netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][VIA-RHINE]: Fix CONFIG_VIA_RHINE_NAPI usage
@ 2007-08-22 21:46 Arnaldo Carvalho de Melo
  2007-08-22 21:58 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2007-08-22 21:46 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

Hi David,

	napi is broken here, with this patch at least I can isolate this
breakage and boot the machine with a non-napi via-rhine driver.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index 8f4cf82..4cecd06 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -390,7 +390,9 @@ struct rhine_private {
 	struct pci_dev *pdev;
 	long pioaddr;
 	struct net_device *dev;
+#ifdef CONFIG_VIA_RHINE_NAPI
 	struct napi_struct napi;
+#endif
 	struct net_device_stats stats;
 	spinlock_t lock;
 
@@ -1059,9 +1061,9 @@ static void init_registers(struct net_device *dev)
 	iowrite32(rp->tx_ring_dma, ioaddr + TxRingPtr);
 
 	rhine_set_rx_mode(dev);
-
+#ifdef CONFIG_VIA_RHINE_NAPI
 	napi_enable(&rp->napi);
-
+#endif
 	/* Enable interrupts by setting the interrupt mask. */
 	iowrite16(IntrRxDone | IntrRxErr | IntrRxEmpty| IntrRxOverflow |
 	       IntrRxDropped | IntrRxNoBuf | IntrTxAborted |
@@ -1836,8 +1838,9 @@ static int rhine_close(struct net_device *dev)
 	spin_lock_irq(&rp->lock);
 
 	netif_stop_queue(dev);
+#ifdef CONFIG_VIA_RHINE_NAPI
 	napi_disable(&rp->napi);
-
+#endif
 	if (debug > 1)
 		printk(KERN_DEBUG "%s: Shutting down ethercard, "
 		       "status was %4.4x.\n",

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH][VIA-RHINE]: Fix CONFIG_VIA_RHINE_NAPI usage
  2007-08-22 21:46 [PATCH][VIA-RHINE]: Fix CONFIG_VIA_RHINE_NAPI usage Arnaldo Carvalho de Melo
@ 2007-08-22 21:58 ` David Miller
  2007-08-22 22:19   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2007-08-22 21:58 UTC (permalink / raw)
  To: acme; +Cc: netdev

From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Date: Wed, 22 Aug 2007 18:46:59 -0300

> Hi David,
> 
> 	napi is broken here, with this patch at least I can isolate this
> breakage and boot the machine with a non-napi via-rhine driver.
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Thanks for finding this problem.

The core issue seems to be that via-rhine.c tries to perform
a napi_enable() when there has not been a previous napi_disable().

So lets make sure that all paths that lead to an init_registers()
call makes a preceeding napi_disable().

Please give this patch a try:

diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index 8f4cf82..0e6aefe 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -1167,6 +1167,7 @@ static int rhine_open(struct net_device *dev)
 		free_irq(rp->pdev->irq, dev);
 		return rc;
 	}
+	napi_disable(&rp->napi);
 	alloc_rbufs(dev);
 	alloc_tbufs(dev);
 	rhine_chip_reset(dev);
@@ -1195,6 +1196,8 @@ static void rhine_tx_timeout(struct net_device *dev)
 	/* protect against concurrent rx interrupts */
 	disable_irq(rp->pdev->irq);
 
+	napi_disable(&rp->napi);
+
 	spin_lock(&rp->lock);
 
 	/* clear all descriptors */
@@ -1935,6 +1938,7 @@ static int rhine_suspend(struct pci_dev *pdev, pm_message_t state)
 	if (!netif_running(dev))
 		return 0;
 
+	napi_disable(&rp->napi);
 	netif_device_detach(dev);
 	pci_save_state(pdev);
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH][VIA-RHINE]: Fix CONFIG_VIA_RHINE_NAPI usage
  2007-08-22 21:58 ` David Miller
@ 2007-08-22 22:19   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2007-08-22 22:19 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

Em Wed, Aug 22, 2007 at 02:58:55PM -0700, David Miller escreveu:
> From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
> Date: Wed, 22 Aug 2007 18:46:59 -0300
> 
> > Hi David,
> > 
> > 	napi is broken here, with this patch at least I can isolate this
> > breakage and boot the machine with a non-napi via-rhine driver.
> > 
> 
> Thanks for finding this problem.
> 
> The core issue seems to be that via-rhine.c tries to perform
> a napi_enable() when there has not been a previous napi_disable().
> 
> So lets make sure that all paths that lead to an init_registers()
> call makes a preceeding napi_disable().
> 
> Please give this patch a try:

Tried with and without CONFIG_VIA_RHINE_NAPI, did stress testing with
netperf only with NAPI enabled. Works great


Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
 
> diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
> index 8f4cf82..0e6aefe 100644
> --- a/drivers/net/via-rhine.c
> +++ b/drivers/net/via-rhine.c
> @@ -1167,6 +1167,7 @@ static int rhine_open(struct net_device *dev)
>  		free_irq(rp->pdev->irq, dev);
>  		return rc;
>  	}
> +	napi_disable(&rp->napi);
>  	alloc_rbufs(dev);
>  	alloc_tbufs(dev);
>  	rhine_chip_reset(dev);
> @@ -1195,6 +1196,8 @@ static void rhine_tx_timeout(struct net_device *dev)
>  	/* protect against concurrent rx interrupts */
>  	disable_irq(rp->pdev->irq);
>  
> +	napi_disable(&rp->napi);
> +
>  	spin_lock(&rp->lock);
>  
>  	/* clear all descriptors */
> @@ -1935,6 +1938,7 @@ static int rhine_suspend(struct pci_dev *pdev, pm_message_t state)
>  	if (!netif_running(dev))
>  		return 0;
>  
> +	napi_disable(&rp->napi);
>  	netif_device_detach(dev);
>  	pci_save_state(pdev);
>  
> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-08-22 22:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-22 21:46 [PATCH][VIA-RHINE]: Fix CONFIG_VIA_RHINE_NAPI usage Arnaldo Carvalho de Melo
2007-08-22 21:58 ` David Miller
2007-08-22 22:19   ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).