On 9/15/21 4:54 PM, David Marchand wrote:
> Caught by code review, this copy is unnecessary.
>
> Signed-off-by: David Marchand <david.march...@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.coque...@redhat.com>
Thanks,
Maxime