From patchwork Wed Sep 15 14:54:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 98937 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6B568A0C41; Wed, 15 Sep 2021 16:55:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 21E2D4068F; Wed, 15 Sep 2021 16:55:05 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id E15794014F for ; Wed, 15 Sep 2021 16:55:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631717703; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YVGRISWxMJzO8qQJkmqY6EuGOy1v9B/le76ngZyXxyc=; b=Qn/hMt4BIVS8S+iVQwAr5+3zQbTLCBy5QRWK3u09BMKgsWYO/CoCyvGK7kBNEtIta5O+uN R/jVO9/s1xRzm/iyhGjpiU4DsrX9zTZ1QrjNZhlY/s+N8KR3eqKkpc4N1rOlPlNU+jjJ3B 3eicES73mlbEQn7734F/LDTGqenPcWA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-545-aeyCedoFMky3bp673PiC8A-1; Wed, 15 Sep 2021 10:55:01 -0400 X-MC-Unique: aeyCedoFMky3bp673PiC8A-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B6CEF10168C0; Wed, 15 Sep 2021 14:55:00 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.192.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id B6B45781EE; Wed, 15 Sep 2021 14:54:56 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: Maxime Coquelin , Chenbo Xia Date: Wed, 15 Sep 2021 16:54:47 +0200 Message-Id: <20210915145447.28481-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [dpdk-dev] [PATCH] vhost: rework RARP packet injection X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 | 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; }