Skip to content

Commit 8613641

Browse files
elic307iSaeed Mahameed
authored andcommitted
net/mlx5: Fix lag port remapping logic
Fix the logic so that if both ports netdevices are enabled or disabled, use the trivial mapping without swapping. If only one of the netdevice's tx is enabled, use it to remap traffic to that port. Signed-off-by: Eli Cohen <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 2b14767 commit 8613641

File tree

1 file changed

+13
-6
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+13
-6
lines changed

drivers/net/ethernet/mellanox/mlx5/core/lag.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,17 +118,24 @@ static bool __mlx5_lag_is_sriov(struct mlx5_lag *ldev)
118118
static void mlx5_infer_tx_affinity_mapping(struct lag_tracker *tracker,
119119
u8 *port1, u8 *port2)
120120
{
121+
bool p1en;
122+
bool p2en;
123+
124+
p1en = tracker->netdev_state[MLX5_LAG_P1].tx_enabled &&
125+
tracker->netdev_state[MLX5_LAG_P1].link_up;
126+
127+
p2en = tracker->netdev_state[MLX5_LAG_P2].tx_enabled &&
128+
tracker->netdev_state[MLX5_LAG_P2].link_up;
129+
121130
*port1 = 1;
122131
*port2 = 2;
123-
if (!tracker->netdev_state[MLX5_LAG_P1].tx_enabled ||
124-
!tracker->netdev_state[MLX5_LAG_P1].link_up) {
125-
*port1 = 2;
132+
if ((!p1en && !p2en) || (p1en && p2en))
126133
return;
127-
}
128134

129-
if (!tracker->netdev_state[MLX5_LAG_P2].tx_enabled ||
130-
!tracker->netdev_state[MLX5_LAG_P2].link_up)
135+
if (p1en)
131136
*port2 = 1;
137+
else
138+
*port1 = 2;
132139
}
133140

134141
void mlx5_modify_lag(struct mlx5_lag *ldev,

0 commit comments

Comments
 (0)