X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrmac%2Fmac_msg_hdl.c;h=d5544ba2dea18d54708b65883b747048bebb3390;hb=f78bb742344bb919e27f38c2d7bc2d11fc37b184;hp=b0779d95be84cd1ec902e4b6ef4e0518b9b72f21;hpb=3fcf32e0ea0cbb4e83cbd3ece7a16e692fedcedd;p=o-du%2Fl2.git diff --git a/src/5gnrmac/mac_msg_hdl.c b/src/5gnrmac/mac_msg_hdl.c index b0779d95b..d5544ba2d 100644 --- a/src/5gnrmac/mac_msg_hdl.c +++ b/src/5gnrmac/mac_msg_hdl.c @@ -38,6 +38,14 @@ MacCb macCb; +MacDuStatsIndFunc macDuStatsIndOpts[] = +{ + packDuMacStatsInd, /* packing for loosely coupled */ + DuProcMacStatsInd, /* packing for tightly coupled */ + packDuMacStatsInd /* packing for light weight loosly coupled */ +}; + + /******************************************************************* * * @brief Sends DL BO Info to SCH @@ -1057,6 +1065,77 @@ uint8_t MacProcSliceRecfgReq(Pst *pst, MacSliceRecfgReq *macSliceRecfgReq) return ret; } +/** + * @brief Mac process the statistics indication received from sch. + * + * @details + * + * Function : MacProcSchStatsInd + * + * This function process the statistics indication received from sch + * + * @param[in] Pst *pst + * @param[in] SchStatsInd *schStatsInd + * @return int + * -# ROK + **/ +uint8_t MacProcSchStatsInd(Pst *pst, SchStatsInd *schStatsInd) +{ + uint8_t statsIdx = 0; + Pst indPst; + MacStatsInd *macStatsInd; + +#ifdef DEBUG_PRINT + DU_LOG("\nDEBUG --> MAC : MacProcSchStatsInd: Received Statistics Indication from SCH"); +#endif + + if(schStatsInd == NULLP) + { + DU_LOG("\nERROR --> MAC : MacProcSchStatsInd: NULL pointer :schStatsInd"); + return RFAILED; + } + + MAC_ALLOC_SHRABL_BUF(macStatsInd, sizeof(MacStatsInd)); + if(macStatsInd == NULLP) + { + DU_LOG("\nERROR --> MAC : Failed to allocate memory in MacProcSchStatsInd"); + return RFAILED; + } + + macStatsInd->subscriptionId = schStatsInd->subscriptionId; + macStatsInd->groupId = schStatsInd->groupId; + + for(statsIdx = 0; statsIdx < schStatsInd->numStats; statsIdx++) + { + switch(schStatsInd->measuredStatsList[statsIdx].type) + { + case SCH_DL_TOTAL_PRB_USAGE: + { + macStatsInd->measuredStatsList[statsIdx].type = MAC_DL_TOTAL_PRB_USAGE; + break; + } + case SCH_UL_TOTAL_PRB_USAGE: + { + macStatsInd->measuredStatsList[statsIdx].type = MAC_UL_TOTAL_PRB_USAGE; + break; + } + default: + { + DU_LOG("\nERROR --> MAC : MacProcSchStatsInd: Invalid measurement type [%d]", \ + schStatsInd->measuredStatsList[statsIdx].type); + MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, macStatsInd, sizeof(MacStatsInd)); + return RFAILED; + } + } + macStatsInd->measuredStatsList[statsIdx].value = schStatsInd->measuredStatsList[statsIdx].value; + } + macStatsInd->numStats = schStatsInd->numStats; + + memset(&indPst, 0, sizeof(Pst)); + FILL_PST_MAC_TO_DUAPP(indPst, EVENT_MAC_STATISTICS_IND); + return (*macDuStatsIndOpts[indPst.selector])(&indPst, macStatsInd); +} + /********************************************************************** End of file **********************************************************************/