Skip to contentSkip to conversation

vhost: fix async inflight packet counter

PATCH Applied Patrick Fu 2 participants 3 messages Nov 3, 2020 – Nov 9, 2020

lore
Share & tools
lore

Patrick Fu

author
#0 lore raw

PATCH 1/1 vhost: fix async inflight packet counter

Async inflight packet counter should take failed packets into account. Failed packets will be deducted in the error handling logic.

Fixes 6b3c81db8bb7 ("vhost: simplify async copy completion")
Fixes cd6760da1076 ("vhost: introduce async enqueue for split ring")
---
 lib/librte_vhost/virtio_net.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/librte_vhost/virtio_net.c +2 -2
index 10dec5e54..6c5128665 100644
@@ -1567,7 +1567,7 @@ virtio_dev_rx_async_submit_split(struct virtio_net *dev,
 			src_it = it_pool;
 			dst_it = it_pool + 1;
 			segs_await = 0;
-			vq->async_pkts_inflight_n += n_pkts;
+			vq->async_pkts_inflight_n += pkt_burst_idx;
 
 			if (unlikely(n_pkts < (int)pkt_burst_idx)) {
 				/*
@@ -1587,7 +1587,7 @@ virtio_dev_rx_async_submit_split(struct virtio_net *dev,
 	if (pkt_burst_idx) {
 		n_pkts = vq->async_ops.transfer_data(dev->vid,
 				queue_id, tdes, 0, pkt_burst_idx);
-		vq->async_pkts_inflight_n += n_pkts;
+		vq->async_pkts_inflight_n += pkt_burst_idx;
 
 		if (unlikely(n_pkts < (int)pkt_burst_idx))
 			pkt_err = pkt_burst_idx - n_pkts;
Signature · 1 line
2.18.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 26 lines · Patrick Fu

Async inflight packet counter should take failed packets into account. Failed packets will be deducted in the error handling logic.

Fixes 6b3c81db8bb7 ("vhost: simplify async copy completion")
Fixes cd6760da1076 ("vhost: introduce async enqueue for split ring")
---
 lib/librte_vhost/virtio_net.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/librte_vhost/virtio_net.c +1 -1
index 10dec5e54..6c5128665 100644
@@ -1567,7 +1567,7 @@ virtio_dev_rx_async_submit_split(struct virtio_net *dev,
 			src_it = it_pool;
 			dst_it = it_pool + 1;
 			segs_await = 0;
-			vq->async_pkts_inflight_n += n_pkts;
+			vq->async_pkts_inflight_n += pkt_burst_idx;
 
 			if (unlikely(n_pkts < (int)pkt_burst_idx)) {
 				/*

lib/librte_vhost/virtio_net.c virtio_dev_rx_async_submit_split(struct virtio_net *dev, · line 1593

Quoted 8 lines
lib/librte_vhost/virtio_net.c +1 -1
@@ -1587,7 +1587,7 @@ virtio_dev_rx_async_submit_split(struct virtio_net *dev,
 	if (pkt_burst_idx) {
 		n_pkts = vq->async_ops.transfer_data(dev->vid,
 				queue_id, tdes, 0, pkt_burst_idx);
-		vq->async_pkts_inflight_n += n_pkts;
+		vq->async_pkts_inflight_n += pkt_burst_idx;
 
 		if (unlikely(n_pkts < (int)pkt_burst_idx))
 			pkt_err = pkt_burst_idx - n_pkts;

Thanks,
Maxime

#2 lore raw
In reply to Patrick Fu
Quoted 26 lines · Patrick Fu

Async inflight packet counter should take failed packets into account. Failed packets will be deducted in the error handling logic.

Fixes 6b3c81db8bb7 ("vhost: simplify async copy completion")
Fixes cd6760da1076 ("vhost: introduce async enqueue for split ring")
---
 lib/librte_vhost/virtio_net.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/librte_vhost/virtio_net.c +1 -1
index 10dec5e54..6c5128665 100644
@@ -1567,7 +1567,7 @@ virtio_dev_rx_async_submit_split(struct virtio_net *dev,
 			src_it = it_pool;
 			dst_it = it_pool + 1;
 			segs_await = 0;
-			vq->async_pkts_inflight_n += n_pkts;
+			vq->async_pkts_inflight_n += pkt_burst_idx;
 
 			if (unlikely(n_pkts < (int)pkt_burst_idx)) {
 				/*

lib/librte_vhost/virtio_net.c virtio_dev_rx_async_submit_split(struct virtio_net *dev, · line 1593

Quoted 8 lines
lib/librte_vhost/virtio_net.c +1 -1
@@ -1587,7 +1587,7 @@ virtio_dev_rx_async_submit_split(struct virtio_net *dev,
 	if (pkt_burst_idx) {
 		n_pkts = vq->async_ops.transfer_data(dev->vid,
 				queue_id, tdes, 0, pkt_burst_idx);
-		vq->async_pkts_inflight_n += n_pkts;
+		vq->async_pkts_inflight_n += pkt_burst_idx;
 
 		if (unlikely(n_pkts < (int)pkt_burst_idx))
 			pkt_err = pkt_burst_idx - n_pkts;

Applied to dpdk-next-virtio/main.

Thanks,
Maxime