[EXT] Re: [PATCH] reorder: fix registration of dynamic field in mbuf
Volodymyr Fialko
vfialko at marvell.com
Mon Mar 13 18:29:24 CET 2023
> -----Original Message-----
> From: Stephen Hemminger <stephen at networkplumber.org>
> Sent: Monday, March 13, 2023 4:51 PM
> To: Volodymyr Fialko <vfialko at marvell.com>
> Cc: dev at dpdk.org; Reshma Pattan <reshma.pattan at intel.com>; David Marchand
> <david.marchand at redhat.com>; Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>; Jerin Jacob
> Kollanukkaran <jerinj at marvell.com>; Anoob Joseph <anoobj at marvell.com>
> Subject: [EXT] Re: [PATCH] reorder: fix registration of dynamic field in mbuf
>
> External Email
>
> ----------------------------------------------------------------------
> On Mon, 13 Mar 2023 10:34:50 +0100
> Volodymyr Fialko <vfialko at marvell.com> wrote:
>
> > +rte_reorder_dynf_register(void)
> > +{
> > + int ret;
> > +
> > + static const struct rte_mbuf_dynfield reorder_seqn_dynfield_desc = {
> > + .name = RTE_REORDER_SEQN_DYNFIELD_NAME,
> > + .size = sizeof(rte_reorder_seqn_t),
> > + .align = __alignof__(rte_reorder_seqn_t),
> > + };
> > +
>
> This does not need to be static, can just be on stack variable.
I agree, static is unnecessary here since the parameters will be copied to the internal storage during the register call.
So it can be on stack, but static sort of indicates/hints that this is one time initialization.
Also, static is present near every dynfield register in this codebase.
In fact, this patch simply moved the dynamic field declaration from create() to init() - static was already present.
Therefore, if the maintainers decide to remove static, it should be done in all other places too, it's not in scope of this patch.
More information about the dev
mailing list