X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrrlc%2Frlc_msg_hdl.c;h=4e2973471dcd5400c0c02af259765e4ede607b50;hb=f33e70cfac9c2fa3ffbbbdf2183b4c8876974b96;hp=b68e53c74f7d5b711159c212193777d6bfe5d6dc;hpb=2e79829c81833df467daa9cce57a967d2224876e;p=o-du%2Fl2.git diff --git a/src/5gnrrlc/rlc_msg_hdl.c b/src/5gnrrlc/rlc_msg_hdl.c index b68e53c74..4e2973471 100644 --- a/src/5gnrrlc/rlc_msg_hdl.c +++ b/src/5gnrrlc/rlc_msg_hdl.c @@ -43,6 +43,7 @@ #include "du_app_rlc_inf.h" #include "rlc_utils.h" #include "rlc_upr_inf_api.h" + /******************************************************************* * * @brief Fills RLC UL UE Cfg Rsp from RlcCRsp @@ -331,9 +332,9 @@ uint8_t BuildAndSendRrcDeliveryReportToDu( RlcDlRrcMsgInfo *dlRrcMsgInfo ) uint8_t RlcProcDlRrcMsgTransfer(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo) { Buffer *mBuf; - KwuDatReqInfo *datReqInfo; + RlcDatReqInfo *datReqInfo; - RLC_SHRABL_STATIC_BUF_ALLOC(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(KwuDatReqInfo)); + 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"); @@ -353,7 +354,7 @@ uint8_t RlcProcDlRrcMsgTransfer(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo) 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(KwuDatReqInfo)); + 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; @@ -372,7 +373,7 @@ uint8_t RlcProcDlRrcMsgTransfer(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo) } /* Free memory allocated by du app */ - RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(KwuDatReqInfo)); + 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; @@ -669,6 +670,225 @@ uint8_t RlcProcUeReconfigReq(Pst *pst, RlcUeCfg *ueCfg) return ret; } +/* **************************************************************** + * + * @brief Process the DL Data transfer from DU APP + * + * @details + * + * Function : RlcProcDlUserDataTransfer + * + * Functionality: Process the DL transfer from DU APP + * + * @params[in] Post structure + * DL RRC Message info + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t RlcProcDlUserDataTransfer(Pst *pst, RlcDlUserDataInfo *dlDataMsgInfo) +{ + Buffer *mBuf = NULLP; + RlcDatReqInfo *datReqInfo = NULLP; + + if(dlDataMsgInfo->dlMsg == NULLP) + { + DU_LOG("\nERROR --> RLC_DL : Received DL message is NULLP in RlcProcDlUserDataTransfer()"); + return RFAILED; + } + RLC_SHRABL_STATIC_BUF_ALLOC(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(RlcDatReqInfo)); + if(!datReqInfo) + { + DU_LOG("\nERROR --> RLC_DL : Memory allocation failed for DatReq in RlcProcDlUserDataTransfer()"); + RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlDataMsgInfo->dlMsg, dlDataMsgInfo->msgLen); + RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlDataMsgInfo, sizeof(RlcDlUserDataInfo)); + return RFAILED; + } + + datReqInfo->rlcId.rbType = RB_TYPE_DRB; + datReqInfo->rlcId.rbId = dlDataMsgInfo->rbId; + datReqInfo->rlcId.ueId = dlDataMsgInfo->ueIdx; + datReqInfo->rlcId.cellId = dlDataMsgInfo->cellId; + datReqInfo->lcType = LCH_DTCH; + datReqInfo->sduId = ++(rlcCb[pst->dstInst]->dlSduId); + mBuf = dlDataMsgInfo->dlMsg; + if(rlcProcDlData(pst, datReqInfo, mBuf) != ROK) + { + return RFAILED; + } + + /* 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, dlDataMsgInfo, sizeof(RlcDlUserDataInfo)); + return ROK; +} + +/******************************************************************* + * + * @brief sending UE delete response to DU + * + * @details + * + * Function : sendRlcUeDeleteRspToDu + * + * Functionality: + * sending UE delete response to DU + * + * @params[in] uint8_t ueIdx, uint8_t cellId, UeDeleteResult result + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t sendRlcUeDeleteRspToDu(uint8_t ueIdx, uint16_t cellId, UeDeleteResult result) +{ + Pst pst; + RlcUeDeleteRsp *ueDeleteRsp = NULLP; + + FILL_PST_RLC_TO_DUAPP(pst, RLC_UL_INST, EVENT_RLC_UE_DELETE_RSP); + + RLC_ALLOC_SHRABL_BUF(pst.region, pst.pool, ueDeleteRsp, sizeof(RlcUeDeleteRsp)); + if(!ueDeleteRsp) + { + DU_LOG("\nERROR --> RLC: sendRlcUeDeleteRspToDu(): Memory allocation failed "); + return RFAILED; + } + else + { + ueDeleteRsp->cellId = cellId; + ueDeleteRsp->ueIdx = ueIdx; + ueDeleteRsp->result = result; + + if(rlcSendUeDeleteRspToDu(&pst, ueDeleteRsp) == ROK) + { + DU_LOG("\nDEBUG --> RLC: UE Delete response send successfully"); + } + else + { + DU_LOG("\nERROR --> RLC: SendRlcUeDeleteRspToDu():Failed to send UE Delete response to DU"); + RLC_FREE_SHRABL_BUF(pst.region, pst.pool, ueDeleteRsp, sizeof(RlcUeDeleteRsp)); + return RFAILED; + } + } + return ROK; +} + +/* **************************************************************** +* +* @brief filling RLC UE delete configuration +* +* @details +* +* Function : fillRlcCfgInfo +* +* Functionality: filling RLC UE delete configuration +* +* @params[in] RlcUlUeCb *ueCb, RlcCfgInfo *rlcUeCfg +* +* @return void +* +* ****************************************************************/ + +void fillRlcUeDelInfo(RlcUlUeCb *ueCb, RlcCfgInfo *rlcUeCfg) +{ + uint8_t lcIdx; + + rlcUeCfg->ueId = ueCb->ueId; + rlcUeCfg->cellId = ueCb->cellId; + rlcUeCfg->numEnt = 0; + for(lcIdx=0; lcIdxnumEnt < 1; lcIdx++) + { + if(ueCb->lCh[lcIdx].ulRbCb != NULLP) + { + rlcUeCfg->entCfg[rlcUeCfg->numEnt].rbId = 0; + rlcUeCfg->entCfg[rlcUeCfg->numEnt].rbType = 0; + rlcUeCfg->entCfg[rlcUeCfg->numEnt].cfgType = CKW_CFG_DELETE_UE; + rlcUeCfg->numEnt++; + } + } +} + +/******************************************************************* +* +* @brief Handles Ue delete Request from DU APP +* +* @details +* +* Function : RlcProcUeDeleteReq +* +* Functionality: +* Handles Ue delete Request from DU APP +* +* @params[in] Post structure pointer +* RlcUeDelete pointer +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ + +uint8_t RlcProcUeDeleteReq(Pst *pst, RlcUeDelete *ueDelete) +{ + uint8_t ret = ROK; + RlcCb *gRlcCb = NULLP; + RlcCfgInfo *rlcUeCfg = NULLP; + RlcUlUeCb *ueCb = NULLP; + UeDeleteResult result=SUCCESSFUL; + + DU_LOG("\nDEBUG --> RLC: UE Delete request received. CellID[%d] UEIDX[%d]",ueDelete->cellId, ueDelete->ueIdx); + + if(ueDelete != NULLP) + { + gRlcCb = RLC_GET_RLCCB(pst->dstInst); + rlcDbmFetchUlUeCb(gRlcCb,ueDelete->ueIdx, ueDelete->cellId, &ueCb); + if(ueCb != NULLP) + { + if(ueDelete->cellId == ueCb->cellId) + { + RLC_ALLOC(gRlcCb, rlcUeCfg, sizeof(RlcCfgInfo)); + if(rlcUeCfg == NULLP) + { + DU_LOG("\nERROR --> RLC: deleteRlcUeCb(): Failed to allocate memory"); + ret = RFAILED; + } + else + { + memset(rlcUeCfg, 0, sizeof(RlcCfgInfo)); + fillRlcUeDelInfo(ueCb, rlcUeCfg); + if(RlcProcCfgReq(pst, rlcUeCfg) != ROK) + { + DU_LOG("\nERROR --> RLC: deleteRlcUeCb(): Failed to delete UE information"); + result = INVALID_UEID; + } + } + } + else + { + result = INVALID_CELLID; + } + } + else + { + result = INVALID_UEID; + } + + if(result != SUCCESSFUL) + { + ret = sendRlcUeDeleteRspToDu(ueDelete->ueIdx, ueDelete->cellId, result); + if(ret != ROK) + { + DU_LOG("\nERROR --> RLC: RlcProcUeDeleteReq():Failed to send UE Delete response to DU"); + } + } + RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ueDelete, sizeof(RlcUeDelete)); + } + else + { + DU_LOG("\nERROR --> RLC: RlcProcUeDeleteReq(): Recieved NULL pointer UE Delete "); + ret = RFAILED; + } + return ret; +} + /********************************************************************** End of file **********************************************************************/