forked from luck/tmp_suning_uos_patched
ibmvnic: Handle all login error conditions
There is a bug in handling the possible return codes from sending the login CRQ. The current code treats any non-success return value, minus failure to send the crq and a timeout waiting for a login response, as a need to re-send the login CRQ. This can put the drive in an infinite loop of trying to login when getting return values other that a partial success such as a return code of aborted. For these scenarios the login will not ever succeed at this point and the driver would need to be reset again. To resolve this loop trying to login is updated to only retry the login if the driver gets a return code of a partial success. Other return codes are treated as an error and the driver returns an error from ibmvnic_login(). To avoid infinite looping in the partial success return cases, the number of retries is capped at the maximum number of supported queues. This value was chosen because the driver does a renegotiation of capabilities which sets the number of queues possible and allows the driver to attempt a login for possible value for the number of queues supported. Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
7dd07c143a
commit
64d92aa2c9
|
@ -794,46 +794,61 @@ static int ibmvnic_login(struct net_device *netdev)
|
|||
{
|
||||
struct ibmvnic_adapter *adapter = netdev_priv(netdev);
|
||||
unsigned long timeout = msecs_to_jiffies(30000);
|
||||
struct device *dev = &adapter->vdev->dev;
|
||||
int retry_count = 0;
|
||||
int rc;
|
||||
|
||||
do {
|
||||
if (adapter->renegotiate) {
|
||||
adapter->renegotiate = false;
|
||||
if (retry_count > IBMVNIC_MAX_QUEUES) {
|
||||
netdev_warn(netdev, "Login attempts exceeded\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
adapter->init_done_rc = 0;
|
||||
reinit_completion(&adapter->init_done);
|
||||
rc = send_login(adapter);
|
||||
if (rc) {
|
||||
netdev_warn(netdev, "Unable to login\n");
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (!wait_for_completion_timeout(&adapter->init_done,
|
||||
timeout)) {
|
||||
netdev_warn(netdev, "Login timed out\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (adapter->init_done_rc == PARTIALSUCCESS) {
|
||||
retry_count++;
|
||||
release_sub_crqs(adapter, 1);
|
||||
|
||||
adapter->init_done_rc = 0;
|
||||
reinit_completion(&adapter->init_done);
|
||||
send_cap_queries(adapter);
|
||||
if (!wait_for_completion_timeout(&adapter->init_done,
|
||||
timeout)) {
|
||||
dev_err(dev, "Capabilities query timeout\n");
|
||||
netdev_warn(netdev,
|
||||
"Capabilities query timed out\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = init_sub_crqs(adapter);
|
||||
if (rc) {
|
||||
dev_err(dev,
|
||||
"Initialization of SCRQ's failed\n");
|
||||
netdev_warn(netdev,
|
||||
"SCRQ initialization failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = init_sub_crq_irqs(adapter);
|
||||
if (rc) {
|
||||
dev_err(dev,
|
||||
"Initialization of SCRQ's irqs failed\n");
|
||||
netdev_warn(netdev,
|
||||
"SCRQ irq initialization failed\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
reinit_completion(&adapter->init_done);
|
||||
rc = send_login(adapter);
|
||||
if (rc) {
|
||||
dev_err(dev, "Unable to attempt device login\n");
|
||||
return rc;
|
||||
} else if (!wait_for_completion_timeout(&adapter->init_done,
|
||||
timeout)) {
|
||||
dev_err(dev, "Login timeout\n");
|
||||
} else if (adapter->init_done_rc) {
|
||||
netdev_warn(netdev, "Adapter login failed\n");
|
||||
return -1;
|
||||
}
|
||||
} while (adapter->renegotiate);
|
||||
} while (adapter->init_done_rc == PARTIALSUCCESS);
|
||||
|
||||
/* handle pending MAC address changes after successful login */
|
||||
if (adapter->mac_change_pending) {
|
||||
|
@ -3942,7 +3957,7 @@ static int handle_login_rsp(union ibmvnic_crq *login_rsp_crq,
|
|||
* to resend the login buffer with fewer queues requested.
|
||||
*/
|
||||
if (login_rsp_crq->generic.rc.code) {
|
||||
adapter->renegotiate = true;
|
||||
adapter->init_done_rc = login_rsp_crq->generic.rc.code;
|
||||
complete(&adapter->init_done);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1035,7 +1035,6 @@ struct ibmvnic_adapter {
|
|||
|
||||
struct ibmvnic_sub_crq_queue **tx_scrq;
|
||||
struct ibmvnic_sub_crq_queue **rx_scrq;
|
||||
bool renegotiate;
|
||||
|
||||
/* rx structs */
|
||||
struct napi_struct *napi;
|
||||
|
|
Loading…
Reference in New Issue
Block a user