From 38ebacef5994ffe0d94bd0d9d9b1f306f6417110 Mon Sep 17 00:00:00 2001 From: pborla Date: Fri, 24 Nov 2023 01:08:09 +0530 Subject: [PATCH] [Epic-ID: ODUHIGH-516][Task-ID: ODUHIGH-530] Handling of Ric action deletion Change-Id: Id6f08799c2c68eca82245caa858f4f40c8770f7b Signed-off-by: pborla --- src/5gnrmac/mac_cfg_hdl.c | 109 ++++++++--- src/5gnrsch/sch.c | 451 ++++++++++++++++++++++++++++----------------- src/5gnrsch/sch.h | 9 +- src/cm/du_app_mac_inf.h | 19 +- src/cm/mac_sch_interface.h | 17 +- src/du_app/du_e2ap_mgr.c | 13 +- src/du_app/du_mgr_main.c | 14 +- src/du_app/du_msg_hdl.c | 44 ++++- 8 files changed, 450 insertions(+), 226 deletions(-) diff --git a/src/5gnrmac/mac_cfg_hdl.c b/src/5gnrmac/mac_cfg_hdl.c index 3544c12db..c682a66a8 100644 --- a/src/5gnrmac/mac_cfg_hdl.c +++ b/src/5gnrmac/mac_cfg_hdl.c @@ -1349,39 +1349,98 @@ uint8_t MacProcSchStatsRsp(Pst *pst, SchStatsRsp *schStatsRsp) * Function : MacSendStatsDeleteRspToDuApp * * Fill and send statistics delete response to DU APP - * - * @param[in] Response - * @param[in] Cause of response + * [Step-1] In SCH delete response is received, fill MAC stats delete + * response with info from SCH stats delete response. + * [Step-2] If a failure occurs while processing MAC stats delete request, + * then fill MAC stats delete rsp with failure using info from MAC stats delete request. + * [Step-3] Else if numStatsGroup > 0, then send stats delete response + * with deletion status of each stats group. + * [Step-4] If numStatsGroup = 0, send Stats delete response + * for deletion of complete subscription. + * + * @param[in] SchStatsDeleteRsp + * @param[in] MacStatsDeleteReq * @return int * -# ROK **/ -uint8_t MacSendStatsDeleteRspToDuApp(uint64_t subscriptionId, MacRsp result, CauseOfResult status) +uint8_t MacSendStatsDeleteRspToDuApp(SchStatsDeleteRsp *schStatsDeleteRsp, MacStatsDeleteReq *macStatsDeleteReq) { - uint8_t ret = ROK; Pst pst; - MacStatsDeleteRsp *macStatsDeleteRsp = NULLP; - - DU_LOG("\nINFO --> MAC : MacSendStatsDeleteRspToDuApp: Sending Delete Statistics Response to DU APP"); + uint8_t ret = ROK, idx=0; + MacStatsDeleteRsp *macStatsDeleteRsp=NULLP; MAC_ALLOC_SHRABL_BUF(macStatsDeleteRsp, sizeof(MacStatsDeleteRsp)); if(macStatsDeleteRsp == NULLP) { - DU_LOG("\nERROR --> MAC : Failed to allocate memory in MacSendStatsDeleteRspToDuApp"); + DU_LOG("\nERROR --> MAC : Failed to allocate memory in MacProcSchStatsDeleteRsp"); ret = RFAILED; } + + if(schStatsDeleteRsp) + { + /* [Step-1] */ + macStatsDeleteRsp->subscriptionId = schStatsDeleteRsp->subscriptionId; + macStatsDeleteRsp->numStatsGroupDeleted = schStatsDeleteRsp->numStatsGroupDeleted; + + if(macStatsDeleteRsp->numStatsGroupDeleted) + { + /* [Step-3] */ + for(idx =0;idxnumStatsGroupDeleted; idx++) + { + if(schStatsDeleteRsp->statsGrpDelInfo[idx].statsGrpDelRsp == RSP_OK) + { + macStatsDeleteRsp->statsGrpDelInfo[idx].statsGrpDelRsp =MAC_DU_APP_RSP_OK; + macStatsDeleteRsp->statsGrpDelInfo[idx].statsGrpDelCause =schStatsDeleteRsp->statsGrpDelInfo[idx].statsGrpDelCause; + } + else + { + macStatsDeleteRsp->statsGrpDelInfo[idx].statsGrpDelRsp =MAC_DU_APP_RSP_NOK; + macStatsDeleteRsp->statsGrpDelInfo[idx].statsGrpDelCause =schStatsDeleteRsp->statsGrpDelInfo[idx].statsGrpDelCause; + } + } + } + else + { + /* [Step-4] */ + if(schStatsDeleteRsp->subsDelRsp == RSP_OK) + macStatsDeleteRsp->subsDelRsp = MAC_DU_APP_RSP_OK; + else + macStatsDeleteRsp->subsDelRsp = MAC_DU_APP_RSP_NOK; + macStatsDeleteRsp->subsDelCause = schStatsDeleteRsp->subsDelCause; + } + } 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) + /* [Step-2] */ + macStatsDeleteRsp->subscriptionId = macStatsDeleteReq->subscriptionId; + macStatsDeleteRsp->numStatsGroupDeleted= macStatsDeleteReq->numStatsGroupToBeDeleted; + + if(macStatsDeleteRsp->numStatsGroupDeleted) { - 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; + /* [Step-3] */ + for(idx =0;idxnumStatsGroupDeleted; idx++) + { + macStatsDeleteRsp->statsGrpDelInfo[idx].statsGrpDelRsp =MAC_DU_APP_RSP_NOK; + macStatsDeleteRsp->statsGrpDelInfo[idx].statsGrpDelCause = RESOURCE_UNAVAILABLE; + } } + else + { + /* [Step-4] */ + macStatsDeleteRsp->subsDelRsp = MAC_DU_APP_RSP_NOK; + macStatsDeleteRsp->subsDelCause = RESOURCE_UNAVAILABLE; + } + } + + DU_LOG("\nINFO --> MAC : MacSendStatsDeleteRspToDuApp: Sending Delete Statistics Response to DU APP"); + + 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; @@ -1407,13 +1466,9 @@ uint8_t MacProcSchStatsDeleteRsp(Pst *pst, SchStatsDeleteRsp *schStatsDeleteRsp) 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); - + ret = MacSendStatsDeleteRspToDuApp(schStatsDeleteRsp, NULLP); + MAC_FREE(schStatsDeleteRsp, sizeof(SchStatsDeleteRsp)); } - MAC_FREE(schStatsDeleteRsp, sizeof(SchStatsDeleteRsp)); return ret; } @@ -1452,15 +1507,17 @@ uint8_t MacProcStatsDeleteReq(Pst *pst, MacStatsDeleteReq *macStatsDeleteReq) } else { + /* fill all the information in schStatsDeleteReq structure */ schStatsDeleteReq->subscriptionId = macStatsDeleteReq->subscriptionId; + schStatsDeleteReq->numStatsGroupToBeDeleted = macStatsDeleteReq->numStatsGroupToBeDeleted; + memcpy(&schStatsDeleteReq->statsGrpIdToBeDelList, &macStatsDeleteReq->statsGrpIdToBeDelList, schStatsDeleteReq->numStatsGroupToBeDeleted*sizeof(uint8_t)); 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); + ret = MacSendStatsDeleteRspToDuApp(NULLP, macStatsDeleteReq); } MAC_FREE_SHRABL_BUF(pst->region, pst->pool, macStatsDeleteReq, sizeof(MacStatsDeleteReq)); diff --git a/src/5gnrsch/sch.c b/src/5gnrsch/sch.c index ace885ea1..d8adc88f4 100644 --- a/src/5gnrsch/sch.c +++ b/src/5gnrsch/sch.c @@ -2678,7 +2678,7 @@ uint8_t SchProcStatsReq(Pst *pst, SchStatsReq *statsReq) Inst inst = pst->dstInst - SCH_INST_START; bool measTypeInvalid; CauseOfResult cause; - SchStatsInfo *statsInfo = NULLP; + CmLList *statsGrpNode=NULLP; SchStatsGrpInfo *grpInfo = NULLP; SchStatsGrp *grpInfoDb = NULLP; SchStatsRsp schStatsRsp; @@ -2694,7 +2694,7 @@ uint8_t SchProcStatsReq(Pst *pst, SchStatsReq *statsReq) /* [Step 1] Basic validation. If fails, all stats group in stats request are rejected */ /* If maximum number of statistics already configured */ - if(schCb[inst].statistics.numOfStatsCfgd >= MAX_NUM_STATS_CFG) + if(schCb[inst].statistics.statsGrpList.count >= MAX_NUM_STATS_GRP) { DU_LOG("\nERROR --> SCH : SchProcStatsReq: Maximum number of statistics configured. \ Cannot process new request."); @@ -2706,111 +2706,121 @@ uint8_t SchProcStatsReq(Pst *pst, SchStatsReq *statsReq) memset(&schStatsRsp, 0, sizeof(SchStatsRsp)); /* [Step 2] Traverse all stats group and validate each measurement types in each group */ - statsInfo = &schCb[inst].statistics.statsInfoList[schCb[inst].statistics.numOfStatsCfgd]; - statsInfo->numStatsGroup = 0; for(reqGrpIdx=0; reqGrpIdxnumStatsGroup && grpIdxstatsGrpList[reqGrpIdx]; - grpInfoDb = &statsInfo->statsGrpList[grpIdx]; - for(reqMeasIdx = 0; reqMeasIdx < grpInfo->numStats; reqMeasIdx++) - { - switch(grpInfo->statsList[reqMeasIdx]) - { - case SCH_DL_TOTAL_PRB_USAGE: - { - /* Allocate memory */ - SCH_ALLOC(grpInfoDb->kpiStats.dlTotalPrbUsage, sizeof(TotalPrbUsage)); - if(!grpInfoDb->kpiStats.dlTotalPrbUsage) - { - DU_LOG("\nERROR --> SCH : Memory allocation failed for dlTotalPrbUsage in \ - SchProcStatsReq()"); - measTypeInvalid = true; - cause = RESOURCE_UNAVAILABLE; - } - break; - } - - case SCH_UL_TOTAL_PRB_USAGE: - { - /* Allocate memory */ - SCH_ALLOC(grpInfoDb->kpiStats.ulTotalPrbUsage, sizeof(TotalPrbUsage)); - if(!grpInfoDb->kpiStats.ulTotalPrbUsage) - { - DU_LOG("\nERROR --> SCH : Memory allocation failed for dlTotalPrbUsage in \ - SchProcStatsReq()"); - measTypeInvalid = true; - cause = RESOURCE_UNAVAILABLE; - } - break; - } - - default: - { - DU_LOG("\nERROR --> SCH : SchProcStatsReq: Invalid measurement type [%d]", \ - grpInfo->statsList[reqMeasIdx]); - measTypeInvalid = true; - cause = PARAM_INVALID; - break; - } - } - - /* [Step 3 a] If any measurement type validation fails in a group, that group - * is not configured */ - if(measTypeInvalid) - { - SCH_FREE(grpInfoDb->kpiStats.dlTotalPrbUsage, sizeof(TotalPrbUsage)); - SCH_FREE(grpInfoDb->kpiStats.ulTotalPrbUsage, sizeof(TotalPrbUsage)); - memset(grpInfoDb, 0, sizeof(SchStatsGrp)); - break; - } - } - - /* [Step 4] If a group passes all validation, it is added to SCH database. - * A timer is started for this group. And the group is added to - * stats-group-accepted-list in sch-stats-response message. */ - if(!measTypeInvalid) - { - /* Add this group's configured KPIs to list of Active KPIs */ - if(schAddToKpiActiveList(inst, grpInfoDb) == ROK) - { - grpInfoDb->schInst = inst; - grpInfoDb->subscriptionId = statsReq->subscriptionId; - grpInfoDb->groupId = grpInfo->groupId; - grpInfoDb->periodicity = grpInfo->periodicity; - - - /* Start timer */ - cmInitTimers(&(grpInfoDb->periodTimer), 1); - schStartTmr(&schCb[inst], (PTR)(grpInfoDb), EVENT_STATISTICS_TMR, grpInfoDb->periodicity); - - schStatsRsp.statsGrpAcceptedList[schStatsRsp.numGrpAccepted] = grpInfo->groupId; - schStatsRsp.numGrpAccepted++; - grpIdx++; - } - else - { - memset(grpInfoDb, 0, sizeof(SchStatsGrp)); - } - } - else - { - /* [Step 3 b] The rejected group is added to stats-group-rejected-list in - * sch-stats-response message */ - memset(grpInfoDb, 0, sizeof(SchStatsGrp)); - schStatsRsp.statsGrpRejectedList[schStatsRsp.numGrpRejected].groupId = grpInfo->groupId; - schStatsRsp.statsGrpRejectedList[schStatsRsp.numGrpRejected].cause = cause; - schStatsRsp.numGrpRejected++; - } - } - statsInfo->numStatsGroup = grpIdx; - if(statsInfo->numStatsGroup) - { - schCb[inst].statistics.numOfStatsCfgd++; - } - else - { - memset(statsInfo, 0, sizeof(SchStatsInfo)); + measTypeInvalid = false; + grpInfo = &statsReq->statsGrpList[reqGrpIdx]; + SCH_ALLOC(grpInfoDb, sizeof(SchStatsGrp)); + if(grpInfoDb == NULLP) + { + + DU_LOG("\nERROR --> SCH : Memory allocation failed for dlTotalPrbUsage in \ + SchProcStatsReq()"); + measTypeInvalid = true; + cause = RESOURCE_UNAVAILABLE; + } + else + { + for(reqMeasIdx = 0; reqMeasIdx < grpInfo->numStats; reqMeasIdx++) + { + switch(grpInfo->statsList[reqMeasIdx]) + { + case SCH_DL_TOTAL_PRB_USAGE: + { + /* Allocate memory */ + SCH_ALLOC(grpInfoDb->kpiStats.dlTotalPrbUsage, sizeof(TotalPrbUsage)); + if(!grpInfoDb->kpiStats.dlTotalPrbUsage) + { + DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d",__func__, __LINE__); + measTypeInvalid = true; + cause = RESOURCE_UNAVAILABLE; + } + break; + } + + case SCH_UL_TOTAL_PRB_USAGE: + { + /* Allocate memory */ + SCH_ALLOC(grpInfoDb->kpiStats.ulTotalPrbUsage, sizeof(TotalPrbUsage)); + if(!grpInfoDb->kpiStats.ulTotalPrbUsage) + { + DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d",__func__, __LINE__); + measTypeInvalid = true; + cause = RESOURCE_UNAVAILABLE; + } + break; + } + + default: + { + DU_LOG("\nERROR --> SCH : SchProcStatsReq: Invalid measurement type [%d]", \ + grpInfo->statsList[reqMeasIdx]); + measTypeInvalid = true; + cause = PARAM_INVALID; + break; + } + } + + /* [Step 3 a] If any measurement type validation fails in a group, that group + * is not configured */ + if(measTypeInvalid) + { + SCH_FREE(grpInfoDb->kpiStats.dlTotalPrbUsage, sizeof(TotalPrbUsage)); + SCH_FREE(grpInfoDb->kpiStats.ulTotalPrbUsage, sizeof(TotalPrbUsage)); + memset(grpInfoDb, 0, sizeof(SchStatsGrp)); + break; + } + } + } + /* [Step 4] If a group passes all validation, it is added to SCH database. + * A timer is started for this group. And the group is added to + * stats-group-accepted-list in sch-stats-response message. */ + if(!measTypeInvalid) + { + /* Add this group's configured KPIs to list of Active KPIs */ + if(schAddToKpiActiveList(inst, grpInfoDb) == ROK) + { + grpInfoDb->schInst = inst; + grpInfoDb->subscriptionId = statsReq->subscriptionId; + grpInfoDb->groupId = grpInfo->groupId; + grpInfoDb->periodicity = grpInfo->periodicity; + + + /* Start timer */ + cmInitTimers(&(grpInfoDb->periodTimer), 1); + schStartTmr(&schCb[inst], (PTR)(grpInfoDb), EVENT_STATISTICS_TMR, grpInfoDb->periodicity); + + + /* Adding the information in link list*/ + SCH_ALLOC(statsGrpNode, sizeof(CmLList)); + if(statsGrpNode) + { + statsGrpNode->node = (PTR) grpInfoDb; + cmLListAdd2Tail(&schCb[inst].statistics.statsGrpList, statsGrpNode); + schStatsRsp.statsGrpAcceptedList[schStatsRsp.numGrpAccepted] = grpInfo->groupId; + schStatsRsp.numGrpAccepted++; + grpIdx++; + } + else + { + DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at %d",__func__,__LINE__); + SCH_FREE(grpInfoDb->kpiStats.dlTotalPrbUsage, sizeof(TotalPrbUsage)); + SCH_FREE(grpInfoDb->kpiStats.ulTotalPrbUsage, sizeof(TotalPrbUsage)); + SCH_FREE(grpInfoDb, sizeof(SchStatsGrp)); + schStatsRsp.statsGrpRejectedList[schStatsRsp.numGrpRejected].groupId = grpInfo->groupId; + schStatsRsp.statsGrpRejectedList[schStatsRsp.numGrpRejected].cause = cause; + schStatsRsp.numGrpRejected++; + } + } + } + else + { + /* [Step 3 b] The rejected group is added to stats-group-rejected-list in + * sch-stats-response message */ + schStatsRsp.statsGrpRejectedList[schStatsRsp.numGrpRejected].groupId = grpInfo->groupId; + schStatsRsp.statsGrpRejectedList[schStatsRsp.numGrpRejected].cause = cause; + schStatsRsp.numGrpRejected++; + } } schStatsRsp.subscriptionId = statsReq->subscriptionId; @@ -2947,51 +2957,119 @@ uint8_t schCalcAndSendGrpStats(SchStatsGrp *grpInfo) /******************************************************************* * - * @brief Fill and send Statistics Delete Response to MAC + * @brief Delete statistics group * * @details * - * Function : SchSendStatsDeleteRspToMac + * Function : deleteStatsGrp * - * Functionality: Fill and send Statistics Delete Response to MAC + * Functionality: + * Delete statistics group * - * @params[in] - * Statistics Delete Request from MAC - * Statistics Delete result - * Cause of response + * @params[in] + * Inst + * Stats Grp Node * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t SchSendStatsDeleteRspToMac(SchStatsDeleteReq *statsDeleteReq, SchMacRsp rsp, CauseOfResult cause) +void deleteStatsGrp(Inst inst, CmLList *grpNode) { - Pst rspPst; - uint8_t ret = ROK; - SchStatsDeleteRsp *schStatsDeleteRsp; + SchStatsGrp *statsGrpInfo=NULLP; + + if(grpNode) + { + statsGrpInfo = (SchStatsGrp*)grpNode->node; + 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)); + SCH_FREE(grpNode->node, sizeof(SchStatsGrp)); + SCH_FREE(grpNode, sizeof(CmLList)); + } +} - DU_LOG("\nINFO --> SCH : Filling Statistics Delete Response"); - SCH_ALLOC(schStatsDeleteRsp, sizeof(SchStatsDeleteRsp)); - if(schStatsDeleteRsp == NULLP) +/****************************************************************** + * + * @brief Deletion of node from statistics group list + * + * @details + * + * Function : deleteFromStatsGrpList + * + * Functionality: Deletion of node from statistics group list + * [Step 1]: Traverse each and every node of stats group list + * stored in the database + * [Step 2]: Check if the node's subscription id is same + * as the subscription id received. If same then go to step 3 + * else move to the next node of the list. + * [Step 3]: If deleteAllGrp == true, then delete the node and + * move to the next node of the list. + * [Step 4]: If deleteAllGrp != true, then check if the node's group + * id is same as group id received then delete the node and mark the + * status found true else move to the next node of the list. + * [Step 5]: Once the traversing complete, + * if deleteAllGrp is true, then return successful rsp; + * else if status found is true, then return successful rsp; + * else return failure. + * @params[in] + * Inst + * Stats Grp List + * Subscription Id + * Group Id + * boolen of deleteAllGrp + * @return void + * + * ****************************************************************/ +uint8_t deleteFromStatsGrpList(Inst inst, CmLListCp *statsGrpList, uint64_t subscriptionId, uint8_t groupId, bool deleteAllGrp) +{ + bool statsFound=false; + SchStatsGrp *statsGrpInfo=NULLP; + CmLList *grpNode=NULLP; + + /* [Step 1] */ + CM_LLIST_FIRST_NODE(statsGrpList, grpNode); + while(grpNode) { - DU_LOG("\nERROR --> SCH : Failed to allocate memory in SchSendStatsDeleteRspToMac()"); - return RFAILED; + statsGrpInfo = (SchStatsGrp*)grpNode->node; + + /* [Step 2] */ + if(statsGrpInfo->subscriptionId== subscriptionId) + { + if(deleteAllGrp == true) + { + /* [Step 3] */ + cmLListDelFrm(statsGrpList, grpNode); + deleteStatsGrp(inst, grpNode); + } + else + { + /* [Step 4] */ + if(statsGrpInfo->groupId== groupId) + { + cmLListDelFrm(statsGrpList, grpNode); + deleteStatsGrp(inst, grpNode); + statsFound = true; + } + } + } + CM_LLIST_FIRST_NODE(statsGrpList, grpNode); } - - 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) + /* [Step 5] */ + if(deleteAllGrp == true) { - DU_LOG("\nERROR --> SCH : SchSendStatsDeleteRspToMac(): Failed to send Statistics Response"); - return ret; + return ROK; } - return ret; + else + { + if(statsFound == true) + return ROK; + } + return RFAILED; } /******************************************************************* @@ -3003,47 +3081,72 @@ uint8_t SchSendStatsDeleteRspToMac(SchStatsDeleteReq *statsDeleteReq, SchMacRsp * Function : deleteStatsInfo * * Functionality: - * Delete statistics information - * + * Delete statistics information base on numStatsGroup + * Info- If numStatsGroup = 0' indicates the Deletion procedure triggered by + * 'SUBS_DELETION_REQ' wherein all the groups of this particular + * Subscription has to be removed + * else when numStatsGroup != 0 then this is + * for SUBS_MOD_REQ's actionToBeDeleted wherein particular action(s) has + * to be removed thus need to pass groupId belonging to that subscription + * which has to be deleted.' + * + * [Step-1] If numStatsGroup = 0, Deletion of all stats group belonging to + * received subscription Id. + * [Step-2] Else if numStatsGroup > 0, Deletion of individual stats group + * from list whose information are present in stats delete request. + * [Step-3] Fill the result of the stats deletion in the SCH stats delete + * response * @params[in] * Instance - * Subscription id + * Subscription delete req + * Subscription delete rsp * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t deleteStatsInfo(Inst inst, uint64_t subscriptionId) +uint8_t deleteStatsInfo(Inst inst, SchStatsDeleteReq *statsDeleteReq, SchStatsDeleteRsp *schStatsDeleteRsp) { - bool statsFound=false; - uint8_t idx=0, statsGrpIdx=0; - SchStatsGrp *statsGrpInfo=NULLP; + uint8_t statsGrpIdx=0; + CmLListCp *statsGrpList =NULLP; - if(schCb[inst].statistics.numOfStatsCfgd) + statsGrpList = &schCb[inst].statistics.statsGrpList; + + if(!statsDeleteReq->numStatsGroupToBeDeleted) { - for(idx=0;idxsubscriptionId, 0, true) == ROK) { - for(statsGrpIdx=0;statsGrpIdxsubscriptionId ==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; - } - } + /* [Step 3]*/ + schStatsDeleteRsp->subsDelRsp = RSP_OK; + schStatsDeleteRsp->subsDelCause = SUCCESSFUL; + } + else + { + /* [Step-3]*/ + schStatsDeleteRsp->subsDelRsp = RSP_NOK; + schStatsDeleteRsp->subsDelCause = STATS_ID_NOT_FOUND; } } - - if(statsFound ==false) + else { - DU_LOG("\nERROR --> SCH : SchProcStatsDeleteReq(): Statistics information is not present"); - return RFAILED; + for(statsGrpIdx=0; statsGrpIdxnumStatsGroupToBeDeleted; statsGrpIdx++) + { + /* [Step-2] */ + if(deleteFromStatsGrpList(inst, statsGrpList, statsDeleteReq->subscriptionId,\ + statsDeleteReq->statsGrpIdToBeDelList[statsGrpIdx], false) != ROK) + { + /* [Step-3]*/ + schStatsDeleteRsp->statsGrpDelInfo[statsGrpIdx].statsGrpDelRsp = RSP_OK; + schStatsDeleteRsp->statsGrpDelInfo[statsGrpIdx].statsGrpDelCause = SUCCESSFUL; + } + else + { + /* [Step-3]*/ + schStatsDeleteRsp->statsGrpDelInfo[statsGrpIdx].statsGrpDelRsp = RSP_NOK; + schStatsDeleteRsp->statsGrpDelInfo[statsGrpIdx].statsGrpDelCause = STATS_ID_NOT_FOUND; + } + } + schStatsDeleteRsp->numStatsGroupDeleted = statsDeleteReq->numStatsGroupToBeDeleted; } return ROK; } @@ -3067,7 +3170,9 @@ uint8_t deleteStatsInfo(Inst inst, uint64_t subscriptionId) * ****************************************************************/ uint8_t SchProcStatsDeleteReq(Pst *pst, SchStatsDeleteReq *statsDeleteReq) { + Pst rspPst; uint8_t ret =ROK; + SchStatsDeleteRsp *schStatsDeleteRsp; Inst inst = pst->dstInst - SCH_INST_START; DU_LOG("\nINFO --> SCH : Received Statistics Delete Request from MAC"); @@ -3077,15 +3182,25 @@ uint8_t SchProcStatsDeleteReq(Pst *pst, SchStatsDeleteReq *statsDeleteReq) DU_LOG("\nERROR --> SCH : SchProcStatsDeleteReq(): Received Null pointer"); return RFAILED; } - - ret = deleteStatsInfo(inst, statsDeleteReq->subscriptionId); - if(ret == ROK) + + /* Process Stats delete request and fill stats delete response simultaneously */ + SCH_ALLOC(schStatsDeleteRsp, sizeof(SchStatsDeleteRsp)); + if(schStatsDeleteRsp == NULLP) { - SchSendStatsDeleteRspToMac(statsDeleteReq, RSP_OK, SUCCESSFUL); + DU_LOG("\nERROR --> SCH : Failed to allocate memory in SchProcStatsDeleteReq()"); + return RFAILED; } - else + schStatsDeleteRsp->subscriptionId=statsDeleteReq->subscriptionId; + deleteStatsInfo(inst, statsDeleteReq, schStatsDeleteRsp); + + 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) { - SchSendStatsDeleteRspToMac(statsDeleteReq, RSP_NOK, STATS_ID_NOT_FOUND); + DU_LOG("\nERROR --> SCH : SchProcStatsDeleteReq(): Failed to send Statistics Response"); } SCH_FREE(statsDeleteReq, sizeof(SchStatsDeleteReq)); diff --git a/src/5gnrsch/sch.h b/src/5gnrsch/sch.h index 5a7a39695..58e1c6813 100644 --- a/src/5gnrsch/sch.h +++ b/src/5gnrsch/sch.h @@ -628,16 +628,9 @@ typedef struct schStatsGrp SchKpiSupported kpiStats; }SchStatsGrp; -typedef struct schStatsInfo -{ - uint8_t numStatsGroup; - SchStatsGrp statsGrpList[MAX_NUM_STATS_GRP]; -}SchStatsInfo; - typedef struct schStatistics { - uint16_t numOfStatsCfgd; - SchStatsInfo statsInfoList[MAX_NUM_STATS_CFG]; + CmLListCp statsGrpList; SchKpiActive activeKpiList; }SchStatistics; diff --git a/src/cm/du_app_mac_inf.h b/src/cm/du_app_mac_inf.h index 30a11a300..9450cac38 100644 --- a/src/cm/du_app_mac_inf.h +++ b/src/cm/du_app_mac_inf.h @@ -1903,14 +1903,25 @@ typedef struct macStatsInd typedef struct macStatsDeleteReq { - uint64_t subscriptionId; + uint64_t subscriptionId; + uint8_t numStatsGroupToBeDeleted; + uint8_t statsGrpIdToBeDelList[MAX_NUM_STATS_GRP]; }MacStatsDeleteReq; +typedef struct macStatsDeleteInfo +{ + uint8_t groupId; + MacRsp statsGrpDelRsp; + CauseOfResult statsGrpDelCause; +}MacStatsDeleteInfo; + typedef struct macStatsDeleteRsp { - uint64_t subscriptionId; - MacRsp result; - CauseOfResult status; + uint64_t subscriptionId; /* subscription Id */ + MacRsp subsDelRsp; /* deletion status of all statsGrp with given subscriptionId */ + CauseOfResult subsDelCause; /* cause of failure in deletion of all statsGrp with given subscriptionId */ + uint8_t numStatsGroupDeleted; /* number of actions to deleted */ + MacStatsDeleteInfo statsGrpDelInfo[MAX_NUM_STATS_GRP]; /*list of the deletion statuses for specific actions */ }MacStatsDeleteRsp; /****************** FUNCTION POINTERS ********************************/ diff --git a/src/cm/mac_sch_interface.h b/src/cm/mac_sch_interface.h index 941ad4a77..985d7bbc3 100644 --- a/src/cm/mac_sch_interface.h +++ b/src/cm/mac_sch_interface.h @@ -2297,13 +2297,24 @@ typedef struct schStatsInd typedef struct schStatsDeleteReq { uint64_t subscriptionId; + uint8_t numStatsGroupToBeDeleted; + uint8_t statsGrpIdToBeDelList[MAX_NUM_STATS_GRP]; }SchStatsDeleteReq; +typedef struct statsDeleteResult +{ + uint8_t groupId; + SchMacRsp statsGrpDelRsp; + CauseOfResult statsGrpDelCause; +}StatsDeleteResult; + typedef struct schStatsDeleteRsp { - uint64_t subscriptionId; - SchMacRsp rsp; - CauseOfResult cause; + uint64_t subscriptionId; /* subscription Id */ + SchMacRsp subsDelRsp; /* deletion status of all statsGrp with given subscriptionId */ + CauseOfResult subsDelCause; /* cause of failure in deletion of all statsGrp with given subscriptionId*/ + uint8_t numStatsGroupDeleted; /* num of action deleted */ + StatsDeleteResult statsGrpDelInfo[MAX_NUM_STATS_GRP]; /* list of the deletion status for specific actions */ }SchStatsDeleteRsp; /* function declarations */ diff --git a/src/du_app/du_e2ap_mgr.c b/src/du_app/du_e2ap_mgr.c index c104722e4..57b751ccf 100644 --- a/src/du_app/du_e2ap_mgr.c +++ b/src/du_app/du_e2ap_mgr.c @@ -1365,7 +1365,6 @@ void deleteActionSequenceList(CmLListCp *actionList) deleteActionSequence(actionNode); CM_LLIST_FIRST_NODE(actionList, actionNode); } - } /****************************************************************** @@ -1530,6 +1529,8 @@ void removeE2NodeInformation() * ****************************************************************/ uint8_t e2ProcStatsDeleteRsp(MacStatsDeleteRsp *statsDeleteRsp) { + RicRequestId requestId; + uint16_t ranFuncId; RanFunction *ranFuncDb = NULLP; CmLList *ricSubscriptionNode = NULLP; RicSubscription *ricSubscriptionInfo = NULLP; @@ -1542,12 +1543,14 @@ uint8_t e2ProcStatsDeleteRsp(MacStatsDeleteRsp *statsDeleteRsp) DU_LOG("\nERROR --> E2AP : e2ProcStatsDeleteRsp: Failed to fetch subscriprtion details"); return RFAILED; } + ranFuncId = ricSubscriptionInfo->ranFuncId; + memcpy(&requestId, &ricSubscriptionInfo->requestId, sizeof(RicRequestId)); deleteRicSubscriptionNode(ricSubscriptionNode); - if(statsDeleteRsp->result == MAC_DU_APP_RSP_NOK) + if(statsDeleteRsp->subsDelRsp == MAC_DU_APP_RSP_NOK) { - if(statsDeleteRsp->status == STATS_ID_NOT_FOUND) + if(statsDeleteRsp->subsDelCause == STATS_ID_NOT_FOUND) { failureCause.causeType =E2_RIC_REQUEST; failureCause.cause = E2_REQUEST_INFORMATION_UNAVAILABLE; @@ -1558,7 +1561,7 @@ uint8_t e2ProcStatsDeleteRsp(MacStatsDeleteRsp *statsDeleteRsp) failureCause.cause = E2_MISCELLANEOUS_CAUSE_UNSPECIFIED; } - if(BuildAndSendRicSubscriptionDeleteFailure(ricSubscriptionInfo->ranFuncId, ricSubscriptionInfo->requestId, failureCause) != ROK) + if(BuildAndSendRicSubscriptionDeleteFailure(ranFuncId, requestId, failureCause) != ROK) { DU_LOG("\nERROR --> E2AP : e2ProcStatsDeleteRsp: failed to build and send ric subs delete failure"); return RFAILED; @@ -1566,7 +1569,7 @@ uint8_t e2ProcStatsDeleteRsp(MacStatsDeleteRsp *statsDeleteRsp) } else { - if(BuildAndSendRicSubscriptionDeleteResponse(ricSubscriptionInfo->ranFuncId, ricSubscriptionInfo->requestId) != ROK) + if(BuildAndSendRicSubscriptionDeleteResponse(ranFuncId, requestId) != ROK) { DU_LOG("\nERROR --> E2AP : e2ProcStatsDeleteRsp: failed to build and send ric subs delete rsp"); return RFAILED; diff --git a/src/du_app/du_mgr_main.c b/src/du_app/du_mgr_main.c index b545555c8..88043ee17 100644 --- a/src/du_app/du_mgr_main.c +++ b/src/du_app/du_mgr_main.c @@ -586,7 +586,7 @@ uint8_t commonInit() DU_LOG("\nERROR --> DU_APP : System Task creation for DU APP failed"); return RFAILED; } - ODU_SET_THREAD_AFFINITY(&du_app_stsk, SS_AFFINITY_MODE_EXCL, 16, 0); + //ODU_SET_THREAD_AFFINITY(&du_app_stsk, SS_AFFINITY_MODE_EXCL, 16, 0); /* system task for EGTP */ if(ODU_CREATE_TASK(PRIOR0, &egtp_stsk) != ROK) @@ -594,7 +594,7 @@ uint8_t commonInit() DU_LOG("\nERROR --> DU_APP : System Task creation for EGTP failed"); return RFAILED; } - ODU_SET_THREAD_AFFINITY(&egtp_stsk, SS_AFFINITY_MODE_EXCL, 27, 0); + //ODU_SET_THREAD_AFFINITY(&egtp_stsk, SS_AFFINITY_MODE_EXCL, 27, 0); /* system task for RLC_DL and MAC */ if(ODU_CREATE_TASK(PRIOR0, &rlc_mac_cl_stsk) != ROK) @@ -604,7 +604,7 @@ uint8_t commonInit() } pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - ODU_SET_THREAD_AFFINITY(&rlc_mac_cl_stsk, SS_AFFINITY_MODE_EXCL, 18, 0); + //ODU_SET_THREAD_AFFINITY(&rlc_mac_cl_stsk, SS_AFFINITY_MODE_EXCL, 18, 0); /* system task for RLC UL */ if(ODU_CREATE_TASK(PRIOR1, &rlc_ul_stsk) != ROK) @@ -612,7 +612,7 @@ uint8_t commonInit() DU_LOG("\nERROR --> DU_APP : System Task creation for RLC UL failed"); return RFAILED; } - ODU_SET_THREAD_AFFINITY(&rlc_ul_stsk, SS_AFFINITY_MODE_EXCL, 22, 0); + //ODU_SET_THREAD_AFFINITY(&rlc_ul_stsk, SS_AFFINITY_MODE_EXCL, 22, 0); /* system task for SCH */ if(ODU_CREATE_TASK(PRIOR1, &sch_stsk) != ROK) @@ -620,7 +620,7 @@ uint8_t commonInit() DU_LOG("\nERROR --> DU_APP : System Task creation for SCH failed"); return RFAILED; } - ODU_SET_THREAD_AFFINITY(&sch_stsk, SS_AFFINITY_MODE_EXCL, 22, 0); + //ODU_SET_THREAD_AFFINITY(&sch_stsk, SS_AFFINITY_MODE_EXCL, 22, 0); /* system task for SCTP receiver thread */ if(ODU_CREATE_TASK(PRIOR0, &sctp_stsk) != ROK) @@ -628,7 +628,7 @@ uint8_t commonInit() DU_LOG("\nERROR --> DU_APP : System Task creation for SCTP failed"); return RFAILED; } - ODU_SET_THREAD_AFFINITY(&sctp_stsk, SS_AFFINITY_MODE_EXCL, 25, 0); + //ODU_SET_THREAD_AFFINITY(&sctp_stsk, SS_AFFINITY_MODE_EXCL, 25, 0); /* system task for lower-mac receiver thread */ if(ODU_CREATE_TASK(PRIOR0, &lwr_mac_stsk) != ROK) @@ -636,7 +636,7 @@ uint8_t commonInit() DU_LOG("\nERROR --> DU_APP : System Task creation for Lower MAC failed"); return RFAILED; } - ODU_SET_THREAD_AFFINITY(&lwr_mac_stsk, SS_AFFINITY_MODE_EXCL, 21, 0); + //ODU_SET_THREAD_AFFINITY(&lwr_mac_stsk, SS_AFFINITY_MODE_EXCL, 21, 0); #ifndef INTEL_WLS_MEM /* system task for phy stub's slot indication generator thread */ diff --git a/src/du_app/du_msg_hdl.c b/src/du_app/du_msg_hdl.c index 9f3b50c92..39b2702c1 100644 --- a/src/du_app/du_msg_hdl.c +++ b/src/du_app/du_msg_hdl.c @@ -2307,9 +2307,19 @@ uint8_t DuProcMacStatsDeleteRsp(Pst *pst, MacStatsDeleteRsp *statsDeleteRsp) if(statsDeleteRsp) { - if((ret = e2ProcStatsDeleteRsp(statsDeleteRsp)) != ROK) + /* numStatsGroup == 0, received a response for complete ric + * subscription deletion else, received a response + * for RIC_SUBS_MOD_REQ's actionToBeDeleted*/ + if(statsDeleteRsp->numStatsGroupDeleted ==0) { - DU_LOG("\nINFO --> DU_APP : Failed in %s at line %d", __func__, __LINE__); + if((ret = e2ProcStatsDeleteRsp(statsDeleteRsp)) != ROK) + { + DU_LOG("\nINFO --> DU_APP : Failed in %s at line %d", __func__, __LINE__); + } + } + else + { + /* TODO calling ric sub modification action to be deleted functions */ } DU_FREE_SHRABL_BUF(pst->region, pst->pool, statsDeleteRsp, sizeof(MacStatsDeleteRsp)); } @@ -2332,13 +2342,17 @@ uint8_t DuProcMacStatsDeleteRsp(Pst *pst, MacStatsDeleteRsp *statsDeleteRsp) * * @params[in] * Subscription Info + * delete All Stats * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t BuildAndSendStatsDeleteReqToMac(RicSubscription *ricSubscriptionInfo) +uint8_t BuildAndSendStatsDeleteReqToMac(RicSubscription *ricSubscriptionInfo, bool deleteAllStats) { Pst pst; + uint8_t actionIdx=0; + CmLList *actionNode=NULLP; + ActionInfo *actionDb = NULLP; E2FailureCause failureCause; MacStatsDeleteReq *macStatsDelete = NULLP; @@ -2357,10 +2371,30 @@ uint8_t BuildAndSendStatsDeleteReqToMac(RicSubscription *ricSubscriptionInfo) } return RFAILED; } - + + memset(macStatsDelete, 0, sizeof(MacStatsDeleteReq)); /* Generate subscription ID using RIC Request ID and RAN Function ID */ encodeSubscriptionId(&macStatsDelete->subscriptionId, ricSubscriptionInfo->ranFuncId, ricSubscriptionInfo->requestId); + /* If deleteAllStats is true, then we don't need to fill in the + * statsGrpIdToBeDelList with action details; otherwise, we must fill in the + * statsGrpIdToBeDelList with action-related data that is set to CONFIG_DEL.*/ + if(!deleteAllStats) + { + actionIdx=0; + CM_LLIST_FIRST_NODE(&ricSubscriptionInfo->actionSequence, actionNode); + while(actionNode) + { + actionDb = (ActionInfo*)(actionNode->node); + if(actionDb->action == CONFIG_DEL) + { + macStatsDelete->statsGrpIdToBeDelList[actionIdx] = actionDb->actionId; + actionIdx++; + } + } + macStatsDelete->numStatsGroupToBeDeleted=actionIdx; + } + DU_LOG("\nDEBUG --> DU_APP: Sending Statistics delete req to MAC "); FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_STATS_DELETE_REQ); @@ -2394,7 +2428,7 @@ uint8_t BuildAndSendStatsDeleteReqToMac(RicSubscription *ricSubscriptionInfo) uint8_t BuildAndSendStatsDeleteReq(RicSubscription *ricSubscriptionInfo) { /* Build and sent subscription information to MAC in Statistics delete */ - if(BuildAndSendStatsDeleteReqToMac(ricSubscriptionInfo) != ROK) + if(BuildAndSendStatsDeleteReqToMac(ricSubscriptionInfo, true) != ROK) { DU_LOG("\nERROR --> DU_APP : Failed at BuildAndSendStatsDeleteReqToMac()"); return RFAILED; -- 2.16.6