[dpdk-dev] [PATCH v6 2/2] net: introduce IPv4 ihl and version fields
Ferruh Yigit
ferruh.yigit at intel.com
Thu Oct 14 17:11:14 CEST 2021
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.
More information about the dev
mailing list