2e57169626748a02ae0d2484e7d68d7fdbb44fe5
[o-du/phy.git] / docs / xRAN-Library-Design_fh.rst
1 ..    Copyright (c) 2019 Intel
2 ..
3 ..  Licensed under the Apache License, Version 2.0 (the "License");
4 ..  you may not use this file except in compliance with the License.
5 ..  You may obtain a copy of the License at
6 ..
7 ..      http://www.apache.org/licenses/LICENSE-2.0
8 ..
9 ..  Unless required by applicable law or agreed to in writing, software
10 ..  distributed under the License is distributed on an "AS IS" BASIS,
11 ..  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 ..  See the License for the specific language governing permissions and
13 ..  limitations under the License.
14
15 .. |br| raw:: html
16
17    <br />
18
19 xRAN Library Design
20 ===================
21
22 .. contents::
23     :depth: 3
24     :local:
25
26 The xRAN Library consists of multiple modules where different
27 functionality is encapsulated. The complete list of all \*.c and \*.h
28 files as well as Makefile for xRAN (aka FHI Lib Bronze Release) release is:
29
30 ├── app
31
32 │   ├── dpdk.sh
33
34 │   ├── gen_test.m
35
36 │   ├── Makefile
37
38 │   ├── src
39
40 │   │   ├── common.c
41
42 │   │   ├── common.h
43
44 │   │   ├── config.c
45
46 │   │   ├── config.h
47
48 │   │   ├── debug.h
49
50 │   │   ├── sample-app.c
51
52 │   │   └── xran_mlog_task_id.h
53
54 │   └── usecase
55
56 │       ├── cat_b
57
58 │       ├── lte_a
59
60 │       ├── lte_b
61
62 │       ├── mu0_10mhz
63
64 │       ├── mu0_20mhz
65
66 │       ├── mu0_5mhz
67
68 │       ├── mu1_100mhz
69
70 │       └── mu3_100mhz
71
72 ├── banner.txt
73
74 ├── build.sh
75
76 ├── lib
77
78 │   ├── api
79
80 │   │   ├── xran_compression.h
81
82 │   │   ├── xran_compression.hpp
83
84 │   │   ├── xran_cp_api.h
85
86 │   │   ├── xran_fh_o_du.h
87
88 │   │   ├── xran_mlog_lnx.h
89
90 │   │   ├── xran_pkt_cp.h
91
92 │   │   ├── xran_pkt.h
93
94 │   │   ├── xran_pkt_up.h
95
96 │   │   ├── xran_sync_api.h
97
98 │   │   ├── xran_timer.h
99
100 │   │   ├── xran_transport.h
101
102 │   │   └── xran_up_api.h
103
104 │   ├── ethernet
105
106 │   │   ├── ethdi.c
107
108 │   │   ├── ethdi.h
109
110 │   │   ├── ethernet.c
111
112 │   │   └── ethernet.h
113
114 │   ├── Makefile
115
116 │   └── src
117
118 │       ├── xran_app_frag.c
119
120 │       ├── xran_app_frag.h
121
122 │       ├── xran_bfp_cplane16.cpp
123
124 │       ├── xran_bfp_cplane32.cpp
125
126 │       ├── xran_bfp_cplane64.cpp
127
128 │       ├── xran_bfp_cplane8.cpp
129
130 │       ├── xran_bfp_ref.cpp
131
132 │       ├── xran_bfp_utils.hpp
133
134 │       ├── xran_common.c
135
136 │       ├── xran_common.h
137
138 │       ├── xran_compression.cpp
139
140 │       ├── xran_cp_api.c
141
142 │       ├── xran_frame_struct.c
143
144 │       ├── xran_frame_struct.h
145
146 │       ├── xran_lib_mlog_tasks_id.h
147
148 │       ├── xran_main.c
149
150 │       ├── xran_printf.h
151
152 │       ├── xran_sync_api.c
153
154 │       ├── xran_timer.c
155
156 │       ├── xran_transport.c
157
158 │       ├── xran_ul_tables.c
159
160 │       └── xran_up_api.c
161
162 ├── Licenses.txt
163
164 ├── readme.md
165
166 └── test
167
168     ├── common
169     
170     │   ├── common.cpp
171     
172     │   ├── common.hpp
173     
174     │   ├── common_typedef_xran.h
175     
176     │   ├── json.hpp
177     
178     │   ├── MIT_License.txt
179     
180     │   ├── xranlib_unit_test_main.cc
181     
182     │   └── xran_lib_wrap.hpp
183     
184     ├── master.py
185     
186     ├── readme.txt
187     
188     └── test_xran
189     
190         ├── chain_tests.cc
191         
192         ├── compander_functional.cc
193         
194         ├── conf.json
195         
196         ├── c_plane_tests.cc
197         
198         ├── init_sys_functional.cc
199         
200         ├── Makefile
201         
202         ├── prach_functional.cc
203         
204         ├── prach_performance.cc
205         
206         ├── unittests.cc
207         
208         └── u_plane_functional.cc
209
210
211 General Introduction
212 --------------------
213
214 The xRAN Library functionality is broken down into two main sections:
215
216 -  XRAN specific packet handling (src)
217
218 -  Ethernet and supporting functionality (Ethernet)
219
220 External functions and structures are available via set of header files
221 in the API folder.
222
223 This library depends on DPDK primitives to perform Ethernet networking
224 in userspace, including initialization and control of Ethernet ports.
225 Ethernet ports are expected to be SRIOV virtual functions (VF) but also
226 can be physical functions (PF) as well.
227
228 This library is expected to be included in the project via
229 xran_fh_o_du.h, statically compiled and linked with the L1 application
230 as well as DPDK libraries. The xRAN packet processing-specific
231 functionality is encapsulated into this library and not exposed to the
232 rest of the 5G NR pipeline. 
233
234 This way, xRAN specific changes are decoupled from the 5G NR L1
235 pipeline. As a result, the design and implementation of the 5G L1
236 pipeline code and xRAN library can be done in parallel, provided the
237 defined interface is not modified.
238
239 Ethernet consists of two modules:
240
241 -  Ethernet implements xRAN specific HW Ethernet initialization, close,
242    send and receive
243
244 -  ethdi provides Ethernet level software primitives to handle xRAN
245    packet exchange
246
247 The xRAN layer implements the next set of functionalities:
248
249 -  Common code specific for both C-plane and U-plane as well as TX and
250    RX
251
252 -  Implementation of C-plane API available within the library and
253    externally
254
255 -  The primary function where general library initialization and
256    configuration performed
257
258 -  Module to provide the status of PTP synchronization
259
260 -  Timing module where system time is polled
261
262 -  eCPRI specific transport layer functions
263
264 -  APIs to handle U-plane packets
265
266 -  A set of utility modules for debugging (printf) and data tables are
267    included as well.
268
269 .. image:: images/Illustration-of-xRAN-Sublayers.jpg
270   :width: 600
271   :alt: Figure 24. Illustration of xRAN Sublayers
272
273 Figure 24. Illustration of xRAN Sublayers
274
275 A detailed description of functions and input/output arguments, as well
276 as key data structures, can be found in the Doxygen file for the FlexRAN
277 5G NR release. In this document supplemental information is provided
278 with respect to the overall design and implementation assumptions.
279
280 Initialization and Close
281 ------------------------
282
283 An example of the initialization sequence can be found in the sample
284 application code. It consists of the following steps:
285
286 1.Setup structure struct xran_fh_init according to configuration.
287
288 2.Call xran_init() to instantiate the xRAN lib memory model and
289 threads. The function returns a pointer to xRAN handle which is used
290 for consecutive configuration functions.
291
292 3.Initialize memory buffers used for L1 and xRAN exchange of
293 information.
294
295 4.Assign callback functions for (one) TTI event and for the reception
296 of half of the slot of symbols (7 symbols) and Full slot of symbols
297 14 symbols).
298
299 5.Call xran_open() to initialize PRACH configuration, initialize DPDK,
300 and launch xRAN timing thread.
301
302 6.Call xran_start() to start processing xRAN packets for DL and UL.
303
304 After this is complete 5G L1 runs with xRAN Front haul interface. During
305 run time for every TTI event, the corresponding call back is called. For
306 packet reception on UL direction, the corresponding call back is called.
307 OTA time information such as frame id, subframe id and slot id can be
308 obtained as result synchronization of the L1 pipeline to GPS time is
309 performed.
310
311 To stop and close the interface, perform this sequence of steps:
312
313 7.Call xran_stop() to stop the processing of DL and UL.
314
315 8.Call xran_close() to remove usage of xRAN resources.
316
317 9.Call xran_mm_destroy() to destroy memory management subsystem.
318
319 After this session is complete, a restart of the full L1 application is
320 required. The current version of the library does not support multiple
321 sessions without a restart of the full L1 application.
322
323 Configuration
324 ~~~~~~~~~~~~~
325
326 The xRAN library configuration is provided in the set of structures, such as struct xran_fh_init and struct xran_fh_config. 
327 The sample application gives an example of a test configuration used for LTE and 5GNR mmWave and Sub 6. Sample application
328 folder /app/usecase/ contains set of examples for different Radio Access technology  (LTE|5G NR), different category  (A|B)
329 and list of numerologies (0,1,3) and list of bandwidths (5,10,20,100Mhz).
330
331 Some configuration options are not used in the Bronze Release and are reserved
332 for future use.
333
334 The following options are available: 
335
336 **Structure** struct xran_fh_init\ **:**
337
338 -  Number of CC and corresponding settings for each
339
340 -  Core allocation for xRAN
341
342 -  Ethernet port allocation
343
344 -  O-DU and RU Ethernet Mac address
345
346 -  Timing constraints of O-DU and 0-RU
347
348 -  Debug features
349
350 **Structure** struct xran_fh_config\ **:**
351
352 -  Number of eAxC
353
354 -  TTI Callback function and parameters
355
356 -  PRACH 5G NR specific settings
357
358 -  TDD frame configuration
359
360 -  BBU specific configuration
361
362 -  RU specific configuration
363
364 **From an implementation perspective:**
365
366 xran_init() performs init of the xRAN library and interface according to
367 struct xran_fh_init information as per the start of application
368 configuration.:
369
370 -  Init DPDK with corresponding networking ports and core assignment
371
372 -  Init mbuf pools
373
374 -  Init DPDK timers and DPDK rings for internal packet processing
375
376 -  Instantiate ORAN FH thread doing
377
378    -  Timing processing (xran_timing_source_thread())
379
380    -  ETH PMD (process_dpdk_io())
381
382    -  IO XRAN-PHY exchange (ring_processing_func())
383
384 **xran_open()** performs additional configuration as per run scenario:
385
386 -  PRACH configuration
387
388 -  C-plane initialization
389
390 The Function **xran_close()** performs free of resources and allows potential
391 restart of front haul interface with a different scenario.
392
393 Start/Stop
394 ~~~~~~~~~~
395
396 The Functions **xran_start()/xran_stop()** enable/disable packet processing for
397 both DL and UL. This triggers execution of callbacks into the L1
398 application.
399
400 Data Exchange
401 ~~~~~~~~~~~~~
402
403 Exchange of IQ samples, as well as C-plane specific information, is
404 performed using a set of buffers allocated by xRAN library from DPDK
405 memory and shared with the l1 application. Buffers are allocated as a
406 standard mbuf structure and DPDK pools are used to manage the allocation
407 and free resources. Shared buffers are allocated at the init stage and
408 are expected to be reused within 80 TTIs (10 ms).
409
410 The xRAN protocol requires U-plane IQ data to be transferred in network
411 byte order, and the L1 application handles IQ sample data in CPU byte
412 order, requiring a swap. The PHY BBU pooling tasks perform copy and byte
413 order swap during packet processing.
414
415 C-plane Information Settings
416 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
417
418 The interface between the xRAN library and PHY is defined via struct
419 xran_prb_map and similar to the data plane. The same mbuf memory is used
420 to allocate memory map of PRBs for each TTI.
421
422 /\* Beamforming waights for single stream for each PRBs  given number of Antenna elements \*/
423 struct xran_cp_bf_weight{
424
425     int16_t nAntElmTRx;        /\*< num TRX for this allocation \*/
426     int8_t*  p_ext_start;      /\*< pointer to start of buffer for full C-plane packet \*/
427     int8_t*  p_ext_section;    /\*< pointer to form extType \*/
428     int16_t  ext_section_sz;   /\*< extType section size \*/
429
430 /\* section descriptor for given number of PRBs used on U-plane packet creation \*/
431 struct xran_section_desc {
432
433     uint16_t section_id; /\*< section id used for this element \*/
434
435     int16_t iq_buffer_offset;    /\*< Offset in bytes for the content of IQs with in main symb buffer \*/
436     int16_t iq_buffer_len;       /\*< Length in bytes for the content of IQs with in main symb buffer \*/
437
438     uint8_t \*pData;      /\*< optional pointer to data buffer \*/
439     void    \*pCtrl;      /\*< optional poitner to mbuf \*/
440     
441 };
442
443 struct xran_prb_elm {
444     int16_t nRBStart;    /\*< start RB of RB allocation \*/
445     int16_t nRBSize;     /\*< number of RBs used \*/
446     int16_t nStartSymb;  /\*< start symbol ID \*/
447     int16_t numSymb;     /\\*< number of symbols \*/
448     int16_t nBeamIndex;  /\*< beam index for given PRB \*/
449     int16_t bf_weight_update; /\* need to update beam weights or not \*/
450     int16_t compMethod;  /\*< compression index for given PRB \*/
451     int16_t iqWidth;     /\*< compression bit width for given PRB \*/
452     int16_t BeamFormingType; /\*< index based, weights based or attribute based beam forming\*/
453
454     struct xran_section_desc * p_sec_desc[XRAN_NUM_OF_SYMBOL_PER_SLOT]; /\*< section desctiptors to U-plane data given RBs \*/
455     struct xran_cp_bf_weight   bf_weight; /\*< beam forming information relevant for given RBs \*/
456
457     union {
458         struct xran_cp_bf_attribute bf_attribute;
459         struct xran_cp_bf_precoding bf_precoding;
460         
461     };
462     
463 /\* PRB map structure \*/
464
465 struct xran_prb_map {
466     uint8_t   dir;        /\*< DL or UL direction \*/
467     uint8_t   xran_port;  /\*< xran id of given RU [0-(XRAN_PORTS_NUM-1)] \*/
468     uint16_t  band_id;    /\*< xran band id \*/
469     uint16_t  cc_id;      /\*< componnent carrier id [0 - (XRAN_MAX_SECTOR_NR-1)] \*/
470     uint16_t  ru_port_id; /\*< RU device antenna port id [0 - (XRAN_MAX_ANTENNA_NR-1) \*/
471     uint16_t  tti_id;     /\*< xRAN slot id [0 - (max tti-1)] \*/
472     uint8_t   start_sym_id;     /\*< start symbol Id [0-13] \*/
473     uint32_t  nPrbElm;    /\*< total number of PRB elements for given map [0- (XRAN_MAX_PRBS-1)] \*/
474     struct xran_prb_elm prbMap[XRAN_MAX_PRBS];
475     
476 };
477
478
479 For the Bronze release C-plane sections are expected to be provided by L1
480 pipeline. If 100% of RBs always allocated single element of RB map
481 is expected to be allocated across all symbols. Dynamic RB allocation is
482 performed base on C-plane configuration.
483
484 The xRAN library will require that the content of the PRB map should be
485 sorted in increasing order of PRB first and then symbols.
486
487 Memory Management
488 -----------------
489
490 Memory used for the exchange of IQ data as well as control information,
491 is controlled by the xRAN library. L1 application at the init stage
492 performs:
493
494 -  init memory management subsystem
495
496 -  init buffer management subsystem (via DPDK pools)
497
498 -  allocate buffers (mbuf) for each CC, antenna, symbol, and direction \
499    (DL, UL, PRACH) for XRAN_N_FE_BUF_LEN TTIs.
500
501 -  buffers are reused for every XRAN_N_FE_BUF_LEN TTIs
502
503 After the session is completed, the application can free buffers and
504 destroy the memory management subsystem.
505
506 From an implementation perspective, the xRAN library uses a standard
507 mbuf primitive and allocates a pool of buffers for each sector. This
508 function is performed using rte_pktmbuf_pool_create(),
509 rte_pktmbuf_alloc(), rte_pktmbuf_append() to allocate one buffer per
510 symbol for the mmWave case. More information on mbuf and DPDK pools can
511 be found in the DPDK documentation.
512
513 In the current implementation, mbuf, the number of buffers shared with
514 the L1 application is the same number of buffers used to send to and
515 receive from the Ethernet port. Memory copy operations are not required
516 if the packet size is smaller than or equal to MTU. Future versions of
517 the xRAN library are required to remove the memory copy requirement for
518 packets where the size larger than MTU.
519
520 External Interface Memory
521 ~~~~~~~~~~~~~~~~~~~~~~~~~
522
523 The xRAN library header file defines a set of structures to simplify
524 access to memory buffers used for IQ data.
525
526 struct xran_flat_buffer {
527
528 uint32_t nElementLenInBytes;
529
530 uint32_t nNumberOfElements;
531
532 uint32_t nOffsetInBytes;
533
534 uint32_t nIsPhyAddr;
535
536 uint8_t \*pData;
537
538 void \*pCtrl;
539
540 };
541
542 struct xran_buffer_list {
543
544 uint32_t nNumBuffers;
545
546 struct xran_flat_buffer \*pBuffers;
547
548 void \*pUserData;
549
550 void \*pPrivateMetaData;
551
552 };
553
554 typedef struct {
555
556 int32_t bValid ;
557
558 int32_t nSegToBeGen;
559
560 int32_t nSegGenerated;
561
562 int32_t nSegTransferred;
563
564 struct rte_mbuf \*pData[N_MAX_BUFFER_SEGMENT];
565
566 struct xran_buffer_list sBufferList;
567
568 } BbuIoBufCtrlStruct;
569
570 There is no explicit requirement for user to organize a set of buffers
571 in this particular way. From a compatibility |br|
572 perspective it is useful to
573 follow the existing design of the 5G NR l1app used for Front Haul FPGA
574 and define structures shared between l1 and xRAN lib as shown:
575
576 /\* io struct \*/
577
578 BbuIoBufCtrlStruct
579 sFrontHaulTxBbuIoBufCtrl[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR]\
580 [XRAN_MAX_ANTENNA_NR];
581
582 BbuIoBufCtrlStruct
583 sFrontHaulTxPrbMapBbuIoBufCtrl[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR];
584
585 BbuIoBufCtrlStruct
586 sFrontHaulRxBbuIoBufCtrl[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR];
587
588 BbuIoBufCtrlStruct
589 sFrontHaulRxPrbMapBbuIoBufCtrl[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR];
590
591 BbuIoBufCtrlStruct
592 sFHPrachRxBbuIoBufCtrl[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR];
593
594 /\* Cat B \*/
595
596 BbuIoBufCtrlStruct
597 sFHSrsRxBbuIoBufCtrl[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANT_ARRAY_ELM_NR];
598
599 /\* buffers list \*/
600
601 struct xran_flat_buffer
602 sFrontHaulTxBuffers[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR][XRAN_NUM_OF_SYMBOL_PER_SLOT];
603
604 struct xran_flat_buffer
605 sFrontHaulTxPrbMapBuffers[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR][XRAN_NUM_OF_SYMBOL_PER_SLOT];
606
607 struct xran_flat_buffer
608 sFrontHaulRxBuffers[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR][XRAN_NUM_OF_SYMBOL_PER_SLOT];
609
610 struct xran_flat_buffer
611 sFrontHaulRxPrbMapBuffers[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR][XRAN_NUM_OF_SYMBOL_PER_SLOT];
612
613 struct xran_flat_buffer
614 sFHPrachRxBuffers[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR][XRAN_NUM_OF_SYMBOL_PER_SLOT];
615
616 /\* Cat B SRS buffers \*/
617
618 struct xran_flat_buffer
619 sFHSrsRxBuffers[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANT_ARRAY_ELM_NR][XRAN_MAX_NUM_OF_SRS_SYMBOL_PER_SLOT];
620
621 Doxygen file and xran_fh_o_du.h provide more details on the definition
622 and usage of these structures.
623
624 xRAN Specific Functionality
625 ---------------------------
626
627 Front haul interface implementation in the general case is abstracted
628 away using the interface defined in xran_fh_o_du.h
629
630 The L1 application is not required to access xRAN protocol primitives
631 (eCPRI header, application header, and others) directly. It is
632 recommended to use the interface to remove dependencies between
633 different software modules such as the l1 pipeline and xRAN library.
634
635 External API
636 ~~~~~~~~~~~~
637
638 The U-plane and C-plane APIs can be used directly from the application
639 if such an option is required. The set of header files can be exported
640 and called directly.
641
642 xran_fh_o_du.h – xRAN main header file for O-DU scenario
643
644 xran_cp_api.h – Control plane functions
645
646 xran_pkt_cp.h – xRAN control plane packet definition
647
648 xran_pkt.h – xRAN packet definition
649
650 xran_pkt_up.h – xRAN User plane packet definition
651
652 xran_sync_api.h – api functions to check PTP status
653
654 xran_timer.h – API for timing
655
656 xran_transport.h – eCPRI transport layer definition and api
657
658 xran_up_api.h – user plane functions and definitions
659
660 xran_compression.h – interface to compression/decompression functions
661
662 Doxygen files provide detailed information on functions and structures
663 available.
664
665 .. _c-plane-1:
666
667 C-plane
668 ~~~~~~~
669
670 Implementation of the C-plane set of functions is defined in
671 xran_cp_api.c and is used to prepare the content of C-plane packets
672 according to the given configuration. Users can enable/disable
673 generation of C-plane messages using enableCP field in struct
674 xran_fh_init structure during init of ORAN front haul. The time of
675 generation of C-plane message for DL and UL is done “Slot-based,” and
676 timing can be controlled using O-DU settings according to Table 4.
677
678 The C-plane module contains:
679
680 -  initialization of C-plane database to keep track of allocation of
681    resources
682
683 -  code to prepare C-plane packet for TX (O-DU)
684
685 -  eCPRI header
686
687 -  append radio application header
688
689 -  append control section header
690
691 -  append control section
692
693 -  parser of C-plane packet for RX (O-RU emulation)
694
695 -  parses and checks Section 1 and Section 3 packet content
696
697 Sending and receiving packets is performed using xRAN ethdi sublayer
698 functions.
699
700 Creating a C-Plane Packet
701 ^^^^^^^^^^^^^^^^^^^^^^^^^
702
703 API and Data Structures
704 '''''''''''''''''''''''
705
706 A C-Plane message can be composed using the following API:
707
708 int xran_prepare_ctrl_pkt(struct rte_mbuf \*mbuf,
709
710 struct xran_cp_gen_params \*params,
711
712 uint8_t CC_ID, uint8_t Ant_ID, uint8_t seq_id);
713
714 mbuf is the pointer of a DPDK packet buffer, which is allocated from the
715 caller.
716
717 params are the pointer of the structure which has the parameters to
718 create the message.
719
720 CC_ID is the parameter to specify component carrier index, Ant_ID is the
721 parameters to specify the antenna port index (RU port index).
722
723 seq_id is the sequence index for the message.
724
725 params, the parameters to create a C-Plane message are defined as the
726 structure of xran_cp_gen_params with an |br|
727 example given below:
728
729 struct xran_cp_gen_params {
730
731 uint8_t dir;
732
733 uint8_t sectionType;
734
735 uint16_t numSections;
736
737 struct xran_cp_header_params hdr;
738
739 struct xran_section_gen_info \*sections;
740
741 };
742
743 dir is the direction of the C-Plane message to be generated. Available
744 parameters are defined as XRAN_DIR_UL and XRAN_DIR_DL.
745
746 sectionType is the section type for C-Plane message to generate, as ORAN
747 specification defines all sections in a C-Plane message shall have the
748 same section type. If different section types are required, they shall
749 be sent with separate C-Plane messages. Available types of sections are
750 defined as XRAN_CP_SECTIONTYPE_x. Please refer to the Table 5-2 Section
751 Types in chapter 5.4 of ORAN specification.
752
753 numSections is the total number of sections to generate, i.e., the
754 number of the array in sections (struct xran_section_gen_info).
755
756 hdr is the structure to hold the information to generate the radio
757 application and section header in the C-Plane message. It is defined as
758 the structure of xran_cp_header_params. Not all parameters in this
759 structure are used for the generation, and the required parameters are
760 slightly different by the type of section, as described in Table 10 and
761 Table 11.
762
763 Table 10. struct xran_cp_header_params – Common Radio Application Header
764
765 +------------+---------------------------------------------+---------+
766 |            | Description                                 | Remarks |
767 +============+=============================================+=========+
768 | filterIdx  | Filter Index. Available values are defined  | 5.4.4.3 |
769 |            | as XRAN_FILTERINDEX_xxxxx.                  |         |
770 +------------+---------------------------------------------+---------+
771 | frameId    | Frame Index. It is modulo 256 of frame      | 5.4.4.4 |
772 |            | number.                                     |         |
773 +------------+---------------------------------------------+---------+
774 | subframeId | Sub-frame Index.                            | 5.4.4.5 |
775 +------------+---------------------------------------------+---------+
776 | slotId     | Slot Index. The maximum number is 15, as    | 5.4.4.6 |
777 |            | defined in the specification.               |         |
778 +------------+---------------------------------------------+---------+
779 | startSymId | Start Symbol Index.                         | 5.4.4.7 |
780 +------------+---------------------------------------------+---------+
781
782 Table 11. struct xran_cp_header_params – Section Specific Parameters
783
784 +----------+----------+----------+---------+---+---+---+---+----------+
785 |          | Des\     | Section  | Remarks |   |   |   |   |          |
786 |          | cription | Type     |         |   |   |   |   |          |
787 |          |          | ap\      |         |   |   |   |   |          |
788 |          |          | plicable |         |   |   |   |   |          |
789 +==========+==========+==========+=========+===+===+===+===+==========+
790 |          |          | 0        | 1       | 3 | 5 | 6 | 7 |          |
791 +----------+----------+----------+---------+---+---+---+---+----------+
792 | fftSize  | FFT size | X        |         | X |   |   |   | 5.4.4.13 |
793 |          | in frame |          |         |   |   |   |   |          |
794 |          | st\      |          |         |   |   |   |   |          |
795 |          | ructure. |          |         |   |   |   |   |          |
796 |          | A\       |          |         |   |   |   |   |          |
797 |          | vailable |          |         |   |   |   |   |          |
798 |          | values   |          |         |   |   |   |   |          |
799 |          | are      |          |         |   |   |   |   |          |
800 |          | defined  |          |         |   |   |   |   |          |
801 |          | as       |          |         |   |   |   |   |          |
802 |          | X\       |          |         |   |   |   |   |          |
803 |          | RAN_FFTS\|          |         |   |   |   |   |          |
804 |          | IZE_xxxx |          |         |   |   |   |   |          |
805 +----------+----------+----------+---------+---+---+---+---+----------+
806 | Scs      | Su\      | X        |         | X |   |   |   | 5.4.4.13 |
807 |          | bcarrier |          |         |   |   |   |   |          |
808 |          | Spacing  |          |         |   |   |   |   |          |
809 |          | in the   |          |         |   |   |   |   |          |
810 |          | frame    |          |         |   |   |   |   |          |
811 |          | st\      |          |         |   |   |   |   |          |
812 |          | ructure. |          |         |   |   |   |   |          |
813 |          | A\       |          |         |   |   |   |   |          |
814 |          | vailable |          |         |   |   |   |   |          |
815 |          | values   |          |         |   |   |   |   |          |
816 |          | are      |          |         |   |   |   |   |          |
817 |          | defined  |          |         |   |   |   |   |          |
818 |          | as       |          |         |   |   |   |   |          |
819 |          | XRAN_SCS\|          |         |   |   |   |   |          |          
820 |          | _xxxx    |          |         |   |   |   |   |          |
821 +----------+----------+----------+---------+---+---+---+---+----------+
822 | iqWidth  | I/Q bit  |          | X       | X | X |   |   | 5.4.4.10 |
823 |          | width in |          |         |   |   |   |   |          |
824 |          | user     |          |         |   |   |   |   | 6.3.3.13 |
825 |          | data     |          |         |   |   |   |   |          |
826 |          | com\     |          |         |   |   |   |   |          |
827 |          | pression |          |         |   |   |   |   |          |
828 |          | header.  |          |         |   |   |   |   |          |
829 |          | Should   |          |         |   |   |   |   |          |
830 |          | be set   |          |         |   |   |   |   |          |
831 |          | by zero  |          |         |   |   |   |   |          |
832 |          | for      |          |         |   |   |   |   |          |
833 |          | 16bits   |          |         |   |   |   |   |          |
834 +----------+----------+----------+---------+---+---+---+---+----------+
835 | compMeth | Com\     |          | X       | X | X |   |   | 5.4.4.10 |
836 |          | pression |          |         |   |   |   |   |          |
837 |          | Method   |          |         |   |   |   |   | 6.3.3.13 |
838 |          | in user  |          |         |   |   |   |   |          |
839 |          | data     |          |         |   |   |   |   |          |
840 |          | com\     |          |         |   |   |   |   |          |
841 |          | pression |          |         |   |   |   |   |          |
842 |          | header.  |          |         |   |   |   |   |          |
843 |          | A\       |          |         |   |   |   |   |          |
844 |          | vailable |          |         |   |   |   |   |          |
845 |          | values   |          |         |   |   |   |   |          |
846 |          | are      |          |         |   |   |   |   |          |
847 |          | defined  |          |         |   |   |   |   |          |
848 |          | as       |          |         |   |   |   |   |          |
849 |          | XRAN\    |          |         |   |   |   |   |          |
850 |          | _COMPMET\|          |         |   |   |   |   |          |
851 |          | HOD_xxxx |          |         |   |   |   |   |          |
852 +----------+----------+----------+---------+---+---+---+---+----------+
853 | numUEs   | Number   |          |         |   |   | X |   | 5.4.4.11 |
854 |          | of UEs.  |          |         |   |   |   |   |          |
855 |          | Applies  |          |         |   |   |   |   |          |
856 |          | to       |          |         |   |   |   |   |          |
857 |          | section  |          |         |   |   |   |   |          |
858 |          | type 6   |          |         |   |   |   |   |          |
859 |          | and not  |          |         |   |   |   |   |          |
860 |          | s\       |          |         |   |   |   |   |          |
861 |          | upported |          |         |   |   |   |   |          |
862 |          | in this  |          |         |   |   |   |   |          |
863 |          | release. |          |         |   |   |   |   |          |
864 +----------+----------+----------+---------+---+---+---+---+----------+
865 | ti\      | Time     | X        |         | X |   |   |   | 5.4.4.12 |
866 | meOffset | Offset.  |          |         |   |   |   |   |          |
867 |          | Time     |          |         |   |   |   |   |          |
868 |          | offset   |          |         |   |   |   |   |          |
869 |          | from the |          |         |   |   |   |   |          |
870 |          | start of |          |         |   |   |   |   |          |
871 |          | the slot |          |         |   |   |   |   |          |
872 |          | to start |          |         |   |   |   |   |          |
873 |          | of       |          |         |   |   |   |   |          |
874 |          | Cyclic   |          |         |   |   |   |   |          |
875 |          | Prefix.  |          |         |   |   |   |   |          |
876 +----------+----------+----------+---------+---+---+---+---+----------+
877 | cpLength | Cyclic   | X        |         | X |   |   |   | 5.4.4.14 |
878 |          | Prefix   |          |         |   |   |   |   |          |
879 |          | Length.  |          |         |   |   |   |   |          |
880 +----------+----------+----------+---------+---+---+---+---+----------+
881
882 **Only sections types 1 and 3 are supported in the current release.**
883
884 Sections are the pointer to the array of structure which has the
885 parameters for section(s) and it is defined as below:
886
887 struct xran_section_gen_info {
888
889 struct xran_section_info info;
890
891 uint32_t exDataSize;
892
893 struct {
894
895 uint16_t type;
896
897 uint16_t len;
898
899 void \*data;
900
901 } exData[XRAN_MAX_NUM_EXTENSIONS];
902
903 };
904
905 info is the structure to hold the information to generate section and it
906 is defined as the structure of xran_section_info. Like
907 xran_cp_header_params, all parameters are not required to generate
908 section and Table 12 describes which |br|
909 parameters are required for each
910 section.
911
912 Table 12. Parameters for Sections
913
914 +-------+-------+-------+-------+-------+-------+-------+-------+
915 |       | D\    | Se\   | Re\   |       |       |       |       |
916 |       | escri\| ction | marks |       |       |       |       |
917 |       | ption | Type  |       |       |       |       |       |
918 |       |       | appli\|       |       |       |       |       |
919 |       |       | cable |       |       |       |       |       |
920 +=======+=======+=======+=======+=======+=======+=======+=======+
921 |       |       | 0     | 1     | 3     | 5     | 6     |       |
922 +-------+-------+-------+-------+-------+-------+-------+-------+
923 | Id    | Se\   | **X** | **X** | **X** | **X** | **X** | 5.\   |
924 |       | ction |       |       |       |       |       | 4.5.1 |
925 |       | I\    |       |       |       |       |       |       |
926 |       | denti\|       |       |       |       |       |       |
927 |       | fier. |       |       |       |       |       |       |
928 +-------+-------+-------+-------+-------+-------+-------+-------+
929 | Rb    | Res\  | **X** | **X** | **X** | **X** | **X** | 5.\   |
930 |       | ource |       |       |       |       |       | 4.5.2 |
931 |       | Block\|       |       |       |       |       |       |
932 |       | Indic\|       |       |       |       |       |       |
933 |       | ator. |       |       |       |       |       |       |
934 |       | Avai\ |       |       |       |       |       |       |
935 |       | lable |       |       |       |       |       |       |
936 |       | v\    |       |       |       |       |       |       |
937 |       | alues |       |       |       |       |       |       |
938 |       | are   |       |       |       |       |       |       |
939 |       | de\   |       |       |       |       |       |       |
940 |       | fined |       |       |       |       |       |       |
941 |       | as    |       |       |       |       |       |       |
942 |       | XRAN\ |       |       |       |       |       |       |
943 |       | _\    |       |       |       |       |       |       |
944 |       | RBI\  |       |       |       |       |       |       |
945 |       | ND_xx\|       |       |       |       |       |       |
946 |       | xx.   |       |       |       |       |       |       |
947 +-------+-------+-------+-------+-------+-------+-------+-------+
948 | s\    | S\    | **X** | **X** | **X** | **X** | **X** | 5.\   |
949 | ymInc | ymbol |       |       |       |       |       | 4.5.3 |
950 |       | n\    |       |       |       |       |       |       |
951 |       | umber |       |       |       |       |       |       |
952 |       | Incr\ |       |       |       |       |       |       |
953 |       | ement |       |       |       |       |       |       |
954 |       | com\  |       |       |       |       |       |       |
955 |       | mand. |       |       |       |       |       |       |
956 |       | Avai\ |       |       |       |       |       |       |
957 |       | lable |       |       |       |       |       |       |
958 |       | v\    |       |       |       |       |       |       |
959 |       | alues |       |       |       |       |       |       |
960 |       | are   |       |       |       |       |       |       |
961 |       | de\   |       |       |       |       |       |       |
962 |       | fined |       |       |       |       |       |       |
963 |       | as    |       |       |       |       |       |       |
964 |       | XRA\  |       |       |       |       |       |       |
965 |       | N_SYM\|       |       |       |       |       |       |
966 |       | BOL\  |       |       |       |       |       |       |
967 |       | NUMBE\|       |       |       |       |       |       |
968 |       | R_xx\ |       |       |       |       |       |       |
969 |       | xx.   |       |       |       |       |       |       |
970 +-------+-------+-------+-------+-------+-------+-------+-------+
971 | star\ | Sta\  | **X** | **X** | **X** | **X** | **X** | 5.\   |
972 | tPrbc | rting\|       |       |       |       |       | 4.5.4 |
973 |       | PRB   |       |       |       |       |       |       |
974 |       | of    |       |       |       |       |       |       |
975 |       | data  |       |       |       |       |       |       |
976 |       | se\   |       |       |       |       |       |       |
977 |       | ction |       |       |       |       |       |       |
978 |       | de\   |       |       |       |       |       |       |
979 |       | scrip\|       |       |       |       |       |       |
980 |       | tion. |       |       |       |       |       |       |
981 +-------+-------+-------+-------+-------+-------+-------+-------+
982 | nu    | The   | **X** | **X** | **X** | **X** | **X** | 5.\   |
983 | mPrbc | n\    |       |       |       |       |       | 4.5.6 |
984 |       | umber |       |       |       |       |       |       |
985 |       | of    |       |       |       |       |       |       |
986 |       | conti\|       |       |       |       |       |       |
987 |       | guous |       |       |       |       |       |       |
988 |       | PRBs  |       |       |       |       |       |       |
989 |       | per   |       |       |       |       |       |       |
990 |       | data  |       |       |       |       |       |       |
991 |       | se\   |       |       |       |       |       |       |
992 |       | ction |       |       |       |       |       |       |
993 |       | de\   |       |       |       |       |       |       |
994 |       | scrip\|       |       |       |       |       |       |
995 |       | tion. |       |       |       |       |       |       |
996 |       | When  |       |       |       |       |       |       |
997 |       | nu\   |       |       |       |       |       |       |
998 |       | mPrbc |       |       |       |       |       |       |
999 |       | is    |       |       |       |       |       |       |
1000 |       | gr\   |       |       |       |       |       |       |
1001 |       | eater |       |       |       |       |       |       |
1002 |       | than  |       |       |       |       |       |       |
1003 |       | 255,  |       |       |       |       |       |       |
1004 |       | it    |       |       |       |       |       |       |
1005 |       | will  |       |       |       |       |       |       |
1006 |       | be    |       |       |       |       |       |       |
1007 |       | conv\ |       |       |       |       |       |       |
1008 |       | erted |       |       |       |       |       |       |
1009 |       | to    |       |       |       |       |       |       |
1010 |       | zero  |       |       |       |       |       |       |
1011 |       | by    |       |       |       |       |       |       |
1012 |       | the   |       |       |       |       |       |       |
1013 |       | macro |       |       |       |       |       |       |
1014 |       | (XR\  |       |       |       |       |       |       |
1015 |       | AN_CO\|       |       |       |       |       |       |
1016 |       | NVERT\|       |       |       |       |       |       |
1017 |       | _NUMP\|       |       |       |       |       |       |
1018 |       | RBC). |       |       |       |       |       |       |
1019 +-------+-------+-------+-------+-------+-------+-------+-------+
1020 | r\    | Res\  | **X** | **X** | **X** | **X** |       | 5.\   |
1021 | eMask | ource\|       |       |       |       |       | 4.5.5 |
1022 |       | El\   |       |       |       |       |       |       |
1023 |       | ement\|       |       |       |       |       |       |
1024 |       | Mask. |       |       |       |       |       |       |
1025 +-------+-------+-------+-------+-------+-------+-------+-------+
1026 | numS\ | N\    | **X** | **X** | **X** | **X** |       | 5.\   |
1027 | ymbol | umber |       |       |       |       |       | 4.5.7 |
1028 |       | of    |       |       |       |       |       |       |
1029 |       | Sym\  |       |       |       |       |       |       |
1030 |       | bols. |       |       |       |       |       |       |
1031 +-------+-------+-------+-------+-------+-------+-------+-------+
1032 | b\    | Beam\ |       | **X** | **X** |       |       | 5.\   |
1033 | eamId | I\    |       |       |       |       |       | 4.5.9 |
1034 |       | denti\|       |       |       |       |       |       |
1035 |       | fier. |       |       |       |       |       |       |
1036 +-------+-------+-------+-------+-------+-------+-------+-------+
1037 | freqO\| Freq\ |       |       | **X** |       |       | 5.4\  |
1038 | ffset | uency\|       |       |       |       |       | .5.11 |
1039 |       | Of\   |       |       |       |       |       |       |
1040 |       | fset. |       |       |       |       |       |       |
1041 +-------+-------+-------+-------+-------+-------+-------+-------+
1042 | ueId  | UE\   |       |       |       | **X** | **X** | 5.4\  |
1043 |       | i\    |       |       |       |       |       | .5.10 |
1044 |       | denti\|       |       |       |       |       |       |
1045 |       | fier. |       |       |       |       |       |       |
1046 |       | Not   |       |       |       |       |       |       |
1047 |       | supp\ |       |       |       |       |       |       |
1048 |       | orted |       |       |       |       |       |       |
1049 |       | in    |       |       |       |       |       |       |
1050 |       | this  |       |       |       |       |       |       |
1051 |       | rel\  |       |       |       |       |       |       |
1052 |       | ease. |       |       |       |       |       |       |
1053 +-------+-------+-------+-------+-------+-------+-------+-------+
1054 | regF\ | Regu\ |       |       |       |       | **X** | 5.4\  |
1055 | actor | lariz\|       |       |       |       |       | .5.12 |
1056 |       | ation |       |       |       |       |       |       |
1057 |       | Fa\   |       |       |       |       |       |       |
1058 |       | ctor. |       |       |       |       |       |       |
1059 |       | Not   |       |       |       |       |       |       |
1060 |       | supp\ |       |       |       |       |       |       |
1061 |       | orted |       |       |       |       |       |       |
1062 |       | in    |       |       |       |       |       |       |
1063 |       | this  |       |       |       |       |       |       |
1064 |       | re\   |       |       |       |       |       |       |
1065 |       | lease |       |       |       |       |       |       |
1066 +-------+-------+-------+-------+-------+-------+-------+-------+
1067 | Ef    | Exte\ |       | **X** | **X** | **X** | **X** | 5.\   |
1068 |       | nsion |       |       |       |       |       | 4.5.8 |
1069 |       | Flag. |       |       |       |       |       |       |
1070 |       | Not   |       |       |       |       |       |       |
1071 |       | supp\ |       |       |       |       |       |       |
1072 |       | orted |       |       |       |       |       |       |
1073 |       | in    |       |       |       |       |       |       |
1074 |       | this  |       |       |       |       |       |       |
1075 |       | rel\  |       |       |       |       |       |       |
1076 |       | ease. |       |       |       |       |       |       |
1077 +-------+-------+-------+-------+-------+-------+-------+-------+
1078
1079 **Only sections types 1 and 3 are supported in the current release.**
1080
1081 **The xran_section_info has more parameters – type, startSymId, iqWidth,
1082 compMeth. These are the same parameters as those of radio application
1083 or section header but need to be copied into this structure again for
1084 the section data base.**
1085
1086 exDataSize and exData are used to add section extensions for the
1087 section.
1088
1089 exDataSize is the number of elements in the exData array. The maximum
1090 number of elements is defined as XRAN_MAX_NUM_EXTENSIONS and it is
1091 defined by four in this release with the assumption that four different
1092 types of section extensions can be added to a section (section extension
1093 type 3 is excluded since it is not supported). exData.type is the type
1094 of section extension and exData.len is the length of structure of
1095 section extension parameter in exData.data. exData.data is the pointer
1096 to the structure of section extensions and different structures are used
1097 by the type of section extensions like below.
1098
1099 struct xran_sectionext1_info {
1100
1101 uint16_t rbNumber; /* number RBs to ext1 chain \*/
1102
1103 uint16_t bfwNumber; /* number of bf weights in this section \*/
1104
1105 uint8_t bfwiqWidth;
1106
1107 uint8_t bfwCompMeth;
1108
1109 int16_t \*p_bfwIQ; /* pointer to formed section extention \*/
1110
1111 int16_t bfwIQ_sz; /* size of buffer with section extention information
1112 \*/
1113
1114 union {
1115
1116 uint8_t exponent;
1117
1118 uint8_t blockScaler;
1119
1120 uint8_t compBitWidthShift;
1121
1122 uint8_t activeBeamspaceCoeffMask[XRAN_MAX_BFW_N]; /\* ceil(N/8)*8,
1123 should be multiple of 8 \*/
1124
1125 } bfwCompParam;
1126
1127 };
1128
1129 For section extension type 1, the structure of xran_sectionext1_info is
1130 used. Please note that the xRAN library will use bfwIQ (beamforming
1131 weight) as-is, i.e., xRAN library will not perform the compression, so
1132 the user should provide proper data to bfwIQ.
1133
1134 struct xran_sectionext2_info {
1135
1136 uint8_t bfAzPtWidth;
1137
1138 uint8_t bfAzPt;
1139
1140 uint8_t bfZePtWidth;
1141
1142 uint8_t bfZePt;
1143
1144 uint8_t bfAz3ddWidth;
1145
1146 uint8_t bfAz3dd;
1147
1148 uint8_t bfZe3ddWidth;
1149
1150 uint8_t bfZe3dd;
1151
1152 uint8_t bfAzSI;
1153
1154 uint8_t bfZeSI;
1155
1156 };
1157
1158 For section extension type 2, the structure of xran_sectionext2_info is
1159 used. Each parameter will be packed as specified bit width.
1160
1161 struct xran_sectionext4_info {
1162
1163 uint8_t csf;
1164
1165 uint8_t pad0;
1166
1167 uint16_t modCompScaler;
1168
1169 };
1170
1171 For section extension type 4, the structure of xran_sectionext4_info is
1172 used.
1173
1174 struct xran_sectionext5_info {
1175
1176 uint8_t num_sets;
1177
1178 struct {
1179
1180 uint16_t csf;
1181
1182 uint16_t mcScaleReMask;
1183
1184 uint16_t mcScaleOffset;
1185
1186 } mc[XRAN_MAX_MODCOMP_ADDPARMS];
1187
1188 };
1189
1190 For section extension type 5, the structure of xran_sectionext5_info is
1191 used. Please note that current implementation supports maximum two sets
1192 of additional parameters.
1193
1194 **Section extensions type 3 is not supported since it is LTE specific.**
1195
1196 Section Extensions are not fully verified in this release.
1197
1198 Detail Procedures in API
1199 ''''''''''''''''''''''''
1200
1201 xran_prepare_ctrl_pkt() has several procedures to compose a C-Plane
1202 packet.
1203
1204 1. Append transport header
1205
1206 -  Reserve eCPRI header space in the packet buffer
1207
1208 -  eCPRI version is fixed by XRAN_ECPRI_VER (0x0001)
1209
1210 -  Concatenation and transport layer fragmentation is not supported.
1211
1212    ecpri_concat=0, ecpri_seq_id.sub_seq_id=0 and ecpri_seq_id.e_bit=1
1213
1214 -  The caller needs to provide a component carrier index, antenna index,
1215    and message identifier through function arguments.
1216
1217    CC_ID, Ant_ID and seq_id
1218
1219 -  ecpriRtcid (ecpri_xtc_id) is composed with CC_ID and Ant_ID by
1220    xran_compose_cid.
1221
1222 -  DU port ID and band sector ID are fixed by zero in this release.
1223
1224 -  The output of xran_compose_cid is stored in network byte order.
1225
1226 -  The length of the payload is initialized by zero.
1227
1228 2. Append radio application header:
1229
1230 -  xran_append_radioapp_header() checks the type of section through
1231    params->sectionType and determines proper function to append
1232    remaining header components.
1233
1234 -  Only section type 1 and 3 are supported, returns
1235    XRAN_STATUS_INVALID_PARAM for other types.
1236
1237 -  Each section uses a different function to compose the remaining
1238    header and size to calculate the total length in the transport
1239    header.
1240
1241 For section type 1, xran_prepare_section1_hdr() and sizeof(struct
1242 xran_cp_radioapp_section1_header)
1243
1244 For section type 3, xran_prepare_section3_hdr() and sizeof(struct
1245 xran_cp_radioapp_section3_header)
1246
1247 -  Reserves the space of common radio application header and composes
1248    header by xran_prepare_radioapp_common_header().
1249
1250 -  The header is stored in network byte order.
1251
1252 -  Appends remaining header components by the selected function above
1253
1254 -  The header is stored in network byte order
1255
1256 3. Append section header and section
1257
1258 -  xran_append_control_section() determines proper size and function to
1259    append section header and contents.
1260
1261 -  For section type 1, xran_prepare_section1() and sizeof(struct
1262    xran_cp_radioapp_section1)
1263
1264 -  For section type 3, xran_prepare_section3() and sizeof(struct
1265    xran_cp_radioapp_section3)
1266
1267 -  Appends section header and section(s) by selected function above.
1268
1269 -  If multiple sections are configured, then those will be added.
1270
1271 -  Since fragmentation is not considered in this implementation, the
1272    total length of a single C-Plane message shall not exceed MTU
1273    size.
1274
1275 -  The header and section(s) are stored in network byte order.
1276
1277 -  Appends section extensions if it is set (ef=1)
1278
1279 -  xran_append_section_extensions() adds all configured extensions by
1280    its type.
1281
1282 -  xran_prepare_sectionext_x() (x = 1,2,4,5) will be called by the
1283    type from xran_append_section_extensions() and these functions
1284    will create extension field.
1285
1286 **Example Usage of API**
1287 ''''''''''''''''''''''''
1288
1289 There are two reference usages of API to generate C-Plane message in
1290 lib/src/xran_common.c
1291
1292 -  generate_cpmsg_dlul()
1293
1294 -  generate_cpmsg_prach()
1295
1296 generate_cpmsg_dlul() is to generate the C-Plane message with section
1297 type 1 for DL or UL symbol data scheduling.
1298
1299 This function has hardcoded values for some parameters such as:
1300
1301 -  The filter index is fixed to XRAN_FILTERINDEX_STANDARD.
1302
1303 -  RB indicator is fixed to XRAN_RBIND_EVERY.
1304
1305 -  Symbol increment is not used (XRAN_SYMBOLNUMBER_NOTINC)
1306
1307 -  Resource Element Mask is fixed to 0xfff
1308
1309 The extension is not used.
1310
1311 After C-Plane message generation, API send_cpmsg() is called. This
1312 function also includes the implementation for these capabilities:
1313
1314 -  Send the generated packet to the TX ring after adding an Ethernet
1315    header.
1316
1317 -  Add section information of generated C-Plane packet to section
1318    database, to generate U-plane message by C-Plane configuration
1319
1320 send_cpmsg_prach() is to generate the C-Plane message with section type
1321 3 for PRACH scheduling.
1322
1323 This functions also has some hardcoded values for the following
1324 parameters:
1325
1326 -  RB indicator is fixed to XRAN_RBIND_EVERY.
1327
1328 -  Symbol increment is not used (XRAN_SYMBOLNUMBER_NOTINC).
1329
1330 -  Resource Element Mask is fixed to 0xfff.
1331
1332 And similar to generate_cpmsg_dlul(), after this function generates the
1333 message, send_cpmsg() sends the generated packet to the TX ring and adds
1334 section information of the packet to the section database. Checking and
1335 parsing received PRACH symbol data by section information from the
1336 C-Plane are not implemented in this release.
1337
1338 Example Configuration of C-Plane Messages
1339 '''''''''''''''''''''''''''''''''''''''''
1340
1341 C-Plane messages can be composed through API, and the sample application
1342 shows several reference usages of the configuration for different
1343 numerologies.
1344
1345 Below are the examples of C-Plane message configuration with a sample
1346 application for mmWave – numerology 3, 100 MHz bandwidth, TDD (DDDS)
1347
1348 **C-Plane Message – downlink symbol data for a downlink slot**
1349
1350 -  Single CP message with the single section of section type 1
1351
1352 -  Configures single CP message for all consecutive downlink symbols
1353
1354 -  Configures whole RBs (66) for a symbol
1355
1356 -  Compression and beamforming are not used
1357
1358 Common Header Fields::
1359
1360 - dataDirection = XRAN_DIR_DL
1361 - payloadVersion = XRAN_PAYLOAD_VER
1362 - filterIndex = XRAN_FILTERINDEX_STANDARD
1363 - frameId = [0..99]
1364 - subframeId = [0..9]
1365 - slotID = [0..9]
1366 - startSymbolid = 0
1367 - numberOfsections = 1
1368 - sectionType = XRAN_CP_SECTIONTYPE_1
1369 - udCompHdr.idIqWidth = 0
1370 - udCompHdr.udCompMeth = XRAN_COMPMETHOD_NONE
1371 - reserved = 0
1372
1373 Section Fields::
1374
1375 - sectionId = [0..4095]
1376 - rb = XRAN_RBIND_EVERY
1377 - symInc = XRAN_SYMBOLNUMBER_NOTINC 
1378 - startPrbc = 0
1379 - numPrbc = 66
1380 - reMask = 0xfff
1381 - numSymbol = 14
1382 - ef = 0
1383 - beamId = 0
1384
1385
1386 **C-Plane Message – uplink symbol data for uplink slot**
1387
1388 -  Single CP message with the single section of section type 1
1389
1390 -  Configures single CP message for all consecutive uplink symbols (UL
1391    symbol starts from 3)
1392
1393 -  Configures whole RBs (66) for a symbol
1394
1395 -  Compression and beamforming are not used
1396
1397 Common Header Fields::
1398
1399 - dataDirection = XRAN_DIR_UL
1400 - payloadVersion = XRAN_PAYLOAD_VER
1401 - filterIndex = XRAN_FILTERINDEX_STANDARD
1402 - frameId = [0..99]
1403 - subframeId = [0..9]
1404 - slotID = [0..9]
1405 - startSymbolid = 3
1406 - numberOfsections = 1
1407 - sectionType = XRAN_CP_SECTIONTYPE_1
1408 - udCompHdr.idIqWidth = 0
1409 - udCompHdr.udCompMeth = XRAN_COMPMETHOD_NONE
1410 - reserved = 0
1411
1412 Section Fields::
1413
1414 - sectionId = [0..4095]
1415 - rb = XRAN_RBIND_EVERY
1416 - symInc = XRAN_SYMBOLNUMBER_NOTINC 
1417 - startPrbc = 0
1418 - numPrbc = 66
1419 - reMask = 0xfff
1420 - numSymbol = 11
1421 - ef = 0
1422 - beamId = 0
1423
1424
1425 **C-Plane Message – PRACH**
1426
1427 -  Single CP message with the single section of section type 3 including
1428    repetition
1429
1430 -  Configures PRACH format A3, config index 81, and detail parameters
1431    are:
1432
1433 -  Filter Index : 3
1434
1435 -  CP length : 0
1436
1437 -  Time offset : 2026
1438
1439 -  FFT size : 1024
1440
1441 -  Subcarrier spacing : 120KHz
1442
1443 -  Start symbol index : 7
1444
1445 -  Number of symbols : 6
1446
1447 -  Number of PRBCs : 12
1448
1449 -  Frequency offset : -792
1450
1451 -  Compression and beamforming are not used
1452
1453 Common Header Fields::
1454
1455 -  dataDirection = XRAN_DIR_UL
1456 -  payloadVersion = XRAN_PAYLOAD_VER
1457 -  filterIndex = XRAN_FILTERINDEPRACH_ABC
1458 -  frameId = [0,99]
1459 -  subframeId = [0,3]
1460 -  slotID = 3 or 7
1461 -  startSymbolid = 7
1462 -  numberOfSections = 1
1463 -  sectionType = XRAN_CP_SECTIONTYPE_3
1464 -  timeOffset = 2026
1465 -  frameStructure.FFTSize = XRAN_FFTSIZE_1024
1466 -  frameStructure.u = XRAN_SCS_120KHZ
1467 -  cpLength = 0
1468 -  udCompHdr.idIqWidth = 0
1469 -  udCompHdr.udCompMeth = XRAN_COMPMETHOD_NONE
1470
1471 Section Fields::
1472
1473 - sectionId = [0..4095]
1474 - rb = XRAN_RBIND_EVERY
1475 - symInc = XRAN_SYMBOLNUMBER_NOTINC 
1476 - startPrbc = 0
1477 - numPrbc = 12
1478 - reMask = 0xfff
1479 - numSymbol = 6
1480 - ef = 0
1481 - beamId = 0
1482 - frequencyOffset = -792
1483 - reserved
1484
1485
1486 Functions to Store/Retrieve Section Information
1487 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1488
1489 There are several functions to store/retrieve section information of
1490 C-Plane messages. Since U-plane messages must be generated by the
1491 information in the sections of a C-Plane message, it is required to
1492 store and retrieve section information.
1493
1494 **APIs and Data Structure**
1495 '''''''''''''''''''''''''''
1496
1497 APIs for initialization and release storage are:
1498
1499 -  int xran_cp_init_sectiondb(void \*pHandle);
1500
1501 -  int xran_cp_free_sectiondb(void \*pHandle);
1502
1503 APIs to store and retrieve section information are:
1504
1505 -  int xran_cp_add_section_info(void \*pHandle, uint8_t dir, uint8_t
1506    cc_id, uint8_t ruport_id, uint8_t ctx_id, struct xran_section_info
1507    \*info);
1508
1509 -  int xran_cp_add_multisection_info(void \*pHandle, uint8_t cc_id,
1510    uint8_t ruport_id, uint8_t ctx_id, struct xran_cp_gen_params
1511    \*gen_info);
1512
1513 -  struct xran_section_info \*xran_cp_find_section_info(void \*pHandle,
1514    uint8_t dir, uint8_t cc_id, uint8_t ruport_id, uint8_t ctx_id,
1515    uint16_t section_id);
1516
1517 -  struct xran_section_info \*xran_cp_iterate_section_info(void
1518    \*pHandle, uint8_t dir, uint8_t cc_id, uint8_t ruport_id, uint8_t
1519    ctx_id, uint32_t \*next);
1520
1521 -  int xran_cp_getsize_section_info(void \*pHandle, uint8_t dir, uint8_t
1522    cc_id, uint8_t ruport_id, uint8_t ctx_id);
1523
1524 APIs to reset the storage for a new slot are:
1525
1526 -  int xran_cp_reset_section_info(void \*pHandle, uint8_t dir, uint8_t
1527    cc_id, uint8_t ruport_id, uint8_t ctx_id);
1528
1529 The structure of xran_section_info is used to store/retrieve
1530 information. This is the same structure used to generate a C-Plane
1531 message. Please refer to Section 5.4.2.1.1 for more details.
1532
1533 The storage for section information is declared as a multi-dimensional
1534 array and declared as a local static variable to limit direct access.
1535 Each item is defined as the structure of xran_sectioninfo_db, and it has
1536 the number of stored section information items (cur_index) and the array
1537 of the information (list), as shown below.
1538
1539 /*
1540
1541 \* This structure to store the section information of C-Plane
1542
1543 \* in order to generate and parse corresponding U-Plane \*/
1544
1545 struct xran_sectioninfo_db {
1546
1547 uint32_t cur_index; /* Current index to store for this eAXC \*/
1548
1549 struct xran_section_info list[XRAN_MAX_NUM_SECTIONS]; /* The array of
1550 section information \*/
1551
1552 };
1553
1554 static struct xran_sectioninfo_db
1555 sectiondb[XRAN_MAX_SECTIONDB_CTX][XRAN_DIR_MAX][XRAN_COMPONENT_CARRIERS_MAX][XRAN_MAX_ANTENNA_NR*2
1556 + XRAN_MAX_ANT_ARRAY_ELM_NR];
1557
1558 The maximum size of the array can be adjusted if required by system
1559 configuration. Since transmission and reception window of U-Plane can be
1560 overlapped with the start of new C-Plane for next slot, functions have
1561 context index to identify and protect the information. Currently the
1562 maximum number of context is defined by two and it can be adjusted if
1563 needed.
1564
1565 Note. Since the context index is not managed by the library and APIs are
1566 expecting it from the caller as a parameter, the caller shall
1567 consider a proper method to manage it to avoid corruption. The
1568 current reference implementation uses a slot and subframe index to
1569 calculate the context index.
1570
1571 **Example Usage of APIs**
1572 '''''''''''''''''''''''''
1573
1574 There are references to show the usage of APIs as below.
1575
1576 -  Initialization and release:
1577
1578 -  xran_cp_init_sectiondb(): xran_open() in lib/src/xran_main.c
1579
1580 -  xran_cp_free_sectiondb(): xran_close() in lib/src/xran_main.c
1581
1582 -  Store section information:
1583
1584 -  xran_cp_add_section_info(): send_cpmsg_dlul() and
1585    send_cpmsg_prach()in lib/src/xran_main.c
1586
1587 -  Retrieve section information:
1588
1589 -  xran_cp_iterate_section_info(): xran_process_tx_sym() in
1590    lib/src/xran_main.c
1591
1592 -  xran_cp_getsize_section_info(): xran_process_tx_sym() in
1593    lib/src/xran_main.c
1594
1595 -  Reset the storage for a new slot:
1596
1597 -  xran_cp_reset_section_info(): tx_cp_dl_cb() and tx_cp_ul_cb() in
1598    lib/src/xran_main.c
1599
1600 **Function for RU emulation and Debug**
1601 '''''''''''''''''''''''''''''''''''''''
1602
1603 xran_parse_cp_pkt() is a function which can be utilized for RU emulation
1604 or debug. It is defined below:
1605
1606 int xran_parse_cp_pkt(struct rte_mbuf \*mbuf,
1607
1608 struct xran_cp_gen_params \*result,
1609
1610 struct xran_recv_packet_info \*pkt_info);
1611
1612 It parses a received C-Plane packet and retrieves the information from
1613 its headers and sections.
1614
1615 The retrieved information is stored in the structures:
1616
1617 struct xran_cp_gen_params: section information from received C-Plane
1618 packet
1619
1620 struct xran_recv_packet_info: transport layer header information (eCPRI
1621 header)
1622
1623 These functions can be utilized to debug or RU emulation purposes.
1624
1625 .. _u-plane-1:
1626
1627 U-plane
1628 ~~~~~~~
1629
1630 Single Section is the default mode of xRAN packet creation. It assumes
1631 that there is only one section per packet, and all IQ samples are
1632 attached to it. Compression is not supported.
1633
1634 A message is built in mbuf space given as a parameter. The library
1635 builds eCPRI header filling structure fields by taking the IQ sample
1636 size and populating a particular packet length and sequence number.
1637
1638 With compression, supported IQ bit widths are 8,9,10,12,14.
1639
1640 Implementation of a U-plane set of functions is defined in xran_up_api.c
1641 and is used to prepare U-plane packet content according to the given
1642 configuration.
1643
1644 The following list of functions is implemented for U-plane:
1645
1646 -  Build eCPRI header
1647
1648 -  Build application header
1649
1650 -  Build section header
1651
1652 -  Append IQ samples to packet
1653
1654 -  Prepare full symbol of xRAN data for single eAxC
1655
1656 -  Process RX packet per symbol.
1657
1658 The time of generation of a U-plane message for DL and UL is
1659 “symbol-based” and can be controlled using O-DU settings (O-RU),
1660 according to Table 4.
1661
1662 Supporting Code
1663 ---------------
1664
1665 The xRAN library has a set of functions used to assist in packet
1666 processing and data exchange not directly used for xRAN packet
1667 processing.
1668
1669 Timing
1670 ~~~~~~
1671
1672 The sense of time for the xRAN protocol is obtained from system time,
1673 where the system timer is synchronized to GPS time via PTP protocol
1674 using the Linux PHP package. On the software side, a simple polling loop
1675 is utilized to get time up to nanosecond precision and particular packet
1676 processing jobs are scheduled via the DPDK timer.
1677
1678 long poll_next_tick(int interval)
1679
1680 {
1681
1682 struct timespec start_time;
1683
1684 struct timespec cur_time;
1685
1686 long target_time;
1687
1688 long delta;
1689
1690 clock_gettime(CLOCK_REALTIME, &start_time);
1691
1692 target_time = (start_time.tv_sec \* NSEC_PER_SEC + start_time.tv_nsec +
1693 interval \* NSEC_PER_USEC) / (interval \* NSEC_PER_USEC) \* interval;
1694
1695 while(1)
1696
1697 {
1698
1699 clock_gettime(CLOCK_REALTIME, &cur_time);
1700
1701 delta = (cur_time.tv_sec \* NSEC_PER_SEC + cur_time.tv_nsec) -
1702 target_time \* NSEC_PER_USEC;
1703
1704 if(delta > 0 \|\| (delta < 0 && abs(delta) < THRESHOLD))
1705
1706 {
1707
1708 break;
1709
1710 }
1711
1712 }
1713
1714 return delta;
1715
1716 }
1717
1718 Polling is used to achieve the required precision of symbol time. For
1719 example, in the mmWave scenario, the symbol time is 125µs/14=~8.9µs.
1720 Small deterministic tasks can be executed within the polling interval
1721 provided. It’s smaller than the symbol interval time.
1722
1723 DPDK Timers
1724 ~~~~~~~~~~~
1725
1726 DPDK provides sets of primitives (struct rte_rimer) and functions
1727 (rte_timer_reset_sync() rte_timer_manage()) to |br|
1728 schedule processing of
1729 function as timer. The timer is based on the TSC clock and is not
1730 synchronized to PTP time. As a |br|
1731 result, this timer cannot be used as a
1732 periodic timer because the TSC clock can drift substantially relative to
1733 the system timer which in turn is synchronized to PTP (GPS)
1734
1735 Only single-shot timers are used to schedule processing based on
1736 events such as symbol time. The packet |br|
1737 processing function
1738 calls rte_timer_manage() in the loop, and the resulting execution of
1739 timer function happens right |br|
1740 after the timer was “armed”.
1741
1742 xRAN Ethernet
1743 ~~~~~~~~~~~~~
1744
1745 xran_init_port() function performs initialization of DPDK ETH port.
1746 Standard port configuration is used as per reference example from DPDK.
1747
1748 Jumbo Frames are used by default. Mbufs size is extended to support 9600
1749 bytes packets.
1750
1751 Mac address and VLAN tag are expected to be configured by Infrastructure
1752 software. See Appendix A.4.
1753
1754 From an implementation perspective, modules provide functions to handle:
1755
1756 -  Ethernet headers
1757
1758 -  VLAN tag
1759
1760 -  Send and Receive mbuf.
1761
1762 xRAN Ethdi
1763 ~~~~~~~~~~
1764
1765 Ethdi provides functionality to work with the content of an Ethernet
1766 packet and dispatch processing to/from the xRAN layer. Ethdi
1767 instantiates a main PMD driver thread and dispatches packets between the
1768 ring and RX/TX using rte_eth_rx_burst() and rte_eth_tx_burst() DPDK
1769 functions.
1770
1771 For received packets, it maintains a set of handlers for ethertype
1772 handlers and xRAN layer register one xRAN ethtype |br|
1773 0xAEFE, resulting in
1774 packets with this ethertype being routed to the xRAN processing
1775 function. This function checks the message type of the eCPRI header and
1776 dispatches packet to either C-plane processing or U-plane processing.
1777
1778 Initialization of memory pools, allocation and freeing of mbuf for
1779 Ethernet packets occur in this layer.
1780
1781
1782
1783
1784