From: Markus Stockhausen Date: Sun, 28 Jun 2026 09:05:02 +0000 (+0200) Subject: realtek: l3: cleanup headers X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=867afa0e0375d485d49ae7faf6b7aed6cf79981a;p=thirdparty%2Fopenwrt.git realtek: l3: cleanup headers 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 --- 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 f82e36ac20d..749f0d6edfa 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 @@ -15,6 +15,12 @@ #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; 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 ebdedcac205..0b02bdace94 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 @@ -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); 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 863c3603bf3..4072047bd17 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 @@ -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,