Skip to content

Commit 91b4b2c

Browse files
chiarameiohasrleon
authored andcommitted
RDMA/mlx5: Initialize phys_port_cnt earlier in RDMA device creation
phys_port_cnt of the IB device must be initialized before calling ib_device_set_netdev(). Previously, phys_port_cnt was initialized in the mlx5_ib init function. Remove this initialization to allow setting it separately, providing the flexibility to call ib_device_set_netdev before registering the IB device. Signed-off-by: Chiara Meiohas <[email protected]> Signed-off-by: Michael Guralnik <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 3ed7f9e commit 91b4b2c

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

drivers/infiniband/hw/mlx5/ib_rep.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ mlx5_ib_vport_rep_load(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep)
104104
ibdev->is_rep = true;
105105
vport_index = rep->vport_index;
106106
ibdev->port[vport_index].rep = rep;
107+
ibdev->ib_dev.phys_port_cnt = num_ports;
107108
ibdev->port[vport_index].roce.netdev =
108109
mlx5_ib_get_rep_netdev(lag_master->priv.eswitch, rep->vport);
109110
ibdev->mdev = lag_master;

drivers/infiniband/hw/mlx5/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3934,7 +3934,6 @@ static int mlx5_ib_stage_init_init(struct mlx5_ib_dev *dev)
39343934

39353935
dev->ib_dev.node_type = RDMA_NODE_IB_CA;
39363936
dev->ib_dev.local_dma_lkey = 0 /* not supported for now */;
3937-
dev->ib_dev.phys_port_cnt = dev->num_ports;
39383937
dev->ib_dev.dev.parent = mdev->device;
39393938
dev->ib_dev.lag_flags = RDMA_LAG_FLAGS_HASH_ALL_SLAVES;
39403939

@@ -4649,6 +4648,7 @@ static struct ib_device *mlx5_ib_add_sub_dev(struct ib_device *parent,
46494648
mplane->mdev = mparent->mdev;
46504649
mplane->num_ports = mparent->num_plane;
46514650
mplane->sub_dev_name = name;
4651+
mplane->ib_dev.phys_port_cnt = mplane->num_ports;
46524652

46534653
ret = __mlx5_ib_add(mplane, &plane_profile);
46544654
if (ret)
@@ -4765,6 +4765,7 @@ static int mlx5r_probe(struct auxiliary_device *adev,
47654765

47664766
dev->mdev = mdev;
47674767
dev->num_ports = num_ports;
4768+
dev->ib_dev.phys_port_cnt = num_ports;
47684769

47694770
if (ll == IB_LINK_LAYER_ETHERNET && !mlx5_get_roce_state(mdev))
47704771
profile = &raw_eth_profile;

0 commit comments

Comments
 (0)