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 "rlc_env.h" /* RLC environment options */
29 /* header/extern include files (.x) */
31 #include "lkw.x" /* LKW */
32 #include "ckw.x" /* CKW */
33 #include "kwu.x" /* KWU */
35 #include "rlc_utils.h" /* RLC defines */
36 #include "rlc_dl_ul_inf.h"
39 #include "rlc_mac_inf.h"
40 #include "du_app_rlc_inf.h"
41 #include "rlc_upr_inf_api.h"
43 /*******************************************************************
45 * @brief Fills RLC UL UE Cfg Rsp from RlcCRsp
49 * Function : fillRlcUeCfgRsp
52 * Fills RLC UL UE Cfg Rsp from RlcCRsp
54 * @params[in] Pointer to RlcCfgCfm
55 * Pointer to RlcUeCfgRsp
59 *****************************************************************/
61 uint8_t fillRlcUeCfgRsp(RlcUeCfgRsp *rlcCfgRsp, RlcCfgCfmInfo *rlcCRsp)
66 rlcCfgRsp->cellId = rlcCRsp->cellId;
67 rlcCfgRsp->ueIdx = rlcCRsp->ueId;
68 for(idx = 0; idx < rlcCRsp->numEnt; idx++)
70 if(rlcCRsp->entCfgCfm[idx].status.status == CKW_CFG_CFM_OK)
72 rlcCfgRsp->result = RLC_DU_APP_RSP_OK;
73 rlcCfgRsp->reason = rlcCRsp->entCfgCfm[idx].status.reason;
78 rlcCfgRsp->result = RLC_DU_APP_RSP_NOK;
79 rlcCfgRsp->reason = rlcCRsp->entCfgCfm[idx].status.reason;
87 /*******************************************************************
89 * @brief Fills the entity mode and direction compiling to seed code
93 * Function : fillEntModeAndDir
96 * Fills the entity mode and direction compiling to seed code
98 * @params[in] Pointer to entMode
99 * Pointer to direction
102 * ****************************************************************/
104 void fillEntModeAndDir(uint8_t *entMode, uint8_t *direction, RlcMode rlcMode)
109 *entMode = RLC_MODE_AM;
110 *direction = RLC_CFG_DIR_BOTH;
112 case RLC_UM_BI_DIRECTIONAL:
113 *entMode = RLC_MODE_UM;
114 *direction = RLC_CFG_DIR_BOTH;
116 case RLC_UM_UNI_DIRECTIONAL_UL:
117 *entMode = RLC_MODE_UM;
118 *direction = RLC_CFG_DIR_UL;
120 case RLC_UM_UNI_DIRECTIONAL_DL:
121 *entMode = RLC_MODE_UM;
122 *direction = RLC_CFG_DIR_DL;
125 DU_LOG("\nERROR --> RLC: Rlc Mode invalid %d", rlcMode);
130 /*******************************************************************
132 * @brief fills LC Cfgs to be Added in RLC
136 * Function : fillLcCfg
139 * fills LC Cfgs to be Added in RLC
142 * RlcEntCfgInfo pointer
143 * RlcBearerCfg pointer
145 * @return ROK - SUCCESS
148 * ****************************************************************/
149 uint8_t fillLcCfg(RlcCb *gCb, RlcEntCfgInfo *rlcUeCfg, RlcBearerCfg *duRlcUeCfg)
151 uint8_t lChRbIdx = 0;
153 rlcUeCfg->rbId = duRlcUeCfg->rbId;
154 rlcUeCfg->rbType = duRlcUeCfg->rbType; // SRB or DRB
155 rlcUeCfg->lCh[lChRbIdx].lChId = duRlcUeCfg->lcId;
156 rlcUeCfg->lCh[lChRbIdx].type = duRlcUeCfg->lcType;
157 if(duRlcUeCfg->snssai)
159 RLC_ALLOC(gCb, rlcUeCfg->snssai, sizeof(Snssai));
160 if(rlcUeCfg->snssai == NULLP)
162 DU_LOG("\nERROR --> RLC : fillLcCfg(): Failed to allocate memory for snssai");
165 memcpy(rlcUeCfg->snssai, duRlcUeCfg->snssai, sizeof(Snssai));
167 fillEntModeAndDir(&rlcUeCfg->entMode, &rlcUeCfg->dir, duRlcUeCfg->rlcMode);
168 rlcUeCfg->cfgType = duRlcUeCfg->configType;
169 switch(rlcUeCfg->entMode)
175 rlcUeCfg->m.amInfo.dl.snLen = duRlcUeCfg->u.amCfg->dlAmCfg.snLenDl;
176 rlcUeCfg->m.amInfo.dl.pollRetxTmr = duRlcUeCfg->u.amCfg->dlAmCfg.pollRetxTmr;
177 rlcUeCfg->m.amInfo.dl.pollPdu = duRlcUeCfg->u.amCfg->dlAmCfg.pollPdu;
178 rlcUeCfg->m.amInfo.dl.pollByte = duRlcUeCfg->u.amCfg->dlAmCfg.pollByte;
179 rlcUeCfg->m.amInfo.dl.maxRetx = duRlcUeCfg->u.amCfg->dlAmCfg.maxRetxTh;
182 lChRbIdx++; //lChRbIdx = 1, indicates UL AM
183 rlcUeCfg->lCh[lChRbIdx].lChId = duRlcUeCfg->lcId;
184 rlcUeCfg->lCh[lChRbIdx].type = duRlcUeCfg->lcType;
185 rlcUeCfg->m.amInfo.ul.snLen = duRlcUeCfg->u.amCfg->ulAmCfg.snLenUl;
186 rlcUeCfg->m.amInfo.ul.staProhTmr = duRlcUeCfg->u.amCfg->ulAmCfg.statProhTmr;
187 rlcUeCfg->m.amInfo.ul.reAsmblTmr = duRlcUeCfg->u.amCfg->ulAmCfg.reAssemTmr * RLC_REASSEMBLY_TMR_BASE;
193 rlcUeCfg->m.umInfo.ul.snLen = duRlcUeCfg->u.umBiDirCfg->ulUmCfg.snLenUlUm;
194 rlcUeCfg->m.umInfo.ul.reAsmblTmr = duRlcUeCfg->u.umBiDirCfg->ulUmCfg.reAssemTmr * RLC_REASSEMBLY_TMR_BASE;
197 rlcUeCfg->m.umInfo.dl.snLen = duRlcUeCfg->u.umBiDirCfg->dlUmCfg.snLenDlUm;
202 }/* End of switch(entMode) */
206 /*******************************************************************
208 * @brief fills LC Cfgs to be Added in RLC
212 * Function : fillRlcCfg
215 * fills LC Cfgs to be Add/Mod/Del in RLC
218 * RlcEntCfgInfo pointer
219 * RlcBearerCfg pointer
220 * @return ROK - Success
223 ******************************************************************/
225 uint8_t fillRlcCfg(RlcCb *gCb, RlcCfgInfo *rlcUeCfg, RlcUeCfg *ueCfg)
229 rlcUeCfg->ueId = ueCfg->ueIdx;
230 rlcUeCfg->cellId = ueCfg->cellId;
231 rlcUeCfg->numEnt = ueCfg->numLcs;
232 rlcUeCfg->transId = getTransId();
234 for(lcIdx = 0; lcIdx < rlcUeCfg->numEnt; lcIdx++)
236 if(fillLcCfg(gCb, &rlcUeCfg->entCfg[lcIdx], &ueCfg->rlcLcCfg[lcIdx]) != ROK)
238 DU_LOG("\nERROR --> RLC : fillRlcCfg(): Failed to fill LC configuration");
245 /*******************************************************************
247 * @brief Fill RlcCfgCfmInfo structure for sending failure response to DU
251 * Function : fillRlcCfgFailureRsp
254 * Fill RlcCfgCfmInfo structure for sending failure response to DU
256 * @params[in] RlcCfgCfmInfo *cfgRsp, RlcUeCfg *ueCfg
260 * ****************************************************************/
261 void fillRlcCfgFailureRsp(RlcCfgCfmInfo *cfgRsp, RlcUeCfg *ueCfg)
265 cfgRsp->ueId = ueCfg->ueIdx;
266 cfgRsp->cellId = ueCfg->cellId;
267 cfgRsp->numEnt = ueCfg->numLcs;
268 for(cfgIdx =0; cfgIdx<ueCfg->numLcs; cfgIdx++)
270 cfgRsp->entCfgCfm[cfgIdx].rbId = ueCfg->rlcLcCfg[cfgIdx].rbId;
271 cfgRsp->entCfgCfm[cfgIdx].rbType = ueCfg->rlcLcCfg[cfgIdx].rbType;
272 cfgRsp->entCfgCfm[cfgIdx].status.status = RLC_DU_APP_RSP_NOK;
273 cfgRsp->entCfgCfm[cfgIdx].status.reason = CKW_CFG_REAS_NONE;
276 /*******************************************************************
278 * @brief Handles Ue Create Request from DU APP
282 * Function : RlcProcUeCreateReq
285 * Handles Ue create Request from DU APP
287 * @params[in] Post structure pointer
289 * @return ROK - success
292 * ****************************************************************/
293 uint8_t RlcProcUeCreateReq(Pst *pst, RlcUeCfg *ueCfg)
297 RlcCfgInfo *rlcUeCfg = NULLP;
298 RlcCfgCfmInfo cfgRsp;
301 gCb = RLC_GET_RLCCB(pst->dstInst);
302 RLC_ALLOC(gCb, rlcUeCfg, sizeof(RlcCfgInfo));
303 if(rlcUeCfg == NULLP)
305 DU_LOG("\nERROR --> RLC: Failed to allocate memory at RlcProcUeCreateReq()");
310 memset(rlcUeCfg, 0, sizeof(RlcCfgInfo));
311 ret = fillRlcCfg(gCb, rlcUeCfg, ueCfg);
314 DU_LOG("\nERROR --> RLC: Failed to fill configuration at RlcProcUeCreateReq()");
315 FILL_PST_RLC_TO_DUAPP(rspPst, RLC_UL_INST, EVENT_RLC_UE_CREATE_RSP);
316 fillRlcCfgFailureRsp(&cfgRsp, ueCfg);
317 SendRlcUeCfgRspToDu(&rspPst, &cfgRsp);
322 ret = RlcProcCfgReq(pst, rlcUeCfg);
324 DU_LOG("\nERROR --> RLC: Failed to configure Add/Mod/Del entities at RlcProcUeCreateReq()");
327 RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ueCfg, sizeof(RlcUeCfg));
331 /*******************************************************************
333 * @brief filling the structure of rrc delivery msg info
337 * Function : BuildAndSendRrcDeliveryReportToDu
339 * Functionality: filling the structure of rrc delivery msg info
341 * @return ROK - success
344 * ****************************************************************/
345 uint8_t BuildAndSendRrcDeliveryReportToDu( RlcDlRrcMsgInfo *dlRrcMsgInfo )
348 RrcDeliveryReport *rrcDelivery;
350 DU_LOG("\nINFO --> RLC : Filling RRC Delivery Report");
351 RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_UL, RLC_POOL, rrcDelivery, sizeof(RrcDeliveryReport));
355 rrcDelivery->cellId = dlRrcMsgInfo->cellId;
356 rrcDelivery->ueIdx = dlRrcMsgInfo->ueIdx;
357 rrcDelivery->srbId = dlRrcMsgInfo->lcId ;
358 rrcDelivery->rrcDeliveryStatus.deliveryStatus = PDCP_SN;
359 rrcDelivery->rrcDeliveryStatus.triggeringMessage = PDCP_SN;
361 /* Sending UL RRC Message transfeer to DU APP */
362 memset(&pst, 0, sizeof(Pst));
363 FILL_PST_RLC_TO_DUAPP(pst, RLC_UL_INST, EVENT_RRC_DELIVERY_MSG_TRANS_TO_DU);
364 rlcSendRrcDeliveryReportToDu(&pst, rrcDelivery);
368 DU_LOG("\nERROR --> RLC : Memory allocation failed");
373 /* ****************************************************************
375 * @brief Process the DL RRC Message from DU APP
379 * Function : RlcProcDlRrcMsgTransfer
381 * Functionality: Process the DL RRC Message from DU APP
383 * @params[in] Post structure
384 * DL RRC Message info
385 * @return ROK - success
388 * ****************************************************************/
389 uint8_t RlcProcDlRrcMsgTransfer(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo)
392 RlcDatReqInfo *datReqInfo;
394 RLC_SHRABL_STATIC_BUF_ALLOC(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(RlcDatReqInfo));
397 DU_LOG("\nERROR --> RLC : Memory allocation failed in RlcProcDlRrcMsgTransfer");
398 RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlRrcMsgInfo->rrcMsg, dlRrcMsgInfo->msgLen);
399 RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlRrcMsgInfo, sizeof(RlcDlRrcMsgInfo));
403 datReqInfo->rlcId.rbType = dlRrcMsgInfo->rbType;
404 datReqInfo->rlcId.rbId = dlRrcMsgInfo->rbId;
405 datReqInfo->rlcId.ueId = dlRrcMsgInfo->ueIdx;
406 datReqInfo->rlcId.cellId = dlRrcMsgInfo->cellId;
407 datReqInfo->lcType = dlRrcMsgInfo->lcType;
408 datReqInfo->sduId = ++(rlcCb[pst->dstInst]->dlSduId);
410 /* Copy fixed buffer to message */
411 if(ODU_GET_MSG_BUF(RLC_MEM_REGION_UL, RLC_POOL, &mBuf) != ROK)
413 DU_LOG("\nERROR --> RLC : Memory allocation failed at RlcMacProcUlData");
414 RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(RlcDatReqInfo));
415 RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlRrcMsgInfo->rrcMsg, dlRrcMsgInfo->msgLen);
416 RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlRrcMsgInfo, sizeof(RlcDlRrcMsgInfo));
419 oduCpyFixBufToMsg(dlRrcMsgInfo->rrcMsg, mBuf, dlRrcMsgInfo->msgLen);
421 if(rlcProcDlData(pst, datReqInfo, mBuf) != ROK)
426 /* RRC Delivery report is only send when RRC Delivery status report is true in DL RRC Message */
427 if(dlRrcMsgInfo->deliveryStaRpt)
429 BuildAndSendRrcDeliveryReportToDu(dlRrcMsgInfo);
432 /* Free memory allocated by du app */
433 RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(RlcDatReqInfo));
434 RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlRrcMsgInfo->rrcMsg, dlRrcMsgInfo->msgLen);
435 RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlRrcMsgInfo, sizeof(RlcDlRrcMsgInfo));
439 /*******************************************************************
441 * @brief Process UL data from UE
445 * Function : RlcProcUlData
448 * This function receives the PDU from MAC.
449 * seggregates common and dedicated logical channel
450 * PDU and call respective handler.
453 * @return ROK - success
456 * ****************************************************************/
457 uint8_t RlcProcUlData(Pst *pst, RlcData *ulData)
461 uint8_t lcId; /* Logical Channel */
462 uint8_t numDLch = 0; /* Number of dedicated logical channel */
463 bool dLchPduPres; /* PDU received on dedicated logical channel */
464 RguLchDatInd dLchData[MAX_NUM_LC]; /* PDU info on dedicated logical channel */
465 RguDDatIndInfo *dLchUlDat; /* UL data on dedicated logical channel */
466 RguCDatIndInfo *cLchUlDat; /* UL data on common logical channel */
468 /* Initializing dedicated logical channel Database */
469 DU_LOG("\nDEBUG --> RLC: Received UL Data request from MAC");
470 for(idx = 0; idx < MAX_NUM_LC; idx++)
472 dLchData[idx].lcId = idx;
473 dLchData[idx].pdu.numPdu = 0;
477 /* Seggregate PDUs received on common and dedicated channels
478 * and call common channel's handler */
479 for(idx = 0; idx< ulData->numPdu; idx++)
481 if(ulData->pduInfo[idx].commCh)
483 RLC_SHRABL_STATIC_BUF_ALLOC(RLC_MEM_REGION_UL, RLC_POOL, cLchUlDat, \
484 sizeof(RguCDatIndInfo));
487 DU_LOG("\nERROR --> RLC : Memory allocation failed at RlcProcUlData");
491 memset(cLchUlDat, 0, sizeof(RguCDatIndInfo));
493 cLchUlDat->cellId = ulData->cellId;
494 GET_UE_IDX(ulData->rnti, cLchUlDat->rnti);
495 cLchUlDat->lcId = ulData->pduInfo[idx].lcId;
497 /* Copy fixed buffer to message */
498 if(ODU_GET_MSG_BUF(RLC_MEM_REGION_UL, RLC_POOL, &cLchUlDat->pdu) != ROK)
500 DU_LOG("\nERROR --> RLC : Memory allocation failed at RlcProcUlData");
501 RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_UL, RLC_POOL, cLchUlDat, \
502 sizeof(RguCDatIndInfo));
506 oduCpyFixBufToMsg(ulData->pduInfo[idx].pduBuf, cLchUlDat->pdu, \
507 ulData->pduInfo[idx].pduLen);
509 rlcProcCommLcUlData(pst, 0, cLchUlDat);
515 RLC_SHRABL_STATIC_BUF_ALLOC(RLC_MEM_REGION_UL, RLC_POOL, dLchUlDat, \
516 sizeof(RguDDatIndInfo));
519 DU_LOG("\nERROR --> RLC : Memory allocation failed at RlcMacProcUlData");
526 /* Copy fixed buffer to message */
527 lcId = ulData->pduInfo[idx].lcId;
528 if(ODU_GET_MSG_BUF(RLC_MEM_REGION_UL, RLC_POOL, \
529 &dLchData[lcId].pdu.mBuf[dLchData[lcId].pdu.numPdu]) != ROK)
531 DU_LOG("\nERROR --> RLC : Memory allocation failed at RlcMacProcUlData");
532 for(pduIdx=0; pduIdx < dLchData[lcId].pdu.numPdu; pduIdx++)
534 ODU_PUT_MSG_BUF(dLchData[lcId].pdu.mBuf[dLchData[lcId].pdu.numPdu]);
536 RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_UL, RLC_POOL, dLchUlDat, \
537 sizeof(RguDDatIndInfo));
541 oduCpyFixBufToMsg(ulData->pduInfo[idx].pduBuf, \
542 dLchData[lcId].pdu.mBuf[dLchData[lcId].pdu.numPdu],\
543 ulData->pduInfo[idx].pduLen);
545 dLchData[lcId].pdu.numPdu++;
549 /* If any PDU received on dedicated logical channel, copy into RguDDatIndInfo
550 * and call its handler */
555 dLchUlDat->cellId = ulData->cellId;
556 GET_UE_IDX(ulData->rnti, dLchUlDat->rnti);
558 for(idx = 0; idx < MAX_NUM_LC; idx++)
560 if(dLchData[idx].pdu.numPdu)
562 memcpy(&dLchUlDat->lchData[numDLch], &dLchData[idx], sizeof(RguLchDatInd));
566 dLchUlDat->numLch = numDLch;
567 rlcProcDedLcUlData(pst, 0, dLchUlDat);
571 for(pduIdx = 0; pduIdx < ulData->numPdu; pduIdx++)
573 RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ulData->pduInfo[pduIdx].pduBuf, \
574 ulData->pduInfo[pduIdx].pduLen);
576 RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ulData, sizeof(RlcData));
579 }/* End of RlcProcUlData */
581 /*******************************************************************
583 * @brief Handler for extracting common and dedicated channel
584 * Scheduling result report.
588 * Function : RlcProcSchedResultRpt
591 * Handler for extracting common and dedicated channel
592 * Scheduling result report
595 * @return ROK - success
598 * ****************************************************************/
599 uint8_t RlcProcSchedResultRpt(Pst *pst, RlcSchedResultRpt *schRep)
602 uint8_t idx; /* Iterator */
603 uint8_t nmbDLch = 0; /* Number of dedicated logical channles */
604 RguCStaIndInfo *cLchSchInfo; /* Common logical channel scheduling result */
605 RguDStaIndInfo *dLchSchInfo; /* Dedicated logical channel scheduling result */
607 DU_LOG("\nDEBUG --> RLC : Received scheduling report from MAC");
608 for(idx=0; idx < schRep->numLc; idx++)
610 /* If it is common channel, fill status indication information
611 * and trigger the handler for each common lch separately */
612 if(schRep->lcSch[idx].commCh)
614 RLC_SHRABL_STATIC_BUF_ALLOC(RLC_MEM_REGION_DL, RLC_POOL, cLchSchInfo, \
615 sizeof(RguCStaIndInfo));
618 DU_LOG("\nERROR --> RLC: RlcProcSchedResultRpt: Memory allocation failed for cLchSchInfo");
622 memset(cLchSchInfo, 0, sizeof(RguCStaIndInfo));
624 cLchSchInfo->cellId = schRep->cellId;
625 cLchSchInfo->lcId = schRep->lcSch[idx].lcId;
626 cLchSchInfo->transId = schRep->slotInfo.sfn;
627 cLchSchInfo->transId = (cLchSchInfo->transId << 16) | schRep->slotInfo.slot;
628 cLchSchInfo->rnti = schRep->rnti;
629 rlcProcCommLcSchedRpt(pst, 0, cLchSchInfo);
634 /* Fill status info structure if at least one dedicated channel
635 * scheduling report is received */
638 RLC_SHRABL_STATIC_BUF_ALLOC(RLC_MEM_REGION_DL, RLC_POOL, dLchSchInfo, \
639 sizeof(RguDStaIndInfo));
642 DU_LOG("\nERROR --> RLC: RlcProcSchedResultRpt: Memory allocation failed for dLchSchInfo");
647 dLchSchInfo->cellId = schRep->cellId;
648 dLchSchInfo->nmbOfUeGrantPerTti = 1;
649 /* MAC sends Scheduling report for one UE at a time. Hence filling
650 only the 0th index of staInd */
651 dLchSchInfo->staInd[0].rnti = schRep->rnti;
653 /* Storing sfn/slot into a single 32-bit variable to be used later*/
654 dLchSchInfo->staInd[0].transId = schRep->slotInfo.sfn;
655 dLchSchInfo->staInd[0].transId = \
656 (dLchSchInfo->staInd[0].transId << 16) | schRep->slotInfo.slot;
657 dLchSchInfo->staInd[0].nmbOfTbs = 1;
658 dLchSchInfo->staInd[0].fillCtrlPdu = true;
661 /* Fill logical channel scheduling info */
662 dLchSchInfo->staInd[0].staIndTb[0].lchStaInd[nmbDLch].lcId = \
663 schRep->lcSch[idx].lcId;
664 dLchSchInfo->staInd[0].staIndTb[0].lchStaInd[nmbDLch].totBufSize = \
665 schRep->lcSch[idx].bufSize;
670 /* Calling handler for all dedicated channels scheduling*/
675 dLchSchInfo->staInd[0].staIndTb[0].nmbLch = nmbDLch;
676 rlcProcDedLcSchedRpt(pst, 0, dLchSchInfo);
680 RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, schRep, sizeof(RlcSchedResultRpt));
685 /*******************************************************************
687 * @brief Handles Ue Reconfig Request from DU APP
691 * Function : RlcProcUeReconfigReq
694 * Handles Ue Reconfig Request from DU APP
696 * @params[in] Post structure pointer
698 * @return ROK - success
701 * ****************************************************************/
702 uint8_t RlcProcUeReconfigReq(Pst *pst, RlcUeCfg *ueCfg)
705 RlcCfgInfo *rlcUeCfg = NULLP; //Seed code Rlc cfg struct
706 RlcCb *rlcUeCb = NULLP;
707 RlcCfgCfmInfo *cfgRsp;
710 DU_LOG("\nDEBUG --> RLC: UE reconfig request received. CellID[%d] UEIDX[%d]",ueCfg->cellId, ueCfg->ueIdx);
712 rlcUeCb = RLC_GET_RLCCB(pst->dstInst);
713 RLC_ALLOC(rlcUeCb, rlcUeCfg, sizeof(RlcCfgInfo));
714 if(rlcUeCfg == NULLP)
716 DU_LOG("\nERROR --> RLC: Failed to allocate memory at RlcProcUeReconfigReq()");
721 memset(rlcUeCfg, 0, sizeof(RlcCfgInfo));
722 ret = fillRlcCfg(rlcUeCb, rlcUeCfg, ueCfg);
725 DU_LOG("\nERROR --> RLC: Failed to fill configuration at RlcProcUeReconfigReq()");
726 FILL_PST_RLC_TO_DUAPP(rspPst, RLC_UL_INST, EVENT_RLC_UE_RECONFIG_RSP);
727 memset(cfgRsp, 0, sizeof(RlcCfgCfmInfo));
728 fillRlcCfgFailureRsp(cfgRsp, ueCfg);
729 SendRlcUeCfgRspToDu(&rspPst, cfgRsp);
733 ret = RlcProcCfgReq(pst, rlcUeCfg);
735 DU_LOG("\nERROR --> RLC: Failed to configure Add/Mod/Del entities at RlcProcUeReconfigReq()");
739 RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ueCfg, sizeof(RlcUeCfg));
743 /* ****************************************************************
745 * @brief Process the DL Data transfer from DU APP
749 * Function : RlcProcDlUserDataTransfer
751 * Functionality: Process the DL transfer from DU APP
753 * @params[in] Post structure
754 * DL RRC Message info
755 * @return ROK - success
758 * ****************************************************************/
759 uint8_t RlcProcDlUserDataTransfer(Pst *pst, RlcDlUserDataInfo *dlDataMsgInfo)
761 Buffer *mBuf = NULLP;
762 RlcDatReqInfo *datReqInfo = NULLP;
764 if(dlDataMsgInfo->dlMsg == NULLP)
766 DU_LOG("\nERROR --> RLC_DL : Received DL message is NULLP in RlcProcDlUserDataTransfer()");
769 RLC_SHRABL_STATIC_BUF_ALLOC(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(RlcDatReqInfo));
772 DU_LOG("\nERROR --> RLC_DL : Memory allocation failed for DatReq in RlcProcDlUserDataTransfer()");
773 ODU_PUT_MSG_BUF(dlDataMsgInfo->dlMsg);
774 RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlDataMsgInfo, sizeof(RlcDlUserDataInfo));
778 datReqInfo->rlcId.rbType = RB_TYPE_DRB;
779 datReqInfo->rlcId.rbId = dlDataMsgInfo->rbId;
780 datReqInfo->rlcId.ueId = dlDataMsgInfo->ueIdx;
781 datReqInfo->rlcId.cellId = dlDataMsgInfo->cellId;
782 datReqInfo->lcType = LCH_DTCH;
783 datReqInfo->sduId = ++(rlcCb[pst->dstInst]->dlSduId);
784 mBuf = dlDataMsgInfo->dlMsg;
785 if(rlcProcDlData(pst, datReqInfo, mBuf) != ROK)
790 /* Free memory allocated by du app */
791 RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(RlcDatReqInfo));
792 RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlDataMsgInfo, sizeof(RlcDlUserDataInfo));
796 /*******************************************************************
798 * @brief sending UE delete response to DU
802 * Function : sendRlcUeDeleteRspToDu
805 * sending UE delete response to DU
807 * @params[in] uint8_t cellId, uint8_t ueIdx, UeDeleteResult result
809 * @return ROK - success
812 * ****************************************************************/
813 uint8_t sendRlcUeDeleteRspToDu(uint16_t cellId,uint8_t ueId, UeDeleteResult result)
816 RlcUeDeleteRsp *ueDeleteRsp = NULLP;
818 FILL_PST_RLC_TO_DUAPP(pst, RLC_UL_INST, EVENT_RLC_UE_DELETE_RSP);
820 RLC_ALLOC_SHRABL_BUF(pst.region, pst.pool, ueDeleteRsp, sizeof(RlcUeDeleteRsp));
823 DU_LOG("\nERROR --> RLC: sendRlcUeDeleteRspToDu(): Memory allocation failed ");
828 ueDeleteRsp->cellId = cellId;
829 ueDeleteRsp->ueId = ueId;
830 ueDeleteRsp->result = result;
832 if(rlcSendUeDeleteRspToDu(&pst, ueDeleteRsp) == ROK)
834 DU_LOG("\nDEBUG --> RLC: UE Delete response send successfully");
838 DU_LOG("\nERROR --> RLC: SendRlcUeDeleteRspToDu():Failed to send UE Delete response to DU");
839 RLC_FREE_SHRABL_BUF(pst.region, pst.pool, ueDeleteRsp, sizeof(RlcUeDeleteRsp));
846 /*******************************************************************
848 * @brief Handles Ue delete Request from DU APP
852 * Function : RlcProcUeDeleteReq
855 * Handles Ue delete Request from DU APP
857 * @params[in] Post structure pointer
858 * RlcUeDelete pointer
859 * @return ROK - success
862 * ****************************************************************/
864 uint8_t RlcProcUeDeleteReq(Pst *pst, RlcUeDelete *ueDelete)
867 RlcCb *gRlcCb = NULLP;
868 RlcUlUeCb *ueCb = NULLP;
869 UeDeleteResult result=SUCCESSFUL;
871 DU_LOG("\nDEBUG --> RLC: UE Delete request received. CellID[%d] UEID[%d]",ueDelete->cellId, ueDelete->ueId);
873 if(ueDelete != NULLP)
875 gRlcCb = RLC_GET_RLCCB(pst->dstInst);
876 rlcDbmFetchUlUeCb(gRlcCb,ueDelete->ueId, ueDelete->cellId, &ueCb);
879 if(ueDelete->cellId == ueCb->cellId)
881 memcpy(&ueCb->ueDeleteInfo.pst, pst, sizeof(Pst));
882 if((rlcChkTmr(gRlcCb, (PTR)ueCb, EVENT_RLC_UE_DELETE_TMR)) == FALSE)
884 rlcStartTmr(gRlcCb,(PTR)ueCb, EVENT_RLC_UE_DELETE_TMR);
889 result = INVALID_CELLID;
894 result = INVALID_UEID;
897 if(result != SUCCESSFUL)
899 ret = sendRlcUeDeleteRspToDu(ueDelete->cellId, ueDelete->ueId, result);
902 DU_LOG("\nERROR --> RLC: RlcProcUeDeleteReq():Failed to send UE Delete response to DU");
905 RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ueDelete, sizeof(RlcUeDelete));
909 DU_LOG("\nERROR --> RLC: RlcProcUeDeleteReq(): Recieved NULL pointer UE Delete ");
915 /**********************************************************************
917 **********************************************************************/