From: Markus Stockhausen Date: Sun, 28 Jun 2026 07:21:37 +0000 (+0200) Subject: realtek: l3: move host_route_use_bm to layer 3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=55cf68c52c381776e0bcb05731996181f050ea2e;p=thirdparty%2Fopenwrt.git 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 --- 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 1d8390da3cb..deef903306a 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 @@ -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); 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 1440b7c0edf..f780e6e4248 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 @@ -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 { 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 393ad060cb5..4f172a4835d 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 @@ -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];