From: Markus Stockhausen Date: Sun, 28 Jun 2026 16:45:08 +0000 (+0200) Subject: realtek: l3: move route_use_bm to layer 3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=efe23afc8b77d83e0239327c3bff34c4ff3fa1a5;p=thirdparty%2Fopenwrt.git realtek: l3: move route_use_bm to layer 3 This is another variable that belongs to the layer 3 code. Link: https://github.com/openwrt/openwrt/pull/23979 Signed-off-by: Markus Stockhausen --- diff --git a/target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/l3.c b/target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/l3.c index 59b2cb9989f..9ea70949d96 100644 --- a/target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/l3.c +++ b/target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/l3.c @@ -825,7 +825,7 @@ static int otto_l3_930x_setup(struct otto_l3_ctrl *ctrl) /* PORT_ISO_RESTRICT_ROUTE_CTRL? */ /* Do not use prefix route 0 because of HW limitations */ - set_bit(0, priv->route_use_bm); + set_bit(0, ctrl->route_use_bm); return 0; } @@ -986,7 +986,6 @@ static int otto_l3_port_ipv4_resolve(struct otto_l3_ctrl *ctrl, static void otto_l3_route_remove(struct otto_l3_ctrl *ctrl, struct otto_l3_route *r) { - struct rtl838x_switch_priv *priv = ctrl->priv; int id; if (rhltable_remove(&ctrl->routes, &r->linkage, otto_l3_route_ht_params)) @@ -1006,7 +1005,7 @@ static void otto_l3_route_remove(struct otto_l3_ctrl *ctrl, struct otto_l3_route r->attr.valid = false; ctrl->cfg->route_write(ctrl, id, r); } - clear_bit(r->id, priv->route_use_bm); + clear_bit(r->id, ctrl->route_use_bm); } kfree(r); @@ -1065,7 +1064,7 @@ static struct otto_l3_route *otto_l3_route_alloc(struct otto_l3_ctrl *ctrl, u32 mutex_lock(&priv->reg_mutex); - idx = find_first_zero_bit(priv->route_use_bm, MAX_ROUTES); + idx = find_first_zero_bit(ctrl->route_use_bm, MAX_ROUTES); dev_dbg(ctrl->dev, "id: %d, ip %pI4\n", idx, &ip); r = kzalloc(sizeof(*r), GFP_KERNEL); @@ -1086,7 +1085,7 @@ static struct otto_l3_route *otto_l3_route_alloc(struct otto_l3_ctrl *ctrl, u32 goto out_free; } - set_bit(idx, priv->route_use_bm); + set_bit(idx, ctrl->route_use_bm); mutex_unlock(&priv->reg_mutex); diff --git a/target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/l3.h b/target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/l3.h index 1d5dc87dde2..a318dbdaba5 100644 --- a/target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/l3.h +++ b/target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/l3.h @@ -6,6 +6,7 @@ #include "rtl-otto.h" #define MAX_HOST_ROUTES 1536 +#define MAX_ROUTES 512 #define MAX_INTERFACES 100 #define HASH_PICK(val, lsb, len) ((val & (((1 << len) - 1) << lsb)) >> lsb) @@ -106,6 +107,7 @@ struct otto_l3_ctrl { struct notifier_block fib_nb; struct notifier_block ne_nb; struct rhltable routes; + unsigned long route_use_bm[MAX_ROUTES / 32]; unsigned long host_route_use_bm[MAX_HOST_ROUTES / 32]; struct otto_l3_intf *interfaces[MAX_INTERFACES]; }; diff --git a/target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/rtl-otto.h b/target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/rtl-otto.h index 318f5903153..4ff7bb50c30 100644 --- a/target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/rtl-otto.h +++ b/target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/rtl-otto.h @@ -870,7 +870,6 @@ typedef enum { #define N_FIXED_FIELDS 12 #define N_FIXED_FIELDS_RTL931X 14 #define MAX_COUNTERS 2048 -#define MAX_ROUTES 512 #define MAX_INTF_MTUS 8 #define DEFAULT_MTU 1536 #define MAX_ROUTER_MACS 64 @@ -1459,7 +1458,6 @@ struct rtl838x_switch_priv { unsigned long pie_use_bm[MAX_PIE_ENTRIES >> 5]; 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]; u16 intf_mtus[MAX_INTF_MTUS]; int intf_mtu_count[MAX_INTF_MTUS];