From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 586A858D4 for ; Tue, 3 May 2016 02:42:58 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP; 02 May 2016 17:42:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,570,1455004800"; d="scan'208";a="967323219" Received: from yliu-dev.sh.intel.com ([10.239.67.162]) by orsmga002.jf.intel.com with ESMTP; 02 May 2016 17:42:56 -0700 From: Yuanhan Liu To: dev@dpdk.org Cc: huawei.xie@intel.com, Yuanhan Liu Date: Mon, 2 May 2016 17:46:18 -0700 Message-Id: <1462236378-7604-4-git-send-email-yuanhan.liu@linux.intel.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1462236378-7604-1-git-send-email-yuanhan.liu@linux.intel.com> References: <1462236378-7604-1-git-send-email-yuanhan.liu@linux.intel.com> Subject: [dpdk-dev] [PATCH 3/3] vhost: arrange virtio_net fields for better cache sharing X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 May 2016 00:42:58 -0000 the ifname[] field takes so much space, that it seperate some frequently used fields into different caches, say, features and broadcast_rarp. This patch move all those fields that will be accessed frequently in Rx/Tx together (before the ifname[] field) to let them share one cache line. Signed-off-by: Yuanhan Liu --- lib/librte_vhost/vhost-net.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/librte_vhost/vhost-net.h b/lib/librte_vhost/vhost-net.h index 9dec83c..3b0ffe7 100644 --- a/lib/librte_vhost/vhost-net.h +++ b/lib/librte_vhost/vhost-net.h @@ -123,16 +123,16 @@ struct virtio_net { int vid; uint32_t flags; uint16_t vhost_hlen; + /* to tell if we need broadcast rarp packet */ + rte_atomic16_t broadcast_rarp; + uint32_t virt_qp_nb; + struct vhost_virtqueue *virtqueue[VHOST_MAX_QUEUE_PAIRS * 2]; #define IF_NAME_SZ (PATH_MAX > IFNAMSIZ ? PATH_MAX : IFNAMSIZ) char ifname[IF_NAME_SZ]; - uint32_t virt_qp_nb; uint64_t log_size; uint64_t log_base; struct ether_addr mac; - /* to tell if we need broadcast rarp packet */ - rte_atomic16_t broadcast_rarp; - struct vhost_virtqueue *virtqueue[VHOST_MAX_QUEUE_PAIRS * 2]; } __rte_cache_aligned; /** -- 1.9.0