From 7d2e3cb7000b883a8e489485ac249be572fe17b1 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Tue, 13 May 2008 01:41:58 -0400 Subject: [netdrvr] Trim trailing whitespace for several drivers Signed-off-by: Jeff Garzik --- drivers/net/gianfar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net/gianfar.c') diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 587afe7be689..642dc633b444 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c @@ -925,7 +925,7 @@ rx_irq_fail: tx_irq_fail: free_irq(priv->interruptError, dev); err_irq_fail: -err_rxalloc_fail: +err_rxalloc_fail: rx_skb_fail: free_skb_resources(priv); tx_skb_fail: -- cgit v1.2.3 From 0aa1538f4e4bab366023f4c414555e4ed25994e6 Mon Sep 17 00:00:00 2001 From: Francois Romieu Date: Fri, 11 Jul 2008 00:33:52 +0200 Subject: gianfar: delete non NAPI code from the driver. Compile-tested only. Signed-off-by: Francois Romieu Signed-off-by: Jeff Garzik --- drivers/net/Kconfig | 4 --- drivers/net/gianfar.c | 76 ++++----------------------------------------------- drivers/net/gianfar.h | 11 -------- 3 files changed, 6 insertions(+), 85 deletions(-) (limited to 'drivers/net/gianfar.c') 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 This driver supports the Gigabit TSEC on the MPC83xx, MPC85xx, and MPC86xx family of chips, and the FEC on the 8540. -config GFAR_NAPI - bool "Use Rx Polling (NAPI)" - depends on GIANFAR - config UCC_GETH tristate "Freescale QE Gigabit Ethernet" 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 @@ * happen immediately, but will wait until either a set number * of frames or amount of time have passed). In NAPI, the * interrupt handler will signal there is work to be done, and - * exit. Without NAPI, the packet(s) will be handled - * immediately. Both methods will start at the last known empty + * exit. This method will start at the last known empty * descriptor, and process every subsequent descriptor until there * are none left with data (NAPI will stop after a set number of * packets to give time to other tasks, but will eventually @@ -101,12 +100,6 @@ #undef BRIEF_GFAR_ERRORS #undef VERBOSE_GFAR_ERRORS -#ifdef CONFIG_GFAR_NAPI -#define RECEIVE(x) netif_receive_skb(x) -#else -#define RECEIVE(x) netif_rx(x) -#endif - const char gfar_driver_name[] = "Gianfar Ethernet"; const char gfar_driver_version[] = "1.3"; @@ -131,9 +124,7 @@ static void free_skb_resources(struct gfar_private *priv); static void gfar_set_multi(struct net_device *dev); static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr); static void gfar_configure_serdes(struct net_device *dev); -#ifdef CONFIG_GFAR_NAPI static int gfar_poll(struct napi_struct *napi, int budget); -#endif #ifdef CONFIG_NET_POLL_CONTROLLER static void gfar_netpoll(struct net_device *dev); #endif @@ -260,9 +251,7 @@ static int gfar_probe(struct platform_device *pdev) dev->hard_start_xmit = gfar_start_xmit; dev->tx_timeout = gfar_timeout; dev->watchdog_timeo = TX_TIMEOUT; -#ifdef CONFIG_GFAR_NAPI netif_napi_add(dev, &priv->napi, gfar_poll, GFAR_DEV_WEIGHT); -#endif #ifdef CONFIG_NET_POLL_CONTROLLER dev->poll_controller = gfar_netpoll; #endif @@ -363,11 +352,7 @@ static int gfar_probe(struct platform_device *pdev) /* Even more device info helps when determining which kernel */ /* provided which set of benchmarks. */ -#ifdef CONFIG_GFAR_NAPI printk(KERN_INFO "%s: Running with NAPI enabled\n", dev->name); -#else - printk(KERN_INFO "%s: Running with NAPI disabled\n", dev->name); -#endif printk(KERN_INFO "%s: %d/%d RX/TX BD ring size\n", dev->name, priv->rx_ring_size, priv->tx_ring_size); @@ -945,14 +930,10 @@ tx_skb_fail: /* Returns 0 for success. */ static int gfar_enet_open(struct net_device *dev) { -#ifdef CONFIG_GFAR_NAPI struct gfar_private *priv = netdev_priv(dev); -#endif int err; -#ifdef CONFIG_GFAR_NAPI napi_enable(&priv->napi); -#endif /* Initialize a bunch of registers */ init_registers(dev); @@ -962,17 +943,13 @@ static int gfar_enet_open(struct net_device *dev) err = init_phy(dev); if(err) { -#ifdef CONFIG_GFAR_NAPI napi_disable(&priv->napi); -#endif return err; } err = startup_gfar(dev); if (err) { -#ifdef CONFIG_GFAR_NAPI napi_disable(&priv->napi); -#endif return err; } @@ -1128,9 +1105,7 @@ static int gfar_close(struct net_device *dev) { struct gfar_private *priv = netdev_priv(dev); -#ifdef CONFIG_GFAR_NAPI napi_disable(&priv->napi); -#endif stop_gfar(dev); @@ -1427,14 +1402,9 @@ irqreturn_t gfar_receive(int irq, void *dev_id) { struct net_device *dev = (struct net_device *) dev_id; struct gfar_private *priv = netdev_priv(dev); -#ifdef CONFIG_GFAR_NAPI u32 tempval; -#else - unsigned long flags; -#endif /* support NAPI */ -#ifdef CONFIG_GFAR_NAPI /* Clear IEVENT, so interrupts aren't called again * because of the packets that have already arrived */ gfar_write(&priv->regs->ievent, IEVENT_RTX_MASK); @@ -1451,38 +1421,10 @@ irqreturn_t gfar_receive(int irq, void *dev_id) dev->name, gfar_read(&priv->regs->ievent), gfar_read(&priv->regs->imask)); } -#else - /* Clear IEVENT, so rx interrupt isn't called again - * because of this interrupt */ - gfar_write(&priv->regs->ievent, IEVENT_RX_MASK); - - spin_lock_irqsave(&priv->rxlock, flags); - gfar_clean_rx_ring(dev, priv->rx_ring_size); - - /* If we are coalescing interrupts, update the timer */ - /* Otherwise, clear it */ - if (likely(priv->rxcoalescing)) { - gfar_write(&priv->regs->rxic, 0); - gfar_write(&priv->regs->rxic, - mk_ic_value(priv->rxcount, priv->rxtime)); - } - - spin_unlock_irqrestore(&priv->rxlock, flags); -#endif return IRQ_HANDLED; } -static inline int gfar_rx_vlan(struct sk_buff *skb, - struct vlan_group *vlgrp, unsigned short vlctl) -{ -#ifdef CONFIG_GFAR_NAPI - return vlan_hwaccel_receive_skb(skb, vlgrp, vlctl); -#else - return vlan_hwaccel_rx(skb, vlgrp, vlctl); -#endif -} - static inline void gfar_rx_checksum(struct sk_buff *skb, struct rxfcb *fcb) { /* 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, skb->protocol = eth_type_trans(skb, dev); /* Send the packet up the stack */ - if (unlikely(priv->vlgrp && (fcb->flags & RXFCB_VLN))) - ret = gfar_rx_vlan(skb, priv->vlgrp, fcb->vlctl); - else - ret = RECEIVE(skb); + if (unlikely(priv->vlgrp && (fcb->flags & RXFCB_VLN))) { + ret = vlan_hwaccel_receive_skb(skb, priv->vlgrp, + fcb->vlctl); + } else + ret = netif_receive_skb(skb); if (NET_RX_DROP == ret) priv->extra_stats.kernel_dropped++; @@ -1629,7 +1572,6 @@ int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit) return howmany; } -#ifdef CONFIG_GFAR_NAPI static int gfar_poll(struct napi_struct *napi, int budget) { 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) return howmany; } -#endif #ifdef CONFIG_NET_POLL_CONTROLLER /* @@ -2003,11 +1944,6 @@ static irqreturn_t gfar_error(int irq, void *dev_id) gfar_receive(irq, dev_id); -#ifndef CONFIG_GFAR_NAPI - /* Clear the halt bit in RSTAT */ - gfar_write(&priv->regs->rstat, RSTAT_CLEAR_RHALT); -#endif - if (netif_msg_rx_err(priv)) printk(KERN_DEBUG "%s: busy error (rstat: %x)\n", 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[]; extern const char gfar_driver_version[]; /* These need to be powers of 2 for this driver */ -#ifdef CONFIG_GFAR_NAPI #define DEFAULT_TX_RING_SIZE 256 #define DEFAULT_RX_RING_SIZE 256 -#else -#define DEFAULT_TX_RING_SIZE 64 -#define DEFAULT_RX_RING_SIZE 64 -#endif #define GFAR_RX_MAX_RING_SIZE 256 #define GFAR_TX_MAX_RING_SIZE 256 @@ -128,14 +123,8 @@ extern const char gfar_driver_version[]; #define DEFAULT_RXTIME 21 -/* Non NAPI Case */ -#ifndef CONFIG_GFAR_NAPI -#define DEFAULT_RX_COALESCE 1 -#define DEFAULT_RXCOUNT 16 -#else #define DEFAULT_RX_COALESCE 0 #define DEFAULT_RXCOUNT 0 -#endif /* CONFIG_GFAR_NAPI */ #define MIIMCFG_INIT_VALUE 0x00000007 #define MIIMCFG_RESET 0x80000000 -- cgit v1.2.3 From 263ba3204a434d0ca851e1321b31cd58376b86cb Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Tue, 15 Jul 2008 03:47:41 -0700 Subject: netdev: Convert all drivers away from netif_schedule(). They logically all want to trigger a schedule for all device TX queues. Signed-off-by: David S. Miller --- drivers/net/au1000_eth.c | 2 +- drivers/net/bfin_mac.c | 2 +- drivers/net/fec_mpc52xx.c | 2 +- drivers/net/fs_enet/fs_enet-main.c | 2 +- drivers/net/gianfar.c | 4 ++-- drivers/net/macb.c | 2 +- drivers/net/sh_eth.c | 2 +- drivers/net/tc35815.c | 2 +- drivers/net/ucc_geth.c | 4 ++-- 9 files changed, 11 insertions(+), 11 deletions(-) (limited to 'drivers/net/gianfar.c') diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c index 7023d77bf380..3ab61e40e86a 100644 --- a/drivers/net/au1000_eth.c +++ b/drivers/net/au1000_eth.c @@ -912,7 +912,7 @@ au1000_adjust_link(struct net_device *dev) // link state changed if (phydev->link) // link went up - netif_schedule(dev); + netif_tx_schedule_all(dev); else { // link went down aup->old_speed = 0; aup->old_duplex = -1; diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c index 41443435ab1c..a6a3da89f590 100644 --- a/drivers/net/bfin_mac.c +++ b/drivers/net/bfin_mac.c @@ -357,7 +357,7 @@ static void bfin_mac_adjust_link(struct net_device *dev) if (!lp->old_link) { new_state = 1; lp->old_link = 1; - netif_schedule(dev); + netif_tx_schedule_all(dev); } } else if (lp->old_link) { new_state = 1; diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c index 329edd9c08fc..ae9ecb7df22b 100644 --- a/drivers/net/fec_mpc52xx.c +++ b/drivers/net/fec_mpc52xx.c @@ -197,7 +197,7 @@ static void mpc52xx_fec_adjust_link(struct net_device *dev) if (priv->link == PHY_DOWN) { new_state = 1; priv->link = phydev->link; - netif_schedule(dev); + netif_tx_schedule_all(dev); netif_carrier_on(dev); netif_start_queue(dev); } diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index fb7c47790bd6..bdb81f5750ad 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c @@ -738,7 +738,7 @@ static void generic_adjust_link(struct net_device *dev) if (!fep->oldlink) { new_state = 1; fep->oldlink = 1; - netif_schedule(dev); + netif_tx_schedule_all(dev); netif_carrier_on(dev); netif_start_queue(dev); } diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index fa78d6870124..45a63172852f 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c @@ -1234,7 +1234,7 @@ static void gfar_timeout(struct net_device *dev) startup_gfar(dev); } - netif_schedule(dev); + netif_tx_schedule_all(dev); } /* Interrupt Handler for Transmit complete */ @@ -1725,7 +1725,7 @@ static void adjust_link(struct net_device *dev) if (!priv->oldlink) { new_state = 1; priv->oldlink = 1; - netif_schedule(dev); + netif_tx_schedule_all(dev); } } else if (priv->oldlink) { new_state = 1; diff --git a/drivers/net/macb.c b/drivers/net/macb.c index e34630252cef..50688a52658e 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -165,7 +165,7 @@ static void macb_handle_link_change(struct net_device *dev) if (phydev->link != bp->link) { if (phydev->link) - netif_schedule(dev); + netif_tx_schedule_all(dev); else { bp->speed = 0; bp->duplex = -1; diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index 37f3116ea6bd..a4bc812aa999 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c @@ -642,7 +642,7 @@ static void sh_eth_adjust_link(struct net_device *ndev) | ECMR_DM, ioaddr + ECMR); new_state = 1; mdp->link = phydev->link; - netif_schedule(ndev); + netif_tx_schedule_all(ndev); netif_carrier_on(ndev); netif_start_queue(ndev); } diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c index b07b8cbadeaf..41d3ac45685f 100644 --- a/drivers/net/tc35815.c +++ b/drivers/net/tc35815.c @@ -672,7 +672,7 @@ static void tc_handle_link_change(struct net_device *dev) if (dev->flags & IFF_PROMISC) tc35815_set_multicast_list(dev); #endif - netif_schedule(dev); + netif_tx_schedule_all(dev); } else { lp->speed = 0; lp->duplex = -1; diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index 07933f71b86d..c1b55bc7eab7 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c @@ -1588,7 +1588,7 @@ static void adjust_link(struct net_device *dev) if (!ugeth->oldlink) { new_state = 1; ugeth->oldlink = 1; - netif_schedule(dev); + netif_tx_schedule_all(dev); } } else if (ugeth->oldlink) { new_state = 1; @@ -3372,7 +3372,7 @@ static void ucc_geth_timeout(struct net_device *dev) ucc_geth_startup(ugeth); } - netif_schedule(dev); + netif_tx_schedule_all(dev); } /* This is called by the kernel when a frame is ready for transmission. */ -- cgit v1.2.3 From afc079465e991ffb7fe197d1ad80eb8140e2c341 Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Mon, 21 Jul 2008 08:29:54 -0700 Subject: gianfar: do not touch net queue in adjust_link phylib callback If the net queue has not been started, we'll get this nice oops and non-working ethernet: PHY: 0:01 - Link is Up - 1000/Full ------------[ cut here ]------------ kernel BUG at net/core/dev.c:1328! Oops: Exception in kernel mode, sig: 5 [#1] MPC837x RDB Modules linked in: NIP: c02544a0 LR: c01a17d0 CTR: c01a16ac REGS: cf837e40 TRAP: 0700 Not tainted (2.6.26-05253-g14b395e) MSR: 00021032 CR: 22042044 XER: 00000000 TASK = cf819400[5] 'events/0' THREAD: cf836000 GPR00: c01a17d0 cf837ef0 cf819400 c03d8d08 cf8469a0 00000064 00000000 00000000 GPR08: c03d8d08 00000001 00000001 cf899ba0 22044044 00000000 0fffd000 00000000 GPR16: 0fff3028 0fff6cf0 00000000 0fff8390 0ff494a0 00000004 00000000 00000000 GPR24: c0361a00 00001058 cf9f6600 00009032 cf846800 cf846b80 00000001 00000014 NIP [c02544a0] __netif_schedule+0x28/0x8c LR [c01a17d0] adjust_link+0x124/0x1cc Call Trace: [cf837ef0] [c03fb3a0] 0xc03fb3a0 (unreliable) [cf837f10] [c01a17d0] adjust_link+0x124/0x1cc [cf837f40] [c01a8e28] phy_state_machine+0x2e0/0x448 [cf837f60] [c0040254] run_workqueue+0xc8/0x168 [cf837f90] [c00408d8] worker_thread+0x70/0xd0 [cf837fd0] [c0044630] kthread+0x48/0x84 [cf837ff0] [c0012610] kernel_thread+0x44/0x60 Instruction dump: 7c0803a6 4e800020 3d20c03e 9421ffe0 7c0802a6 7c681b78 39298d08 7c694a78 7d290034 90010024 bfa10014 5529d97e <0f090000> 39600002 38030024 7d200028 ---[ end trace 13dfd73ee42d0c30 ]--- Since the driver is using phylib (which is doing netif_carrier_on/off()), we should simply remove netif_tx_schedule_all() from adjust_link(). Signed-off-by: Anton Vorontsov Signed-off-by: David S. Miller --- drivers/net/gianfar.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/net/gianfar.c') diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 45a63172852f..39b45e901be6 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c @@ -1725,7 +1725,6 @@ static void adjust_link(struct net_device *dev) if (!priv->oldlink) { new_state = 1; priv->oldlink = 1; - netif_tx_schedule_all(dev); } } else if (priv->oldlink) { new_state = 1; -- cgit v1.2.3