From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 20A2B5908 for ; Tue, 3 May 2016 11:40:56 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP; 03 May 2016 02:40:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,572,1455004800"; d="scan'208";a="957738135" Received: from bricha3-mobl3.ger.corp.intel.com ([10.237.220.29]) by fmsmga001.fm.intel.com with SMTP; 03 May 2016 02:40:53 -0700 Received: by (sSMTP sendmail emulation); Tue, 03 May 2016 10:40:53 +0025 Date: Tue, 3 May 2016 10:40:53 +0100 From: Bruce Richardson To: Jerin Jacob Cc: dev@dpdk.org, thomas.monjalon@6wind.com Message-ID: <20160503094052.GA21300@bricha3-MOBL3> References: <1462176465-21562-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1462176465-21562-1-git-send-email-jerin.jacob@caviumnetworks.com> Organization: Intel Shannon Ltd. User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH] ethdev: make struct rte_eth_dev cache aligned 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 09:40:57 -0000 On Mon, May 02, 2016 at 01:37:45PM +0530, Jerin Jacob wrote: > Elements of struct rte_eth_dev used in the fast path. > Make struct rte_eth_dev cache aligned to avoid the cases where > rte_eth_dev elements share the same cache line with other structures. > > Signed-off-by: Jerin Jacob > --- > lib/librte_ether/rte_ethdev.c | 2 +- > lib/librte_ether/rte_ethdev.h | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c > index a31018e..04f492d 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -70,7 +70,7 @@ > #include "rte_ethdev.h" > > static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data"; > -struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS]; > +struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS] __rte_cache_aligned; > static struct rte_eth_dev_data *rte_eth_dev_data; > static uint8_t nb_ports; > > diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h > index 8519ff6..e359dda 100644 > --- a/lib/librte_ether/rte_ethdev.h > +++ b/lib/librte_ether/rte_ethdev.h > @@ -1630,7 +1630,7 @@ struct rte_eth_dev { > struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT]; > uint8_t attached; /**< Flag indicating the port is attached */ > enum rte_eth_dev_type dev_type; /**< Flag indicating the device type */ > -}; > +} __rte_cache_aligned; > > struct rte_eth_dev_sriov { > uint8_t active; /**< SRIOV is active with 16, 32 or 64 pools */ > -- Adding cache aligned in two places is overkill, I think. If the structure is marked as being cache aligned, there is no need to have the rte_eth_devices marked that way too. I suggest therefore just keeping the structure alignment. Regards, /Bruce