Skip to contentSkip to conversation

net/virtio: Fix check of threshold for Tx freeing

PATCH Applied Hengqi Chen 3 participants 10 messages Jun 9, 2025 – Jul 18, 2025 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/virtio: Fix check of threshold for Tx freeing

Like most dirvers, make the fast path of virtio_xmit_cleanup() behave as described by the comments of rte_eth_txconf::tx_free_thresh ([0]):
Start freeing Tx buffers if there are
less free descriptors than this value.

The rationale behind this change is that:
* vq->vq_nentries is set during device probe with the queue size specified by vhost backend, this value does not reflect the real nb_tx_desc
* the real available tx desc is set to vq->vq_free_cnt via the nb_tx_desc param of rte_eth_tx_queue_setup() API
* so nb_used > vq->vq_nentries - vq->vq_free_thresh could never be true

    if say nb_tx_desc=2048, vq->vq_nentries=4096, vq->vq_free_thresh=32,
    see bug report 1716 ([1]) for details.

Bugzilla ID: 1716

[0]: https://github.com/DPDK/dpdk/commit/72514b5d5543
[1]: https://bugs.dpdk.org/show_bug.cgi?id=1716

---
 drivers/net/virtio/virtio_rxtx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/virtio/virtio_rxtx.c +1 -1
index edecd2011f..ab97f03d7d 100644
@@ -1873,7 +1873,7 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 
 	nb_used = virtqueue_nused(vq);
 
-	if (likely(nb_used > vq->vq_nentries - vq->vq_free_thresh))
+	if (likely(vq->vq_free_cnt < vq->vq_free_thresh))
 		virtio_xmit_cleanup(vq, nb_used);
 
 	for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {
Signature · 1 line
2.43.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 30 lines · Hengqi Chen

Like most dirvers, make the fast path of virtio_xmit_cleanup() behave as described by the comments of rte_eth_txconf::tx_free_thresh ([0]):
Start freeing Tx buffers if there are
less free descriptors than this value.

The rationale behind this change is that:
* vq->vq_nentries is set during device probe with the queue size specified by vhost backend, this value does not reflect the real nb_tx_desc
* the real available tx desc is set to vq->vq_free_cnt via the nb_tx_desc param of rte_eth_tx_queue_setup() API
* so nb_used > vq->vq_nentries - vq->vq_free_thresh could never be true

     if say nb_tx_desc=2048, vq->vq_nentries=4096, vq->vq_free_thresh=32,
     see bug report 1716 ([1]) for details.

Bugzilla ID: 1716

   [0]: https://github.com/DPDK/dpdk/commit/72514b5d5543
   [1]: https://bugs.dpdk.org/show_bug.cgi?id=1716
---
  drivers/net/virtio/virtio_rxtx.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/virtio/virtio_rxtx.c +0 -0
index edecd2011f..ab97f03d7d 100644

drivers/net/virtio/virtio_rxtx.c virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) · line 1879

Quoted 8 lines
drivers/net/virtio/virtio_rxtx.c +1 -1
@@ -1873,7 +1873,7 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 
  	nb_used = virtqueue_nused(vq);
 
-	if (likely(nb_used > vq->vq_nentries - vq->vq_free_thresh))
+	if (likely(vq->vq_free_cnt < vq->vq_free_thresh))
  		virtio_xmit_cleanup(vq, nb_used);
 
  	for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {

Thanks,
Maxime

#2 lore raw
In reply to Hengqi Chen
Quoted 30 lines · Hengqi Chen

Like most dirvers, make the fast path of virtio_xmit_cleanup() behave as described by the comments of rte_eth_txconf::tx_free_thresh ([0]):
Start freeing Tx buffers if there are
less free descriptors than this value.

The rationale behind this change is that:
* vq->vq_nentries is set during device probe with the queue size specified by vhost backend, this value does not reflect the real nb_tx_desc
* the real available tx desc is set to vq->vq_free_cnt via the nb_tx_desc param of rte_eth_tx_queue_setup() API
* so nb_used > vq->vq_nentries - vq->vq_free_thresh could never be true

     if say nb_tx_desc=2048, vq->vq_nentries=4096, vq->vq_free_thresh=32,
     see bug report 1716 ([1]) for details.

Bugzilla ID: 1716

   [0]: https://github.com/DPDK/dpdk/commit/72514b5d5543
   [1]: https://bugs.dpdk.org/show_bug.cgi?id=1716
---
  drivers/net/virtio/virtio_rxtx.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/virtio/virtio_rxtx.c +0 -0
index edecd2011f..ab97f03d7d 100644

drivers/net/virtio/virtio_rxtx.c virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) · line 1879

