Skip to content

Commit

Permalink
net: dsa: don't disable multicast flooding to the CPU even without an…
Browse files Browse the repository at this point in the history
… IGMP querier

[ Upstream commit c73c570 ]

Commit 08cc83c ("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 a8b659e ("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: a8b659e ("net: dsa: act as passthrough for bridge port flags")
Fixes: 08cc83c ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
vladimiroltean authored and gregkh committed Sep 15, 2021
1 parent b88acd9 commit 1e36843
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 52 deletions.
10 changes: 0 additions & 10 deletions drivers/net/dsa/b53/b53_common.c
Expand Up @@ -1993,15 +1993,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
Expand Down Expand Up @@ -2245,7 +2236,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,
Expand Down
2 changes: 0 additions & 2 deletions drivers/net/dsa/b53/b53_priv.h
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion drivers/net/dsa/bcm_sf2.c
Expand Up @@ -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,
Expand Down
18 changes: 0 additions & 18 deletions drivers/net/dsa/mv88e6xxx/chip.c
Expand Up @@ -5781,23 +5781,6 @@ static int mv88e6xxx_port_bridge_flags(struct dsa_switch *ds, int port,
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)
Expand Down Expand Up @@ -6099,7 +6082,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,
Expand Down
2 changes: 0 additions & 2 deletions include/net/dsa.h
Expand Up @@ -643,8 +643,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
Expand Down
2 changes: 0 additions & 2 deletions net/dsa/dsa_priv.h
Expand Up @@ -211,8 +211,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);
Expand Down
11 changes: 0 additions & 11 deletions net/dsa/port.c
Expand Up @@ -545,17 +545,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 propagate_upstream)
{
Expand Down
6 changes: 0 additions & 6 deletions net/dsa/slave.c
Expand Up @@ -311,12 +311,6 @@ static int dsa_slave_port_attr_set(struct net_device *dev,

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;
Expand Down

0 comments on commit 1e36843

Please sign in to comment.