1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
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 #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
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 /* This file contains UE management handling functionality for DU APP */
19 #include "common_def.h"
29 #include "du_app_mac_inf.h"
30 #include "du_app_rlc_inf.h"
34 #include "du_f1ap_msg_hdl.h"
35 #include "du_ue_mgr.h"
41 DuMacDlCcchInd packMacDlCcchIndOpts[] =
43 packMacDlCcchInd, /* Loose coupling */
44 MacProcDlCcchInd, /* TIght coupling */
45 packMacDlCcchInd /* Light weight-loose coupling */
48 DuMacUeCreateReq packMacUeCreateReqOpts[] =
50 packDuMacUeCreateReq, /* Loose coupling */
51 MacProcUeCreateReq, /* TIght coupling */
52 packDuMacUeCreateReq /* Light weight-loose coupling */
55 DuRlcUeCreateReq packRlcUeCreateReqOpts[] =
57 packDuRlcUeCreateReq, /* Loose coupling */
58 RlcProcUeCreateReq, /* TIght coupling */
59 packDuRlcUeCreateReq /* Light weight-loose coupling */
62 DuDlRrcMsgToRlcFunc duSendDlRrcMsgToRlcOpts[] =
64 packDlRrcMsgToRlc, /* Loose coupling */
65 RlcProcDlRrcMsgTransfer, /* Tight coupling */
66 packDlRrcMsgToRlc /* Light weight-loose coupling */
69 DuRlcUeReconfigReq packRlcUeReconfigReqOpts[] =
71 packDuRlcUeReconfigReq, /* Loose coupling */
72 RlcProcUeReconfigReq, /* TIght coupling */
73 packDuRlcUeReconfigReq /* Light weight-loose coupling */
76 DuMacUeReconfigReq packMacUeReconfigReqOpts[] =
78 packDuMacUeReconfigReq, /* Loose coupling */
79 MacProcUeReconfigReq, /* TIght coupling */
80 packDuMacUeReconfigReq /* Light weight-loose coupling */
82 /*******************************************************************
84 * @brief Handles EGTP data from CU
88 * Function : duHdlEgtpData
91 * Processes EGTP header and sends data to RLC
93 * @params[in] Pointer to EGTP Message
94 * @return ROK - success
97 * ****************************************************************/
98 uint8_t duHdlEgtpDlData(EgtpMsg *egtpMsg)
101 /* TODO : Extract RbId/UeID/CellID/SduId from database
102 using tunnel id in egtp header */
104 DU_LOG("\nDU_APP : Processing DL data");
107 KwuDatReqInfo datReqInfo;
109 datReqInfo.rlcId.rbId = RB_ID;
110 datReqInfo.rlcId.rbType = CM_LTE_DRB;
111 datReqInfo.rlcId.ueId = UE_ID;
112 datReqInfo.rlcId.cellId = NR_CELL_ID;
114 datReqInfo.sduId = ++sduId;
115 datReqInfo.lcType = CM_LTE_LCH_DTCH;
117 /* Filling pst and Sending to RLC DL */
118 pst.selector = ODU_SELECTOR_LWLC;
119 pst.srcEnt = ENTDUAPP;
121 pst.dstInst = RLC_DL_INST;
122 pst.dstProcId = DU_PROC;
123 pst.srcProcId = DU_PROC;
124 pst.region = duCb.init.region;
126 cmPkKwuDatReq(&pst, &datReqInfo, egtpMsg->msg);
128 //duBuildAndSendDlRrcMsgToRlc();
133 /******************************************************************
135 * @brief Builds and Sends DL CCCH Ind to MAC
139 * Function : duBuildAndSendDlCcchInd
141 * Functionality: Builds and sends DL CCCH Ind Msg to MAC
143 * @params[in] dlCcchMsg - uint8_t*
144 * @return ROK - success
147 * ****************************************************************/
148 uint8_t duBuildAndSendDlCcchInd(uint16_t *cellId, uint16_t *crnti, \
149 DlCcchMsgType msgType, uint16_t dlCcchMsgSize, uint8_t *dlCcchMsg)
153 DlCcchIndInfo *dlCcchIndInfo = NULLP;
156 DU_LOG("\nDU APP : Building and Sending DL CCCH Ind to MAC");
158 DU_ALLOC_SHRABL_BUF(dlCcchIndInfo, sizeof(DlCcchIndInfo));
162 DU_LOG("\nDU APP : Memory alloc failed while building DL CCCH Ind");
166 dlCcchIndInfo->cellId = *cellId;
167 dlCcchIndInfo->crnti = *crnti;
168 dlCcchIndInfo->msgType = msgType;
169 dlCcchIndInfo->dlCcchMsgLen = dlCcchMsgSize;
171 DU_ALLOC_SHRABL_BUF(dlCcchIndInfo->dlCcchMsg, dlCcchIndInfo->dlCcchMsgLen);
172 if(!dlCcchIndInfo->dlCcchMsg)
174 DU_LOG("\nDU APP : Memory alloc failed while building DL CCCH Ind");
175 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo, sizeof(DlCcchIndInfo));
178 for(idx2 = 0; idx2 < dlCcchIndInfo->dlCcchMsgLen; idx2++)
180 dlCcchIndInfo->dlCcchMsg[idx2] = dlCcchMsg[idx2];
182 DU_FREE(dlCcchMsg, dlCcchMsgSize);
185 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_DL_CCCH_IND);
186 ret = (*packMacDlCcchIndOpts[pst.selector])(&pst, dlCcchIndInfo);
189 DU_LOG("\nDU_APP : Failure in sending DL CCCH to MAC");
190 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo->dlCcchMsg,\
191 dlCcchIndInfo->dlCcchMsgLen);
192 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo, \
193 sizeof(DlCcchIndInfo));
201 /*******************************************************************
203 * @brief Build and Send DL RRC Message transfer to RLC
207 * Function : duBuildAndSendDlRrcMsgToRlc
210 * Build and Send DL RRC Message transfer to RLC
212 * @params[in] Cell ID
214 * Logical Channgel ID
217 * @return ROK - success
220 * ****************************************************************/
221 uint8_t duBuildAndSendDlRrcMsgToRlc(uint16_t cellId, RlcUeCfg ueCfg, F1DlRrcMsg *f1DlRrcMsg)
226 RlcDlRrcMsgInfo *dlRrcMsgInfo = NULLP;
230 DU_LOG("\nDU APP : Received Dl RRC Msg is NULL at duBuildAndSendDlRrcMsgToRlc()");
234 DU_ALLOC_SHRABL_BUF(dlRrcMsgInfo, sizeof(RlcDlRrcMsgInfo));
237 DU_LOG("\nDU APP : Memory allocation failed for dlRrcMsgInfo in \
238 duBuildAndSendDlRrcMsgToRlc");
239 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, f1DlRrcMsg->rrcMsgPdu, f1DlRrcMsg->rrcMsgSize);
243 /* Filling up the RRC msg info */
244 dlRrcMsgInfo->cellId = cellId;
245 dlRrcMsgInfo->ueIdx = ueCfg.ueIdx;
246 for(lcIdx = 0; lcIdx <= MAX_NUM_LC; lcIdx++)
248 if(ueCfg.rlcLcCfg[lcIdx].lcId == f1DlRrcMsg->srbId)
250 dlRrcMsgInfo->rbType = ueCfg.rlcLcCfg[lcIdx].rbType;
251 dlRrcMsgInfo->rbId = ueCfg.rlcLcCfg[lcIdx].rbId;
252 dlRrcMsgInfo->lcType = ueCfg.rlcLcCfg[lcIdx].lcType;
253 dlRrcMsgInfo->lcId = ueCfg.rlcLcCfg[lcIdx].lcId;
257 dlRrcMsgInfo->execDup = f1DlRrcMsg->execDup;
258 dlRrcMsgInfo->deliveryStaRpt = f1DlRrcMsg->deliveryStatRpt;
259 dlRrcMsgInfo->msgLen = f1DlRrcMsg->rrcMsgSize;
260 dlRrcMsgInfo->rrcMsg = f1DlRrcMsg->rrcMsgPdu;
262 /* Filling post structure and sending msg */
263 FILL_PST_DUAPP_TO_RLC(pst, RLC_DL_INST, EVENT_DL_RRC_MSG_TRANS_TO_RLC);
264 DU_LOG("\nDU_APP: Sending Dl RRC Msg to RLC \n");
265 ret = (*duSendDlRrcMsgToRlcOpts[pst.selector])(&pst, dlRrcMsgInfo);
268 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, f1DlRrcMsg->rrcMsgPdu, f1DlRrcMsg->rrcMsgSize);
269 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlRrcMsgInfo, sizeof(RlcDlRrcMsgInfo));
278 /******************************************************************
280 * @brief Process DL RRC Msg recevied from F1AP
284 * Function : duProcDlRrcMsg
286 * Functionality: Process DL RRC Msg recevied from F1AP
288 * @params[in] dlCcchMsg - uint8_t*
289 * @return ROK - success
292 * ****************************************************************/
294 uint8_t duProcDlRrcMsg(F1DlRrcMsg *dlRrcMsg)
297 uint16_t crnti, cellId, cellIdx;
298 bool ueCcchCtxtFound = false;
299 bool ueFound = false;
303 if(dlRrcMsg->srbId == SRB0_LCID) //RRC connection setup
305 for(ueIdx=0; ueIdx<duCb.numUe; ueIdx++)
307 if(dlRrcMsg->gnbDuUeF1apId == duCb.ueCcchCtxt[ueIdx].gnbDuUeF1apId)
309 ueCcchCtxtFound = true;
310 crnti = duCb.ueCcchCtxt[ueIdx].crnti;
311 cellId = duCb.ueCcchCtxt[ueIdx].cellId;
318 ret = duBuildAndSendDlCcchInd(&cellId, &crnti, RRC_SETUP, dlRrcMsg->rrcMsgSize, dlRrcMsg->rrcMsgPdu);
321 DU_LOG("\nDU_APP: Falied to build DlCcch Ind at procDlRrcMsgTrans()");
325 if(duCb.actvCellLst[cellId-1]->numActvUes < MAX_NUM_UE)
327 ret = duCreateUeCb(&duCb.ueCcchCtxt[ueIdx], dlRrcMsg->gnbCuUeF1apId);
330 DU_LOG("\nDU_APP: Failed to createUeCb for cellId [%d] at procDlRrcMsgTrans()", \
331 duCb.ueCcchCtxt[ueIdx].cellId);
336 DU_LOG("\nDU_APP: Max Active UEs has reached at procDlRrcMsgTrans()");
343 for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
345 for(ueIdx = 0 ; ueIdx < MAX_NUM_UE; ueIdx++)
347 if((dlRrcMsg->gnbCuUeF1apId == duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId)
348 && (dlRrcMsg->gnbDuUeF1apId == duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId))
351 ret = duBuildAndSendDlRrcMsgToRlc(duCb.actvCellLst[cellIdx]->cellId, \
352 duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg, dlRrcMsg);
365 /******************************************************************
367 * @brief Generates GNB DU Ue F1AP ID
371 * Function : genGnbDuUeF1apId
373 * Functionality: Generates GNB DU Ue F1AP ID
376 * @return gnbDuF1apId
378 * ****************************************************************/
379 uint32_t genGnbDuUeF1apId()
381 static uint32_t gnbDuUeF1apId = 0;
383 return ++gnbDuUeF1apId;
386 /******************************************************************
388 * @brief Processes UL CCCH Ind recvd from MAC
392 * Function : duProcUlCcchInd
394 * Functionality: Processes UL CCCH Ind recvd from MAC
396 * @params[in] UlCcchIndInfo *ulCcchIndInfo
397 * @return ROK - success
400 * ****************************************************************/
401 uint8_t duProcUlCcchInd(UlCcchIndInfo *ulCcchIndInfo)
405 uint32_t gnbDuUeF1apId = 0;
407 gnbDuUeF1apId = genGnbDuUeF1apId();
409 /* Store Ue mapping */
410 duCb.ueCcchCtxt[duCb.numUe].gnbDuUeF1apId = gnbDuUeF1apId;
411 duCb.ueCcchCtxt[duCb.numUe].crnti = ulCcchIndInfo->crnti;
412 duCb.ueCcchCtxt[duCb.numUe].cellId = ulCcchIndInfo->cellId;
416 ret = (BuildAndSendInitialRrcMsgTransfer(gnbDuUeF1apId, ulCcchIndInfo->crnti, ulCcchIndInfo->ulCcchMsgLen,
417 ulCcchIndInfo->ulCcchMsg));
420 DU_LOG("\nDU_APP : BuildAndSendInitialRrcMsgTransfer failed");
423 DU_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, ulCcchIndInfo->ulCcchMsg, ulCcchIndInfo->ulCcchMsgLen);
424 DU_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, ulCcchIndInfo, sizeof(UlCcchIndInfo));
430 /******************************************************************
432 * @brief Fills Default UL LC Cfg
436 * Function : fillDefaultUlLcCfg
438 * Functionality: Fills Default UL LC Cfg
440 * @params[in] UlLcCfg *ulLcCfg
442 *****************************************************************/
443 void fillDefaultUlLcCfg(UlLcCfg *ulLcCfg)
445 ulLcCfg->priority = LC_PRIORITY_1;
446 ulLcCfg->lcGroup = 0;
447 ulLcCfg->schReqId = 0;
448 ulLcCfg->pbr = PBR_KBPS_INFINITY;
449 ulLcCfg->bsd = BSD_MS_1000;
452 /******************************************************************
454 * @brief Fills Initial DL Bandwidth Part
458 * Function : fillDefaultInitDlBwp
460 * Functionality: Fills Initial DL Bandwidth Part
462 * @params[in] InitialDlBwp *initDlBwp
465 *****************************************************************/
466 void fillDefaultInitDlBwp(InitialDlBwp *initDlBwp)
469 uint8_t freqDomainResource[FREQ_DOM_RSRC_SIZE] = {0};
470 uint8_t coreset0EndPrb, coreset1StartPrb, coreset1NumPrb;
475 /* Filling PDCCH Config */
476 initDlBwp->pdcchPresent = TRUE;
477 if(initDlBwp->pdcchPresent)
479 initDlBwp->pdcchCfg.numCRsetToAddMod = PDCCH_CTRL_RSRC_SET_ONE_ID;
480 memset(initDlBwp->pdcchCfg.cRSetToAddModList, 0, MAX_NUM_CRSET);
481 if(initDlBwp->pdcchCfg.numCRsetToAddMod <= MAX_NUM_CRSET)
483 initDlBwp->pdcchCfg.cRSetToAddModList[idx].cRSetId = \
484 PDCCH_CTRL_RSRC_SET_ONE_ID;
485 memset(initDlBwp->pdcchCfg.cRSetToAddModList[idx].freqDomainRsrc, 0,\
487 coreset0EndPrb = CORESET0_END_PRB;
488 coreset1StartPrb = coreset0EndPrb +6;
489 coreset1NumPrb = CORESET1_NUM_PRB;
490 /* calculate the PRBs */
491 freqDomRscAllocType0(((coreset1StartPrb)/6), (coreset1NumPrb/6), freqDomainResource);
492 memcpy(initDlBwp->pdcchCfg.cRSetToAddModList[idx].freqDomainRsrc, freqDomainResource,
495 initDlBwp->pdcchCfg.cRSetToAddModList[idx].duration = \
496 PDCCH_CTRL_RSRC_SET_ONE_DURATION;
497 initDlBwp->pdcchCfg.cRSetToAddModList[idx].cceRegMappingType = \
498 CCE_REG_MAPPINGTYPE_PR_NONINTERLEAVED;
499 initDlBwp->pdcchCfg.cRSetToAddModList[idx].precoderGranularity = \
501 initDlBwp->pdcchCfg.cRSetToAddModList[idx].dmrsScramblingId = \
504 initDlBwp->pdcchCfg.numCRsetToRel = 0;
505 /* Filling Serach Space */
506 initDlBwp->pdcchCfg.numSearchSpcToAddMod = PDCCH_CTRL_RSRC_SET_ONE_ID;
507 memset(initDlBwp->pdcchCfg.searchSpcToAddModList, 0, MAX_NUM_CRSET);
508 if(initDlBwp->pdcchCfg.numSearchSpcToAddMod <= MAX_NUM_CRSET)
510 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].searchSpaceId =\
511 PDCCH_SRCH_SPC_TWO_ID;
512 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].cRSetId = \
513 PDCCH_CTRL_RSRC_SET_ONE_ID;
514 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].\
515 mSlotPeriodicityAndOffset = SLOTPERIODICITYANDOFFSET_PR_SL1;
516 memset(initDlBwp->pdcchCfg.searchSpcToAddModList[idx].mSymbolsWithinSlot, 0,\
517 MONITORING_SYMB_WITHIN_SLOT_SIZE);
518 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].mSymbolsWithinSlot[idx] =\
519 PDCCH_SYMBOL_WITHIN_SLOT;
520 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel1 =\
522 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel2 =\
524 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel4 =\
526 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel8 =\
528 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel16 =\
530 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].searchSpaceType = \
531 SEARCHSPACETYPE_PR_UE_SPECIFIC;
532 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].ueSpecificDciFormat =\
533 PDCCH_SRCH_SPC_TWO_UE_SPEC_DCI_FORMAT;
535 initDlBwp->pdcchCfg.numSearchSpcToRel = 0;
539 /* Filling PDSCH Config */
540 initDlBwp->pdschPresent = TRUE;
541 if(initDlBwp->pdschPresent)
543 initDlBwp->pdschCfg.dmrsDlCfgForPdschMapTypeA.addPos = ADDITIONALPOSITION_POS0;
544 initDlBwp->pdschCfg.resourceAllocType = RESOURCEALLOCATION_TYPE1;
545 initDlBwp->pdschCfg.numTimeDomRsrcAlloc = 1;
546 initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].mappingType = \
548 initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].startSymbol = PDSCH_START_SYMBOL;
549 initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].symbolLength = PDSCH_LENGTH_SYMBOL;
550 initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].startSymbolAndLength = \
551 calcSliv(PDSCH_START_SYMBOL, PDSCH_LENGTH_SYMBOL);
552 initDlBwp->pdschCfg.rbgSize = RBG_SIZE_CONFIG1;
553 initDlBwp->pdschCfg.numCodeWordsSchByDci = CODEWORDS_SCHED_BY_DCI_N1;
554 initDlBwp->pdschCfg.bundlingType = TYPE_STATIC_BUNDLING;
555 initDlBwp->pdschCfg.bundlingInfo.StaticBundling.size = 0;
561 /******************************************************************
563 * @brief Fills Initial UL Bandwidth Part
567 * Function : fillDefaultInitUlBwp
569 * Functionality: Fills Initial UL Bandwidth Part
571 * @params[in] InitialUlBwp *initUlBwp
574 *****************************************************************/
575 void fillDefaultInitUlBwp(InitialUlBwp *initUlBwp)
580 initUlBwp->pucchPresent = FALSE;
582 /*Filling PUSCH Config */
583 initUlBwp->puschPresent = TRUE;
584 if(initUlBwp->puschPresent)
586 initUlBwp->puschCfg.dataScramblingId = SCRAMBLING_ID;
587 initUlBwp->puschCfg.dmrsUlCfgForPuschMapTypeA.addPos = ADDITIONALPOSITION_POS0;
588 initUlBwp->puschCfg.dmrsUlCfgForPuschMapTypeA.transPrecodDisabled. \
589 scramblingId0 = SCRAMBLING_ID;
590 initUlBwp->puschCfg.resourceAllocType = RESOURCEALLOCATION_TYPE1;
591 initUlBwp->puschCfg.numTimeDomRsrcAlloc = 1;
593 if(initUlBwp->puschCfg.numTimeDomRsrcAlloc <= MAX_NUM_UL_ALLOC)
595 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].k2 = PUSCH_K2;
596 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].mappingType =\
598 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].startSymbol = PUSCH_START_SYMBOL;
599 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].symbolLength = PUSCH_LENGTH_SYMBOL;
600 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].startSymbolAndLength =\
601 calcSliv(PUSCH_START_SYMBOL, PUSCH_LENGTH_SYMBOL);
603 initUlBwp->puschCfg.transformPrecoder = TRANSFORM_PRECODER_DISABLED;
608 DU_LOG("\n DUAPP: Memory is NULL of InitalUlBwp");
612 /******************************************************************
614 * @brief Fills SpCell Group Info
618 * Function : fillDefaultSpCellGrpInfo
620 * Functionality: Fills Sp Cell Group Info
622 * @params[in] SpCellCfg *spCell
625 *****************************************************************/
626 void fillDefaultSpCellGrpInfo(SpCellCfg *spCell)
630 spCell->servCellIdx = SERV_CELL_IDX;
631 /* Filling Initial Dl Bwp */
632 fillDefaultInitDlBwp(&spCell->servCellCfg.initDlBwp);
634 spCell->servCellCfg.numDlBwpToAdd = 0;
635 spCell->servCellCfg.firstActvDlBwpId = ACTIVE_DL_BWP_ID;
636 spCell->servCellCfg.defaultDlBwpId = ACTIVE_DL_BWP_ID;
637 spCell->servCellCfg.bwpInactivityTmr = NULLP;
638 spCell->servCellCfg.pdschServCellCfg.maxMimoLayers = NULLP;
639 spCell->servCellCfg.pdschServCellCfg.maxCodeBlkGrpPerTb = NULLP;
640 spCell->servCellCfg.pdschServCellCfg.codeBlkGrpFlushInd = NULLP;
641 spCell->servCellCfg.pdschServCellCfg.xOverhead = NULLP;
642 spCell->servCellCfg.pdschServCellCfg.numHarqProcForPdsch =\
643 NUM_HARQ_PROC_FOR_PDSCH_N_16;
644 /* Filling Initial UL Bwp*/
645 fillDefaultInitUlBwp(&spCell->servCellCfg.initUlBwp);
646 spCell->servCellCfg.numUlBwpToAdd = 0;
647 spCell->servCellCfg.firstActvUlBwpId = ACTIVE_DL_BWP_ID;
651 DU_LOG("\n DU_APP: Memory is NULL for SpCellGrp");
655 /******************************************************************
657 * @brief Fills Physical Cell Group Info
661 * Function : fillDefaultPhyCellGrpInfo
663 * Functionality: Fills Physical Cell Group Info
665 * @params[in] PhyCellGrpCfg *cellGrp
668 *****************************************************************/
669 void fillDefaultPhyCellGrpInfo(PhyCellGrpCfg *cellGrp)
673 cellGrp->pdschHarqAckCodebook = PDSCH_HARQ_ACK_CODEBOOK_DYNAMIC;
674 cellGrp->pNrFr1 = P_NR_FR1;
678 DU_LOG("\nDUAPP: Memory is NULL for Physical Cell Group");
682 /******************************************************************
684 * @brief Fills Mac Cell Group Info
688 * Function : fillDefaultMacCellGrpInfo
690 * Functionality: Fills Mac Cell Group Info
692 * @params[in] MacCellGrpCfg *cellGrp
695 *****************************************************************/
696 void fillDefaultMacCellGrpInfo(MacCellGrpCfg *cellGrp)
702 /* Filling Scheduling Request Config */
703 cellGrp->schReqCfg.addModListCount = 1;
704 if(cellGrp->schReqCfg.addModListCount <= MAX_NUM_SR_CFG_PER_CELL_GRP)
706 for(idx = 0; idx < cellGrp->schReqCfg.addModListCount; idx++)
708 cellGrp->schReqCfg.addModList[idx].schedReqId = SCH_REQ_ID;
709 cellGrp->schReqCfg.addModList[idx].srProhibitTmr = SR_PROHIBIT_MS_32;
710 cellGrp->schReqCfg.addModList[idx].srTransMax = SR_TRANS_MAX_N_16;
713 cellGrp->schReqCfg.relListCount = 0;
715 /* Filling Tag config */
716 cellGrp->tagCfg.addModListCount = 1;
717 if(cellGrp->tagCfg.addModListCount <= MAC_NUM_TAGS)
719 for(idx = 0; idx < cellGrp->tagCfg.addModListCount; idx++)
721 cellGrp->tagCfg.addModList[idx].tagId = TAG_ID;
722 cellGrp->tagCfg.addModList[idx].timeAlignTimer = TIME_ALIGNMENT_TIMER_INFINITY;
725 cellGrp->tagCfg.relListCount = 0;
727 /* Filling BSR config */
728 cellGrp->bsrTmrCfg.periodicTimer = BSR_PERIODIC_TIMER_SF_10;
729 cellGrp->bsrTmrCfg.retxTimer = BSR_RETX_TIMER_SF_320;
730 cellGrp->bsrTmrCfg.srDelayTimer = BSR_SR_DELAY_TMR_2560;
732 /* Filling PHR config */
733 cellGrp->phrCfgSetupPres = true;
734 cellGrp->phrCfg.periodicTimer = PHR_PERIODIC_TIMER_INFINITY;
735 cellGrp->phrCfg.prohibitTimer = PHR_PROHIBIT_TIMER_SF_0;
736 cellGrp->phrCfg.txPowerFactor = PHR_TX_PWR_FACTOR_CHANGE_INFINITY;
737 cellGrp->phrCfg.multiplePHR = false;
738 cellGrp->phrCfg.dummy = false;
739 cellGrp->phrCfg.phrType2OtherCell = false;
740 cellGrp->phrCfg.phrOtherCG = PHR_MODE_OTHER_CG_REAL;
745 DU_LOG("\nDUAPP: Memory is NULL for Master Cell Group");
749 /******************************************************************
751 * @brief Function to fill Mac Lc Cfg for SRB1
755 * Function : fillMacSrb1LcCfg
757 * Functionality: Function to fill Mac Lc cfg for SRB1
759 * @params[in] LcCfg *lcCfg, LcCfg *ueSetReqDb
761 *****************************************************************/
763 void fillMacSrb1LcCfg(LcCfg *macLcCfg)
765 macLcCfg->lcId = SRB1_LCID;
766 macLcCfg->configType = CONFIG_ADD;
767 macLcCfg->drbQos = NULLP;
768 macLcCfg->snssai = NULLP;
769 macLcCfg->ulLcCfgPres = true;
770 fillDefaultUlLcCfg(&macLcCfg->ulLcCfg);
773 /******************************************************************
775 * @brief Function to fill the Lc cfg from ueSetupReqDb
779 * Function : fillMacLcCfgToAddMod
781 * Functionality: Function to fill the Lc cfg from ueSetupReqDb
783 * @params[in] LcCfg *lcCfg, LcCfg *ueSetReqDb
784 * @return ROK/RFAILED
786 *****************************************************************/
788 uint8_t fillMacLcCfgToAddMod(LcCfg *lcCfg, LcCfg *ueSetReqDb)
791 lcCfg->lcId = ueSetReqDb->lcId;
792 lcCfg->configType = ueSetReqDb->configType;
794 if(ueSetReqDb->drbQos)
798 DU_ALLOC_SHRABL_BUF(lcCfg->drbQos, sizeof(DrbQosInfo));
801 DU_LOG("\nDU APP: Memory Alloc failed at drQos at fillMacLcCfgToAddMod()");
807 memcpy(lcCfg->drbQos, ueSetReqDb->drbQos, sizeof(DrbQosInfo));
812 lcCfg->drbQos = NULLP;
817 if(ueSetReqDb->snssai)
821 DU_ALLOC_SHRABL_BUF(lcCfg->snssai, sizeof(Snssai));
824 DU_LOG("\nDU APP: Memory Alloc failed at snnsai at fillMacLcCfgToAddMod()");
831 memcpy(lcCfg->snssai, ueSetReqDb->snssai, sizeof(Snssai));
835 lcCfg->snssai = NULLP;
838 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->drbQos, sizeof(DrbQosInfo));
839 lcCfg->drbQos = NULLP;
845 lcCfg->snssai = NULLP;
847 lcCfg->ulLcCfgPres = ueSetReqDb->ulLcCfgPres;
848 memcpy(&lcCfg->ulLcCfg, &ueSetReqDb->ulLcCfg, sizeof(UlLcCfg));
849 memcpy(&lcCfg->dlLcCfg, &ueSetReqDb->dlLcCfg, sizeof(DlLcCfg));
853 /******************************************************************
855 * @brief Function to copy the Bit rate from ueSetupReqDb
859 * Function : getMaxAggrBitRate
861 * Functionality: Function to copy bit Rate from ueSetupReqDb
863 * @params[in] MaxAggrBitRate *macBitRate, MaxAggrBitRate *ueDbBitRate
864 * @return ROK/RFAILED
866 *****************************************************************/
868 uint8_t getMaxAggrBitRate(MaxAggrBitRate *macBitRate, MaxAggrBitRate *ueDbBitRate)
874 DU_ALLOC_SHRABL_BUF(macBitRate, sizeof(MaxAggrBitRate));
877 DU_LOG("\nDUAPP: Memory Alloc Failed at getMaxAggrBitRate()");
881 memcpy(macBitRate, ueDbBitRate, sizeof(MaxAggrBitRate));
890 /******************************************************************
892 * @brief Builds and Send UE ReConfig Request to MAC
896 * Function : sendUeReCfgReqToMac
898 * Functionality: Builds and Send UE ReConfig Request to MAC
900 * @Params[in] MacUeCfg pointer
901 * @return ROK - success
904 * ****************************************************************/
906 uint8_t sendUeReCfgReqToMac(MacUeCfg *macUeCfg)
912 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_RECONFIG_REQ);
916 /* Processing one Ue at a time to MAC */
917 DU_LOG("\nDU_APP: Sending Reconfig Request to MAC");
918 ret = (*packMacUeReconfigReqOpts[pst.selector])(&pst, macUeCfg);
921 DU_LOG("\nDU_APP: Failed to send Reconfig Request to MAC at sendUeReCfgReqToMac()");
922 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macUeCfg, sizeof(MacUeCfg));
927 DU_LOG("\n DU_APP: Received macUeCfg is NULLP at sendUeReCfgReqToMac()");
933 /******************************************************************
935 * @brief Function to return Drb LcId
939 * Function : getDrbLcId
941 * Functionality: Function to return Drb LcId
943 * Returns: lcId - SUCCESS
945 *****************************************************************/
947 uint8_t getDrbLcId(uint32_t *drbBitMap)
949 uint8_t bitMask = 1, bitPos = 0;
950 bitPos = MIN_DRB_LCID;
952 while(bitPos <= MAX_DRB_LCID)
954 if((*drbBitMap & (bitMask << bitPos)) == 0)
956 *drbBitMap = ((bitMask << bitPos)| *drbBitMap);
964 DU_LOG("\nDU_APP: Max LC Reached in getDrbLcId()");
968 /******************************************************************
970 * @brief Fills MacUeCfg structure
974 * Function : fillMacUeCfg
976 * Functionality: Fills MacUeCfg
978 * @params[in] cellId, ueIdx, crnti,
981 * @return ROK/RFAILED
983 *****************************************************************/
984 uint8_t fillMacUeCfg(uint16_t cellId, uint8_t ueIdx, uint16_t crnti, \
985 DuUeCfg *ueCfgDb, MacUeCfg *macUeCfg)
987 uint8_t ret, dbIdx, lcIdx, cellIdx;
988 bool lcIdFound = false;
989 MacUeCfg *duMacDb = NULLP;
995 macUeCfg->cellId = cellId;
996 macUeCfg->ueIdx = ueIdx;
997 macUeCfg->crnti = crnti;
998 fillDefaultMacCellGrpInfo(&macUeCfg->macCellGrpCfg);
999 fillDefaultPhyCellGrpInfo(&macUeCfg->phyCellGrpCfg);
1000 fillDefaultSpCellGrpInfo(&macUeCfg->spCellCfg);
1001 macUeCfg->maxAggrBitRate = NULLP;
1002 fillMacSrb1LcCfg(&macUeCfg->lcCfgList[0]);
1007 /* Fetching MacDb from DuUeCb */
1008 GET_CELL_IDX(cellId, cellIdx);
1009 duMacDb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].macUeCfg;
1010 /* Fetching MaUeCfg List for ADD/MOD/DEL */
1011 macUeCfg->cellId = cellId;
1012 macUeCfg->ueIdx = ueIdx;
1013 macUeCfg->crnti = crnti;
1014 ret = procUeReCfgCellInfo(macUeCfg, ueCfgDb->cellGrpCfg);
1017 if(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschPresent)
1019 fillStartSymbolAndLen(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg.numTimeDomRsrcAlloc,\
1020 &macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg, NULL);
1022 if(macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschPresent)
1024 fillStartSymbolAndLen(macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg.numTimeDomRsrcAlloc,\
1025 NULL, &macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg);
1027 ret = getMaxAggrBitRate(macUeCfg->maxAggrBitRate, ueCfgDb->maxAggrBitRate);
1030 /* Filling LC Context */
1031 for(dbIdx = 0; (dbIdx < ueCfgDb->numMacLcs && ret == ROK); dbIdx++)
1033 if(!ueCfgDb->macLcCfg[dbIdx].ulLcCfgPres)
1035 /* Filling default UL LC config in MAC if not present */
1036 ueCfgDb->macLcCfg[dbIdx].ulLcCfgPres = true;
1037 fillDefaultUlLcCfg(&ueCfgDb->macLcCfg[dbIdx].ulLcCfg);
1039 for(lcIdx = 0; lcIdx < duMacDb->numLcs; lcIdx++)
1041 if(ueCfgDb->macLcCfg[dbIdx].lcId == duMacDb->lcCfgList[lcIdx].lcId)
1044 if((ueCfgDb->macLcCfg[dbIdx].configType == CONFIG_UNKNOWN) ||
1045 (ueCfgDb->macLcCfg[dbIdx].configType == CONFIG_MOD))
1047 ueCfgDb->macLcCfg[dbIdx].configType = CONFIG_MOD;
1048 ret = fillMacLcCfgToAddMod(&macUeCfg->lcCfgList[dbIdx], &ueCfgDb->macLcCfg[dbIdx]);
1056 /* ADD/DEL CONFIG */
1057 ret = fillMacLcCfgToAddMod(&macUeCfg->lcCfgList[dbIdx], &ueCfgDb->macLcCfg[dbIdx]);
1065 DU_LOG("\n DU_APP: Failed to add Lc at Idx %d in fillMacUeCfg()", dbIdx);
1068 }/*End of Outer FOR loop */
1073 /******************************************************************
1075 * @brief Fills Rlc AM Information
1079 * Function : fillDefaultAmInfo
1081 * Functionality: Fills Rlc AM Information
1083 * @params[in] AmBearerCfg *amCfg
1086 *****************************************************************/
1087 void fillDefaultAmInfo(AmBearerCfg *amCfg)
1090 amCfg->dlAmCfg.snLenDl = AM_SIZE_12;
1091 amCfg->dlAmCfg.pollRetxTmr = POLL_RETX_TMR_45MS;
1092 amCfg->dlAmCfg.pollPdu = POLL_PDU_TMR_INFINITY;
1093 amCfg->dlAmCfg.pollByte = POLL_BYTES_INFINITY;
1094 amCfg->dlAmCfg.maxRetxTh = RETX_TH_8;
1097 amCfg->ulAmCfg.snLenUl = AM_SIZE_12;
1098 amCfg->ulAmCfg.reAssemTmr = RE_ASM_40MS;
1099 amCfg->ulAmCfg.statProhTmr = PROH_35MS;
1102 /******************************************************************
1104 * @brief Fills RLC UM Bi Directional Information
1108 * Function : fillDefaultUmBiInfo
1110 * Functionality: Fills RLC UM Bi Directional Information
1112 * @params[in] UmBiDirBearerCfg *umBiDirCfg
1115 *****************************************************************/
1116 void fillDefaultUmBiInfo(UmBiDirBearerCfg *umBiDirCfg)
1118 /* UL UM BI DIR INFO */
1119 umBiDirCfg->ulUmCfg.snLenUlUm = UM_SIZE_12;
1120 umBiDirCfg->ulUmCfg.reAssemTmr = RE_ASM_40MS;
1122 /* DL UM BI DIR INFO */
1123 umBiDirCfg->dlUmCfg.snLenDlUm = UM_SIZE_12;
1126 /******************************************************************
1128 * @brief Fills RLC UM Uni Directional UL Information
1132 * Function : fillDefaultUmUlInfo
1134 * Functionality: Fills RLC UM Uni Directional Info
1136 * @params[in] UmUniDirUlBearerCfg *UmUlCfg
1139 *****************************************************************/
1140 void fillDefaultUmUlInfo(UmUniDirUlBearerCfg *UmUlCfg)
1142 UmUlCfg->ulUmCfg.snLenUlUm = UM_SIZE_12;
1143 UmUlCfg->ulUmCfg.reAssemTmr = RE_ASM_40MS;
1146 /******************************************************************
1148 * @brief Fills RLC UM Uni Directional DL Information
1152 * Function : fillDefaultUmDlInfo
1154 * Functionality: Fills RLC UM Uni Directional DL Info
1156 * @params[in] UmUniDirDlBearerCfg *UmDlCfg
1159 *****************************************************************/
1160 void fillDefaultUmDlInfo(UmUniDirDlBearerCfg *UmDlCfg)
1162 UmDlCfg->dlUmCfg.snLenDlUm = UM_SIZE_12;
1165 /******************************************************************
1167 * @brief Builds Rlc Mode Default Configuration
1171 * Function : fillDefaultRlcModeCfg
1173 * Functionality: Builds Rlc Mode Default Configuration
1175 * @params[in] rlcMode, RlcBearerCfg *lcCfg
1176 * @return ROK/RFAILED
1178 *****************************************************************/
1180 uint8_t fillDefaultRlcModeCfg(uint8_t rlcMode, RlcBearerCfg *lcCfg)
1191 DU_ALLOC_SHRABL_BUF(lcCfg->u.amCfg, sizeof(AmBearerCfg));
1193 fillDefaultAmInfo(lcCfg->u.amCfg);
1196 DU_LOG("\n DU_APP: Memory Alloc failed at AmCfg at fillDefaultRlcModeCfg()");
1202 case RLC_UM_BI_DIRECTIONAL :
1204 if(!lcCfg->u.umBiDirCfg)
1206 DU_ALLOC_SHRABL_BUF(lcCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
1207 if(lcCfg->u.umBiDirCfg)
1208 fillDefaultUmBiInfo(lcCfg->u.umBiDirCfg);
1211 DU_LOG("\n DU_APP: Memory Alloc failed at UmBiDirCfg at fillDefaultRlcModeCfg()");
1217 case RLC_UM_UNI_DIRECTIONAL_UL :
1219 if(!lcCfg->u.umUniDirUlCfg)
1221 DU_ALLOC_SHRABL_BUF(lcCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
1222 if(lcCfg->u.umUniDirUlCfg)
1223 fillDefaultUmUlInfo(lcCfg->u.umUniDirUlCfg);
1226 DU_LOG("\n DU_APP: Memory Alloc failed at UmUniDirUlCfg at fillDefaultRlcModeCfg()");
1232 case RLC_UM_UNI_DIRECTIONAL_DL :
1234 if(!lcCfg->u.umUniDirDlCfg)
1236 DU_ALLOC_SHRABL_BUF(lcCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
1237 if(lcCfg->u.umUniDirDlCfg)
1238 fillDefaultUmDlInfo(lcCfg->u.umUniDirDlCfg);
1241 DU_LOG("\n DU_APP: Memory Alloc failed at UmUniDirDlCfg at fillDefaultRlcModeCfg()");
1248 DU_LOG("\nDUAPP: Invalid rlcMode %d at extractRlcCfgToAddMod()", rlcMode);
1255 DU_LOG("\nDUAPP: Received Lc Config is NULL");
1261 /*******************************************************************
1263 * @brief Function to fill Rlc Lc Cfg for SRB1
1267 * Function : fillRlcSrb1LcCfg
1270 * Function to fill Rlc Lc Cfg for SRB1
1272 * @params[in] Pointer to RlcBearerCfg
1273 * @return ROK/RFAILED
1275 *****************************************************************/
1277 uint8_t fillRlcSrb1LcCfg(RlcBearerCfg *rlcLcCfg)
1281 rlcLcCfg->rbId = SRB1_LCID;
1282 rlcLcCfg->rbType = RB_TYPE_SRB;
1283 rlcLcCfg->lcId = SRB1_LCID;
1284 rlcLcCfg->lcType = LCH_DCCH;
1285 rlcLcCfg->rlcMode = RLC_AM;
1286 rlcLcCfg->configType = CONFIG_ADD;
1287 ret = fillDefaultRlcModeCfg(rlcLcCfg->rlcMode, rlcLcCfg);
1291 /*******************************************************************
1293 * @brief Processes UE ReConfig Req to RLC UL
1297 * Function : sendUeReCfgReqToRlc
1300 * Processes UE Reconfig Req to RLC UL
1302 * @params[in] Pointer to RlcUeCfg
1303 * @return ROK - success
1306 *****************************************************************/
1308 uint8_t sendUeReCfgReqToRlc(RlcUeCfg *rlcUeCfg)
1313 FILL_PST_DUAPP_TO_RLC(pst, RLC_UL_INST, EVENT_RLC_UE_RECONFIG_REQ);
1316 /* Processing one Ue at a time to RLC */
1317 DU_LOG("\nDU_APP: Sending Reconfig Request to RLC UL");
1318 ret = (*packRlcUeReconfigReqOpts[pst.selector])(&pst, rlcUeCfg);
1321 DU_LOG("\nDU_APP : Failed to send Ue Reconfig Req to RLC at sendUeReCfgReqToRlc()");
1322 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rlcUeCfg, sizeof(RlcUeCfg));
1327 DU_LOG("\n DU_APP: Received RlcUeCfg is NULL at sendUeReCfgReqToRlc()");
1333 /******************************************************************
1335 * @brief Fills RlcBearerCfg structure
1339 * Function : fillRlcUeCfg
1341 * Functionality: Fills Rlc Bearer Cfg
1344 *****************************************************************/
1345 uint8_t fillRlcUeCfg(uint16_t cellId, uint8_t ueIdx,\
1346 DuUeCfg *ueCfgDb, RlcUeCfg *rlcUeCfg)
1348 uint8_t ret, dbIdx, lcIdx, cellIdx;
1349 bool lcIdFound = false;
1350 RlcUeCfg *duRlcDb = NULLP;
1355 /* Initial RB being Added */
1356 rlcUeCfg->cellId = cellId;
1357 rlcUeCfg->ueIdx = ueIdx;
1358 ret = fillRlcSrb1LcCfg(&rlcUeCfg->rlcLcCfg[0]);
1362 memset(rlcUeCfg, 0, sizeof(RlcUeCfg));
1366 /* Fetch RlcDb from DuUeCb */
1367 GET_CELL_IDX(cellId, cellIdx);
1368 duRlcDb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].rlcUeCfg;
1369 /*Filling RlcUeCfg */
1370 rlcUeCfg->cellId = cellId;
1371 rlcUeCfg->ueIdx = ueIdx;
1372 for(dbIdx = 0; (dbIdx < ueCfgDb->numRlcLcs && ret == ROK); dbIdx++)
1374 ret = fillDefaultRlcModeCfg(ueCfgDb->rlcLcCfg[dbIdx].rlcMode, &ueCfgDb->rlcLcCfg[dbIdx]);
1377 DU_LOG("\n DU_APP: Failed to fill Rlc Mode at fillRlcUeCfg()");
1378 memset(rlcUeCfg, 0, sizeof(RlcUeCfg));
1381 /* Fill Rlc Ue Cfg List for ADD/MOD/DEL */
1382 for(lcIdx = 0; lcIdx < duRlcDb->numLcs; lcIdx++)
1384 if(ueCfgDb->rlcLcCfg[dbIdx].lcId == duRlcDb->rlcLcCfg[lcIdx].lcId)
1387 if((ueCfgDb->rlcLcCfg[dbIdx].configType == CONFIG_UNKNOWN)||
1388 (ueCfgDb->rlcLcCfg[dbIdx].configType == CONFIG_MOD))
1391 ueCfgDb->rlcLcCfg[dbIdx].configType = CONFIG_MOD; /* update Db for MOD type */
1392 memcpy(&rlcUeCfg->rlcLcCfg[dbIdx], &ueCfgDb->rlcLcCfg[dbIdx], sizeof(RlcBearerCfg));
1400 /* ADD/ DEL Config Type */
1401 memcpy(&rlcUeCfg->rlcLcCfg[dbIdx], &ueCfgDb->rlcLcCfg[dbIdx], sizeof(RlcBearerCfg));
1409 /******************************************************************
1411 * @brief creates UE context
1415 * Function : duCreateUeCb
1417 * Functionality: Creates UE Conetxt
1419 * @params[in] UeCcchCtxt Pointer
1422 * @return ROK - success
1424 * ****************************************************************/
1425 uint8_t duCreateUeCb(UeCcchCtxt *ueCcchCtxt, uint32_t gnbCuUeF1apId)
1427 uint8_t cellIdx = 0;
1431 for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
1433 if(ueCcchCtxt->cellId == duCb.actvCellLst[cellIdx]->cellId)
1435 GET_UE_IDX(ueCcchCtxt->crnti, ueIdx);
1436 DU_LOG("\nDU_APP: Filling UeCb for ueIdx [%d]", ueIdx);
1438 duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].f1UeDb = NULLP;
1439 duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].crnti = ueCcchCtxt->crnti;
1440 duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbDuUeF1apId = ueCcchCtxt->gnbDuUeF1apId;
1441 duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbCuUeF1apId = gnbCuUeF1apId;
1442 duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].drbBitMap = NULLP;
1443 duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].ueState = UE_ACTIVE;
1445 /* Filling Mac Ue Config */
1446 memset(&duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].macUeCfg, 0, sizeof(MacUeCfg));
1447 ret = duBuildAndSendUeCreateReqToMac(ueCcchCtxt->cellId, ueIdx, ueCcchCtxt->crnti,\
1448 &duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].macUeCfg);
1450 DU_LOG("\nDU_APP: Failed to send UE create request to MAC");
1452 /* Filling Rlc Ue Config */
1453 memset(&duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].rlcUeCfg, 0, sizeof(RlcUeCfg));
1454 ret = duBuildAndSendUeCreateReqToRlc(ueCcchCtxt->cellId, ueIdx, \
1455 &duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].rlcUeCfg);
1457 DU_LOG("\nDU_APP: Failed to send UE create request to RLC");
1459 duCb.actvCellLst[cellIdx]->numActvUes++;
1460 memset(ueCcchCtxt, 0, sizeof(UeCcchCtxt));
1466 /******************************************************************
1468 * @brief Builds and Send UE Create Request to MAC
1472 * Function : duBuildAndSendUeCreateReqToMac
1474 * Functionality: Builds and Send UE Create Request to MAC
1476 * @Params[in] cellId,
1478 * @return ROK - success
1481 * ****************************************************************/
1483 uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t ueIdx,\
1484 uint16_t crnti, MacUeCfg *duMacUeCfg)
1487 MacUeCfg *macUeCfg = NULLP;
1489 memset(&pst, 0, sizeof(Pst));
1492 ret = fillMacUeCfg(cellId, ueIdx, crnti, NULL, duMacUeCfg);
1495 DU_LOG("\nDU APP: Failed to fill MacUeCfg at duBuildAndSendUeCreateReqToMac()");
1499 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_CREATE_REQ);
1501 /* Copying ueCb to a sharable buffer */
1502 DU_ALLOC_SHRABL_BUF(macUeCfg, sizeof(MacUeCfg));
1505 memset(macUeCfg, 0, sizeof(MacUeCfg));
1506 memcpy(macUeCfg, &duCb.actvCellLst[cellId - 1]->ueCb[ueIdx -1].macUeCfg, sizeof(MacUeCfg));
1507 DU_LOG("\nDU_APP: Sending UE create request to MAC");
1509 /* Processing one Ue at a time to MAC */
1510 ret = (*packMacUeCreateReqOpts[pst.selector])(&pst, macUeCfg);
1513 DU_LOG("\nDU_APP : Failure in sending Ue Create Req to MAC at duBuildAndSendUeCreateReqToMac()");
1514 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macUeCfg, sizeof(MacUeCfg));
1519 DU_LOG("\n DU_APP: Memory alloc failed at duBuildAndSendUeCreateReqToMac()");
1525 /*******************************************************************
1527 * @brief To update DuUeCb Mac Cfg
1531 * Function : duUpdateMacCfg
1532 * Functionality: update DuUeCb MAC Cfg
1534 * @params[in] DuUeCb Pointer
1535 * F1UeContextSetupDb pointer
1536 * @return ROK - success
1539 * ****************************************************************/
1540 uint8_t duUpdateMacCfg(MacUeCfg *macUeCfg, F1UeContextSetupDb *f1UeDb)
1542 uint8_t ret, lcIdx, dbIdx, numLcs, lcDelIdx;
1545 /*Filling Cell Group Cfg*/
1546 ret = procUeReCfgCellInfo(macUeCfg, f1UeDb->duUeCfg.cellGrpCfg);
1549 if(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschPresent)
1551 fillStartSymbolAndLen(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg.numTimeDomRsrcAlloc,\
1552 &macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg, NULL);
1554 if(macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschPresent)
1556 fillStartSymbolAndLen(macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg.numTimeDomRsrcAlloc,\
1557 NULL, &macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg);
1559 ret = getMaxAggrBitRate(macUeCfg->maxAggrBitRate, f1UeDb->duUeCfg.maxAggrBitRate);
1561 /* Filling LC Context */
1562 for(dbIdx = 0; (dbIdx < f1UeDb->duUeCfg.numMacLcs && ret == ROK); dbIdx++)
1564 numLcs = macUeCfg->numLcs;
1565 for(lcIdx = 0; lcIdx < numLcs; lcIdx++)
1567 if(f1UeDb->duUeCfg.macLcCfg[dbIdx].lcId == macUeCfg->lcCfgList[lcIdx].lcId)
1569 if(f1UeDb->duUeCfg.macLcCfg[dbIdx].configType == CONFIG_MOD)
1571 ret = fillMacLcCfgToAddMod(&macUeCfg->lcCfgList[lcIdx],&f1UeDb->duUeCfg.macLcCfg[dbIdx]);
1573 else if(f1UeDb->duUeCfg.macLcCfg[dbIdx].configType == CONFIG_DEL)
1575 /* Free memory at matched lcIdx index */
1576 freeMacLcCfg(&macUeCfg->lcCfgList[lcIdx]);
1578 for(lcDelIdx = lcIdx; lcDelIdx < macUeCfg->numLcs; lcDelIdx++)
1580 /* moving all elements one index ahead */
1581 ret = fillMacLcCfgToAddMod(&macUeCfg->lcCfgList[lcDelIdx], &macUeCfg->lcCfgList[lcDelIdx+1]);
1582 freeMacLcCfg(&macUeCfg->lcCfgList[lcDelIdx+1]);
1585 DU_LOG("\nDU_APP: Failed to delete LC at Idx %d in duUpdateMacCfg()", lcDelIdx);
1592 if(f1UeDb->duUeCfg.macLcCfg[dbIdx].configType == CONFIG_ADD)
1594 ret = fillMacLcCfgToAddMod(&macUeCfg->lcCfgList[numLcs], &f1UeDb->duUeCfg.macLcCfg[dbIdx]);
1597 DU_LOG("\nDU_APP: Failed to add LC at Idx %d in duUpdateMacCfg()", numLcs);
1607 /******************************************************************
1609 * @brief Function to fill the RLC Lc cfg from ueSetupReqDb
1613 * Function : fillRlcCfgToAddMod
1615 * Functionality: Function to fill the RLC Lc cfg from ueSetupReqDb
1618 *****************************************************************/
1620 uint8_t fillRlcCfgToAddMod(RlcBearerCfg *lcCfg, RlcBearerCfg *f1UeDbLcCfg)
1622 lcCfg->configType = f1UeDbLcCfg->configType;
1623 lcCfg->rbId = f1UeDbLcCfg->rbId;
1624 lcCfg->rbType = f1UeDbLcCfg->rbType;
1625 lcCfg->lcId = f1UeDbLcCfg->lcId;
1626 lcCfg->lcType = f1UeDbLcCfg->lcType;
1627 lcCfg->rlcMode = f1UeDbLcCfg->rlcMode;
1628 switch(lcCfg->rlcMode)
1634 DU_ALLOC_SHRABL_BUF(lcCfg->u.amCfg, sizeof(AmBearerCfg));
1639 lcCfg->u.amCfg->dlAmCfg.snLenDl = f1UeDbLcCfg->u.amCfg->dlAmCfg.snLenDl;
1640 lcCfg->u.amCfg->dlAmCfg.pollRetxTmr = f1UeDbLcCfg->u.amCfg->dlAmCfg.pollRetxTmr;
1641 lcCfg->u.amCfg->dlAmCfg.pollPdu = f1UeDbLcCfg->u.amCfg->dlAmCfg.pollPdu;
1642 lcCfg->u.amCfg->dlAmCfg.pollByte = f1UeDbLcCfg->u.amCfg->dlAmCfg.pollByte;
1643 lcCfg->u.amCfg->dlAmCfg.maxRetxTh = f1UeDbLcCfg->u.amCfg->dlAmCfg.maxRetxTh;
1646 lcCfg->u.amCfg->ulAmCfg.snLenUl = f1UeDbLcCfg->u.amCfg->ulAmCfg.snLenUl;
1647 lcCfg->u.amCfg->ulAmCfg.reAssemTmr = f1UeDbLcCfg->u.amCfg->ulAmCfg.reAssemTmr;
1648 lcCfg->u.amCfg->ulAmCfg.statProhTmr = f1UeDbLcCfg->u.amCfg->ulAmCfg.statProhTmr;
1651 case RLC_UM_BI_DIRECTIONAL :
1653 if(!lcCfg->u.umBiDirCfg)
1655 DU_ALLOC_SHRABL_BUF(lcCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
1656 if(!lcCfg->u.umBiDirCfg)
1659 /* UL UM BI DIR INFO */
1660 lcCfg->u.umBiDirCfg->ulUmCfg.snLenUlUm = f1UeDbLcCfg->u.umBiDirCfg->ulUmCfg.snLenUlUm;
1661 lcCfg->u.umBiDirCfg->ulUmCfg.reAssemTmr = f1UeDbLcCfg->u.umBiDirCfg->ulUmCfg.reAssemTmr;
1662 /* DL UM BI DIR INFO */
1663 lcCfg->u.umBiDirCfg->dlUmCfg.snLenDlUm = f1UeDbLcCfg->u.umBiDirCfg->dlUmCfg.snLenDlUm;
1666 case RLC_UM_UNI_DIRECTIONAL_UL :
1668 if(!lcCfg->u.umUniDirUlCfg)
1670 DU_ALLOC_SHRABL_BUF(lcCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
1671 if(!lcCfg->u.umUniDirUlCfg)
1674 lcCfg->u.umUniDirUlCfg->ulUmCfg.snLenUlUm = f1UeDbLcCfg->u.umUniDirUlCfg->ulUmCfg.snLenUlUm;
1675 lcCfg->u.umUniDirUlCfg->ulUmCfg.reAssemTmr = f1UeDbLcCfg->u.umUniDirUlCfg->ulUmCfg.reAssemTmr;
1679 case RLC_UM_UNI_DIRECTIONAL_DL :
1681 if(!lcCfg->u.umUniDirDlCfg)
1683 DU_ALLOC_SHRABL_BUF(lcCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
1684 if(!lcCfg->u.umUniDirDlCfg)
1687 lcCfg->u.umUniDirDlCfg->dlUmCfg.snLenDlUm = f1UeDbLcCfg->u.umUniDirDlCfg->dlUmCfg.snLenDlUm;
1691 DU_LOG("\nDU_APP: Invalid Rlc Mode %d at fillRlcCfgToAddMod()", lcCfg->rlcMode);
1697 /*******************************************************************
1699 * @brief To update DuUeCb Rlc Lc Cfg
1703 * Function : duUpdateRlcLcCfg
1704 * Functionality: update DuUeCb Rlc Lc Cfg
1706 * @params[in] DuUeCb Pointer
1707 * F1UeContextSetupDb pointer
1708 * @return ROK - success
1711 * ****************************************************************/
1713 uint8_t duUpdateRlcLcCfg(RlcUeCfg *rlcUeCfg, F1UeContextSetupDb *f1UeDb)
1715 uint8_t ret, lcIdx, dbIdx, numLcs, lcDelIdx;
1718 for(dbIdx = 0; (dbIdx < f1UeDb->duUeCfg.numRlcLcs && ret ==ROK); dbIdx++)
1720 numLcs = rlcUeCfg->numLcs;
1721 for(lcIdx = 0; lcIdx < numLcs; lcIdx++)
1723 if(f1UeDb->duUeCfg.rlcLcCfg[dbIdx].lcId == rlcUeCfg->rlcLcCfg[lcIdx].lcId)
1725 if(f1UeDb->duUeCfg.rlcLcCfg[dbIdx].configType == CONFIG_MOD)
1727 ret = fillRlcCfgToAddMod(&rlcUeCfg->rlcLcCfg[lcIdx], &f1UeDb->duUeCfg.rlcLcCfg[dbIdx]);
1729 else if(f1UeDb->duUeCfg.rlcLcCfg[dbIdx].configType == CONFIG_DEL)
1731 /* Free memory at matched lcIdx index */
1732 freeRlcLcCfg(&rlcUeCfg->rlcLcCfg[lcIdx]);
1734 for(lcDelIdx = lcIdx; lcDelIdx < rlcUeCfg->numLcs; lcDelIdx++)
1736 ret = fillRlcCfgToAddMod(&rlcUeCfg->rlcLcCfg[lcDelIdx], &rlcUeCfg->rlcLcCfg[lcDelIdx+1]);
1737 freeRlcLcCfg(&rlcUeCfg->rlcLcCfg[lcDelIdx+1]);
1740 DU_LOG("\nDU_APP: Failed to delete LC at Idx %d in duUpdateRlcCfg()", lcDelIdx);
1747 if(f1UeDb->duUeCfg.rlcLcCfg[dbIdx].configType == CONFIG_ADD)
1749 ret = fillRlcCfgToAddMod(&rlcUeCfg->rlcLcCfg[lcIdx], &f1UeDb->duUeCfg.rlcLcCfg[dbIdx]);
1758 /*******************************************************************
1760 * @brief @brief To update DuUeCb Mac and Rlc Ue Cfg
1765 * Function : duUpdateDuUeCbCfg
1767 * Functionality: update DuUeCb Mac and Rlc Ue Cfg
1769 * @params[in] ueIdx, cellIdx
1770 * @return ROK - success
1773 * ****************************************************************/
1775 uint8_t duUpdateDuUeCbCfg(uint8_t ueIdx, uint8_t cellId)
1777 uint8_t ret = ROK, cellIdx = 0, crnti=0;
1778 DuUeCb *ueCb = NULLP;
1780 GET_CELL_IDX(cellId, cellIdx);
1782 if((duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].macUeCfg. \
1783 macUeCfgState == UE_RECFG_COMPLETE) &&
1784 (duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].rlcUeCfg. \
1785 rlcUeCfgState == UE_RECFG_COMPLETE))
1787 ueCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1];
1789 /*Filling RLC Ue Cfg */
1790 ueCb->rlcUeCfg.cellId = cellId;
1791 ueCb->rlcUeCfg.ueIdx = ueIdx;
1792 ret = duUpdateRlcLcCfg(&ueCb->rlcUeCfg, ueCb->f1UeDb);
1795 /*Filling MAC Ue Cfg */
1796 GET_CRNTI(crnti, ueIdx);
1797 ueCb->macUeCfg.cellId = cellId;
1798 ueCb->macUeCfg.ueIdx = ueIdx;
1799 ueCb->macUeCfg.crnti = crnti;
1800 ret = duUpdateMacCfg(&ueCb->macUeCfg, ueCb->f1UeDb);
1802 DU_LOG("\nDU APP: Failed while updating MAC LC Config at duUpdateDuUeCbCfg()");
1805 DU_LOG("\nDU APP: Failed while updating RLC LC Config at duUpdateDuUeCbCfg()");
1812 /*******************************************************************
1814 * @brief Handle UE config response from MAC
1818 * Function : DuProcMacUeCfgRsp
1820 * Functionality: Handle UE Config response from MAC
1822 * @params[in] Pointer to MacUeCfgRsp and Pst
1823 * @return ROK - success
1826 * ****************************************************************/
1827 uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp)
1833 if(cfgRsp->result == MAC_DU_APP_RSP_OK)
1835 if(pst->event == EVENT_MAC_UE_CREATE_RSP)
1837 DU_LOG("\nDU APP : MAC UE Create Response : SUCCESS [UE IDX : %d]", cfgRsp->ueIdx);
1838 duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\
1839 macUeCfg.macUeCfgState = UE_CREATE_COMPLETE;
1841 else if(pst->event == EVENT_MAC_UE_RECONFIG_RSP)
1843 DU_LOG("\nDU APP : MAC UE Reconfig Response : SUCCESS [UE IDX : %d]", cfgRsp->ueIdx);
1844 duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\
1845 macUeCfg.macUeCfgState = UE_RECFG_COMPLETE;
1846 if((ret = duUpdateDuUeCbCfg(cfgRsp->ueIdx, cfgRsp->cellId)) == ROK)
1847 BuildAndSendUeCtxtRsp(cfgRsp->ueIdx, cfgRsp->cellId);
1852 DU_LOG("\nDU APP : MAC UE CFG Response for EVENT[%d]: FAILURE [UE IDX : %d]", pst->event, cfgRsp->ueIdx);
1853 if(pst->event == EVENT_MAC_UE_RECONFIG_RSP)
1855 //TODO: Send the failure case in Ue Context Setup Response
1859 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCfgRsp));
1863 DU_LOG("\nDU APP : Received MAC Ue Config Response is NULL at DuProcMacUeCfgRsp()");
1870 /*******************************************************************
1872 * @brief Processes UE create Req to RLC UL
1876 * Function : duBuildAndSendUeCreateReqToRlc
1879 * Processes UE create Req to RLC UL
1881 * @params[in] cellId,
1883 * Pointer to RlcUeCfg
1884 * @return ROK - success
1887 *****************************************************************/
1889 uint8_t duBuildAndSendUeCreateReqToRlc(uint16_t cellId, uint8_t ueIdx,\
1890 RlcUeCfg *duRlcUeCfg)
1893 RlcUeCfg *rlcUeCfg = NULLP;
1896 ret = fillRlcUeCfg(cellId, ueIdx, NULL, duRlcUeCfg);
1899 DU_LOG("\nDU_APP: Failed to fill Rlc Ue Cfg at duBuildAndSendUeCreateReqToRlc()");
1903 FILL_PST_DUAPP_TO_RLC(pst, RLC_UL_INST, EVENT_RLC_UE_CREATE_REQ);
1904 /* Copying ueCfg to a sharable buffer */
1905 DU_ALLOC_SHRABL_BUF(rlcUeCfg, sizeof(RlcUeCfg));
1908 memset(rlcUeCfg, 0, sizeof(RlcUeCfg));
1909 memcpy(rlcUeCfg, duRlcUeCfg, sizeof(RlcUeCfg));
1910 /* Processing one Ue at a time to RLC */
1911 DU_LOG("\nDU_APP: Sending UE create request to RLC UL");
1912 ret = (*packRlcUeCreateReqOpts[pst.selector])(&pst, rlcUeCfg);
1915 DU_LOG("\nDU_APP : Failure in sending Ue Create Req to RLC");
1916 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rlcUeCfg, sizeof(RlcUeCfg));
1922 DU_LOG("\n DU_APP: Memory alloc failed at duBuildAndSendUeCreateReqToRlc()");
1928 /*******************************************************************
1930 * @brief Processes UE create Rsp received from RLC UL
1935 * Function : DuProcRlcUeCfgRsp
1938 * Processes UE create Rsp received from RLC UL
1940 * @params[in] Post structure
1941 * Pointer to RlcCfgCfm
1942 * @return ROK - success
1945 *****************************************************************/
1946 uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp)
1952 if(cfgRsp->result == RLC_DU_APP_RSP_OK)
1954 if(pst->event == EVENT_RLC_UE_CREATE_RSP)
1956 DU_LOG("\nDU_APP: RLC UE Create Response : SUCCESS [UE IDX:%d]", cfgRsp->ueIdx);
1957 duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\
1958 rlcUeCfg.rlcUeCfgState = UE_CREATE_COMPLETE;
1960 else if(pst->event == EVENT_RLC_UE_RECONFIG_RSP)
1962 DU_LOG("\nDU_APP: RLC UE Reconfig Response : SUCCESS [UE IDX:%d]", cfgRsp->ueIdx);
1963 duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\
1964 rlcUeCfg.rlcUeCfgState = UE_RECFG_COMPLETE;
1965 if((ret = duUpdateDuUeCbCfg(cfgRsp->ueIdx, cfgRsp->cellId)) == ROK)
1966 BuildAndSendUeCtxtRsp(cfgRsp->ueIdx, cfgRsp->cellId);
1972 DU_LOG("\nDU_APP: RLC UE CFG Response for EVENT[%d] : FAILED [UE IDX : %d, REASON :%d]",\
1973 pst->event, cfgRsp->ueIdx, cfgRsp->reason);
1974 if((pst->event == EVENT_RLC_UE_RECONFIG_RSP))
1976 //TODO: update failure case in ue Context setup Response
1980 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCfgRsp));
1984 DU_LOG("\nDU_APP: Received RLC Ue Config Response is NULL at DuProcRlcUeCfgRsp()");
1990 /*******************************************************************
1992 * @brief Builds and Send Ue Reconfig Req to RLC
1996 * Function : duBuildAndSendUeReCfgReqToRLC
1998 * Functionality: Builds and Send Ue Reconfig Req to RLC
2000 * @params[in] cellId, crnti
2002 * RlcUeCfg *rlcUeCfg
2003 * @return ROK - success
2006 * ****************************************************************/
2008 uint8_t duBuildAndSendUeReCfgReqToRlc(uint8_t cellId, uint8_t crnti, DuUeCfg *ueCfgDb)
2010 uint8_t ret = ROK, ueIdx = 0;
2011 RlcUeCfg *rlcUeCfg = NULLP;
2013 GET_UE_IDX(crnti, ueIdx);
2014 DU_ALLOC_SHRABL_BUF(rlcUeCfg, sizeof(RlcUeCfg));
2017 memset(rlcUeCfg, 0, sizeof(RlcUeCfg));
2018 ret = fillRlcUeCfg(cellId, ueIdx, ueCfgDb, rlcUeCfg);
2020 DU_LOG("\nDU APP: Failed at duBuildAndSendUeReCfgReqToRlc()");
2022 ret = sendUeReCfgReqToRlc(rlcUeCfg);
2026 DU_LOG("\nDU APP: Memory Alloc failed at duBuildAndSendUeReCfgReqToRlc()");
2032 /*******************************************************************
2034 * @brief Builds and Send Ue Reconfig Req to MAC
2038 * Function : duBuildAndSendUeReCfgReqToMac
2040 * Functionality: Builds and Send Ue Reconfig Req to MAC
2042 * @params[in] CellGroupConfigRrc_t *macCellGrpCfg
2044 * MacUeCfg *macUeCfg
2045 * @return ROK - success
2048 * ****************************************************************/
2050 uint8_t duBuildAndSendUeReCfgReqToMac(uint8_t cellId, uint8_t crnti, DuUeCfg *ueCfgDb)
2052 uint8_t ret, ueIdx = 0;
2053 MacUeCfg *macUeCfg = NULLP;
2056 GET_UE_IDX(crnti, ueIdx);
2058 DU_ALLOC_SHRABL_BUF(macUeCfg, sizeof(MacUeCfg));
2061 memset(macUeCfg, 0, sizeof(MacUeCfg));
2062 ret = fillMacUeCfg(cellId, ueIdx, crnti, ueCfgDb, macUeCfg);
2064 DU_LOG("\nDU_APP: Failed to fill Mac Ue Cfg at duBuildAndSendUeReCfgReqToMac()");
2066 ret = sendUeReCfgReqToMac(macUeCfg);
2070 DU_LOG("\nDU_APP: Memory alloc failed for macUeCfg at duBuildAndSendUeReCfgReqToMac()");
2076 /*******************************************************************
2078 * @brief Process UE context setup request from CU
2082 * Function : duProcUeContextSetupRequest
2084 * Functionality: Process UE context setup request from CU
2086 * @params[in] F1AP message
2087 * @return ROK - success
2090 * ****************************************************************/
2092 uint8_t duProcUeContextSetupRequest(DuUeCb *ueCb)
2094 uint8_t ret, cellId;
2099 cellId = duCb.actvCellLst[ueCb->f1UeDb->cellIdx]->cellId;
2100 if(ueCb->f1UeDb->dlRrcMsg)
2102 if(ueCb->f1UeDb->dlRrcMsg->rrcMsgPdu)
2104 /* Sending DL RRC Message to RLC */
2105 ret = duBuildAndSendDlRrcMsgToRlc(cellId, ueCb->rlcUeCfg, ueCb->f1UeDb->dlRrcMsg);
2108 DU_LOG("\nDU APP : Failed to send DL RRC msg in duProcUeContextSetupRequest()");
2109 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCb->f1UeDb->dlRrcMsg->rrcMsgPdu,\
2110 ueCb->f1UeDb->dlRrcMsg->rrcMsgSize);
2111 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
2118 DU_LOG("\nDU_APP: Processing Ue Context Setup Request for cellId [%d]", cellId);
2119 /* Filling RLC Ue Reconfig */
2120 ret = duBuildAndSendUeReCfgReqToRlc(cellId, ueCb->crnti, &ueCb->f1UeDb->duUeCfg);
2122 DU_LOG("\nDU_APP: Failed to build ctxt setup req for RLC at duBuildAndSendUeReCfgReqToRlc()");
2124 /* Filling MAC Ue Reconfig */
2125 ret = duBuildAndSendUeReCfgReqToMac(cellId, ueCb->crnti, &ueCb->f1UeDb->duUeCfg);
2127 DU_LOG("\nDU_APP: Failed at build ctxt setup req for MAC at duBuildAndSendUeReCfgReqToMac()");
2133 //TODO: To send the failure cause in UeContextSetupRsp
2134 DU_LOG("DU_APP: Failed to process UE CNTXT SETUP REQ at duProcUeContextSetupRequest()");
2139 /**********************************************************************
2141 ***********************************************************************/