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