diff mbox series

[03/10] net: clarify endianness of 32-bit fields in VXLAN headers

Message ID 20210312093143.28186-3-ivan.malov@oktetlabs.ru (mailing list archive)
State Superseded
Headers show
Series [01/10] ethdev: reuse header definition in flow pattern item ETH | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Ivan Malov March 12, 2021, 9:31 a.m. UTC
These fields have network byte order. Highlight it using dedicated type.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
---
 lib/librte_net/rte_vxlan.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/lib/librte_net/rte_vxlan.h b/lib/librte_net/rte_vxlan.h
index 2ad606165..929fa7a1d 100644
--- a/lib/librte_net/rte_vxlan.h
+++ b/lib/librte_net/rte_vxlan.h
@@ -13,6 +13,7 @@ 
 
 #include <stdint.h>
 
+#include <rte_byteorder.h>
 #include <rte_udp.h>
 
 
@@ -30,8 +31,8 @@  extern "C" {
  * Reserved fields (24 bits and 8 bits)
  */
 struct rte_vxlan_hdr {
-	uint32_t vx_flags; /**< flag (8) + Reserved (24). */
-	uint32_t vx_vni;   /**< VNI (24) + Reserved (8). */
+	rte_be32_t vx_flags; /**< flag (8) + Reserved (24). */
+	rte_be32_t vx_vni;   /**< VNI (24) + Reserved (8). */
 } __rte_packed;
 
 /** VXLAN tunnel header length. */
@@ -48,7 +49,7 @@  struct rte_vxlan_gpe_hdr {
 	uint8_t vx_flags;    /**< flag (8). */
 	uint8_t reserved[2]; /**< Reserved (16). */
 	uint8_t proto;       /**< next-protocol (8). */
-	uint32_t vx_vni;     /**< VNI (24) + Reserved (8). */
+	rte_be32_t vx_vni;   /**< VNI (24) + Reserved (8). */
 } __rte_packed;
 
 /** VXLAN-GPE tunnel header length. */