From d1f428c3527bfff3b3eae2715e91ae8449ad1784 Mon Sep 17 00:00:00 2001 From: "lal.harshita" Date: Mon, 13 Mar 2023 22:22:15 +0530 Subject: [PATCH] [Epic-ID: ODUHIGH-488][Task-ID: ODUHIGH-501] WG8 Alignment | Ue reset req and rsp Signed-off-by: lal.harshita Change-Id: I955af091f96d68ab52e19fb44d0437b2aacdcb04 Signed-off-by: lal.harshita --- src/5gnrmac/mac_cfg_hdl.c | 18 ++--- src/5gnrmac/mac_msg_router.c | 6 ++ src/5gnrmac/mac_ue_mgr.c | 136 +++++++++++++++++++++++++++++++----- src/5gnrrlc/rlc_mgr.h | 2 +- src/5gnrrlc/rlc_msg_hdl.c | 16 ++--- src/5gnrrlc/rlc_tmr.c | 2 +- src/5gnrsch/sch.c | 8 +-- src/5gnrsch/sch_ue_mgr.c | 22 +++--- src/cm/common_def.h | 12 +++- src/cm/du_app_mac_inf.c | 149 +++++++++++++++++++++++++++++++++++++++ src/cm/du_app_mac_inf.h | 69 ++++++++++-------- src/cm/du_app_rlc_inf.h | 9 +-- src/cm/mac_sch_interface.h | 33 ++------- src/du_app/du_cell_mgr.c | 2 +- src/du_app/du_mgr.h | 3 +- src/du_app/du_mgr_msg_router.c | 5 ++ src/du_app/du_ue_mgr.c | 154 ++++++++++++++++++++++++++++++++++++++++- 17 files changed, 526 insertions(+), 120 deletions(-) diff --git a/src/5gnrmac/mac_cfg_hdl.c b/src/5gnrmac/mac_cfg_hdl.c index 69591c488..1af9b0b0b 100644 --- a/src/5gnrmac/mac_cfg_hdl.c +++ b/src/5gnrmac/mac_cfg_hdl.c @@ -500,7 +500,7 @@ void fapiMacConfigRsp(uint16_t cellId) * RFAILED - failure * * ****************************************************************/ -uint8_t MacSendCellDeleteRsp(CellDeleteStatus result, uint8_t cellId) +uint8_t MacSendCellDeleteRsp(CauseOfResult status, uint8_t cellId) { MacCellDeleteRsp *deleteRsp=NULLP; Pst rspPst; @@ -516,7 +516,7 @@ uint8_t MacSendCellDeleteRsp(CellDeleteStatus result, uint8_t cellId) memset(deleteRsp, 0, sizeof(MacCellDeleteRsp)); deleteRsp->cellId = cellId; - deleteRsp->result = result; + deleteRsp->status = status; /* Fill Post structure and send CELL delete response*/ memset(&rspPst, 0, sizeof(Pst)); @@ -545,7 +545,7 @@ uint8_t MacProcSchCellDeleteRsp(Pst *pst, SchCellDeleteRsp *schCellDelRsp) { uint8_t ret = ROK, sliceIdx = 0, plmnIdx = 0; uint16_t cellIdx=0; - CellDeleteStatus status; + CauseOfResult cause; #ifdef CALL_FLOW_DEBUG_LOG DU_LOG("\nCall Flow: ENTSCH -> ENTMAC : EVENT_CELL_DELETE_RSP_TO_MAC\n"); @@ -562,7 +562,7 @@ uint8_t MacProcSchCellDeleteRsp(Pst *pst, SchCellDeleteRsp *schCellDelRsp) { if(macCb.macCell[cellIdx]->cellId == schCellDelRsp->cellId) { - status = SUCCESSFUL_RSP; + cause = SUCCESSFUL; for(plmnIdx = 0; plmnIdx < MAX_PLMN; plmnIdx++) { if(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai) @@ -582,24 +582,24 @@ uint8_t MacProcSchCellDeleteRsp(Pst *pst, SchCellDeleteRsp *schCellDelRsp) else { DU_LOG("ERROR --> MAC : MacProcSchCellDeleteRsp(): CellId[%d] does not exists", schCellDelRsp->cellId); - status = CELL_ID_INVALID; + cause = CELLID_INVALID; ret = RFAILED; } } else { DU_LOG("ERROR --> MAC : MacProcSchCellDeleteRsp(): CellId[%d] does not exists", schCellDelRsp->cellId); - status = CELL_ID_INVALID; + cause = CELLID_INVALID; ret = RFAILED; } } else { DU_LOG("ERROR --> MAC : MacProcSchCellDeleteRsp(): CellId[%d] does not exists", schCellDelRsp->cellId); - status = CELL_ID_INVALID; + cause = CELLID_INVALID; ret = RFAILED; } - if(MacSendCellDeleteRsp(status, schCellDelRsp->cellId) != ROK) + if(MacSendCellDeleteRsp(cause, schCellDelRsp->cellId) != ROK) { DU_LOG("\nERROR --> MAC: MacProcSchCellDeleteRsp(): Failed to send CELL delete response"); ret = RFAILED; @@ -693,7 +693,7 @@ uint8_t MacProcCellDeleteReq(Pst *pst, MacCellDeleteReq *cellDelete) if(ret == RFAILED) { DU_LOG("\nERROR --> MAC : MacProcCellDeleteReq(): Sending failure response to DU"); - if(MacSendCellDeleteRsp(CELL_ID_INVALID, cellDelete->cellId) != ROK) + if(MacSendCellDeleteRsp(CELLID_INVALID, cellDelete->cellId) != ROK) { DU_LOG("\nERROR --> MAC : MacProcCellDeleteReq(): failed to send cell delete rsp for cellID[%d]",\ cellDelete->cellId); diff --git a/src/5gnrmac/mac_msg_router.c b/src/5gnrmac/mac_msg_router.c index 88fea7bd1..114e1d824 100755 --- a/src/5gnrmac/mac_msg_router.c +++ b/src/5gnrmac/mac_msg_router.c @@ -173,6 +173,12 @@ void MacHdlDuappEvents(Pst *pst, Buffer *mBuf) unpackMacDlPcchInd(MacProcDlPcchInd, pst, mBuf); break; } + case EVENT_MAC_UE_RESET_REQ: + { + /* Process UE Reset Request */ + unpackMacUeResetReq(MacProcUeResetReq, pst, mBuf); + break; + } default: RG_FREE_MSG(mBuf); diff --git a/src/5gnrmac/mac_ue_mgr.c b/src/5gnrmac/mac_ue_mgr.c index aaa95de56..70b189653 100644 --- a/src/5gnrmac/mac_ue_mgr.c +++ b/src/5gnrmac/mac_ue_mgr.c @@ -49,6 +49,12 @@ MacDuUeDeleteRspFunc macDuUeDeleteRspOpts[] = packDuMacUeDeleteRsp /* packing for light weight loosly coupled */ }; +MacDuUeResetRspFunc macDuUeResetRspOpts[] = +{ + packDuMacUeResetRsp, /* packing for loosely coupled */ + DuProcMacUeResetRsp, /* packing for tightly coupled */ + packDuMacUeResetRsp /* packing for light weight loosly coupled */ +}; /******************************************************************* * * @brief Fills mac cell group config to be sent to scheduler @@ -3111,7 +3117,7 @@ uint8_t MacProcUeReconfigReq(Pst *pst, MacUeRecfg *ueRecfg) * * ****************************************************************/ -uint8_t MacSendUeDeleteRsp(uint16_t cellId, uint16_t crnti, UeDeleteStatus result) +uint8_t MacSendUeDeleteRsp(uint16_t cellId, uint16_t crnti, CauseOfResult status) { MacUeDeleteRsp *deleteRsp; Pst rspPst; @@ -3126,7 +3132,7 @@ uint8_t MacSendUeDeleteRsp(uint16_t cellId, uint16_t crnti, UeDeleteStatus resul /* Filling UE delete response */ deleteRsp->cellId = cellId; GET_UE_ID(crnti, deleteRsp->ueId); - deleteRsp->result = result; + deleteRsp->status = status; /* Fill Post structure and send UE delete response*/ memset(&rspPst, 0, sizeof(Pst)); @@ -3210,7 +3216,7 @@ uint8_t MacProcSchUeDeleteRsp(Pst *pst, SchUeDeleteRsp *schUeDelRsp) uint8_t ueId =0, isCrntiValid = 0, tbIdx =0, idx=0; uint16_t cellIdx=0; uint8_t ret = RFAILED; - UeDeleteStatus result; + CauseOfResult status; DlHarqEnt *dlHarqEnt; #ifdef CALL_FLOW_DEBUG_LOG @@ -3230,7 +3236,7 @@ uint8_t MacProcSchUeDeleteRsp(Pst *pst, SchUeDeleteRsp *schUeDelRsp) { /*C-RNTI value is out of Acceptable range*/ DU_LOG("\nERROR --> MAC : MacProcSchUeDeleteRsp(): Invalid crnti[%d] ",schUeDelRsp->crnti); - result = UEID_INVALID; + status = UEID_INVALID; } else { @@ -3264,29 +3270,29 @@ uint8_t MacProcSchUeDeleteRsp(Pst *pst, SchUeDeleteRsp *schUeDelRsp) } memset(&macCb.macCell[cellIdx]->ueCb[ueId -1], 0, sizeof(MacUeCb)); macCb.macCell[cellIdx]->numActvUe--; - result = DEL_SUCCESSFUL; + status = SUCCESSFUL; ret = ROK; } else { DU_LOG("\nERROR --> MAC : MacProcSchUeDeleteRsp(): crnti[%d] does not exist ",schUeDelRsp->crnti); - result = UEID_INVALID; + status = UEID_INVALID; } } } else { DU_LOG("\nERROR --> MAC : MacProcSchUeDeleteRsp(): cellId[%d] does not exist ",schUeDelRsp->cellId); - result = CELLID_INVALID; + status = CELLID_INVALID; } } else - { - result = (schUeDelRsp->cause == INVALID_CELLID) ? CELLID_INVALID : UEID_INVALID; - } - if(MacSendUeDeleteRsp(schUeDelRsp->cellId, schUeDelRsp->crnti, result) != ROK) + status = schUeDelRsp->cause; + + if(MacSendUeDeleteRsp(schUeDelRsp->cellId, schUeDelRsp->crnti, status) != ROK) { DU_LOG("\nERROR --> MAC: MacProcSchUeDeleteRsp(): Failed to send UE delete response"); + ret = RFAILED; } } else @@ -3355,7 +3361,7 @@ uint8_t MacProcUeDeleteReq(Pst *pst, MacUeDelete *ueDelete) { uint8_t ret = ROK; uint8_t cellIdx=0; - UeDeleteStatus result=DEL_SUCCESSFUL; + CauseOfResult status =SUCCESSFUL; MacUeCb *ueCb = NULLP; MacCellCb *cellCb = NULLP; @@ -3380,18 +3386,18 @@ uint8_t MacProcUeDeleteReq(Pst *pst, MacUeDelete *ueDelete) else { DU_LOG("\nERROR --> MAC : MacProcUeDeleteReq(): CRNTI is not matched"); - result = UEID_INVALID; + status = UEID_INVALID; } } else { DU_LOG("\nERROR --> MAC : MacProcUeDeleteReq(): Failed to find the MacUeCb of UeId = %d",ueDelete->ueId); - result = CELLID_INVALID; + status = CELLID_INVALID; } - if(result != DEL_SUCCESSFUL) + if(status!= SUCCESSFUL) { - MacSendUeDeleteRsp(ueDelete->cellId, ueDelete->crnti, result); + MacSendUeDeleteRsp(ueDelete->cellId, ueDelete->crnti, status); MAC_FREE_SHRABL_BUF(pst->region, pst->pool, ueDelete, sizeof(MacUeDelete)); ret = RFAILED; } @@ -3404,6 +3410,104 @@ uint8_t MacProcUeDeleteReq(Pst *pst, MacUeDelete *ueDelete) return ret; } +/******************************************************************* +* +* @brief Fill and Send UE Reset response from MAC to DU APP +* +* @details +* +* Function : MacSendUeResetRsp +* +* Functionality: Fill and Send UE Reset response from MAC to DUAPP +* +* @params[in] MAC UE Reset result +* SCH UE Reset response +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ + +uint8_t MacSendUeResetRsp(uint16_t cellId, uint16_t ueId, CauseOfResult status) +{ + MacUeResetRsp *ResetRsp; + Pst rspPst; + + MAC_ALLOC_SHRABL_BUF(ResetRsp, sizeof(MacUeResetRsp)); + if(!ResetRsp) + { + DU_LOG("\nERROR --> MAC : Memory allocation for UE Reset response failed"); + return RFAILED; + } + + /* Filling UE Reset response */ + ResetRsp->cellId = cellId; + ResetRsp->ueId = ueId; + ResetRsp->status = status; + + /* Fill Post structure and send UE Reset response*/ + memset(&rspPst, 0, sizeof(Pst)); + FILL_PST_MAC_TO_DUAPP(rspPst, EVENT_MAC_UE_RESET_RSP); + return (*macDuUeResetRspOpts[rspPst.selector])(&rspPst, ResetRsp); +} + +/******************************************************************* + * + * @brief Handles UE Reset request from DU APP + * + * @details + * + * Function : MacProcUeResetReq + * + * Functionality: Handles UE Reset requst from DU APP + * + * @params[in] Pst *pst, MacUeResetReq *ueReset + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t MacProcUeResetReq(Pst *pst, MacUeResetReq *ueReset) +{ + uint8_t cellIdx=0; + CauseOfResult status =SUCCESSFUL; + MacUeCb *ueCb = NULLP; + MacCellCb *cellCb = NULLP; + + DU_LOG("\nINFO --> MAC : UE Reset Request received for ueId[%d]", ueReset->ueId); + + if(ueReset) + { + GET_CELL_IDX(ueReset->cellId, cellIdx); + cellCb = macCb.macCell[cellIdx]; + if(cellCb) + { + ueCb = &cellCb->ueCb[ueReset->ueId-1]; + if(ueCb->ueId == ueReset->ueId) + { + /* TODO := complete the processing of UE reset request*/ + } + else + { + DU_LOG("\nERROR --> MAC : MacProcUeResetReq(): UE ID [%d] not found in Cell Id [%d]", ueCb->ueId , ueReset->cellId); + status = UEID_INVALID; + } + } + else + { + DU_LOG("\nERROR --> MAC : MacProcUeResetReq(): Cell Id [%d] not found ",ueReset->cellId); + status = CELLID_INVALID; + } + + MacSendUeResetRsp(ueReset->cellId, ueReset->ueId, status); + MAC_FREE_SHRABL_BUF(pst->region, pst->pool, ueReset, sizeof(MacUeResetReq)); + } + else + { + DU_LOG("\nERROR --> MAC : MacProcUeResetReq(): MAC UE reset request processing failed"); + return RFAILED; + } + return ROK; +} /********************************************************************** End of file **********************************************************************/ diff --git a/src/5gnrrlc/rlc_mgr.h b/src/5gnrrlc/rlc_mgr.h index dd5432c42..c3b64893a 100644 --- a/src/5gnrrlc/rlc_mgr.h +++ b/src/5gnrrlc/rlc_mgr.h @@ -19,7 +19,7 @@ /* This file stores defines used at RLC interface */ uint8_t fillRlcUeCfgRsp(RlcUeCfgRsp *rlcCfgRsp, RlcCfgCfmInfo *rlcCRsp); uint8_t SendRlcUeCfgRspToDu(Pst *pst, RlcCfgCfmInfo *cfgRsp); -uint8_t sendRlcUeDeleteRspToDu(uint16_t cellId, uint8_t ueId, UeDeleteResult result); +uint8_t sendRlcUeDeleteRspToDu(uint16_t cellId, uint8_t ueId, CauseOfResult status); /********************************************************************** End of file diff --git a/src/5gnrrlc/rlc_msg_hdl.c b/src/5gnrrlc/rlc_msg_hdl.c index f10a52017..649a18eb2 100644 --- a/src/5gnrrlc/rlc_msg_hdl.c +++ b/src/5gnrrlc/rlc_msg_hdl.c @@ -853,13 +853,13 @@ uint8_t RlcProcDlUserDataTransfer(Pst *pst, RlcDlUserDataInfo *dlDataMsgInfo) * Functionality: * sending UE delete response to DU * - * @params[in] uint8_t cellId, uint8_t ueId, UeDeleteResult result + * @params[in] uint8_t cellId, uint8_t ueId, CauseOfResult status * * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t sendRlcUeDeleteRspToDu(uint16_t cellId,uint8_t ueId, UeDeleteResult result) +uint8_t sendRlcUeDeleteRspToDu(uint16_t cellId,uint8_t ueId, CauseOfResult status) { Pst pst; RlcUeDeleteRsp *ueDeleteRsp = NULLP; @@ -876,7 +876,7 @@ uint8_t sendRlcUeDeleteRspToDu(uint16_t cellId,uint8_t ueId, UeDeleteResult resu { ueDeleteRsp->cellId = cellId; ueDeleteRsp->ueId = ueId; - ueDeleteRsp->result = result; + ueDeleteRsp->status = status; if(rlcSendUeDeleteRspToDu(&pst, ueDeleteRsp) == ROK) { @@ -915,7 +915,7 @@ uint8_t RlcProcUeDeleteReq(Pst *pst, RlcUeDelete *ueDelete) uint8_t ret = ROK; RlcCb *gRlcCb = NULLP; RlcUlUeCb *ueCb = NULLP; - UeDeleteResult result=SUCCESSFUL; + CauseOfResult status =SUCCESSFUL; DU_LOG("\nDEBUG --> RLC: UE Delete request received. CellID[%d] UEID[%d]",ueDelete->cellId, ueDelete->ueId); @@ -935,17 +935,17 @@ uint8_t RlcProcUeDeleteReq(Pst *pst, RlcUeDelete *ueDelete) } else { - result = INVALID_CELLID; + status = CELLID_INVALID; } } else { - result = INVALID_UEID; + status = UEID_INVALID; } - if(result != SUCCESSFUL) + if(status != SUCCESSFUL) { - ret = sendRlcUeDeleteRspToDu(ueDelete->cellId, ueDelete->ueId, result); + ret = sendRlcUeDeleteRspToDu(ueDelete->cellId, ueDelete->ueId, status); if(ret != ROK) { DU_LOG("\nERROR --> RLC: RlcProcUeDeleteReq():Failed to send UE Delete response to DU"); diff --git a/src/5gnrrlc/rlc_tmr.c b/src/5gnrrlc/rlc_tmr.c index fc8ae668f..0c7234e64 100755 --- a/src/5gnrrlc/rlc_tmr.c +++ b/src/5gnrrlc/rlc_tmr.c @@ -683,7 +683,7 @@ uint8_t rlcUeDeleteTmrExpiry(PTR cb) if(RlcProcCfgReq(&ueCb->ueDeleteInfo.pst, rlcUeCfg) != ROK) { DU_LOG("\nERROR --> RLC: rlcUeDeleteTmrExpiry(): Failed to delete UE"); - if(sendRlcUeDeleteRspToDu(rlcUeCfg->cellId, rlcUeCfg->ueId, INVALID_UEID) != ROK) + if(sendRlcUeDeleteRspToDu(rlcUeCfg->cellId, rlcUeCfg->ueId, UEID_INVALID) != ROK) { DU_LOG("ERROR --> RLC: rlcUeDeleteTmrExpiry(): Failed to send UE delete response "); return RFAILED; diff --git a/src/5gnrsch/sch.c b/src/5gnrsch/sch.c index 7edd709a0..8d8dba6b9 100644 --- a/src/5gnrsch/sch.c +++ b/src/5gnrsch/sch.c @@ -1797,12 +1797,12 @@ uint8_t fillSliceCfgRsp(Inst inst, CmLListCp *storedSliceCfg, SchCellCb *cellCb, if(addSliceCfgInSchDb(storedSliceCfg, schSliceCfgReq->listOfSlices[cfgIdx]) == ROK) { sliceFound = RSP_OK; - schSliceCfgRsp.cause = SLICE_CONFIGURED; + schSliceCfgRsp.cause = SUCCESSFUL; } else { DU_LOG("\nERROR --> SCH : Failed to store slice configuration in SchDb"); - schSliceCfgRsp.cause = RESOURCE_NOT_AVAILABLE; + schSliceCfgRsp.cause = RESOURCE_UNAVAILABLE; ret = RFAILED; } plmnIdx = MAX_PLMN; @@ -1811,7 +1811,7 @@ uint8_t fillSliceCfgRsp(Inst inst, CmLListCp *storedSliceCfg, SchCellCb *cellCb, } } - if((sliceFound == RSP_NOK) && (schSliceCfgRsp.cause != RESOURCE_NOT_AVAILABLE)) + if((sliceFound == RSP_NOK) && (schSliceCfgRsp.cause != RESOURCE_UNAVAILABLE)) schSliceCfgRsp.cause = SLICE_NOT_FOUND; schSliceCfgRsp.snssai = schSliceCfgReq->listOfSlices[cfgIdx]->snssai; @@ -1977,7 +1977,7 @@ uint8_t fillSliceRecfgRsp(Inst inst, CmLListCp *storedSliceCfg, SchSliceRecfgReq schSliceRecfgRsp.snssai = schSliceRecfgReq->listOfSlices[cfgIdx]->snssai; schSliceRecfgRsp.rsp = sliceFound; if(schSliceRecfgRsp.rsp == RSP_OK) - schSliceRecfgRsp.cause = SLICE_RECONFIGURED; + schSliceRecfgRsp.cause = SUCCESSFUL; else schSliceRecfgRsp.cause = SLICE_NOT_FOUND; SchSendSliceRecfgRspToMac(inst, schSliceRecfgRsp); diff --git a/src/5gnrsch/sch_ue_mgr.c b/src/5gnrsch/sch_ue_mgr.c index f6b49fac3..9116d10ff 100644 --- a/src/5gnrsch/sch_ue_mgr.c +++ b/src/5gnrsch/sch_ue_mgr.c @@ -1399,12 +1399,12 @@ void deleteSchUeCb(SchUeCb *ueCb) * Functionality: Fill and send UE delete response to MAC * * @params[in] Inst inst, SchUeDelete *ueDelete, SchMacRsp result, -* ErrorCause cause +* CauseOfResult cause * @return ROK - success * RFAILED - failure * * ****************************************************************/ -void SchSendUeDeleteRspToMac(Inst inst, SchUeDelete *ueDelete, SchMacRsp result, ErrorCause cause) +void SchSendUeDeleteRspToMac(Inst inst, SchUeDelete *ueDelete, SchMacRsp result, CauseOfResult cause) { Pst rspPst; SchUeDeleteRsp delRsp; @@ -1439,9 +1439,9 @@ void SchSendUeDeleteRspToMac(Inst inst, SchUeDelete *ueDelete, SchMacRsp result * ****************************************************************/ uint8_t SchProcUeDeleteReq(Pst *pst, SchUeDelete *ueDelete) { - uint8_t idx=0, ueId=0, ret=ROK; - ErrorCause result; - SchCellCb *cellCb = NULLP; + uint8_t idx=0, ueId=0, ret=ROK; + CauseOfResult cause; + SchCellCb *cellCb = NULLP; Inst inst = pst->dstInst - SCH_INST_START; if(!ueDelete) @@ -1456,7 +1456,7 @@ uint8_t SchProcUeDeleteReq(Pst *pst, SchUeDelete *ueDelete) if(cellCb->cellId != ueDelete->cellId) { DU_LOG("\nERROR --> SCH : SchProcUeDeleteReq(): cell Id is not available"); - result = INVALID_CELLID; + cause = CELLID_INVALID; } else { @@ -1467,22 +1467,22 @@ uint8_t SchProcUeDeleteReq(Pst *pst, SchUeDelete *ueDelete) cellCb->api->SchUeDeleteReq(&cellCb->ueCb[ueId-1]); deleteSchUeCb(&cellCb->ueCb[ueId-1]); cellCb->numActvUe--; - result = NOT_APPLICABLE; + cause = SUCCESSFUL; } else { DU_LOG("\nERROR --> SCH : SchProcUeDeleteReq(): SchUeCb not found"); - result = INVALID_UEID; + cause = UEID_INVALID; } } - if(result == NOT_APPLICABLE) + if(cause == SUCCESSFUL) { - SchSendUeDeleteRspToMac(inst, ueDelete, RSP_OK, result); + SchSendUeDeleteRspToMac(inst, ueDelete, RSP_OK, cause); } else { - SchSendUeDeleteRspToMac(inst, ueDelete, RSP_NOK, result); + SchSendUeDeleteRspToMac(inst, ueDelete, RSP_NOK, cause); ret = RFAILED; } return ret; diff --git a/src/cm/common_def.h b/src/cm/common_def.h index 4c0a55a93..22b7ac95c 100644 --- a/src/cm/common_def.h +++ b/src/cm/common_def.h @@ -222,13 +222,23 @@ _isLcidValid = ((_lcId >= SRB0_LCID && _lcId <= MAX_DRB_LCID) ? 1 : 0);\ } +typedef enum +{ + SUCCESSFUL, + CELLID_INVALID, + UEID_INVALID, + RESOURCE_UNAVAILABLE, + SLICE_NOT_FOUND, +}CauseOfResult ; + typedef enum { UE_CFG_INACTIVE, UE_CFG_INPROGRESS, UE_CREATE_COMPLETE, UE_DELETE_COMPLETE, - UE_RECFG_COMPLETE + UE_RECFG_COMPLETE, + UE_RESET_COMPLETE }UeCfgState; typedef enum diff --git a/src/cm/du_app_mac_inf.c b/src/cm/du_app_mac_inf.c index c72636c4d..c2165da60 100644 --- a/src/cm/du_app_mac_inf.c +++ b/src/cm/du_app_mac_inf.c @@ -1959,6 +1959,155 @@ uint8_t unpackMacDlPcchInd(DuMacDlPcchInd func, Pst *pst, Buffer *mBuf) return RFAILED; } +/******************************************************************* +* +* @brief Packs and Sends UE Reset Request from DUAPP to MAC +* +* @details +* +* Function : packDuMacUeResetReq +* +* Functionality: +* Packs and Sends UE Reset Request from DUAPP to MAC +* +* +* @params[in] Post structure pointer +* MacUeResetReq pointer +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +uint8_t packDuMacUeResetReq(Pst *pst, MacUeResetReq *ueDel) +{ + Buffer *mBuf = NULLP; + + if(pst->selector == ODU_SELECTOR_LWLC) + { + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) + { + DU_LOG("\nERROR --> MAC : Memory allocation failed at packDuMacUeResetReq"); + return RFAILED; + } + /* pack the address of the structure */ + CMCHKPK(oduPackPointer,(PTR)ueDel, mBuf); + } + else + { + DU_LOG("\nERROR --> MAC: Only LWLC supported for packDuMacUeResetReq"); + return RFAILED; + } + return ODU_POST_TASK(pst,mBuf); +} + +/******************************************************************* +* +* @brief Unpacks UE Reset Request received from DU APP +* +* @details +* +* Function : unpackMacUeResetReq +* +* Functionality: +* Unpacks UE Reset Request received from DU APP +* +* @params[in] Pointer to Handler +* Post structure pointer +* Message Buffer +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +uint8_t unpackMacUeResetReq(DuMacUeResetReq func, Pst *pst, Buffer *mBuf) +{ + if(pst->selector == ODU_SELECTOR_LWLC) + { + MacUeResetReq *ueReset; + + /* unpack the address of the structure */ + CMCHKUNPK(oduUnpackPointer, (PTR *)&ueReset, mBuf); + ODU_PUT_MSG_BUF(mBuf); + return (*func)(pst, ueReset); + } + else + { + /* Nothing to do for other selectors */ + DU_LOG("\nERROR --> DU APP : Only LWLC supported for UE Reset Request "); + ODU_PUT_MSG_BUF(mBuf); + } + + return RFAILED; +} + +/******************************************************************* + * + * @brief Pack and send UE reset response from MAC to DU APP + * + * @details + * + * Function : packDuMacUeResetRsp + * + * Functionality: + * Pack and send UE reset response from MAC to DU APP + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t packDuMacUeResetRsp(Pst *pst, MacUeResetRsp *resetRsp) +{ + Buffer *mBuf = NULLP; + + if(pst->selector == ODU_SELECTOR_LWLC) + { + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) + { + DU_LOG("\nERROR --> MAC : Memory allocation failed at packDuMacUeResetRsp"); + return RFAILED; + } + /* pack the address of the structure */ + CMCHKPK(oduPackPointer,(PTR)resetRsp, mBuf); + } + else + { + DU_LOG("\nERROR --> MAC: Only LWLC supported for packDuMacUeResetRsp"); + return RFAILED; + } + + return ODU_POST_TASK(pst,mBuf); +} + +/******************************************************************* +* +* @brief Unpack UE Config Response from MAC to DU APP +* +* @details +* +* Function :unpackDuMacUeResetRsp +* +* Functionality: Unpack UE Config Response from MAC to DU APP +* +* @params[in] +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +uint8_t unpackDuMacUeResetRsp(MacDuUeResetRspFunc func, Pst *pst, Buffer *mBuf) +{ + if(pst->selector == ODU_SELECTOR_LWLC) + { + MacUeResetRsp *ueResetRsp = NULLP; + + /* unpack the address of the structure */ + CMCHKUNPK(oduUnpackPointer, (PTR *)&ueResetRsp, mBuf); + ODU_PUT_MSG_BUF(mBuf); + return (*func)(pst, ueResetRsp); + } + + ODU_PUT_MSG_BUF(mBuf); + return RFAILED; +} + /******************************************************************* * * @brief Searches for first unset bit in ueBitMap diff --git a/src/cm/du_app_mac_inf.h b/src/cm/du_app_mac_inf.h index 1cfa22353..5f94ae8c7 100644 --- a/src/cm/du_app_mac_inf.h +++ b/src/cm/du_app_mac_inf.h @@ -84,6 +84,8 @@ #define EVENT_MAC_RACH_RESOURCE_RSP 222 #define EVENT_MAC_RACH_RESOURCE_REL 223 #define EVENT_MAC_DL_PCCH_IND 224 +#define EVENT_MAC_UE_RESET_REQ 225 +#define EVENT_MAC_UE_RESET_RSP 226 #define BSR_PERIODIC_TIMER_SF_10 10 #define BSR_RETX_TIMER_SF_320 320 @@ -98,27 +100,6 @@ typedef enum MAC_DU_APP_RSP_OK }MacRsp; -typedef enum -{ - SLICE_NOT_PRESENT, - SLICE_IS_CONFIGURED, - SLICE_IS_RECONFIGURED, - RESOURCE_DOES_NOT_AVAILABLE -}RspReason; - -typedef enum -{ - DEL_SUCCESSFUL, - CELLID_INVALID, - UEID_INVALID -}UeDeleteStatus; - -typedef enum -{ - SUCCESSFUL_RSP, - CELL_ID_INVALID -}CellDeleteStatus; - typedef enum { DUP_MODE_FDD, @@ -520,15 +501,15 @@ typedef enum RESTART_TRANSMISSION }DataTransmissionAction; -typedef struct failureCause +typedef struct failureCause { CauseGrp type; union { - RadioNwLyrCause radioNwCause; - TransLyrCause transportCause; - ProtCause protcolCause; - MiscFailCause miscCause; + RadioNwLyrCause radioNwResult; + TransLyrCause transportResult; + ProtCause protcolResult; + MiscFailCause miscResult; }u; }FailureCause; @@ -1604,7 +1585,7 @@ typedef struct ueDeleteRsp { uint16_t cellId; uint8_t ueId; - UeDeleteStatus result; + CauseOfResult status; }MacUeDeleteRsp; typedef struct macCellDeleteReq @@ -1615,14 +1596,14 @@ typedef struct macCellDeleteReq typedef struct macCellDeleteRsp { uint16_t cellId; - CellDeleteStatus result; + CauseOfResult status; }MacCellDeleteRsp; typedef struct macSliceCfgRsp { Snssai snssai; MacRsp rsp; - RspReason cause; + CauseOfResult cause; }MacSliceCfgRsp; typedef struct rrmPolicyRatio @@ -1674,6 +1655,19 @@ typedef struct cellInfo typedef struct cellInfo CellStartInfo; typedef struct cellInfo CellStopInfo; +typedef struct ueReset +{ + uint16_t cellId; + uint8_t ueId; +}MacUeResetReq; + +typedef struct ueResetRsp +{ + uint16_t cellId; + uint8_t ueId; + CauseOfResult status; +}MacUeResetRsp; + /* Functions for CellUp Ind from MAC to DU APP*/ typedef uint8_t (*DuMacCellUpInd) ARGS(( Pst *pst, @@ -1806,6 +1800,16 @@ typedef uint8_t (*DuMacDlPcchInd) ARGS(( Pst *pst, DlPcchInd *pcchInd)); +/* UE Reset Request from DU APP to MAC*/ +typedef uint8_t (*DuMacUeResetReq) ARGS(( + Pst *pst, + MacUeResetReq *ueReset )); + +/* UE Reset Response from MAC to DU APP*/ +typedef uint8_t (*MacDuUeResetRspFunc) ARGS(( + Pst *pst, + MacUeResetRsp *resetRsp)); + uint64_t ueBitMapPerCell[MAX_NUM_CELL]; /* Bit Map to store used/free UE-IDX per Cell */ uint8_t packMacCellUpInd(Pst *pst, OduCellId *cellId); @@ -1886,6 +1890,13 @@ uint8_t MacProcDlPcchInd(Pst *pst, DlPcchInd *pcchInd); uint8_t unpackMacDlPcchInd(DuMacDlPcchInd func, Pst *pst, Buffer *mBuf); int8_t getFreeBitFromUeBitMap(uint16_t cellId); void unsetBitInUeBitMap(uint16_t cellId, uint8_t bitPos); +uint8_t packDuMacUeResetReq(Pst *pst, MacUeResetReq *ueReset); +uint8_t MacProcUeResetReq(Pst *pst, MacUeResetReq *ueReset); +uint8_t unpackMacUeResetReq(DuMacUeResetReq func, Pst *pst, Buffer *mBuf); +uint8_t packDuMacUeResetRsp(Pst *pst, MacUeResetRsp *resetRsp); +uint8_t DuProcMacUeResetRsp(Pst *pst, MacUeResetRsp *resetRsp); +uint8_t unpackDuMacUeResetRsp(MacDuUeResetRspFunc func, Pst *pst, Buffer *mBuf); + #endif diff --git a/src/cm/du_app_rlc_inf.h b/src/cm/du_app_rlc_inf.h index 62ea905b4..44687a41f 100644 --- a/src/cm/du_app_rlc_inf.h +++ b/src/cm/du_app_rlc_inf.h @@ -92,13 +92,6 @@ typedef enum RLC_CFG_REAS_INVALID_RGUSAP /*!< Invalid RGU SAP ID */ }FailureReason; -typedef enum -{ - SUCCESSFUL , /*!< No Failure */ - INVALID_CELLID , /*!< CellId not present */ - INVALID_UEID , /*!< UEId not present */ -}UeDeleteResult; - typedef enum { RLC_AM, //Acknowledged Mode @@ -235,7 +228,7 @@ typedef struct rlcUeDeleteRsp { uint16_t cellId; uint8_t ueId; - UeDeleteResult result; + CauseOfResult status; }RlcUeDeleteRsp; /* UL RRC Message from RLC to DU APP */ diff --git a/src/cm/mac_sch_interface.h b/src/cm/mac_sch_interface.h index fd9554b04..88b347e36 100644 --- a/src/cm/mac_sch_interface.h +++ b/src/cm/mac_sch_interface.h @@ -139,14 +139,6 @@ typedef enum RRC_CONNECTED_USERS_RSRC }SchResourceType; -typedef enum -{ - SLICE_NOT_FOUND, - SLICE_CONFIGURED, - SLICE_RECONFIGURED, - RESOURCE_NOT_AVAILABLE -}RspCause; - typedef enum { NO_TRANSMISSION, @@ -154,14 +146,6 @@ typedef enum REPEATITION }PduTxOccsaion; -typedef enum -{ - UNSPECIFIED_CAUSE, - INVALID_PARAM_VALUE, - RESOURCE_UNAVAILABLE, - SYSTEM_ERROR -}SchFailureCause; - typedef enum { SR_PROHIBIT_MS1, @@ -174,13 +158,6 @@ typedef enum SR_PROHIBIT_MS128 }SchSrProhibitTimer; -typedef enum -{ - NOT_APPLICABLE, - INVALID_CELLID, - INVALID_UEID -}ErrorCause; - typedef enum { SR_TRANS_MAX_N4, @@ -934,7 +911,7 @@ typedef struct schCellCfgCfm { uint16_t cellId; /* Cell Id */ SchMacRsp rsp; - SchFailureCause cause; + CauseOfResult cause; }SchCellCfgCfm; /*Ref: ORAN_WG8.V7.0.0 Sec 11.2.4.2.2 Cell Del Req*/ @@ -948,7 +925,7 @@ typedef struct schCellDeleteRsp { uint16_t cellId; SchMacRsp rsp; - SchFailureCause cause; + CauseOfResult cause; }SchCellDeleteRsp; /*Ref: ORAN_WG8.V7.0.0 Sec 11.2.4.2.3*/ @@ -976,7 +953,7 @@ typedef struct schSliceCfgRsp { Snssai snssai; SchMacRsp rsp; - RspCause cause; + CauseOfResult cause; }SchSliceCfgRsp; /*As per ORAN-WG8 V7.0.0 Sec 11.2.4.3.4 , Slice Cfg and Recfg are same structures*/ @@ -2037,7 +2014,7 @@ typedef struct schUeCfgRsp uint16_t ueId; uint16_t crnti; SchMacRsp rsp; - SchFailureCause cause; + CauseOfResult cause; }SchUeCfgRsp; /*As per WG8 V7.0.0 Sec 11.2.4.3.6, UE ReCFG and UECFG have same structure definition*/ @@ -2056,7 +2033,7 @@ typedef struct schUeDeleteRsp uint16_t cellId; uint16_t crnti; SchMacRsp rsp; - ErrorCause cause; + CauseOfResult cause; }SchUeDeleteRsp; /*Spec O-RAN, WG8, V7.0.0, '11.2.4.2.8' DL HARQ Indication*/ diff --git a/src/du_app/du_cell_mgr.c b/src/du_app/du_cell_mgr.c index 7af503fc8..191240fe6 100644 --- a/src/du_app/du_cell_mgr.c +++ b/src/du_app/du_cell_mgr.c @@ -400,7 +400,7 @@ uint8_t DuProcMacCellDeleteRsp(Pst *pst, MacCellDeleteRsp *deleteRsp) if(deleteRsp) { - if(deleteRsp->result == SUCCESSFUL_RSP) + if(deleteRsp->status == SUCCESSFUL) { GET_CELL_IDX(deleteRsp->cellId, cellIdx); DU_LOG("\nINFO --> DU APP : MAC CELL Delete Response : SUCCESS [CELL IDX : %d]", deleteRsp->cellId); diff --git a/src/du_app/du_mgr.h b/src/du_app/du_mgr.h index 4cf125567..0cdc00d69 100644 --- a/src/du_app/du_mgr.h +++ b/src/du_app/du_mgr.h @@ -80,7 +80,8 @@ typedef enum UE_INACTIVE, UE_ACTIVE, UE_HANDIN_IN_PROGRESS, - UE_DELETION_IN_PROGRESS + UE_DELETION_IN_PROGRESS, + UE_RESET_IN_PROGRESS }UeState; typedef enum diff --git a/src/du_app/du_mgr_msg_router.c b/src/du_app/du_mgr_msg_router.c index b5b5b49ae..7ab4a8c69 100644 --- a/src/du_app/du_mgr_msg_router.c +++ b/src/du_app/du_mgr_msg_router.c @@ -560,6 +560,11 @@ uint8_t duActvTsk(Pst *pst, Buffer *mBuf) ret = unpackDuMacRachRsrcRsp(DuProcMacRachRsrcRsp, pst, mBuf); break; } + case EVENT_MAC_UE_RESET_RSP: + { + ret = unpackDuMacUeResetRsp(DuProcMacUeResetRsp, pst, mBuf); + break; + } default: { DU_LOG("\nERROR --> DU_APP : Invalid event received at duActvTsk from ENTMAC"); diff --git a/src/du_app/du_ue_mgr.c b/src/du_app/du_ue_mgr.c index 974f6e6e8..e37ea0b45 100644 --- a/src/du_app/du_ue_mgr.c +++ b/src/du_app/du_ue_mgr.c @@ -116,6 +116,12 @@ DuRlcUeDeleteReq packRlcUeDeleteReqOpts[] = packDuRlcUeDeleteReq /* Light weight-loose coupling */ }; +DuMacUeResetReq packMacUeResetReqOpts[] = +{ + packDuMacUeResetReq, /* Loose coupling */ + MacProcUeResetReq, /* TIght coupling */ + packDuMacUeResetReq /* Light weight-loose coupling */ +}; /****************************************************************** * * @brief Function to return Drb LcId @@ -3674,7 +3680,7 @@ uint8_t DuProcMacUeDeleteRsp(Pst *pst, MacUeDeleteRsp *deleteRsp) if(deleteRsp) { - if(deleteRsp->result == DEL_SUCCESSFUL) + if(deleteRsp->status == SUCCESSFUL) { DU_LOG("\nINFO --> DU APP : MAC UE Delete Response : SUCCESS [UE IDX : %d]", deleteRsp->ueId); GET_CELL_IDX(deleteRsp->cellId, cellIdx); @@ -3739,7 +3745,7 @@ uint8_t DuProcRlcUeDeleteRsp(Pst *pst, RlcUeDeleteRsp *delRsp) ueId = delRsp->ueId; GET_CELL_IDX(delRsp->cellId, cellIdx); - if(delRsp->result == SUCCESSFUL) + if(delRsp->status == SUCCESSFUL) { DU_LOG("\nINFO --> DU_APP: RLC UE Delete Response : SUCCESS [UE IDX:%d]", ueId); if(duCb.actvCellLst[cellIdx]!=NULLP) @@ -4019,6 +4025,150 @@ uint8_t duProcUeContextReleaseCommand(uint16_t cellId, DuUeCb *duUeCb) return ret; } +/******************************************************************* + * + * @brief Sending UE Reset Req To Mac +* +* @details +* +* Function : sendUeResetReqToMac +* +* Functionality: +* sending UE Reset Req To Mac +* +* @params[in] cellId, ueId, crnti +* @return ROK - success +* RFAILED - failure +* +*****************************************************************/ + +uint8_t sendUeResetReqToMac(uint16_t cellId, uint8_t ueId) +{ + Pst pst; + uint8_t ret=ROK; + MacUeResetReq *ueReset = NULLP; + + DU_ALLOC_SHRABL_BUF(ueReset, sizeof(MacUeResetReq)); + if(ueReset) + { + ueReset->cellId = cellId; + ueReset->ueId = ueId; + FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_RESET_REQ); + + DU_LOG("\nDEBUG --> DU_APP: Sending UE Reset Request to MAC "); + ret = (*packMacUeResetReqOpts[pst.selector])(&pst, ueReset); + if(ret == RFAILED) + { + DU_LOG("\nERROR --> DU_APP: sendUeResetReqToMac(): Failed to send UE Reset Req to MAC"); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueReset, sizeof(MacUeResetReq)); + } + } + else + { + DU_LOG("\nERROR --> DU_APP: sendUeResetReqToMac(): Failed to allocate memory"); + ret = RFAILED; + } + return ret; +} + +/******************************************************************* + * + * @brief DU processes UE reset req and send it to MAC + * + * @details + * + * Function : duBuildAndSendUeResetReq + * + * Functionality: DU processes UE reset req and send to MAC + * + * + * @params[in] cellId, crnti + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t duBuildAndSendUeResetReq(uint16_t cellId, uint16_t crnti) +{ + uint8_t ueId =0; + uint16_t cellIdx = 0; + + DU_LOG("\nDEBUG --> DU_APP : Building UE reset request"); + GET_CELL_IDX(cellId, cellIdx); + GET_UE_ID(crnti, ueId); + + if(duCb.actvCellLst[cellIdx] != NULLP) + { + if(crnti != duCb.actvCellLst[cellIdx]->ueCb[ueId - 1].crnti) + { + DU_LOG("\nERROR --> DU APP : duBuildAndSendUeResetReq(): CRNTI [%d] not found", crnti); + return RFAILED; + } + + duCb.actvCellLst[cellIdx]->ueCb[ueId - 1].ueState = UE_RESET_IN_PROGRESS; + if(sendUeResetReqToMac(cellId, ueId) == RFAILED) + { + DU_LOG("\nERROR --> DU APP : DuProcMacUeResetRsp(): Failed to build UE reset req for MAC "); + return RFAILED; + } + } + else + { + DU_LOG("\nERROR --> DU APP : duBuildAndSendUeResetReq(): Cell Id %d not found", cellId); + return RFAILED; + } + + return ROK; +} + +/******************************************************************* +* +* @brief Handle UE reset response from MAC +* +* @details +* +* Function : DuProcMacUeResetRsp +* +* Functionality: Handle UE reset response from MAC +* +* @params[in] Pointer to MacUeResetRsp and Pst +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ + +uint8_t DuProcMacUeResetRsp(Pst *pst, MacUeResetRsp *resetRsp) +{ + uint8_t ret =ROK; + uint16_t cellIdx=0; + + if(resetRsp) + { + if(resetRsp->status == SUCCESSFUL) + { + DU_LOG("\nINFO --> DU APP : MAC UE Reset Response : SUCCESS [UE IDX : %d]", resetRsp->ueId); + GET_CELL_IDX(resetRsp->cellId, cellIdx); + if(duCb.actvCellLst[cellIdx]) + { + duCb.actvCellLst[cellIdx]->ueCb[resetRsp->ueId -1].duMacUeCfg.macUeCfgState = UE_RESET_COMPLETE; + /*TODO - Complete the processing after receiving successfully reset rsp*/ + } + } + else + { + DU_LOG("\nERROR --> DU APP : DuProcMacUeResetRsp(): MAC UE Reset Response : FAILURE [UE IDX : %d]",resetRsp->ueId); + ret = RFAILED; + } + DU_FREE_SHRABL_BUF(pst->region, pst->pool, resetRsp, sizeof(MacUeResetRsp)); + } + else + { + DU_LOG("\nERROR --> DU APP : DuProcMacUeResetRsp(): MAC UE Reset Response is null"); + ret = RFAILED; + } + return ret; +} + /********************************************************************** End of file ***********************************************************************/ -- 2.16.6