Skip to content

Commit 979b9b2

Browse files
idoschdavem330
authored andcommitted
mlxsw: spectrum: Clear VLAN filters during port initialization
When a port is created, its VLAN filters are not cleared by the firmware. This causes tagged packets to be later dropped by the ingress STP filters, which default to DISCARD state. The above did not matter much until commit b5ce611 ("mlxsw: spectrum: Add devlink-trap support") where we exposed the drop reason to users. Without this patch, the drop reason users will see is not consistent. If a port is enslaved to a VLAN-aware bridge and a packet with an invalid VLAN tries to ingress the bridge, it will be dropped due to ingress STP filter. If the VLAN is later enabled and then disabled, the packet will be dropped by the ingress VLAN filter despite the above being a seemingly NOP operation. Fix this by clearing all the VLAN filters during port initialization. Adjust the test accordingly. Fixes: b5ce611 ("mlxsw: spectrum: Add devlink-trap support") Reported-by: Alex Kushnarov <[email protected]> Tested-by: Alex Kushnarov <[email protected]> Acked-by: Jiri Pirko <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4208966 commit 979b9b2

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

drivers/net/ethernet/mellanox/mlxsw/spectrum.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3771,6 +3771,14 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
37713771
goto err_port_qdiscs_init;
37723772
}
37733773

3774+
err = mlxsw_sp_port_vlan_set(mlxsw_sp_port, 0, VLAN_N_VID - 1, false,
3775+
false);
3776+
if (err) {
3777+
dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to clear VLAN filter\n",
3778+
mlxsw_sp_port->local_port);
3779+
goto err_port_vlan_clear;
3780+
}
3781+
37743782
err = mlxsw_sp_port_nve_init(mlxsw_sp_port);
37753783
if (err) {
37763784
dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to initialize NVE\n",
@@ -3818,6 +3826,7 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
38183826
err_port_pvid_set:
38193827
mlxsw_sp_port_nve_fini(mlxsw_sp_port);
38203828
err_port_nve_init:
3829+
err_port_vlan_clear:
38213830
mlxsw_sp_tc_qdisc_fini(mlxsw_sp_port);
38223831
err_port_qdiscs_init:
38233832
mlxsw_sp_port_fids_fini(mlxsw_sp_port);

tools/testing/selftests/drivers/net/mlxsw/devlink_trap_l2_drops.sh

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,6 @@ ingress_vlan_filter_test()
224224
local vid=10
225225

226226
bridge vlan add vid $vid dev $swp2 master
227-
# During initialization the firmware enables all the VLAN filters and
228-
# the driver does not turn them off since the traffic will be discarded
229-
# by the STP filter whose default is DISCARD state. Add the VID on the
230-
# ingress bridge port and then remove it to make sure it is not member
231-
# in the VLAN.
232-
bridge vlan add vid $vid dev $swp1 master
233-
bridge vlan del vid $vid dev $swp1 master
234227

235228
RET=0
236229

0 commit comments

Comments
 (0)