Quoted 8 lines
drivers/net/virtio/virtio_rxtx.c +1 -1
@@ -1873,7 +1873,7 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 
  	nb_used = virtqueue_nused(vq);
 
-	if (likely(nb_used > vq->vq_nentries - vq->vq_free_thresh))
+	if (likely(vq->vq_free_cnt < vq->vq_free_thresh))
  		virtio_xmit_cleanup(vq, nb_used);
 
  	for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {

Applied to next-virtio/for-net-next

Thanks,
Maxime

#3 lore raw
In reply to Hengqi Chen

Hi Hengqi,

Can you help to check the ticket: https://bugs.dpdk.org/show_bug.cgi?id=1747? The perf drop is caused by your patch. Thanks so much.

Best regards,
Yu Jiang

Quoted 50 lines

-----Original Message-----
From: Hengqi Chen <[email protected]>
Sent: Monday, June 9, 2025 3:24 PM
To: [email protected]
Cc: Hengqi Chen <[email protected]>; Baoyuan Li <[email protected]>; Maxime Coquelin <[email protected]>; Chenbo Xia <[email protected]>
Subject: [PATCH] net/virtio: Fix check of threshold for Tx freeing

Like most dirvers, make the fast path of virtio_xmit_cleanup() behave as described by the comments of rte_eth_txconf::tx_free_thresh ([0]):
Start freeing Tx buffers if there are
less free descriptors than this value.

The rationale behind this change is that:
* vq->vq_nentries is set during device probe with the queue size specified by vhost backend, this value does not reflect the real nb_tx_desc
* the real available tx desc is set to vq->vq_free_cnt via the nb_tx_desc param of rte_eth_tx_queue_setup() API
* so nb_used > vq->vq_nentries - vq->vq_free_thresh could never be true

    if say nb_tx_desc=2048, vq->vq_nentries=4096, vq->vq_free_thresh=32,
    see bug report 1716 ([1]) for details.

Bugzilla ID: 1716

[0]: https://github.com/DPDK/dpdk/commit/72514b5d5543
[1]: https://bugs.dpdk.org/show_bug.cgi?id=1716

---
 drivers/net/virtio/virtio_rxtx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/virtio/virtio_rxtx.c +1 -1
index edecd2011f..ab97f03d7d 100644
@@ -1873,7 +1873,7 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 
 	nb_used = virtqueue_nused(vq);
 
-	if (likely(nb_used > vq->vq_nentries - vq->vq_free_thresh))
+	if (likely(vq->vq_free_cnt < vq->vq_free_thresh))
 		virtio_xmit_cleanup(vq, nb_used);
 

for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {
--
2.43.5

#4 lore raw

Hi Yu, Hengqi,

First, thanks Yu for testing and reporting the performance degradation, this is much appreciated!

Quoted 3 lines · YuX

Hi Hengqi,

Can you help to check the ticket: https://bugs.dpdk.org/show_bug.cgi?id=1747? The perf drop is caused by your patch. Thanks so much.

The options I see are:
1. Revert the patch for v25.07, fix it and resubmit for v25.11.
2. Fix it on time for v25.07-rc3
3. Keep the patch in v25.07 and try to fix it in v25.11.

As I will be OoO starting this evening, I would be in favor of option 1. What do you think?

Thanks,
Maxime

Quoted 54 lines

Best regards,
Yu Jiang

Quoted 50 lines

-----Original Message-----
From: Hengqi Chen <[email protected]>
Sent: Monday, June 9, 2025 3:24 PM
To: [email protected]
Cc: Hengqi Chen <[email protected]>; Baoyuan Li <[email protected]>; Maxime Coquelin <[email protected]>; Chenbo Xia <[email protected]>
Subject: [PATCH] net/virtio: Fix check of threshold for Tx freeing

Like most dirvers, make the fast path of virtio_xmit_cleanup() behave as described by the comments of rte_eth_txconf::tx_free_thresh ([0]):
Start freeing Tx buffers if there are
less free descriptors than this value.

The rationale behind this change is that:
* vq->vq_nentries is set during device probe with the queue size specified by vhost backend, this value does not reflect the real nb_tx_desc
* the real available tx desc is set to vq->vq_free_cnt via the nb_tx_desc param of rte_eth_tx_queue_setup() API
* so nb_used > vq->vq_nentries - vq->vq_free_thresh could never be true

     if say nb_tx_desc=2048, vq->vq_nentries=4096, vq->vq_free_thresh=32,
     see bug report 1716 ([1]) for details.

Bugzilla ID: 1716

   [0]: https://github.com/DPDK/dpdk/commit/72514b5d5543
   [1]: https://bugs.dpdk.org/show_bug.cgi?id=1716
---
  drivers/net/virtio/virtio_rxtx.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/virtio/virtio_rxtx.c +1 -1
index edecd2011f..ab97f03d7d 100644
@@ -1873,7 +1873,7 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 
  	nb_used = virtqueue_nused(vq);
 
-	if (likely(nb_used > vq->vq_nentries - vq->vq_free_thresh))
+	if (likely(vq->vq_free_cnt < vq->vq_free_thresh))
  		virtio_xmit_cleanup(vq, nb_used);
 

for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {
--
2.43.5

#5 lore raw

Hi Maxime and other maintainers,

Quoted 11 lines · Maxime Coquelin

Hi Yu, Hengqi,

First, thanks Yu for testing and reporting the performance degradation, this is much appreciated!

Quoted 3 lines · YuX

Hi Hengqi,

Can you help to check the ticket: https://bugs.dpdk.org/show_bug.cgi?id=1747? The perf drop is caused by your patch. Thanks so much.

Quoted 8 lines

The options I see are:
1. Revert the patch for v25.07, fix it and resubmit for v25.11.
2. Fix it on time for v25.07-rc3
3. Keep the patch in v25.07 and try to fix it in v25.11.

As I will be OoO starting this evening, I would be in favor of option 1. What do you think?

I am OK with both option 1 and 3.
Please handle it according to the DPDK community rules.

Thanks,
Hengqi

Quoted 58 lines

Thanks,
Maxime

Quoted 54 lines

Best regards,
Yu Jiang

Quoted 50 lines

-----Original Message-----
From: Hengqi Chen <[email protected]>
Sent: Monday, June 9, 2025 3:24 PM
To: [email protected]
Cc: Hengqi Chen <[email protected]>; Baoyuan Li <[email protected]>; Maxime Coquelin <[email protected]>; Chenbo Xia <[email protected]>
Subject: [PATCH] net/virtio: Fix check of threshold for Tx freeing

Like most dirvers, make the fast path of virtio_xmit_cleanup() behave as described by the comments of rte_eth_txconf::tx_free_thresh ([0]):
Start freeing Tx buffers if there are
less free descriptors than this value.

The rationale behind this change is that:
* vq->vq_nentries is set during device probe with the queue size specified by vhost backend, this value does not reflect the real nb_tx_desc
* the real available tx desc is set to vq->vq_free_cnt via the nb_tx_desc param of rte_eth_tx_queue_setup() API
* so nb_used > vq->vq_nentries - vq->vq_free_thresh could never be true

     if say nb_tx_desc=2048, vq->vq_nentries=4096, vq->vq_free_thresh=32,
     see bug report 1716 ([1]) for details.

Bugzilla ID: 1716

   [0]: https://github.com/DPDK/dpdk/commit/72514b5d5543
   [1]: https://bugs.dpdk.org/show_bug.cgi?id=1716
---
  drivers/net/virtio/virtio_rxtx.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/virtio/virtio_rxtx.c +1 -1
index edecd2011f..ab97f03d7d 100644
@@ -1873,7 +1873,7 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 
     nb_used = virtqueue_nused(vq);
 
-    if (likely(nb_used > vq->vq_nentries - vq->vq_free_thresh))
+    if (likely(vq->vq_free_cnt < vq->vq_free_thresh))
             virtio_xmit_cleanup(vq, nb_used);
 
     for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {

--
2.43.5

#6 lore raw
In reply to Jiang, YuX

Hi Yu,

Quoted 5 lines · YuX

Hi Hengqi,

Can you help to check the ticket: https://bugs.dpdk.org/show_bug.cgi?id=1747? The perf drop is caused by your patch. Thanks so much.

Thanks for the testing. Will investigate.

Quoted 54 lines

Best regards,
Yu Jiang

Quoted 50 lines

-----Original Message-----
From: Hengqi Chen <[email protected]>
Sent: Monday, June 9, 2025 3:24 PM
To: [email protected]
Cc: Hengqi Chen <[email protected]>; Baoyuan Li <[email protected]>; Maxime Coquelin <[email protected]>; Chenbo Xia <[email protected]>
Subject: [PATCH] net/virtio: Fix check of threshold for Tx freeing

Like most dirvers, make the fast path of virtio_xmit_cleanup() behave as described by the comments of rte_eth_txconf::tx_free_thresh ([0]):
Start freeing Tx buffers if there are
less free descriptors than this value.

The rationale behind this change is that:
* vq->vq_nentries is set during device probe with the queue size specified by vhost backend, this value does not reflect the real nb_tx_desc
* the real available tx desc is set to vq->vq_free_cnt via the nb_tx_desc param of rte_eth_tx_queue_setup() API
* so nb_used > vq->vq_nentries - vq->vq_free_thresh could never be true

    if say nb_tx_desc=2048, vq->vq_nentries=4096, vq->vq_free_thresh=32,
    see bug report 1716 ([1]) for details.

Bugzilla ID: 1716

[0]: https://github.com/DPDK/dpdk/commit/72514b5d5543
[1]: https://bugs.dpdk.org/show_bug.cgi?id=1716

---
 drivers/net/virtio/virtio_rxtx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/virtio/virtio_rxtx.c +1 -1
index edecd2011f..ab97f03d7d 100644
@@ -1873,7 +1873,7 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 
      nb_used = virtqueue_nused(vq);
 
-     if (likely(nb_used > vq->vq_nentries - vq->vq_free_thresh))
+     if (likely(vq->vq_free_cnt < vq->vq_free_thresh))
              virtio_xmit_cleanup(vq, nb_used);
 
      for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {

--
2.43.5

#7 lore raw
In reply to Jiang, YuX

Hi Yu,

Quoted 5 lines · YuX

Hi Hengqi,

Can you help to check the ticket: https://bugs.dpdk.org/show_bug.cgi?id=1747? The perf drop is caused by your patch. Thanks so much.

The [Expect Result] section contains a non-zero TX-errors counter, is this expected ?
BTW, the expected result is done by dropping/reverting the bad commit ONLY, right ?

Quoted 54 lines

Best regards,
Yu Jiang

Quoted 50 lines

-----Original Message-----
From: Hengqi Chen <[email protected]>
Sent: Monday, June 9, 2025 3:24 PM
To: [email protected]
Cc: Hengqi Chen <[email protected]>; Baoyuan Li <[email protected]>; Maxime Coquelin <[email protected]>; Chenbo Xia <[email protected]>
Subject: [PATCH] net/virtio: Fix check of threshold for Tx freeing

Like most dirvers, make the fast path of virtio_xmit_cleanup() behave as described by the comments of rte_eth_txconf::tx_free_thresh ([0]):
Start freeing Tx buffers if there are
less free descriptors than this value.

The rationale behind this change is that:
* vq->vq_nentries is set during device probe with the queue size specified by vhost backend, this value does not reflect the real nb_tx_desc
* the real available tx desc is set to vq->vq_free_cnt via the nb_tx_desc param of rte_eth_tx_queue_setup() API
* so nb_used > vq->vq_nentries - vq->vq_free_thresh could never be true

    if say nb_tx_desc=2048, vq->vq_nentries=4096, vq->vq_free_thresh=32,
    see bug report 1716 ([1]) for details.

Bugzilla ID: 1716

[0]: https://github.com/DPDK/dpdk/commit/72514b5d5543
[1]: https://bugs.dpdk.org/show_bug.cgi?id=1716

---
 drivers/net/virtio/virtio_rxtx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/virtio/virtio_rxtx.c +1 -1
index edecd2011f..ab97f03d7d 100644
@@ -1873,7 +1873,7 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 
      nb_used = virtqueue_nused(vq);
 
-     if (likely(nb_used > vq->vq_nentries - vq->vq_free_thresh))
+     if (likely(vq->vq_free_cnt < vq->vq_free_thresh))
              virtio_xmit_cleanup(vq, nb_used);
 
      for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {

--
2.43.5

#8 lore raw
In reply to Jiang, YuX

Hi Yu,

Quoted 5 lines · YuX

Hi Hengqi,

Can you help to check the ticket: https://bugs.dpdk.org/show_bug.cgi?id=1747? The perf drop is caused by your patch. Thanks so much.

Could you please elaborate how to use trex in your reproduce steps ? Thanks.

Cheers,
---
Hengqi

Quoted 54 lines

Best regards,
Yu Jiang

Quoted 50 lines

-----Original Message-----
From: Hengqi Chen <[email protected]>
Sent: Monday, June 9, 2025 3:24 PM
To: [email protected]
Cc: Hengqi Chen <[email protected]>; Baoyuan Li <[email protected]>; Maxime Coquelin <[email protected]>; Chenbo Xia <[email protected]>
Subject: [PATCH] net/virtio: Fix check of threshold for Tx freeing

Like most dirvers, make the fast path of virtio_xmit_cleanup() behave as described by the comments of rte_eth_txconf::tx_free_thresh ([0]):
Start freeing Tx buffers if there are
less free descriptors than this value.

The rationale behind this change is that:
* vq->vq_nentries is set during device probe with the queue size specified by vhost backend, this value does not reflect the real nb_tx_desc
* the real available tx desc is set to vq->vq_free_cnt via the nb_tx_desc param of rte_eth_tx_queue_setup() API
* so nb_used > vq->vq_nentries - vq->vq_free_thresh could never be true

    if say nb_tx_desc=2048, vq->vq_nentries=4096, vq->vq_free_thresh=32,
    see bug report 1716 ([1]) for details.

Bugzilla ID: 1716

[0]: https://github.com/DPDK/dpdk/commit/72514b5d5543
[1]: https://bugs.dpdk.org/show_bug.cgi?id=1716

---
 drivers/net/virtio/virtio_rxtx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/virtio/virtio_rxtx.c +1 -1
index edecd2011f..ab97f03d7d 100644
@@ -1873,7 +1873,7 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 
      nb_used = virtqueue_nused(vq);
 
-     if (likely(nb_used > vq->vq_nentries - vq->vq_free_thresh))
+     if (likely(vq->vq_free_cnt < vq->vq_free_thresh))
              virtio_xmit_cleanup(vq, nb_used);
 
      for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {

--
2.43.5

#9 lore raw

Hi,

cd /opt/trex/v3.00/;./t-rex-64 -i --cfg /etc/trex_cfg.yaml -c 16 cp stl/bench.py stl/jy-bench.py
cd /opt/trex/v3.00/;./trex-console
start -f stl/jy-bench.py --port 0 -m 100% -t vm=random

stl/jy-bench.py modify base_pkt.
def create_stream (self, stl_flow, size, vm, src, dst, pps = 1, isg = 0):
# Create base packet and pad it to size
#base_pkt = Ether()/IP(src=src, dst=dst)/UDP(dport=12,sport=1025,chksum=0) base_pkt = Ether(dst="40:a6:b7:96:e4:00")/IP(src="192.168.4.1")/("X"*1480)

Best regards,
Yu Jiang

Quoted 82 lines

-----Original Message-----
From: Hengqi Chen <[email protected]>
Sent: Thursday, July 17, 2025 11:04 PM
To: Jiang, YuX <[email protected]>
Cc: [email protected]; Baoyuan Li <[email protected]>; Maxime Coquelin <[email protected]>; Chenbo Xia <[email protected]>
Subject: Re: [PATCH] net/virtio: Fix check of threshold for Tx freeing

Hi Yu,

Quoted 4 lines · YuX

Hi Hengqi,

Can you help to check the ticket:

https://bugs.dpdk.org/show_bug.cgi?id=1747? The perf drop is caused by your patch. Thanks so much.

Quoted 1 line

Could you please elaborate how to use trex in your reproduce steps ? Thanks.

Cheers,
---
Hengqi

Quoted 14 lines

Best regards,
Yu Jiang

Quoted 11 lines

-----Original Message-----
From: Hengqi Chen <[email protected]>
Sent: Monday, June 9, 2025 3:24 PM
To: [email protected]
Cc: Hengqi Chen <[email protected]>; Baoyuan Li <[email protected]>; Maxime Coquelin <[email protected]>; Chenbo Xia <[email protected]>
Subject: [PATCH] net/virtio: Fix check of threshold for Tx freeing

Like most dirvers, make the fast path of virtio_xmit_cleanup() behave as described by the comments of rte_eth_txconf::tx_free_thresh

([0]):

Quoted 9 lines
Quoted 9 lines

Start freeing Tx buffers if there are
less free descriptors than this value.

The rationale behind this change is that:
* vq->vq_nentries is set during device probe with the queue size specified by vhost backend, this value does not reflect the real nb_tx_desc
* the real available tx desc is set to vq->vq_free_cnt via the nb_tx_desc param of rte_eth_tx_queue_setup() API
* so nb_used > vq->vq_nentries - vq->vq_free_thresh could never be

true

Quoted 32 lines
Quoted 31 lines
    if say nb_tx_desc=2048, vq->vq_nentries=4096, vq->vq_free_thresh=32,
    see bug report 1716 ([1]) for details.

Bugzilla ID: 1716

[0]: https://github.com/DPDK/dpdk/commit/72514b5d5543
[1]: https://bugs.dpdk.org/show_bug.cgi?id=1716

---
 drivers/net/virtio/virtio_rxtx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/virtio/virtio_rxtx.c +1 -1
index edecd2011f..ab97f03d7d 100644
@@ -1873,7 +1873,7 @@ virtio_xmit_pkts(void *tx_queue, struct
 rte_mbuf **tx_pkts, uint16_t nb_pkts)
 
      nb_used = virtqueue_nused(vq);
 
-     if (likely(nb_used > vq->vq_nentries - vq->vq_free_thresh))
+     if (likely(vq->vq_free_cnt < vq->vq_free_thresh))
              virtio_xmit_cleanup(vq, nb_used);
 
      for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {

--
2.43.5