aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cnic.c
diff options
context:
space:
mode:
authorMichael Chan <mchan@broadcom.com>2010-06-24 10:58:38 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-25 23:37:19 -0400
commit66fee9ed03a4413ea054e437b65af6fd3583b4db (patch)
treee4574c4c14ffd1252f8bd9e04a16e16e64216930 /drivers/net/cnic.c
parent520efdf44f0140eef9018518fdae5edfc86f3b6c (diff)
cnic: Unify IRQ code for all hardware types.
By creating a common cnic_doirq(). Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cnic.c')
-rw-r--r--drivers/net/cnic.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index 70a53cc7df32..df6a0ccf0655 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -2188,6 +2188,9 @@ static void cnic_chk_pkt_rings(struct cnic_local *cp)
2188 u16 tx_cons = *cp->tx_cons_ptr; 2188 u16 tx_cons = *cp->tx_cons_ptr;
2189 int comp = 0; 2189 int comp = 0;
2190 2190
2191 if (!test_bit(CNIC_F_CNIC_UP, &cp->dev->flags))
2192 return;
2193
2191 if (cp->tx_cons != tx_cons || cp->rx_cons != rx_cons) { 2194 if (cp->tx_cons != tx_cons || cp->rx_cons != rx_cons) {
2192 if (test_bit(CNIC_LCL_FL_L2_WAIT, &cp->cnic_local_flags)) 2195 if (test_bit(CNIC_LCL_FL_L2_WAIT, &cp->cnic_local_flags))
2193 comp = cnic_l2_completion(cp); 2196 comp = cnic_l2_completion(cp);
@@ -2284,20 +2287,28 @@ done:
2284 BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | cp->last_status_idx); 2287 BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | cp->last_status_idx);
2285} 2288}
2286 2289
2290static void cnic_doirq(struct cnic_dev *dev)
2291{
2292 struct cnic_local *cp = dev->cnic_priv;
2293 u16 prod = cp->kcq_prod_idx & MAX_KCQ_IDX;
2294
2295 if (likely(test_bit(CNIC_F_CNIC_UP, &dev->flags))) {
2296 prefetch(cp->status_blk.gen);
2297 prefetch(&cp->kcq[KCQ_PG(prod)][KCQ_IDX(prod)]);
2298
2299 tasklet_schedule(&cp->cnic_irq_task);
2300 }
2301}
2302
2287static irqreturn_t cnic_irq(int irq, void *dev_instance) 2303static irqreturn_t cnic_irq(int irq, void *dev_instance)
2288{ 2304{
2289 struct cnic_dev *dev = dev_instance; 2305 struct cnic_dev *dev = dev_instance;
2290 struct cnic_local *cp = dev->cnic_priv; 2306 struct cnic_local *cp = dev->cnic_priv;
2291 u16 prod = cp->kcq_prod_idx & MAX_KCQ_IDX;
2292 2307
2293 if (cp->ack_int) 2308 if (cp->ack_int)
2294 cp->ack_int(dev); 2309 cp->ack_int(dev);
2295 2310
2296 prefetch(cp->status_blk.gen); 2311 cnic_doirq(dev);
2297 prefetch(&cp->kcq[KCQ_PG(prod)][KCQ_IDX(prod)]);
2298
2299 if (likely(test_bit(CNIC_F_CNIC_UP, &dev->flags)))
2300 tasklet_schedule(&cp->cnic_irq_task);
2301 2312
2302 return IRQ_HANDLED; 2313 return IRQ_HANDLED;
2303} 2314}
@@ -2373,15 +2384,11 @@ static int cnic_service_bnx2x(void *data, void *status_blk)
2373{ 2384{
2374 struct cnic_dev *dev = data; 2385 struct cnic_dev *dev = data;
2375 struct cnic_local *cp = dev->cnic_priv; 2386 struct cnic_local *cp = dev->cnic_priv;
2376 u16 prod = cp->kcq_prod_idx & MAX_KCQ_IDX;
2377 2387
2378 if (likely(test_bit(CNIC_F_CNIC_UP, &dev->flags))) { 2388 if (!(cp->ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX))
2379 prefetch(cp->status_blk.bnx2x); 2389 cnic_doirq(dev);
2380 prefetch(&cp->kcq[KCQ_PG(prod)][KCQ_IDX(prod)]);
2381 2390
2382 tasklet_schedule(&cp->cnic_irq_task); 2391 cnic_chk_pkt_rings(cp);
2383 cnic_chk_pkt_rings(cp);
2384 }
2385 2392
2386 return 0; 2393 return 0;
2387} 2394}