+ RlcCfgCfmInfo cfgRsp;
+ Pst rspPst;
+
+ gCb = RLC_GET_RLCCB(pst->dstInst);
+ RLC_ALLOC(gCb, rlcUeCfg, sizeof(RlcCfgInfo));
+ if(rlcUeCfg == NULLP)
+ {
+ DU_LOG("\nERROR --> RLC: Failed to allocate memory at RlcProcUeCreateReq()");
+ ret = RFAILED;
+ }
+ else
+ {
+ memset(rlcUeCfg, 0, sizeof(RlcCfgInfo));
+ ret = fillRlcCfg(gCb, rlcUeCfg, ueCfg);
+ if(ret != ROK)
+ {
+ DU_LOG("\nERROR --> RLC: Failed to fill configuration at RlcProcUeCreateReq()");
+ FILL_PST_RLC_TO_DUAPP(rspPst, RLC_UL_INST, EVENT_RLC_UE_CREATE_RSP);
+ fillRlcCfgFailureRsp(&cfgRsp, ueCfg);
+ SendRlcUeCreateRspToDu(&rspPst, &cfgRsp);
+
+ }
+ else
+ {
+ ret = RlcProcCfgReq(pst, rlcUeCfg);
+ if(ret != ROK)
+ DU_LOG("\nERROR --> RLC: Failed to configure Add/Mod/Del entities at RlcProcUeCreateReq()");
+ }
+ }
+ RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ueCfg, sizeof(RlcUeCreate));
+ return ret;
+}
+
+/*******************************************************************
+*
+* @brief filling the structure of rrc delivery msg info
+*
+* @details
+*
+* Function : BuildAndSendRrcDeliveryReportToDu
+*
+* Functionality: filling the structure of rrc delivery msg info
+*
+* @return ROK - success
+* RFAILED - failure
+*
+* ****************************************************************/
+uint8_t BuildAndSendRrcDeliveryReportToDu( RlcDlRrcMsgInfo *dlRrcMsgInfo )
+{
+ Pst pst;
+ RrcDeliveryReport *rrcDelivery;
+
+ DU_LOG("\nINFO --> RLC : Filling RRC Delivery Report");
+ RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_UL, RLC_POOL, rrcDelivery, sizeof(RrcDeliveryReport));
+
+ if(rrcDelivery)
+ {
+ rrcDelivery->cellId = dlRrcMsgInfo->cellId;
+ rrcDelivery->ueId = dlRrcMsgInfo->ueId;
+ rrcDelivery->srbId = dlRrcMsgInfo->lcId ;
+ rrcDelivery->rrcDeliveryStatus.deliveryStatus = PDCP_SN;
+ rrcDelivery->rrcDeliveryStatus.triggeringMessage = PDCP_SN;
+
+ /* Sending UL RRC Message transfeer to DU APP */
+ memset(&pst, 0, sizeof(Pst));
+ FILL_PST_RLC_TO_DUAPP(pst, RLC_UL_INST, EVENT_RRC_DELIVERY_MSG_TRANS_TO_DU);
+ rlcSendRrcDeliveryReportToDu(&pst, rrcDelivery);
+ }
+ else
+ {
+ DU_LOG("\nERROR --> RLC : Memory allocation failed");
+ }
+
+ return ROK;
+}
+/* ****************************************************************
+ *
+ * @brief Process the DL RRC Message from DU APP
+ *
+ * @details
+ *
+ * Function : RlcProcDlRrcMsgTransfer
+ *
+ * Functionality: Process the DL RRC Message from DU APP
+ *
+ * @params[in] Post structure
+ * DL RRC Message info
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t RlcProcDlRrcMsgTransfer(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo)
+{
+ Buffer *mBuf;
+ RlcDatReqInfo *datReqInfo;
+
+ RLC_SHRABL_STATIC_BUF_ALLOC(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(RlcDatReqInfo));
+ if(!datReqInfo)
+ {
+ DU_LOG("\nERROR --> RLC : Memory allocation failed in RlcProcDlRrcMsgTransfer");
+ RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlRrcMsgInfo->rrcMsg, dlRrcMsgInfo->msgLen);
+ RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlRrcMsgInfo, sizeof(RlcDlRrcMsgInfo));
+ return RFAILED;
+ }
+
+ datReqInfo->rlcId.rbType = RB_TYPE_SRB;
+ datReqInfo->rlcId.rbId = dlRrcMsgInfo->lcId;
+ datReqInfo->rlcId.ueId = dlRrcMsgInfo->ueId;
+ datReqInfo->rlcId.cellId = dlRrcMsgInfo->cellId;
+ datReqInfo->lcType = LCH_DCCH;
+ datReqInfo->sduId = ++(rlcCb[pst->dstInst]->dlSduId);
+
+ /* Copy fixed buffer to message */
+ if(ODU_GET_MSG_BUF(RLC_MEM_REGION_UL, RLC_POOL, &mBuf) != ROK)
+ {
+ DU_LOG("\nERROR --> RLC : Memory allocation failed at RlcMacProcUlData");
+ RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(RlcDatReqInfo));
+ RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlRrcMsgInfo->rrcMsg, dlRrcMsgInfo->msgLen);
+ RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlRrcMsgInfo, sizeof(RlcDlRrcMsgInfo));
+ return RFAILED;
+ }
+ oduCpyFixBufToMsg(dlRrcMsgInfo->rrcMsg, mBuf, dlRrcMsgInfo->msgLen);
+
+ if(rlcProcDlData(pst, datReqInfo, mBuf) != ROK)
+ {
+ return RFAILED;
+ }
+
+ /* RRC Delivery report is only send when RRC Delivery status report is true in DL RRC Message */
+ if(dlRrcMsgInfo->deliveryStaRpt)
+ {
+ BuildAndSendRrcDeliveryReportToDu(dlRrcMsgInfo);
+ }
+
+ /* Free memory allocated by du app */
+ RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(RlcDatReqInfo));
+ RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlRrcMsgInfo->rrcMsg, dlRrcMsgInfo->msgLen);
+ RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlRrcMsgInfo, sizeof(RlcDlRrcMsgInfo));
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Process UL data from UE
+ *
+ * @details
+ *
+ * Function : RlcProcUlData
+ *
+ * Functionality:
+ * This function receives the PDU from MAC.
+ * seggregates common and dedicated logical channel
+ * PDU and call respective handler.
+ *
+ * @params[in]
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t RlcProcUlData(Pst *pst, RlcUlData *ulData)
+{
+ uint8_t ret = ROK;
+ uint8_t idx, pduIdx;
+ uint8_t lcId; /* Logical Channel */
+ uint8_t numDLch = 0; /* Number of dedicated logical channel */
+ bool dLchPduPres; /* PDU received on dedicated logical channel */
+ RguLchDatInd dLchData[MAX_NUM_LC]; /* PDU info on dedicated logical channel */
+ RguDDatIndInfo *dLchUlDat; /* UL data on dedicated logical channel */
+
+ /* Initializing dedicated logical channel Database */
+ DU_LOG("\nDEBUG --> RLC: Received UL Data request from MAC");
+ for(idx = 0; idx < MAX_NUM_LC; idx++)
+ {
+ dLchData[idx].lcId = idx;
+ dLchData[idx].pdu.numPdu = 0;
+ }
+ dLchPduPres = FALSE;
+
+ /* Seggregate PDUs received on common and dedicated channels
+ * and call common channel's handler */
+ for(idx = 0; idx< ulData->numPdu; idx++)
+ {
+ if(!dLchPduPres)
+ {
+ RLC_SHRABL_STATIC_BUF_ALLOC(RLC_MEM_REGION_UL, RLC_POOL, dLchUlDat, \
+ sizeof(RguDDatIndInfo));
+ if(!dLchUlDat)
+ {
+ DU_LOG("\nERROR --> RLC : Memory allocation failed at RlcMacProcUlData");
+ ret = RFAILED;
+ break;
+ }
+ dLchPduPres = TRUE;
+ }
+
+ /* Copy fixed buffer to message */
+ lcId = ulData->pduInfo[idx].lcId;
+ if(ODU_GET_MSG_BUF(RLC_MEM_REGION_UL, RLC_POOL, \
+ &dLchData[lcId].pdu.mBuf[dLchData[lcId].pdu.numPdu]) != ROK)
+ {
+ DU_LOG("\nERROR --> RLC : Memory allocation failed at RlcMacProcUlData");
+ for(pduIdx=0; pduIdx < dLchData[lcId].pdu.numPdu; pduIdx++)
+ {
+ ODU_PUT_MSG_BUF(dLchData[lcId].pdu.mBuf[dLchData[lcId].pdu.numPdu]);
+ }
+ RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_UL, RLC_POOL, dLchUlDat, \
+ sizeof(RguDDatIndInfo));
+ ret = RFAILED;
+ break;
+ }
+ oduCpyFixBufToMsg(ulData->pduInfo[idx].pduBuf, \
+ dLchData[lcId].pdu.mBuf[dLchData[lcId].pdu.numPdu],\
+ ulData->pduInfo[idx].pduLen);
+
+ dLchData[lcId].pdu.numPdu++;
+ }
+
+ /* If any PDU received on dedicated logical channel, copy into RguDDatIndInfo
+ * and call its handler */
+ if(ret == ROK)
+ {
+ if(dLchPduPres)
+ {
+ dLchUlDat->cellId = ulData->cellId;
+ GET_UE_ID(ulData->rnti, dLchUlDat->rnti);
+
+ for(idx = 0; idx < MAX_NUM_LC; idx++)
+ {
+ if(dLchData[idx].pdu.numPdu)
+ {
+ memcpy(&dLchUlDat->lchData[numDLch], &dLchData[idx], sizeof(RguLchDatInd));
+ numDLch++;
+ }
+ }
+ dLchUlDat->numLch = numDLch;
+ rlcProcDedLcUlData(pst, 0, dLchUlDat);
+ }
+ }
+
+ for(pduIdx = 0; pduIdx < ulData->numPdu; pduIdx++)
+ {
+ RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ulData->pduInfo[pduIdx].pduBuf, \
+ ulData->pduInfo[pduIdx].pduLen);
+ }
+ RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ulData, sizeof(RlcUlData));
+ return ROK;
+
+}/* End of RlcProcUlData */