[dpdk-dev] [PATCH v2 03/10] net: clarify endianness of 32-bit fields in VXLAN headers
Ivan Malov
ivan.malov at oktetlabs.ru
Fri Mar 12 12:07:38 CET 2021
These fields have network byte order. Highlight it using dedicated type.
Signed-off-by: Ivan Malov <ivan.malov at oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton at xilinx.com>
---
lib/librte_net/rte_vxlan.h | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
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. */
--
2.20.1
More information about the dev
mailing list