mirror of
https://github.com/torvalds/linux.git
synced 2026-10-04 10:19:02 +02:00
Merge branch 'net-mlx5-sd-lag-and-devcom-stability-fixes'
Tariq Toukan says: ==================== net/mlx5: SD LAG and devcom stability fixes This series by Shay fixes four bugs in the Socket Direct LAG and devcom subsystems, all related to initialization/teardown ordering and concurrent access to the LAG device. ==================== Link: https://patch.msgid.link/20260915113459.3934760-1-tariqt@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
b73bcf7c1f
|
|
@ -1266,25 +1266,45 @@ void mlx5_lag_remove_devices(struct mlx5_lag *ldev)
|
|||
mlx5_lag_remove_devices_filter(ldev, MLX5_LAG_FILTER_PORTS);
|
||||
}
|
||||
|
||||
static int mlx5_lag_reload_ib_reps_idx(struct mlx5_lag *ldev, int idx,
|
||||
u32 flags)
|
||||
{
|
||||
struct lag_func *pf = mlx5_lag_pf(ldev, idx);
|
||||
struct mlx5_eswitch *esw;
|
||||
int ret;
|
||||
|
||||
if (pf->dev->priv.flags & flags)
|
||||
return 0;
|
||||
|
||||
esw = pf->dev->priv.eswitch;
|
||||
mlx5_esw_reps_block(esw);
|
||||
ret = mlx5_eswitch_reload_ib_reps(esw);
|
||||
mlx5_esw_reps_unblock(esw);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int mlx5_lag_reload_ib_reps_unlocked(struct mlx5_lag *ldev, u32 flags,
|
||||
u32 filter, bool cont_on_fail)
|
||||
{
|
||||
struct lag_func *pf;
|
||||
int master_idx = mlx5_lag_get_dev_index_by_seq_filter(ldev, MLX5_LAG_P1,
|
||||
filter);
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
mlx5_lag_for_each(i, 0, ldev, filter) {
|
||||
pf = mlx5_lag_pf(ldev, i);
|
||||
if (!(pf->dev->priv.flags & flags)) {
|
||||
struct mlx5_eswitch *esw;
|
||||
if (master_idx < 0)
|
||||
return -EINVAL;
|
||||
|
||||
esw = pf->dev->priv.eswitch;
|
||||
mlx5_esw_reps_block(esw);
|
||||
ret = mlx5_eswitch_reload_ib_reps(esw);
|
||||
mlx5_esw_reps_unblock(esw);
|
||||
if (ret && !cont_on_fail)
|
||||
return ret;
|
||||
}
|
||||
ret = mlx5_lag_reload_ib_reps_idx(ldev, master_idx, flags);
|
||||
if (ret && !cont_on_fail)
|
||||
return ret;
|
||||
|
||||
mlx5_lag_for_each(i, 0, ldev, filter) {
|
||||
if (i == master_idx)
|
||||
continue;
|
||||
ret = mlx5_lag_reload_ib_reps_idx(ldev, i, flags);
|
||||
if (ret && !cont_on_fail)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -270,6 +270,7 @@ int mlx5_lag_shared_fdb_create(struct mlx5_lag *ldev,
|
|||
pf->sd_fdb_active = false;
|
||||
}
|
||||
mlx5_lag_destroy_single_fdb_filter(ldev, group_id);
|
||||
mlx5_lag_unload_reps_from_locked(ldev, filter);
|
||||
}
|
||||
err_add_devices:
|
||||
mlx5_lag_add_devices_filter(ldev, filter);
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ struct mlx5_devcom_comp {
|
|||
struct mlx5_devcom_key key;
|
||||
mlx5_devcom_event_handler_t handler;
|
||||
struct kref ref;
|
||||
int nr_devs;
|
||||
bool ready;
|
||||
struct rw_semaphore sem;
|
||||
struct lock_class_key lock_key;
|
||||
|
|
@ -170,6 +171,7 @@ devcom_alloc_comp_dev(struct mlx5_devcom_dev *devc,
|
|||
|
||||
down_write(&comp->sem);
|
||||
list_add_tail(&devcom->list, &comp->comp_dev_list_head);
|
||||
WRITE_ONCE(comp->nr_devs, comp->nr_devs + 1);
|
||||
up_write(&comp->sem);
|
||||
|
||||
return devcom;
|
||||
|
|
@ -182,6 +184,7 @@ devcom_free_comp_dev(struct mlx5_devcom_comp_dev *devcom)
|
|||
|
||||
down_write(&comp->sem);
|
||||
list_del(&devcom->list);
|
||||
WRITE_ONCE(comp->nr_devs, comp->nr_devs - 1);
|
||||
up_write(&comp->sem);
|
||||
|
||||
kref_put(&devcom->devc->ref, mlx5_devcom_dev_release);
|
||||
|
|
@ -284,7 +287,7 @@ int mlx5_devcom_comp_get_size(struct mlx5_devcom_comp_dev *devcom)
|
|||
{
|
||||
struct mlx5_devcom_comp *comp = devcom->comp;
|
||||
|
||||
return kref_read(&comp->ref);
|
||||
return READ_ONCE(comp->nr_devs);
|
||||
}
|
||||
|
||||
int mlx5_devcom_locked_send_event(struct mlx5_devcom_comp_dev *devcom,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user