aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-01-07 23:48:21 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-09 02:30:09 -0500
commit4ec2411980d0fd2995e8dea8a06fe57aa47523cb (patch)
treea4013547ff1bda8fc038623290debd62ad6dd7fe /drivers
parenta0a46196cd98af5cc015842bba757571f02a8c30 (diff)
[NET]: Do not check netif_running() and carrier state in ->poll()
Drivers do this to try to break out of the ->poll()'ing loop when the device is being brought administratively down. Now that we have a napi_disable() "pending" state we are going to solve that problem generically. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/e100.c2
-rw-r--r--drivers/net/e1000/e1000_main.c8
-rw-r--r--drivers/net/e1000e/netdev.c8
-rw-r--r--drivers/net/epic100.c2
-rw-r--r--drivers/net/fec_8xx/fec_main.c5
-rw-r--r--drivers/net/fs_enet/fs_enet-main.c3
-rw-r--r--drivers/net/ixgb/ixgb_main.c2
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c8
-rw-r--r--drivers/net/ixp2000/ixpdev.c2
-rw-r--r--drivers/net/myri10ge/myri10ge.c2
-rw-r--r--drivers/net/natsemi.c2
-rw-r--r--drivers/net/qla3xxx.c7
-rw-r--r--drivers/net/s2io.c3
-rw-r--r--drivers/net/tulip/interrupt.c5
-rw-r--r--drivers/net/xen-netfront.c5
15 files changed, 9 insertions, 55 deletions
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 2b06e4b4dabc..68316f15a7cb 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -1997,7 +1997,7 @@ static int e100_poll(struct napi_struct *napi, int budget)
1997 tx_cleaned = e100_tx_clean(nic); 1997 tx_cleaned = e100_tx_clean(nic);
1998 1998
1999 /* If no Rx and Tx cleanup work was done, exit polling mode. */ 1999 /* If no Rx and Tx cleanup work was done, exit polling mode. */
2000 if((!tx_cleaned && (work_done == 0)) || !netif_running(netdev)) { 2000 if((!tx_cleaned && (work_done == 0))) {
2001 netif_rx_complete(netdev, napi); 2001 netif_rx_complete(netdev, napi);
2002 e100_enable_irq(nic); 2002 e100_enable_irq(nic);
2003 } 2003 }
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 4f37506ad374..9de71443ef89 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -3924,10 +3924,6 @@ e1000_clean(struct napi_struct *napi, int budget)
3924 /* Must NOT use netdev_priv macro here. */ 3924 /* Must NOT use netdev_priv macro here. */
3925 adapter = poll_dev->priv; 3925 adapter = poll_dev->priv;
3926 3926
3927 /* Keep link state information with original netdev */
3928 if (!netif_carrier_ok(poll_dev))
3929 goto quit_polling;
3930
3931 /* e1000_clean is called per-cpu. This lock protects 3927 /* e1000_clean is called per-cpu. This lock protects
3932 * tx_ring[0] from being cleaned by multiple cpus 3928 * tx_ring[0] from being cleaned by multiple cpus
3933 * simultaneously. A failure obtaining the lock means 3929 * simultaneously. A failure obtaining the lock means
@@ -3942,9 +3938,7 @@ e1000_clean(struct napi_struct *napi, int budget)
3942 &work_done, budget); 3938 &work_done, budget);
3943 3939
3944 /* If no Tx and not enough Rx work done, exit the polling mode */ 3940 /* If no Tx and not enough Rx work done, exit the polling mode */
3945 if ((!tx_cleaned && (work_done == 0)) || 3941 if ((!tx_cleaned && (work_done == 0))) {
3946 !netif_running(poll_dev)) {
3947quit_polling:
3948 if (likely(adapter->itr_setting & 3)) 3942 if (likely(adapter->itr_setting & 3))
3949 e1000_set_itr(adapter); 3943 e1000_set_itr(adapter);
3950 netif_rx_complete(poll_dev, napi); 3944 netif_rx_complete(poll_dev, napi);
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 4fd2e23720b6..dd9698cfbb9d 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -1389,10 +1389,6 @@ static int e1000_clean(struct napi_struct *napi, int budget)
1389 /* Must NOT use netdev_priv macro here. */ 1389 /* Must NOT use netdev_priv macro here. */
1390 adapter = poll_dev->priv; 1390 adapter = poll_dev->priv;
1391 1391
1392 /* Keep link state information with original netdev */
1393 if (!netif_carrier_ok(poll_dev))
1394 goto quit_polling;
1395
1396 /* e1000_clean is called per-cpu. This lock protects 1392 /* e1000_clean is called per-cpu. This lock protects
1397 * tx_ring from being cleaned by multiple cpus 1393 * tx_ring from being cleaned by multiple cpus
1398 * simultaneously. A failure obtaining the lock means 1394 * simultaneously. A failure obtaining the lock means
@@ -1405,9 +1401,7 @@ static int e1000_clean(struct napi_struct *napi, int budget)
1405 adapter->clean_rx(adapter, &work_done, budget); 1401 adapter->clean_rx(adapter, &work_done, budget);
1406 1402
1407 /* If no Tx and not enough Rx work done, exit the polling mode */ 1403 /* If no Tx and not enough Rx work done, exit the polling mode */
1408 if ((!tx_cleaned && (work_done < budget)) || 1404 if ((!tx_cleaned && (work_done < budget))) {
1409 !netif_running(poll_dev)) {
1410quit_polling:
1411 if (adapter->itr_setting & 3) 1405 if (adapter->itr_setting & 3)
1412 e1000_set_itr(adapter); 1406 e1000_set_itr(adapter);
1413 netif_rx_complete(poll_dev, napi); 1407 netif_rx_complete(poll_dev, napi);
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c
index ecdd3fc8d70c..0b365b8d947b 100644
--- a/drivers/net/epic100.c
+++ b/drivers/net/epic100.c
@@ -1273,7 +1273,7 @@ rx_action:
1273 1273
1274 epic_rx_err(dev, ep); 1274 epic_rx_err(dev, ep);
1275 1275
1276 if (netif_running(dev) && (work_done < budget)) { 1276 if (work_done < budget) {
1277 unsigned long flags; 1277 unsigned long flags;
1278 int more; 1278 int more;
1279 1279
diff --git a/drivers/net/fec_8xx/fec_main.c b/drivers/net/fec_8xx/fec_main.c
index 8d2904fa5789..ab9637ab3a8d 100644
--- a/drivers/net/fec_8xx/fec_main.c
+++ b/drivers/net/fec_8xx/fec_main.c
@@ -476,11 +476,6 @@ static int fec_enet_rx_common(struct fec_enet_private *ep,
476 __u16 pkt_len, sc; 476 __u16 pkt_len, sc;
477 int curidx; 477 int curidx;
478 478
479 if (fpi->use_napi) {
480 if (!netif_running(dev))
481 return 0;
482 }
483
484 /* 479 /*
485 * First, grab all of the stats for the incoming packet. 480 * First, grab all of the stats for the incoming packet.
486 * These get messed up if we get called due to a busy condition. 481 * These get messed up if we get called due to a busy condition.
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index f2a4d399a6e5..3e1a57a42f11 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -96,9 +96,6 @@ static int fs_enet_rx_napi(struct napi_struct *napi, int budget)
96 u16 pkt_len, sc; 96 u16 pkt_len, sc;
97 int curidx; 97 int curidx;
98 98
99 if (!netif_running(dev))
100 return 0;
101
102 /* 99 /*
103 * First, grab all of the stats for the incoming packet. 100 * First, grab all of the stats for the incoming packet.
104 * These get messed up if we get called due to a busy condition. 101 * These get messed up if we get called due to a busy condition.
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index bf9085fe035a..a8bef52870fd 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -1794,7 +1794,7 @@ ixgb_clean(struct napi_struct *napi, int budget)
1794 ixgb_clean_rx_irq(adapter, &work_done, budget); 1794 ixgb_clean_rx_irq(adapter, &work_done, budget);
1795 1795
1796 /* if no Tx and not enough Rx work done, exit the polling mode */ 1796 /* if no Tx and not enough Rx work done, exit the polling mode */
1797 if((!tx_cleaned && (work_done == 0)) || !netif_running(netdev)) { 1797 if((!tx_cleaned && (work_done == 0))) {
1798 netif_rx_complete(netdev, napi); 1798 netif_rx_complete(netdev, napi);
1799 ixgb_irq_enable(adapter); 1799 ixgb_irq_enable(adapter);
1800 } 1800 }
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 00bc525c6560..7c319303f0f8 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -1470,19 +1470,13 @@ static int ixgbe_clean(struct napi_struct *napi, int budget)
1470 struct net_device *netdev = adapter->netdev; 1470 struct net_device *netdev = adapter->netdev;
1471 int tx_cleaned = 0, work_done = 0; 1471 int tx_cleaned = 0, work_done = 0;
1472 1472
1473 /* Keep link state information with original netdev */
1474 if (!netif_carrier_ok(adapter->netdev))
1475 goto quit_polling;
1476
1477 /* In non-MSIX case, there is no multi-Tx/Rx queue */ 1473 /* In non-MSIX case, there is no multi-Tx/Rx queue */
1478 tx_cleaned = ixgbe_clean_tx_irq(adapter, adapter->tx_ring); 1474 tx_cleaned = ixgbe_clean_tx_irq(adapter, adapter->tx_ring);
1479 ixgbe_clean_rx_irq(adapter, &adapter->rx_ring[0], &work_done, 1475 ixgbe_clean_rx_irq(adapter, &adapter->rx_ring[0], &work_done,
1480 budget); 1476 budget);
1481 1477
1482 /* If no Tx and not enough Rx work done, exit the polling mode */ 1478 /* If no Tx and not enough Rx work done, exit the polling mode */
1483 if ((!tx_cleaned && (work_done < budget)) || 1479 if ((!tx_cleaned && (work_done < budget))) {
1484 !netif_running(adapter->netdev)) {
1485quit_polling:
1486 netif_rx_complete(netdev, napi); 1480 netif_rx_complete(netdev, napi);
1487 ixgbe_irq_enable(adapter); 1481 ixgbe_irq_enable(adapter);
1488 } 1482 }
diff --git a/drivers/net/ixp2000/ixpdev.c b/drivers/net/ixp2000/ixpdev.c
index 6c0dd49149d0..484cb2ba717f 100644
--- a/drivers/net/ixp2000/ixpdev.c
+++ b/drivers/net/ixp2000/ixpdev.c
@@ -135,8 +135,6 @@ static int ixpdev_poll(struct napi_struct *napi, int budget)
135 struct net_device *dev = ip->dev; 135 struct net_device *dev = ip->dev;
136 int rx; 136 int rx;
137 137
138 /* @@@ Have to stop polling when nds[0] is administratively
139 * downed while we are polling. */
140 rx = 0; 138 rx = 0;
141 do { 139 do {
142 ixp2000_reg_write(IXP2000_IRQ_THD_RAW_STATUS_A_0, 0x00ff); 140 ixp2000_reg_write(IXP2000_IRQ_THD_RAW_STATUS_A_0, 0x00ff);
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 8def8657251f..c90958f6d3fe 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -1239,7 +1239,7 @@ static int myri10ge_poll(struct napi_struct *napi, int budget)
1239 /* process as many rx events as NAPI will allow */ 1239 /* process as many rx events as NAPI will allow */
1240 work_done = myri10ge_clean_rx_done(mgp, budget); 1240 work_done = myri10ge_clean_rx_done(mgp, budget);
1241 1241
1242 if (work_done < budget || !netif_running(netdev)) { 1242 if (work_done < budget) {
1243 netif_rx_complete(netdev, napi); 1243 netif_rx_complete(netdev, napi);
1244 put_be32(htonl(3), mgp->irq_claim); 1244 put_be32(htonl(3), mgp->irq_claim);
1245 } 1245 }
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 87cde062fd63..c329a4f5840c 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -2266,7 +2266,7 @@ static int natsemi_poll(struct napi_struct *napi, int budget)
2266 /* Reenable interrupts providing nothing is trying to shut 2266 /* Reenable interrupts providing nothing is trying to shut
2267 * the chip down. */ 2267 * the chip down. */
2268 spin_lock(&np->lock); 2268 spin_lock(&np->lock);
2269 if (!np->hands_off && netif_running(dev)) 2269 if (!np->hands_off)
2270 natsemi_irq_enable(dev); 2270 natsemi_irq_enable(dev);
2271 spin_unlock(&np->lock); 2271 spin_unlock(&np->lock);
2272 2272
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index a5791114b7bd..cf0774de6c41 100644
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -2320,14 +2320,9 @@ static int ql_poll(struct napi_struct *napi, int budget)
2320 unsigned long hw_flags; 2320 unsigned long hw_flags;
2321 struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers; 2321 struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers;
2322 2322
2323 if (!netif_carrier_ok(ndev))
2324 goto quit_polling;
2325
2326 ql_tx_rx_clean(qdev, &tx_cleaned, &rx_cleaned, budget); 2323 ql_tx_rx_clean(qdev, &tx_cleaned, &rx_cleaned, budget);
2327 2324
2328 if (tx_cleaned + rx_cleaned != budget || 2325 if (tx_cleaned + rx_cleaned != budget) {
2329 !netif_running(ndev)) {
2330quit_polling:
2331 spin_lock_irqsave(&qdev->hw_lock, hw_flags); 2326 spin_lock_irqsave(&qdev->hw_lock, hw_flags);
2332 __netif_rx_complete(ndev, napi); 2327 __netif_rx_complete(ndev, napi);
2333 ql_update_small_bufq_prod_index(qdev); 2328 ql_update_small_bufq_prod_index(qdev);
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 9d80f1cf73ac..fa57c49c0c51 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -2704,9 +2704,6 @@ static int s2io_poll(struct napi_struct *napi, int budget)
2704 struct XENA_dev_config __iomem *bar0 = nic->bar0; 2704 struct XENA_dev_config __iomem *bar0 = nic->bar0;
2705 int i; 2705 int i;
2706 2706
2707 if (!is_s2io_card_up(nic))
2708 return 0;
2709
2710 mac_control = &nic->mac_control; 2707 mac_control = &nic->mac_control;
2711 config = &nic->config; 2708 config = &nic->config;
2712 2709
diff --git a/drivers/net/tulip/interrupt.c b/drivers/net/tulip/interrupt.c
index 0461956d3b50..6284afd14bbb 100644
--- a/drivers/net/tulip/interrupt.c
+++ b/drivers/net/tulip/interrupt.c
@@ -117,9 +117,6 @@ int tulip_poll(struct napi_struct *napi, int budget)
117 int received = 0; 117 int received = 0;
118#endif 118#endif
119 119
120 if (!netif_running(dev))
121 goto done;
122
123#ifdef CONFIG_TULIP_NAPI_HW_MITIGATION 120#ifdef CONFIG_TULIP_NAPI_HW_MITIGATION
124 121
125/* that one buffer is needed for mit activation; or might be a 122/* that one buffer is needed for mit activation; or might be a
@@ -261,8 +258,6 @@ int tulip_poll(struct napi_struct *napi, int budget)
261 * finally: amount of IO did not increase at all. */ 258 * finally: amount of IO did not increase at all. */
262 } while ((ioread32(tp->base_addr + CSR5) & RxIntr)); 259 } while ((ioread32(tp->base_addr + CSR5) & RxIntr));
263 260
264done:
265
266 #ifdef CONFIG_TULIP_NAPI_HW_MITIGATION 261 #ifdef CONFIG_TULIP_NAPI_HW_MITIGATION
267 262
268 /* We use this simplistic scheme for IM. It's proven by 263 /* We use this simplistic scheme for IM. It's proven by
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 2a8fc431099f..bca37bf0f545 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -852,11 +852,6 @@ static int xennet_poll(struct napi_struct *napi, int budget)
852 852
853 spin_lock(&np->rx_lock); 853 spin_lock(&np->rx_lock);
854 854
855 if (unlikely(!netif_carrier_ok(dev))) {
856 spin_unlock(&np->rx_lock);
857 return 0;
858 }
859
860 skb_queue_head_init(&rxq); 855 skb_queue_head_init(&rxq);
861 skb_queue_head_init(&errq); 856 skb_queue_head_init(&errq);
862 skb_queue_head_init(&tmpq); 857 skb_queue_head_init(&tmpq);