[infiniband] Require drivers to specify the number of ports

Require drivers to report the total number of Infiniband ports.  This
is necessary to report the correct number of ports on devices with
dynamic port types.

For example, dual-port Mellanox cards configured for (eth, ib) would
be rejected by the subnet manager, because they report using "port 2,
out of 1".

Signed-off-by: Christian Iversen <ci@iversenit.dk>
This commit is contained in:
Christian Iversen
2021-01-27 00:43:51 +01:00
committed by Michael Brown
parent 4f9fbe6c16
commit b9de7e6eda
9 changed files with 9 additions and 22 deletions

View File

@@ -813,26 +813,6 @@ void ib_mcast_detach ( struct ib_device *ibdev, struct ib_queue_pair *qp,
***************************************************************************
*/
/**
* Count Infiniband HCA ports
*
* @v ibdev Infiniband device
* @ret num_ports Number of ports
*/
int ib_count_ports ( struct ib_device *ibdev ) {
struct ib_device *tmp;
int num_ports = 0;
/* Search for IB devices with the same physical device to
* identify port count.
*/
for_each_ibdev ( tmp ) {
if ( tmp->dev == ibdev->dev )
num_ports++;
}
return num_ports;
}
/**
* Set port information
*

View File

@@ -63,7 +63,7 @@ static void ib_sma_node_info ( struct ib_device *ibdev,
node_info->base_version = IB_MGMT_BASE_VERSION;
node_info->class_version = IB_SMP_CLASS_VERSION;
node_info->node_type = IB_NODE_TYPE_HCA;
node_info->num_ports = ib_count_ports ( ibdev );
node_info->num_ports = ibdev->ports;
memcpy ( &node_info->sys_guid, &ibdev->node_guid,
sizeof ( node_info->sys_guid ) );
memcpy ( &node_info->node_guid, &ibdev->node_guid,