cnic: Unify IRQ code for all hardware types.
authorMichael Chan <mchan@broadcom.com>
Thu, 24 Jun 2010 14:58:38 +0000 (14:58 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 26 Jun 2010 03:37:19 +0000 (20:37 -0700)
By creating a common cnic_doirq().

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/cnic.c

index 70a53cc7df327e91bb4a4b9ed8111ab3dd56841a..df6a0ccf0655e61e3d5fe2b6008629d04a4e04d6 100644 (file)
@@ -2188,6 +2188,9 @@ static void cnic_chk_pkt_rings(struct cnic_local *cp)
        u16 tx_cons = *cp->tx_cons_ptr;
        int comp = 0;
 
+       if (!test_bit(CNIC_F_CNIC_UP, &cp->dev->flags))
+               return;
+
        if (cp->tx_cons != tx_cons || cp->rx_cons != rx_cons) {
                if (test_bit(CNIC_LCL_FL_L2_WAIT, &cp->cnic_local_flags))
                        comp = cnic_l2_completion(cp);
@@ -2284,20 +2287,28 @@ done:
                BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | cp->last_status_idx);
 }
 
+static void cnic_doirq(struct cnic_dev *dev)
+{
+       struct cnic_local *cp = dev->cnic_priv;
+       u16 prod = cp->kcq_prod_idx & MAX_KCQ_IDX;
+
+       if (likely(test_bit(CNIC_F_CNIC_UP, &dev->flags))) {
+               prefetch(cp->status_blk.gen);
+               prefetch(&cp->kcq[KCQ_PG(prod)][KCQ_IDX(prod)]);
+
+               tasklet_schedule(&cp->cnic_irq_task);
+       }
+}
+
 static irqreturn_t cnic_irq(int irq, void *dev_instance)
 {
        struct cnic_dev *dev = dev_instance;
        struct cnic_local *cp = dev->cnic_priv;
-       u16 prod = cp->kcq_prod_idx & MAX_KCQ_IDX;
 
        if (cp->ack_int)
                cp->ack_int(dev);
 
-       prefetch(cp->status_blk.gen);
-       prefetch(&cp->kcq[KCQ_PG(prod)][KCQ_IDX(prod)]);
-
-       if (likely(test_bit(CNIC_F_CNIC_UP, &dev->flags)))
-               tasklet_schedule(&cp->cnic_irq_task);
+       cnic_doirq(dev);
 
        return IRQ_HANDLED;
 }
@@ -2373,15 +2384,11 @@ static int cnic_service_bnx2x(void *data, void *status_blk)
 {
        struct cnic_dev *dev = data;
        struct cnic_local *cp = dev->cnic_priv;
-       u16 prod = cp->kcq_prod_idx & MAX_KCQ_IDX;
 
-       if (likely(test_bit(CNIC_F_CNIC_UP, &dev->flags))) {
-               prefetch(cp->status_blk.bnx2x);
-               prefetch(&cp->kcq[KCQ_PG(prod)][KCQ_IDX(prod)]);
+       if (!(cp->ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX))
+               cnic_doirq(dev);
 
-               tasklet_schedule(&cp->cnic_irq_task);
-               cnic_chk_pkt_rings(cp);
-       }
+       cnic_chk_pkt_rings(cp);
 
        return 0;
 }