* INTC Contribution to the O-RAN F Release for O-DU Low
[o-du/phy.git] / fhi_lib / lib / api / xran_cp_api.h
1 /******************************************************************************
2 *
3 *   Copyright (c) 2020 Intel.
4 *
5 *   Licensed under the Apache License, Version 2.0 (the "License");
6 *   you may not use this file except in compliance with the License.
7 *   You may obtain a copy of the License at
8 *
9 *       http://www.apache.org/licenses/LICENSE-2.0
10 *
11 *   Unless required by applicable law or agreed to in writing, software
12 *   distributed under the License is distributed on an "AS IS" BASIS,
13 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 *   See the License for the specific language governing permissions and
15 *   limitations under the License.
16 *
17 *******************************************************************************/
18
19 /**
20  * @brief This file provides the definitions for Control Plane Messages APIs.
21  *
22  * @file xran_cp_api.h
23  * @ingroup group_lte_source_xran
24  * @author Intel Corporation
25  *
26  **/
27
28 #ifndef _XRAN_CP_API_H_
29 #define _XRAN_CP_API_H_
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 #include "xran_fh_o_du.h"
36 #include "xran_pkt_cp.h"
37 #include "xran_transport.h"
38
39 #define XRAN_MAX_SECTIONDB_CTX              4
40
41 #define XRAN_MAX_NUM_EXTENSIONS     10//XRAN_MAX_PRBS /* Maximum number of extensions in a section [up to 1 ext section per RB]*/
42 #define XRAN_MAX_NUM_UE             16      /* Maximum number of UEs/Lyaers */
43 #define XRAN_MAX_NUM_ANT_BF         64      /* Maximum number of beamforming antenna,
44                                              * could be defined as XRAN_MAX_ANTENNA_NR */
45 /* Maximum total number of beamforming weights (5.4.7.1.2) */
46 #define XRAN_MAX_BFW_N              (XRAN_MAX_NUM_ANT_BF*XRAN_MAX_NUM_UE)
47 #define XRAN_MAX_MODCOMP_ADDPARMS   6       /* max should be even number */
48
49 #define XRAN_SECTIONEXT_ALIGN       4       /* alignment size in byte for section extension */
50
51
52 /** Control Plane section types, defined in 5.4 Table 5.1 */
53 enum xran_cp_sectiontype {
54     XRAN_CP_SECTIONTYPE_0   = 0,    /**< Unused RB or Symbols in DL or UL, not supported */
55     XRAN_CP_SECTIONTYPE_1   = 1,    /**< Most DL/UL Radio Channels */
56     XRAN_CP_SECTIONTYPE_3   = 3,    /**< PRACH and Mixed-numerology Channels */
57     XRAN_CP_SECTIONTYPE_5   = 5,    /**< UE scheduling information, not supported  */
58     XRAN_CP_SECTIONTYPE_6   = 6,    /**< Channel Information, not supported */
59     XRAN_CP_SECTIONTYPE_7   = 7,    /**< LAA, not supported */
60     XRAN_CP_SECTIONTYPE_MAX
61     };
62
63 /** Filter index, defined in 5.4.4.3 */
64 enum xran_cp_filterindex {
65     XRAN_FILTERINDEX_STANDARD   = 0,    /**< UL filter for standard channel */
66     XRAN_FILTERINDEX_PRACH_012  = 1,    /**< UL filter for PRACH preamble format 0, 1, 2 */
67     XRAN_FILTERINDEX_PRACH_3    = 2,    /**< UL filter for PRACH preamble format 3 */
68     XRAN_FILTERINDEX_PRACH_ABC  = 3,    /**< UL filter for PRACH preamble format A1~3, B1~4, C0, C2 */
69     XRAN_FILTERINDEX_NPRACH     = 4,    /**< UL filter for NPRACH */
70     XRAN_FILTERINDEX_LTE4       = 5,    /**< UL filter for PRACH preamble format LTE-4 */
71     XRAN_FILTERINDEX_MAX
72     };
73
74 /** Maximum Slot Index, defined in 5.4.4.6 */
75 #define XRAN_SLOTID_MAX                     16
76
77 /** FFT size in frame structure, defined in 5.4.4.13 Table 5.9 */
78 enum xran_cp_fftsize {
79     XRAN_FFTSIZE_128    = 7,       /* 128 */
80     XRAN_FFTSIZE_256    = 8,       /* 256 */
81     XRAN_FFTSIZE_512    = 9,       /* 512 */
82     XRAN_FFTSIZE_1024   = 10,      /* 1024 */
83     XRAN_FFTSIZE_2048   = 11,      /* 2048 */
84     XRAN_FFTSIZE_4096   = 12,      /* 4096 */
85     XRAN_FFTSIZE_1536   = 13,      /* 1536 */
86     XRAN_FFTSIZE_MAX
87     };
88
89 /** Sub-carrier spacing, defined in 5.4.4.13 Table 5.10 */
90 enum xran_cp_subcarrierspacing {   /*3GPP u,  SCS, Nslot, Slot len */
91     XRAN_SCS_15KHZ      = 0,       /*  0,   15kHz,  1, 1ms */
92     XRAN_SCS_30KHZ      = 1,       /*  1,   30kHz,  2, 500us */
93     XRAN_SCS_60KHZ      = 2,       /*  2,   60kHz,  4, 250us */
94     XRAN_SCS_120KHZ     = 3,       /*  3,  120kHz,  8, 125us */
95     XRAN_SCS_240KHZ     = 4,       /*  4,  240kHz, 16, 62.5us */
96     XRAN_SCS_1P25KHZ    = 12,      /* NA, 1.25kHz,  1, 1ms */
97     XRAN_SCS_3P75KHZ    = 13,      /* NA, 3.75kHz,  1, 1ms */
98     XRAN_SCS_5KHZ       = 14,      /* NA,    5kHz,  1, 1ms */
99     XRAN_SCS_7P5KHZ     = 15,      /* NA,  7.5kHz,  1, 1ms */
100     XRAN_SCS_MAX
101     };
102
103 /** Resource block indicator, defined in 5.4.5.2 */
104 enum xran_cp_rbindicator {
105     XRAN_RBIND_EVERY        = 0,    /**< every RB used */
106     XRAN_RBIND_EVERYOTHER   = 1,    /**< every other RB used */
107     XRAN_RBIND_MAX
108     };
109
110 /** Symbol number increment command, defined in 5.4.5.3 */
111 enum xran_cp_symbolnuminc {
112     XRAN_SYMBOLNUMBER_NOTINC    = 0,      /**< do not increment the current symbol number */
113     XRAN_SYMBOLNUMBER_INC       = 1,      /**< increment the current symbol number and use that */
114     XRAN_SYMBOLNUMBER_INC_MAX
115     };
116
117 /** Macro to convert the number of PRBs as defined in 5.4.5.6 */
118 #define XRAN_CONVERT_NUMPRBC(x)             ((x) > 255 ? 0 : (x))
119
120 #define XRAN_CONVERT_IQWIDTH(x)             ((x) > 15 ? 0 : (x))
121
122 /** Minimum number of symbols, defined in 5.4.5.7 */
123 #define XRAN_SYMBOLNUMBER_MIN               1
124 /** Maximum number of symbols, defined in  5.4.5.7 */
125 #define XRAN_SYMBOLNUMBER_MAX               14
126
127 /* LAA message type 5.4.5.14 Table 5.11, not supported */
128 #define XRAN_LAAMSGTYPE_LBT_PDSCH_REQ       0
129 #define XRAN_LAAMSGTYPE_LBT_DRS_REQ         1
130 #define XRAN_LAAMSGTYPE_LBT_PDSCH_RSP       2
131 #define XRAN_LAAMSGTYPE_LBT_DRS_RSP         3
132 #define XRAN_LAAMSGTYPE_LBT_BUFFER_ERROR    4
133 #define XRAN_LAAMSGTYPE_LBT_CWCONFIG_REQ    5
134 #define XRAN_LAAMSGTYPE_LBT_CWCONFIG_RSP    6
135
136 #define XRAN_LBTMODE_FULL                   0
137 #define XRAN_LBTMODE_PARTIAL25              1
138 #define XRAN_LBTMODE_PARTIAL34              2
139 #define XRAN_LBTMODE_FULLSTOP               3
140
141
142 #define XRAN_EF_F_LAST                      0
143 #define XRAN_EF_F_ANOTHER_ONE               1
144
145 /** Control Plane section extension commands, defined in 5.4.6 Table 5.13 */
146 enum xran_cp_sectionextcmd {
147     XRAN_CP_SECTIONEXTCMD_0 = 0,    /**< Reserved, for future use */
148     XRAN_CP_SECTIONEXTCMD_1 = 1,    /**< Beamforming weights */
149     XRAN_CP_SECTIONEXTCMD_2 = 2,    /**< Beamforming attributes */
150     XRAN_CP_SECTIONEXTCMD_3 = 3,    /**< DL Precoding configuration parameters and indications, not supported */
151     XRAN_CP_SECTIONEXTCMD_4 = 4,    /**< Modulation compression parameter */
152     XRAN_CP_SECTIONEXTCMD_5 = 5,    /**< Modulation compression additional scaling parameters */
153     XRAN_CP_SECTIONEXTCMD_6 = 6,    /**< Non-contiguous PRB allocation */
154     XRAN_CP_SECTIONEXTCMD_7 = 7,    /**< Multiple-eAxC designation */
155     XRAN_CP_SECTIONEXTCMD_8 = 8,    /**< MMSE parameters */
156     XRAN_CP_SECTIONEXTCMD_9 = 9,    /**< Dynamic Spectrum Sharing parameters */
157     XRAN_CP_SECTIONEXTCMD_10 = 10,  /**< Multiple ports grouping */
158     XRAN_CP_SECTIONEXTCMD_11 = 11,  /**< Flexible BF weights */
159     XRAN_CP_SECTIONEXTCMD_MAX       /* 12~127 reserved for future use */
160     };
161
162 /** Macro to convert bfwIqWidth defined in 5.4.7.1.1, Table 5-15 */
163 #define XRAN_CONVERT_BFWIQWIDTH(x)          ((x) > 15 ? 0 : (x))
164
165 /** Beamforming Weights Compression Method 5.4.7.1.1, Table 5-16 */
166 enum xran_cp_bfw_compression_method {
167     XRAN_BFWCOMPMETHOD_NONE         = 0,    /**< Uncopressed I/Q value */
168     XRAN_BFWCOMPMETHOD_BLKFLOAT     = 1,    /**< I/Q mantissa value */
169     XRAN_BFWCOMPMETHOD_BLKSCALE     = 2,    /**< I/Q scaled value */
170     XRAN_BFWCOMPMETHOD_ULAW         = 3,    /**< compressed I/Q value */
171     XRAN_BFWCOMPMETHOD_BEAMSPACE    = 4,    /**< beamspace I/Q coefficient */
172     XRAN_BFWCOMPMETHOD_MAX                  /* reserved for future methods */
173     };
174
175 /** Beamforming Attributes Bitwidth 5.4.7.2.1 */
176 enum xran_cp_bfa_bitwidth {
177     XRAN_BFABITWIDTH_NO             = 0,    /**< the filed is no applicable or the default value shall be used */
178     XRAN_BFABITWIDTH_2BIT           = 1,    /**< the filed is 2-bit bitwidth */
179     XRAN_BFABITWIDTH_3BIT           = 2,    /**< the filed is 3-bit bitwidth */
180     XRAN_BFABITWIDTH_4BIT           = 3,    /**< the filed is 4-bit bitwidth */
181     XRAN_BFABITWIDTH_5BIT           = 4,    /**< the filed is 5-bit bitwidth */
182     XRAN_BFABITWIDTH_6BIT           = 5,    /**< the filed is 6-bit bitwidth */
183     XRAN_BFABITWIDTH_7BIT           = 6,    /**< the filed is 7-bit bitwidth */
184     XRAN_BFABITWIDTH_8BIT           = 7,    /**< the filed is 8-bit bitwidth */
185     };
186
187 /** Layer ID for DL transmission in TM1-TM4 5.4.7.3.2 */
188 #define XRAN_LAYERID_0              0       /**< Layer 0 */
189 #define XRAN_LAYERID_1              1       /**< Layer 1 */
190 #define XRAN_LAYERID_2              2       /**< Layer 2 */
191 #define XRAN_LAYERID_3              3       /**< Layer 3 */
192 #define XRAN_LAYERID_TXD            0xf     /**< TxD */
193
194 /** LTE Transmission Scheme for section extension type 3 5.4.7.3.3 */
195 #define XRAN_TXS_SMUXCDD            0       /**< Spatial Multiplexing (CDD) */
196 #define XRAN_TXS_SMUXNOCDD          1       /**< Spatial Multiplexing (no CDD) */
197 #define XRAN_TXS_TXDIV              2       /**< Transmit diversity */
198
199 /** Resource Block Group Size 5.4.7.6.1 */
200 enum xran_cp_rbgsize {
201     XRAN_RBGSIZE_1RB                = 1,    /**< 1 RB */
202     XRAN_RBGSIZE_2RB                = 2,    /**< 2 RBs */
203     XRAN_RBGSIZE_3RB                = 3,    /**< 3 RBs */
204     XRAN_RBGSIZE_4RB                = 4,    /**< 4 RBs */
205     XRAN_RBGSIZE_6RB                = 5,    /**< 6 RBs */
206     XRAN_RBGSIZE_8RB                = 6,    /**< 8 RBs */
207     XRAN_RBGSIZE_16RB               = 7,    /**< 16 RBs */
208 };
209
210 /** Technology for Dynamic Spectrum Sharing operation 5,4,7.9.1 */
211 #define XRAN_DSSTECH_LTE            0       /**< LTE support */
212 #define XRAN_DSSTECH_NR             1       /**< NR support */
213
214 /** The type of beam grouping 5.4.7.10.1 */
215 #define XRAN_BEAMGT_COMMON          0       /** common beam */
216 #define XRAN_BEAMGT_MATRIXIND       1       /** beam matrix indication */
217 #define XRAN_BEAMGT_VECTORLIST      2       /** beam vector listing */
218
219 #define XRAN_MAX_NUMPORTC_EXT10     64      /* defined in 5.4.7.10.2 */
220
221 /**
222  * This structure contains the information to generate the section body of C-Plane message */
223 struct xran_section_info {
224     /** for U-plane */
225     struct xran_section_desc sec_desc[XRAN_NUM_OF_SYMBOL_PER_SLOT];
226     int32_t     freqOffset; /*      X         24bits */
227     uint32_t    startPrbc:9;  /*  X X X X X     9bits */
228     uint32_t    numPrbc:9;    /*  X X X X X      8bits */ /* will be converted to zero if >255 */
229     uint32_t    type:4;       /* type of this section  */
230                             /* section type   bit-    */
231                             /*  0 1 3 5 6 7    length */
232     uint32_t     startSymId:4; /*  X X X X X X    4bits */
233     uint32_t     numSymbol:4;  /*  X X X X        4bits */
234     uint32_t    res:2;
235     uint16_t    beamId;     /*    X X         15bits */
236     uint16_t    ueId;       /*        X X     15bits */
237     uint16_t    regFactor;  /*          X     16bits */
238     uint16_t    id;         /*  X X X X X     12bits */
239     uint16_t    reMask;     /*  X X X X       12bits */
240
241     uint8_t     symInc:1;     /*  X X X X X      1bit  */
242     uint8_t     rb:1;         /*  X X X X X      1bit  */
243     uint8_t     ef:1;         /*    X X X X      1bit  */
244     uint8_t     prbElemBegin:1;      /* Flag to indicate beginning of a PRB element */
245     uint8_t     prbElemEnd:1;        /* Flag to indicate end of a PRB element */
246     uint8_t     reserved:3;
247     uint8_t     compMeth:4;   /*    X X X        4bits */
248     uint8_t     iqWidth:4;    /*    X X X        4bits */
249 };
250
251
252 struct xran_sectionext1_info {
253     uint16_t    rbNumber;                   /**< number RBs to ext1 chain */
254     uint16_t    bfwNumber;                  /**< number of bf weights in this section */
255     uint8_t     bfwIqWidth;
256     uint8_t     bfwCompMeth;
257     int8_t     *p_bfwIQ;                   /**< pointer to formed section extention */
258     int16_t     bfwIQ_sz;                   /**< size of buffer with section extention information */
259     union {
260         uint8_t     exponent;
261         uint8_t     blockScaler;
262         uint8_t     compBitWidthShift;
263         uint8_t     activeBeamspaceCoeffMask[XRAN_MAX_BFW_N];   /* ceil(N/8)*8, should be multiple of 8 */
264         } bfwCompParam;
265     };
266
267 struct xran_sectionext2_info {
268     uint8_t     bfAzPtWidth;    /* beamforming zenith beamwidth parameter */
269     uint8_t     bfAzPt;
270     uint8_t     bfZePtWidth;    /* beamforming azimuth beamwidth parameter */
271     uint8_t     bfZePt;
272     uint8_t     bfAz3ddWidth;   /* beamforming zenith pointing parameter */
273     uint8_t     bfAz3dd;
274     uint8_t     bfZe3ddWidth;   /* beamforming azimuth pointing parameter */
275     uint8_t     bfZe3dd;
276
277     uint8_t     bfAzSI;
278     uint8_t     bfZeSI;
279     };
280
281 struct xran_sectionext3_info {
282     uint8_t     codebookIdx;
283     uint8_t     layerId;
284     uint8_t     numLayers;
285     uint8_t     txScheme;
286     uint16_t    crsReMask;
287     uint8_t     crsShift;
288     uint8_t     crsSymNum;
289     uint16_t    numAntPort;     /* number of antenna port - 2 or 4 */
290     uint16_t    beamIdAP1;
291     uint16_t    beamIdAP2;
292     uint16_t    beamIdAP3;
293     };
294
295 struct xran_sectionext4_info {
296     uint8_t     csf;
297     uint8_t     pad0;
298     uint16_t    modCompScaler;
299     };
300
301 struct xran_sectionext5_info {
302     uint8_t     num_sets;
303     struct {
304         uint16_t    csf;
305         uint16_t    mcScaleReMask;
306         uint16_t    mcScaleOffset;
307         } mc[XRAN_MAX_MODCOMP_ADDPARMS];
308     };
309
310 struct xran_sectionext6_info {
311     uint8_t     rbgSize;
312     uint8_t     pad;
313     uint16_t    symbolMask;
314     uint32_t    rbgMask;
315 };
316
317 struct xran_sectionext7_info {
318     uint16_t    eAxCmask;
319 };
320
321 struct xran_sectionext8_info {
322     uint16_t    regularizationFactor;
323 };
324
325 struct xran_sectionext9_info {
326     uint8_t     technology;
327     uint8_t     reserved;
328 };
329
330 struct xran_sectionext10_info {
331     uint8_t     numPortc;
332     uint8_t     beamGrpType;
333     uint16_t    beamID[XRAN_MAX_NUMPORTC_EXT10];
334 };
335
336 struct xran_sectionext11_info {
337     uint8_t     RAD;
338     uint8_t     disableBFWs;
339
340     uint8_t     numBundPrb;
341     uint8_t     numSetBFWs;     /* Total number of beam forming weights set (L) */
342
343     uint8_t     bfwCompMeth;
344     uint8_t     bfwIqWidth;
345
346     int32_t         totalBfwIQLen;
347     int32_t         maxExtBufSize;  /* Maximum space of external buffer */
348     uint8_t     *pExtBuf;       /* pointer to start of external buffer */
349     void        *pExtBufShinfo; /* Pointer to rte_mbuf_ext_shared_info */
350 };
351
352 union xran_ext_bfwcompparam_info {
353     uint8_t     exponent;
354 //    uint8_t     blockScaler;                /*  Not supported */
355 //    uint8_t     compBitWidthShift;          /*  Not supported */
356 //    uint8_t     *pActBeamspaceCoeffMask;    /*  Not supported */
357     };
358 struct xran_ext11_prbbundle_info {
359     union xran_ext_bfwcompparam_info bfwCompParam;
360     uint16_t    beamId;     /*  15bits, needs to strip MSB */
361     uint16_t    BFWSize;    /*  actual size of bfws in bytes */
362     uint8_t     *pBFWs;     /*  external buffer pointer */
363 };
364 struct xran_sectionext11_recv_info {
365     uint8_t     RAD;
366     uint8_t     disableBFWs;
367
368     uint8_t     numBundPrb;
369     uint8_t     numSetBFWs;     /* Total number of beam forming weights set (L) */
370
371     uint8_t     bfwCompMeth;
372     uint8_t     bfwIqWidth;
373
374     int32_t         totalBfwIQLen;
375     int32_t         maxExtBufSize;  /* Maximum space of external buffer */
376     uint8_t     *pExtBuf;       /* pointer to start of external buffer */
377     void        *pExtBufShinfo; /* Pointer to rte_mbuf_ext_shared_info */
378
379     /* For parsing */
380     struct xran_ext11_prbbundle_info bundInfo[XRAN_MAX_SET_BFWS];
381 };
382
383 struct xran_sectionext_info {
384     uint16_t    type;
385     uint16_t    len;
386     void        *data;
387     };
388
389 /**
390  * This structure contains the information to generate the section header of C-Plane message */
391 struct xran_cp_header_params {
392     // common parameters
393     uint8_t     filterIdx;
394     uint8_t     frameId;
395     uint8_t     subframeId;
396     uint8_t     slotId;
397     uint8_t     startSymId;
398                             /* section type   bit-    */
399                             /*  0 1 3 5 6 7    length */
400     uint8_t     fftSize;    /*  X   X          4bits */
401     uint8_t     scs;        /*  X   X          4bits */
402     uint8_t     iqWidth;    /*    X X X        4bits */
403     uint8_t     compMeth;   /*    X X X        4bits */
404     uint8_t     numUEs;     /*          X      8bits */
405     uint16_t    timeOffset; /*  X   X         16bits */
406     uint16_t    cpLength;   /*  X   X         16bits */
407     };
408
409 /** The structure for the generation of section extension */
410 struct xran_section_ext_gen_info {
411     uint16_t    type;           /**< the type of section extension */
412     uint16_t    len;            /**< length of extension data */
413     void        *data;          /**< pointer to extension data */
414     };
415
416 /**
417  * This structure to hold the information to generate the sections of C-Plane message */
418 struct xran_section_gen_info {
419     struct xran_section_info *info;  /**< The information for section */
420
421     /** the array to store section extension */
422     struct xran_section_ext_gen_info exData[XRAN_MAX_NUM_EXTENSIONS];
423     uint32_t    exDataSize;         /**< The number of Extensions or type 6/7 data */
424 };
425
426
427 /**
428  * This structure to hold the information to generate a C-Plane message */
429 struct xran_cp_gen_params {
430     uint8_t     dir;            /**< UL or DL */
431     uint8_t     sectionType;    /**< each section must have same type with this */
432     uint16_t    numSections;    /**< the number of sections to generate */
433
434     struct xran_cp_header_params hdr;
435     /**< The information for C-Plane message header */
436     struct xran_section_gen_info *sections;
437     /**< Array of the section information */
438     };
439
440 /** The structure to store received section extension */
441 struct xran_section_ext_recv_info {
442     uint16_t    type;           /**< the type of section extension */
443     uint16_t    size;
444     union {
445         struct xran_sectionext1_info    ext1;
446         struct xran_sectionext2_info    ext2;
447         struct xran_sectionext3_info    ext3;
448         struct xran_sectionext4_info    ext4;
449         struct xran_sectionext5_info    ext5;
450         struct xran_sectionext6_info    ext6;
451         struct xran_sectionext9_info    ext9;
452         struct xran_sectionext10_info   ext10;
453         struct xran_sectionext11_recv_info  ext11;
454     } u;
455 };
456
457 /**
458  * This structure to hold the information of received sections of C-Plane message */
459 struct xran_section_recv_info {
460     struct xran_section_info info;  /**< The information for received section */
461
462     uint32_t numExts;
463     /** the array to store section extension */
464     struct xran_section_ext_recv_info exts[XRAN_MAX_NUM_EXTENSIONS];
465 };
466
467 /**
468  * This structure to store received C-Plane message */
469 struct xran_cp_recv_params {
470     uint8_t     dir;            /**< UL or DL */
471     uint8_t     sectionType;    /**< each section must have same type with this */
472     uint16_t    numSections;    /**< the number of sections received */
473     uint8_t     numSetBFW;      /**<Set of BFWs */
474     uint8_t     ext1count;      /**<Count set of extension type-1 BFWs*/
475     uint32_t    tti;            /**<micro-second*/
476     uint8_t     dssPeriod;      /**< DSS pattern period for LTE/NR */
477     uint8_t     technology_arr[XRAN_MAX_DSS_PERIODICITY];   /**< technology array represents slot is LTE(0)/NR(1) */
478     
479
480     struct xran_cp_header_params hdr;
481     /**< The information for C-Plane message header */
482     struct xran_section_recv_info *sections;
483     /**< Array of the section information */
484 };
485
486 /**
487  * This structure to hold the information of RB allocation from PHY
488  * to send data for allocated RBs only. */
489 struct xran_cp_rbmap_list {
490     uint16_t    grp_id;     /**< group id for this entry, reserved for future use */
491
492     uint8_t     sym_start;  /**< Start symbol ID */
493     uint8_t     sym_num;    /**< Number of symbols */
494
495     uint16_t    rb_start;   /**< Start RB position */
496     uint16_t    rb_num;     /**< Number of RBs */
497
498     int16_t     iq_buff_offset; /**< Offset within Sym for start of IQs */
499     int16_t     iq_buff_len;    /**< length IQs */
500
501     uint16_t    beam_id;    /**< Bean Index */
502     uint8_t     iqWidth;    /**< I and Q width in bits */
503     uint8_t     comp_meth;  /**< Compression method */
504     uint8_t     pad0;
505     };
506
507 typedef struct tagSECTION_DB_TYPE {
508     struct xran_sectioninfo_db* p_sectiondb_elm[XRAN_MAX_SECTIONDB_CTX][XRAN_DIR_MAX][XRAN_COMPONENT_CARRIERS_MAX][XRAN_MAX_ANTENNA_NR * 2 + XRAN_MAX_ANT_ARRAY_ELM_NR];
509 } SECTION_DB_TYPE, * PSECTION_DB_TYPE;
510
511 uint16_t xran_get_cplength(int32_t cpLength);
512 int32_t xran_get_freqoffset(int32_t freqOffset, int32_t scs);
513
514 int32_t xran_prepare_ctrl_pkt(struct rte_mbuf *mbuf,
515                         struct xran_cp_gen_params *params,
516                         uint8_t CC_ID, uint8_t Ant_ID,
517                         uint8_t seq_id,
518                         uint16_t start_sect_id);
519
520 int32_t xran_parse_cp_pkt(struct rte_mbuf *mbuf,
521                     struct xran_cp_recv_params *result,
522                     struct xran_recv_packet_info *pkt_info, void* handle, uint32_t *mb_free);
523
524 int32_t xran_cp_init_sectiondb(void *pHandle);
525 int32_t xran_cp_free_sectiondb(void *pHandle);
526 int32_t xran_cp_add_section_info(void *pHandle,
527         uint8_t dir, uint8_t cc_id, uint8_t ruport_id,
528         uint8_t ctx_id, struct xran_section_info *info);
529
530 struct xran_section_info *
531 xran_cp_get_section_info_ptr(void *pHandle, uint8_t dir, uint8_t cc_id, uint8_t ruport_id, uint8_t ctx_id);
532
533 int32_t xran_cp_add_multisection_info(void *pHandle,
534         uint8_t cc_id, uint8_t ruport_id, uint8_t ctx_id,
535         struct xran_cp_gen_params *gen_info);
536 struct xran_section_info *xran_cp_find_section_info(void *pHandle,
537         uint8_t dir, uint8_t cc_id, uint8_t ruport_id,
538         uint8_t ctx_id, uint16_t section_id);
539 struct xran_section_info *xran_cp_iterate_section_info(void *pHandle,
540         uint8_t dir, uint8_t cc_id, uint8_t ruport_id,
541         uint8_t ctx_id, uint32_t *next);
542
543 int32_t xran_cp_getsize_section_info(void *pHandle, uint8_t dir, uint8_t cc_id, uint8_t ruport_id, uint8_t ctx_id);
544 int32_t xran_cp_reset_section_info(void *pHandle, uint8_t dir, uint8_t cc_id, uint8_t ruport_id, uint8_t ctx_id);
545 int32_t xran_cp_populate_section_ext_1(int8_t  *p_ext1_dst,    /**< destination buffer */
546                                        uint16_t  ext1_dst_len, /**< dest buffer size */
547                                        int16_t  *p_bfw_iq_src, /**< source buffer of IQs */
548                                        struct xran_prb_elm *p_pRbMapElm);
549 struct rte_mbuf *xran_attach_cp_ext_buf(uint16_t vf_id, int8_t* p_ext_buff_start, int8_t* p_ext_buff, uint16_t ext_buff_len,
550                 struct rte_mbuf_ext_shared_info * p_share_data);
551 int32_t xran_cp_attach_ext_buf(struct rte_mbuf *mbuf, uint8_t *extbuf_start, uint16_t extbuf_len,
552                 struct rte_mbuf_ext_shared_info *shinfo);
553 int32_t xran_cp_prepare_ext11_bfws(uint8_t numSetBFW, uint8_t numBFW,
554                         uint8_t iqWidth, uint8_t compMeth,
555                         uint8_t *dst, int16_t dst_maxlen,
556                         struct xran_ext11_bfw_info bfwInfo[]);
557 int32_t xran_cp_estimate_max_set_bfws(uint8_t numBFWs, uint8_t iqWidth,
558                         uint8_t compMeth, uint16_t mtu);
559
560 #ifdef __cplusplus
561 }
562 #endif
563
564 #endif /* _XRAN_CP_API_H_ */