realtek: l3: move host_route_use_bm to layer 3

This is another layer 3 specific attribute. Move it to its new home.

Link: https://github.com/openwrt/openwrt/pull/23979
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
This commit is contained in:
Markus Stockhausen committed 2026-06-29 18:17:07 +02:00
1 parent f4ddf8d7ef
commit 55cf68c52c
3 files changed
+6 -5

No files matched your search

@@ -668,7 +668,7 @@ static void otto_l3_route_remove(struct otto_l3_ctrl *ctrl, struct otto_l3_route
dev_dbg(ctrl->dev, "Got id for host route: %d\n", id);
r->attr.valid = false;
priv->r->host_route_write(id, r);
clear_bit(r->id - MAX_ROUTES, priv->host_route_use_bm);
clear_bit(r->id - MAX_ROUTES, ctrl->host_route_use_bm);
} else {
/* If there is a HW representation of the route, delete it */
if (ctrl->cfg->route_lookup_hw) {
@@ -691,7 +691,7 @@ static struct otto_l3_route *otto_l3_host_route_alloc(struct otto_l3_ctrl *ctrl,
mutex_lock(&priv->reg_mutex);
idx = find_first_zero_bit(priv->host_route_use_bm, MAX_HOST_ROUTES);
idx = find_first_zero_bit(ctrl->host_route_use_bm, MAX_HOST_ROUTES);
dev_dbg(ctrl->dev, "id: %d, ip %pI4\n", idx, &ip);
r = kzalloc(sizeof(*r), GFP_KERNEL);
@@ -716,7 +716,7 @@ static struct otto_l3_route *otto_l3_host_route_alloc(struct otto_l3_ctrl *ctrl,
goto out_free;
}
set_bit(idx, priv->host_route_use_bm);
set_bit(idx, ctrl->host_route_use_bm);
mutex_unlock(&priv->reg_mutex);
@@ -5,6 +5,8 @@
#include "rtl-otto.h"
#define MAX_HOST_ROUTES 1536
/* An entry in the RTL93XX SoC's ROUTER_MAC tables setting up a termination point
* for the L3 routing system. Packets arriving and matching an entry in this table
* will be considered for routing.
@@ -42,6 +44,7 @@ struct otto_l3_ctrl {
struct notifier_block fib_nb;
struct notifier_block ne_nb;
struct rhltable routes;
unsigned long host_route_use_bm[MAX_HOST_ROUTES / 32];
};
struct otto_l3_route_attr {
@@ -871,7 +871,6 @@ typedef enum {
#define N_FIXED_FIELDS_RTL931X 14
#define MAX_COUNTERS 2048
#define MAX_ROUTES 512
#define MAX_HOST_ROUTES 1536
#define MAX_INTF_MTUS 8
#define DEFAULT_MTU 1536
#define MAX_INTERFACES 100
@@ -1485,7 +1484,6 @@ struct rtl838x_switch_priv {
unsigned long octet_cntr_use_bm[MAX_COUNTERS >> 5];
unsigned long packet_cntr_use_bm[MAX_COUNTERS >> 4];
unsigned long route_use_bm[MAX_ROUTES >> 5];
unsigned long host_route_use_bm[MAX_HOST_ROUTES >> 5];
struct rtl838x_l3_intf *interfaces[MAX_INTERFACES];
u16 intf_mtus[MAX_INTF_MTUS];
int intf_mtu_count[MAX_INTF_MTUS];