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"
37 DuMacDlCcchInd packMacDlCcchIndOpts[] =
39 packMacDlCcchInd, /* Loose coupling */
40 MacProcDlCcchInd, /* TIght coupling */
41 packMacDlCcchInd /* Light weight-loose coupling */
44 DuMacUeCreateReq packMacUeCreateReqOpts[] =
46 packDuMacUeCreateReq, /* Loose coupling */
47 MacProcUeCreateReq, /* TIght coupling */
48 packDuMacUeCreateReq /* Light weight-loose coupling */
51 DuRlcUeCreateReq packRlcUeCreateReqOpts[] =
53 packDuRlcUeCreateReq, /* Loose coupling */
54 RlcProcUeCreateReq, /* TIght coupling */
55 packDuRlcUeCreateReq /* Light weight-loose coupling */
58 DuDlRrcMsgToRlcFunc duSendDlRrcMsgToRlcOpts[] =
60 packDlRrcMsgToRlc, /* Loose coupling */
61 RlcProcDlRrcMsgTransfer, /* Tight coupling */
62 packDlRrcMsgToRlc /* Light weight-loose coupling */
65 DuRlcUeReconfigReq packRlcUeReconfigReqOpts[] =
67 packDuRlcUeReconfigReq, /* Loose coupling */
68 RlcProcUeReconfigReq, /* TIght coupling */
69 packDuRlcUeReconfigReq /* Light weight-loose coupling */
72 DuMacUeReconfigReq packMacUeReconfigReqOpts[] =
74 packDuMacUeReconfigReq, /* Loose coupling */
75 MacProcUeReconfigReq, /* TIght coupling */
76 packDuMacUeReconfigReq /* Light weight-loose coupling */
79 DuRlcDlUserDataToRlcFunc duSendRlcDlUserDataToRlcOpts[] =
81 packRlcDlUserDataToRlc, /* Loose coupling */
82 RlcProcDlUserDataTransfer, /* Tight coupling */
83 packRlcDlUserDataToRlc /* Light weight-loose coupling */
86 DuMacUeDeleteReq packMacUeDeleteReqOpts[] =
88 packDuMacUeDeleteReq, /* Loose coupling */
89 MacProcUeDeleteReq, /* TIght coupling */
90 packDuMacUeDeleteReq /* Light weight-loose coupling */
93 DuRlcUeDeleteReq packRlcUeDeleteReqOpts[] =
95 packDuRlcUeDeleteReq, /* Loose coupling */
96 RlcProcUeDeleteReq, /* TIght coupling */
97 packDuRlcUeDeleteReq /* Light weight-loose coupling */
100 DuMacCellDeleteReq packMacCellDeleteReqOpts[] =
102 packDuMacCellDeleteReq, /* Loose coupling */
103 MacProcCellDeleteReq, /* TIght coupling */
104 packDuMacCellDeleteReq /* Light weight-loose coupling */
107 /*******************************************************************
109 * @brief Function to fillDlUserDataInfo
113 * Function : fillDlUserDataInfo
116 * Function to fillDlUserDataInfo
121 * @return ROK - success
124 * ****************************************************************/
126 uint8_t fillDlUserDataInfo(uint32_t teId, RlcDlUserDataInfo *dlDataMsgInfo)
130 for(drbIdx = 0; drbIdx < duCb.numDrb; drbIdx++)
132 if(duCb.upTnlCfg[drbIdx] && (duCb.upTnlCfg[drbIdx]->tnlCfg1 != NULLP))
134 if(duCb.upTnlCfg[drbIdx]->tnlCfg1->teId == teId)
136 dlDataMsgInfo->cellId = duCb.upTnlCfg[drbIdx]->cellId;
137 dlDataMsgInfo->ueIdx = duCb.upTnlCfg[drbIdx]->ueIdx;
138 dlDataMsgInfo->rbId = duCb.upTnlCfg[drbIdx]->drbId;
146 /*******************************************************************
148 * @brief Build and Send DL Data Message transfer to RLC
152 * Function : duBuildAndSendDlUserDataToRlc
155 * Build and Send DL Data Message transfer to RLC
157 * @params[in] Cell ID
159 * Logical Channgel ID
162 * @return ROK - success
165 * ****************************************************************/
167 uint8_t duBuildAndSendDlUserDataToRlc(uint16_t msgLen, EgtpMsg *egtpMsg)
169 uint8_t ret = RFAILED;
171 RlcDlUserDataInfo *dlDataMsgInfo = NULLP;
173 DU_ALLOC_SHRABL_BUF(dlDataMsgInfo, sizeof(RlcDlUserDataInfo));
176 DU_LOG("\nERROR --> DU_APP : Memory allocation failed for dlDataMsgInfo in duHdlEgtpDlData()");
179 memset(dlDataMsgInfo, 0, sizeof(RlcDlUserDataInfo));
180 dlDataMsgInfo->dlMsg = egtpMsg->msg;
181 dlDataMsgInfo->msgLen = msgLen;
183 /* Filling DL DATA Msg Info */
184 if(fillDlUserDataInfo(egtpMsg->msgHdr.teId, dlDataMsgInfo) == ROK)
186 /* Filling post structure and sending msg */
187 FILL_PST_DUAPP_TO_RLC(pst, RLC_DL_INST, EVENT_DL_USER_DATA_TRANS_TO_RLC);
188 DU_LOG("\nDEBUG --> DU_APP : Sending User Data Msg to RLC \n");
189 ret = (*duSendRlcDlUserDataToRlcOpts[pst.selector])(&pst, dlDataMsgInfo);
193 DU_LOG("\nERROR --> DU_APP : Failed to send User Data to RLC in duHdlEgtpDlData()");
194 ODU_PUT_MSG_BUF(dlDataMsgInfo->dlMsg);
195 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlDataMsgInfo, sizeof(RlcDlUserDataInfo));
200 /*******************************************************************
202 * @brief Handles EGTP data from CU
206 * Function : duHdlEgtpData
209 * Processes EGTP header and sends data to RLC
211 * @params[in] Pointer to EGTP Message
212 * @return ROK - success
215 * ****************************************************************/
216 uint8_t duHdlEgtpDlData(EgtpMsg *egtpMsg)
219 DU_LOG("\nDEBUG --> DU_APP : Processing DL data in duHdlEgtpDlData()");
223 DU_LOG("\nERROR --> DU_APP : Recevied Dl Data is NULLP in duHdlEgtpDlData()");
226 ODU_GET_MSG_LEN(egtpMsg->msg, (MsgLen *)&msgLen);
227 if(duBuildAndSendDlUserDataToRlc(msgLen, egtpMsg) != ROK)
229 DU_LOG("\nERROR --> DU_APP : Failed to build DL USer Data in duHdlEgtpDlData()");
230 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, egtpMsg->msg, msgLen);
236 /******************************************************************
238 * @brief Builds and Sends DL CCCH Ind to MAC
242 * Function : duBuildAndSendDlCcchInd
244 * Functionality: Builds and sends DL CCCH Ind Msg to MAC
246 * @params[in] dlCcchMsg - uint8_t*
247 * @return ROK - success
250 * ****************************************************************/
251 uint8_t duBuildAndSendDlCcchInd(uint16_t *cellId, uint16_t *crnti, \
252 DlCcchMsgType msgType, uint16_t dlCcchMsgSize, uint8_t *dlCcchMsg)
256 DlCcchIndInfo *dlCcchIndInfo = NULLP;
259 DU_LOG("\nDEBUG --> DU APP : Building and Sending DL CCCH Ind to MAC");
261 DU_ALLOC_SHRABL_BUF(dlCcchIndInfo, sizeof(DlCcchIndInfo));
265 DU_LOG("\nERROR --> DU APP : Memory alloc failed while building DL CCCH Ind");
269 dlCcchIndInfo->cellId = *cellId;
270 dlCcchIndInfo->crnti = *crnti;
271 dlCcchIndInfo->msgType = msgType;
272 dlCcchIndInfo->dlCcchMsgLen = dlCcchMsgSize;
274 DU_ALLOC_SHRABL_BUF(dlCcchIndInfo->dlCcchMsg, dlCcchIndInfo->dlCcchMsgLen);
275 if(!dlCcchIndInfo->dlCcchMsg)
277 DU_LOG("\nERROR --> DU APP : Memory alloc failed while building DL CCCH Ind");
278 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo, sizeof(DlCcchIndInfo));
281 for(idx2 = 0; idx2 < dlCcchIndInfo->dlCcchMsgLen; idx2++)
283 dlCcchIndInfo->dlCcchMsg[idx2] = dlCcchMsg[idx2];
285 DU_FREE(dlCcchMsg, dlCcchMsgSize);
288 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_DL_CCCH_IND);
289 ret = (*packMacDlCcchIndOpts[pst.selector])(&pst, dlCcchIndInfo);
292 DU_LOG("\nERROR --> DU_APP : Failure in sending DL CCCH to MAC");
293 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo->dlCcchMsg,\
294 dlCcchIndInfo->dlCcchMsgLen);
295 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo, \
296 sizeof(DlCcchIndInfo));
304 /*******************************************************************
306 * @brief Build and Send DL RRC Message transfer to RLC
310 * Function : duBuildAndSendDlRrcMsgToRlc
313 * Build and Send DL RRC Message transfer to RLC
315 * @params[in] Cell ID
317 * Logical Channgel ID
320 * @return ROK - success
323 * ****************************************************************/
324 uint8_t duBuildAndSendDlRrcMsgToRlc(uint16_t cellId, RlcUeCfg ueCfg, F1DlRrcMsg *f1DlRrcMsg)
329 RlcDlRrcMsgInfo *dlRrcMsgInfo = NULLP;
333 DU_LOG("\nERROR --> DU APP : Received Dl RRC Msg is NULL at duBuildAndSendDlRrcMsgToRlc()");
337 DU_ALLOC_SHRABL_BUF(dlRrcMsgInfo, sizeof(RlcDlRrcMsgInfo));
340 DU_LOG("\nERROR --> DU APP : Memory allocation failed for dlRrcMsgInfo in \
341 duBuildAndSendDlRrcMsgToRlc");
342 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, f1DlRrcMsg->rrcMsgPdu, f1DlRrcMsg->rrcMsgSize);
346 /* Filling up the RRC msg info */
347 dlRrcMsgInfo->cellId = cellId;
348 dlRrcMsgInfo->ueIdx = ueCfg.ueIdx;
349 for(lcIdx = 0; lcIdx <= MAX_NUM_LC; lcIdx++)
351 if(ueCfg.rlcLcCfg[lcIdx].lcId == f1DlRrcMsg->srbId)
353 dlRrcMsgInfo->rbType = ueCfg.rlcLcCfg[lcIdx].rbType;
354 dlRrcMsgInfo->rbId = ueCfg.rlcLcCfg[lcIdx].rbId;
355 dlRrcMsgInfo->lcType = ueCfg.rlcLcCfg[lcIdx].lcType;
356 dlRrcMsgInfo->lcId = ueCfg.rlcLcCfg[lcIdx].lcId;
360 dlRrcMsgInfo->execDup = f1DlRrcMsg->execDup;
361 dlRrcMsgInfo->deliveryStaRpt = f1DlRrcMsg->deliveryStatRpt;
362 dlRrcMsgInfo->msgLen = f1DlRrcMsg->rrcMsgSize;
363 dlRrcMsgInfo->rrcMsg = f1DlRrcMsg->rrcMsgPdu;
365 /* Filling post structure and sending msg */
366 FILL_PST_DUAPP_TO_RLC(pst, RLC_DL_INST, EVENT_DL_RRC_MSG_TRANS_TO_RLC);
367 DU_LOG("\nDEBUG --> DU_APP: Sending Dl RRC Msg to RLC \n");
368 ret = (*duSendDlRrcMsgToRlcOpts[pst.selector])(&pst, dlRrcMsgInfo);
371 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, f1DlRrcMsg->rrcMsgPdu, f1DlRrcMsg->rrcMsgSize);
372 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlRrcMsgInfo, sizeof(RlcDlRrcMsgInfo));
381 /******************************************************************
383 * @brief Process DL RRC Msg recevied from F1AP
387 * Function : duProcDlRrcMsg
389 * Functionality: Process DL RRC Msg recevied from F1AP
391 * @params[in] dlCcchMsg - uint8_t*
392 * @return ROK - success
395 * ****************************************************************/
397 uint8_t duProcDlRrcMsg(F1DlRrcMsg *dlRrcMsg)
400 uint16_t crnti, cellId, cellIdx;
401 bool ueCcchCtxtFound = false;
402 bool ueFound = false;
406 if(dlRrcMsg->srbId == SRB0_LCID) //RRC connection setup
408 for(ueIdx=0; ueIdx<duCb.numUe; ueIdx++)
410 if(dlRrcMsg->gnbDuUeF1apId == duCb.ueCcchCtxt[ueIdx].gnbDuUeF1apId)
412 ueCcchCtxtFound = true;
413 crnti = duCb.ueCcchCtxt[ueIdx].crnti;
414 cellId = duCb.ueCcchCtxt[ueIdx].cellId;
421 ret = duBuildAndSendDlCcchInd(&cellId, &crnti, RRC_SETUP, dlRrcMsg->rrcMsgSize, dlRrcMsg->rrcMsgPdu);
424 DU_LOG("\nERROR --> DU APP : Failed to build DlCcch Ind at procDlRrcMsgTrans()");
428 if(duCb.actvCellLst[cellId-1]->numActvUes < MAX_NUM_UE)
430 ret = duCreateUeCb(&duCb.ueCcchCtxt[ueIdx], dlRrcMsg->gnbCuUeF1apId);
433 DU_LOG("\nERROR --> DU APP : Failed to createUeCb for cellId [%d] at procDlRrcMsgTrans()", \
434 duCb.ueCcchCtxt[ueIdx].cellId);
439 DU_LOG("\nERROR --> DU_APP: Max Active UEs has reached at procDlRrcMsgTrans()");
446 for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
448 for(ueIdx = 0 ; ueIdx < MAX_NUM_UE; ueIdx++)
450 if((dlRrcMsg->gnbCuUeF1apId == duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId)
451 && (dlRrcMsg->gnbDuUeF1apId == duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId))
454 ret = duBuildAndSendDlRrcMsgToRlc(duCb.actvCellLst[cellIdx]->cellId, \
455 duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg, dlRrcMsg);
468 /******************************************************************
470 * @brief Generates GNB DU Ue F1AP ID
474 * Function : genGnbDuUeF1apId
476 * Functionality: Generates GNB DU Ue F1AP ID
479 * @return gnbDuF1apId
481 * ****************************************************************/
482 uint32_t genGnbDuUeF1apId()
484 static uint32_t gnbDuUeF1apId = 0;
486 return ++gnbDuUeF1apId;
489 /******************************************************************
491 * @brief Processes UL CCCH Ind recvd from MAC
495 * Function : duProcUlCcchInd
497 * Functionality: Processes UL CCCH Ind recvd from MAC
499 * @params[in] UlCcchIndInfo *ulCcchIndInfo
500 * @return ROK - success
503 * ****************************************************************/
504 uint8_t duProcUlCcchInd(UlCcchIndInfo *ulCcchIndInfo)
508 uint32_t gnbDuUeF1apId = 0;
510 gnbDuUeF1apId = genGnbDuUeF1apId();
512 /* Store Ue mapping */
513 duCb.ueCcchCtxt[duCb.numUe].gnbDuUeF1apId = gnbDuUeF1apId;
514 duCb.ueCcchCtxt[duCb.numUe].crnti = ulCcchIndInfo->crnti;
515 duCb.ueCcchCtxt[duCb.numUe].cellId = ulCcchIndInfo->cellId;
519 ret = (BuildAndSendInitialRrcMsgTransfer(gnbDuUeF1apId, ulCcchIndInfo->crnti, ulCcchIndInfo->ulCcchMsgLen,
520 ulCcchIndInfo->ulCcchMsg));
523 DU_LOG("\nERROR --> DU_APP : BuildAndSendInitialRrcMsgTransfer failed");
526 DU_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, ulCcchIndInfo->ulCcchMsg, ulCcchIndInfo->ulCcchMsgLen);
527 DU_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, ulCcchIndInfo, sizeof(UlCcchIndInfo));
533 /******************************************************************
535 * @brief Fills Default UL LC Cfg
539 * Function : fillDefaultUlLcCfg
541 * Functionality: Fills Default UL LC Cfg
543 * @params[in] UlLcCfg *ulLcCfg
545 *****************************************************************/
546 void fillDefaultUlLcCfg(UlLcCfg *ulLcCfg)
548 ulLcCfg->priority = LC_PRIORITY_1;
549 ulLcCfg->lcGroup = 0;
550 ulLcCfg->schReqId = 0;
551 ulLcCfg->pbr = PBR_KBPS_INFINITY;
552 ulLcCfg->bsd = BSD_MS_1000;
555 /******************************************************************
557 * @brief Fills Initial DL Bandwidth Part
561 * Function : fillDefaultInitDlBwp
563 * Functionality: Fills Initial DL Bandwidth Part
565 * @params[in] InitialDlBwp *initDlBwp
568 *****************************************************************/
569 void fillDefaultInitDlBwp(InitialDlBwp *initDlBwp)
572 uint8_t freqDomainResource[FREQ_DOM_RSRC_SIZE] = {0};
573 uint8_t coreset0EndPrb, coreset1StartPrb, coreset1NumPrb;
578 /* Filling PDCCH Config */
579 initDlBwp->pdcchPresent = TRUE;
580 if(initDlBwp->pdcchPresent)
582 initDlBwp->pdcchCfg.numCRsetToAddMod = PDCCH_CTRL_RSRC_SET_ONE_ID;
583 memset(initDlBwp->pdcchCfg.cRSetToAddModList, 0, MAX_NUM_CRSET);
584 if(initDlBwp->pdcchCfg.numCRsetToAddMod <= MAX_NUM_CRSET)
586 initDlBwp->pdcchCfg.cRSetToAddModList[idx].cRSetId = \
587 PDCCH_CTRL_RSRC_SET_ONE_ID;
588 memset(initDlBwp->pdcchCfg.cRSetToAddModList[idx].freqDomainRsrc, 0,\
590 coreset0EndPrb = CORESET0_END_PRB;
591 coreset1StartPrb = coreset0EndPrb +6;
592 coreset1NumPrb = CORESET1_NUM_PRB;
593 /* calculate the PRBs */
594 freqDomRscAllocType0(((coreset1StartPrb)/6), (coreset1NumPrb/6), freqDomainResource);
595 memcpy(initDlBwp->pdcchCfg.cRSetToAddModList[idx].freqDomainRsrc, freqDomainResource,
598 initDlBwp->pdcchCfg.cRSetToAddModList[idx].duration = \
599 PDCCH_CTRL_RSRC_SET_ONE_DURATION;
600 initDlBwp->pdcchCfg.cRSetToAddModList[idx].cceRegMappingType = \
601 CCE_REG_MAPPINGTYPE_PR_NONINTERLEAVED;
602 initDlBwp->pdcchCfg.cRSetToAddModList[idx].precoderGranularity = \
604 initDlBwp->pdcchCfg.cRSetToAddModList[idx].dmrsScramblingId = \
607 initDlBwp->pdcchCfg.numCRsetToRel = 0;
608 /* Filling Serach Space */
609 initDlBwp->pdcchCfg.numSearchSpcToAddMod = PDCCH_CTRL_RSRC_SET_ONE_ID;
610 memset(initDlBwp->pdcchCfg.searchSpcToAddModList, 0, MAX_NUM_CRSET);
611 if(initDlBwp->pdcchCfg.numSearchSpcToAddMod <= MAX_NUM_CRSET)
613 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].searchSpaceId =\
614 PDCCH_SRCH_SPC_TWO_ID;
615 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].cRSetId = \
616 PDCCH_CTRL_RSRC_SET_ONE_ID;
617 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].\
618 mSlotPeriodicityAndOffset = SLOTPERIODICITYANDOFFSET_PR_SL1;
619 memset(initDlBwp->pdcchCfg.searchSpcToAddModList[idx].mSymbolsWithinSlot, 0,\
620 MONITORING_SYMB_WITHIN_SLOT_SIZE);
621 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].mSymbolsWithinSlot[idx] =\
622 PDCCH_SYMBOL_WITHIN_SLOT;
623 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel1 =\
625 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel2 =\
627 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel4 =\
629 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel8 =\
631 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel16 =\
633 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].searchSpaceType = \
634 SEARCHSPACETYPE_PR_UE_SPECIFIC;
635 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].ueSpecificDciFormat =\
636 PDCCH_SRCH_SPC_TWO_UE_SPEC_DCI_FORMAT;
638 initDlBwp->pdcchCfg.numSearchSpcToRel = 0;
642 /* Filling PDSCH Config */
643 initDlBwp->pdschPresent = TRUE;
644 if(initDlBwp->pdschPresent)
646 initDlBwp->pdschCfg.dmrsDlCfgForPdschMapTypeA.addPos = ADDITIONALPOSITION_POS0;
647 initDlBwp->pdschCfg.resourceAllocType = RESOURCEALLOCATION_TYPE1;
648 initDlBwp->pdschCfg.numTimeDomRsrcAlloc = 1;
649 initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].mappingType = \
651 initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].startSymbol = PDSCH_START_SYMBOL;
652 initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].symbolLength = PDSCH_LENGTH_SYMBOL;
653 initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].startSymbolAndLength = \
654 calcSliv(PDSCH_START_SYMBOL, PDSCH_LENGTH_SYMBOL);
655 initDlBwp->pdschCfg.rbgSize = RBG_SIZE_CONFIG1;
656 initDlBwp->pdschCfg.numCodeWordsSchByDci = CODEWORDS_SCHED_BY_DCI_N1;
657 initDlBwp->pdschCfg.bundlingType = TYPE_STATIC_BUNDLING;
658 initDlBwp->pdschCfg.bundlingInfo.StaticBundling.size = 0;
664 /******************************************************************
666 * @brief Fills Initial UL Bandwidth Part
670 * Function : fillDefaultInitUlBwp
672 * Functionality: Fills Initial UL Bandwidth Part
674 * @params[in] InitialUlBwp *initUlBwp
677 *****************************************************************/
678 void fillDefaultInitUlBwp(InitialUlBwp *initUlBwp)
683 initUlBwp->pucchPresent = FALSE;
685 /*Filling PUSCH Config */
686 initUlBwp->puschPresent = TRUE;
687 if(initUlBwp->puschPresent)
689 initUlBwp->puschCfg.dataScramblingId = SCRAMBLING_ID;
690 initUlBwp->puschCfg.dmrsUlCfgForPuschMapTypeA.addPos = ADDITIONALPOSITION_POS0;
691 initUlBwp->puschCfg.dmrsUlCfgForPuschMapTypeA.transPrecodDisabled. \
692 scramblingId0 = SCRAMBLING_ID;
693 initUlBwp->puschCfg.resourceAllocType = RESOURCEALLOCATION_TYPE1;
694 initUlBwp->puschCfg.numTimeDomRsrcAlloc = 1;
696 if(initUlBwp->puschCfg.numTimeDomRsrcAlloc <= MAX_NUM_UL_ALLOC)
698 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].k2 = PUSCH_K2;
699 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].mappingType =\
701 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].startSymbol = PUSCH_START_SYMBOL;
702 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].symbolLength = PUSCH_LENGTH_SYMBOL;
703 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].startSymbolAndLength =\
704 calcSliv(PUSCH_START_SYMBOL, PUSCH_LENGTH_SYMBOL);
706 initUlBwp->puschCfg.transformPrecoder = TRANSFORM_PRECODER_DISABLED;
711 DU_LOG("\nERROR --> DU APP : Memory is NULL of InitalUlBwp");
715 /******************************************************************
717 * @brief Fills SpCell Group Info
721 * Function : fillDefaultSpCellGrpInfo
723 * Functionality: Fills Sp Cell Group Info
725 * @params[in] MacUeCfg *macUeCfg
728 *****************************************************************/
729 void fillDefaultSpCellGrpInfo(MacUeCfg *macUeCfg)
731 SpCellCfg *spCell = NULL;
734 spCell = &macUeCfg->spCellCfg;
738 macUeCfg->spCellCfgPres = true;
740 spCell->servCellIdx = SERV_CELL_IDX;
741 /* Filling Initial Dl Bwp */
742 fillDefaultInitDlBwp(&spCell->servCellCfg.initDlBwp);
744 spCell->servCellCfg.numDlBwpToAdd = 0;
745 spCell->servCellCfg.firstActvDlBwpId = ACTIVE_DL_BWP_ID;
746 spCell->servCellCfg.defaultDlBwpId = ACTIVE_DL_BWP_ID;
747 spCell->servCellCfg.bwpInactivityTmr = NULLP;
748 spCell->servCellCfg.pdschServCellCfg.maxMimoLayers = NULLP;
749 spCell->servCellCfg.pdschServCellCfg.maxCodeBlkGrpPerTb = NULLP;
750 spCell->servCellCfg.pdschServCellCfg.codeBlkGrpFlushInd = NULLP;
751 spCell->servCellCfg.pdschServCellCfg.xOverhead = NULLP;
752 spCell->servCellCfg.pdschServCellCfg.numHarqProcForPdsch =\
753 NUM_HARQ_PROC_FOR_PDSCH_N_16;
754 /* Filling Initial UL Bwp*/
755 fillDefaultInitUlBwp(&spCell->servCellCfg.initUlBwp);
756 spCell->servCellCfg.numUlBwpToAdd = 0;
757 spCell->servCellCfg.firstActvUlBwpId = ACTIVE_DL_BWP_ID;
761 DU_LOG("\nERROR --> DU APP : Memory is NULL for SpCellGrp");
765 /******************************************************************
767 * @brief Fills Physical Cell Group Info
771 * Function : fillDefaultPhyCellGrpInfo
773 * Functionality: Fills Physical Cell Group Info
775 * @params[in] MacUeCfg *macUeCfg
778 *****************************************************************/
779 void fillDefaultPhyCellGrpInfo(MacUeCfg *macUeCfg)
781 PhyCellGrpCfg *cellGrp = NULL;
784 cellGrp = &macUeCfg->phyCellGrpCfg;
788 macUeCfg->phyCellGrpCfgPres = true;
789 cellGrp->pdschHarqAckCodebook = PDSCH_HARQ_ACK_CODEBOOK_DYNAMIC;
790 cellGrp->pNrFr1 = P_NR_FR1;
794 DU_LOG("\nERROR --> DU APP : Memory is NULL for Physical Cell Group");
798 /******************************************************************
800 * @brief Fills Mac Cell Group Info
804 * Function : fillDefaultMacCellGrpInfo
806 * Functionality: Fills Mac Cell Group Info
808 * @params[in] MacUeCfg *macUeCfg
811 *****************************************************************/
812 void fillDefaultMacCellGrpInfo(MacUeCfg *macUeCfg)
815 MacCellGrpCfg *cellGrp = NULL;
818 cellGrp = &macUeCfg->macCellGrpCfg;
822 macUeCfg->macCellGrpCfgPres = true;
824 /* Filling Scheduling Request Config */
825 cellGrp->schReqCfg.addModListCount = 1;
826 if(cellGrp->schReqCfg.addModListCount <= MAX_NUM_SR_CFG_PER_CELL_GRP)
828 for(idx = 0; idx < cellGrp->schReqCfg.addModListCount; idx++)
830 cellGrp->schReqCfg.addModList[idx].schedReqId = SCH_REQ_ID;
831 cellGrp->schReqCfg.addModList[idx].srProhibitTmr = SR_PROHIBIT_MS_32;
832 cellGrp->schReqCfg.addModList[idx].srTransMax = SR_TRANS_MAX_N_16;
835 cellGrp->schReqCfg.relListCount = 0;
837 /* Filling Tag config */
838 cellGrp->tagCfg.addModListCount = 1;
839 if(cellGrp->tagCfg.addModListCount <= MAC_NUM_TAGS)
841 for(idx = 0; idx < cellGrp->tagCfg.addModListCount; idx++)
843 cellGrp->tagCfg.addModList[idx].tagId = TAG_ID;
844 cellGrp->tagCfg.addModList[idx].timeAlignTimer = TIME_ALIGNMENT_TIMER_INFINITY;
847 cellGrp->tagCfg.relListCount = 0;
849 /* Filling BSR config */
850 cellGrp->bsrTmrCfg.periodicTimer = BSR_PERIODIC_TIMER_SF_10;
851 cellGrp->bsrTmrCfg.retxTimer = BSR_RETX_TIMER_SF_320;
852 cellGrp->bsrTmrCfg.srDelayTimer = BSR_SR_DELAY_TMR_2560;
854 /* Filling PHR config */
855 cellGrp->phrCfgSetupPres = true;
856 cellGrp->phrCfg.periodicTimer = PHR_PERIODIC_TIMER_INFINITY;
857 cellGrp->phrCfg.prohibitTimer = PHR_PROHIBIT_TIMER_SF_0;
858 cellGrp->phrCfg.txPowerFactor = PHR_TX_PWR_FACTOR_CHANGE_INFINITY;
859 cellGrp->phrCfg.multiplePHR = false;
860 cellGrp->phrCfg.dummy = false;
861 cellGrp->phrCfg.phrType2OtherCell = false;
862 cellGrp->phrCfg.phrOtherCG = PHR_MODE_OTHER_CG_REAL;
867 DU_LOG("\nERROR --> DU APP : Memory is NULL for Master Cell Group");
871 /*******************************************************************
873 * @brief Fills default modulation info for a UE
877 * Function : fillDefaultModulation
879 * Functionality: Fills default modulation info for a UE
881 * @params[in] Pointer to MAC UE configuration
882 * @return ROK - success
885 * ****************************************************************/
886 void fillDefaultModulation(MacUeCfg *ueCfg)
888 ueCfg->dlModInfo.modOrder = MOD_ORDER_QPSK;
889 ueCfg->dlModInfo.mcsIndex = SIB1_MCS;
890 ueCfg->dlModInfo.mcsTable = MCS_TABLE_QAM64; /* Spec 38.214-Table 5.1.3.1-1 */
892 ueCfg->ulModInfo.modOrder = MOD_ORDER_QPSK;
893 ueCfg->ulModInfo.mcsIndex = SIB1_MCS;
894 ueCfg->ulModInfo.mcsTable = MCS_TABLE_QAM64; /* Spec 38.214-Table 5.1.3.1-1 */
897 /******************************************************************
899 * @brief Function to fill Mac Lc Cfg for SRB1
903 * Function : fillMacSrb1LcCfg
905 * Functionality: Function to fill Mac Lc cfg for SRB1
907 * @params[in] LcCfg *lcCfg, LcCfg *ueSetReqDb
909 *****************************************************************/
911 void fillMacSrb1LcCfg(LcCfg *macLcCfg)
913 macLcCfg->lcId = SRB1_LCID;
914 macLcCfg->configType = CONFIG_ADD;
915 macLcCfg->drbQos = NULLP;
916 macLcCfg->snssai = NULLP;
917 macLcCfg->ulLcCfgPres = true;
918 fillDefaultUlLcCfg(&macLcCfg->ulLcCfg);
921 /******************************************************************
923 * @brief Function to fill the Lc cfg from ueSetupReqDb
927 * Function : fillMacLcCfgToAddMod
929 * Functionality: Function to fill the Lc cfg from ueSetupReqDb
931 * @params[in] LcCfg *lcCfg, LcCfg *ueSetReqDb
932 * @return ROK/RFAILED
934 *****************************************************************/
936 uint8_t fillMacLcCfgToAddMod(LcCfg *lcCfg, LcCfg *ueSetReqDb)
939 lcCfg->lcId = ueSetReqDb->lcId;
940 lcCfg->configType = ueSetReqDb->configType;
942 if(ueSetReqDb->drbQos)
946 DU_ALLOC_SHRABL_BUF(lcCfg->drbQos, sizeof(DrbQosInfo));
949 DU_LOG("\nERROR --> DU APP : Memory Alloc failed at drQos at fillMacLcCfgToAddMod()");
955 memcpy(lcCfg->drbQos, ueSetReqDb->drbQos, sizeof(DrbQosInfo));
960 lcCfg->drbQos = NULLP;
965 if(ueSetReqDb->snssai)
969 DU_ALLOC_SHRABL_BUF(lcCfg->snssai, sizeof(Snssai));
972 DU_LOG("\nERROR --> DU APP : Memory Alloc failed at snnsai at fillMacLcCfgToAddMod()");
979 memcpy(lcCfg->snssai, ueSetReqDb->snssai, sizeof(Snssai));
983 lcCfg->snssai = NULLP;
986 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->drbQos, sizeof(DrbQosInfo));
987 lcCfg->drbQos = NULLP;
993 lcCfg->snssai = NULLP;
995 lcCfg->ulLcCfgPres = ueSetReqDb->ulLcCfgPres;
996 memcpy(&lcCfg->ulLcCfg, &ueSetReqDb->ulLcCfg, sizeof(UlLcCfg));
997 memcpy(&lcCfg->dlLcCfg, &ueSetReqDb->dlLcCfg, sizeof(DlLcCfg));
1001 /******************************************************************
1003 * @brief Function to copy the Bit rate from ueSetupReqDb
1007 * Function : fillAmbr
1009 * Functionality: Function to copy bit Rate from ueSetupReqDb
1011 * @params[in] AmbrCfg **macAmbr, AmbrCfg *ueDbAmbr
1012 * @return ROK/RFAILED
1014 *****************************************************************/
1016 uint8_t fillAmbr(AmbrCfg **macAmbr, AmbrCfg *ueDbAmbr)
1020 if(*macAmbr == NULLP)
1022 DU_ALLOC_SHRABL_BUF(*macAmbr, sizeof(AmbrCfg));
1023 if(*macAmbr == NULLP)
1025 DU_LOG("\nERROR --> DU APP : Memory Alloc Failed at fillAmbr()");
1029 memset(*macAmbr, 0, sizeof(AmbrCfg));
1030 (*macAmbr)->ulBr = ueDbAmbr->ulBr;
1039 /******************************************************************
1041 * @brief Builds and Send UE ReConfig Request to MAC
1045 * Function : sendUeReCfgReqToMac
1047 * Functionality: Builds and Send UE ReConfig Request to MAC
1049 * @Params[in] MacUeCfg pointer
1050 * @return ROK - success
1053 * ****************************************************************/
1055 uint8_t sendUeReCfgReqToMac(MacUeCfg *macUeCfg)
1061 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_RECONFIG_REQ);
1065 /* Processing one Ue at a time to MAC */
1066 DU_LOG("\nDEBUG --> DU_APP: Sending Ue Reconfig Request to MAC");
1067 ret = (*packMacUeReconfigReqOpts[pst.selector])(&pst, macUeCfg);
1070 DU_LOG("\nERROR --> DU APP : Failed to send Reconfig Request to MAC at sendUeReCfgReqToMac()");
1071 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macUeCfg, sizeof(MacUeCfg));
1076 DU_LOG("\nERROR --> DU_APP: Received macUeCfg is NULLP at sendUeReCfgReqToMac()");
1082 /******************************************************************
1084 * @brief Function to return Drb LcId
1088 * Function : getDrbLcId
1090 * Functionality: Function to return Drb LcId
1092 * Returns: lcId - SUCCESS
1094 *****************************************************************/
1096 uint8_t getDrbLcId(uint32_t *drbBitMap)
1098 uint8_t bitMask = 1, bitPos = 0;
1099 bitPos = MIN_DRB_LCID;
1101 while(bitPos <= MAX_DRB_LCID)
1103 if((*drbBitMap & (bitMask << bitPos)) == 0)
1105 *drbBitMap = ((bitMask << bitPos)| *drbBitMap);
1113 DU_LOG("\nERROR --> DU_APP: Max LC Reached in getDrbLcId()");
1117 /******************************************************************
1119 * @brief Fills MacUeCfg structure
1123 * Function : fillMacUeCfg
1125 * Functionality: Fills MacUeCfg
1127 * @params[in] cellId, ueIdx, crnti,
1130 * @return ROK/RFAILED
1132 *****************************************************************/
1133 uint8_t fillMacUeCfg(uint16_t cellId, uint8_t ueIdx, uint16_t crnti, \
1134 DuUeCfg *ueCfgDb, MacUeCfg *macUeCfg)
1136 uint8_t ret, dbIdx, lcIdx, cellIdx;
1137 bool lcIdFound = false;
1138 MacUeCfg *duMacDb = NULLP;
1144 macUeCfg->cellId = cellId;
1145 macUeCfg->ueIdx = ueIdx;
1146 macUeCfg->crnti = crnti;
1148 fillDefaultMacCellGrpInfo(macUeCfg);
1149 fillDefaultPhyCellGrpInfo(macUeCfg);
1150 fillDefaultSpCellGrpInfo(macUeCfg);
1151 macUeCfg->ambrCfg = NULLP;
1152 fillDefaultModulation(macUeCfg);
1153 fillMacSrb1LcCfg(&macUeCfg->lcCfgList[0]);
1158 /* Fetching MacDb from DuUeCb */
1159 GET_CELL_IDX(cellId, cellIdx);
1160 duMacDb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].macUeCfg;
1161 duMacDb->macUeCfgState = UE_CFG_INPROGRESS;
1162 /* Fetching MaUeCfg List for ADD/MOD/DEL */
1163 macUeCfg->cellId = cellId;
1164 macUeCfg->ueIdx = ueIdx;
1165 macUeCfg->crnti = crnti;
1166 ret = procUeReCfgCellInfo(macUeCfg, ueCfgDb->cellGrpCfg);
1169 if(macUeCfg->spCellCfgPres == true)
1171 if(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschPresent)
1173 fillStartSymbolAndLen(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg.numTimeDomRsrcAlloc,\
1174 &macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg, NULL);
1176 if(macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschPresent)
1178 fillStartSymbolAndLen(macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg.numTimeDomRsrcAlloc,\
1179 NULL, &macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg);
1182 ret = fillAmbr(&macUeCfg->ambrCfg, ueCfgDb->ambrCfg);
1183 duFillModulationDetails(macUeCfg, duMacDb, ueCfgDb->ueNrCapability);
1186 /* Filling LC Context */
1187 for(dbIdx = 0; (dbIdx < ueCfgDb->numMacLcs && ret == ROK); dbIdx++)
1189 if(!ueCfgDb->macLcCfg[dbIdx].ulLcCfgPres)
1191 /* Filling default UL LC config in MAC if not present */
1192 ueCfgDb->macLcCfg[dbIdx].ulLcCfgPres = true;
1193 fillDefaultUlLcCfg(&ueCfgDb->macLcCfg[dbIdx].ulLcCfg);
1195 for(lcIdx = 0; lcIdx < duMacDb->numLcs; lcIdx++)
1197 if(ueCfgDb->macLcCfg[dbIdx].lcId == duMacDb->lcCfgList[lcIdx].lcId)
1200 if((ueCfgDb->macLcCfg[dbIdx].configType == CONFIG_UNKNOWN) ||
1201 (ueCfgDb->macLcCfg[dbIdx].configType == CONFIG_MOD))
1203 ueCfgDb->macLcCfg[dbIdx].configType = CONFIG_MOD;
1204 ret = fillMacLcCfgToAddMod(&macUeCfg->lcCfgList[dbIdx], &ueCfgDb->macLcCfg[dbIdx]);
1212 /* ADD/DEL CONFIG */
1213 ret = fillMacLcCfgToAddMod(&macUeCfg->lcCfgList[dbIdx], &ueCfgDb->macLcCfg[dbIdx]);
1221 DU_LOG("\nERROR --> DU APP : Failed to add Lc at Idx %d in fillMacUeCfg()", dbIdx);
1224 }/*End of Outer FOR loop */
1229 /******************************************************************
1231 * @brief Fills Rlc AM Information
1235 * Function : fillDefaultAmInfo
1237 * Functionality: Fills Rlc AM Information
1239 * @params[in] AmBearerCfg *amCfg
1242 *****************************************************************/
1243 void fillDefaultAmInfo(AmBearerCfg *amCfg)
1246 amCfg->dlAmCfg.snLenDl = AM_SIZE_12;
1247 amCfg->dlAmCfg.pollRetxTmr = T_POLL_RETRANSMIT_VAL;
1248 amCfg->dlAmCfg.pollPdu = POLL_PDU_VAL;
1249 amCfg->dlAmCfg.pollByte = POLL_BYTE_VAL;
1250 amCfg->dlAmCfg.maxRetxTh = MAX_RETX_THRESHOLD_VAL;
1253 amCfg->ulAmCfg.snLenUl = AM_SIZE_12;
1254 amCfg->ulAmCfg.reAssemTmr = T_REASSEMBLY_VAL;
1255 amCfg->ulAmCfg.statProhTmr = T_STATUS_PROHIBHIT_VAL;
1258 /******************************************************************
1260 * @brief Fills RLC UM Bi Directional Information
1264 * Function : fillDefaultUmBiInfo
1266 * Functionality: Fills RLC UM Bi Directional Information
1268 * @params[in] UmBiDirBearerCfg *umBiDirCfg
1271 *****************************************************************/
1272 void fillDefaultUmBiInfo(UmBiDirBearerCfg *umBiDirCfg)
1274 /* UL UM BI DIR INFO */
1275 umBiDirCfg->ulUmCfg.snLenUlUm = UM_SIZE_12;
1276 umBiDirCfg->ulUmCfg.reAssemTmr = T_REASSEMBLY_VAL;
1278 /* DL UM BI DIR INFO */
1279 umBiDirCfg->dlUmCfg.snLenDlUm = UM_SIZE_12;
1282 /******************************************************************
1284 * @brief Fills RLC UM Uni Directional UL Information
1288 * Function : fillDefaultUmUlInfo
1290 * Functionality: Fills RLC UM Uni Directional Info
1292 * @params[in] UmUniDirUlBearerCfg *UmUlCfg
1295 *****************************************************************/
1296 void fillDefaultUmUlInfo(UmUniDirUlBearerCfg *UmUlCfg)
1298 UmUlCfg->ulUmCfg.snLenUlUm = UM_SIZE_12;
1299 UmUlCfg->ulUmCfg.reAssemTmr = T_REASSEMBLY_VAL;
1302 /******************************************************************
1304 * @brief Fills RLC UM Uni Directional DL Information
1308 * Function : fillDefaultUmDlInfo
1310 * Functionality: Fills RLC UM Uni Directional DL Info
1312 * @params[in] UmUniDirDlBearerCfg *UmDlCfg
1315 *****************************************************************/
1316 void fillDefaultUmDlInfo(UmUniDirDlBearerCfg *UmDlCfg)
1318 UmDlCfg->dlUmCfg.snLenDlUm = UM_SIZE_12;
1321 /******************************************************************
1323 * @brief Builds Rlc Mode Default Configuration
1327 * Function : fillDefaultRlcModeCfg
1329 * Functionality: Builds Rlc Mode Default Configuration
1331 * @params[in] rlcMode, RlcBearerCfg *lcCfg
1332 * @return ROK/RFAILED
1334 *****************************************************************/
1336 uint8_t fillDefaultRlcModeCfg(uint8_t rlcMode, RlcBearerCfg *lcCfg)
1347 DU_ALLOC_SHRABL_BUF(lcCfg->u.amCfg, sizeof(AmBearerCfg));
1349 fillDefaultAmInfo(lcCfg->u.amCfg);
1352 DU_LOG("\n ERROR --> DU APP : Memory Alloc failed at AmCfg at fillDefaultRlcModeCfg()");
1358 case RLC_UM_BI_DIRECTIONAL :
1360 if(!lcCfg->u.umBiDirCfg)
1362 DU_ALLOC_SHRABL_BUF(lcCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
1363 if(lcCfg->u.umBiDirCfg)
1364 fillDefaultUmBiInfo(lcCfg->u.umBiDirCfg);
1367 DU_LOG("\n ERROR --> DU APP : Memory Alloc failed at UmBiDirCfg at fillDefaultRlcModeCfg()");
1373 case RLC_UM_UNI_DIRECTIONAL_UL :
1375 if(!lcCfg->u.umUniDirUlCfg)
1377 DU_ALLOC_SHRABL_BUF(lcCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
1378 if(lcCfg->u.umUniDirUlCfg)
1379 fillDefaultUmUlInfo(lcCfg->u.umUniDirUlCfg);
1382 DU_LOG("\n ERROR --> DU APP : Memory Alloc failed at UmUniDirUlCfg at fillDefaultRlcModeCfg()");
1388 case RLC_UM_UNI_DIRECTIONAL_DL :
1390 if(!lcCfg->u.umUniDirDlCfg)
1392 DU_ALLOC_SHRABL_BUF(lcCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
1393 if(lcCfg->u.umUniDirDlCfg)
1394 fillDefaultUmDlInfo(lcCfg->u.umUniDirDlCfg);
1397 DU_LOG("\n ERROR --> DU APP : Memory Alloc failed at UmUniDirDlCfg at fillDefaultRlcModeCfg()");
1404 DU_LOG("\nERROR --> DUAPP: Invalid rlcMode %d at extractRlcCfgToAddMod()", rlcMode);
1411 DU_LOG("\nERROR --> DUAPP: Received LC Config is NULL");
1417 /*******************************************************************
1419 * @brief Function to fill Rlc Lc Cfg for SRB1
1423 * Function : fillRlcSrb1LcCfg
1426 * Function to fill Rlc Lc Cfg for SRB1
1428 * @params[in] Pointer to RlcBearerCfg
1429 * @return ROK/RFAILED
1431 *****************************************************************/
1433 uint8_t fillRlcSrb1LcCfg(RlcBearerCfg *rlcLcCfg)
1437 rlcLcCfg->rbId = SRB1_LCID;
1438 rlcLcCfg->rbType = RB_TYPE_SRB;
1439 rlcLcCfg->lcId = SRB1_LCID;
1440 rlcLcCfg->lcType = LCH_DCCH;
1441 rlcLcCfg->rlcMode = RLC_AM;
1442 rlcLcCfg->configType = CONFIG_ADD;
1443 ret = fillDefaultRlcModeCfg(rlcLcCfg->rlcMode, rlcLcCfg);
1447 /*******************************************************************
1449 * @brief Processes UE ReConfig Req to RLC UL
1453 * Function : sendUeReCfgReqToRlc
1456 * Processes UE Reconfig Req to RLC UL
1458 * @params[in] Pointer to RlcUeCfg
1459 * @return ROK - success
1462 *****************************************************************/
1464 uint8_t sendUeReCfgReqToRlc(RlcUeCfg *rlcUeCfg)
1469 FILL_PST_DUAPP_TO_RLC(pst, RLC_UL_INST, EVENT_RLC_UE_RECONFIG_REQ);
1472 /* Processing one Ue at a time to RLC */
1473 DU_LOG("\nDEBUG --> DU_APP: Sending Ue Reconfig Request to RLC UL");
1474 ret = (*packRlcUeReconfigReqOpts[pst.selector])(&pst, rlcUeCfg);
1477 DU_LOG("\nERROR --> DU_APP : Failed to send Ue Reconfig Req to RLC at sendUeReCfgReqToRlc()");
1478 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rlcUeCfg, sizeof(RlcUeCfg));
1483 DU_LOG("\nERROR --> DU_APP: Received RlcUeCfg is NULL at sendUeReCfgReqToRlc()");
1489 /******************************************************************
1491 * @brief Fills RlcBearerCfg structure
1495 * Function : fillRlcUeCfg
1497 * Functionality: Fills Rlc Bearer Cfg
1500 *****************************************************************/
1501 uint8_t fillRlcUeCfg(uint16_t cellId, uint8_t ueIdx,\
1502 DuUeCfg *ueCfgDb, RlcUeCfg *rlcUeCfg)
1504 uint8_t ret, dbIdx, lcIdx, cellIdx;
1505 bool lcIdFound = false;
1506 RlcUeCfg *duRlcDb = NULLP;
1511 /* Initial RB being Added */
1512 rlcUeCfg->cellId = cellId;
1513 rlcUeCfg->ueIdx = ueIdx;
1514 ret = fillRlcSrb1LcCfg(&rlcUeCfg->rlcLcCfg[0]);
1518 memset(rlcUeCfg, 0, sizeof(RlcUeCfg));
1522 /* Fetch RlcDb from DuUeCb */
1523 GET_CELL_IDX(cellId, cellIdx);
1524 duRlcDb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].rlcUeCfg;
1525 duRlcDb->rlcUeCfgState = UE_CFG_INPROGRESS;
1526 /*Filling RlcUeCfg */
1527 rlcUeCfg->cellId = cellId;
1528 rlcUeCfg->ueIdx = ueIdx;
1529 for(dbIdx = 0; (dbIdx < ueCfgDb->numRlcLcs && ret == ROK); dbIdx++)
1531 ret = fillDefaultRlcModeCfg(ueCfgDb->rlcLcCfg[dbIdx].rlcMode, &ueCfgDb->rlcLcCfg[dbIdx]);
1534 DU_LOG("\n ERROR --> DU APP : Failed to fill Rlc Mode at fillRlcUeCfg()");
1535 memset(rlcUeCfg, 0, sizeof(RlcUeCfg));
1538 /* Fill Rlc Ue Cfg List for ADD/MOD/DEL */
1539 for(lcIdx = 0; lcIdx < duRlcDb->numLcs; lcIdx++)
1541 if(ueCfgDb->rlcLcCfg[dbIdx].lcId == duRlcDb->rlcLcCfg[lcIdx].lcId)
1544 if((ueCfgDb->rlcLcCfg[dbIdx].configType == CONFIG_UNKNOWN)||
1545 (ueCfgDb->rlcLcCfg[dbIdx].configType == CONFIG_MOD))
1548 ueCfgDb->rlcLcCfg[dbIdx].configType = CONFIG_MOD; /* update Db for MOD type */
1549 memcpy(&rlcUeCfg->rlcLcCfg[dbIdx], &ueCfgDb->rlcLcCfg[dbIdx], sizeof(RlcBearerCfg));
1557 /* ADD/ DEL Config Type */
1558 memcpy(&rlcUeCfg->rlcLcCfg[dbIdx], &ueCfgDb->rlcLcCfg[dbIdx], sizeof(RlcBearerCfg));
1566 /******************************************************************
1568 * @brief creates UE context
1572 * Function : duCreateUeCb
1574 * Functionality: Creates UE Conetxt
1576 * @params[in] UeCcchCtxt Pointer
1579 * @return ROK - success
1581 * ****************************************************************/
1582 uint8_t duCreateUeCb(UeCcchCtxt *ueCcchCtxt, uint32_t gnbCuUeF1apId)
1584 uint8_t cellIdx = 0;
1588 for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
1590 if(ueCcchCtxt->cellId == duCb.actvCellLst[cellIdx]->cellId)
1592 GET_UE_IDX(ueCcchCtxt->crnti, ueIdx);
1593 DU_LOG("\nDEBUG --> DU_APP: Filling UeCb for ueIdx [%d]", ueIdx);
1595 duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].f1UeDb = NULLP;
1596 duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].crnti = ueCcchCtxt->crnti;
1597 duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbDuUeF1apId = ueCcchCtxt->gnbDuUeF1apId;
1598 duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbCuUeF1apId = gnbCuUeF1apId;
1599 duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].drbBitMap = NULLP;
1600 duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].ueState = UE_ACTIVE;
1602 /* Filling Mac Ue Config */
1603 memset(&duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].macUeCfg, 0, sizeof(MacUeCfg));
1604 ret = duBuildAndSendUeCreateReqToMac(ueCcchCtxt->cellId, ueIdx, ueCcchCtxt->crnti,\
1605 &duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].macUeCfg);
1607 DU_LOG("\nERROR --> DU APP : Failed to send UE create request to MAC");
1609 /* Filling Rlc Ue Config */
1610 memset(&duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].rlcUeCfg, 0, sizeof(RlcUeCfg));
1611 ret = duBuildAndSendUeCreateReqToRlc(ueCcchCtxt->cellId, ueIdx, \
1612 &duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].rlcUeCfg);
1614 DU_LOG("\nERROR --> DU APP : Failed to send UE create request to RLC");
1616 duCb.actvCellLst[cellIdx]->numActvUes++;
1617 memset(ueCcchCtxt, 0, sizeof(UeCcchCtxt));
1623 /******************************************************************
1625 * @brief Builds and Send UE Create Request to MAC
1629 * Function : duBuildAndSendUeCreateReqToMac
1631 * Functionality: Builds and Send UE Create Request to MAC
1633 * @Params[in] cellId,
1635 * @return ROK - success
1638 * ****************************************************************/
1640 uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t ueIdx,\
1641 uint16_t crnti, MacUeCfg *duMacUeCfg)
1644 MacUeCfg *macUeCfg = NULLP;
1646 memset(&pst, 0, sizeof(Pst));
1649 ret = fillMacUeCfg(cellId, ueIdx, crnti, NULL, duMacUeCfg);
1652 DU_LOG("\nERROR --> DU APP : Failed to fill MacUeCfg at duBuildAndSendUeCreateReqToMac()");
1656 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_CREATE_REQ);
1658 /* Copying ueCb to a sharable buffer */
1659 DU_ALLOC_SHRABL_BUF(macUeCfg, sizeof(MacUeCfg));
1662 memset(macUeCfg, 0, sizeof(MacUeCfg));
1663 memcpy(macUeCfg, duMacUeCfg, sizeof(MacUeCfg));
1664 DU_LOG("\nDEBUG --> DU_APP: Sending UE create request to MAC");
1666 /* Processing one Ue at a time to MAC */
1667 ret = (*packMacUeCreateReqOpts[pst.selector])(&pst, macUeCfg);
1670 DU_LOG("\nERROR --> DU_APP : Failure in sending Ue Create Req to MAC at duBuildAndSendUeCreateReqToMac()");
1671 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macUeCfg, sizeof(MacUeCfg));
1676 DU_LOG("\n ERROR --> DU APP : Memory alloc failed at duBuildAndSendUeCreateReqToMac()");
1682 /*******************************************************************
1684 * @brief To update DuUeCb Mac Cfg
1688 * Function : duUpdateMacCfg
1689 * Functionality: update DuUeCb MAC Cfg
1691 * @params[in] DuUeCb Pointer
1692 * F1UeContextSetupDb pointer
1693 * @return ROK - success
1696 * ****************************************************************/
1697 uint8_t duUpdateMacCfg(MacUeCfg *macUeCfg, F1UeContextSetupDb *f1UeDb)
1699 uint8_t ret, lcIdx, dbIdx, numLcs, lcDelIdx, cellIdx;
1700 MacUeCfg *oldMacUeCfg;
1703 /*Filling Cell Group Cfg*/
1704 ret = procUeReCfgCellInfo(macUeCfg, f1UeDb->duUeCfg.cellGrpCfg);
1707 if(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschPresent)
1709 fillStartSymbolAndLen(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg.numTimeDomRsrcAlloc,\
1710 &macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg, NULL);
1712 if(macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschPresent)
1714 fillStartSymbolAndLen(macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg.numTimeDomRsrcAlloc,\
1715 NULL, &macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg);
1717 ret = fillAmbr(&macUeCfg->ambrCfg, f1UeDb->duUeCfg.ambrCfg);
1719 GET_CELL_IDX(macUeCfg->cellId, cellIdx);
1720 oldMacUeCfg = &duCb.actvCellLst[cellIdx]->ueCb[macUeCfg->ueIdx-1].macUeCfg;
1721 duFillModulationDetails(macUeCfg, oldMacUeCfg, f1UeDb->duUeCfg.ueNrCapability);
1724 /* Filling LC Context */
1725 for(dbIdx = 0; (dbIdx < f1UeDb->duUeCfg.numMacLcs && ret == ROK); dbIdx++)
1727 numLcs = macUeCfg->numLcs;
1728 for(lcIdx = 0; lcIdx < numLcs; lcIdx++)
1730 if(f1UeDb->duUeCfg.macLcCfg[dbIdx].lcId == macUeCfg->lcCfgList[lcIdx].lcId)
1732 if(f1UeDb->duUeCfg.macLcCfg[dbIdx].configType == CONFIG_MOD)
1734 ret = fillMacLcCfgToAddMod(&macUeCfg->lcCfgList[lcIdx],&f1UeDb->duUeCfg.macLcCfg[dbIdx]);
1736 else if(f1UeDb->duUeCfg.macLcCfg[dbIdx].configType == CONFIG_DEL)
1738 /* Free memory at matched lcIdx index */
1739 freeMacLcCfg(&macUeCfg->lcCfgList[lcIdx]);
1741 for(lcDelIdx = lcIdx; lcDelIdx < macUeCfg->numLcs; lcDelIdx++)
1743 /* moving all elements one index ahead */
1744 ret = fillMacLcCfgToAddMod(&macUeCfg->lcCfgList[lcDelIdx], &macUeCfg->lcCfgList[lcDelIdx+1]);
1745 freeMacLcCfg(&macUeCfg->lcCfgList[lcDelIdx+1]);
1748 DU_LOG("\nERROR --> DU APP : Failed to delete LC at Idx %d in duUpdateMacCfg()", lcDelIdx);
1755 if(f1UeDb->duUeCfg.macLcCfg[dbIdx].configType == CONFIG_ADD)
1757 ret = fillMacLcCfgToAddMod(&macUeCfg->lcCfgList[numLcs], &f1UeDb->duUeCfg.macLcCfg[dbIdx]);
1760 DU_LOG("\nERROR --> DU APP : Failed to add LC at Idx %d in duUpdateMacCfg()", numLcs);
1770 /******************************************************************
1772 * @brief Function to fill the RLC Lc cfg from ueSetupReqDb
1776 * Function : fillRlcCfgToAddMod
1778 * Functionality: Function to fill the RLC Lc cfg from ueSetupReqDb
1781 *****************************************************************/
1783 uint8_t fillRlcCfgToAddMod(RlcBearerCfg *lcCfg, RlcBearerCfg *f1UeDbLcCfg)
1785 lcCfg->configType = f1UeDbLcCfg->configType;
1786 lcCfg->rbId = f1UeDbLcCfg->rbId;
1787 lcCfg->rbType = f1UeDbLcCfg->rbType;
1788 lcCfg->lcId = f1UeDbLcCfg->lcId;
1789 lcCfg->lcType = f1UeDbLcCfg->lcType;
1790 lcCfg->rlcMode = f1UeDbLcCfg->rlcMode;
1791 switch(lcCfg->rlcMode)
1797 DU_ALLOC_SHRABL_BUF(lcCfg->u.amCfg, sizeof(AmBearerCfg));
1802 lcCfg->u.amCfg->dlAmCfg.snLenDl = f1UeDbLcCfg->u.amCfg->dlAmCfg.snLenDl;
1803 lcCfg->u.amCfg->dlAmCfg.pollRetxTmr = f1UeDbLcCfg->u.amCfg->dlAmCfg.pollRetxTmr;
1804 lcCfg->u.amCfg->dlAmCfg.pollPdu = f1UeDbLcCfg->u.amCfg->dlAmCfg.pollPdu;
1805 lcCfg->u.amCfg->dlAmCfg.pollByte = f1UeDbLcCfg->u.amCfg->dlAmCfg.pollByte;
1806 lcCfg->u.amCfg->dlAmCfg.maxRetxTh = f1UeDbLcCfg->u.amCfg->dlAmCfg.maxRetxTh;
1809 lcCfg->u.amCfg->ulAmCfg.snLenUl = f1UeDbLcCfg->u.amCfg->ulAmCfg.snLenUl;
1810 lcCfg->u.amCfg->ulAmCfg.reAssemTmr = f1UeDbLcCfg->u.amCfg->ulAmCfg.reAssemTmr;
1811 lcCfg->u.amCfg->ulAmCfg.statProhTmr = f1UeDbLcCfg->u.amCfg->ulAmCfg.statProhTmr;
1814 case RLC_UM_BI_DIRECTIONAL :
1816 if(!lcCfg->u.umBiDirCfg)
1818 DU_ALLOC_SHRABL_BUF(lcCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
1819 if(!lcCfg->u.umBiDirCfg)
1822 /* UL UM BI DIR INFO */
1823 lcCfg->u.umBiDirCfg->ulUmCfg.snLenUlUm = f1UeDbLcCfg->u.umBiDirCfg->ulUmCfg.snLenUlUm;
1824 lcCfg->u.umBiDirCfg->ulUmCfg.reAssemTmr = f1UeDbLcCfg->u.umBiDirCfg->ulUmCfg.reAssemTmr;
1825 /* DL UM BI DIR INFO */
1826 lcCfg->u.umBiDirCfg->dlUmCfg.snLenDlUm = f1UeDbLcCfg->u.umBiDirCfg->dlUmCfg.snLenDlUm;
1829 case RLC_UM_UNI_DIRECTIONAL_UL :
1831 if(!lcCfg->u.umUniDirUlCfg)
1833 DU_ALLOC_SHRABL_BUF(lcCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
1834 if(!lcCfg->u.umUniDirUlCfg)
1837 lcCfg->u.umUniDirUlCfg->ulUmCfg.snLenUlUm = f1UeDbLcCfg->u.umUniDirUlCfg->ulUmCfg.snLenUlUm;
1838 lcCfg->u.umUniDirUlCfg->ulUmCfg.reAssemTmr = f1UeDbLcCfg->u.umUniDirUlCfg->ulUmCfg.reAssemTmr;
1842 case RLC_UM_UNI_DIRECTIONAL_DL :
1844 if(!lcCfg->u.umUniDirDlCfg)
1846 DU_ALLOC_SHRABL_BUF(lcCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
1847 if(!lcCfg->u.umUniDirDlCfg)
1850 lcCfg->u.umUniDirDlCfg->dlUmCfg.snLenDlUm = f1UeDbLcCfg->u.umUniDirDlCfg->dlUmCfg.snLenDlUm;
1854 DU_LOG("\nERROR --> DU_APP: Invalid Rlc Mode %d at fillRlcCfgToAddMod()", lcCfg->rlcMode);
1860 /*******************************************************************
1862 * @brief To update DuUeCb Rlc Lc Cfg
1866 * Function : duUpdateRlcLcCfg
1867 * Functionality: update DuUeCb Rlc Lc Cfg
1869 * @params[in] DuUeCb Pointer
1870 * F1UeContextSetupDb pointer
1871 * @return ROK - success
1874 * ****************************************************************/
1876 uint8_t duUpdateRlcLcCfg(RlcUeCfg *rlcUeCfg, F1UeContextSetupDb *f1UeDb)
1878 uint8_t ret, lcIdx, dbIdx, numLcs, lcDelIdx;
1881 for(dbIdx = 0; (dbIdx < f1UeDb->duUeCfg.numRlcLcs && ret ==ROK); dbIdx++)
1883 numLcs = rlcUeCfg->numLcs;
1884 for(lcIdx = 0; lcIdx < numLcs; lcIdx++)
1886 if(f1UeDb->duUeCfg.rlcLcCfg[dbIdx].lcId == rlcUeCfg->rlcLcCfg[lcIdx].lcId)
1888 if(f1UeDb->duUeCfg.rlcLcCfg[dbIdx].configType == CONFIG_MOD)
1890 ret = fillRlcCfgToAddMod(&rlcUeCfg->rlcLcCfg[lcIdx], &f1UeDb->duUeCfg.rlcLcCfg[dbIdx]);
1892 else if(f1UeDb->duUeCfg.rlcLcCfg[dbIdx].configType == CONFIG_DEL)
1894 /* Free memory at matched lcIdx index */
1895 freeRlcLcCfg(&rlcUeCfg->rlcLcCfg[lcIdx]);
1897 for(lcDelIdx = lcIdx; lcDelIdx < rlcUeCfg->numLcs; lcDelIdx++)
1899 ret = fillRlcCfgToAddMod(&rlcUeCfg->rlcLcCfg[lcDelIdx], &rlcUeCfg->rlcLcCfg[lcDelIdx+1]);
1900 freeRlcLcCfg(&rlcUeCfg->rlcLcCfg[lcDelIdx+1]);
1903 DU_LOG("\nERROR --> DU APP : Failed to delete LC at Idx %d in duUpdateRlcCfg()", lcDelIdx);
1910 if(f1UeDb->duUeCfg.rlcLcCfg[dbIdx].configType == CONFIG_ADD)
1912 ret = fillRlcCfgToAddMod(&rlcUeCfg->rlcLcCfg[lcIdx], &f1UeDb->duUeCfg.rlcLcCfg[dbIdx]);
1921 /*******************************************************************
1923 * @brief Function to fill Tunnel Config to Add/Mod
1928 * Function : fillTnlCfgToAddMod
1930 * Functionality: Function to fill tunnel Config to Add/Mod
1932 * @params[in] Pointer to tnlCfgDb,
1933 * pointer to f1TnlCfg
1934 * @return ROK - success
1937 * ****************************************************************/
1938 uint8_t fillTnlCfgToAddMod(UpTnlCfg **ueCbTnlCfg, UpTnlCfg *f1TnlCfg)
1940 if(*ueCbTnlCfg == NULLP)
1942 /* copying to DuCb Tnl Cfg */
1943 DU_ALLOC(*ueCbTnlCfg, sizeof(UpTnlCfg));
1944 if(*ueCbTnlCfg == NULLP)
1946 DU_LOG("\nERROR --> DU_APP : fillTnlCfgToAddMod: Memory Alloc failed for drbId[%d]", f1TnlCfg->drbId);
1950 memset(*ueCbTnlCfg, 0, sizeof(UpTnlCfg));
1951 (*ueCbTnlCfg)->configType = f1TnlCfg->configType;
1952 (*ueCbTnlCfg)->cellId = f1TnlCfg->cellId;
1953 (*ueCbTnlCfg)->ueIdx = f1TnlCfg->ueIdx;
1954 (*ueCbTnlCfg)->drbId = f1TnlCfg->drbId;
1955 if(f1TnlCfg->tnlCfg1)
1957 if((*ueCbTnlCfg)->tnlCfg1 == NULLP)
1959 DU_ALLOC((*ueCbTnlCfg)->tnlCfg1, sizeof(GtpTnlCfg));
1960 if((*ueCbTnlCfg)->tnlCfg1 == NULLP)
1962 DU_LOG("\nERROR --> DU_APP : fillTnlCfgToAddMod: Memory Alloc failed for tnlCfg1 for drbId[%d]", f1TnlCfg->drbId);
1966 memset((*ueCbTnlCfg)->tnlCfg1, 0, sizeof(GtpTnlCfg));
1967 (*ueCbTnlCfg)->tnlCfg1->teId = f1TnlCfg->tnlCfg1->teId;
1968 (*ueCbTnlCfg)->tnlCfg1->ulTnlAddress = f1TnlCfg->tnlCfg1->ulTnlAddress;
1969 (*ueCbTnlCfg)->tnlCfg1->dlTnlAddress = f1TnlCfg->tnlCfg1->dlTnlAddress;
1974 /*******************************************************************
1976 * @brief Processing the tunnel Request to EGTP
1980 * Function : duProcEgtpTunnelCfg
1982 * Functionality: Processing the tunnel Request to EGTP
1984 * @params[in] UptnlCfg *duTnlCfg, UpTnlCfg *f1TnlCfg
1985 * @return ROK - success
1988 * ****************************************************************/
1990 uint8_t duProcEgtpTunnelCfg(uint8_t ueCbIdx, UpTnlCfg *duTnlCfg, UpTnlCfg *f1TnlCfg)
1992 uint8_t ret = RFAILED, delIdx;
1994 if(f1TnlCfg->tnlCfg1 == NULLP)
1996 DU_LOG("\nERROR --> DU_APP : Tunnel config not found");
2000 if(f1TnlCfg->configType == CONFIG_ADD)
2002 if(duSendEgtpTnlMgmtReq(EGTP_TNL_MGMT_ADD, NULLP, f1TnlCfg->tnlCfg1) == ROK)
2004 if(fillTnlCfgToAddMod(&duCb.upTnlCfg[duCb.numDrb], f1TnlCfg) == ROK)
2011 else if(f1TnlCfg->configType == CONFIG_MOD)
2013 if(duSendEgtpTnlMgmtReq(EGTP_TNL_MGMT_MOD, duTnlCfg->tnlCfg1->teId, f1TnlCfg->tnlCfg1) == ROK)
2015 if(fillTnlCfgToAddMod(&duTnlCfg, f1TnlCfg) == ROK)
2021 else if(f1TnlCfg->configType == CONFIG_DEL)
2023 if(duSendEgtpTnlMgmtReq(EGTP_TNL_MGMT_DEL, duTnlCfg->tnlCfg1->teId, f1TnlCfg->tnlCfg1) == ROK)
2025 /* Free memory at drbIdx */
2026 DU_FREE(duTnlCfg->tnlCfg1, sizeof(GtpTnlCfg));
2027 DU_FREE(duTnlCfg, sizeof(UpTnlCfg));
2029 for(delIdx = ueCbIdx; delIdx < duCb.numDrb; delIdx++)
2031 /* moving all elements one index ahead */
2032 ret = fillTnlCfgToAddMod(&duCb.upTnlCfg[delIdx], duCb.upTnlCfg[delIdx+1]);
2043 /***********************************************************************
2045 * @brief Function to fill Tunnel Config
2046 * and sends tunnel Req to EGTP
2051 * Function : duUpdateTunnelCfgDb
2053 * Functionality: Function to fill tunnel Config
2054 * and sends tunnel Cfg Req to EGTP
2056 * @params[in] ueIdx, cellId, DuUeCfg
2057 * @return ROK - success
2060 * ****************************************************************/
2062 uint8_t duUpdateTunnelCfgDb(uint8_t ueIdx, uint8_t cellId, DuUeCfg *duUeCfg)
2064 uint8_t ret = ROK, drbIdx, duCbDrbIdx;
2065 bool drbFound = false;
2067 /*If Add/Mod tunnels request for that DRB is successful in EGTP */
2068 /*then update drbId and tunnel Info in duCb */
2069 for(drbIdx=0; drbIdx < duUeCfg->numDrb; drbIdx++)
2071 duUeCfg->upTnlInfo[drbIdx].cellId = cellId;
2072 duUeCfg->upTnlInfo[drbIdx].ueIdx = ueIdx;
2073 for(duCbDrbIdx = 0; duCbDrbIdx < duCb.numDrb; duCbDrbIdx++)
2075 if(duCb.upTnlCfg[duCbDrbIdx]->drbId == duUeCfg->upTnlInfo[drbIdx].drbId)
2077 drbFound = true; /* existing DRB */
2078 if(duProcEgtpTunnelCfg(duCbDrbIdx, duCb.upTnlCfg[duCbDrbIdx], &duUeCfg->upTnlInfo[drbIdx]) != ROK)
2080 DU_LOG("\nERROR -> DU_APP : duUpdateTunnelCfgDb: Failed to modify tunnel req for Drb id[%d]",
2081 duUeCfg->upTnlInfo[drbIdx].drbId);
2089 if(!drbFound && ret == ROK)/* new DRB to Add */
2091 if(duProcEgtpTunnelCfg(NULLP, NULLP, &duUeCfg->upTnlInfo[drbIdx]) != ROK)
2093 DU_LOG("\nERROR -> DU_APP : duUpdateTunnelCfgDb: Failed to add tunnel req for Drb id[%d]",
2094 duUeCfg->upTnlInfo[drbIdx].drbId);
2105 /*******************************************************************
2107 * @brief @brief To update DuUeCb Mac and Rlc Ue Cfg
2112 * Function : duUpdateDuUeCbCfg
2114 * Functionality: update DuUeCb Mac and Rlc Ue Cfg
2116 * @params[in] ueIdx, cellIdx
2117 * @return ROK - success
2120 * ****************************************************************/
2122 uint8_t duUpdateDuUeCbCfg(uint8_t ueIdx, uint8_t cellId)
2124 uint8_t ret = ROK, cellIdx = 0, crnti=0;
2125 DuUeCb *ueCb = NULLP;
2127 GET_CELL_IDX(cellId, cellIdx);
2129 if((duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].macUeCfg. \
2130 macUeCfgState == UE_RECFG_COMPLETE) &&
2131 (duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].rlcUeCfg. \
2132 rlcUeCfgState == UE_RECFG_COMPLETE))
2134 ueCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1];
2136 /*Filling RLC Ue Cfg */
2137 ueCb->rlcUeCfg.cellId = cellId;
2138 ueCb->rlcUeCfg.ueIdx = ueIdx;
2139 ret = duUpdateRlcLcCfg(&ueCb->rlcUeCfg, ueCb->f1UeDb);
2142 /*Filling MAC Ue Cfg */
2143 GET_CRNTI(crnti, ueIdx);
2144 ueCb->macUeCfg.cellId = cellId;
2145 ueCb->macUeCfg.ueIdx = ueIdx;
2146 ueCb->macUeCfg.crnti = crnti;
2147 ret = duUpdateMacCfg(&ueCb->macUeCfg, ueCb->f1UeDb);
2149 DU_LOG("\nERROR --> DU APP : Failed while updating MAC LC Config at duUpdateDuUeCbCfg()");
2152 if(duUpdateTunnelCfgDb(ueIdx, cellId, &ueCb->f1UeDb->duUeCfg) != ROK)
2154 DU_LOG("\nERROR --> DU_APP : Failed to establish tunnel in duUpdateDuUeCbCfg()");
2160 DU_LOG("\nERROR --> DU APP : Failed while updating RLC LC Config at duUpdateDuUeCbCfg()");
2167 /*******************************************************************
2169 * @brief Handle UE config response from MAC
2173 * Function : DuProcMacUeCfgRsp
2175 * Functionality: Handle UE Config response from MAC
2177 * @params[in] Pointer to MacUeCfgRsp and Pst
2178 * @return ROK - success
2181 * ****************************************************************/
2182 uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp)
2188 if(cfgRsp->result == MAC_DU_APP_RSP_OK)
2190 if(pst->event == EVENT_MAC_UE_CREATE_RSP)
2192 DU_LOG("\nINFO --> DU APP : MAC UE Create Response : SUCCESS [UE IDX : %d]", cfgRsp->ueIdx);
2193 duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\
2194 macUeCfg.macUeCfgState = UE_CREATE_COMPLETE;
2196 else if(pst->event == EVENT_MAC_UE_RECONFIG_RSP)
2198 DU_LOG("\nINFO --> DU APP : MAC UE Reconfig Response : SUCCESS [UE IDX : %d]", cfgRsp->ueIdx);
2199 duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\
2200 macUeCfg.macUeCfgState = UE_RECFG_COMPLETE;
2201 if((ret = duUpdateDuUeCbCfg(cfgRsp->ueIdx, cfgRsp->cellId)) == ROK)
2203 BuildAndSendUeCtxtRsp(cfgRsp->cellId, cfgRsp->ueIdx);
2209 DU_LOG("\nERROR --> DU APP : MAC UE CFG Response for EVENT[%d]: FAILURE [UE IDX : %d]", pst->event, cfgRsp->ueIdx);
2210 if(pst->event == EVENT_MAC_UE_RECONFIG_RSP)
2212 //TODO: Send the failure case in Ue Context Setup Response
2216 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCfgRsp));
2220 DU_LOG("\nERROR --> DU APP : Received MAC Ue Config Response is NULL at DuProcMacUeCfgRsp()");
2227 /*******************************************************************
2229 * @brief Processes UE create Req to RLC UL
2233 * Function : duBuildAndSendUeCreateReqToRlc
2236 * Processes UE create Req to RLC UL
2238 * @params[in] cellId,
2240 * Pointer to RlcUeCfg
2241 * @return ROK - success
2244 *****************************************************************/
2246 uint8_t duBuildAndSendUeCreateReqToRlc(uint16_t cellId, uint8_t ueIdx,\
2247 RlcUeCfg *duRlcUeCfg)
2250 RlcUeCfg *rlcUeCfg = NULLP;
2253 ret = fillRlcUeCfg(cellId, ueIdx, NULL, duRlcUeCfg);
2256 DU_LOG("\nERROR --> DU APP : Failed to fill Rlc Ue Cfg at duBuildAndSendUeCreateReqToRlc()");
2260 FILL_PST_DUAPP_TO_RLC(pst, RLC_UL_INST, EVENT_RLC_UE_CREATE_REQ);
2261 /* Copying ueCfg to a sharable buffer */
2262 DU_ALLOC_SHRABL_BUF(rlcUeCfg, sizeof(RlcUeCfg));
2265 memset(rlcUeCfg, 0, sizeof(RlcUeCfg));
2266 memcpy(rlcUeCfg, duRlcUeCfg, sizeof(RlcUeCfg));
2267 /* Processing one Ue at a time to RLC */
2268 DU_LOG("\nDEBUG --> DU_APP: Sending UE create request to RLC UL");
2269 ret = (*packRlcUeCreateReqOpts[pst.selector])(&pst, rlcUeCfg);
2272 DU_LOG("\nERROR --> DU_APP : Failure in sending Ue Create Req to RLC");
2273 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rlcUeCfg, sizeof(RlcUeCfg));
2279 DU_LOG("\n ERROR --> DU APP : Memory alloc failed at duBuildAndSendUeCreateReqToRlc()");
2285 /*******************************************************************
2287 * @brief Processes UE create Rsp received from RLC UL
2292 * Function : DuProcRlcUeCfgRsp
2295 * Processes UE create Rsp received from RLC UL
2297 * @params[in] Post structure
2298 * Pointer to RlcCfgCfm
2299 * @return ROK - success
2302 *****************************************************************/
2303 uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp)
2309 if(cfgRsp->result == RLC_DU_APP_RSP_OK)
2311 if(pst->event == EVENT_RLC_UE_CREATE_RSP)
2313 DU_LOG("\nINFO --> DU_APP: RLC UE Create Response : SUCCESS [UE IDX:%d]", cfgRsp->ueIdx);
2314 duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\
2315 rlcUeCfg.rlcUeCfgState = UE_CREATE_COMPLETE;
2317 else if(pst->event == EVENT_RLC_UE_RECONFIG_RSP)
2319 DU_LOG("\nINFO --> DU_APP: RLC UE Reconfig Response : SUCCESS [UE IDX:%d]", cfgRsp->ueIdx);
2320 duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\
2321 rlcUeCfg.rlcUeCfgState = UE_RECFG_COMPLETE;
2322 if((ret = duUpdateDuUeCbCfg(cfgRsp->ueIdx, cfgRsp->cellId)) == ROK)
2324 BuildAndSendUeCtxtRsp(cfgRsp->cellId, cfgRsp->ueIdx);
2330 DU_LOG("\nERROR --> DU_APP: RLC UE CFG Response for EVENT[%d] : FAILED [UE IDX : %d, REASON :%d]",\
2331 pst->event, cfgRsp->ueIdx, cfgRsp->reason);
2332 if((pst->event == EVENT_RLC_UE_RECONFIG_RSP))
2334 //TODO: update failure case in ue Context setup Response
2338 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCfgRsp));
2342 DU_LOG("\nERROR --> DU_APP: Received RLC Ue Config Response is NULL at DuProcRlcUeCfgRsp()");
2348 /*******************************************************************
2350 * @brief Builds and Send Ue Reconfig Req to RLC
2354 * Function : duBuildAndSendUeReCfgReqToRLC
2356 * Functionality: Builds and Send Ue Reconfig Req to RLC
2358 * @params[in] cellId, crnti
2360 * RlcUeCfg *rlcUeCfg
2361 * @return ROK - success
2364 * ****************************************************************/
2366 uint8_t duBuildAndSendUeReCfgReqToRlc(uint8_t cellId, uint8_t crnti, DuUeCfg *ueCfgDb)
2368 uint8_t ret = ROK, ueIdx = 0;
2369 RlcUeCfg *rlcUeCfg = NULLP;
2371 GET_UE_IDX(crnti, ueIdx);
2372 DU_ALLOC_SHRABL_BUF(rlcUeCfg, sizeof(RlcUeCfg));
2375 memset(rlcUeCfg, 0, sizeof(RlcUeCfg));
2376 ret = fillRlcUeCfg(cellId, ueIdx, ueCfgDb, rlcUeCfg);
2378 DU_LOG("\nERROR --> DU APP : Failed at duBuildAndSendUeReCfgReqToRlc()");
2380 ret = sendUeReCfgReqToRlc(rlcUeCfg);
2384 DU_LOG("\nERROR --> DU APP : Memory Alloc failed at duBuildAndSendUeReCfgReqToRlc()");
2390 /*******************************************************************
2392 * @brief Builds and Send Ue Reconfig Req to MAC
2396 * Function : duBuildAndSendUeReCfgReqToMac
2398 * Functionality: Builds and Send Ue Reconfig Req to MAC
2400 * @params[in] CellGroupConfigRrc_t *macCellGrpCfg
2402 * MacUeCfg *macUeCfg
2403 * @return ROK - success
2406 * ****************************************************************/
2408 uint8_t duBuildAndSendUeReCfgReqToMac(uint8_t cellId, uint8_t crnti, DuUeCfg *ueCfgDb)
2410 uint8_t ret, ueIdx = 0;
2411 MacUeCfg *macUeCfg = NULLP;
2414 GET_UE_IDX(crnti, ueIdx);
2416 DU_ALLOC_SHRABL_BUF(macUeCfg, sizeof(MacUeCfg));
2419 memset(macUeCfg, 0, sizeof(MacUeCfg));
2420 ret = fillMacUeCfg(cellId, ueIdx, crnti, ueCfgDb, macUeCfg);
2422 DU_LOG("\nERROR --> DU APP : Failed to fill Mac Ue Cfg at duBuildAndSendUeReCfgReqToMac()");
2424 ret = sendUeReCfgReqToMac(macUeCfg);
2428 DU_LOG("\nERROR --> DU APP : Memory alloc failed for macUeCfg at duBuildAndSendUeReCfgReqToMac()");
2434 /*******************************************************************
2436 * @brief Build and Send Ue context setup request
2441 * Function : duBuildAndSendUeContextSetupReq
2444 * Build and Send Ue context setup request
2446 * @params[in] cellId, crnti, DuUeCfg pointer
2447 * @return ROK - success
2450 *****************************************************************/
2452 uint8_t duBuildAndSendUeContextSetupReq(uint16_t cellId, uint16_t crnti, DuUeCfg *duUeCfg)
2456 DU_LOG("\nDEBUG --> DU_APP: Processing Ue Context Setup Request for cellId [%d]", cellId);
2457 /* Filling RLC Ue Reconfig */
2458 ret = duBuildAndSendUeReCfgReqToRlc(cellId, crnti, duUeCfg);
2460 DU_LOG("\nERROR --> DU APP : Failed to build ctxt setup req for RLC at duBuildAndSendUeContextSetupReq()");
2462 /* Filling MAC Ue Reconfig */
2463 ret = duBuildAndSendUeReCfgReqToMac(cellId, crnti, duUeCfg);
2465 DU_LOG("\nERROR --> DU APP : Failed at build ctxt setup req for MAC at duBuildAndSendUeContextSetupReq()");
2470 /*******************************************************************
2472 * @brief Processes DL Rsp received from RLC DL
2477 * Function : DuProcRlcDlRrcMsgRsp
2480 * Processes UE Rsp received from RLC DL
2482 * @params[in] Post structure
2483 * Pointer to RlcCfgCfm
2484 * @return ROK - success
2487 *****************************************************************/
2488 uint8_t DuProcRlcDlRrcMsgRsp(Pst *pst, RlcDlRrcMsgRsp *dlRrcMsg)
2490 uint8_t ret = ROK, ueIdx = 0;
2491 DuUeCb *ueCb = NULLP;
2493 if(dlRrcMsg->state == TRANSMISSION_COMPLETE)
2495 GET_UE_IDX(dlRrcMsg->crnti, ueIdx);
2496 ueCb = &duCb.actvCellLst[dlRrcMsg->cellId -1]->ueCb[ueIdx -1];
2497 if(ueCb->f1UeDb && ueCb->f1UeDb->dlRrcMsgPres)
2499 if(ueCb->f1UeDb->actionType == UE_CTXT_SETUP)
2501 ret = duBuildAndSendUeContextSetupReq(dlRrcMsg->cellId, dlRrcMsg->crnti, &ueCb->f1UeDb->duUeCfg);
2503 DU_LOG("\nERROR --> DU APP : Failed to process UE Context Setup Request in DuProcRlcDlRrcMsgRsp()");
2505 if(ueCb->f1UeDb->actionType == UE_CTXT_MOD)
2507 ret = duBuildAndSendUeContextModReq(dlRrcMsg->cellId, dlRrcMsg->crnti, &ueCb->f1UeDb->duUeCfg);
2509 DU_LOG("\nERROR --> DU APP : Failed to process UE Context Mod Request in DuProcRlcDlRrcMsgRsp()");
2511 if(ueCb->f1UeDb->actionType == UE_CTXT_RELEASE)
2513 ret = duBuildAndSendUeDeleteReq(dlRrcMsg->cellId,dlRrcMsg->crnti);
2516 DU_LOG("\nERROR --> DU APP : Failed to process UE Context Release Request in DuProcRlcDlRrcMsgRsp()");
2523 DU_LOG("\nERROR --> DU APP : Failed to transmit DL RRC Msg");
2525 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlRrcMsg, sizeof(RlcDlRrcMsgRsp));
2528 /*******************************************************************
2530 * @brief Process UE context setup request from CU
2534 * Function : duProcUeContextSetupRequest
2536 * Functionality: Process UE context setup request from CU
2538 * @params[in] F1AP message
2539 * @return ROK - success
2542 * ****************************************************************/
2544 uint8_t duProcUeContextSetupRequest(DuUeCb *ueCb)
2546 uint8_t ret, cellId;
2551 cellId = duCb.actvCellLst[ueCb->f1UeDb->cellIdx]->cellId;
2552 /* Send DL RRC msg for security Mode */
2553 if(ueCb->f1UeDb->dlRrcMsg)
2555 if(ueCb->f1UeDb->dlRrcMsg->rrcMsgPdu)
2557 /* Sending DL RRC Message to RLC */
2558 ret = duBuildAndSendDlRrcMsgToRlc(cellId, ueCb->rlcUeCfg, ueCb->f1UeDb->dlRrcMsg);
2561 DU_LOG("\nERROR --> DU APP : Failed to send DL RRC msg in duProcUeContextSetupRequest()");
2562 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCb->f1UeDb->dlRrcMsg->rrcMsgPdu,\
2563 ueCb->f1UeDb->dlRrcMsg->rrcMsgSize);
2564 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
2568 else if(ueCb->f1UeDb->actionType == UE_CTXT_SETUP)
2570 ret = duBuildAndSendUeContextSetupReq(cellId, ueCb->crnti, &ueCb->f1UeDb->duUeCfg);
2573 DU_LOG("\nERROR --> DU APP : Failed to build ue context setup Req in duProcUeContextSetupRequest()");
2579 //TODO: To send the failure cause in UeContextSetupRsp
2580 DU_LOG("ERROR --> DU APP : Failed to process UE CNTXT SETUP REQ at duProcUeContextSetupRequest()");
2585 /*******************************************************************
2587 * @brief Build and Send Ue context mod request
2592 * Function : duBuildAndSendUeContextModReq
2595 * Build and Send Ue context mod request
2597 * @params[in] cellId, crnti, DuUeCfg pointer
2598 * @return ROK - success
2601 *****************************************************************/
2603 uint8_t duBuildAndSendUeContextModReq(uint16_t cellId, uint16_t crnti, DuUeCfg *duUeCfg)
2607 DU_LOG("\nDEBUG --> DU_APP: Processing Ue Context Mod Request for cellId [%d]", cellId);
2608 /* Filling RLC Ue Reconfig */
2609 ret = duBuildAndSendUeReCfgReqToRlc(cellId, crnti, duUeCfg);
2611 DU_LOG("\nERROR --> DU APP : Failed to build ctxt setup req for RLC at duBuildAndSendUeContextModReq()");
2613 /* Filling MAC Ue Reconfig */
2614 ret = duBuildAndSendUeReCfgReqToMac(cellId, crnti, duUeCfg);
2616 DU_LOG("\nERROR --> DU APP : Failed at build ctxt setup req for MAC at duBuildAndSendUeContextModReq()");
2620 /*******************************************************************
2622 * @brief Processing Ue context mod request
2627 * Function : duProcUeContextModReq
2630 * Processing Ue context mod request
2632 * @params[in] DuUeCb *ueCb
2633 * @return ROK - success
2636 *****************************************************************/
2638 uint8_t duProcUeContextModReq(DuUeCb *ueCb)
2640 uint8_t ret, cellId;
2645 cellId = duCb.actvCellLst[ueCb->f1UeDb->cellIdx]->cellId;
2646 /* Send DL RRC msg for security Mode */
2647 if(ueCb->f1UeDb->dlRrcMsg)
2649 if(ueCb->f1UeDb->dlRrcMsg->rrcMsgPdu)
2651 /* Sending DL RRC Message to RLC */
2652 ret = duBuildAndSendDlRrcMsgToRlc(cellId, ueCb->rlcUeCfg, ueCb->f1UeDb->dlRrcMsg);
2655 DU_LOG("\nERROR --> DU APP : Failed to send DL RRC msg in duProcUeContextModReq()");
2656 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCb->f1UeDb->dlRrcMsg->rrcMsgPdu,\
2657 ueCb->f1UeDb->dlRrcMsg->rrcMsgSize);
2658 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
2664 ret = duBuildAndSendUeContextModReq(cellId, ueCb->crnti, &ueCb->f1UeDb->duUeCfg);
2667 DU_LOG("\nERROR --> DU APP : Failed to build ue context setup Req in duProcUeContextModReq()");
2673 //TODO: To send the failure cause in UeContextModRsp
2674 DU_LOG("ERROR --> DU APP : Failed to process UE CNTXT MOD REQ at duProcUeContextModReq()");
2679 /*******************************************************************
2681 * @brief Function to delete Pdsch ServCellCfg
2685 * Function : deletePdschServCellCfg
2687 * Functionality: Function to delete Pdsch ServCellCfg
2689 * @params[in] PdschServCellCfg *pdschServCellCfg
2692 * ****************************************************************/
2694 void deletePdschServCellCfg(PdschServCellCfg *pdschServCellCfg)
2696 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,pdschServCellCfg->maxMimoLayers, sizeof(uint8_t));
2697 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,pdschServCellCfg->maxCodeBlkGrpPerTb, sizeof(MaxCodeBlkGrpPerTB));
2698 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,pdschServCellCfg->codeBlkGrpFlushInd, sizeof(bool));
2699 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,pdschServCellCfg->xOverhead, sizeof(PdschXOverhead));
2702 /*******************************************************************
2704 * @brief delete MacUeCfg from duCb
2708 * Function : deleteMacUeCfg
2710 * Functionality: delete MacUeCfg from duCb
2712 * @params[in] Pointer to MacUeCfg
2713 * @return ROK - success
2716 *******************************************************************/
2718 void deleteMacUeCfg(MacUeCfg *ueCfg)
2722 ServCellCfgInfo *servCellCfg;
2723 PucchResrcInfo *resrcToAddModList;
2727 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,ueCfg->ambrCfg, sizeof(AmbrCfg));
2728 if(ueCfg->spCellCfgPres)
2730 servCellCfg = &ueCfg->spCellCfg.servCellCfg;
2731 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->bwpInactivityTmr, sizeof(uint8_t));
2732 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.resrcSet,\
2733 sizeof(PucchResrcSetCfg));
2734 if(servCellCfg->initUlBwp.pucchCfg.resrc)
2736 /*freeing the PucchResrcCfg*/
2737 for(resrcIdx= 0; resrcIdx< servCellCfg->initUlBwp.pucchCfg.resrc->resrcToAddModListCount; resrcIdx++)
2739 resrcToAddModList=&servCellCfg->initUlBwp.pucchCfg.resrc->resrcToAddModList[resrcIdx];
2740 switch(resrcToAddModList->pucchFormat)
2742 case PUCCH_FORMAT_0:
2744 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,resrcToAddModList->PucchFormat.format0 ,\
2745 sizeof(PucchFormat0));
2748 case PUCCH_FORMAT_1:
2750 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,resrcToAddModList->PucchFormat.format1 ,\
2751 sizeof(PucchFormat1));
2754 case PUCCH_FORMAT_2:
2756 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,resrcToAddModList->PucchFormat.format2 ,\
2757 sizeof(PucchFormat2_3));
2760 case PUCCH_FORMAT_3:
2762 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,resrcToAddModList->PucchFormat.format3 ,\
2763 sizeof(PucchFormat2_3));
2766 case PUCCH_FORMAT_4:
2768 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,resrcToAddModList->PucchFormat.format4 ,\
2769 sizeof(PucchFormat4));
2774 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.resrc,\
2775 sizeof(PucchResrcCfg));
2777 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.format1,\
2778 sizeof(PucchFormatCfg));
2779 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.format2,\
2780 sizeof(PucchFormatCfg));
2781 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.format3,\
2782 sizeof(PucchFormatCfg));
2783 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.format4,\
2784 sizeof(PucchFormatCfg));
2785 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.schedReq,\
2786 sizeof(PucchSchedReqCfg));
2787 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.multiCsiCfg,\
2788 sizeof(PucchMultiCsiCfg));
2789 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.spatialInfo,\
2790 sizeof(PucchSpatialCfg));
2791 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.dlDataToUlAck ,\
2792 sizeof(PucchDlDataToUlAck));
2793 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.powerControl,\
2794 sizeof(PucchPowerControl));
2795 deletePdschServCellCfg(&servCellCfg->pdschServCellCfg);
2797 for(lcCfgIdx=0; lcCfgIdx< ueCfg->numLcs; lcCfgIdx++)
2799 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,ueCfg->lcCfgList[lcCfgIdx].drbQos, sizeof(DrbQosInfo));
2800 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,ueCfg->lcCfgList[lcCfgIdx].snssai, sizeof(Snssai));
2803 memset(ueCfg, 0, sizeof(MacUeCfg));
2806 /*******************************************************************
2808 * @brief delete UE Configuration of a particular UE
2812 * Function : deleteUeCfg
2814 * Functionality: delete UE Configuration of a particular UE
2816 * @params[in] uint16_t cellIdx, uint8_t ueIdx
2817 * @return ROK - success
2820 * ****************************************************************/
2821 uint8_t deleteUeCfg(uint16_t cellIdx, uint8_t ueIdx)
2823 DuUeCb *ueCb = NULLP;
2824 if(duCb.actvCellLst[cellIdx] != NULLP)
2826 if((duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].macUeCfg.macUeCfgState == UE_DELETE_COMPLETE)\
2827 &&(duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].rlcUeCfg.rlcUeCfgState == UE_DELETE_COMPLETE))
2829 ueCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1];
2830 deleteMacUeCfg(&ueCb->macUeCfg);
2831 deleteRlcUeCfg(&ueCb->rlcUeCfg);
2832 if(ueCb->f1UeDb !=NULLP)
2834 freeF1UeDb(ueCb->f1UeDb);
2836 duCb.actvCellLst[cellIdx]->numActvUes--;
2837 memset(ueCb, 0, sizeof(DuUeCb));
2846 DU_LOG("\nERROR --> DU APP : deleteUeCfg(): CellIdx[%d] is not found", cellIdx);
2853 /*******************************************************************
2855 * @brief Handle UE delete response from MAC
2859 * Function : DuProcMacUeDeleteRsp
2861 * Functionality: Handle UE delete response from MAC
2863 * @params[in] Pointer to MacUeDeleteRsp and Pst
2864 * @return ROK - success
2867 * ****************************************************************/
2869 uint8_t DuProcMacUeDeleteRsp(Pst *pst, MacUeDeleteRsp *deleteRsp)
2876 if(deleteRsp->result == SUCCESS)
2878 DU_LOG("\nINFO --> DU APP : MAC UE Delete Response : SUCCESS [UE IDX : %d]", deleteRsp->ueId);
2879 GET_CELL_IDX(deleteRsp->cellId, cellIdx);
2880 if(duCb.actvCellLst[cellIdx])
2882 duCb.actvCellLst[cellIdx]->ueCb[deleteRsp->ueId -1].macUeCfg.macUeCfgState = UE_DELETE_COMPLETE;
2883 if(sendUeDeleteReqToRlc(deleteRsp->cellId, deleteRsp->ueId) == RFAILED)
2885 DU_LOG("\nERROR --> DU APP : DuProcMacUeDeleteRsp():Failed to build UE delete req for RLC ");
2892 DU_LOG("\nERROR --> DU APP : DuProcMacUeDeleteRsp(): MAC UE Delete Response : FAILURE [UE IDX : %d]",\
2896 DU_FREE_SHRABL_BUF(pst->region, pst->pool, deleteRsp, sizeof(MacUeDeleteRsp));
2900 DU_LOG("\nERROR --> DU APP : DuProcMacUeDeleteRsp(): MAC UE Delete Response is null");
2906 /*******************************************************************
2908 * @brief Processes UE Delete Rsp received from RLC
2912 * Function : DuProcRlcUeDeleteRsp
2915 * Processes UE Delete Rsp received from RLC
2917 * @params[in] Post structure
2918 * Pointer to RlcUeDeleteRsp
2919 * @return ROK - success
2922 * *****************************************************************/
2924 uint8_t DuProcRlcUeDeleteRsp(Pst *pst, RlcUeDeleteRsp *delRsp)
2926 uint8_t ueId = 0, ret = ROK;
2927 uint16_t cellIdx = 0;
2928 uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId =0;
2932 ueId = delRsp->ueId;
2933 GET_CELL_IDX(delRsp->cellId, cellIdx);
2935 if(delRsp->result == SUCCESSFUL)
2937 DU_LOG("\nINFO --> DU_APP: RLC UE Delete Response : SUCCESS [UE IDX:%d]", ueId);
2938 if(duCb.actvCellLst[cellIdx]!=NULLP)
2940 duCb.actvCellLst[cellIdx]->ueCb[ueId-1].rlcUeCfg.rlcUeCfgState = UE_DELETE_COMPLETE;
2941 gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbDuUeF1apId;
2942 gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbCuUeF1apId;
2943 if(deleteUeCfg(cellIdx, ueId) == ROK)
2945 ret = BuildAndSendUeContextReleaseComplete(delRsp->cellId, gnbCuUeF1apId, gnbDuUeF1apId);
2948 DU_LOG("\nERROR --> DU APP : DuProcMacUeDeleteRsp(): failed to send UE context release complete");
2955 DU_LOG("\nERROR --> DU_APP: RLC UE Delete Response : FAILED [UE IDX:%d]", ueId);
2958 DU_FREE_SHRABL_BUF(pst->region, pst->pool, delRsp, sizeof(RlcUeDeleteRsp));
2964 /*******************************************************************
2966 * @brief Sending UE Delete Req To Mac
2970 * Function : sendUeDeleteReqToMac
2973 * sending UE Delete Req To Mac
2975 * @params[in] cellId, ueId, crnti
2976 * @return ROK - success
2979 *****************************************************************/
2981 uint8_t sendUeDeleteReqToMac(uint16_t cellId, uint8_t ueId, uint16_t crnti)
2985 MacUeDelete *ueDelete = NULLP;
2987 DU_ALLOC_SHRABL_BUF(ueDelete, sizeof(MacUeDelete));
2990 ueDelete->cellId = cellId;
2991 ueDelete->ueId = ueId;
2992 ueDelete->crnti = crnti;
2993 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_DELETE_REQ);
2995 DU_LOG("\nDEBUG --> DU_APP: Sending UE delete Request to MAC ");
2996 ret = (*packMacUeDeleteReqOpts[pst.selector])(&pst, ueDelete);
2999 DU_LOG("\nERROR --> DU_APP: sendUeDeleteReqToMac(): Failed to send UE delete Req to MAC");
3000 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueDelete, sizeof(MacUeDelete));
3005 DU_LOG("\nERROR --> DU_APP: sendUeDeleteReqToMac(): Failed to allocate memory");
3011 /*******************************************************************
3013 * @brief Sending UE Delete Req To Rlc
3017 * Function : sendUeDeleteReqToRlc
3020 * Sending UE Delete Req To Rlc
3022 * @params[in] cellId, ueId
3023 * @return ROK - success
3026 *****************************************************************/
3028 uint8_t sendUeDeleteReqToRlc(uint16_t cellId, uint8_t ueId)
3032 RlcUeDelete *ueDelete;
3034 DU_ALLOC_SHRABL_BUF(ueDelete, sizeof(RlcUeDelete));
3035 if(ueDelete !=NULLP)
3037 ueDelete->cellId = cellId;
3038 ueDelete->ueId = ueId;
3039 FILL_PST_DUAPP_TO_RLC(pst, RLC_UL_INST, EVENT_RLC_UE_DELETE_REQ);
3041 ret = (*packRlcUeDeleteReqOpts[pst.selector])(&pst, ueDelete);
3044 DU_LOG("\nERROR --> DU_APP : sendUeDeleteReqToRlc():Failed to send UE Delete Req to RLC");
3045 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueDelete, sizeof(RlcUeDelete));
3050 DU_LOG("\nERROR --> DU_APP: sendUeDeleteReqToRlc():Memory allocation failed");
3056 /*******************************************************************
3058 * @brief DU processes UE delete req from CU and sends to MAC and RLC
3062 * Function : duBuildAndSendUeDeleteReq
3064 * Functionality: DU processes UE delete req from CU and sends to MAC
3067 * @params[in] cellId, crnti
3068 * @return ROK - success
3071 * ****************************************************************/
3073 uint8_t duBuildAndSendUeDeleteReq(uint16_t cellId, uint16_t crnti)
3076 uint16_t cellIdx = 0;
3078 DU_LOG("\nDEBUG --> DU_APP: Processing UE Delete Request ");
3079 GET_CELL_IDX(cellId, cellIdx);
3080 GET_UE_IDX(crnti, ueId);
3082 if(duCb.actvCellLst[cellIdx] != NULLP)
3084 if(crnti != duCb.actvCellLst[cellIdx]->ueCb[ueId - 1].crnti)
3086 DU_LOG("\nERROR --> DU APP : duBuildAndSendUeDeleteReq(): CRNTI [%d] not found", crnti);
3090 if(sendUeDeleteReqToMac(cellId, ueId, crnti) == RFAILED)
3092 DU_LOG("\nERROR --> DU APP : duBuildAndSendUeDeleteReq(): Failed to build UE delete req for MAC ");
3098 DU_LOG("\nERROR --> DU APP : duBuildAndSendUeDeleteReq(): Cell Id is not found");
3105 /*******************************************************************
3107 * @brief delete RlcUeCfg from duCb
3111 * Function : deleteRlcUeCfg
3114 * delete RlcUeCfg from duCb
3116 * @params[in] RlcUeCfg *ueCfg
3118 * @return ROK - success
3121 *****************************************************************/
3123 void deleteRlcUeCfg(RlcUeCfg *ueCfg)
3126 RlcBearerCfg *lcCfg= NULLP;
3129 for(lcIdx =0 ; lcIdx < ueCfg->numLcs ; lcIdx++)
3131 lcCfg = &ueCfg->rlcLcCfg[lcIdx];
3132 switch(lcCfg->rlcMode)
3136 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.amCfg, sizeof(AmBearerCfg));
3139 case RLC_UM_BI_DIRECTIONAL :
3141 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
3144 case RLC_UM_UNI_DIRECTIONAL_UL :
3146 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
3149 case RLC_UM_UNI_DIRECTIONAL_DL :
3151 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
3156 memset(ueCfg, 0, sizeof(RlcUeCfg));
3160 /*******************************************************************
3162 * @brief Delete DU CellCb information
3166 * Function : deleteDuCellCb
3168 * Functionality: Delete DU CellCb information
3170 * @params[in] DuCellCb *cellCb
3171 * @return ROK - success
3174 * ****************************************************************/
3176 void deleteDuCellCb(DuCellCb *cellCb)
3179 if(cellCb->duMacCellCfg)
3181 if(cellCb->duMacCellCfg->prachCfg.fdm[0].unsuedRootSeq)
3183 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cellCb->duMacCellCfg->prachCfg.fdm[0].unsuedRootSeq,\
3184 cellCb->duMacCellCfg->prachCfg.fdm[0].numUnusedRootSeq);
3186 if(cellCb->duMacCellCfg->sib1Cfg.sib1Pdu)
3188 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,cellCb->duMacCellCfg->sib1Cfg.sib1Pdu,\
3189 cellCb->duMacCellCfg->sib1Cfg.sib1PduLen);
3191 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cellCb->duMacCellCfg, sizeof(MacCellCfg));
3193 memset(cellCb, 0, sizeof(DuCellCb));
3197 /*******************************************************************
3199 * @brief Handle Cell delete response from MAC
3203 * Function : DuProcMacCellDeleteRsp
3205 * Functionality: Handle Cell delete response from MAC
3207 * @params[in] Pointer to MacCellDeleteRsp and Pst
3208 * @return ROK - success
3211 * ****************************************************************/
3213 uint8_t DuProcMacCellDeleteRsp(Pst *pst, MacCellDeleteRsp *deleteRsp)
3219 if(deleteRsp->result == SUCCESSFUL_RSP)
3221 GET_CELL_IDX(deleteRsp->cellId, cellIdx);
3222 DU_LOG("\nINFO --> DU APP : MAC CELL Delete Response : SUCCESS [CELL IDX : %d]", deleteRsp->cellId);
3223 if(duCb.actvCellLst[cellIdx]->cellId == deleteRsp->cellId)
3225 deleteDuCellCb(duCb.actvCellLst[cellIdx]);
3226 gCellStatus = CELL_DOWN;
3227 duCb.numActvCells--;
3228 DU_FREE(duCb.actvCellLst[cellIdx], sizeof(DuCellCb));
3232 DU_LOG("\nERROR --> DU APP : DuProcMacCellDeleteRsp(): CellId [%d] doesnot exist", deleteRsp->cellId);
3238 DU_LOG("\nERROR --> DU APP : DuProcMacCellDeleteRsp(): MAC CELL Delete Response : FAILED\
3239 [CELL IDX : %d]", deleteRsp->cellId);
3242 DU_FREE_SHRABL_BUF(pst->region, pst->pool, deleteRsp, sizeof(MacCellDeleteRsp));
3246 DU_LOG("\nERROR --> DU APP : DuProcMacCellDeleteRsp(): Received MAC cell delete response is NULL");
3252 /*******************************************************************
3254 * @brief Sending Cell Delete Req To Mac
3258 * Function : sendCellDeleteReqToMac
3261 * sending Cell Delete Req To Mac
3263 * @params[in] uint16_t cellId
3264 * @return ROK - success
3268 *****************************************************************/
3270 uint8_t sendCellDeleteReqToMac(uint16_t cellId)
3274 MacCellDelete *cellDelete = NULLP;
3276 DU_ALLOC(cellDelete, sizeof(MacCellDelete));
3279 cellDelete->cellId = cellId;
3280 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_DELETE_REQ);
3282 DU_LOG("\nINFO --> DU APP : Sending Cell Delete Request to MAC");
3283 /* Processing one Cell at a time to MAC */
3284 ret = (*packMacCellDeleteReqOpts[pst.selector])(&pst, cellDelete);
3287 DU_LOG("\nERROR --> DU APP : sendCellDeleteReqToMac(): Failed to send Cell delete Req to MAC");
3288 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cellDelete, sizeof(MacCellDelete));
3293 DU_LOG("\nERROR --> DU APP : sendCellDeleteReqToMac(): Failed to allocate memory");
3299 /*******************************************************************
3301 * @brief DU preocess Cell Delete Req to MAC
3305 * Function : duSendCellDeletReq
3307 * Functionality: DU process Cell Delete Req to MAC
3309 * @params[in] uint16_t cellId
3310 * @return ROK - success
3313 * ****************************************************************/
3315 uint8_t duSendCellDeletReq(uint16_t cellId)
3317 uint16_t cellIdx = 0;
3318 DU_LOG("\nINFO --> DU APP : Processing Cell Delete Request ");
3319 GET_CELL_IDX(cellId, cellIdx);
3321 if(duCb.actvCellLst[cellIdx] == NULLP)
3323 DU_LOG("\nERROR --> DU APP : duSendCellDeletReq(): CellId[%d] is not found", cellId);
3327 if(duCb.actvCellLst[cellIdx]->cellId != cellId)
3329 DU_LOG("\nERROR --> DU APP : duSendCellDeletReq(): CellId[%d] is not found", cellId);
3334 if(duCb.actvCellLst[cellIdx]->cellStatus != DELETION_IN_PROGRESS)
3336 DU_LOG("\nERROR --> DU APP : duSendCellDeletReq(): CellStatus[%d] of cellId[%d] is not correct.\
3337 Expected CellStatus is DELETION_IN_PROGRESS",duCb.actvCellLst[cellIdx]->cellStatus, cellId);
3341 if(duCb.actvCellLst[cellIdx]->numActvUes)
3343 DU_LOG("\nERROR --> DU APP : duSendCellDeletReq(): Active UEs still present in cellId[%d].\
3344 Failed to delete cell", cellId);
3348 if(duBuildAndSendMacCellStop(cellId) == RFAILED)
3350 DU_LOG("\nERROR --> DU APP : duSendCellDeletReq(): Failed to build and send cell stop request to MAC for\
3351 cellId[%d]",cellId);
3355 if(sendCellDeleteReqToMac(cellId) == RFAILED)
3357 DU_LOG("\nERROR --> DU APP : duSendCellDeletReq(): Failed to send Cell delete req to MAC for\
3358 cellId[%d]",cellId);
3364 /*******************************************************************
3366 * @brief Du process Ue Context Release Command
3370 * Function : duProcUeContextReleaseCommand
3372 * Functionality: Du process Ue Context Release Command
3374 * @params[in] DuUeCb *duUeCb
3375 * @return ROK - success
3378 * ****************************************************************/
3379 uint8_t duProcUeContextReleaseCommand(DuUeCb *duUeCb)
3381 uint8_t ret =ROK, ueIdx=0;
3382 uint16_t cellId=0,crnti =0;
3385 DU_LOG("\nERROR --> DU APP : duProcUeContextReleaseCommand() : duUeCb is null");
3388 if(duUeCb->f1UeDb == NULLP)
3390 DU_LOG("\nERROR --> DU APP : duProcUeContextReleaseCommand() : f1UeDb is null");
3394 cellId = duCb.actvCellLst[duUeCb->f1UeDb->cellIdx]->cellId;
3395 crnti = duUeCb->crnti;
3396 /* Send DL RRC msg for RRC release */
3397 if(duUeCb->f1UeDb->dlRrcMsg)
3399 if(duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu != NULLP)
3401 ret = duBuildAndSendDlRrcMsgToRlc(cellId, duCb.actvCellLst[duUeCb->f1UeDb->cellIdx]->ueCb[ueIdx].rlcUeCfg,\
3402 duUeCb->f1UeDb->dlRrcMsg);
3405 DU_LOG("\nERROR --> DU APP : duProcUeContextReleaseCommand() : Failed to send DL RRC msg");
3406 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu,\
3407 duUeCb->f1UeDb->dlRrcMsg->rrcMsgSize);
3408 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
3414 ret = duBuildAndSendUeDeleteReq(cellId,crnti);
3417 DU_LOG("\nERROR --> DU APP : duProcUeContextReleaseCommand(): Failed to build and send Ue Delete request");
3423 /**********************************************************************
3425 ***********************************************************************/