* [PATCH] mlx4_en: Restoring RX buffer pointer in case of failure
@ 2011-04-07 9:25 Yevgeny Petrilin
2011-04-08 3:36 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Yevgeny Petrilin @ 2011-04-07 9:25 UTC (permalink / raw)
To: davem; +Cc: netdev, yevgenyp
If not done, second attempt to open the RX ring would cause memory corruption.
Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
---
drivers/net/mlx4/en_rx.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/net/mlx4/en_rx.c b/drivers/net/mlx4/en_rx.c
index a0423eb..33edecb 100644
--- a/drivers/net/mlx4/en_rx.c
+++ b/drivers/net/mlx4/en_rx.c
@@ -345,6 +345,8 @@ int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv)
err = mlx4_en_init_allocator(priv, ring);
if (err) {
en_err(priv, "Failed initializing ring allocator\n");
+ if (ring->stride <= TXBB_SIZE)
+ ring->buf -= TXBB_SIZE;
ring_ind--;
goto err_allocator;
}
@@ -369,6 +371,8 @@ err_buffers:
ring_ind = priv->rx_ring_num - 1;
err_allocator:
while (ring_ind >= 0) {
+ if (priv->rx_ring[ring_ind].stride <= TXBB_SIZE)
+ priv->rx_ring[ring_ind].buf -= TXBB_SIZE;
mlx4_en_destroy_allocator(priv, &priv->rx_ring[ring_ind]);
ring_ind--;
}
--
1.6.0.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-04-08 3:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-07 9:25 [PATCH] mlx4_en: Restoring RX buffer pointer in case of failure Yevgeny Petrilin
2011-04-08 3:36 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox