[dpdk-dev] [PATCH v6 2/2] net: introduce IPv4 ihl and version fields
Thomas Monjalon
thomas at monjalon.net
Thu Oct 14 18:04:24 CEST 2021
14/10/2021 17:11, Ferruh Yigit:
> On 10/13/2021 6:13 PM, Gregory Etelson wrote:
> > 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.
More information about the dev
mailing list