* [PATCH net-2.6.24] e100: fix driver init lockup on e100_up()
@ 2007-08-27 17:06 James Chapman
2007-08-27 17:09 ` [E1000-devel] " Kok, Auke
0 siblings, 1 reply; 4+ messages in thread
From: James Chapman @ 2007-08-27 17:06 UTC (permalink / raw)
To: netdev; +Cc: e1000-devel
Recent NAPI changes require that napi_enable() is always matched with
a napi_disable(). This patch makes sure that this invariant holds for
e100. It also moves the netif_napi_add() call until after private
pointers have been intialized, though this might only be significant
for cases where netpoll is being used.
Signed-off-by: James Chapman <jchapman@katalix.com>
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index e25f5ec..48996a4 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -2575,11 +2575,12 @@ static int __devinit e100_probe(struct pci_dev *pdev,
strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1);
nic = netdev_priv(netdev);
- netif_napi_add(netdev, &nic->napi, e100_poll, E100_NAPI_WEIGHT);
nic->netdev = netdev;
nic->pdev = pdev;
nic->msg_enable = (1 << debug) - 1;
pci_set_drvdata(pdev, netdev);
+ netif_napi_add(netdev, &nic->napi, e100_poll, E100_NAPI_WEIGHT);
+ napi_disable(&nic->napi);
if((err = pci_enable_device(pdev))) {
DPRINTK(PROBE, ERR, "Cannot enable PCI device, aborting.\n");
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [E1000-devel] [PATCH net-2.6.24] e100: fix driver init lockup on e100_up()
2007-08-27 17:06 [PATCH net-2.6.24] e100: fix driver init lockup on e100_up() James Chapman
@ 2007-08-27 17:09 ` Kok, Auke
2007-08-27 21:03 ` James Chapman
0 siblings, 1 reply; 4+ messages in thread
From: Kok, Auke @ 2007-08-27 17:09 UTC (permalink / raw)
To: James Chapman; +Cc: netdev, e1000-devel
James Chapman wrote:
> Recent NAPI changes require that napi_enable() is always matched with
> a napi_disable(). This patch makes sure that this invariant holds for
> e100. It also moves the netif_napi_add() call until after private
> pointers have been intialized, though this might only be significant
> for cases where netpoll is being used.
>
> Signed-off-by: James Chapman <jchapman@katalix.com>
>
> diff --git a/drivers/net/e100.c b/drivers/net/e100.c
> index e25f5ec..48996a4 100644
> --- a/drivers/net/e100.c
> +++ b/drivers/net/e100.c
> @@ -2575,11 +2575,12 @@ static int __devinit e100_probe(struct pci_dev *pdev,
> strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1);
>
> nic = netdev_priv(netdev);
> - netif_napi_add(netdev, &nic->napi, e100_poll, E100_NAPI_WEIGHT);
> nic->netdev = netdev;
> nic->pdev = pdev;
> nic->msg_enable = (1 << debug) - 1;
> pci_set_drvdata(pdev, netdev);
> + netif_napi_add(netdev, &nic->napi, e100_poll, E100_NAPI_WEIGHT);
> + napi_disable(&nic->napi);
Just wondering, could we even reverse this order? IOW disable NAPI first, then
add it ?
Otherwise this sounds OK to me.
Auke
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [E1000-devel] [PATCH net-2.6.24] e100: fix driver init lockup on e100_up()
2007-08-27 17:09 ` [E1000-devel] " Kok, Auke
@ 2007-08-27 21:03 ` James Chapman
2007-08-27 21:18 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: James Chapman @ 2007-08-27 21:03 UTC (permalink / raw)
To: Kok, Auke, David S. Miller; +Cc: netdev, e1000-devel
Kok, Auke wrote:
> James Chapman wrote:
>> Recent NAPI changes require that napi_enable() is always matched with
>> a napi_disable(). This patch makes sure that this invariant holds for
>> e100. It also moves the netif_napi_add() call until after private
>> pointers have been intialized, though this might only be significant
>> for cases where netpoll is being used.
>>
>> Signed-off-by: James Chapman <jchapman@katalix.com>
>>
>> diff --git a/drivers/net/e100.c b/drivers/net/e100.c
>> index e25f5ec..48996a4 100644
>> --- a/drivers/net/e100.c
>> +++ b/drivers/net/e100.c
>> @@ -2575,11 +2575,12 @@ static int __devinit e100_probe(struct pci_dev
>> *pdev,
>> strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1);
>>
>> nic = netdev_priv(netdev);
>> - netif_napi_add(netdev, &nic->napi, e100_poll, E100_NAPI_WEIGHT);
>> nic->netdev = netdev;
>> nic->pdev = pdev;
>> nic->msg_enable = (1 << debug) - 1;
>> pci_set_drvdata(pdev, netdev);
>> + netif_napi_add(netdev, &nic->napi, e100_poll, E100_NAPI_WEIGHT);
>> + napi_disable(&nic->napi);
>
> Just wondering, could we even reverse this order? IOW disable NAPI
> first, then add it ?
I think the order shouldn't matter. DaveM?
> Otherwise this sounds OK to me.
--
James Chapman
Katalix Systems Ltd
http://www.katalix.com
Catalysts for your Embedded Linux software development
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [E1000-devel] [PATCH net-2.6.24] e100: fix driver init lockup on e100_up()
2007-08-27 21:03 ` James Chapman
@ 2007-08-27 21:18 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2007-08-27 21:18 UTC (permalink / raw)
To: jchapman; +Cc: auke-jan.h.kok, netdev, e1000-devel
From: James Chapman <jchapman@katalix.com>
Date: Mon, 27 Aug 2007 22:03:15 +0100
> Kok, Auke wrote:
> > James Chapman wrote:
> >> nic = netdev_priv(netdev);
> >> - netif_napi_add(netdev, &nic->napi, e100_poll, E100_NAPI_WEIGHT);
> >> nic->netdev = netdev;
> >> nic->pdev = pdev;
> >> nic->msg_enable = (1 << debug) - 1;
> >> pci_set_drvdata(pdev, netdev);
> >> + netif_napi_add(netdev, &nic->napi, e100_poll, E100_NAPI_WEIGHT);
> >> + napi_disable(&nic->napi);
> >
> > Just wondering, could we even reverse this order? IOW disable NAPI
> > first, then add it ?
>
> I think the order shouldn't matter. DaveM?
It doesn't matter.
I'm beginning to think maybe we should do an implicit napi_disable()
in netif_napi_add(), then it's easier for drivers to play nice.
On open you do napi_enable(), in close you do napi_disable().
That's it.
And anywhere else in your driver that you have to napi_disable()
(suspend, recovering from hardware errors, etc.) you must be sure to
do the associated napi_enable() later on in order to keep things
balanced.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-08-27 21:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-27 17:06 [PATCH net-2.6.24] e100: fix driver init lockup on e100_up() James Chapman
2007-08-27 17:09 ` [E1000-devel] " Kok, Auke
2007-08-27 21:03 ` James Chapman
2007-08-27 21:18 ` David Miller
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).