Jira id - ODUHIGH-227
[o-du/l2.git] / src / du_app / du_ue_mgr.c
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
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                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
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"
20 #include "lrg.h"
21 #include "lrg.x"
22 #include "ckw.h"
23 #include "ckw.x"
24 #include "kwu.h"
25 #include "kwu.x"
26 #include "lkw.h"
27 #include "lkw.x"
28 #include "legtp.h"
29 #include "du_app_mac_inf.h"
30 #include "du_app_rlc_inf.h"
31 #include "du_cfg.h"
32 #include "du_utils.h"
33 #include<ProtocolIE-Field.h>
34 #include "F1AP-PDU.h"
35 #include "du_mgr.h"
36 #include "du_f1ap_msg_hdl.h"
37 #include "du_ue_mgr.h"
38
39 #ifdef EGTP_TEST
40 U32 sduId = 0;
41 #endif
42
43 DuMacDlCcchInd packMacDlCcchIndOpts[] =
44 {
45    packMacDlCcchInd,   /* Loose coupling */
46    MacProcDlCcchInd,    /* TIght coupling */
47    packMacDlCcchInd    /* Light weight-loose coupling */
48 };
49
50 DuMacUeCreateReq packMacUeCreateReqOpts[] =
51 {
52    packDuMacUeCreateReq,       /* Loose coupling */
53    MacProcUeCreateReq,          /* TIght coupling */
54    packDuMacUeCreateReq,       /* Light weight-loose coupling */
55 };
56
57 DuRlcUlUeCreateReq packRlcUlUeCreateReqOpts[] =
58 {
59    packDuRlcUlUeCreateReq,       /* Loose coupling */
60    RlcUlProcUeCreateReq,          /* TIght coupling */
61    packDuRlcUlUeCreateReq,       /* Light weight-loose coupling */
62 };
63
64 /*******************************************************************
65  *
66  * @brief Handles EGTP data from CU 
67  *
68  * @details
69  *
70  *    Function : duHdlEgtpData
71  *
72  *    Functionality: 
73  *      Processes EGTP header and sends data to RLC
74  *
75  * @params[in]  Pointer to EGTP Message 
76  * @return ROK     - success
77  *         RFAILED - failure
78  *
79  * ****************************************************************/
80 uint8_t duHdlEgtpDlData(EgtpMsg  *egtpMsg)
81 {
82    /* TODO : Extract RbId/UeID/CellID/SduId from database
83       using tunnel id in egtp header */
84
85    DU_LOG("\nDU_APP : Processing DL data");
86
87    Pst pst;
88    KwuDatReqInfo datReqInfo;
89
90 #ifdef EGTP_TEST
91    datReqInfo.rlcId.rbId = RB_ID;
92    datReqInfo.rlcId.rbType = CM_LTE_DRB;
93    datReqInfo.rlcId.ueId = UE_ID;
94    datReqInfo.rlcId.cellId = NR_CELL_ID;
95
96    datReqInfo.sduId = ++sduId;
97    datReqInfo.lcType = CM_LTE_LCH_DTCH;
98 #endif
99    /* Filling pst and Sending to RLC DL */
100    pst.selector  = ODU_SELECTOR_LWLC;
101    pst.srcEnt    = ENTDUAPP;
102    pst.dstEnt    = ENTRLC;
103    pst.dstInst   = RLC_DL_INST;
104    pst.dstProcId = DU_PROC;
105    pst.srcProcId = DU_PROC;
106    pst.region    = duCb.init.region;
107
108    cmPkKwuDatReq(&pst, &datReqInfo, egtpMsg->msg);
109    return ROK;
110 }
111
112 /*******************************************************************
113  *
114  * @brief Handles UL data and send to CU
115  *
116  * @details
117  *
118  *    Function : duHdlRlcUlData
119  *
120  *    Functionality: 
121  *     Processes UL Data from RLC and sends to CU
122  * 
123  *  @params[in]  Pointer to EGTP Message 
124  *  @return ROK     - success
125  *          RFAILED - failure
126  * 
127  *****************************************************************/
128
129 uint8_t duHdlRlcUlData(Pst *pst, KwuDatIndInfo* datInd, Buffer *mBuf)
130 {
131    DU_LOG("\nDU_APP : Received UL Data at DU_APP");
132
133    /* Send UL data to CU via EGTP */
134    duSendEgtpDatInd(mBuf);
135    ODU_PUT_MSG(mBuf);
136
137    return ROK;
138 }
139
140 /******************************************************************
141  *
142  * @brief Builds and Sends DL CCCH Ind to MAC
143  *
144  * @details
145  *
146  *    Function : duBuildAndSendDlCcchInd 
147  *
148  *    Functionality: Builds and sends DL CCCH Ind Msg to MAC
149  *
150  * @params[in] dlCcchMsg - uint8_t*
151  * @return ROK     - success
152  *         RFAILED - failure
153  *
154  * ****************************************************************/
155 uint8_t duBuildAndSendDlCcchInd(uint16_t *cellId, uint16_t *crnti, \
156       DlCcchMsgType msgType, uint8_t *dlCcchMsg, uint16_t dlCcchMsgSize)
157 {
158    uint8_t ret                  = ROK;
159    uint16_t idx2;
160    DlCcchIndInfo *dlCcchIndInfo = NULLP;
161    Pst pst;
162    memset(&pst, 0, sizeof(Pst));
163
164    DU_LOG("\nDU APP : Building and Sending DL CCCH Ind to MAC");
165
166    DU_ALLOC_SHRABL_BUF(dlCcchIndInfo, sizeof(DlCcchIndInfo));
167
168    if(!dlCcchIndInfo)
169    {
170       DU_LOG("\nDU APP : Memory alloc failed while building DL CCCH Ind");
171       return RFAILED;
172    }
173
174    dlCcchIndInfo->cellId = *cellId;
175    dlCcchIndInfo->crnti = *crnti;
176    dlCcchIndInfo->msgType = msgType;
177    dlCcchIndInfo->dlCcchMsgLen = dlCcchMsgSize;
178
179    DU_ALLOC_SHRABL_BUF(dlCcchIndInfo->dlCcchMsg, dlCcchIndInfo->dlCcchMsgLen);
180    if(!dlCcchIndInfo->dlCcchMsg)
181    {
182       DU_LOG("\nDU APP : Memory alloc failed while building DL CCCH Ind");
183       DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo, sizeof(DlCcchIndInfo));
184       return RFAILED;
185    }
186    for(idx2 = 0; idx2 < dlCcchIndInfo->dlCcchMsgLen; idx2++)
187    {
188       dlCcchIndInfo->dlCcchMsg[idx2] = dlCcchMsg[idx2];
189    }
190    DU_FREE(dlCcchMsg, dlCcchMsgSize);
191
192    /* Fill Pst */
193    FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_DL_CCCH_IND);
194    ret = (*packMacDlCcchIndOpts[pst.selector])(&pst, dlCcchIndInfo);
195    if(ret != ROK)
196    {
197       DU_LOG("\nDU_APP : Failure in sending DL CCCH to MAC");
198       DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo->dlCcchMsg,\
199             dlCcchIndInfo->dlCcchMsgLen);
200       DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo, \
201             sizeof(DlCcchIndInfo));
202       ret = RFAILED; 
203    }
204
205    return ret;
206
207 }
208
209 /******************************************************************
210  *
211  * @brief Processes DL RRC Message Transfer  sent by CU
212  *
213  * @details
214  *
215  *    Function : procDlRrcMsgTrans 
216  *
217  *    Functionality: Processes DL RRC Message Transfer sent by CU
218  *
219  * @params[in] F1AP_PDU_t ASN decoded F1AP message
220  * @return ROK     - success
221  *         RFAILED - failure
222  *
223  * ****************************************************************/
224 uint8_t procDlRrcMsgTrans(F1AP_PDU_t *f1apMsg)
225 {
226    DLRRCMessageTransfer_t *dlRrcMsg = NULLP;
227    uint8_t                *dlCcchMsg = NULLP;
228    uint8_t                idx, ret, srbId;
229    uint16_t               idx2, crnti, cellId, dlCcchMsgSize;
230    uint32_t               gnbCuUeF1apId, gnbDuUeF1apId;
231
232
233    DU_LOG("\nDU_APP : DL RRC message transfer Recevied");
234    dlRrcMsg = &f1apMsg->choice.initiatingMessage->value.choice.DLRRCMessageTransfer;
235
236    ret = ROK;
237
238    for(idx=0; idx<dlRrcMsg->protocolIEs.list.count; idx++)
239    {
240       switch(dlRrcMsg->protocolIEs.list.array[idx]->id)
241       {
242          case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
243             {
244                gnbCuUeF1apId = dlRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID;
245                break;
246             }
247          case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
248             {
249                gnbDuUeF1apId = dlRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID;
250                break;
251             }
252          case ProtocolIE_ID_id_SRBID:
253             {
254                srbId = dlRrcMsg->protocolIEs.list.array[idx]->value.choice.SRBID;
255                break;
256             }
257          case ProtocolIE_ID_id_ExecuteDuplication:
258             break;
259
260          case ProtocolIE_ID_id_RRCContainer:
261             {
262                if(dlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size > 0)
263                {
264                   dlCcchMsgSize = dlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size;
265                   DU_ALLOC(dlCcchMsg, dlCcchMsgSize);
266                   for(idx2 = 0; idx2 < dlCcchMsgSize; idx2++)
267                   {
268                      dlCcchMsg[idx2] = \
269                         dlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf[idx2];
270                   }
271                }
272                else
273                {
274                   DU_LOG("\nDU_APP : RRC Container Size is invalid:%ld",\
275                         dlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size);
276                }
277                break;
278             }
279
280          default:
281             DU_LOG("\nDU_APP : Invalid IE received in DL RRC Msg Transfer:%ld",
282                   dlRrcMsg->protocolIEs.list.array[idx]->id);
283       }
284    }
285
286    for(idx=0; idx<duCb.numUe; idx++)
287    {
288       if(gnbDuUeF1apId == duCb.ueCcchCtxt[idx].gnbDuUeF1apId)
289       {
290          crnti  = duCb.ueCcchCtxt[idx].crnti;
291          cellId = duCb.ueCcchCtxt[idx].cellId;
292          break;
293       }
294    }
295    if(srbId == SRB_ID_1) //RRC connection setup
296    {
297       ret = duBuildAndSendDlCcchInd(&cellId, &crnti, RRC_SETUP, dlCcchMsg, dlCcchMsgSize);
298       if(ret)
299       {
300          DU_LOG("\nDU_APP: Falied at duBuildAndSendDlCcchInd()");
301       }
302       else
303       {
304          if(duCb.actvCellLst[cellId-1]->numActvUes < MAX_NUM_UE)
305          {
306             ret = duCreateUeCb(&duCb.ueCcchCtxt[idx], gnbCuUeF1apId);
307             if(ret)
308             {
309                DU_LOG("\nDU_APP: Failed at duCreateUeCb for cellId [%d]", duCb.ueCcchCtxt[idx].cellId);
310                ret = RFAILED;
311             }
312          }
313          else
314          {
315             DU_LOG("\nDU_APP: Max Active UEs has reached");
316             ret = RFAILED;
317          }
318       }
319    }            
320    return ret;
321 }
322
323 /******************************************************************
324  *
325  * @brief Generates GNB DU Ue F1AP ID
326  *
327  * @details
328  *
329  *    Function : genGnbDuUeF1apId
330  *
331  *    Functionality: Generates GNB DU Ue F1AP ID
332  *
333  * @params[in] void
334  * @return gnbDuF1apId
335  *
336  * ****************************************************************/
337 uint32_t genGnbDuUeF1apId()
338 {
339    static uint32_t gnbDuUeF1apId = 0;
340
341    return ++gnbDuUeF1apId;
342 }
343
344 /******************************************************************
345  *
346  * @brief Processes UL CCCH Ind recvd from MAC
347  *
348  * @details
349  *
350  *    Function : duProcUlCcchInd
351  *
352  *    Functionality: Processes UL CCCH Ind recvd from MAC
353  *
354  * @params[in] UlCcchIndInfo *ulCcchIndInfo
355  * @return ROK     - success
356  *         RFAILED - failure
357  *
358  * ****************************************************************/
359 uint8_t duProcUlCcchInd(UlCcchIndInfo *ulCcchIndInfo)
360 {
361
362    uint8_t ret = ROK;
363    uint32_t gnbDuUeF1apId = 0;
364
365    gnbDuUeF1apId = genGnbDuUeF1apId();
366
367    /* Store Ue mapping */
368    duCb.ueCcchCtxt[duCb.numUe].gnbDuUeF1apId = gnbDuUeF1apId;
369    duCb.ueCcchCtxt[duCb.numUe].crnti         = ulCcchIndInfo->crnti;
370    duCb.ueCcchCtxt[duCb.numUe].cellId        = ulCcchIndInfo->cellId;
371
372    duCb.numUe++;
373
374    ret = (BuildAndSendInitialRrcMsgTransfer(gnbDuUeF1apId, ulCcchIndInfo->crnti, ulCcchIndInfo->ulCcchMsgLen,
375             ulCcchIndInfo->ulCcchMsg));
376    if(ret != ROK)
377    {
378       DU_LOG("\nDU_APP : BuildAndSendInitialRrcMsgTransfer failed");
379    }
380
381    DU_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, ulCcchIndInfo->ulCcchMsg, ulCcchIndInfo->ulCcchMsgLen);
382    DU_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, ulCcchIndInfo, sizeof(UlCcchIndInfo));
383
384    return ret;
385
386 }
387
388 /******************************************************************
389  *
390  * @brief Fills Initial DL Bandwidth Part
391  *
392  * @details
393  *
394  *    Function : fillInitDlBwp
395  *
396  *    Functionality: Fills Initial DL Bandwidth Part
397  *
398  *
399  *****************************************************************/
400 void fillInitDlBwp(InitialDlBwp *initDlBwp)
401 {
402    uint8_t idx = 0;
403    uint8_t freqDomainResource[FREQ_DOM_RSRC_SIZE] = {0};
404    uint8_t coreset0EndPrb, coreset1StartPrb, coreset1NumPrb;
405
406
407    if(initDlBwp)
408    {
409       /* Filling PDCCH Config */
410       initDlBwp->pdcchPresent = TRUE;
411       if(initDlBwp->pdcchPresent)
412       {
413          initDlBwp->pdcchCfg.numCRsetToAddMod = PDCCH_CTRL_RSRC_SET_ONE_ID;
414          memset(initDlBwp->pdcchCfg.cRSetToAddModList, 0, MAX_NUM_CRSET);
415          if(initDlBwp->pdcchCfg.numCRsetToAddMod <= MAX_NUM_CRSET)
416          {
417             initDlBwp->pdcchCfg.cRSetToAddModList[idx].cRSetId = \
418                PDCCH_CTRL_RSRC_SET_ONE_ID;
419             memset(initDlBwp->pdcchCfg.cRSetToAddModList[idx].freqDomainRsrc, 0,\
420                FREQ_DOM_RSRC_SIZE); 
421             coreset0EndPrb = CORESET0_END_PRB;
422             coreset1StartPrb = coreset0EndPrb +6;
423             coreset1NumPrb = CORESET1_NUM_PRB;
424             /* calculate the PRBs */
425             schAllocFreqDomRscType0(((coreset1StartPrb)/6), (coreset1NumPrb/6), freqDomainResource);
426             memcpy(initDlBwp->pdcchCfg.cRSetToAddModList[idx].freqDomainRsrc, freqDomainResource,
427                FREQ_DOM_RSRC_SIZE);
428
429             initDlBwp->pdcchCfg.cRSetToAddModList[idx].duration = \
430                PDCCH_CTRL_RSRC_SET_ONE_DURATION;
431             initDlBwp->pdcchCfg.cRSetToAddModList[idx].cceRegMappingType = \
432                CCE_REG_MAPPINGTYPE_PR_NONINTERLEAVED;
433             initDlBwp->pdcchCfg.cRSetToAddModList[idx].precoderGranularity = \
434                ALL_CONTIGUOUS_RBS;
435             initDlBwp->pdcchCfg.cRSetToAddModList[idx].dmrsScramblingId = \
436                SCRAMBLING_ID;
437          }
438          initDlBwp->pdcchCfg.numCRsetToRel = 0;
439          /* Filling Serach Space */
440          initDlBwp->pdcchCfg.numSearchSpcToAddMod = PDCCH_CTRL_RSRC_SET_ONE_ID;
441          memset(initDlBwp->pdcchCfg.searchSpcToAddModList, 0, MAX_NUM_CRSET);
442          if(initDlBwp->pdcchCfg.numSearchSpcToAddMod <= MAX_NUM_CRSET)
443          {
444             initDlBwp->pdcchCfg.searchSpcToAddModList[idx].searchSpaceId =\
445                PDCCH_SRCH_SPC_TWO_ID;
446             initDlBwp->pdcchCfg.searchSpcToAddModList[idx].cRSetId = \
447                PDCCH_CTRL_RSRC_SET_ONE_ID;
448             initDlBwp->pdcchCfg.searchSpcToAddModList[idx].\
449                mSlotPeriodicityAndOffset = SLOTPERIODICITYANDOFFSET_PR_SL1;
450             memset(initDlBwp->pdcchCfg.searchSpcToAddModList[idx].mSymbolsWithinSlot, 0,\
451                MONITORING_SYMB_WITHIN_SLOT_SIZE);
452             initDlBwp->pdcchCfg.searchSpcToAddModList[idx].mSymbolsWithinSlot[idx] =\
453                PDCCH_SYMBOL_WITHIN_SLOT;
454             initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel1 =\
455                AGGREGATIONLEVEL_N8; 
456             initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel2 =\
457                AGGREGATIONLEVEL_N8; 
458             initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel4 =\
459                AGGREGATIONLEVEL_N4; 
460             initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel8 =\
461                AGGREGATIONLEVEL_N2; 
462             initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel16 =\
463                AGGREGATIONLEVEL_N1;
464             initDlBwp->pdcchCfg.searchSpcToAddModList[idx].searchSpaceType = \
465                SEARCHSPACETYPE_PR_UE_SPECIFIC;
466             initDlBwp->pdcchCfg.searchSpcToAddModList[idx].ueSpecificDciFormat =\
467                PDCCH_SRCH_SPC_TWO_UE_SPEC_DCI_FORMAT;
468
469             initDlBwp->pdcchCfg.numSearchSpcToRel = 0;
470
471          }
472       }
473       /* Filling PDSCH Config */
474       initDlBwp->pdschPresent = TRUE;
475       if(initDlBwp->pdschPresent)
476       {
477          initDlBwp->pdschCfg.dmrsDlCfgForPdschMapTypeA.addPos = ADDITIONALPOSITION_POS0;
478          initDlBwp->pdschCfg.resourceAllocType = RESOURCEALLOCATION_TYPE1;
479          initDlBwp->pdschCfg.numTimeDomRsrcAlloc = 1;
480          initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].mappingType = \
481             MAPPING_TYPEA;
482          initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].startSymbol = PDSCH_START_SYMBOL; 
483          initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].symbolLength = PDSCH_LENGTH_SYMBOL;
484          initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].startSymbolAndLength = \
485             calcSliv(PDSCH_START_SYMBOL, PDSCH_LENGTH_SYMBOL);
486          initDlBwp->pdschCfg.rbgSize = RBG_SIZE_CONFIG1;
487          initDlBwp->pdschCfg.numCodeWordsSchByDci = CODEWORDS_SCHED_BY_DCI_N1;
488          initDlBwp->pdschCfg.bundlingType = TYPE_STATIC_BUNDLING;
489       }
490    }
491
492 }
493
494 /******************************************************************
495  *
496  * @brief Fills Initial UL Bandwidth Part
497  *
498  * @details
499  *
500  *    Function : fillInitUlBwp
501  *
502  *    Functionality: Fills Initial UL Bandwidth Part
503  *
504  *
505  *****************************************************************/
506 void fillInitUlBwp(InitialUlBwp *initUlBwp)
507 {
508    uint8_t idx;
509    if(initUlBwp)
510    {
511       initUlBwp->pucchPresent = FALSE;
512
513       /*Filling PUSCH Config */
514       initUlBwp->puschPresent = TRUE;
515       if(initUlBwp->puschPresent)
516       {
517          initUlBwp->puschCfg.dmrsUlCfgForPuschMapTypeA.addPos = ADDITIONALPOSITION_POS0; 
518          initUlBwp->puschCfg.dmrsUlCfgForPuschMapTypeA.transPrecodDisabled. \
519             scramblingId0 = SCRAMBLING_ID; 
520          initUlBwp->puschCfg.resourceAllocType = RESOURCEALLOCATION_TYPE1;
521          initUlBwp->puschCfg.numTimeDomRsrcAlloc = 1;
522          idx = 0;
523          if(initUlBwp->puschCfg.numTimeDomRsrcAlloc <= MAX_NUM_UL_ALLOC)
524          {
525             initUlBwp->puschCfg.timeDomRsrcAllocList[idx].k2 = PUSCH_K2;
526             initUlBwp->puschCfg.timeDomRsrcAllocList[idx].mappingType =\
527                MAPPING_TYPEA;
528             initUlBwp->puschCfg.timeDomRsrcAllocList[idx].startSymbol = PUSCH_START_SYMBOL;
529             initUlBwp->puschCfg.timeDomRsrcAllocList[idx].symbolLength = PUSCH_LENGTH_SYMBOL;
530             initUlBwp->puschCfg.timeDomRsrcAllocList[idx].startSymbolAndLength =\
531                calcSliv(PUSCH_START_SYMBOL, PUSCH_LENGTH_SYMBOL);
532          }
533          initUlBwp->puschCfg.transformPrecoder = TRANSFORM_PRECODER_DISABLED;
534       }
535    }
536    else
537    {
538       DU_LOG("\n DUAPP: Memory is NULL of InitalUlBwp");
539    }
540
541 }
542 /******************************************************************
543  *
544  * @brief Fills SpCell Group Info
545  *
546  * @details
547  *
548  *    Function : fillSpCellGrpInfo
549  *
550  *    Functionality: Fills Sp Cell Group Info
551  *
552  *
553  *****************************************************************/
554 void fillSpCellGrpInfo(SpCellCfg *spCell)
555 {
556    if(spCell)
557    {
558       spCell->servCellIdx = SERV_CELL_IDX;
559       /* Filling Initial Dl Bwp */
560       fillInitDlBwp(&spCell->servCellCfg.initDlBwp);
561
562       spCell->servCellCfg.numDlBwpToAdd    = 0; 
563       spCell->servCellCfg.firstActvDlBwpId = ACTIVE_DL_BWP_ID;
564       spCell->servCellCfg.defaultDlBwpId   = ACTIVE_DL_BWP_ID;
565       spCell->servCellCfg.bwpInactivityTmr = NULLP;
566       spCell->servCellCfg.pdschServCellCfg.maxMimoLayers = NULLP;
567       spCell->servCellCfg.pdschServCellCfg.maxCodeBlkGrpPerTb = NULLP;
568       spCell->servCellCfg.pdschServCellCfg.codeBlkGrpFlushInd = NULLP;
569       spCell->servCellCfg.pdschServCellCfg.xOverhead = NULLP;
570       spCell->servCellCfg.pdschServCellCfg.numHarqProcForPdsch =\
571          NUM_HARQ_PROC_FOR_PDSCH_N_16;
572       /* Filling Initial UL Bwp*/
573       fillInitUlBwp(&spCell->servCellCfg.initUlBwp);
574       spCell->servCellCfg.numUlBwpToAdd     = 0; 
575       spCell->servCellCfg.firstActvUlBwpId  = ACTIVE_DL_BWP_ID; 
576    }
577    else
578    {
579       DU_LOG("\n DU_APP: Memory is NULL for SpCellGrp");
580    }
581 }
582
583 /******************************************************************
584  *
585  * @brief Fills Physical Cell Group Info
586  *
587  * @details
588  *
589  *    Function : fillPhyCellGrpInfo
590  *
591  *    Functionality: Fills Physical Cell Group Info
592  *
593  *
594  *****************************************************************/
595 void fillPhyCellGrpInfo(PhyCellGrpCfg *cellGrp)
596 {
597    if(cellGrp)
598    {
599       cellGrp->pdschHarqAckCodebook = PDSCH_HARQ_ACK_CODEBOOK_DYNAMIC;
600       cellGrp->pNrFr1 = P_NR_FR1;
601    }
602    else
603    {
604       DU_LOG("\nDUAPP: Memory is NULL for Physical Cell Group");
605    }
606 }
607
608 /******************************************************************
609  *
610  * @brief Fills Mac Cell Group Info
611  *
612  * @details
613  *
614  *    Function : fillMacCellGrpInfo
615  *
616  *    Functionality: Fills Mac Cell Group Info
617  *
618  *
619  *****************************************************************/
620 void fillMacCellGrpInfo(MacCellGrpCfg *cellGrp)
621 {
622    uint8_t idx;
623
624    if(cellGrp)
625    {
626       /* Filling Scheduling Request Config */
627       cellGrp->schReqCfg.addModListCount = 1;
628       if(cellGrp->schReqCfg.addModListCount <= MAX_NUM_SR_CFG_PER_CELL_GRP)
629       {
630          for(idx = 0; idx < cellGrp->schReqCfg.addModListCount; idx++)
631          {
632             cellGrp->schReqCfg.addModList[idx].schedReqId    = SCH_REQ_ID;
633             cellGrp->schReqCfg.addModList[idx].srProhibitTmr = SR_PROHIBIT_MS_32;
634             cellGrp->schReqCfg.addModList[idx].srTransMax    = SR_TRANS_MAX_N_16;
635          }
636       }
637       cellGrp->schReqCfg.relListCount = 0;
638
639       /* Filling Tag config */
640       cellGrp->tagCfg.addModListCount = 1;
641       if(cellGrp->tagCfg.addModListCount <= MAC_NUM_TAGS)
642       {
643          for(idx = 0; idx < cellGrp->tagCfg.addModListCount; idx++)
644          {
645             cellGrp->tagCfg.addModList[idx].tagId = TAG_ID;
646             cellGrp->tagCfg.addModList[idx].timeAlignTimer = TIME_ALIGNMENT_TIMER_INFINITY;
647          }
648       }
649       cellGrp->tagCfg.relListCount = 0;
650
651       /* Filling BSR config */
652       cellGrp->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR;
653       cellGrp->bsrTmrCfg.retxTimer = RETX_BSR_TMR;
654       cellGrp->bsrTmrCfg.srDelayTimer = SR_DELAY_TMR;
655
656       /* Filling PHR config */
657       cellGrp->phrCfgSetupPres = true;
658       cellGrp->phrCfg.periodicTimer = PHR_PERIODIC_TIMER_INFINITY;
659       cellGrp->phrCfg.prohibitTimer = PHR_PROHIBIT_TIMER_SF_0;
660       cellGrp->phrCfg.txPowerFactor = PHR_TX_PWR_FACTOR_CHANGE_INFINITY;
661       cellGrp->phrCfg.multiplePHR   = false;
662       cellGrp->phrCfg.dummy         = false;
663       cellGrp->phrCfg.phrType2OtherCell = false;
664       cellGrp->phrCfg.phrOtherCG = PHR_MODE_OTHER_CG_REAL;  
665
666    }
667    else
668    {
669       DU_LOG("\nDUAPP: Memory is NULL for Master Cell Group");
670    }
671 }
672
673 /******************************************************************
674  *
675  * @brief Fills Logical Channel Config List
676  *
677  * @details
678  *
679  *    Function : fillLcCfgList
680  *
681  *    Functionality: Fills Logical channel Config List
682  *
683  *
684  *****************************************************************/
685 void fillLcCfgList(LcCfg *lcCfgInfo)
686 {
687    if(lcCfgInfo)
688    {
689       lcCfgInfo->lcId = SRB_ID_1;
690       lcCfgInfo->drbQos = NULLP;
691       lcCfgInfo->snssai = NULLP;
692       lcCfgInfo->ulLcCfg = NULLP;
693       lcCfgInfo->dlLcCfg.lcp = LC_PRIORITY_1;
694
695 #if 0
696       /* TODO: To be filled on receving UE CONTEXT SETUP from CU */
697       /* Filling Qos characteristics */
698       lcCfgInfo->drbQos.fiveQiType = QoS_Characteristics_PR_non_Dynamic_5QI;
699       lcCfgInfo->drbQos.u.nonDyn5Qi.fiveQi = 0;
700       lcCfgInfo->drbQos.u.nonDyn5Qi.priorLevel = 0;
701       lcCfgInfo->drbQos.u.nonDyn5Qi.avgWindow = 0;
702       lcCfgInfo->drbQos.u.nonDyn5Qi.maxDataBurstVol = 0;
703
704       /* Filling NgRAN */
705       lcCfgInfo->drbQos.ngRanRetPri.priorityLevel = PriorityLevel_highest;
706       lcCfgInfo->drbQos.ngRanRetPri.preEmptionCap = \
707                                                     Pre_emptionCapability_may_trigger_pre_emption;
708       lcCfgInfo->drbQos.ngRanRetPri.preEmptionVul = \
709                                                     Pre_emptionVulnerability_not_pre_emptable;
710
711       /* Filling Grb Qos */
712       lcCfgInfo->drbQos.grbQosInfo.maxFlowBitRateDl  = 0;
713       lcCfgInfo->drbQos.grbQosInfo.maxFlowBitRateUl  = 0;
714       lcCfgInfo->drbQos.grbQosInfo.guarFlowBitRateDl = 0;
715       lcCfgInfo->drbQos.grbQosInfo.guarFlowBitRateUl = 0;
716
717       /* Filling S-NSSAI */
718       /* TODO :To be filled when UE Context Setup Request is sent from CU */
719       /* Filling UL Logical Channel Config */
720       lcCfgInfo->ulLcCfg.priority = 0;
721       lcCfgInfo->ulLcCfg.lcGroup  = 0;
722       lcCfgInfo->ulLcCfg.schReqId = 0;
723       lcCfgInfo->ulLcCfg.pbr = 0;
724       lcCfgInfo->ulLcCfg.bsd = 0;
725
726       /* Filling DL Logical Channel Config */
727       lcCfgInfo->dlLcCfg.lcp = 0;
728 #endif
729    }
730    else
731    {
732       DU_LOG("\n Memory is null for LcCfgList");
733    }
734 }
735
736 /******************************************************************
737  *
738  * @brief Fills MacUeCfg structure
739  *
740  * @details
741  *
742  *    Function : fillMacUeCfg
743  *
744  *    Functionality: Fills MacUeCfg
745  *
746  *
747  *****************************************************************/
748 void fillMacUeCfg(uint16_t cellId, uint8_t ueIdx,\
749   uint16_t crnti, MacUeCfg *ueCfg)
750 {
751    uint8_t idx;
752    ueCfg->cellId       = cellId;
753    ueCfg->ueIdx        = ueIdx;
754    ueCfg->crnti        = crnti;
755    /* Filling MacCellGroup Config */ 
756    fillMacCellGrpInfo(&ueCfg->macCellGrpCfg);
757    /* Filling PhyCellGroup Config */ 
758    fillPhyCellGrpInfo(&ueCfg->phyCellGrpCfg);
759    /* Filling SpCellGroup Config */ 
760    fillSpCellGrpInfo(&ueCfg->spCellCfg);
761    /* Filling AMBR for UL and DL */ 
762    ueCfg->maxAggrBitRate = NULLP;
763    /* Filling LC Context */
764    ueCfg->numLcs = SRB_ID_1;
765    if(ueCfg->numLcs < MAX_NUM_LOGICAL_CHANNELS)
766    {
767       for(idx = 0; idx < ueCfg->numLcs; idx++)
768       {   
769          fillLcCfgList(&ueCfg->lcCfgList[idx]);
770       }
771    }
772
773 }
774
775 /******************************************************************
776  *
777  * @brief Fills Rlc AM Information
778  *
779  * @details
780  *
781  *    Function : fillAmInfo
782  *
783  *    Functionality: Fills Rlc AM Information
784  *
785  *
786  *****************************************************************/
787 void fillAmInfo(AmBearerCfg *amCfg)
788 {
789    /* DL AM */
790    amCfg->dlAmCfg.snLenDl     = AM_SIZE_12;
791    amCfg->dlAmCfg.pollRetxTmr = POLL_RETX_TMR_45MS;
792    amCfg->dlAmCfg.pollPdu     = POLL_PDU_TMR_INFINITY;
793    amCfg->dlAmCfg.pollByte    = POLL_BYTES_INFINITY;
794    amCfg->dlAmCfg.maxRetxTh   = RETX_TH_8;   
795  
796    /* UL AM */
797    amCfg->ulAmCfg.snLenUl     = AM_SIZE_12;
798    amCfg->ulAmCfg.reAssemTmr  = RE_ASM_40MS; 
799    amCfg->ulAmCfg.statProhTmr = PROH_35MS;
800
801 }
802
803 /******************************************************************
804  *
805  * @brief Fills RLC UM Bi Directional Information
806  *
807  * @details
808  *
809  *    Function : fillUmBiDirInfo
810  *
811  *    Functionality: Fills RLC UM Bi Directional Information
812  *
813  *
814  *****************************************************************/
815 void fillUmBiDirInfo(UmBiDirBearerCfg *umBiDirCfg)
816 {
817    /* UL UM BI DIR INFO */
818    umBiDirCfg->ulUmCfg.snLenUlUm = UM_SIZE_12;
819    umBiDirCfg->ulUmCfg.reAssemTmr = RE_ASM_40MS;
820
821    /* DL UM BI DIR INFO */
822    umBiDirCfg->dlUmCfg.snLenDlUm  = UM_SIZE_12;
823
824 }
825
826 /******************************************************************
827  *
828  * @brief Fills RLC UM Uni Directional UL Information
829  *
830  * @details
831  *
832  *    Function : fillUmUniDirUlInfo
833  *
834  *    Functionality: Fills RLC UM Uni Directional Info
835  *
836  *
837  *****************************************************************/
838 void fillUmUniDirUlInfo(UmUniDirUlBearerCfg *umUniDirUlCfg)
839 {
840    umUniDirUlCfg->ulUmCfg.snLenUlUm = UM_SIZE_12;
841    umUniDirUlCfg->ulUmCfg.reAssemTmr = RE_ASM_40MS;
842 }
843
844 /******************************************************************
845  *
846  * @brief Fills RLC UM Uni Directional DL Information
847  *
848  * @details
849  *
850  *    Function : fillUmUniDirDlInfo
851  *
852  *    Functionality: Fills RLC UM Uni Directional DL Info
853  *
854  *
855  *****************************************************************/
856 void fillUmUniDirDlInfo(UmUniDirDlBearerCfg *umUniDirDlCfg)
857 {
858    umUniDirDlCfg->dlUmCfg.snLenDlUm  = UM_SIZE_12;
859 }
860
861 /******************************************************************
862  *
863  * @brief Fills RlcBearerCfg structure
864  *
865  * @details
866  *
867  *    Function : fillRlcBearerCfg
868  *
869  *    Functionality: Fills Rlc Bearer Cfg
870  *
871  *
872  *****************************************************************/
873 void fillRlcBearerCfg(uint16_t cellId, uint8_t ueIdx, RlcUeCfg *ueCfg)
874 {
875    uint8_t idx;
876    ueCfg->cellId       = cellId;
877    ueCfg->ueIdx        = ueIdx;
878    ueCfg->numLcs       = SRB_ID_1; 
879
880    for(idx = 0; idx < ueCfg->numLcs; idx++)
881    {
882       ueCfg->rlcBearerCfg[idx].rbId         = RB_ID_SRB;
883       ueCfg->rlcBearerCfg[idx].rbType       = RB_TYPE_SRB;
884       ueCfg->rlcBearerCfg[idx].lcId         = SRB_ID_1;
885       ueCfg->rlcBearerCfg[idx].lcType       = LCH_DCCH;
886       ueCfg->rlcBearerCfg[idx].rlcMode      = RLC_AM;
887       switch(ueCfg->rlcBearerCfg[idx].rlcMode)
888       {
889          case RLC_AM:
890             memset(&ueCfg->rlcBearerCfg[idx].u.amCfg, 0, sizeof(AmBearerCfg));
891             fillAmInfo(&ueCfg->rlcBearerCfg[idx].u.amCfg);
892             break;
893          case RLC_UM_BI_DIRECTIONAL:
894             memset(&ueCfg->rlcBearerCfg[idx].u.umBiDirCfg, 0, sizeof(UmBiDirBearerCfg));
895             fillUmBiDirInfo(&ueCfg->rlcBearerCfg[idx].u.umBiDirCfg);
896             break;
897          case RLC_UM_UNI_DIRECTIONAL_UL:
898             memset(&ueCfg->rlcBearerCfg[idx].u.umUniDirUlCfg, 0, sizeof(UmUniDirUlBearerCfg));
899             fillUmUniDirUlInfo(&ueCfg->rlcBearerCfg[idx].u.umUniDirUlCfg);
900             break;
901          case RLC_UM_UNI_DIRECTIONAL_DL:
902             memset(&ueCfg->rlcBearerCfg[idx].u.umUniDirDlCfg, 0, sizeof(UmUniDirDlBearerCfg));
903             fillUmUniDirDlInfo(&ueCfg->rlcBearerCfg[idx].u.umUniDirDlCfg);
904             break;
905          default :
906             DU_LOG("\nDU_APP: Rlc Mode invalid %d", ueCfg->rlcBearerCfg[idx].rlcMode);
907             break;
908       }
909    }
910 }
911
912 /******************************************************************
913  *
914  * @brief creates UE context
915  *
916  * @details
917  *
918  *    Function : duCreateUeCb
919  *
920  *    Functionality: Creates UE Conetxt
921  *
922  * @params[in] UeCcchCtxt Pointer
923  *             UeIdx Pointer
924  *
925  * @return ROK     - success
926  *         RFAILED - failure
927  * ****************************************************************/
928 uint8_t duCreateUeCb(UeCcchCtxt *ueCcchCtxt, uint32_t gnbCuUeF1apId)
929 {
930    uint8_t cellIdx = 0;
931    uint8_t ret     = ROK;
932    uint8_t ueIdx;
933
934    for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
935    {
936       if(ueCcchCtxt->cellId == duCb.actvCellLst[cellIdx]->cellId)
937       {
938          GET_UE_IDX(ueCcchCtxt->crnti, ueIdx);
939          DU_LOG("\nDU_APP: Filling UeCb for ueIdx [%d]", ueIdx);
940
941          duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbDuUeF1apId = ueCcchCtxt->gnbDuUeF1apId;
942          duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbCuUeF1apId = gnbCuUeF1apId;
943          duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].ueState       = UE_ACTIVE;
944
945          /* Filling Mac Ue Config */ 
946          memset(&duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].macUeCfg, 0, sizeof(MacUeCfg));
947          ret = duBuildAndSendUeCreateReqToMac(ueCcchCtxt->cellId, ueIdx, ueCcchCtxt->crnti,\
948                 &duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].macUeCfg);
949          if(ret)
950             DU_LOG("\nDU_APP: Failed to send UE create request to MAC");
951          
952          /* Filling Rlc Ue Config */
953          memset(&duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].rlcUeCfg, 0, sizeof(RlcUeCfg));
954          ret = duBuildAndSendUeCreateReqToRlc(ueCcchCtxt->cellId, ueIdx, \
955                 &duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].rlcUeCfg);
956          if(ret)
957             DU_LOG("\nDU_APP: Failed to send UE create request to RLC");
958
959          duCb.actvCellLst[cellIdx]->numActvUes++;
960          memset(ueCcchCtxt, 0, sizeof(UeCcchCtxt));
961       }
962    }
963    return ret;
964 }
965
966 /******************************************************************
967  *
968  * @brief Builds and Send UE Create Request to MAC
969  *
970  * @details
971  *
972  *    Function : duBuildAndSendUeCreateReqToMac
973  *
974  *    Functionality: Builds and Send UE Create Request to MAC
975  *
976  * @Params[in]  cellId,
977  *              ueIdx
978  * @return ROK     - success
979  *         RFAILED - failure
980  *
981  * ****************************************************************/
982
983 uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t ueIdx,\
984    uint16_t crnti, MacUeCfg *duMacUeCfg)
985 {
986    uint8_t ret = ROK;
987    MacUeCfg *macUeCfg = NULLP;
988    Pst pst;
989    memset(&pst, 0, sizeof(Pst));
990
991    fillMacUeCfg(cellId, ueIdx, crnti, duMacUeCfg);
992
993    /* Fill Pst */
994    FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_CREATE_REQ);
995
996    /* Copying ueCb to a sharable buffer */
997    DU_ALLOC_SHRABL_BUF(macUeCfg, sizeof(MacUeCfg));
998    if(macUeCfg)
999    {
1000       memset(macUeCfg, 0, sizeof(MacUeCfg));
1001       memcpy(macUeCfg, &duCb.actvCellLst[cellId - 1]->ueCb[ueIdx -1].macUeCfg, sizeof(MacUeCfg));
1002       DU_LOG("\nDU_APP: Sending UE create request to MAC");
1003
1004       /* Processing one Ue at a time to MAC */
1005       ret = (*packMacUeCreateReqOpts[pst.selector])(&pst, macUeCfg);
1006       if(ret)
1007       {
1008          DU_LOG("\nDU_APP : Failure in sending Ue Create Req to MAC");
1009          DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macUeCfg, sizeof(MacUeCfg));
1010          ret = RFAILED;
1011       }
1012    }
1013    else
1014    {
1015       DU_LOG("\n DU_APP: Memory alloc failed at duBuildAndSendUeCreateReqToMac()");
1016       ret = RFAILED;
1017    }
1018    return ret;
1019 }
1020
1021 /*******************************************************************
1022  *
1023  * @brief Handle UE create response from MAC
1024  *
1025  * @details
1026  *
1027  *    Function : DuHandleMacUeCreateRsp
1028  *
1029  *    Functionality: Handle UE create response from MAC
1030  *
1031  * @params[in] Pointer to MacUeCfgRsp and Pst 
1032  * @return ROK     - success
1033  *         RFAILED - failure
1034  *
1035  * ****************************************************************/
1036 uint8_t DuHandleMacUeCreateRsp(Pst *pst, MacUeCfgRsp *cfgRsp)
1037 {
1038    if(cfgRsp->result == MAC_DU_APP_RSP_OK)
1039    {
1040       DU_LOG("\nDU APP : MAC UE Create Response : SUCCESS [UE IDX : %d]", cfgRsp->ueIdx);
1041    }
1042    else
1043    {
1044       DU_LOG("\nDU APP : MAC UE Create Response : FAILURE [UE IDX : %d]", cfgRsp->ueIdx);
1045    }
1046    return ROK;
1047 }
1048
1049 /*******************************************************************
1050  *
1051  * @brief Processes UE create Req to RLC UL
1052  *
1053  * @details
1054  *
1055  *    Function : duBuildAndSendUeCreateReqToRlc
1056  *
1057  *    Functionality: 
1058  *     Processes UE create Req to RLC UL
1059  * 
1060  *  @params[in]  cellId,
1061  *               ueIdx,
1062  *               Pointer to RlcUeCfg
1063  *  @return ROK     - success
1064  *          RFAILED - failure
1065  * 
1066  *****************************************************************/
1067
1068 uint8_t duBuildAndSendUeCreateReqToRlc(uint16_t cellId, uint8_t ueIdx, RlcUeCfg *duRlcUeCfg)
1069 {
1070    uint8_t ret = ROK;
1071    RlcUeCfg *rlcUeCfg = NULLP;
1072    Pst pst;
1073    memset(&pst, 0, sizeof(Pst));
1074   
1075    fillRlcBearerCfg(cellId, ueIdx, duRlcUeCfg);
1076    FILL_PST_DUAPP_TO_RLC(pst, RLC_UL_INST, EVENT_RLC_UL_UE_CREATE_REQ);
1077
1078    /* Copying ueCfg to a sharable buffer */
1079    DU_ALLOC_SHRABL_BUF(rlcUeCfg, sizeof(RlcUeCfg));
1080    if(rlcUeCfg)
1081    {
1082       memset(rlcUeCfg, 0, sizeof(RlcUeCfg));
1083       memcpy(rlcUeCfg, duRlcUeCfg, sizeof(RlcUeCfg));
1084       /* Processing one Ue at a time to RLC */
1085       DU_LOG("\nDU_APP: Sending UE create request to RLC UL");
1086       ret = (*packRlcUlUeCreateReqOpts[pst.selector])(&pst, rlcUeCfg);
1087       if(ret)
1088       {
1089          DU_LOG("\nDU_APP : Failure in sending Ue Create Req to RLC");
1090          DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rlcUeCfg, sizeof(RlcUeCfg));
1091          ret = RFAILED;
1092       }
1093    }
1094    else
1095    {
1096       DU_LOG("\n DU_APP: Memory alloc failed at duBuildAndSendUeCreateReqToRlc()");
1097       ret = RFAILED;
1098    }
1099    return ret;
1100 }
1101
1102
1103
1104 /*******************************************************************
1105  *
1106  * @brief Processes UE create Rsp received from RLC UL
1107  *
1108  * @details
1109  *
1110  *    Function : DuProcRlcUlUeCfgRsp
1111  *
1112  *    Functionality: 
1113  *     Processes UE create Rsp received from RLC UL
1114  * 
1115  *  @params[in]  Post structure
1116  *               Pointer to RlcCfgCfm
1117  *  @return ROK     - success
1118  *          RFAILED - failure
1119  * 
1120  *****************************************************************/
1121
1122 uint8_t DuProcRlcUlUeCreateRsp(Pst *pst, RlcUeCfgRsp *cfgRsp)
1123 {
1124    uint8_t ret = ROK;
1125
1126    if(cfgRsp)
1127    {
1128       if(cfgRsp->result == RLC_DU_APP_RSP_OK)
1129       {
1130          DU_LOG("\nDU_APP: RLC UE Create Response : SUCCESS [UE IDX:%d]", cfgRsp->ueIdx);
1131       }
1132       else
1133       {
1134          DU_LOG("\nDU_APP: RLC UE Create Response : FAILED [UE IDX:%d, REASON :%d]",\
1135             cfgRsp->ueIdx, cfgRsp->reason);
1136          ret = RFAILED;
1137       }
1138       DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCfgRsp));
1139    }
1140    else
1141    {
1142       DU_LOG("\nDU_APP: Received RLC Ue Create Response is NULL");
1143       ret = RFAILED;
1144    }
1145    return ret;
1146 }
1147 /**********************************************************************
1148   End of file
1149  ***********************************************************************/