From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 36A6EA0547; Wed, 20 Oct 2021 10:20:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F181040150; Wed, 20 Oct 2021 10:20:49 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 95AA840142 for ; Wed, 20 Oct 2021 10:20:48 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10142"; a="228994526" X-IronPort-AV: E=Sophos;i="5.87,166,1631602800"; d="scan'208";a="228994526" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2021 01:20:47 -0700 X-IronPort-AV: E=Sophos;i="5.87,166,1631602800"; d="scan'208";a="662153665" Received: from jofo1-mobl.ger.corp.intel.com (HELO bricha3-MOBL.ger.corp.intel.com) ([10.252.29.221]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 20 Oct 2021 01:20:45 -0700 Date: Wed, 20 Oct 2021 09:20:42 +0100 From: Bruce Richardson To: fengchengwen Cc: Kevin Laatz , dev@dpdk.org, thomas@monjalon.net, jerinj@marvell.com, conor.walsh@intel.com Message-ID: References: <20210827172048.558704-1-kevin.laatz@intel.com> <20211019141041.1890983-1-kevin.laatz@intel.com> <20211019141041.1890983-7-kevin.laatz@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [dpdk-dev] [PATCH v10 06/16] dma/idxd: add datapath structures 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" On Wed, Oct 20, 2021 at 03:44:28PM +0800, fengchengwen wrote: > On 2021/10/19 22:10, Kevin Laatz wrote: > > Add data structures required for the data path for IDXD devices. > > > > Signed-off-by: Bruce Richardson > > Signed-off-by: Kevin Laatz > > Reviewed-by: Conor Walsh > > --- > > drivers/dma/idxd/idxd_bus.c | 1 + > > drivers/dma/idxd/idxd_common.c | 33 +++++++++++++++++++++++++ > > drivers/dma/idxd/idxd_hw_defs.h | 41 ++++++++++++++++++++++++++++++++ > > drivers/dma/idxd/idxd_internal.h | 4 ++++ > > drivers/dma/idxd/idxd_pci.c | 2 ++ > > 5 files changed, 81 insertions(+) > > [snip] > > > +/** > > + * Hardware descriptor used by DSA hardware, for both bursts and > > + * for individual operations. > > + */ > > +struct idxd_hw_desc { > > + uint32_t pasid; > > + uint32_t op_flags; > > + rte_iova_t completion; > > + > > + RTE_STD_C11 > > + union { > > + rte_iova_t src; /* source address for copy ops etc. */ > > + rte_iova_t desc_addr; /* descriptor pointer for batch */ > > + }; > > + rte_iova_t dst; > > + > > + uint32_t size; /* length of data for op, or batch size */ > > + > > + uint16_t intr_handle; /* completion interrupt handle */ > > + > > + /* remaining 26 bytes are reserved */ > > + uint16_t __reserved[13]; > > The non-reserved take about 30+B, and the struct align 64, so the __reserved[13] could delete. > > It's a minor problem, so: > Reviewed-by: Chengwen Feng > There are actually cases where that reserved field makes a difference. If we go to initialize a descriptor as a local variable the compiler is required to initialize all unspecified fields to 0, which means that if we don't explicitly put in place those reserved fields those bytes will be uninitialized. Since the hardware requires all unused fields to be zero, we need to keep this field in place to simplify the code and save us having to do extra memsets to zero the unused space.