1 /******************************************************************************
3 * Copyright (c) 2019 Intel.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 *******************************************************************************/
20 * @brief Definitions and support functions to process XRAN packet
22 * @ingroup group_source_xran
23 * @author Intel Corporation
26 /* ORAN-WG4.CUS.0-v01.00 O-RAN Fronthaul Working Group
27 Control, User and Synchronization Plane Specification
31 * Layer common to data and control packets
41 #include <rte_common.h>
42 #include <rte_ether.h>
43 #include <rte_byteorder.h>
46 *****************************************************************************
49 * @defgroup xran_common_pkt XRAN Packet definitions and functions
53 * Definitions and support functions to process XRAN packet
54 *****************************************************************************/
56 #define ECPRI_MAX_PAYLOAD_SIZE 65535 /**< Max packet size taken in this implementation */
58 /* XRAN spec: For this encapsulation, either the eCPRI Ethertype or the IEEE 1914.3 Ethertype shall be use */
59 #define XRAN_ETHER_TYPE 0xAEFE /**< defined by eCPRI Specification V1.1 */
61 #define XRAN_ECPRI_VER 0x0001 /**< eCPRI protocol revision 3.1.3.1.1 */
62 #define XRAN_PAYLOAD_VER 0x0001 /**< Payload version 5.4.4.2 */
64 #define VLAN_ID 0 /**< Default Tag protocol identifier (TPID)*/
65 #define VLAN_PCP 7 /**< U-Plane and C-Plane only see Table 3 5 : Quality of service classes */
68 ******************************************************************************
69 * @ingroup xran_common_pkt
73 * as per eCPRI spec 3.2.4. Message Types
74 *****************************************************************************/
77 ECPRI_IQ_DATA = 0x00, /**< U-plane: IQ data */
78 ECPRI_BIT_SEQUENCE = 0x01, /* msg type is not supported */
79 ECPRI_RT_CONTROL_DATA = 0x02, /**< C-plane: Control */
81 /* Below msg types are not supported */
82 ECPRI_GEN_DATA_TRANSFER = 0x03,
83 ECPRI_REMOTE_MEM_ACCESS = 0x04,
84 ECPRI_DELAY_MEASUREMENT = 0x05,
85 ECPRI_REMOTE_RESET = 0x06,
86 ECPRI_EVENT_INDICATION = 0x07,
91 ******************************************************************************
92 * @ingroup xran_common_pkt
95 * see 3.1.3.1.7 ecpriSeqid (message identifier)
96 *****************************************************************************/
99 uint8_t seq_id:8; /**< Sequence ID */
100 uint8_t sub_seq_id:7; /**< Subsequence ID */
101 uint8_t e_bit:1; /**< E bit */
106 ******************************************************************************
107 * @ingroup xran_common_pkt
110 * Structure holds common eCPRI header as per
111 * Table 3 1 : eCPRI Transport Header Field Definitions
112 *****************************************************************************/
113 struct xran_ecpri_cmn_hdr
115 uint8_t ecpri_concat:1; /**< 3.1.3.1.3 eCPRI concatenation indicator */
116 uint8_t ecpri_resv:3; /**< 3.1.3.1.2 eCPRI reserved */
117 uint8_t ecpri_ver:4; /**< 3.1.3.1.1 eCPRI protocol revision, defined in XRAN_ECPRI_VER */
118 uint8_t ecpri_mesg_type; /**< 3.1.3.1.4 eCPRI message type, defined in ecpri_msg_type */
119 uint16_t ecpri_payl_size; /**< 3.1.3.1.5 eCPRI payload size, without common header and any padding bytes */
123 ******************************************************************************
124 * @ingroup xran_common_pkt
127 * Structure holds eCPRI transport header as per
128 * Table 3 1 : eCPRI Transport Header Field Definitions
129 *****************************************************************************/
130 struct xran_ecpri_hdr
132 struct xran_ecpri_cmn_hdr cmnhdr;
133 rte_be16_t ecpri_xtc_id; /**< 3.1.3.1.6 real time control data / IQ data transfer message series identifier */
134 struct ecpri_seq_id ecpri_seq_id; /**< 3.1.3.1.7 message identifier */
139 ******************************************************************************
140 * @ingroup xran_common_pkt
143 * Enum used to set xRAN packet data direction (gNB Tx/Rx 5.4.4.1)
145 *****************************************************************************/
148 XRAN_DIR_UL = 0, /**< UL direction */
149 XRAN_DIR_DL = 1, /**< DL direction */
154 ******************************************************************************
155 * @ingroup xran_common_pkt
158 * Structure holds components of radio application header
159 * 5.4.4 Coding of Information Elements - Application Layer, Common
160 * for U-plane as per 6.3.2 DL/UL Data
161 *****************************************************************************/
162 struct radio_app_common_hdr
165 uint8_t filter_id:4; /**< This parameter defines an index to the channel filter to be
166 used between IQ data and air interface, both in DL and UL.
167 For most physical channels filterIndex =0000b is used which
168 indexes the standard channel filter, e.g. 100MHz channel filter
169 for 100MHz nominal carrier bandwidth. (see 5.4.4.3 for more) */
170 uint8_t payl_ver:3; /**< This parameter defines the payload protocol version valid
171 for the following IEs in the application layer. In this version of
172 the specification payloadVersion=001b shall be used. */
173 uint8_t data_direction:1; /**< This parameter indicates the gNB data direction. */
176 uint8_t frame_id:8; /**< This parameter is a counter for 10 ms frames (wrapping period 2.56 seconds) */
183 uint16_t symb_id:6; /**< This parameter identifies the first symbol number within slot,
184 to which the information of this message is applies. */
185 uint16_t slot_id:6; /**< This parameter is the slot number within a 1ms sub-frame. All slots in
186 one sub-frame are counted by this parameter, slotId running from 0 to Nslot-1.
187 In this version of the specification the maximum Nslot=16, All
188 other values of the 6 bits are reserved for future use. */
189 uint16_t subframe_id:4; /**< This parameter is a counter for 1 ms sub-frames within 10ms frame. */
196 ******************************************************************************
197 * @ingroup xran_common_pkt
200 * This parameter defines the compression method and IQ bit width for the
201 * user data in the data section. This field is absent from U-Plane messages
202 * when the static IQ format and compression method is configured via the M-Plane.
203 * In this way a single compression method and IQ bit width is provided
204 * (per UL and DL, per LTE and NR) without adding more overhead to U-Plane messages.
205 *****************************************************************************/
206 struct compression_hdr
208 uint8_t ud_iq_width:4; /**< Bit width of each I and each Q
209 16 for udIqWidth=0, otherwise equals udIqWidth e.g. udIqWidth = 0000b means I and Q are each 16 bits wide;
210 e.g. udIQWidth = 0001b means I and Q are each 1 bit wide;
211 e.g. udIqWidth = 1111b means I and Q are each 15 bits wide
213 uint8_t ud_comp_meth:4;
214 /**< udCompMeth| compression method |udIqWidth meaning
215 ---------------+-----------------------------+--------------------------------------------
216 0000b | no compression |bitwidth of each uncompressed I and Q value
217 0001b | block floating point |bitwidth of each I and Q mantissa value
218 0010b | block scaling |bitwidth of each I and Q scaled value
219 0011b | mu-law |bitwidth of each compressed I and Q value
220 0100b | modulation compression |bitwidth of each compressed I and Q value
221 0100b - 1111b | reserved for future methods |depends on the specific compression method
226 ******************************************************************************
227 * @ingroup xran_common_pkt
230 * Structure holds common xran packet header
231 * 3.1.1 Ethernet Encapsulation
232 *****************************************************************************/
233 struct xran_pkt_comm_hdr
235 struct ether_hdr eth_hdr; /**< Ethernet Header */
236 struct xran_ecpri_hdr ecpri_hdr; /**< eCPRI Transport Header */