From: Markus Stockhausen Date: Sat, 27 Jun 2026 11:48:59 +0000 (+0200) Subject: realtek: l3: add device specific configuration X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c6df98aecbcc61f91d7de7a164048f79dca89be5;p=thirdparty%2Fopenwrt.git realtek: l3: add device specific configuration All the layer 3 device specific functions and attributes currently live in the DSA driver. Add a configuration structure to the layer 3 code. For now provide and fill a dummy value. It will be replaced with meaningful data with the next patches. Link: https://github.com/openwrt/openwrt/pull/23963 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 86b407d8207..305d9e8beb8 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 @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -697,6 +698,30 @@ static int otto_l3_netevent_notifier(struct notifier_block *this, unsigned long return NOTIFY_DONE; } +const struct otto_l3_config otto_l3_838x_cfg = { + ._dummy = 8380, +}; + +const struct otto_l3_config otto_l3_839x_cfg = { + ._dummy = 8390, +}; + +const struct otto_l3_config otto_l3_930x_cfg = { + ._dummy = 9300, +}; + +const struct otto_l3_config otto_l3_931x_cfg = { + ._dummy = 9310, +}; + +static const struct of_device_id otto_l3_of_ids[] = { + { .compatible = "realtek,rtl8380-switch", .data = &otto_l3_838x_cfg, }, + { .compatible = "realtek,rtl8392-switch", .data = &otto_l3_839x_cfg, }, + { .compatible = "realtek,rtl9301-switch", .data = &otto_l3_930x_cfg, }, + { .compatible = "realtek,rtl9311-switch", .data = &otto_l3_931x_cfg, }, + { /* sentinel */ } +}; + void otto_l3_remove(struct rtl838x_switch_priv *priv) { struct otto_l3_ctrl *ctrl = priv->l3_ctrl; @@ -713,6 +738,7 @@ void otto_l3_remove(struct rtl838x_switch_priv *priv) int otto_l3_probe(struct device *dev, struct rtl838x_switch_priv *priv) { + const struct of_device_id *match; struct otto_l3_ctrl *ctrl; int err; @@ -723,6 +749,11 @@ int otto_l3_probe(struct device *dev, struct rtl838x_switch_priv *priv) ctrl->priv = priv; ctrl->dev = priv->dev; + match = of_match_node(otto_l3_of_ids, dev->of_node); + if (!match) + return dev_err_probe(dev, -EINVAL, "No compatible configuration found\n"); + ctrl->cfg = match->data; + /* Initialize hash table for L3 routing */ rhltable_init(&ctrl->routes, &otto_l3_route_ht_params); 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 8894075c0f8..4ab71dea98f 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,7 +5,12 @@ #include "rtl-otto.h" +struct otto_l3_config { + int _dummy; +}; + struct otto_l3_ctrl { + const struct otto_l3_config *cfg; struct device *dev; struct rtl838x_switch_priv *priv; struct notifier_block fib_nb;