[dpdk-dev] [PATCH v10 06/16] dma/idxd: add datapath structures
Bruce Richardson
bruce.richardson at intel.com
Wed Oct 20 10:20:42 CEST 2021
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 <bruce.richardson at intel.com>
> > Signed-off-by: Kevin Laatz <kevin.laatz at intel.com>
> > Reviewed-by: Conor Walsh <conor.walsh at intel.com>
> > ---
> > 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 <fengchengwen at huawei.com>
>
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.
More information about the dev
mailing list