aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/Kconfig4
-rw-r--r--drivers/net/gianfar.c76
-rw-r--r--drivers/net/gianfar.h11
3 files changed, 6 insertions, 85 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index fb618b6e88eb..1fe7e0792c1f 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2262,10 +2262,6 @@ config GIANFAR
2262 This driver supports the Gigabit TSEC on the MPC83xx, MPC85xx, 2262 This driver supports the Gigabit TSEC on the MPC83xx, MPC85xx,
2263 and MPC86xx family of chips, and the FEC on the 8540. 2263 and MPC86xx family of chips, and the FEC on the 8540.
2264 2264
2265config GFAR_NAPI
2266 bool "Use Rx Polling (NAPI)"
2267 depends on GIANFAR
2268
2269config UCC_GETH 2265config UCC_GETH
2270 tristate "Freescale QE Gigabit Ethernet" 2266 tristate "Freescale QE Gigabit Ethernet"
2271 depends on QUICC_ENGINE 2267 depends on QUICC_ENGINE
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 393a0f175302..fa78d6870124 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
110const char gfar_driver_name[] = "Gianfar Ethernet"; 103const char gfar_driver_name[] = "Gianfar Ethernet";
111const char gfar_driver_version[] = "1.3"; 104const char gfar_driver_version[] = "1.3";
112 105
@@ -131,9 +124,7 @@ static void free_skb_resources(struct gfar_private *priv);
131static void gfar_set_multi(struct net_device *dev); 124static void gfar_set_multi(struct net_device *dev);
132static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr); 125static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr);
133static void gfar_configure_serdes(struct net_device *dev); 126static void gfar_configure_serdes(struct net_device *dev);
134#ifdef CONFIG_GFAR_NAPI
135static int gfar_poll(struct napi_struct *napi, int budget); 127static int gfar_poll(struct napi_struct *napi, int budget);
136#endif
137#ifdef CONFIG_NET_POLL_CONTROLLER 128#ifdef CONFIG_NET_POLL_CONTROLLER
138static void gfar_netpoll(struct net_device *dev); 129static 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. */
946static int gfar_enet_open(struct net_device *dev) 931static 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
1476static 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
1486static inline void gfar_rx_checksum(struct sk_buff *skb, struct rxfcb *fcb) 1428static 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
1633static int gfar_poll(struct napi_struct *napi, int budget) 1575static 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));
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h
index 27f37c81e52c..bead71cb2b16 100644
--- a/drivers/net/gianfar.h
+++ b/drivers/net/gianfar.h
@@ -77,13 +77,8 @@ extern const char gfar_driver_name[];
77extern const char gfar_driver_version[]; 77extern const char gfar_driver_version[];
78 78
79/* These need to be powers of 2 for this driver */ 79/* These need to be powers of 2 for this driver */
80#ifdef CONFIG_GFAR_NAPI
81#define DEFAULT_TX_RING_SIZE 256 80#define DEFAULT_TX_RING_SIZE 256
82#define DEFAULT_RX_RING_SIZE 256 81#define DEFAULT_RX_RING_SIZE 256
83#else
84#define DEFAULT_TX_RING_SIZE 64
85#define DEFAULT_RX_RING_SIZE 64
86#endif
87 82
88#define GFAR_RX_MAX_RING_SIZE 256 83#define GFAR_RX_MAX_RING_SIZE 256
89#define GFAR_TX_MAX_RING_SIZE 256 84#define GFAR_TX_MAX_RING_SIZE 256
@@ -128,14 +123,8 @@ extern const char gfar_driver_version[];
128 123
129#define DEFAULT_RXTIME 21 124#define DEFAULT_RXTIME 21
130 125
131/* Non NAPI Case */
132#ifndef CONFIG_GFAR_NAPI
133#define DEFAULT_RX_COALESCE 1
134#define DEFAULT_RXCOUNT 16
135#else
136#define DEFAULT_RX_COALESCE 0 126#define DEFAULT_RX_COALESCE 0
137#define DEFAULT_RXCOUNT 0 127#define DEFAULT_RXCOUNT 0
138#endif /* CONFIG_GFAR_NAPI */
139 128
140#define MIIMCFG_INIT_VALUE 0x00000007 129#define MIIMCFG_INIT_VALUE 0x00000007
141#define MIIMCFG_RESET 0x80000000 130#define MIIMCFG_RESET 0x80000000