Commit 86136410 authored by Eli Cohen's avatar Eli Cohen Committed by Saeed Mahameed

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: default avatarEli Cohen <elic@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 2b147675
...@@ -118,17 +118,24 @@ static bool __mlx5_lag_is_sriov(struct mlx5_lag *ldev) ...@@ -118,17 +118,24 @@ static bool __mlx5_lag_is_sriov(struct mlx5_lag *ldev)
static void mlx5_infer_tx_affinity_mapping(struct lag_tracker *tracker, static void mlx5_infer_tx_affinity_mapping(struct lag_tracker *tracker,
u8 *port1, u8 *port2) u8 *port1, u8 *port2)
{ {
bool p1en;
bool p2en;
p1en = tracker->netdev_state[MLX5_LAG_P1].tx_enabled &&
tracker->netdev_state[MLX5_LAG_P1].link_up;
p2en = tracker->netdev_state[MLX5_LAG_P2].tx_enabled &&
tracker->netdev_state[MLX5_LAG_P2].link_up;
*port1 = 1; *port1 = 1;
*port2 = 2; *port2 = 2;
if (!tracker->netdev_state[MLX5_LAG_P1].tx_enabled || if ((!p1en && !p2en) || (p1en && p2en))
!tracker->netdev_state[MLX5_LAG_P1].link_up) {
*port1 = 2;
return; return;
}
if (!tracker->netdev_state[MLX5_LAG_P2].tx_enabled || if (p1en)
!tracker->netdev_state[MLX5_LAG_P2].link_up)
*port2 = 1; *port2 = 1;
else
*port1 = 2;
} }
void mlx5_modify_lag(struct mlx5_lag *ldev, void mlx5_modify_lag(struct mlx5_lag *ldev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment