aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorFrancois Romieu <romieu@fr.zoreil.com>2008-07-06 23:54:45 -0400
committerDavid S. Miller <davem@davemloft.net>2008-07-08 01:40:42 -0400
commita6676019a794eac967a967c1206a57824b180c9a (patch)
tree9df26bc5151cec8e4c8c0fd4490aabe95f449025 /drivers
parent6a3d8aa48c1c9d3afc761b862267b9945cc6f281 (diff)
starfire: delete non NAPI code from the driver.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Acked-by: Jeff Garzik <jgarzik@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/Kconfig14
-rw-r--r--drivers/net/starfire.c111
2 files changed, 45 insertions, 80 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 1fe47a3bb6f5..9f7442fba47d 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -1334,20 +1334,6 @@ config ADAPTEC_STARFIRE
1334 To compile this driver as a module, choose M here: the module 1334 To compile this driver as a module, choose M here: the module
1335 will be called starfire. This is recommended. 1335 will be called starfire. This is recommended.
1336 1336
1337config ADAPTEC_STARFIRE_NAPI
1338 bool "Use Rx Polling (NAPI) (EXPERIMENTAL)"
1339 depends on ADAPTEC_STARFIRE && EXPERIMENTAL
1340 help
1341 NAPI is a new driver API designed to reduce CPU and interrupt load
1342 when the driver is receiving lots of packets from the card. It is
1343 still somewhat experimental and thus not yet enabled by default.
1344
1345 If your estimated Rx load is 10kpps or more, or if the card will be
1346 deployed on potentially unfriendly networks (e.g. in a firewall),
1347 then say Y here.
1348
1349 If in doubt, say N.
1350
1351config AC3200 1337config AC3200
1352 tristate "Ansel Communications EISA 3200 support (EXPERIMENTAL)" 1338 tristate "Ansel Communications EISA 3200 support (EXPERIMENTAL)"
1353 depends on NET_PCI && (ISA || EISA) && EXPERIMENTAL 1339 depends on NET_PCI && (ISA || EISA) && EXPERIMENTAL
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index 2038f38dc04b..1d2ef8f47780 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -27,8 +27,8 @@
27*/ 27*/
28 28
29#define DRV_NAME "starfire" 29#define DRV_NAME "starfire"
30#define DRV_VERSION "2.0" 30#define DRV_VERSION "2.1"
31#define DRV_RELDATE "June 27, 2006" 31#define DRV_RELDATE "July 6, 2008"
32 32
33#include <linux/module.h> 33#include <linux/module.h>
34#include <linux/kernel.h> 34#include <linux/kernel.h>
@@ -69,10 +69,6 @@
69#define VLAN_SUPPORT 69#define VLAN_SUPPORT
70#endif 70#endif
71 71
72#ifndef CONFIG_ADAPTEC_STARFIRE_NAPI
73#undef HAVE_NETDEV_POLL
74#endif
75
76/* The user-configurable values. 72/* The user-configurable values.
77 These may be modified when a driver module is loaded.*/ 73 These may be modified when a driver module is loaded.*/
78 74
@@ -177,44 +173,6 @@ static int full_duplex[MAX_UNITS] = {0, };
177#define skb_first_frag_len(skb) skb_headlen(skb) 173#define skb_first_frag_len(skb) skb_headlen(skb)
178#define skb_num_frags(skb) (skb_shinfo(skb)->nr_frags + 1) 174#define skb_num_frags(skb) (skb_shinfo(skb)->nr_frags + 1)
179 175
180#ifdef HAVE_NETDEV_POLL
181#define init_poll(dev, np) \
182 netif_napi_add(dev, &np->napi, netdev_poll, max_interrupt_work)
183#define netdev_rx(dev, np, ioaddr) \
184do { \
185 u32 intr_enable; \
186 if (netif_rx_schedule_prep(dev, &np->napi)) { \
187 __netif_rx_schedule(dev, &np->napi); \
188 intr_enable = readl(ioaddr + IntrEnable); \
189 intr_enable &= ~(IntrRxDone | IntrRxEmpty); \
190 writel(intr_enable, ioaddr + IntrEnable); \
191 readl(ioaddr + IntrEnable); /* flush PCI posting buffers */ \
192 } else { \
193 /* Paranoia check */ \
194 intr_enable = readl(ioaddr + IntrEnable); \
195 if (intr_enable & (IntrRxDone | IntrRxEmpty)) { \
196 printk(KERN_INFO "%s: interrupt while in polling mode!\n", dev->name); \
197 intr_enable &= ~(IntrRxDone | IntrRxEmpty); \
198 writel(intr_enable, ioaddr + IntrEnable); \
199 } \
200 } \
201} while (0)
202#define netdev_receive_skb(skb) netif_receive_skb(skb)
203#define vlan_netdev_receive_skb(skb, vlgrp, vlid) vlan_hwaccel_receive_skb(skb, vlgrp, vlid)
204static int netdev_poll(struct napi_struct *napi, int budget);
205#else /* not HAVE_NETDEV_POLL */
206#define init_poll(dev, np)
207#define netdev_receive_skb(skb) netif_rx(skb)
208#define vlan_netdev_receive_skb(skb, vlgrp, vlid) vlan_hwaccel_rx(skb, vlgrp, vlid)
209#define netdev_rx(dev, np, ioaddr) \
210do { \
211 int quota = np->dirty_rx + RX_RING_SIZE - np->cur_rx; \
212 __netdev_rx(dev, &quota);\
213} while (0)
214#endif /* not HAVE_NETDEV_POLL */
215/* end of compatibility code */
216
217
218/* These identify the driver base version and may not be removed. */ 176/* These identify the driver base version and may not be removed. */
219static char version[] = 177static char version[] =
220KERN_INFO "starfire.c:v1.03 7/26/2000 Written by Donald Becker <becker@scyld.com>\n" 178KERN_INFO "starfire.c:v1.03 7/26/2000 Written by Donald Becker <becker@scyld.com>\n"
@@ -635,6 +593,7 @@ static int start_tx(struct sk_buff *skb, struct net_device *dev);
635static irqreturn_t intr_handler(int irq, void *dev_instance); 593static irqreturn_t intr_handler(int irq, void *dev_instance);
636static void netdev_error(struct net_device *dev, int intr_status); 594static void netdev_error(struct net_device *dev, int intr_status);
637static int __netdev_rx(struct net_device *dev, int *quota); 595static int __netdev_rx(struct net_device *dev, int *quota);
596static int netdev_poll(struct napi_struct *napi, int budget);
638static void refill_rx_ring(struct net_device *dev); 597static void refill_rx_ring(struct net_device *dev);
639static void netdev_error(struct net_device *dev, int intr_status); 598static void netdev_error(struct net_device *dev, int intr_status);
640static void set_rx_mode(struct net_device *dev); 599static void set_rx_mode(struct net_device *dev);
@@ -851,7 +810,7 @@ static int __devinit starfire_init_one(struct pci_dev *pdev,
851 dev->hard_start_xmit = &start_tx; 810 dev->hard_start_xmit = &start_tx;
852 dev->tx_timeout = tx_timeout; 811 dev->tx_timeout = tx_timeout;
853 dev->watchdog_timeo = TX_TIMEOUT; 812 dev->watchdog_timeo = TX_TIMEOUT;
854 init_poll(dev, np); 813 netif_napi_add(dev, &np->napi, netdev_poll, max_interrupt_work);
855 dev->stop = &netdev_close; 814 dev->stop = &netdev_close;
856 dev->get_stats = &get_stats; 815 dev->get_stats = &get_stats;
857 dev->set_multicast_list = &set_rx_mode; 816 dev->set_multicast_list = &set_rx_mode;
@@ -1054,9 +1013,8 @@ static int netdev_open(struct net_device *dev)
1054 1013
1055 writel(np->intr_timer_ctrl, ioaddr + IntrTimerCtrl); 1014 writel(np->intr_timer_ctrl, ioaddr + IntrTimerCtrl);
1056 1015
1057#ifdef HAVE_NETDEV_POLL
1058 napi_enable(&np->napi); 1016 napi_enable(&np->napi);
1059#endif 1017
1060 netif_start_queue(dev); 1018 netif_start_queue(dev);
1061 1019
1062 if (debug > 1) 1020 if (debug > 1)
@@ -1330,8 +1288,28 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
1330 1288
1331 handled = 1; 1289 handled = 1;
1332 1290
1333 if (intr_status & (IntrRxDone | IntrRxEmpty)) 1291 if (intr_status & (IntrRxDone | IntrRxEmpty)) {
1334 netdev_rx(dev, np, ioaddr); 1292 u32 enable;
1293
1294 if (likely(netif_rx_schedule_prep(dev, &np->napi))) {
1295 __netif_rx_schedule(dev, &np->napi);
1296 enable = readl(ioaddr + IntrEnable);
1297 enable &= ~(IntrRxDone | IntrRxEmpty);
1298 writel(enable, ioaddr + IntrEnable);
1299 /* flush PCI posting buffers */
1300 readl(ioaddr + IntrEnable);
1301 } else {
1302 /* Paranoia check */
1303 enable = readl(ioaddr + IntrEnable);
1304 if (enable & (IntrRxDone | IntrRxEmpty)) {
1305 printk(KERN_INFO
1306 "%s: interrupt while in poll!\n",
1307 dev->name);
1308 enable &= ~(IntrRxDone | IntrRxEmpty);
1309 writel(enable, ioaddr + IntrEnable);
1310 }
1311 }
1312 }
1335 1313
1336 /* Scavenge the skbuff list based on the Tx-done queue. 1314 /* Scavenge the skbuff list based on the Tx-done queue.
1337 There are redundant checks here that may be cleaned up 1315 There are redundant checks here that may be cleaned up
@@ -1411,8 +1389,10 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
1411} 1389}
1412 1390
1413 1391
1414/* This routine is logically part of the interrupt/poll handler, but separated 1392/*
1415 for clarity, code sharing between NAPI/non-NAPI, and better register allocation. */ 1393 * This routine is logically part of the interrupt/poll handler, but separated
1394 * for clarity and better register allocation.
1395 */
1416static int __netdev_rx(struct net_device *dev, int *quota) 1396static int __netdev_rx(struct net_device *dev, int *quota)
1417{ 1397{
1418 struct netdev_private *np = netdev_priv(dev); 1398 struct netdev_private *np = netdev_priv(dev);
@@ -1507,13 +1487,20 @@ static int __netdev_rx(struct net_device *dev, int *quota)
1507 } 1487 }
1508#ifdef VLAN_SUPPORT 1488#ifdef VLAN_SUPPORT
1509 if (np->vlgrp && le16_to_cpu(desc->status2) & 0x0200) { 1489 if (np->vlgrp && le16_to_cpu(desc->status2) & 0x0200) {
1510 if (debug > 4) 1490 u16 vlid = le16_to_cpu(desc->vlanid);
1511 printk(KERN_DEBUG " netdev_rx() vlanid = %d\n", le16_to_cpu(desc->vlanid)); 1491
1512 /* vlan_netdev_receive_skb() expects a packet with the VLAN tag stripped out */ 1492 if (debug > 4) {
1513 vlan_netdev_receive_skb(skb, np->vlgrp, le16_to_cpu(desc->vlanid)); 1493 printk(KERN_DEBUG " netdev_rx() vlanid = %d\n",
1494 vlid);
1495 }
1496 /*
1497 * vlan_hwaccel_rx expects a packet with the VLAN tag
1498 * stripped out.
1499 */
1500 vlan_hwaccel_rx(skb, np->vlgrp, vlid);
1514 } else 1501 } else
1515#endif /* VLAN_SUPPORT */ 1502#endif /* VLAN_SUPPORT */
1516 netdev_receive_skb(skb); 1503 netif_receive_skb(skb);
1517 dev->last_rx = jiffies; 1504 dev->last_rx = jiffies;
1518 np->stats.rx_packets++; 1505 np->stats.rx_packets++;
1519 1506
@@ -1532,8 +1519,6 @@ static int __netdev_rx(struct net_device *dev, int *quota)
1532 return retcode; 1519 return retcode;
1533} 1520}
1534 1521
1535
1536#ifdef HAVE_NETDEV_POLL
1537static int netdev_poll(struct napi_struct *napi, int budget) 1522static int netdev_poll(struct napi_struct *napi, int budget)
1538{ 1523{
1539 struct netdev_private *np = container_of(napi, struct netdev_private, napi); 1524 struct netdev_private *np = container_of(napi, struct netdev_private, napi);
@@ -1564,8 +1549,6 @@ static int netdev_poll(struct napi_struct *napi, int budget)
1564 /* Restart Rx engine if stopped. */ 1549 /* Restart Rx engine if stopped. */
1565 return budget - quota; 1550 return budget - quota;
1566} 1551}
1567#endif /* HAVE_NETDEV_POLL */
1568
1569 1552
1570static void refill_rx_ring(struct net_device *dev) 1553static void refill_rx_ring(struct net_device *dev)
1571{ 1554{
@@ -1906,9 +1889,8 @@ static int netdev_close(struct net_device *dev)
1906 int i; 1889 int i;
1907 1890
1908 netif_stop_queue(dev); 1891 netif_stop_queue(dev);
1909#ifdef HAVE_NETDEV_POLL 1892
1910 napi_disable(&np->napi); 1893 napi_disable(&np->napi);
1911#endif
1912 1894
1913 if (debug > 1) { 1895 if (debug > 1) {
1914 printk(KERN_DEBUG "%s: Shutting down ethercard, Intr status %#8.8x.\n", 1896 printk(KERN_DEBUG "%s: Shutting down ethercard, Intr status %#8.8x.\n",
@@ -2044,11 +2026,8 @@ static int __init starfire_init (void)
2044/* when a module, this is printed whether or not devices are found in probe */ 2026/* when a module, this is printed whether or not devices are found in probe */
2045#ifdef MODULE 2027#ifdef MODULE
2046 printk(version); 2028 printk(version);
2047#ifdef HAVE_NETDEV_POLL 2029
2048 printk(KERN_INFO DRV_NAME ": polling (NAPI) enabled\n"); 2030 printk(KERN_INFO DRV_NAME ": polling (NAPI) enabled\n");
2049#else
2050 printk(KERN_INFO DRV_NAME ": polling (NAPI) disabled\n");
2051#endif
2052#endif 2031#endif
2053 2032
2054 /* we can do this test only at run-time... sigh */ 2033 /* we can do this test only at run-time... sigh */