aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000
diff options
context:
space:
mode:
authorFrancois Romieu <romieu@fr.zoreil.com>2008-07-11 18:17:38 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-07-22 19:39:11 -0400
commitc3570acb53c885f8accb8c85eda195781d30632f (patch)
tree1a6d96fc1b90689c1800587bfa12e490516c7508 /drivers/net/e1000
parent63cd31f60716c4a9f1b5b6ffd804326dc766d2d2 (diff)
e1000: delete non NAPI code from the driver
Compile-tested only. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/e1000')
-rw-r--r--drivers/net/e1000/e1000.h10
-rw-r--r--drivers/net/e1000/e1000_main.c151
2 files changed, 14 insertions, 147 deletions
diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
index 3aeba9305dfa..583b823f760c 100644
--- a/drivers/net/e1000/e1000.h
+++ b/drivers/net/e1000/e1000.h
@@ -253,9 +253,7 @@ struct e1000_adapter {
253 u16 link_speed; 253 u16 link_speed;
254 u16 link_duplex; 254 u16 link_duplex;
255 spinlock_t stats_lock; 255 spinlock_t stats_lock;
256#ifdef CONFIG_E1000_NAPI
257 spinlock_t tx_queue_lock; 256 spinlock_t tx_queue_lock;
258#endif
259 unsigned int total_tx_bytes; 257 unsigned int total_tx_bytes;
260 unsigned int total_tx_packets; 258 unsigned int total_tx_packets;
261 unsigned int total_rx_bytes; 259 unsigned int total_rx_bytes;
@@ -293,22 +291,16 @@ struct e1000_adapter {
293 bool detect_tx_hung; 291 bool detect_tx_hung;
294 292
295 /* RX */ 293 /* RX */
296#ifdef CONFIG_E1000_NAPI
297 bool (*clean_rx)(struct e1000_adapter *adapter, 294 bool (*clean_rx)(struct e1000_adapter *adapter,
298 struct e1000_rx_ring *rx_ring, 295 struct e1000_rx_ring *rx_ring,
299 int *work_done, int work_to_do); 296 int *work_done, int work_to_do);
300#else
301 bool (*clean_rx)(struct e1000_adapter *adapter,
302 struct e1000_rx_ring *rx_ring);
303#endif
304 void (*alloc_rx_buf)(struct e1000_adapter *adapter, 297 void (*alloc_rx_buf)(struct e1000_adapter *adapter,
305 struct e1000_rx_ring *rx_ring, 298 struct e1000_rx_ring *rx_ring,
306 int cleaned_count); 299 int cleaned_count);
307 struct e1000_rx_ring *rx_ring; /* One per active queue */ 300 struct e1000_rx_ring *rx_ring; /* One per active queue */
308#ifdef CONFIG_E1000_NAPI
309 struct napi_struct napi; 301 struct napi_struct napi;
310 struct net_device *polling_netdev; /* One per active queue */ 302 struct net_device *polling_netdev; /* One per active queue */
311#endif 303
312 int num_tx_queues; 304 int num_tx_queues;
313 int num_rx_queues; 305 int num_rx_queues;
314 306
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index b2c3e4cc0cb4..190352c6216e 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -31,12 +31,7 @@
31 31
32char e1000_driver_name[] = "e1000"; 32char e1000_driver_name[] = "e1000";
33static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; 33static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver";
34#ifndef CONFIG_E1000_NAPI 34#define DRV_VERSION "7.3.20-k3-NAPI"
35#define DRIVERNAPI
36#else
37#define DRIVERNAPI "-NAPI"
38#endif
39#define DRV_VERSION "7.3.20-k2"DRIVERNAPI
40const char e1000_driver_version[] = DRV_VERSION; 35const char e1000_driver_version[] = DRV_VERSION;
41static const char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; 36static const char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation.";
42 37
@@ -138,7 +133,6 @@ static irqreturn_t e1000_intr(int irq, void *data);
138static irqreturn_t e1000_intr_msi(int irq, void *data); 133static irqreturn_t e1000_intr_msi(int irq, void *data);
139static bool e1000_clean_tx_irq(struct e1000_adapter *adapter, 134static bool e1000_clean_tx_irq(struct e1000_adapter *adapter,
140 struct e1000_tx_ring *tx_ring); 135 struct e1000_tx_ring *tx_ring);
141#ifdef CONFIG_E1000_NAPI
142static int e1000_clean(struct napi_struct *napi, int budget); 136static int e1000_clean(struct napi_struct *napi, int budget);
143static bool e1000_clean_rx_irq(struct e1000_adapter *adapter, 137static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
144 struct e1000_rx_ring *rx_ring, 138 struct e1000_rx_ring *rx_ring,
@@ -146,12 +140,6 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
146static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, 140static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
147 struct e1000_rx_ring *rx_ring, 141 struct e1000_rx_ring *rx_ring,
148 int *work_done, int work_to_do); 142 int *work_done, int work_to_do);
149#else
150static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
151 struct e1000_rx_ring *rx_ring);
152static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
153 struct e1000_rx_ring *rx_ring);
154#endif
155static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter, 143static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter,
156 struct e1000_rx_ring *rx_ring, 144 struct e1000_rx_ring *rx_ring,
157 int cleaned_count); 145 int cleaned_count);
@@ -512,9 +500,8 @@ int e1000_up(struct e1000_adapter *adapter)
512 500
513 clear_bit(__E1000_DOWN, &adapter->flags); 501 clear_bit(__E1000_DOWN, &adapter->flags);
514 502
515#ifdef CONFIG_E1000_NAPI
516 napi_enable(&adapter->napi); 503 napi_enable(&adapter->napi);
517#endif 504
518 e1000_irq_enable(adapter); 505 e1000_irq_enable(adapter);
519 506
520 /* fire a link change interrupt to start the watchdog */ 507 /* fire a link change interrupt to start the watchdog */
@@ -602,9 +589,8 @@ void e1000_down(struct e1000_adapter *adapter)
602 * reschedule our watchdog timer */ 589 * reschedule our watchdog timer */
603 set_bit(__E1000_DOWN, &adapter->flags); 590 set_bit(__E1000_DOWN, &adapter->flags);
604 591
605#ifdef CONFIG_E1000_NAPI
606 napi_disable(&adapter->napi); 592 napi_disable(&adapter->napi);
607#endif 593
608 e1000_irq_disable(adapter); 594 e1000_irq_disable(adapter);
609 595
610 del_timer_sync(&adapter->tx_fifo_stall_timer); 596 del_timer_sync(&adapter->tx_fifo_stall_timer);
@@ -966,9 +952,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
966 e1000_set_ethtool_ops(netdev); 952 e1000_set_ethtool_ops(netdev);
967 netdev->tx_timeout = &e1000_tx_timeout; 953 netdev->tx_timeout = &e1000_tx_timeout;
968 netdev->watchdog_timeo = 5 * HZ; 954 netdev->watchdog_timeo = 5 * HZ;
969#ifdef CONFIG_E1000_NAPI
970 netif_napi_add(netdev, &adapter->napi, e1000_clean, 64); 955 netif_napi_add(netdev, &adapter->napi, e1000_clean, 64);
971#endif
972 netdev->vlan_rx_register = e1000_vlan_rx_register; 956 netdev->vlan_rx_register = e1000_vlan_rx_register;
973 netdev->vlan_rx_add_vid = e1000_vlan_rx_add_vid; 957 netdev->vlan_rx_add_vid = e1000_vlan_rx_add_vid;
974 netdev->vlan_rx_kill_vid = e1000_vlan_rx_kill_vid; 958 netdev->vlan_rx_kill_vid = e1000_vlan_rx_kill_vid;
@@ -1207,16 +1191,12 @@ err_eeprom:
1207 if (hw->flash_address) 1191 if (hw->flash_address)
1208 iounmap(hw->flash_address); 1192 iounmap(hw->flash_address);
1209err_flashmap: 1193err_flashmap:
1210#ifdef CONFIG_E1000_NAPI
1211 for (i = 0; i < adapter->num_rx_queues; i++) 1194 for (i = 0; i < adapter->num_rx_queues; i++)
1212 dev_put(&adapter->polling_netdev[i]); 1195 dev_put(&adapter->polling_netdev[i]);
1213#endif
1214 1196
1215 kfree(adapter->tx_ring); 1197 kfree(adapter->tx_ring);
1216 kfree(adapter->rx_ring); 1198 kfree(adapter->rx_ring);
1217#ifdef CONFIG_E1000_NAPI
1218 kfree(adapter->polling_netdev); 1199 kfree(adapter->polling_netdev);
1219#endif
1220err_sw_init: 1200err_sw_init:
1221 iounmap(hw->hw_addr); 1201 iounmap(hw->hw_addr);
1222err_ioremap: 1202err_ioremap:
@@ -1244,9 +1224,7 @@ static void __devexit e1000_remove(struct pci_dev *pdev)
1244 struct net_device *netdev = pci_get_drvdata(pdev); 1224 struct net_device *netdev = pci_get_drvdata(pdev);
1245 struct e1000_adapter *adapter = netdev_priv(netdev); 1225 struct e1000_adapter *adapter = netdev_priv(netdev);
1246 struct e1000_hw *hw = &adapter->hw; 1226 struct e1000_hw *hw = &adapter->hw;
1247#ifdef CONFIG_E1000_NAPI
1248 int i; 1227 int i;
1249#endif
1250 1228
1251 cancel_work_sync(&adapter->reset_task); 1229 cancel_work_sync(&adapter->reset_task);
1252 1230
@@ -1256,10 +1234,8 @@ static void __devexit e1000_remove(struct pci_dev *pdev)
1256 * would have already happened in close and is redundant. */ 1234 * would have already happened in close and is redundant. */
1257 e1000_release_hw_control(adapter); 1235 e1000_release_hw_control(adapter);
1258 1236
1259#ifdef CONFIG_E1000_NAPI
1260 for (i = 0; i < adapter->num_rx_queues; i++) 1237 for (i = 0; i < adapter->num_rx_queues; i++)
1261 dev_put(&adapter->polling_netdev[i]); 1238 dev_put(&adapter->polling_netdev[i]);
1262#endif
1263 1239
1264 unregister_netdev(netdev); 1240 unregister_netdev(netdev);
1265 1241
@@ -1268,9 +1244,7 @@ static void __devexit e1000_remove(struct pci_dev *pdev)
1268 1244
1269 kfree(adapter->tx_ring); 1245 kfree(adapter->tx_ring);
1270 kfree(adapter->rx_ring); 1246 kfree(adapter->rx_ring);
1271#ifdef CONFIG_E1000_NAPI
1272 kfree(adapter->polling_netdev); 1247 kfree(adapter->polling_netdev);
1273#endif
1274 1248
1275 iounmap(hw->hw_addr); 1249 iounmap(hw->hw_addr);
1276 if (hw->flash_address) 1250 if (hw->flash_address)
@@ -1296,9 +1270,7 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter)
1296 struct e1000_hw *hw = &adapter->hw; 1270 struct e1000_hw *hw = &adapter->hw;
1297 struct net_device *netdev = adapter->netdev; 1271 struct net_device *netdev = adapter->netdev;
1298 struct pci_dev *pdev = adapter->pdev; 1272 struct pci_dev *pdev = adapter->pdev;
1299#ifdef CONFIG_E1000_NAPI
1300 int i; 1273 int i;
1301#endif
1302 1274
1303 /* PCI config space info */ 1275 /* PCI config space info */
1304 1276
@@ -1356,14 +1328,12 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter)
1356 return -ENOMEM; 1328 return -ENOMEM;
1357 } 1329 }
1358 1330
1359#ifdef CONFIG_E1000_NAPI
1360 for (i = 0; i < adapter->num_rx_queues; i++) { 1331 for (i = 0; i < adapter->num_rx_queues; i++) {
1361 adapter->polling_netdev[i].priv = adapter; 1332 adapter->polling_netdev[i].priv = adapter;
1362 dev_hold(&adapter->polling_netdev[i]); 1333 dev_hold(&adapter->polling_netdev[i]);
1363 set_bit(__LINK_STATE_START, &adapter->polling_netdev[i].state); 1334 set_bit(__LINK_STATE_START, &adapter->polling_netdev[i].state);
1364 } 1335 }
1365 spin_lock_init(&adapter->tx_queue_lock); 1336 spin_lock_init(&adapter->tx_queue_lock);
1366#endif
1367 1337
1368 /* Explicitly disable IRQ since the NIC can be in any state. */ 1338 /* Explicitly disable IRQ since the NIC can be in any state. */
1369 e1000_irq_disable(adapter); 1339 e1000_irq_disable(adapter);
@@ -1398,7 +1368,6 @@ static int __devinit e1000_alloc_queues(struct e1000_adapter *adapter)
1398 return -ENOMEM; 1368 return -ENOMEM;
1399 } 1369 }
1400 1370
1401#ifdef CONFIG_E1000_NAPI
1402 adapter->polling_netdev = kcalloc(adapter->num_rx_queues, 1371 adapter->polling_netdev = kcalloc(adapter->num_rx_queues,
1403 sizeof(struct net_device), 1372 sizeof(struct net_device),
1404 GFP_KERNEL); 1373 GFP_KERNEL);
@@ -1407,7 +1376,6 @@ static int __devinit e1000_alloc_queues(struct e1000_adapter *adapter)
1407 kfree(adapter->rx_ring); 1376 kfree(adapter->rx_ring);
1408 return -ENOMEM; 1377 return -ENOMEM;
1409 } 1378 }
1410#endif
1411 1379
1412 return E1000_SUCCESS; 1380 return E1000_SUCCESS;
1413} 1381}
@@ -1472,9 +1440,7 @@ static int e1000_open(struct net_device *netdev)
1472 /* From here on the code is the same as e1000_up() */ 1440 /* From here on the code is the same as e1000_up() */
1473 clear_bit(__E1000_DOWN, &adapter->flags); 1441 clear_bit(__E1000_DOWN, &adapter->flags);
1474 1442
1475#ifdef CONFIG_E1000_NAPI
1476 napi_enable(&adapter->napi); 1443 napi_enable(&adapter->napi);
1477#endif
1478 1444
1479 e1000_irq_enable(adapter); 1445 e1000_irq_enable(adapter);
1480 1446
@@ -2069,11 +2035,9 @@ static void e1000_configure_rx(struct e1000_adapter *adapter)
2069 ctrl_ext = er32(CTRL_EXT); 2035 ctrl_ext = er32(CTRL_EXT);
2070 /* Reset delay timers after every interrupt */ 2036 /* Reset delay timers after every interrupt */
2071 ctrl_ext |= E1000_CTRL_EXT_INT_TIMER_CLR; 2037 ctrl_ext |= E1000_CTRL_EXT_INT_TIMER_CLR;
2072#ifdef CONFIG_E1000_NAPI
2073 /* Auto-Mask interrupts upon ICR access */ 2038 /* Auto-Mask interrupts upon ICR access */
2074 ctrl_ext |= E1000_CTRL_EXT_IAME; 2039 ctrl_ext |= E1000_CTRL_EXT_IAME;
2075 ew32(IAM, 0xffffffff); 2040 ew32(IAM, 0xffffffff);
2076#endif
2077 ew32(CTRL_EXT, ctrl_ext); 2041 ew32(CTRL_EXT, ctrl_ext);
2078 E1000_WRITE_FLUSH(); 2042 E1000_WRITE_FLUSH();
2079 } 2043 }
@@ -3777,9 +3741,6 @@ static irqreturn_t e1000_intr_msi(int irq, void *data)
3777 struct net_device *netdev = data; 3741 struct net_device *netdev = data;
3778 struct e1000_adapter *adapter = netdev_priv(netdev); 3742 struct e1000_adapter *adapter = netdev_priv(netdev);
3779 struct e1000_hw *hw = &adapter->hw; 3743 struct e1000_hw *hw = &adapter->hw;
3780#ifndef CONFIG_E1000_NAPI
3781 int i;
3782#endif
3783 u32 icr = er32(ICR); 3744 u32 icr = er32(ICR);
3784 3745
3785 /* in NAPI mode read ICR disables interrupts using IAM */ 3746 /* in NAPI mode read ICR disables interrupts using IAM */
@@ -3800,7 +3761,6 @@ static irqreturn_t e1000_intr_msi(int irq, void *data)
3800 mod_timer(&adapter->watchdog_timer, jiffies + 1); 3761 mod_timer(&adapter->watchdog_timer, jiffies + 1);
3801 } 3762 }
3802 3763
3803#ifdef CONFIG_E1000_NAPI
3804 if (likely(netif_rx_schedule_prep(netdev, &adapter->napi))) { 3764 if (likely(netif_rx_schedule_prep(netdev, &adapter->napi))) {
3805 adapter->total_tx_bytes = 0; 3765 adapter->total_tx_bytes = 0;
3806 adapter->total_tx_packets = 0; 3766 adapter->total_tx_packets = 0;
@@ -3809,20 +3769,6 @@ static irqreturn_t e1000_intr_msi(int irq, void *data)
3809 __netif_rx_schedule(netdev, &adapter->napi); 3769 __netif_rx_schedule(netdev, &adapter->napi);
3810 } else 3770 } else
3811 e1000_irq_enable(adapter); 3771 e1000_irq_enable(adapter);
3812#else
3813 adapter->total_tx_bytes = 0;
3814 adapter->total_rx_bytes = 0;
3815 adapter->total_tx_packets = 0;
3816 adapter->total_rx_packets = 0;
3817
3818 for (i = 0; i < E1000_MAX_INTR; i++)
3819 if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) &
3820 !e1000_clean_tx_irq(adapter, adapter->tx_ring)))
3821 break;
3822
3823 if (likely(adapter->itr_setting & 3))
3824 e1000_set_itr(adapter);
3825#endif
3826 3772
3827 return IRQ_HANDLED; 3773 return IRQ_HANDLED;
3828} 3774}
@@ -3839,13 +3785,10 @@ static irqreturn_t e1000_intr(int irq, void *data)
3839 struct e1000_adapter *adapter = netdev_priv(netdev); 3785 struct e1000_adapter *adapter = netdev_priv(netdev);
3840 struct e1000_hw *hw = &adapter->hw; 3786 struct e1000_hw *hw = &adapter->hw;
3841 u32 rctl, icr = er32(ICR); 3787 u32 rctl, icr = er32(ICR);
3842#ifndef CONFIG_E1000_NAPI 3788
3843 int i;
3844#endif
3845 if (unlikely(!icr)) 3789 if (unlikely(!icr))
3846 return IRQ_NONE; /* Not our interrupt */ 3790 return IRQ_NONE; /* Not our interrupt */
3847 3791
3848#ifdef CONFIG_E1000_NAPI
3849 /* IMS will not auto-mask if INT_ASSERTED is not set, and if it is 3792 /* IMS will not auto-mask if INT_ASSERTED is not set, and if it is
3850 * not set, then the adapter didn't send an interrupt */ 3793 * not set, then the adapter didn't send an interrupt */
3851 if (unlikely(hw->mac_type >= e1000_82571 && 3794 if (unlikely(hw->mac_type >= e1000_82571 &&
@@ -3854,7 +3797,6 @@ static irqreturn_t e1000_intr(int irq, void *data)
3854 3797
3855 /* Interrupt Auto-Mask...upon reading ICR, interrupts are masked. No 3798 /* Interrupt Auto-Mask...upon reading ICR, interrupts are masked. No
3856 * need for the IMC write */ 3799 * need for the IMC write */
3857#endif
3858 3800
3859 if (unlikely(icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC))) { 3801 if (unlikely(icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC))) {
3860 hw->get_link_status = 1; 3802 hw->get_link_status = 1;
@@ -3874,7 +3816,6 @@ static irqreturn_t e1000_intr(int irq, void *data)
3874 mod_timer(&adapter->watchdog_timer, jiffies + 1); 3816 mod_timer(&adapter->watchdog_timer, jiffies + 1);
3875 } 3817 }
3876 3818
3877#ifdef CONFIG_E1000_NAPI
3878 if (unlikely(hw->mac_type < e1000_82571)) { 3819 if (unlikely(hw->mac_type < e1000_82571)) {
3879 /* disable interrupts, without the synchronize_irq bit */ 3820 /* disable interrupts, without the synchronize_irq bit */
3880 ew32(IMC, ~0); 3821 ew32(IMC, ~0);
@@ -3890,46 +3831,14 @@ static irqreturn_t e1000_intr(int irq, void *data)
3890 /* this really should not happen! if it does it is basically a 3831 /* this really should not happen! if it does it is basically a
3891 * bug, but not a hard error, so enable ints and continue */ 3832 * bug, but not a hard error, so enable ints and continue */
3892 e1000_irq_enable(adapter); 3833 e1000_irq_enable(adapter);
3893#else
3894 /* Writing IMC and IMS is needed for 82547.
3895 * Due to Hub Link bus being occupied, an interrupt
3896 * de-assertion message is not able to be sent.
3897 * When an interrupt assertion message is generated later,
3898 * two messages are re-ordered and sent out.
3899 * That causes APIC to think 82547 is in de-assertion
3900 * state, while 82547 is in assertion state, resulting
3901 * in dead lock. Writing IMC forces 82547 into
3902 * de-assertion state.
3903 */
3904 if (hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2)
3905 ew32(IMC, ~0);
3906
3907 adapter->total_tx_bytes = 0;
3908 adapter->total_rx_bytes = 0;
3909 adapter->total_tx_packets = 0;
3910 adapter->total_rx_packets = 0;
3911
3912 for (i = 0; i < E1000_MAX_INTR; i++)
3913 if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) &
3914 !e1000_clean_tx_irq(adapter, adapter->tx_ring)))
3915 break;
3916 3834
3917 if (likely(adapter->itr_setting & 3))
3918 e1000_set_itr(adapter);
3919
3920 if (hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2)
3921 e1000_irq_enable(adapter);
3922
3923#endif
3924 return IRQ_HANDLED; 3835 return IRQ_HANDLED;
3925} 3836}
3926 3837
3927#ifdef CONFIG_E1000_NAPI
3928/** 3838/**
3929 * e1000_clean - NAPI Rx polling callback 3839 * e1000_clean - NAPI Rx polling callback
3930 * @adapter: board private structure 3840 * @adapter: board private structure
3931 **/ 3841 **/
3932
3933static int e1000_clean(struct napi_struct *napi, int budget) 3842static int e1000_clean(struct napi_struct *napi, int budget)
3934{ 3843{
3935 struct e1000_adapter *adapter = container_of(napi, struct e1000_adapter, napi); 3844 struct e1000_adapter *adapter = container_of(napi, struct e1000_adapter, napi);
@@ -3966,12 +3875,10 @@ static int e1000_clean(struct napi_struct *napi, int budget)
3966 return work_done; 3875 return work_done;
3967} 3876}
3968 3877
3969#endif
3970/** 3878/**
3971 * e1000_clean_tx_irq - Reclaim resources after transmit completes 3879 * e1000_clean_tx_irq - Reclaim resources after transmit completes
3972 * @adapter: board private structure 3880 * @adapter: board private structure
3973 **/ 3881 **/
3974
3975static bool e1000_clean_tx_irq(struct e1000_adapter *adapter, 3882static bool e1000_clean_tx_irq(struct e1000_adapter *adapter,
3976 struct e1000_tx_ring *tx_ring) 3883 struct e1000_tx_ring *tx_ring)
3977{ 3884{
@@ -3980,9 +3887,7 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter,
3980 struct e1000_tx_desc *tx_desc, *eop_desc; 3887 struct e1000_tx_desc *tx_desc, *eop_desc;
3981 struct e1000_buffer *buffer_info; 3888 struct e1000_buffer *buffer_info;
3982 unsigned int i, eop; 3889 unsigned int i, eop;
3983#ifdef CONFIG_E1000_NAPI
3984 unsigned int count = 0; 3890 unsigned int count = 0;
3985#endif
3986 bool cleaned = false; 3891 bool cleaned = false;
3987 unsigned int total_tx_bytes=0, total_tx_packets=0; 3892 unsigned int total_tx_bytes=0, total_tx_packets=0;
3988 3893
@@ -4014,11 +3919,10 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter,
4014 3919
4015 eop = tx_ring->buffer_info[i].next_to_watch; 3920 eop = tx_ring->buffer_info[i].next_to_watch;
4016 eop_desc = E1000_TX_DESC(*tx_ring, eop); 3921 eop_desc = E1000_TX_DESC(*tx_ring, eop);
4017#ifdef CONFIG_E1000_NAPI
4018#define E1000_TX_WEIGHT 64 3922#define E1000_TX_WEIGHT 64
4019 /* weight of a sort for tx, to avoid endless transmit cleanup */ 3923 /* weight of a sort for tx, to avoid endless transmit cleanup */
4020 if (count++ == E1000_TX_WEIGHT) break; 3924 if (count++ == E1000_TX_WEIGHT)
4021#endif 3925 break;
4022 } 3926 }
4023 3927
4024 tx_ring->next_to_clean = i; 3928 tx_ring->next_to_clean = i;
@@ -4131,14 +4035,9 @@ static void e1000_rx_checksum(struct e1000_adapter *adapter, u32 status_err,
4131 * e1000_clean_rx_irq - Send received data up the network stack; legacy 4035 * e1000_clean_rx_irq - Send received data up the network stack; legacy
4132 * @adapter: board private structure 4036 * @adapter: board private structure
4133 **/ 4037 **/
4134#ifdef CONFIG_E1000_NAPI
4135static bool e1000_clean_rx_irq(struct e1000_adapter *adapter, 4038static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
4136 struct e1000_rx_ring *rx_ring, 4039 struct e1000_rx_ring *rx_ring,
4137 int *work_done, int work_to_do) 4040 int *work_done, int work_to_do)
4138#else
4139static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
4140 struct e1000_rx_ring *rx_ring)
4141#endif
4142{ 4041{
4143 struct e1000_hw *hw = &adapter->hw; 4042 struct e1000_hw *hw = &adapter->hw;
4144 struct net_device *netdev = adapter->netdev; 4043 struct net_device *netdev = adapter->netdev;
@@ -4161,11 +4060,10 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
4161 struct sk_buff *skb; 4060 struct sk_buff *skb;
4162 u8 status; 4061 u8 status;
4163 4062
4164#ifdef CONFIG_E1000_NAPI
4165 if (*work_done >= work_to_do) 4063 if (*work_done >= work_to_do)
4166 break; 4064 break;
4167 (*work_done)++; 4065 (*work_done)++;
4168#endif 4066
4169 status = rx_desc->status; 4067 status = rx_desc->status;
4170 skb = buffer_info->skb; 4068 skb = buffer_info->skb;
4171 buffer_info->skb = NULL; 4069 buffer_info->skb = NULL;
@@ -4251,7 +4149,7 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
4251 le16_to_cpu(rx_desc->csum), skb); 4149 le16_to_cpu(rx_desc->csum), skb);
4252 4150
4253 skb->protocol = eth_type_trans(skb, netdev); 4151 skb->protocol = eth_type_trans(skb, netdev);
4254#ifdef CONFIG_E1000_NAPI 4152
4255 if (unlikely(adapter->vlgrp && 4153 if (unlikely(adapter->vlgrp &&
4256 (status & E1000_RXD_STAT_VP))) { 4154 (status & E1000_RXD_STAT_VP))) {
4257 vlan_hwaccel_receive_skb(skb, adapter->vlgrp, 4155 vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
@@ -4259,15 +4157,7 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
4259 } else { 4157 } else {
4260 netif_receive_skb(skb); 4158 netif_receive_skb(skb);
4261 } 4159 }
4262#else /* CONFIG_E1000_NAPI */ 4160
4263 if (unlikely(adapter->vlgrp &&
4264 (status & E1000_RXD_STAT_VP))) {
4265 vlan_hwaccel_rx(skb, adapter->vlgrp,
4266 le16_to_cpu(rx_desc->special));
4267 } else {
4268 netif_rx(skb);
4269 }
4270#endif /* CONFIG_E1000_NAPI */
4271 netdev->last_rx = jiffies; 4161 netdev->last_rx = jiffies;
4272 4162
4273next_desc: 4163next_desc:
@@ -4301,14 +4191,9 @@ next_desc:
4301 * @adapter: board private structure 4191 * @adapter: board private structure
4302 **/ 4192 **/
4303 4193
4304#ifdef CONFIG_E1000_NAPI
4305static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, 4194static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
4306 struct e1000_rx_ring *rx_ring, 4195 struct e1000_rx_ring *rx_ring,
4307 int *work_done, int work_to_do) 4196 int *work_done, int work_to_do)
4308#else
4309static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
4310 struct e1000_rx_ring *rx_ring)
4311#endif
4312{ 4197{
4313 union e1000_rx_desc_packet_split *rx_desc, *next_rxd; 4198 union e1000_rx_desc_packet_split *rx_desc, *next_rxd;
4314 struct net_device *netdev = adapter->netdev; 4199 struct net_device *netdev = adapter->netdev;
@@ -4331,11 +4216,11 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
4331 while (staterr & E1000_RXD_STAT_DD) { 4216 while (staterr & E1000_RXD_STAT_DD) {
4332 ps_page = &rx_ring->ps_page[i]; 4217 ps_page = &rx_ring->ps_page[i];
4333 ps_page_dma = &rx_ring->ps_page_dma[i]; 4218 ps_page_dma = &rx_ring->ps_page_dma[i];
4334#ifdef CONFIG_E1000_NAPI 4219
4335 if (unlikely(*work_done >= work_to_do)) 4220 if (unlikely(*work_done >= work_to_do))
4336 break; 4221 break;
4337 (*work_done)++; 4222 (*work_done)++;
4338#endif 4223
4339 skb = buffer_info->skb; 4224 skb = buffer_info->skb;
4340 4225
4341 /* in the packet split case this is header only */ 4226 /* in the packet split case this is header only */
@@ -4437,21 +4322,14 @@ copydone:
4437 if (likely(rx_desc->wb.upper.header_status & 4322 if (likely(rx_desc->wb.upper.header_status &
4438 cpu_to_le16(E1000_RXDPS_HDRSTAT_HDRSP))) 4323 cpu_to_le16(E1000_RXDPS_HDRSTAT_HDRSP)))
4439 adapter->rx_hdr_split++; 4324 adapter->rx_hdr_split++;
4440#ifdef CONFIG_E1000_NAPI 4325
4441 if (unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) { 4326 if (unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) {
4442 vlan_hwaccel_receive_skb(skb, adapter->vlgrp, 4327 vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
4443 le16_to_cpu(rx_desc->wb.middle.vlan)); 4328 le16_to_cpu(rx_desc->wb.middle.vlan));
4444 } else { 4329 } else {
4445 netif_receive_skb(skb); 4330 netif_receive_skb(skb);
4446 } 4331 }
4447#else /* CONFIG_E1000_NAPI */ 4332
4448 if (unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) {
4449 vlan_hwaccel_rx(skb, adapter->vlgrp,
4450 le16_to_cpu(rx_desc->wb.middle.vlan));
4451 } else {
4452 netif_rx(skb);
4453 }
4454#endif /* CONFIG_E1000_NAPI */
4455 netdev->last_rx = jiffies; 4333 netdev->last_rx = jiffies;
4456 4334
4457next_desc: 4335next_desc:
@@ -5218,9 +5096,6 @@ static void e1000_netpoll(struct net_device *netdev)
5218 5096
5219 disable_irq(adapter->pdev->irq); 5097 disable_irq(adapter->pdev->irq);
5220 e1000_intr(adapter->pdev->irq, netdev); 5098 e1000_intr(adapter->pdev->irq, netdev);
5221#ifndef CONFIG_E1000_NAPI
5222 adapter->clean_rx(adapter, adapter->rx_ring);
5223#endif
5224 enable_irq(adapter->pdev->irq); 5099 enable_irq(adapter->pdev->irq);
5225} 5100}
5226#endif 5101#endif