Skip to content

Commit 32f69e4

Browse files
Daniel Jurgensjgunthorpe
authored andcommitted
{net, IB}/mlx5: Manage port association for multiport RoCE
When mlx5_ib_add is called determine if the mlx5 core device being added is capable of dual port RoCE operation. If it is, determine whether it is a master device or a slave device using the num_vhca_ports and affiliate_nic_vport_criteria capabilities. If the device is a slave, attempt to find a master device to affiliate it with. Devices that can be affiliated will share a system image guid. If none are found place it on a list of unaffiliated ports. If a master is found bind the port to it by configuring the port affiliation in the NIC vport context. Similarly when mlx5_ib_remove is called determine the port type. If it's a slave port, unaffiliate it from the master device, otherwise just remove it from the unaffiliated port list. The IB device is registered as a multiport device, even if a 2nd port is not available for affiliation. When the 2nd port is affiliated later the GID cache must be refreshed in order to get the default GIDs for the 2nd port in the cache. Export roce_rescan_device to provide a mechanism to refresh the cache after a new port is bound. In a multiport configuration all IB object (QP, MR, PD, etc) related commands should flow through the master mlx5_core_dev, other commands must be sent to the slave port mlx5_core_mdev, an interface is provide to get the correct mdev for non IB object commands. Signed-off-by: Daniel Jurgens <[email protected]> Reviewed-by: Parav Pandit <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 7fd8aef commit 32f69e4

File tree

12 files changed

+550
-42
lines changed

12 files changed

+550
-42
lines changed

drivers/infiniband/core/cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ static int gid_table_setup_one(struct ib_device *ib_dev)
821821
if (err)
822822
return err;
823823

824-
roce_rescan_device(ib_dev);
824+
rdma_roce_rescan_device(ib_dev);
825825

826826
return err;
827827
}

drivers/infiniband/core/core_priv.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ int ib_cache_gid_del_all_netdev_gids(struct ib_device *ib_dev, u8 port,
137137
int roce_gid_mgmt_init(void);
138138
void roce_gid_mgmt_cleanup(void);
139139

140-
void roce_rescan_device(struct ib_device *ib_dev);
141140
unsigned long roce_gid_type_mask_support(struct ib_device *ib_dev, u8 port);
142141

143142
int ib_cache_setup_one(struct ib_device *device);

drivers/infiniband/core/roce_gid_mgmt.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,13 +410,18 @@ static void enum_all_gids_of_dev_cb(struct ib_device *ib_dev,
410410
rtnl_unlock();
411411
}
412412

413-
/* This function will rescan all of the network devices in the system
414-
* and add their gids, as needed, to the relevant RoCE devices. */
415-
void roce_rescan_device(struct ib_device *ib_dev)
413+
/**
414+
* rdma_roce_rescan_device - Rescan all of the network devices in the system
415+
* and add their gids, as needed, to the relevant RoCE devices.
416+
*
417+
* @device: the rdma device
418+
*/
419+
void rdma_roce_rescan_device(struct ib_device *ib_dev)
416420
{
417421
ib_enum_roce_netdev(ib_dev, pass_all_filter, NULL,
418422
enum_all_gids_of_dev_cb, NULL);
419423
}
424+
EXPORT_SYMBOL(rdma_roce_rescan_device);
420425

421426
static void callback_for_addr_gid_device_scan(struct ib_device *device,
422427
u8 port,

0 commit comments

Comments
 (0)