From b8d0a27842dc2a90f1bf341d1e5cbf0dfbc7c4e5 Mon Sep 17 00:00:00 2001 From: Ivan Ilchenko Date: Fri, 20 Aug 2021 15:47:20 +0300 Subject: [PATCH] net/virtio: fix mbuf count on Rx queue setup Rx queue setup finish function may report wrong number of allocated mbufs in case of in-order feature. Fix the function to not ignore allocation error and count only successfully allocated number of buffers. Fixes: e5f456a98d3c ("net/virtio: support in-order Rx and Tx") Cc: stable@dpdk.org Signed-off-by: Ivan Ilchenko Signed-off-by: Andrew Rybchenko Reviewed-by: Maxime Coquelin --- drivers/net/virtio/virtio_rxtx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index d0365ce4bf..8a48fba5cc 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -768,10 +768,11 @@ virtio_dev_rx_queue_setup_finish(struct rte_eth_dev *dev, uint16_t queue_idx) if (unlikely(error)) { for (i = 0; i < free_cnt; i++) rte_pktmbuf_free(pkts[i]); + } else { + nbufs += free_cnt; } } - nbufs += free_cnt; vq_update_avail_idx(vq); } } else { -- 2.39.5