]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
net: dsa: don't disable multicast flooding to the CPU even without an IGMP querier
authorVladimir Oltean <vladimir.oltean@nxp.com>
Fri, 6 Aug 2021 00:20:08 +0000 (03:20 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 6 Aug 2021 10:11:13 +0000 (11:11 +0100)
Commit 08cc83cc7fd8 ("net: dsa: add support for BRIDGE_MROUTER
attribute") added an option for users to turn off multicast flooding
towards the CPU if they turn off the IGMP querier on a bridge which
already has enslaved ports (echo 0 > /sys/class/net/br0/bridge/multicast_router).

And commit a8b659e7ff75 ("net: dsa: act as passthrough for bridge port flags")
simply papered over that issue, because it moved the decision to flood
the CPU with multicast (or not) from the DSA core down to individual drivers,
instead of taking a more radical position then.

The truth is that disabling multicast flooding to the CPU is simply
something we are not prepared to do now, if at all. Some reasons:

- ICMP6 neighbor solicitation messages are unregistered multicast
  packets as far as the bridge is concerned. So if we stop flooding
  multicast, the outside world cannot ping the bridge device's IPv6
  link-local address.

- There might be foreign interfaces bridged with our DSA switch ports
  (sending a packet towards the host does not necessarily equal
  termination, but maybe software forwarding). So if there is no one
  interested in that multicast traffic in the local network stack, that
  doesn't mean nobody is.

- PTP over L4 (IPv4, IPv6) is multicast, but is unregistered as far as
  the bridge is concerned. This should reach the CPU port.

- The switch driver might not do FDB partitioning. And since we don't
  even bother to do more fine-grained flood disabling (such as "disable
  flooding _from_port_N_ towards the CPU port" as opposed to "disable
  flooding _from_any_port_ towards the CPU port"), this breaks standalone
  ports, or even multiple bridges where one has an IGMP querier and one
  doesn't.

Reverting the logic makes all of the above work.

Fixes: a8b659e7ff75 ("net: dsa: act as passthrough for bridge port flags")
Fixes: 08cc83cc7fd8 ("net: dsa: add support for BRIDGE_MROUTER attribute")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/b53/b53_common.c
drivers/net/dsa/b53/b53_priv.h
drivers/net/dsa/bcm_sf2.c
drivers/net/dsa/mv88e6xxx/chip.c
include/net/dsa.h
net/dsa/dsa_priv.h
net/dsa/port.c
net/dsa/slave.c

index b23e3488695ba2f53368733cab857ed6311188de..bd1417a66cbf24941864c6e66c4bbb1e5c24b8bc 100644 (file)
@@ -2016,15 +2016,6 @@ int b53_br_flags(struct dsa_switch *ds, int port,
 }
 EXPORT_SYMBOL(b53_br_flags);
 
-int b53_set_mrouter(struct dsa_switch *ds, int port, bool mrouter,
-                   struct netlink_ext_ack *extack)
-{
-       b53_port_set_mcast_flood(ds->priv, port, mrouter);
-
-       return 0;
-}
-EXPORT_SYMBOL(b53_set_mrouter);
-
 static bool b53_possible_cpu_port(struct dsa_switch *ds, int port)
 {
        /* Broadcom switches will accept enabling Broadcom tags on the
@@ -2268,7 +2259,6 @@ static const struct dsa_switch_ops b53_switch_ops = {
        .port_bridge_leave      = b53_br_leave,
        .port_pre_bridge_flags  = b53_br_flags_pre,
        .port_bridge_flags      = b53_br_flags,
-       .port_set_mrouter       = b53_set_mrouter,
        .port_stp_state_set     = b53_br_set_stp_state,
        .port_fast_age          = b53_br_fast_age,
        .port_vlan_filtering    = b53_vlan_filtering,
index 82700a5714c10809fdcdefcb76a57cb35301e5e0..9bf8319342b0b81569a2985c6a3ae8f7e152af8f 100644 (file)
@@ -328,8 +328,6 @@ int b53_br_flags_pre(struct dsa_switch *ds, int port,
 int b53_br_flags(struct dsa_switch *ds, int port,
                 struct switchdev_brport_flags flags,
                 struct netlink_ext_ack *extack);
-int b53_set_mrouter(struct dsa_switch *ds, int port, bool mrouter,
-                   struct netlink_ext_ack *extack);
 int b53_setup_devlink_resources(struct dsa_switch *ds);
 void b53_port_event(struct dsa_switch *ds, int port);
 void b53_phylink_validate(struct dsa_switch *ds, int port,
index 3b018fcf44124ac8ba04ed5d979206a8fe2304f3..6ce9ec1283e05d63f9a46629d9757b40121fda4a 100644 (file)
@@ -1199,7 +1199,6 @@ static const struct dsa_switch_ops bcm_sf2_ops = {
        .port_pre_bridge_flags  = b53_br_flags_pre,
        .port_bridge_flags      = b53_br_flags,
        .port_stp_state_set     = b53_br_set_stp_state,
-       .port_set_mrouter       = b53_set_mrouter,
        .port_fast_age          = b53_br_fast_age,
        .port_vlan_filtering    = b53_vlan_filtering,
        .port_vlan_add          = b53_vlan_add,
index ddb51dd132ef8d609753ce2b16988eb3b666eafb..c2c5f1573fe5d974c8fc68a8bc587844f34af205 100644 (file)
@@ -5849,23 +5849,6 @@ out:
        return err;
 }
 
-static int mv88e6xxx_port_set_mrouter(struct dsa_switch *ds, int port,
-                                     bool mrouter,
-                                     struct netlink_ext_ack *extack)
-{
-       struct mv88e6xxx_chip *chip = ds->priv;
-       int err;
-
-       if (!chip->info->ops->port_set_mcast_flood)
-               return -EOPNOTSUPP;
-
-       mv88e6xxx_reg_lock(chip);
-       err = chip->info->ops->port_set_mcast_flood(chip, port, mrouter);
-       mv88e6xxx_reg_unlock(chip);
-
-       return err;
-}
-
 static bool mv88e6xxx_lag_can_offload(struct dsa_switch *ds,
                                      struct net_device *lag,
                                      struct netdev_lag_upper_info *info)
@@ -6167,7 +6150,6 @@ static const struct dsa_switch_ops mv88e6xxx_switch_ops = {
        .port_bridge_leave      = mv88e6xxx_port_bridge_leave,
        .port_pre_bridge_flags  = mv88e6xxx_port_pre_bridge_flags,
        .port_bridge_flags      = mv88e6xxx_port_bridge_flags,
-       .port_set_mrouter       = mv88e6xxx_port_set_mrouter,
        .port_stp_state_set     = mv88e6xxx_port_stp_state_set,
        .port_fast_age          = mv88e6xxx_port_fast_age,
        .port_vlan_filtering    = mv88e6xxx_port_vlan_filtering,
index 7cc9507282d37ddedfbe272ceba3b644e3439ba9..d7dc26d316ea421059f66eafa31581b81009e50d 100644 (file)
@@ -714,8 +714,6 @@ struct dsa_switch_ops {
        int     (*port_bridge_flags)(struct dsa_switch *ds, int port,
                                     struct switchdev_brport_flags flags,
                                     struct netlink_ext_ack *extack);
-       int     (*port_set_mrouter)(struct dsa_switch *ds, int port, bool mrouter,
-                                   struct netlink_ext_ack *extack);
 
        /*
         * VLAN support
index e43c5dc04282dcaec963d8aa41d4cc0cce7fb229..7841b3957516479f4ac06fc87668369c7dfae7a1 100644 (file)
@@ -244,8 +244,6 @@ int dsa_port_pre_bridge_flags(const struct dsa_port *dp,
 int dsa_port_bridge_flags(const struct dsa_port *dp,
                          struct switchdev_brport_flags flags,
                          struct netlink_ext_ack *extack);
-int dsa_port_mrouter(struct dsa_port *dp, bool mrouter,
-                    struct netlink_ext_ack *extack);
 int dsa_port_vlan_add(struct dsa_port *dp,
                      const struct switchdev_obj_port_vlan *vlan,
                      struct netlink_ext_ack *extack);
index c18077a3c7797681f496b5c1430676e9fb29fa72..797a3269a96441c1f8441b784f03a65b17e4b91d 100644 (file)
@@ -641,17 +641,6 @@ int dsa_port_bridge_flags(const struct dsa_port *dp,
        return ds->ops->port_bridge_flags(ds, dp->index, flags, extack);
 }
 
-int dsa_port_mrouter(struct dsa_port *dp, bool mrouter,
-                    struct netlink_ext_ack *extack)
-{
-       struct dsa_switch *ds = dp->ds;
-
-       if (!ds->ops->port_set_mrouter)
-               return -EOPNOTSUPP;
-
-       return ds->ops->port_set_mrouter(ds, dp->index, mrouter, extack);
-}
-
 int dsa_port_mtu_change(struct dsa_port *dp, int new_mtu,
                        bool targeted_match)
 {
index 6e1135d3ee3363048afff68783f50874dc5451ea..022174635bc1edcde5a6443856aa8544806ea1ff 100644 (file)
@@ -314,12 +314,6 @@ static int dsa_slave_port_attr_set(struct net_device *dev, const void *ctx,
 
                ret = dsa_port_bridge_flags(dp, attr->u.brport_flags, extack);
                break;
-       case SWITCHDEV_ATTR_ID_BRIDGE_MROUTER:
-               if (!dsa_port_offloads_bridge(dp, attr->orig_dev))
-                       return -EOPNOTSUPP;
-
-               ret = dsa_port_mrouter(dp->cpu_dp, attr->u.mrouter, extack);
-               break;
        default:
                ret = -EOPNOTSUPP;
                break;