From patchwork Mon Mar 15 16:46:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Coquelin X-Patchwork-Id: 89152 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 3035EA054F; Mon, 15 Mar 2021 17:46:43 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3244D24271D; Mon, 15 Mar 2021 17:46:38 +0100 (CET) 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 BDF912426CB for ; Mon, 15 Mar 2021 17:46:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615826795; 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=rbItycB57lrXs2to2Vp7KD83iaYFbvcn6jULph45WA0=; b=O8AVJHxO6fKRSb6BPm+zvkv7t/eoCqMWkpscEaJc5hVWVlH2l+ZdwPrA+/XBxR3Yz6rFrr TlU3HpXw2eohaN4bNuytZjDf8x/TgVr+oo0S989C+KHbbz33iVJuxBDZKgCrGe4CgCalCp B738Zv8QOdhdMjzJ6XHRfs6W9hrBkSw= 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-521-ok5UiME9OtKq_9qIG2ZK_Q-1; Mon, 15 Mar 2021 12:46:30 -0400 X-MC-Unique: ok5UiME9OtKq_9qIG2ZK_Q-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 866DC760C6; Mon, 15 Mar 2021 16:46:29 +0000 (UTC) Received: from max-t490s.redhat.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id B13F5614ED; Mon, 15 Mar 2021 16:46:21 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, chenbo.xia@intel.com, amorenoz@redhat.com, david.marchand@redhat.com, olivier.matz@6wind.com, bnemeth@redhat.com Cc: Maxime Coquelin Date: Mon, 15 Mar 2021 17:46:15 +0100 Message-Id: <20210315164619.372575-1-maxime.coquelin@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=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [dpdk-dev] [PATCH v3 0/4] net/virtio: make virtqueue struct cache-friendly 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" This series optimizes the cache usage of virtqueue struct, by making a "fake" mbuf being dynamically allocated in Rx virtnet struct, by removing a useless virtuque pointer into the virtnet structs and by moving a few fields to pack holes. With these 3 patches, the virtqueue struct size goes from 576 bytes (9 cachelines) to 248 bytes (4 cachelines). Changes in v3: ============== - Use rte_zmalloc_socket for fake mbuf alloc (David) - Fix typos in commit messages - Remove superfluous pointer check befor freeing (David) - Fix checkpatch warnings Changes in v2: ============== - Rebase on latest main - Improve error path in virtio_init_queue - Fix various typos in commit messages Maxime Coquelin (4): net/virtio: remove reference to virtqueue in vrings net/virtio: improve queue init error path net/virtio: allocate fake mbuf in Rx queue net/virtio: pack virtqueue struct drivers/net/virtio/virtio_ethdev.c | 64 +++++++++++-------- drivers/net/virtio/virtio_rxtx.c | 37 +++++------ drivers/net/virtio/virtio_rxtx.h | 5 +- drivers/net/virtio/virtio_rxtx_packed.c | 4 +- drivers/net/virtio/virtio_rxtx_packed.h | 6 +- drivers/net/virtio/virtio_rxtx_packed_avx.h | 4 +- drivers/net/virtio/virtio_rxtx_simple.h | 2 +- .../net/virtio/virtio_rxtx_simple_altivec.c | 2 +- drivers/net/virtio/virtio_rxtx_simple_neon.c | 2 +- drivers/net/virtio/virtio_rxtx_simple_sse.c | 2 +- .../net/virtio/virtio_user/virtio_user_dev.c | 4 +- drivers/net/virtio/virtio_user_ethdev.c | 2 +- drivers/net/virtio/virtqueue.h | 24 ++++--- 13 files changed, 85 insertions(+), 73 deletions(-) Reviewed-by: David Marchand