From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 652B5A09FD; Sun, 20 Dec 2020 22:18:58 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 94069CB6B; Sun, 20 Dec 2020 22:15:19 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by dpdk.org (Postfix) with ESMTP id C00B3CB2F for ; Sun, 20 Dec 2020 22:15:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608498916; 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: in-reply-to:in-reply-to:references:references; bh=EaACO0WLVfEf3dKUeWr2yKXmR4S9jM3xUr339HZePBk=; b=fzNwhdKBW0ktWqNzOCq7rJecADagA8H7tySONg70iA4DLGrspNbzK0gnFd+Ma9HTHdUf2n y85Zd9u9F+VwAqHt97E5fdwa87JIUb15SkqL5hUxi2V2/7E9TulmFgeAkLVV+N8R+RaSoe 0ccIGwY0rKUH5XabX1YMXK79ovyrXb4= 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-32-eL48fXAvP8mioocZs5Krjg-1; Sun, 20 Dec 2020 16:15:12 -0500 X-MC-Unique: eL48fXAvP8mioocZs5Krjg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F1BFB59; Sun, 20 Dec 2020 21:15:10 +0000 (UTC) Received: from max-t490s.redhat.com (unknown [10.36.110.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 14BC160C43; Sun, 20 Dec 2020 21:15:07 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, chenbo.xia@intel.com, olivier.matz@6wind.com, amorenoz@redhat.com, david.marchand@redhat.com Cc: Maxime Coquelin Date: Sun, 20 Dec 2020 22:13:39 +0100 Message-Id: <20201220211405.313012-15-maxime.coquelin@redhat.com> In-Reply-To: <20201220211405.313012-1-maxime.coquelin@redhat.com> References: <20201220211405.313012-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Subject: [dpdk-dev] [PATCH 14/40] net/virtio: pack virtio HW struct X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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 patch improves the virtio_hw struct packing, going from 88 down to 80 bytes with a 6 bytes hole in the end of the first cacheline. Fields only used in the slow path are placed in the end, so that hot path only uses the first cacheline. Signed-off-by: Maxime Coquelin --- drivers/net/virtio/virtio_pci.h | 45 ++++++++++++++++----------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h index 5629b37050..15f68f141c 100644 --- a/drivers/net/virtio/virtio_pci.h +++ b/drivers/net/virtio/virtio_pci.h @@ -246,26 +246,25 @@ struct virtio_pci_ops { struct virtio_net_config; struct virtio_hw { - struct virtnet_ctl *cvq; - uint64_t req_guest_features; - uint64_t guest_features; - uint32_t max_queue_pairs; - bool started; - uint16_t max_mtu; - uint16_t vtnet_hdr_size; - uint8_t vlan_strip; - uint8_t use_msix; - uint8_t use_vec_rx; - uint8_t use_vec_tx; - uint8_t use_inorder_rx; - uint8_t use_inorder_tx; - uint8_t weak_barriers; - bool has_tx_offload; - bool has_rx_offload; - uint16_t port_id; - uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; - uint32_t speed; /* link speed in MB */ - uint8_t duplex; + struct virtqueue **vqs; + uint64_t guest_features; + uint16_t vtnet_hdr_size; + uint8_t started; + uint8_t weak_barriers; + uint8_t vlan_strip; + uint8_t has_tx_offload; + uint8_t has_rx_offload; + uint8_t use_vec_rx; + uint8_t use_vec_tx; + uint8_t use_inorder_rx; + uint8_t use_inorder_tx; + uint8_t opened; + uint16_t port_id; + uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; + uint32_t speed; /* link speed in MB */ + uint8_t duplex; + uint8_t use_msix; + uint16_t max_mtu; /* * App management thread and virtio interrupt handler thread * both can change device state, this lock is meant to avoid @@ -273,9 +272,9 @@ struct virtio_hw { */ rte_spinlock_t state_lock; struct rte_mbuf **inject_pkts; - bool opened; - - struct virtqueue **vqs; + uint16_t max_queue_pairs; + uint64_t req_guest_features; + struct virtnet_ctl *cvq; }; struct virtio_pci_dev { -- 2.29.2