On Mon, Jan 24, 2022 at 11:05 PM Thomas Monjalon <tho...@monjalon.net> wrote: > > 24/01/2022 15:36, Jerin Jacob: > > On Tue, Jan 18, 2022 at 9:01 PM Alexander Kozyrev <akozy...@nvidia.com> > > wrote: > > > +struct rte_flow_port_attr { > > > + /** > > > + * Version of the struct layout, should be 0. > > > + */ > > > + uint32_t version; > > > > Why version number? Across DPDK, we are using dynamic function > > versioning, I think, that would be sufficient for ABI versioning > > Function versioning is not ideal when the structure is accessed > in many places like many drivers and library functions. > > The idea of this version field (which can be a bitfield) > is to update it when some new features are added, > so the users of the struct can check if a feature is there > before trying to use it. > It means a bit more code in the functions, but avoid duplicating functions > as in function versioning. > > Another approach was suggested by Bruce, and applied to dmadev. > It is assuming we only add new fields at the end (no removal), > and focus on the size of the struct. > By passing sizeof as an extra parameter, the function knows > which fields are OK to use. > Example: http://code.dpdk.org/dpdk/v21.11/source/lib/dmadev/rte_dmadev.c#L476
+ @Richardson, Bruce Either approach is fine, No strong opinion. We can have one approach and use it across DPDK for consistency. > >