Skip to content

Commit b2f81d3

Browse files
viviendavem330
authored andcommitted
net: dsa: add CPU and DSA ports as VLAN members
In a multi-chip switch fabric, it is currently the responsibility of the driver to add the CPU or DSA (interconnecting chips together) ports as members of a new VLAN entry. This makes the drivers more complicated. We want the DSA drivers to be stupid and the DSA core being the one responsible for caring about the abstracted switch logic and topology. Make the DSA core program the CPU and DSA ports as part of the VLAN. This makes all chips of the data path to be aware of VIDs spanning the the whole fabric and thus, seamlessly add support for cross-chip VLAN. Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 1ca4aa9 commit b2f81d3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/dsa/switch.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ static int dsa_switch_vlan_add(struct dsa_switch *ds,
166166
bitmap_zero(members, ds->num_ports);
167167
if (ds->index == info->sw_index)
168168
set_bit(info->port, members);
169+
for (port = 0; port < ds->num_ports; port++)
170+
if (dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port))
171+
set_bit(port, members);
169172

170173
if (switchdev_trans_ph_prepare(trans)) {
171174
if (!ds->ops->port_vlan_prepare || !ds->ops->port_vlan_add)

0 commit comments

Comments
 (0)