]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[infiniband] Always call ib_link_state_changed() in ib_smc_update()
authorMichael Brown <mcb30@ipxe.org>
Thu, 16 Sep 2010 02:23:45 +0000 (03:23 +0100)
committerMichael Brown <mcb30@ipxe.org>
Thu, 16 Sep 2010 02:30:45 +0000 (03:30 +0100)
ib_smc_update() potentially updates the Infiniband port state, and so
should almost always be followed by a call to ib_link_state_changed().
The one exception is the call made to ib_smc_update() before the
device is registered.

Fix by removing explicit calls to ib_link_state_changed() from drivers
using ib_smc_update(), including a call to ib_link_state_changed()
within ib_smc_update(), and creating a separate ib_smc_init() for use
prior to device registration.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/infiniband/arbel.c
src/drivers/infiniband/hermon.c
src/include/ipxe/ib_smc.h
src/net/infiniband/ib_smc.c

index 129ec574ee3d7a811d3b2b886a3ed4258e7f84fb..7685532707eda3aa4bd5676b62a6986bdcb1094a 100644 (file)
@@ -1436,9 +1436,6 @@ static void arbel_event_port_state_change ( struct arbel *arbel,
 
        /* Update MAD parameters */
        ib_smc_update ( arbel->ibdev[port], arbel_mad );
-
-       /* Notify Infiniband core of link state change */
-       ib_link_state_changed ( arbel->ibdev[port] );
 }
 
 /**
@@ -2169,9 +2166,9 @@ static int arbel_probe ( struct pci_device *pci,
        if ( ( rc = arbel_create_eq ( arbel ) ) != 0 )
                goto err_create_eq;
 
-       /* Update MAD parameters */
+       /* Initialise parameters using SMC */
        for ( i = 0 ; i < ARBEL_NUM_PORTS ; i++ )
-               ib_smc_update ( arbel->ibdev[i], arbel_mad );
+               ib_smc_init ( arbel->ibdev[i], arbel_mad );
 
        /* Register Infiniband devices */
        for ( i = 0 ; i < ARBEL_NUM_PORTS ; i++ ) {
index 8b5c2487c67197ebedbf07cf1a5484b52d1bd2dd..907865ded5e305f8a28bf8884181f10896c59901 100644 (file)
@@ -1821,9 +1821,6 @@ static void hermon_event_port_state_change ( struct hermon *hermon,
 
        /* Update MAD parameters */
        ib_smc_update ( hermon->ibdev[port], hermon_mad );
-
-       /* Notify Infiniband core of link state change */
-       ib_link_state_changed ( hermon->ibdev[port] );
 }
 
 /**
@@ -2826,10 +2823,9 @@ static int hermon_probe ( struct pci_device *pci,
        if ( ( rc = hermon_configure_special_qps ( hermon ) ) != 0 )
                goto err_conf_special_qps;
 
-       /* Update IPoIB MAC address */
-       for ( i = 0 ; i < hermon->cap.num_ports ; i++ ) {
-               ib_smc_update ( hermon->ibdev[i], hermon_mad );
-       }
+       /* Initialise parameters using SMC */
+       for ( i = 0 ; i < hermon->cap.num_ports ; i++ )
+               ib_smc_init ( hermon->ibdev[i], hermon_mad );
 
        /* Register Infiniband devices */
        for ( i = 0 ; i < hermon->cap.num_ports ; i++ ) {
index d16a37fa3f3bd6a5439b1eb0f6643b3785c2cda6..259d2cde165bd7fdde9c5aa7c804a9c7051b1802 100644 (file)
@@ -14,7 +14,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
 typedef int ( * ib_local_mad_t ) ( struct ib_device *ibdev,
                                   union ib_mad *mad );
 
-extern int ib_smc_update ( struct ib_device *ibdev,
-                          ib_local_mad_t local_mad );
+extern int ib_smc_init ( struct ib_device *ibdev, ib_local_mad_t local_mad );
+extern int ib_smc_update ( struct ib_device *ibdev, ib_local_mad_t local_mad );
 
 #endif /* _IPXE_IB_SMC_H */
index 5eef8255a1b88c0ea01fa073b2f82f1054293aab..2e0535abafcd57535cc41fe25ab498d89ed0071c 100644 (file)
@@ -123,13 +123,13 @@ static int ib_smc_get_pkey_table ( struct ib_device *ibdev,
 }
 
 /**
- * Get MAD parameters
+ * Get Infiniband parameters using SMC
  *
  * @v ibdev            Infiniband device
  * @v local_mad                Method for issuing local MADs
  * @ret rc             Return status code
  */
-int ib_smc_update ( struct ib_device *ibdev, ib_local_mad_t local_mad ) {
+static int ib_smc_get ( struct ib_device *ibdev, ib_local_mad_t local_mad ) {
        union ib_mad mad;
        struct ib_port_info *port_info = &mad.smp.smp_data.port_info;
        struct ib_guid_info *guid_info = &mad.smp.smp_data.guid_info;
@@ -174,3 +174,40 @@ int ib_smc_update ( struct ib_device *ibdev, ib_local_mad_t local_mad ) {
 
        return 0;
 }
+
+/**
+ * Initialise Infiniband parameters using SMC
+ *
+ * @v ibdev            Infiniband device
+ * @v local_mad                Method for issuing local MADs
+ * @ret rc             Return status code
+ */
+int ib_smc_init ( struct ib_device *ibdev, ib_local_mad_t local_mad ) {
+       int rc;
+
+       /* Get MAD parameters */
+       if ( ( rc = ib_smc_get ( ibdev, local_mad ) ) != 0 )
+               return rc;
+
+       return 0;
+}
+
+/**
+ * Update Infiniband parameters using SMC
+ *
+ * @v ibdev            Infiniband device
+ * @v local_mad                Method for issuing local MADs
+ * @ret rc             Return status code
+ */
+int ib_smc_update ( struct ib_device *ibdev, ib_local_mad_t local_mad ) {
+       int rc;
+
+       /* Get MAD parameters */
+       if ( ( rc = ib_smc_get ( ibdev, local_mad ) ) != 0 )
+               return rc;
+
+       /* Notify Infiniband core of potential link state change */
+       ib_link_state_changed ( ibdev );
+
+       return 0;
+}