Skip to content

Commit 183be6f

Browse files
vladimirolteandavem330
authored andcommitted
net: dsa: felix: send VLANs on CPU port as egress-tagged
As explained in other commits before (b9cd75e and 87b0f98), ocelot switches have a single egress-untagged VLAN per port, and the driver would deny adding a second one while an egress-untagged VLAN already exists. But on the CPU port (where the VLAN configuration is implicit, because there is no net device for the bridge to control), the DSA core attempts to add a VLAN using the same flags as were used for the front-panel port. This would make adding any untagged VLAN fail due to the CPU port rejecting the configuration: bridge vlan add dev swp0 vid 100 pvid untagged [ 1865.854253] mscc_felix 0000:00:00.5: Port already has a native VLAN: 1 [ 1865.860824] mscc_felix 0000:00:00.5: Failed to add VLAN 100 to port 5: -16 (note that port 5 is the CPU port and not the front-panel swp0). So this hardware will send all VLANs as tagged towards the CPU. Fixes: 5605194 ("net: dsa: ocelot: add driver for Felix switch family") Signed-off-by: Vladimir Oltean <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b3b6a84 commit 183be6f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/net/dsa/ocelot/felix.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,17 @@ static void felix_vlan_add(struct dsa_switch *ds, int port,
102102
const struct switchdev_obj_port_vlan *vlan)
103103
{
104104
struct ocelot *ocelot = ds->priv;
105+
u16 flags = vlan->flags;
105106
u16 vid;
106107
int err;
107108

109+
if (dsa_is_cpu_port(ds, port))
110+
flags &= ~BRIDGE_VLAN_INFO_UNTAGGED;
111+
108112
for (vid = vlan->vid_begin; vid <= vlan->vid_end; vid++) {
109113
err = ocelot_vlan_add(ocelot, port, vid,
110-
vlan->flags & BRIDGE_VLAN_INFO_PVID,
111-
vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED);
114+
flags & BRIDGE_VLAN_INFO_PVID,
115+
flags & BRIDGE_VLAN_INFO_UNTAGGED);
112116
if (err) {
113117
dev_err(ds->dev, "Failed to add VLAN %d to port %d: %d\n",
114118
vid, port, err);

0 commit comments

Comments
 (0)