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"
38 #include "AlarmInterface.h"
39 #include "CmInterface.h"
42 DuMacDlCcchInd packMacDlCcchIndOpts[] =
44 packMacDlCcchInd, /* Loose coupling */
45 MacProcDlCcchInd, /* TIght coupling */
46 packMacDlCcchInd /* Light weight-loose coupling */
49 DuMacUeCreateReq packMacUeCreateReqOpts[] =
51 packDuMacUeCreateReq, /* Loose coupling */
52 MacProcUeCreateReq, /* TIght coupling */
53 packDuMacUeCreateReq /* Light weight-loose coupling */
56 DuRlcUeCreateReq packRlcUeCreateReqOpts[] =
58 packDuRlcUeCreateReq, /* Loose coupling */
59 RlcProcUeCreateReq, /* TIght coupling */
60 packDuRlcUeCreateReq /* Light weight-loose coupling */
63 DuDlRrcMsgToRlcFunc duSendDlRrcMsgToRlcOpts[] =
65 packDlRrcMsgToRlc, /* Loose coupling */
66 RlcProcDlRrcMsgTransfer, /* Tight coupling */
67 packDlRrcMsgToRlc /* Light weight-loose coupling */
70 DuRlcUeReconfigReq packRlcUeReconfigReqOpts[] =
72 packDuRlcUeReconfigReq, /* Loose coupling */
73 RlcProcUeReconfigReq, /* TIght coupling */
74 packDuRlcUeReconfigReq /* Light weight-loose coupling */
77 DuMacUeReconfigReq packMacUeReconfigReqOpts[] =
79 packDuMacUeReconfigReq, /* Loose coupling */
80 MacProcUeReconfigReq, /* TIght coupling */
81 packDuMacUeReconfigReq /* Light weight-loose coupling */
84 DuRlcDlUserDataToRlcFunc duSendRlcDlUserDataToRlcOpts[] =
86 packRlcDlUserDataToRlc, /* Loose coupling */
87 RlcProcDlUserDataTransfer, /* Tight coupling */
88 packRlcDlUserDataToRlc /* Light weight-loose coupling */
91 DuMacUeDeleteReq packMacUeDeleteReqOpts[] =
93 packDuMacUeDeleteReq, /* Loose coupling */
94 MacProcUeDeleteReq, /* TIght coupling */
95 packDuMacUeDeleteReq /* Light weight-loose coupling */
98 DuRlcUeDeleteReq packRlcUeDeleteReqOpts[] =
100 packDuRlcUeDeleteReq, /* Loose coupling */
101 RlcProcUeDeleteReq, /* TIght coupling */
102 packDuRlcUeDeleteReq /* Light weight-loose coupling */
105 /******************************************************************
107 * @brief Function to return Drb LcId
111 * Function : getDrbLcId
113 * Functionality: Function to return Drb LcId
115 * @params[in] drbBitMap
117 * Returns: lcId - SUCCESS
119 *****************************************************************/
121 uint8_t getDrbLcId(uint32_t *drbBitMap)
123 uint8_t bitMask = 1, bitPos = 0;
124 bitPos = MIN_DRB_LCID;
126 while(bitPos <= MAX_DRB_LCID)
128 if((*drbBitMap & (bitMask << bitPos)) == 0)
130 *drbBitMap = ((bitMask << bitPos)| *drbBitMap);
138 DU_LOG("\nERROR --> DU_APP: Max LC Reached in getDrbLcId()");
142 /*******************************************************************
144 * @brief Function to fillDlUserDataInfo
148 * Function : fillDlUserDataInfo
151 * Function to fillDlUserDataInfo
156 * @return ROK - success
159 * ****************************************************************/
161 uint8_t fillDlUserDataInfo(uint32_t teId, RlcDlUserDataInfo *dlDataMsgInfo)
165 /*Traversing the duCb to find the CellId, UeId, LCID corresponding to TEID*/
166 for(teIdx = 0; teIdx < duCb.numTeId; teIdx++)
168 if(duCb.upTnlCfg[teIdx] && (duCb.upTnlCfg[teIdx]->tnlCfg1 != NULLP))
170 if(duCb.upTnlCfg[teIdx]->tnlCfg1->teId == teId)
172 dlDataMsgInfo->cellId = duCb.upTnlCfg[teIdx]->cellId;
173 dlDataMsgInfo->ueId = duCb.upTnlCfg[teIdx]->ueId;
174 dlDataMsgInfo->rbId = duCb.upTnlCfg[teIdx]->drbId;
182 /*******************************************************************
184 * @brief Build and Send DL Data Message transfer to RLC
188 * Function : duBuildAndSendDlUserDataToRlc
191 * Build and Send DL Data Message transfer to RLC
193 * @params[in] Cell ID
195 * Logical Channgel ID
198 * @return ROK - success
201 * ****************************************************************/
203 uint8_t duBuildAndSendDlUserDataToRlc(uint16_t msgLen, EgtpMsg *egtpMsg)
205 uint8_t ret = RFAILED;
207 RlcDlUserDataInfo *dlDataMsgInfo = NULLP;
209 DU_ALLOC_SHRABL_BUF(dlDataMsgInfo, sizeof(RlcDlUserDataInfo));
212 DU_LOG("\nERROR --> DU_APP : Memory allocation failed for dlDataMsgInfo in duHdlEgtpDlData()");
215 memset(dlDataMsgInfo, 0, sizeof(RlcDlUserDataInfo));
216 dlDataMsgInfo->dlMsg = egtpMsg->msg;
217 dlDataMsgInfo->msgLen = msgLen;
219 /* Filling DL DATA Msg Info */
220 if(fillDlUserDataInfo(egtpMsg->msgHdr.teId, dlDataMsgInfo) == ROK)
222 /* Filling post structure and sending msg */
223 FILL_PST_DUAPP_TO_RLC(pst, RLC_DL_INST, EVENT_DL_USER_DATA_TRANS_TO_RLC);
224 DU_LOG("\nDEBUG --> DU_APP : Sending User Data Msg to RLC [TEID, nPDU]:[%d, %d]\n",\
225 egtpMsg->msgHdr.teId, egtpMsg->msgHdr.nPdu.val);
226 ret = (*duSendRlcDlUserDataToRlcOpts[pst.selector])(&pst, dlDataMsgInfo);
230 DU_LOG("\nERROR --> DU_APP : Failed to send User Data to RLC in duHdlEgtpDlData()");
231 ODU_PUT_MSG_BUF(dlDataMsgInfo->dlMsg);
232 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlDataMsgInfo, sizeof(RlcDlUserDataInfo));
237 /*******************************************************************
239 * @brief Handles EGTP data from CU
243 * Function : duHdlEgtpData
246 * Processes EGTP header and sends data to RLC
248 * @params[in] Pointer to EGTP Message
249 * @return ROK - success
252 * ****************************************************************/
253 uint8_t duHdlEgtpDlData(EgtpMsg *egtpMsg)
257 #ifdef CALL_FLOW_DEBUG_LOG
258 DU_LOG("\nCall Flow: ENTEGTP -> ENTDUAPP : EVENT_HDL_RECV_DL_DATA\n");
261 DU_LOG("\nDEBUG --> DU_APP : Processing DL data in duHdlEgtpDlData()");
265 DU_LOG("\nERROR --> DU_APP : Recevied Dl Data is NULLP in duHdlEgtpDlData()");
268 ODU_GET_MSG_LEN(egtpMsg->msg, (MsgLen *)&msgLen);
269 if(duBuildAndSendDlUserDataToRlc(msgLen, egtpMsg) != ROK)
271 DU_LOG("\nERROR --> DU_APP : Failed to build DL USer Data in duHdlEgtpDlData()");
277 /******************************************************************
279 * @brief Builds and Sends DL CCCH Ind to MAC
283 * Function : duBuildAndSendDlCcchInd
285 * Functionality: Builds and sends DL CCCH Ind Msg to MAC
287 * @params[in] dlCcchMsg - uint8_t*
288 * @return ROK - success
291 * ****************************************************************/
292 uint8_t duBuildAndSendDlCcchInd(uint16_t *cellId, uint16_t *crnti, \
293 DlCcchMsgType msgType, uint16_t dlCcchMsgSize, uint8_t *dlCcchMsg)
297 DlCcchIndInfo *dlCcchIndInfo = NULLP;
300 DU_LOG("\nDEBUG --> DU APP : Building and Sending DL CCCH Ind to MAC");
302 DU_ALLOC_SHRABL_BUF(dlCcchIndInfo, sizeof(DlCcchIndInfo));
306 DU_LOG("\nERROR --> DU APP : Memory alloc failed while building DL CCCH Ind");
310 dlCcchIndInfo->cellId = *cellId;
311 dlCcchIndInfo->crnti = *crnti;
312 dlCcchIndInfo->msgType = msgType;
313 dlCcchIndInfo->dlCcchMsgLen = dlCcchMsgSize;
315 DU_ALLOC_SHRABL_BUF(dlCcchIndInfo->dlCcchMsg, dlCcchIndInfo->dlCcchMsgLen);
316 if(!dlCcchIndInfo->dlCcchMsg)
318 DU_LOG("\nERROR --> DU APP : Memory alloc failed while building DL CCCH Ind");
319 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo, sizeof(DlCcchIndInfo));
322 for(idx2 = 0; idx2 < dlCcchIndInfo->dlCcchMsgLen; idx2++)
324 dlCcchIndInfo->dlCcchMsg[idx2] = dlCcchMsg[idx2];
326 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchMsg, dlCcchMsgSize);
329 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_DL_CCCH_IND);
330 ret = (*packMacDlCcchIndOpts[pst.selector])(&pst, dlCcchIndInfo);
333 DU_LOG("\nERROR --> DU_APP : Failure in sending DL CCCH to MAC");
334 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo->dlCcchMsg,\
335 dlCcchIndInfo->dlCcchMsgLen);
336 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo, \
337 sizeof(DlCcchIndInfo));
345 /*******************************************************************
347 * @brief Build and Send DL RRC Message transfer to RLC
351 * Function : duBuildAndSendDlRrcMsgToRlc
354 * Build and Send DL RRC Message transfer to RLC
356 * @params[in] Cell ID
358 * Logical Channgel ID
361 * @return ROK - success
364 * ****************************************************************/
365 uint8_t duBuildAndSendDlRrcMsgToRlc(uint16_t cellId, RlcUeCfg ueCfg, F1DlRrcMsg *f1DlRrcMsg)
370 RlcDlRrcMsgInfo *dlRrcMsgInfo = NULLP;
374 DU_LOG("\nERROR --> DU APP : Received Dl RRC Msg is NULL at duBuildAndSendDlRrcMsgToRlc()");
378 DU_ALLOC_SHRABL_BUF(dlRrcMsgInfo, sizeof(RlcDlRrcMsgInfo));
381 DU_LOG("\nERROR --> DU APP : Memory allocation failed for dlRrcMsgInfo in \
382 duBuildAndSendDlRrcMsgToRlc");
383 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, f1DlRrcMsg->rrcMsgPdu, f1DlRrcMsg->rrcMsgSize);
387 /* Filling up the RRC msg info */
388 dlRrcMsgInfo->cellId = cellId;
389 dlRrcMsgInfo->ueId = ueCfg.ueId;
390 for(lcIdx = 0; lcIdx <= MAX_NUM_LC; lcIdx++)
392 if(ueCfg.rlcLcCfg[lcIdx].lcId == f1DlRrcMsg->srbId)
394 dlRrcMsgInfo->rbType = ueCfg.rlcLcCfg[lcIdx].rbType;
395 dlRrcMsgInfo->rbId = ueCfg.rlcLcCfg[lcIdx].rbId;
396 dlRrcMsgInfo->lcType = ueCfg.rlcLcCfg[lcIdx].lcType;
397 dlRrcMsgInfo->lcId = ueCfg.rlcLcCfg[lcIdx].lcId;
401 dlRrcMsgInfo->execDup = f1DlRrcMsg->execDup;
402 dlRrcMsgInfo->deliveryStaRpt = f1DlRrcMsg->deliveryStatRpt;
403 dlRrcMsgInfo->msgLen = f1DlRrcMsg->rrcMsgSize;
404 dlRrcMsgInfo->rrcMsg = f1DlRrcMsg->rrcMsgPdu;
406 /* Filling post structure and sending msg */
407 FILL_PST_DUAPP_TO_RLC(pst, RLC_DL_INST, EVENT_DL_RRC_MSG_TRANS_TO_RLC);
408 DU_LOG("\nDEBUG --> DU_APP: Sending Dl RRC Msg to RLC \n");
409 ret = (*duSendDlRrcMsgToRlcOpts[pst.selector])(&pst, dlRrcMsgInfo);
412 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, f1DlRrcMsg->rrcMsgPdu, f1DlRrcMsg->rrcMsgSize);
413 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlRrcMsgInfo, sizeof(RlcDlRrcMsgInfo));
422 /******************************************************************
424 * @brief Process DL RRC Msg recevied from F1AP
428 * Function : duProcDlRrcMsg
430 * Functionality: Process DL RRC Msg recevied from F1AP
432 * @params[in] dlCcchMsg - uint8_t*
433 * @return ROK - success
436 * ****************************************************************/
438 uint8_t duProcDlRrcMsg(F1DlRrcMsg *dlRrcMsg)
441 uint16_t crnti, cellId, cellIdx;
442 bool ueCcchCtxtFound = false;
443 bool ueFound = false;
447 if(dlRrcMsg->srbId == SRB0_LCID) //RRC connection setup
449 for(ueIdx=0; ueIdx<duCb.numUe; ueIdx++)
451 if(dlRrcMsg->gnbDuUeF1apId == duCb.ueCcchCtxt[ueIdx].gnbDuUeF1apId)
453 ueCcchCtxtFound = true;
454 crnti = duCb.ueCcchCtxt[ueIdx].crnti;
455 cellId = duCb.ueCcchCtxt[ueIdx].cellId;
462 ret = duBuildAndSendDlCcchInd(&cellId, &crnti, RRC_SETUP, dlRrcMsg->rrcMsgSize, dlRrcMsg->rrcMsgPdu);
465 DU_LOG("\nERROR --> DU APP : Failed to build DlCcch Ind at procDlRrcMsgTrans()");
469 if(duCb.actvCellLst[cellId-1] == NULLP)
471 DU_LOG("\nERROR --> DU APP : cellId [%d] does not exist", cellId);
474 if(duCb.actvCellLst[cellId-1]->numActvUes < MAX_NUM_UE)
476 ret = duCreateUeCb(&duCb.ueCcchCtxt[ueIdx], dlRrcMsg->gnbCuUeF1apId);
479 DU_LOG("\nERROR --> DU APP : Failed to createUeCb for cellId [%d] at procDlRrcMsgTrans()", \
480 duCb.ueCcchCtxt[ueIdx].cellId);
485 DU_LOG("\nERROR --> DU_APP: Max Active UEs has reached at procDlRrcMsgTrans()");
492 for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
494 for(ueIdx = 0 ; ueIdx < MAX_NUM_UE; ueIdx++)
496 if(duCb.actvCellLst[cellIdx] && (dlRrcMsg->gnbCuUeF1apId == duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId)
497 && (dlRrcMsg->gnbDuUeF1apId == duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId))
500 ret = duBuildAndSendDlRrcMsgToRlc(duCb.actvCellLst[cellIdx]->cellId, \
501 duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg, dlRrcMsg);
510 DU_LOG("\nERROR --> DU_APP: UE ID [%d] not found", dlRrcMsg->gnbDuUeF1apId);
517 /******************************************************************
519 * @brief Processes UL CCCH Ind recvd from MAC
523 * Function : duProcUlCcchInd
525 * Functionality: Processes UL CCCH Ind recvd from MAC
527 * @params[in] UlCcchIndInfo *ulCcchIndInfo
528 * @return ROK - success
531 * ****************************************************************/
532 uint8_t duProcUlCcchInd(UlCcchIndInfo *ulCcchIndInfo)
536 int32_t gnbDuUeF1apId = 0;
538 if(ulCcchIndInfo->crnti)
540 GET_UE_ID(ulCcchIndInfo->crnti, gnbDuUeF1apId);
544 DU_LOG("\nERROR --> DU_APP : Received invalid CRNTI [%d] ", ulCcchIndInfo->crnti);
548 /* Store Ue mapping */
549 duCb.ueCcchCtxt[duCb.numUe].gnbDuUeF1apId = (uint32_t)gnbDuUeF1apId;
550 duCb.ueCcchCtxt[duCb.numUe].crnti = ulCcchIndInfo->crnti;
551 duCb.ueCcchCtxt[duCb.numUe].cellId = ulCcchIndInfo->cellId;
555 ret = (BuildAndSendInitialRrcMsgTransfer(gnbDuUeF1apId, ulCcchIndInfo->crnti, ulCcchIndInfo->ulCcchMsgLen,
556 ulCcchIndInfo->ulCcchMsg));
559 DU_LOG("\nERROR --> DU_APP : BuildAndSendInitialRrcMsgTransfer failed");
562 DU_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, ulCcchIndInfo->ulCcchMsg, ulCcchIndInfo->ulCcchMsgLen);
563 DU_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, ulCcchIndInfo, sizeof(UlCcchIndInfo));
569 /******************************************************************
571 * @brief Fills Default UL LC Cfg
575 * Function : fillDefaultUlLcCfg
577 * Functionality: Fills Default UL LC Cfg
579 * @params[in] UlLcCfg *ulLcCfg
581 *****************************************************************/
582 void fillDefaultUlLcCfg(UlLcCfg *ulLcCfg)
584 ulLcCfg->priority = LC_PRIORITY_1;
585 ulLcCfg->lcGroup = 0;
586 ulLcCfg->schReqId = 0;
587 ulLcCfg->pbr = PBR_KBPS_INFINITY;
588 ulLcCfg->bsd = BSD_MS_1000;
591 /******************************************************************
593 * @brief Fills Initial DL Bandwidth Part
597 * Function : fillDefaultInitDlBwp
599 * Functionality: Fills Initial DL Bandwidth Part
601 * @params[in] InitialDlBwp *initDlBwp
602 * @return ROK - success
605 *****************************************************************/
606 uint8_t fillDefaultInitDlBwp(InitialDlBwp *initDlBwp)
609 uint8_t freqDomainResource[FREQ_DOM_RSRC_SIZE] = {0};
610 uint8_t coreset0EndPrb, coreset1StartPrb, coreset1NumPrb;
614 /* Filling PDCCH Config */
615 initDlBwp->pdcchPresent = TRUE;
616 if(initDlBwp->pdcchPresent)
618 initDlBwp->pdcchCfg.numCRsetToAddMod = PDCCH_CTRL_RSRC_SET_ONE_ID;
619 memset(initDlBwp->pdcchCfg.cRSetToAddModList, 0, MAX_NUM_CRSET);
620 if(initDlBwp->pdcchCfg.numCRsetToAddMod <= MAX_NUM_CRSET)
622 initDlBwp->pdcchCfg.cRSetToAddModList[idx].cRSetId = PDCCH_CTRL_RSRC_SET_ONE_ID;
623 memset(initDlBwp->pdcchCfg.cRSetToAddModList[idx].freqDomainRsrc, 0, FREQ_DOM_RSRC_SIZE);
624 coreset0EndPrb = CORESET0_END_PRB;
625 coreset1StartPrb = coreset0EndPrb +6;
626 coreset1NumPrb = CORESET1_NUM_PRB;
627 /* calculate the PRBs */
628 fillCoresetFeqDomAllocMap(((coreset1StartPrb)/6), (coreset1NumPrb/6), freqDomainResource);
629 memcpy(initDlBwp->pdcchCfg.cRSetToAddModList[idx].freqDomainRsrc, freqDomainResource, FREQ_DOM_RSRC_SIZE);
631 initDlBwp->pdcchCfg.cRSetToAddModList[idx].duration = PDCCH_CTRL_RSRC_SET_ONE_DURATION;
632 initDlBwp->pdcchCfg.cRSetToAddModList[idx].cceRegMappingType = CCE_REG_MAPPINGTYPE_PR_NONINTERLEAVED;
633 initDlBwp->pdcchCfg.cRSetToAddModList[idx].precoderGranularity = ALL_CONTIGUOUS_RBS;
634 initDlBwp->pdcchCfg.cRSetToAddModList[idx].dmrsScramblingId = SCRAMBLING_ID;
636 initDlBwp->pdcchCfg.numCRsetToRel = 0;
638 /* Filling Serach Space */
639 initDlBwp->pdcchCfg.numSearchSpcToAddMod = PDCCH_CTRL_RSRC_SET_ONE_ID;
640 memset(initDlBwp->pdcchCfg.searchSpcToAddModList, 0, MAX_NUM_CRSET);
641 if(initDlBwp->pdcchCfg.numSearchSpcToAddMod <= MAX_NUM_CRSET)
643 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].searchSpaceId = PDCCH_SRCH_SPC_TWO_ID;
644 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].cRSetId = PDCCH_CTRL_RSRC_SET_ONE_ID;
645 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].mSlotPeriodicityAndOffset = SLOTPERIODICITYANDOFFSET_PR_SL1;
646 memset(initDlBwp->pdcchCfg.searchSpcToAddModList[idx].mSymbolsWithinSlot, 0, MONITORING_SYMB_WITHIN_SLOT_SIZE);
647 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].mSymbolsWithinSlot[idx] = PDCCH_SYMBOL_WITHIN_SLOT;
648 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel1 = AGGREGATIONLEVEL_N8;
649 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel2 = AGGREGATIONLEVEL_N8;
650 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel4 = AGGREGATIONLEVEL_N4;
651 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel8 = AGGREGATIONLEVEL_N2;
652 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel16 = AGGREGATIONLEVEL_N1;
653 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].searchSpaceType = SEARCHSPACETYPE_PR_UE_SPECIFIC;
654 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].ueSpecificDciFormat = PDCCH_SRCH_SPC_TWO_UE_SPEC_DCI_FORMAT;
656 initDlBwp->pdcchCfg.numSearchSpcToRel = 0;
659 /* Filling PDSCH Config */
660 initDlBwp->pdschPresent = TRUE;
661 if(initDlBwp->pdschPresent)
663 initDlBwp->pdschCfg.dmrsDlCfgForPdschMapTypeA.addPos = ADDITIONALPOSITION_POS0;
664 initDlBwp->pdschCfg.resourceAllocType = RESOURCEALLOCATION_TYPE1;
666 initDlBwp->pdschCfg.numTimeDomRsrcAlloc = NUM_TIME_DOM_RSRC_ALLOC;
669 initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].mappingType = MAPPING_TYPEA;
670 initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].startSymbol = PDSCH_START_SYMBOL;
671 initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].symbolLength = PDSCH_LENGTH_SYMBOL;
672 initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].startSymbolAndLength = calcSliv(PDSCH_START_SYMBOL, PDSCH_LENGTH_SYMBOL);
675 DU_ALLOC_SHRABL_BUF(initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].k0, sizeof(uint8_t));
676 if(initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].k0 == NULLP)
678 DU_LOG("\nERROR --> DUAPP : Failed to allocate memory to K0 in fillDefaultInitDlBwp");
681 if(initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].k0)
682 *(initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].k0) = 1;
683 initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].mappingType = MAPPING_TYPEA;
684 initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].startSymbol = PDSCH_START_SYMBOL;
685 initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].symbolLength = PDSCH_LENGTH_SYMBOL;
686 initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].startSymbolAndLength = calcSliv(PDSCH_START_SYMBOL, PDSCH_LENGTH_SYMBOL);
688 initDlBwp->pdschCfg.rbgSize = RBG_SIZE_CONFIG1;
689 initDlBwp->pdschCfg.numCodeWordsSchByDci = CODEWORDS_SCHED_BY_DCI_N1;
690 initDlBwp->pdschCfg.bundlingType = TYPE_STATIC_BUNDLING;
691 initDlBwp->pdschCfg.bundlingInfo.StaticBundling.size = 0;
698 /******************************************************************
700 * @brief Fills Initial UL Bandwidth Part
704 * Function : fillDefaultInitUlBwp
706 * Functionality: Fills Initial UL Bandwidth Part
708 * @params[in] InitialUlBwp *initUlBwp
711 *****************************************************************/
712 void fillDefaultInitUlBwp(InitialUlBwp *initUlBwp)
717 initUlBwp->pucchPresent = FALSE;
719 /*Filling PUSCH Config */
720 initUlBwp->puschPresent = TRUE;
721 if(initUlBwp->puschPresent)
723 initUlBwp->puschCfg.dataScramblingId = SCRAMBLING_ID;
724 initUlBwp->puschCfg.dmrsUlCfgForPuschMapTypeA.addPos = ADDITIONALPOSITION_POS0;
725 initUlBwp->puschCfg.dmrsUlCfgForPuschMapTypeA.transPrecodDisabled. \
726 scramblingId0 = SCRAMBLING_ID;
727 initUlBwp->puschCfg.resourceAllocType = RESOURCEALLOCATION_TYPE1;
728 initUlBwp->puschCfg.numTimeDomRsrcAlloc = 2;
730 if(initUlBwp->puschCfg.numTimeDomRsrcAlloc <= MAX_NUM_UL_ALLOC)
732 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].k2 = PUSCH_K2_CFG1;
733 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].mappingType =\
735 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].startSymbol = PUSCH_START_SYMBOL;
736 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].symbolLength = PUSCH_LENGTH_SYMBOL;
737 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].startSymbolAndLength =\
738 calcSliv(PUSCH_START_SYMBOL, PUSCH_LENGTH_SYMBOL);
741 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].k2 = PUSCH_K2_CFG2;
742 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].mappingType = MAPPING_TYPEA;
743 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].startSymbol = PUSCH_START_SYMBOL;
744 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].symbolLength = PUSCH_LENGTH_SYMBOL;
745 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].startSymbolAndLength =\
746 calcSliv(PUSCH_START_SYMBOL, PUSCH_LENGTH_SYMBOL);
748 initUlBwp->puschCfg.transformPrecoder = TRANSFORM_PRECODER_DISABLED;
753 DU_LOG("\nERROR --> DU APP : Memory is NULL of InitalUlBwp");
757 /******************************************************************
759 * @brief Fills SpCell Group Info
763 * Function : fillDefaultSpCellGrpInfo
765 * Functionality: Fills Sp Cell Group Info
767 * @params[in] MacUeCfg *macUeCfg
768 * @return ROK - Success
771 *****************************************************************/
772 uint8_t fillDefaultSpCellGrpInfo(MacUeCfg *macUeCfg)
774 SpCellCfg *spCell = NULL;
777 spCell = &macUeCfg->spCellCfg;
781 macUeCfg->spCellCfgPres = true;
783 spCell->servCellIdx = SERV_CELL_IDX;
784 /* Filling Initial Dl Bwp */
785 if((fillDefaultInitDlBwp(&spCell->servCellCfg.initDlBwp)) != ROK)
787 DU_LOG("\nERROR --> DUAPP : Failed in fillDefaultInitDlBwp");
791 spCell->servCellCfg.numDlBwpToAdd = 0;
792 spCell->servCellCfg.firstActvDlBwpId = ACTIVE_DL_BWP_ID;
793 spCell->servCellCfg.defaultDlBwpId = ACTIVE_DL_BWP_ID;
794 spCell->servCellCfg.bwpInactivityTmr = NULLP;
795 spCell->servCellCfg.pdschServCellCfg.maxMimoLayers = NULLP;
796 spCell->servCellCfg.pdschServCellCfg.maxCodeBlkGrpPerTb = NULLP;
797 spCell->servCellCfg.pdschServCellCfg.codeBlkGrpFlushInd = NULLP;
798 spCell->servCellCfg.pdschServCellCfg.xOverhead = NULLP;
799 spCell->servCellCfg.pdschServCellCfg.numHarqProcForPdsch = NUM_HARQ_PROC_FOR_PDSCH_N_16;
801 /* Filling Initial UL Bwp*/
802 fillDefaultInitUlBwp(&spCell->servCellCfg.initUlBwp);
803 spCell->servCellCfg.numUlBwpToAdd = 0;
804 spCell->servCellCfg.firstActvUlBwpId = ACTIVE_DL_BWP_ID;
808 DU_LOG("\nERROR --> DU APP : Memory is NULL for SpCellGrp");
814 /******************************************************************
816 * @brief Fills Physical Cell Group Info
820 * Function : fillDefaultPhyCellGrpInfo
822 * Functionality: Fills Physical Cell Group Info
824 * @params[in] MacUeCfg *macUeCfg
827 *****************************************************************/
828 void fillDefaultPhyCellGrpInfo(MacUeCfg *macUeCfg)
830 PhyCellGrpCfg *cellGrp = NULL;
833 cellGrp = &macUeCfg->phyCellGrpCfg;
837 macUeCfg->phyCellGrpCfgPres = true;
838 cellGrp->pdschHarqAckCodebook = PDSCH_HARQ_ACK_CODEBOOK_DYNAMIC;
839 cellGrp->pNrFr1 = P_NR_FR1;
843 DU_LOG("\nERROR --> DU APP : Memory is NULL for Physical Cell Group");
847 /******************************************************************
849 * @brief Fills Mac Cell Group Info
853 * Function : fillDefaultMacCellGrpInfo
855 * Functionality: Fills Mac Cell Group Info
857 * @params[in] MacUeCfg *macUeCfg
860 *****************************************************************/
861 void fillDefaultMacCellGrpInfo(MacUeCfg *macUeCfg)
864 MacCellGrpCfg *cellGrp = NULL;
867 cellGrp = &macUeCfg->macCellGrpCfg;
871 macUeCfg->macCellGrpCfgPres = true;
873 /* Filling Scheduling Request Config */
874 cellGrp->schReqCfg.addModListCount = 1;
875 if(cellGrp->schReqCfg.addModListCount <= MAX_NUM_SR_CFG_PER_CELL_GRP)
877 for(idx = 0; idx < cellGrp->schReqCfg.addModListCount; idx++)
879 cellGrp->schReqCfg.addModList[idx].schedReqId = SCH_REQ_ID;
880 cellGrp->schReqCfg.addModList[idx].srProhibitTmr = SR_PROHIBIT_MS_32;
881 cellGrp->schReqCfg.addModList[idx].srTransMax = SR_TRANS_MAX_N_16;
884 cellGrp->schReqCfg.relListCount = 0;
886 /* Filling Tag config */
887 cellGrp->tagCfg.addModListCount = 1;
888 if(cellGrp->tagCfg.addModListCount <= MAC_NUM_TAGS)
890 for(idx = 0; idx < cellGrp->tagCfg.addModListCount; idx++)
892 cellGrp->tagCfg.addModList[idx].tagId = TAG_ID;
893 cellGrp->tagCfg.addModList[idx].timeAlignTimer = TIME_ALIGNMENT_TIMER_INFINITY;
896 cellGrp->tagCfg.relListCount = 0;
898 /* Filling BSR config */
899 cellGrp->bsrTmrCfg.periodicTimer = BSR_PERIODIC_TIMER_SF_10;
900 cellGrp->bsrTmrCfg.retxTimer = BSR_RETX_TIMER_SF_320;
901 cellGrp->bsrTmrCfg.srDelayTimer = BSR_SR_DELAY_TMR_2560;
903 /* Filling PHR config */
904 cellGrp->phrCfgSetupPres = true;
905 cellGrp->phrCfg.periodicTimer = PHR_PERIODIC_TIMER_INFINITY;
906 cellGrp->phrCfg.prohibitTimer = PHR_PROHIBIT_TIMER_SF_0;
907 cellGrp->phrCfg.txPowerFactor = PHR_TX_PWR_FACTOR_CHANGE_INFINITY;
908 cellGrp->phrCfg.multiplePHR = false;
909 cellGrp->phrCfg.dummy = false;
910 cellGrp->phrCfg.phrType2OtherCell = false;
911 cellGrp->phrCfg.phrOtherCG = PHR_MODE_OTHER_CG_REAL;
916 DU_LOG("\nERROR --> DU APP : Memory is NULL for Master Cell Group");
920 /*******************************************************************
922 * @brief Fills default modulation info for a UE
926 * Function : fillDefaultModulation
928 * Functionality: Fills default modulation info for a UE
930 * @params[in] Pointer to MAC UE configuration
931 * @return ROK - success
934 * ****************************************************************/
935 void fillDefaultModulation(MacUeCfg *ueCfg)
937 ueCfg->dlModInfo.modOrder = MOD_ORDER_QPSK;
938 ueCfg->dlModInfo.mcsIndex = DEFAULT_MCS;
939 ueCfg->dlModInfo.mcsTable = MCS_TABLE_QAM64; /* Spec 38.214-Table 5.1.3.1-1 */
941 ueCfg->ulModInfo.modOrder = MOD_ORDER_QPSK;
942 ueCfg->ulModInfo.mcsIndex = DEFAULT_MCS;
943 ueCfg->ulModInfo.mcsTable = MCS_TABLE_QAM64; /* Spec 38.214-Table 5.1.3.1-1 */
946 /******************************************************************
948 * @brief Function to fill Mac Lc Cfg for SRB1
952 * Function : fillMacSrb1LcCfg
954 * Functionality: Function to fill Mac Lc cfg for SRB1
956 * @params[in] LcCfg *lcCfg, LcCfg *ueSetReqDb
958 *****************************************************************/
960 void fillMacSrb1LcCfg(LcCfg *macLcCfg)
962 macLcCfg->lcId = SRB1_LCID;
963 macLcCfg->configType = CONFIG_ADD;
964 macLcCfg->drbQos = NULLP;
965 macLcCfg->snssai = NULLP;
966 macLcCfg->ulLcCfgPres = true;
967 fillDefaultUlLcCfg(&macLcCfg->ulLcCfg);
970 /******************************************************************
972 * @brief Function to fill the Lc cfg from ueSetupReqDb
976 * Function : fillMacLcCfgToAddMod
978 * Functionality: Function to fill the Lc cfg from ueSetupReqDb
980 * @params[in] LcCfg *lcCfg, LcCfg *ueSetReqDb
981 * @return ROK/RFAILED
983 *****************************************************************/
985 uint8_t fillMacLcCfgToAddMod(LcCfg *macLcCfgToSend, LcCfg *ueLcCfgDb, LcCfg *oldLcCfg, Bool toUpdate)
991 macLcCfgToSend->lcId = ueLcCfgDb->lcId;
992 macLcCfgToSend->configType = ueLcCfgDb->configType;
994 if(ueLcCfgDb->drbQos)
995 macLcCfgToSend->drbQos = ueLcCfgDb->drbQos;
997 macLcCfgToSend->drbQos = oldLcCfg->drbQos;
999 macLcCfgToSend->drbQos = NULL;
1001 if(ueLcCfgDb->snssai)
1002 macLcCfgToSend->snssai = ueLcCfgDb->snssai;
1004 macLcCfgToSend->snssai = oldLcCfg->snssai;
1006 macLcCfgToSend->snssai = NULL;
1008 macLcCfgToSend->ulLcCfgPres = ueLcCfgDb->ulLcCfgPres;
1009 memcpy(&macLcCfgToSend->ulLcCfg, &ueLcCfgDb->ulLcCfg, sizeof(UlLcCfg));
1010 memcpy(&macLcCfgToSend->dlLcCfg, &ueLcCfgDb->dlLcCfg, sizeof(DlLcCfg));
1015 oldLcCfg->lcId = ueLcCfgDb->lcId;
1016 oldLcCfg->configType = ueLcCfgDb->configType;
1018 if(ueLcCfgDb->drbQos)
1020 if(oldLcCfg->drbQos)
1021 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, oldLcCfg->drbQos, sizeof(DrbQosInfo));
1023 DU_ALLOC_SHRABL_BUF(oldLcCfg->drbQos, sizeof(DrbQosInfo));
1024 if(oldLcCfg->drbQos == NULL)
1026 DU_LOG("\nERROR --> DU APP : Memory Alloc Failed at fillMacLcCfgToAddMod()");
1029 memcpy(oldLcCfg->drbQos, ueLcCfgDb->drbQos, sizeof(DrbQosInfo));
1032 if(ueLcCfgDb->snssai)
1034 if(oldLcCfg->snssai)
1035 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, oldLcCfg->snssai, sizeof(Snssai));
1037 DU_ALLOC_SHRABL_BUF(oldLcCfg->snssai, sizeof(Snssai));
1038 if(oldLcCfg->snssai == NULL)
1040 DU_LOG("\nERROR --> DU APP : Memory Alloc Failed at fillMacLcCfgToAddMod()");
1041 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, oldLcCfg->drbQos, sizeof(DrbQosInfo));
1044 memcpy(oldLcCfg->snssai, ueLcCfgDb->snssai, sizeof(Snssai));
1047 oldLcCfg->ulLcCfgPres = ueLcCfgDb->ulLcCfgPres;
1048 memcpy(&oldLcCfg->ulLcCfg, &ueLcCfgDb->ulLcCfg, sizeof(UlLcCfg));
1049 memcpy(&oldLcCfg->dlLcCfg, &ueLcCfgDb->dlLcCfg, sizeof(DlLcCfg));
1054 /******************************************************************
1056 * @brief Function to copy the Bit rate from ueSetupReqDb
1060 * Function : fillAmbr
1062 * Functionality: Function to copy bit Rate from ueSetupReqDb
1064 * @params[in] AmbrCfg **macAmbr, AmbrCfg *ueDbAmbr
1065 * @return ROK/RFAILED
1067 *****************************************************************/
1069 uint8_t fillAmbr(AmbrCfg **macAmbrCfgToSend, AmbrCfg *ueDbAmbr, AmbrCfg **oldMacAmbrCfg, Bool toUpdate)
1075 *macAmbrCfgToSend = ueDbAmbr;
1077 else if(oldMacAmbrCfg)
1078 *macAmbrCfgToSend = *oldMacAmbrCfg;
1088 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, *oldMacAmbrCfg, sizeof(AmbrCfg));
1090 DU_ALLOC_SHRABL_BUF(*oldMacAmbrCfg, sizeof(AmbrCfg));
1091 if(*oldMacAmbrCfg == NULLP)
1093 DU_LOG("\nERROR --> DU APP : Memory Alloc Failed at fillAmbr()");
1096 memset(*oldMacAmbrCfg, 0, sizeof(AmbrCfg));
1097 (*oldMacAmbrCfg)->ulBr = ueDbAmbr->ulBr;
1105 /******************************************************************
1107 * @brief Builds and Send UE ReConfig Request to MAC
1111 * Function : sendUeReCfgReqToMac
1113 * Functionality: Builds and Send UE ReConfig Request to MAC
1115 * @Params[in] MacUeCfg pointer
1116 * @return ROK - success
1119 * ****************************************************************/
1121 uint8_t sendUeReCfgReqToMac(MacUeCfg *macUeCfg)
1127 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_RECONFIG_REQ);
1131 /* Processing one Ue at a time to MAC */
1132 DU_LOG("\nDEBUG --> DU_APP: Sending Ue Reconfig Request to MAC");
1133 ret = (*packMacUeReconfigReqOpts[pst.selector])(&pst, macUeCfg);
1136 DU_LOG("\nERROR --> DU APP : Failed to send Reconfig Request to MAC at sendUeReCfgReqToMac()");
1137 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macUeCfg, sizeof(MacUeCfg));
1142 DU_LOG("\nERROR --> DU_APP: Received macUeCfg is NULLP at sendUeReCfgReqToMac()");
1150 /******************************************************************
1152 * @brief Fills MacUeCfg structure
1156 * Function : fillMacUeCfg
1158 * Functionality: Fills MacUeCfg
1160 * @params[in] cellId, ueId, crnti,
1163 * @return ROK/RFAILED
1165 *****************************************************************/
1166 uint8_t fillMacUeCfg(uint16_t cellId, uint8_t gnbDuUef1apId, uint16_t crnti, DuUeCfg *ueCfgDb, MacUeCfg *macUeCfg)
1168 uint8_t ret = ROK, dbIdx = 0, lcIdx = 0, cellIdx = 0;
1169 bool lcIdFound = false;
1170 MacUeCfg *duMacDb = NULLP;
1172 macUeCfg->cellId = cellId;
1173 macUeCfg->ueId = gnbDuUef1apId;
1174 macUeCfg->crnti = crnti;
1178 fillDefaultMacCellGrpInfo(macUeCfg);
1179 fillDefaultPhyCellGrpInfo(macUeCfg);
1181 if((fillDefaultSpCellGrpInfo(macUeCfg)) != ROK)
1183 DU_LOG("\nERROR --> DUAPP : Failed in fillDefaultSpCellGrpInfo");
1187 macUeCfg->ambrCfg = NULLP;
1188 fillDefaultModulation(macUeCfg);
1189 fillMacSrb1LcCfg(&macUeCfg->lcCfgList[0]);
1194 if(ueCfgDb->dataTransmissionAction == STOP_TRANSMISSION)
1196 macUeCfg->transmissionAction = ueCfgDb->dataTransmissionAction;
1200 /* Fetching MacDb from DuUeCb.
1201 * In case of UE hand-in, UE context is created before RRC setup. Hence
1202 * crnti is not known yet. Thus, passing crnti=0 to this function.
1203 * In such a case actvCellLst doesnt yet have any entry for this UE. So
1204 * duMacDb will be NULL.
1209 GET_CELL_IDX(cellId, cellIdx);
1210 if(duCb.actvCellLst[cellIdx])
1211 duMacDb = &duCb.actvCellLst[cellIdx]->ueCb[macUeCfg->ueId-1].macUeCfg;
1214 DU_LOG("\nERROR --> DU APP : Cell Id [%d] does not exist", cellId);
1217 duMacDb->macUeCfgState = UE_CFG_INPROGRESS;
1220 if(ueCfgDb->cellGrpCfg)
1222 ret = procUeReCfgCellInfo(macUeCfg, duMacDb, ueCfgDb->cellGrpCfg);
1225 if(macUeCfg->spCellCfgPres == true)
1227 if(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschPresent)
1229 fillStartSymbolAndLen(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg.numTimeDomRsrcAlloc,\
1230 &macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg, NULL);
1232 if(macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschPresent)
1234 fillStartSymbolAndLen(macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg.numTimeDomRsrcAlloc,\
1235 NULL, &macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg);
1240 ret = fillAmbr(&macUeCfg->ambrCfg, ueCfgDb->ambrCfg , &duMacDb->ambrCfg, FALSE);
1242 ret = fillAmbr(&macUeCfg->ambrCfg, ueCfgDb->ambrCfg , NULL, FALSE);
1244 duFillModulationDetails(macUeCfg, duMacDb, ueCfgDb->ueNrCapability);
1249 fillDefaultMacCellGrpInfo(macUeCfg);
1250 fillDefaultPhyCellGrpInfo(macUeCfg);
1251 fillDefaultSpCellGrpInfo(macUeCfg);
1252 fillDefaultModulation(macUeCfg);
1255 /* Filling LC Context */
1256 for(dbIdx = 0; (dbIdx < ueCfgDb->numMacLcs && ret == ROK); dbIdx++)
1258 if(!ueCfgDb->macLcCfg[dbIdx].ulLcCfgPres)
1260 /* Filling default UL LC config in MAC if not present */
1261 ueCfgDb->macLcCfg[dbIdx].ulLcCfgPres = true;
1262 fillDefaultUlLcCfg(&ueCfgDb->macLcCfg[dbIdx].ulLcCfg);
1267 for(lcIdx = 0; lcIdx < duMacDb->numLcs; lcIdx++)
1269 if(ueCfgDb->macLcCfg[dbIdx].lcId == duMacDb->lcCfgList[lcIdx].lcId)
1272 if((ueCfgDb->macLcCfg[dbIdx].configType == CONFIG_UNKNOWN) ||
1273 (ueCfgDb->macLcCfg[dbIdx].configType == CONFIG_MOD))
1275 ueCfgDb->macLcCfg[dbIdx].configType = CONFIG_MOD;
1276 ret = fillMacLcCfgToAddMod(&macUeCfg->lcCfgList[dbIdx], &ueCfgDb->macLcCfg[dbIdx],\
1277 &duMacDb->lcCfgList[lcIdx], FALSE);
1287 /* ADD/DEL CONFIG */
1288 ret = fillMacLcCfgToAddMod(&macUeCfg->lcCfgList[dbIdx], &ueCfgDb->macLcCfg[dbIdx], NULL, FALSE);
1296 DU_LOG("\nERROR --> DU APP : Failed to add Lc at Idx %d in fillMacUeCfg()", dbIdx);
1299 }/*End of Outer FOR loop */
1300 memcpy(&ueCfgDb->copyOfmacUeCfg, macUeCfg, sizeof(MacUeCfg));
1305 /******************************************************************
1307 * @brief Fills Rlc AM Information
1311 * Function : fillDefaultAmInfo
1313 * Functionality: Fills Rlc AM Information
1315 * @params[in] AmBearerCfg *amCfg
1318 *****************************************************************/
1319 void fillDefaultAmInfo(AmBearerCfg *amCfg)
1322 amCfg->dlAmCfg.snLenDl = AM_SIZE_12;
1323 amCfg->dlAmCfg.pollRetxTmr = T_POLL_RETRANSMIT_VAL;
1324 amCfg->dlAmCfg.pollPdu = POLL_PDU_VAL;
1325 amCfg->dlAmCfg.pollByte = POLL_BYTE_VAL;
1326 amCfg->dlAmCfg.maxRetxTh = MAX_RETX_THRESHOLD_VAL;
1329 amCfg->ulAmCfg.snLenUl = AM_SIZE_12;
1330 amCfg->ulAmCfg.reAssemTmr = T_REASSEMBLY_VAL;
1331 amCfg->ulAmCfg.statProhTmr = T_STATUS_PROHIBHIT_VAL;
1334 /******************************************************************
1336 * @brief Fills RLC UM Bi Directional Information
1340 * Function : fillDefaultUmBiInfo
1342 * Functionality: Fills RLC UM Bi Directional Information
1344 * @params[in] UmBiDirBearerCfg *umBiDirCfg
1347 *****************************************************************/
1348 void fillDefaultUmBiInfo(UmBiDirBearerCfg *umBiDirCfg)
1350 /* UL UM BI DIR INFO */
1351 umBiDirCfg->ulUmCfg.snLenUlUm = UM_SIZE_12;
1352 umBiDirCfg->ulUmCfg.reAssemTmr = T_REASSEMBLY_VAL;
1354 /* DL UM BI DIR INFO */
1355 umBiDirCfg->dlUmCfg.snLenDlUm = UM_SIZE_12;
1358 /******************************************************************
1360 * @brief Fills RLC UM Uni Directional UL Information
1364 * Function : fillDefaultUmUlInfo
1366 * Functionality: Fills RLC UM Uni Directional Info
1368 * @params[in] UmUniDirUlBearerCfg *UmUlCfg
1371 *****************************************************************/
1372 void fillDefaultUmUlInfo(UmUniDirUlBearerCfg *UmUlCfg)
1374 UmUlCfg->ulUmCfg.snLenUlUm = UM_SIZE_12;
1375 UmUlCfg->ulUmCfg.reAssemTmr = T_REASSEMBLY_VAL;
1378 /******************************************************************
1380 * @brief Fills RLC UM Uni Directional DL Information
1384 * Function : fillDefaultUmDlInfo
1386 * Functionality: Fills RLC UM Uni Directional DL Info
1388 * @params[in] UmUniDirDlBearerCfg *UmDlCfg
1391 *****************************************************************/
1392 void fillDefaultUmDlInfo(UmUniDirDlBearerCfg *UmDlCfg)
1394 UmDlCfg->dlUmCfg.snLenDlUm = UM_SIZE_12;
1397 /******************************************************************
1399 * @brief Builds Rlc Mode Default Configuration
1403 * Function : fillDefaultRlcModeCfg
1405 * Functionality: Builds Rlc Mode Default Configuration
1407 * @params[in] rlcMode, RlcBearerCfg *lcCfg
1408 * @return ROK/RFAILED
1410 *****************************************************************/
1412 uint8_t fillDefaultRlcModeCfg(uint8_t rlcMode, RlcBearerCfg *lcCfg)
1422 DU_ALLOC_SHRABL_BUF(lcCfg->u.amCfg, sizeof(AmBearerCfg));
1424 fillDefaultAmInfo(lcCfg->u.amCfg);
1427 DU_LOG("\n ERROR --> DU APP : Memory Alloc failed at AmCfg at fillDefaultRlcModeCfg()");
1433 case RLC_UM_BI_DIRECTIONAL :
1435 if(!lcCfg->u.umBiDirCfg)
1437 DU_ALLOC_SHRABL_BUF(lcCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
1438 if(lcCfg->u.umBiDirCfg)
1439 fillDefaultUmBiInfo(lcCfg->u.umBiDirCfg);
1442 DU_LOG("\n ERROR --> DU APP : Memory Alloc failed at UmBiDirCfg at fillDefaultRlcModeCfg()");
1448 case RLC_UM_UNI_DIRECTIONAL_UL :
1450 if(!lcCfg->u.umUniDirUlCfg)
1452 DU_ALLOC_SHRABL_BUF(lcCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
1453 if(lcCfg->u.umUniDirUlCfg)
1454 fillDefaultUmUlInfo(lcCfg->u.umUniDirUlCfg);
1457 DU_LOG("\n ERROR --> DU APP : Memory Alloc failed at UmUniDirUlCfg at fillDefaultRlcModeCfg()");
1463 case RLC_UM_UNI_DIRECTIONAL_DL :
1465 if(!lcCfg->u.umUniDirDlCfg)
1467 DU_ALLOC_SHRABL_BUF(lcCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
1468 if(lcCfg->u.umUniDirDlCfg)
1469 fillDefaultUmDlInfo(lcCfg->u.umUniDirDlCfg);
1472 DU_LOG("\n ERROR --> DU APP : Memory Alloc failed at UmUniDirDlCfg at fillDefaultRlcModeCfg()");
1479 DU_LOG("\nERROR --> DUAPP: Invalid rlcMode %d at extractRlcCfgToAddMod()", rlcMode);
1486 DU_LOG("\nERROR --> DUAPP: Received LC Config is NULL");
1492 /*******************************************************************
1494 * @brief Function to fill Rlc Lc Cfg for SRB1
1498 * Function : fillRlcSrb1LcCfg
1501 * Function to fill Rlc Lc Cfg for SRB1
1503 * @params[in] Pointer to RlcBearerCfg
1504 * @return ROK/RFAILED
1506 *****************************************************************/
1508 uint8_t fillRlcSrb1LcCfg(RlcBearerCfg *rlcLcCfg)
1512 rlcLcCfg->rbId = SRB1_LCID;
1513 rlcLcCfg->rbType = RB_TYPE_SRB;
1514 rlcLcCfg->lcId = SRB1_LCID;
1515 rlcLcCfg->lcType = LCH_DCCH;
1516 rlcLcCfg->rlcMode = RLC_AM;
1517 rlcLcCfg->configType = CONFIG_ADD;
1518 ret = fillDefaultRlcModeCfg(rlcLcCfg->rlcMode, rlcLcCfg);
1519 rlcLcCfg->isLcAddModRspSent = true;
1523 /*******************************************************************
1525 * @brief Processes UE ReConfig Req to RLC UL
1529 * Function : sendUeReCfgReqToRlc
1532 * Processes UE Reconfig Req to RLC UL
1534 * @params[in] Pointer to RlcUeCfg
1535 * @return ROK - success
1538 *****************************************************************/
1540 uint8_t sendUeReCfgReqToRlc(RlcUeCfg *rlcUeCfg)
1545 FILL_PST_DUAPP_TO_RLC(pst, RLC_UL_INST, EVENT_RLC_UE_RECONFIG_REQ);
1548 /* Processing one Ue at a time to RLC */
1549 DU_LOG("\nDEBUG --> DU_APP: Sending Ue Reconfig Request to RLC UL");
1550 ret = (*packRlcUeReconfigReqOpts[pst.selector])(&pst, rlcUeCfg);
1553 DU_LOG("\nERROR --> DU_APP : Failed to send Ue Reconfig Req to RLC at sendUeReCfgReqToRlc()");
1554 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rlcUeCfg, sizeof(RlcUeCfg));
1559 DU_LOG("\nERROR --> DU_APP: Received RlcUeCfg is NULL at sendUeReCfgReqToRlc()");
1565 /******************************************************************
1567 * @brief Fills Snssai information
1571 * Function : fillSnssaiInfo
1573 * Functionality: Fills Snssai information
1575 * @params[in] LcCfg *snssaiTobeSend, LcCfg *snssaiDb, LcCfg *oldSnssai,
1577 * @return ROK - success
1580 *****************************************************************/
1581 uint8_t fillSnssaiInfo(Snssai *snssaiTobeSend, Snssai *snssaiDb, Snssai **oldSnssai, Bool toUpdate)
1586 snssaiTobeSend = snssaiDb;
1588 snssaiTobeSend = *oldSnssai;
1590 snssaiTobeSend = NULL;
1597 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, *oldSnssai, sizeof(Snssai));
1599 DU_ALLOC_SHRABL_BUF(*oldSnssai, sizeof(Snssai));
1600 if(*oldSnssai == NULL)
1602 DU_LOG("\nERROR --> DU APP : Memory Alloc Failed at fillSnssaiInfo()");
1605 memcpy(*oldSnssai, snssaiDb, sizeof(Snssai));
1610 /******************************************************************
1612 * @brief Fills RlcBearerCfg structure
1616 * Function : fillRlcUeCfg
1618 * Functionality: Fills Rlc Bearer Cfg
1621 *****************************************************************/
1622 uint8_t fillRlcUeCfg(uint16_t cellId, uint8_t ueId, DuUeCfg *ueCfgDb, RlcUeCfg *rlcUeCfg)
1624 uint8_t ret, dbIdx, lcIdx, cellIdx;
1625 bool lcIdFound = false;
1626 RlcUeCfg *duRlcDb = NULLP;
1631 /* Initial RB being Added */
1632 rlcUeCfg->cellId = cellId;
1633 rlcUeCfg->ueId = ueId;
1634 ret = fillRlcSrb1LcCfg(&rlcUeCfg->rlcLcCfg[0]);
1638 memset(rlcUeCfg, 0, sizeof(RlcUeCfg));
1642 /* Fetch RlcDb from DuUeCb */
1643 GET_CELL_IDX(cellId, cellIdx);
1644 duRlcDb = &duCb.actvCellLst[cellIdx]->ueCb[ueId-1].rlcUeCfg;
1645 duRlcDb->rlcUeCfgState = UE_CFG_INPROGRESS;
1646 /*Filling RlcUeCfg */
1647 rlcUeCfg->cellId = cellId;
1648 rlcUeCfg->ueId = ueId;
1650 for(dbIdx = 0; (dbIdx < ueCfgDb->numRlcLcs && ret == ROK); dbIdx++)
1652 ret = fillDefaultRlcModeCfg(ueCfgDb->rlcLcCfg[dbIdx].rlcMode, &ueCfgDb->rlcLcCfg[dbIdx]);
1655 DU_LOG("\n ERROR --> DU APP : Failed to fill Rlc Mode at fillRlcUeCfg()");
1656 memset(rlcUeCfg, 0, sizeof(RlcUeCfg));
1659 /* Fill Rlc Ue Cfg List for ADD/MOD/DEL */
1660 for(lcIdx = 0; lcIdx < duRlcDb->numLcs; lcIdx++)
1662 if(ueCfgDb->rlcLcCfg[dbIdx].lcId == duRlcDb->rlcLcCfg[lcIdx].lcId)
1665 if((ueCfgDb->rlcLcCfg[dbIdx].configType == CONFIG_UNKNOWN)||
1666 (ueCfgDb->rlcLcCfg[dbIdx].configType == CONFIG_MOD))
1669 ueCfgDb->rlcLcCfg[dbIdx].configType = CONFIG_MOD; /* update Db for MOD type */
1670 memcpy(&rlcUeCfg->rlcLcCfg[dbIdx], &ueCfgDb->rlcLcCfg[dbIdx], sizeof(RlcBearerCfg));
1671 fillSnssaiInfo(rlcUeCfg->rlcLcCfg[dbIdx].snssai, ueCfgDb->rlcLcCfg[dbIdx].snssai,\
1672 &duRlcDb->rlcLcCfg[lcIdx].snssai,false);
1680 /* ADD/ DEL Config Type */
1681 memcpy(&rlcUeCfg->rlcLcCfg[dbIdx], &ueCfgDb->rlcLcCfg[dbIdx], sizeof(RlcBearerCfg));
1682 fillSnssaiInfo(rlcUeCfg->rlcLcCfg[dbIdx].snssai, ueCfgDb->rlcLcCfg[dbIdx].snssai, NULL, false);
1690 /******************************************************************
1692 * @brief creates UE context
1696 * Function : duCreateUeCb
1698 * Functionality: Creates UE Conetxt
1700 * @params[in] UeCcchCtxt Pointer
1703 * @return ROK - success
1705 * ****************************************************************/
1706 uint8_t duCreateUeCb(UeCcchCtxt *ueCcchCtxt, uint32_t gnbCuUeF1apId)
1708 uint8_t cellIdx = 0;
1710 uint8_t ueId = 0, ueIdx = 0;
1712 for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
1714 if(duCb.actvCellLst[cellIdx] && (ueCcchCtxt->cellId == duCb.actvCellLst[cellIdx]->cellId))
1716 GET_UE_ID(ueCcchCtxt->crnti, ueId);
1717 DU_LOG("\nDEBUG --> DU_APP: Filling UeCb for ueId [%d]", ueId);
1720 duCb.actvCellLst[cellIdx]->ueCb[ueIdx].f1UeDb = NULLP;
1721 duCb.actvCellLst[cellIdx]->ueCb[ueIdx].crnti = ueCcchCtxt->crnti;
1722 duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId = ueCcchCtxt->gnbDuUeF1apId;
1723 duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId = gnbCuUeF1apId;
1724 duCb.actvCellLst[cellIdx]->ueCb[ueIdx].drbBitMap = NULLP;
1725 duCb.actvCellLst[cellIdx]->ueCb[ueIdx].ueState = UE_ACTIVE;
1727 /* Filling Mac Ue Config */
1728 memset(&duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg, 0, sizeof(MacUeCfg));
1729 ret = duBuildAndSendUeCreateReqToMac(ueCcchCtxt->cellId, ueCcchCtxt->gnbDuUeF1apId, ueCcchCtxt->crnti, NULL,
1730 &duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg);
1732 DU_LOG("\nERROR --> DU APP : Failed to send UE create request to MAC");
1734 /* Filling Rlc Ue Config */
1735 memset(&duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg, 0, sizeof(RlcUeCfg));
1736 ret = duBuildAndSendUeCreateReqToRlc(ueCcchCtxt->cellId, ueId, \
1737 &duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg);
1739 DU_LOG("\nERROR --> DU APP : Failed to send UE create request to RLC");
1741 duCb.actvCellLst[cellIdx]->numActvUes++;
1742 memset(ueCcchCtxt, 0, sizeof(UeCcchCtxt));
1749 /******************************************************************
1751 * @brief Builds and Send UE Create Request to MAC
1755 * Function : duBuildAndSendUeCreateReqToMac
1757 * Functionality: Builds and Send UE Create Request to MAC
1759 * @Params[in] cellId,
1762 * UE config extracted from F1AP msg
1763 * MAC UE config struct to be filled
1764 * @return ROK - success
1767 * ****************************************************************/
1769 uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t gnbDuUeF1apId, uint16_t crnti, DuUeCfg *ueCfgDb, MacUeCfg *duMacUeCfg)
1772 MacUeCfg *macUeCfg = NULLP;
1774 memset(&pst, 0, sizeof(Pst));
1777 ret = fillMacUeCfg(cellId, gnbDuUeF1apId, crnti, ueCfgDb, duMacUeCfg);
1780 DU_LOG("\nERROR --> DU APP : Failed to fill MacUeCfg at duBuildAndSendUeCreateReqToMac()");
1785 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_CREATE_REQ);
1787 /* Copying ueCb to a sharable buffer */
1788 DU_ALLOC_SHRABL_BUF(macUeCfg, sizeof(MacUeCfg));
1791 memset(macUeCfg, 0, sizeof(MacUeCfg));
1792 memcpy(macUeCfg, duMacUeCfg, sizeof(MacUeCfg));
1793 DU_LOG("\nDEBUG --> DU_APP: Sending UE create request to MAC");
1795 /* Processing one Ue at a time to MAC */
1796 ret = (*packMacUeCreateReqOpts[pst.selector])(&pst, macUeCfg);
1799 DU_LOG("\nERROR --> DU_APP : Failure in sending Ue Create Req to MAC at duBuildAndSendUeCreateReqToMac()");
1800 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macUeCfg, sizeof(MacUeCfg));
1805 DU_LOG("\n ERROR --> DU APP : Memory alloc failed at duBuildAndSendUeCreateReqToMac()");
1811 /*******************************************************************
1813 * @brief To update DuUeCb Mac Cfg
1817 * Function : duUpdateMacCfg
1818 * Functionality: update DuUeCb MAC Cfg
1820 * @params[in] DuUeCb Pointer
1821 * F1UeContextSetupDb pointer
1822 * @return ROK - success
1825 * ****************************************************************/
1826 uint8_t duUpdateMacCfg(MacUeCfg *macUeCfg, F1UeContextSetupDb *f1UeDb)
1828 uint8_t ret, lcIdx, dbIdx, numLcs, lcDelIdx, cellIdx;
1829 MacUeCfg *oldMacUeCfg;
1832 GET_CELL_IDX(macUeCfg->cellId, cellIdx);
1833 if(duCb.actvCellLst[cellIdx] == NULLP)
1835 DU_LOG("\nERROR --> DU APP: CellId[%d] not found", macUeCfg->cellId);
1838 oldMacUeCfg = &duCb.actvCellLst[cellIdx]->ueCb[macUeCfg->ueId-1].macUeCfg;
1840 /*Filling Cell Group Cfg*/
1841 ret = procUeReCfgCellInfo(macUeCfg, &f1UeDb->duUeCfg.copyOfmacUeCfg, f1UeDb->duUeCfg.cellGrpCfg);
1844 if(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschPresent)
1846 fillStartSymbolAndLen(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg.numTimeDomRsrcAlloc,\
1847 &macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg, NULL);
1849 if(macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschPresent)
1851 fillStartSymbolAndLen(macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg.numTimeDomRsrcAlloc,\
1852 NULL, &macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg);
1854 ret = fillAmbr(NULL, f1UeDb->duUeCfg.ambrCfg, &oldMacUeCfg->ambrCfg, true);
1855 duFillModulationDetails(macUeCfg, oldMacUeCfg, f1UeDb->duUeCfg.ueNrCapability);
1858 /* Filling LC Context */
1859 for(dbIdx = 0; (dbIdx < f1UeDb->duUeCfg.numMacLcs && ret == ROK); dbIdx++)
1861 numLcs = macUeCfg->numLcs;
1862 for(lcIdx = 0; lcIdx < numLcs; lcIdx++)
1864 if(f1UeDb->duUeCfg.macLcCfg[dbIdx].lcId == macUeCfg->lcCfgList[lcIdx].lcId)
1866 if(f1UeDb->duUeCfg.macLcCfg[dbIdx].configType == CONFIG_MOD)
1868 ret = fillMacLcCfgToAddMod(NULL, &f1UeDb->duUeCfg.macLcCfg[dbIdx], &macUeCfg->lcCfgList[lcIdx], true);
1870 else if(f1UeDb->duUeCfg.macLcCfg[dbIdx].configType == CONFIG_DEL)
1872 /* Free memory at matched lcIdx index */
1873 freeMacLcCfg(&macUeCfg->lcCfgList[lcIdx]);
1875 for(lcDelIdx = lcIdx; lcDelIdx < macUeCfg->numLcs; lcDelIdx++)
1877 /* moving all elements one index ahead */
1878 ret = fillMacLcCfgToAddMod(NULL, &macUeCfg->lcCfgList[lcDelIdx+1], &macUeCfg->lcCfgList[lcDelIdx], true);
1879 freeMacLcCfg(&macUeCfg->lcCfgList[lcDelIdx+1]);
1882 DU_LOG("\nERROR --> DU APP : Failed to delete LC at Idx %d in duUpdateMacCfg()", lcDelIdx);
1889 if(f1UeDb->duUeCfg.macLcCfg[dbIdx].configType == CONFIG_ADD)
1891 ret = fillMacLcCfgToAddMod(NULL, &f1UeDb->duUeCfg.macLcCfg[dbIdx], &macUeCfg->lcCfgList[numLcs], true);
1894 DU_LOG("\nERROR --> DU APP : Failed to add LC at Idx %d in duUpdateMacCfg()", numLcs);
1904 /******************************************************************
1906 * @brief Function to fill the RLC Lc cfg from ueSetupReqDb
1910 * Function : fillRlcCfgToAddMod
1912 * Functionality: Function to fill the RLC Lc cfg from ueSetupReqDb
1915 *****************************************************************/
1917 uint8_t fillRlcCfgToAddMod(RlcBearerCfg *lcCfg, RlcBearerCfg *f1UeDbLcCfg)
1919 lcCfg->configType = f1UeDbLcCfg->configType;
1920 lcCfg->rbId = f1UeDbLcCfg->rbId;
1921 lcCfg->rbType = f1UeDbLcCfg->rbType;
1922 lcCfg->lcId = f1UeDbLcCfg->lcId;
1923 lcCfg->lcType = f1UeDbLcCfg->lcType;
1924 lcCfg->rlcMode = f1UeDbLcCfg->rlcMode;
1926 switch(lcCfg->rlcMode)
1932 DU_ALLOC_SHRABL_BUF(lcCfg->u.amCfg, sizeof(AmBearerCfg));
1937 lcCfg->u.amCfg->dlAmCfg.snLenDl = f1UeDbLcCfg->u.amCfg->dlAmCfg.snLenDl;
1938 lcCfg->u.amCfg->dlAmCfg.pollRetxTmr = f1UeDbLcCfg->u.amCfg->dlAmCfg.pollRetxTmr;
1939 lcCfg->u.amCfg->dlAmCfg.pollPdu = f1UeDbLcCfg->u.amCfg->dlAmCfg.pollPdu;
1940 lcCfg->u.amCfg->dlAmCfg.pollByte = f1UeDbLcCfg->u.amCfg->dlAmCfg.pollByte;
1941 lcCfg->u.amCfg->dlAmCfg.maxRetxTh = f1UeDbLcCfg->u.amCfg->dlAmCfg.maxRetxTh;
1944 lcCfg->u.amCfg->ulAmCfg.snLenUl = f1UeDbLcCfg->u.amCfg->ulAmCfg.snLenUl;
1945 lcCfg->u.amCfg->ulAmCfg.reAssemTmr = f1UeDbLcCfg->u.amCfg->ulAmCfg.reAssemTmr;
1946 lcCfg->u.amCfg->ulAmCfg.statProhTmr = f1UeDbLcCfg->u.amCfg->ulAmCfg.statProhTmr;
1949 case RLC_UM_BI_DIRECTIONAL :
1951 if(!lcCfg->u.umBiDirCfg)
1953 DU_ALLOC_SHRABL_BUF(lcCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
1954 if(!lcCfg->u.umBiDirCfg)
1957 /* UL UM BI DIR INFO */
1958 lcCfg->u.umBiDirCfg->ulUmCfg.snLenUlUm = f1UeDbLcCfg->u.umBiDirCfg->ulUmCfg.snLenUlUm;
1959 lcCfg->u.umBiDirCfg->ulUmCfg.reAssemTmr = f1UeDbLcCfg->u.umBiDirCfg->ulUmCfg.reAssemTmr;
1960 /* DL UM BI DIR INFO */
1961 lcCfg->u.umBiDirCfg->dlUmCfg.snLenDlUm = f1UeDbLcCfg->u.umBiDirCfg->dlUmCfg.snLenDlUm;
1964 case RLC_UM_UNI_DIRECTIONAL_UL :
1966 if(!lcCfg->u.umUniDirUlCfg)
1968 DU_ALLOC_SHRABL_BUF(lcCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
1969 if(!lcCfg->u.umUniDirUlCfg)
1972 lcCfg->u.umUniDirUlCfg->ulUmCfg.snLenUlUm = f1UeDbLcCfg->u.umUniDirUlCfg->ulUmCfg.snLenUlUm;
1973 lcCfg->u.umUniDirUlCfg->ulUmCfg.reAssemTmr = f1UeDbLcCfg->u.umUniDirUlCfg->ulUmCfg.reAssemTmr;
1977 case RLC_UM_UNI_DIRECTIONAL_DL :
1979 if(!lcCfg->u.umUniDirDlCfg)
1981 DU_ALLOC_SHRABL_BUF(lcCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
1982 if(!lcCfg->u.umUniDirDlCfg)
1985 lcCfg->u.umUniDirDlCfg->dlUmCfg.snLenDlUm = f1UeDbLcCfg->u.umUniDirDlCfg->dlUmCfg.snLenDlUm;
1989 DU_LOG("\nERROR --> DU_APP: Invalid Rlc Mode %d at fillRlcCfgToAddMod()", lcCfg->rlcMode);
1995 /*******************************************************************
1997 * @brief To update DuUeCb Rlc Lc Cfg
2001 * Function : duUpdateRlcLcCfg
2002 * Functionality: update DuUeCb Rlc Lc Cfg
2004 * @params[in] DuUeCb Pointer
2005 * F1UeContextSetupDb pointer
2006 * @return ROK - success
2009 * ****************************************************************/
2011 uint8_t duUpdateRlcLcCfg(RlcUeCfg *rlcUeCfg, F1UeContextSetupDb *f1UeDb)
2013 uint8_t ret, lcIdx, dbIdx, numLcs, lcDelIdx;
2016 for(dbIdx = 0; (dbIdx < f1UeDb->duUeCfg.numRlcLcs && ret ==ROK); dbIdx++)
2018 numLcs = rlcUeCfg->numLcs;
2019 for(lcIdx = 0; lcIdx < numLcs; lcIdx++)
2021 if(f1UeDb->duUeCfg.rlcLcCfg[dbIdx].lcId == rlcUeCfg->rlcLcCfg[lcIdx].lcId)
2023 if(f1UeDb->duUeCfg.rlcLcCfg[dbIdx].configType == CONFIG_MOD)
2025 ret = fillRlcCfgToAddMod(&rlcUeCfg->rlcLcCfg[lcIdx], &f1UeDb->duUeCfg.rlcLcCfg[dbIdx]);
2028 DU_LOG("\nERROR --> DU APP : Failed to modify LC at Idx %d in duUpdateRlcCfg()", lcDelIdx);
2031 fillSnssaiInfo(NULL, f1UeDb->duUeCfg.rlcLcCfg[dbIdx].snssai, &rlcUeCfg->rlcLcCfg[lcIdx].snssai, true);
2033 else if(f1UeDb->duUeCfg.rlcLcCfg[dbIdx].configType == CONFIG_DEL)
2035 /* Free memory at matched lcIdx index */
2036 freeRlcLcCfg(&rlcUeCfg->rlcLcCfg[lcIdx]);
2038 for(lcDelIdx = lcIdx; lcDelIdx < rlcUeCfg->numLcs; lcDelIdx++)
2040 ret = fillRlcCfgToAddMod(&rlcUeCfg->rlcLcCfg[lcDelIdx], &rlcUeCfg->rlcLcCfg[lcDelIdx+1]);
2041 fillSnssaiInfo(NULL, rlcUeCfg->rlcLcCfg[lcDelIdx+1].snssai, &rlcUeCfg->rlcLcCfg[lcDelIdx].snssai,\
2043 freeRlcLcCfg(&rlcUeCfg->rlcLcCfg[lcDelIdx+1]);
2046 DU_LOG("\nERROR --> DU APP : Failed to delete LC at Idx %d in duUpdateRlcCfg()", lcDelIdx);
2053 if(f1UeDb->duUeCfg.rlcLcCfg[dbIdx].configType == CONFIG_ADD)
2055 ret = fillRlcCfgToAddMod(&rlcUeCfg->rlcLcCfg[lcIdx], &f1UeDb->duUeCfg.rlcLcCfg[dbIdx]);
2058 fillSnssaiInfo(NULL, f1UeDb->duUeCfg.rlcLcCfg[dbIdx].snssai, &rlcUeCfg->rlcLcCfg[ rlcUeCfg->numLcs].snssai,\
2067 /*******************************************************************
2069 * @brief Function to fill Tunnel Config to Add/Mod
2074 * Function : fillTnlCfgToAddMod
2076 * Functionality: Function to fill tunnel Config to Add/Mod
2078 * @params[in] Pointer to tnlCfgDb,
2079 * pointer to f1TnlCfg
2080 * @return ROK - success
2083 * ****************************************************************/
2084 uint8_t fillTnlCfgToAddMod(UpTnlCfg **ueCbTnlCfg, UpTnlCfg *f1TnlCfg)
2088 DU_FREE((*ueCbTnlCfg)->tnlCfg1, sizeof(GtpTnlCfg));
2089 DU_FREE(*ueCbTnlCfg, sizeof(UpTnlCfg));
2092 if(*ueCbTnlCfg == NULLP)
2094 /* copying to DuCb Tnl Cfg */
2095 DU_ALLOC(*ueCbTnlCfg, sizeof(UpTnlCfg));
2096 if(*ueCbTnlCfg == NULLP)
2098 DU_LOG("\nERROR --> DU_APP : fillTnlCfgToAddMod: Memory Alloc failed for drbId[%d]", f1TnlCfg->drbId);
2102 memset(*ueCbTnlCfg, 0, sizeof(UpTnlCfg));
2103 (*ueCbTnlCfg)->configType = f1TnlCfg->configType;
2104 (*ueCbTnlCfg)->cellId = f1TnlCfg->cellId;
2105 (*ueCbTnlCfg)->ueId = f1TnlCfg->ueId;
2106 (*ueCbTnlCfg)->drbId = f1TnlCfg->drbId;
2107 if(f1TnlCfg->tnlCfg1)
2109 if((*ueCbTnlCfg)->tnlCfg1 == NULLP)
2111 DU_ALLOC((*ueCbTnlCfg)->tnlCfg1, sizeof(GtpTnlCfg));
2112 if((*ueCbTnlCfg)->tnlCfg1 == NULLP)
2114 DU_LOG("\nERROR --> DU_APP : fillTnlCfgToAddMod: Memory Alloc failed for tnlCfg1 for drbId[%d]", f1TnlCfg->drbId);
2118 memset((*ueCbTnlCfg)->tnlCfg1, 0, sizeof(GtpTnlCfg));
2119 (*ueCbTnlCfg)->tnlCfg1->teId = f1TnlCfg->tnlCfg1->teId;
2120 (*ueCbTnlCfg)->tnlCfg1->ulTnlAddress = f1TnlCfg->tnlCfg1->ulTnlAddress;
2121 (*ueCbTnlCfg)->tnlCfg1->dlTnlAddress = f1TnlCfg->tnlCfg1->dlTnlAddress;
2126 /*******************************************************************
2128 * @brief Processing the tunnel Request to EGTP
2132 * Function : duProcEgtpTunnelCfg
2134 * Functionality: Processing the tunnel Request to EGTP
2136 * @params[in] UptnlCfg *duTnlCfg, UpTnlCfg *f1TnlCfg
2137 * @return ROK - success
2140 * ****************************************************************/
2142 uint8_t duProcEgtpTunnelCfg(uint8_t ueCbIdx, UpTnlCfg *duTnlCfg, UpTnlCfg *f1TnlCfg)
2144 uint8_t ret = RFAILED, delIdx;
2146 if(f1TnlCfg->tnlCfg1 == NULLP)
2148 DU_LOG("\nERROR --> DU_APP : Tunnel config not found");
2152 if(f1TnlCfg->configType == CONFIG_ADD)
2154 if(duSendEgtpTnlMgmtReq(EGTP_TNL_MGMT_ADD, NULLP, f1TnlCfg->tnlCfg1) == ROK)
2156 if(fillTnlCfgToAddMod(&duCb.upTnlCfg[duCb.numTeId], f1TnlCfg) == ROK)
2163 else if(f1TnlCfg->configType == CONFIG_MOD)
2165 if(duSendEgtpTnlMgmtReq(EGTP_TNL_MGMT_MOD, duTnlCfg->tnlCfg1->teId, f1TnlCfg->tnlCfg1) == ROK)
2167 if(fillTnlCfgToAddMod(&duTnlCfg, f1TnlCfg) == ROK)
2173 else if(f1TnlCfg->configType == CONFIG_DEL)
2175 if(duSendEgtpTnlMgmtReq(EGTP_TNL_MGMT_DEL, duTnlCfg->tnlCfg1->teId, f1TnlCfg->tnlCfg1) == ROK)
2177 /* Free memory at drbIdx */
2179 for(delIdx = ueCbIdx; delIdx < duCb.numTeId; delIdx++)
2181 /* moving all elements one index ahead */
2182 ret = fillTnlCfgToAddMod(&duCb.upTnlCfg[delIdx], duCb.upTnlCfg[delIdx+1]);
2188 if(duCb.upTnlCfg[delIdx])
2190 DU_FREE(duCb.upTnlCfg[delIdx]->tnlCfg1, sizeof(GtpTnlCfg));
2191 DU_FREE(duCb.upTnlCfg[delIdx], sizeof(UpTnlCfg));
2198 /***********************************************************************
2200 * @brief Function to fill Tunnel Config
2201 * and sends tunnel Req to EGTP
2206 * Function : duUpdateTunnelCfgDb
2208 * Functionality: Function to fill tunnel Config
2209 * and sends tunnel Cfg Req to EGTP
2211 * @params[in] ueId, cellId, DuUeCfg
2212 * @return ROK - success
2215 * ****************************************************************/
2217 uint8_t duUpdateTunnelCfgDb(uint8_t ueId, uint8_t cellId, DuUeCfg *duUeCfg)
2219 uint8_t ret = ROK, drbIdx, teIdx;
2220 bool drbFound = false;
2222 /*If Add/Mod tunnels request for that DRB is successful in EGTP */
2223 /*then update drbId and tunnel Info in duCb */
2224 for(drbIdx=0; drbIdx < duUeCfg->numDrb; drbIdx++)
2226 duUeCfg->upTnlInfo[drbIdx].cellId = cellId;
2227 duUeCfg->upTnlInfo[drbIdx].ueId = ueId;
2228 for(teIdx = 0; teIdx < duCb.numTeId; teIdx++)
2230 if((duCb.upTnlCfg[teIdx]->ueId == duUeCfg->upTnlInfo[drbIdx].ueId) && \
2231 (duCb.upTnlCfg[teIdx]->drbId == duUeCfg->upTnlInfo[drbIdx].drbId))
2233 drbFound = true; /* existing DRB */
2234 if(duProcEgtpTunnelCfg(teIdx, duCb.upTnlCfg[teIdx], &duUeCfg->upTnlInfo[drbIdx]) != ROK)
2236 DU_LOG("\nERROR -> DU_APP : duUpdateTunnelCfgDb: Failed to modify tunnel req for Drb id[%d]",
2237 duUeCfg->upTnlInfo[drbIdx].drbId);
2246 if(!drbFound && ret == ROK)/* new DRB to Add */
2248 if(duProcEgtpTunnelCfg(NULLP, NULLP, &duUeCfg->upTnlInfo[drbIdx]) != ROK)
2250 DU_LOG("\nERROR -> DU_APP : duUpdateTunnelCfgDb: Failed to add tunnel req for Drb id[%d]",
2251 duUeCfg->upTnlInfo[drbIdx].drbId);
2262 /*******************************************************************
2264 * @brief @brief To update DuUeCb Mac and Rlc Ue Cfg
2269 * Function : duUpdateDuUeCbCfg
2271 * Functionality: update DuUeCb Mac and Rlc Ue Cfg
2273 * @params[in] ueId, cellIdx
2274 * @return ROK - success
2277 * ****************************************************************/
2279 uint8_t duUpdateDuUeCbCfg(uint8_t ueId, uint8_t cellId)
2281 uint8_t ret = ROK, cellIdx = 0, crnti=0;
2282 DuUeCb *ueCb = NULLP;
2284 GET_CELL_IDX(cellId, cellIdx);
2286 if(duCb.actvCellLst[cellIdx] && (duCb.actvCellLst[cellIdx]->ueCb[ueId-1].macUeCfg.macUeCfgState == UE_RECFG_COMPLETE) &&
2287 (duCb.actvCellLst[cellIdx]->ueCb[ueId-1].rlcUeCfg.rlcUeCfgState == UE_RECFG_COMPLETE))
2289 ueCb = &duCb.actvCellLst[cellIdx]->ueCb[ueId-1];
2291 /*Filling RLC Ue Cfg */
2292 ueCb->rlcUeCfg.cellId = cellId;
2293 ueCb->rlcUeCfg.ueId = ueId;
2294 ret = duUpdateRlcLcCfg(&ueCb->rlcUeCfg, ueCb->f1UeDb);
2297 /*Filling MAC Ue Cfg */
2298 GET_CRNTI(crnti, ueId);
2299 ueCb->macUeCfg.cellId = cellId;
2300 ueCb->macUeCfg.ueId = ueId;
2301 ueCb->macUeCfg.crnti = crnti;
2302 ret = duUpdateMacCfg(&ueCb->macUeCfg, ueCb->f1UeDb);
2304 DU_LOG("\nERROR --> DU APP : Failed while updating MAC LC Config at duUpdateDuUeCbCfg()");
2307 if(duUpdateTunnelCfgDb(ueId, cellId, &ueCb->f1UeDb->duUeCfg) != ROK)
2309 DU_LOG("\nERROR --> DU_APP : Failed to establish tunnel in duUpdateDuUeCbCfg()");
2315 DU_LOG("\nERROR --> DU APP : Failed while updating RLC LC Config at duUpdateDuUeCbCfg()");
2322 /*******************************************************************
2324 * @brief Handle UE config response from MAC
2328 * Function : DuProcMacUeCfgRsp
2330 * Functionality: Handle UE Config response from MAC
2332 * @params[in] Pointer to MacUeCfgRsp and Pst
2333 * @return ROK - success
2336 * ****************************************************************/
2337 uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp)
2344 GET_CELL_IDX(cfgRsp->cellId, cellIdx);
2345 if(cfgRsp->result == MAC_DU_APP_RSP_OK)
2347 if(pst->event == EVENT_MAC_UE_CREATE_RSP)
2349 DU_LOG("\nINFO --> DU APP : MAC UE Create Response : SUCCESS [DU UE F1AP ID : %d]", cfgRsp->ueId);
2351 if(duCb.actvCellLst[cellIdx] &&
2352 (duCb.actvCellLst[cellIdx]->ueCb[cfgRsp->ueId -1].gnbDuUeF1apId == cfgRsp->ueId))
2354 duCb.actvCellLst[cellIdx]->ueCb[cfgRsp->ueId -1].macUeCfg.macUeCfgState = UE_CREATE_COMPLETE;
2356 /* TODO : IF UE state is HANDIN_IN_PROGRESS, then send UE Context Setup Response */
2359 else if(pst->event == EVENT_MAC_UE_RECONFIG_RSP)
2361 DU_LOG("\nINFO --> DU APP : MAC UE Reconfig Response : SUCCESS [DU UE F1AP ID : %d]", cfgRsp->ueId);
2362 if(duCb.actvCellLst[cellIdx] &&
2363 (duCb.actvCellLst[cellIdx]->ueCb[cfgRsp->ueId -1].gnbDuUeF1apId == cfgRsp->ueId))
2365 duCb.actvCellLst[cellIdx]->ueCb[cfgRsp->ueId -1].macUeCfg.macUeCfgState = UE_RECFG_COMPLETE;
2366 if((ret = duUpdateDuUeCbCfg(cfgRsp->ueId, cfgRsp->cellId)) == ROK)
2368 BuildAndSendUeCtxtRsp(cfgRsp->cellId, cfgRsp->ueId);
2375 DU_LOG("\nERROR --> DU APP : MAC UE CFG Response for EVENT[%d]: FAILURE [DU UE F1AP ID : %d]", pst->event, cfgRsp->ueId);
2376 if(pst->event == EVENT_MAC_UE_RECONFIG_RSP)
2378 //TODO: Send the failure case in Ue Context Setup Response
2382 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCfgRsp));
2386 DU_LOG("\nERROR --> DU APP : Received MAC Ue Config Response is NULL at DuProcMacUeCfgRsp()");
2393 /*******************************************************************
2395 * @brief Processes UE create Req to RLC UL
2399 * Function : duBuildAndSendUeCreateReqToRlc
2402 * Processes UE create Req to RLC UL
2404 * @params[in] cellId,
2406 * Pointer to RlcUeCfg
2407 * @return ROK - success
2410 *****************************************************************/
2412 uint8_t duBuildAndSendUeCreateReqToRlc(uint16_t cellId, uint8_t ueId, RlcUeCfg *duRlcUeCfg)
2415 RlcUeCfg *rlcUeCfg = NULLP;
2418 ret = fillRlcUeCfg(cellId, ueId, NULL, duRlcUeCfg);
2421 DU_LOG("\nERROR --> DU APP : Failed to fill Rlc Ue Cfg at duBuildAndSendUeCreateReqToRlc()");
2425 FILL_PST_DUAPP_TO_RLC(pst, RLC_UL_INST, EVENT_RLC_UE_CREATE_REQ);
2426 /* Copying ueCfg to a sharable buffer */
2427 DU_ALLOC_SHRABL_BUF(rlcUeCfg, sizeof(RlcUeCfg));
2430 memset(rlcUeCfg, 0, sizeof(RlcUeCfg));
2431 memcpy(rlcUeCfg, duRlcUeCfg, sizeof(RlcUeCfg));
2432 /* Processing one Ue at a time to RLC */
2433 DU_LOG("\nDEBUG --> DU_APP: Sending UE create request to RLC UL");
2434 ret = (*packRlcUeCreateReqOpts[pst.selector])(&pst, rlcUeCfg);
2437 DU_LOG("\nERROR --> DU_APP : Failure in sending Ue Create Req to RLC");
2438 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rlcUeCfg, sizeof(RlcUeCfg));
2444 DU_LOG("\n ERROR --> DU APP : Memory alloc failed at duBuildAndSendUeCreateReqToRlc()");
2450 /*******************************************************************
2452 * @brief Processes UE create Rsp received from RLC UL
2457 * Function : DuProcRlcUeCfgRsp
2460 * Processes UE create Rsp received from RLC UL
2462 * @params[in] Post structure
2463 * Pointer to RlcCfgCfm
2464 * @return ROK - success
2467 *****************************************************************/
2468 uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp)
2474 if(cfgRsp->result == RLC_DU_APP_RSP_OK)
2476 if(pst->event == EVENT_RLC_UE_CREATE_RSP)
2478 DU_LOG("\nINFO --> DU_APP: RLC UE Create Response : SUCCESS [UE IDX:%d]", cfgRsp->ueId);
2479 duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].\
2480 rlcUeCfg.rlcUeCfgState = UE_CREATE_COMPLETE;
2482 else if(pst->event == EVENT_RLC_UE_RECONFIG_RSP)
2484 DU_LOG("\nINFO --> DU_APP: RLC UE Reconfig Response : SUCCESS [UE IDX:%d]", cfgRsp->ueId);
2485 duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].\
2486 rlcUeCfg.rlcUeCfgState = UE_RECFG_COMPLETE;
2487 if((ret = duUpdateDuUeCbCfg(cfgRsp->ueId, cfgRsp->cellId)) == ROK)
2489 BuildAndSendUeCtxtRsp(cfgRsp->cellId, cfgRsp->ueId);
2495 DU_LOG("\nERROR --> DU_APP: RLC UE CFG Response for EVENT[%d] : FAILED [UE IDX : %d, REASON :%d]",\
2496 pst->event, cfgRsp->ueId, cfgRsp->reason);
2497 if((pst->event == EVENT_RLC_UE_RECONFIG_RSP))
2499 //TODO: update failure case in ue Context setup Response
2503 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCfgRsp));
2507 DU_LOG("\nERROR --> DU_APP: Received RLC Ue Config Response is NULL at DuProcRlcUeCfgRsp()");
2513 /*******************************************************************
2515 * @brief Builds and Send Ue Reconfig Req to RLC
2519 * Function : duBuildAndSendUeReCfgReqToRLC
2521 * Functionality: Builds and Send Ue Reconfig Req to RLC
2523 * @params[in] cellId, crnti
2525 * RlcUeCfg *rlcUeCfg
2526 * @return ROK - success
2529 * ****************************************************************/
2531 uint8_t duBuildAndSendUeReCfgReqToRlc(uint8_t cellId, uint8_t crnti, DuUeCfg *ueCfgDb)
2533 uint8_t ret = ROK, ueId = 0;
2534 RlcUeCfg *rlcUeCfg = NULLP;
2536 GET_UE_ID(crnti, ueId);
2537 DU_ALLOC_SHRABL_BUF(rlcUeCfg, sizeof(RlcUeCfg));
2540 memset(rlcUeCfg, 0, sizeof(RlcUeCfg));
2541 ret = fillRlcUeCfg(cellId, ueId, ueCfgDb, rlcUeCfg);
2543 DU_LOG("\nERROR --> DU APP : Failed at duBuildAndSendUeReCfgReqToRlc()");
2545 ret = sendUeReCfgReqToRlc(rlcUeCfg);
2549 DU_LOG("\nERROR --> DU APP : Memory Alloc failed at duBuildAndSendUeReCfgReqToRlc()");
2555 /*******************************************************************
2557 * @brief Builds and Send Ue Reconfig Req to MAC
2561 * Function : duBuildAndSendUeReCfgReqToMac
2563 * Functionality: Builds and Send Ue Reconfig Req to MAC
2565 * @params[in] CellGroupConfigRrc_t *macCellGrpCfg
2567 * MacUeCfg *macUeCfg
2568 * @return ROK - success
2571 * ****************************************************************/
2573 uint8_t duBuildAndSendUeReCfgReqToMac(uint8_t cellId, uint8_t duUeF1apId, uint8_t crnti, DuUeCfg *ueCfgDb)
2576 MacUeCfg *macUeCfg = NULLP;
2578 DU_ALLOC_SHRABL_BUF(macUeCfg, sizeof(MacUeCfg));
2581 memset(macUeCfg, 0, sizeof(MacUeCfg));
2582 ret = fillMacUeCfg(cellId, duUeF1apId, crnti, ueCfgDb, macUeCfg);
2584 DU_LOG("\nERROR --> DU APP : Failed to fill Mac Ue Cfg at duBuildAndSendUeReCfgReqToMac()");
2586 ret = sendUeReCfgReqToMac(macUeCfg);
2590 DU_LOG("\nERROR --> DU APP : Memory alloc failed for macUeCfg at duBuildAndSendUeReCfgReqToMac()");
2596 /*******************************************************************
2598 * @brief Build and Send Ue context setup request
2603 * Function : duBuildAndSendUeContextSetupReq
2606 * Build and Send Ue context setup request
2608 * @params[in] cellId, crnti, DuUeCfg pointer
2609 * @return ROK - success
2612 *****************************************************************/
2614 uint8_t duBuildAndSendUeContextSetupReq(uint16_t cellId, DuUeCb *ueCb)
2618 DuUeCfg *duUeCfg = NULLP;
2620 DU_LOG("\nDEBUG --> DU_APP: Processing Ue Context Setup Request for cellId [%d]", cellId);
2624 DU_LOG("\nERROR --> DU APP : UE Cb is NULL");
2628 crnti = ueCb->crnti;
2629 duUeCfg = &ueCb->f1UeDb->duUeCfg;
2631 /* If UE is being handed-in to this DU, UE context setup request will create
2632 * new UE context at MAC/SCH and RLC.
2633 * If UE is in active state, UE contex setup request will lead to
2634 * reconfiguration of UE at MAC/SCH and RLC
2636 if(ueCb->ueState == UE_HANDIN_IN_PROGRESS)
2638 /* Filling MAC UE Config */
2639 memset(&ueCb->macUeCfg, 0, sizeof(MacUeCfg));
2641 /* Since UE attach has not yet happened, ueId and crnti is unknow. Hence
2643 ret = duBuildAndSendUeCreateReqToMac(cellId, ueCb->gnbDuUeF1apId, 0, duUeCfg, &ueCb->macUeCfg);
2645 DU_LOG("\nERROR --> DU APP : Failed to send UE create request to MAC");
2649 /* Filling RLC UE Reconfig */
2650 ret = duBuildAndSendUeReCfgReqToRlc(cellId, crnti, duUeCfg);
2652 DU_LOG("\nERROR --> DU APP : Failed to build ctxt setup req for RLC at duBuildAndSendUeContextSetupReq()");
2654 /* Filling MAC UE Reconfig */
2655 ret = duBuildAndSendUeReCfgReqToMac(cellId, ueCb->gnbDuUeF1apId, crnti, duUeCfg);
2657 DU_LOG("\nERROR --> DU APP : Failed at build ctxt setup req for MAC at duBuildAndSendUeContextSetupReq()");
2663 /*******************************************************************
2665 * @brief Processes DL Rsp received from RLC DL
2670 * Function : DuProcRlcDlRrcMsgRsp
2673 * Processes UE Rsp received from RLC DL
2675 * @params[in] Post structure
2676 * Pointer to RlcCfgCfm
2677 * @return ROK - success
2680 *****************************************************************/
2681 uint8_t DuProcRlcDlRrcMsgRsp(Pst *pst, RlcDlRrcMsgRsp *dlRrcMsg)
2683 uint8_t ret = ROK, ueId = 0;
2684 uint16_t cellId, crnti;
2685 DuUeCb *ueCb = NULLP;
2688 state = dlRrcMsg->state;
2689 cellId = dlRrcMsg->cellId;
2690 crnti = dlRrcMsg->crnti;
2691 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlRrcMsg, sizeof(RlcDlRrcMsgRsp));
2693 if(state == TRANSMISSION_COMPLETE)
2695 GET_UE_ID(crnti, ueId);
2696 ueCb = &duCb.actvCellLst[cellId -1]->ueCb[ueId -1];
2698 if(ueCb->f1UeDb && ueCb->f1UeDb->dlRrcMsgPres)
2700 if(ueCb->f1UeDb->actionType == UE_CTXT_SETUP)
2702 ret = duBuildAndSendUeContextSetupReq(cellId, ueCb);
2704 DU_LOG("\nERROR --> DU APP : Failed to process UE Context Setup Request in DuProcRlcDlRrcMsgRsp()");
2707 if(ueCb->f1UeDb->actionType == UE_CTXT_MOD)
2709 ret = duBuildAndSendUeContextModReq(cellId, ueCb->gnbDuUeF1apId, crnti, &ueCb->f1UeDb->duUeCfg);
2711 DU_LOG("\nERROR --> DU APP : Failed to process UE Context Mod Request in DuProcRlcDlRrcMsgRsp()");
2714 if(ueCb->f1UeDb->actionType == UE_CTXT_RELEASE && ueCb->ueState == UE_ACTIVE)
2716 ret = duBuildAndSendUeDeleteReq(cellId, crnti);
2719 DU_LOG("\nERROR --> DU APP : Failed to process UE Context Release Request in DuProcRlcDlRrcMsgRsp()");
2725 DU_LOG("\nERROR --> DU APP : Failed to transmit DL RRC Msg");
2729 /*******************************************************************
2731 * @brief Process UE context setup request from CU
2735 * Function : duProcUeContextSetupRequest
2737 * Functionality: Process UE context setup request from CU
2739 * @params[in] F1AP message
2740 * @return ROK - success
2743 * ****************************************************************/
2745 uint8_t duProcUeContextSetupRequest(DuUeCb *ueCb)
2747 uint8_t ret, cellId;
2752 cellId = duCb.actvCellLst[ueCb->f1UeDb->cellIdx]->cellId;
2754 /* Send DL RRC msg for security Mode */
2755 if(ueCb->f1UeDb->dlRrcMsg)
2757 if(ueCb->f1UeDb->dlRrcMsg->rrcMsgPdu)
2759 /* Sending DL RRC Message to RLC */
2760 ret = duBuildAndSendDlRrcMsgToRlc(cellId, ueCb->rlcUeCfg, ueCb->f1UeDb->dlRrcMsg);
2763 DU_LOG("\nERROR --> DU APP : Failed to send DL RRC msg in duProcUeContextSetupRequest()");
2764 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCb->f1UeDb->dlRrcMsg->rrcMsgPdu,\
2765 ueCb->f1UeDb->dlRrcMsg->rrcMsgSize);
2766 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
2770 else if(ueCb->f1UeDb->actionType == UE_CTXT_SETUP)
2772 ret = duBuildAndSendUeContextSetupReq(cellId, ueCb);
2775 DU_LOG("\nERROR --> DU APP : Failed to build ue context setup Req in duProcUeContextSetupRequest()");
2781 //TODO: To send the failure cause in UeContextSetupRsp
2782 DU_LOG("ERROR --> DU APP : Failed to process UE CNTXT SETUP REQ at duProcUeContextSetupRequest()");
2787 /*******************************************************************
2789 * @brief Build and Send Ue context mod request
2794 * Function : duBuildAndSendUeContextModReq
2797 * Build and Send Ue context mod request
2799 * @params[in] cellId, crnti, DuUeCfg pointer
2800 * @return ROK - success
2803 *****************************************************************/
2805 uint8_t duBuildAndSendUeContextModReq(uint16_t cellId, uint8_t gnbDuUeF1apId, uint16_t crnti, DuUeCfg *duUeCfg)
2809 DU_LOG("\nDEBUG --> DU_APP: Processing Ue Context Mod Request for cellId [%d]", cellId);
2810 /* Filling RLC Ue Reconfig */
2811 ret = duBuildAndSendUeReCfgReqToRlc(cellId, crnti, duUeCfg);
2813 DU_LOG("\nERROR --> DU APP : Failed to build ctxt setup req for RLC at duBuildAndSendUeContextModReq()");
2815 /* Filling MAC Ue Reconfig */
2816 ret = duBuildAndSendUeReCfgReqToMac(cellId, gnbDuUeF1apId, crnti, duUeCfg);
2818 DU_LOG("\nERROR --> DU APP : Failed at build ctxt setup req for MAC at duBuildAndSendUeContextModReq()");
2822 /*******************************************************************
2824 * @brief Processing Ue context mod request
2829 * Function : duProcUeContextModReq
2832 * Processing Ue context mod request
2834 * @params[in] DuUeCb *ueCb
2835 * @return ROK - success
2838 *****************************************************************/
2840 uint8_t duProcUeContextModReq(DuUeCb *ueCb)
2842 uint8_t ret, cellId;
2847 cellId = duCb.actvCellLst[ueCb->f1UeDb->cellIdx]->cellId;
2848 /* Send DL RRC msg for security Mode */
2849 if(ueCb->f1UeDb->dlRrcMsg)
2851 if(ueCb->f1UeDb->dlRrcMsg->rrcMsgPdu)
2853 /* Sending DL RRC Message to RLC */
2854 ret = duBuildAndSendDlRrcMsgToRlc(cellId, ueCb->rlcUeCfg, ueCb->f1UeDb->dlRrcMsg);
2857 DU_LOG("\nERROR --> DU APP : Failed to send DL RRC msg in duProcUeContextModReq()");
2858 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCb->f1UeDb->dlRrcMsg->rrcMsgPdu,\
2859 ueCb->f1UeDb->dlRrcMsg->rrcMsgSize);
2860 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
2864 else if(ueCb->f1UeDb->actionType == UE_CTXT_MOD)
2866 ret = duBuildAndSendUeContextModReq(cellId, ueCb->gnbDuUeF1apId, ueCb->crnti, &ueCb->f1UeDb->duUeCfg);
2869 DU_LOG("\nERROR --> DU APP : Failed to build ue context setup Req in duProcUeContextModReq()");
2873 else if((ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY) || (ueCb->f1UeDb->actionType == UE_CTXT_RRC_RECFG_COMPLETE))
2875 if((BuildAndSendUeContextModRsp(ueCb) != ROK))
2877 DU_LOG("\nERROR --> DU APP : Failed to build UE Context modification response");
2884 //TODO: To send the failure cause in UeContextModRsp
2886 DU_LOG("ERROR --> DU APP : Failed to process UE CNTXT MOD REQ at duProcUeContextModReq()");
2892 /*******************************************************************
2894 * @brief Function to delete Pdsch ServCellCfg
2898 * Function : deletePdschServCellCfg
2900 * Functionality: Function to delete Pdsch ServCellCfg
2902 * @params[in] PdschServCellCfg *pdschServCellCfg
2905 * ****************************************************************/
2907 void deletePdschServCellCfg(PdschServCellCfg *pdschServCellCfg)
2909 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,pdschServCellCfg->maxMimoLayers, sizeof(uint8_t));
2910 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,pdschServCellCfg->maxCodeBlkGrpPerTb, sizeof(MaxCodeBlkGrpPerTB));
2911 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,pdschServCellCfg->codeBlkGrpFlushInd, sizeof(bool));
2912 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,pdschServCellCfg->xOverhead, sizeof(PdschXOverhead));
2915 /*******************************************************************
2917 * @brief delete MacUeCfg from duCb
2921 * Function : deleteMacUeCfg
2923 * Functionality: delete MacUeCfg from duCb
2925 * @params[in] Pointer to MacUeCfg
2926 * @return ROK - success
2929 *******************************************************************/
2931 void deleteMacUeCfg(MacUeCfg *ueCfg)
2935 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,ueCfg->ambrCfg, sizeof(AmbrCfg));
2936 if(ueCfg->spCellCfgPres)
2938 freeUeReCfgCellGrpInfo(ueCfg);
2940 for(lcCfgIdx=0; lcCfgIdx< ueCfg->numLcs; lcCfgIdx++)
2942 freeMacLcCfg(&ueCfg->lcCfgList[lcCfgIdx]);
2944 memset(ueCfg, 0, sizeof(MacUeCfg));
2947 /*******************************************************************
2949 * @brief delete UE Configuration of a particular UE
2953 * Function : deleteUeCfg
2955 * Functionality: delete UE Configuration of a particular UE
2957 * @params[in] uint16_t cellIdx, uint8_t ueId
2958 * @return ROK - success
2961 * ****************************************************************/
2962 uint8_t deleteUeCfg(uint16_t cellId, uint8_t ueId)
2965 uint16_t cellIdx = 0;
2966 DuUeCb *ueCb = NULLP;
2968 GET_CELL_IDX(cellId, cellIdx);
2969 if(duCb.actvCellLst[cellIdx] != NULLP)
2971 if((duCb.actvCellLst[cellIdx]->ueCb[ueId-1].macUeCfg.macUeCfgState == UE_DELETE_COMPLETE)\
2972 &&(duCb.actvCellLst[cellIdx]->ueCb[ueId-1].rlcUeCfg.rlcUeCfgState == UE_DELETE_COMPLETE))
2974 ueCb = &duCb.actvCellLst[cellIdx]->ueCb[ueId-1];
2975 deleteMacUeCfg(&ueCb->macUeCfg);
2976 deleteRlcUeCfg(&ueCb->rlcUeCfg);
2977 if(ueCb->f1UeDb !=NULLP)
2979 freeF1UeDb(ueCb->f1UeDb);
2981 for(tnlIdx = 0; tnlIdx < duCb.numTeId; )
2983 if(duCb.upTnlCfg[tnlIdx]->ueId == ueId)
2985 duCb.upTnlCfg[tnlIdx]->configType = CONFIG_DEL;
2986 duProcEgtpTunnelCfg(tnlIdx, duCb.upTnlCfg[tnlIdx], duCb.upTnlCfg[tnlIdx]);
2991 unsetBitInUeBitMap(cellId, ueId-1);
2992 duCb.actvCellLst[cellIdx]->numActvUes--;
2993 memset(ueCb, 0, sizeof(DuUeCb));
3002 DU_LOG("\nERROR --> DU APP : deleteUeCfg(): CellIdx[%d] is not found", cellIdx);
3009 /*******************************************************************
3011 * @brief Handle UE delete response from MAC
3015 * Function : DuProcMacUeDeleteRsp
3017 * Functionality: Handle UE delete response from MAC
3019 * @params[in] Pointer to MacUeDeleteRsp and Pst
3020 * @return ROK - success
3023 * ****************************************************************/
3025 uint8_t DuProcMacUeDeleteRsp(Pst *pst, MacUeDeleteRsp *deleteRsp)
3027 uint8_t ret =ROK,ueId=0;
3029 uint32_t gnbCuUeF1apId =0 , gnbDuUeF1apId =0;
3033 if(deleteRsp->result == SUCCESS)
3035 DU_LOG("\nINFO --> DU APP : MAC UE Delete Response : SUCCESS [UE IDX : %d]", deleteRsp->ueId);
3036 GET_CELL_IDX(deleteRsp->cellId, cellIdx);
3037 if(duCb.actvCellLst[cellIdx])
3039 duCb.actvCellLst[cellIdx]->ueCb[deleteRsp->ueId -1].macUeCfg.macUeCfgState = UE_DELETE_COMPLETE;
3040 ueId = deleteRsp->ueId;
3041 gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbCuUeF1apId;
3042 gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbDuUeF1apId;
3043 if(deleteUeCfg(deleteRsp->cellId, ueId) == ROK)
3045 ret = BuildAndSendUeContextReleaseComplete(deleteRsp->cellId, gnbCuUeF1apId, gnbDuUeF1apId);
3048 DU_LOG("\nERROR --> DU APP : DuProcMacUeDeleteRsp(): failed to send UE context release complete");
3056 DU_LOG("\nERROR --> DU APP : DuProcMacUeDeleteRsp(): MAC UE Delete Response : FAILURE [UE IDX : %d]",\
3060 DU_FREE_SHRABL_BUF(pst->region, pst->pool, deleteRsp, sizeof(MacUeDeleteRsp));
3064 DU_LOG("\nERROR --> DU APP : DuProcMacUeDeleteRsp(): MAC UE Delete Response is null");
3070 /*******************************************************************
3072 * @brief Processes UE Delete Rsp received from RLC
3076 * Function : DuProcRlcUeDeleteRsp
3079 * Processes UE Delete Rsp received from RLC
3081 * @params[in] Post structure
3082 * Pointer to RlcUeDeleteRsp
3083 * @return ROK - success
3086 * *****************************************************************/
3088 uint8_t DuProcRlcUeDeleteRsp(Pst *pst, RlcUeDeleteRsp *delRsp)
3090 uint8_t ueId = 0, ret = ROK;
3091 uint16_t cellIdx = 0,crnti=0;
3095 ueId = delRsp->ueId;
3096 GET_CELL_IDX(delRsp->cellId, cellIdx);
3098 if(delRsp->result == SUCCESSFUL)
3100 DU_LOG("\nINFO --> DU_APP: RLC UE Delete Response : SUCCESS [UE IDX:%d]", ueId);
3101 if(duCb.actvCellLst[cellIdx]!=NULLP)
3103 duCb.actvCellLst[cellIdx]->ueCb[ueId-1].rlcUeCfg.rlcUeCfgState = UE_DELETE_COMPLETE;
3104 GET_CRNTI(crnti, ueId);
3105 if(sendUeDeleteReqToMac(delRsp->cellId, ueId, crnti) == RFAILED)
3107 DU_LOG("\nERROR --> DU APP : duBuildAndSendUeDeleteReq(): Failed to build UE delete req for MAC ");
3115 DU_LOG("\nERROR --> DU_APP: RLC UE Delete Response : FAILED [UE IDX:%d]", ueId);
3118 DU_FREE_SHRABL_BUF(pst->region, pst->pool, delRsp, sizeof(RlcUeDeleteRsp));
3124 /*******************************************************************
3126 * @brief Sending UE Delete Req To Mac
3130 * Function : sendUeDeleteReqToMac
3133 * sending UE Delete Req To Mac
3135 * @params[in] cellId, ueId, crnti
3136 * @return ROK - success
3139 *****************************************************************/
3141 uint8_t sendUeDeleteReqToMac(uint16_t cellId, uint8_t ueId, uint16_t crnti)
3145 MacUeDelete *ueDelete = NULLP;
3147 DU_ALLOC_SHRABL_BUF(ueDelete, sizeof(MacUeDelete));
3150 ueDelete->cellId = cellId;
3151 ueDelete->ueId = ueId;
3152 ueDelete->crnti = crnti;
3153 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_DELETE_REQ);
3155 DU_LOG("\nDEBUG --> DU_APP: Sending UE delete Request to MAC ");
3156 ret = (*packMacUeDeleteReqOpts[pst.selector])(&pst, ueDelete);
3159 DU_LOG("\nERROR --> DU_APP: sendUeDeleteReqToMac(): Failed to send UE delete Req to MAC");
3160 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueDelete, sizeof(MacUeDelete));
3165 DU_LOG("\nERROR --> DU_APP: sendUeDeleteReqToMac(): Failed to allocate memory");
3171 /*******************************************************************
3173 * @brief Sending UE Delete Req To Rlc
3177 * Function : sendUeDeleteReqToRlc
3180 * Sending UE Delete Req To Rlc
3182 * @params[in] cellId, ueId
3183 * @return ROK - success
3186 *****************************************************************/
3188 uint8_t sendUeDeleteReqToRlc(uint16_t cellId, uint8_t ueId)
3192 RlcUeDelete *ueDelete;
3194 DU_ALLOC_SHRABL_BUF(ueDelete, sizeof(RlcUeDelete));
3195 if(ueDelete !=NULLP)
3197 ueDelete->cellId = cellId;
3198 ueDelete->ueId = ueId;
3199 FILL_PST_DUAPP_TO_RLC(pst, RLC_UL_INST, EVENT_RLC_UE_DELETE_REQ);
3201 ret = (*packRlcUeDeleteReqOpts[pst.selector])(&pst, ueDelete);
3204 DU_LOG("\nERROR --> DU_APP : sendUeDeleteReqToRlc():Failed to send UE Delete Req to RLC");
3205 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueDelete, sizeof(RlcUeDelete));
3210 DU_LOG("\nERROR --> DU_APP: sendUeDeleteReqToRlc():Memory allocation failed");
3216 /*******************************************************************
3218 * @brief DU processes UE delete req from CU and sends to MAC and RLC
3222 * Function : duBuildAndSendUeDeleteReq
3224 * Functionality: DU processes UE delete req from CU and sends to MAC
3227 * @params[in] cellId, crnti
3228 * @return ROK - success
3231 * ****************************************************************/
3233 uint8_t duBuildAndSendUeDeleteReq(uint16_t cellId, uint16_t crnti)
3236 uint16_t cellIdx = 0;
3238 DU_LOG("\nDEBUG --> DU_APP: Processing UE Delete Request ");
3239 GET_CELL_IDX(cellId, cellIdx);
3240 GET_UE_ID(crnti, ueId);
3242 if(duCb.actvCellLst[cellIdx] != NULLP)
3244 if(crnti != duCb.actvCellLst[cellIdx]->ueCb[ueId - 1].crnti)
3246 DU_LOG("\nERROR --> DU APP : duBuildAndSendUeDeleteReq(): CRNTI [%d] not found", crnti);
3250 duCb.actvCellLst[cellIdx]->ueCb[ueId - 1].ueState = UE_DELETION_IN_PROGRESS;
3251 if(sendUeDeleteReqToRlc(cellId, ueId) == RFAILED)
3253 DU_LOG("\nERROR --> DU APP : DuProcMacUeDeleteRsp():Failed to build UE delete req for RLC ");
3259 DU_LOG("\nERROR --> DU APP : duBuildAndSendUeDeleteReq(): Cell Id is not found");
3266 /*******************************************************************
3268 * @brief delete RlcUeCfg from duCb
3272 * Function : deleteRlcUeCfg
3275 * delete RlcUeCfg from duCb
3277 * @params[in] RlcUeCfg *ueCfg
3279 * @return ROK - success
3282 *****************************************************************/
3284 void deleteRlcUeCfg(RlcUeCfg *ueCfg)
3287 RlcBearerCfg *lcCfg= NULLP;
3290 for(lcIdx =0 ; lcIdx < ueCfg->numLcs ; lcIdx++)
3292 lcCfg = &ueCfg->rlcLcCfg[lcIdx];
3293 switch(lcCfg->rlcMode)
3297 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.amCfg, sizeof(AmBearerCfg));
3300 case RLC_UM_BI_DIRECTIONAL :
3302 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
3305 case RLC_UM_UNI_DIRECTIONAL_UL :
3307 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
3310 case RLC_UM_UNI_DIRECTIONAL_DL :
3312 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
3316 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->snssai, sizeof(Snssai));
3318 memset(ueCfg, 0, sizeof(RlcUeCfg));
3322 /*******************************************************************
3324 * @brief Du process Ue Context Release Command
3328 * Function : duProcUeContextReleaseCommand
3330 * Functionality: Du process Ue Context Release Command
3332 * @params[in] DuUeCb *duUeCb
3333 * @return ROK - success
3336 * ****************************************************************/
3337 uint8_t duProcUeContextReleaseCommand(uint16_t cellId, DuUeCb *duUeCb)
3339 uint8_t ret =ROK, ueId=0;
3344 crnti = duUeCb->crnti;
3345 GET_UE_ID(crnti, ueId);
3349 /* Send DL RRC msg for RRC release */
3350 if(duUeCb->f1UeDb->dlRrcMsg)
3352 if(duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu != NULLP)
3354 ret = duBuildAndSendDlRrcMsgToRlc(cellId, duCb.actvCellLst[duUeCb->f1UeDb->cellIdx]->ueCb[ueId-1].rlcUeCfg,\
3355 duUeCb->f1UeDb->dlRrcMsg);
3358 DU_LOG("\nERROR --> DU APP : duProcUeContextReleaseCommand() : Failed to send DL RRC msg");
3359 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu,\
3360 duUeCb->f1UeDb->dlRrcMsg->rrcMsgSize);
3361 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
3368 ret = duBuildAndSendUeDeleteReq(cellId,crnti);
3371 DU_LOG("\nERROR --> DU APP : duProcUeContextReleaseCommand(): Failed to build and send Ue Delete request");
3378 /**********************************************************************
3380 ***********************************************************************/