]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[infiniband] Require drivers to specify the number of ports
authorChristian Iversen <ci@iversenit.dk>
Tue, 26 Jan 2021 23:43:51 +0000 (00:43 +0100)
committerMichael Brown <mcb30@ipxe.org>
Wed, 27 Jan 2021 01:15:35 +0000 (01:15 +0000)
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>
src/drivers/infiniband/arbel.c
src/drivers/infiniband/flexboot_nodnic.c
src/drivers/infiniband/golan.c
src/drivers/infiniband/hermon.c
src/drivers/infiniband/linda.c
src/drivers/infiniband/qib7322.c
src/include/ipxe/infiniband.h
src/net/infiniband.c
src/net/infiniband/ib_sma.c

index fb48487f3f2980099109ec622a7d21737dfaf892..fbef3f8a6453b6a8496c45798953b5b440b90b0d 100644 (file)
@@ -3061,6 +3061,7 @@ static int arbel_probe ( struct pci_device *pci ) {
                ibdev->op = &arbel_ib_operations;
                ibdev->dev = &pci->dev;
                ibdev->port = ( ARBEL_PORT_BASE + i );
+               ibdev->ports = ARBEL_NUM_PORTS;
                ib_set_drvdata ( ibdev, arbel );
        }
 
index 54b8584060202cdff183c782caa5494bda4709a4..c6e19b95572af053624660fbcd28b4aeadfec919 100644 (file)
@@ -1165,6 +1165,7 @@ flexboot_nodnic_allocate_infiniband_devices( struct flexboot_nodnic *flexboot_no
                ibdev->op = &flexboot_nodnic_ib_operations;
                ibdev->dev = &pci->dev;
                ibdev->port = ( FLEXBOOT_NODNIC_PORT_BASE + i);
+               ibdev->ports = device_priv->device_cap.num_ports;
                ib_set_drvdata(ibdev, flexboot_nodnic_priv);
        }
        return status;
index 441d3b73f51e831aa4370bffa199ccc10ce22f7e..2f1ab235764cf934747b6e0e94ffe618b4ba1a40 100755 (executable)
@@ -2386,6 +2386,7 @@ static int golan_probe_normal ( struct pci_device *pci ) {
                ibdev->op = &golan_ib_operations;
                ibdev->dev = &pci->dev;
                ibdev->port = (GOLAN_PORT_BASE + i);
+               ibdev->ports = golan->caps.num_ports;
                ib_set_drvdata( ibdev, golan );
        }
 
index fdf2d9dd873080f2c7543c9235d839ade1f1d4ff..7537d83c2b2104cc72a6a7e8cae7be6f4b2fef70 100644 (file)
@@ -3829,6 +3829,7 @@ static int hermon_probe ( struct pci_device *pci ) {
                ibdev->op = &hermon_ib_operations;
                ibdev->dev = &pci->dev;
                ibdev->port = ( HERMON_PORT_BASE + i );
+               ibdev->ports = hermon->cap.num_ports;
                ib_set_drvdata ( ibdev, hermon );
        }
 
index b275268a2560b2550f6657b408f12ba9942ebad7..8c59126607b50eb53008b478301e28ff7bcbbcb3 100644 (file)
@@ -2330,6 +2330,7 @@ static int linda_probe ( struct pci_device *pci ) {
        ibdev->op = &linda_ib_operations;
        ibdev->dev = &pci->dev;
        ibdev->port = 1;
+       ibdev->ports = 1;
 
        /* Fix up PCI device */
        adjust_pci_device ( pci );
index e3250147d107ee4c162cd181952808f1129d7ffb..a4b51db05c2a1c863d2af5a2ac0f6aee93e3ee70 100644 (file)
@@ -2348,6 +2348,7 @@ static int qib7322_probe ( struct pci_device *pci ) {
                ibdev->dev = &pci->dev;
                ibdev->op = &qib7322_ib_operations;
                ibdev->port = ( QIB7322_PORT_BASE + i );
+               ibdev->ports = QIB7322_MAX_PORTS;
                ibdev->link_width_enabled = ibdev->link_width_supported =
                        IB_LINK_WIDTH_4X; /* 1x does not work */
                ibdev->link_speed_enabled = ibdev->link_speed_supported =
index 6f4951f17c86b5f5a87faac158424a07f8359bf8..379bc109e9016a997f77d713f7e3021e0f7b8fb3 100644 (file)
@@ -416,6 +416,8 @@ struct ib_device {
        struct ib_device_operations *op;
        /** Port number */
        unsigned int port;
+       /** Total ports on device */
+       unsigned int ports;
        /** Port open request counter */
        unsigned int open_count;
 
@@ -538,7 +540,6 @@ extern int ib_mcast_attach ( struct ib_device *ibdev, struct ib_queue_pair *qp,
                             union ib_gid *gid );
 extern void ib_mcast_detach ( struct ib_device *ibdev,
                              struct ib_queue_pair *qp, union ib_gid *gid );
-extern int ib_count_ports ( struct ib_device *ibdev );
 extern int ib_set_port_info ( struct ib_device *ibdev, union ib_mad *mad );
 extern int ib_set_pkey_table ( struct ib_device *ibdev, union ib_mad *mad );
 extern struct ib_device * alloc_ibdev ( size_t priv_size );
index 3b79a660c21681724142807c5bf268a4131dc02c..e19e121c129e1ef2339eec9a7d0b82a2089536a8 100644 (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
  *
index 24ec9f4e0f9a60a8f37c04be308078bafc5566ff..b553e66b1cd26af4d6c2142bdac80eab6465dd3d 100644 (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,