X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=fhi_lib%2Flib%2Fapi%2Fxran_cp_api.h;h=6a461f3c46caa62bdefee5b587e3f2715282b8ef;hb=refs%2Fheads%2Fmaster;hp=9d08e422ba2f13a1dd8c212f05b274614459cfad;hpb=4745e5c88ba931c6d71cb6d8c681f76cf364eac5;p=o-du%2Fphy.git diff --git a/fhi_lib/lib/api/xran_cp_api.h b/fhi_lib/lib/api/xran_cp_api.h index 9d08e42..6a461f3 100644 --- a/fhi_lib/lib/api/xran_cp_api.h +++ b/fhi_lib/lib/api/xran_cp_api.h @@ -1,6 +1,6 @@ /****************************************************************************** * -* Copyright (c) 2019 Intel. +* Copyright (c) 2020 Intel. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ * *******************************************************************************/ - /** * @brief This file provides the definitions for Control Plane Messages APIs. * @@ -29,19 +28,26 @@ #ifndef _XRAN_CP_API_H_ #define _XRAN_CP_API_H_ -#include "xran_fh_lls_cu.h" +#ifdef __cplusplus +extern "C" { +#endif + +#include "xran_fh_o_du.h" #include "xran_pkt_cp.h" +#include "xran_transport.h" + +#define XRAN_MAX_SECTIONDB_CTX 4 + +#define XRAN_MAX_NUM_EXTENSIONS 10//XRAN_MAX_PRBS /* Maximum number of extensions in a section [up to 1 ext section per RB]*/ +#define XRAN_MAX_NUM_UE 16 /* Maximum number of UEs/Lyaers */ +#define XRAN_MAX_NUM_ANT_BF 64 /* Maximum number of beamforming antenna, + * could be defined as XRAN_MAX_ANTENNA_NR */ +/* Maximum total number of beamforming weights (5.4.7.1.2) */ +#define XRAN_MAX_BFW_N (XRAN_MAX_NUM_ANT_BF*XRAN_MAX_NUM_UE) +#define XRAN_MAX_MODCOMP_ADDPARMS 6 /* max should be even number */ + +#define XRAN_SECTIONEXT_ALIGN 4 /* alignment size in byte for section extension */ -/* Error Codes - * For errors and exceptions, all values will be negative */ -enum xran_errcodes { - XRAN_ERRCODE_OK = 0, - XRAN_ERRCODE_INVALIDPARAM, - XRAN_ERRCODE_OUTOFMEMORY, - XRAN_ERRCODE_FAILTOSEND, - XRAN_ERRCODE_INVALIDPACKET, - XRAN_ERRCODE_MAX - }; /** Control Plane section types, defined in 5.4 Table 5.1 */ enum xran_cp_sectiontype { @@ -61,6 +67,7 @@ enum xran_cp_filterindex { XRAN_FILTERINDEX_PRACH_3 = 2, /**< UL filter for PRACH preamble format 3 */ XRAN_FILTERINDEX_PRACH_ABC = 3, /**< UL filter for PRACH preamble format A1~3, B1~4, C0, C2 */ XRAN_FILTERINDEX_NPRACH = 4, /**< UL filter for NPRACH */ + XRAN_FILTERINDEX_LTE4 = 5, /**< UL filter for PRACH preamble format LTE-4 */ XRAN_FILTERINDEX_MAX }; @@ -107,6 +114,11 @@ enum xran_cp_symbolnuminc { XRAN_SYMBOLNUMBER_INC_MAX }; +/** Macro to convert the number of PRBs as defined in 5.4.5.6 */ +#define XRAN_CONVERT_NUMPRBC(x) ((x) > 255 ? 0 : (x)) + +#define XRAN_CONVERT_IQWIDTH(x) ((x) > 15 ? 0 : (x)) + /** Minimum number of symbols, defined in 5.4.5.7 */ #define XRAN_SYMBOLNUMBER_MIN 1 /** Maximum number of symbols, defined in 5.4.5.7 */ @@ -126,26 +138,252 @@ enum xran_cp_symbolnuminc { #define XRAN_LBTMODE_PARTIAL34 2 #define XRAN_LBTMODE_FULLSTOP 3 + +#define XRAN_EF_F_LAST 0 +#define XRAN_EF_F_ANOTHER_ONE 1 + +/** Control Plane section extension commands, defined in 5.4.6 Table 5.13 */ +enum xran_cp_sectionextcmd { + XRAN_CP_SECTIONEXTCMD_0 = 0, /**< Reserved, for future use */ + XRAN_CP_SECTIONEXTCMD_1 = 1, /**< Beamforming weights */ + XRAN_CP_SECTIONEXTCMD_2 = 2, /**< Beamforming attributes */ + XRAN_CP_SECTIONEXTCMD_3 = 3, /**< DL Precoding configuration parameters and indications, not supported */ + XRAN_CP_SECTIONEXTCMD_4 = 4, /**< Modulation compression parameter */ + XRAN_CP_SECTIONEXTCMD_5 = 5, /**< Modulation compression additional scaling parameters */ + XRAN_CP_SECTIONEXTCMD_6 = 6, /**< Non-contiguous PRB allocation */ + XRAN_CP_SECTIONEXTCMD_7 = 7, /**< Multiple-eAxC designation */ + XRAN_CP_SECTIONEXTCMD_8 = 8, /**< MMSE parameters */ + XRAN_CP_SECTIONEXTCMD_9 = 9, /**< Dynamic Spectrum Sharing parameters */ + XRAN_CP_SECTIONEXTCMD_10 = 10, /**< Multiple ports grouping */ + XRAN_CP_SECTIONEXTCMD_11 = 11, /**< Flexible BF weights */ + XRAN_CP_SECTIONEXTCMD_MAX /* 12~127 reserved for future use */ + }; + +/** Macro to convert bfwIqWidth defined in 5.4.7.1.1, Table 5-15 */ +#define XRAN_CONVERT_BFWIQWIDTH(x) ((x) > 15 ? 0 : (x)) + +/** Beamforming Weights Compression Method 5.4.7.1.1, Table 5-16 */ +enum xran_cp_bfw_compression_method { + XRAN_BFWCOMPMETHOD_NONE = 0, /**< Uncopressed I/Q value */ + XRAN_BFWCOMPMETHOD_BLKFLOAT = 1, /**< I/Q mantissa value */ + XRAN_BFWCOMPMETHOD_BLKSCALE = 2, /**< I/Q scaled value */ + XRAN_BFWCOMPMETHOD_ULAW = 3, /**< compressed I/Q value */ + XRAN_BFWCOMPMETHOD_BEAMSPACE = 4, /**< beamspace I/Q coefficient */ + XRAN_BFWCOMPMETHOD_MAX /* reserved for future methods */ + }; + +/** Beamforming Attributes Bitwidth 5.4.7.2.1 */ +enum xran_cp_bfa_bitwidth { + XRAN_BFABITWIDTH_NO = 0, /**< the filed is no applicable or the default value shall be used */ + XRAN_BFABITWIDTH_2BIT = 1, /**< the filed is 2-bit bitwidth */ + XRAN_BFABITWIDTH_3BIT = 2, /**< the filed is 3-bit bitwidth */ + XRAN_BFABITWIDTH_4BIT = 3, /**< the filed is 4-bit bitwidth */ + XRAN_BFABITWIDTH_5BIT = 4, /**< the filed is 5-bit bitwidth */ + XRAN_BFABITWIDTH_6BIT = 5, /**< the filed is 6-bit bitwidth */ + XRAN_BFABITWIDTH_7BIT = 6, /**< the filed is 7-bit bitwidth */ + XRAN_BFABITWIDTH_8BIT = 7, /**< the filed is 8-bit bitwidth */ + }; + +/** Layer ID for DL transmission in TM1-TM4 5.4.7.3.2 */ +#define XRAN_LAYERID_0 0 /**< Layer 0 */ +#define XRAN_LAYERID_1 1 /**< Layer 1 */ +#define XRAN_LAYERID_2 2 /**< Layer 2 */ +#define XRAN_LAYERID_3 3 /**< Layer 3 */ +#define XRAN_LAYERID_TXD 0xf /**< TxD */ + +/** LTE Transmission Scheme for section extension type 3 5.4.7.3.3 */ +#define XRAN_TXS_SMUXCDD 0 /**< Spatial Multiplexing (CDD) */ +#define XRAN_TXS_SMUXNOCDD 1 /**< Spatial Multiplexing (no CDD) */ +#define XRAN_TXS_TXDIV 2 /**< Transmit diversity */ + +/** Resource Block Group Size 5.4.7.6.1 */ +enum xran_cp_rbgsize { + XRAN_RBGSIZE_1RB = 1, /**< 1 RB */ + XRAN_RBGSIZE_2RB = 2, /**< 2 RBs */ + XRAN_RBGSIZE_3RB = 3, /**< 3 RBs */ + XRAN_RBGSIZE_4RB = 4, /**< 4 RBs */ + XRAN_RBGSIZE_6RB = 5, /**< 6 RBs */ + XRAN_RBGSIZE_8RB = 6, /**< 8 RBs */ + XRAN_RBGSIZE_16RB = 7, /**< 16 RBs */ +}; + +/** Technology for Dynamic Spectrum Sharing operation 5,4,7.9.1 */ +#define XRAN_DSSTECH_LTE 0 /**< LTE support */ +#define XRAN_DSSTECH_NR 1 /**< NR support */ + +/** The type of beam grouping 5.4.7.10.1 */ +#define XRAN_BEAMGT_COMMON 0 /** common beam */ +#define XRAN_BEAMGT_MATRIXIND 1 /** beam matrix indication */ +#define XRAN_BEAMGT_VECTORLIST 2 /** beam vector listing */ + +#define XRAN_MAX_NUMPORTC_EXT10 64 /* defined in 5.4.7.10.2 */ + /** * This structure contains the information to generate the section body of C-Plane message */ struct xran_section_info { + /** for U-plane */ + struct xran_section_desc sec_desc[XRAN_NUM_OF_SYMBOL_PER_SLOT]; + int32_t freqOffset; /* X 24bits */ + uint32_t startPrbc:9; /* X X X X X 9bits */ + uint32_t numPrbc:9; /* X X X X X 8bits */ /* will be converted to zero if >255 */ + uint32_t type:4; /* type of this section */ /* section type bit- */ /* 0 1 3 5 6 7 length */ - uint16_t id; /* X X X X X 12bits */ - uint8_t rb; /* X X X X X 1bit */ - uint8_t symInc; /* X X X X X 1bit */ - uint16_t startPrbc; /* X X X X X 10bits */ - uint8_t numPrbc; /* X X X X X 8bits */ - uint8_t numSymbol; /* X X X X 4bits */ - uint16_t reMask; /* X X X X 12bits */ + uint32_t startSymId:4; /* X X X X X X 4bits */ + uint32_t numSymbol:4; /* X X X X 4bits */ + uint32_t res:2; uint16_t beamId; /* X X 15bits */ uint16_t ueId; /* X X 15bits */ uint16_t regFactor; /* X 16bits */ - int32_t freqOffset; /* X 24bits */ - uint8_t ef; /* X X X X 1bit */ + uint16_t id; /* X X X X X 12bits */ + uint16_t reMask; /* X X X X 12bits */ + + uint8_t symInc:1; /* X X X X X 1bit */ + uint8_t rb:1; /* X X X X X 1bit */ + uint8_t ef:1; /* X X X X 1bit */ + uint8_t prbElemBegin:1; /* Flag to indicate beginning of a PRB element */ + uint8_t prbElemEnd:1; /* Flag to indicate end of a PRB element */ + uint8_t reserved:3; + uint8_t compMeth:4; /* X X X 4bits */ + uint8_t iqWidth:4; /* X X X 4bits */ +}; + - uint8_t type; /* type of this section */ - uint16_t pad0; +struct xran_sectionext1_info { + uint16_t rbNumber; /**< number RBs to ext1 chain */ + uint16_t bfwNumber; /**< number of bf weights in this section */ + uint8_t bfwIqWidth; + uint8_t bfwCompMeth; + int8_t *p_bfwIQ; /**< pointer to formed section extention */ + int16_t bfwIQ_sz; /**< size of buffer with section extention information */ + union { + uint8_t exponent; + uint8_t blockScaler; + uint8_t compBitWidthShift; + uint8_t activeBeamspaceCoeffMask[XRAN_MAX_BFW_N]; /* ceil(N/8)*8, should be multiple of 8 */ + } bfwCompParam; + }; + +struct xran_sectionext2_info { + uint8_t bfAzPtWidth; /* beamforming zenith beamwidth parameter */ + uint8_t bfAzPt; + uint8_t bfZePtWidth; /* beamforming azimuth beamwidth parameter */ + uint8_t bfZePt; + uint8_t bfAz3ddWidth; /* beamforming zenith pointing parameter */ + uint8_t bfAz3dd; + uint8_t bfZe3ddWidth; /* beamforming azimuth pointing parameter */ + uint8_t bfZe3dd; + + uint8_t bfAzSI; + uint8_t bfZeSI; + }; + +struct xran_sectionext3_info { + uint8_t codebookIdx; + uint8_t layerId; + uint8_t numLayers; + uint8_t txScheme; + uint16_t crsReMask; + uint8_t crsShift; + uint8_t crsSymNum; + uint16_t numAntPort; /* number of antenna port - 2 or 4 */ + uint16_t beamIdAP1; + uint16_t beamIdAP2; + uint16_t beamIdAP3; + }; + +struct xran_sectionext4_info { + uint8_t csf; + uint8_t pad0; + uint16_t modCompScaler; + }; + +struct xran_sectionext5_info { + uint8_t num_sets; + struct { + uint16_t csf; + uint16_t mcScaleReMask; + uint16_t mcScaleOffset; + } mc[XRAN_MAX_MODCOMP_ADDPARMS]; + }; + +struct xran_sectionext6_info { + uint8_t rbgSize; + uint8_t pad; + uint16_t symbolMask; + uint32_t rbgMask; +}; + +struct xran_sectionext7_info { + uint16_t eAxCmask; +}; + +struct xran_sectionext8_info { + uint16_t regularizationFactor; +}; + +struct xran_sectionext9_info { + uint8_t technology; + uint8_t reserved; +}; + +struct xran_sectionext10_info { + uint8_t numPortc; + uint8_t beamGrpType; + uint16_t beamID[XRAN_MAX_NUMPORTC_EXT10]; +}; + +struct xran_sectionext11_info { + uint8_t RAD; + uint8_t disableBFWs; + + uint8_t numBundPrb; + uint8_t numSetBFWs; /* Total number of beam forming weights set (L) */ + + uint8_t bfwCompMeth; + uint8_t bfwIqWidth; + + int32_t totalBfwIQLen; + int32_t maxExtBufSize; /* Maximum space of external buffer */ + uint8_t *pExtBuf; /* pointer to start of external buffer */ + void *pExtBufShinfo; /* Pointer to rte_mbuf_ext_shared_info */ +}; + +union xran_ext_bfwcompparam_info { + uint8_t exponent; +// uint8_t blockScaler; /* Not supported */ +// uint8_t compBitWidthShift; /* Not supported */ +// uint8_t *pActBeamspaceCoeffMask; /* Not supported */ + }; +struct xran_ext11_prbbundle_info { + union xran_ext_bfwcompparam_info bfwCompParam; + uint16_t beamId; /* 15bits, needs to strip MSB */ + uint16_t BFWSize; /* actual size of bfws in bytes */ + uint8_t *pBFWs; /* external buffer pointer */ +}; +struct xran_sectionext11_recv_info { + uint8_t RAD; + uint8_t disableBFWs; + + uint8_t numBundPrb; + uint8_t numSetBFWs; /* Total number of beam forming weights set (L) */ + + uint8_t bfwCompMeth; + uint8_t bfwIqWidth; + + int32_t totalBfwIQLen; + int32_t maxExtBufSize; /* Maximum space of external buffer */ + uint8_t *pExtBuf; /* pointer to start of external buffer */ + void *pExtBufShinfo; /* Pointer to rte_mbuf_ext_shared_info */ + + /* For parsing */ + struct xran_ext11_prbbundle_info bundInfo[XRAN_MAX_SET_BFWS]; +}; + +struct xran_sectionext_info { + uint16_t type; + uint16_t len; + void *data; }; /** @@ -168,16 +406,23 @@ struct xran_cp_header_params { uint16_t cpLength; /* X X 16bits */ }; +/** The structure for the generation of section extension */ +struct xran_section_ext_gen_info { + uint16_t type; /**< the type of section extension */ + uint16_t len; /**< length of extension data */ + void *data; /**< pointer to extension data */ + }; + /** * This structure to hold the information to generate the sections of C-Plane message */ struct xran_section_gen_info { - struct xran_section_info info; /**< The information for section */ + struct xran_section_info *info; /**< The information for section */ + + /** the array to store section extension */ + struct xran_section_ext_gen_info exData[XRAN_MAX_NUM_EXTENSIONS]; + uint32_t exDataSize; /**< The number of Extensions or type 6/7 data */ +}; - uint32_t exDataSize; - /**< Extension or type 6/7 data size, not supported */ - void *exData; - /*(< The pointer to the extension or type 6/7 data, not supported */ - }; /** * This structure to hold the information to generate a C-Plane message */ @@ -192,29 +437,128 @@ struct xran_cp_gen_params { /**< Array of the section information */ }; +/** The structure to store received section extension */ +struct xran_section_ext_recv_info { + uint16_t type; /**< the type of section extension */ + uint16_t size; + union { + struct xran_sectionext1_info ext1; + struct xran_sectionext2_info ext2; + struct xran_sectionext3_info ext3; + struct xran_sectionext4_info ext4; + struct xran_sectionext5_info ext5; + struct xran_sectionext6_info ext6; + struct xran_sectionext9_info ext9; + struct xran_sectionext10_info ext10; + struct xran_sectionext11_recv_info ext11; + } u; +}; + +/** + * This structure to hold the information of received sections of C-Plane message */ +struct xran_section_recv_info { + struct xran_section_info info; /**< The information for received section */ + + uint32_t numExts; + /** the array to store section extension */ + struct xran_section_ext_recv_info exts[XRAN_MAX_NUM_EXTENSIONS]; +}; + +/** + * This structure to store received C-Plane message */ +struct xran_cp_recv_params { + uint8_t dir; /**< UL or DL */ + uint8_t sectionType; /**< each section must have same type with this */ + uint16_t numSections; /**< the number of sections received */ + uint8_t numSetBFW; /**