net: dsa: pass extack to .port_bridge_join driver methods
authorVladimir Oltean <vladimir.oltean@nxp.com>
Fri, 25 Feb 2022 09:22:23 +0000 (11:22 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 27 Feb 2022 11:06:14 +0000 (11:06 +0000)
As FDB isolation cannot be enforced between VLAN-aware bridges in lack
of hardware assistance like extra FID bits, it seems plausible that many
DSA switches cannot do it. Therefore, they need to reject configurations
with multiple VLAN-aware bridges from the two code paths that can
transition towards that state:

- joining a VLAN-aware bridge
- toggling VLAN awareness on an existing bridge

The .port_vlan_filtering method already propagates the netlink extack to
the driver, let's propagate it from .port_bridge_join too, to make sure
that the driver can use the same function for both.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
19 files changed:
drivers/net/dsa/b53/b53_common.c
drivers/net/dsa/b53/b53_priv.h
drivers/net/dsa/dsa_loop.c
drivers/net/dsa/hirschmann/hellcreek.c
drivers/net/dsa/lan9303-core.c
drivers/net/dsa/lantiq_gswip.c
drivers/net/dsa/microchip/ksz_common.c
drivers/net/dsa/microchip/ksz_common.h
drivers/net/dsa/mt7530.c
drivers/net/dsa/mv88e6xxx/chip.c
drivers/net/dsa/ocelot/felix.c
drivers/net/dsa/qca8k.c
drivers/net/dsa/realtek/rtl8366rb.c
drivers/net/dsa/sja1105/sja1105_main.c
drivers/net/dsa/xrs700x/xrs700x.c
include/net/dsa.h
net/dsa/dsa_priv.h
net/dsa/port.c
net/dsa/switch.c

index a8cc6e182c45ca9f1abdae08933c787b7524aa18..122e6376297901d2e607e36613d40e9ac8c3c61d 100644 (file)
@@ -1869,7 +1869,7 @@ int b53_mdb_del(struct dsa_switch *ds, int port,
 EXPORT_SYMBOL(b53_mdb_del);
 
 int b53_br_join(struct dsa_switch *ds, int port, struct dsa_bridge bridge,
-               bool *tx_fwd_offload)
+               bool *tx_fwd_offload, struct netlink_ext_ack *extack)
 {
        struct b53_device *dev = ds->priv;
        s8 cpu_port = dsa_to_port(ds, port)->cpu_dp->index;
index d3091f0ad3e67209d653f448d00e827c130bbe5b..86e7eb7924e750b4a291290bb3c94dd3c53a79bd 100644 (file)
@@ -324,7 +324,7 @@ void b53_get_ethtool_stats(struct dsa_switch *ds, int port, uint64_t *data);
 int b53_get_sset_count(struct dsa_switch *ds, int port, int sset);
 void b53_get_ethtool_phy_stats(struct dsa_switch *ds, int port, uint64_t *data);
 int b53_br_join(struct dsa_switch *ds, int port, struct dsa_bridge bridge,
-               bool *tx_fwd_offload);
+               bool *tx_fwd_offload, struct netlink_ext_ack *extack);
 void b53_br_leave(struct dsa_switch *ds, int port, struct dsa_bridge bridge);
 void b53_br_set_stp_state(struct dsa_switch *ds, int port, u8 state);
 void b53_br_fast_age(struct dsa_switch *ds, int port);
index 33daaf10c488146640d586cd05ce19d0006109da..263e41191c2926c931aac16239740dd35ab5a6f5 100644 (file)
@@ -168,7 +168,8 @@ static int dsa_loop_phy_write(struct dsa_switch *ds, int port,
 
 static int dsa_loop_port_bridge_join(struct dsa_switch *ds, int port,
                                     struct dsa_bridge bridge,
-                                    bool *tx_fwd_offload)
+                                    bool *tx_fwd_offload,
+                                    struct netlink_ext_ack *extack)
 {
        dev_dbg(ds->dev, "%s: port: %d, bridge: %s\n",
                __func__, port, bridge.dev->name);
index cb89be9de43a762f91361b906e2d0e53b9e1d4f3..ac1f3b3a7040371c3154fd2a0eda20541d2fcf3a 100644 (file)
@@ -675,7 +675,8 @@ static int hellcreek_bridge_flags(struct dsa_switch *ds, int port,
 
 static int hellcreek_port_bridge_join(struct dsa_switch *ds, int port,
                                      struct dsa_bridge bridge,
-                                     bool *tx_fwd_offload)
+                                     bool *tx_fwd_offload,
+                                     struct netlink_ext_ack *extack)
 {
        struct hellcreek *hellcreek = ds->priv;
 
index a21184e7fcb6c2af4aa559b4c7f763e66e8fd32e..e03ff1f267bba3b2339dde31eb123812474409b6 100644 (file)
@@ -1111,7 +1111,8 @@ static void lan9303_port_disable(struct dsa_switch *ds, int port)
 
 static int lan9303_port_bridge_join(struct dsa_switch *ds, int port,
                                    struct dsa_bridge bridge,
-                                   bool *tx_fwd_offload)
+                                   bool *tx_fwd_offload,
+                                   struct netlink_ext_ack *extack)
 {
        struct lan9303 *chip = ds->priv;
 
index 3dfb532b7784a4de5986839725180ee6f10b4b9d..a8bd233f3cb9050430df9d3587cb5b805dffbf76 100644 (file)
@@ -1152,7 +1152,8 @@ static int gswip_vlan_remove(struct gswip_priv *priv,
 
 static int gswip_port_bridge_join(struct dsa_switch *ds, int port,
                                  struct dsa_bridge bridge,
-                                 bool *tx_fwd_offload)
+                                 bool *tx_fwd_offload,
+                                 struct netlink_ext_ack *extack)
 {
        struct net_device *br = bridge.dev;
        struct gswip_priv *priv = ds->priv;
index 104458ec9cbc09e149a0428bd2eed69f2e781978..8014b18d93914f4564aef1324a2bad7e42470cde 100644 (file)
@@ -217,7 +217,8 @@ EXPORT_SYMBOL_GPL(ksz_get_ethtool_stats);
 
 int ksz_port_bridge_join(struct dsa_switch *ds, int port,
                         struct dsa_bridge bridge,
-                        bool *tx_fwd_offload)
+                        bool *tx_fwd_offload,
+                        struct netlink_ext_ack *extack)
 {
        /* port_stp_state_set() will be called after to put the port in
         * appropriate state so there is no need to do anything.
index 66933445a44712cc6edcc445c96d8a6842255062..4ff0a159ce3c707e711b0f1c7b0aa9853fed505c 100644 (file)
@@ -159,7 +159,8 @@ void ksz_mac_link_down(struct dsa_switch *ds, int port, unsigned int mode,
 int ksz_sset_count(struct dsa_switch *ds, int port, int sset);
 void ksz_get_ethtool_stats(struct dsa_switch *ds, int port, uint64_t *buf);
 int ksz_port_bridge_join(struct dsa_switch *ds, int port,
-                        struct dsa_bridge bridge, bool *tx_fwd_offload);
+                        struct dsa_bridge bridge, bool *tx_fwd_offload,
+                        struct netlink_ext_ack *extack);
 void ksz_port_bridge_leave(struct dsa_switch *ds, int port,
                           struct dsa_bridge bridge);
 void ksz_port_fast_age(struct dsa_switch *ds, int port);
index abe63ec0506695555f1a16fadb138103783ed826..66b00c19ebe0dd473aec0dfe417a56d0303fc44f 100644 (file)
@@ -1186,7 +1186,8 @@ mt7530_port_bridge_flags(struct dsa_switch *ds, int port,
 
 static int
 mt7530_port_bridge_join(struct dsa_switch *ds, int port,
-                       struct dsa_bridge bridge, bool *tx_fwd_offload)
+                       struct dsa_bridge bridge, bool *tx_fwd_offload,
+                       struct netlink_ext_ack *extack)
 {
        struct dsa_port *dp = dsa_to_port(ds, port), *other_dp;
        u32 port_bitmap = BIT(MT7530_CPU_PORT);
index d79c65bb227e2ac91ad88ca5b6a81c641e7b3c5d..84b90fc36c582d571680c7748b979ba0d44e181b 100644 (file)
@@ -2618,7 +2618,8 @@ static int mv88e6xxx_map_virtual_bridge_to_pvt(struct dsa_switch *ds,
 
 static int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port,
                                      struct dsa_bridge bridge,
-                                     bool *tx_fwd_offload)
+                                     bool *tx_fwd_offload,
+                                     struct netlink_ext_ack *extack)
 {
        struct mv88e6xxx_chip *chip = ds->priv;
        int err;
@@ -2684,7 +2685,8 @@ static void mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port,
 
 static int mv88e6xxx_crosschip_bridge_join(struct dsa_switch *ds,
                                           int tree_index, int sw_index,
-                                          int port, struct dsa_bridge bridge)
+                                          int port, struct dsa_bridge bridge,
+                                          struct netlink_ext_ack *extack)
 {
        struct mv88e6xxx_chip *chip = ds->priv;
        int err;
index 4d3b0ba190e237312c9d1072fb7358b9ca10c18d..c2e0d2be5fe3a3680abecb39ea8b1d1af8c31e6d 100644 (file)
@@ -674,7 +674,8 @@ static int felix_bridge_flags(struct dsa_switch *ds, int port,
 }
 
 static int felix_bridge_join(struct dsa_switch *ds, int port,
-                            struct dsa_bridge bridge, bool *tx_fwd_offload)
+                            struct dsa_bridge bridge, bool *tx_fwd_offload,
+                            struct netlink_ext_ack *extack)
 {
        struct ocelot *ocelot = ds->priv;
 
index 95104ae954ba1107676e7d61f2d66061ac89670a..ee0dbf32426855c7f35c96c96aabde8353ff773c 100644 (file)
@@ -2247,7 +2247,8 @@ qca8k_port_stp_state_set(struct dsa_switch *ds, int port, u8 state)
 
 static int qca8k_port_bridge_join(struct dsa_switch *ds, int port,
                                  struct dsa_bridge bridge,
-                                 bool *tx_fwd_offload)
+                                 bool *tx_fwd_offload,
+                                 struct netlink_ext_ack *extack)
 {
        struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv;
        int port_mask, cpu_port;
index fb6565e6840118c1f8cc440a9e2e6bd6c219e163..1a3406b9e64c9ac14821fc264010867b5c82c7ef 100644 (file)
@@ -1189,7 +1189,8 @@ rtl8366rb_port_disable(struct dsa_switch *ds, int port)
 static int
 rtl8366rb_port_bridge_join(struct dsa_switch *ds, int port,
                           struct dsa_bridge bridge,
-                          bool *tx_fwd_offload)
+                          bool *tx_fwd_offload,
+                          struct netlink_ext_ack *extack)
 {
        struct realtek_priv *priv = ds->priv;
        unsigned int port_bitmap = 0;
index 3a5e37c81f8f9b340406c9039324714a5a1e46f2..edcf9b2c7da7480219f8494331cd6e108945fd7d 100644 (file)
@@ -2071,7 +2071,8 @@ static void sja1105_bridge_stp_state_set(struct dsa_switch *ds, int port,
 
 static int sja1105_bridge_join(struct dsa_switch *ds, int port,
                               struct dsa_bridge bridge,
-                              bool *tx_fwd_offload)
+                              bool *tx_fwd_offload,
+                              struct netlink_ext_ack *extack)
 {
        int rc;
 
index bc06fe6bac6b750bb5b9c108082e53b0c0c04b9c..3887ed33c5fe2ab7f3c88701d89fdb2a37461162 100644 (file)
@@ -534,7 +534,8 @@ static int xrs700x_bridge_common(struct dsa_switch *ds, int port,
 }
 
 static int xrs700x_bridge_join(struct dsa_switch *ds, int port,
-                              struct dsa_bridge bridge, bool *tx_fwd_offload)
+                              struct dsa_bridge bridge, bool *tx_fwd_offload,
+                              struct netlink_ext_ack *extack)
 {
        return xrs700x_bridge_common(ds, port, bridge, true);
 }
index 87c5f18eb3817df2923631a4ef75f4190b67a24c..cfedcfb8635049904a524a01f091b8ce01908cab 100644 (file)
@@ -937,7 +937,8 @@ struct dsa_switch_ops {
        int     (*set_ageing_time)(struct dsa_switch *ds, unsigned int msecs);
        int     (*port_bridge_join)(struct dsa_switch *ds, int port,
                                    struct dsa_bridge bridge,
-                                   bool *tx_fwd_offload);
+                                   bool *tx_fwd_offload,
+                                   struct netlink_ext_ack *extack);
        void    (*port_bridge_leave)(struct dsa_switch *ds, int port,
                                     struct dsa_bridge bridge);
        void    (*port_stp_state_set)(struct dsa_switch *ds, int port,
@@ -1021,7 +1022,8 @@ struct dsa_switch_ops {
         */
        int     (*crosschip_bridge_join)(struct dsa_switch *ds, int tree_index,
                                         int sw_index, int port,
-                                        struct dsa_bridge bridge);
+                                        struct dsa_bridge bridge,
+                                        struct netlink_ext_ack *extack);
        void    (*crosschip_bridge_leave)(struct dsa_switch *ds, int tree_index,
                                          int sw_index, int port,
                                          struct dsa_bridge bridge);
index 27575fc3883e543e492ab3f616dc537d4db077a4..07c0ad52395a7467a866d754d0c0a80f9368b406 100644 (file)
@@ -59,6 +59,7 @@ struct dsa_notifier_bridge_info {
        int sw_index;
        int port;
        bool tx_fwd_offload;
+       struct netlink_ext_ack *extack;
 };
 
 /* DSA_NOTIFIER_FDB_* */
index 7af44a28f0326696e236672ebad967d2af568ae9..d9da425a17fb754145953cd3e0c4025cc39ebb4e 100644 (file)
@@ -328,6 +328,7 @@ int dsa_port_bridge_join(struct dsa_port *dp, struct net_device *br,
                .tree_index = dp->ds->dst->index,
                .sw_index = dp->ds->index,
                .port = dp->index,
+               .extack = extack,
        };
        struct net_device *dev = dp->slave;
        struct net_device *brport_dev;
index 1d3c161e31316f9b57b39e72ced5ef50e3322361..327d66bf7b47839f16b1b08d980ef1c9d93ad6a3 100644 (file)
@@ -96,7 +96,8 @@ static int dsa_switch_bridge_join(struct dsa_switch *ds,
                        return -EOPNOTSUPP;
 
                err = ds->ops->port_bridge_join(ds, info->port, info->bridge,
-                                               &info->tx_fwd_offload);
+                                               &info->tx_fwd_offload,
+                                               info->extack);
                if (err)
                        return err;
        }
@@ -105,7 +106,8 @@ static int dsa_switch_bridge_join(struct dsa_switch *ds,
            ds->ops->crosschip_bridge_join) {
                err = ds->ops->crosschip_bridge_join(ds, info->tree_index,
                                                     info->sw_index,
-                                                    info->port, info->bridge);
+                                                    info->port, info->bridge,
+                                                    info->extack);
                if (err)
                        return err;
        }