From 6c3dc9ebaa9f8bc9257299ec703a9a0fbff627b0 Mon Sep 17 00:00:00 2001 From: Ophir Munk Date: Wed, 4 Nov 2020 07:55:20 +0000 Subject: [PATCH] net/mlx5: fix Rx queue object allocation with MPRQ The space for extra buffer pointers used by MPRQ routines was not allocated in Rx queue object creation structure causing memory corruption. The fix allocates the extra memory for the pointers in case MPRQ is engaged. Fixes: a0a45e8af723 ("net/mlx5: configure Rx queue for buffer split") Signed-off-by: Ophir Munk Acked-by: Viacheslav Ovsiienko Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_rxq.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 4d3bd00d8b..a61a2dac95 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -1424,8 +1424,11 @@ mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, const struct rte_eth_rxseg_split *qs_seg = rx_seg; unsigned int tail_len; - tmpl = mlx5_malloc(MLX5_MEM_RTE | MLX5_MEM_ZERO, sizeof(*tmpl) + - desc_n * sizeof(struct rte_mbuf *), 0, socket); + tmpl = mlx5_malloc(MLX5_MEM_RTE | MLX5_MEM_ZERO, + sizeof(*tmpl) + desc_n * sizeof(struct rte_mbuf *) + + (!!mprq_en) * + (desc >> mprq_stride_nums) * sizeof(struct mlx5_mprq_buf *), + 0, socket); if (!tmpl) { rte_errno = ENOMEM; return NULL; -- 2.20.1