diff mbox series

[v2,1/4] helper: add vxlan protocol header structure

Message ID 1513270810-29728-2-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [v2,1/4] helper: add vxlan protocol header structure | expand

Commit Message

Github ODP bot Dec. 14, 2017, 5 p.m. UTC
From: Balasubramanian Manoharan <bala.manoharan@linaro.org>


adds vxlan header protocol structure

Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>

---
/** Email created from pull request 345 (bala-manoharan:BUG2903)
 ** https://github.com/Linaro/odp/pull/345
 ** Patch: https://github.com/Linaro/odp/pull/345.patch
 ** Base sha: 6b5cdc77eb9759a2349b10372a964648559bc92c
 ** Merge commit sha: 65c561d30ea4c8c5f8ae17c2b407df9c6cc35f3d
 **/
 helper/include/odp/helper/odph_api.h             |  2 +-
 helper/include/odp/helper/vxlan.h                | 58 ++++++++++++++++++++++++
 platform/linux-generic/include/protocols/vxlan.h | 56 +++++++++++++++++++++++
 3 files changed, 115 insertions(+), 1 deletion(-)
 create mode 100644 helper/include/odp/helper/vxlan.h
 create mode 100644 platform/linux-generic/include/protocols/vxlan.h
diff mbox series

Patch

diff --git a/helper/include/odp/helper/odph_api.h b/helper/include/odp/helper/odph_api.h
index 7ed0e7786..4f38c58e7 100644
--- a/helper/include/odp/helper/odph_api.h
+++ b/helper/include/odp/helper/odph_api.h
@@ -32,7 +32,7 @@  extern "C" {
 #include <odp/helper/table.h>
 #include <odp/helper/threads.h>
 #include <odp/helper/udp.h>
-
+#include <odp/helper/vxlan.h>
 #ifdef __cplusplus
 }
 #endif
diff --git a/helper/include/odp/helper/vxlan.h b/helper/include/odp/helper/vxlan.h
new file mode 100644
index 000000000..cfe0a9aa4
--- /dev/null
+++ b/helper/include/odp/helper/vxlan.h
@@ -0,0 +1,58 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODPH VxLAN header
+ */
+
+#ifndef ODPH_VXLAN_H_
+#define ODPH_VXLAN_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp_api.h>
+
+/** @addtogroup odp_header ODP HEADER
+ *  @{
+ */
+
+/** VXLAN header length */
+#define ODPH_VXLANHDR_LEN 8
+
+/** VNI from VXLAN header format */
+#define ODPH_VXLAN_VNI(vxlan_vni) ((vxlan_vni & 0xffffff00) >> 8)
+
+/** UDP VXLAN destination port */
+#define ODPH_UDP_VXLAN_PORT 4789
+
+/** VNI to VXLAN header format */
+#define ODPH_VNI_VXLAN(vxlan_vni) (vxlan_vni << 8)
+
+/** VXLAN header */
+typedef struct ODP_PACKED {
+	uint8_t flags; /**< Vxlan flags */
+	uint8_t reserve1; /**< reserved bits */
+	uint16_t reseve2; /**< reserved bits */
+	odp_u32be_t vni; /**< VNI Identifier */
+} odph_vxlanhdr_t;
+
+/** @internal Compile time assert */
+ODP_STATIC_ASSERT(sizeof(odph_vxlanhdr_t) == ODPH_VXLANHDR_LEN,
+		  "ODPH_VXLANHDR_T__SIZE_ERROR");
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/protocols/vxlan.h b/platform/linux-generic/include/protocols/vxlan.h
new file mode 100644
index 000000000..b42e79097
--- /dev/null
+++ b/platform/linux-generic/include/protocols/vxlan.h
@@ -0,0 +1,56 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP VxLAN header
+ */
+
+#ifndef ODP_VXLAN_H_
+#define ODP_VXLAN_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp_api.h>
+
+/** @addtogroup odp_header ODP HEADER
+ *  @{
+ */
+
+/** VXLAN header length */
+#define _ODP_VXLANHDR_LEN 8
+
+/** VXLAN UDP destination port */
+#define _ODP_UDP_VXLAN_PORT 4789
+
+#define ODPH_VXLAN_VNI(vxlan_vni) ((vxlan_vni & 0xffffff00) >> 8)
+
+#define ODPH_VXLAN_BIT(vxlan_flag) (vxlan_flag & 0x08)
+
+/** UDP header */
+typedef struct ODP_PACKED {
+	uint8_t flags; /**< Vxlan flags */
+	uint8_t reserve1; /**< reserved bits */
+	uint16_t reseve2; /**< reserved bits */
+	odp_u32be_t vni; /**< VNI Identifier */
+} _odp_vxlanhdr_t;
+
+/** @internal Compile time assert */
+ODP_STATIC_ASSERT(sizeof(_odp_vxlanhdr_t) == _ODP_VXLANHDR_LEN,
+		  "_ODP_VXLANHDR_T__SIZE_ERROR");
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif