summaryrefslogtreecommitdiffstats
path: root/net/dsa/slave.c
diff options
context:
space:
mode:
authorVivien Didelot <vivien.didelot@gmail.com>2019-08-25 13:25:19 -0400
committerDavid S. Miller <davem@davemloft.net>2019-08-27 23:17:28 -0400
commit7e1741b47f2441e7c570284d60ba936e3d41529a (patch)
tree5e6c37a33c85c249e5173ec5521bcbe7bfb472ab /net/dsa/slave.c
parentc5335d737ff30f1cb23d245ef9e20ec23cc2d7ba (diff)
net: dsa: program VLAN on CPU port from slave
DSA currently programs a VLAN on the CPU port implicitly after the related notifier is received by a switch. While we still need to do this transparent programmation of the DSA links in the fabric, programming the CPU port this way may cause problems in some corners such as the tag_8021q driver. Because the dedicated CPU port is specific to a slave, make their programmation explicit a few layers up, in the slave code. Note that technically, DSA links have a dedicated CPU port as well, but since they are only used as conduit between interconnected switches of a fabric, programming them transparently this way is what we want. Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa/slave.c')
-rw-r--r--net/dsa/slave.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 82e48d247b81..8267c156a51a 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -332,6 +332,10 @@ static int dsa_slave_vlan_add(struct net_device *dev,
332 if (err) 332 if (err)
333 return err; 333 return err;
334 334
335 err = dsa_port_vlan_add(dp->cpu_dp, &vlan, trans);
336 if (err)
337 return err;
338
335 return 0; 339 return 0;
336} 340}
337 341
@@ -383,6 +387,9 @@ static int dsa_slave_vlan_del(struct net_device *dev,
383 if (dp->bridge_dev && !br_vlan_enabled(dp->bridge_dev)) 387 if (dp->bridge_dev && !br_vlan_enabled(dp->bridge_dev))
384 return 0; 388 return 0;
385 389
390 /* Do not deprogram the CPU port as it may be shared with other user
391 * ports which can be members of this VLAN as well.
392 */
386 return dsa_port_vlan_del(dp, SWITCHDEV_OBJ_PORT_VLAN(obj)); 393 return dsa_port_vlan_del(dp, SWITCHDEV_OBJ_PORT_VLAN(obj));
387} 394}
388 395
@@ -1121,6 +1128,10 @@ static int dsa_slave_vlan_rx_add_vid(struct net_device *dev, __be16 proto,
1121 if (ret && ret != -EOPNOTSUPP) 1128 if (ret && ret != -EOPNOTSUPP)
1122 return ret; 1129 return ret;
1123 1130
1131 ret = dsa_port_vid_add(dp->cpu_dp, vid, 0);
1132 if (ret && ret != -EOPNOTSUPP)
1133 return ret;
1134
1124 return 0; 1135 return 0;
1125} 1136}
1126 1137
@@ -1151,6 +1162,9 @@ static int dsa_slave_vlan_rx_kill_vid(struct net_device *dev, __be16 proto,
1151 if (ret == -EOPNOTSUPP) 1162 if (ret == -EOPNOTSUPP)
1152 ret = 0; 1163 ret = 0;
1153 1164
1165 /* Do not deprogram the CPU port as it may be shared with other user
1166 * ports which can be members of this VLAN as well.
1167 */
1154 return ret; 1168 return ret;
1155} 1169}
1156 1170