[PATCH v3] eventdev: ensure 16-byte alignment for events
Bruce Richardson
bruce.richardson at intel.com
Fri Oct 6 12:19:24 CEST 2023
On Fri, Oct 06, 2023 at 03:46:21PM +0530, Jerin Jacob wrote:
> On Fri, Oct 6, 2023 at 3:44 PM Morten Brørup <mb at smartsharesystems.com> wrote:
> >
> > > From: Bruce Richardson [mailto:bruce.richardson at intel.com]
> > > Sent: Friday, 6 October 2023 11.45
> > >
> > > The event structure in DPDK is 16-bytes in size, and events are
> > > regularly passed as parameters directly rather than being passed as
> > > pointers. To help compiler optimize correctly, we can explicitly request
> > > 16-byte alignment for events, which means that we should be able
> > > to do aligned vector loads/stores (e.g. with SSE or Neon) when working
> > > with those events.
> > >
> > > Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
> > > Acked-by: Morten Brørup <mb at smartsharesystems.com>
> > > Acked-by: Jerin Jacob <jerinj at marvell.com>
> > >
> > > ---
> >
> > [...]
> >
> > > +_Static_assert(sizeof(struct rte_event) == 16, "Event structure size is not 16-bytes in size");
> >
> > Thank you for adding this extra check. We should have more of these.
>
> Use existing RTE_BUILD_BUG_ON this on .c file instead of header file.
>
Ok to move to a C file, but I think using static_asserts are better than
using the old macro tricks of negatively sized arrays.
> >
> > NB: _Static_assert is deprecated in C23 [1], so for forward compatibility, you could use static_assert (which is available in <assert.h>) instead. Nice to have; feel free to ignore this comment.
> >
> > [1]: https://en.cppreference.com/w/c/language/_Static_assert
> >
More information about the dev
mailing list