Skip to content

Commit

Permalink
net/mlx5e: Return a valid errno if can't get lag device index
Browse files Browse the repository at this point in the history
Change the return value to -ENOENT, to make it more meaningful.

Signed-off-by: Jianbo Liu <jianbol@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
  • Loading branch information
Jianbo Liu authored and Saeed Mahameed committed Sep 15, 2020
1 parent 0d2ffdc commit f552be5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions drivers/net/ethernet/mellanox/mlx5/core/lag.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ int mlx5_lag_dev_get_netdev_idx(struct mlx5_lag *ldev,
if (ldev->pf[i].netdev == ndev)
return i;

return -1;
return -ENOENT;
}

static bool __mlx5_lag_is_roce(struct mlx5_lag *ldev)
Expand Down Expand Up @@ -374,7 +374,7 @@ static int mlx5_handle_changeupper_event(struct mlx5_lag *ldev,
rcu_read_lock();
for_each_netdev_in_bond_rcu(upper, ndev_tmp) {
idx = mlx5_lag_dev_get_netdev_idx(ldev, ndev_tmp);
if (idx > -1)
if (idx >= 0)
bond_status |= (1 << idx);

num_slaves++;
Expand Down Expand Up @@ -418,7 +418,7 @@ static int mlx5_handle_changelowerstate_event(struct mlx5_lag *ldev,
return 0;

idx = mlx5_lag_dev_get_netdev_idx(ldev, ndev);
if (idx == -1)
if (idx < 0)
return 0;

/* This information is used to determine virtual to physical
Expand Down
7 changes: 6 additions & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/lag_mp.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,12 @@ static void mlx5_lag_fib_route_event(struct mlx5_lag *ldev,
struct net_device *nh_dev = nh->fib_nh_dev;
int i = mlx5_lag_dev_get_netdev_idx(ldev, nh_dev);

mlx5_lag_set_port_affinity(ldev, ++i);
if (i < 0)
i = MLX5_LAG_NORMAL_AFFINITY;
else
++i;

mlx5_lag_set_port_affinity(ldev, i);
}
return;
}
Expand Down

0 comments on commit f552be5

Please sign in to comment.