Front Haul Interface Library update to first seed code contribution
[o-du/phy.git] / fhi_lib / lib / api / xran_pkt.h
index 112ea41..69a17f2 100644 (file)
@@ -16,7 +16,6 @@
 *
 *******************************************************************************/
 
-
 /**
  * @brief Definitions and support functions to process XRAN packet
  * @file xran_pkt.h
@@ -24,7 +23,9 @@
  * @author Intel Corporation
  **/
 
-/* XRAN-FH.CUS.0-v02.01.03 xRAN Front haul Working Group Control, User and Synchronization Plane Specification */
+/* ORAN-WG4.CUS.0-v01.00 O-RAN Fronthaul Working Group
+                         Control, User and Synchronization Plane Specification
+*/
 
 /*
  * Layer common to data and control packets
 #ifndef _XRAN_PKT_H_
 #define _XRAN_PKT_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include <rte_common.h>
 #include <rte_ether.h>
 #include <rte_byteorder.h>
 
-
 /**
  *****************************************************************************
  * @file xran_pkt.h
@@ -92,9 +96,9 @@ enum ecpri_msg_type
  *****************************************************************************/
 struct ecpri_seq_id
 {
-    uint8_t seq_id:8; /**< Sequence ID */
-    uint8_t sub_seq_id:7; /**< Subsequence ID */
-    uint8_t e_bit:1;  /**< E bit */
+    uint8_t seq_id:8;       /**< Sequence ID */
+    uint8_t sub_seq_id:7;   /**< Subsequence ID */
+    uint8_t e_bit:1;        /**< E bit */
 } __rte_packed;
 
 
@@ -106,54 +110,13 @@ struct ecpri_seq_id
  *       Structure holds common eCPRI header as per
  *       Table 3 1 : eCPRI Transport Header Field Definitions
  *****************************************************************************/
