Commit fa68bfab authored by Lijun Pan's avatar Lijun Pan Committed by David S. Miller

ibmvnic: improve ibmvnic_init and ibmvnic_reset_init

When H_SEND_CRQ command returns with H_CLOSED, it means the
server's CRQ is not ready yet. Instead of resetting immediately,
we wait for the server to launch passive init.
ibmvnic_init() and ibmvnic_reset_init() should also return the
error code from ibmvnic_send_crq_init() call.
Signed-off-by: default avatarLijun Pan <ljp@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4c5f6af0
...@@ -3556,8 +3556,7 @@ static int ibmvnic_send_crq(struct ibmvnic_adapter *adapter, ...@@ -3556,8 +3556,7 @@ static int ibmvnic_send_crq(struct ibmvnic_adapter *adapter,
if (rc) { if (rc) {
if (rc == H_CLOSED) { if (rc == H_CLOSED) {
dev_warn(dev, "CRQ Queue closed\n"); dev_warn(dev, "CRQ Queue closed\n");
if (test_bit(0, &adapter->resetting)) /* do not reset, report the fail, wait for passive init from server */
ibmvnic_reset(adapter, VNIC_RESET_FATAL);
} }
dev_warn(dev, "Send error (rc=%d)\n", rc); dev_warn(dev, "Send error (rc=%d)\n", rc);
...@@ -5002,7 +5001,12 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter *adapter) ...@@ -5002,7 +5001,12 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter *adapter)
reinit_completion(&adapter->init_done); reinit_completion(&adapter->init_done);
adapter->init_done_rc = 0; adapter->init_done_rc = 0;
ibmvnic_send_crq_init(adapter); rc = ibmvnic_send_crq_init(adapter);
if (rc) {
dev_err(dev, "Send crq init failed with error %d\n", rc);
return rc;
}
if (!wait_for_completion_timeout(&adapter->init_done, timeout)) { if (!wait_for_completion_timeout(&adapter->init_done, timeout)) {
dev_err(dev, "Initialization sequence timed out\n"); dev_err(dev, "Initialization sequence timed out\n");
return -1; return -1;
...@@ -5056,7 +5060,12 @@ static int ibmvnic_init(struct ibmvnic_adapter *adapter) ...@@ -5056,7 +5060,12 @@ static int ibmvnic_init(struct ibmvnic_adapter *adapter)
adapter->from_passive_init = false; adapter->from_passive_init = false;
adapter->init_done_rc = 0; adapter->init_done_rc = 0;
ibmvnic_send_crq_init(adapter); rc = ibmvnic_send_crq_init(adapter);
if (rc) {
dev_err(dev, "Send crq init failed with error %d\n", rc);
return rc;
}
if (!wait_for_completion_timeout(&adapter->init_done, timeout)) { if (!wait_for_completion_timeout(&adapter->init_done, timeout)) {
dev_err(dev, "Initialization sequence timed out\n"); dev_err(dev, "Initialization sequence timed out\n");
return -1; return -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment