X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrmac%2Fmac_cfg_hdl.c;h=fa17ba067245c09581585c435f491f5688555adc;hb=f73456bd55152c329601f8286ae67fe9875025bc;hp=fee5f4f77b54f112e14efba3c2a347239d10d4c5;hpb=ab13dee0decf8731b1d95f943d13a6e7a4a2ead5;p=o-du%2Fl2.git diff --git a/src/5gnrmac/mac_cfg_hdl.c b/src/5gnrmac/mac_cfg_hdl.c index fee5f4f77..fa17ba067 100644 --- a/src/5gnrmac/mac_cfg_hdl.c +++ b/src/5gnrmac/mac_cfg_hdl.c @@ -1014,6 +1014,105 @@ uint8_t MacProcDlBroadcastReq(Pst *pst, MacDlBroadcastReq *dlBroadcastReq) } return ret; } + +/** + * @brief Mac process the statistics Req received from DUAPP + * + * @details + * + * Function : MacProcStatsReq + * + * This function process the statistics request from duapp + * + * @param[in] Pst *pst + * @param[in] StatsReq *statsReq + * @return int + * -# ROK + **/ +uint8_t MacProcStatsReq(Pst *pst, MacStatsReq *macStatsReq) +{ + uint8_t macStatsIdx = 0, schStatsIdx = 0; + uint8_t ret = RFAILED; + bool measTypeInvalid = false; + Pst schPst; + SchStatsReq *schStatsReq = NULLP; + CauseOfResult cause; + + if(macStatsReq) + { + DU_LOG("\nINFO --> MAC : Received Statistics Request from DU_APP"); + + MAC_ALLOC(schStatsReq, sizeof(SchStatsReq)); + if(schStatsReq == NULLP) + { + DU_LOG("\nERROR --> MAC : MacProcStatsReq: Failed to allocate memory"); + cause = RESOURCE_UNAVAILABLE; + } + else + { + schStatsReq->numStats = 0; + for(macStatsIdx=0; macStatsIdx < macStatsReq->numStats; macStatsIdx++) + { + /* Checking each measurement type to send only SCH related + * measurement config to SCH + * This will be useful in future when some measurement type will + * be configured for SCH and rest for only MAC */ + switch(macStatsReq->statsList[macStatsIdx].type) + { + case MAC_DL_TOTAL_PRB_USAGE: + { + schStatsReq->statsList[schStatsIdx].type = SCH_DL_TOTAL_PRB_USAGE; + break; + } + case MAC_UL_TOTAL_PRB_USAGE: + { + schStatsReq->statsList[schStatsIdx].type = SCH_UL_TOTAL_PRB_USAGE; + break; + } + default: + { + DU_LOG("\nERROR --> MAC : MacProcStatsReq: Invalid measurement type [%d]", \ + macStatsReq->statsList[macStatsIdx].type); + measTypeInvalid = true; + } + } + + if(!measTypeInvalid) + { + schStatsReq->statsList[schStatsIdx].periodicity = macStatsReq->statsList[macStatsIdx].periodicity; + schStatsIdx++; + measTypeInvalid = false; + } + } + schStatsReq->numStats = schStatsIdx; + + /* If no measurement types are valid, it is failure scenario. + * Even if one measurement type is valid, send to SCH */ + if(schStatsReq->numStats) + { + FILL_PST_MAC_TO_SCH(schPst, EVENT_STATISTICS_REQ_TO_SCH); + ret = SchMessageRouter(&schPst, (void *)schStatsReq); + } + else + { + cause = PARAM_INVALID; + } + } + MAC_FREE_SHRABL_BUF(pst->region, pst->pool, macStatsReq, sizeof(MacStatsReq)); + } + else + { + DU_LOG("\nERROR --> MAC : MacProcStatsReq(): Received Null pointer"); + cause = PARAM_INVALID; + } + + if(ret == RFAILED) + { + /* Send negative acknowledgment to DU APP. TBD in next gerrit */ + } + return ret; +} + /********************************************************************** End of file **********************************************************************/