From: Ivan Ilchenko <ivan.ilche...@oktetlabs.ru>

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: e5f456a98d3 ("net/virtio: support in-order Rx and Tx")
Cc: sta...@dpdk.org

Signed-off-by: Ivan Ilchenko <ivan.ilche...@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybche...@oktetlabs.ru>
---
 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.30.2

Reply via email to