* 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;idx<macStatsDeleteRsp->numStatsGroupDeleted; 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;idx<macStatsDeleteRsp->numStatsGroupDeleted; 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;
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;
}
}
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));
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;
/* [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.");
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; reqGrpIdx<statsReq->numStatsGroup && grpIdx<MAX_NUM_STATS; reqGrpIdx++)
{
- measTypeInvalid = false;
- grpInfo = &statsReq->statsGrpList[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;
/*******************************************************************
*
- * @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;
}
/*******************************************************************
* 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;idx<schCb[inst].statistics.numOfStatsCfgd; idx++)
+ /* [Step-1] */
+ if(deleteFromStatsGrpList(inst,statsGrpList, statsDeleteReq->subscriptionId, 0, true) == ROK)
{
- for(statsGrpIdx=0;statsGrpIdx<schCb[inst].statistics.statsInfoList[idx].numStatsGroup; statsGrpIdx++)
- {
- statsGrpInfo = &schCb[inst].statistics.statsInfoList[idx].statsGrpList[statsGrpIdx];
- if(statsGrpInfo->subscriptionId ==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; statsGrpIdx<statsDeleteReq->numStatsGroupToBeDeleted; 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;
}
* ****************************************************************/
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");
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));