[dpdk-dev] [PATCH v6 2/2] net: introduce IPv4 ihl and version fields
Gregory Etelson
getelson at nvidia.com
Thu Oct 14 19:42:41 CEST 2021
Hello Thomas,
> > > struct rte_ipv4_hdr {
> > > - uint8_t version_ihl; /**< version
> and header length */
> > > + __extension__
> > > + union {
> > > + uint8_t version_ihl; /**< version
> and header length */
> > > + struct {
> > > +#if RTE_BYTE_ORDER ==
> RTE_LITTLE_ENDIAN
> > > + uint8_t ihl:4; /**< header
> length */
> > > + uint8_t version:4; /**< version
> */
> > > +#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
> > > + uint8_t version:4; /**< version
> */
> > > + uint8_t ihl:4; /**< header
> length */
> > > +#else
> > > +#error "setup endian definition"
> > > +#endif
> >
> > Do we need the last 'else' part?
> > Although it is harmless to have it, other
> protocol headers for endianness
> > check doesn't have this part, so I think better
> to be consistent.
>
> In lib/eal/include/generic/rte_byteorder.h we
> already have
> #if !defined(RTE_BYTE_ORDER)
> #error Unknown endianness.
> #endif
>
> So indeed we don't need this last else part.
>
>
I updated the patch in v7.
Regards,
Gregory
More information about the dev
mailing list