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 *******************************************************************************/
19 /* header include files (.h) */
20 #include "common_def.h"
21 #include "rgu.h" /* RGU interface includes*/
22 #include "lkw.h" /* LKW defines */
23 #include "ckw.h" /* CKW defines */
24 #include "kwu.h" /* KWU defines */
25 #include "kw_env.h" /* RLC environment options */
26 #include "kw.h" /* RLC defines */
31 /* header/extern include files (.x) */
33 #include "lkw.x" /* LKW */
34 #include "ckw.x" /* CKW */
35 #include "kwu.x" /* KWU */
42 #include "rlc_mac_inf.h"
43 #include "du_app_rlc_inf.h"
44 #include "rlc_utils.h"
45 #include "rlc_upr_inf_api.h"
47 /*******************************************************************
49 * @brief Fills RLC UL UE Cfg Rsp from RlcCRsp
53 * Function : fillRlcUeCfgRsp
56 * Fills RLC UL UE Cfg Rsp from RlcCRsp
58 * @params[in] Pointer to RlcCfgCfm
59 * Pointer to RlcUeCfgRsp
63 *****************************************************************/
65 uint8_t fillRlcUeCfgRsp(RlcUeCfgRsp *rlcCfgRsp, RlcCfgCfmInfo *rlcCRsp)
70 rlcCfgRsp->cellId = rlcCRsp->cellId;
71 rlcCfgRsp->ueIdx = rlcCRsp->ueId;
72 for(idx = 0; idx < rlcCRsp->numEnt; idx++)
74 if(rlcCRsp->entCfgCfm[idx].status.status == CKW_CFG_CFM_OK)
76 rlcCfgRsp->result = RLC_DU_APP_RSP_OK;
77 rlcCfgRsp->reason = rlcCRsp->entCfgCfm[idx].status.reason;
82 rlcCfgRsp->result = RLC_DU_APP_RSP_NOK;
83 rlcCfgRsp->reason = rlcCRsp->entCfgCfm[idx].status.reason;
91 /*******************************************************************
93 * @brief Fills the entity mode and direction compiling to seed code
97 * Function : fillEntModeAndDir
100 * Fills the entity mode and direction compiling to seed code
102 * @params[in] Pointer to entMode
103 * Pointer to direction
106 * ****************************************************************/
108 void fillEntModeAndDir(uint8_t *entMode, uint8_t *direction, RlcMode rlcMode)
113 *entMode = RLC_MODE_AM;
114 *direction = RLC_CFG_DIR_BOTH;
116 case RLC_UM_BI_DIRECTIONAL:
117 *entMode = RLC_MODE_UM;
118 *direction = RLC_CFG_DIR_BOTH;
120 case RLC_UM_UNI_DIRECTIONAL_UL:
121 *entMode = RLC_MODE_UM;
122 *direction = RLC_CFG_DIR_UL;
124 case RLC_UM_UNI_DIRECTIONAL_DL:
125 *entMode = RLC_MODE_UM;
126 *direction = RLC_CFG_DIR_DL;
129 DU_LOG("\nERROR --> RLC: Rlc Mode invalid %d", rlcMode);
134 /*******************************************************************
136 * @brief fills LC Cfgs to be Added in RLC
140 * Function : fillLcCfg
143 * fills LC Cfgs to be Added in RLC
146 * RlcEntCfgInfo pointer
147 * RlcBearerCfg pointer
151 * ****************************************************************/
152 void fillLcCfg(RlcEntCfgInfo *rlcUeCfg, RlcBearerCfg *duRlcUeCfg, uint8_t cfgType)
154 uint8_t lChRbIdx = 0;
156 rlcUeCfg->rbId = duRlcUeCfg->rbId;
157 rlcUeCfg->rbType = duRlcUeCfg->rbType; // SRB or DRB
158 rlcUeCfg->lCh[lChRbIdx].lChId = duRlcUeCfg->lcId;
159 rlcUeCfg->lCh[lChRbIdx].type = duRlcUeCfg->lcType;
160 fillEntModeAndDir(&rlcUeCfg->entMode, &rlcUeCfg->dir, duRlcUeCfg->rlcMode);
161 rlcUeCfg->cfgType = cfgType;
162 switch(rlcUeCfg->entMode)
168 rlcUeCfg->m.amInfo.dl.snLen = duRlcUeCfg->u.amCfg->dlAmCfg.snLenDl;
169 rlcUeCfg->m.amInfo.dl.pollRetxTmr = duRlcUeCfg->u.amCfg->dlAmCfg.pollRetxTmr;
170 rlcUeCfg->m.amInfo.dl.pollPdu = duRlcUeCfg->u.amCfg->dlAmCfg.pollPdu;
171 rlcUeCfg->m.amInfo.dl.pollByte = duRlcUeCfg->u.amCfg->dlAmCfg.pollByte;
172 rlcUeCfg->m.amInfo.dl.maxRetx = duRlcUeCfg->u.amCfg->dlAmCfg.maxRetxTh;
175 lChRbIdx++; //lChRbIdx = 1, indicates UL AM
176 rlcUeCfg->lCh[lChRbIdx].lChId = duRlcUeCfg->lcId;
177 rlcUeCfg->lCh[lChRbIdx].type = duRlcUeCfg->lcType;
178 rlcUeCfg->m.amInfo.ul.snLen = duRlcUeCfg->u.amCfg->ulAmCfg.snLenUl;
179 rlcUeCfg->m.amInfo.ul.staProhTmr = duRlcUeCfg->u.amCfg->ulAmCfg.statProhTmr;
180 rlcUeCfg->m.amInfo.ul.reAsmblTmr = duRlcUeCfg->u.amCfg->ulAmCfg.reAssemTmr * RLC_REASSEMBLY_TMR_BASE;
186 rlcUeCfg->m.umInfo.ul.snLen = duRlcUeCfg->u.umBiDirCfg->ulUmCfg.snLenUlUm;
187 rlcUeCfg->m.umInfo.ul.reAsmblTmr = duRlcUeCfg->u.umBiDirCfg->ulUmCfg.reAssemTmr * RLC_REASSEMBLY_TMR_BASE;
190 rlcUeCfg->m.umInfo.dl.snLen = duRlcUeCfg->u.umBiDirCfg->dlUmCfg.snLenDlUm;
195 }/* End of switch(entMode) */
198 /*******************************************************************
200 * @brief fills LC Cfgs to be Added in RLC
204 * Function : fillRlcCfg
207 * fills LC Cfgs to be Add/Mod/Del in RLC
210 * RlcEntCfgInfo pointer
211 * RlcBearerCfg pointer
214 ******************************************************************/
216 void fillRlcCfg(RlcCfgInfo *rlcUeCfg, RlcUeCfg *ueCfg)
220 rlcUeCfg->ueId = ueCfg->ueIdx;
221 rlcUeCfg->cellId = ueCfg->cellId;
222 rlcUeCfg->numEnt = ueCfg->numLcs;
223 rlcUeCfg->transId = getTransId();
225 for(lcIdx = 0; lcIdx < rlcUeCfg->numEnt; lcIdx++)
227 fillLcCfg(&rlcUeCfg->entCfg[lcIdx], &ueCfg->rlcLcCfg[lcIdx], ueCfg->rlcLcCfg[lcIdx].configType);
231 /*******************************************************************
233 * @brief Handles Ue Create Request from DU APP
237 * Function : RlcProcUeCreateReq
240 * Handles Ue create Request from DU APP
242 * @params[in] Post structure pointer
244 * @return ROK - success
247 * ****************************************************************/
248 uint8_t RlcProcUeCreateReq(Pst *pst, RlcUeCfg *ueCfg)
251 RlcCfgInfo *rlcUeCfg = NULLP;
253 RlcCb *rlcUeCb = NULLP;
254 rlcUeCb = RLC_GET_RLCCB(pst->dstInst);
255 RLC_ALLOC(rlcUeCb, rlcUeCfg, sizeof(RlcCfgInfo));
256 if(rlcUeCfg == NULLP)
258 DU_LOG("\nERROR --> RLC: Failed to allocate memory at RlcProcUeCreateReq()");
263 memset(rlcUeCfg, 0, sizeof(RlcCfgInfo));
264 fillRlcCfg(rlcUeCfg, ueCfg);
265 ret = RlcProcCfgReq(pst, rlcUeCfg);
267 DU_LOG("\nERROR --> RLC: Failed to configure Add/Mod/Del entities at RlcProcUeCreateReq()");
270 RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ueCfg, sizeof(RlcUeCfg));
274 /*******************************************************************
276 * @brief filling the structure of rrc delivery msg info
280 * Function : BuildAndSendRrcDeliveryReportToDu
282 * Functionality: filling the structure of rrc delivery msg info
284 * @return ROK - success
287 * ****************************************************************/
288 uint8_t BuildAndSendRrcDeliveryReportToDu( RlcDlRrcMsgInfo *dlRrcMsgInfo )
291 RrcDeliveryReport *rrcDelivery;
293 DU_LOG("\nINFO --> RLC : Filling RRC Delivery Report");
294 RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_UL, RLC_POOL, rrcDelivery, sizeof(RrcDeliveryReport));
298 rrcDelivery->cellId = dlRrcMsgInfo->cellId;
299 rrcDelivery->ueIdx = dlRrcMsgInfo->ueIdx;
300 rrcDelivery->srbId = dlRrcMsgInfo->lcId ;
301 rrcDelivery->rrcDeliveryStatus.deliveryStatus = PDCP_SN;
302 rrcDelivery->rrcDeliveryStatus.triggeringMessage = PDCP_SN;
304 /* Sending UL RRC Message transfeer to DU APP */
305 memset(&pst, 0, sizeof(Pst));
306 FILL_PST_RLC_TO_DUAPP(pst, RLC_UL_INST, EVENT_RRC_DELIVERY_MSG_TRANS_TO_DU);
307 rlcSendRrcDeliveryReportToDu(&pst, rrcDelivery);
311 DU_LOG("\nERROR --> RLC : Memory allocation failed");
316 /* ****************************************************************
318 * @brief Process the DL RRC Message from DU APP
322 * Function : RlcProcDlRrcMsgTransfer
324 * Functionality: Process the DL RRC Message from DU APP
326 * @params[in] Post structure
327 * DL RRC Message info
328 * @return ROK - success
331 * ****************************************************************/
332 uint8_t RlcProcDlRrcMsgTransfer(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo)
335 RlcDatReqInfo *datReqInfo;
337 RLC_SHRABL_STATIC_BUF_ALLOC(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(RlcDatReqInfo));
340 DU_LOG("\nERROR --> RLC : Memory allocation failed in RlcProcDlRrcMsgTransfer");
341 RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlRrcMsgInfo->rrcMsg, dlRrcMsgInfo->msgLen);
342 RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlRrcMsgInfo, sizeof(RlcDlRrcMsgInfo));
346 datReqInfo->rlcId.rbType = dlRrcMsgInfo->rbType;
347 datReqInfo->rlcId.rbId = dlRrcMsgInfo->rbId;
348 datReqInfo->rlcId.ueId = dlRrcMsgInfo->ueIdx;
349 datReqInfo->rlcId.cellId = dlRrcMsgInfo->cellId;
350 datReqInfo->lcType = dlRrcMsgInfo->lcType;
351 datReqInfo->sduId = ++(rlcCb[pst->dstInst]->dlSduId);
353 /* Copy fixed buffer to message */
354 if(ODU_GET_MSG_BUF(RLC_MEM_REGION_UL, RLC_POOL, &mBuf) != ROK)
356 DU_LOG("\nERROR --> RLC : Memory allocation failed at RlcMacProcUlData");
357 RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(RlcDatReqInfo));
358 RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlRrcMsgInfo->rrcMsg, dlRrcMsgInfo->msgLen);
359 RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlRrcMsgInfo, sizeof(RlcDlRrcMsgInfo));
362 oduCpyFixBufToMsg(dlRrcMsgInfo->rrcMsg, mBuf, dlRrcMsgInfo->msgLen);
364 if(rlcProcDlData(pst, datReqInfo, mBuf) != ROK)
369 /* RRC Delivery report is only send when RRC Delivery status report is true in DL RRC Message */
370 if(dlRrcMsgInfo->deliveryStaRpt)
372 BuildAndSendRrcDeliveryReportToDu(dlRrcMsgInfo);
375 /* Free memory allocated by du app */
376 RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(RlcDatReqInfo));
377 RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlRrcMsgInfo->rrcMsg, dlRrcMsgInfo->msgLen);
378 RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlRrcMsgInfo, sizeof(RlcDlRrcMsgInfo));
382 /*******************************************************************
384 * @brief Process UL data from UE
388 * Function : RlcProcUlData
391 * This function receives the PDU from MAC.
392 * seggregates common and dedicated logical channel
393 * PDU and call respective handler.
396 * @return ROK - success
399 * ****************************************************************/
400 uint8_t RlcProcUlData(Pst *pst, RlcData *ulData)
404 uint8_t lcId; /* Logical Channel */
405 uint8_t numDLch = 0; /* Number of dedicated logical channel */
406 bool dLchPduPres; /* PDU received on dedicated logical channel */
407 RguLchDatInd dLchData[MAX_NUM_LC]; /* PDU info on dedicated logical channel */
408 RguDDatIndInfo *dLchUlDat; /* UL data on dedicated logical channel */
409 RguCDatIndInfo *cLchUlDat; /* UL data on common logical channel */
411 /* Initializing dedicated logical channel Database */
412 DU_LOG("\nDEBUG --> RLC: Received UL Data request from MAC");
413 for(idx = 0; idx < MAX_NUM_LC; idx++)
415 dLchData[idx].lcId = idx;
416 dLchData[idx].pdu.numPdu = 0;
420 /* Seggregate PDUs received on common and dedicated channels
421 * and call common channel's handler */
422 for(idx = 0; idx< ulData->numPdu; idx++)
424 if(ulData->pduInfo[idx].commCh)
426 RLC_SHRABL_STATIC_BUF_ALLOC(RLC_MEM_REGION_UL, RLC_POOL, cLchUlDat, \
427 sizeof(RguCDatIndInfo));
430 DU_LOG("\nERROR --> RLC : Memory allocation failed at RlcProcUlData");
434 memset(cLchUlDat, 0, sizeof(RguCDatIndInfo));
436 cLchUlDat->cellId = ulData->cellId;
437 GET_UE_IDX(ulData->rnti, cLchUlDat->rnti);
438 cLchUlDat->lcId = ulData->pduInfo[idx].lcId;
440 /* Copy fixed buffer to message */
441 if(ODU_GET_MSG_BUF(RLC_MEM_REGION_UL, RLC_POOL, &cLchUlDat->pdu) != ROK)
443 DU_LOG("\nERROR --> RLC : Memory allocation failed at RlcProcUlData");
444 RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_UL, RLC_POOL, cLchUlDat, \
445 sizeof(RguCDatIndInfo));
449 oduCpyFixBufToMsg(ulData->pduInfo[idx].pduBuf, cLchUlDat->pdu, \
450 ulData->pduInfo[idx].pduLen);
452 rlcProcCommLcUlData(pst, 0, cLchUlDat);
458 RLC_SHRABL_STATIC_BUF_ALLOC(RLC_MEM_REGION_UL, RLC_POOL, dLchUlDat, \
459 sizeof(RguDDatIndInfo));
462 DU_LOG("\nERROR --> RLC : Memory allocation failed at RlcMacProcUlData");
469 /* Copy fixed buffer to message */
470 lcId = ulData->pduInfo[idx].lcId;
471 if(ODU_GET_MSG_BUF(RLC_MEM_REGION_UL, RLC_POOL, \
472 &dLchData[lcId].pdu.mBuf[dLchData[lcId].pdu.numPdu]) != ROK)
474 DU_LOG("\nERROR --> RLC : Memory allocation failed at RlcMacProcUlData");
475 for(pduIdx=0; pduIdx < dLchData[lcId].pdu.numPdu; pduIdx++)
477 ODU_PUT_MSG_BUF(dLchData[lcId].pdu.mBuf[dLchData[lcId].pdu.numPdu]);
479 RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_UL, RLC_POOL, dLchUlDat, \
480 sizeof(RguDDatIndInfo));
484 oduCpyFixBufToMsg(ulData->pduInfo[idx].pduBuf, \
485 dLchData[lcId].pdu.mBuf[dLchData[lcId].pdu.numPdu],\
486 ulData->pduInfo[idx].pduLen);
488 dLchData[lcId].pdu.numPdu++;
492 /* If any PDU received on dedicated logical channel, copy into RguDDatIndInfo
493 * and call its handler */
498 dLchUlDat->cellId = ulData->cellId;
499 GET_UE_IDX(ulData->rnti, dLchUlDat->rnti);
501 for(idx = 0; idx < MAX_NUM_LC; idx++)
503 if(dLchData[idx].pdu.numPdu)
505 memcpy(&dLchUlDat->lchData[numDLch], &dLchData[idx], sizeof(RguLchDatInd));
509 dLchUlDat->numLch = numDLch;
510 rlcProcDedLcUlData(pst, 0, dLchUlDat);
514 for(pduIdx = 0; pduIdx < ulData->numPdu; pduIdx++)
516 RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ulData->pduInfo[pduIdx].pduBuf, \
517 ulData->pduInfo[pduIdx].pduLen);
519 RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ulData, sizeof(RlcData));
522 }/* End of RlcProcUlData */
524 /*******************************************************************
526 * @brief Handler for extracting common and dedicated channel
527 * Scheduling result report.
531 * Function : RlcProcSchedResultRpt
534 * Handler for extracting common and dedicated channel
535 * Scheduling result report
538 * @return ROK - success
541 * ****************************************************************/
542 uint8_t RlcProcSchedResultRpt(Pst *pst, RlcSchedResultRpt *schRep)
545 uint8_t idx; /* Iterator */
546 uint8_t nmbDLch = 0; /* Number of dedicated logical channles */
547 RguCStaIndInfo *cLchSchInfo; /* Common logical channel scheduling result */
548 RguDStaIndInfo *dLchSchInfo; /* Dedicated logical channel scheduling result */
550 DU_LOG("\nDEBUG --> RLC : Received scheduling report from MAC");
551 for(idx=0; idx < schRep->numLc; idx++)
553 /* If it is common channel, fill status indication information
554 * and trigger the handler for each common lch separately */
555 if(schRep->lcSch[idx].commCh)
557 RLC_SHRABL_STATIC_BUF_ALLOC(RLC_MEM_REGION_DL, RLC_POOL, cLchSchInfo, \
558 sizeof(RguCStaIndInfo));
561 DU_LOG("\nERROR --> RLC: RlcProcSchedResultRpt: Memory allocation failed for cLchSchInfo");
565 memset(cLchSchInfo, 0, sizeof(RguCStaIndInfo));
567 cLchSchInfo->cellId = schRep->cellId;
568 cLchSchInfo->lcId = schRep->lcSch[idx].lcId;
569 cLchSchInfo->transId = schRep->slotInfo.sfn;
570 cLchSchInfo->transId = (cLchSchInfo->transId << 16) | schRep->slotInfo.slot;
571 cLchSchInfo->rnti = schRep->rnti;
572 rlcProcCommLcSchedRpt(pst, 0, cLchSchInfo);
577 /* Fill status info structure if at least one dedicated channel
578 * scheduling report is received */
581 RLC_SHRABL_STATIC_BUF_ALLOC(RLC_MEM_REGION_DL, RLC_POOL, dLchSchInfo, \
582 sizeof(RguDStaIndInfo));
585 DU_LOG("\nERROR --> RLC: RlcProcSchedResultRpt: Memory allocation failed for dLchSchInfo");
590 dLchSchInfo->cellId = schRep->cellId;
591 dLchSchInfo->nmbOfUeGrantPerTti = 1;
592 /* MAC sends Scheduling report for one UE at a time. Hence filling
593 only the 0th index of staInd */
594 dLchSchInfo->staInd[0].rnti = schRep->rnti;
596 /* Storing sfn/slot into a single 32-bit variable to be used later*/
597 dLchSchInfo->staInd[0].transId = schRep->slotInfo.sfn;
598 dLchSchInfo->staInd[0].transId = \
599 (dLchSchInfo->staInd[0].transId << 16) | schRep->slotInfo.slot;
600 dLchSchInfo->staInd[0].nmbOfTbs = 1;
601 dLchSchInfo->staInd[0].fillCtrlPdu = true;
604 /* Fill logical channel scheduling info */
605 dLchSchInfo->staInd[0].staIndTb[0].lchStaInd[nmbDLch].lcId = \
606 schRep->lcSch[idx].lcId;
607 dLchSchInfo->staInd[0].staIndTb[0].lchStaInd[nmbDLch].totBufSize = \
608 schRep->lcSch[idx].bufSize;
613 /* Calling handler for all dedicated channels scheduling*/
618 dLchSchInfo->staInd[0].staIndTb[0].nmbLch = nmbDLch;
619 rlcProcDedLcSchedRpt(pst, 0, dLchSchInfo);
623 RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, schRep, sizeof(RlcSchedResultRpt));
628 /*******************************************************************
630 * @brief Handles Ue Reconfig Request from DU APP
634 * Function : RlcProcUeReconfigReq
637 * Handles Ue Reconfig Request from DU APP
639 * @params[in] Post structure pointer
641 * @return ROK - success
644 * ****************************************************************/
645 uint8_t RlcProcUeReconfigReq(Pst *pst, RlcUeCfg *ueCfg)
648 RlcCfgInfo *rlcUeCfg = NULLP; //Seed code Rlc cfg struct
649 RlcCb *rlcUeCb = NULLP;
651 DU_LOG("\nDEBUG --> RLC: UE reconfig request received. CellID[%d] UEIDX[%d]",ueCfg->cellId, ueCfg->ueIdx);
653 rlcUeCb = RLC_GET_RLCCB(pst->dstInst);
654 RLC_ALLOC(rlcUeCb, rlcUeCfg, sizeof(RlcCfgInfo));
655 if(rlcUeCfg == NULLP)
657 DU_LOG("\nERROR --> RLC: Failed to allocate memory at RlcProcUeReconfigReq()");
662 memset(rlcUeCfg, 0, sizeof(RlcCfgInfo));
663 fillRlcCfg(rlcUeCfg, ueCfg);
664 ret = RlcProcCfgReq(pst, rlcUeCfg);
666 DU_LOG("\nERROR --> RLC: Failed to configure Add/Mod/Del entities at RlcProcUeReconfigReq()");
669 RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ueCfg, sizeof(RlcUeCfg));
673 /* ****************************************************************
675 * @brief Process the DL Data transfer from DU APP
679 * Function : RlcProcDlUserDataTransfer
681 * Functionality: Process the DL transfer from DU APP
683 * @params[in] Post structure
684 * DL RRC Message info
685 * @return ROK - success
688 * ****************************************************************/
689 uint8_t RlcProcDlUserDataTransfer(Pst *pst, RlcDlUserDataInfo *dlDataMsgInfo)
691 Buffer *mBuf = NULLP;
692 RlcDatReqInfo *datReqInfo = NULLP;
694 if(dlDataMsgInfo->dlMsg == NULLP)
696 DU_LOG("\nERROR --> RLC_DL : Received DL message is NULLP in RlcProcDlUserDataTransfer()");
699 RLC_SHRABL_STATIC_BUF_ALLOC(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(RlcDatReqInfo));
702 DU_LOG("\nERROR --> RLC_DL : Memory allocation failed for DatReq in RlcProcDlUserDataTransfer()");
703 ODU_PUT_MSG_BUF(dlDataMsgInfo->dlMsg);
704 RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlDataMsgInfo, sizeof(RlcDlUserDataInfo));
708 datReqInfo->rlcId.rbType = RB_TYPE_DRB;
709 datReqInfo->rlcId.rbId = dlDataMsgInfo->rbId;
710 datReqInfo->rlcId.ueId = dlDataMsgInfo->ueIdx;
711 datReqInfo->rlcId.cellId = dlDataMsgInfo->cellId;
712 datReqInfo->lcType = LCH_DTCH;
713 datReqInfo->sduId = ++(rlcCb[pst->dstInst]->dlSduId);
714 mBuf = dlDataMsgInfo->dlMsg;
715 if(rlcProcDlData(pst, datReqInfo, mBuf) != ROK)
720 /* Free memory allocated by du app */
721 RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(RlcDatReqInfo));
722 RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlDataMsgInfo, sizeof(RlcDlUserDataInfo));
726 /*******************************************************************
728 * @brief sending UE delete response to DU
732 * Function : sendRlcUeDeleteRspToDu
735 * sending UE delete response to DU
737 * @params[in] uint8_t ueIdx, uint8_t cellId, UeDeleteResult result
739 * @return ROK - success
742 * ****************************************************************/
743 uint8_t sendRlcUeDeleteRspToDu(uint8_t ueIdx, uint16_t cellId, UeDeleteResult result)
746 RlcUeDeleteRsp *ueDeleteRsp = NULLP;
748 FILL_PST_RLC_TO_DUAPP(pst, RLC_UL_INST, EVENT_RLC_UE_DELETE_RSP);
750 RLC_ALLOC_SHRABL_BUF(pst.region, pst.pool, ueDeleteRsp, sizeof(RlcUeDeleteRsp));
753 DU_LOG("\nERROR --> RLC: sendRlcUeDeleteRspToDu(): Memory allocation failed ");
758 ueDeleteRsp->cellId = cellId;
759 ueDeleteRsp->ueIdx = ueIdx;
760 ueDeleteRsp->result = result;
762 if(rlcSendUeDeleteRspToDu(&pst, ueDeleteRsp) == ROK)
764 DU_LOG("\nDEBUG --> RLC: UE Delete response send successfully");
768 DU_LOG("\nERROR --> RLC: SendRlcUeDeleteRspToDu():Failed to send UE Delete response to DU");
769 RLC_FREE_SHRABL_BUF(pst.region, pst.pool, ueDeleteRsp, sizeof(RlcUeDeleteRsp));
776 /* ****************************************************************
778 * @brief filling RLC UE delete configuration
782 * Function : fillRlcCfgInfo
784 * Functionality: filling RLC UE delete configuration
786 * @params[in] RlcUlUeCb *ueCb, RlcCfgInfo *rlcUeCfg
790 * ****************************************************************/
792 void fillRlcUeDelInfo(RlcUlUeCb *ueCb, RlcCfgInfo *rlcUeCfg)
796 rlcUeCfg->ueId = ueCb->ueId;
797 rlcUeCfg->cellId = ueCb->cellId;
798 rlcUeCfg->numEnt = 0;
799 for(lcIdx=0; lcIdx<RLC_MAX_LCH_PER_UE && rlcUeCfg->numEnt < 1; lcIdx++)
801 if(ueCb->lCh[lcIdx].ulRbCb != NULLP)
803 rlcUeCfg->entCfg[rlcUeCfg->numEnt].rbId = 0;
804 rlcUeCfg->entCfg[rlcUeCfg->numEnt].rbType = 0;
805 rlcUeCfg->entCfg[rlcUeCfg->numEnt].cfgType = CKW_CFG_DELETE_UE;
811 /*******************************************************************
813 * @brief Handles Ue delete Request from DU APP
817 * Function : RlcProcUeDeleteReq
820 * Handles Ue delete Request from DU APP
822 * @params[in] Post structure pointer
823 * RlcUeDelete pointer
824 * @return ROK - success
827 * ****************************************************************/
829 uint8_t RlcProcUeDeleteReq(Pst *pst, RlcUeDelete *ueDelete)
832 RlcCb *gRlcCb = NULLP;
833 RlcCfgInfo *rlcUeCfg = NULLP;
834 RlcUlUeCb *ueCb = NULLP;
835 UeDeleteResult result=SUCCESSFUL;
837 DU_LOG("\nDEBUG --> RLC: UE Delete request received. CellID[%d] UEIDX[%d]",ueDelete->cellId, ueDelete->ueIdx);
839 if(ueDelete != NULLP)
841 gRlcCb = RLC_GET_RLCCB(pst->dstInst);
842 rlcDbmFetchUlUeCb(gRlcCb,ueDelete->ueIdx, ueDelete->cellId, &ueCb);
845 if(ueDelete->cellId == ueCb->cellId)
847 RLC_ALLOC(gRlcCb, rlcUeCfg, sizeof(RlcCfgInfo));
848 if(rlcUeCfg == NULLP)
850 DU_LOG("\nERROR --> RLC: deleteRlcUeCb(): Failed to allocate memory");
855 memset(rlcUeCfg, 0, sizeof(RlcCfgInfo));
856 fillRlcUeDelInfo(ueCb, rlcUeCfg);
857 if(RlcProcCfgReq(pst, rlcUeCfg) != ROK)
859 DU_LOG("\nERROR --> RLC: deleteRlcUeCb(): Failed to delete UE information");
860 result = INVALID_UEID;
866 result = INVALID_CELLID;
871 result = INVALID_UEID;
874 if(result != SUCCESSFUL)
876 ret = sendRlcUeDeleteRspToDu(ueDelete->ueIdx, ueDelete->cellId, result);
879 DU_LOG("\nERROR --> RLC: RlcProcUeDeleteReq():Failed to send UE Delete response to DU");
882 RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ueDelete, sizeof(RlcUeDelete));
886 DU_LOG("\nERROR --> RLC: RlcProcUeDeleteReq(): Recieved NULL pointer UE Delete ");
892 /**********************************************************************
894 **********************************************************************/