aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2009-12-14 11:05:09 -0500
committerDavid S. Miller <davem@davemloft.net>2010-01-04 00:18:40 -0500
commit35bb5cadc8c7b1462df57e32e08d964f1be7a75c (patch)
treebc8c8182bfba02caaf3f571e22dfc5581f2d0aa8
parentb3319b10523d8dac82b134a05de2a403119abebd (diff)
via-velocity: Give RX descriptors to the NIC later on open or MTU change
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> Tested-by: Jan Ceuleers <jan.ceuleers@computer.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/via-velocity.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 4ceb441f2687..c93f58f5c6f2 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)
2237 /* Ensure chip is running */ 2237 /* Ensure chip is running */
2238 pci_set_power_state(vptr->pdev, PCI_D0); 2238 pci_set_power_state(vptr->pdev, PCI_D0);
2239 2239
2240 velocity_give_many_rx_descs(vptr);
2241
2242 velocity_init_registers(vptr, VELOCITY_INIT_COLD); 2240 velocity_init_registers(vptr, VELOCITY_INIT_COLD);
2243 2241
2244 ret = request_irq(vptr->pdev->irq, velocity_intr, IRQF_SHARED, 2242 ret = request_irq(vptr->pdev->irq, velocity_intr, IRQF_SHARED,
@@ -2250,6 +2248,8 @@ static int velocity_open(struct net_device *dev)
2250 goto out; 2248 goto out;
2251 } 2249 }
2252 2250
2251 velocity_give_many_rx_descs(vptr);
2252
2253 mac_enable_int(vptr->mac_regs); 2253 mac_enable_int(vptr->mac_regs);
2254 netif_start_queue(dev); 2254 netif_start_queue(dev);
2255 napi_enable(&vptr->napi); 2255 napi_enable(&vptr->napi);
@@ -2339,10 +2339,10 @@ static int velocity_change_mtu(struct net_device *dev, int new_mtu)
2339 2339
2340 dev->mtu = new_mtu; 2340 dev->mtu = new_mtu;
2341 2341
2342 velocity_give_many_rx_descs(vptr);
2343
2344 velocity_init_registers(vptr, VELOCITY_INIT_COLD); 2342 velocity_init_registers(vptr, VELOCITY_INIT_COLD);
2345 2343
2344 velocity_give_many_rx_descs(vptr);
2345
2346 mac_enable_int(vptr->mac_regs); 2346 mac_enable_int(vptr->mac_regs);
2347 netif_start_queue(dev); 2347 netif_start_queue(dev);
2348 2348