-struct xran_ecpri_hdr
+struct xran_ecpri_cmn_hdr
 {
-    uint8_t ecpri_concat:1; /**< This parameter indicates when eCPRI concatenation is in use
-                            (allowing multiple eCPRI messages in a single Ethernet payload).
-                            NOTE: This parameter is part of the eCPRI common header. */
-    uint8_t ecpri_resv:3; /**< This parameter is reserved for eCPRI future use.
-                               NOTE: This parameter is part of the eCPRI common header. */
-    uint8_t ecpri_ver:4; /**< This parameter indicates the eCPRI protocol version.
-                              NOTE: This parameter is part of the eCPRI common header. */
-    uint8_t ecpri_mesg_type:8; /**< This parameter indicates the type of service conveyed by
-                               the message type. NOTE: This parameter is part of the eCPRI
-                               common header. NOTE: In this version of the specification,
-                               only values "0000 0000b" and "0000 0010b" and "0000 0101b" are used. */
-    rte_be16_t ecpri_payl_size:16; /**< This parameter is the size in bytes of the payload part
-                                    of the corresponding eCPRI message. It does not include any padding bytes
-                                    following the eCPRI message. The maximum supported payload size is 216-1,
-                                    but the actual size may be further limited by the maximum payload size of
-                                    the underlying transport network. NOTE: This parameter is part of the
-                                    eCPRI common header. */
-
-    rte_be16_t ecpri_xtc_id;  /**< 3.1.3.1.6 This parameter is a component_eAxC identifier (c_eAxC ID) and
-                            identifies the specific data flow associated with each C-Plane (ecpriRtcid) or
-                            U-Plane (ecpriPcid) message.  It is the analog of CPRI's "AxC" (antenna-carrier)
-                            value so is designated here as "eAxC" ("e" for "extended" to accommodate multiple
-                            bands and multiple component carriers).  In addition, the "eAxC" is divided into
-                            "component eAxC" parts (c_eAxC) because multiple lls-CU processors may contribute
-                            to a single eAxC and must be identified for correct data routing. */
-
-    struct ecpri_seq_id ecpri_seq_id; /**< This parameter provides unique message identification and ordering on
-        two different levels. The first octet of this parameter is the Sequence ID, which is used to identify ordering of
-        messages within an eAxC message stream.  The Sequence ID field increments and wraps independently for each U-Plane
-        eAxC DL, U-Plane eAxC UL, C-Plane eAxC DL, and C-Plane eAxC UL, even if they share the same eAxC ID.
-        The Sequence ID is used to verify that all messages are received and also to reorder messages that are received out of order.
-        The second octet of this parameter is the Subsequence ID. The Subsequence ID is used to verify ordering and implement
-        reordering when radio-transport-level (eCPRI or IEEE-1914.3) fragmentation occurs.
-        Radio-transport (eCPRI or IEEE-1914.3) fragmentation is a method of splitting U-plane messages containing one or
-        more sections whose length exceeds the maximum packet or message length of the underlying protocol.
-        The Subsequence ID field consists of a 7 bit Subsequence counter and a single bit field, called E-bit.
-        The Subsequence number increments starting from zero for each fragment of a U-plane message.  The E bit
-        is used to indicate the last message of the radio-transport level fragments.  It is always set to zero
-        except for the last message of the U-plane fragment. In the case of C-plane messages radio-transport
-        fragmentation is not allowed, therefore the Subsequence ID shall be set to zero, and the E bit set to one.
-        See Section 3.1.4 for a description of the fragmentation process.
-        NOTE: As an alternative to radio-transport-level fragmentation, application fragmentation can be implemented.
-        In this case the application can take the responsibility to ensure all transport messages are not too long
-        (fit within the necessary transport payload size).  When this "application layer fragmentation" is used,
-        the subsequence identifier shall always be set to "0", and the E-bit set to "1" (See Section 3.1.4). */
-
+    uint8_t     ecpri_concat:1;     /**< 3.1.3.1.3 eCPRI concatenation indicator */
+    uint8_t     ecpri_resv:3;       /**< 3.1.3.1.2 eCPRI reserved */
+    uint8_t     ecpri_ver:4;        /**< 3.1.3.1.1 eCPRI protocol revision, defined in XRAN_ECPRI_VER */
+    uint8_t     ecpri_mesg_type;    /**< 3.1.3.1.4 eCPRI message type, defined in ecpri_msg_type */
+    uint16_t    ecpri_payl_size;    /**< 3.1.3.1.5 eCPRI payload size, without common header and any padding bytes */
 } __rte_packed;
 
 /**
@@ -161,15 +124,16 @@ struct xran_ecpri_hdr
  * @ingroup xran_common_pkt
  *
  * @description
- *       Structure holds complete xran packet header
- *       3.1.1 Ethernet Encapsulation
+ *       Structure holds eCPRI transport header as per
+ *       Table 3 1 : eCPRI Transport Header Field Definitions
  *****************************************************************************/
-struct xran_pkt_hdr
+struct xran_ecpri_hdr
 {
-    struct ether_hdr eth_hdr; /**< Ethernet Header */
-    struct vlan_hdr vlan_hdr; /**< VLAN Header */
-    struct xran_ecpri_hdr ecpri_hdr; /**< eCPRI Transport Header */
-};
+    struct xran_ecpri_cmn_hdr cmnhdr;
+    rte_be16_t ecpri_xtc_id;            /**< 3.1.3.1.6 real time control data / IQ data transfer message series identifier */
+    struct ecpri_seq_id ecpri_seq_id;   /**< 3.1.3.1.7 message identifier */
+} __rte_packed;
+
 
 /**
  ******************************************************************************
@@ -258,4 +222,22 @@ struct compression_hdr
     */
 } __rte_packed;
 
+/**
+ ******************************************************************************
+ * @ingroup xran_common_pkt
+ *
+ * @description
+ *       Structure holds common xran packet header
+ *       3.1.1 Ethernet Encapsulation
+ *****************************************************************************/
+struct xran_pkt_comm_hdr
+{
+    struct ether_hdr eth_hdr; /**< Ethernet Header */
+    struct xran_ecpri_hdr ecpri_hdr; /**< eCPRI Transport Header */
+} __rte_packed;
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif