diff options
author | Quintin Pitts <geek4linux@gmail.com> | 2010-04-09 15:37:38 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-04-12 15:22:10 -0400 |
commit | 5988f385b4cffa9ca72c5be0188e5f4c9ef46d82 (patch) | |
tree | 2c79481788945047c97b4ffe54a3c49362c3789a /drivers/net/wireless/p54 | |
parent | b1f90866fb3a329b1c4ebfff93ae9c110943e50a (diff) |
p54pci: prevent stuck rx-ring on slow system
This patch fixes an old problem, which - under certain
circumstances - could cause the device to become
unresponsive.
most of p54pci's rx-ring management is implemented in just
two distinct standalone functions. p54p_check_rx_ring takes
care of processing incoming data, while p54p_refill_rx_ring
tries to replenish all depleted communication buffers.
This has always worked fine on my fast machine, but
now I know there is a hidden race...
The most likely candidate here is ring_control->device_idx.
Quintin Pitts had already analyzed the culprit and posted
a patch back in Oct 2009. But sadly, no one's picked up on this.
( https://patchwork.kernel.org/patch/53079/ [2 & 3] ).
This patch does the same way, except that it also prioritize
rx data processing, simply because tx routines *can* wait.
Reported-by: Sean Young <sean@mess.org>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=11386
Reported-by: Quintin Pitts <geek4linux@gmail.com>
Signed-off-by: Quintin Pitts <geek4linux@gmail.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/p54')
-rw-r--r-- | drivers/net/wireless/p54/p54pci.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c index ed4bdffdd63e..aa29663bf6c9 100644 --- a/drivers/net/wireless/p54/p54pci.c +++ b/drivers/net/wireless/p54/p54pci.c | |||
@@ -131,7 +131,7 @@ static int p54p_upload_firmware(struct ieee80211_hw *dev) | |||
131 | 131 | ||
132 | static void p54p_refill_rx_ring(struct ieee80211_hw *dev, | 132 | static void p54p_refill_rx_ring(struct ieee80211_hw *dev, |
133 | int ring_index, struct p54p_desc *ring, u32 ring_limit, | 133 | int ring_index, struct p54p_desc *ring, u32 ring_limit, |
134 | struct sk_buff **rx_buf) | 134 | struct sk_buff **rx_buf, u32 index) |
135 | { | 135 | { |
136 | struct p54p_priv *priv = dev->priv; | 136 | struct p54p_priv *priv = dev->priv; |
137 | struct p54p_ring_control *ring_control = priv->ring_control; | 137 | struct p54p_ring_control *ring_control = priv->ring_control; |
@@ -139,7 +139,7 @@ static void p54p_refill_rx_ring(struct ieee80211_hw *dev, | |||
139 | 139 | ||
140 | idx = le32_to_cpu(ring_control->host_idx[ring_index]); | 140 | idx = le32_to_cpu(ring_control->host_idx[ring_index]); |
141 | limit = idx; | 141 | limit = idx; |
142 | limit -= le32_to_cpu(ring_control->device_idx[ring_index]); | 142 | limit -= le32_to_cpu(index); |
143 | limit = ring_limit - limit; | 143 | limit = ring_limit - limit; |
144 | 144 | ||
145 | i = idx % ring_limit; | 145 | i = idx % ring_limit; |
@@ -231,7 +231,7 @@ static void p54p_check_rx_ring(struct ieee80211_hw *dev, u32 *index, | |||
231 | i %= ring_limit; | 231 | i %= ring_limit; |
232 | } | 232 | } |
233 | 233 | ||
234 | p54p_refill_rx_ring(dev, ring_index, ring, ring_limit, rx_buf); | 234 | p54p_refill_rx_ring(dev, ring_index, ring, ring_limit, rx_buf, *index); |
235 | } | 235 | } |
236 | 236 | ||
237 | static void p54p_check_tx_ring(struct ieee80211_hw *dev, u32 *index, | 237 | static void p54p_check_tx_ring(struct ieee80211_hw *dev, u32 *index, |
@@ -276,14 +276,6 @@ static void p54p_tasklet(unsigned long dev_id) | |||
276 | struct p54p_priv *priv = dev->priv; | 276 | struct p54p_priv *priv = dev->priv; |
277 | struct p54p_ring_control *ring_control = priv->ring_control; | 277 | struct p54p_ring_control *ring_control = priv->ring_control; |
278 | 278 | ||
279 | p54p_check_tx_ring(dev, &priv->tx_idx_mgmt, 3, ring_control->tx_mgmt, | ||
280 | ARRAY_SIZE(ring_control->tx_mgmt), | ||
281 | priv->tx_buf_mgmt); | ||
282 | |||
283 | p54p_check_tx_ring(dev, &priv->tx_idx_data, 1, ring_control->tx_data, | ||
284 | ARRAY_SIZE(ring_control->tx_data), | ||
285 | priv->tx_buf_data); | ||
286 | |||
287 | p54p_check_rx_ring(dev, &priv->rx_idx_mgmt, 2, ring_control->rx_mgmt, | 279 | p54p_check_rx_ring(dev, &priv->rx_idx_mgmt, 2, ring_control->rx_mgmt, |
288 | ARRAY_SIZE(ring_control->rx_mgmt), priv->rx_buf_mgmt); | 280 | ARRAY_SIZE(ring_control->rx_mgmt), priv->rx_buf_mgmt); |
289 | 281 | ||
@@ -292,6 +284,14 @@ static void p54p_tasklet(unsigned long dev_id) | |||
292 | 284 | ||
293 | wmb(); | 285 | wmb(); |
294 | P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_UPDATE)); | 286 | P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_UPDATE)); |
287 | |||
288 | p54p_check_tx_ring(dev, &priv->tx_idx_mgmt, 3, ring_control->tx_mgmt, | ||
289 | ARRAY_SIZE(ring_control->tx_mgmt), | ||
290 | priv->tx_buf_mgmt); | ||
291 | |||
292 | p54p_check_tx_ring(dev, &priv->tx_idx_data, 1, ring_control->tx_data, | ||
293 | ARRAY_SIZE(ring_control->tx_data), | ||
294 | priv->tx_buf_data); | ||
295 | } | 295 | } |
296 | 296 | ||
297 | static irqreturn_t p54p_interrupt(int irq, void *dev_id) | 297 | static irqreturn_t p54p_interrupt(int irq, void *dev_id) |
@@ -444,10 +444,10 @@ static int p54p_open(struct ieee80211_hw *dev) | |||
444 | priv->rx_idx_mgmt = priv->tx_idx_mgmt = 0; | 444 | priv->rx_idx_mgmt = priv->tx_idx_mgmt = 0; |
445 | 445 | ||
446 | p54p_refill_rx_ring(dev, 0, priv->ring_control->rx_data, | 446 | p54p_refill_rx_ring(dev, 0, priv->ring_control->rx_data, |
447 | ARRAY_SIZE(priv->ring_control->rx_data), priv->rx_buf_data); | 447 | ARRAY_SIZE(priv->ring_control->rx_data), priv->rx_buf_data, 0); |
448 | 448 | ||
449 | p54p_refill_rx_ring(dev, 2, priv->ring_control->rx_mgmt, | 449 | p54p_refill_rx_ring(dev, 2, priv->ring_control->rx_mgmt, |
450 | ARRAY_SIZE(priv->ring_control->rx_mgmt), priv->rx_buf_mgmt); | 450 | ARRAY_SIZE(priv->ring_control->rx_mgmt), priv->rx_buf_mgmt, 0); |
451 | 451 | ||
452 | P54P_WRITE(ring_control_base, cpu_to_le32(priv->ring_control_dma)); | 452 | P54P_WRITE(ring_control_base, cpu_to_le32(priv->ring_control_dma)); |
453 | P54P_READ(ring_control_base); | 453 | P54P_READ(ring_control_base); |