X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrsch%2Fsch_msg_router.c;h=ca15f65b8a7199679a93900f27081a03cfbe1791;hb=f73456bd55152c329601f8286ae67fe9875025bc;hp=1f16e39ed77fc82fd5e4c8c79eaee8035730577a;hpb=904e86bfdd8b8caacb73b9b7ae40c279e5befb84;p=o-du%2Fl2.git diff --git a/src/5gnrsch/sch_msg_router.c b/src/5gnrsch/sch_msg_router.c index 1f16e39ed..ca15f65b8 100755 --- a/src/5gnrsch/sch_msg_router.c +++ b/src/5gnrsch/sch_msg_router.c @@ -28,212 +28,363 @@ **********************************************************************/ -#if 0 /*MAC-SCH Interface working as Tightly Coupled thus Commenting*/ - -/** @file sch_msg_router.c -@brief This file contains the implementation of callback functions -registered with SSI during the LTE MAC Task initialization. -*/ -/* header include files -- defines (.h) */ #include "common_def.h" -#include "tfu.h" /* RGU defines */ -#include "lrg.h" /* layer management defines for LTE-MAC */ -#include "rgr.h" /* layer management defines for LTE-MAC */ -#include "rgm.h" /* layer management defines for LTE-MAC */ -#include "rg_env.h" /* customisable defines and macros for LTE-MAC */ -#include "rg_sch_err.h" /* defines and macros for Scheduler */ -#include "rg_sch_inf.h" /* defines and macros for Scheduler */ -#include "rg_sch.h" /* defines and macros for Scheduler */ - +#include "lrg.h" +#include "tfu.h" +#include "du_log.h" +#include "rgr.h" +#include "rg_sch_inf.h" +#include "rg_sch.h" +#include "mac_sch_interface.h" -/* header/extern include files (.x) */ -#include "tfu.x" /* RGU types */ +#include "tfu.x" /* TFU types */ #include "lrg.x" /* layer management typedefs for MAC */ #include "rgr.x" /* layer management typedefs for MAC */ -#include "rgm.x" /* layer management typedefs for MAC */ -#include "rg_sch_inf.x" /* typedefs for Scheduler */ -#include "rg_sch.x" /* typedefs for Scheduler */ -#include "mac_sch_interface.h" +#include "rg_sch_inf.x" /* typedefs for Scheduler */ +#include "sch.h" +#include "sch_tmr.h" + +/** + * @brief Task Initiation function. + * + * @details + * + * Function : schActvInit + * + * This function is supplied as one of parameters during MAC's + * task registration. MAC will invoke this function once, after + * it creates and attaches this TAPA Task to a system task. + * + * @param[in] Ent Entity, the entity ID of this task. + * @param[in] Inst Inst, the instance ID of this task. + * @param[in] Region Region, the region ID registered for memory + * usage of this task. + * @param[in] Reason Reason. + * @return int + * -# ROK + **/ +uint8_t schActvInit(Ent entity, Inst instId, Region region, Reason reason) +{ + Inst inst = (instId - SCH_INST_START); + + /* Initialize the MAC TskInit structure to zero */ + memset ((uint8_t *)&schCb[inst], 0, sizeof(schCb)); + + /* Initialize the MAC TskInit with received values */ + schCb[inst].schInit.ent = entity; + schCb[inst].schInit.inst = inst; + schCb[inst].schInit.region = region; + schCb[inst].schInit.pool = 0; + schCb[inst].schInit.reason = reason; + schCb[inst].schInit.cfgDone = FALSE; + schCb[inst].schInit.acnt = FALSE; + schCb[inst].schInit.usta = FALSE; + schCb[inst].schInit.trc = FALSE; + schCb[inst].schInit.procId = ODU_GET_PROCID(); + + return ROK; +} /* schActvInit */ + +/** + * @brief Task Activation callback function. + * + * @details + * + * Function : schActvTsk + * + * Primitives invoked by SCH's users/providers through + * a loosely coupled interface arrive here by means of + * SSI's message handling. This API is registered with + * SSI during the Task Registration of SCH. + * + * @param[in] Pst *pst, Post structure of the primitive. + * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer. + * @param[in] Reason reason. + * @return uint8_t + * -# ROK + **/ +uint8_t schActvTsk(Pst *pst, Buffer *mBuf) +{ + SchMessageRouter(pst, (void *)mBuf); + + ODU_EXIT_TASK(); + return ROK; +} #ifdef CALL_FLOW_DEBUG_LOG -/* -* @brief +/** +* @brief Function prints src, dest, msg infor about all the msgs that received. * -* Function: -* name : callFlowSchActvTsk +* @details * -* @b Description: -* Function used to print values of src, dest, message -* received at the layer +* Function : callFlowSchMsgRouter * -* @param[in] pst - Pst Structure +* Function prints src, dest, msg infor about all the msgs that received * -* @return void -*/ +* @param[in] Pst *pst, Post structure of the primitive. +* +* @return void +**/ -void callFlowSchActvTsk(Pst *pst) +void callFlowSchMsgRouter(Pst *pst) { char sourceTask[50]; char destTask[50]="ENTSCH"; char message[100]; - switch(pst->srcEnt) + strcpy(sourceTask,"ENTMAC"); + switch(pst->event) { - case ENTMAC: /* When MAC sends a msg to Scheduler instance */ - { - strcpy(sourceTask,"ENTMAC"); - switch(pst->event) - { -#ifdef LCSCH - case EVTINFDEDBOUPDTREQ: - strcpy(message,"EVTINFDEDBOUPDTREQ"); - break; - case EVTINFCMNBOUPDTREQ: - strcpy(message,"EVTINFCMNBOUPDTREQ"); - break; - case EVTINFSFRECPIND: - strcpy(message,"EVTINFSFRECPIND"); - break; - /*Fix: start: Inform UE delete to scheduler*/ - case EVTINFUEDELIND: - strcpy(message,"EVTINFUEDELIND"); - break; - /*Fix: end: Inform UE delete to scheduler*/ -#ifdef LTE_L2_MEAS - case EVTINFL2MEASCFM: - strcpy(message,"EVTINFL2MEASCFM"); - break; - case EVTINFL2MEASSTOPCFM: - strcpy(message,"EVTINFL2MEASSTOPCFM"); - break; -#endif -#endif - case EVENT_SLOT_IND_TO_SCH: - strcpy(message,"EVENT_SLOT_IND_TO_SCH"); - break; - default: - strcpy(message,"Invalid Event"); - break; - } + case EVENT_SCH_GEN_CFG: + { + strcpy(message,"EVENT_SCH_GEN_CFG"); + break; + } + case EVENT_SLICE_CFG_REQ_TO_SCH: + { + strcpy(message,"EVENT_SLICE_CFG_REQ_TO_SCH"); + break; + } + case EVENT_SLICE_RECFG_REQ_TO_SCH: + { + strcpy(message,"EVENT_SLICE_RECFG_REQ_TO_SCH"); + break; + } + case EVENT_SCH_CELL_CFG: + { + strcpy(message,"EVENT_SCH_CELL_CFG"); + break; + } + case EVENT_SLOT_IND_TO_SCH: + { + strcpy(message,"EVENT_SLOT_IND_TO_SCH"); + break; + } + case EVENT_ADD_UE_CONFIG_REQ_TO_SCH: + { + strcpy(message,"EVENT_ADD_UE_CONFIG_REQ_TO_SCH"); + break; + } + case EVENT_MODIFY_UE_CONFIG_REQ_TO_SCH: + { + strcpy(message,"EVENT_MODIFY_UE_CONFIG_REQ_TO_SCH"); + break; + } + case EVENT_UL_CQI_TO_SCH: + { + strcpy(message,"EVENT_UL_CQI_TO_SCH"); + break; + } + case EVENT_DL_CQI_TO_SCH: + { + strcpy(message,"EVENT_DL_CQI_TO_SCH"); + break; + } + case EVENT_PHR_IND_TO_SCH + { + strcpy(message,"EVENT_PHR_IND_TO_SCH"); + } + case EVENT_RACH_IND_TO_SCH: + { + strcpy(message,"EVENT_RACH_IND_TO_SCH"); + break; + } + case EVENT_CRC_IND_TO_SCH: + { + strcpy(message,"EVENT_CRC_IND_TO_SCH"); + break; + } + case EVENT_DL_RLC_BO_INFO_TO_SCH: + { + strcpy(message,"EVENT_DL_RLC_BO_INFO_TO_SCH"); + break; + } + case EVENT_SHORT_BSR: + { + strcpy(message,"EVENT_SHORT_BSR"); + break; + } + case EVENT_LONG_BSR: + { + strcpy(message,"EVENT_LONG_BSR"); + break; + } + case EVENT_UCI_IND_TO_SCH: + { + strcpy(message,"EVENT_UCI_IND_TO_SCH"); + break; + } + case EVENT_UE_DELETE_REQ_TO_SCH: + { + strcpy(message,"EVENT_UE_DELETE_REQ_TO_SCH"); + break; + } + case EVENT_CELL_DELETE_REQ_TO_SCH: + { + strcpy(message,"EVENT_CELL_DELETE_REQ_TO_SCH"); + break; + } + case EVENT_RACH_RESOURCE_REQUEST_TO_SCH: + { + strcpy(message,"EVENT_RACH_RESOURCE_REQUEST_TO_SCH"); + break; + } + case EVENT_RACH_RESOURCE_RELEASE_TO_SCH: + { + strcpy(message,"EVENT_RACH_RESOURCE_RELEASE_TO_SCH"); + break; + } + case EVENT_PAGING_IND_TO_SCH: + { + strcpy(message,"EVENT_PAGING_IND_TO_SCH"); + break; + } + case EVENT_DL_HARQ_IND_TO_SCH: + { + strcpy(message,"EVENT_DL_HARQ_IND_TO_SCH"); + break; + } + case EVENT_STATISTICS_REQ_TO_SCH: + { + strcpy(message,"EVENT_STATISTICS_REQ_TO_SCH"); break; } default: - strcpy(sourceTask,"Invalid Source Entity Id"); + strcpy(message,"Invalid Event"); break; } DU_LOG("\nCall Flow: %s -> %s : %s\n", sourceTask, destTask, message); } #endif -/** - * @brief Task Activation callback function. - * - * @details - * - * Function : schActvTsk - * - * Primitives invoked by MAC's users/providers through - * a loosely coupled interface arrive here by means of - * SSI's message handling. This API is registered with - * SSI during the Task Registration of MAC. - * - * @param[in] Pst *pst, post structure of the Primitive. - * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer. - * @param[in] Reason reason. - * @return S16 - * -# ROK - **/ -S16 schActvTsk -( -Pst *pst, /* post structure */ -Buffer *mBuf /* message buffer */ -) +uint8_t SchMessageRouter(Pst *pst, void *msg) { - #ifdef CALL_FLOW_DEBUG_LOG - callFlowSchActvTsk(pst); + callFlowSchMsgRouter(pst); #endif - switch(pst->srcEnt) + switch(pst->event) { - /* The originator of this message is the stack manager, - * unpack and go to the respective primitive processing function */ - case ENTSM: - switch(pst->event) - { -#ifdef LCRGMILRG - case EVTMACSCHGENCFGREQ: - /* Process a config. request */ - cmUnpkLrgSchCfgReq(SchProcGenCfgReq, pst, mBuf); - break; - case EVTLRGSCHSTAIND: - /* Process a control request */ - cmUnpkLrgSchStaInd(RgMiLrgSchStaInd, pst, mBuf); - break; -#ifdef LTE_L2_MEAS - case EVTLRGSCHL2MEASREQ: - /* Process L2 Measurement request */ - cmUnpkLrgSchL2MeasReq(RgMiLrgSchL2MeasReq, pst, mBuf); - break; - case EVTLRGSCHL2MEASSTOPREQ: - /* Process L2 Measurement Stop request */ - cmUnpkLrgSchL2MeasStopReq(RgMiLrgSchL2MeasStopReq, pst, mBuf); - break; - case EVTLRGSCHL2MEASSENDREQ: - /* Process L2 Measurement Send request */ - cmUnpkLrgSchL2MeasSendReq(RgMiLrgSchL2MeasSendReq, pst, mBuf); - break; -#endif -#endif /* LCRGMILRG */ - default: - RGSCH_FREE_MSG(mBuf); - break; - } - break; - case ENTMAC: /* When MAC sends a msg to Scheduler instance */ - switch(pst->event) - { -#ifdef LCSCH - case EVTINFDEDBOUPDTREQ: - cmUnpkMacSchDedBoUpdtReq(RgMacSchDedBoUpdtReq, pst, mBuf); - break; - case EVTINFCMNBOUPDTREQ: - cmUnpkMacSchCmnBoUpdtReq(RgMacSchCmnBoUpdtReq, pst, mBuf); - break; - case EVTINFSFRECPIND: - cmUnpkMacSchSfRecpInd(RgMacSchSfRecpInd, pst, mBuf); - break; - /*Fix: start: Inform UE delete to scheduler*/ - case EVTINFUEDELIND: - cmUnpkMacSchUeDelInd(RgMacSchUeDelInd, pst, mBuf); - break; - /*Fix: end: Inform UE delete to scheduler*/ -#ifdef LTE_L2_MEAS - case EVTINFL2MEASCFM: - cmUnpkMacSchL2MeasCfm(RgMacSchL2MeasCfm, pst, mBuf); - break; - case EVTINFL2MEASSTOPCFM: - cmUnpkMacSchL2MeasCfm(RgMacSchL2MeasStopCfm, pst, mBuf); - break; -#endif -#endif - case EVENT_SLOT_IND_TO_SCH: - unpackMacSchSlotInd(MacSchSlotInd, pst, mBuf); - break; - default: - RGSCH_FREE_MSG(mBuf); - break; - } + case EVENT_SCH_GEN_CFG: + { + SchProcGenCfgReq(pst, (RgMngmt *)msg); + break; + } + case EVENT_SLICE_CFG_REQ_TO_SCH: + { + SchProcSliceCfgReq(pst, (SchSliceCfgReq *)msg); + break; + } + case EVENT_SLICE_RECFG_REQ_TO_SCH: + { + SchProcSliceRecfgReq(pst, (SchSliceRecfgReq *)msg); + break; + } + case EVENT_SCH_CELL_CFG: + { + SchProcCellCfgReq(pst, (SchCellCfg *)msg); + break; + } + case EVENT_SLOT_IND_TO_SCH: + { + SchProcSlotInd(pst, (SlotTimingInfo *)msg); + break; + } + case EVENT_ADD_UE_CONFIG_REQ_TO_SCH: + { + SchAddUeConfigReq(pst, (SchUeCfgReq *)msg); + break; + } + case EVENT_MODIFY_UE_CONFIG_REQ_TO_SCH: + { + SchModUeConfigReq(pst, (SchUeRecfgReq *)msg); + break; + } + case EVENT_UL_CQI_TO_SCH: + { + SchProcUlCqiInd(pst, (SchUlCqiInd *)msg); + break; + } + case EVENT_DL_CQI_TO_SCH: + { + SchProcDlCqiInd(pst, (SchDlCqiInd *)msg); break; + } + case EVENT_PHR_IND_TO_SCH: + { + SchProcPhrInd(pst, (SchPwrHeadroomInd *)msg); + break; + } + case EVENT_RACH_IND_TO_SCH: + { + SchProcRachInd(pst, (RachIndInfo *)msg); + break; + } + case EVENT_CRC_IND_TO_SCH: + { + SchProcCrcInd(pst, (CrcIndInfo *)msg); + break; + } + case EVENT_DL_RLC_BO_INFO_TO_SCH: + { + SchProcDlRlcBoInfo(pst, (DlRlcBoInfo *)msg); + break; + } + case EVENT_SHORT_BSR: + case EVENT_LONG_BSR: + { + SchProcBsr(pst, (UlBufferStatusRptInd *)msg); + break; + } + case EVENT_UCI_IND_TO_SCH: + { + SchProcSrUciInd(pst, (SrUciIndInfo *)msg); + break; + } + case EVENT_UE_DELETE_REQ_TO_SCH: + { + SchProcUeDeleteReq(pst, (SchUeDelete *)msg); + break; + } + case EVENT_CELL_DELETE_REQ_TO_SCH: + { + SchProcCellDeleteReq(pst, (SchCellDeleteReq *)msg); + break; + } + case EVENT_RACH_RESOURCE_REQUEST_TO_SCH: + { + SchProcRachRsrcReq(pst, (SchRachRsrcReq *)msg); + break; + } + case EVENT_RACH_RESOURCE_RELEASE_TO_SCH: + { + SchProcRachRsrcRel(pst, (SchRachRsrcRel *)msg); + break; + } + case EVENT_PAGING_IND_TO_SCH: + { + SchProcPagingInd(pst, (SchPageInd *)msg); + break; + } + case EVENT_DL_HARQ_IND_TO_SCH: + { + SchProcDlHarqInd(pst, (DlHarqInd *)msg); + break; + } + case EVENT_STATISTICS_REQ_TO_SCH: + { + SchProcStatsReq(pst, (SchStatsReq *)msg); + break; + } default: - RGSCH_FREE_MSG(mBuf); - break; + { + DU_LOG("\nERROR --> SCH : SchMessageRouter(): Invalid event [%d] received", pst->event); + return RFAILED; + } } - ODU_EXIT_TASK(); return ROK; -}/* end of schActvTsk */ +} -#endif /**********************************************************************