Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "net: dsa: sja1105: Clear VLAN filtering offload netdev feature"

This reverts commit e9bf96943b408e6c99dd13fb01cb907335787c61.

The topic of the reverted patch is the support for switches with global
VLAN filtering, added by commit 061f6a505ac3 ("net: dsa: Add
ndo_vlan_rx_{add, kill}_vid implementation"). Be there a switch with 4
ports swp0 -> swp3, and the following setup:

ip link add br0 type bridge vlan_filtering 1
ip link set swp0 master br0
ip link set swp1 master br0

What would happen with VLAN-tagged traffic received on standalone ports
swp2 and swp3? Well, it would get dropped, were it not for the
.ndo_vlan_rx_add_vid and .ndo_vlan_rx_kill_vid implementations (called
from vlan_vid_add and vlan_vid_del respectively). Basically, for DSA
switches where VLAN filtering is a global attribute, we enforce the
standalone ports to have 'rx-vlan-filter: off [fixed]' in their ethtool
features, which lets the user know that all VLAN-tagged packets that are
not explicitly added in the RX filtering list are dropped.

As for the sja1105 driver, at the time of the reverted patch, it was
operating in a pretty handicapped mode when it had ports under a bridge
with vlan_filtering=1. Specifically, it was unable to terminate traffic
through the CPU port (for further explanation see "Traffic support" in
Documentation/networking/dsa/sja1105.rst).

However, since then, the sja1105 driver has made considerable progress,
and that limitation is no longer as severe now. Specifically, since
commit 2cafa72e516f ("net: dsa: sja1105: add a new
best_effort_vlan_filtering devlink parameter"), the driver is able to
perform CPU termination even when some ports are under bridges with
vlan_filtering=1. Then, since commit 8841f6e63f2c ("net: dsa: sja1105:
make devlink property best_effort_vlan_filtering true by default"), this
even became the default operating mode.

So we can now take advantage of the logic in the DSA core.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Vladimir Oltean and committed by
David S. Miller
a1e6f641 dc4aa50b

-16
-16
drivers/net/dsa/sja1105/sja1105_main.c
··· 3049 3049 } 3050 3050 } 3051 3051 3052 - static int sja1105_port_enable(struct dsa_switch *ds, int port, 3053 - struct phy_device *phy) 3054 - { 3055 - struct net_device *slave; 3056 - 3057 - if (!dsa_is_user_port(ds, port)) 3058 - return 0; 3059 - 3060 - slave = dsa_to_port(ds, port)->slave; 3061 - 3062 - slave->features &= ~NETIF_F_HW_VLAN_CTAG_FILTER; 3063 - 3064 - return 0; 3065 - } 3066 - 3067 3052 static void sja1105_port_disable(struct dsa_switch *ds, int port) 3068 3053 { 3069 3054 struct sja1105_private *priv = ds->priv; ··· 3476 3491 .get_ethtool_stats = sja1105_get_ethtool_stats, 3477 3492 .get_sset_count = sja1105_get_sset_count, 3478 3493 .get_ts_info = sja1105_get_ts_info, 3479 - .port_enable = sja1105_port_enable, 3480 3494 .port_disable = sja1105_port_disable, 3481 3495 .port_fdb_dump = sja1105_fdb_dump, 3482 3496 .port_fdb_add = sja1105_fdb_add,