diff mbox series

[v2,05/15] vhost: remove async batch threshold

Message ID 20211026162904.482987-6-maxime.coquelin@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers show
Series vhost: clean-up and simplify async implementation | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Maxime Coquelin Oct. 26, 2021, 4:28 p.m. UTC
Reaching the async batch threshold was one of the condition
to trigger the DMA transfer. However, this condition was
never met since the threshold value is 32, same as the
MAX_PKT_BURST value.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 lib/vhost/virtio_net.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

Comments

Xia, Chenbo Oct. 29, 2021, 6:19 a.m. UTC | #1
> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Wednesday, October 27, 2021 12:29 AM
> To: dev@dpdk.org; Xia, Chenbo <chenbo.xia@intel.com>; Hu, Jiayu
> <jiayu.hu@intel.com>; Wang, YuanX <yuanx.wang@intel.com>; Ma, WenwuX
> <wenwux.ma@intel.com>; Richardson, Bruce <bruce.richardson@intel.com>;
> Mcnamara, John <john.mcnamara@intel.com>
> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
> Subject: [PATCH v2 05/15] vhost: remove async batch threshold
> 
> Reaching the async batch threshold was one of the condition
> to trigger the DMA transfer. However, this condition was
> never met since the threshold value is 32, same as the
> MAX_PKT_BURST value.
> 
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  lib/vhost/virtio_net.c | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
> index f0d923704a..c4a8b5276f 100644
> --- a/lib/vhost/virtio_net.c
> +++ b/lib/vhost/virtio_net.c
> @@ -25,8 +25,6 @@
> 
>  #define MAX_BATCH_LEN 256
> 
> -#define VHOST_ASYNC_BATCH_THRESHOLD 32
> -
>  static  __rte_always_inline bool
>  rxvq_is_mergeable(struct virtio_net *dev)
>  {
> @@ -1565,12 +1563,10 @@ virtio_dev_rx_async_submit_split(struct virtio_net
> *dev,
>  		vq->last_avail_idx += num_buffers;
> 
>  		/*
> -		 * conditions to trigger async device transfer:
> -		 * - buffered packet number reaches transfer threshold
> +		 * condition to trigger async device transfer:
>  		 * - unused async iov number is less than max vhost vector
>  		 */
> -		if (unlikely(pkt_burst_idx >= VHOST_ASYNC_BATCH_THRESHOLD ||
> -			(VHOST_MAX_ASYNC_VEC - iovec_idx < BUF_VECTOR_MAX))) {
> +		if (unlikely(VHOST_MAX_ASYNC_VEC - iovec_idx < BUF_VECTOR_MAX)) {
>  			n_xfer = async->ops.transfer_data(dev->vid,
>  					queue_id, tdes, 0, pkt_burst_idx);
>  			if (likely(n_xfer >= 0)) {
> @@ -1864,12 +1860,10 @@ virtio_dev_rx_async_submit_packed(struct virtio_net
> *dev,
>  		vq_inc_last_avail_packed(vq, num_descs);
> 
>  		/*
> -		 * conditions to trigger async device transfer:
> -		 * - buffered packet number reaches transfer threshold
> +		 * condition to trigger async device transfer:
>  		 * - unused async iov number is less than max vhost vector
>  		 */
> -		if (unlikely(pkt_burst_idx >= VHOST_ASYNC_BATCH_THRESHOLD ||
> -			(VHOST_MAX_ASYNC_VEC - iovec_idx < BUF_VECTOR_MAX))) {
> +		if (unlikely(VHOST_MAX_ASYNC_VEC - iovec_idx < BUF_VECTOR_MAX)) {
>  			n_xfer = async->ops.transfer_data(dev->vid,
>  					queue_id, tdes, 0, pkt_burst_idx);
>  			if (likely(n_xfer >= 0)) {
> --
> 2.31.1

Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
diff mbox series

Patch

diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
index f0d923704a..c4a8b5276f 100644
--- a/lib/vhost/virtio_net.c
+++ b/lib/vhost/virtio_net.c
@@ -25,8 +25,6 @@ 
 
 #define MAX_BATCH_LEN 256
 
-#define VHOST_ASYNC_BATCH_THRESHOLD 32
-
 static  __rte_always_inline bool
 rxvq_is_mergeable(struct virtio_net *dev)
 {
@@ -1565,12 +1563,10 @@  virtio_dev_rx_async_submit_split(struct virtio_net *dev,
 		vq->last_avail_idx += num_buffers;
 
 		/*
-		 * conditions to trigger async device transfer:
-		 * - buffered packet number reaches transfer threshold
+		 * condition to trigger async device transfer:
 		 * - unused async iov number is less than max vhost vector
 		 */
-		if (unlikely(pkt_burst_idx >= VHOST_ASYNC_BATCH_THRESHOLD ||
-			(VHOST_MAX_ASYNC_VEC - iovec_idx < BUF_VECTOR_MAX))) {
+		if (unlikely(VHOST_MAX_ASYNC_VEC - iovec_idx < BUF_VECTOR_MAX)) {
 			n_xfer = async->ops.transfer_data(dev->vid,
 					queue_id, tdes, 0, pkt_burst_idx);
 			if (likely(n_xfer >= 0)) {
@@ -1864,12 +1860,10 @@  virtio_dev_rx_async_submit_packed(struct virtio_net *dev,
 		vq_inc_last_avail_packed(vq, num_descs);
 
 		/*
-		 * conditions to trigger async device transfer:
-		 * - buffered packet number reaches transfer threshold
+		 * condition to trigger async device transfer:
 		 * - unused async iov number is less than max vhost vector
 		 */
-		if (unlikely(pkt_burst_idx >= VHOST_ASYNC_BATCH_THRESHOLD ||
-			(VHOST_MAX_ASYNC_VEC - iovec_idx < BUF_VECTOR_MAX))) {
+		if (unlikely(VHOST_MAX_ASYNC_VEC - iovec_idx < BUF_VECTOR_MAX)) {
 			n_xfer = async->ops.transfer_data(dev->vid,
 					queue_id, tdes, 0, pkt_burst_idx);
 			if (likely(n_xfer >= 0)) {