realtek: 6.6: change to 6.1 dsa structures
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Tue, 13 Aug 2024 17:17:33 +0000 (13:17 -0400)
committerSander Vanheule <sander@svanheule.net>
Sat, 14 Sep 2024 18:02:52 +0000 (20:02 +0200)
The DSA framework has changed a bit since 5.15, lets adapt to match.
Currently there is no one-patch-fits-all solution to directly fix
all errors up to 6.6. So at least take all the already known changes
that cover differences between 5.15 and 6.1

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 <oliver@schinagl.nl>
[align updates with upstream, add references to upstream commits]
Signed-off-by: Sander Vanheule <sander@svanheule.net>
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/dsa.c

index 9eb444515f46b343ea15e718b0f36b061712b0ed..24c36439296e0597cbb810b3d9ab1e08d7deb2d7 100644 (file)
@@ -1127,7 +1127,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;
@@ -1146,7 +1148,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);
@@ -1174,7 +1176,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;
@@ -1189,7 +1191,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);
@@ -1595,7 +1597,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);
@@ -1637,7 +1640,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);
@@ -1710,7 +1714,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);
@@ -1785,7 +1790,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);
@@ -1837,7 +1843,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;
@@ -1997,20 +2003,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) {
@@ -2019,7 +2027,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;
@@ -2042,7 +2050,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;