ibmvnic: Handle failover after failed init crq
authorJohn Allen <jallen@linux.vnet.ibm.com>
Fri, 26 May 2017 14:30:19 +0000 (10:30 -0400)
committerDavid S. Miller <davem@davemloft.net>
Fri, 26 May 2017 19:32:44 +0000 (15:32 -0400)
Handle case where phyp sends a failover after failing to send the
init crq.

Signed-off-by: John Allen <jallen@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ibm/ibmvnic.c
drivers/net/ethernet/ibm/ibmvnic.h

index 4997de425b5c3bef8480f9cebb4f53af523a592d..1f7cf6fbe150f4f57bdcf4f09f152477b6b4ca66 100644 (file)
@@ -3167,6 +3167,8 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq,
                switch (gen_crq->cmd) {
                case IBMVNIC_CRQ_INIT:
                        dev_info(dev, "Partner initialized\n");
+                       adapter->from_passive_init = true;
+                       complete(&adapter->init_done);
                        break;
                case IBMVNIC_CRQ_INIT_COMPLETE:
                        dev_info(dev, "Partner initialization complete\n");
@@ -3481,11 +3483,18 @@ static int ibmvnic_init(struct ibmvnic_adapter *adapter)
                return rc;
        }
 
+       adapter->from_passive_init = false;
+
        init_completion(&adapter->init_done);
        ibmvnic_send_crq_init(adapter);
        if (!wait_for_completion_timeout(&adapter->init_done, timeout)) {
                dev_err(dev, "Initialization sequence timed out\n");
-               release_crq_queue(adapter);
+               return -1;
+       }
+
+       if (adapter->from_passive_init) {
+               adapter->state = VNIC_OPEN;
+               adapter->from_passive_init = false;
                return -1;
        }
 
index 4816e042502587ade9a97dd0089ca6c6913c56a6..fa6ac4e4a16e68822a0154f34759fc8107cac7d6 100644 (file)
@@ -1031,5 +1031,5 @@ struct ibmvnic_adapter {
        struct list_head rwi_list;
        struct work_struct ibmvnic_reset;
        bool resetting;
-       bool napi_enabled;
+       bool napi_enabled, from_passive_init;
 };