Skip to content

Commit 6e61b55

Browse files
vladimirolteanPaolo Abeni
authored andcommitted
net: dsa: don't keep track of admin/oper state on LAG DSA masters
We store information about the DSA master's state in cpu_dp->master_admin_up and cpu_dp->master_oper_up, and this assumes a bijective association between a CPU port and a DSA master. However, when we have CPU ports in a LAG (and DSA masters in a LAG too), the way in which we set up things is that the physical DSA masters still have dev->dsa_ptr pointing to our cpu_dp, but the bonding/team device itself also has its dev->dsa_ptr pointing towards one of the CPU port structures (the first one). So logically speaking, that first cpu_dp can't keep track of both the physical master's admin/oper state, and of the bonding master's state. This isn't even needed; the reason why we keep track of the DSA master's state is to know when it is available for Ethernet-based register access. For that use case, we don't even need LAG; we just need to decide upon one of the physical DSA masters (if there is more than 1 available) and use that. This change suppresses dsa_tree_master_{admin,oper}_state_change() calls on LAG DSA masters (which will be supported in a future change), to allow the tracking of just physical DSA masters. Link: https://lore.kernel.org/netdev/[email protected]/ Suggested-by: Christian Marangi <[email protected]> Signed-off-by: Vladimir Oltean <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent 95f510d commit 6e61b55

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

net/dsa/dsa2.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,6 +1326,12 @@ void dsa_tree_master_admin_state_change(struct dsa_switch_tree *dst,
13261326
struct dsa_port *cpu_dp = master->dsa_ptr;
13271327
bool notify = false;
13281328

1329+
/* Don't keep track of admin state on LAG DSA masters,
1330+
* but rather just of physical DSA masters
1331+
*/
1332+
if (netif_is_lag_master(master))
1333+
return;
1334+
13291335
if ((dsa_port_master_is_operational(cpu_dp)) !=
13301336
(up && cpu_dp->master_oper_up))
13311337
notify = true;
@@ -1343,6 +1349,12 @@ void dsa_tree_master_oper_state_change(struct dsa_switch_tree *dst,
13431349
struct dsa_port *cpu_dp = master->dsa_ptr;
13441350
bool notify = false;
13451351

1352+
/* Don't keep track of oper state on LAG DSA masters,
1353+
* but rather just of physical DSA masters
1354+
*/
1355+
if (netif_is_lag_master(master))
1356+
return;
1357+
13461358
if ((dsa_port_master_is_operational(cpu_dp)) !=
13471359
(cpu_dp->master_admin_up && up))
13481360
notify = true;

0 commit comments

Comments
 (0)