|
@@ -238,6 +238,32 @@ static void linda_link_state_changed ( struct ib_device *ibdev ) {
|
238
|
238
|
ib_link_state_changed ( ibdev );
|
239
|
239
|
}
|
240
|
240
|
|
|
241
|
+/**
|
|
242
|
+ * Wait for link state change to take effect
|
|
243
|
+ *
|
|
244
|
+ * @v linda Linda device
|
|
245
|
+ * @v new_link_state Expected link state
|
|
246
|
+ * @ret rc Return status code
|
|
247
|
+ */
|
|
248
|
+static int linda_link_state_check ( struct linda *linda,
|
|
249
|
+ unsigned int new_link_state ) {
|
|
250
|
+ struct QIB_7220_IBCStatus ibcstatus;
|
|
251
|
+ unsigned int link_state;
|
|
252
|
+ unsigned int i;
|
|
253
|
+
|
|
254
|
+ for ( i = 0 ; i < LINDA_LINK_STATE_MAX_WAIT_US ; i++ ) {
|
|
255
|
+ linda_readq ( linda, &ibcstatus, QIB_7220_IBCStatus_offset );
|
|
256
|
+ link_state = BIT_GET ( &ibcstatus, LinkState );
|
|
257
|
+ if ( link_state == new_link_state )
|
|
258
|
+ return 0;
|
|
259
|
+ udelay ( 1 );
|
|
260
|
+ }
|
|
261
|
+
|
|
262
|
+ DBGC ( linda, "Linda %p timed out waiting for link state %s\n",
|
|
263
|
+ linda, linda_link_state_text ( link_state ) );
|
|
264
|
+ return -ETIMEDOUT;
|
|
265
|
+}
|
|
266
|
+
|
241
|
267
|
/**
|
242
|
268
|
* Set port information
|
243
|
269
|
*
|
|
@@ -260,6 +286,12 @@ static int linda_set_port_info ( struct ib_device *ibdev, union ib_mad *mad ) {
|
260
|
286
|
linda_readq ( linda, &ibcctrl, QIB_7220_IBCCtrl_offset );
|
261
|
287
|
BIT_SET ( &ibcctrl, LinkCmd, link_state );
|
262
|
288
|
linda_writeq ( linda, &ibcctrl, QIB_7220_IBCCtrl_offset );
|
|
289
|
+
|
|
290
|
+ /* Wait for link state change to take effect. Ignore
|
|
291
|
+ * errors; the current link state will be returned via
|
|
292
|
+ * the GetResponse MAD.
|
|
293
|
+ */
|
|
294
|
+ linda_link_state_check ( linda, link_state );
|
263
|
295
|
}
|
264
|
296
|
|
265
|
297
|
/* Detect and report link state change */
|