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"
30 #include "du_app_mac_inf.h"
31 #include "du_app_rlc_inf.h"
32 #include "du_e2ap_mgr.h"
36 #include "du_f1ap_msg_hdl.h"
37 #include "du_ue_mgr.h"
40 #include "AlarmInterface.h"
41 #include "CmInterface.h"
45 DuRlcUeReestablishReq packRlcUeReestablishReqOpts[] =
47 packDuRlcUeReestablishReq, /* Loose coupling */
48 RlcProcUeReestablishReq, /* TIght coupling */
49 packDuRlcUeReestablishReq /* Light weight-loose coupling */
52 DuMacDlCcchInd packMacDlCcchIndOpts[] =
54 packMacDlCcchInd, /* Loose coupling */
55 MacProcDlCcchInd, /* TIght coupling */
56 packMacDlCcchInd /* Light weight-loose coupling */
59 DuMacUeCreateReq packMacUeCreateReqOpts[] =
61 packDuMacUeCreateReq, /* Loose coupling */
62 MacProcUeCreateReq, /* TIght coupling */
63 packDuMacUeCreateReq /* Light weight-loose coupling */
66 DuRlcUeCreateReq packRlcUeCreateReqOpts[] =
68 packDuRlcUeCreateReq, /* Loose coupling */
69 RlcProcUeCreateReq, /* TIght coupling */
70 packDuRlcUeCreateReq /* Light weight-loose coupling */
73 DuDlRrcMsgToRlcFunc duSendDlRrcMsgToRlcOpts[] =
75 packDlRrcMsgToRlc, /* Loose coupling */
76 RlcProcDlRrcMsgTransfer, /* Tight coupling */
77 packDlRrcMsgToRlc /* Light weight-loose coupling */
80 DuRlcUeReconfigReq packRlcUeReconfigReqOpts[] =
82 packDuRlcUeReconfigReq, /* Loose coupling */
83 RlcProcUeReconfigReq, /* TIght coupling */
84 packDuRlcUeReconfigReq /* Light weight-loose coupling */
87 DuMacUeReconfigReq packMacUeReconfigReqOpts[] =
89 packDuMacUeReconfigReq, /* Loose coupling */
90 MacProcUeReconfigReq, /* TIght coupling */
91 packDuMacUeReconfigReq /* Light weight-loose coupling */
94 DuMacRachRsrcReq packMacRachRsrcReqOpts[] =
96 packDuMacRachRsrcReq, /* Loose coupling */
97 MacProcRachRsrcReq, /* Tight coupling */
98 packDuMacRachRsrcReq /* Light weight-loose coupling */
101 DuRlcDlUserDataToRlcFunc duSendRlcDlUserDataToRlcOpts[] =
103 packRlcDlUserDataToRlc, /* Loose coupling */
104 RlcProcDlUserDataTransfer, /* Tight coupling */
105 packRlcDlUserDataToRlc /* Light weight-loose coupling */
108 DuMacRachRsrcRel packMacRachRsrcRelOpts[] =
110 packDuMacRachRsrcRel, /* Loose coupling */
111 MacProcRachRsrcRel, /* Tight coupling */
112 packDuMacRachRsrcRel /* Light weight-loose coupling */
115 DuMacUeDeleteReq packMacUeDeleteReqOpts[] =
117 packDuMacUeDeleteReq, /* Loose coupling */
118 MacProcUeDeleteReq, /* TIght coupling */
119 packDuMacUeDeleteReq /* Light weight-loose coupling */
122 DuRlcUeDeleteReq packRlcUeDeleteReqOpts[] =
124 packDuRlcUeDeleteReq, /* Loose coupling */
125 RlcProcUeDeleteReq, /* TIght coupling */
126 packDuRlcUeDeleteReq /* Light weight-loose coupling */
129 DuMacUeResetReq packMacUeResetReqOpts[] =
131 packDuMacUeResetReq, /* Loose coupling */
132 MacProcUeResetReq, /* TIght coupling */
133 packDuMacUeResetReq /* Light weight-loose coupling */
136 /*******************************************************************
138 * @brief Processes UE's max retransmission information received from RLC
142 * Function : DuProcRlcMaxRetransInd
145 * Processes max retransmission reached information received from RLC
147 * @params[in] Post structure
148 * Pointer to RlcMaxRetransInfo
149 * @return ROK - success
152 * *****************************************************************/
154 uint8_t DuProcRlcMaxRetransInd(Pst *pst, RlcMaxRetransInfo *maxRetransInfo)
156 uint8_t ueId = 0, ret = RFAILED;
157 uint16_t cellIdx = 0,crnti=0;
161 GET_CELL_IDX(maxRetransInfo->cellId, cellIdx);
163 if(duCb.actvCellLst[cellIdx]!=NULLP)
165 ueId = maxRetransInfo->ueId;
166 GET_CRNTI(crnti, ueId);
167 if(duCb.actvCellLst[cellIdx]->ueCb[ueId-1].crnti == crnti)
169 /*TODO: complete the processing of max retransmission */
173 DU_LOG("\nERROR --> DU APP : DuProcRlcMaxRetransInd(): CRNTI [%d] not found", crnti);
176 DU_LOG("\nERROR --> DU APP : DuProcRlcMaxRetransInd(): Cell Id[%d] is not found", maxRetransInfo->cellId);
178 DU_FREE_SHRABL_BUF(pst->region, pst->pool, maxRetransInfo, sizeof(RlcMaxRetransInfo));
184 /******************************************************************
186 * @brief Function to return Drb LcId
190 * Function : getDrbLcId
192 * Functionality: Function to return Drb LcId
194 * @params[in] drbBitMap
196 * Returns: lcId - SUCCESS
198 *****************************************************************/
200 uint8_t getDrbLcId(uint32_t *drbBitMap)
202 uint8_t bitMask = 1, bitPos = 0;
203 bitPos = MIN_DRB_LCID;
205 while(bitPos <= MAX_DRB_LCID)
207 if((*drbBitMap & (bitMask << bitPos)) == 0)
209 *drbBitMap = ((bitMask << bitPos)| *drbBitMap);
217 DU_LOG("\nERROR --> DU_APP: Max LC Reached in getDrbLcId()");
221 /*******************************************************************
223 * @brief Function to fillDlUserDataInfo
227 * Function : fillDlUserDataInfo
230 * Function to fillDlUserDataInfo
235 * @return ROK - success
238 * ****************************************************************/
240 uint8_t fillDlUserDataInfo(uint32_t teId, RlcDlUserDataInfo *dlDataMsgInfo)
244 /*Traversing the duCb to find the CellId, UeId, LCID corresponding to TEID*/
245 for(teIdx = 0; teIdx < duCb.numTeId; teIdx++)
247 if(duCb.upTnlCfg[teIdx] && (duCb.upTnlCfg[teIdx]->tnlCfg1 != NULLP))
249 if(duCb.upTnlCfg[teIdx]->tnlCfg1->teId == teId)
251 dlDataMsgInfo->cellId = duCb.upTnlCfg[teIdx]->cellId;
252 dlDataMsgInfo->ueId = duCb.upTnlCfg[teIdx]->ueId;
253 dlDataMsgInfo->rbId = duCb.upTnlCfg[teIdx]->drbId;
261 /*******************************************************************
263 * @brief Build and Send DL Data Message transfer to RLC
267 * Function : duBuildAndSendDlUserDataToRlc
270 * Build and Send DL Data Message transfer to RLC
272 * @params[in] Cell ID
274 * Logical Channgel ID
277 * @return ROK - success
280 * ****************************************************************/
282 uint8_t duBuildAndSendDlUserDataToRlc(uint16_t msgLen, EgtpMsg *egtpMsg)
284 uint8_t ret = RFAILED;
286 RlcDlUserDataInfo *dlDataMsgInfo = NULLP;
288 DU_ALLOC_SHRABL_BUF(dlDataMsgInfo, sizeof(RlcDlUserDataInfo));
291 DU_LOG("\nERROR --> DU_APP : Memory allocation failed for dlDataMsgInfo in duHdlEgtpDlData()");
294 memset(dlDataMsgInfo, 0, sizeof(RlcDlUserDataInfo));
295 dlDataMsgInfo->dlMsg = egtpMsg->msg;
296 dlDataMsgInfo->msgLen = msgLen;
298 /* Filling DL DATA Msg Info */
299 if(fillDlUserDataInfo(egtpMsg->msgHdr.teId, dlDataMsgInfo) == ROK)
301 /* Filling post structure and sending msg */
302 FILL_PST_DUAPP_TO_RLC(pst, RLC_DL_INST, EVENT_DL_USER_DATA_TRANS_TO_RLC);
303 DU_LOG("\nDEBUG --> DU_APP : Sending User Data Msg to RLC [TEID, nPDU]:[%d, %d]\n",\
304 egtpMsg->msgHdr.teId, egtpMsg->msgHdr.nPdu.val);
305 ret = (*duSendRlcDlUserDataToRlcOpts[pst.selector])(&pst, dlDataMsgInfo);
309 DU_LOG("\nERROR --> DU_APP : Failed to send User Data to RLC in duHdlEgtpDlData()");
310 ODU_PUT_MSG_BUF(dlDataMsgInfo->dlMsg);
311 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlDataMsgInfo, sizeof(RlcDlUserDataInfo));
316 /*******************************************************************
318 * @brief Handles EGTP data from CU
322 * Function : duHdlEgtpData
325 * Processes EGTP header and sends data to RLC
327 * @params[in] Pointer to EGTP Message
328 * @return ROK - success
331 * ****************************************************************/
332 uint8_t duHdlEgtpDlData(EgtpMsg *egtpMsg)
336 #ifdef CALL_FLOW_DEBUG_LOG
337 DU_LOG("\nCall Flow: ENTEGTP -> ENTDUAPP : EVENT_HDL_RECV_DL_DATA\n");
340 DU_LOG("\nDEBUG --> DU_APP : Processing DL data in duHdlEgtpDlData()");
344 DU_LOG("\nERROR --> DU_APP : Recevied Dl Data is NULLP in duHdlEgtpDlData()");
347 ODU_GET_MSG_LEN(egtpMsg->msg, (MsgLen *)&msgLen);
348 if(duBuildAndSendDlUserDataToRlc(msgLen, egtpMsg) != ROK)
350 DU_LOG("\nERROR --> DU_APP : Failed to build DL USer Data in duHdlEgtpDlData()");
356 /******************************************************************
358 * @brief Builds and Sends DL CCCH Ind to MAC
362 * Function : duBuildAndSendDlCcchInd
364 * Functionality: Builds and sends DL CCCH Ind Msg to MAC
366 * @params[in] dlCcchMsg - uint8_t*
367 * @return ROK - success
370 * ****************************************************************/
371 uint8_t duBuildAndSendDlCcchInd(uint16_t *cellId, uint16_t *crnti, \
372 DlCcchMsgType msgType, uint16_t dlCcchMsgSize, uint8_t *dlCcchMsg)
376 DlCcchIndInfo *dlCcchIndInfo = NULLP;
379 DU_LOG("\nDEBUG --> DU APP : Building and Sending DL CCCH Ind to MAC");
381 DU_ALLOC_SHRABL_BUF(dlCcchIndInfo, sizeof(DlCcchIndInfo));
385 DU_LOG("\nERROR --> DU APP : Memory alloc failed while building DL CCCH Ind");
389 dlCcchIndInfo->cellId = *cellId;
390 dlCcchIndInfo->crnti = *crnti;
391 dlCcchIndInfo->msgType = msgType;
392 dlCcchIndInfo->dlCcchMsgLen = dlCcchMsgSize;
394 DU_ALLOC_SHRABL_BUF(dlCcchIndInfo->dlCcchMsg, dlCcchIndInfo->dlCcchMsgLen);
395 if(!dlCcchIndInfo->dlCcchMsg)
397 DU_LOG("\nERROR --> DU APP : Memory alloc failed while building DL CCCH Ind");
398 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo, sizeof(DlCcchIndInfo));
401 for(idx2 = 0; idx2 < dlCcchIndInfo->dlCcchMsgLen; idx2++)
403 dlCcchIndInfo->dlCcchMsg[idx2] = dlCcchMsg[idx2];
405 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchMsg, dlCcchMsgSize);
408 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_DL_CCCH_IND);
409 ret = (*packMacDlCcchIndOpts[pst.selector])(&pst, dlCcchIndInfo);
412 DU_LOG("\nERROR --> DU_APP : Failure in sending DL CCCH to MAC");
413 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo->dlCcchMsg,\
414 dlCcchIndInfo->dlCcchMsgLen);
415 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo, \
416 sizeof(DlCcchIndInfo));
424 /*******************************************************************
426 * @brief Build and Send DL RRC Message transfer to RLC
430 * Function : duBuildAndSendDlRrcMsgToRlc
433 * Build and Send DL RRC Message transfer to RLC
435 * @params[in] Cell ID
437 * Logical Channgel ID
440 * @return ROK - success
443 * ****************************************************************/
444 uint8_t duBuildAndSendDlRrcMsgToRlc(uint16_t cellId, DuRlcUeCfg ueCfg, F1DlRrcMsg *f1DlRrcMsg)
449 RlcDlRrcMsgInfo *dlRrcMsgInfo = NULLP;
453 DU_LOG("\nERROR --> DU APP : Received Dl RRC Msg is NULL at duBuildAndSendDlRrcMsgToRlc()");
457 /*As per Spec ORAN WG8 AAD, lcId for DL RRC range from 1...3*/
458 if((f1DlRrcMsg->srbId < SRB1_LCID) || (f1DlRrcMsg->srbId > SRB3_LCID))
460 DU_LOG("\nERROR --> DU APP : Received SRBID for this Dl RRC Msg is not valid");
464 DU_ALLOC_SHRABL_BUF(dlRrcMsgInfo, sizeof(RlcDlRrcMsgInfo));
468 DU_LOG("\nERROR --> DU APP : Memory allocation failed for dlRrcMsgInfo in \
469 duBuildAndSendDlRrcMsgToRlc");
470 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, f1DlRrcMsg->rrcMsgPdu, f1DlRrcMsg->rrcMsgSize);
474 /* Filling up the RRC msg info */
475 dlRrcMsgInfo->cellId = cellId;
476 dlRrcMsgInfo->ueId = ueCfg.ueId;
477 for(lcIdx = 0; lcIdx <= MAX_NUM_LC; lcIdx++)
479 if(ueCfg.rlcLcCfg[lcIdx].rlcBearerCfg.lcId == f1DlRrcMsg->srbId)
481 dlRrcMsgInfo->lcId = f1DlRrcMsg->srbId;
485 if(lcIdx == (MAX_NUM_LC + 1))
487 DU_LOG("\nERROR --> DU APP : (duBuildAndSendDlRrcMsgToRlc) SRB for this DL_RRC msg is not configured.");
488 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, f1DlRrcMsg->rrcMsgPdu, f1DlRrcMsg->rrcMsgSize);
492 dlRrcMsgInfo->execDup = f1DlRrcMsg->execDup;
493 dlRrcMsgInfo->deliveryStaRpt = f1DlRrcMsg->deliveryStatRpt;
494 dlRrcMsgInfo->msgLen = f1DlRrcMsg->rrcMsgSize;
495 dlRrcMsgInfo->rrcMsg = f1DlRrcMsg->rrcMsgPdu;
497 /* Filling post structure and sending msg */
498 FILL_PST_DUAPP_TO_RLC(pst, RLC_DL_INST, EVENT_DL_RRC_MSG_TRANS_TO_RLC);
499 DU_LOG("\nDEBUG --> DU_APP: Sending Dl RRC Msg to RLC \n");
500 ret = (*duSendDlRrcMsgToRlcOpts[pst.selector])(&pst, dlRrcMsgInfo);
503 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, f1DlRrcMsg->rrcMsgPdu, f1DlRrcMsg->rrcMsgSize);
504 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlRrcMsgInfo, sizeof(RlcDlRrcMsgInfo));
513 /******************************************************************
515 * @brief Process DL RRC Msg recevied from F1AP
519 * Function : duProcDlRrcMsg
521 * Functionality: Process DL RRC Msg recevied from F1AP
523 * @params[in] dlCcchMsg - uint8_t*
524 * @return ROK - success
527 * ****************************************************************/
529 uint8_t duProcDlRrcMsg(F1DlRrcMsg *dlRrcMsg)
532 uint16_t crnti, cellId, cellIdx;
533 bool ueCcchCtxtFound = false;
534 bool ueFound = false;
538 if(dlRrcMsg->srbId == SRB0_LCID) //RRC connection setup
540 for(ueIdx=0; ueIdx<duCb.numUe; ueIdx++)
542 if(dlRrcMsg->gnbDuUeF1apId == duCb.ueCcchCtxt[ueIdx].gnbDuUeF1apId)
544 ueCcchCtxtFound = true;
545 crnti = duCb.ueCcchCtxt[ueIdx].crnti;
546 cellId = duCb.ueCcchCtxt[ueIdx].cellId;
553 ret = duBuildAndSendDlCcchInd(&cellId, &crnti, RRC_SETUP, dlRrcMsg->rrcMsgSize, dlRrcMsg->rrcMsgPdu);
556 DU_LOG("\nERROR --> DU APP : Failed to build DlCcch Ind at procDlRrcMsgTrans()");
560 if(duCb.actvCellLst[cellId-1] == NULLP)
562 DU_LOG("\nERROR --> DU APP : cellId [%d] does not exist", cellId);
565 if(duCb.actvCellLst[cellId-1]->numActvUes < MAX_NUM_UE)
567 ret = duCreateUeCb(&duCb.ueCcchCtxt[ueIdx], dlRrcMsg->gnbCuUeF1apId);
570 DU_LOG("\nERROR --> DU APP : Failed to createUeCb for cellId [%d] at procDlRrcMsgTrans()", \
571 duCb.ueCcchCtxt[ueIdx].cellId);
576 DU_LOG("\nERROR --> DU_APP: Max Active UEs has reached at procDlRrcMsgTrans()");
583 for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
585 for(ueIdx = 0 ; ueIdx < MAX_NUM_UE; ueIdx++)
587 if(duCb.actvCellLst[cellIdx] && (dlRrcMsg->gnbCuUeF1apId == duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId)
588 && (dlRrcMsg->gnbDuUeF1apId == duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId))
591 ret = duBuildAndSendDlRrcMsgToRlc(duCb.actvCellLst[cellIdx]->cellId, \
592 duCb.actvCellLst[cellIdx]->ueCb[ueIdx].duRlcUeCfg, dlRrcMsg);
595 DU_LOG("\nERROR --> DU_APP: duBuildAndSendDlRrcMsgToRlc() Failed for UE ID:%d", dlRrcMsg->gnbDuUeF1apId);
606 DU_LOG("\nERROR --> DU_APP: UE ID [%d] not found", dlRrcMsg->gnbDuUeF1apId);
613 /******************************************************************
615 * @brief Processes UL CCCH Ind recvd from MAC
619 * Function : duProcUlCcchInd
621 * Functionality: Processes UL CCCH Ind recvd from MAC
623 * @params[in] UlCcchIndInfo *ulCcchIndInfo
624 * @return ROK - success
627 * ****************************************************************/
628 uint8_t duProcUlCcchInd(UlCcchIndInfo *ulCcchIndInfo)
632 int32_t gnbDuUeF1apId = 0;
634 if(ulCcchIndInfo->crnti)
636 GET_UE_ID(ulCcchIndInfo->crnti, gnbDuUeF1apId);
640 DU_LOG("\nERROR --> DU_APP : Received invalid CRNTI [%d] ", ulCcchIndInfo->crnti);
644 /* Store Ue mapping */
645 duCb.ueCcchCtxt[duCb.numUe].gnbDuUeF1apId = (uint32_t)gnbDuUeF1apId;
646 duCb.ueCcchCtxt[duCb.numUe].crnti = ulCcchIndInfo->crnti;
647 duCb.ueCcchCtxt[duCb.numUe].cellId = ulCcchIndInfo->cellId;
651 ret = (BuildAndSendInitialRrcMsgTransfer(gnbDuUeF1apId, ulCcchIndInfo->crnti, ulCcchIndInfo->ulCcchMsgLen,
652 ulCcchIndInfo->ulCcchMsg));
655 DU_LOG("\nERROR --> DU_APP : BuildAndSendInitialRrcMsgTransfer failed");
658 DU_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, ulCcchIndInfo->ulCcchMsg, ulCcchIndInfo->ulCcchMsgLen);
659 DU_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, ulCcchIndInfo, sizeof(UlCcchIndInfo));
665 /******************************************************************
667 * @brief Fills Default UL LC Cfg
671 * Function : fillDefaultUlLcCfg
673 * Functionality: Fills Default UL LC Cfg
675 * @params[in] UlLcCfg *ulLcCfg
677 *****************************************************************/
678 void fillDefaultUlLcCfg(UlLcCfg *ulLcCfg)
680 ulLcCfg->priority = LC_PRIORITY_1;
681 ulLcCfg->lcGroup = 0;
682 ulLcCfg->schReqId = 0;
683 ulLcCfg->pbr = PBR_KBPS_INFINITY;
684 ulLcCfg->bsd = BSD_MS_1000;
687 /******************************************************************
689 * @brief Fills Initial DL Bandwidth Part
693 * Function : fillDefaultInitDlBwp
695 * Functionality: Fills Initial DL Bandwidth Part
697 * @params[in] InitialDlBwp *initDlBwp
698 * @return ROK - success
701 *****************************************************************/
702 uint8_t fillDefaultInitDlBwp(InitialDlBwp *initDlBwp)
705 uint8_t freqDomainResource[FREQ_DOM_RSRC_SIZE] = {0};
706 uint8_t coreset0EndPrb, coreset1StartPrb, coreset1NumPrb;
710 /* Filling PDCCH Config */
711 initDlBwp->pdcchPresent = TRUE;
712 if(initDlBwp->pdcchPresent)
714 initDlBwp->pdcchCfg.numCRsetToAddMod = PDCCH_CTRL_RSRC_SET_ONE_ID;
715 memset(initDlBwp->pdcchCfg.cRSetToAddModList, 0, MAX_NUM_CRSET);
716 if(initDlBwp->pdcchCfg.numCRsetToAddMod <= MAX_NUM_CRSET)
718 initDlBwp->pdcchCfg.cRSetToAddModList[idx].cRSetId = PDCCH_CTRL_RSRC_SET_ONE_ID;
719 memset(initDlBwp->pdcchCfg.cRSetToAddModList[idx].freqDomainRsrc, 0, FREQ_DOM_RSRC_SIZE);
720 coreset0EndPrb = CORESET0_END_PRB;
721 coreset1StartPrb = coreset0EndPrb +6;
722 coreset1NumPrb = CORESET1_NUM_PRB;
723 /* calculate the PRBs */
724 fillCoresetFeqDomAllocMap(((coreset1StartPrb)/6), (coreset1NumPrb/6), freqDomainResource);
725 memcpy(initDlBwp->pdcchCfg.cRSetToAddModList[idx].freqDomainRsrc, freqDomainResource, FREQ_DOM_RSRC_SIZE);
727 initDlBwp->pdcchCfg.cRSetToAddModList[idx].duration = PDCCH_CTRL_RSRC_SET_ONE_DURATION;
728 initDlBwp->pdcchCfg.cRSetToAddModList[idx].cceRegMappingType = CCE_REG_MAPPINGTYPE_PR_NONINTERLEAVED;
729 initDlBwp->pdcchCfg.cRSetToAddModList[idx].precoderGranularity = ALL_CONTIGUOUS_RBS;
730 initDlBwp->pdcchCfg.cRSetToAddModList[idx].dmrsScramblingId = SCRAMBLING_ID;
732 initDlBwp->pdcchCfg.numCRsetToRel = 0;
734 /* Filling Serach Space */
735 initDlBwp->pdcchCfg.numSearchSpcToAddMod = PDCCH_CTRL_RSRC_SET_ONE_ID;
736 memset(initDlBwp->pdcchCfg.searchSpcToAddModList, 0, MAX_NUM_CRSET);
737 if(initDlBwp->pdcchCfg.numSearchSpcToAddMod <= MAX_NUM_CRSET)
739 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].searchSpaceId = PDCCH_SRCH_SPC_TWO_ID;
740 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].cRSetId = PDCCH_CTRL_RSRC_SET_ONE_ID;
741 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].mSlotPeriodicityAndOffset.mSlotPeriodicity\
742 = SLOTPERIODICITY_PR_SL1;
743 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].mSlotPeriodicityAndOffset.mSlotOffset = 0;
744 memset(initDlBwp->pdcchCfg.searchSpcToAddModList[idx].mSymbolsWithinSlot, 0, MONITORING_SYMB_WITHIN_SLOT_SIZE);
745 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].mSymbolsWithinSlot[idx] = PDCCH_SYMBOL_WITHIN_SLOT;
746 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel1 = AGGREGATIONLEVEL_N8;
747 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel2 = AGGREGATIONLEVEL_N8;
748 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel4 = AGGREGATIONLEVEL_N4;
749 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel8 = AGGREGATIONLEVEL_N2;
750 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel16 = AGGREGATIONLEVEL_N1;
751 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].searchSpaceType = SEARCHSPACETYPE_PR_UE_SPECIFIC;
752 initDlBwp->pdcchCfg.searchSpcToAddModList[idx].ueSpecificDciFormat = PDCCH_SRCH_SPC_TWO_UE_SPEC_DCI_FORMAT;
754 initDlBwp->pdcchCfg.numSearchSpcToRel = 0;
757 /* Filling PDSCH Config */
758 initDlBwp->pdschPresent = TRUE;
759 if(initDlBwp->pdschPresent)
761 initDlBwp->pdschCfg.dmrsDlCfgForPdschMapTypeA.addPos = ADDITIONALPOSITION_POS0;
762 initDlBwp->pdschCfg.resourceAllocType = RESOURCEALLOCATION_TYPE1;
764 initDlBwp->pdschCfg.numTimeDomRsrcAlloc = NUM_TIME_DOM_RSRC_ALLOC;
767 initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].mappingType = MAPPING_TYPEA;
768 initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].startSymbol = PDSCH_START_SYMBOL;
769 initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].symbolLength = PDSCH_LENGTH_SYMBOL;
770 initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].startSymbolAndLength = calcSliv(PDSCH_START_SYMBOL, PDSCH_LENGTH_SYMBOL);
773 DU_ALLOC_SHRABL_BUF(initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].k0, sizeof(uint8_t));
774 if(initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].k0 == NULLP)
776 DU_LOG("\nERROR --> DUAPP : Failed to allocate memory to K0 in fillDefaultInitDlBwp");
779 if(initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].k0)
781 *(initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].k0) = 1;
783 initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].mappingType = MAPPING_TYPEA;
784 initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].startSymbol = PDSCH_START_SYMBOL;
785 initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].symbolLength = PDSCH_LENGTH_SYMBOL;
786 initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].startSymbolAndLength = calcSliv(PDSCH_START_SYMBOL, PDSCH_LENGTH_SYMBOL);
788 initDlBwp->pdschCfg.rbgSize = RBG_SIZE_CONFIG1;
789 initDlBwp->pdschCfg.numCodeWordsSchByDci = CODEWORDS_SCHED_BY_DCI_N1;
790 initDlBwp->pdschCfg.bundlingType = TYPE_STATIC_BUNDLING;
791 initDlBwp->pdschCfg.bundlingInfo.StaticBundling.size = 0;
798 /******************************************************************
800 * @brief Fills Initial UL Bandwidth Part
804 * Function : fillDefaultInitUlBwp
806 * Functionality: Fills Initial UL Bandwidth Part
808 * @params[in] InitialUlBwp *initUlBwp
811 *****************************************************************/
812 void fillDefaultInitUlBwp(InitialUlBwp *initUlBwp)
817 initUlBwp->pucchPresent = FALSE;
819 /*Filling PUSCH Config */
820 initUlBwp->puschPresent = TRUE;
821 if(initUlBwp->puschPresent)
823 initUlBwp->puschCfg.dataScramblingId = SCRAMBLING_ID;
824 initUlBwp->puschCfg.dmrsUlCfgForPuschMapTypeA.addPos = ADDITIONALPOSITION_POS0;
825 initUlBwp->puschCfg.dmrsUlCfgForPuschMapTypeA.transPrecodDisabled. \
826 scramblingId0 = SCRAMBLING_ID;
827 initUlBwp->puschCfg.resourceAllocType = RESOURCEALLOCATION_TYPE1;
828 initUlBwp->puschCfg.numTimeDomRsrcAlloc = 2;
830 if(initUlBwp->puschCfg.numTimeDomRsrcAlloc <= MAX_NUM_UL_ALLOC)
832 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].k2 = PUSCH_K2_CFG1;
833 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].mappingType =\
835 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].startSymbol = PUSCH_START_SYMBOL;
836 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].symbolLength = PUSCH_LENGTH_SYMBOL;
837 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].startSymbolAndLength =\
838 calcSliv(PUSCH_START_SYMBOL, PUSCH_LENGTH_SYMBOL);
841 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].k2 = PUSCH_K2_CFG2;
842 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].mappingType = MAPPING_TYPEA;
843 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].startSymbol = PUSCH_START_SYMBOL;
844 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].symbolLength = PUSCH_LENGTH_SYMBOL;
845 initUlBwp->puschCfg.timeDomRsrcAllocList[idx].startSymbolAndLength =\
846 calcSliv(PUSCH_START_SYMBOL, PUSCH_LENGTH_SYMBOL);
848 initUlBwp->puschCfg.transformPrecoder = TRANSFORM_PRECODER_DISABLED;
853 DU_LOG("\nERROR --> DU APP : Memory is NULL of InitalUlBwp");
857 /******************************************************************
859 * @brief Fills SpCell Group Info
863 * Function : fillDefaultSpCellGrpInfo
865 * Functionality: Fills Sp Cell Group Info
867 * @params[in] DuMacUeCfg *macUeCfg
868 * @return ROK - Success
871 *****************************************************************/
872 uint8_t fillDefaultSpCellGrpInfo(DuMacUeCfg *macUeCfg)
874 SpCellRecfg *spCell = NULL;
877 spCell = &macUeCfg->spCellCfg;
881 macUeCfg->spCellCfgPres = true;
883 spCell->servCellIdx = SERV_CELL_IDX;
884 /* Filling Initial Dl Bwp */
885 if((fillDefaultInitDlBwp(&spCell->servCellCfg.initDlBwp)) != ROK)
887 DU_LOG("\nERROR --> DUAPP : Failed in fillDefaultInitDlBwp");
891 spCell->servCellCfg.numDlBwpToAddOrMod = 0;
892 spCell->servCellCfg.numDlBwpToRel = 0;
893 spCell->servCellCfg.firstActvDlBwpId = ACTIVE_DL_BWP_ID;
894 spCell->servCellCfg.defaultDlBwpId = ACTIVE_DL_BWP_ID;
895 spCell->servCellCfg.bwpInactivityTmr = NULLP;
896 spCell->servCellCfg.pdschServCellCfg.maxMimoLayers = NULLP;
897 spCell->servCellCfg.pdschServCellCfg.maxCodeBlkGrpPerTb = NULLP;
898 spCell->servCellCfg.pdschServCellCfg.codeBlkGrpFlushInd = NULLP;
899 spCell->servCellCfg.pdschServCellCfg.xOverhead = NULLP;
900 spCell->servCellCfg.pdschServCellCfg.numHarqProcForPdsch = NUM_HARQ_PROC_FOR_PDSCH_N_16;
902 /* Filling Initial UL Bwp*/
903 fillDefaultInitUlBwp(&spCell->servCellCfg.initUlBwp);
904 spCell->servCellCfg.numUlBwpToAddOrMod = 0;
905 spCell->servCellCfg.numUlBwpToRel = 0;
906 spCell->servCellCfg.firstActvUlBwpId = ACTIVE_DL_BWP_ID;
910 DU_LOG("\nERROR --> DU APP : Memory is NULL for SpCellGrp");
916 /******************************************************************
918 * @brief Fills Physical Cell Group Info
922 * Function : fillDefaultPhyCellGrpInfo
924 * Functionality: Fills Physical Cell Group Info
926 * @params[in] DuMacUeCfg *macUeCfg
929 *****************************************************************/
930 void fillDefaultPhyCellGrpInfo(DuMacUeCfg *macUeCfg)
932 PhyCellGrpCfg *cellGrp = NULL;
935 cellGrp = &macUeCfg->phyCellGrpCfg;
939 macUeCfg->phyCellGrpCfgPres = true;
940 cellGrp->pdschHarqAckCodebook = PDSCH_HARQ_ACK_CODEBOOK_DYNAMIC;
941 cellGrp->pNrFr1 = P_NR_FR1;
945 DU_LOG("\nERROR --> DU APP : Memory is NULL for Physical Cell Group");
949 /******************************************************************
951 * @brief Fills Mac Cell Group Info
955 * Function : fillDefaultMacCellGrpInfo
957 * Functionality: Fills Mac Cell Group Info
959 * @params[in] DuMacUeCfg *macUeCfg
962 *****************************************************************/
963 void fillDefaultMacCellGrpInfo(DuMacUeCfg *macUeCfg)
966 MacCellGrpCfg *cellGrp = NULL;
969 cellGrp = &macUeCfg->macCellGrpCfg;
973 macUeCfg->macCellGrpCfgPres = true;
975 /* Filling Scheduling Request Config */
976 cellGrp->schReqCfg.addModListCount = 1;
977 if(cellGrp->schReqCfg.addModListCount <= MAX_NUM_SR_CFG_PER_CELL_GRP)
979 for(idx = 0; idx < cellGrp->schReqCfg.addModListCount; idx++)
981 cellGrp->schReqCfg.addModList[idx].schedReqId = SCH_REQ_ID;
982 cellGrp->schReqCfg.addModList[idx].srProhibitTmr = SR_PROHIBIT_MS_32;
983 cellGrp->schReqCfg.addModList[idx].srTransMax = SR_TRANS_MAX_N_16;
986 cellGrp->schReqCfg.relListCount = 0;
988 /* Filling Tag config */
989 cellGrp->tagCfg.addModListCount = 1;
990 if(cellGrp->tagCfg.addModListCount <= MAC_NUM_TAGS)
992 for(idx = 0; idx < cellGrp->tagCfg.addModListCount; idx++)
994 cellGrp->tagCfg.addModList[idx].tagId = TAG_ID;
995 cellGrp->tagCfg.addModList[idx].timeAlignTimer = TIME_ALIGNMENT_TIMER_INFINITY;
998 cellGrp->tagCfg.relListCount = 0;
1000 /* Filling BSR config */
1001 cellGrp->bsrTmrCfg.periodicTimer = BSR_PERIODIC_TIMER_SF_10;
1002 cellGrp->bsrTmrCfg.retxTimer = BSR_RETX_TIMER_SF_320;
1003 cellGrp->bsrTmrCfg.srDelayTimer = BSR_SR_DELAY_TMR_2560;
1005 /* Filling PHR config */
1006 cellGrp->phrCfgSetupPres = true;
1007 cellGrp->phrCfg.periodicTimer = PHR_PERIODIC_TIMER_INFINITY;
1008 cellGrp->phrCfg.prohibitTimer = PHR_PROHIBIT_TIMER_SF_0;
1009 cellGrp->phrCfg.txPowerFactor = PHR_TX_PWR_FACTOR_CHANGE_INFINITY;
1010 cellGrp->phrCfg.multiplePHR = false;
1011 cellGrp->phrCfg.dummy = false;
1012 cellGrp->phrCfg.phrType2OtherCell = false;
1013 cellGrp->phrCfg.phrOtherCG = PHR_MODE_OTHER_CG_REAL;
1015 /* Filling Drx Config */
1017 cellGrp->drxCfg.drxOnDurationTimer.onDurationTimerValInMs = DRX_ONDURATION_TIMER_VALUE_PRESENT_IN_MS;
1018 if(!cellGrp->drxCfg.drxOnDurationTimer.onDurationTimerValInMs)
1019 cellGrp->drxCfg.drxOnDurationTimer.onDurationtimerValue.subMilliSeconds = \
1020 DRX_ONDURATION_TIMER_VALUE_IN_SUBMS;
1022 cellGrp->drxCfg.drxOnDurationTimer.onDurationtimerValue.milliSeconds = \
1023 DRX_ONDURATION_TIMER_VALUE_IN_MS;
1024 cellGrp->drxCfg.drxInactivityTimer = DRX_INACTIVITY_TIMER;
1025 cellGrp->drxCfg.drxHarqRttTimerDl = DRX_HARQ_RTT_TIMER_DL;
1026 cellGrp->drxCfg.drxHarqRttTimerUl = DRX_HARQ_RTT_TIMER_UL;
1027 cellGrp->drxCfg.drxRetransmissionTimerDl = DRX_RETRANSMISSION_TIMER_DL;
1028 cellGrp->drxCfg.drxRetransmissionTimerUl = DRX_RETRANSMISSION_TIMER_UL;
1029 cellGrp->drxCfg.drxLongCycleStartOffset.drxLongCycleStartOffsetVal = DRX_LONG_CYCLE_START_OFFSET_VAL;
1030 cellGrp->drxCfg.drxLongCycleStartOffset.drxLongCycleStartOffsetChoice = DRX_LONG_CYCLE_START_OFFSET_CHOICE;
1031 cellGrp->drxCfg.shortDrxPres = DRX_SHORT_CYCLE_PRESENT;
1032 if(cellGrp->drxCfg.shortDrxPres)
1034 cellGrp->drxCfg.shortDrx.drxShortCycle = DRX_SHORT_CYCLE;
1035 cellGrp->drxCfg.shortDrx.drxShortCycleTimer = DRX_SHORT_CYCLE_TIMER;
1037 cellGrp->drxCfg.drxSlotOffset = DRX_SLOT_OFFSET;
1043 DU_LOG("\nERROR --> DU APP : Memory is NULL for Master Cell Group");
1047 /*******************************************************************
1049 * @brief Fills default modulation info for a UE
1053 * Function : fillDefaultModulation
1055 * Functionality: Fills default modulation info for a UE
1057 * @params[in] Pointer to MAC UE configuration
1058 * @return ROK - success
1061 * ****************************************************************/
1062 void fillDefaultModulation(DuMacUeCfg *ueCfg)
1064 ueCfg->dlModInfo.modOrder = MOD_ORDER_QPSK;
1065 ueCfg->dlModInfo.mcsIndex = DEFAULT_MCS;
1066 ueCfg->dlModInfo.mcsTable = MCS_TABLE_QAM64; /* Spec 38.214-Table 5.1.3.1-1 */
1068 ueCfg->ulModInfo.modOrder = MOD_ORDER_QPSK;
1069 ueCfg->ulModInfo.mcsIndex = DEFAULT_MCS;
1070 ueCfg->ulModInfo.mcsTable = MCS_TABLE_QAM64; /* Spec 38.214-Table 5.1.3.1-1 */
1073 /******************************************************************
1075 * @brief Function to fill Mac Lc Cfg for SRB1
1079 * Function : fillMacSrb1LcCfg
1081 * Functionality: Function to fill Mac Lc cfg for SRB1
1083 * @params[in] LcCfg *lcCfg, LcCfg *ueSetReqDb
1085 *****************************************************************/
1087 void fillMacSrb1LcCfg(DuLcCfg *macLcCfg)
1089 macLcCfg->lcConfig.lcId = SRB1_LCID;
1090 macLcCfg->configType = CONFIG_ADD;
1091 macLcCfg->lcConfig.drbQos = NULLP;
1092 macLcCfg->lcConfig.snssai = NULLP;
1093 macLcCfg->lcConfig.ulLcCfgPres = true;
1094 fillDefaultUlLcCfg(&macLcCfg->lcConfig.ulLcCfg);
1097 /******************************************************************
1099 * @brief Function to fill the Lc cfg from ueSetupReqDb
1103 * Function : fillMacLcCfgToAddMod
1105 * Functionality: Function to fill the Lc cfg from ueSetupReqDb
1107 * @params[in] LcCfg *lcCfg, LcCfg *ueSetReqDb
1108 * @return ROK/RFAILED
1110 *****************************************************************/
1112 uint8_t fillMacLcCfgToAddMod(DuLcCfg *macLcCfgToSend, DuLcCfg *ueLcCfgDb, DuLcCfg *oldLcCfg, Bool toUpdate)
1118 macLcCfgToSend->lcConfig.lcId = ueLcCfgDb->lcConfig.lcId;
1119 macLcCfgToSend->configType = ueLcCfgDb->configType;
1121 if(ueLcCfgDb->lcConfig.drbQos)
1122 macLcCfgToSend->lcConfig.drbQos = ueLcCfgDb->lcConfig.drbQos;
1124 macLcCfgToSend->lcConfig.drbQos = oldLcCfg->lcConfig.drbQos;
1126 macLcCfgToSend->lcConfig.drbQos = NULL;
1128 if(ueLcCfgDb->lcConfig.snssai)
1129 macLcCfgToSend->lcConfig.snssai = ueLcCfgDb->lcConfig.snssai;
1131 macLcCfgToSend->lcConfig.snssai = oldLcCfg->lcConfig.snssai;
1133 macLcCfgToSend->lcConfig.snssai = NULL;
1135 macLcCfgToSend->lcConfig.ulLcCfgPres = ueLcCfgDb->lcConfig.ulLcCfgPres;
1136 memcpy(&macLcCfgToSend->lcConfig.ulLcCfg, &ueLcCfgDb->lcConfig.ulLcCfg, sizeof(UlLcCfg));
1137 memcpy(&macLcCfgToSend->lcConfig.dlLcCfg, &ueLcCfgDb->lcConfig.dlLcCfg, sizeof(DlLcCfg));
1142 oldLcCfg->lcConfig.lcId = ueLcCfgDb->lcConfig.lcId;
1143 oldLcCfg->configType = ueLcCfgDb->configType;
1145 if(ueLcCfgDb->lcConfig.drbQos)
1147 if(oldLcCfg->lcConfig.drbQos)
1148 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, oldLcCfg->lcConfig.drbQos, sizeof(DrbQosInfo));
1150 DU_ALLOC_SHRABL_BUF(oldLcCfg->lcConfig.drbQos, sizeof(DrbQosInfo));
1151 if(oldLcCfg->lcConfig.drbQos == NULL)
1153 DU_LOG("\nERROR --> DU APP : Memory Alloc Failed at fillMacLcCfgToAddMod()");
1156 memcpy(oldLcCfg->lcConfig.drbQos, ueLcCfgDb->lcConfig.drbQos, sizeof(DrbQosInfo));
1159 if(ueLcCfgDb->lcConfig.snssai)
1161 if(oldLcCfg->lcConfig.snssai)
1162 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, oldLcCfg->lcConfig.snssai, sizeof(Snssai));
1164 DU_ALLOC_SHRABL_BUF(oldLcCfg->lcConfig.snssai, sizeof(Snssai));
1165 if(oldLcCfg->lcConfig.snssai == NULL)
1167 DU_LOG("\nERROR --> DU APP : Memory Alloc Failed at fillMacLcCfgToAddMod()");
1168 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, oldLcCfg->lcConfig.drbQos, sizeof(DrbQosInfo));
1171 memcpy(oldLcCfg->lcConfig.snssai, ueLcCfgDb->lcConfig.snssai, sizeof(Snssai));
1174 oldLcCfg->lcConfig.ulLcCfgPres = ueLcCfgDb->lcConfig.ulLcCfgPres;
1175 memcpy(&oldLcCfg->lcConfig.ulLcCfg, &ueLcCfgDb->lcConfig.ulLcCfg, sizeof(UlLcCfg));
1176 memcpy(&oldLcCfg->lcConfig.dlLcCfg, &ueLcCfgDb->lcConfig.dlLcCfg, sizeof(DlLcCfg));
1181 /******************************************************************
1183 * @brief Function to copy the Bit rate from ueSetupReqDb
1187 * Function : fillAmbr
1189 * Functionality: Function to copy bit Rate from ueSetupReqDb
1191 * @params[in] AmbrCfg **macAmbr, AmbrCfg *ueDbAmbr
1192 * @return ROK/RFAILED
1194 *****************************************************************/
1196 uint8_t fillAmbr(AmbrCfg **macAmbrCfgToSend, AmbrCfg *ueDbAmbr, AmbrCfg **oldMacAmbrCfg, Bool toUpdate)
1202 *macAmbrCfgToSend = ueDbAmbr;
1204 else if(oldMacAmbrCfg)
1205 *macAmbrCfgToSend = *oldMacAmbrCfg;
1215 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, *oldMacAmbrCfg, sizeof(AmbrCfg));
1217 DU_ALLOC_SHRABL_BUF(*oldMacAmbrCfg, sizeof(AmbrCfg));
1218 if(*oldMacAmbrCfg == NULLP)
1220 DU_LOG("\nERROR --> DU APP : Memory Alloc Failed at fillAmbr()");
1223 memset(*oldMacAmbrCfg, 0, sizeof(AmbrCfg));
1224 (*oldMacAmbrCfg)->ulBr = ueDbAmbr->ulBr;
1232 /******************************************************************
1234 * @brief Builds and Send UE ReConfig Request to MAC
1238 * Function : sendUeRecfgReqToMac
1240 * Functionality: Builds and Send UE ReConfig Request to MAC
1242 * @Params[in] MacUeRecfg pointer
1243 * @return ROK - success
1246 * ****************************************************************/
1248 uint8_t sendUeRecfgReqToMac(MacUeRecfg *macUeRecfg)
1254 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_RECONFIG_REQ);
1258 /* Processing one Ue at a time to MAC */
1259 DU_LOG("\nDEBUG --> DU_APP: Sending Ue Reconfig Request to MAC");
1260 ret = (*packMacUeReconfigReqOpts[pst.selector])(&pst, macUeRecfg);
1263 DU_LOG("\nERROR --> DU APP : Failed to send Reconfig Request to MAC at sendUeRecfgReqToMac()");
1264 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macUeRecfg, sizeof(MacUeRecfg));
1269 DU_LOG("\nERROR --> DU_APP: Received macUeRecfg is NULLP at sendUeRecfgReqToMac()");
1277 /******************************************************************
1279 * @brief update DuMacUeCfg structure
1283 * Function : updateDuMacUeCfg
1285 * Functionality: Fills DuMacUeCfg
1287 * @params[in] cellId, ueId, crnti,
1289 * DuMacUeCfg pointer
1290 * @return ROK/RFAILED
1292 *****************************************************************/
1293 uint8_t updateDuMacUeCfg(uint16_t cellId, uint8_t gnbDuUef1apId, uint16_t crnti, DuUeCfg *ueCfgDb, DuMacUeCfg *duMacUeCfg)
1295 uint8_t ret = ROK, dbIdx = 0, lcIdx = 0, cellIdx = 0;
1296 bool lcIdFound = false;
1297 DuMacUeCfg *duMacDb = NULLP;
1299 duMacUeCfg->cellId = cellId;
1300 duMacUeCfg->ueId = gnbDuUef1apId;
1301 duMacUeCfg->crnti = crnti;
1305 fillDefaultMacCellGrpInfo(duMacUeCfg);
1306 fillDefaultPhyCellGrpInfo(duMacUeCfg);
1308 if((fillDefaultSpCellGrpInfo(duMacUeCfg)) != ROK)
1310 DU_LOG("\nERROR --> DUAPP : Failed in fillDefaultSpCellGrpInfo");
1314 duMacUeCfg->ambrCfg = NULLP;
1315 fillDefaultModulation(duMacUeCfg);
1316 fillMacSrb1LcCfg(&duMacUeCfg->lcCfgList[0]);
1317 duMacUeCfg->numLcs++;
1321 if(ueCfgDb->dataTransmissionAction == STOP_TRANSMISSION)
1323 duMacUeCfg->transmissionAction = ueCfgDb->dataTransmissionAction;
1327 GET_CELL_IDX(cellId, cellIdx);
1328 if(duCb.actvCellLst[cellIdx])
1329 duMacDb = &duCb.actvCellLst[cellIdx]->ueCb[duMacUeCfg->ueId-1].duMacUeCfg;
1332 DU_LOG("\nERROR --> DU APP : Cell Id [%d] does not exist", cellId);
1335 duMacDb->macUeCfgState = UE_CFG_INPROGRESS;
1337 if(ueCfgDb->cellGrpCfg)
1339 ret = procUeRecfgCellInfo(duMacUeCfg, duMacDb, ueCfgDb->cellGrpCfg);
1342 if(duMacUeCfg->spCellCfgPres == true)
1344 if(duMacUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschPresent)
1346 fillStartSymbolAndLen(duMacUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg.numTimeDomRsrcAlloc,\
1347 &duMacUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg, NULL);
1349 if(duMacUeCfg->spCellCfg.servCellCfg.initUlBwp.puschPresent)
1351 fillStartSymbolAndLen(duMacUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg.numTimeDomRsrcAlloc,\
1352 NULL, &duMacUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg);
1357 ret = fillAmbr(&duMacUeCfg->ambrCfg, ueCfgDb->ambrCfg , &duMacDb->ambrCfg, FALSE);
1359 ret = fillAmbr(&duMacUeCfg->ambrCfg, ueCfgDb->ambrCfg , NULL, FALSE);
1361 duFillModulationDetails(duMacUeCfg, duMacDb, ueCfgDb->ueNrCapability);
1366 fillDefaultMacCellGrpInfo(duMacUeCfg);
1367 fillDefaultPhyCellGrpInfo(duMacUeCfg);
1368 fillDefaultSpCellGrpInfo(duMacUeCfg);
1369 fillDefaultModulation(duMacUeCfg);
1370 duMacUeCfg->ambrCfg = NULLP;
1375 duMacUeCfg->drxConfigIndicatorRelease = ueCfgDb->drxConfigIndicatorRelease;
1377 if(ueCfgDb->drxCyclePres)
1379 duMacUeCfg->macCellGrpCfg.drxCfg.drxLongCycleStartOffset.drxLongCycleStartOffsetChoice = ueCfgDb->drxCycle.drxLongCycleLength;
1380 if(ueCfgDb->drxCycle.shortDrxCyclePres)
1382 duMacUeCfg->macCellGrpCfg.drxCfg.shortDrxPres = true;
1383 duMacUeCfg->macCellGrpCfg.drxCfg.shortDrx.drxShortCycle = ueCfgDb->drxCycle.shortDrxCycle.drxShortCycle;
1384 duMacUeCfg->macCellGrpCfg.drxCfg.shortDrx.drxShortCycleTimer = ueCfgDb->drxCycle.shortDrxCycle.drxShortCycleTimer;
1388 duMacUeCfg->macCellGrpCfg.drxCfg.shortDrxPres = false;
1393 /* Filling LC Context */
1394 for(dbIdx = 0; (dbIdx < ueCfgDb->numMacLcs && ret == ROK); dbIdx++)
1396 if(!ueCfgDb->macLcCfg[dbIdx].lcConfig.ulLcCfgPres)
1398 /* Filling default UL LC config in MAC if not present */
1399 ueCfgDb->macLcCfg[dbIdx].lcConfig.ulLcCfgPres = true;
1400 fillDefaultUlLcCfg(&ueCfgDb->macLcCfg[dbIdx].lcConfig.ulLcCfg);
1405 for(lcIdx = 0; lcIdx < duMacDb->numLcs; lcIdx++)
1407 if(ueCfgDb->macLcCfg[dbIdx].lcConfig.lcId == duMacDb->lcCfgList[lcIdx].lcConfig.lcId)
1410 if((ueCfgDb->macLcCfg[dbIdx].configType == CONFIG_UNKNOWN) ||
1411 (ueCfgDb->macLcCfg[dbIdx].configType == CONFIG_MOD))
1413 ueCfgDb->macLcCfg[dbIdx].configType = CONFIG_MOD;
1414 ret = fillMacLcCfgToAddMod(&duMacUeCfg->lcCfgList[dbIdx], &ueCfgDb->macLcCfg[dbIdx],\
1415 &duMacDb->lcCfgList[lcIdx], FALSE);
1425 /* ADD/DEL CONFIG */
1426 ret = fillMacLcCfgToAddMod(&duMacUeCfg->lcCfgList[dbIdx], &ueCfgDb->macLcCfg[dbIdx], NULL, FALSE);
1430 duMacUeCfg->numLcs++;
1434 DU_LOG("\nERROR --> DU APP : Failed to add Lc at Idx %d in updateDuMacUeCfg()", dbIdx);
1437 }/*End of Outer FOR loop */
1438 memcpy(&ueCfgDb->copyOfmacUeCfg, duMacUeCfg, sizeof(DuMacUeCfg));
1443 /******************************************************************
1445 * @brief Fills Rlc AM Information
1449 * Function : fillDefaultAmInfo
1451 * Functionality: Fills Rlc AM Information
1453 * @params[in] AmBearerCfg *amCfg
1456 *****************************************************************/
1457 void fillDefaultAmInfo(AmBearerCfg *amCfg)
1460 amCfg->dlAmCfg.snLenDl = AM_SIZE_12;
1461 amCfg->dlAmCfg.pollRetxTmr = T_POLL_RETRANSMIT_VAL;
1462 amCfg->dlAmCfg.pollPdu = POLL_PDU_VAL;
1463 amCfg->dlAmCfg.pollByte = POLL_BYTE_VAL;
1464 amCfg->dlAmCfg.maxRetxTh = MAX_RETX_THRESHOLD_VAL;
1467 amCfg->ulAmCfg.snLenUl = AM_SIZE_12;
1468 amCfg->ulAmCfg.reAssemTmr = T_REASSEMBLY_VAL;
1469 amCfg->ulAmCfg.statProhTmr = T_STATUS_PROHIBHIT_VAL;
1472 /******************************************************************
1474 * @brief Fills RLC UM Bi Directional Information
1478 * Function : fillDefaultUmBiInfo
1480 * Functionality: Fills RLC UM Bi Directional Information
1482 * @params[in] UmBiDirBearerCfg *umBiDirCfg
1485 *****************************************************************/
1486 void fillDefaultUmBiInfo(UmBiDirBearerCfg *umBiDirCfg)
1488 /* UL UM BI DIR INFO */
1489 umBiDirCfg->ulUmCfg.snLenUlUm = UM_SIZE_12;
1490 umBiDirCfg->ulUmCfg.reAssemTmr = T_REASSEMBLY_VAL;
1492 /* DL UM BI DIR INFO */
1493 umBiDirCfg->dlUmCfg.snLenDlUm = UM_SIZE_12;
1496 /******************************************************************
1498 * @brief Fills RLC UM Uni Directional UL Information
1502 * Function : fillDefaultUmUlInfo
1504 * Functionality: Fills RLC UM Uni Directional Info
1506 * @params[in] UmUniDirUlBearerCfg *UmUlCfg
1509 *****************************************************************/
1510 void fillDefaultUmUlInfo(UmUniDirUlBearerCfg *UmUlCfg)
1512 UmUlCfg->ulUmCfg.snLenUlUm = UM_SIZE_12;
1513 UmUlCfg->ulUmCfg.reAssemTmr = T_REASSEMBLY_VAL;
1516 /******************************************************************
1518 * @brief Fills RLC UM Uni Directional DL Information
1522 * Function : fillDefaultUmDlInfo
1524 * Functionality: Fills RLC UM Uni Directional DL Info
1526 * @params[in] UmUniDirDlBearerCfg *UmDlCfg
1529 *****************************************************************/
1530 void fillDefaultUmDlInfo(UmUniDirDlBearerCfg *UmDlCfg)
1532 UmDlCfg->dlUmCfg.snLenDlUm = UM_SIZE_12;
1535 /******************************************************************
1537 * @brief Builds Rlc Mode Default Configuration
1541 * Function : fillDefaultRlcModeCfg
1543 * Functionality: Builds Rlc Mode Default Configuration
1545 * @params[in] rlcMode, RlcBearerCfg *lcCfg
1546 * @return ROK/RFAILED
1548 *****************************************************************/
1550 uint8_t fillDefaultRlcModeCfg(uint8_t rlcMode, RlcBearerCfg *lcCfg)
1560 DU_ALLOC_SHRABL_BUF(lcCfg->u.amCfg, sizeof(AmBearerCfg));
1562 fillDefaultAmInfo(lcCfg->u.amCfg);
1565 DU_LOG("\n ERROR --> DU APP : Memory Alloc failed at AmCfg at fillDefaultRlcModeCfg()");
1571 case RLC_UM_BI_DIRECTIONAL :
1573 if(!lcCfg->u.umBiDirCfg)
1575 DU_ALLOC_SHRABL_BUF(lcCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
1576 if(lcCfg->u.umBiDirCfg)
1577 fillDefaultUmBiInfo(lcCfg->u.umBiDirCfg);
1580 DU_LOG("\n ERROR --> DU APP : Memory Alloc failed at UmBiDirCfg at fillDefaultRlcModeCfg()");
1586 case RLC_UM_UNI_DIRECTIONAL_UL :
1588 if(!lcCfg->u.umUniDirUlCfg)
1590 DU_ALLOC_SHRABL_BUF(lcCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
1591 if(lcCfg->u.umUniDirUlCfg)
1592 fillDefaultUmUlInfo(lcCfg->u.umUniDirUlCfg);
1595 DU_LOG("\n ERROR --> DU APP : Memory Alloc failed at UmUniDirUlCfg at fillDefaultRlcModeCfg()");
1601 case RLC_UM_UNI_DIRECTIONAL_DL :
1603 if(!lcCfg->u.umUniDirDlCfg)
1605 DU_ALLOC_SHRABL_BUF(lcCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
1606 if(lcCfg->u.umUniDirDlCfg)
1607 fillDefaultUmDlInfo(lcCfg->u.umUniDirDlCfg);
1610 DU_LOG("\n ERROR --> DU APP : Memory Alloc failed at UmUniDirDlCfg at fillDefaultRlcModeCfg()");
1617 DU_LOG("\nERROR --> DUAPP: Invalid rlcMode %d at extractRlcCfgToAddMod()", rlcMode);
1624 DU_LOG("\nERROR --> DUAPP: Received LC Config is NULL");
1630 /*******************************************************************
1632 * @brief Function to fill Rlc Lc Cfg for SRB1
1636 * Function : fillRlcSrb1LcCfg
1639 * Function to fill Rlc Lc Cfg for SRB1
1641 * @params[in] Pointer to RlcBearerCfg
1642 * @return ROK/RFAILED
1644 *****************************************************************/
1646 uint8_t fillRlcSrb1LcCfg(DuRlcBearerCfg *rlcLcCfg)
1650 rlcLcCfg->rlcBearerCfg.rbId = SRB1_LCID;
1651 rlcLcCfg->rlcBearerCfg.rbType = RB_TYPE_SRB;
1652 rlcLcCfg->rlcBearerCfg.lcId = SRB1_LCID;
1653 rlcLcCfg->rlcBearerCfg.lcType = LCH_DCCH;
1654 rlcLcCfg->rlcBearerCfg.rlcMode = RLC_AM;
1655 rlcLcCfg->configType = CONFIG_ADD;
1656 ret = fillDefaultRlcModeCfg(rlcLcCfg->rlcBearerCfg.rlcMode, &rlcLcCfg->rlcBearerCfg);
1657 rlcLcCfg->rlcBearerCfg.isLcAddModRspSent = true;
1661 /*******************************************************************
1663 * @brief Processes UE ReConfig Req to RLC UL
1667 * Function : sendUeRecfgReqToRlc
1670 * Processes UE Reconfig Req to RLC UL
1672 * @params[in] Pointer to RlcUeRecfg
1673 * @return ROK - success
1676 *****************************************************************/
1678 uint8_t sendUeRecfgReqToRlc(RlcUeRecfg *rlcUeRecfg)
1683 FILL_PST_DUAPP_TO_RLC(pst, RLC_UL_INST, EVENT_RLC_UE_RECONFIG_REQ);
1686 /* Processing one Ue at a time to RLC */
1687 DU_LOG("\nDEBUG --> DU_APP: Sending Ue Reconfig Request to RLC UL");
1688 ret = (*packRlcUeReconfigReqOpts[pst.selector])(&pst, rlcUeRecfg);
1691 DU_LOG("\nERROR --> DU_APP : Failed to send Ue Reconfig Req to RLC at sendUeRecfgReqToRlc()");
1692 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rlcUeRecfg, sizeof(RlcUeRecfg));
1697 DU_LOG("\nERROR --> DU_APP: Received RlcUeRecfg is NULL at sendUeRecfgReqToRlc()");
1703 /******************************************************************
1705 * @brief Fills Snssai information
1709 * Function : fillSnssaiInfo
1711 * Functionality: Fills Snssai information
1713 * @params[in] LcCfg *snssaiTobeSend, LcCfg *snssaiDb, LcCfg *oldSnssai,
1715 * @return ROK - success
1718 *****************************************************************/
1719 uint8_t fillSnssaiInfo(Snssai *snssaiTobeSend, Snssai *snssaiDb, Snssai **oldSnssai, Bool toUpdate)
1724 snssaiTobeSend = snssaiDb;
1726 snssaiTobeSend = *oldSnssai;
1728 snssaiTobeSend = NULL;
1735 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, *oldSnssai, sizeof(Snssai));
1737 DU_ALLOC_SHRABL_BUF(*oldSnssai, sizeof(Snssai));
1738 if(*oldSnssai == NULL)
1740 DU_LOG("\nERROR --> DU APP : Memory Alloc Failed at fillSnssaiInfo()");
1743 memcpy(*oldSnssai, snssaiDb, sizeof(Snssai));
1748 /******************************************************************
1750 * @brief Fills RlcBearerCfg structure
1754 * Function : updateRlcUeCfg
1756 * Functionality: Fills Rlc Bearer Cfg
1759 *****************************************************************/
1760 uint8_t updateRlcUeCfg(uint16_t cellId, uint8_t duUeF1apId, DuUeCfg *ueCfgDb, DuRlcUeCfg *rlcUeCfg)
1762 uint8_t ret, dbIdx, lcIdx, cellIdx;
1763 bool lcIdFound = false;
1764 DuRlcUeCfg *duRlcDb = NULLP;
1767 rlcUeCfg->cellId = cellId;
1768 rlcUeCfg->ueId = duUeF1apId;
1772 /* Initial RB being Added */
1773 ret = fillRlcSrb1LcCfg(&rlcUeCfg->rlcLcCfg[0]);
1777 memset(rlcUeCfg, 0, sizeof(DuRlcUeCfg));
1781 /* Fetch RlcDb from DuUeCb */
1782 GET_CELL_IDX(cellId, cellIdx);
1783 duRlcDb = &duCb.actvCellLst[cellIdx]->ueCb[rlcUeCfg->ueId-1].duRlcUeCfg;
1784 duRlcDb->rlcUeCfgState = UE_CFG_INPROGRESS;
1786 for(dbIdx = 0; (dbIdx < ueCfgDb->numRlcLcs && ret == ROK); dbIdx++)
1788 ret = fillDefaultRlcModeCfg(ueCfgDb->rlcLcCfg[dbIdx].rlcBearerCfg.rlcMode, &ueCfgDb->rlcLcCfg[dbIdx].rlcBearerCfg);
1791 DU_LOG("\n ERROR --> DU APP : Failed to fill Rlc Mode at fillRlcUeCfg()");
1792 memset(rlcUeCfg, 0, sizeof(DuRlcUeCfg));
1798 /* Fill Rlc Ue Cfg List for ADD/MOD/DEL */
1799 for(lcIdx = 0; lcIdx < duRlcDb->numLcs; lcIdx++)
1801 if(ueCfgDb->rlcLcCfg[dbIdx].rlcBearerCfg.lcId == duRlcDb->rlcLcCfg[lcIdx].rlcBearerCfg.lcId)
1804 if((ueCfgDb->rlcLcCfg[dbIdx].configType == CONFIG_UNKNOWN)||
1805 (ueCfgDb->rlcLcCfg[dbIdx].configType == CONFIG_MOD))
1808 ueCfgDb->rlcLcCfg[dbIdx].configType = CONFIG_MOD; /* update Db for MOD type */
1809 memcpy(&rlcUeCfg->rlcLcCfg[dbIdx], &ueCfgDb->rlcLcCfg[dbIdx], sizeof(DuRlcBearerCfg));
1810 fillSnssaiInfo(rlcUeCfg->rlcLcCfg[dbIdx].rlcBearerCfg.snssai, ueCfgDb->rlcLcCfg[dbIdx].rlcBearerCfg.snssai,\
1811 &duRlcDb->rlcLcCfg[lcIdx].rlcBearerCfg.snssai,false);
1821 /* ADD/ DEL Config Type */
1822 memcpy(&rlcUeCfg->rlcLcCfg[dbIdx], &ueCfgDb->rlcLcCfg[dbIdx], sizeof(DuRlcBearerCfg));
1823 fillSnssaiInfo(rlcUeCfg->rlcLcCfg[dbIdx].rlcBearerCfg.snssai, ueCfgDb->rlcLcCfg[dbIdx].rlcBearerCfg.snssai, NULL, false);
1831 /******************************************************************
1833 * @brief creates UE context
1837 * Function : duCreateUeCb
1839 * Functionality: Creates UE Conetxt
1841 * @params[in] UeCcchCtxt Pointer
1844 * @return ROK - success
1846 * ****************************************************************/
1847 uint8_t duCreateUeCb(UeCcchCtxt *ueCcchCtxt, uint32_t gnbCuUeF1apId)
1849 uint8_t cellIdx = 0;
1851 uint8_t ueId = 0, ueIdx = 0;
1853 for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
1855 if(duCb.actvCellLst[cellIdx] && (ueCcchCtxt->cellId == duCb.actvCellLst[cellIdx]->cellId))
1857 GET_UE_ID(ueCcchCtxt->crnti, ueId);
1858 DU_LOG("\nDEBUG --> DU_APP: Filling UeCb for ueId [%d]", ueId);
1861 duCb.actvCellLst[cellIdx]->ueCb[ueIdx].f1UeDb = NULLP;
1862 duCb.actvCellLst[cellIdx]->ueCb[ueIdx].crnti = ueCcchCtxt->crnti;
1863 duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId = ueCcchCtxt->gnbDuUeF1apId;
1864 duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId = gnbCuUeF1apId;
1865 duCb.actvCellLst[cellIdx]->ueCb[ueIdx].drbBitMap = NULLP;
1866 duCb.actvCellLst[cellIdx]->ueCb[ueIdx].ueState = UE_ACTIVE;
1868 /* Filling Mac Ue Config */
1869 memset(&duCb.actvCellLst[cellIdx]->ueCb[ueIdx].duMacUeCfg, 0, sizeof(DuMacUeCfg));
1870 ret = duBuildAndSendUeCreateReqToMac(ueCcchCtxt->cellId, ueCcchCtxt->gnbDuUeF1apId, ueCcchCtxt->crnti, NULL,
1871 &duCb.actvCellLst[cellIdx]->ueCb[ueIdx].duMacUeCfg);
1873 DU_LOG("\nERROR --> DU APP : Failed to send UE create request to MAC");
1875 /* Filling Rlc Ue Config */
1876 memset(&duCb.actvCellLst[cellIdx]->ueCb[ueIdx].duRlcUeCfg, 0, sizeof(DuRlcUeCfg));
1877 ret = duBuildAndSendUeCreateReqToRlc(ueCcchCtxt->cellId, ueCcchCtxt->gnbDuUeF1apId, NULL,
1878 &duCb.actvCellLst[cellIdx]->ueCb[ueIdx].duRlcUeCfg);
1880 DU_LOG("\nERROR --> DU APP : Failed to send UE create request to RLC");
1882 duCb.actvCellLst[cellIdx]->numActvUes++;
1883 memset(ueCcchCtxt, 0, sizeof(UeCcchCtxt));
1890 /**********************************************************************************
1892 * @brief Fills Ue Cfg from DU DB to MacUeCreateReq
1896 * Function : fillMacUeCfg
1898 * Functionality: fills ue Cfg to be sent to MAC
1900 * @params[in] DuMacUeCfg Pointer
1901 * MacUeCreateReq Pointer
1903 * @return ROK - success
1905 * *******************************************************************************/
1906 void fillMacUeCfg(DuMacUeCfg *duMacUeCfg, MacUeCreateReq *macUeCfg)
1910 macUeCfg->cellId = duMacUeCfg->cellId;
1911 macUeCfg->ueId = duMacUeCfg->ueId;
1912 macUeCfg->crnti = duMacUeCfg->crnti;
1913 macUeCfg->macCellGrpCfgPres = duMacUeCfg->macCellGrpCfgPres;
1914 if(macUeCfg->macCellGrpCfgPres)
1916 memcpy(&macUeCfg->macCellGrpCfg, &duMacUeCfg->macCellGrpCfg, sizeof(MacCellGrpCfg));
1918 macUeCfg->phyCellGrpCfgPres = duMacUeCfg->phyCellGrpCfgPres;
1919 if(macUeCfg->phyCellGrpCfgPres)
1921 memcpy(&macUeCfg->phyCellGrpCfg, &duMacUeCfg->phyCellGrpCfg, sizeof(PhyCellGrpCfg));
1923 macUeCfg->spCellCfgPres = duMacUeCfg->spCellCfgPres;
1924 if(macUeCfg->spCellCfgPres)
1926 macUeCfg->spCellCfg.servCellIdx = duMacUeCfg->spCellCfg.servCellIdx;
1927 macUeCfg->spCellCfg.servCellCfg.initDlBwp = duMacUeCfg->spCellCfg.servCellCfg.initDlBwp;
1928 macUeCfg->spCellCfg.servCellCfg.numDlBwpToAdd = duMacUeCfg->spCellCfg.servCellCfg.numDlBwpToAddOrMod;
1929 if(macUeCfg->spCellCfg.servCellCfg.numDlBwpToAdd > 0)
1931 memcpy(macUeCfg->spCellCfg.servCellCfg.dlBwpToAddList, duMacUeCfg->spCellCfg.servCellCfg.dlBwpToAddOrModList, \
1932 (sizeof(DlBwpInfo) * MAX_NUM_BWP));
1934 macUeCfg->spCellCfg.servCellCfg.firstActvDlBwpId = duMacUeCfg->spCellCfg.servCellCfg.firstActvDlBwpId;
1935 macUeCfg->spCellCfg.servCellCfg.defaultDlBwpId = duMacUeCfg->spCellCfg.servCellCfg.defaultDlBwpId;
1936 macUeCfg->spCellCfg.servCellCfg.bwpInactivityTmr = duMacUeCfg->spCellCfg.servCellCfg.bwpInactivityTmr;
1937 memcpy(&macUeCfg->spCellCfg.servCellCfg.pdschServCellCfg, &duMacUeCfg->spCellCfg.servCellCfg.pdschServCellCfg, sizeof(PdschServCellCfg));
1938 memcpy(&macUeCfg->spCellCfg.servCellCfg.initUlBwp, &duMacUeCfg->spCellCfg.servCellCfg.initUlBwp, sizeof(InitialUlBwp));
1939 macUeCfg->spCellCfg.servCellCfg.numUlBwpToAdd = duMacUeCfg->spCellCfg.servCellCfg.numUlBwpToAddOrMod;
1940 if(macUeCfg->spCellCfg.servCellCfg.numUlBwpToAdd > 0)
1942 memcpy(macUeCfg->spCellCfg.servCellCfg.ulBwpToAddList, duMacUeCfg->spCellCfg.servCellCfg.ulBwpToAddOrModList,\
1943 (sizeof(UlBwpInfo) * MAX_NUM_BWP));
1945 macUeCfg->spCellCfg.servCellCfg.firstActvUlBwpId = duMacUeCfg->spCellCfg.servCellCfg.firstActvUlBwpId;
1947 if(duMacUeCfg->ambrCfg != NULLP)
1949 memcpy(macUeCfg->ambrCfg, duMacUeCfg->ambrCfg, sizeof(AmbrCfg));
1951 memcpy(&macUeCfg->dlModInfo, &duMacUeCfg->dlModInfo, sizeof(ModulationInfo));
1952 memcpy(&macUeCfg->ulModInfo, &duMacUeCfg->ulModInfo, sizeof(ModulationInfo));
1953 if(duMacUeCfg->numLcs > 0)
1955 macUeCfg->numLcs = 0;
1956 for(lcIdx = 0; lcIdx < duMacUeCfg->numLcs; lcIdx++)
1958 if(duMacUeCfg->lcCfgList[lcIdx].configType == CONFIG_ADD)
1960 //VS: To thoroughly check
1961 memcpy(&macUeCfg->lcCfgList[macUeCfg->numLcs], &duMacUeCfg->lcCfgList[lcIdx].lcConfig, sizeof(LcCfg));
1968 /**********************************************************************************
1970 * @brief Fills Ue Cfg from DU DB to RLCUeCfg
1974 * Function : fillRlcUeCfg
1976 * Functionality: fills ue Cfg to be sent to RLC
1978 * @params[in] DuRlcUeCfg Pointer
1979 * RlcUeCreate Pointer
1981 * @return ROK - success
1983 * *******************************************************************************/
1984 void fillRlcUeCfg(DuRlcUeCfg *duRlcUeCfg, RlcUeCreate *rlcUeCfg)
1988 rlcUeCfg->cellId = duRlcUeCfg->cellId;
1989 rlcUeCfg->ueId = duRlcUeCfg->ueId;
1991 rlcUeCfg->numLcsToAdd = 0;
1992 for(lcIdx = 0; lcIdx < duRlcUeCfg->numLcs; lcIdx++)
1994 if(duRlcUeCfg->rlcLcCfg[lcIdx].configType == CONFIG_ADD)
1996 memcpy(&rlcUeCfg->rlcLcCfgAdd[rlcUeCfg->numLcsToAdd], &duRlcUeCfg->rlcLcCfg[lcIdx].rlcBearerCfg, sizeof(RlcBearerCfg));
1997 rlcUeCfg->numLcsToAdd++;
2003 /******************************************************************
2005 * @brief Builds and Send UE Create Request to MAC
2009 * Function : duBuildAndSendUeCreateReqToMac
2011 * Functionality: Builds and Send UE Create Request to MAC
2013 * @Params[in] cellId,
2016 * UE config extracted from F1AP msg
2017 * MAC UE config struct to be filled
2018 * @return ROK - success
2021 * ****************************************************************/
2023 uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t gnbDuUeF1apId, uint16_t crnti, DuUeCfg *ueCfgDb, DuMacUeCfg *duMacUeCfg)
2026 MacUeCreateReq *macUeCfg = NULLP;
2028 memset(&pst, 0, sizeof(Pst));
2031 ret = updateDuMacUeCfg(cellId, gnbDuUeF1apId, crnti, ueCfgDb, duMacUeCfg);
2034 DU_LOG("\nERROR --> DU APP : Failed to fill MacUeCfg at duBuildAndSendUeCreateReqToMac()");
2039 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_CREATE_REQ);
2041 /* Copying ueCb to a sharable buffer */
2042 DU_ALLOC_SHRABL_BUF(macUeCfg, sizeof(MacUeCreateReq));
2045 memset(macUeCfg, 0, sizeof(MacUeCreateReq));
2046 fillMacUeCfg(duMacUeCfg, macUeCfg);
2047 DU_LOG("\nDEBUG --> DU_APP: Sending UE create request to MAC");
2049 /* Processing one Ue at a time to MAC */
2050 ret = (*packMacUeCreateReqOpts[pst.selector])(&pst, macUeCfg);
2053 DU_LOG("\nERROR --> DU_APP : Failure in sending Ue Create Req to MAC at duBuildAndSendUeCreateReqToMac()");
2054 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macUeCfg, sizeof(MacUeCreateReq));
2059 DU_LOG("\n ERROR --> DU APP : Memory alloc failed at duBuildAndSendUeCreateReqToMac()");
2065 /*******************************************************************
2067 * @brief Build and send RACH Resource request to MAC
2071 * Function : duBuildAndSendRachRsrcReqToMac
2073 * Build and send RACH Resource request to MAC
2075 * @params[in] Cell Id
2077 * @return ROK - success
2080 * ****************************************************************/
2081 uint8_t duBuildAndSendRachRsrcReqToMac(uint16_t cellId, uint16_t ueId)
2083 uint16_t cellIdx = 0, ssbIdx = 0;
2085 MacRachRsrcReq *rachRsrcReq = NULLP;
2087 GET_CELL_IDX(cellId, cellIdx);
2088 if(duCb.actvCellLst[cellIdx] == NULLP)
2090 DU_LOG("\nERROR --> DU APP : Cell Id [%d] not found in duBuildAndSendRachRsrcReqToMac()", cellId);
2094 DU_ALLOC_SHRABL_BUF(rachRsrcReq, sizeof(MacRachRsrcReq));
2097 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for RACH Resource Request in \
2098 duBuildAndSendRachRsrcReqToMac()");
2102 rachRsrcReq->cellId = cellId;
2103 rachRsrcReq->ueId = ueId;
2104 rachRsrcReq->numSsb = duCfgParam.macCellCfg.prachCfg.ssbPerRach;
2105 for(ssbIdx = 0; ssbIdx < rachRsrcReq->numSsb; ssbIdx++)
2107 rachRsrcReq->ssbIdx[ssbIdx] = ssbIdx;
2111 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_RACH_RESOURCE_REQ);
2113 if(((*packMacRachRsrcReqOpts[pst.selector])(&pst, rachRsrcReq)) != ROK)
2115 DU_LOG("\nERROR --> DU_APP : Failure in sending RACH Resource Request to MAC at \
2116 duBuildAndSendRachRsrcReqToMac()");
2117 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rachRsrcReq, sizeof(MacRachRsrcReq));
2124 /*******************************************************************
2126 * @brief Process RACH resource response from MAC
2130 * Function : DuProcMacRachRsrcRsp
2132 * Process RACH resource response from MAC
2134 * @params[in] Post structure
2135 * RACH resource response
2136 * @return ROK - success
2139 * ****************************************************************/
2140 uint8_t DuProcMacRachRsrcRsp(Pst *pst, MacRachRsrcRsp *rachRsrcRsp)
2142 uint8_t ret = RFAILED;
2143 uint16_t cellIdx = 0;
2144 DuCellCb *cellCb = NULLP;
2145 DuUeCb *ueCb = NULLP;
2147 DU_LOG("\nINFO --> DU APP : Received RACH Resource Response from MAC. Cell ID [%d] UE ID [%d]",
2148 rachRsrcRsp->cellId, rachRsrcRsp->ueId);
2150 if(rachRsrcRsp->result == MAC_DU_APP_RSP_OK)
2152 DU_LOG("\nINFO : DU APP : RACH Resource Response from MAC : Result [SUCCESS]");
2155 GET_CELL_IDX(rachRsrcRsp->cellId, cellIdx);
2156 if(duCb.actvCellLst[cellIdx] && (duCb.actvCellLst[cellIdx]->cellId == rachRsrcRsp->cellId))
2158 cellCb = duCb.actvCellLst[cellIdx];
2161 if(cellCb->ueCb[rachRsrcRsp->ueId-1].gnbDuUeF1apId == rachRsrcRsp->ueId)
2163 ueCb = &cellCb->ueCb[rachRsrcRsp->ueId-1];
2165 /* Store CRNTI alloted to this UE by MAC */
2166 ueCb->crnti = rachRsrcRsp->newCrnti;
2168 /* Store the assigned CF-RA resources */
2169 memcpy(&ueCb->cfraResource, &rachRsrcRsp->cfraResource, sizeof(MacCfraResource));
2171 /* RACH resources allocated to UE is sent to CU in UE Context Setup Response
2172 * along with the result of UE Context setup requested by CU */
2173 if((ret = BuildAndSendUeCtxtRsp(rachRsrcRsp->cellId, rachRsrcRsp->ueId)) != ROK)
2174 DU_LOG("\nERROR -> DU APP : Failure in BuildAndSendUeCtxtRsp()");
2177 DU_LOG("\nERROR --> DU APP : UE ID [%d] not found in DuProcMacRachRsrcRsp", rachRsrcRsp->ueId);
2180 DU_LOG("\nERROR --> DU APP : Cell ID [%d] not found in DuProcMacRachRsrcRsp", rachRsrcRsp->cellId);
2183 DU_LOG("\nINFO : DU APP : RACH Resource Response from MAC : Result [FAILURE]");
2185 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rachRsrcRsp, sizeof(MacRachRsrcRsp));
2189 /*******************************************************************
2191 * @brief fill k0 value in duCb
2195 * Function : fillK0Values
2196 * Functionality: update k0 value in duCb
2198 * @params[in] PdschConfig *cuPdschCfg, PdschConfig *storePdschCfg
2199 * @return ROK - success
2202 * ****************************************************************/
2204 uint8_t fillK0Values(PdschConfig *cuPdschCfg, PdschConfig *storePdschCfg)
2206 uint8_t numTimeDomRsrcAlloc, rsrcIdx;
2210 if(storePdschCfg->numTimeDomRsrcAlloc)
2212 numTimeDomRsrcAlloc = cuPdschCfg->numTimeDomRsrcAlloc;
2213 for(rsrcIdx =0 ; rsrcIdx<numTimeDomRsrcAlloc; rsrcIdx++)
2215 if(cuPdschCfg->timeDomRsrcAllociList[rsrcIdx].k0)
2217 if(storePdschCfg->timeDomRsrcAllociList[rsrcIdx].k0)
2219 *(storePdschCfg->timeDomRsrcAllociList[rsrcIdx].k0) = *(cuPdschCfg->timeDomRsrcAllociList[rsrcIdx].k0);
2220 if(storePdschCfg->timeDomRsrcAllociList[rsrcIdx].k0 != cuPdschCfg->timeDomRsrcAllociList[rsrcIdx].k0)
2221 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cuPdschCfg->timeDomRsrcAllociList[rsrcIdx].k0, sizeof(uint8_t));
2225 (storePdschCfg->timeDomRsrcAllociList[rsrcIdx].k0) = (cuPdschCfg->timeDomRsrcAllociList[rsrcIdx].k0);
2234 /*******************************************************************
2236 * @brief To update DuUeCb Mac Cfg
2240 * Function : duUpdateMacCfg
2241 * Functionality: update DuUeCb MAC Cfg
2243 * @params[in] DuUeCb Pointer
2244 * F1UeContextSetupDb pointer
2245 * @return ROK - success
2248 * ****************************************************************/
2249 uint8_t duUpdateMacCfg(DuMacUeCfg *macUeCfg, F1UeContextSetupDb *f1UeDb)
2251 uint8_t ret, lcIdx, dbIdx, numLcs, lcDelIdx, cellIdx;
2252 DuMacUeCfg *oldMacUeCfg;
2255 GET_CELL_IDX(macUeCfg->cellId, cellIdx);
2256 if(duCb.actvCellLst[cellIdx] == NULLP)
2258 DU_LOG("\nERROR --> DU APP: CellId[%d] not found", macUeCfg->cellId);
2261 oldMacUeCfg = &duCb.actvCellLst[cellIdx]->ueCb[macUeCfg->ueId-1].duMacUeCfg;
2263 /*Filling Cell Group Cfg*/
2264 ret = procUeRecfgCellInfo(macUeCfg, &f1UeDb->duUeCfg.copyOfmacUeCfg, f1UeDb->duUeCfg.cellGrpCfg);
2266 memcpy(&macUeCfg->macCellGrpCfg.drxCfg, &f1UeDb->duUeCfg.copyOfmacUeCfg.macCellGrpCfg.drxCfg, sizeof(DrxCfg));
2270 if(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschPresent)
2272 /* update k0 values */
2273 fillK0Values(&f1UeDb->duUeCfg.copyOfmacUeCfg.spCellCfg.servCellCfg.initDlBwp.pdschCfg, &macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg);
2274 fillStartSymbolAndLen(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg.numTimeDomRsrcAlloc,\
2275 &macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg, NULL);
2277 if(macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschPresent)
2279 fillStartSymbolAndLen(macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg.numTimeDomRsrcAlloc,\
2280 NULL, &macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg);
2282 ret = fillAmbr(NULL, f1UeDb->duUeCfg.ambrCfg, &oldMacUeCfg->ambrCfg, true);
2283 duFillModulationDetails(macUeCfg, oldMacUeCfg, f1UeDb->duUeCfg.ueNrCapability);
2286 /* Filling LC Context */
2287 for(dbIdx = 0; (dbIdx < f1UeDb->duUeCfg.numMacLcs && ret == ROK); dbIdx++)
2289 numLcs = macUeCfg->numLcs;
2290 for(lcIdx = 0; lcIdx < numLcs; lcIdx++)
2292 if(f1UeDb->duUeCfg.macLcCfg[dbIdx].lcConfig.lcId == macUeCfg->lcCfgList[lcIdx].lcConfig.lcId)
2294 if(f1UeDb->duUeCfg.macLcCfg[dbIdx].configType == CONFIG_MOD)
2296 ret = fillMacLcCfgToAddMod(NULL, &f1UeDb->duUeCfg.macLcCfg[dbIdx], &macUeCfg->lcCfgList[lcIdx], true);
2298 else if(f1UeDb->duUeCfg.macLcCfg[dbIdx].configType == CONFIG_DEL)
2300 /* Free memory at matched lcIdx index */
2301 freeMacLcCfg(&macUeCfg->lcCfgList[lcIdx].lcConfig);
2303 for(lcDelIdx = lcIdx; lcDelIdx < macUeCfg->numLcs; lcDelIdx++)
2305 /* moving all elements one index ahead */
2306 ret = fillMacLcCfgToAddMod(NULL, &macUeCfg->lcCfgList[lcDelIdx+1], &macUeCfg->lcCfgList[lcDelIdx], true);
2307 freeMacLcCfg(&macUeCfg->lcCfgList[lcDelIdx+1].lcConfig);
2310 DU_LOG("\nERROR --> DU APP : Failed to delete LC at Idx %d in duUpdateMacCfg()", lcDelIdx);
2317 if(f1UeDb->duUeCfg.macLcCfg[dbIdx].configType == CONFIG_ADD)
2319 ret = fillMacLcCfgToAddMod(NULL, &f1UeDb->duUeCfg.macLcCfg[dbIdx], &macUeCfg->lcCfgList[numLcs], true);
2322 DU_LOG("\nERROR --> DU APP : Failed to add LC at Idx %d in duUpdateMacCfg()", numLcs);
2332 /******************************************************************
2334 * @brief Function to fill the RLC Lc cfg from ueSetupReqDb
2338 * Function : fillRlcCfgToAddMod
2340 * Functionality: Function to fill the RLC Lc cfg from ueSetupReqDb
2343 *****************************************************************/
2345 uint8_t fillRlcCfgToAddMod(DuRlcBearerCfg *lcCfg, DuRlcBearerCfg *f1UeDbLcCfg)
2347 lcCfg->configType = f1UeDbLcCfg->configType;
2348 lcCfg->rlcBearerCfg.rbId = f1UeDbLcCfg->rlcBearerCfg.rbId;
2349 lcCfg->rlcBearerCfg.rbType = f1UeDbLcCfg->rlcBearerCfg.rbType;
2350 lcCfg->rlcBearerCfg.lcId = f1UeDbLcCfg->rlcBearerCfg.lcId;
2351 lcCfg->rlcBearerCfg.lcType = f1UeDbLcCfg->rlcBearerCfg.lcType;
2352 lcCfg->rlcBearerCfg.rlcMode = f1UeDbLcCfg->rlcBearerCfg.rlcMode;
2354 switch(lcCfg->rlcBearerCfg.rlcMode)
2358 if(!lcCfg->rlcBearerCfg.u.amCfg)
2360 DU_ALLOC_SHRABL_BUF(lcCfg->rlcBearerCfg.u.amCfg, sizeof(AmBearerCfg));
2361 if(!lcCfg->rlcBearerCfg.u.amCfg)
2365 lcCfg->rlcBearerCfg.u.amCfg->dlAmCfg.snLenDl = f1UeDbLcCfg->rlcBearerCfg.u.amCfg->dlAmCfg.snLenDl;
2366 lcCfg->rlcBearerCfg.u.amCfg->dlAmCfg.pollRetxTmr = f1UeDbLcCfg->rlcBearerCfg.u.amCfg->dlAmCfg.pollRetxTmr;
2367 lcCfg->rlcBearerCfg.u.amCfg->dlAmCfg.pollPdu = f1UeDbLcCfg->rlcBearerCfg.u.amCfg->dlAmCfg.pollPdu;
2368 lcCfg->rlcBearerCfg.u.amCfg->dlAmCfg.pollByte = f1UeDbLcCfg->rlcBearerCfg.u.amCfg->dlAmCfg.pollByte;
2369 lcCfg->rlcBearerCfg.u.amCfg->dlAmCfg.maxRetxTh = f1UeDbLcCfg->rlcBearerCfg.u.amCfg->dlAmCfg.maxRetxTh;
2372 lcCfg->rlcBearerCfg.u.amCfg->ulAmCfg.snLenUl = f1UeDbLcCfg->rlcBearerCfg.u.amCfg->ulAmCfg.snLenUl;
2373 lcCfg->rlcBearerCfg.u.amCfg->ulAmCfg.reAssemTmr = f1UeDbLcCfg->rlcBearerCfg.u.amCfg->ulAmCfg.reAssemTmr;
2374 lcCfg->rlcBearerCfg.u.amCfg->ulAmCfg.statProhTmr = f1UeDbLcCfg->rlcBearerCfg.u.amCfg->ulAmCfg.statProhTmr;
2377 case RLC_UM_BI_DIRECTIONAL :
2379 if(!lcCfg->rlcBearerCfg.u.umBiDirCfg)
2381 DU_ALLOC_SHRABL_BUF(lcCfg->rlcBearerCfg.u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
2382 if(!lcCfg->rlcBearerCfg.u.umBiDirCfg)
2385 /* UL UM BI DIR INFO */
2386 lcCfg->rlcBearerCfg.u.umBiDirCfg->ulUmCfg.snLenUlUm = f1UeDbLcCfg->rlcBearerCfg.u.umBiDirCfg->ulUmCfg.snLenUlUm;
2387 lcCfg->rlcBearerCfg.u.umBiDirCfg->ulUmCfg.reAssemTmr = f1UeDbLcCfg->rlcBearerCfg.u.umBiDirCfg->ulUmCfg.reAssemTmr;
2388 /* DL UM BI DIR INFO */
2389 lcCfg->rlcBearerCfg.u.umBiDirCfg->dlUmCfg.snLenDlUm = f1UeDbLcCfg->rlcBearerCfg.u.umBiDirCfg->dlUmCfg.snLenDlUm;
2392 case RLC_UM_UNI_DIRECTIONAL_UL :
2394 if(!lcCfg->rlcBearerCfg.u.umUniDirUlCfg)
2396 DU_ALLOC_SHRABL_BUF(lcCfg->rlcBearerCfg.u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
2397 if(!lcCfg->rlcBearerCfg.u.umUniDirUlCfg)
2400 lcCfg->rlcBearerCfg.u.umUniDirUlCfg->ulUmCfg.snLenUlUm = f1UeDbLcCfg->rlcBearerCfg.u.umUniDirUlCfg->ulUmCfg.snLenUlUm;
2401 lcCfg->rlcBearerCfg.u.umUniDirUlCfg->ulUmCfg.reAssemTmr = f1UeDbLcCfg->rlcBearerCfg.u.umUniDirUlCfg->ulUmCfg.reAssemTmr;
2405 case RLC_UM_UNI_DIRECTIONAL_DL :
2407 if(!lcCfg->rlcBearerCfg.u.umUniDirDlCfg)
2409 DU_ALLOC_SHRABL_BUF(lcCfg->rlcBearerCfg.u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
2410 if(!lcCfg->rlcBearerCfg.u.umUniDirDlCfg)
2413 lcCfg->rlcBearerCfg.u.umUniDirDlCfg->dlUmCfg.snLenDlUm = f1UeDbLcCfg->rlcBearerCfg.u.umUniDirDlCfg->dlUmCfg.snLenDlUm;
2417 DU_LOG("\nERROR --> DU_APP: Invalid Rlc Mode %d at fillRlcCfgToAddMod()", lcCfg->rlcBearerCfg.rlcMode);
2423 /*******************************************************************
2425 * @brief To update DuUeCb Rlc Lc Cfg
2429 * Function : duUpdateRlcLcCfg
2430 * Functionality: update DuUeCb Rlc Lc Cfg
2432 * @params[in] DuUeCb Pointer
2433 * F1UeContextSetupDb pointer
2434 * @return ROK - success
2437 * ****************************************************************/
2439 uint8_t duUpdateRlcLcCfg(DuRlcUeCfg *rlcUeCfg, F1UeContextSetupDb *f1UeDb)
2441 uint8_t ret, lcIdx, dbIdx, numLcs, lcDelIdx;
2444 for(dbIdx = 0; (dbIdx < f1UeDb->duUeCfg.numRlcLcs && ret ==ROK); dbIdx++)
2446 numLcs = rlcUeCfg->numLcs;
2447 for(lcIdx = 0; lcIdx < numLcs; lcIdx++)
2449 if(f1UeDb->duUeCfg.rlcLcCfg[dbIdx].rlcBearerCfg.lcId == rlcUeCfg->rlcLcCfg[lcIdx].rlcBearerCfg.lcId)
2451 if(f1UeDb->duUeCfg.rlcLcCfg[dbIdx].configType == CONFIG_MOD)
2453 ret = fillRlcCfgToAddMod(&rlcUeCfg->rlcLcCfg[lcIdx], &f1UeDb->duUeCfg.rlcLcCfg[dbIdx]);
2456 DU_LOG("\nERROR --> DU APP : Failed to modify LC at Idx %d in duUpdateRlcCfg()", lcDelIdx);
2459 fillSnssaiInfo(NULL, f1UeDb->duUeCfg.rlcLcCfg[dbIdx].rlcBearerCfg.snssai,\
2460 &rlcUeCfg->rlcLcCfg[lcIdx].rlcBearerCfg.snssai, true);
2462 else if(f1UeDb->duUeCfg.rlcLcCfg[dbIdx].configType == CONFIG_DEL)
2464 /* Free memory at matched lcIdx index */
2465 freeRlcLcCfg(&rlcUeCfg->rlcLcCfg[lcIdx].rlcBearerCfg);
2467 for(lcDelIdx = lcIdx; lcDelIdx < rlcUeCfg->numLcs; lcDelIdx++)
2469 ret = fillRlcCfgToAddMod(&rlcUeCfg->rlcLcCfg[lcDelIdx], &rlcUeCfg->rlcLcCfg[lcDelIdx+1]);
2470 fillSnssaiInfo(NULL, rlcUeCfg->rlcLcCfg[lcDelIdx+1].rlcBearerCfg.snssai,\
2471 &rlcUeCfg->rlcLcCfg[lcDelIdx].rlcBearerCfg.snssai, true);
2472 freeRlcLcCfg(&rlcUeCfg->rlcLcCfg[lcDelIdx+1].rlcBearerCfg);
2475 DU_LOG("\nERROR --> DU APP : Failed to delete LC at Idx %d in duUpdateRlcCfg()", lcDelIdx);
2482 if(f1UeDb->duUeCfg.rlcLcCfg[dbIdx].configType == CONFIG_ADD)
2484 ret = fillRlcCfgToAddMod(&rlcUeCfg->rlcLcCfg[lcIdx], &f1UeDb->duUeCfg.rlcLcCfg[dbIdx]);
2487 fillSnssaiInfo(NULL, f1UeDb->duUeCfg.rlcLcCfg[dbIdx].rlcBearerCfg.snssai,\
2488 &rlcUeCfg->rlcLcCfg[rlcUeCfg->numLcs].rlcBearerCfg.snssai, true);
2496 /*******************************************************************
2498 * @brief Function to fill Tunnel Config to Add/Mod
2503 * Function : fillTnlCfgToAddMod
2505 * Functionality: Function to fill tunnel Config to Add/Mod
2507 * @params[in] Pointer to tnlCfgDb,
2508 * pointer to f1TnlCfg
2509 * @return ROK - success
2512 * ****************************************************************/
2513 uint8_t fillTnlCfgToAddMod(UpTnlCfg **ueCbTnlCfg, UpTnlCfg *f1TnlCfg)
2517 DU_FREE((*ueCbTnlCfg)->tnlCfg1, sizeof(GtpTnlCfg));
2518 DU_FREE(*ueCbTnlCfg, sizeof(UpTnlCfg));
2521 if(*ueCbTnlCfg == NULLP)
2523 /* copying to DuCb Tnl Cfg */
2524 DU_ALLOC(*ueCbTnlCfg, sizeof(UpTnlCfg));
2525 if(*ueCbTnlCfg == NULLP)
2527 DU_LOG("\nERROR --> DU_APP : fillTnlCfgToAddMod: Memory Alloc failed for drbId[%d]", f1TnlCfg->drbId);
2531 memset(*ueCbTnlCfg, 0, sizeof(UpTnlCfg));
2532 (*ueCbTnlCfg)->configType = f1TnlCfg->configType;
2533 (*ueCbTnlCfg)->cellId = f1TnlCfg->cellId;
2534 (*ueCbTnlCfg)->ueId = f1TnlCfg->ueId;
2535 (*ueCbTnlCfg)->drbId = f1TnlCfg->drbId;
2536 if(f1TnlCfg->tnlCfg1)
2538 if((*ueCbTnlCfg)->tnlCfg1 == NULLP)
2540 DU_ALLOC((*ueCbTnlCfg)->tnlCfg1, sizeof(GtpTnlCfg));
2541 if((*ueCbTnlCfg)->tnlCfg1 == NULLP)
2543 DU_LOG("\nERROR --> DU_APP : fillTnlCfgToAddMod: Memory Alloc failed for tnlCfg1 for drbId[%d]", f1TnlCfg->drbId);
2547 memset((*ueCbTnlCfg)->tnlCfg1, 0, sizeof(GtpTnlCfg));
2548 (*ueCbTnlCfg)->tnlCfg1->teId = f1TnlCfg->tnlCfg1->teId;
2549 (*ueCbTnlCfg)->tnlCfg1->ulTnlAddress = f1TnlCfg->tnlCfg1->ulTnlAddress;
2550 (*ueCbTnlCfg)->tnlCfg1->dlTnlAddress = f1TnlCfg->tnlCfg1->dlTnlAddress;
2555 /*******************************************************************
2557 * @brief Processing the tunnel Request to EGTP
2561 * Function : duProcEgtpTunnelCfg
2563 * Functionality: Processing the tunnel Request to EGTP
2565 * @params[in] UptnlCfg *duTnlCfg, UpTnlCfg *f1TnlCfg
2566 * @return ROK - success
2569 * ****************************************************************/
2571 uint8_t duProcEgtpTunnelCfg(uint8_t ueCbIdx, UpTnlCfg *duTnlCfg, UpTnlCfg *f1TnlCfg)
2573 uint8_t ret = RFAILED, delIdx;
2575 if(f1TnlCfg->tnlCfg1 == NULLP)
2577 DU_LOG("\nERROR --> DU_APP : Tunnel config not found");
2581 if(f1TnlCfg->configType == CONFIG_ADD)
2583 if(duSendEgtpTnlMgmtReq(EGTP_TNL_MGMT_ADD, NULLP, f1TnlCfg->tnlCfg1) == ROK)
2585 if(fillTnlCfgToAddMod(&duCb.upTnlCfg[duCb.numTeId], f1TnlCfg) == ROK)
2592 else if(f1TnlCfg->configType == CONFIG_MOD)
2594 if(duSendEgtpTnlMgmtReq(EGTP_TNL_MGMT_MOD, duTnlCfg->tnlCfg1->teId, f1TnlCfg->tnlCfg1) == ROK)
2596 if(fillTnlCfgToAddMod(&duTnlCfg, f1TnlCfg) == ROK)
2602 else if(f1TnlCfg->configType == CONFIG_DEL)
2604 if(duSendEgtpTnlMgmtReq(EGTP_TNL_MGMT_DEL, duTnlCfg->tnlCfg1->teId, f1TnlCfg->tnlCfg1) == ROK)
2606 /* Free memory at drbIdx */
2608 for(delIdx = ueCbIdx; delIdx < duCb.numTeId; delIdx++)
2610 /* moving all elements one index ahead */
2611 ret = fillTnlCfgToAddMod(&duCb.upTnlCfg[delIdx], duCb.upTnlCfg[delIdx+1]);
2617 if(duCb.upTnlCfg[delIdx])
2619 DU_FREE(duCb.upTnlCfg[delIdx]->tnlCfg1, sizeof(GtpTnlCfg));
2620 DU_FREE(duCb.upTnlCfg[delIdx], sizeof(UpTnlCfg));
2627 /***********************************************************************
2629 * @brief Function to fill Tunnel Config
2630 * and sends tunnel Req to EGTP
2635 * Function : duUpdateTunnelCfgDb
2637 * Functionality: Function to fill tunnel Config
2638 * and sends tunnel Cfg Req to EGTP
2640 * @params[in] ueId, cellId, DuUeCfg
2641 * @return ROK - success
2644 * ****************************************************************/
2646 uint8_t duUpdateTunnelCfgDb(uint8_t ueId, uint8_t cellId, DuUeCfg *duUeCfg)
2648 uint8_t ret = ROK, drbIdx, teIdx;
2649 bool drbFound = false;
2651 /*If Add/Mod tunnels request for that DRB is successful in EGTP */
2652 /*then update drbId and tunnel Info in duCb */
2653 for(drbIdx=0; drbIdx < duUeCfg->numDrb; drbIdx++)
2655 duUeCfg->upTnlInfo[drbIdx].cellId = cellId;
2656 duUeCfg->upTnlInfo[drbIdx].ueId = ueId;
2657 for(teIdx = 0; teIdx < duCb.numTeId; teIdx++)
2659 if((duCb.upTnlCfg[teIdx]->ueId == duUeCfg->upTnlInfo[drbIdx].ueId) && \
2660 (duCb.upTnlCfg[teIdx]->drbId == duUeCfg->upTnlInfo[drbIdx].drbId))
2662 drbFound = true; /* existing DRB */
2663 if(duProcEgtpTunnelCfg(teIdx, duCb.upTnlCfg[teIdx], &duUeCfg->upTnlInfo[drbIdx]) != ROK)
2665 DU_LOG("\nERROR -> DU_APP : duUpdateTunnelCfgDb: Failed to modify tunnel req for Drb id[%d]",
2666 duUeCfg->upTnlInfo[drbIdx].drbId);
2675 if(!drbFound && ret == ROK)/* new DRB to Add */
2677 if(duProcEgtpTunnelCfg(NULLP, NULLP, &duUeCfg->upTnlInfo[drbIdx]) != ROK)
2679 DU_LOG("\nERROR -> DU_APP : duUpdateTunnelCfgDb: Failed to add tunnel req for Drb id[%d]",
2680 duUeCfg->upTnlInfo[drbIdx].drbId);
2689 /*******************************************************************
2691 * @brief @brief To update DuUeCb Mac and Rlc Ue Cfg
2696 * Function : duUpdateDuUeCbCfg
2698 * Functionality: update DuUeCb Mac and Rlc Ue Cfg
2700 * @params[in] ueId, cellIdx
2701 * @return ROK - success
2704 * ****************************************************************/
2706 uint8_t duUpdateDuUeCbCfg(uint8_t ueId, uint8_t cellId)
2709 uint16_t cellIdx = 0, crnti=0;
2710 DuUeCb *ueCb = NULLP;
2712 GET_CELL_IDX(cellId, cellIdx);
2713 ueCb = &duCb.actvCellLst[cellIdx]->ueCb[ueId-1];
2715 /*Filling RLC Ue Cfg */
2716 ueCb->duRlcUeCfg.cellId = cellId;
2717 ueCb->duRlcUeCfg.ueId = ueId;
2718 ret = duUpdateRlcLcCfg(&ueCb->duRlcUeCfg, ueCb->f1UeDb);
2721 /*Filling MAC Ue Cfg */
2722 GET_CRNTI(crnti, ueId);
2723 ueCb->duMacUeCfg.cellId = cellId;
2724 ueCb->duMacUeCfg.ueId = ueId;
2725 ueCb->duMacUeCfg.crnti = crnti;
2726 ret = duUpdateMacCfg(&ueCb->duMacUeCfg, ueCb->f1UeDb);
2728 DU_LOG("\nERROR --> DU APP : Failed while updating MAC LC Config at duUpdateDuUeCbCfg()");
2731 if(duUpdateTunnelCfgDb(ueId, cellId, &ueCb->f1UeDb->duUeCfg) != ROK)
2733 DU_LOG("\nERROR --> DU_APP : Failed to establish tunnel in duUpdateDuUeCbCfg()");
2739 DU_LOG("\nERROR --> DU APP : Failed while updating RLC LC Config at duUpdateDuUeCbCfg()");
2743 /*******************************************************************
2745 * @brief Handle UE create response from MAC
2749 * Function : DuProcMacUeCreateRsp
2751 * Functionality: Handle UE Create response from MAC
2753 * @params[in] Pointer to MacUeCreateRsp and Pst
2754 * @return ROK - success
2757 * ****************************************************************/
2758 uint8_t DuProcMacUeCreateRsp(Pst *pst, MacUeCreateRsp *cfgRsp)
2765 GET_CELL_IDX(cfgRsp->cellId, cellIdx);
2766 if(cfgRsp->result == MAC_DU_APP_RSP_OK)
2768 if(pst->event == EVENT_MAC_UE_CREATE_RSP)
2770 DU_LOG("\nINFO --> DU APP : MAC UE Create Response : SUCCESS [DU UE F1AP ID : %d]", cfgRsp->ueId);
2772 if(duCb.actvCellLst[cellIdx] && (duCb.actvCellLst[cellIdx]->ueCb[cfgRsp->ueId -1].gnbDuUeF1apId == cfgRsp->ueId))
2774 duCb.actvCellLst[cellIdx]->ueCb[cfgRsp->ueId -1].duMacUeCfg.macUeCfgState = UE_CREATE_COMPLETE;
2776 if((duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].ueState == UE_HANDIN_IN_PROGRESS) &&
2777 (duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].duMacUeCfg.macUeCfgState == UE_CREATE_COMPLETE) &&
2778 (duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].duRlcUeCfg.rlcUeCfgState == UE_CREATE_COMPLETE))
2780 if((ret = duUpdateDuUeCbCfg(cfgRsp->ueId, cfgRsp->cellId)) == ROK)
2782 /* If UE is in handover, RACH resource needs to be requested
2783 * from MAC for CFRA */
2784 if((duBuildAndSendRachRsrcReqToMac(cfgRsp->cellId, cfgRsp->ueId)) != ROK)
2786 DU_LOG("\nERROR --> DU APP : Failed to send RACH Resource Request to MAC");
2787 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCreateRsp));
2793 DU_LOG("\nERROR -> DU APP : Failure in updating DU UE CB");
2794 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCreateRsp));
2803 DU_LOG("\nERROR --> DU APP : MAC UE CFG Response for EVENT[%d]: FAILURE [DU UE F1AP ID : %d]", pst->event, cfgRsp->ueId);
2806 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCreateRsp));
2810 DU_LOG("\nERROR --> DU APP : Received MAC Ue Config Response is NULL at DuProcMacUeCreateRsp()");
2816 /*******************************************************************
2818 * @brief Handle UE Reconfig response from MAC
2822 * Function : DuProcMacUeRecfgRsp
2824 * Functionality: Handle UE ReConfig response from MAC
2826 * @params[in] Pointer to MacUeRecfgRsp and Pst
2827 * @return ROK - success
2830 * ****************************************************************/
2831 uint8_t DuProcMacUeRecfgRsp(Pst *pst, MacUeRecfgRsp *reCfgRsp)
2838 GET_CELL_IDX(reCfgRsp->cellId, cellIdx);
2839 if(reCfgRsp->result == MAC_DU_APP_RSP_OK)
2841 if(pst->event == EVENT_MAC_UE_RECONFIG_RSP)
2843 DU_LOG("\nINFO --> DU APP : MAC UE Reconfig Response : SUCCESS [DU UE F1AP ID : %d]", reCfgRsp->ueId);
2844 if(duCb.actvCellLst[cellIdx] &&
2845 (duCb.actvCellLst[cellIdx]->ueCb[reCfgRsp->ueId -1].gnbDuUeF1apId == reCfgRsp->ueId))
2847 duCb.actvCellLst[cellIdx]->ueCb[reCfgRsp->ueId -1].duMacUeCfg.macUeCfgState = UE_RECFG_COMPLETE;
2848 if((duCb.actvCellLst[cellIdx]->ueCb[reCfgRsp->ueId -1].duMacUeCfg.macUeCfgState == UE_RECFG_COMPLETE) &&
2849 (duCb.actvCellLst[reCfgRsp->cellId -1]->ueCb[reCfgRsp->ueId -1].duRlcUeCfg.rlcUeCfgState == UE_RECFG_COMPLETE))
2851 if((ret = duUpdateDuUeCbCfg(reCfgRsp->ueId, reCfgRsp->cellId)) == ROK)
2853 if((BuildAndSendUeCtxtRsp(reCfgRsp->cellId, reCfgRsp->ueId)) != ROK)
2855 DU_LOG("\nERROR -> DU APP : Failure in BuildAndSendUeCtxtRsp()");
2856 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, reCfgRsp, sizeof(MacUeRecfgRsp));
2862 DU_LOG("\nERROR -> DU APP : Failure in updating DU UE CB");
2863 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, reCfgRsp, sizeof(MacUeRecfgRsp));
2872 DU_LOG("\nERROR --> DU APP : MAC UE RECFG Response for EVENT[%d]: FAILURE [DU UE F1AP ID : %d]", pst->event, reCfgRsp->ueId);
2873 if(pst->event == EVENT_MAC_UE_RECONFIG_RSP)
2875 //TODO: Send the failure case in Ue Context Setup Response
2879 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, reCfgRsp, sizeof(MacUeRecfgRsp));
2883 DU_LOG("\nERROR --> DU APP : Received MAC Ue ReConfig Response is NULL at DuProcMacUeRecfgRsp()");
2889 /*******************************************************************
2891 * @brief Processes UE create Req to RLC UL
2895 * Function : duBuildAndSendUeCreateReqToRlc
2898 * Processes UE create Req to RLC UL
2900 * @params[in] cellId,
2902 * Pointer to RlcUeCreate
2903 * @return ROK - success
2906 *****************************************************************/
2908 uint8_t duBuildAndSendUeCreateReqToRlc(uint16_t cellId, uint8_t gnbDuUeF1apId, DuUeCfg *ueCfgDb, DuRlcUeCfg *duRlcUeCfg)
2911 RlcUeCreate *rlcUeCfg = NULLP;
2914 ret = updateRlcUeCfg(cellId, gnbDuUeF1apId, ueCfgDb, duRlcUeCfg);
2917 DU_LOG("\nERROR --> DU APP : Failed to fill Rlc Ue Cfg at duBuildAndSendUeCreateReqToRlc()");
2921 FILL_PST_DUAPP_TO_RLC(pst, RLC_UL_INST, EVENT_RLC_UE_CREATE_REQ);
2922 /* Copying ueCfg to a sharable buffer */
2923 DU_ALLOC_SHRABL_BUF(rlcUeCfg, sizeof(RlcUeCreate));
2926 memset(rlcUeCfg, 0, sizeof(RlcUeCreate));
2927 fillRlcUeCfg(duRlcUeCfg, rlcUeCfg);
2929 /* Processing one Ue at a time to RLC */
2930 DU_LOG("\nDEBUG --> DU_APP: Sending UE create request to RLC UL");
2931 ret = (*packRlcUeCreateReqOpts[pst.selector])(&pst, rlcUeCfg);
2934 DU_LOG("\nERROR --> DU_APP : Failure in sending Ue Create Req to RLC");
2935 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rlcUeCfg, sizeof(RlcUeCreate));
2941 DU_LOG("\n ERROR --> DU APP : Memory alloc failed at duBuildAndSendUeCreateReqToRlc()");
2947 /*******************************************************************
2949 * @brief Processes UE create Rsp received from RLC UL
2954 * Function : DuProcRlcUeCreateRsp
2957 * Processes UE create Rsp received from RLC UL
2959 * @params[in] Post structure
2960 * Pointer to RlcCfgCfm
2961 * @return ROK - success
2964 *****************************************************************/
2965 uint8_t DuProcRlcUeCreateRsp(Pst *pst, RlcUeCreateRsp *cfgRsp)
2971 if(cfgRsp->result == RLC_DU_APP_RSP_OK)
2973 if(pst->event == EVENT_RLC_UE_CREATE_RSP)
2975 DU_LOG("\nINFO --> DU_APP: RLC UE Create Response : SUCCESS [UE IDX:%d]", cfgRsp->ueId);
2976 duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].duRlcUeCfg.rlcUeCfgState = UE_CREATE_COMPLETE;
2978 if((duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].ueState == UE_HANDIN_IN_PROGRESS) &&
2979 (duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].duMacUeCfg.macUeCfgState == UE_CREATE_COMPLETE) &&
2980 (duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].duRlcUeCfg.rlcUeCfgState == UE_CREATE_COMPLETE))
2982 if((ret = duUpdateDuUeCbCfg(cfgRsp->ueId, cfgRsp->cellId)) == ROK)
2984 /* If UE is in handover, RACH resource needs to be requested
2985 * from MAC for CFRA */
2986 if((duBuildAndSendRachRsrcReqToMac(cfgRsp->cellId, cfgRsp->ueId)) != ROK)
2988 DU_LOG("\nERROR --> DU APP : Failed to send RACH Resource Request to MAC");
2989 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCreateRsp));
2995 DU_LOG("\nERROR --> DU APP : Failure in updating DU UE CB");
2996 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCreateRsp));
3004 DU_LOG("\nERROR --> DU_APP: RLC UE CREATE Response for EVENT[%d] : FAILED [UE IDX : %d, REASON :%d]",\
3005 pst->event, cfgRsp->ueId, cfgRsp->reason);
3008 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCreateRsp));
3012 DU_LOG("\nERROR --> DU_APP: Received RLC Ue Create Response is NULL at DuProcRlcUeCreateRsp()");
3018 /*******************************************************************
3020 * @brief Processes UE reconfig Rsp received from RLC UL
3025 * Function : DuProcRlcUeReconfigRsp
3028 * Processes UE reconfig Rsp received from RLC UL
3030 * @params[in] Post structure
3031 * Pointer to RlcCfgCfm
3032 * @return ROK - success
3035 *****************************************************************/
3036 uint8_t DuProcRlcUeReconfigRsp(Pst *pst, RlcUeReconfigRsp *cfgRsp)
3042 if(cfgRsp->result == RLC_DU_APP_RSP_OK)
3044 if(pst->event == EVENT_RLC_UE_RECONFIG_RSP)
3046 DU_LOG("\nINFO --> DU_APP: RLC UE Reconfig Response : SUCCESS [UE IDX:%d]", cfgRsp->ueId);
3048 duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].duRlcUeCfg.rlcUeCfgState = UE_RECFG_COMPLETE;
3049 if((duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].duMacUeCfg.macUeCfgState == UE_RECFG_COMPLETE) &&
3050 (duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].duRlcUeCfg.rlcUeCfgState == UE_RECFG_COMPLETE))
3052 if((ret = duUpdateDuUeCbCfg(cfgRsp->ueId, cfgRsp->cellId)) == ROK)
3054 if((BuildAndSendUeCtxtRsp(cfgRsp->cellId, cfgRsp->ueId)) != ROK)
3056 DU_LOG("\nERROR --> DU APP : Failure in BuildAndSendUeCtxtRsp");
3057 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeReconfigRsp));
3063 DU_LOG("\nERROR --> DU APP : Failure in updating DU UE CB");
3064 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeReconfigRsp));
3072 DU_LOG("\nERROR --> DU_APP: RLC UE RE-CFG Response for EVENT[%d] : FAILED [UE IDX : %d, REASON :%d]",\
3073 pst->event, cfgRsp->ueId, cfgRsp->reason);
3074 if((pst->event == EVENT_RLC_UE_RECONFIG_RSP))
3076 //TODO: update failure case in ue Context setup Response
3080 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeReconfigRsp));
3084 DU_LOG("\nERROR --> DU_APP: Received RLC Ue ReConfig Response is NULL at DuProcRlcUeReconfigRsp()");
3089 /**********************************************************************************
3091 * @brief Fills Ue ReCfg from DU DB to RlcUeRecfg
3095 * Function : fillRlcUeRecfg
3097 * Functionality: fills ue ReCfg to be sent to RLC
3099 * @params[in] DuRlcUeCfg Pointer
3100 * RlcUeRecfg Pointer
3103 * *******************************************************************************/
3104 void fillRlcUeRecfg(DuRlcUeCfg *duRlcUeCfg, RlcUeRecfg *rlcUeRecfg)
3108 rlcUeRecfg->cellId = duRlcUeCfg->cellId;
3109 rlcUeRecfg->ueId = duRlcUeCfg->ueId;
3112 if(duRlcUeCfg->numLcs > 0)
3114 rlcUeRecfg->numLcsToAdd = 0;
3115 rlcUeRecfg->numLcsToMod = 0;
3116 rlcUeRecfg->numLcsToRel = 0;
3118 for(lcIdx = 0; lcIdx < duRlcUeCfg->numLcs; lcIdx++)
3120 if(duRlcUeCfg->rlcLcCfg[lcIdx].configType == CONFIG_ADD)
3122 memcpy(&rlcUeRecfg->rlcLcCfgAdd[rlcUeRecfg->numLcsToAdd], &duRlcUeCfg->rlcLcCfg[lcIdx].rlcBearerCfg, sizeof(RlcBearerCfg));
3123 rlcUeRecfg->numLcsToAdd++;
3125 if(duRlcUeCfg->rlcLcCfg[lcIdx].configType == CONFIG_MOD)
3127 memcpy(&rlcUeRecfg->rlcLcCfgMod[rlcUeRecfg->numLcsToMod], &duRlcUeCfg->rlcLcCfg[lcIdx].rlcBearerCfg, sizeof(RlcBearerCfg));
3128 rlcUeRecfg->numLcsToMod++;
3130 if(duRlcUeCfg->rlcLcCfg[lcIdx].configType == CONFIG_DEL)
3132 memcpy(&rlcUeRecfg->rlcLcCfgRel[rlcUeRecfg->numLcsToRel], &duRlcUeCfg->rlcLcCfg[lcIdx].rlcBearerCfg, sizeof(RlcBearerCfg));
3133 rlcUeRecfg->numLcsToRel++;
3140 /*******************************************************************
3142 * @brief Builds and Send Ue Reconfig Req to RLC
3146 * Function : duBuildAndSendUeRecfgReqToRLC
3148 * Functionality: Builds and Send Ue Reconfig Req to RLC
3150 * @params[in] uint16_t cellId,
3151 * uint6_t crnti #AS per 38.473 V15.3.0, Section 9.3.1.32 crnti
3152 * value range is b/w 0..65535#
3154 * RlcUeCreate *rlcUeCfg
3155 * @return ROK - success
3158 * ****************************************************************/
3160 uint8_t duBuildAndSendUeRecfgReqToRlc(uint16_t cellId, uint8_t gnbDuUeF1apId, uint16_t crnti, DuUeCfg *ueCfgDb)
3163 DuRlcUeCfg *duRlcUeCfg = NULLP;
3164 RlcUeRecfg *rlcUeRecfg = NULLP;
3166 DU_ALLOC(duRlcUeCfg, sizeof(DuRlcUeCfg));
3167 DU_ALLOC_SHRABL_BUF(rlcUeRecfg, sizeof(RlcUeRecfg));
3168 if(duRlcUeCfg && rlcUeRecfg)
3170 memset(duRlcUeCfg, 0, sizeof(DuRlcUeCfg));
3171 memset(rlcUeRecfg, 0, sizeof(RlcUeRecfg));
3173 ret = updateRlcUeCfg(cellId, gnbDuUeF1apId, ueCfgDb, duRlcUeCfg);
3176 DU_LOG("\nERROR --> DU APP : Failed at duBuildAndSendUeRecfgReqToRlc()");
3179 fillRlcUeRecfg(duRlcUeCfg, rlcUeRecfg);
3180 ret = sendUeRecfgReqToRlc(rlcUeRecfg);
3185 DU_LOG("\nERROR --> DU APP : Memory Alloc failed at duBuildAndSendUeRecfgReqToRlc()");
3188 DU_FREE(duRlcUeCfg, sizeof(DuRlcUeCfg));
3192 /**********************************************************************************
3194 * @brief Fills Ue ReCfg from DU DB to MacUeRecfg
3198 * Function : fillMacUeRecfg
3200 * Functionality: fills ue ReCfg to be sent to MAC
3202 * @params[in] DuMacUeCfg Pointer
3203 * MacUeRecfg Pointer
3206 * *******************************************************************************/
3207 void fillMacUeRecfg(DuMacUeCfg *duMacUeCfg, MacUeRecfg *macUeRecfg)
3211 macUeRecfg->cellId = duMacUeCfg->cellId;
3212 macUeRecfg->ueId = duMacUeCfg->ueId;
3213 macUeRecfg->crnti = duMacUeCfg->crnti;
3214 macUeRecfg->macCellGrpRecfgPres = duMacUeCfg->macCellGrpCfgPres;
3215 if(macUeRecfg->macCellGrpRecfgPres)
3217 memcpy(&macUeRecfg->macCellGrpRecfg, &duMacUeCfg->macCellGrpCfg, sizeof(MacCellGrpCfg));
3219 macUeRecfg->phyCellGrpRecfgPres = duMacUeCfg->phyCellGrpCfgPres;
3220 if(macUeRecfg->phyCellGrpRecfgPres)
3222 memcpy(&macUeRecfg->phyCellGrpRecfg, &duMacUeCfg->phyCellGrpCfg, sizeof(PhyCellGrpCfg));
3224 macUeRecfg->spCellRecfgPres = duMacUeCfg->spCellCfgPres;
3225 if(macUeRecfg->spCellRecfgPres)
3227 memcpy(&macUeRecfg->spCellRecfg, &duMacUeCfg->spCellCfg, sizeof(SpCellRecfg));
3229 if(duMacUeCfg->ambrCfg != NULLP)
3231 DU_ALLOC_SHRABL_BUF(macUeRecfg->ambrRecfg, sizeof(AmbrCfg));
3232 memcpy(macUeRecfg->ambrRecfg, duMacUeCfg->ambrCfg, sizeof(AmbrCfg));
3234 memcpy(&macUeRecfg->dlModInfo, &duMacUeCfg->dlModInfo, sizeof(ModulationInfo));
3235 memcpy(&macUeRecfg->ulModInfo, &duMacUeCfg->ulModInfo, sizeof(ModulationInfo));
3236 if(duMacUeCfg->numLcs > 0)
3238 macUeRecfg->numLcsToAdd = 0;
3239 macUeRecfg->numLcsToDel = 0;
3240 macUeRecfg->numLcsToMod = 0;
3242 for(lcIdx = 0; lcIdx < duMacUeCfg->numLcs; lcIdx++)
3244 if(duMacUeCfg->lcCfgList[lcIdx].configType == CONFIG_ADD)
3246 /*VS: To thoroughly check*/
3247 memcpy(&macUeRecfg->lcCfgAdd[macUeRecfg->numLcsToAdd], &duMacUeCfg->lcCfgList[lcIdx].lcConfig, sizeof(LcCfg));
3248 macUeRecfg->numLcsToAdd++;
3250 if(duMacUeCfg->lcCfgList[lcIdx].configType == CONFIG_DEL)
3252 /*VS: To thoroughly check*/
3253 macUeRecfg->lcIdToDel[macUeRecfg->numLcsToDel] = duMacUeCfg->lcCfgList[lcIdx].lcConfig.lcId;
3254 macUeRecfg->numLcsToDel++;
3256 if(duMacUeCfg->lcCfgList[lcIdx].configType == CONFIG_MOD)
3258 /*VS: To thoroughly check*/
3259 memcpy(&macUeRecfg->lcCfgMod[macUeRecfg->numLcsToMod], &duMacUeCfg->lcCfgList[lcIdx].lcConfig, sizeof(LcCfg));
3260 macUeRecfg->numLcsToMod++;
3264 macUeRecfg->transmissionAction = duMacUeCfg->transmissionAction;
3266 macUeRecfg->drxConfigIndicatorRelease = duMacUeCfg->drxConfigIndicatorRelease;
3270 /*******************************************************************
3272 * @brief Builds and Send Ue Reconfig Req to MAC
3276 * Function : duBuildAndSendUeRecfgReqToMac
3278 * Functionality: Builds and Send Ue Reconfig Req to MAC
3280 * @params[in] uint16_t cellId,
3281 * uint6_t crnti #AS per 38.473 V15.3.0, Section 9.3.1.32 crnti
3282 * value range is b/w 0..65535#
3283 * CellGroupConfigRrc_t *macCellGrpCfg
3285 * @return ROK - success
3288 * ****************************************************************/
3290 uint8_t duBuildAndSendUeRecfgReqToMac(uint16_t cellId, uint8_t duUeF1apId, uint16_t crnti, DuUeCfg *ueCfgDb)
3293 DuMacUeCfg *duMacUeCfg = NULLP;
3294 MacUeRecfg *macUeRecfg = NULLP;
3296 DU_ALLOC(duMacUeCfg, sizeof(DuMacUeCfg));
3297 DU_ALLOC_SHRABL_BUF(macUeRecfg, sizeof(MacUeRecfg));
3298 if(macUeRecfg && duMacUeCfg)
3300 memset(duMacUeCfg, 0, sizeof(DuMacUeCfg));
3301 memset(macUeRecfg, 0, sizeof(MacUeRecfg));
3303 ret = updateDuMacUeCfg(cellId, duUeF1apId, crnti, ueCfgDb, duMacUeCfg);
3305 DU_LOG("\nERROR --> DU APP : Failed to fill Mac Ue Cfg at duBuildAndSendUeRecfgReqToMac()");
3308 fillMacUeRecfg(duMacUeCfg, macUeRecfg);
3309 ret = sendUeRecfgReqToMac(macUeRecfg);
3314 DU_LOG("\nERROR --> DU APP : Memory alloc failed for macUeCfg at duBuildAndSendUeRecfgReqToMac()");
3317 DU_FREE(duMacUeCfg, sizeof(DuMacUeCfg));
3322 /*******************************************************************
3324 * @brief Build and Send Ue context setup request
3329 * Function : duBuildAndSendUeContextSetupReq
3332 * Build and Send Ue context setup request
3334 * @params[in] cellId, crnti, DuUeCfg pointer
3335 * @return ROK - success
3338 *****************************************************************/
3340 uint8_t duBuildAndSendUeContextSetupReq(uint16_t cellId, DuUeCb *ueCb)
3344 DuUeCfg *duUeCfg = NULLP;
3346 DU_LOG("\nDEBUG --> DU_APP: Processing Ue Context Setup Request for cellId [%d]", cellId);
3350 DU_LOG("\nERROR --> DU APP : UE Cb is NULL");
3354 crnti = ueCb->crnti;
3355 duUeCfg = &ueCb->f1UeDb->duUeCfg;
3357 /* If UE is being handed-in to this DU, UE context setup request will create
3358 * new UE context at MAC/SCH and RLC.
3359 * If UE is in active state, UE contex setup request will lead to
3360 * reconfiguration of UE at MAC/SCH and RLC
3362 if(ueCb->ueState == UE_HANDIN_IN_PROGRESS)
3364 /* Filling MAC UE Config */
3365 memset(&ueCb->duMacUeCfg, 0, sizeof(DuMacUeCfg));
3367 /* Since UE attach has not yet happened, crnti is unknow. Hence passing 0 */
3368 ret = duBuildAndSendUeCreateReqToMac(cellId, ueCb->gnbDuUeF1apId, 0, duUeCfg, &ueCb->duMacUeCfg);
3370 DU_LOG("\nERROR --> DU APP : Failed to send UE create request to MAC");
3372 ret = duBuildAndSendUeCreateReqToRlc(cellId, ueCb->gnbDuUeF1apId, duUeCfg, &ueCb->duRlcUeCfg);
3374 DU_LOG("\nERROR --> DU APP : Failed to send UE create request to RLC");
3379 /* Filling RLC UE Reconfig */
3380 ret = duBuildAndSendUeRecfgReqToRlc(cellId, ueCb->gnbDuUeF1apId, crnti, duUeCfg);
3382 DU_LOG("\nERROR --> DU APP : Failed to build ctxt setup req for RLC at duBuildAndSendUeContextSetupReq()");
3384 /* Filling MAC UE Reconfig */
3385 ret = duBuildAndSendUeRecfgReqToMac(cellId, ueCb->gnbDuUeF1apId, crnti, duUeCfg);
3387 DU_LOG("\nERROR --> DU APP : Failed at build ctxt setup req for MAC at duBuildAndSendUeContextSetupReq()");
3393 /*******************************************************************
3395 * @brief Processes DL Rsp received from RLC DL
3400 * Function : DuProcRlcDlRrcMsgRsp
3403 * Processes UE Rsp received from RLC DL
3405 * @params[in] Post structure
3406 * Pointer to RlcCfgCfm
3407 * @return ROK - success
3410 *****************************************************************/
3411 uint8_t DuProcRlcDlRrcMsgRsp(Pst *pst, RlcDlRrcMsgRsp *dlRrcMsg)
3413 uint8_t ret = ROK, ueId = 0;
3414 uint16_t cellId, crnti;
3415 DuUeCb *ueCb = NULLP;
3418 state = dlRrcMsg->state;
3419 cellId = dlRrcMsg->cellId;
3420 crnti = dlRrcMsg->crnti;
3421 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlRrcMsg, sizeof(RlcDlRrcMsgRsp));
3423 if(state == TRANSMISSION_COMPLETE)
3425 GET_UE_ID(crnti, ueId);
3426 ueCb = &duCb.actvCellLst[cellId -1]->ueCb[ueId -1];
3428 if(ueCb->f1UeDb && ueCb->f1UeDb->dlRrcMsgPres)
3430 if(ueCb->f1UeDb->actionType == UE_CTXT_SETUP)
3432 ret = duBuildAndSendUeContextSetupReq(cellId, ueCb);
3434 DU_LOG("\nERROR --> DU APP : Failed to process UE Context Setup Request in DuProcRlcDlRrcMsgRsp()");
3437 if(ueCb->f1UeDb->actionType == UE_CTXT_MOD)
3439 ret = duBuildAndSendUeContextModReq(cellId, ueCb->gnbDuUeF1apId, crnti, &ueCb->f1UeDb->duUeCfg);
3441 DU_LOG("\nERROR --> DU APP : Failed to process UE Context Mod Request in DuProcRlcDlRrcMsgRsp()");
3444 if(ueCb->f1UeDb->actionType == UE_CTXT_RELEASE && ueCb->ueState == UE_ACTIVE)
3446 ret = duBuildAndSendUeDeleteReq(cellId, crnti);
3449 DU_LOG("\nERROR --> DU APP : Failed to process UE Context Release Request in DuProcRlcDlRrcMsgRsp()");
3455 DU_LOG("\nERROR --> DU APP : Failed to transmit DL RRC Msg");
3459 /*******************************************************************
3461 * @brief Process UE context setup request from CU
3465 * Function : duProcUeContextSetupRequest
3467 * Functionality: Process UE context setup request from CU
3469 * @params[in] F1AP message
3470 * @return ROK - success
3473 * ****************************************************************/
3475 uint8_t duProcUeContextSetupRequest(DuUeCb *ueCb)
3477 uint8_t ret, cellId;
3482 cellId = duCb.actvCellLst[ueCb->f1UeDb->cellIdx]->cellId;
3484 /* Send DL RRC msg for security Mode */
3485 if(ueCb->f1UeDb->dlRrcMsg)
3487 if(ueCb->f1UeDb->dlRrcMsg->rrcMsgPdu)
3489 /* Sending DL RRC Message to RLC */
3490 ret = duBuildAndSendDlRrcMsgToRlc(cellId, ueCb->duRlcUeCfg, ueCb->f1UeDb->dlRrcMsg);
3493 DU_LOG("\nERROR --> DU APP : Failed to send DL RRC msg in duProcUeContextSetupRequest()");
3494 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCb->f1UeDb->dlRrcMsg->rrcMsgPdu,\
3495 ueCb->f1UeDb->dlRrcMsg->rrcMsgSize);
3496 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
3500 else if(ueCb->f1UeDb->actionType == UE_CTXT_SETUP)
3502 ret = duBuildAndSendUeContextSetupReq(cellId, ueCb);
3505 DU_LOG("\nERROR --> DU APP : Failed to build ue context setup Req in duProcUeContextSetupRequest()");
3511 //TODO: To send the failure cause in UeContextSetupRsp
3512 DU_LOG("ERROR --> DU APP : Failed to process UE CNTXT SETUP REQ at duProcUeContextSetupRequest()");
3517 /*******************************************************************
3519 * @brief Build and Send Ue context mod request
3524 * Function : duBuildAndSendUeContextModReq
3527 * Build and Send Ue context mod request
3529 * @params[in] cellId, crnti, DuUeCfg pointer
3530 * @return ROK - success
3533 *****************************************************************/
3535 uint8_t duBuildAndSendUeContextModReq(uint16_t cellId, uint8_t gnbDuUeF1apId, uint16_t crnti, DuUeCfg *duUeCfg)
3539 DU_LOG("\nDEBUG --> DU_APP: Processing Ue Context Mod Request for cellId [%d]", cellId);
3540 /* Filling RLC Ue Reconfig */
3541 ret = duBuildAndSendUeRecfgReqToRlc(cellId, gnbDuUeF1apId, crnti, duUeCfg);
3543 DU_LOG("\nERROR --> DU APP : Failed to build ctxt setup req for RLC at duBuildAndSendUeContextModReq()");
3545 /* Filling MAC Ue Reconfig */
3546 ret = duBuildAndSendUeRecfgReqToMac(cellId, gnbDuUeF1apId, crnti, duUeCfg);
3548 DU_LOG("\nERROR --> DU APP : Failed at build ctxt setup req for MAC at duBuildAndSendUeContextModReq()");
3552 /*******************************************************************
3554 * @brief Processing Ue context mod request
3559 * Function : duProcUeContextModReq
3562 * Processing Ue context mod request
3564 * @params[in] DuUeCb *ueCb
3565 * @return ROK - success
3568 *****************************************************************/
3570 uint8_t duProcUeContextModReq(DuUeCb *ueCb)
3572 uint8_t ret, cellId;
3577 cellId = duCb.actvCellLst[ueCb->f1UeDb->cellIdx]->cellId;
3578 /* Send DL RRC msg for security Mode */
3579 if(ueCb->f1UeDb->dlRrcMsg)
3581 if(ueCb->f1UeDb->dlRrcMsg->rrcMsgPdu)
3583 /* Sending DL RRC Message to RLC */
3584 ret = duBuildAndSendDlRrcMsgToRlc(cellId, ueCb->duRlcUeCfg, ueCb->f1UeDb->dlRrcMsg);
3587 DU_LOG("\nERROR --> DU APP : Failed to send DL RRC msg in duProcUeContextModReq()");
3588 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCb->f1UeDb->dlRrcMsg->rrcMsgPdu,\
3589 ueCb->f1UeDb->dlRrcMsg->rrcMsgSize);
3590 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
3594 else if(ueCb->f1UeDb->actionType == UE_CTXT_MOD)
3596 ret = duBuildAndSendUeContextModReq(cellId, ueCb->gnbDuUeF1apId, ueCb->crnti, &ueCb->f1UeDb->duUeCfg);
3599 DU_LOG("\nERROR --> DU APP : Failed to build ue context setup Req in duProcUeContextModReq()");
3603 else if((ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY) || (ueCb->f1UeDb->actionType == UE_CTXT_RRC_RECFG_COMPLETE))
3605 if((BuildAndSendUeContextModRsp(ueCb) != ROK))
3607 DU_LOG("\nERROR --> DU APP : Failed to build UE Context modification response");
3614 //TODO: To send the failure cause in UeContextModRsp
3616 DU_LOG("ERROR --> DU APP : Failed to process UE CNTXT MOD REQ at duProcUeContextModReq()");
3622 /*******************************************************************
3624 * @brief Build and send dedicated RACH resource release request to MAC
3628 * Function : duBuildAndSendRachRsrcRelToMac
3630 * Functionality: Function to Build and send dedicated RACH resource
3631 * release request to MAC
3633 * @params[in] Cell ID
3635 * @return ROK - Success
3638 * ****************************************************************/
3639 uint8_t duBuildAndSendRachRsrcRelToMac(uint16_t cellId, DuUeCb *ueCb)
3642 MacRachRsrcRel *rachRsrcRel = NULLP;
3644 DU_ALLOC_SHRABL_BUF(rachRsrcRel, sizeof(MacRachRsrcRel));
3647 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for RACH Resource Release in \
3648 duBuildAndSendRachRsrcRelToMac()");
3652 rachRsrcRel->cellId = cellId;
3653 rachRsrcRel->ueId = ueCb->gnbDuUeF1apId;
3654 rachRsrcRel->crnti = ueCb->crnti;
3657 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_RACH_RESOURCE_REL);
3659 if(((*packMacRachRsrcRelOpts[pst.selector])(&pst, rachRsrcRel)) != ROK)
3661 DU_LOG("\nERROR --> DU_APP : Failure in sending RACH Resource Release to MAC at \
3662 duBuildAndSendRachRsrcRelToMac()");
3663 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rachRsrcRel, sizeof(MacRachRsrcRel));
3670 /*******************************************************************
3672 * @brief delete DuMacUeCfg from duCb
3676 * Function : deleteMacUeCfg
3678 * Functionality: delete DuMacUeCfg from duCb
3680 * @params[in] Pointer to DuMacUeCfg
3681 * @return ROK - success
3684 *******************************************************************/
3686 void deleteMacUeCfg(DuMacUeCfg *ueCfg)
3690 if(ueCfg->spCellCfgPres)
3692 freeUeRecfgCellGrpInfo(ueCfg);
3696 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,ueCfg->ambrCfg, sizeof(AmbrCfg));
3698 for(lcCfgIdx=0; lcCfgIdx< ueCfg->numLcs; lcCfgIdx++)
3700 freeMacLcCfg(&ueCfg->lcCfgList[lcCfgIdx].lcConfig);
3702 memset(ueCfg, 0, sizeof(DuMacUeCfg));
3705 /*******************************************************************
3707 * @brief delete UE Configuration of a particular UE
3711 * Function : deleteUeCfg
3713 * Functionality: delete UE Configuration of a particular UE
3715 * @params[in] uint16_t cellIdx, uint8_t ueId
3716 * @return ROK - success
3719 * ****************************************************************/
3720 uint8_t deleteUeCfg(uint16_t cellId, uint8_t ueId)
3723 uint16_t cellIdx = 0;
3724 DuUeCb *ueCb = NULLP;
3726 GET_CELL_IDX(cellId, cellIdx);
3727 if(duCb.actvCellLst[cellIdx] != NULLP)
3729 if((duCb.actvCellLst[cellIdx]->ueCb[ueId-1].duMacUeCfg.macUeCfgState == UE_DELETE_COMPLETE)\
3730 &&(duCb.actvCellLst[cellIdx]->ueCb[ueId-1].duRlcUeCfg.rlcUeCfgState == UE_DELETE_COMPLETE))
3732 ueCb = &duCb.actvCellLst[cellIdx]->ueCb[ueId-1];
3733 deleteMacUeCfg(&ueCb->duMacUeCfg);
3734 deleteRlcUeCfg(&ueCb->duRlcUeCfg);
3735 if(ueCb->f1UeDb !=NULLP)
3737 freeF1UeDb(ueCb->f1UeDb);
3739 for(tnlIdx = 0; tnlIdx < duCb.numTeId; )
3741 if(duCb.upTnlCfg[tnlIdx]->ueId == ueId)
3743 duCb.upTnlCfg[tnlIdx]->configType = CONFIG_DEL;
3744 duProcEgtpTunnelCfg(tnlIdx, duCb.upTnlCfg[tnlIdx], duCb.upTnlCfg[tnlIdx]);
3749 unsetBitInUeBitMap(cellId, ueId-1);
3750 duCb.actvCellLst[cellIdx]->numActvUes--;
3751 memset(ueCb, 0, sizeof(DuUeCb));
3760 DU_LOG("\nERROR --> DU APP : deleteUeCfg(): CellIdx[%d] is not found", cellIdx);
3767 /*******************************************************************
3769 * @brief Handle UE delete response from MAC
3773 * Function : DuProcMacUeDeleteRsp
3775 * Functionality: Handle UE delete response from MAC
3777 * @params[in] Pointer to MacUeDeleteRsp and Pst
3778 * @return ROK - success
3781 * ****************************************************************/
3783 uint8_t DuProcMacUeDeleteRsp(Pst *pst, MacUeDeleteRsp *deleteRsp)
3785 uint8_t ret =ROK,ueId=0;
3787 uint32_t gnbCuUeF1apId =0 , gnbDuUeF1apId =0;
3791 if(deleteRsp->status == SUCCESSFUL)
3793 DU_LOG("\nINFO --> DU APP : MAC UE Delete Response : SUCCESS [UE IDX : %d]", deleteRsp->ueId);
3794 GET_CELL_IDX(deleteRsp->cellId, cellIdx);
3795 if(duCb.actvCellLst[cellIdx])
3797 duCb.actvCellLst[cellIdx]->ueCb[deleteRsp->ueId -1].duMacUeCfg.macUeCfgState = UE_DELETE_COMPLETE;
3798 ueId = deleteRsp->ueId;
3799 gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbCuUeF1apId;
3800 gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbDuUeF1apId;
3801 if(deleteUeCfg(deleteRsp->cellId, ueId) == ROK)
3803 ret = BuildAndSendUeContextReleaseComplete(deleteRsp->cellId, gnbCuUeF1apId, gnbDuUeF1apId);
3806 DU_LOG("\nERROR --> DU APP : DuProcMacUeDeleteRsp(): failed to send UE context release complete");
3814 DU_LOG("\nERROR --> DU APP : DuProcMacUeDeleteRsp(): MAC UE Delete Response : FAILURE [UE IDX : %d]",\
3818 DU_FREE_SHRABL_BUF(pst->region, pst->pool, deleteRsp, sizeof(MacUeDeleteRsp));
3822 DU_LOG("\nERROR --> DU APP : DuProcMacUeDeleteRsp(): MAC UE Delete Response is null");
3828 /*******************************************************************
3830 * @brief Processes UE Delete Rsp received from RLC
3834 * Function : DuProcRlcUeDeleteRsp
3837 * Processes UE Delete Rsp received from RLC
3839 * @params[in] Post structure
3840 * Pointer to RlcUeDeleteRsp
3841 * @return ROK - success
3844 * *****************************************************************/
3846 uint8_t DuProcRlcUeDeleteRsp(Pst *pst, RlcUeDeleteRsp *delRsp)
3848 uint8_t ueId = 0, ret = ROK;
3849 uint16_t cellIdx = 0,crnti=0;
3853 ueId = delRsp->ueId;
3854 GET_CELL_IDX(delRsp->cellId, cellIdx);
3856 if(delRsp->status == SUCCESSFUL)
3858 DU_LOG("\nINFO --> DU_APP: RLC UE Delete Response : SUCCESS [UE IDX:%d]", ueId);
3859 if(duCb.actvCellLst[cellIdx]!=NULLP)
3861 duCb.actvCellLst[cellIdx]->ueCb[ueId-1].duRlcUeCfg.rlcUeCfgState = UE_DELETE_COMPLETE;
3862 GET_CRNTI(crnti, ueId);
3863 if(sendUeDeleteReqToMac(delRsp->cellId, ueId, crnti) == RFAILED)
3865 DU_LOG("\nERROR --> DU APP : duBuildAndSendUeDeleteReq(): Failed to build UE delete req for MAC ");
3873 DU_LOG("\nERROR --> DU_APP: RLC UE Delete Response : FAILED [UE IDX:%d]", ueId);
3876 DU_FREE_SHRABL_BUF(pst->region, pst->pool, delRsp, sizeof(RlcUeDeleteRsp));
3882 /*******************************************************************
3884 * @brief Sending UE Delete Req To Mac
3888 * Function : sendUeDeleteReqToMac
3891 * sending UE Delete Req To Mac
3893 * @params[in] cellId, ueId, crnti
3894 * @return ROK - success
3897 *****************************************************************/
3899 uint8_t sendUeDeleteReqToMac(uint16_t cellId, uint8_t ueId, uint16_t crnti)
3903 MacUeDelete *ueDelete = NULLP;
3905 DU_ALLOC_SHRABL_BUF(ueDelete, sizeof(MacUeDelete));
3908 ueDelete->cellId = cellId;
3909 ueDelete->ueId = ueId;
3910 ueDelete->crnti = crnti;
3911 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_DELETE_REQ);
3913 DU_LOG("\nDEBUG --> DU_APP: Sending UE delete Request to MAC ");
3914 ret = (*packMacUeDeleteReqOpts[pst.selector])(&pst, ueDelete);
3917 DU_LOG("\nERROR --> DU_APP: sendUeDeleteReqToMac(): Failed to send UE delete Req to MAC");
3918 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueDelete, sizeof(MacUeDelete));
3923 DU_LOG("\nERROR --> DU_APP: sendUeDeleteReqToMac(): Failed to allocate memory");
3929 /*******************************************************************
3931 * @brief Sending UE Delete Req To Rlc
3935 * Function : sendUeDeleteReqToRlc
3938 * Sending UE Delete Req To Rlc
3940 * @params[in] cellId, ueId
3941 * @return ROK - success
3944 *****************************************************************/
3946 uint8_t sendUeDeleteReqToRlc(uint16_t cellId, uint8_t ueId)
3950 RlcUeDelete *ueDelete;
3952 DU_ALLOC_SHRABL_BUF(ueDelete, sizeof(RlcUeDelete));
3953 if(ueDelete !=NULLP)
3955 ueDelete->cellId = cellId;
3956 ueDelete->ueId = ueId;
3957 FILL_PST_DUAPP_TO_RLC(pst, RLC_UL_INST, EVENT_RLC_UE_DELETE_REQ);
3959 ret = (*packRlcUeDeleteReqOpts[pst.selector])(&pst, ueDelete);
3962 DU_LOG("\nERROR --> DU_APP : sendUeDeleteReqToRlc():Failed to send UE Delete Req to RLC");
3963 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueDelete, sizeof(RlcUeDelete));
3968 DU_LOG("\nERROR --> DU_APP: sendUeDeleteReqToRlc():Memory allocation failed");
3974 /*******************************************************************
3976 * @brief DU processes UE delete req from CU and sends to MAC and RLC
3980 * Function : duBuildAndSendUeDeleteReq
3982 * Functionality: DU processes UE delete req from CU and sends to MAC
3985 * @params[in] cellId, crnti
3986 * @return ROK - success
3989 * ****************************************************************/
3991 uint8_t duBuildAndSendUeDeleteReq(uint16_t cellId, uint16_t crnti)
3994 uint16_t cellIdx = 0;
3996 DU_LOG("\nDEBUG --> DU_APP: Processing UE Delete Request ");
3997 GET_CELL_IDX(cellId, cellIdx);
3998 GET_UE_ID(crnti, ueId);
4000 if(duCb.actvCellLst[cellIdx] != NULLP)
4002 if(crnti != duCb.actvCellLst[cellIdx]->ueCb[ueId - 1].crnti)
4004 DU_LOG("\nERROR --> DU APP : duBuildAndSendUeDeleteReq(): CRNTI [%d] not found", crnti);
4008 duCb.actvCellLst[cellIdx]->ueCb[ueId - 1].ueState = UE_DELETION_IN_PROGRESS;
4009 if(sendUeDeleteReqToRlc(cellId, ueId) == RFAILED)
4011 DU_LOG("\nERROR --> DU APP : DuProcMacUeDeleteRsp():Failed to build UE delete req for RLC ");
4017 DU_LOG("\nERROR --> DU APP : duBuildAndSendUeDeleteReq(): Cell Id is not found");
4024 /*******************************************************************
4026 * @brief delete RlcUeCreate from duCb
4030 * Function : deleteRlcUeCfg
4033 * delete RlcUeCreate from duCb
4035 * @params[in] RlcUeCreate *ueCfg
4037 * @return ROK - success
4040 *****************************************************************/
4042 void deleteRlcUeCfg(DuRlcUeCfg *ueCfg)
4045 RlcBearerCfg *lcCfg= NULLP;
4048 for(lcIdx =0 ; lcIdx < ueCfg->numLcs ; lcIdx++)
4050 lcCfg = &ueCfg->rlcLcCfg[lcIdx].rlcBearerCfg;
4051 switch(lcCfg->rlcMode)
4055 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.amCfg, sizeof(AmBearerCfg));
4058 case RLC_UM_BI_DIRECTIONAL :
4060 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
4063 case RLC_UM_UNI_DIRECTIONAL_UL :
4065 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
4068 case RLC_UM_UNI_DIRECTIONAL_DL :
4070 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
4074 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->snssai, sizeof(Snssai));
4076 memset(ueCfg, 0, sizeof(DuRlcUeCfg));
4080 /*******************************************************************
4082 * @brief Du process Ue Context Release Command
4086 * Function : duProcUeContextReleaseCommand
4088 * Functionality: Du process Ue Context Release Command
4090 * @params[in] DuUeCb *duUeCb
4091 * @return ROK - success
4094 * ****************************************************************/
4095 uint8_t duProcUeContextReleaseCommand(uint16_t cellId, DuUeCb *duUeCb)
4097 uint8_t ret =ROK, ueId=0;
4102 crnti = duUeCb->crnti;
4103 GET_UE_ID(crnti, ueId);
4107 /* Send DL RRC msg for RRC release */
4108 if(duUeCb->f1UeDb->dlRrcMsg)
4110 if(duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu != NULLP)
4112 ret = duBuildAndSendDlRrcMsgToRlc(cellId, duCb.actvCellLst[duUeCb->f1UeDb->cellIdx]->ueCb[ueId-1].duRlcUeCfg,\
4113 duUeCb->f1UeDb->dlRrcMsg);
4116 DU_LOG("\nERROR --> DU APP : duProcUeContextReleaseCommand() : Failed to send DL RRC msg");
4117 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu,\
4118 duUeCb->f1UeDb->dlRrcMsg->rrcMsgSize);
4119 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
4126 ret = duBuildAndSendUeDeleteReq(cellId,crnti);
4129 DU_LOG("\nERROR --> DU APP : duProcUeContextReleaseCommand(): Failed to build and send Ue Delete request");
4136 /*******************************************************************
4138 * @brief Sending UE Reset Req To Mac
4142 * Function : sendUeResetReqToMac
4145 * sending UE Reset Req To Mac
4147 * @params[in] cellId, ueId, crnti
4148 * @return ROK - success
4151 *****************************************************************/
4153 uint8_t sendUeResetReqToMac(uint16_t cellId, uint8_t ueId)
4157 MacUeResetReq *ueReset = NULLP;
4159 DU_ALLOC_SHRABL_BUF(ueReset, sizeof(MacUeResetReq));
4162 ueReset->cellId = cellId;
4163 ueReset->ueId = ueId;
4164 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_RESET_REQ);
4166 DU_LOG("\nDEBUG --> DU_APP: Sending UE Reset Request to MAC ");
4167 ret = (*packMacUeResetReqOpts[pst.selector])(&pst, ueReset);
4170 DU_LOG("\nERROR --> DU_APP: sendUeResetReqToMac(): Failed to send UE Reset Req to MAC");
4171 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueReset, sizeof(MacUeResetReq));
4176 DU_LOG("\nERROR --> DU_APP: sendUeResetReqToMac(): Failed to allocate memory");
4182 /*******************************************************************
4184 * @brief DU processes UE reset req and send it to MAC
4188 * Function : duBuildAndSendUeResetReq
4190 * Functionality: DU processes UE reset req and send to MAC
4193 * @params[in] cellId, crnti
4194 * @return ROK - success
4197 * ****************************************************************/
4199 uint8_t duBuildAndSendUeResetReq(uint16_t cellId, uint16_t crnti)
4202 uint16_t cellIdx = 0;
4204 DU_LOG("\nDEBUG --> DU_APP : Building UE reset request");
4205 GET_CELL_IDX(cellId, cellIdx);
4206 GET_UE_ID(crnti, ueId);
4208 if(duCb.actvCellLst[cellIdx] != NULLP)
4210 if(crnti != duCb.actvCellLst[cellIdx]->ueCb[ueId - 1].crnti)
4212 DU_LOG("\nERROR --> DU APP : duBuildAndSendUeResetReq(): CRNTI [%d] not found", crnti);
4216 duCb.actvCellLst[cellIdx]->ueCb[ueId - 1].ueState = UE_RESET_IN_PROGRESS;
4217 if(sendUeResetReqToMac(cellId, ueId) == RFAILED)
4219 DU_LOG("\nERROR --> DU APP : DuProcMacUeResetRsp(): Failed to build UE reset req for MAC ");
4225 DU_LOG("\nERROR --> DU APP : duBuildAndSendUeResetReq(): Cell Id %d not found", cellId);
4232 /*******************************************************************
4234 * @brief Handle UE reset response from MAC
4238 * Function : DuProcMacUeResetRsp
4240 * Functionality: Handle UE reset response from MAC
4242 * @params[in] Pointer to MacUeResetRsp and Pst
4243 * @return ROK - success
4246 * ****************************************************************/
4248 uint8_t DuProcMacUeResetRsp(Pst *pst, MacUeResetRsp *resetRsp)
4255 if(resetRsp->status == SUCCESSFUL)
4257 DU_LOG("\nINFO --> DU APP : MAC UE Reset Response : SUCCESS [UE IDX : %d]", resetRsp->ueId);
4258 GET_CELL_IDX(resetRsp->cellId, cellIdx);
4259 if(duCb.actvCellLst[cellIdx])
4261 duCb.actvCellLst[cellIdx]->ueCb[resetRsp->ueId -1].duMacUeCfg.macUeCfgState = UE_RESET_COMPLETE;
4262 /*TODO - Complete the processing after receiving successfully reset rsp*/
4267 DU_LOG("\nERROR --> DU APP : DuProcMacUeResetRsp(): MAC UE Reset Response : FAILURE [UE IDX : %d]",resetRsp->ueId);
4270 DU_FREE_SHRABL_BUF(pst->region, pst->pool, resetRsp, sizeof(MacUeResetRsp));
4274 DU_LOG("\nERROR --> DU APP : DuProcMacUeResetRsp(): MAC UE Reset Response is null");
4280 /*******************************************************************
4282 * @brief Handle UE sync status indication from MAC
4286 * Function : DuProcMacUeSyncStatusInd
4288 * Functionality: Handle UE sync status indication from MAC
4290 * @params[in] Pointer to MacUeSyncStatusInd and Pst
4291 * @return ROK - success
4294 * ****************************************************************/
4296 uint8_t DuProcMacUeSyncStatusInd(Pst *pst, MacUeSyncStatusInd *ueSyncStatusInd)
4298 uint8_t ret =RFAILED;
4299 uint16_t cellIdx=0, crnti = 0;
4304 GET_CELL_IDX(ueSyncStatusInd->cellId, cellIdx);
4305 if(duCb.actvCellLst[cellIdx])
4307 GET_CRNTI(crnti, ueSyncStatusInd->ueId);
4308 if(duCb.actvCellLst[cellIdx]->ueCb[ueSyncStatusInd->ueId-1].crnti == crnti)
4310 switch(ueSyncStatusInd->status)
4317 status = "OUT_OF_SYNC";
4320 case OUT_OF_SUNC_MAX_RETRIES:
4321 status = "OUT_OF_SUNC_MAX_RETRIES";
4329 DU_LOG("\nINFO --> DU APP : MAC UE sync status for received UeId %d is %s", ueSyncStatusInd->ueId,status);
4333 DU_LOG("\nERROR --> DU APP : DuProcMacUeSyncStatusInd(): MAC UE sync status indication : Ue Id [%d] not found",ueSyncStatusInd->cellId);
4338 DU_LOG("\nERROR --> DU APP : DuProcMacUeSyncStatusInd(): MAC UE sync status indication : Cell Id [%d] not found",ueSyncStatusInd->cellId);
4340 DU_FREE_SHRABL_BUF(pst->region, pst->pool, ueSyncStatusInd, sizeof(MacUeSyncStatusInd));
4344 DU_LOG("\nERROR --> DU APP : DuProcMacUeSyncStatusInd(): MAC UE sync status indication is null");
4349 /*******************************************************************
4351 * @brief Sending UE Reestablishment Req To Rlc
4355 * Function : sendUeReestablishReqToRlc
4358 * Sending UE Reestablishment Req To Rlc
4360 * @params[in] cellId, ueId
4361 * @return ROK - success
4364 *****************************************************************/
4366 uint8_t sendUeReestablishReqToRlc(uint16_t cellId, uint8_t ueId, uint8_t numLcToReestablish, uint8_t *lcId)
4368 uint8_t ret=ROK,idx=0;
4370 RlcUeReestablishReq *ueReestablish;
4372 DU_ALLOC_SHRABL_BUF(ueReestablish, sizeof(RlcUeReestablishReq));
4373 if(ueReestablish !=NULLP)
4375 ueReestablish->cellId = cellId;
4376 ueReestablish->ueId = ueId;
4377 ueReestablish->numLcsToReestablish = numLcToReestablish;
4379 for(idx = 0;idx<numLcToReestablish; idx++)
4381 ueReestablish->lcToReestablish[idx]= lcId[idx];
4383 FILL_PST_DUAPP_TO_RLC(pst, RLC_UL_INST, EVENT_RLC_UE_REESTABLISH_REQ);
4385 ret = (*packRlcUeReestablishReqOpts[pst.selector])(&pst, ueReestablish);
4388 DU_LOG("\nERROR --> DU_APP : sendUeReestablishReqToRlc():Failed to send UE Reestablishment Req to RLC");
4389 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueReestablish, sizeof(RlcUeReestablishReq));
4394 DU_LOG("\nERROR --> DU_APP: sendUeReestablishReqToRlc():Memory allocation failed");
4400 /*******************************************************************
4402 * @brief DU processes UE reestablishment req and sends to MAC and RLC
4406 * Function : duBuildAndSendUeReestablishReq
4408 * Functionality: DU processes UE reestablishment req and sends to MAC
4411 * @params[in] cellId, crnti, numLcToReestablish, ListOflcid
4412 * @return ROK - success
4415 * ****************************************************************/
4417 uint8_t duBuildAndSendUeReestablishReq(uint16_t cellId, uint16_t crnti, uint8_t numLcToReestablish, uint8_t *lcId)
4420 uint16_t cellIdx = 0;
4422 DU_LOG("\nDEBUG --> DU_APP: Building UE Reestablishment Request ");
4423 GET_CELL_IDX(cellId, cellIdx);
4424 GET_UE_ID(crnti, ueId);
4426 if(duCb.actvCellLst[cellIdx] != NULLP)
4428 if(crnti != duCb.actvCellLst[cellIdx]->ueCb[ueId - 1].crnti)
4430 DU_LOG("\nERROR --> DU APP : duBuildAndSendUeReestablishReq(): CRNTI [%d] not found", crnti);
4434 if(sendUeReestablishReqToRlc(cellId, ueId, numLcToReestablish, lcId) == RFAILED)
4436 DU_LOG("\nERROR --> DU APP : duBuildAndSendUeReestablishReq(): Failed to send UE reestablishment req for RLC ");
4442 DU_LOG("\nERROR --> DU APP : duBuildAndSendUeReestablishReq(): Cell Id %d is not found", cellId);
4449 /*******************************************************************
4451 * @brief Processes UE Reestablishment Rsp received from RLC
4455 * Function : DuProcRlcUeReestablishRsp
4458 * Processes UE Reestablishment Rsp received from RLC
4460 * @params[in] Post structure
4461 * Pointer to RlcUeReestablishRsp
4462 * @return ROK - success
4465 * *****************************************************************/
4467 uint8_t DuProcRlcUeReestablishRsp(Pst *pst, RlcUeReestablishRsp *ueReestablishRsp)
4469 uint8_t ueId = 0, ret = RFAILED;
4470 uint16_t cellIdx = 0,crnti=0;
4472 if(ueReestablishRsp)
4474 ueId = ueReestablishRsp->ueId;
4475 GET_CELL_IDX(ueReestablishRsp->cellId, cellIdx);
4477 if(ueReestablishRsp->status == SUCCESSFUL)
4479 if(duCb.actvCellLst[cellIdx]!=NULLP)
4481 GET_CRNTI(crnti, ueId);
4482 if(duCb.actvCellLst[cellIdx]->ueCb[ueId-1].crnti == crnti)
4484 /*TODO: complete the processing of UE Reestablishment Response */
4485 DU_LOG("\nINFO --> DU_APP: RLC UE Reestablishment Response : SUCCESS [UE IDX:%d]", ueId);
4489 DU_LOG("\nERROR --> DU APP : duBuildAndSendUeReestablishRsp(): CRNTI [%d] not found", crnti);
4492 DU_LOG("\nERROR --> DU APP : duBuildAndSendUeReestablishRsp(): Cell Id[%d] is not found", ueReestablishRsp->cellId);
4497 DU_LOG("\nERROR --> DU_APP: RLC UE Reestablishment Response : FAILED [UE IDX:%d]", ueId);
4499 DU_FREE_SHRABL_BUF(pst->region, pst->pool, ueReestablishRsp, sizeof(RlcUeReestablishRsp));
4504 /**********************************************************************
4506 ***********************************************************************/