[v6,5/12] helper: add SCTP protocol header

Message ID 1534870807-18456-6-git-send-email-odpbot@yandex.ru
State New
Headers show
Series
  • SCTP checksums support
Related show

Commit Message

Github ODP bot Aug. 21, 2018, 5 p.m.
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
/** Email created from pull request 674 (lumag:sctp-checksum)
 ** https://github.com/Linaro/odp/pull/674
 ** Patch: https://github.com/Linaro/odp/pull/674.patch
 ** Base sha: f6c423a7d29e2c7d6d890cbc098a398d0d7e1288
 ** Merge commit sha: d4f772b36da26684194cb0452a01b8da1ba7e3e1
 **/
 helper/Makefile.am                   |  1 +
 helper/include/odp/helper/ip.h       |  2 ++
 helper/include/odp/helper/odph_api.h |  1 +
 helper/include/odp/helper/sctp.h     | 49 ++++++++++++++++++++++++++++
 4 files changed, 53 insertions(+)
 create mode 100644 helper/include/odp/helper/sctp.h

Patch

diff --git a/helper/Makefile.am b/helper/Makefile.am
index d1b0359cc..518a6a944 100644
--- a/helper/Makefile.am
+++ b/helper/Makefile.am
@@ -22,6 +22,7 @@  helperinclude_HEADERS = \
 		  include/odp/helper/odph_hashtable.h\
 		  include/odp/helper/odph_iplookuptable.h\
 		  include/odp/helper/odph_lineartable.h\
+		  include/odp/helper/sctp.h \
 		  include/odp/helper/strong_types.h\
 		  include/odp/helper/tcp.h\
 		  include/odp/helper/table.h\
diff --git a/helper/include/odp/helper/ip.h b/helper/include/odp/helper/ip.h
index cdc430627..b5bfed78c 100644
--- a/helper/include/odp/helper/ip.h
+++ b/helper/include/odp/helper/ip.h
@@ -259,6 +259,8 @@  typedef struct ODP_PACKED {
 #define ODPH_IPPROTO_AH      0x33 /**< Authentication Header (51) */
 #define ODPH_IPPROTO_ESP     0x32 /**< Encapsulating Security Payload (50) */
 #define ODPH_IPPROTO_ICMPV6  0x3A /**< Internet Control Message Protocol (58) */
+#define ODPH_IPPROTO_SCTP    0x84 /**< Stream Control Transmission protocol
+				       (132) */
 #define ODPH_IPPROTO_INVALID 0xFF /**< Reserved invalid by IANA */
 
 /**@}*/
diff --git a/helper/include/odp/helper/odph_api.h b/helper/include/odp/helper/odph_api.h
index 8ad8a27fe..d46ab2ad2 100644
--- a/helper/include/odp/helper/odph_api.h
+++ b/helper/include/odp/helper/odph_api.h
@@ -27,6 +27,7 @@  extern "C" {
 #include <odp/helper/ipsec.h>
 #include <odp/helper/odph_lineartable.h>
 #include <odp/helper/odph_iplookuptable.h>
+#include <odp/helper/sctp.h>
 #include <odp/helper/strong_types.h>
 #include <odp/helper/tcp.h>
 #include <odp/helper/table.h>
diff --git a/helper/include/odp/helper/sctp.h b/helper/include/odp/helper/sctp.h
new file mode 100644
index 000000000..c81bd6313
--- /dev/null
+++ b/helper/include/odp/helper/sctp.h
@@ -0,0 +1,49 @@ 
+/* Copyright (c) 2014-2018, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP SCTP header
+ */
+
+#ifndef ODPH_SCTP_H_
+#define ODPH_SCTP_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp_api.h>
+
+/** @addtogroup odph_header ODPH HEADER
+ *  @{
+ */
+
+/** SCTP header length */
+#define ODPH_SCTPHDR_LEN 12
+
+/** SCTP header */
+typedef struct ODP_PACKED {
+	odp_u16be_t src_port; /**< Source port */
+	odp_u16be_t dst_port; /**< Destination port */
+	odp_u32be_t tag;      /**< Verification tag */
+	odp_u32be_t chksum;   /**< SCTP header and data checksum */
+} odph_sctphdr_t;
+
+/** @internal Compile time assert */
+ODP_STATIC_ASSERT(sizeof(odph_sctphdr_t) == ODPH_SCTPHDR_LEN,
+		  "ODPH_SCTPHDR_T__SIZE_ERROR");
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif