From 5ac9d766b535189301df3452368580ffa0d6ff97 Mon Sep 17 00:00:00 2001 From: David Marchand Date: Wed, 15 Sep 2021 16:54:47 +0200 Subject: [PATCH] vhost: rework RARP packet injection Caught by code review, this copy is unnecessary. Signed-off-by: David Marchand Reviewed-by: Maxime Coquelin Reviewed-by: Chenbo Xia --- lib/vhost/virtio_net.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c index ec2c91e7a7..e481906113 100644 --- a/lib/vhost/virtio_net.c +++ b/lib/vhost/virtio_net.c @@ -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; } @@ -3158,15 +3164,8 @@ out: 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; } -- 2.20.1