Skip to content

Commit e05feab

Browse files
PatrisiousHaddadrleon
authored andcommitted
RDMA/mlx5: Enforce same type port association for multiport RoCE
Different core device types such as PFs and VFs shouldn't be affiliated together since they have different capabilities, fix that by enforcing type check before doing the affiliation. Fixes: 32f69e4 ("{net, IB}/mlx5: Manage port association for multiport RoCE") Reviewed-by: Mark Bloch <[email protected]> Signed-off-by: Patrisious Haddad <[email protected]> Link: https://patch.msgid.link/88699500f690dff1c1852c1ddb71f8a1cc8b956e.1733233480.git.leonro@nvidia.com Reviewed-by: Mateusz Polchlopek <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]>
1 parent d0257e0 commit e05feab

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

drivers/infiniband/hw/mlx5/main.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3639,7 +3639,8 @@ static int mlx5_ib_init_multiport_master(struct mlx5_ib_dev *dev)
36393639
list_for_each_entry(mpi, &mlx5_ib_unaffiliated_port_list,
36403640
list) {
36413641
if (dev->sys_image_guid == mpi->sys_image_guid &&
3642-
(mlx5_core_native_port_num(mpi->mdev) - 1) == i) {
3642+
(mlx5_core_native_port_num(mpi->mdev) - 1) == i &&
3643+
mlx5_core_same_coredev_type(dev->mdev, mpi->mdev)) {
36433644
bound = mlx5_ib_bind_slave_port(dev, mpi);
36443645
}
36453646

@@ -4785,7 +4786,8 @@ static int mlx5r_mp_probe(struct auxiliary_device *adev,
47854786

47864787
mutex_lock(&mlx5_ib_multiport_mutex);
47874788
list_for_each_entry(dev, &mlx5_ib_dev_list, ib_dev_list) {
4788-
if (dev->sys_image_guid == mpi->sys_image_guid)
4789+
if (dev->sys_image_guid == mpi->sys_image_guid &&
4790+
mlx5_core_same_coredev_type(dev->mdev, mpi->mdev))
47894791
bound = mlx5_ib_bind_slave_port(dev, mpi);
47904792

47914793
if (bound) {

include/linux/mlx5/driver.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,6 +1202,12 @@ static inline bool mlx5_core_is_vf(const struct mlx5_core_dev *dev)
12021202
return dev->coredev_type == MLX5_COREDEV_VF;
12031203
}
12041204

1205+
static inline bool mlx5_core_same_coredev_type(const struct mlx5_core_dev *dev1,
1206+
const struct mlx5_core_dev *dev2)
1207+
{
1208+
return dev1->coredev_type == dev2->coredev_type;
1209+
}
1210+
12051211
static inline bool mlx5_core_is_ecpf(const struct mlx5_core_dev *dev)
12061212
{
12071213
return dev->caps.embedded_cpu;

0 commit comments

Comments
 (0)