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