diff mbox series

vhost: rework RARP packet injection

Message ID 20210915145447.28481-1-david.marchand@redhat.com (mailing list archive)
State Accepted
Delegated to: Maxime Coquelin
Headers show
Series vhost: rework RARP packet injection | expand

Checks

Context Check Description
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/intel-Testing fail Testing issues
ci/Intel-compilation success Compilation OK
ci/iol-x86_64-unit-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/checkpatch success coding style OK

Commit Message

David Marchand Sept. 15, 2021, 2:54 p.m. UTC
Caught by code review, this copy is unnecessary.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/vhost/virtio_net.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

Comments

Maxime Coquelin Sept. 15, 2021, 7:51 p.m. UTC | #1
On 9/15/21 4:54 PM, David Marchand wrote:
> Caught by code review, this copy is unnecessary.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  lib/vhost/virtio_net.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
> index 8549afbbe1..1d30ad0fd9 100644
> --- a/lib/vhost/virtio_net.c
> +++ b/lib/vhost/virtio_net.c
> @@ -3364,6 +3364,8 @@ rte_vhost_dequeue_burst(int vid, uint16_t queue_id,
>  			count = 0;
>  			goto out;
>  		}
> +		pkts[0] = rarp_mbuf;
> +		pkts++;
>  		count -= 1;
>  	}
>  
> @@ -3386,15 +3388,8 @@ rte_vhost_dequeue_burst(int vid, uint16_t queue_id,
>  out_access_unlock:
>  	rte_spinlock_unlock(&vq->access_lock);
>  
> -	if (unlikely(rarp_mbuf != NULL)) {
> -		/*
> -		 * Inject it to the head of "pkts" array, so that switch's mac
> -		 * learning table will get updated first.
> -		 */
> -		memmove(&pkts[1], pkts, count * sizeof(struct rte_mbuf *));
> -		pkts[0] = rarp_mbuf;
> +	if (unlikely(rarp_mbuf != NULL))
>  		count += 1;
> -	}
>  
>  	return count;
>  }
> 

That's indeed much better!

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

Thanks,
Maxime
Xia, Chenbo Sept. 16, 2021, 1:40 a.m. UTC | #2
> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Wednesday, September 15, 2021 10:55 PM
> To: dev@dpdk.org
> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>; Xia, Chenbo
> <chenbo.xia@intel.com>
> Subject: [PATCH] vhost: rework RARP packet injection
> 
> Caught by code review, this copy is unnecessary.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  lib/vhost/virtio_net.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> --
> 2.23.0

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

Thanks!
Maxime Coquelin Sept. 28, 2021, 3:32 p.m. UTC | #3
On 9/15/21 16:54, David Marchand wrote:
> Caught by code review, this copy is unnecessary.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>   lib/vhost/virtio_net.c | 11 +++--------
>   1 file changed, 3 insertions(+), 8 deletions(-)
> 

Applied to dpdk-next-virtio/main.

Thanks,
Maxime
Maxime Coquelin Sept. 28, 2021, 7:23 p.m. UTC | #4
On 9/28/21 17:32, Maxime Coquelin wrote:
> 
> 
> On 9/15/21 16:54, David Marchand wrote:
>> Caught by code review, this copy is unnecessary.
>>
>> Signed-off-by: David Marchand <david.marchand@redhat.com>
>> ---
>>   lib/vhost/virtio_net.c | 11 +++--------
>>   1 file changed, 3 insertions(+), 8 deletions(-)
>>
> 
> Applied to dpdk-next-virtio/main.
> 
> Thanks,
> Maxime
> 

As you suggested on IRC, I added back the comment that got removed:

@@ -3136,6 +3136,12 @@ rte_vhost_dequeue_burst(int vid, uint16_t queue_id,
                         count = 0;
                         goto out;
                 }
+               /*
+                * Inject it to the head of "pkts" array, so that 
switch's mac
+                * learning table will get updated first.
+                */
+               pkts[0] = rarp_mbuf;
+               pkts++;
                 count -= 1;
         }

Regards,
Maxime
diff mbox series

Patch

diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
index 8549afbbe1..1d30ad0fd9 100644
--- a/lib/vhost/virtio_net.c
+++ b/lib/vhost/virtio_net.c
@@ -3364,6 +3364,8 @@  rte_vhost_dequeue_burst(int vid, uint16_t queue_id,
 			count = 0;
 			goto out;
 		}
+		pkts[0] = rarp_mbuf;
+		pkts++;
 		count -= 1;
 	}
 
@@ -3386,15 +3388,8 @@  rte_vhost_dequeue_burst(int vid, uint16_t queue_id,
 out_access_unlock:
 	rte_spinlock_unlock(&vq->access_lock);
 
-	if (unlikely(rarp_mbuf != NULL)) {
-		/*
-		 * Inject it to the head of "pkts" array, so that switch's mac
-		 * learning table will get updated first.
-		 */
-		memmove(&pkts[1], pkts, count * sizeof(struct rte_mbuf *));
-		pkts[0] = rarp_mbuf;
+	if (unlikely(rarp_mbuf != NULL))
 		count += 1;
-	}
 
 	return count;
 }