]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: l3: cleanup headers
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Sun, 28 Jun 2026 09:05:02 +0000 (11:05 +0200)
committerMarkus Stockhausen <markus.stockhausen@gmx.de>
Mon, 29 Jun 2026 16:17:08 +0000 (18:17 +0200)
With all the code relocation it is time to clean the headers.

- otto_l3_route_ht_params is internal and can be moved to l3.c
- otto_l3_route is no longer needed in rtl-otto.h
- additionally reorder structures to avoid forward declarations

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 f82e36ac20d77331a3a15166eacd3b81c45ac38a..749f0d6edfaefaf9b06b4d6dba559f1da851b22f 100644 (file)
 #include "l3.h"
 #include "rtl-otto.h"
 
+static const struct rhashtable_params otto_l3_route_ht_params = {
+       .key_len     = sizeof(u32),
+       .key_offset  = offsetof(struct otto_l3_route, gw_ip),
+       .head_offset = offsetof(struct otto_l3_route, linkage),
+};
+
 struct otto_l3_net_event_work {
        struct work_struct work;
        struct otto_l3_ctrl *ctrl;
index ebdedcac205df16d5b1a138699eabe716b06dfe0..0b02bdace949e2c7352d9feef2957d982e2194a4 100644 (file)
@@ -44,31 +44,6 @@ struct otto_l3_intf {
        u8 ip6_pbr_icmp_redirect;
 };
 
-struct otto_l3_config {
-       int (*find_slot)(struct otto_l3_ctrl *ctrl, struct otto_l3_route *rt, bool must_exist);
-       void (*set_egress_intf)(struct otto_l3_ctrl *ctrl, int idx, struct otto_l3_intf *intf);
-       u64 (*get_egress_mac)(struct otto_l3_ctrl *ctrl, u32 idx);
-       void (*host_route_write)(struct otto_l3_ctrl *ctrl, int idx, struct otto_l3_route *rt);
-       void (*get_router_mac)(struct otto_l3_ctrl *ctrl, u32 idx, struct otto_l3_router_mac *m);
-       void (*set_router_mac)(struct otto_l3_ctrl *ctrl, u32 idx, struct otto_l3_router_mac *m);
-       void (*get_nexthop)(struct otto_l3_ctrl *ctrl, int idx, u16 *dmac_id, u16 *interface);
-       void (*set_nexthop)(struct otto_l3_ctrl *ctrl, int idx, u16 dmac_id, u16 interface);
-       int (*route_lookup_hw)(struct otto_l3_ctrl *ctrl, struct otto_l3_route *rt);
-       void (*route_read)(struct otto_l3_ctrl *ctrl, int idx, struct otto_l3_route *rt);
-       void (*route_write)(struct otto_l3_ctrl *ctrl, int idx, struct otto_l3_route *rt);
-};
-
-struct otto_l3_ctrl {
-       const struct otto_l3_config *cfg;
-       struct device *dev;
-       struct rtl838x_switch_priv *priv;
-       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_intf *interfaces[MAX_INTERFACES];
-};
-
 struct otto_l3_route_attr {
        bool valid;
        bool hit;
@@ -108,10 +83,29 @@ struct otto_l3_route {
        struct otto_l3_route_attr attr;
 };
 
-static const struct rhashtable_params otto_l3_route_ht_params = {
-       .key_len     = sizeof(u32),
-       .key_offset  = offsetof(struct otto_l3_route, gw_ip),
-       .head_offset = offsetof(struct otto_l3_route, linkage),
+struct otto_l3_config {
+       int (*find_slot)(struct otto_l3_ctrl *ctrl, struct otto_l3_route *rt, bool must_exist);
+       void (*set_egress_intf)(struct otto_l3_ctrl *ctrl, int idx, struct otto_l3_intf *intf);
+       u64 (*get_egress_mac)(struct otto_l3_ctrl *ctrl, u32 idx);
+       void (*host_route_write)(struct otto_l3_ctrl *ctrl, int idx, struct otto_l3_route *rt);
+       void (*get_router_mac)(struct otto_l3_ctrl *ctrl, u32 idx, struct otto_l3_router_mac *m);
+       void (*set_router_mac)(struct otto_l3_ctrl *ctrl, u32 idx, struct otto_l3_router_mac *m);
+       void (*get_nexthop)(struct otto_l3_ctrl *ctrl, int idx, u16 *dmac_id, u16 *interface);
+       void (*set_nexthop)(struct otto_l3_ctrl *ctrl, int idx, u16 dmac_id, u16 interface);
+       int (*route_lookup_hw)(struct otto_l3_ctrl *ctrl, struct otto_l3_route *rt);
+       void (*route_read)(struct otto_l3_ctrl *ctrl, int idx, struct otto_l3_route *rt);
+       void (*route_write)(struct otto_l3_ctrl *ctrl, int idx, struct otto_l3_route *rt);
+};
+
+struct otto_l3_ctrl {
+       const struct otto_l3_config *cfg;
+       struct device *dev;
+       struct rtl838x_switch_priv *priv;
+       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_intf *interfaces[MAX_INTERFACES];
 };
 
 int otto_l3_probe(struct device *dev, struct rtl838x_switch_priv *priv);
index 863c3603bf39f94d0b0e350c2436b72837940e21..4072047bd175438ed8b72b6f61d9e4c27bdf7458 100644 (file)
@@ -896,8 +896,6 @@ typedef enum {
  */
 #define RTLDSA_COUNTERS_FAST_POLL_INTERVAL     (3 * HZ)
 
-struct otto_l3_route;
-
 enum pbvlan_type {
        PBVLAN_TYPE_INNER = 0,
        PBVLAN_TYPE_OUTER,