- 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++;
+ }