Skip to content

Commit 7654c10

Browse files
committed
Merge branch 'mlxsw-set-port-stp-state-on-bridge-enslavement'
Petr Machata says: ==================== mlxsw: Set port STP state on bridge enslavement When the first port joins a LAG that already has a bridge upper, an instance of struct mlxsw_sp_bridge_port is created for the LAG to keep track of it as a bridge port. The bridge_port's STP state is initialized to BR_STATE_DISABLED. This made sense previously, because mlxsw would only ever allow a port to join a LAG if the LAG had no uppers. Thus if a bridge_port was instantiated, it must have been because the LAG as such is joining a bridge, and the STP state is correspondingly disabled. However as of commit 2c5ffe8 ("mlxsw: spectrum: Permit enslavement to netdevices with uppers"), mlxsw allows a port to join a LAG that is already a member of a bridge. The STP state may be different than disabled in that case. Initialize it properly by querying the actual state. This bug may cause an issue as traffic on ports attached to a bridged LAG gets dropped on ingress with discard_ingress_general counter bumped. The above fix in patch #1. Patch #2 contains a selftest that would sporadically reproduce the issue. ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents b77049f + aae5bb8 commit 7654c10

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ mlxsw_sp_bridge_port_create(struct mlxsw_sp_bridge_device *bridge_device,
490490
bridge_port->system_port = mlxsw_sp_port->local_port;
491491
bridge_port->dev = brport_dev;
492492
bridge_port->bridge_device = bridge_device;
493-
bridge_port->stp_state = BR_STATE_DISABLED;
493+
bridge_port->stp_state = br_port_get_stp_state(brport_dev);
494494
bridge_port->flags = BR_LEARNING | BR_FLOOD | BR_LEARNING_SYNC |
495495
BR_MCAST_FLOOD;
496496
INIT_LIST_HEAD(&bridge_port->vlans_list);
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
# SPDX-License-Identifier: GPL-2.0
3+
4+
# Test enslavement to LAG with a clean slate.
5+
# See $lib_dir/router_bridge_lag.sh for further details.
6+
7+
ALL_TESTS="
8+
config_devlink_reload
9+
config_enslave_h1
10+
config_enslave_h2
11+
config_enslave_h3
12+
config_enslave_h4
13+
config_enslave_swp1
14+
config_enslave_swp2
15+
config_enslave_swp3
16+
config_enslave_swp4
17+
config_wait
18+
ping_ipv4
19+
ping_ipv6
20+
"
21+
22+
config_devlink_reload()
23+
{
24+
log_info "Devlink reload"
25+
devlink_reload
26+
}
27+
28+
config_enslave_h1()
29+
{
30+
config_enslave $h1 lag1
31+
}
32+
33+
config_enslave_h2()
34+
{
35+
config_enslave $h2 lag4
36+
}
37+
38+
config_enslave_h3()
39+
{
40+
config_enslave $h3 lag4
41+
}
42+
43+
config_enslave_h4()
44+
{
45+
config_enslave $h4 lag1
46+
}
47+
48+
lib_dir=$(dirname $0)/../../../net/forwarding
49+
EXTRA_SOURCE="source $lib_dir/devlink_lib.sh"
50+
source $lib_dir/router_bridge_lag.sh

0 commit comments

Comments
 (0)