Skip to content

Commit 6b278c0

Browse files
sukadevdavem330
authored andcommitted
ibmvnic: delay complete()
If we get CRQ_INIT, we set errno to -EIO and first call complete() to notify the waiter. Then we try to schedule a FAILOVER reset. If this occurs while adapter is in PROBING state, ibmvnic_reset() changes the error code to EAGAIN and returns without scheduling the FAILOVER. The purpose of setting error code to EAGAIN is to ask the waiter to retry. But due to the earlier complete() call, the waiter may already have seen the -EIO response and decided not to retry. This can cause intermittent failures when bringing up ibmvnic adapters during boot, specially in in kexec/kdump kernels. Defer the complete() call until after scheduling the reset. Also streamline the error code to EAGAIN. Don't see why we need EIO sometimes. All 3 callers of ibmvnic_reset_init() can handle EAGAIN. Fixes: 17c8705 ("ibmvnic: Return error code if init interrupted by transport event") Reported-by: Vaishnavi Bhat <[email protected]> Signed-off-by: Sukadev Bhattiprolu <[email protected]> Reviewed-by: Dany Madden <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6e20d00 commit 6b278c0

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

drivers/net/ethernet/ibm/ibmvnic.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2565,7 +2565,7 @@ static int ibmvnic_reset(struct ibmvnic_adapter *adapter,
25652565

25662566
if (adapter->state == VNIC_PROBING) {
25672567
netdev_warn(netdev, "Adapter reset during probe\n");
2568-
adapter->init_done_rc = EAGAIN;
2568+
adapter->init_done_rc = -EAGAIN;
25692569
ret = EAGAIN;
25702570
goto err;
25712571
}
@@ -5067,11 +5067,6 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq,
50675067
*/
50685068
adapter->login_pending = false;
50695069

5070-
if (!completion_done(&adapter->init_done)) {
5071-
complete(&adapter->init_done);
5072-
adapter->init_done_rc = -EIO;
5073-
}
5074-
50755070
if (adapter->state == VNIC_DOWN)
50765071
rc = ibmvnic_reset(adapter, VNIC_RESET_PASSIVE_INIT);
50775072
else
@@ -5092,6 +5087,13 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq,
50925087
rc);
50935088
adapter->failover_pending = false;
50945089
}
5090+
5091+
if (!completion_done(&adapter->init_done)) {
5092+
complete(&adapter->init_done);
5093+
if (!adapter->init_done_rc)
5094+
adapter->init_done_rc = -EAGAIN;
5095+
}
5096+
50955097
break;
50965098
case IBMVNIC_CRQ_INIT_COMPLETE:
50975099
dev_info(dev, "Partner initialization complete\n");
@@ -5559,7 +5561,7 @@ static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id)
55595561
}
55605562

55615563
rc = ibmvnic_reset_init(adapter, false);
5562-
} while (rc == EAGAIN);
5564+
} while (rc == -EAGAIN);
55635565

55645566
/* We are ignoring the error from ibmvnic_reset_init() assuming that the
55655567
* partner is not ready. CRQ is not active. When the partner becomes

0 commit comments

Comments
 (0)