realtek: dsa: drop priv->id

There is only one check left for that attribute in rtldsa_port_mdb_add().
Split the consumer into device specific implementations and remove the
attribute from the private structure.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22794
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Markus Stockhausen 2026-04-05 10:38:38 +02:00 committed by Robert Marko
parent 1aedb2af54
commit 7f94645fef
3 changed files with 11 additions and 10 deletions

View File

@ -1558,7 +1558,6 @@ static int rtl83xx_sw_probe(struct platform_device *pdev)
return err;
priv->family_id = soc_info.family;
priv->id = soc_info.id;
sw_w32(0, priv->r->spanning_tree_ctrl);
priv->irq_mask = GENMASK_ULL(priv->r->cpu_port - 1, 0);

View File

@ -2056,9 +2056,9 @@ static bool rtldsa_mac_is_unsnoop(const unsigned char *addr)
return false;
}
static int rtldsa_port_mdb_add(struct dsa_switch *ds, int port,
const struct switchdev_obj_port_mdb *mdb,
const struct dsa_db db)
static int rtldsa_83xx_port_mdb_add(struct dsa_switch *ds, int port,
const struct switchdev_obj_port_mdb *mdb,
const struct dsa_db db)
{
struct rtl838x_switch_priv *priv = ds->priv;
u64 mac = ether_addr_to_u64(mdb->addr);
@ -2068,9 +2068,6 @@ static int rtldsa_port_mdb_add(struct dsa_switch *ds, int port,
u64 seed = priv->r->l2_hash_seed(mac, vid);
int mc_group;
if (priv->id >= 0x9300)
return -EOPNOTSUPP;
pr_debug("In %s port %d, mac %llx, vid: %d\n", __func__, port, mac, vid);
if (priv->lag_non_primary & BIT_ULL(port)) {
@ -2138,6 +2135,12 @@ out:
return err;
}
static int rtldsa_93xx_port_mdb_add(struct dsa_switch *ds, int port,
const struct switchdev_obj_port_mdb *mdb,
const struct dsa_db db)
{
return -EOPNOTSUPP;
}
static int rtldsa_port_mdb_del(struct dsa_switch *ds, int port,
const struct switchdev_obj_port_mdb *mdb,
@ -2656,7 +2659,7 @@ const struct dsa_switch_ops rtldsa_83xx_switch_ops = {
.port_fdb_del = rtldsa_port_fdb_del,
.port_fdb_dump = rtldsa_port_fdb_dump,
.port_mdb_add = rtldsa_port_mdb_add,
.port_mdb_add = rtldsa_83xx_port_mdb_add,
.port_mdb_del = rtldsa_port_mdb_del,
.port_mirror_add = rtldsa_port_mirror_add,
@ -2716,7 +2719,7 @@ const struct dsa_switch_ops rtldsa_93xx_switch_ops = {
.port_fdb_del = rtldsa_port_fdb_del,
.port_fdb_dump = rtldsa_port_fdb_dump,
.port_mdb_add = rtldsa_port_mdb_add,
.port_mdb_add = rtldsa_93xx_port_mdb_add,
.port_mdb_del = rtldsa_port_mdb_del,
.port_mirror_add = rtldsa_port_mirror_add,

View File

@ -1516,7 +1516,6 @@ struct rtl838x_switch_priv {
/* Switch operation */
struct dsa_switch *ds;
struct device *dev;
u16 id;
u16 family_id;
struct rtldsa_port ports[57];
struct mutex reg_mutex; /* Mutex for individual register manipulations */