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 This file provides public interface to xRAN Front Haul layer implementation as defined in the
\r
21 * ORAN-WG4.CUS.0-v01.00 spec. Implementation specific to
\r
22 * Lower Layer Split Central Unit (O-DU): a logical node that includes the eNB/gNB functions as
\r
23 * listed in section 2.1 split option 7-2x, excepting those functions allocated exclusively to the O-RU.
\r
24 * The O-DU controls the operation of O-RUs for 5G NR Radio Access technology
\r
26 * @file xran_fh_o_du.h
\r
27 * @ingroup group_lte_source_xran
\r
28 * @author Intel Corporation
\r
32 #ifndef _XRAN_FH_O_DU_H_
\r
33 #define _XRAN_FH_O_DU_H_
\r
43 #include <inttypes.h>
\r
44 #include <sys/types.h>
\r
45 #include <sys/queue.h>
\r
46 #include <netinet/in.h>
\r
54 #define XRAN_STATUS_SUCCESS (0)
\r
57 * Success status value. */
\r
58 #define XRAN_STATUS_FAIL (-1)
\r
61 * Fail status value. */
\r
63 #define XRAN_STATUS_RETRY (-2)
\r
66 * Retry status value. */
\r
68 #define XRAN_STATUS_RESOURCE (-3)
\r
71 * The resource that has been requested is unavailable. Refer
\r
72 * to relevant sections of the API for specifics on what the suggested
\r
73 * course of action is. */
\r
75 #define XRAN_STATUS_INVALID_PARAM (-4)
\r
78 * Invalid parameter has been passed in. */
\r
79 #define XRAN_STATUS_FATAL (-5)
\r
82 * A serious error has occurred. Recommended course of action
\r
83 * is to shutdown and restart the component. */
\r
85 #define XRAN_STATUS_UNSUPPORTED (-6)
\r
88 * The function is not supported, at least not with the specific
\r
89 * parameters supplied. This may be because a particular
\r
90 * capability is not supported by the current implementation. */
\r
92 #define XRAN_STATUS_INVALID_PACKET (-7)
\r
95 * Recevied packet does not have correct format. */
\r
97 /** Macro to calculate TTI number from symbol index used by timing thread */
\r
98 #define XranGetTtiNum(symIdx, numSymPerTti) (((uint32_t)symIdx / (uint32_t)numSymPerTti))
\r
99 /** Macro to calculate Symbol number for given slot from symbol index */
\r
100 #define XranGetSymNum(symIdx, numSymPerTti) (((uint32_t)symIdx % (uint32_t)numSymPerTti))
\r
101 /** Macro to calculate Frame number for given tti */
\r
102 #define XranGetFrameNum(tti,SFNatSecStart,numSubFramePerSystemFrame, numSlotPerSubFrame) ((((uint32_t)tti / ((uint32_t)numSubFramePerSystemFrame * (uint32_t)numSlotPerSubFrame)) + SFNatSecStart) & 0x3FF)
\r
103 /** Macro to calculate Subframe number for given tti */
\r
104 #define XranGetSubFrameNum(tti, numSlotPerSubFrame, numSubFramePerSystemFrame) (((uint32_t)tti/(uint32_t)numSlotPerSubFrame) % (uint32_t)numSubFramePerSystemFrame)
\r
105 /** Macro to calculate Slot number */
\r
106 #define XranGetSlotNum(tti, numSlotPerSfn) ((uint32_t)tti % ((uint32_t)numSlotPerSfn))
\r
108 #define XRAN_PORTS_NUM (1) /**< number of XRAN ports (aka O-RU devices) supported */
\r
109 #define XRAN_N_FE_BUF_LEN (40) /**< Number of TTIs (slots) */
\r
110 #define XRAN_MAX_SECTOR_NR (12) /**< Max sectors per XRAN port */
\r
111 #define XRAN_MAX_ANTENNA_NR (16) /**< Max number of extended Antenna-Carriers:
\r
112 a data flow for a single antenna (or spatial stream) for a single carrier in a single sector */
\r
114 /* see 10.2 Hierarchy of Radiation Structure in O-RU (assume TX and RX pannel are the same dimensions)*/
\r
115 #define XRAN_MAX_PANEL_NR (1) /**< Max number of Panels supported per O-RU */
\r
116 #define XRAN_MAX_TRX_ANTENNA_ARRAY (1) /**< Max number of TX and RX arrays per panel in O-RU */
\r
117 #define XRAN_MAX_ANT_ARRAY_ELM_NR (64) /**< Maximum number of Antenna Array Elemets in Antenna Array in the O-RU */
\r
121 #define XRAN_NUM_OF_SYMBOL_PER_SLOT (14) /**< Number of symbols per slot */
\r
122 #define XRAN_MAX_NUM_OF_SRS_SYMBOL_PER_SLOT XRAN_NUM_OF_SYMBOL_PER_SLOT /**< Max Number of SRS symbols per slot */
\r
123 #define XRAN_MAX_TDD_PERIODICITY (80) /**< Max TDD pattern period */
\r
124 #define XRAN_MAX_CELLS_PER_PORT (XRAN_MAX_SECTOR_NR) /**< Max cells mapped to XRAN port */
\r
125 #define XRAN_COMPONENT_CARRIERS_MAX (XRAN_MAX_SECTOR_NR) /**< number of CCs */
\r
126 #define XRAN_NUM_OF_ANT_RADIO (XRAN_MAX_SECTOR_NR*XRAN_MAX_ANTENNA_NR) /**< Max Number of Antennas supported for all CC on single XRAN port */
\r
127 #define XRAN_MAX_PRBS (275) /**< Max of PRBs per CC per antanna for 5G NR */
\r
129 #define XRAN_MAX_SECTIONS_PER_SYM (16) /**< Max number of different sections in single symbol (section is equal to RB allocation for UE) */
\r
131 #define XRAN_MAX_PKT_BURST (448+4) /**< 4x14x8 symbols per ms */
\r
132 #define XRAN_N_MAX_BUFFER_SEGMENT XRAN_MAX_PKT_BURST /**< Max number of segments per ms */
\r
134 #define XRAN_STRICT_PARM_CHECK (1) /**< enable parameter check for C-plane */
\r
136 /* Slot type definition */
\r
137 #define XRAN_SLOT_TYPE_INVALID (0) /**< invalid slot type */
\r
138 #define XRAN_SLOT_TYPE_DL (1) /**< DL slot */
\r
139 #define XRAN_SLOT_TYPE_UL (2) /**< UL slot */
\r
140 #define XRAN_SLOT_TYPE_SP (3) /**< Special slot */
\r
141 #define XRAN_SLOT_TYPE_FDD (4) /**< FDD slot */
\r
142 #define XRAN_SLOT_TYPE_LAST (5) /**< MAX slot */
\r
144 /* symbol type definition */
\r
145 #define XRAN_SYMBOL_TYPE_DL (0) /**< DL symbol */
\r
146 #define XRAN_SYMBOL_TYPE_UL (1) /**< UL symbol */
\r
147 #define XRAN_SYMBOL_TYPE_GUARD (2) /**< GUARD symbol */
\r
148 #define XRAN_SYMBOL_TYPE_FDD (3) /**< FDD symbol */
\r
150 #define XRAN_NUM_OF_SLOT_IN_TDD_LOOP (80)/**< MAX number of slot for TDD repetition */
\r
152 //#define _XRAN_DEBUG /**< Enable debug log */
\r
153 //#define _XRAN_VERBOSE /**< Enable verbose log */
\r
156 #define xran_log_dbg(fmt, ...) \
\r
158 "DEBUG: %s(%d): " fmt "\n", \
\r
160 __LINE__, ##__VA_ARGS__)
\r
162 #define xran_log_dbg(fmt, ...)
\r
165 #if defined(_XRAN_DEBUG) || defined(_XRAN_VERBOSE)
\r
166 #define xran_log_wrn(fmt, ...) \
\r
169 "WARNING: %s(%d): " fmt "\n", \
\r
171 __LINE__, ##__VA_ARGS__)
\r
173 #define xran_log_dbg(fmt, ...)
\r
174 #define xran_log_wrn(fmt, ...)
\r
177 #define xran_log_err(fmt, ...) \
\r
179 "ERROR: %s(%d): " fmt "\n", \
\r
181 __LINE__, ##__VA_ARGS__)
\r
183 enum XranFrameDuplexType
\r
185 XRAN_FDD = 0, XRAN_TDD
\r
196 ******************************************************************************
\r
200 * Compression Method 6.3.3.13, Table 6-43
\r
201 *****************************************************************************/
\r
202 enum xran_compression_method {
\r
203 XRAN_COMPMETHOD_NONE = 0,
\r
204 XRAN_COMPMETHOD_BLKFLOAT = 1,
\r
205 XRAN_COMPMETHOD_BLKSCALE = 2,
\r
206 XRAN_COMPMETHOD_ULAW = 3,
\r
207 XRAN_COMPMETHOD_MODULATION = 4,
\r
208 XRAN_COMPMETHOD_MAX
\r
212 ******************************************************************************
\r
216 * Callback function type for symbol packet enum
\r
217 *****************************************************************************/
\r
218 enum callback_to_phy_id
\r
220 XRAN_CB_TTI = 0, /**< callback on TTI boundary */
\r
221 XRAN_CB_HALF_SLOT_RX =1, /**< callback on half slot (sym 7) packet arrival*/
\r
222 XRAN_CB_FULL_SLOT_RX =2, /**< callback on full slot (sym 14) packet arrival */
\r
223 XRAN_CB_MAX /**< max number of callbacks */
\r
226 /** Beamforming type, enumerated as "frequency", "time" or "hybrid"
\r
227 section 10.4.2 Weight-based dynamic beamforming */
\r
228 enum xran_weight_based_beamforming_type {
\r
229 XRAN_BF_T_FREQUENCY = 0,
\r
230 XRAN_BF_T_TIME = 1,
\r
231 XRAN_BF_T_HYBRID = 2,
\r
235 typedef int32_t xran_status_t; /**< Xran status return value */
\r
237 /** callback function type for Symbol packet */
\r
238 typedef void (*xran_callback_sym_fn)(void*);
\r
240 /** Callback function type for TTI event */
\r
241 typedef int (*xran_fh_tti_callback_fn)(void*);
\r
243 /** Callback function type packet arrival from transport layer (ETH or IP) */
\r
244 typedef void (*xran_transport_callback_fn)(void*, xran_status_t);
\r
246 /** Callback functions to poll BBdev encoder */
\r
247 typedef int16_t (*phy_encoder_poll_fn)(void);
\r
249 /** Callback functions to poll BBdev secoder */
\r
250 typedef int16_t (*phy_decoder_poll_fn)(void);
\r
252 /** XRAN port enum */
\r
255 XRAN_UP_VF = 0, /**< port type for U-plane */
\r
256 XRAN_CP_VF, /**< port type for C-plane */
\r
260 /** XRAN category enum */
\r
263 XRAN_CATEGORY_A = 0,
\r
264 XRAN_CATEGORY_B = 1,
\r
268 /** type of beamforming */
\r
269 enum xran_beamforming_type
\r
271 XRAN_BEAM_ID_BASED = 0, /**< beam index based */
\r
272 XRAN_BEAM_WEIGHT, /**< beam forming weights */
\r
273 XRAN_BEAM_ATTRIBUTE, /**< beam index based */
\r
276 /** state of bbdev with xran */
\r
277 enum xran_bbdev_init
\r
279 XRAN_BBDEV_NOT_USED = -1, /**< BBDEV is disabled */
\r
280 XRAN_BBDEV_MODE_HW_OFF = 0, /**< BBDEV is enabled for SW sim mode */
\r
281 XRAN_BBDEV_MODE_HW_ON = 1, /**< BBDEV is enable for HW */
\r
282 XRAN_BBDEV_MODE_MAX
\r
285 /** callback return information */
\r
286 struct xran_cb_tag {
\r
292 /** DPDK IO configuration for XRAN layer */
\r
293 struct xran_io_cfg {
\r
294 uint8_t id; /**< should be (0) for O-DU or (1) O-RU (debug) */
\r
295 char *dpdk_dev[XRAN_VF_MAX]; /**< VFs devices */
\r
296 char *bbdev_dev[1]; /**< BBDev dev name */
\r
297 int32_t bbdev_mode; /**< DPDK for BBDev */
\r
298 int32_t core; /**< reservd */
\r
299 int32_t system_core; /**< reservd */
\r
300 int32_t pkt_proc_core; /**< reservd */
\r
301 int32_t pkt_aux_core; /**< reservd */
\r
302 int32_t timing_core; /**< core used by xRAN */
\r
303 int32_t port[XRAN_VF_MAX]; /**< VFs ports */
\r
306 /** XRAN spec section 3.1.3.1.6 ecpriRtcid / ecpriPcid define */
\r
307 struct xran_eaxcid_config {
\r
308 uint16_t mask_cuPortId; /**< Mask CU PortId */
\r
309 uint16_t mask_bandSectorId; /**< Mask Band */
\r
310 uint16_t mask_ccId; /**< Mask CC */
\r
311 uint16_t mask_ruPortId; /**< Mask RU Port ID */
\r
313 uint8_t bit_cuPortId; /**< bandsectorId + ccId + ruportId */
\r
314 uint8_t bit_bandSectorId; /**< ccId + ruPortId */
\r
315 uint8_t bit_ccId; /**< ruportId */
\r
316 uint8_t bit_ruPortId; /**< 0 */
\r
320 * XRAN Front haul interface initialization settings
\r
322 struct xran_fh_init {
\r
323 struct xran_io_cfg io_cfg;/**< DPDK IO for XRAN */
\r
324 struct xran_eaxcid_config eAxCId_conf; /**< config of ecpriRtcid/ecpriPcid */
\r
326 uint32_t dpdkBasebandFecMode; /**< DPDK Baseband FEC device mode (0-SW, 1-HW) */
\r
327 char *dpdkBasebandDevice; /**< DPDK Baseband device address */
\r
328 char *filePrefix; /**< DPDK prefix */
\r
330 uint32_t mtu; /**< maximum transmission unit (MTU) is the size of the largest protocol data unit (PDU) that can be communicated in a single
\r
331 xRAN network layer transaction. supported 1500 bytes and 9600 bytes (Jumbo Frame) */
\r
332 int8_t *p_o_du_addr; /**< O-DU Ethernet Mac Address */
\r
333 int8_t *p_o_ru_addr; /**< O-RU Ethernet Mac Address */
\r
335 uint16_t totalBfWeights;/**< The total number of beamforming weights on RU for extensions */
\r
337 uint16_t Tadv_cp_dl; /**< Table 2 7 : xRAN Delay Management Model Parameters */
\r
338 uint16_t T2a_min_cp_dl; /**< Table 2 7 : xRAN Delay Management Model Parameters */
\r
339 uint16_t T2a_max_cp_dl; /**< Table 2 7 : xRAN Delay Management Model Parameters */
\r
340 uint16_t T2a_min_cp_ul; /**< Table 2 7 : xRAN Delay Management Model Parameters */
\r
341 uint16_t T2a_max_cp_ul; /**< Table 2 7 : xRAN Delay Management Model Parameters */
\r
342 uint16_t T2a_min_up; /**< Table 2 7 : xRAN Delay Management Model Parameters */
\r
343 uint16_t T2a_max_up; /**< Table 2 7 : xRAN Delay Management Model Parameters */
\r
344 uint16_t Ta3_min; /**< Table 2 7 : xRAN Delay Management Model Parameters */
\r
345 uint16_t Ta3_max; /**< Table 2 7 : xRAN Delay Management Model Parameters */
\r
346 uint16_t T1a_min_cp_dl; /**< Table 2 7 : xRAN Delay Management Model Parameters */
\r
347 uint16_t T1a_max_cp_dl; /**< Table 2 7 : xRAN Delay Management Model Parameters */
\r
348 uint16_t T1a_min_cp_ul; /**< Table 2 7 : xRAN Delay Management Model Parameters */
\r
349 uint16_t T1a_max_cp_ul; /**< Table 2 7 : xRAN Delay Management Model Parameters */
\r
350 uint16_t T1a_min_up; /**< Table 2 7 : xRAN Delay Management Model Parameters */
\r
351 uint16_t T1a_max_up; /**< Table 2 7 : xRAN Delay Management Model Parameters */
\r
352 uint16_t Ta4_min; /**< Table 2 7 : xRAN Delay Management Model Parameters */
\r
353 uint16_t Ta4_max; /**< Table 2 7 : xRAN Delay Management Model Parameters */
\r
355 uint8_t enableCP; /**< enable C-plane */
\r
356 uint8_t prachEnable; /**< enable PRACH */
\r
357 uint8_t srsEnable; /**< enable SRS (Cat B specific) */
\r
358 uint8_t cp_vlan_tag; /**< C-plane vlan tag */
\r
359 uint8_t up_vlan_tag; /**< U-plane vlan tag */
\r
360 int32_t debugStop; /**< enable auto stop */
\r
361 int32_t debugStopCount; /**< enable auto stop after number of Tx packets */
\r
362 int32_t DynamicSectionEna; /**< enable dynamic C-Plane section allocation */
\r
363 int32_t GPS_Alpha; // refer to alpha as defined in section 9.7.2 of ORAN spec. this value should be alpha*(1/1.2288ns), range 0 - 1e7 (ns)
\r
364 int32_t GPS_Beta; //beta value as defined in section 9.7.2 of ORAN spec. range -32767 ~ +32767
\r
367 /** Beamforming waights for single stream for each PRBs given number of Antenna elements */
\r
368 struct xran_cp_bf_weight{
\r
369 int16_t nAntElmTRx; /**< num TRX for this allocation */
\r
370 int8_t* p_ext_section; /**< pointer to form extType */
\r
371 int16_t ext_section_sz; /**< extType section size */
\r
373 struct xran_cp_bf_attribute{
\r
376 struct xran_cp_bf_precoding{
\r
380 /** section descriptor for given number of PRBs used on U-plane packet creation */
\r
381 struct xran_section_desc {
\r
382 uint16_t section_id; /**< section id used for this element */
\r
384 int16_t iq_buffer_offset; /**< Offset in bytes for the content of IQs with in main symb buffer */
\r
385 int16_t iq_buffer_len; /**< Length in bytes for the content of IQs with in main symb buffer */
\r
387 uint8_t *pData; /**< optional pointer to data buffer */
\r
388 void *pCtrl; /**< optional poitner to mbuf */
\r
391 /** PRB element structure */
\r
392 struct xran_prb_elm {
\r
393 int16_t nRBStart; /**< start RB of RB allocation */
\r
394 int16_t nRBSize; /**< number of RBs used */
\r
395 int16_t nStartSymb; /**< start symbol ID */
\r
396 int16_t numSymb; /**< number of symbols */
\r
397 int16_t nBeamIndex; /**< beam index for given PRB */
\r
398 int16_t bf_weight_update; /** need to update beam weights or not */
\r
399 int16_t compMethod; /**< compression index for given PRB */
\r
400 int16_t iqWidth; /**< compression bit width for given PRB */
\r
401 int16_t BeamFormingType; /**< index based, weights based or attribute based beam forming*/
\r
403 struct xran_section_desc * p_sec_desc[XRAN_NUM_OF_SYMBOL_PER_SLOT]; /**< section desctiptors to U-plane data given RBs */
\r
404 struct xran_cp_bf_weight bf_weight; /**< beam forming information relevant for given RBs */
\r
407 struct xran_cp_bf_attribute bf_attribute;
\r
408 struct xran_cp_bf_precoding bf_precoding;
\r
412 /** PRB map structure */
\r
413 struct xran_prb_map {
\r
414 uint8_t dir; /**< DL or UL direction */
\r
415 uint8_t xran_port; /**< xran id of given RU [0-(XRAN_PORTS_NUM-1)] */
\r
416 uint16_t band_id; /**< xran band id */
\r
417 uint16_t cc_id; /**< componnent carrier id [0 - (XRAN_MAX_SECTOR_NR-1)] */
\r
418 uint16_t ru_port_id; /**< RU device antenna port id [0 - (XRAN_MAX_ANTENNA_NR-1) */
\r
419 uint16_t tti_id; /**< xRAN slot id [0 - (max tti-1)] */
\r
420 uint8_t start_sym_id; /**< start symbol Id [0-13] */
\r
421 uint32_t nPrbElm; /**< total number of PRB elements for given map [0- (XRAN_MAX_PRBS-1)] */
\r
422 struct xran_prb_elm prbMap[XRAN_MAX_PRBS];
\r
427 /* PRACH config required for XRAN based FH */
\r
428 struct xran_prach_config
\r
431 uint8_t nPrachConfIdx; /**< PRACH Configuration Index*/
\r
432 uint8_t nPrachSubcSpacing;
\r
433 /**< PRACH Sub-carrier spacing
\r
435 For below 6GHz the values indicate 15kHz or 30kHz
\r
436 For above 6GHz the values indicate 60kHz or 120kHz*/
\r
437 uint8_t nPrachZeroCorrConf; /**< PRACH zeroCorrelationZoneConfig */
\r
438 uint8_t nPrachRestrictSet; /**< PRACH restrictedSetConfig */
\r
439 uint16_t nPrachRootSeqIdx; /**< PRACH Root Sequence Index */
\r
440 uint16_t nPrachFreqStart; /**< PRACH prach-frequency-start */
\r
441 int32_t nPrachFreqOffset; /**< PRACH prach-frequency-offset */
\r
442 uint8_t nPrachFilterIdx; /**< PRACH Filter index */
\r
445 /**< SRS configuration required for XRAN based FH */
\r
446 struct xran_srs_config {
\r
447 uint16_t symbMask; /**< symbols used for SRS with in U/S slot [bits 0-13] */
\r
448 uint8_t eAxC_offset; /**< starting value of eAxC for SRS packets */
\r
451 /** XRAN slot configuration */
\r
452 struct xran_slot_config {
\r
453 uint8_t nSymbolType[XRAN_NUM_OF_SYMBOL_PER_SLOT]; /**< Defines the Symbol type for all 14 symbols in a slot. 0: DL, 1: UL, 2: Guard */
\r
454 uint8_t reserved[2];
\r
457 /** XRAN front haul frame config */
\r
458 struct xran_frame_config {
\r
459 uint8_t nFrameDuplexType; /**< Frame Duplex type: 0 -> FDD, 1 -> TDD */
\r
460 uint8_t nNumerology; /**< Numerology, determine sub carrier spacing, Value: 0->4
\r
461 0: 15khz, 1: 30khz, 2: 60khz
\r
462 3: 120khz, 4: 240khz */
\r
463 uint8_t nTddPeriod; /**< TDD period */
\r
464 struct xran_slot_config sSlotConfig[XRAN_MAX_TDD_PERIODICITY];
\r
465 /**< TDD Slot configuration - If nFrameDuplexType = TDD(1), then this config defines the slot config type for each slot.*/
\r
466 /* The number of slots need to be equal to nTddPeriod */
\r
469 /** XRAN-PHY interface byte order */
\r
470 enum xran_input_byte_order {
\r
471 XRAN_NE_BE_BYTE_ORDER = 0, /**< Network byte order (Big endian), xRAN lib doesn't do swap */
\r
472 XRAN_CPU_LE_BYTE_ORDER /**< CPU byte order (Little endian), xRAN lib does do swap */
\r
475 /** XRAN-PHY interface I and Q order */
\r
476 enum xran_input_i_q_order {
\r
477 XRAN_I_Q_ORDER = 0, /**< I , Q */
\r
478 XRAN_Q_I_ORDER /**< Q , I */
\r
481 /** XRAN front haul IQ compression settings */
\r
482 struct xran_ru_config {
\r
483 enum xran_category xranCat; /**< mode: Catergory A or Category B */
\r
485 uint8_t iqWidth; /**< IQ bit width */
\r
486 uint8_t compMeth; /**< Compression method */
\r
487 uint8_t fftSize; /**< FFT Size */
\r
488 enum xran_input_byte_order byteOrder; /**< Order of bytes in int16_t in buffer. Big or little endian */
\r
489 enum xran_input_i_q_order iqOrder; /**< order of IQs in the buffer */
\r
490 uint16_t xran_max_frame; /**< max frame number supported */
\r
495 * XRAN front haul general configuration */
\r
496 struct xran_fh_config {
\r
497 uint32_t dpdk_port; /**< DPDK port number used for FH */
\r
498 uint32_t sector_id; /**< Band sector ID for FH */
\r
499 uint32_t nCC; /**< number of Component carriers supported on FH */
\r
500 uint32_t neAxc; /**< number of eAxc supported on one CC*/
\r
501 uint32_t neAxcUl; /**< number of eAxc supported on one CC for UL direction */
\r
502 uint32_t nAntElmTRx; /**< Number of antenna elements for TX and RX */
\r
503 uint16_t nDLFftSize; /**< DL FFT size */
\r
504 uint16_t nULFftSize; /**< UL FFT size */
\r
505 uint16_t nDLRBs; /**< DL PRB */
\r
506 uint16_t nULRBs; /**< UL PRB */
\r
507 uint32_t nDLAbsFrePointA; /**< Abs Freq Point A of the Carrier Center Frequency for in KHz Value: 450000->52600000 */
\r
508 uint32_t nULAbsFrePointA; /**< Abs Freq Point A of the Carrier Center Frequency for in KHz Value: 450000->52600000 */
\r
509 uint32_t nDLCenterFreqARFCN; /**< center frerquency for DL in MHz */
\r
510 uint32_t nULCenterFreqARFCN; /**< center frerquency for UL in MHz */
\r
511 xran_fh_tti_callback_fn ttiCb; /**< call back for TTI event */
\r
512 void *ttiCbParam; /**< parameters of call back function */
\r
514 struct xran_prach_config prach_conf; /**< PRACH specific configurations for FH */
\r
515 struct xran_srs_config srs_conf; /**< SRS specific configurations for FH */
\r
516 struct xran_frame_config frame_conf; /**< frame config */
\r
517 struct xran_ru_config ru_conf; /**< config of RU as per XRAN spec */
\r
519 phy_encoder_poll_fn bbdev_enc; /**< call back to poll BBDev encoder */
\r
520 phy_decoder_poll_fn bbdev_dec; /**< call back to poll BBDev decoder */
\r
522 uint32_t log_level; /**< configuration of log level */
\r
527 * XRAN front haul statistic counters according to Table 7 1 : Common Counters for both DL and UL */
\r
528 struct xran_common_counters{
\r
529 uint64_t Rx_on_time; /**< Data was received on time (applies to user data reception window) */
\r
530 uint64_t Rx_early; /**< Data was received too early (applies to user data reception window) */
\r
531 uint64_t Rx_late; /**< Data was received too late (applies to user data reception window) */
\r
532 uint64_t Rx_corrupt; /**< Corrupt/Incorrect header packet */
\r
533 uint64_t Rx_pkt_dupl; /**< Duplicated packet */
\r
534 uint64_t Total_msgs_rcvd; /**< Total messages received (on all links) */
\r
539 * CC instance handle pointer type */
\r
540 typedef void * xran_cc_handle_t;
\r
543 *****************************************************************************
\r
547 * A flat buffer structure. The data pointer, pData, is a virtual address.
\r
548 * The API requires the memory to by physically contiguous. Each flat
\r
549 * buffer segment may contain several equally sized elements.
\r
551 *****************************************************************************/
\r
552 struct xran_flat_buffer
\r
554 uint32_t nElementLenInBytes;
\r
555 /**< The Element length specified in bytes.
\r
556 * This parameter specifies the size of a single element in the buffer.
\r
557 * The total size of the buffer is described as
\r
558 * bufferSize = nElementLenInBytes * nNumberOfElements */
\r
559 uint32_t nNumberOfElements;
\r
560 /**< The number of elements in the physical contiguous memory segment */
\r
561 uint32_t nOffsetInBytes;
\r
562 /**< Offset in bytes to the start of the data in the physical contiguous
\r
563 * memory segment */
\r
564 uint32_t nIsPhyAddr;
\r
566 /**< The data pointer is a virtual address, however the actual data pointed
\r
567 * to is required to be in contiguous physical memory unless the field
\r
568 requiresPhysicallyContiguousMemory in CpaInstanceInfo is false. */
\r
570 /**< pointer to control section coresponding to data buffer */
\r
574 *****************************************************************************
\r
576 * Scatter/Gather buffer list containing an array of Simple buffers.
\r
579 * A Scatter/Gather buffer list structure. It is expected that this buffer
\r
580 * structure will be used where more than one flat buffer can be provided
\r
581 * on a particular API.
\r
583 * IMPORTANT - The memory for the pPrivateMetaData member must be allocated
\r
584 * by the client as contiguous memory. When allocating memory for
\r
585 * pPrivateMetaData a call to cpaCyBufferListGetMetaSize MUST be made to
\r
586 * determine the size of the Meta Data Buffer. The returned size
\r
587 * (in bytes) may then be passed in a memory allocation routine to allocate
\r
588 * the pPrivateMetaData memory.
\r
590 *****************************************************************************/
\r
591 struct xran_buffer_list
\r
593 uint32_t nNumBuffers;
\r
594 /**< Number of pointers */
\r
595 struct xran_flat_buffer *pBuffers;
\r
596 /**< Pointer to an unbounded array containing the number of CpaFlatBuffers
\r
597 * defined by nNumBuffers */
\r
599 /**< This is an opaque field that is not read or modified internally. */
\r
600 void *pPrivateMetaData;
\r
601 /**< Private Meta representation of this buffer List - the memory for this
\r
602 * buffer needs to be allocated by the client as contiguous data.
\r
603 * The amount of memory required is returned with a call to
\r
604 * cpaCyBufferListGetMetaSize. If cpaCyBufferListGetMetaSize returns a size
\r
605 * of zero no memory needs to be allocated, and this parameter can be NULL.
\r
611 * Initialize the XRAN Layer via DPDK.
\r
614 * A non-negative value. If it is greater than 0, the array members
\r
615 * for argv[0] through argv[argc] (non-inclusive) shall contain pointers
\r
618 * An array of strings. The contents of the array, as well as the strings
\r
619 * which are pointed to by the array, may be modified by this function.
\r
623 * Error codes returned via rte_errno
\r
625 int32_t xran_init(int argc, char *argv[], struct xran_fh_init *p_xran_fh_init, char *appName, void ** pHandle);
\r
630 * Function returns handles for number of sectors supported by XRAN layer. Currently function
\r
631 * supports one handle XRAN layer where it supports only one CC
\r
634 * Pointer to XRAN layer handle
\r
635 * @param nNumInstances
\r
636 * total number of instances of CC
\r
637 * @param pSectorInstanceHandles
\r
638 * Pointer to xran_cc_handle_t where to store Handle pointer
\r
643 int32_t xran_sector_get_instances (void * pHandle, uint16_t nNumInstances,
\r
644 xran_cc_handle_t * pSectorInstanceHandles);
\r
649 * Function initialize Memory Management subsystem (mm) in order to handle memory buffers between XRAN layer
\r
653 * Pointer to XRAN layer handle for given CC
\r
654 * @param nMemorySize
\r
655 * memory size of all segments
\r
656 * @param nMemorySegmentSize
\r
657 * size of memory per segment
\r
662 int32_t xran_mm_init (void * pHandle, uint64_t nMemorySize, uint32_t nMemorySegmentSize);
\r
667 * Function allocates buffer memory (bm) used between XRAN layer and PHY. In general case it's DPDK mbuf.
\r
668 * it uses Memory Management system to get memory chunk and define memory pool on top of it.
\r
671 * Pointer to XRAN layer handle for given CC
\r
672 * @param nPoolIndex
\r
673 * pointer to buffer pool identification to be returned
\r
674 * @param nNumberOfBuffers
\r
675 * number of buffer to allocate in the pool
\r
676 * @param nBufferSize
\r
677 * buffer size to allocate
\r
682 int32_t xran_bm_init (void * pHandle, uint32_t * pPoolIndex, uint32_t nNumberOfBuffers, uint32_t nBufferSize);
\r
687 * Function allocates buffer used between XRAN layer and PHY. In general case it's DPDK mbuf.
\r
690 * Pointer to XRAN layer handle for given CC
\r
691 * @param nPoolIndex
\r
692 * buffer pool identification
\r
694 * Pointer to pointer where to store address of new buffer
\r
696 * Pointer to pointer where to store address of internal private control information
\r
702 int32_t xran_bm_allocate_buffer(void * pHandle, uint32_t nPoolIndex, void **ppData, void **ppCtrl);
\r
707 * Function frees buffer used between XRAN layer and PHY. In general case it's DPDK mbuf
\r
710 * Pointer to XRAN layer handle for given CC
\r
712 * Pointer to buffer
\r
714 * Pointer to internal private control information
\r
719 int32_t xran_bm_free_buffer(void * pHandle, void *pData, void *pCtrl);
\r
724 * Function destroys Memory Management (MM) layer of XRAN library
\r
727 * Pointer to XRAN layer handle for given CC
\r
732 int32_t xran_mm_destroy (void * pHandle);
\r
737 * Function configures TX(DL) and RX(UL) output buffers and callback (UL only) for XRAN layer with
\r
741 * Pointer to XRAN layer handle for given CC
\r
742 * @param pSrcBuffer
\r
743 * list of memory buffers to use to fetch IQs from PHY to XRAN layer (DL)
\r
744 * @param pSrcCpBuffer
\r
745 * list of memory buffers to use to configure C-plane (DL)
\r
746 * @param pDstBuffer
\r
747 * list of memory buffers to use to deliver IQs from XRAN layer to PHY (UL)
\r
748 * @param pDstCpBuffer
\r
749 * list of memory buffers to use to configure C-plane (UL)
\r
750 * @param xran_transport_callback_fn pCallback
\r
751 * Callback function to call with arrival of all packets for given CC for given symbol
\r
752 * @param pCallbackTag
\r
753 * Parameters of Callback function
\r
759 int32_t xran_5g_fronthault_config (void * pHandle,
\r
760 struct xran_buffer_list *pSrcBuffer[XRAN_MAX_ANTENNA_NR][XRAN_N_FE_BUF_LEN],
\r
761 struct xran_buffer_list *pSrcCpBuffer[XRAN_MAX_ANTENNA_NR][XRAN_N_FE_BUF_LEN],
\r
762 struct xran_buffer_list *pDstBuffer[XRAN_MAX_ANTENNA_NR][XRAN_N_FE_BUF_LEN],
\r
763 struct xran_buffer_list *pDstCpBuffer[XRAN_MAX_ANTENNA_NR][XRAN_N_FE_BUF_LEN],
\r
764 xran_transport_callback_fn pCallback,
\r
765 void *pCallbackTag);
\r
770 * Function configures PRACH output buffers and callback for XRAN layer with given handle
\r
773 * Pointer to XRAN layer handle for given CC
\r
774 * @param pDstBuffer
\r
775 * list of memory buffers to use to deliver PRACH IQs from xran layer to PHY
\r
776 * @param xran_transport_callback_fn pCallback
\r
777 * Callback function to call with arrival of PRACH packets for given CC
\r
778 * @param pCallbackTag
\r
779 * Parameters of Callback function
\r
785 int32_t xran_5g_prach_req (void * pHandle,
\r
786 struct xran_buffer_list *pDstBuffer[XRAN_MAX_ANTENNA_NR][XRAN_N_FE_BUF_LEN],
\r
787 xran_transport_callback_fn pCallback,
\r
788 void *pCallbackTag);
\r
793 * Function configures SRS output buffers and callback for XRAN layer with given handle
\r
796 * Pointer to XRAN layer handle for given CC
\r
797 * @param pDstBuffer
\r
798 * list of memory buffers to use to deliver SRS IQs from xran layer to PHY
\r
799 * @param xran_transport_callback_fn pCallback
\r
800 * Callback function to call with arrival of SRS packets for given CC
\r
801 * @param pCallbackTag
\r
802 * Parameters of Callback function
\r
808 int32_t xran_5g_srs_req (void * pHandle,
\r
809 struct xran_buffer_list *pDstBuffer[XRAN_MAX_ANT_ARRAY_ELM_NR][XRAN_N_FE_BUF_LEN],
\r
810 xran_transport_callback_fn pCallback,
\r
811 void *pCallbackTag);
\r
817 * Function returns XRAN core utilization stats
\r
819 * @param total_time (out)
\r
820 * Pointer to variable to store Total time thread has been running
\r
821 * @param used_time (out)
\r
822 * Pointer to variable to store Total time essential tasks have been running on the thread
\r
823 * @param core_used (out)
\r
824 * Pointer to variable to store Core on which the XRAN thread is running
\r
825 * @param clear (in)
\r
826 * If set to 1, then internal variables total_time and used_time are cleared
\r
831 uint32_t xran_get_time_stats(uint64_t *total_time, uint64_t *used_time, uint32_t *core_used, uint32_t clear);
\r
836 * Function opens XRAN layer with given handle
\r
839 * Pointer to XRAN layer handle for given CC
\r
840 * @param pointer to struct xran_fh_config pConf
\r
841 * Pointer to XRAN configuration structure with specific settings to use
\r
846 int32_t xran_open(void *pHandle, struct xran_fh_config* pConf);
\r
851 * Function starts XRAN layer with given handle
\r
854 * Pointer to XRAN layer handle for given CC
\r
859 int32_t xran_start(void *pHandle);
\r
864 * Function stops XRAN layer with given handle
\r
867 * Pointer to XRAN layer handle for given CC
\r
872 int32_t xran_stop(void *pHandle);
\r
877 * Function closes XRAN layer with given handle
\r
880 * Pointer to XRAN layer handle for given CC
\r
885 int32_t xran_close(void *pHandle);
\r
890 * Function registers callback to XRAN layer. Function support callbacks aligned on packet arrival.
\r
893 * Pointer to XRAN layer handle for given CC
\r
895 * pointer to callback function
\r
897 * pointer to Callback Function parameters
\r
899 * symbol to be register for
\r
901 * Antenna number to trigger callback for packet arrival
\r
904 * 0 - in case of success
\r
905 * -1 - in case of failure
\r
907 int32_t xran_reg_sym_cb(void *pHandle, xran_callback_sym_fn symCb, void * symCbParam, uint8_t symb, uint8_t ant);
\r
912 * Function registers callback to XRAN layer. Function support callbacks align to OTA time. TTI even, half of slot,
\r
913 * full slot with respect to PTP time.
\r
916 * Pointer to XRAN layer handle for given CC
\r
918 * pointer to callback function
\r
920 * pointer to Callback Function parameters
\r
921 * @param skipTtiNum
\r
922 * number of calls to be skipped before first call
\r
923 * @param callback_to_phy_id
\r
924 * call back time identification (see enum callback_to_phy_id)
\r
927 * 0 - in case of success
\r
928 * -1 - in case of failure
\r
930 int32_t xran_reg_physide_cb(void *pHandle, xran_fh_tti_callback_fn Cb, void *cbParam, int skipTtiNum, enum callback_to_phy_id);
\r
935 * Function returns current TTI, Frame, Subframe, Slot Number as seen "Over air" base on PTP time
\r
938 * Pointer to Frame number [0-99]
\r
940 * @param nSubframeIdx
\r
941 * Pointer to Subframe number [0-10]
\r
944 * Pointer to Slot number [0-7]
\r
947 * Pointer to current UTC second
\r
950 * current TTI number [0-7999]
\r
952 int32_t xran_get_slot_idx (uint32_t *nFrameIdx, uint32_t *nSubframeIdx, uint32_t *nSlotIdx, uint64_t *nSecond);
\r
957 * Function retrun XRAN layer common counters for given handle
\r
960 * Pointer to XRAN layer handle for given CC
\r
963 * Pointer to pointer of common counter structure
\r
968 int32_t xran_get_common_counters(void *pXranLayerHandle, struct xran_common_counters *pStats);
\r
974 * Function returns status of operation of FH layer
\r
977 * XRAN_INIT - init state
\r
978 * XRAN_RUNNING - running
\r
979 * XRAN_STOPPED - stopped
\r
981 enum xran_if_state xran_get_if_state(void);
\r
987 * Function allocates memory of given size from heap
\r
993 * ptr - to memory buffer or NULL
\r
995 void* xran_malloc(size_t buf_len);
\r
1001 * Function calculates offset for ptr according to ORAN headers requared
\r
1004 * pointer to be addjusted
\r
1006 * compression method according to enum xran_compression_method
\r
1009 * ptr - pointer to payload given header requared
\r
1011 uint8_t* xran_add_hdr_offset(uint8_t *dst, int16_t compMethod);
\r
1013 #ifdef __cplusplus
\r
1017 #endif /* _XRAN_FH_O_DU_H_*/
\r