be2net: Fix issues in error recovery due to wrong queue state
authorPadmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Sat, 20 Oct 2012 06:03:25 +0000 (06:03 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 22 Oct 2012 02:15:36 +0000 (22:15 -0400)
During recovery from a FW error, destroy queue operation may fail.
Queue should be marked as destroyed so that recovery code can recreate
the queue. Also fix queue created state not getting checked at one instance.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/emulex/benet/be_cmds.c

index 9d602f4a09d51ea668423868f65c82e83e8cbabc..15202d07cf8a3dc979652406fde3a4f17de7b9c8 100644 (file)
@@ -681,6 +681,9 @@ static struct be_mcc_wrb *wrb_from_mccq(struct be_adapter *adapter)
        struct be_queue_info *mccq = &adapter->mcc_obj.q;
        struct be_mcc_wrb *wrb;
 
+       if (!mccq->created)
+               return NULL;
+
        if (atomic_read(&mccq->used) >= mccq->len) {
                dev_err(&adapter->pdev->dev, "Out of MCCQ wrbs\n");
                return NULL;
@@ -1235,8 +1238,7 @@ int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q,
        req->id = cpu_to_le16(q->id);
 
        status = be_mbox_notify_wait(adapter);
-       if (!status)
-               q->created = false;
+       q->created = false;
 
        mutex_unlock(&adapter->mbox_lock);
        return status;
@@ -1263,8 +1265,7 @@ int be_cmd_rxq_destroy(struct be_adapter *adapter, struct be_queue_info *q)
        req->id = cpu_to_le16(q->id);
 
        status = be_mcc_notify_wait(adapter);
-       if (!status)
-               q->created = false;
+       q->created = false;
 
 err:
        spin_unlock_bh(&adapter->mcc_lock);