cxgb4: Don't sleep when mbox cmd is issued from interrupt context
authorHariprasad Shenai <hariprasad@chelsio.com>
Tue, 3 May 2016 13:28:01 +0000 (18:58 +0530)
committerDavid S. Miller <davem@davemloft.net>
Wed, 4 May 2016 17:59:27 +0000 (13:59 -0400)
When link goes down, from the interrupt handler DCB priority for the
Tx queues needs to be unset. We issue mbox command to unset the Tx queue
priority with negative timeout. In t4_wr_mbox_meat_timeout() do not sleep
when negative timeout is passed, since it is called from interrupt context.

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c

index 49bcbf16c9caee11a1be5193362b87ee8339a347..59f5e0b40286737aa92da86594c3b699974a08c0 100644 (file)
@@ -304,6 +304,12 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, const void *cmd,
        if (adap->pdev->error_state != pci_channel_io_normal)
                return -EIO;
 
+       /* If we have a negative timeout, that implies that we can't sleep. */
+       if (timeout < 0) {
+               sleep_ok = false;
+               timeout = -timeout;
+       }
+
        v = MBOWNER_G(t4_read_reg(adap, ctl_reg));
        for (i = 0; v == MBOX_OWNER_NONE && i < 3; i++)
                v = MBOWNER_G(t4_read_reg(adap, ctl_reg));