[v1] vhost: fix async inflight packet counter

Message ID 20201103053501.2805-1-patrick.fu@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series [v1] vhost: fix async inflight packet counter |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS

Commit Message

Patrick Fu Nov. 3, 2020, 5:35 a.m. UTC
  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")

Signed-off-by: Patrick Fu <patrick.fu@intel.com>
---
 lib/librte_vhost/virtio_net.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Maxime Coquelin Nov. 9, 2020, 9:18 a.m. UTC | #1
On 11/3/20 6:35 AM, Patrick Fu wrote:
> 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")
> 
> Signed-off-by: Patrick Fu <patrick.fu@intel.com>
> ---
>  lib/librte_vhost/virtio_net.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
> index 10dec5e54..6c5128665 100644
> --- a/lib/librte_vhost/virtio_net.c
> +++ b/lib/librte_vhost/virtio_net.c
> @@ -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;
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime
  
Maxime Coquelin Nov. 9, 2020, 4:32 p.m. UTC | #2
On 11/3/20 6:35 AM, Patrick Fu wrote:
> 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")
> 
> Signed-off-by: Patrick Fu <patrick.fu@intel.com>
> ---
>  lib/librte_vhost/virtio_net.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
> index 10dec5e54..6c5128665 100644
> --- a/lib/librte_vhost/virtio_net.c
> +++ b/lib/librte_vhost/virtio_net.c
> @@ -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;
> 

Applied to dpdk-next-virtio/main.

Thanks,
Maxime
  

Patch

diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index 10dec5e54..6c5128665 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -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;