[dpdk-dev] net/mlx4: fix rx not working after mbuf alloc failure

Message ID 1492121724-105935-1-git-send-email-Charles.Myers@spirent.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Myers, Charles April 13, 2017, 10:15 p.m. UTC
  From: Charles <Charles.Myers@spirent.com>

Fixes issue where mlx4 driver stops receiving packets when mbuf
allocation fails in mlx4_rx_burst().

This issue appears to be caused because the code doesn't recycle the
existing mbuf to the sges array when mbuf allocation fails as is done
in the code right above it which handles (wc.status != IBV_WC_SUCCESS).

Copying the code from the above case fixes the issue.

Fixes: acac55f16412 ("mlx4: use MOFED 3.0 fast verbs interface for Rx
operations")

Signed-off-by: Charles Myers <Charles.Myers@spirent.com>
---
 drivers/net/mlx4/mlx4.c |    3 +++
 1 file changed, 3 insertions(+)
  

Comments

Ferruh Yigit April 14, 2017, 9:58 a.m. UTC | #1
On 4/13/2017 11:15 PM, Charles Myers wrote:
> From: Charles <Charles.Myers@spirent.com>
> 
> Fixes issue where mlx4 driver stops receiving packets when mbuf
> allocation fails in mlx4_rx_burst().
> 
> This issue appears to be caused because the code doesn't recycle the
> existing mbuf to the sges array when mbuf allocation fails as is done
> in the code right above it which handles (wc.status != IBV_WC_SUCCESS).
> 
> Copying the code from the above case fixes the issue.
> 
> Fixes: acac55f16412 ("mlx4: use MOFED 3.0 fast verbs interface for Rx
> operations")

Cc: stable@dpdk.org

> 
> Signed-off-by: Charles Myers <Charles.Myers@spirent.com>

Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>

Applied to dpdk-next-net/master, thanks.
  

Patch

diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index aff9155..59d26fe 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -3169,6 +3169,8 @@  struct txq_mp2mr_mbuf_check_data {
 			/* Increase out of memory counters. */
 			++rxq->stats.rx_nombuf;
 			++rxq->priv->dev->data->rx_mbuf_alloc_failed;
+			/* Add SGE to array for repost. */
+			sges[i] = elt->sge;
 			goto repost;
 		}