summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2019-12-22 12:40:11 +0000
committerRussell King <rmk+kernel@armlinux.org.uk>2020-04-16 23:03:40 +0100
commit0a3db82529f9dce9bc6edf4b35f6456eb6b4c7c5 (patch)
treed58a2314409c340c72f1ac1003bd3ec50702e763 /net
parent98204e7a5b645def36c1e32be7cc455da1c0d7f4 (diff)
net: dsa: mv88e6xxx: fix vlan setup
DSA assumes that a bridge which has vlan filtering disabled is not vlan aware, and ignores all vlan configuration. However, the kernel software bridge code allows configuration in this state. This causes the kernel's idea of the bridge vlan state and the hardware state to disagree, so "bridge vlan show" indicates a correct configuration but the hardware lacks all configuration. Even worse, enabling vlan filtering on a DSA bridge immediately blocks all traffic which, given the output of "bridge vlan show", is very confusing. Provide an option that drivers can set to indicate they want to receive vlan configuration even when vlan filtering is disabled. This is safe for Marvell DSA bridges, which do not look up ingress traffic in the VTU if the port is in 8021Q disabled state. Whether this change is suitable for all DSA bridges is not known. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Diffstat (limited to 'net')
-rw-r--r--net/dsa/slave.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 86f3f1a5c97c..5938213ba551 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -314,7 +314,8 @@ static int dsa_slave_vlan_add(struct net_device *dev,
if (obj->orig_dev != dev)
return -EOPNOTSUPP;
- if (dp->bridge_dev && !br_vlan_enabled(dp->bridge_dev))
+ if (dp->bridge_dev && !dp->ds->vlan_bridge_vtu &&
+ !br_vlan_enabled(dp->bridge_dev))
return 0;
vlan = *SWITCHDEV_OBJ_PORT_VLAN(obj);
@@ -381,7 +382,8 @@ static int dsa_slave_vlan_del(struct net_device *dev,
if (obj->orig_dev != dev)
return -EOPNOTSUPP;
- if (dp->bridge_dev && !br_vlan_enabled(dp->bridge_dev))
+ if (dp->bridge_dev && !dp->ds->vlan_bridge_vtu &&
+ !br_vlan_enabled(dp->bridge_dev))
return 0;
/* Do not deprogram the CPU port as it may be shared with other user
@@ -1102,7 +1104,8 @@ static int dsa_slave_vlan_rx_add_vid(struct net_device *dev, __be16 proto,
* need to emulate the switchdev prepare + commit phase.
*/
if (dp->bridge_dev) {
- if (!br_vlan_enabled(dp->bridge_dev))
+ if (!dp->ds->vlan_bridge_vtu &&
+ !br_vlan_enabled(dp->bridge_dev))
return 0;
/* br_vlan_get_info() returns -EINVAL or -ENOENT if the
@@ -1136,7 +1139,8 @@ static int dsa_slave_vlan_rx_kill_vid(struct net_device *dev, __be16 proto,
* need to emulate the switchdev prepare + commit phase.
*/
if (dp->bridge_dev) {
- if (!br_vlan_enabled(dp->bridge_dev))
+ if (!dp->ds->vlan_bridge_vtu &&
+ !br_vlan_enabled(dp->bridge_dev))
return 0;
/* br_vlan_get_info() returns -EINVAL or -ENOENT if the