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.

Reply via email to