diff options
author | Yevgeny Petrilin <yevgenyp@mellanox.co.il> | 2009-05-25 16:57:21 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-05-30 01:04:42 -0400 |
commit | 465440d2720543669841db5b0691ba41892ed0ae (patch) | |
tree | e037c9c1796086a5cd223f170a8a8d295f2a4e99 | |
parent | e8573758d520279be9510d63177968627ab98752 (diff) |
mlx4_en: Fix a kernel panic when waking tx queue
When the transmit queue gets full we enable interrupts for TX completions
There was a race that we handled the TX queue both from the interrupt context
and from the transmit function. Using "spin_trylock_irq()" ensures this
doesn't happen.
Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/mlx4/en_tx.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/mlx4/en_tx.c b/drivers/net/mlx4/en_tx.c index ac6fc499b280..e5c98a98ad37 100644 --- a/drivers/net/mlx4/en_tx.c +++ b/drivers/net/mlx4/en_tx.c | |||
@@ -426,7 +426,7 @@ void mlx4_en_poll_tx_cq(unsigned long data) | |||
426 | 426 | ||
427 | INC_PERF_COUNTER(priv->pstats.tx_poll); | 427 | INC_PERF_COUNTER(priv->pstats.tx_poll); |
428 | 428 | ||
429 | if (!spin_trylock(&ring->comp_lock)) { | 429 | if (!spin_trylock_irq(&ring->comp_lock)) { |
430 | mod_timer(&cq->timer, jiffies + MLX4_EN_TX_POLL_TIMEOUT); | 430 | mod_timer(&cq->timer, jiffies + MLX4_EN_TX_POLL_TIMEOUT); |
431 | return; | 431 | return; |
432 | } | 432 | } |
@@ -439,7 +439,7 @@ void mlx4_en_poll_tx_cq(unsigned long data) | |||
439 | if (inflight && priv->port_up) | 439 | if (inflight && priv->port_up) |
440 | mod_timer(&cq->timer, jiffies + MLX4_EN_TX_POLL_TIMEOUT); | 440 | mod_timer(&cq->timer, jiffies + MLX4_EN_TX_POLL_TIMEOUT); |
441 | 441 | ||
442 | spin_unlock(&ring->comp_lock); | 442 | spin_unlock_irq(&ring->comp_lock); |
443 | } | 443 | } |
444 | 444 | ||
445 | static struct mlx4_en_tx_desc *mlx4_en_bounce_to_desc(struct mlx4_en_priv *priv, | 445 | static struct mlx4_en_tx_desc *mlx4_en_bounce_to_desc(struct mlx4_en_priv *priv, |
@@ -482,9 +482,9 @@ static inline void mlx4_en_xmit_poll(struct mlx4_en_priv *priv, int tx_ind) | |||
482 | 482 | ||
483 | /* Poll the CQ every mlx4_en_TX_MODER_POLL packets */ | 483 | /* Poll the CQ every mlx4_en_TX_MODER_POLL packets */ |
484 | if ((++ring->poll_cnt & (MLX4_EN_TX_POLL_MODER - 1)) == 0) | 484 | if ((++ring->poll_cnt & (MLX4_EN_TX_POLL_MODER - 1)) == 0) |
485 | if (spin_trylock(&ring->comp_lock)) { | 485 | if (spin_trylock_irq(&ring->comp_lock)) { |
486 | mlx4_en_process_tx_cq(priv->dev, cq); | 486 | mlx4_en_process_tx_cq(priv->dev, cq); |
487 | spin_unlock(&ring->comp_lock); | 487 | spin_unlock_irq(&ring->comp_lock); |
488 | } | 488 | } |
489 | } | 489 | } |
490 | 490 | ||