]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: l3: move host_route_use_bm to layer 3
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Sun, 28 Jun 2026 07:21:37 +0000 (09:21 +0200)
committerMarkus Stockhausen <markus.stockhausen@gmx.de>
Mon, 29 Jun 2026 16:17:07 +0000 (18:17 +0200)
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>
target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/l3.c
target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/l3.h
target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/rtl-otto.h

index 1d8390da3cb41355a771359f9ece8bd1c65863f3..deef903306a4ae42b1325c60de0c556d5e1ff60e 100644 (file)
@@ -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);
 
index 1440b7c0edf2139c4ce68f8482cd1b8cae4b5dbf..f780e6e4248451c075e82e91cadbdb3886440ef4 100644 (file)
@@ -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 {
index 393ad060cb54488471d13e2de1b6217e5447518f..4f172a4835dc3a7b099a4140822f604d2539c480 100644 (file)
@@ -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];