Commit 1afbd1e2 authored by Liu, Changcheng's avatar Liu, Changcheng Committed by Saeed Mahameed

net/mlx5: Lag, correct get the port select mode str

mode & mode_flags is updated at the end of mlx5_activate_lag which
may not reflect the actual mode as shown in below logic:
    mlx5_activate_lag(struct mlx5_lag *ldev,
    |-- unsigned long flags = 0;
    |-- err = mlx5_lag_set_flags(ldev, mode, tracker, shared_fdb, &flags);
    |-- err = mlx5_create_lag(ldev, tracker, mode, flags);
              |-- mlx5_get_str_port_sel_mode(ldev);
    |-- ldev->mode = mode;
    |-- ldev->mode_flags = flags;
Use mode & flag as parameters to get port select mode info.

Fixes: 94db3317 ("net/mlx5: Support multiport eswitch mode")
Signed-off-by: default avatarLiu, Changcheng <jerrliu@nvidia.com>
Reviewed-by: default avatarEli Cohen <elic@nvidia.com>
Reviewed-by: default avatarMark Bloch <mbloch@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 0c9d8765
...@@ -44,7 +44,7 @@ static int port_sel_mode_show(struct seq_file *file, void *priv) ...@@ -44,7 +44,7 @@ static int port_sel_mode_show(struct seq_file *file, void *priv)
ldev = dev->priv.lag; ldev = dev->priv.lag;
mutex_lock(&ldev->lock); mutex_lock(&ldev->lock);
if (__mlx5_lag_is_active(ldev)) if (__mlx5_lag_is_active(ldev))
mode = mlx5_get_str_port_sel_mode(ldev); mode = mlx5_get_str_port_sel_mode(ldev->mode, ldev->mode_flags);
else else
ret = -EINVAL; ret = -EINVAL;
mutex_unlock(&ldev->lock); mutex_unlock(&ldev->lock);
......
...@@ -487,9 +487,9 @@ static int mlx5_lag_set_flags(struct mlx5_lag *ldev, enum mlx5_lag_mode mode, ...@@ -487,9 +487,9 @@ static int mlx5_lag_set_flags(struct mlx5_lag *ldev, enum mlx5_lag_mode mode,
return 0; return 0;
} }
char *mlx5_get_str_port_sel_mode(struct mlx5_lag *ldev) char *mlx5_get_str_port_sel_mode(enum mlx5_lag_mode mode, unsigned long flags)
{ {
int port_sel_mode = get_port_sel_mode(ldev->mode, ldev->mode_flags); int port_sel_mode = get_port_sel_mode(mode, flags);
switch (port_sel_mode) { switch (port_sel_mode) {
case MLX5_LAG_PORT_SELECT_MODE_QUEUE_AFFINITY: return "queue_affinity"; case MLX5_LAG_PORT_SELECT_MODE_QUEUE_AFFINITY: return "queue_affinity";
...@@ -513,7 +513,7 @@ static int mlx5_create_lag(struct mlx5_lag *ldev, ...@@ -513,7 +513,7 @@ static int mlx5_create_lag(struct mlx5_lag *ldev,
if (tracker) if (tracker)
mlx5_lag_print_mapping(dev0, ldev, tracker, flags); mlx5_lag_print_mapping(dev0, ldev, tracker, flags);
mlx5_core_info(dev0, "shared_fdb:%d mode:%s\n", mlx5_core_info(dev0, "shared_fdb:%d mode:%s\n",
shared_fdb, mlx5_get_str_port_sel_mode(ldev)); shared_fdb, mlx5_get_str_port_sel_mode(mode, flags));
err = mlx5_cmd_create_lag(dev0, ldev->v2p_map, mode, flags); err = mlx5_cmd_create_lag(dev0, ldev->v2p_map, mode, flags);
if (err) { if (err) {
......
...@@ -115,7 +115,7 @@ bool mlx5_shared_fdb_supported(struct mlx5_lag *ldev); ...@@ -115,7 +115,7 @@ bool mlx5_shared_fdb_supported(struct mlx5_lag *ldev);
void mlx5_lag_del_mpesw_rule(struct mlx5_core_dev *dev); void mlx5_lag_del_mpesw_rule(struct mlx5_core_dev *dev);
int mlx5_lag_add_mpesw_rule(struct mlx5_core_dev *dev); int mlx5_lag_add_mpesw_rule(struct mlx5_core_dev *dev);
char *mlx5_get_str_port_sel_mode(struct mlx5_lag *ldev); char *mlx5_get_str_port_sel_mode(enum mlx5_lag_mode mode, unsigned long flags);
void mlx5_infer_tx_enabled(struct lag_tracker *tracker, u8 num_ports, void mlx5_infer_tx_enabled(struct lag_tracker *tracker, u8 num_ports,
u8 *ports, int *num_enabled); u8 *ports, int *num_enabled);
......
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