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 <markus.stockhausen@gmx.de>
This commit is contained in:
Markus Stockhausen committed 2026-06-29 18:17:08 +02:00
1 parent 339db36d97
commit 867afa0e03
3 files changed
+29 -31

No files matched your search

@@ -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;
@@ -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);
@@ -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,