aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/dsa
diff options
context:
space:
mode:
authorVladimir Oltean <olteanv@gmail.com>2019-04-28 14:45:45 -0400
committerDavid S. Miller <davem@davemloft.net>2019-04-30 23:05:28 -0400
commit7228b23e68f79d96141976924983296600dc1346 (patch)
tree3548bdce9dbd03239d49b42b4cc23dc030c72364 /drivers/net/dsa
parent8f5d16f638b9a1adf544a7f8cfd11ac1c01c6e25 (diff)
net: dsa: b53: Let DSA handle mismatched VLAN filtering settings
The DSA core is now able to do this check prior to calling the .port_vlan_filtering callback, so tell it that VLAN filtering is global for this particular hardware. Signed-off-by: Vladimir Oltean <olteanv@gmail.com> Suggested-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa')
-rw-r--r--drivers/net/dsa/b53/b53_common.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 0852e5e08177..a779b9c3ab6e 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -966,6 +966,13 @@ static int b53_setup(struct dsa_switch *ds)
966 b53_disable_port(ds, port); 966 b53_disable_port(ds, port);
967 } 967 }
968 968
969 /* Let DSA handle the case were multiple bridges span the same switch
970 * device and different VLAN awareness settings are requested, which
971 * would be breaking filtering semantics for any of the other bridge
972 * devices. (not hardware supported)
973 */
974 ds->vlan_filtering_is_global = true;
975
969 return ret; 976 return ret;
970} 977}
971 978
@@ -1275,26 +1282,8 @@ EXPORT_SYMBOL(b53_phylink_mac_link_up);
1275int b53_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering) 1282int b53_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering)
1276{ 1283{
1277 struct b53_device *dev = ds->priv; 1284 struct b53_device *dev = ds->priv;
1278 struct net_device *bridge_dev;
1279 unsigned int i;
1280 u16 pvid, new_pvid; 1285 u16 pvid, new_pvid;
1281 1286
1282 /* Handle the case were multiple bridges span the same switch device
1283 * and one of them has a different setting than what is being requested
1284 * which would be breaking filtering semantics for any of the other
1285 * bridge devices.
1286 */
1287 b53_for_each_port(dev, i) {
1288 bridge_dev = dsa_to_port(ds, i)->bridge_dev;
1289 if (bridge_dev &&
1290 bridge_dev != dsa_to_port(ds, port)->bridge_dev &&
1291 br_vlan_enabled(bridge_dev) != vlan_filtering) {
1292 netdev_err(bridge_dev,
1293 "VLAN filtering is global to the switch!\n");
1294 return -EINVAL;
1295 }
1296 }
1297
1298 b53_read16(dev, B53_VLAN_PAGE, B53_VLAN_PORT_DEF_TAG(port), &pvid); 1287 b53_read16(dev, B53_VLAN_PAGE, B53_VLAN_PORT_DEF_TAG(port), &pvid);
1299 new_pvid = pvid; 1288 new_pvid = pvid;
1300 if (dev->vlan_filtering_enabled && !vlan_filtering) { 1289 if (dev->vlan_filtering_enabled && !vlan_filtering) {