From d369f043c79eca97edd24e2ccf8f0a5af3595034 Mon Sep 17 00:00:00 2001 From: Olliver Schinagl Date: Thu, 25 May 2023 13:41:15 +0200 Subject: [PATCH] realtek: 6.1: change to new dsa structures The DSA framework has changed a bit since 5.15, lets adapt to match. Most notable upstream changes are: - d3eed0e57d5d ("net: dsa: keep the bridge_dev and bridge_num as part of the same structure") Update of port_bridge_{join,leave}: use same helper as upstream - c26933639b54 ("net: dsa: request drivers to perform FDB isolation") Update of port_fdb_{add,del}, port_mdb_{add,del} - dedd6a009f41 ("net: dsa: create a dsa_lag structure") Update of port_lag_{join,leave} Signed-off-by: Olliver Schinagl [align updates with upstream, add references to upstream commits] Signed-off-by: Sander Vanheule --- .../files-6.1/drivers/net/dsa/rtl83xx/dsa.c | 40 +++++++++++-------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/target/linux/realtek/files-6.1/drivers/net/dsa/rtl83xx/dsa.c b/target/linux/realtek/files-6.1/drivers/net/dsa/rtl83xx/dsa.c index a5b8ccea1c..1d39828665 100644 --- a/target/linux/realtek/files-6.1/drivers/net/dsa/rtl83xx/dsa.c +++ b/target/linux/realtek/files-6.1/drivers/net/dsa/rtl83xx/dsa.c @@ -1142,7 +1142,9 @@ static int rtl83xx_set_ageing_time(struct dsa_switch *ds, unsigned int msec) } static int rtl83xx_port_bridge_join(struct dsa_switch *ds, int port, - struct net_device *bridge) + struct dsa_bridge bridge, + bool *tx_fwd_offload, + struct netlink_ext_ack *extack) { struct rtl838x_switch_priv *priv = ds->priv; u64 port_bitmap = BIT_ULL(priv->cpu_port), v; @@ -1161,7 +1163,7 @@ static int rtl83xx_port_bridge_join(struct dsa_switch *ds, int port, * and not being setup until the port becomes enabled. */ if (dsa_is_user_port(ds, i) && !priv->is_lagmember[i] && i != port) { - if (dsa_to_port(ds, i)->bridge_dev != bridge) + if (!dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge)) continue; if (priv->ports[i].enable) priv->r->traffic_enable(i, port); @@ -1189,7 +1191,7 @@ static int rtl83xx_port_bridge_join(struct dsa_switch *ds, int port, } static void rtl83xx_port_bridge_leave(struct dsa_switch *ds, int port, - struct net_device *bridge) + struct dsa_bridge bridge) { struct rtl838x_switch_priv *priv = ds->priv; u64 port_bitmap = 0, v; @@ -1204,7 +1206,7 @@ static void rtl83xx_port_bridge_leave(struct dsa_switch *ds, int port, * other port is still a VLAN-aware port. */ if (dsa_is_user_port(ds, i) && i != port) { - if (dsa_to_port(ds, i)->bridge_dev != bridge) + if (!dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge)) continue; if (priv->ports[i].enable) priv->r->traffic_disable(i, port); @@ -1610,7 +1612,8 @@ static int rtl83xx_find_l2_cam_entry(struct rtl838x_switch_priv *priv, u64 seed, } static int rtl83xx_port_fdb_add(struct dsa_switch *ds, int port, - const unsigned char *addr, u16 vid) + const unsigned char *addr, u16 vid, + const struct dsa_db db) { struct rtl838x_switch_priv *priv = ds->priv; u64 mac = ether_addr_to_u64(addr); @@ -1652,7 +1655,8 @@ out: } static int rtl83xx_port_fdb_del(struct dsa_switch *ds, int port, - const unsigned char *addr, u16 vid) + const unsigned char *addr, u16 vid, + const struct dsa_db db) { struct rtl838x_switch_priv *priv = ds->priv; u64 mac = ether_addr_to_u64(addr); @@ -1725,7 +1729,8 @@ static int rtl83xx_port_fdb_dump(struct dsa_switch *ds, int port, } static int rtl83xx_port_mdb_add(struct dsa_switch *ds, int port, - const struct switchdev_obj_port_mdb *mdb) + 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); @@ -1800,7 +1805,8 @@ out: } int rtl83xx_port_mdb_del(struct dsa_switch *ds, int port, - const struct switchdev_obj_port_mdb *mdb) + 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); @@ -1852,7 +1858,7 @@ out: static int rtl83xx_port_mirror_add(struct dsa_switch *ds, int port, struct dsa_mall_mirror_tc_entry *mirror, - bool ingress) + bool ingress, struct netlink_ext_ack *extack) { /* We support 4 mirror groups, one destination port per group */ int group; @@ -2012,20 +2018,22 @@ static int rtl83xx_port_lag_change(struct dsa_switch *ds, int port) return 0; } -static int rtl83xx_port_lag_join(struct dsa_switch *ds, int port, - struct net_device *lag, - struct netdev_lag_upper_info *info) +static int rtl83xx_port_lag_join(struct dsa_switch *ds, + int port, + struct dsa_lag lag, + struct netdev_lag_upper_info *info, + struct netlink_ext_ack *extack) { struct rtl838x_switch_priv *priv = ds->priv; int i, err = 0; - if (!rtl83xx_lag_can_offload(ds, lag, info)) + if (!rtl83xx_lag_can_offload(ds, lag.dev, info)) return -EOPNOTSUPP; mutex_lock(&priv->reg_mutex); for (i = 0; i < priv->n_lags; i++) { - if ((!priv->lag_devs[i]) || (priv->lag_devs[i] == lag)) + if ((!priv->lag_devs[i]) || (priv->lag_devs[i] == lag.dev)) break; } if (port >= priv->cpu_port) { @@ -2034,7 +2042,7 @@ static int rtl83xx_port_lag_join(struct dsa_switch *ds, int port, } pr_info("port_lag_join: group %d, port %d\n",i, port); if (!priv->lag_devs[i]) - priv->lag_devs[i] = lag; + priv->lag_devs[i] = lag.dev; if (priv->lag_primary[i] == -1) { priv->lag_primary[i] = port; @@ -2057,7 +2065,7 @@ out: } static int rtl83xx_port_lag_leave(struct dsa_switch *ds, int port, - struct net_device *lag) + struct dsa_lag lag) { int i, group = -1, err; struct rtl838x_switch_priv *priv = ds->priv; -- 2.30.2