All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] via-velocity: Give RX descriptors to the NIC later on open or MTU change
@ 2009-12-15  2:05 Ben Hutchings
  2009-12-26  2:21 ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Ben Hutchings @ 2009-12-15  2:05 UTC (permalink / raw
  To: Francois Romieu; +Cc: netdev, 508527

velocity_open() calls velocity_give_many_rx_descs(), which gives RX
descriptors to the NIC, before installing an interrupt handler or
calling velocity_init_registers().  I think this is very unsafe and it
appears to explain the bug report <http://bugs.debian.org/508527>.

On MTU change, velocity_give_many_rx_descs() is again called before
velocity_init_registers().  I'm not sure whether this is unsafe but
it does look wrong.

Therefore, move the calls to velocity_give_many_rx_descs() after
request_irq() and velocity_init_registers().

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
This is untested; I don't have this hardware.

Ben.

 drivers/net/via-velocity.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 4ceb441..c93f58f 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -2237,8 +2237,6 @@ static int velocity_open(struct net_device *dev)
 	/* Ensure chip is running */
 	pci_set_power_state(vptr->pdev, PCI_D0);
 
-	velocity_give_many_rx_descs(vptr);
-
 	velocity_init_registers(vptr, VELOCITY_INIT_COLD);
 
 	ret = request_irq(vptr->pdev->irq, velocity_intr, IRQF_SHARED,
@@ -2250,6 +2248,8 @@ static int velocity_open(struct net_device *dev)
 		goto out;
 	}
 
+	velocity_give_many_rx_descs(vptr);
+
 	mac_enable_int(vptr->mac_regs);
 	netif_start_queue(dev);
 	napi_enable(&vptr->napi);
@@ -2339,10 +2339,10 @@ static int velocity_change_mtu(struct net_device *dev, int new_mtu)
 
 		dev->mtu = new_mtu;
 
-		velocity_give_many_rx_descs(vptr);
-
 		velocity_init_registers(vptr, VELOCITY_INIT_COLD);
 
+		velocity_give_many_rx_descs(vptr);
+
 		mac_enable_int(vptr->mac_regs);
 		netif_start_queue(dev);
 
-- 
1.6.5.4



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

* Re: [PATCH] via-velocity: Give RX descriptors to the NIC later on open or MTU change
  2009-12-15  2:05 [PATCH] via-velocity: Give RX descriptors to the NIC later on open or MTU change Ben Hutchings
@ 2009-12-26  2:21 ` David Miller
  2009-12-28  9:27   ` Jan Ceuleers
  0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2009-12-26  2:21 UTC (permalink / raw
  To: ben; +Cc: romieu, netdev, 508527

From: Ben Hutchings <ben@decadent.org.uk>
Date: Tue, 15 Dec 2009 02:05:09 +0000

> velocity_open() calls velocity_give_many_rx_descs(), which gives RX
> descriptors to the NIC, before installing an interrupt handler or
> calling velocity_init_registers().  I think this is very unsafe and it
> appears to explain the bug report <http://bugs.debian.org/508527>.
> 
> On MTU change, velocity_give_many_rx_descs() is again called before
> velocity_init_registers().  I'm not sure whether this is unsafe but
> it does look wrong.
> 
> Therefore, move the calls to velocity_give_many_rx_descs() after
> request_irq() and velocity_init_registers().
> 
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> ---
> This is untested; I don't have this hardware.

Although this patch looks fine to me, I don't want to apply
it until someone tests it.

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

* Re: [PATCH] via-velocity: Give RX descriptors to the NIC later on open or MTU change
  2009-12-26  2:21 ` David Miller
@ 2009-12-28  9:27   ` Jan Ceuleers
  2009-12-28  9:36     ` Jan Ceuleers
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Ceuleers @ 2009-12-28  9:27 UTC (permalink / raw
  To: David Miller; +Cc: ben, romieu, netdev, 508527

David Miller wrote:
>> velocity_open() calls velocity_give_many_rx_descs(), which gives RX
>> descriptors to the NIC, before installing an interrupt handler or
>> calling velocity_init_registers().  I think this is very unsafe and it
>> appears to explain the bug report <http://bugs.debian.org/508527>.
>>
>> On MTU change, velocity_give_many_rx_descs() is again called before
>> velocity_init_registers().  I'm not sure whether this is unsafe but
>> it does look wrong.
>>
>> Therefore, move the calls to velocity_give_many_rx_descs() after
>> request_irq() and velocity_init_registers().
>>
>> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
>> ---
>> This is untested; I don't have this hardware.
> 
> Although this patch looks fine to me, I don't want to apply
> it until someone tests it.

I have successfully booted a 2.6.32.2 kernel with this patch applied on top on a PXE-booting machine with nfsroot. If you consider that to be a sufficient test then please feel free to add my

Tested-by: Jan Ceuleers <jan.ceuleers@computer.org>

Otherwise, please let me know which other tests you would like me to carry out.

Note though that I am unable to reproduce the original bug on my system.

Cheers, Jan

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

* Re: [PATCH] via-velocity: Give RX descriptors to the NIC later on open or MTU change
  2009-12-28  9:27   ` Jan Ceuleers
@ 2009-12-28  9:36     ` Jan Ceuleers
  2010-01-04  5:19       ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Ceuleers @ 2009-12-28  9:36 UTC (permalink / raw
  To: David Miller; +Cc: ben, romieu, netdev, 508527

Jan Ceuleers wrote:
> I have successfully booted a 2.6.32.2 kernel with this patch applied on top on a PXE-booting machine with nfsroot.

Obviously this was on a machine with a Via Velocity NIC.

Jan

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

* Re: [PATCH] via-velocity: Give RX descriptors to the NIC later on open or MTU change
  2009-12-28  9:36     ` Jan Ceuleers
@ 2010-01-04  5:19       ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2010-01-04  5:19 UTC (permalink / raw
  To: jan.ceuleers; +Cc: ben, romieu, netdev, 508527

From: Jan Ceuleers <jan.ceuleers@computer.org>
Date: Mon, 28 Dec 2009 10:36:03 +0100

> Jan Ceuleers wrote:
>> I have successfully booted a 2.6.32.2 kernel with this patch applied on top on a PXE-booting machine with nfsroot.
> 
> Obviously this was on a machine with a Via Velocity NIC.

Fair enough, applied to net-2.6, thanks.

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

end of thread, other threads:[~2010-01-04  5:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-15  2:05 [PATCH] via-velocity: Give RX descriptors to the NIC later on open or MTU change Ben Hutchings
2009-12-26  2:21 ` David Miller
2009-12-28  9:27   ` Jan Ceuleers
2009-12-28  9:36     ` Jan Ceuleers
2010-01-04  5:19       ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.