From: pborla Date: Tue, 7 Nov 2023 12:46:57 +0000 (+0530) Subject: [Epic-ID: ODUHIGH-516][Task-ID: ODUHIGH-532] RIC Subscription Delete Req/Rsp API... X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;ds=sidebyside;h=6dc8a4c17da24847b3a3aee91b37151f77a8a5bc;hp=02385cfbd5aa8844077a5054ce1912f6e4ce6471;p=o-du%2Fl2.git [Epic-ID: ODUHIGH-516][Task-ID: ODUHIGH-532] RIC Subscription Delete Req/Rsp API b/w DU Layers Change-Id: Icf7cef20740d2c094c3818e9cd014c582a9c6c5a Signed-off-by: pborla --- diff --git a/src/5gnrmac/mac.h b/src/5gnrmac/mac.h index a4dc3207e..5a1db5a00 100644 --- a/src/5gnrmac/mac.h +++ b/src/5gnrmac/mac.h @@ -302,6 +302,8 @@ uint8_t MacProcSchCellDeleteRsp(Pst *pst, SchCellDeleteRsp *schCellDeleteRsp); uint8_t MacProcSchStatsRsp(Pst *pst, SchStatsRsp *schStatsRsp); uint8_t MacProcSchStatsInd(Pst *pst, SchStatsInd *schStatsInd); +uint8_t MacProcSchStatsDeleteRsp(Pst *pst, SchStatsDeleteRsp *schStatsDeleteRsp); + #endif /********************************************************************** End of file diff --git a/src/5gnrmac/mac_cfg_hdl.c b/src/5gnrmac/mac_cfg_hdl.c index 0572fd781..3544c12db 100644 --- a/src/5gnrmac/mac_cfg_hdl.c +++ b/src/5gnrmac/mac_cfg_hdl.c @@ -70,6 +70,12 @@ MacDuStatsRspFunc macDuStatsRspOpts[] = packDuMacStatsRsp /* packing for light weight loosly coupled */ }; +MacDuStatsDeleteRspFunc macDuStatsDeleteRspOpts[] = +{ + packDuMacStatsDeleteRsp, /* packing for loosely coupled */ + DuProcMacStatsDeleteRsp, /* packing for tightly coupled */ + packDuMacStatsDeleteRsp /* packing for light weight loosly coupled */ +}; /** * @brief Layer Manager Configuration request handler for Scheduler @@ -1335,6 +1341,132 @@ uint8_t MacProcSchStatsRsp(Pst *pst, SchStatsRsp *schStatsRsp) return ret; } +/** + * @brief Fill and send statistics delete response to DU APP + * + * @details + * + * Function : MacSendStatsDeleteRspToDuApp + * + * Fill and send statistics delete response to DU APP + * + * @param[in] Response + * @param[in] Cause of response + * @return int + * -# ROK + **/ +uint8_t MacSendStatsDeleteRspToDuApp(uint64_t subscriptionId, MacRsp result, CauseOfResult status) +{ + uint8_t ret = ROK; + Pst pst; + MacStatsDeleteRsp *macStatsDeleteRsp = NULLP; + + DU_LOG("\nINFO --> MAC : MacSendStatsDeleteRspToDuApp: Sending Delete Statistics Response to DU APP"); + + MAC_ALLOC_SHRABL_BUF(macStatsDeleteRsp, sizeof(MacStatsDeleteRsp)); + if(macStatsDeleteRsp == NULLP) + { + DU_LOG("\nERROR --> MAC : Failed to allocate memory in MacSendStatsDeleteRspToDuApp"); + ret = RFAILED; + } + else + { + macStatsDeleteRsp->subscriptionId= subscriptionId; + macStatsDeleteRsp->result = result; + macStatsDeleteRsp->status = status; + memset(&pst, 0, sizeof(Pst)); + FILL_PST_MAC_TO_DUAPP(pst, EVENT_MAC_STATS_DELETE_RSP); + if(((*macDuStatsDeleteRspOpts[pst.selector])(&pst, macStatsDeleteRsp))!= ROK) + { + DU_LOG("\nERROR --> MAC : Failed to send statistics delete response to DU APP"); + MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, macStatsDeleteRsp, sizeof(MacStatsDeleteRsp)); + ret = RFAILED; + } + } + + return ret; +} + +/** + * @brief Mac process the statistics delete rsp received from sch. + * + * @details + * + * Function : MacProcSchStatsDeleteRsp + * + * This function process the statistics delete response received from sch + * + * @param[in] Pst *pst + * @param[in] SchStatsDeleteRsp *schStatsDeleteRsp + * @return int + * -# ROK + **/ +uint8_t MacProcSchStatsDeleteRsp(Pst *pst, SchStatsDeleteRsp *schStatsDeleteRsp) +{ + uint8_t ret = RFAILED; + + if(schStatsDeleteRsp) + { + if(schStatsDeleteRsp->rsp == RSP_OK) + ret = MacSendStatsDeleteRspToDuApp(schStatsDeleteRsp->subscriptionId,MAC_DU_APP_RSP_OK,schStatsDeleteRsp->cause); + else + ret = MacSendStatsDeleteRspToDuApp(schStatsDeleteRsp->subscriptionId,MAC_DU_APP_RSP_NOK,schStatsDeleteRsp->cause); + + } + MAC_FREE(schStatsDeleteRsp, sizeof(SchStatsDeleteRsp)); + return ret; +} + +/** + * @brief Mac process the statistics delete Req received from DUAPP + * + * @details + * + * Function : MacProcStatsDeleteReq + * + * Functionality: Process the statistics delete request from duapp + * @param[in] Pst *pst + * @param[in] StatsDeleteReq *statsReq + * @return int + * -# ROK + **/ + +uint8_t MacProcStatsDeleteReq(Pst *pst, MacStatsDeleteReq *macStatsDeleteReq) +{ + Pst schPst; + uint8_t ret = RFAILED; + SchStatsDeleteReq *schStatsDeleteReq = NULLP; + + DU_LOG("\nINFO --> MAC : Received Statistics delete Request from DU_APP"); + + if(macStatsDeleteReq == NULLP) + { + DU_LOG("\nERROR --> MAC : MacProcStatsDeleteReq(): Received Null pointer"); + return RFAILED; + } + + MAC_ALLOC(schStatsDeleteReq, sizeof(SchStatsDeleteReq)); + if(schStatsDeleteReq == NULLP) + { + DU_LOG("\nERROR --> MAC : MacProcStatsDeleteReq: Failed to allocate memory"); + } + else + { + schStatsDeleteReq->subscriptionId = macStatsDeleteReq->subscriptionId; + FILL_PST_MAC_TO_SCH(schPst, EVENT_STATISTICS_DELETE_REQ_TO_SCH); + ret = SchMessageRouter(&schPst, (void *)schStatsDeleteReq); + } + + if(ret != ROK) + { + MAC_FREE(schStatsDeleteReq, sizeof(SchStatsDeleteReq)); + ret = MacSendStatsDeleteRspToDuApp(macStatsDeleteReq->subscriptionId , MAC_DU_APP_RSP_NOK, RESOURCE_UNAVAILABLE); + } + + MAC_FREE_SHRABL_BUF(pst->region, pst->pool, macStatsDeleteReq, sizeof(MacStatsDeleteReq)); + return ret; +} + /********************************************************************** End of file **********************************************************************/ diff --git a/src/5gnrmac/mac_msg_router.c b/src/5gnrmac/mac_msg_router.c index 37f07ae6e..88c06893f 100755 --- a/src/5gnrmac/mac_msg_router.c +++ b/src/5gnrmac/mac_msg_router.c @@ -191,8 +191,17 @@ void MacHdlDuappEvents(Pst *pst, Buffer *mBuf) { /* Process Statistics Request */ unpackMacStatsReq(MacProcStatsReq, pst, mBuf); + break; + } + + case EVENT_MAC_STATS_DELETE_REQ: + { + /* Process Statistics Delete Request */ + unpackMacStatsDeleteReq(MacProcStatsDeleteReq, pst, mBuf); + break; } + default: RG_FREE_MSG(mBuf); break; @@ -346,6 +355,9 @@ void callFlowMacActvTsk(Pst *pst) case EVENT_MAC_STATISTICS_REQ: strcpy(message,"EVENT_MAC_STATISTICS_REQ"); break; + case EVENT_MAC_STATS_DELETE_REQ: + strcpy(message,"EVENT_MAC_STATS_DELETE_REQ"); + break; default: strcpy(message,"Invalid Event"); break; @@ -485,6 +497,11 @@ void callFlowMacActvTsk(Pst *pst) strcpy(message,"EVENT_STATISTICS_IND_TO_MAC"); break; } + case EVENT_STATISTICS_DELETE_RSP_TO_MAC: + { + strcpy(message,"EVENT_STATISTICS_DELETE_RSP_TO_MAC"); + break; + } default: strcpy(message,"Invalid Event"); break; @@ -639,6 +656,11 @@ uint8_t MacMessageRouter(Pst *pst, void *msg) MacProcSchStatsInd(pst, (SchStatsInd *)msg); break; } + case EVENT_STATISTICS_DELETE_RSP_TO_MAC: + { + MacProcSchStatsDeleteRsp(pst, (SchStatsDeleteRsp *)msg); + break; + } default: { return RFAILED; diff --git a/src/5gnrsch/sch.c b/src/5gnrsch/sch.c index 9017f924d..ace885ea1 100644 --- a/src/5gnrsch/sch.c +++ b/src/5gnrsch/sch.c @@ -2945,6 +2945,153 @@ uint8_t schCalcAndSendGrpStats(SchStatsGrp *grpInfo) return SchSendStatsIndToMac(grpInfo->schInst, &statsInd); } +/******************************************************************* + * + * @brief Fill and send Statistics Delete Response to MAC + * + * @details + * + * Function : SchSendStatsDeleteRspToMac + * + * Functionality: Fill and send Statistics Delete Response to MAC + * + * @params[in] + * Statistics Delete Request from MAC + * Statistics Delete result + * Cause of response + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t SchSendStatsDeleteRspToMac(SchStatsDeleteReq *statsDeleteReq, SchMacRsp rsp, CauseOfResult cause) +{ + Pst rspPst; + uint8_t ret = ROK; + SchStatsDeleteRsp *schStatsDeleteRsp; + + DU_LOG("\nINFO --> SCH : Filling Statistics Delete Response"); + SCH_ALLOC(schStatsDeleteRsp, sizeof(SchStatsDeleteRsp)); + if(schStatsDeleteRsp == NULLP) + { + DU_LOG("\nERROR --> SCH : Failed to allocate memory in SchSendStatsDeleteRspToMac()"); + return RFAILED; + } + + schStatsDeleteRsp->subscriptionId=statsDeleteReq->subscriptionId; + schStatsDeleteRsp->rsp=rsp; + schStatsDeleteRsp->cause=cause; + /* Filling response post */ + memset(&rspPst, 0, sizeof(Pst)); + FILL_PST_SCH_TO_MAC(rspPst, inst); + rspPst.event = EVENT_STATISTICS_DELETE_RSP_TO_MAC; + + ret = MacMessageRouter(&rspPst, (void *)schStatsDeleteRsp); + if(ret == RFAILED) + { + DU_LOG("\nERROR --> SCH : SchSendStatsDeleteRspToMac(): Failed to send Statistics Response"); + return ret; + } + return ret; +} + +/******************************************************************* + * + * @brief Delete statistics information + * + * @details + * + * Function : deleteStatsInfo + * + * Functionality: + * Delete statistics information + * + * @params[in] + * Instance + * Subscription id + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t deleteStatsInfo(Inst inst, uint64_t subscriptionId) +{ + bool statsFound=false; + uint8_t idx=0, statsGrpIdx=0; + SchStatsGrp *statsGrpInfo=NULLP; + + if(schCb[inst].statistics.numOfStatsCfgd) + { + for(idx=0;idxsubscriptionId ==subscriptionId) + { + SCH_FREE(statsGrpInfo->kpiStats.dlTotalPrbUsage, sizeof(TotalPrbUsage)); + SCH_FREE(statsGrpInfo->kpiStats.ulTotalPrbUsage, sizeof(TotalPrbUsage)); + if(schChkTmr((PTR)statsGrpInfo, EVENT_STATISTICS_TMR) == true) + { + schStopTmr(&schCb[inst], (PTR)statsGrpInfo, EVENT_STATISTICS_TMR); + } + memset(statsGrpInfo, 0, sizeof(SchStatsGrp)); + statsFound = true; + } + } + } + } + + if(statsFound ==false) + { + DU_LOG("\nERROR --> SCH : SchProcStatsDeleteReq(): Statistics information is not present"); + return RFAILED; + } + return ROK; +} + +/******************************************************************* + * + * @brief Processes Statistics Delete Request from MAC + * + * @details + * + * Function : SchProcStatsDeleteReq + * + * Functionality: + * This function process the statistics delete request from MAC: + * + * @params[in] Post structure + * Statistics Delete Request from MAC + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t SchProcStatsDeleteReq(Pst *pst, SchStatsDeleteReq *statsDeleteReq) +{ + uint8_t ret =ROK; + Inst inst = pst->dstInst - SCH_INST_START; + + DU_LOG("\nINFO --> SCH : Received Statistics Delete Request from MAC"); + + if(statsDeleteReq == NULLP) + { + DU_LOG("\nERROR --> SCH : SchProcStatsDeleteReq(): Received Null pointer"); + return RFAILED; + } + + ret = deleteStatsInfo(inst, statsDeleteReq->subscriptionId); + if(ret == ROK) + { + SchSendStatsDeleteRspToMac(statsDeleteReq, RSP_OK, SUCCESSFUL); + } + else + { + SchSendStatsDeleteRspToMac(statsDeleteReq, RSP_NOK, STATS_ID_NOT_FOUND); + } + SCH_FREE(statsDeleteReq, sizeof(SchStatsDeleteReq)); + + return ret; +} /* End of SchProcStatsDeleteReq */ + /********************************************************************** End of file **********************************************************************/ diff --git a/src/5gnrsch/sch.h b/src/5gnrsch/sch.h index 4a82d1786..5a7a39695 100644 --- a/src/5gnrsch/sch.h +++ b/src/5gnrsch/sch.h @@ -824,7 +824,7 @@ void schMsg4Complete(SchUeCb *ueCb); uint8_t SchProcStatsReq(Pst *pst, SchStatsReq *statsReq); uint8_t SchSendStatsIndToMac(Inst inst, SchStatsInd *statsInd); uint8_t schCalcAndSendGrpStats(SchStatsGrp *grpInfo); - +uint8_t SchProcStatsDeleteReq(Pst *pst, SchStatsDeleteReq *statsDeleteReq); /********************************************************************** End of file **********************************************************************/ diff --git a/src/5gnrsch/sch_msg_router.c b/src/5gnrsch/sch_msg_router.c index ca15f65b8..bad7ceac0 100755 --- a/src/5gnrsch/sch_msg_router.c +++ b/src/5gnrsch/sch_msg_router.c @@ -249,6 +249,11 @@ void callFlowSchMsgRouter(Pst *pst) strcpy(message,"EVENT_STATISTICS_REQ_TO_SCH"); break; } + case EVENT_STATISTICS_DELETE_REQ_TO_SCH: + { + strcpy(message,"EVENT_STATISTICS_DELETE_REQ_TO_SCH"); + break; + } default: strcpy(message,"Invalid Event"); break; @@ -376,6 +381,11 @@ uint8_t SchMessageRouter(Pst *pst, void *msg) SchProcStatsReq(pst, (SchStatsReq *)msg); break; } + case EVENT_STATISTICS_DELETE_REQ_TO_SCH: + { + SchProcStatsDeleteReq(pst, (SchStatsDeleteReq *)msg); + break; + } default: { DU_LOG("\nERROR --> SCH : SchMessageRouter(): Invalid event [%d] received", pst->event); diff --git a/src/cm/common_def.h b/src/cm/common_def.h index cbe952c27..9e7bef4cb 100644 --- a/src/cm/common_def.h +++ b/src/cm/common_def.h @@ -263,7 +263,8 @@ typedef enum RESOURCE_UNAVAILABLE, SLICE_NOT_FOUND, DUPLICATE_ENTRY, - PARAM_INVALID + PARAM_INVALID, + STATS_ID_NOT_FOUND }CauseOfResult ; typedef enum diff --git a/src/cm/du_app_mac_inf.c b/src/cm/du_app_mac_inf.c index 52ea9dc02..4886061bb 100644 --- a/src/cm/du_app_mac_inf.c +++ b/src/cm/du_app_mac_inf.c @@ -2555,6 +2555,164 @@ uint8_t unpackDuMacStatsInd(MacDuStatsIndFunc func, Pst *pst, Buffer *mBuf) return RFAILED; } +/******************************************************************* +* +* @brief Packs and Sends Statistics Delete Request from DUAPP to MAC +* +* @details +* +* Function : packDuMacStatsDeleteReq +* +* Functionality: +* Packs and Sends statistics Delete Request from DUAPP to MAC +* +* +* @params[in] Post structure pointer +* StatsDeleteReq pointer +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +uint8_t packDuMacStatsDeleteReq(Pst *pst, MacStatsDeleteReq *statsDeleteReq) +{ + 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 packDuMacStatsDeleteReq"); + return RFAILED; + } + /* pack the address of the structure */ + CMCHKPK(oduPackPointer,(PTR)statsDeleteReq, mBuf); + } + else + { + DU_LOG("\nERROR --> MAC: Only LWLC supported for packDuMacStatsDeleteReq"); + return RFAILED; + } + return ODU_POST_TASK(pst,mBuf); +} + +/******************************************************************* +* +* @brief Unpacks Statistics Delete Request received from DU APP +* +* @details +* +* Function : unpackMacStatsDeleteReq +* +* Functionality: +* Unpacks Statistics Delete Request received from DU APP +* +* @params[in] Pointer to Handler +* Post structure pointer +* Message Buffer +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +uint8_t unpackMacStatsDeleteReq(DuMacStatsDeleteReqFunc func, Pst *pst, Buffer *mBuf) +{ + if(pst->selector == ODU_SELECTOR_LWLC) + { + MacStatsDeleteReq *statsDeleteReq; + + /* unpack the address of the structure */ + CMCHKUNPK(oduUnpackPointer, (PTR *)&statsDeleteReq, mBuf); + ODU_PUT_MSG_BUF(mBuf); + return (*func)(pst, statsDeleteReq); + } + else + { + /* Nothing to do for other selectors */ + DU_LOG("\nERROR --> DU APP : Only LWLC supported for Statistics Delete Request "); + ODU_PUT_MSG_BUF(mBuf); + } + + return RFAILED; +} + +/******************************************************************* +* +* @brief Packs and Sends Statistics Delete Response from MAC to DUAPP +* +* @details +* +* Function : packDuMacStatsDeleteRsp +* +* Functionality: +* Packs and Sends Statistics Delete Response from MAC to DUAPP +* +* +* @params[in] Post structure pointer +* StatsDeleteRsp pointer +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +uint8_t packDuMacStatsDeleteRsp(Pst *pst, MacStatsDeleteRsp *statsRsp) +{ + 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 packDuMacStatsDeleteRsp"); + return RFAILED; + } + /* pack the address of the structure */ + CMCHKPK(oduPackPointer,(PTR)statsRsp, mBuf); + } + else + { + DU_LOG("\nERROR --> MAC: Only LWLC supported for packDuMacStatsDeleteRsp"); + return RFAILED; + } + return ODU_POST_TASK(pst,mBuf); +} + +/******************************************************************* +* +* @brief Unpacks Statistics Delete Response received from MAC +* +* @details +* +* Function : unpackDuMacStatsDeleteRsp +* +* Functionality: +* Unpacks Statistics Delete Response received from MAC +* +* @params[in] Pointer to Handler +* Post structure pointer +* Message Buffer +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +uint8_t unpackDuMacStatsDeleteRsp(MacDuStatsDeleteRspFunc func, Pst *pst, Buffer *mBuf) +{ + if(pst->selector == ODU_SELECTOR_LWLC) + { + MacStatsDeleteRsp *statsRsp; + + /* unpack the address of the structure */ + CMCHKUNPK(oduUnpackPointer, (PTR *)&statsRsp, mBuf); + ODU_PUT_MSG_BUF(mBuf); + return (*func)(pst, statsRsp); + } + else + { + /* Nothing to do for other selectors */ + DU_LOG("\nERROR --> DU APP : Only LWLC supported for Statistics Delete Response "); + ODU_PUT_MSG_BUF(mBuf); + } + + return RFAILED; +} + /********************************************************************** End of file **********************************************************************/ diff --git a/src/cm/du_app_mac_inf.h b/src/cm/du_app_mac_inf.h index 351471460..30a11a300 100644 --- a/src/cm/du_app_mac_inf.h +++ b/src/cm/du_app_mac_inf.h @@ -92,6 +92,8 @@ #define EVENT_MAC_STATISTICS_REQ 229 #define EVENT_MAC_STATISTICS_RSP 230 #define EVENT_MAC_STATISTICS_IND 231 +#define EVENT_MAC_STATS_DELETE_REQ 232 +#define EVENT_MAC_STATS_DELETE_RSP 233 #define BSR_PERIODIC_TIMER_SF_10 10 #define BSR_RETX_TIMER_SF_320 320 @@ -1899,6 +1901,18 @@ typedef struct macStatsInd MacStats measuredStatsList[MAX_NUM_STATS]; }MacStatsInd; +typedef struct macStatsDeleteReq +{ + uint64_t subscriptionId; +}MacStatsDeleteReq; + +typedef struct macStatsDeleteRsp +{ + uint64_t subscriptionId; + MacRsp result; + CauseOfResult status; +}MacStatsDeleteRsp; + /****************** FUNCTION POINTERS ********************************/ /* DL broadcast req from DU APP to MAC*/ @@ -2068,6 +2082,16 @@ typedef uint8_t (*MacDuStatsIndFunc) ARGS(( Pst *pst, MacStatsInd *statsInd)); +/* Statitics Delete Request from DU APP to MAC */ +typedef uint8_t (*DuMacStatsDeleteReqFunc) ARGS(( + Pst *pst, + MacStatsDeleteReq *statsDeleteReq)); + +/* Statistics Delete Response from MAC to DU APP */ +typedef uint8_t (*MacDuStatsDeleteRspFunc) ARGS(( + Pst *pst, + MacStatsDeleteRsp *statsDeleteRsp)); + /******************** FUNCTION DECLARATIONS ********************************/ uint8_t packMacCellUpInd(Pst *pst, OduCellId *cellId); uint8_t unpackMacCellUpInd(DuMacCellUpInd func, Pst *pst, Buffer *mBuf); @@ -2200,6 +2224,15 @@ uint8_t unpackDuMacStatsRsp(MacDuStatsRspFunc func, Pst *pst, Buffer *mBuf); uint8_t packDuMacStatsInd(Pst *pst, MacStatsInd *statsRsp); uint8_t DuProcMacStatsInd(Pst *pst, MacStatsInd *statsRsp); uint8_t unpackDuMacStatsInd(MacDuStatsIndFunc func, Pst *pst, Buffer *mBuf); + +uint8_t packDuMacStatsDeleteReq(Pst *pst, MacStatsDeleteReq *statsDeleteReq); +uint8_t MacProcStatsDeleteReq(Pst *pst, MacStatsDeleteReq *statsDeleteReq); +uint8_t unpackMacStatsDeleteReq(DuMacStatsDeleteReqFunc func, Pst *pst, Buffer *mBuf); + +uint8_t packDuMacStatsDeleteRsp(Pst *pst, MacStatsDeleteRsp *statsDeleteRsp); +uint8_t DuProcMacStatsDeleteRsp(Pst *pst, MacStatsDeleteRsp *statsDeleteRsp); +uint8_t unpackDuMacStatsDeleteRsp(MacDuStatsDeleteRspFunc func, Pst *pst, Buffer *mBuf); + #endif diff --git a/src/cm/mac_sch_interface.h b/src/cm/mac_sch_interface.h index adb77f026..941ad4a77 100644 --- a/src/cm/mac_sch_interface.h +++ b/src/cm/mac_sch_interface.h @@ -54,6 +54,8 @@ #define EVENT_STATISTICS_REQ_TO_SCH 35 #define EVENT_STATISTICS_RSP_TO_MAC 36 #define EVENT_STATISTICS_IND_TO_MAC 37 +#define EVENT_STATISTICS_DELETE_REQ_TO_SCH 38 +#define EVENT_STATISTICS_DELETE_RSP_TO_MAC 39 /*macros*/ #define MAX_SSB_IDX 1 /* forcing it as 1 for now. Right value is 64 */ @@ -2292,6 +2294,17 @@ typedef struct schStatsInd SchStats measuredStatsList[MAX_NUM_STATS]; }SchStatsInd; +typedef struct schStatsDeleteReq +{ + uint64_t subscriptionId; +}SchStatsDeleteReq; + +typedef struct schStatsDeleteRsp +{ + uint64_t subscriptionId; + SchMacRsp rsp; + CauseOfResult cause; +}SchStatsDeleteRsp; /* function declarations */ uint8_t MacMessageRouter(Pst *pst, void *msg); diff --git a/src/du_app/du_e2ap_mgr.c b/src/du_app/du_e2ap_mgr.c index 0956f9599..ed0d8187c 100644 --- a/src/du_app/du_e2ap_mgr.c +++ b/src/du_app/du_e2ap_mgr.c @@ -1465,6 +1465,56 @@ void removeE2NodeInformation() memset(&duCb.e2apDb.tnlAssoc, 0, MAX_TNL_ASSOCIATION*sizeof(TNLAssociation)); memset(&ricParams, 0, sizeof(DuSctpDestCb)); } + +/******************************************************************* + * + * @brief Extract statistics received from DU layers and delete + * Ric subscription info + * + * @details + * + * Function :e2ProcStatsDeleteRsp + * + * Functionality: Extract statistics received from DU layers + * and delete ric subscription iformation form db + * + * @params[in] Statistics delete rsp from MAC + * @return ROK-success + * RFAILED-failure + * + * ****************************************************************/ +uint8_t e2ProcStatsDeleteRsp(MacStatsDeleteRsp *statsDeleteRsp) +{ + RanFunction *ranFuncDb = NULLP; + CmLList *ricSubscriptionNode = NULLP; + RicSubscription *ricSubscriptionInfo = NULLP; + E2FailureCause failureCause; + + /* Fetch RAN Function and Subscription DB using subscription Id received + * in statistics delete response */ + if(fetchSubsInfoFromSubsId(statsDeleteRsp->subscriptionId, &ranFuncDb, &ricSubscriptionNode, &ricSubscriptionInfo) != ROK) + { + DU_LOG("\nERROR --> E2AP : extractStatsMeasurement: Failed to fetch subscriprtion details"); + return RFAILED; + } + + deleteRicSubscriptionNode(ricSubscriptionNode); +#if 0 + /* TODO */ + if(statsDeleteRsp->result == MAC_DU_APP_RSP_NOK && statsDeleteRsp->status == STATS_ID_NOT_FOUND) + { + failureCause->causeType =E2_RIC_REQUEST; + failureCause->cause = E2_REQUEST_INFORMATION_UNAVAILABLE; + BuildAndSendRicSubscriptionDeleteFailure(ricSubscriptionInfo->ranFuncId, ricSubscriptionInfo->requestId, failureCause); + } + else + { + BuildAndSendRicSubscriptionDeleteResponse(ricSubscriptionInfo->ranFuncId, ricSubscriptionInfo->requestId); + } +#endif + return ROK; +} + /********************************************************************** End of file **********************************************************************/ diff --git a/src/du_app/du_e2ap_mgr.h b/src/du_app/du_e2ap_mgr.h index e2ef11759..471f92121 100644 --- a/src/du_app/du_e2ap_mgr.h +++ b/src/du_app/du_e2ap_mgr.h @@ -533,6 +533,9 @@ void deleteMeasurementInfoList(CmLListCp *measInfoList); void deleteActionSequence(ActionInfo *action); void deleteMeasuredValueList(CmLListCp *measuredValueList); void removeE2NodeInformation(); +void encodeSubscriptionId(uint64_t *subscriptionId, uint16_t ranFuncId, RicRequestId ricReqId); +uint8_t e2ProcStatsDeleteRsp(MacStatsDeleteRsp *statsDeleteRsp); + /********************************************************************** End of file **********************************************************************/ diff --git a/src/du_app/du_e2ap_msg_hdl.c b/src/du_app/du_e2ap_msg_hdl.c index cb805f94b..7660a541e 100644 --- a/src/du_app/du_e2ap_msg_hdl.c +++ b/src/du_app/du_e2ap_msg_hdl.c @@ -7640,7 +7640,10 @@ void procRicSubscriptionDeleteRequest(E2AP_PDU_t *e2apMsg) break; } - //TODO : Send statistics delete request to MAC + if(BuildAndSendStatsDeleteReq(ricSubsDb) != ROK) + { + DU_LOG("\nERROR --> E2AP : Failed to build and send ric subscription delete req to du layers"); + } break; } diff --git a/src/du_app/du_mgr_msg_router.c b/src/du_app/du_mgr_msg_router.c index 5acda22e9..a1112d051 100644 --- a/src/du_app/du_mgr_msg_router.c +++ b/src/du_app/du_mgr_msg_router.c @@ -297,6 +297,11 @@ void callFlowduActvTsk(Pst *pst) strcpy(message,"EVENT_MAC_STATISTICS_IND"); break; } + case EVENT_MAC_STATS_DELETE_RSP: + { + strcpy(message,"EVENT_MAC_STATS_DELETE_RSP"); + break; + } default: { strcpy(message,"Invalid Event"); @@ -602,6 +607,11 @@ uint8_t duActvTsk(Pst *pst, Buffer *mBuf) ret = unpackDuMacStatsInd(DuProcMacStatsInd, pst, mBuf); break; } + case EVENT_MAC_STATS_DELETE_RSP: + { + ret = unpackDuMacStatsDeleteRsp(DuProcMacStatsDeleteRsp, pst, mBuf); + break; + } default: { DU_LOG("\nERROR --> DU_APP : Invalid event received at duActvTsk from ENTMAC"); diff --git a/src/du_app/du_msg_hdl.c b/src/du_app/du_msg_hdl.c index a99b7dbc8..07524c2c9 100644 --- a/src/du_app/du_msg_hdl.c +++ b/src/du_app/du_msg_hdl.c @@ -66,6 +66,7 @@ uint8_t BuildAndSendDUConfigUpdate(); uint16_t getTransId(); uint8_t cmPkLrgSchCfgReq(Pst * pst,RgMngmt * cfg); uint8_t sendCellDeleteReqToMac(uint16_t cellId); +uint8_t BuildAndSendStatsDeleteReq(RicSubscription *ricSubscriptionInfo); packMacCellCfgReq packMacCellCfgOpts[] = { @@ -110,6 +111,13 @@ DuMacStatsReqFunc packMacStatsReqOpts[]= packDuMacStatsReq /* Light weight-loose coupling */ }; +DuMacStatsDeleteReqFunc packMacStatsDeleteReqOpts[]= +{ + packDuMacStatsDeleteReq, /* Loose Coupling */ + MacProcStatsDeleteReq, /* Tight Coupling */ + packDuMacStatsDeleteReq /* Light weight-loose coupling */ +}; + /************************************************************************** * @brief Function to fill configs required by RLC * @@ -2272,6 +2280,119 @@ uint8_t DuProcMacStatsInd(Pst *pst, MacStatsInd *statsInd) return ret; } +/******************************************************************* + * + * @brief Process statistics delete response from MAC + * + * @details + * + * Function : DuProcMacStatsDeleteRsp + * + * Functionality: Processes statistics delete response + * from MAC. + + * @params[in] + * Pst Information + * Mac stats delete rsp + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t DuProcMacStatsDeleteRsp(Pst *pst, MacStatsDeleteRsp *statsDeleteRsp) +{ + uint8_t ret = RFAILED; + DU_LOG("\nINFO --> DU_APP : DuProcMacStatsDeleteRsp: Received Statistics Response from MAC"); + + if(statsDeleteRsp) + { + if((ret = e2ProcStatsDeleteRsp(statsDeleteRsp)) != ROK) + { + DU_LOG("\nINFO --> DU_APP : Failed in %s at line %d", __func__, __LINE__); + } + DU_FREE_SHRABL_BUF(pst->region, pst->pool, statsDeleteRsp, sizeof(MacStatsDeleteRsp)); + } + else + { + DU_LOG("\nERROR --> DU_APP : DuProcMacStatsDeleteRsp: Received NULL Pointer"); + } + return ret; +} + +/******************************************************************* + * + * @brief Send Statistics delete req to MAC + * + * @details + * + * Function : BuildAndSendStatsDeleteReqToMac() + * + * Functionality: Send Statistics delete req To Mac + * + * @params[in] + * Subscription Info + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t BuildAndSendStatsDeleteReqToMac(RicSubscription *ricSubscriptionInfo) +{ + Pst pst; + MacStatsDeleteReq *macStatsDelete = NULLP; + + /* Fill MAC statistics delete */ + DU_ALLOC_SHRABL_BUF(macStatsDelete, sizeof(MacStatsDeleteReq)); + if(macStatsDelete == NULLP) + { + DU_LOG("\nERROR --> DU_APP : Memory allocation failed for macStatsDelete in BuildAndSendStatsDeleteReqToMac"); + return RFAILED; + } + + /* Generate subscription ID using RIC Request ID and RAN Function ID */ + encodeSubscriptionId(&macStatsDelete->subscriptionId, ricSubscriptionInfo->ranFuncId, ricSubscriptionInfo->requestId); + + DU_LOG("\nDEBUG --> DU_APP: Sending Statistics delete req to MAC "); + FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_STATS_DELETE_REQ); + + if( (*packMacStatsDeleteReqOpts[pst.selector])(&pst, macStatsDelete) != ROK) + { + DU_LOG("\nERROR --> DU_APP: Failed to send Statistics delete req to MAC"); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macStatsDelete, sizeof(MacStatsDeleteReq)); + return RFAILED; + } + + return ROK; +} + + +/******************************************************************* + * + * @brief Statistics delete to DU layers + * + * @details + * + * Function : BuildAndSendStatsDeleteReq() + * + * Functionality: Statistics delete to DU layers + * + * @params[in] Subscription Info + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t BuildAndSendStatsDeleteReq(RicSubscription *ricSubscriptionInfo) +{ + /* Build and sent subscription information to MAC in Statistics delete */ + if(BuildAndSendStatsDeleteReqToMac(ricSubscriptionInfo) != ROK) + { + DU_LOG("\nERROR --> DU_APP : Failed at BuildAndSendStatsDeleteReqToMac()"); + return RFAILED; + } + return ROK; +} + /********************************************************************** End of file **********************************************************************/ diff --git a/src/ric_stub/ric_e2ap_msg_hdl.h b/src/ric_stub/ric_e2ap_msg_hdl.h index 6c230e9b1..47ab8d75e 100644 --- a/src/ric_stub/ric_e2ap_msg_hdl.h +++ b/src/ric_stub/ric_e2ap_msg_hdl.h @@ -65,6 +65,7 @@ uint8_t handleE2NodeComponentAction(DuDb *duDb, PTR e2NodeCfg, uint8_t protocolI uint8_t BuildAndSendE2NodeConfigUpdateAck(DuDb *duDb, uint8_t transId, E2NodeConfigList *e2NodeList); uint8_t BuildAndSendConnectionUpdate(uint32_t duId); uint8_t BuildAndSendE2ConnectionUpdate(uint32_t duId, E2Connection connectionInfo); +uint8_t BuildAndSendRicSubscriptionDeleteRequest(uint32_t duId, RicSubscription *ricSubsDb); /********************************************************************** End of file **********************************************************************/