From 0bdd575f55257e64b4becb4cee0df0dab2bac3fa Mon Sep 17 00:00:00 2001 From: Balaji Shankaran Date: Fri, 26 Jun 2020 20:32:12 +0530 Subject: [PATCH] Ue Create Request from DU_APP to MAC JIRA ID: ODUHIGH-176 Change-Id: I8e31a2f302cd3fad402417e473169cfce6f0384f Signed-off-by: Balaji Shankaran --- src/5gnrmac/mac_msg_hdl.c | 27 +++ src/5gnrmac/rg_ex_ms.c | 4 + src/cm/du_app_mac_inf.c | 77 ++++++ src/cm/du_app_mac_inf.h | 566 +++++++++++++++++++++++++++++++++++++++++++ src/du_app/du_cfg.h | 2 + src/du_app/du_f1ap_msg_hdl.c | 5 +- src/du_app/du_mgr.h | 30 ++- src/du_app/du_mgr_ex_ms.c | 2 + src/du_app/du_msg_hdl.c | 4 +- src/du_app/du_ue_mgr.c | 511 +++++++++++++++++++++++++++++++++++++- src/du_app/du_ue_mgr.h | 2 + 11 files changed, 1216 insertions(+), 14 deletions(-) diff --git a/src/5gnrmac/mac_msg_hdl.c b/src/5gnrmac/mac_msg_hdl.c index fa8b678b6..8efe4006e 100644 --- a/src/5gnrmac/mac_msg_hdl.c +++ b/src/5gnrmac/mac_msg_hdl.c @@ -428,6 +428,33 @@ uint16_t macSendUlCcchInd(uint8_t *rrcContainer, uint16_t cellId, uint16_t crnti return ret; } +/******************************************************************* + * + * @brief Handles Ue Create Request from DU APP + * + * @details + * + * Function : MacHdlUeCreateReq + * + * Functionality: + * Handles Ue create Request from DU APP + * + * @params[in] Post structure pointer + * MacUeCfg pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t MacHdlUeCreateReq(Pst *pst, MacUeCfg *ueCfg) +{ + /* TODO : Create MAC UE Context. + Copy Tx Pdu from raCb + Delete RaCb + Send MacUeContext to SCH */ + MAC_FREE_SHRABL_BUF(pst->region, pst->pool, ueCfg, sizeof(MacUeCfg)); + return ROK; +} + /********************************************************************** End of file **********************************************************************/ diff --git a/src/5gnrmac/rg_ex_ms.c b/src/5gnrmac/rg_ex_ms.c index 335a3671e..6ca817a17 100755 --- a/src/5gnrmac/rg_ex_ms.c +++ b/src/5gnrmac/rg_ex_ms.c @@ -145,6 +145,10 @@ Buffer *mBuf; /* message buffer */ /* Process DL CCCH Ind */ unpackMacDlCcchInd(MacHdlDlCcchInd, pst, mBuf); break; + case EVENT_MAC_UE_CREATE_REQ: + /* Process Ue Create Request */ + unpackMacUeCreateReq(MacHdlUeCreateReq, pst, mBuf); + break; default: RG_FREE_MSG(mBuf); break; diff --git a/src/cm/du_app_mac_inf.c b/src/cm/du_app_mac_inf.c index 3ade19478..eb686a133 100644 --- a/src/cm/du_app_mac_inf.c +++ b/src/cm/du_app_mac_inf.c @@ -708,8 +708,85 @@ uint16_t unpackMacDlCcchInd(DuMacDlCcchInd func, Pst *pst, Buffer *mBuf) return RFAILED; } +/******************************************************************* + * + * @brief Packs and Sends UE create Request from DUAPP to MAC + * + * @details + * + * Function : packDuMacUeCreateReq + * + * Functionality: + * Packs and Sends UE Create Request from DUAPP to MAC + * + * + * @params[in] Post structure pointer + * MacUeCfg pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t packDuMacUeCreateReq(Pst *pst, MacUeCfg *ueCfg) +{ + Buffer *mBuf = NULLP; + + if(pst->selector == DU_SELECTOR_LWLC) + { + if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) + { + DU_LOG("\nMAC : Memory allocation failed at packDuMacUeCreateReq"); + return RFAILED; + } + /* pack the address of the structure */ + CMCHKPK(cmPkPtr,(PTR)ueCfg, mBuf); + } + else + { + DU_LOG("\nMAC: Only LWLC supported for packDuMacUeCreateReq"); + return RFAILED; + } + return SPstTsk(pst,mBuf); +} +/******************************************************************* + * + * @brief Unpacks UE Create Request received from DU APP + * + * @details + * + * Function : unpackMacUeCreateReq + * + * Functionality: + * Unpacks UE Create Request received from DU APP + * + * @params[in] Pointer to Handler + * Post structure pointer + * Message Buffer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t unpackMacUeCreateReq(DuMacUeCreateReq func, Pst *pst, Buffer *mBuf) +{ + if(pst->selector == DU_SELECTOR_LWLC) + { + MacUeCfg *ueCfg; + + /* unpack the address of the structure */ + CMCHKUNPK(cmUnpkPtr, (PTR *)&ueCfg, mBuf); + SPutMsg(mBuf); + return (*func)(pst, ueCfg); + } + else + { + /* Nothing to do for other selectors */ + DU_LOG("\n Only LWLC supported for UE Create Request "); + SPutMsg(mBuf); + } + + return RFAILED; +} /********************************************************************** End of file **********************************************************************/ diff --git a/src/cm/du_app_mac_inf.h b/src/cm/du_app_mac_inf.h index c9855a202..ccc3206f7 100644 --- a/src/cm/du_app_mac_inf.h +++ b/src/cm/du_app_mac_inf.h @@ -20,6 +20,8 @@ #ifndef __MACINT_H__ #define __MACINT_H__ +#include + #define NUM_NUMEROLOGY 5 /* Number of numerology */ #define MAXIMUM_TDD_PERIODICITY 5 #define MAX_SYMB_PER_SLOT 14 @@ -44,6 +46,21 @@ #define SRB_ID_0 0 #define SRB_ID_1 1 +/* Macro for Ue Context */ +#define MAX_NUM_LOGICAL_CHANNELS 11 +#define MAX_NUM_SR_CFG_PER_CELL_GRP 8 /* Max number of scheduling request config per cell group */ +#define MAC_NUM_TAGS 4 /* Max number of timing advance groups */ +#define MAX_NUM_BWP 4 /* Max number of BWP per serving cell */ +#define MAX_NUM_CRSET 3 /* Max number of control resource set in add/modify/release list */ +#define MAX_NUM_SEARCH_SPC 10 /* Max number of search space in add/modify/release list */ +#define FREQ_DOM_RSRC_SIZE 6 /* i.e. 6 bytes because Size of frequency domain resource is 45 bits */ +#define MONITORING_SYMB_WITHIN_SLOT_SIZE 2 /* i.e. 2 bytes because size of monitoring symbols within slot is 14 bits */ +#define MAX_NUM_DL_ALLOC 16 /* Max number of pdsch time domain downlink allocation */ +#define MAX_NUM_UL_ALLOC 16 /* Max number of pusch time domain uplink allocation */ +#define SD_SIZE 3 /* Max size of Slice Differentiator in S-NSSAI */ +#define PDSCH_START_SYMBOL_LEN 53 +#define PUSCH_START_SYMBOL_LEN 41 + /* Macros for coupling */ #define DU_MAC_LC 0 #define DU_MAC_TC 1 @@ -58,6 +75,7 @@ #define EVENT_MAC_STOP_IND 205 #define EVENT_MAC_UL_CCCH_IND 206 #define EVENT_MAC_DL_CCCH_IND 207 +#define EVENT_MAC_UE_CREATE_REQ 208 typedef enum { @@ -133,6 +151,213 @@ typedef enum RRC_SETUP }DlCcchMsgType; +/* Enums for Ue Create Request */ + +/* SR PROHIBIT TIMER */ +typedef enum +{ + SR_PROHIBIT_MS_1, + SR_PROHIBIT_MS_2, + SR_PROHIBIT_MS_4, + SR_PROHIBIT_MS_8, + SR_PROHIBIT_MS_16, + SR_PROHIBIT_MS_32, + SR_PROHIBIT_MS_64, + SR_PROHIBIT_MS_128 +}SrProhibitTimer; + +typedef enum +{ + SR_TRANS_MAX_N_4, + SR_TRANS_MAX_N_8, + SR_TRANS_MAX_N_16, + SR_TRANS_MAX_N_32, + SR_TRANS_MAX_N_64, + SR_TRANS_MAX_spare3, + SR_TRANS_MAX_spare2, + SR_TRANS_MAX_spare1 +}SrTransMax; + +typedef enum +{ + TIME_ALIGNMENT_TIMER_MS_500, + TIME_ALIGNMENT_TIMER_MS_750, + TIME_ALIGNMENT_TIMER_MS_1280, + TIME_ALIGNMENT_TIMER_MS_1920, + TIME_ALIGNMENT_TIMER_MS_2560, + TIME_ALIGNMENT_TIMER_MS_5120, + TIME_ALIGNMENT_TIMER_MS_10240, + TIME_ALIGNMENT_TIMER_INFINITY +}TimeAlignmentTimer; + +typedef enum +{ + PHR_PERIODIC_TIMER_SF_10, + PHR_PERIODIC_TIMER_SF_20, + PHR_PERIODIC_TIMER_SF_50, + PHR_PERIODIC_TIMER_SF_100, + PHR_PERIODIC_TIMER_SF_200, + PHR_PERIODIC_TIMER_SF_500, + PHR_PERIODIC_TIMER_SF_1000, + PHR_PERIODIC_TIMER_INFINITY +}PhrPeriodicTimer; + +typedef enum +{ + PHR_PROHIBIT_TIMER_SF_0, + PHR_PROHIBIT_TIMER_SF_10, + PHR_PROHIBIT_TIMER_SF_20, + PHR_PROHIBIT_TIMER_SF_50, + PHR_PROHIBIT_TIMER_SF_100, + PHR_PROHIBIT_TIMER_SF_200, + PHR_PROHIBIT_TIMER_SF_500, + PHR_PROHIBIT_TIMER_SF_1000 +}PhrProhibitTimer; + +typedef enum +{ + PHR_TX_PWR_FACTOR_CHANGE_DB_1, + PHR_TX_PWR_FACTOR_CHANGE_DB_3, + PHR_TX_PWR_FACTOR_CHANGE_DB_6, + PHR_TX_PWR_FACTOR_CHANGE_INFINITY +}PhrTxPwrFactorChange; + +typedef enum +{ + PHR_MODE_OTHER_CG_REAL, + PHR_MODE_OTHER_CG_VIRTUAL +}PhrModeOtherCG; + +typedef enum +{ + PDSCH_HARQ_ACK_CODEBOOK_SEMISTATIC, + PDSCH_HARQ_ACK_CODEBOOK_DYNAMIC +}PdschHarqAckCodebook; + +typedef enum +{ + NUM_HARQ_PROC_FOR_PDSCH_N_2, + NUM_HARQ_PROC_FOR_PDSCH_N_4, + NUM_HARQ_PROC_FOR_PDSCH_N_6, + NUM_HARQ_PROC_FOR_PDSCH_N_10, + NUM_HARQ_PROC_FOR_PDSCH_N_16 +}NumHarqProcForPdsch; + +typedef enum +{ + MAX_CODE_BLOCK_GROUP_PER_TB_N_2, + MAX_CODE_BLOCK_GROUP_PER_TB_N_4, + MAX_CODE_BLOCK_GROUP_PER_TB_N_6, + MAX_CODE_BLOCK_GROUP_PER_TB_N_8 +}MaxCodeBlkGrpPerTB; + +typedef enum +{ + PDSCH_X_OVERHEAD_6, + PDSCH_X_OVERHEAD_12, + PDSCH_X_OVERHEAD_18 +}PdschXOverhead; + +typedef enum +{ + TRANSFORM_PRECODER_ENABLED, + TRANSFORM_PRECODER_DISABLED +}TransformPrecoder; + +typedef enum +{ + CCE_REG_MAPPINGTYPE_PR_INTERLEAVED, + CCE_REG_MAPPINGTYPE_PR_NONINTERLEAVED +}REGMappingType; + +typedef enum +{ + SLOTPERIODICITYANDOFFSET_PR_SL1, + SLOTPERIODICITYANDOFFSET_PR_SL2, + SLOTPERIODICITYANDOFFSET_PR_SL4, + SLOTPERIODICITYANDOFFSET_PR_SL5, + SLOTPERIODICITYANDOFFSET_PR_SL8, + SLOTPERIODICITYANDOFFSET_PR_SL10, + SLOTPERIODICITYANDOFFSET_PR_SL16, + SLOTPERIODICITYANDOFFSET_PR_SL20, + SLOTPERIODICITYANDOFFSET_PR_SL40, + SLOTPERIODICITYANDOFFSET_PR_SL80, + SLOTPERIODICITYANDOFFSET_PR_SL160, + SLOTPERIODICITYANDOFFSET_PR_SL320, + SLOTPERIODICITYANDOFFSET_PR_SL640, + SLOTPERIODICITYANDOFFSET_PR_SL1280, + SLOTPERIODICITYANDOFFSET_PR_SL2560 +}MSlotPeriodAndOffset; + +typedef enum +{ + SAMEASREG_BUNDLE, + ALL_CONTIGUOUS_RBS +}PrecoderGranul; + +typedef enum +{ + SEARCHSPACETYPE_PR_COMMON, + SEARCHSPACETYPE_PR_UE_SPECIFIC +}SearchSpaceType; + +typedef enum +{ + AGGREGATIONLEVEL_N0 = 0, + AGGREGATIONLEVEL_N1 = 1, + AGGREGATIONLEVEL_N2 = 2, + AGGREGATIONLEVEL_N3 = 3, + AGGREGATIONLEVEL_N4 = 4, + AGGREGATIONLEVEL_N5 = 5, + AGGREGATIONLEVEL_N6 = 6, + AGGREGATIONLEVEL_N8 = 7 +}AggrLevel; + +typedef enum +{ + ADDITIONALPOSITION_POS0, + ADDITIONALPOSITION_POS1, + ADDITIONALPOSITION_POS3 +}AddPosType; + +typedef enum +{ + MAPPING_TYPEA, + MAPPING_TYPEB +}CommonMappingType; + +typedef enum +{ + RESOURCEALLOCATION_TYPE0, + RESOURCEALLOCATION_TYPE1, + RESOURCEALLOCATION_DYNAMICSWITCH +}ResAllocType; + +typedef enum +{ + RBG_SIZE_CONFIG1, + RBG_SIZE_CONFIG2 +}RBGSize; + +typedef enum +{ + CODEWORDS_SCHED_BY_DCI_N1, + CODEWORDS_SCHED_BY_DCI_N2 +}CodeWordsSchedDci; + +typedef enum +{ + TYPE_STATIC_BUNDLING, + TYPE_DYNAMIC_BUNDLING +}BundlingType; + +typedef enum +{ + LC_PRIORITY_1 = 1, + LC_PRIORITY_2, + LC_PRIORITY_3 +}LcPriority; + typedef struct carrierCfg { Bool pres; @@ -338,6 +563,339 @@ typedef struct dlCcchInd uint8_t *dlCcchMsg; }DlCcchIndInfo; +typedef struct bsrCfg +{ + uint8_t periodicTimer; + uint8_t retxTimer; + uint8_t srDelayTimer; +}BsrCfg; + + +/* Info of Scheduling Request to Add/Modify */ +typedef struct schedReqInfo +{ + uint8_t schedReqId; + SrProhibitTimer srProhibitTmr; + SrTransMax srTransMax; +}SchedReqInfo; + +/* Scheduling Request Configuration */ +typedef struct schedReqCfg +{ + uint8_t addModListCount; + SchedReqInfo addModList[MAX_NUM_SR_CFG_PER_CELL_GRP]; /* List of Scheduling req to be added/modified */ + uint8_t relListCount; + uint8_t relList[MAX_NUM_SR_CFG_PER_CELL_GRP]; /* list of scheduling request Id to be deleted */ +}SchedReqCfg; + +typedef struct tagInfo +{ + uint8_t tagId; + TimeAlignmentTimer timeAlignTimer; +}TagInfo; + +typedef struct tagCfg +{ + uint8_t addModListCount; + TagInfo addModList[MAC_NUM_TAGS]; /* List of Tag to Add/Modify */ + uint8_t relListCount; + uint8_t relList[MAC_NUM_TAGS]; /* list of Tag Id to release */ +}TagCfg; + +typedef struct phrCfg +{ + PhrPeriodicTimer periodicTimer; + PhrProhibitTimer prohibitTimer; + PhrTxPwrFactorChange txPowerFactor; + bool multiplePHR; + bool dummy; + bool phrType2OtherCell; + PhrModeOtherCG phrOtherCG; +}PhrCfg; + +typedef struct macCellGrpCfg +{ + SchedReqCfg schReqCfg; + TagCfg tagCfg; + //BsrCfg bsrCfg; + bool phrCfgSetupPres; /* true/false: phrCfgSetup/phrCfgRelease */ + PhrCfg phrCfg; +}MacCellGrpCfg; + +typedef struct phyCellGrpCfg +{ + PdschHarqAckCodebook pdschHarqAckCodebook; + uint8_t pNrFr1; +}PhyCellGrpCfg; + +/* Control resource set info */ +typedef struct controlRsrcSet +{ + uint8_t cRSetId; /* Control resource set id */ + uint8_t freqDomainRsrc[FREQ_DOM_RSRC_SIZE]; /* Frequency domain resource */ + uint8_t duration; + REGMappingType cceRegMappingType; + PrecoderGranul precoderGranularity; + uint16_t dmrsScramblingId; +}ControlRsrcSet; + +/* Search Space info */ +typedef struct searchSpace +{ + uint8_t searchSpaceId; + uint8_t cRSetId; + MSlotPeriodAndOffset mSlotPeriodicityAndOffset; + uint8_t mSymbolsWithinSlot[MONITORING_SYMB_WITHIN_SLOT_SIZE]; + AggrLevel numCandidatesAggLevel1; /* Number of candidates for aggregation level 1 */ + AggrLevel numCandidatesAggLevel2; /* Number of candidates for aggregation level 2 */ + AggrLevel numCandidatesAggLevel4; /* Number of candidates for aggregation level 4 */ + AggrLevel numCandidatesAggLevel8; /* Number of candidates for aggregation level 8 */ + AggrLevel numCandidatesAggLevel16; /* Number of candidates for aggregation level 16 */ + SearchSpaceType searchSpaceType; + uint8_t ueSpecificDciFormat; +}SearchSpace; + +/* PDCCH cofniguration */ +typedef struct pdcchConfig +{ + uint8_t numCRsetToAddMod; + ControlRsrcSet cRSetToAddModList[MAX_NUM_CRSET]; /* List of control resource set to add/modify */ + uint8_t numCRsetToRel; + uint8_t cRSetToRelList[MAX_NUM_CRSET]; /* List of control resource set to release */ + uint8_t numSearchSpcToAddMod; + SearchSpace searchSpcToAddModList[MAX_NUM_SEARCH_SPC]; /* List of search space to add/modify */ + uint8_t numSearchSpcToRel; + uint8_t searchSpcToRelList[MAX_NUM_SEARCH_SPC]; /* List of search space to release */ +}PdcchConfig; + +/* PDSCH time domain resource allocation */ +typedef struct pdschTimeDomRsrcAlloc +{ + CommonMappingType mappingType; + uint8_t startSymbolAndLength; +}PdschTimeDomRsrcAlloc; + +/* DMRS downlink configuration */ +typedef struct dmrsDlCfg +{ + AddPosType addPos; /* DMRS additional position */ +}DmrsDlCfg; + +/* PDSCH Configuration */ +typedef struct pdschConfig +{ + DmrsDlCfg dmrsDlCfgForPdschMapTypeA; + ResAllocType resourceAllocType; + uint8_t numTimeDomRsrcAlloc; + PdschTimeDomRsrcAlloc timeDomRsrcAllociList[MAX_NUM_DL_ALLOC]; /* PDSCH time domain DL resource allocation list */ + RBGSize rbgSize; + CodeWordsSchedDci numCodeWordsSchByDci; /* Number of code words scheduled by DCI */ + BundlingType bundlingType; +}PdschConfig; + +/* Initial Downlink BWP */ +typedef struct initialDlBwp +{ + bool pdcchPresent; + PdcchConfig pdcchCfg; + bool pdschPresent; + PdschConfig pdschCfg; +}InitialDlBwp; + +/* BWP Downlink common */ +typedef struct bwpDlCommon +{ +}BwpDlCommon; + +/* Downlink BWP information */ +typedef struct dlBwpInfo +{ + uint8_t bwpId; +}DlBwpInfo; + +/* PDCCH Serving Cell configuration */ +typedef struct pdschServCellCfg +{ + uint8_t *maxMimoLayers; + NumHarqProcForPdsch numHarqProcForPdsch; + MaxCodeBlkGrpPerTB *maxCodeBlkGrpPerTb; + bool *codeBlkGrpFlushInd; + PdschXOverhead *xOverhead; +}PdschServCellCfg; + +/* PUCCH Configuration */ +typedef struct pucchCfg +{ + /* TODO : Not used currently */ +}PucchCfg; + +/* Transform precoding disabled */ +typedef struct transPrecodDisabled +{ + uint16_t scramblingId0; +}TransPrecodDisabled; + +/* DMRS Uplink configuration */ +typedef struct dmrsUlCfg +{ + AddPosType addPos; /* DMRS additional position */ + TransPrecodDisabled transPrecodDisabled; /* Transform precoding disabled */ +}DmrsUlCfg; + +/* PUSCH Time Domain Resource Allocation */ +typedef struct puschTimeDomRsrcAlloc +{ + uint8_t k2; + CommonMappingType mappingType; + uint8_t startSymbolAndLength; +}PuschTimeDomRsrcAlloc; + +/* PUSCH Configuration */ +typedef struct puschCfg +{ + DmrsUlCfg dmrsUlCfgForPuschMapTypeA; + ResAllocType resourceAllocType; + uint8_t numTimeDomRsrcAlloc; + PuschTimeDomRsrcAlloc timeDomRsrcAllocList[MAX_NUM_UL_ALLOC]; /* PUSCH time domain UL resource allocation list */ + TransformPrecoder transformPrecoder; +}PuschCfg; + +/* Initial Uplink BWP */ +typedef struct initialUlBwp +{ + bool pucchPresent; + PucchCfg pucchCfg; + bool puschPresent; + PuschCfg puschCfg; +}InitialUlBwp; + +/* Uplink BWP information */ +typedef struct ulBwpInfo +{ + uint8_t bwpId; +}UlBwpInfo; + +/* Serving cell configuration */ +typedef struct servCellCfgInfo +{ + InitialDlBwp initDlBwp; + uint8_t numDlBwpToAdd; + DlBwpInfo DlBwpToAddList[MAX_NUM_BWP]; + uint8_t firstActvDlBwpId; + uint8_t defaultDlBwpId; + uint8_t *bwpInactivityTmr; + PdschServCellCfg pdschServCellCfg; + InitialUlBwp initUlBwp; + uint8_t numUlBwpToAdd; + UlBwpInfo UlBwpToAddList[MAX_NUM_BWP]; + uint8_t firstActvUlBwpId; +}ServCellCfgInfo; + +/* Special cell configuration */ +typedef struct spCellCfg +{ + uint8_t servCellIdx; + ServCellCfgInfo servCellCfg; +}SpCellCfg; + +typedef struct maxAggrBitRate +{ + uint32_t ulBits; + uint32_t dlBits; +}MaxAggrBitRate; + +/* Single Network Slice Selection assistance Info */ +typedef struct snssai +{ + uint8_t sst; /* Slice Type */ + uint8_t sd[SD_SIZE]; /* Slice Differentiator */ +}Snssai; + +typedef struct nonDynFiveQi +{ + uint16_t fiveQi; + uint8_t priorLevel; + uint16_t avgWindow; + uint16_t maxDataBurstVol; +}NonDynFiveQi; + +typedef struct dynFiveQi +{ + uint8_t priorLevel; + uint16_t packetDelayBudget; + uint8_t packetErrRateScalar; + uint8_t packetErrRateExp; + uint16_t fiveQi; + uint8_t delayCritical; + uint16_t avgWindow; + uint16_t maxDataBurstVol; +}DynFiveQi; + +typedef struct ngRanAllocAndRetPri +{ + uint8_t priorityLevel; + uint8_t preEmptionCap; + uint8_t preEmptionVul; +}NgRanAllocAndRetPri; + +typedef struct grbQosInfo +{ + uint32_t maxFlowBitRateDl; + uint32_t maxFlowBitRateUl; + uint32_t guarFlowBitRateDl; + uint32_t guarFlowBitRateUl; +}GrbQosInfo; + +typedef struct drbQos +{ + uint8_t fiveQiType; /* Dynamic or non-dynamic */ + union + { + NonDynFiveQi nonDyn5Qi; + DynFiveQi dyn5Qi; + }u; + NgRanAllocAndRetPri ngRanRetPri; + GrbQosInfo grbQosInfo; + uint16_t pduSessionId; + uint32_t ulPduSessAggMaxBitRate; +}DrbQosInfo; + +typedef struct ulLcCfg +{ + uint8_t priority; + uint8_t lcGroup; + uint8_t schReqId; + uint8_t pbr; // prioritisedBitRate + uint8_t bsd; // bucketSizeDuration +}UlLcCfg; + +typedef struct duLcCfg +{ + LcPriority lcp; // logical Channel Prioritization +}DlLcCfg; + +typedef struct lcCfg +{ + uint8_t lcId; + DrbQosInfo *drbQos; + Snssai *snssai; + UlLcCfg *ulLcCfg; + DlLcCfg dlLcCfg; + +}LcCfg; + +typedef struct macUeCfg +{ + uint16_t cellIdx; + uint8_t ueIdx; + uint16_t crnti; + MacCellGrpCfg macCellGrpCfg; + PhyCellGrpCfg phyCellGrpCfg; + SpCellCfg spCellCfg; + MaxAggrBitRate *maxAggrBitRate; + uint8_t numLcs; + LcCfg lcCfgList[MAX_NUM_LOGICAL_CHANNELS]; +}MacUeCfg; /* Functions for slot Ind from MAC to DU APP*/ typedef uint16_t (*DuMacSlotInd) ARGS(( @@ -386,6 +944,11 @@ typedef uint16_t (*DuMacDlCcchInd) ARGS(( Pst *pst, DlCcchIndInfo *dlCcchIndInfo )); +/* UE create Request from DU APP to MAC*/ +typedef uint8_t (*DuMacUeCreateReq) ARGS(( + Pst *pst, + MacUeCfg *ueCfg )); + extern uint16_t packMacSlotInd(Pst *pst, SlotInfo *slotInfo ); extern uint16_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf); extern uint16_t duHandleSlotInd(Pst *pst, SlotInfo *slotInfo); @@ -409,6 +972,9 @@ extern uint16_t duHandleUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo); extern uint16_t packMacDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo); extern uint16_t unpackMacDlCcchInd(DuMacDlCcchInd func, Pst *pst, Buffer *mBuf); extern uint16_t MacHdlDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo); +extern uint8_t packDuMacUeCreateReq(Pst *pst, MacUeCfg *ueCfg); +extern uint8_t unpackMacUeCreateReq(DuMacUeCreateReq func, Pst *pst, Buffer *mBuf); +extern uint8_t MacHdlUeCreateReq(Pst *pst, MacUeCfg *ueCfg); uint8_t sendStopIndMacToDuApp(); #endif diff --git a/src/du_app/du_cfg.h b/src/du_app/du_cfg.h index 12656abd8..eec527ecf 100644 --- a/src/du_app/du_cfg.h +++ b/src/du_app/du_cfg.h @@ -123,6 +123,8 @@ #define PDCCH_SRCH_SPC_TWO_AGG_LVL8_CANDIDATE 2 /* Num of candidate at aggregation level 8 */ #define PDCCH_SRCH_SPC_TWO_AGG_LVL16_CANDIDATE 1 /* Num of candidate at aggregation level 16 */ #define PDCCH_SRCH_SPC_TWO_UE_SPEC_DCI_FORMAT 0 /* format 0-0 and 1-0 */ +#define PDCCH_FREQ_DOM_RSRC 255 /* Frequency domain Resource Value */ +#define PDCCH_SYMBOL_WITHIN_SLOT 128 /* Symbol within Slot Value */ #define SIB1_VALUE_TAG 10 diff --git a/src/du_app/du_f1ap_msg_hdl.c b/src/du_app/du_f1ap_msg_hdl.c index 3398992ca..3cd438c0e 100644 --- a/src/du_app/du_f1ap_msg_hdl.c +++ b/src/du_app/du_f1ap_msg_hdl.c @@ -2548,7 +2548,7 @@ struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList return RFAILED; } byteIdx = 0; - controlRSet->frequencyDomainResources.buf[byteIdx] = 255; /* setting 8 MSBs i.e. ff */ + controlRSet->frequencyDomainResources.buf[byteIdx] = PDCCH_FREQ_DOM_RSRC; /* setting 8 MSBs i.e. ff */ for(byteIdx = 1; byteIdx < numBytes; byteIdx++) { controlRSet->frequencyDomainResources.buf[byteIdx] = 0; @@ -2724,7 +2724,8 @@ struct PDCCH_Config__searchSpacesToAddModList *searchSpcList } byteIdx = 0; - searchSpc->monitoringSymbolsWithinSlot->buf[byteIdx++] = 128 /* setting MSB to 128 i.e. 0x80 */; + searchSpc->monitoringSymbolsWithinSlot->buf[byteIdx++] = \ + PDCCH_SYMBOL_WITHIN_SLOT /* setting MSB to 128 i.e. 0x80 */; searchSpc->monitoringSymbolsWithinSlot->buf[byteIdx++] = 0; searchSpc->monitoringSymbolsWithinSlot->bits_unused = bitsUnused; diff --git a/src/du_app/du_mgr.h b/src/du_app/du_mgr.h index 2b08c776b..6b4183f68 100644 --- a/src/du_app/du_mgr.h +++ b/src/du_app/du_mgr.h @@ -99,8 +99,9 @@ #define DU_ZERO_VAL 0 -/* Macros */ +#define DU_UE_START_CRNTI 100 +/* Macros */ #define ADD 0 #define DEL 1 @@ -174,6 +175,12 @@ typedef enum DELETION_IN_PROGRESS }CellStatus; +typedef enum +{ + UE_INACTIVE, + UE_ACTIVE +}UeState; + typedef struct cellCfgParams { NrEcgi nrEcgi; /* ECGI */ @@ -183,13 +190,22 @@ typedef struct cellCfgParams U32 maxUe; /* max UE per slot */ }CellCfgParams; +typedef struct duUeCb +{ + uint32_t gnbDuUeF1apId; /* GNB DU UE F1AP ID */ + uint32_t gnbCuUeF1apId; /* GNB CU UE F1AP ID */ + UeState ueState; + MacUeCfg macUeCfg; +}DuUeCb; typedef struct duCellCb { - U32 cellId; /* Internal cell Id */ - CellCfgParams cellInfo; /* Cell info */ + uint16_t cellId; /* Internal cell Id */ + CellCfgParams cellInfo; /* Cell info */ Bool firstSlotIndRcvd; - CellStatus cellStatus; /*Cell status */ + CellStatus cellStatus; /* Cell status */ + uint32_t numActvUes; /* Total Active UEs */ + DuUeCb ueCb[DU_MAX_UE]; /* UE CONTEXT */ }DuCellCb; typedef struct duLSapCb @@ -224,9 +240,9 @@ typedef struct duCb DuCellCb* cfgCellLst[DU_MAX_CELLS]; /* List of cells at DU APP of type DuCellCb */ DuCellCb* actvCellLst[DU_MAX_CELLS]; /* List of cells activated/to be activated of type DuCellCb */ /* pointer to store the address of macCellCfg params used to send du-app to MAC */ - MacCellCfg *duMacCellCfg; /* pointer to store params while sending DU-APP to MAC */ - uint32_t numUe; /* current number of UEs */ - UeCcchCtxt ueCcchCtxt[DU_MAX_UE]; /* mapping of gnbDuUeF1apId to CRNTI required for CCCH processing*/ + MacCellCfg *duMacCellCfg; /* pointer to store params while sending DU-APP to MAC */ + uint32_t numUe; /* current number of UEs */ + UeCcchCtxt ueCcchCtxt[DU_MAX_UE]; /* mapping of gnbDuUeF1apId to CRNTI required for CCCH processing*/ }DuCb; diff --git a/src/du_app/du_mgr_ex_ms.c b/src/du_app/du_mgr_ex_ms.c index 10f82dc3f..9bec28b65 100644 --- a/src/du_app/du_mgr_ex_ms.c +++ b/src/du_app/du_mgr_ex_ms.c @@ -55,6 +55,8 @@ extern S16 cmUnpkLrgSchCfgCfm(LrgSchCfgCfm func,Pst *pst,Buffer *mBuf); S16 duActvInit(Ent entity, Inst inst, Region region, Reason reason) { uint8_t id; + + memset(&duCb, 0, sizeof(DuCb)); duCb.init.procId = SFndProcId(); duCb.init.ent = entity; diff --git a/src/du_app/du_msg_hdl.c b/src/du_app/du_msg_hdl.c index a930fcb74..45abfe4e9 100644 --- a/src/du_app/du_msg_hdl.c +++ b/src/du_app/du_msg_hdl.c @@ -313,7 +313,7 @@ S16 duProcCfgComplete() U16 idx; for(idx=0; idx< DEFAULT_CELLS; idx++) { - DuCellCb *cell; + DuCellCb *cell = NULLP; DU_ALLOC(cell, sizeof(DuCellCb)) if(cell == NULLP) { @@ -325,7 +325,7 @@ S16 duProcCfgComplete() U32 nci; U8 idx1; memset(cell, 0, sizeof(DuCellCb)); - cell->cellId = cellId++; + cell->cellId = ++cellId; cell->cellInfo.nrEcgi.plmn.mcc[0] = PLMN_MCC0; cell->cellInfo.nrEcgi.plmn.mcc[1] = PLMN_MCC1; cell->cellInfo.nrEcgi.plmn.mcc[2] = PLMN_MCC2; diff --git a/src/du_app/du_ue_mgr.c b/src/du_app/du_ue_mgr.c index d382622cb..607766625 100644 --- a/src/du_app/du_ue_mgr.c +++ b/src/du_app/du_ue_mgr.c @@ -29,6 +29,13 @@ DuMacDlCcchInd packMacDlCcchIndOpts[] = packMacDlCcchInd /* Light weight-loose coupling */ }; +DuMacUeCreateReq packMacUeCreateReqOpts[] = +{ + packDuMacUeCreateReq, /* Loose coupling */ + MacHdlUeCreateReq, /* TIght coupling */ + packDuMacUeCreateReq, /* Light weight-loose coupling */ +}; + /****************************************************************** * * @brief Send UE configuration to RLC @@ -301,7 +308,6 @@ uint8_t procDlRrcMsgTrans(F1AP_PDU_t *f1apMsg) case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: { gnbCuUeF1apId = dlRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID; - UNUSED(gnbCuUeF1apId); //This is currently not used break; } case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID: @@ -331,7 +337,7 @@ uint8_t procDlRrcMsgTrans(F1AP_PDU_t *f1apMsg) } else { - DU_LOG("\nDU_APP : RRC Container Size is invalid:%d",\ + DU_LOG("\nDU_APP : RRC Container Size is invalid:%ld",\ dlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size); } break; @@ -349,12 +355,34 @@ uint8_t procDlRrcMsgTrans(F1AP_PDU_t *f1apMsg) { crnti = duCb.ueCcchCtxt[idx].crnti; cellId = duCb.ueCcchCtxt[idx].cellId; + break; } } if(srbId == SRB_ID_1) //RRC connection setup { ret = duBuildAndSendDlCcchInd(cellId, crnti, RRC_SETUP, dlCcchMsg, dlCcchMsgSize); - } + if(ret) + { + DU_LOG("\nDU_APP: Falied at duBuildAndSendDlCcchInd()"); + } + else + { + if(duCb.actvCellLst[cellId-1]->numActvUes < DU_MAX_UE) + { + ret = duCreateUeCb(&duCb.ueCcchCtxt[idx], gnbCuUeF1apId); + if(ret) + { + DU_LOG("\nDU_APP: Failed at duCreateUeCb for cellId [%d]", duCb.ueCcchCtxt[idx].cellId); + ret = RFAILED; + } + } + else + { + DU_LOG("\nDU_APP: Max Active UEs has reached"); + ret = RFAILED; + } + } + } return ret; } @@ -378,6 +406,7 @@ uint32_t genGnbDuUeF1apId() return ++gnbDuUeF1apId; } + /****************************************************************** * * @brief Processes UL CCCH Ind recvd from MAC @@ -422,6 +451,482 @@ uint8_t duProcUlCcchInd(UlCcchIndInfo *ulCcchIndInfo) } +/****************************************************************** + * + * @brief Fills Initial DL Bandwidth Part + * + * @details + * + * Function : fillInitDlBwp + * + * Functionality: Fills Initial DL Bandwidth Part + * + * + *****************************************************************/ +void fillInitDlBwp(InitialDlBwp *initDlBwp) +{ + uint8_t idx = 0; + + if(initDlBwp) + { + /* Filling PDCCH Config */ + initDlBwp->pdcchPresent = TRUE; + if(initDlBwp->pdcchPresent) + { + initDlBwp->pdcchCfg.numCRsetToAddMod = PDCCH_CTRL_RSRC_SET_ONE_ID; + memset(initDlBwp->pdcchCfg.cRSetToAddModList, 0, MAX_NUM_CRSET); + if(initDlBwp->pdcchCfg.numCRsetToAddMod <= MAX_NUM_CRSET) + { + initDlBwp->pdcchCfg.cRSetToAddModList[idx].cRSetId = \ + PDCCH_CTRL_RSRC_SET_ONE_ID; + memset(initDlBwp->pdcchCfg.cRSetToAddModList[idx].freqDomainRsrc, 0,\ + FREQ_DOM_RSRC_SIZE); + initDlBwp->pdcchCfg.cRSetToAddModList[idx].freqDomainRsrc[idx] =\ + PDCCH_FREQ_DOM_RSRC; + initDlBwp->pdcchCfg.cRSetToAddModList[idx].duration = \ + PDCCH_CTRL_RSRC_SET_ONE_DURATION; + initDlBwp->pdcchCfg.cRSetToAddModList[idx].cceRegMappingType = \ + CCE_REG_MAPPINGTYPE_PR_NONINTERLEAVED; + initDlBwp->pdcchCfg.cRSetToAddModList[idx].precoderGranularity = \ + ALL_CONTIGUOUS_RBS; + initDlBwp->pdcchCfg.cRSetToAddModList[idx].dmrsScramblingId = \ + SCRAMBLING_ID; + } + initDlBwp->pdcchCfg.numCRsetToRel = 0; + /* Filling Serach Space */ + initDlBwp->pdcchCfg.numSearchSpcToAddMod = PDCCH_CTRL_RSRC_SET_ONE_ID; + memset(initDlBwp->pdcchCfg.searchSpcToAddModList, 0, MAX_NUM_CRSET); + if(initDlBwp->pdcchCfg.numSearchSpcToAddMod <= MAX_NUM_CRSET) + { + initDlBwp->pdcchCfg.searchSpcToAddModList[idx].searchSpaceId =\ + PDCCH_SRCH_SPC_TWO_ID; + initDlBwp->pdcchCfg.searchSpcToAddModList[idx].cRSetId = \ + PDCCH_CTRL_RSRC_SET_ONE_ID; + initDlBwp->pdcchCfg.searchSpcToAddModList[idx].\ + mSlotPeriodicityAndOffset = SLOTPERIODICITYANDOFFSET_PR_SL1; + memset(initDlBwp->pdcchCfg.searchSpcToAddModList[idx].mSymbolsWithinSlot, 0,\ + MONITORING_SYMB_WITHIN_SLOT_SIZE); + initDlBwp->pdcchCfg.searchSpcToAddModList[idx].mSymbolsWithinSlot[idx] =\ + PDCCH_SYMBOL_WITHIN_SLOT; + initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel1 =\ + AGGREGATIONLEVEL_N8; + initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel2 =\ + AGGREGATIONLEVEL_N8; + initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel4 =\ + AGGREGATIONLEVEL_N4; + initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel8 =\ + AGGREGATIONLEVEL_N2; + initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel16 =\ + AGGREGATIONLEVEL_N1; + initDlBwp->pdcchCfg.searchSpcToAddModList[idx].searchSpaceType = \ + SEARCHSPACETYPE_PR_UE_SPECIFIC; + initDlBwp->pdcchCfg.searchSpcToAddModList[idx].ueSpecificDciFormat =\ + PDCCH_SRCH_SPC_TWO_UE_SPEC_DCI_FORMAT; + + initDlBwp->pdcchCfg.numSearchSpcToRel = 0; + + } + } + /* Filling PDSCH Config */ + initDlBwp->pdschPresent = TRUE; + if(initDlBwp->pdschPresent) + { + initDlBwp->pdschCfg.dmrsDlCfgForPdschMapTypeA.addPos = ADDITIONALPOSITION_POS0; + initDlBwp->pdschCfg.resourceAllocType = RESOURCEALLOCATION_TYPE1; + initDlBwp->pdschCfg.numTimeDomRsrcAlloc = 1; + initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].mappingType = \ + MAPPING_TYPEA; + initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].startSymbolAndLength = \ + PDSCH_START_SYMBOL_LEN; + initDlBwp->pdschCfg.rbgSize = RBG_SIZE_CONFIG1; + initDlBwp->pdschCfg.numCodeWordsSchByDci = CODEWORDS_SCHED_BY_DCI_N1; + initDlBwp->pdschCfg.bundlingType = TYPE_STATIC_BUNDLING; + } + } + +} + +/****************************************************************** + * + * @brief Fills Initial UL Bandwidth Part + * + * @details + * + * Function : fillInitUlBwp + * + * Functionality: Fills Initial UL Bandwidth Part + * + * + *****************************************************************/ +void fillInitUlBwp(InitialUlBwp *initUlBwp) +{ + uint8_t idx; + if(initUlBwp) + { + initUlBwp->pucchPresent = FALSE; + + /*Filling PUSCH Config */ + initUlBwp->puschPresent = TRUE; + if(initUlBwp->puschPresent) + { + initUlBwp->puschCfg.dmrsUlCfgForPuschMapTypeA.addPos = ADDITIONALPOSITION_POS0; + initUlBwp->puschCfg.dmrsUlCfgForPuschMapTypeA.transPrecodDisabled. \ + scramblingId0 = SCRAMBLING_ID; + initUlBwp->puschCfg.resourceAllocType = RESOURCEALLOCATION_TYPE1; + initUlBwp->puschCfg.numTimeDomRsrcAlloc = 1; + idx = 0; + if(initUlBwp->puschCfg.numTimeDomRsrcAlloc <= MAX_NUM_UL_ALLOC) + { + initUlBwp->puschCfg.timeDomRsrcAllocList[idx].k2 = PUSCH_K2; + initUlBwp->puschCfg.timeDomRsrcAllocList[idx].mappingType =\ + MAPPING_TYPEA; + initUlBwp->puschCfg.timeDomRsrcAllocList[idx].startSymbolAndLength =\ + PUSCH_START_SYMBOL_LEN; + } + initUlBwp->puschCfg.transformPrecoder = TRANSFORM_PRECODER_DISABLED; + } + } + else + { + DU_LOG("\n DUAPP: Memory is NULL of InitalUlBwp"); + } + +} +/****************************************************************** + * + * @brief Fills SpCell Group Info + * + * @details + * + * Function : fillSpCellGrpInfo + * + * Functionality: Fills Sp Cell Group Info + * + * + *****************************************************************/ +void fillSpCellGrpInfo(SpCellCfg *spCell) +{ + if(spCell) + { + spCell->servCellIdx = SERV_CELL_IDX; + /* Filling Initial Dl Bwp */ + fillInitDlBwp(&spCell->servCellCfg.initDlBwp); + + spCell->servCellCfg.numDlBwpToAdd = 0; + spCell->servCellCfg.firstActvDlBwpId = ACTIVE_DL_BWP_ID; + spCell->servCellCfg.defaultDlBwpId = ACTIVE_DL_BWP_ID; + spCell->servCellCfg.bwpInactivityTmr = NULLP; + spCell->servCellCfg.pdschServCellCfg.maxMimoLayers = NULLP; + spCell->servCellCfg.pdschServCellCfg.maxCodeBlkGrpPerTb = NULLP; + spCell->servCellCfg.pdschServCellCfg.codeBlkGrpFlushInd = NULLP; + spCell->servCellCfg.pdschServCellCfg.xOverhead = NULLP; + spCell->servCellCfg.pdschServCellCfg.numHarqProcForPdsch =\ + NUM_HARQ_PROC_FOR_PDSCH_N_16; + /* Filling Initial UL Bwp*/ + fillInitUlBwp(&spCell->servCellCfg.initUlBwp); + spCell->servCellCfg.numUlBwpToAdd = 0; + spCell->servCellCfg.firstActvUlBwpId = ACTIVE_DL_BWP_ID; + } + else + { + DU_LOG("\n DU_APP: Memory is NULL for SpCellGrp"); + } +} + +/****************************************************************** + * + * @brief Fills Physical Cell Group Info + * + * @details + * + * Function : fillPhyCellGrpInfo + * + * Functionality: Fills Physical Cell Group Info + * + * + *****************************************************************/ +void fillPhyCellGrpInfo(PhyCellGrpCfg *cellGrp) +{ + if(cellGrp) + { + cellGrp->pdschHarqAckCodebook = PDSCH_HARQ_ACK_CODEBOOK_DYNAMIC; + cellGrp->pNrFr1 = P_NR_FR1; + } + else + { + DU_LOG("\nDUAPP: Memory is NULL for Physical Cell Group"); + } +} + +/****************************************************************** + * + * @brief Fills Mac Cell Group Info + * + * @details + * + * Function : fillMacCellGrpInfo + * + * Functionality: Fills Mac Cell Group Info + * + * + *****************************************************************/ +void fillMacCellGrpInfo(MacCellGrpCfg *cellGrp) +{ + uint8_t idx; + + if(cellGrp) + { + /* Filling Scheduling Request Config */ + cellGrp->schReqCfg.addModListCount = 1; + if(cellGrp->schReqCfg.addModListCount <= MAX_NUM_SR_CFG_PER_CELL_GRP) + { + for(idx = 0; idx < cellGrp->schReqCfg.addModListCount; idx++) + { + cellGrp->schReqCfg.addModList[idx].schedReqId = SCH_REQ_ID; + cellGrp->schReqCfg.addModList[idx].srProhibitTmr = SR_PROHIBIT_MS_32; + cellGrp->schReqCfg.addModList[idx].srTransMax = SR_TRANS_MAX_N_16; + } + } + cellGrp->schReqCfg.relListCount = 0; + + /* Filling Tag config */ + cellGrp->tagCfg.addModListCount = 1; + if(cellGrp->tagCfg.addModListCount <= MAC_NUM_TAGS) + { + for(idx = 0; idx < cellGrp->tagCfg.addModListCount; idx++) + { + cellGrp->tagCfg.addModList[idx].tagId = TAG_ID; + cellGrp->tagCfg.addModList[idx].timeAlignTimer = TIME_ALIGNMENT_TIMER_INFINITY; + } + } + cellGrp->tagCfg.relListCount = 0; + + /* Filling PHR config */ + cellGrp->phrCfgSetupPres = true; + cellGrp->phrCfg.periodicTimer = PHR_PERIODIC_TIMER_INFINITY; + cellGrp->phrCfg.prohibitTimer = PHR_PROHIBIT_TIMER_SF_0; + cellGrp->phrCfg.txPowerFactor = PHR_TX_PWR_FACTOR_CHANGE_INFINITY; + cellGrp->phrCfg.multiplePHR = false; + cellGrp->phrCfg.dummy = false; + cellGrp->phrCfg.phrType2OtherCell = false; + cellGrp->phrCfg.phrOtherCG = PHR_MODE_OTHER_CG_REAL; + + } + else + { + DU_LOG("\nDUAPP: Memory is NULL for Master Cell Group"); + } +} + +/****************************************************************** + * + * @brief Fills Logical Channel Config List + * + * @details + * + * Function : fillLcCfgList + * + * Functionality: Fills Logical channel Config List + * + * + *****************************************************************/ +void fillLcCfgList(LcCfg *lcCfgInfo) +{ + if(lcCfgInfo) + { + lcCfgInfo->lcId = SRB_ID_1; + lcCfgInfo->drbQos = NULLP; + lcCfgInfo->snssai = NULLP; + lcCfgInfo->ulLcCfg = NULLP; + lcCfgInfo->dlLcCfg.lcp = LC_PRIORITY_1; + +#if 0 + /* TODO: To be filled on receving UE CONTEXT SETUP from CU */ + /* Filling Qos characteristics */ + lcCfgInfo->drbQos.fiveQiType = QoS_Characteristics_PR_non_Dynamic_5QI; + lcCfgInfo->drbQos.u.nonDyn5Qi.fiveQi = 0; + lcCfgInfo->drbQos.u.nonDyn5Qi.priorLevel = 0; + lcCfgInfo->drbQos.u.nonDyn5Qi.avgWindow = 0; + lcCfgInfo->drbQos.u.nonDyn5Qi.maxDataBurstVol = 0; + + /* Filling NgRAN */ + lcCfgInfo->drbQos.ngRanRetPri.priorityLevel = PriorityLevel_highest; + lcCfgInfo->drbQos.ngRanRetPri.preEmptionCap = \ + Pre_emptionCapability_may_trigger_pre_emption; + lcCfgInfo->drbQos.ngRanRetPri.preEmptionVul = \ + Pre_emptionVulnerability_not_pre_emptable; + + /* Filling Grb Qos */ + lcCfgInfo->drbQos.grbQosInfo.maxFlowBitRateDl = 0; + lcCfgInfo->drbQos.grbQosInfo.maxFlowBitRateUl = 0; + lcCfgInfo->drbQos.grbQosInfo.guarFlowBitRateDl = 0; + lcCfgInfo->drbQos.grbQosInfo.guarFlowBitRateUl = 0; + + /* Filling S-NSSAI */ + /* TODO :To be filled when UE Context Setup Request is sent from CU */ + /* Filling UL Logical Channel Config */ + lcCfgInfo->ulLcCfg.priority = 0; + lcCfgInfo->ulLcCfg.lcGroup = 0; + lcCfgInfo->ulLcCfg.schReqId = 0; + lcCfgInfo->ulLcCfg.pbr = 0; + lcCfgInfo->ulLcCfg.bsd = 0; + + /* Filling DL Logical Channel Config */ + lcCfgInfo->dlLcCfg.lcp = 0; +#endif + } + else + { + DU_LOG("\n Memory is null for LcCfgList"); + } +} + +/****************************************************************** + * + * @brief Fills MacUeCfg structure + * + * @details + * + * Function : fillMacUeCfg + * + * Functionality: Fills MacUeCfg + * + * + *****************************************************************/ +void fillMacUeCfg(MacUeCfg *ueCfg) +{ + uint8_t idx; + + /* Filling MacCellGroup Config */ + fillMacCellGrpInfo(&ueCfg->macCellGrpCfg); + /* Filling PhyCellGroup Config */ + fillPhyCellGrpInfo(&ueCfg->phyCellGrpCfg); + /* Filling SpCellGroup Config */ + fillSpCellGrpInfo(&ueCfg->spCellCfg); + /* Filling AMBR for UL and DL */ + ueCfg->maxAggrBitRate = NULLP; + /* Filling LC Context */ + ueCfg->numLcs = SRB_ID_1; + if(ueCfg->numLcs < MAX_NUM_LOGICAL_CHANNELS) + { + for(idx = 0; idx < ueCfg->numLcs; idx++) + { + fillLcCfgList(&ueCfg->lcCfgList[idx]); + } + } + +} + +/****************************************************************** + * + * @brief creates UE context + * + * @details + * + * Function : duCreateUeCb + * + * Functionality: Creates UE Conetxt + * + * @params[in] UeCcchCtxt Pointer + * UeIdx Pointer + * + * @return ROK - success + * RFAILED - failure + * ****************************************************************/ +uint8_t duCreateUeCb(UeCcchCtxt *ueCcchCtxt, uint32_t gnbCuUeF1apId) +{ + uint8_t cellIdx = 0; + uint8_t ret = ROK; + uint8_t ueIdx; + + for(cellIdx = 0; cellIdx < DU_MAX_CELLS; cellIdx++) + { + if(ueCcchCtxt->cellId == duCb.actvCellLst[cellIdx]->cellId) + { + ueIdx = ueCcchCtxt->crnti % DU_UE_START_CRNTI; + DU_LOG("\nDU_APP: Filling UeCb for ueIdx [%d]", ueIdx); + duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId = ueCcchCtxt->gnbDuUeF1apId; + duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId = gnbCuUeF1apId; + duCb.actvCellLst[cellIdx]->ueCb[ueIdx].ueState = UE_ACTIVE; + + /* Filling Mac Ue Config */ + memset(&duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg, 0, sizeof(MacUeCfg)); + duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg.cellIdx = ueCcchCtxt->cellId; + duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg.ueIdx = ueIdx; + duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg.crnti = ueCcchCtxt->crnti; + fillMacUeCfg(&duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg); + duCb.actvCellLst[cellIdx]->numActvUes++; + memset(ueCcchCtxt, 0, sizeof(UeCcchCtxt)); + + /* Send Ue Create Request to MAC */ + ret = duBuildAndSendUeCreateReqToMac(duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg.cellIdx, ueIdx); + if(ret) + DU_LOG("\nDU_APP: Failed to send UE create request to MAC"); + } + } + + return ret; +} + +/****************************************************************** + * + * @brief Builds and Send UE Create Request to MAC + * + * @details + * + * Function : duBuildAndSendUeCreateReqToMac + * + * Functionality: Builds and Send UE Create Request to MAC + * + * @Params[in] cellId, + * ueIdx + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t ueIdx) +{ + uint8_t ret = ROK; + MacUeCfg *macUeCfg = NULLP; + Pst pst; + + memset(&pst, 0, sizeof(Pst)); + + /* Fill Pst */ + pst.selector = DU_MAC_LWLC; + pst.srcEnt = ENTDUAPP; + pst.srcInst = DU_INST; + pst.dstEnt = ENTRG; + pst.dstInst = 0; + pst.dstProcId = DU_PROC; + pst.srcProcId = DU_PROC; + pst.region = DU_APP_MEM_REGION; + pst.pool = DU_POOL; + pst.event = EVENT_MAC_UE_CREATE_REQ; + + /* Copying ueCb to a sharable buffer */ + DU_ALLOC_SHRABL_BUF(macUeCfg, sizeof(MacUeCfg)); + if(macUeCfg) + { + memset(macUeCfg, 0, sizeof(MacUeCfg)); + memcpy(macUeCfg, &duCb.actvCellLst[cellId - 1]->ueCb[ueIdx].macUeCfg, sizeof(MacUeCfg)); + /* Processing one Ue at a time to MAC */ + ret = (*packMacUeCreateReqOpts[pst.selector])(&pst, macUeCfg); + if(ret) + { + DU_LOG("\nDU_APP : Failure in sending Ue Create Req to MAC"); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macUeCfg, sizeof(MacUeCfg)); + ret = RFAILED; + } + } + else + { + DU_LOG("\n DU_APP: Memory alloc failed at duBuildAndSendUeCreateReq()"); + ret = RFAILED; + } + return ret; +} /********************************************************************** End of file diff --git a/src/du_app/du_ue_mgr.h b/src/du_app/du_ue_mgr.h index 5659c977d..b7e7b72ab 100644 --- a/src/du_app/du_ue_mgr.h +++ b/src/du_app/du_ue_mgr.h @@ -34,6 +34,8 @@ S16 duHdlEgtpDlData(EgtpMsg *egtpMsg); S16 duHdlRlcUlData(Pst *pst, KwuDatIndInfo* datInd, Buffer *mBuf); S16 packUeCreateReq(Pst *pst,CkwCfgInfo *cfgInfo); S16 cmPkKwuDatReq(Pst * pst,KwuDatReqInfo* datReq,Buffer * mBuf); +uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t ueIdx); +uint8_t duCreateUeCb(UeCcchCtxt *ueCcchCtxt, uint32_t gnbCuUeF1apId); uint8_t duProcUlCcchInd(UlCcchIndInfo *ulCcchIndInfo); #endif -- 2.16.6