diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-11-10 04:31:55 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-11-10 04:31:55 -0500 |
commit | 760559e1330a58cc5b320154a20e64b8444143c0 (patch) | |
tree | 46bf5b8d3b78f2ff57fd728026e597844b149efb /drivers/net/8139too.c | |
parent | 2f67bdb23d74a6c6fd4f98f64239c5c34d1833cc (diff) |
[netdrvr 8139too] fast poll for thread, if an unlikely race occurs
The rtl8139 thread is triggered only on rare 8139 hardware, the race
itself is unlikely, and the impact of racing is low. We don't care
enough to create a more-complex race-free solution.
Rather, if the trylock fails, we now simply poll twice a second until
we do get the lock.
Diffstat (limited to 'drivers/net/8139too.c')
-rw-r--r-- | drivers/net/8139too.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c index 120baaa90754..d2102a27d307 100644 --- a/drivers/net/8139too.c +++ b/drivers/net/8139too.c | |||
@@ -1598,13 +1598,19 @@ static void rtl8139_thread (void *_data) | |||
1598 | { | 1598 | { |
1599 | struct net_device *dev = _data; | 1599 | struct net_device *dev = _data; |
1600 | struct rtl8139_private *tp = netdev_priv(dev); | 1600 | struct rtl8139_private *tp = netdev_priv(dev); |
1601 | unsigned long thr_delay; | ||
1601 | 1602 | ||
1602 | if (rtnl_shlock_nowait() == 0) { | 1603 | if (rtnl_shlock_nowait() == 0) { |
1603 | rtl8139_thread_iter (dev, tp, tp->mmio_addr); | 1604 | rtl8139_thread_iter (dev, tp, tp->mmio_addr); |
1604 | rtnl_unlock (); | 1605 | rtnl_unlock (); |
1606 | |||
1607 | thr_delay = next_tick; | ||
1608 | } else { | ||
1609 | /* unlikely race. mitigate with fast poll. */ | ||
1610 | thr_delay = HZ / 2; | ||
1605 | } | 1611 | } |
1606 | 1612 | ||
1607 | schedule_delayed_work(&tp->thread, next_tick); | 1613 | schedule_delayed_work(&tp->thread, thr_delay); |
1608 | } | 1614 | } |
1609 | 1615 | ||
1610 | static void rtl8139_start_thread(struct rtl8139_private *tp) | 1616 | static void rtl8139_start_thread(struct rtl8139_private *tp) |