summaryrefslogtreecommitdiffstats
path: root/src/net/infiniband
diff options
context:
space:
mode:
authorMichael Brown2010-09-16 04:23:45 +0200
committerMichael Brown2010-09-16 04:30:45 +0200
commit09555826e9737cbe94be99331934d2e6a1e6c8be (patch)
tree2e356c0db029cbba37519b912e8b4edc8f51eb88 /src/net/infiniband
parent[scsi] Include sense key within error number reported to user (diff)
downloadipxe-09555826e9737cbe94be99331934d2e6a1e6c8be.tar.gz
ipxe-09555826e9737cbe94be99331934d2e6a1e6c8be.tar.xz
ipxe-09555826e9737cbe94be99331934d2e6a1e6c8be.zip
[infiniband] Always call ib_link_state_changed() in ib_smc_update()
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>
Diffstat (limited to 'src/net/infiniband')
-rw-r--r--src/net/infiniband/ib_smc.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/src/net/infiniband/ib_smc.c b/src/net/infiniband/ib_smc.c
index 5eef8255..2e0535ab 100644
--- a/src/net/infiniband/ib_smc.c
+++ b/src/net/infiniband/ib_smc.c
@@ -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;
+}