Browse Source

[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>
tags/v1.20.1
Michael Brown 13 years ago
parent
commit
09555826e9

+ 2
- 5
src/drivers/infiniband/arbel.c View File

1436
 
1436
 
1437
 	/* Update MAD parameters */
1437
 	/* Update MAD parameters */
1438
 	ib_smc_update ( arbel->ibdev[port], arbel_mad );
1438
 	ib_smc_update ( arbel->ibdev[port], arbel_mad );
1439
-
1440
-	/* Notify Infiniband core of link state change */
1441
-	ib_link_state_changed ( arbel->ibdev[port] );
1442
 }
1439
 }
1443
 
1440
 
1444
 /**
1441
 /**
2169
 	if ( ( rc = arbel_create_eq ( arbel ) ) != 0 )
2166
 	if ( ( rc = arbel_create_eq ( arbel ) ) != 0 )
2170
 		goto err_create_eq;
2167
 		goto err_create_eq;
2171
 
2168
 
2172
-	/* Update MAD parameters */
2169
+	/* Initialise parameters using SMC */
2173
 	for ( i = 0 ; i < ARBEL_NUM_PORTS ; i++ )
2170
 	for ( i = 0 ; i < ARBEL_NUM_PORTS ; i++ )
2174
-		ib_smc_update ( arbel->ibdev[i], arbel_mad );
2171
+		ib_smc_init ( arbel->ibdev[i], arbel_mad );
2175
 
2172
 
2176
 	/* Register Infiniband devices */
2173
 	/* Register Infiniband devices */
2177
 	for ( i = 0 ; i < ARBEL_NUM_PORTS ; i++ ) {
2174
 	for ( i = 0 ; i < ARBEL_NUM_PORTS ; i++ ) {

+ 3
- 7
src/drivers/infiniband/hermon.c View File

1821
 
1821
 
1822
 	/* Update MAD parameters */
1822
 	/* Update MAD parameters */
1823
 	ib_smc_update ( hermon->ibdev[port], hermon_mad );
1823
 	ib_smc_update ( hermon->ibdev[port], hermon_mad );
1824
-
1825
-	/* Notify Infiniband core of link state change */
1826
-	ib_link_state_changed ( hermon->ibdev[port] );
1827
 }
1824
 }
1828
 
1825
 
1829
 /**
1826
 /**
2826
 	if ( ( rc = hermon_configure_special_qps ( hermon ) ) != 0 )
2823
 	if ( ( rc = hermon_configure_special_qps ( hermon ) ) != 0 )
2827
 		goto err_conf_special_qps;
2824
 		goto err_conf_special_qps;
2828
 
2825
 
2829
-	/* Update IPoIB MAC address */
2830
-	for ( i = 0 ; i < hermon->cap.num_ports ; i++ ) {
2831
-		ib_smc_update ( hermon->ibdev[i], hermon_mad );
2832
-	}
2826
+	/* Initialise parameters using SMC */
2827
+	for ( i = 0 ; i < hermon->cap.num_ports ; i++ )
2828
+		ib_smc_init ( hermon->ibdev[i], hermon_mad );
2833
 
2829
 
2834
 	/* Register Infiniband devices */
2830
 	/* Register Infiniband devices */
2835
 	for ( i = 0 ; i < hermon->cap.num_ports ; i++ ) {
2831
 	for ( i = 0 ; i < hermon->cap.num_ports ; i++ ) {

+ 2
- 2
src/include/ipxe/ib_smc.h View File

14
 typedef int ( * ib_local_mad_t ) ( struct ib_device *ibdev,
14
 typedef int ( * ib_local_mad_t ) ( struct ib_device *ibdev,
15
 				   union ib_mad *mad );
15
 				   union ib_mad *mad );
16
 
16
 
17
-extern int ib_smc_update ( struct ib_device *ibdev,
18
-			   ib_local_mad_t local_mad );
17
+extern int ib_smc_init ( struct ib_device *ibdev, ib_local_mad_t local_mad );
18
+extern int ib_smc_update ( struct ib_device *ibdev, ib_local_mad_t local_mad );
19
 
19
 
20
 #endif /* _IPXE_IB_SMC_H */
20
 #endif /* _IPXE_IB_SMC_H */

+ 39
- 2
src/net/infiniband/ib_smc.c View File

123
 }
123
 }
124
 
124
 
125
 /**
125
 /**
126
- * Get MAD parameters
126
+ * Get Infiniband parameters using SMC
127
  *
127
  *
128
  * @v ibdev		Infiniband device
128
  * @v ibdev		Infiniband device
129
  * @v local_mad		Method for issuing local MADs
129
  * @v local_mad		Method for issuing local MADs
130
  * @ret rc		Return status code
130
  * @ret rc		Return status code
131
  */
131
  */
132
-int ib_smc_update ( struct ib_device *ibdev, ib_local_mad_t local_mad ) {
132
+static int ib_smc_get ( struct ib_device *ibdev, ib_local_mad_t local_mad ) {
133
 	union ib_mad mad;
133
 	union ib_mad mad;
134
 	struct ib_port_info *port_info = &mad.smp.smp_data.port_info;
134
 	struct ib_port_info *port_info = &mad.smp.smp_data.port_info;
135
 	struct ib_guid_info *guid_info = &mad.smp.smp_data.guid_info;
135
 	struct ib_guid_info *guid_info = &mad.smp.smp_data.guid_info;
174
 
174
 
175
 	return 0;
175
 	return 0;
176
 }
176
 }
177
+
178
+/**
179
+ * Initialise Infiniband parameters using SMC
180
+ *
181
+ * @v ibdev		Infiniband device
182
+ * @v local_mad		Method for issuing local MADs
183
+ * @ret rc		Return status code
184
+ */
185
+int ib_smc_init ( struct ib_device *ibdev, ib_local_mad_t local_mad ) {
186
+	int rc;
187
+
188
+	/* Get MAD parameters */
189
+	if ( ( rc = ib_smc_get ( ibdev, local_mad ) ) != 0 )
190
+		return rc;
191
+
192
+	return 0;
193
+}
194
+
195
+/**
196
+ * Update Infiniband parameters using SMC
197
+ *
198
+ * @v ibdev		Infiniband device
199
+ * @v local_mad		Method for issuing local MADs
200
+ * @ret rc		Return status code
201
+ */
202
+int ib_smc_update ( struct ib_device *ibdev, ib_local_mad_t local_mad ) {
203
+	int rc;
204
+
205
+	/* Get MAD parameters */
206
+	if ( ( rc = ib_smc_get ( ibdev, local_mad ) ) != 0 )
207
+		return rc;
208
+
209
+	/* Notify Infiniband core of potential link state change */
210
+	ib_link_state_changed ( ibdev );
211
+
212
+	return 0;
213
+}

Loading…
Cancel
Save