diff options
author | Francois Romieu <romieu@fr.zoreil.com> | 2008-07-10 18:33:52 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-07-11 01:11:44 -0400 |
commit | 0aa1538f4e4bab366023f4c414555e4ed25994e6 (patch) | |
tree | 1b9484cda285151ec0004c0decd099d53f2f241c /drivers/net/gianfar.c | |
parent | 32b0f53e5bc80b87fd20d4d78a0e0cb602c9157a (diff) |
gianfar: delete non NAPI code from the driver.
Compile-tested only.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/gianfar.c')
-rw-r--r-- | drivers/net/gianfar.c | 76 |
1 files changed, 6 insertions, 70 deletions
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 393a0f17530..fa78d687012 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -44,8 +44,7 @@ | |||
44 | * happen immediately, but will wait until either a set number | 44 | * happen immediately, but will wait until either a set number |
45 | * of frames or amount of time have passed). In NAPI, the | 45 | * of frames or amount of time have passed). In NAPI, the |
46 | * interrupt handler will signal there is work to be done, and | 46 | * interrupt handler will signal there is work to be done, and |
47 | * exit. Without NAPI, the packet(s) will be handled | 47 | * exit. This method will start at the last known empty |
48 | * immediately. Both methods will start at the last known empty | ||
49 | * descriptor, and process every subsequent descriptor until there | 48 | * descriptor, and process every subsequent descriptor until there |
50 | * are none left with data (NAPI will stop after a set number of | 49 | * are none left with data (NAPI will stop after a set number of |
51 | * packets to give time to other tasks, but will eventually | 50 | * packets to give time to other tasks, but will eventually |
@@ -101,12 +100,6 @@ | |||
101 | #undef BRIEF_GFAR_ERRORS | 100 | #undef BRIEF_GFAR_ERRORS |
102 | #undef VERBOSE_GFAR_ERRORS | 101 | #undef VERBOSE_GFAR_ERRORS |
103 | 102 | ||
104 | #ifdef CONFIG_GFAR_NAPI | ||
105 | #define RECEIVE(x) netif_receive_skb(x) | ||
106 | #else | ||
107 | #define RECEIVE(x) netif_rx(x) | ||
108 | #endif | ||
109 | |||
110 | const char gfar_driver_name[] = "Gianfar Ethernet"; | 103 | const char gfar_driver_name[] = "Gianfar Ethernet"; |
111 | const char gfar_driver_version[] = "1.3"; | 104 | const char gfar_driver_version[] = "1.3"; |
112 | 105 | ||
@@ -131,9 +124,7 @@ static void free_skb_resources(struct gfar_private *priv); | |||
131 | static void gfar_set_multi(struct net_device *dev); | 124 | static void gfar_set_multi(struct net_device *dev); |
132 | static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr); | 125 | static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr); |
133 | static void gfar_configure_serdes(struct net_device *dev); | 126 | static void gfar_configure_serdes(struct net_device *dev); |
134 | #ifdef CONFIG_GFAR_NAPI | ||
135 | static int gfar_poll(struct napi_struct *napi, int budget); | 127 | static int gfar_poll(struct napi_struct *napi, int budget); |
136 | #endif | ||
137 | #ifdef CONFIG_NET_POLL_CONTROLLER | 128 | #ifdef CONFIG_NET_POLL_CONTROLLER |
138 | static void gfar_netpoll(struct net_device *dev); | 129 | static void gfar_netpoll(struct net_device *dev); |
139 | #endif | 130 | #endif |
@@ -260,9 +251,7 @@ static int gfar_probe(struct platform_device *pdev) | |||
260 | dev->hard_start_xmit = gfar_start_xmit; | 251 | dev->hard_start_xmit = gfar_start_xmit; |
261 | dev->tx_timeout = gfar_timeout; | 252 | dev->tx_timeout = gfar_timeout; |
262 | dev->watchdog_timeo = TX_TIMEOUT; | 253 | dev->watchdog_timeo = TX_TIMEOUT; |
263 | #ifdef CONFIG_GFAR_NAPI | ||
264 | netif_napi_add(dev, &priv->napi, gfar_poll, GFAR_DEV_WEIGHT); | 254 | netif_napi_add(dev, &priv->napi, gfar_poll, GFAR_DEV_WEIGHT); |
265 | #endif | ||
266 | #ifdef CONFIG_NET_POLL_CONTROLLER | 255 | #ifdef CONFIG_NET_POLL_CONTROLLER |
267 | dev->poll_controller = gfar_netpoll; | 256 | dev->poll_controller = gfar_netpoll; |
268 | #endif | 257 | #endif |
@@ -363,11 +352,7 @@ static int gfar_probe(struct platform_device *pdev) | |||
363 | 352 | ||
364 | /* Even more device info helps when determining which kernel */ | 353 | /* Even more device info helps when determining which kernel */ |
365 | /* provided which set of benchmarks. */ | 354 | /* provided which set of benchmarks. */ |
366 | #ifdef CONFIG_GFAR_NAPI | ||
367 | printk(KERN_INFO "%s: Running with NAPI enabled\n", dev->name); | 355 | printk(KERN_INFO "%s: Running with NAPI enabled\n", dev->name); |
368 | #else | ||
369 | printk(KERN_INFO "%s: Running with NAPI disabled\n", dev->name); | ||
370 | #endif | ||
371 | printk(KERN_INFO "%s: %d/%d RX/TX BD ring size\n", | 356 | printk(KERN_INFO "%s: %d/%d RX/TX BD ring size\n", |
372 | dev->name, priv->rx_ring_size, priv->tx_ring_size); | 357 | dev->name, priv->rx_ring_size, priv->tx_ring_size); |
373 | 358 | ||
@@ -945,14 +930,10 @@ tx_skb_fail: | |||
945 | /* Returns 0 for success. */ | 930 | /* Returns 0 for success. */ |
946 | static int gfar_enet_open(struct net_device *dev) | 931 | static int gfar_enet_open(struct net_device *dev) |
947 | { | 932 | { |
948 | #ifdef CONFIG_GFAR_NAPI | ||
949 | struct gfar_private *priv = netdev_priv(dev); | 933 | struct gfar_private *priv = netdev_priv(dev); |
950 | #endif | ||
951 | int err; | 934 | int err; |
952 | 935 | ||
953 | #ifdef CONFIG_GFAR_NAPI | ||
954 | napi_enable(&priv->napi); | 936 | napi_enable(&priv->napi); |
955 | #endif | ||
956 | 937 | ||
957 | /* Initialize a bunch of registers */ | 938 | /* Initialize a bunch of registers */ |
958 | init_registers(dev); | 939 | init_registers(dev); |
@@ -962,17 +943,13 @@ static int gfar_enet_open(struct net_device *dev) | |||
962 | err = init_phy(dev); | 943 | err = init_phy(dev); |
963 | 944 | ||
964 | if(err) { | 945 | if(err) { |
965 | #ifdef CONFIG_GFAR_NAPI | ||
966 | napi_disable(&priv->napi); | 946 | napi_disable(&priv->napi); |
967 | #endif | ||
968 | return err; | 947 | return err; |
969 | } | 948 | } |
970 | 949 | ||
971 | err = startup_gfar(dev); | 950 | err = startup_gfar(dev); |
972 | if (err) { | 951 | if (err) { |
973 | #ifdef CONFIG_GFAR_NAPI | ||
974 | napi_disable(&priv->napi); | 952 | napi_disable(&priv->napi); |
975 | #endif | ||
976 | return err; | 953 | return err; |
977 | } | 954 | } |
978 | 955 | ||
@@ -1128,9 +1105,7 @@ static int gfar_close(struct net_device *dev) | |||
1128 | { | 1105 | { |
1129 | struct gfar_private *priv = netdev_priv(dev); | 1106 | struct gfar_private *priv = netdev_priv(dev); |
1130 | 1107 | ||
1131 | #ifdef CONFIG_GFAR_NAPI | ||
1132 | napi_disable(&priv->napi); | 1108 | napi_disable(&priv->napi); |
1133 | #endif | ||
1134 | 1109 | ||
1135 | stop_gfar(dev); | 1110 | stop_gfar(dev); |
1136 | 1111 | ||
@@ -1427,14 +1402,9 @@ irqreturn_t gfar_receive(int irq, void *dev_id) | |||
1427 | { | 1402 | { |
1428 | struct net_device *dev = (struct net_device *) dev_id; | 1403 | struct net_device *dev = (struct net_device *) dev_id; |
1429 | struct gfar_private *priv = netdev_priv(dev); | 1404 | struct gfar_private *priv = netdev_priv(dev); |
1430 | #ifdef CONFIG_GFAR_NAPI | ||
1431 | u32 tempval; | 1405 | u32 tempval; |
1432 | #else | ||
1433 | unsigned long flags; | ||
1434 | #endif | ||
1435 | 1406 | ||
1436 | /* support NAPI */ | 1407 | /* support NAPI */ |
1437 | #ifdef CONFIG_GFAR_NAPI | ||
1438 | /* Clear IEVENT, so interrupts aren't called again | 1408 | /* Clear IEVENT, so interrupts aren't called again |
1439 | * because of the packets that have already arrived */ | 1409 | * because of the packets that have already arrived */ |
1440 | gfar_write(&priv->regs->ievent, IEVENT_RTX_MASK); | 1410 | gfar_write(&priv->regs->ievent, IEVENT_RTX_MASK); |
@@ -1451,38 +1421,10 @@ irqreturn_t gfar_receive(int irq, void *dev_id) | |||
1451 | dev->name, gfar_read(&priv->regs->ievent), | 1421 | dev->name, gfar_read(&priv->regs->ievent), |
1452 | gfar_read(&priv->regs->imask)); | 1422 | gfar_read(&priv->regs->imask)); |
1453 | } | 1423 | } |
1454 | #else | ||
1455 | /* Clear IEVENT, so rx interrupt isn't called again | ||
1456 | * because of this interrupt */ | ||
1457 | gfar_write(&priv->regs->ievent, IEVENT_RX_MASK); | ||
1458 | |||
1459 | spin_lock_irqsave(&priv->rxlock, flags); | ||
1460 | gfar_clean_rx_ring(dev, priv->rx_ring_size); | ||
1461 | |||
1462 | /* If we are coalescing interrupts, update the timer */ | ||
1463 | /* Otherwise, clear it */ | ||
1464 | if (likely(priv->rxcoalescing)) { | ||
1465 | gfar_write(&priv->regs->rxic, 0); | ||
1466 | gfar_write(&priv->regs->rxic, | ||
1467 | mk_ic_value(priv->rxcount, priv->rxtime)); | ||
1468 | } | ||
1469 | |||
1470 | spin_unlock_irqrestore(&priv->rxlock, flags); | ||
1471 | #endif | ||
1472 | 1424 | ||
1473 | return IRQ_HANDLED; | 1425 | return IRQ_HANDLED; |
1474 | } | 1426 | } |
1475 | 1427 | ||
1476 | static inline int gfar_rx_vlan(struct sk_buff *skb, | ||
1477 | struct vlan_group *vlgrp, unsigned short vlctl) | ||
1478 | { | ||
1479 | #ifdef CONFIG_GFAR_NAPI | ||
1480 | return vlan_hwaccel_receive_skb(skb, vlgrp, vlctl); | ||
1481 | #else | ||
1482 | return vlan_hwaccel_rx(skb, vlgrp, vlctl); | ||
1483 | #endif | ||
1484 | } | ||
1485 | |||
1486 | static inline void gfar_rx_checksum(struct sk_buff *skb, struct rxfcb *fcb) | 1428 | static inline void gfar_rx_checksum(struct sk_buff *skb, struct rxfcb *fcb) |
1487 | { | 1429 | { |
1488 | /* If valid headers were found, and valid sums | 1430 | /* If valid headers were found, and valid sums |
@@ -1539,10 +1481,11 @@ static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb, | |||
1539 | skb->protocol = eth_type_trans(skb, dev); | 1481 | skb->protocol = eth_type_trans(skb, dev); |
1540 | 1482 | ||
1541 | /* Send the packet up the stack */ | 1483 | /* Send the packet up the stack */ |
1542 | if (unlikely(priv->vlgrp && (fcb->flags & RXFCB_VLN))) | 1484 | if (unlikely(priv->vlgrp && (fcb->flags & RXFCB_VLN))) { |
1543 | ret = gfar_rx_vlan(skb, priv->vlgrp, fcb->vlctl); | 1485 | ret = vlan_hwaccel_receive_skb(skb, priv->vlgrp, |
1544 | else | 1486 | fcb->vlctl); |
1545 | ret = RECEIVE(skb); | 1487 | } else |
1488 | ret = netif_receive_skb(skb); | ||
1546 | 1489 | ||
1547 | if (NET_RX_DROP == ret) | 1490 | if (NET_RX_DROP == ret) |
1548 | priv->extra_stats.kernel_dropped++; | 1491 | priv->extra_stats.kernel_dropped++; |
@@ -1629,7 +1572,6 @@ int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit) | |||
1629 | return howmany; | 1572 | return howmany; |
1630 | } | 1573 | } |
1631 | 1574 | ||
1632 | #ifdef CONFIG_GFAR_NAPI | ||
1633 | static int gfar_poll(struct napi_struct *napi, int budget) | 1575 | static int gfar_poll(struct napi_struct *napi, int budget) |
1634 | { | 1576 | { |
1635 | struct gfar_private *priv = container_of(napi, struct gfar_private, napi); | 1577 | struct gfar_private *priv = container_of(napi, struct gfar_private, napi); |
@@ -1664,7 +1606,6 @@ static int gfar_poll(struct napi_struct *napi, int budget) | |||
1664 | 1606 | ||
1665 | return howmany; | 1607 | return howmany; |
1666 | } | 1608 | } |
1667 | #endif | ||
1668 | 1609 | ||
1669 | #ifdef CONFIG_NET_POLL_CONTROLLER | 1610 | #ifdef CONFIG_NET_POLL_CONTROLLER |
1670 | /* | 1611 | /* |
@@ -2003,11 +1944,6 @@ static irqreturn_t gfar_error(int irq, void *dev_id) | |||
2003 | 1944 | ||
2004 | gfar_receive(irq, dev_id); | 1945 | gfar_receive(irq, dev_id); |
2005 | 1946 | ||
2006 | #ifndef CONFIG_GFAR_NAPI | ||
2007 | /* Clear the halt bit in RSTAT */ | ||
2008 | gfar_write(&priv->regs->rstat, RSTAT_CLEAR_RHALT); | ||
2009 | #endif | ||
2010 | |||
2011 | if (netif_msg_rx_err(priv)) | 1947 | if (netif_msg_rx_err(priv)) |
2012 | printk(KERN_DEBUG "%s: busy error (rstat: %x)\n", | 1948 | printk(KERN_DEBUG "%s: busy error (rstat: %x)\n", |
2013 | dev->name, gfar_read(&priv->regs->rstat)); | 1949 | dev->name, gfar_read(&priv->regs->rstat)); |