net driver fixes
Subsystems (2)
PATCH 1/1 net driver fixes
Please pull from 'upstream-linus' branch of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git upstream-linus
to receive the following updates:
drivers/net/3c59x.c | 2 +- drivers/net/forcedeth.c | 27 ++++++++++------- drivers/net/fs_enet/fs_enet-main.c | 28 ++++++++++------- drivers/net/fs_enet/fs_enet.h | 1 + drivers/net/gianfar.c | 4 ++- drivers/net/gianfar.h | 1 - drivers/net/ibm_newemac/mal.c | 2 +- drivers/net/pcnet32.c | 58 ++++++++++++++++++++---------------- drivers/net/sky2.c | 46 ++++++++++++---------------- include/linux/netdevice.h | 18 +++++++++++ 10 files changed, 108 insertions(+), 79 deletions(-)
Anton Vorontsov (1):
gianfar: fix obviously wrong #ifdef CONFIG_GFAR_NAPI placement
Badari Pulavarty (1):
vortex_up should initialize "err"
Benjamin Herrenschmidt (1):
fix EMAC driver for proper napi_synchronize API
Don Fry (3):
pcnet32: fix non-napi packet reception
pcnet32: remove compile warnings in non-napi mode
pcnet32: remove private net_device_stats structure
Ingo Molnar (1):
forcedeth: fix rx-work condition in nv_rx_process_optimized() too
Manfred Spraul (1):
forcedeth msi bugfix
Scott Wood (1):
fs_enet: Update for API changes
Sebastian Siewior (1):
gianfar: remove orphan struct.
Stephen Hemminger (2):
napi_synchronize: waiting for NAPI
sky2: shutdown cleanup
drivers/net/3c59x.c +1 -1
@@ -1491,7 +1491,7 @@ vortex_up(struct net_device *dev)struct vortex_private *vp =netdev_priv (dev);void __iomem *ioaddr = vp->ioaddr;unsigned int config; -int i, mii_reg1, mii_reg5, err; +int i, mii_reg1, mii_reg5, err =0 ;if (VORTEX_PCI (vp)) {pci_set_power_state (VORTEX_PCI (vp),PCI_D0 );/* Go active */
drivers/net/forcedeth.c +16 -11
@@ -992,7 +992,7 @@ static void nv_enable_irq(struct net_device *dev)if (np->msi_flags &NV_MSI_X_ENABLED )enable_irq (np->msi_x_entry[NV_MSI_X_VECTOR_ALL ].vector);else -enable_irq (dev->irq); +enable_irq (np->pci_dev->irq); }else {enable_irq (np->msi_x_entry[NV_MSI_X_VECTOR_RX ].vector);enable_irq (np->msi_x_entry[NV_MSI_X_VECTOR_TX ].vector);
@@ -1008,7 +1008,7 @@ static void nv_disable_irq(struct net_device *dev)if (np->msi_flags &NV_MSI_X_ENABLED )disable_irq (np->msi_x_entry[NV_MSI_X_VECTOR_ALL ].vector);else -disable_irq (dev->irq); +disable_irq (np->pci_dev->irq); }else {disable_irq (np->msi_x_entry[NV_MSI_X_VECTOR_RX ].vector);disable_irq (np->msi_x_entry[NV_MSI_X_VECTOR_TX ].vector);
@@ -1607,7 +1607,7 @@ static void nv_do_rx_refill(unsigned long data)if (np->msi_flags &NV_MSI_X_ENABLED )disable_irq (np->msi_x_entry[NV_MSI_X_VECTOR_ALL ].vector);else -disable_irq (dev->irq); +disable_irq (np->pci_dev->irq); }else {disable_irq (np->msi_x_entry[NV_MSI_X_VECTOR_RX ].vector); }
@@ -1625,7 +1625,7 @@ static void nv_do_rx_refill(unsigned long data)if (np->msi_flags &NV_MSI_X_ENABLED )enable_irq (np->msi_x_entry[NV_MSI_X_VECTOR_ALL ].vector);else -enable_irq (dev->irq); +enable_irq (np->pci_dev->irq); }else {enable_irq (np->msi_x_entry[NV_MSI_X_VECTOR_RX ].vector); }
@@ -2408,13 +2408,13 @@ static int nv_rx_process_optimized(struct net_device *dev, int limit)struct fe_priv *np =netdev_priv (dev);u32 flags;u32 vlanflags =0 ; -u32 rx_processed_cnt =0 ; +int rx_work =0 ;struct sk_buff *skb;int len;while ((np->get_rx.ex != np->put_rx.ex) && !((flags =le32_to_cpu (np->get_rx.ex->flaglen)) &NV_RX2_AVAIL ) && - (rx_processed_cnt++ < limit)) { + (rx_work < limit)) {dprintk (KERN_DEBUG "%s: nv_rx_process_optimized: flags 0x%x.\n" , dev->name, flags);
@@ -2517,9 +2517,11 @@ next_pkt: np->get_rx.ex = np->first_rx.ex;if (unlikely (np->get_rx_ctx++ == np->last_rx_ctx)) np->get_rx_ctx = np->first_rx_ctx; + + rx_work++; } -return rx_processed_cnt; +return rx_work; }static void set_bufsize (struct net_device *dev)
@@ -3558,10 +3560,12 @@ static int nv_request_irq(struct net_device *dev, int intr_test)if (ret !=0 && np->msi_flags &NV_MSI_CAPABLE ) {if ((ret =pci_enable_msi (np->pci_dev)) ==0 ) { np->msi_flags |=NV_MSI_ENABLED ; + dev->irq = np->pci_dev->irq;if (request_irq (np->pci_dev->irq, handler,IRQF_SHARED , dev->name, dev) !=0 ) {printk (KERN_INFO "forcedeth: request_irq failed %d\n" , ret);pci_disable_msi (np->pci_dev); np->msi_flags &= ~NV_MSI_ENABLED ; + dev->irq = np->pci_dev->irq; goto out_err; }
@@ -3624,7 +3628,7 @@ static void nv_do_nic_poll(unsigned long data)if (np->msi_flags &NV_MSI_X_ENABLED )disable_irq_lockdep (np->msi_x_entry[NV_MSI_X_VECTOR_ALL ].vector);else -disable_irq_lockdep (dev->irq); +disable_irq_lockdep (np->pci_dev->irq); mask = np->irqmask; }else {if (np->nic_poll_irq &NVREG_IRQ_RX_ALL ) {
@@ -3642,6 +3646,8 @@ static void nv_do_nic_poll(unsigned long data) } np->nic_poll_irq =0 ; +/* disable_irq() contains synchronize_irq, thus no irq handler can run now */ +if (np->recover_error) { np->recover_error =0 ;printk (KERN_INFO "forcedeth: MAC in recoverable error state\n" );
@@ -3678,7 +3684,6 @@ static void nv_do_nic_poll(unsigned long data) } } -/* FIXME: Do we need synchronize_irq(dev->irq) here? */ writel (mask, base + NvRegIrqMask);pci_push (base);
@@ -3691,7 +3696,7 @@ static void nv_do_nic_poll(unsigned long data)if (np->msi_flags &NV_MSI_X_ENABLED )enable_irq_lockdep (np->msi_x_entry[NV_MSI_X_VECTOR_ALL ].vector);else -enable_irq_lockdep (dev->irq); +enable_irq_lockdep (np->pci_dev->irq); }else {if (np->nic_poll_irq &NVREG_IRQ_RX_ALL ) {nv_nic_irq_rx (0 , dev);
@@ -4948,7 +4953,7 @@ static int nv_close(struct net_device *dev)#ifdef CONFIG_FORCEDETH_NAPI napi_disable (&np->napi);#endif -synchronize_irq (dev->irq); +synchronize_irq (np->pci_dev->irq);del_timer_sync (&np->oom_kick);del_timer_sync (&np->nic_poll);
drivers/net/fs_enet/fs_enet-main.c +16 -12
@@ -88,7 +88,7 @@ static void skb_align(struct sk_buff *skb, int align)static int fs_enet_rx_napi (struct napi_struct *napi,int budget) { struct fs_enet_private *fep = container_of(napi, struct fs_enet_private, napi); -struct net_device *dev =to_net_dev (fep->dev); +struct net_device *dev = fep->ndev;const struct fs_platform_info *fpi = fep->fpi;cbd_t __iomem *bdp;struct sk_buff *skb, *skbn, *skbt;
@@ -217,7 +217,7 @@ static int fs_enet_rx_napi(struct napi_struct *napi, int budget) fep->cur_rx = bdp; -if (received >= budget) { +if (received < budget) {/* done */ netif_rx_complete (dev, napi); (*fep->ops->napi_enable_rx)(dev);
@@ -807,20 +807,23 @@ static int fs_enet_open(struct net_device *dev)int r;int err; -napi_enable (&fep->napi); +if (fep->fpi->use_napi) +napi_enable (&fep->napi);/* Install our interrupt handler. */ r =fs_request_irq (dev, fep->interrupt,"fs_enet-mac" , fs_enet_interrupt);if (r !=0 ) { printk(KERN_ERR DRV_MODULE_NAME ": %s Could not allocate FS_ENET IRQ!", dev->name); -napi_disable (&fep->napi); +if (fep->fpi->use_napi) +napi_disable (&fep->napi);return -EINVAL ; } err =fs_init_phy (dev); -if (err) { -napi_disable (&fep->napi); +if (err) { +if (fep->fpi->use_napi) +napi_disable (&fep->napi);return err; }phy_start (fep->phydev);
@@ -1232,7 +1235,7 @@ static int __devinit fs_enet_probe(struct of_device *ofdev, fpi->rx_ring =32 ; fpi->tx_ring =32 ; fpi->rx_copybreak =240 ; - fpi->use_napi =0 ; + fpi->use_napi =1 ; fpi->napi_weight =17 ; ret =find_phy (ofdev->node, fpi);
@@ -1249,11 +1252,11 @@ static int __devinit fs_enet_probe(struct of_device *ofdev, goto out_free_fpi; } -SET_MODULE_OWNER (ndev);dev_set_drvdata (&ofdev->dev, ndev); fep =netdev_priv (ndev); fep->dev = &ofdev->dev; + fep->ndev = ndev; fep->fpi = fpi; fep->ops = match->data;
@@ -1288,10 +1291,11 @@ static int __devinit fs_enet_probe(struct of_device *ofdev, ndev->stop = fs_enet_close; ndev->get_stats = fs_enet_get_stats; ndev->set_multicast_list = fs_set_multicast_list; -if (fpi->use_napi) { - ndev->poll = fs_enet_rx_napi; - ndev->weight = fpi->napi_weight; - } + +if (fpi->use_napi) +netif_napi_add (ndev, &fep->napi, fs_enet_rx_napi, + fpi->napi_weight); + ndev->ethtool_ops = &fs_ethtool_ops; ndev->do_ioctl = fs_ioctl;
drivers/net/fs_enet/fs_enet.h +1 -0
@@ -75,6 +75,7 @@ struct phy_info {struct fs_enet_private {struct napi_struct napi;struct device *dev;/* pointer back to the device (must be initialized first) */ +struct net_device *ndev;spinlock_t lock;/* during all ops except TX pckt processing */ spinlock_t tx_lock;/* during fs_start_xmit and fs_tx */ struct fs_platform_info *fpi;
drivers/net/gianfar.c +3 -1
@@ -956,10 +956,12 @@ static int gfar_enet_open(struct net_device *dev) } err =startup_gfar (dev); - if (err) +if (err) {#ifdef CONFIG_GFAR_NAPI napi_disable (&priv->napi);#endif +return err; + }netif_start_queue (dev);
drivers/net/gianfar.h +0 -1
@@ -749,7 +749,6 @@ struct gfar_private {uint32_t msg_enable;/* Network Statistics */ -struct net_device_stats stats;struct gfar_extra_stats extra_stats; };
drivers/net/ibm_newemac/mal.c +1 -1
@@ -322,7 +322,7 @@ void mal_poll_disable(struct mal_instance *mal, struct mal_commac *commac)msleep (1 );/* Synchronize with the MAL NAPI poller */ -__napi_synchronize (&mal->napi); +napi_synchronize (&mal->napi); }void mal_poll_enable (struct mal_instance *mal,struct mal_commac *commac)
drivers/net/pcnet32.c +32 -26
189 lines not on this page · raw message
drivers/net/sky2.c +20 -26
146 lines not on this page · raw message
include/linux/netdevice.h +18 -0
@@ -407,6 +407,24 @@ static inline void napi_enable(struct napi_struct *n)clear_bit (NAPI_STATE_SCHED , &n->state); } +#ifdef CONFIG_SMP +/** +* napi_synchronize - wait until NAPI is not running +* @n: napi context +* +* Wait until NAPI is done being scheduled on this context. +* Waits till any outstanding processing completes but +* does not disable future activations. +*/ +static inline void napi_synchronize (const struct napi_struct *n) +{ +while (test_bit (NAPI_STATE_SCHED , &n->state)) +msleep (1 ); +} +#else +# define napi_synchronize (n) barrier() +#endif +/* * The DEVICE structure. * Actually, this whole structure is a big mistake. It mixes I/O