From: Harshita Lal Date: Wed, 8 Feb 2023 08:42:40 +0000 (+0000) Subject: Merge "[EPIC-ID: ODUHIGH-488][TASK-ID: ODUHIGH-494]SCH framework update to support... X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=fa6899dae4aee415bbcfd00760b6e2b312ddceec;hp=-c;p=o-du%2Fl2.git Merge "[EPIC-ID: ODUHIGH-488][TASK-ID: ODUHIGH-494]SCH framework update to support different scheduling algorithms" --- fa6899dae4aee415bbcfd00760b6e2b312ddceec diff --combined src/5gnrmac/mac_cfg_hdl.c index 4868e2b4f,4211c731f..23c1bf77a --- a/src/5gnrmac/mac_cfg_hdl.c +++ b/src/5gnrmac/mac_cfg_hdl.c @@@ -42,20 -42,6 +42,6 @@@ packMacCellCfgConfirm packMacCellCfmOpt packMacCellCfgCfm, /* packing for light weight loosly coupled */ }; - SchCellCfgFunc SchCellCfgOpts[] = - { - packSchCellCfg, /* packing for loosely coupled */ - SchHdlCellCfgReq, /* packing for tightly coupled */ - packSchCellCfg /* packing for light weight loosly coupled */ - }; - - MacSchCellDeleteReqFunc macSchCellDeleteReqOpts[]= - { - packMacSchCellDeleteReq, /* packing for loosely coupled */ - MacSchCellDeleteReq, /* packing for tightly coupled */ - packMacSchCellDeleteReq /* packing for light weight loosely coupled */ - }; - MacDuCellDeleteRspFunc macDuCellDeleteRspOpts[] = { packDuMacCellDeleteRsp, /* packing for loosely coupled */ @@@ -77,13 -63,6 +63,6 @@@ MacDuSliceRecfgRspFunc macDuSliceRecfgR packDuMacSliceRecfgRsp /* packing for light weight loosly coupled */ }; - MacSchPagingIndFunc macSchPagingIndOpts[] = - { - packMacSchPagingInd, /* packing for loosely coupled */ - MacSchPagingInd, /* packing for tightly coupled */ - packMacSchPagingInd /* packing for light weight loosely coupled */ - }; - /** * @brief Layer Manager Configuration request handler for Scheduler * @@@ -103,12 -82,11 +82,11 @@@ uint8_t MacSchGenCfgReq(Pst *pst, RgMng { Pst schPst; - printf("\nReceived Scheduler gen config at MAC"); + DU_LOG("\nINFO --> MAC : Received Scheduler gen config at MAC"); memset(&schPst, 0, sizeof(Pst)); FILL_PST_MAC_TO_SCH(schPst, EVENT_SCH_GEN_CFG); - SchProcGenCfgReq(&schPst, cfg); - - return ROK; + + return(SchMessageRouter(&schPst, (void *)cfg)); } /** @@@ -128,7 -106,7 +106,7 @@@ **/ uint8_t SchSendCfgCfm(Pst *pst, RgMngmt *cfm) { - DU_LOG("\nDEBUG --> Sending Scheduler config confirm to DU APP"); + DU_LOG("\nDEBUG --> MAC : Sending Scheduler config confirm to DU APP"); pst->dstEnt = ENTDUAPP; pst->dstInst = 0; pst->srcInst = 0; @@@ -252,7 -230,7 +230,7 @@@ uint8_t MacSchCellCfgReq(Pst *pst, MacC { SchCellCfg schCellCfg; Pst cfgPst; - uint8_t ssbMaskIdx = 0, rsrcListIdx = 0, ret=0, sliceIdx=0; + uint8_t ssbMaskIdx = 0, rsrcListIdx = 0, sliceIdx=0; memset(&cfgPst, 0, sizeof(Pst)); memset(&schCellCfg, 0, sizeof(SchCellCfg)); @@@ -395,8 -373,7 +373,7 @@@ FILL_PST_MAC_TO_SCH(cfgPst, EVENT_SCH_CELL_CFG); - ret = (*SchCellCfgOpts[cfgPst.selector])(&cfgPst, &schCellCfg); - return ret; + return(SchMessageRouter(&cfgPst, (void *)&schCellCfg)); } /* end of MacSchCellCfgReq */ @@@ -644,7 -621,7 +621,7 @@@ uint8_t sendCellDelReqToSch(SchCellDele { Pst schPst; FILL_PST_MAC_TO_SCH(schPst, EVENT_CELL_DELETE_REQ_TO_SCH); - return(*macSchCellDeleteReqOpts[schPst.selector])(&schPst, schCellDelReq); + return(SchMessageRouter(&schPst, (void *)schCellDelReq)); } /******************************************************************* @@@ -735,35 -712,24 +712,35 @@@ uint8_t MacProcCellDeleteReq(Pst *pst, **/ void freeMacSliceCfgReq(MacSliceCfgReq *cfgReq,Pst *pst) { - uint8_t cfgIdx = 0; - - if(cfgReq) - { - if(cfgReq->numOfConfiguredSlice) - { - for(cfgIdx = 0; cfgIdxnumOfConfiguredSlice; cfgIdx++) - { - if(cfgReq->listOfSliceCfg[cfgIdx]) - { - MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cfgReq->listOfSliceCfg[cfgIdx]->rrmPolicyRatio, sizeof(RrmPolicyRatio)); - } - MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cfgReq->listOfSliceCfg[cfgIdx], sizeof(MacSliceRrmPolicy)); - } - MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cfgReq->listOfSliceCfg, cfgReq->numOfConfiguredSlice * sizeof(MacSliceRrmPolicy*)); - } - MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cfgReq, sizeof(MacSliceCfgReq)); - } + uint8_t policyIdx = 0, memberListIdx=0; + + if(cfgReq->numOfRrmPolicy) + { + if(cfgReq->listOfRrmPolicy) + { + for(policyIdx = 0; policyIdxnumOfRrmPolicy; policyIdx++) + { + if(cfgReq->listOfRrmPolicy[policyIdx]) + { + if(cfgReq->listOfRrmPolicy[policyIdx]->numOfRrmPolicyMem) + { + if(cfgReq->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList) + { + for(memberListIdx = 0; memberListIdxlistOfRrmPolicy[policyIdx]->numOfRrmPolicyMem; memberListIdx++) + { + MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cfgReq->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx], sizeof(RrmPolicyMemberList)); + } + MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cfgReq->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList,\ + cfgReq->listOfRrmPolicy[policyIdx]->numOfRrmPolicyMem * sizeof(RrmPolicyMemberList*)); + } + } + MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cfgReq->listOfRrmPolicy[policyIdx], sizeof(MacSliceRrmPolicy)); + } + } + MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cfgReq->listOfRrmPolicy, cfgReq->numOfRrmPolicy * sizeof(MacSliceRrmPolicy*)); + } + } + } /** * @brief fill Mac Slice Config Rsp @@@ -1038,7 -1004,7 +1015,7 @@@ uint8_t MacProcDlPcchInd(Pst *pst, DlPc memcpy(schPageInd->pagePdu, pcchInd->pcchPdu, pcchInd->pduLen); FILL_PST_MAC_TO_SCH(schPst, EVENT_PAGING_IND_TO_SCH); - ret = (*macSchPagingIndOpts[schPst.selector])(&schPst, schPageInd); + ret = SchMessageRouter(&schPst, (void *)schPageInd); } } } diff --combined src/5gnrmac/mac_msg_hdl.c index fb560cd04,0b3e34d12..7e015afee --- a/src/5gnrmac/mac_msg_hdl.c +++ b/src/5gnrmac/mac_msg_hdl.c @@@ -38,61 -38,6 +38,6 @@@ MacCb macCb; - /* Function pointer for sending crc ind from MAC to SCH */ - MacSchCrcIndFunc macSchCrcIndOpts[]= - { - packMacSchCrcInd, - MacSchCrcInd, - packMacSchCrcInd - }; - - /* Function pointer for sending DL RLC BO Info from MAC to SCH */ - MacSchDlRlcBoInfoFunc macSchDlRlcBoInfoOpts[]= - { - packMacSchDlRlcBoInfo, - MacSchDlRlcBoInfo, - packMacSchDlRlcBoInfo - }; - - /* Function pointer for sending short BSR from MAC to SCH */ - MacSchBsrFunc macSchBsrOpts[]= - { - packMacSchBsr, - MacSchBsr, - packMacSchBsr - }; - - /* Function pointer for sending SR Uci ind from MAC to SCH */ - MacSchSrUciIndFunc macSchSrUciIndOpts[]= - { - packMacSchSrUciInd, - MacSchSrUciInd, - packMacSchSrUciInd - }; - - /* Function pointer for sending DL HARQ Ind from MAC to SCH */ - MacSchDlHarqIndFunc macSchDlHarqIndOpts[]= - { - packMacSchDlHarqInd, - MacSchDlHarqInd, - packMacSchDlHarqInd - }; - - /* Function pointer for sending Slice cfg ind from MAC to SCH */ - MacSchSliceCfgReqFunc macSchSliceCfgReqOpts[]= - { - packMacSchSliceCfgReq, - MacSchSliceCfgReq, - packMacSchSliceCfgReq - }; - - /* Function pointer for sending Slice cfg ind from MAC to SCH */ - MacSchSliceRecfgReqFunc macSchSliceRecfgReqOpts[]= - { - packMacSchSliceRecfgReq, - MacSchSliceRecfgReq, - packMacSchSliceRecfgReq - }; /******************************************************************* * * @brief Sends DL BO Info to SCH @@@ -114,7 -59,7 +59,7 @@@ uint8_t sendDlRlcBoInfoToSch(DlRlcBoInf Pst pst; FILL_PST_MAC_TO_SCH(pst, EVENT_DL_RLC_BO_INFO_TO_SCH); - return(*macSchDlRlcBoInfoOpts[pst.selector])(&pst, dlBoInfo); + return(SchMessageRouter(&pst, (void *)dlBoInfo)); } /******************************************************************* @@@ -138,7 -83,7 +83,7 @@@ uint8_t sendCrcIndMacToSch(CrcIndInfo * Pst pst; FILL_PST_MAC_TO_SCH(pst, EVENT_CRC_IND_TO_SCH); - return(*macSchCrcIndOpts[pst.selector])(&pst, crcInd); + return(SchMessageRouter(&pst, (void *)crcInd)); } /******************************************************************* @@@ -688,7 -633,7 +633,7 @@@ uint8_t macProcShortBsr(uint16_t cellId bsrInd.dataVolInfo[0].dataVol = bufferSize; FILL_PST_MAC_TO_SCH(pst, EVENT_SHORT_BSR); - return(*macSchBsrOpts[pst.selector])(&pst, &bsrInd); + return(SchMessageRouter(&pst, (void *)&bsrInd)); } /******************************************************************* @@@ -730,7 -675,7 +675,7 @@@ uint8_t macProcLongBsr(uint16_t cellId memcpy(&(bsrInd.dataVolInfo[lcgIdx]), &(dataVolInfo[lcgIdx]), sizeof(DataVolInfo)); FILL_PST_MAC_TO_SCH(pst, EVENT_LONG_BSR); - return(*macSchBsrOpts[pst.selector])(&pst, &bsrInd); + return(SchMessageRouter(&pst, (void *)&bsrInd)); } /******************************************************************* @@@ -774,7 -719,7 +719,7 @@@ uint8_t buildAndSendHarqInd(HarqInfoF0F /* Fill Pst */ FILL_PST_MAC_TO_SCH(pst, EVENT_DL_HARQ_IND_TO_SCH); - return(*macSchDlHarqIndOpts[pst.selector])(&pst, &dlHarqInd); + return SchMessageRouter(&pst, (void *)&dlHarqInd); } @@@ -814,7 -759,7 +759,7 @@@ uint8_t buildAndSendSrInd(UciInd *macUc /* Fill Pst */ FILL_PST_MAC_TO_SCH(pst, EVENT_UCI_IND_TO_SCH); - return(*macSchSrUciIndOpts[pst.selector])(&pst, &srUciInd); + return(SchMessageRouter(&pst, (void *)&srUciInd)); } /******************************************************************* @@@ -900,50 -845,46 +845,50 @@@ uint8_t FapiMacUciInd(Pst *pst, UciInd * RFAILED - failure * **********************************************************************/ - uint8_t fillSliceCfgInfo(SchSliceCfgReq *schSliceCfgReq, MacSliceCfgReq *macSliceCfgReq) - { - uint8_t cfgIdx = 0; - - if(macSliceCfgReq->listOfSliceCfg) - { - schSliceCfgReq->numOfConfiguredSlice = macSliceCfgReq->numOfConfiguredSlice; - MAC_ALLOC(schSliceCfgReq->listOfConfirguration, schSliceCfgReq->numOfConfiguredSlice *sizeof(SchRrmPolicyOfSlice*)); - if(schSliceCfgReq->listOfConfirguration == NULLP) - { - DU_LOG("\nERROR --> MAC : Memory allocation failed in fillSliceCfgInfo"); - return RFAILED; - } - for(cfgIdx = 0; cfgIdxnumOfConfiguredSlice; cfgIdx++) - { - MAC_ALLOC(schSliceCfgReq->listOfConfirguration[cfgIdx], sizeof(SchRrmPolicyOfSlice)); - if(schSliceCfgReq->listOfConfirguration[cfgIdx] == NULLP) - { - DU_LOG("\nERROR --> MAC : Memory allocation failed in fillSliceCfgInfo"); - return RFAILED; - } - - memcpy(&schSliceCfgReq->listOfConfirguration[cfgIdx]->snssai, &macSliceCfgReq->listOfSliceCfg[cfgIdx]->snssai, sizeof(Snssai)); - - if(macSliceCfgReq->listOfSliceCfg[cfgIdx]->rrmPolicyRatio) - { - MAC_ALLOC(schSliceCfgReq->listOfConfirguration[cfgIdx]->rrmPolicyRatioInfo, sizeof(SchRrmPolicyRatio)); - if(schSliceCfgReq->listOfConfirguration[cfgIdx]->rrmPolicyRatioInfo == NULLP) - { - DU_LOG("\nERROR --> MAC : Memory allocation failed in fillSliceCfgInfo"); - return RFAILED; - } - schSliceCfgReq->listOfConfirguration[cfgIdx]->rrmPolicyRatioInfo->policyMaxRatio = macSliceCfgReq->listOfSliceCfg[cfgIdx]->rrmPolicyRatio->policyMaxRatio; - schSliceCfgReq->listOfConfirguration[cfgIdx]->rrmPolicyRatioInfo->policyMinRatio = macSliceCfgReq->listOfSliceCfg[cfgIdx]->rrmPolicyRatio->policyMinRatio; - schSliceCfgReq->listOfConfirguration[cfgIdx]->rrmPolicyRatioInfo->policyDedicatedRatio = macSliceCfgReq->listOfSliceCfg[cfgIdx]->rrmPolicyRatio->policyDedicatedRatio; - } - } - } - return ROK; - } +uint8_t fillSliceCfgInfo(SchSliceCfgReq *schSliceCfgReq, MacSliceCfgReq *macSliceCfgReq) +{ + uint8_t cfgIdx = 0, memberListIdx = 0, totalSliceCfgRecvd = 0; + + if(macSliceCfgReq->listOfRrmPolicy) + { + for(cfgIdx = 0; cfgIdxnumOfRrmPolicy; cfgIdx++) + { + totalSliceCfgRecvd += macSliceCfgReq->listOfRrmPolicy[cfgIdx]->numOfRrmPolicyMem; + } + + schSliceCfgReq->numOfConfiguredSlice = totalSliceCfgRecvd; + MAC_ALLOC(schSliceCfgReq->listOfSlices, schSliceCfgReq->numOfConfiguredSlice *sizeof(SchRrmPolicyOfSlice*)); + if(schSliceCfgReq->listOfSlices == NULLP) + { + DU_LOG("\nERROR --> MAC : Memory allocation failed in fillSliceCfgInfo"); + return RFAILED; + } + for(cfgIdx = 0; cfgIdxnumOfConfiguredSlice; cfgIdx++) + { + for(memberListIdx = 0; memberListIdxlistOfRrmPolicy[cfgIdx]->numOfRrmPolicyMem; memberListIdx++) + { + if(macSliceCfgReq->listOfRrmPolicy[cfgIdx]->rRMPolicyMemberList[memberListIdx]) + { + + MAC_ALLOC(schSliceCfgReq->listOfSlices[cfgIdx], sizeof(SchRrmPolicyOfSlice)); + if(schSliceCfgReq->listOfSlices[cfgIdx] == NULLP) + { + DU_LOG("\nERROR --> MAC : Memory allocation failed in fillSliceCfgInfo"); + return RFAILED; + } + + memcpy(&schSliceCfgReq->listOfSlices[cfgIdx]->snssai, &macSliceCfgReq->listOfRrmPolicy[cfgIdx]->rRMPolicyMemberList[memberListIdx]->snssai, sizeof(Snssai)); + + schSliceCfgReq->listOfSlices[cfgIdx]->rrmPolicyRatioInfo.maxRatio = macSliceCfgReq->listOfRrmPolicy[cfgIdx]->policyRatio.maxRatio; + schSliceCfgReq->listOfSlices[cfgIdx]->rrmPolicyRatioInfo.minRatio = macSliceCfgReq->listOfRrmPolicy[cfgIdx]->policyRatio.minRatio; + schSliceCfgReq->listOfSlices[cfgIdx]->rrmPolicyRatioInfo.dedicatedRatio = macSliceCfgReq->listOfRrmPolicy[cfgIdx]->policyRatio.dedicatedRatio; + } + } + } + } + return ROK; +} + /******************************************************************* * * @brief Processes Slice Cfg Request recived from DU @@@ -981,7 -922,7 +926,7 @@@ uint8_t MacProcSliceCfgReq(Pst *pst, Ma if(fillSliceCfgInfo(schSliceCfgReq, macSliceCfgReq) == ROK) { FILL_PST_MAC_TO_SCH(schPst, EVENT_SLICE_CFG_REQ_TO_SCH); - ret = (*macSchSliceCfgReqOpts[schPst.selector])(&schPst, schSliceCfgReq); + ret = SchMessageRouter(&schPst, (void *)schSliceCfgReq); } } freeMacSliceCfgReq(macSliceCfgReq, pst); @@@ -1030,8 -971,9 +975,8 @@@ uint8_t MacProcSliceRecfgReq(Pst *pst, if(fillSliceCfgInfo(schSliceRecfgReq, macSliceRecfgReq) == ROK) { FILL_PST_MAC_TO_SCH(schPst, EVENT_SLICE_RECFG_REQ_TO_SCH); - ret = (*macSchSliceRecfgReqOpts[schPst.selector])(&schPst, schSliceRecfgReq); + ret = SchMessageRouter(&schPst, (void *)schSliceRecfgReq); } - } freeMacSliceCfgReq(macSliceRecfgReq, pst); } diff --combined src/5gnrsch/sch.c index 3e924d877,5eb32b1e3..32ab5c23f --- a/src/5gnrsch/sch.c +++ b/src/5gnrsch/sch.c @@@ -47,30 -47,7 +47,7 @@@ #include "mac_sch_interface.h" #include "sch.h" #include "sch_utils.h" - - - /* local defines */ - SchCellCfgCfmFunc SchCellCfgCfmOpts[] = - { - packSchCellCfgCfm, /* LC */ - MacProcSchCellCfgCfm, /* TC */ - packSchCellCfgCfm /* LWLC */ - }; - - SchSliceCfgRspFunc SchSliceCfgRspOpts[] = - { - packSchSliceCfgRsp, /* LC */ - MacProcSchSliceCfgRsp, /* TC */ - packSchSliceCfgRsp /* LWLC */ - - }; - - SchSliceRecfgRspFunc SchSliceRecfgRspOpts[] = - { - packSchSliceRecfgRsp, /* LC */ - MacProcSchSliceRecfgRsp, /* TC */ - packSchSliceRecfgRsp /* LWLC */ - }; + #include "sch_fcfs.h" /** * @brief Task Initiation function. @@@ -113,6 -90,24 +90,24 @@@ uint8_t schActvInit(Ent entity, Inst in return ROK; } /* schActvInit */ + /** + * @brief Scheduler All Apis initialized. + * + * @details + * + * Function : schAllApisInit + * + * This function initializes all Scheduler APIs/functionality for each kind + * of scheduler type. + * + * @param[in] Inst inst, the Scheduler instance + * @return void + **/ + void schAllApisInit(Inst inst) + { + schFcfsAllApisInit(&schCb[inst].allApis[SCH_FCFS]); + } + /** * @brief Scheduler instance Configuration Handler. * @@@ -178,7 -173,8 +173,8 @@@ uint8_t SchInstCfg(RgCfg *cfg, Inst dI /* Set Config done in TskInit */ schCb[inst].schInit.cfgDone = TRUE; DU_LOG("\nINFO --> SCH : Scheduler gen config done"); - + + schAllApisInit(inst); return ret; } @@@ -207,10 -203,6 +203,6 @@@ uint8_t SchProcGenCfgReq(Pst *pst, RgMn RgMngmt cfm; Pst cfmPst; - #ifdef CALL_FLOW_DEBUG_LOG - DU_LOG("\nCall Flow: ENTMAC -> ENTSCH : GENERAL_CFG_REQ\n"); - #endif - if(pst->dstInst < SCH_INST_START) { DU_LOG("\nERROR --> SCH : Invalid inst ID"); @@@ -257,92 -249,6 +249,6 @@@ return ROK; }/*-- SchProcGenCfgReq --*/ - /** - * @brief slot indication from MAC to SCH. - * - * @details - * - * Function : MacSchSlotInd - * - * This API is invoked by PHY to indicate slot indication to Scheduler for - * a cell. - * - * @param[in] Pst *pst - * @param[in] SlotTimingInfo *slotInd - * @return S16 - * -# ROK - * -# RFAILED - **/ - uint8_t MacSchSlotInd(Pst *pst, SlotTimingInfo *slotInd) - { - Inst inst = pst->dstInst-SCH_INST_START; - - #ifdef CALL_FLOW_DEBUG_LOG - DU_LOG("\nCall Flow: ENTMAC -> ENTSCH : EVENT_SLOT_IND_TO_SCH\n"); - #endif - - schProcessSlotInd(slotInd, inst); - - return ROK; - } /* MacSchSlotInd */ - - /******************************************************************* - * - * @brief Processes Rach indication from MAC - * - * @details - * - * Function : MacSchRachInd - * - * Functionality: - * Processes Rach indication from MAC - * - * @params[in] - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ - uint8_t MacSchRachInd(Pst *pst, RachIndInfo *rachInd) - { - Inst inst = pst->dstInst-SCH_INST_START; - - #ifdef CALL_FLOW_DEBUG_LOG - DU_LOG("\nCall Flow: ENTMAC -> ENTSCH : EVENT_RACH_IND_TO_SCH\n"); - #endif - - DU_LOG("\nINFO --> SCH : Received Rach indication"); - schProcessRachInd(rachInd, inst); - return ROK; - } - - /******************************************************************* - * - * @brief Processes CRC indication from MAC - * - * @details - * - * Function : MacSchCrcInd - * - * Functionality: - * Processes CRC indication from MAC - * - * @params[in] Post structure - * Crc Indication - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ - uint8_t MacSchCrcInd(Pst *pst, CrcIndInfo *crcInd) - { - Inst inst = pst->dstInst-SCH_INST_START; - #ifdef CALL_FLOW_DEBUG_LOG - DU_LOG("\nCall Flow: ENTMAC -> ENTSCH : EVENT_CRC_IND_TO_SCH\n"); - #endif - - schProcessCrcInd(crcInd, inst); - return ROK; - } - #ifdef NR_TDD /** *@brief Returns TDD periodicity in micro seconds @@@ -664,7 -570,6 +570,6 @@@ uint8_t schInitCellCb(Inst inst, SchCel cell->firstSsbTransmitted = false; cell->firstSib1Transmitted = false; fillSsbStartSymb(cell); - cmLListInit(&cell->ueToBeScheduled); #ifdef NR_DRX memset(cell->drxCb, 0, MAX_DRX_SIZE*sizeof(SchDrxCb)); @@@ -853,7 -758,7 +758,7 @@@ void fillSchSib1Cfg(uint8_t mu, uint8_ * -# ROK * -# RFAILED **/ - uint8_t SchHdlCellCfgReq(Pst *pst, SchCellCfg *schCellCfg) + uint8_t SchProcCellCfgReq(Pst *pst, SchCellCfg *schCellCfg) { uint8_t ret = ROK; SchCellCb *cellCb; @@@ -866,10 -771,6 +771,6 @@@ uint8_t freqDomainResource[FREQ_DOM_RSRC_SIZE] = {0}; SchPdschConfig pdschCfg; - #ifdef CALL_FLOW_DEBUG_LOG - DU_LOG("\nCall Flow: ENTMAC -> ENTSCH : EVENT_SCH_CELL_CFG\n"); - #endif - schInitCellCb(inst, schCellCfg); cellCb = schCb[inst].cells[inst]; //cells is of MAX_CELLS, why inst cellCb->macInst = pst->srcInst; @@@ -907,6 -808,10 +808,10 @@@ cellCb->cellCfg.schHqCfg.maxUlDataHqTx = SCH_MAX_NUM_UL_HQ_TX; cellCb->cellCfg.schRachCfg.maxMsg3Tx = SCH_MAX_NUM_MSG3_TX; + cellCb->schAlgoType = SCH_FCFS; + cellCb->api = &schCb[inst].allApis[cellCb->schAlgoType]; /* For FCFS */ + cellCb->api->SchCellCfgReq(cellCb); + /* Fill and send Cell config confirm */ memset(&rspPst, 0, sizeof(Pst)); FILL_PST_SCH_TO_MAC(rspPst, pst->dstInst); @@@ -915,9 -820,198 +820,198 @@@ schCellCfgCfm.cellId = schCellCfg->cellId; schCellCfgCfm.rsp = RSP_OK; - ret = (*SchCellCfgCfmOpts[rspPst.selector])(&rspPst, &schCellCfgCfm); + ret = MacMessageRouter(&rspPst, (void *)&schCellCfgCfm); + return ret; + + } + + /******************************************************************* + * + * @brief Fill and send Cell delete response to MAC + * + * @details + * + * Function : SchSendCellDeleteRspToMac + * + * Functionality: Fill and send Cell delete response to MAC + * + * @params[in] SchCellDelete *ueDelete, Inst inst, SchMacRsp result + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + uint8_t SchSendCellDeleteRspToMac(SchCellDeleteReq *ueDelete, Inst inst, SchMacRsp result) + { + Pst rspPst; + uint8_t ret=0; + + SchCellDeleteRsp delRsp; + + DU_LOG("\nINFO --> SCH : Filling Cell Delete response"); + memset(&delRsp, 0, sizeof(SchCellDeleteRsp)); + delRsp.cellId = ueDelete->cellId; + delRsp.rsp = result; + + /* Filling response post */ + memset(&rspPst, 0, sizeof(Pst)); + FILL_PST_SCH_TO_MAC(rspPst, inst); + rspPst.event = EVENT_CELL_DELETE_RSP_TO_MAC; + ret = MacMessageRouter(&rspPst, (void *)&delRsp); + if(ret == RFAILED) + { + DU_LOG("\nERROR --> SCH : SchSendCellDeleteRspToMac(): failed to send the Cell Delete response"); + return ret; + } return ret; + } + + /******************************************************************* + * + * @brief Function for cellCb Deletion + * + * @details + * + * Function : deleteSchCellCb + * + * Functionality: Function for cellCb Deletion + * + * @params[in] SchCellDelete *cellDelete + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + void deleteSchCellCb(SchCellCb *cellCb) + { + uint8_t sliceIdx=0, slotIdx=0; + CmLListCp *list=NULL; + CmLList *node=NULL, *next=NULL; + SchPageInfo *tempNode = NULLP; + + if(cellCb->schDlSlotInfo) + { + for(slotIdx=0; slotIdxnumSlots; slotIdx++) + { + list = &cellCb->schDlSlotInfo[slotIdx]->prbAlloc.freePrbBlockList; + node = list->first; + while(node) + { + next = node->next; + SCH_FREE(node->node, sizeof(FreePrbBlock)); + deleteNodeFromLList(list, node); + node = next; + } + SCH_FREE(cellCb->schDlSlotInfo[slotIdx], sizeof(SchDlSlotInfo)); + } + SCH_FREE(cellCb->schDlSlotInfo, cellCb->numSlots *sizeof(SchDlSlotInfo*)); + } + + if(cellCb->schUlSlotInfo) + { + for(slotIdx=0; slotIdxnumSlots; slotIdx++) + { + list = &cellCb->schUlSlotInfo[slotIdx]->prbAlloc.freePrbBlockList; + node = list->first; + while(node) + { + next = node->next; + SCH_FREE(node->node, sizeof(FreePrbBlock)); + deleteNodeFromLList(list, node); + node = next; + } + SCH_FREE(cellCb->schUlSlotInfo[slotIdx], sizeof(SchUlSlotInfo)); + } + SCH_FREE(cellCb->schUlSlotInfo, cellCb->numSlots * sizeof(SchUlSlotInfo*)); + } + if(cellCb->cellCfg.plmnInfoList.snssai) + { + for(sliceIdx=0; sliceIdxcellCfg.plmnInfoList.numSliceSupport; sliceIdx++) + { + SCH_FREE(cellCb->cellCfg.plmnInfoList.snssai[sliceIdx], sizeof(Snssai)); + } + SCH_FREE(cellCb->cellCfg.plmnInfoList.snssai, cellCb->cellCfg.plmnInfoList.numSliceSupport*sizeof(Snssai*)); + } + + for(uint16_t idx =0; idxpageCb.pageIndInfoRecord[idx]; + node = list->first; + while(node) + { + next = node->next; + if(node->node) + { + tempNode = (SchPageInfo*)(node->node); + SCH_FREE(tempNode->pagePdu, tempNode->msgLen); + SCH_FREE(node->node, sizeof(SchPageInfo)); + } + deleteNodeFromLList(list, node); + node = next; + } + } + + cellCb->api->SchCellDeleteReq(cellCb); + + memset(cellCb, 0, sizeof(SchCellCb)); + } + + /******************************************************************* + * + * @brief Function for cell Delete request from MAC to SCH + * + * @details + * + * Function : SchProcCellDeleteReq + * + * Functionality: Function for cell Delete request from MAC to SCH + * + * @params[in] Pst *pst, SchCellDelete *cellDelete + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + uint8_t SchProcCellDeleteReq(Pst *pst, SchCellDeleteReq *cellDelete) + { + uint8_t cellIdx=0, ret = RFAILED; + Inst inst = pst->dstInst - SCH_INST_START; + SchMacRsp result= RSP_OK; + + if(!cellDelete) + { + DU_LOG("\nERROR --> SCH : SchProcCellDeleteReq(): Ue Delete request failed"); + } + else + { + GET_CELL_IDX(cellDelete->cellId, cellIdx); + if(schCb[inst].cells[cellIdx] == NULLP) + { + DU_LOG("\nERROR --> SCH : SchProcCellDeleteReq(): cell Id[%d] is not available", cellDelete->cellId); + result = RSP_NOK; + } + else + { + if(schCb[inst].cells[cellIdx]->cellId == cellDelete->cellId) + { + deleteSchCellCb(schCb[inst].cells[cellIdx]); + result = RSP_OK; + ret = ROK; + SCH_FREE(schCb[inst].cells[cellIdx], sizeof(SchCellCb)); + DU_LOG("\nINFO --> SCH : Sending Cell Delete response to MAC"); + } + else + { + DU_LOG("\nERROR --> SCH : SchProcCellDeleteReq(): cell Id[%d] is not available",cellDelete->cellId); + result = RSP_NOK; + } + } + + if(SchSendCellDeleteRspToMac(cellDelete, inst, result)!=ROK) + { + DU_LOG("\nERROR --> SCH : SchProcCellDeleteReq(): failed to send Cell Delete response"); + ret = RFAILED; + } + } + return ret; } /******************************************************************* @@@ -926,7 -1020,7 +1020,7 @@@ * * @details * - * Function : MacSchDlRlcBoInfo + * Function : SchProcDlRlcBoInfo * * Functionality: * Processes DL RLC BO info from MAC @@@ -936,7 -1030,7 +1030,7 @@@ * RFAILED - failure * * ****************************************************************/ - uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo) + uint8_t SchProcDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo) { uint8_t lcId = 0; uint16_t ueId = 0; @@@ -945,15 -1039,12 +1039,12 @@@ SchCellCb *cell = NULLP; Inst inst = pst->dstInst-SCH_INST_START; - #ifdef CALL_FLOW_DEBUG_LOG - DU_LOG("\nCall Flow: ENTMAC -> ENTSCH : EVENT_DL_RLC_BO_INFO_TO_SCH\n"); - #endif DU_LOG("\nDEBUG --> SCH : Received RLC BO Status indication LCId [%d] BO [%d]", dlBoInfo->lcId, dlBoInfo->dataVolume); cell = schCb[inst].cells[inst]; if(cell == NULLP) { - DU_LOG("\nERROR --> SCH : MacSchDlRlcBoInfo(): Cell does not exists"); + DU_LOG("\nERROR --> SCH : SchProcDlRlcBoInfo(): Cell does not exists"); return RFAILED; } @@@ -1004,7 -1095,7 +1095,7 @@@ } } /* Adding UE Id to list of pending UEs to be scheduled */ - addUeToBeScheduled(cell, ueId); + cell->api->SchDlRlcBoInfo(cell, ueId); return ROK; } @@@ -1014,7 -1105,7 +1105,7 @@@ * * @details * - * Function : MacSchBsr + * Function : SchProcBsr * * Functionality: * Processes DL BSR from MAC @@@ -1025,17 -1116,13 +1116,13 @@@ * RFAILED - failure * * ****************************************************************/ - uint8_t MacSchBsr(Pst *pst, UlBufferStatusRptInd *bsrInd) + uint8_t SchProcBsr(Pst *pst, UlBufferStatusRptInd *bsrInd) { Inst schInst = pst->dstInst-SCH_INST_START; SchCellCb *cellCb = NULLP; SchUeCb *ueCb = NULLP; uint8_t lcgIdx = 0; - #ifdef CALL_FLOW_DEBUG_LOG - DU_LOG("\nCall Flow: ENTMAC -> ENTSCH : EVENT_SHORT_BSR\n"); - #endif - DU_LOG("\nDEBUG --> SCH : Received BSR"); if(bsrInd == NULLP) { @@@ -1071,7 -1158,7 +1158,7 @@@ } /* Adding UE Id to list of pending UEs to be scheduled */ - addUeToBeScheduled(cellCb, ueCb->ueId); + cellCb->api->SchBsr(cellCb, ueCb->ueId); return ROK; } @@@ -1081,7 -1168,7 +1168,7 @@@ * * @details * - * Function : MacSchSrUciInd + * Function : SchProcSrUciInd * * Functionality: * Processes SR UCI indication from MAC @@@ -1092,17 -1179,13 +1179,13 @@@ * RFAILED - failure * * ****************************************************************/ - uint8_t MacSchSrUciInd(Pst *pst, SrUciIndInfo *uciInd) + uint8_t SchProcSrUciInd(Pst *pst, SrUciIndInfo *uciInd) { Inst inst = pst->dstInst-SCH_INST_START; SchUeCb *ueCb; SchCellCb *cellCb = schCb[inst].cells[inst]; - #ifdef CALL_FLOW_DEBUG_LOG - DU_LOG("\nCall Flow: ENTMAC -> ENTSCH : EVENT_UCI_IND_TO_SCH\n"); - #endif - DU_LOG("\nDEBUG --> SCH : Received SR"); ueCb = schGetUeCb(cellCb, uciInd->crnti); @@@ -1121,7 -1204,7 +1204,7 @@@ { ueCb->srRcvd = true; /* Adding UE Id to list of pending UEs to be scheduled */ - addUeToBeScheduled(cellCb, ueCb->ueId); + cellCb->api->SchSrUciInd(cellCb, ueCb->ueId); } return ROK; } @@@ -1132,7 -1215,7 +1215,7 @@@ * * @details * - * Function : MacSchDlHarqInd + * Function : SchProcDlHarqInd * * Functionality: * Processes DL HARQ indication from MAC @@@ -1143,16 -1226,12 +1226,12 @@@ * RFAILED - failure * * ****************************************************************/ - uint8_t MacSchDlHarqInd(Pst *pst, DlHarqInd *dlHarqInd) + uint8_t SchProcDlHarqInd(Pst *pst, DlHarqInd *dlHarqInd) { Inst inst = pst->dstInst-SCH_INST_START; SchUeCb *ueCb; SchCellCb *cellCb = schCb[inst].cells[inst]; - #ifdef CALL_FLOW_DEBUG_LOG - DU_LOG("\nCall Flow: ENTMAC -> ENTSCH : EVENT_DL_HARQ_IND_TO_SCH\n"); - #endif - DU_LOG("\nDEBUG --> SCH : Received HARQ"); ueCb = schGetUeCb(cellCb, dlHarqInd->crnti); @@@ -1440,58 -1519,6 +1519,6 @@@ uint8_t allocatePrbUl(SchCellCb *cell, return ROK; } - /******************************************************************* - * - * @brief Add UE to ueToBeScheduled List - * - * @details - * - * Function : addUeToBeScheduled - * - * Functionality: - * Search if UE entry present in the list - * If yes, return. - * If no, add UE to the list - * - * @params[in] Cell control block - * Ue Idx to be added - * - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ - uint8_t addUeToBeScheduled(SchCellCb *cell, uint8_t ueIdToAdd) - { - uint8_t *ueId; - CmLList *node; - - /* Search if UE entry is already present in ueToBeScheduled list. - * If yes, another entry for same UE not needed. Hence, return */ - node = cell->ueToBeScheduled.first; - while(node) - { - ueId = (uint8_t *)node->node; - if(*ueId == ueIdToAdd) - return ROK; - node = node->next; - } - - /* If UE entry not present already, add UE to the end of ueToBeScheduled list */ - SCH_ALLOC(ueId, sizeof(uint8_t)); - if(!ueId) - { - DU_LOG("\nERROR --> SCH : Memory allocation failure in addUeToBeScheduled"); - return RFAILED; - } - *ueId = ueIdToAdd; - if(addNodeToLList(&cell->ueToBeScheduled, ueId, NULLP) != ROK) - { - DU_LOG("\nERROR --> SCH : Failed to add ueId [%d] to cell->ueToBeScheduled list", *ueId); - return RFAILED; - } - return ROK; - } - /******************************************************************************* * * @brief Try to find Best Free Block with Max Num PRB @@@ -1652,7 -1679,7 +1679,7 @@@ void SchSendSliceCfgRspToMac(Inst inst FILL_PST_SCH_TO_MAC(rspPst, inst); rspPst.event = EVENT_SLICE_CFG_RSP_TO_MAC; - SchSliceCfgRspOpts[rspPst.selector](&rspPst, &sliceCfgRsp); + MacMessageRouter(&rspPst, (void *)&sliceCfgRsp); } /******************************************************************************* @@@ -1694,7 -1721,7 +1721,7 @@@ uint8_t fillSliceCfgRsp(bool sliceRecfg { for(sliceIdx = 0; sliceIdxcellCfg.plmnInfoList.numSliceSupport; sliceIdx++) { - if(!memcmp(&schSliceCfgReq->listOfConfirguration[cfgIdx]->snssai, cellCb->cellCfg.plmnInfoList.snssai[sliceIdx], sizeof(Snssai))) + if(!memcmp(&schSliceCfgReq->listOfSlices[cfgIdx]->snssai, cellCb->cellCfg.plmnInfoList.snssai[sliceIdx], sizeof(Snssai))) { (*count)++; sliceFound = true; @@@ -1705,11 -1732,11 +1732,11 @@@ else { /* Here comparing the slice cfg request with the slice stored in SchDb */ - if(storedSliceCfg->listOfConfirguration) + if(storedSliceCfg->listOfSlices) { for(sliceIdx = 0; sliceIdxnumOfSliceConfigured; sliceIdx++) { - if(!memcmp(&schSliceCfgReq->listOfConfirguration[cfgIdx]->snssai, &storedSliceCfg->listOfConfirguration[sliceIdx]->snssai,\ + if(!memcmp(&schSliceCfgReq->listOfSlices[cfgIdx]->snssai, &storedSliceCfg->listOfSlices[sliceIdx]->snssai,\ sizeof(Snssai))) { (*count)++; @@@ -1728,7 -1755,7 +1755,7 @@@ } - schSliceCfgRsp->listOfSliceCfgRsp[cfgIdx]->snssai = schSliceCfgReq->listOfConfirguration[cfgIdx]->snssai; + schSliceCfgRsp->listOfSliceCfgRsp[cfgIdx]->snssai = schSliceCfgReq->listOfSlices[cfgIdx]->snssai; if(sliceFound == true) schSliceCfgRsp->listOfSliceCfgRsp[cfgIdx]->rsp = RSP_OK; else @@@ -1766,8 -1793,8 +1793,8 @@@ uint8_t addSliceCfgInSchDb(SchSliceCfg if(count) { storeSliceCfg->numOfSliceConfigured = count; - SCH_ALLOC(storeSliceCfg->listOfConfirguration, storeSliceCfg->numOfSliceConfigured * sizeof(SchRrmPolicyOfSlice*)); - if(storeSliceCfg->listOfConfirguration == NULLP) + SCH_ALLOC(storeSliceCfg->listOfSlices, storeSliceCfg->numOfSliceConfigured * sizeof(SchRrmPolicyOfSlice*)); + if(storeSliceCfg->listOfSlices == NULLP) { DU_LOG("\nERROR --> SCH : Failed to allocate memory in addSliceCfgInSchDb"); return RFAILED; @@@ -1777,15 -1804,22 +1804,15 @@@ { if(cfgRsp.listOfSliceCfgRsp[cfgIdx]->rsp == RSP_OK) { - SCH_ALLOC(storeSliceCfg->listOfConfirguration[sliceIdx], sizeof(SchRrmPolicyOfSlice)); - if(storeSliceCfg->listOfConfirguration[sliceIdx] == NULLP) + SCH_ALLOC(storeSliceCfg->listOfSlices[sliceIdx], sizeof(SchRrmPolicyOfSlice)); + if(storeSliceCfg->listOfSlices[sliceIdx] == NULLP) { DU_LOG("\nERROR --> SCH : Failed to allocate memory in addSliceCfgInSchDb"); return RFAILED; } - SCH_ALLOC(storeSliceCfg->listOfConfirguration[sliceIdx]->rrmPolicyRatioInfo, sizeof(SchRrmPolicyRatio)); - if(storeSliceCfg->listOfConfirguration[sliceIdx]->rrmPolicyRatioInfo == NULLP) - { - DU_LOG("\nERROR --> SCH : Failed to allocate memory in addSliceCfgInSchDb"); - return RFAILED; - } - - memcpy(&storeSliceCfg->listOfConfirguration[sliceIdx]->snssai, &cfgReq->listOfConfirguration[sliceIdx]->snssai, sizeof(Snssai)); - memcpy(storeSliceCfg->listOfConfirguration[sliceIdx]->rrmPolicyRatioInfo, cfgReq->listOfConfirguration[sliceIdx]->rrmPolicyRatioInfo, + memcpy(&storeSliceCfg->listOfSlices[sliceIdx]->snssai, &cfgReq->listOfSlices[sliceIdx]->snssai, sizeof(Snssai)); + memcpy(&storeSliceCfg->listOfSlices[sliceIdx]->rrmPolicyRatioInfo, &cfgReq->listOfSlices[sliceIdx]->rrmPolicyRatioInfo, sizeof(SchRrmPolicyRatio)); sliceIdx++; } @@@ -1821,12 -1855,13 +1848,12 @@@ void freeSchSliceCfgReq(SchSliceCfgReq { for(cfgIdx = 0; cfgIdxnumOfConfiguredSlice; cfgIdx++) { - if(sliceCfgReq->listOfConfirguration[cfgIdx]) + if(sliceCfgReq->listOfSlices[cfgIdx]) { - SCH_FREE(sliceCfgReq->listOfConfirguration[cfgIdx]->rrmPolicyRatioInfo, sizeof(SchRrmPolicyRatio)); - SCH_FREE(sliceCfgReq->listOfConfirguration[cfgIdx], sizeof(SchRrmPolicyOfSlice)); + SCH_FREE(sliceCfgReq->listOfSlices[cfgIdx], sizeof(SchRrmPolicyOfSlice)); } } - SCH_FREE(sliceCfgReq->listOfConfirguration, sliceCfgReq->numOfConfiguredSlice * sizeof(SchRrmPolicyOfSlice*)); + SCH_FREE(sliceCfgReq->listOfSlices, sliceCfgReq->numOfConfiguredSlice * sizeof(SchRrmPolicyOfSlice*)); } SCH_FREE(sliceCfgReq, sizeof(SchSliceCfgReq)); } @@@ -1837,7 -1872,7 +1864,7 @@@ * * @details * - * Function : MacSchSliceCfgReq + * Function : SchProcSliceCfgReq * * Functionality: * function is used to store the slice configuration Sch DB @@@ -1849,7 -1884,7 +1876,7 @@@ * RFAILED - Failure * * ********************************************************************************/ - uint8_t MacSchSliceCfgReq(Pst *pst, SchSliceCfgReq *schSliceCfgReq) + uint8_t SchProcSliceCfgReq(Pst *pst, SchSliceCfgReq *schSliceCfgReq) { uint8_t count = 0; Inst inst = pst->dstInst - SCH_INST_START; @@@ -1858,7 -1893,7 +1885,7 @@@ DU_LOG("\nINFO --> SCH : Received Slice Cfg request from MAC"); if(schSliceCfgReq) { - if(schSliceCfgReq->listOfConfirguration) + if(schSliceCfgReq->listOfSlices) { /* filling the slice configuration response of each slice */ if(fillSliceCfgRsp(false, NULLP, schCb[inst].cells[0], schSliceCfgReq, &sliceCfgRsp, &count) != ROK) @@@ -1907,7 -1942,7 +1934,7 @@@ uint8_t modifySliceCfgInSchDb(SchSliceC if(count) { - if(storeSliceCfg->listOfConfirguration == NULLP) + if(storeSliceCfg->listOfSlices == NULLP) { DU_LOG("\nINFO --> SCH : Memory allocation failed in modifySliceCfgInSchDb"); return RFAILED; @@@ -1919,9 -1954,9 +1946,9 @@@ { for(sliceIdx = 0; sliceIdxnumOfSliceConfigured; sliceIdx++) { - if(!memcmp(&storeSliceCfg->listOfConfirguration[sliceIdx]->snssai, &recfgReq->listOfConfirguration[cfgIdx]->snssai, sizeof(Snssai))) + if(!memcmp(&storeSliceCfg->listOfSlices[sliceIdx]->snssai, &recfgReq->listOfSlices[cfgIdx]->snssai, sizeof(Snssai))) { - memcpy(storeSliceCfg->listOfConfirguration[sliceIdx]->rrmPolicyRatioInfo, recfgReq->listOfConfirguration[cfgIdx]->rrmPolicyRatioInfo, + memcpy(&storeSliceCfg->listOfSlices[sliceIdx]->rrmPolicyRatioInfo, &recfgReq->listOfSlices[cfgIdx]->rrmPolicyRatioInfo, sizeof(SchRrmPolicyRatio)); break; } @@@ -1956,7 -1991,7 +1983,7 @@@ void SchSendSliceRecfgRspToMac(Inst ins FILL_PST_SCH_TO_MAC(rspPst, inst); rspPst.event = EVENT_SLICE_RECFG_RSP_TO_MAC; - SchSliceRecfgRspOpts[rspPst.selector](&rspPst, &schSliceRecfgRsp); + MacMessageRouter(&rspPst, (void *)&schSliceRecfgRsp); } /******************************************************************************* * @@@ -1964,7 -1999,7 +1991,7 @@@ * * @details * - * Function : MacSchSliceRecfgReq + * Function : SchProcSliceRecfgReq * * Functionality: * function is used to store the slice re configuration Sch DB @@@ -1976,7 -2011,7 +2003,7 @@@ * RFAILED - Failure * * ********************************************************************************/ - uint8_t MacSchSliceRecfgReq(Pst *pst, SchSliceRecfgReq *schSliceRecfgReq) + uint8_t SchProcSliceRecfgReq(Pst *pst, SchSliceRecfgReq *schSliceRecfgReq) { uint8_t count = 0; Inst inst = pst->dstInst - SCH_INST_START; @@@ -1985,7 -2020,7 +2012,7 @@@ DU_LOG("\nINFO --> SCH : Received Slice ReCfg request from MAC"); if(schSliceRecfgReq) { - if(schSliceRecfgReq->listOfConfirguration) + if(schSliceRecfgReq->listOfSlices) { /* filling the slice configuration response of each slice */ if(fillSliceCfgRsp(true, &schCb[inst].sliceCfg, NULLP, schSliceRecfgReq, &schSliceRecfgRsp, &count) != ROK) @@@ -2189,7 -2224,7 +2216,7 @@@ uint8_t schAddPagingIndtoList(CmLListC * * @details * - * Function : MacSchPagingInd + * Function : SchProcPagingInd * * Functionality: Process paging indication at SCH recevied form MAC * @@@ -2198,7 -2233,7 +2225,7 @@@ * @return void * *************************************************************************/ - uint8_t MacSchPagingInd(Pst *pst, SchPageInd *pageInd) + uint8_t SchProcPagingInd(Pst *pst, SchPageInd *pageInd) { uint8_t ret = RFAILED; uint16_t cellIdx = 0; @@@ -2224,7 -2259,7 +2251,7 @@@ { if(pageInd->i_s > cellCb->cellCfg.sib1SchCfg.pageCfg.numPO) { - DU_LOG("\nERROR --> SCH : MacSchPagingInd(): i_s should not be greater than number of paging occasion"); + DU_LOG("\nERROR --> SCH : SchProcPagingInd(): i_s should not be greater than number of paging occasion"); } else { @@@ -2241,7 -2276,7 +2268,7 @@@ SCH_ALLOC(pageInfo->pagePdu, pageInfo->msgLen); if(!pageInfo->pagePdu) { - DU_LOG("\nERROR --> SCH : MacSchPagingInd(): Failed to allocate memory"); + DU_LOG("\nERROR --> SCH : SchProcPagingInd(): Failed to allocate memory"); } else { @@@ -2249,13 -2284,13 +2276,13 @@@ ret = schAddPagingIndtoList(&cellCb->pageCb.pageIndInfoRecord[pageInfo->pageTxTime.sfn], pageInfo); if(ret != ROK) { - DU_LOG("\nERROR --> SCH : MacSchPagingInd(): Failed to store paging record"); + DU_LOG("\nERROR --> SCH : SchProcPagingInd(): Failed to store paging record"); } } } else { - DU_LOG("\nERROR --> SCH : MacSchPagingInd(): Failed to allocate memory"); + DU_LOG("\nERROR --> SCH : SchProcPagingInd(): Failed to allocate memory"); } } } @@@ -2268,7 -2303,7 +2295,7 @@@ } else { - DU_LOG("\nERROR --> SCH : MacSchPagingInd(): Received null pointer"); + DU_LOG("\nERROR --> SCH : SchProcPagingInd(): Received null pointer"); } return ret; } diff --combined src/5gnrsch/sch.h index 2c9cd24c1,352c58294..5b2da4045 --- a/src/5gnrsch/sch.h +++ b/src/5gnrsch/sch.h @@@ -76,6 -76,8 +76,8 @@@ #define MAX_DRX_SIZE 512 #endif + #define NUM_SCH_TYPE 1 /*Supported number of Scheduler Algorithm types*/ + typedef struct schDlHqProcCb SchDlHqProcCb; typedef struct schUlHqEnt SchUlHqEnt; typedef struct schRaReq SchRaReq; @@@ -83,6 -85,11 +85,11 @@@ typedef struct schDlHqEnt SchDlHqEnt typedef struct schCellCb SchCellCb; typedef struct schUeCb SchUeCb; + typedef enum + { + SCH_FCFS + }SchType; + typedef enum { SCH_NUMEROLOGY_0, @@@ -137,17 -144,6 +144,6 @@@ typedef struct lcInf uint8_t allocPRB; /*PRB count which is allocated based on RRM policy/FreePRB*/ }LcInfo; - typedef struct schLcPrbEstimate - { - /* TODO: For Multiple RRMPolicies, Make DedicatedLcInfo as array/Double Pointer - * and have separate DedLCInfo for each RRMPolcyMemberList*/ - /* Dedicated LC List will be allocated, if any available*/ - CmLListCp dedLcList; /*Contain LCInfo per RRMPolicy*/ - CmLListCp defLcList; /*Linklist of LC assoc with Default S-NSSAI(s)*/ - /* SharedPRB number can be used by any LC. - * Need to calculate in every Slot based on PRB availability*/ - uint16_t sharedNumPrb; - }SchLcPrbEstimate; typedef struct schUlHqTbCb { uint32_t tbSzReq; @@@ -207,9 -203,9 +203,9 @@@ typedef struct schUlHqProcC CmLList ulSlotLnk; uint8_t strtSymbl; uint8_t numSymbl; - SchLcPrbEstimate ulLcPrbEst; /*UL PRB Alloc Estimate among different LC*/ + void *schSpcUlHqProcCb; /*!< Scheduler specific HARQ Proc CB */ CmLList ulHqProcLink; - uint8_t puschResType; /* Resource allocation type */ + uint8_t puschResType; /*!< Resource allocation type */ uint16_t puschStartPrb; uint16_t puschNumPrb; uint8_t dmrsMappingType; @@@ -230,7 -226,7 +226,7 @@@ struct schDlHqProcC CmLList ulSlotLnk; SchDlHqTbCb tbInfo[2]; uint8_t k1; - SchLcPrbEstimate dlLcPrbEst; /*DL PRB Alloc Estimate among different LC*/ + void *schSpcDlHqProcCb; /*!< Scheduler specific HARQ Proc CB */ CmLList dlHqProcLink; SlotTimingInfo pucchTime; #ifdef NR_DRX @@@ -467,15 -463,14 +463,14 @@@ typedef struct schUeC SchDlCb dlInfo; SchUlHqEnt ulHqEnt; SchDlHqEnt dlHqEnt; - SchDlHqProcCb *msg4Proc; + SchDlHqProcCb *msg4HqProc; SchDlHqProcCb *retxMsg4HqProc; - SchHqDlMap **hqDlmap; - SchHqUlMap **hqUlmap; - CmLListCp ulRetxHqList; - CmLListCp dlRetxHqList; + SchHqDlMap **hqDlmap; + SchHqUlMap **hqUlmap; + void *schSpcUeCb; #ifdef NR_DRX - bool ueDrxInfoPres; - SchDrxUeCb drxUeCb; + bool ueDrxInfoPres; + SchDrxUeCb drxUeCb; #endif }SchUeCb; @@@ -531,6 -526,41 +526,41 @@@ typedef struct schDrxC }SchDrxCb; #endif + typedef struct schAllApis + { + uint8_t (* SchCellCfgReq)(SchCellCb *cellCb); + void (* SchCellDeleteReq)(SchCellCb *cellCb); + uint8_t (* SchAddUeConfigReq)(SchUeCb *ueCb); + void (* SchModUeConfigReq)(SchUeCb *ueCb); + void (* SchUeDeleteReq)(SchUeCb *ueCb); + void (* SchDlHarqInd)(); + void (* SchPagingInd)(); + void (* SchRachRsrcReq)(); + void (* SchRachRsrcRel)(); + void (* SchCrcInd)(SchCellCb *cellCb, uint16_t ueId); + void (* SchRachInd)(SchCellCb *cellCb, uint16_t ueId); + void (* SchDlRlcBoInfo)(SchCellCb *cellCb, uint16_t ueId); + void (* SchSrUciInd)(SchCellCb *cellCb, uint16_t ueId); + void (* SchBsr)(SchCellCb *cellCb, uint16_t ueId); + void (* SchHandleLcList)(void *ptr, CmLList *node, ActionTypeLL action); + void (* SchAddToDlHqRetxList)(SchDlHqProcCb *hqP); + void (* SchAddToUlHqRetxList)(SchUlHqProcCb *hqP); + void (* SchRemoveFrmDlHqRetxList)(SchUeCb *ueCb, CmLList *node); + void (* SchRemoveFrmUlHqRetxList)(SchUeCb *ueCb, CmLList *node); + uint8_t (* SchAddUeToSchedule)(SchCellCb *cellCb, uint16_t ueId); + void (* SchRemoveUeFrmScheduleLst)(SchCellCb *cell, CmLList *node); + uint8_t (* SchInitDlHqProcCb)(SchDlHqProcCb *hqP); + uint8_t (* SchInitUlHqProcCb)(SchUlHqProcCb *hqP); + void (* SchFreeDlHqProcCb)(SchDlHqProcCb *hqP); + void (* SchFreeUlHqProcCb)(SchUlHqProcCb *hqP); + void (* SchDeleteDlHqProcCb)(SchDlHqProcCb *hqP); + void (* SchDeleteUlHqProcCb)(SchUlHqProcCb *hqP); + void (* SchScheduleSlot)(SchCellCb *cell, SlotTimingInfo *slotInd, Inst schInst); + uint32_t (* SchScheduleDlLc)(SlotTimingInfo pdcchTime, SlotTimingInfo pdschTime, uint8_t pdschNumSymbols, \ + bool isRetx, SchDlHqProcCb **hqP); + uint8_t (* SchScheduleUlLc)(SlotTimingInfo dciTime, SlotTimingInfo puschTime, uint8_t startStmb, \ + uint8_t symbLen, bool isRetx, SchUlHqProcCb **hqP); + }SchAllApis; /** * @brief * Cell Control block per cell. @@@ -555,7 -585,6 +585,6 @@@ typedef struct schCellC uint32_t actvUeBitMap; /*!< Bit map to find active UEs */ uint32_t boIndBitMap; /*!< Bit map to indicate UEs that have recevied BO */ SchUeCb ueCb[MAX_NUM_UE]; /*!< Pointer to UE contexts of this cell */ - CmLListCp ueToBeScheduled; /*!< Linked list to store UEs pending to be scheduled, */ SchPageCb pageCb; /*!< Page Record at Schedular*/ #ifdef NR_TDD uint8_t numSlotsInPeriodicity; /*!< number of slots in configured periodicity and SCS */ @@@ -565,13 -594,16 +594,16 @@@ #ifdef NR_DRX SchDrxCb drxCb[MAX_DRX_SIZE]; /*!< Drx cb*/ #endif + SchType schAlgoType; /*!< The scheduler type which the cell is configured with.*/ + SchAllApis *api; /*!< Reference of sch APIs for this cell based on the SchType*/ + void *schSpcCell; /*Ref of Scheduler specific structure*/ }SchCellCb; typedef struct schSliceCfg { uint8_t numOfSliceConfigured; - SchRrmPolicyOfSlice **listOfConfirguration; + SchRrmPolicyOfSlice **listOfSlices; }SchSliceCfg; /** @@@ -580,12 -612,13 +612,13 @@@ */ typedef struct schCb { - TskInit schInit; /*!< Task Init info */ - SchGenCb genCfg; /*!< General Config info */ - CmTqCp tmrTqCp; /*!< Timer Task Queue Cntrl Point */ - CmTqType tmrTq[SCH_TQ_SIZE]; /*!< Timer Task Queue */ - SchCellCb *cells[MAX_NUM_CELL]; /* Array to store cellCb ptr */ - SchSliceCfg sliceCfg; + TskInit schInit; /*!< Task Init info */ + SchGenCb genCfg; /*!< General Config info */ + CmTqCp tmrTqCp; /*!< Timer Task Queue Cntrl Point */ + CmTqType tmrTq[SCH_TQ_SIZE]; /*!< Timer Task Queue */ + SchAllApis allApis[NUM_SCH_TYPE]; /*!SchPucchFormat.format0) { - ulSchedPucch->fdAlloc.numPrb = PUCCH_NUM_PRB_FORMAT_0_1_4; + ulSchedPucch->fdAlloc.resAlloc.type1.numPrb = PUCCH_NUM_PRB_FORMAT_0_1_4; ulSchedPucch->pucchFormat = PUCCH_FORMAT_0; ulSchedPucch->initialCyclicShift = resrcInfo->SchPucchFormat.format0->initialCyclicShift; ulSchedPucch->tdAlloc.numSymb = resrcInfo->SchPucchFormat.format0->numSymbols; @@@ -249,7 -242,7 +242,7 @@@ void fillPucchFormat1(SchPucchInfo *ulS { if(resrcInfo->SchPucchFormat.format1) { - ulSchedPucch->fdAlloc.numPrb = PUCCH_NUM_PRB_FORMAT_0_1_4; + ulSchedPucch->fdAlloc.resAlloc.type1.numPrb = PUCCH_NUM_PRB_FORMAT_0_1_4; ulSchedPucch->pucchFormat = PUCCH_FORMAT_1; ulSchedPucch->initialCyclicShift = resrcInfo->SchPucchFormat.format1->initialCyclicShift; ulSchedPucch->tdAlloc.numSymb = resrcInfo->SchPucchFormat.format1->numSymbols; @@@ -281,24 -274,23 +274,24 @@@ uint8_t fillUlSchedPucchFormat(uint8_t { case PUCCH_FORMAT_0: { - if(resrcInfo) + if(resrcInfo) fillPucchFormat0(ulSchedPucch, resrcInfo); return ret; - } + } case PUCCH_FORMAT_1: { - if(resrcInfo) - { + if(resrcInfo) + { fillPucchFormat1(ulSchedPucch, resrcInfo); - } - if(formatCfg) - { - memcpy(&ulSchedPucch->cmnFormatCfg, formatCfg, sizeof(SchPucchFormatCfg)); - } - return ret; - }/* To Add support for more Pucch Format */ - + } + if(formatCfg) + { + ulSchedPucch->addDmrs = formatCfg->addDmrs; + ulSchedPucch->pi2BPSK = formatCfg->pi2BPSK; + } + return ret; + }/* To Add support for more Pucch Format */ + default: DU_LOG("\nERROR --> SCH : Invalid PUCCH format[%d] in fillUlSchedPucchFormatCfg()", pucchFormat); ret = RFAILED; @@@ -342,7 -334,7 +335,7 @@@ uint8_t fillUlSchedPucchDedicatedCfg(Sc { ulSchedPucch->intraFreqHop = pucchDedCfg->resrc->resrcToAddModList[resrcIdx].intraFreqHop; ulSchedPucch->secondPrbHop = pucchDedCfg->resrc->resrcToAddModList[resrcIdx].secondPrbHop; - ulSchedPucch->fdAlloc.startPrb = pucchDedCfg->resrc->resrcToAddModList[resrcIdx].startPrb; + ulSchedPucch->fdAlloc.resAlloc.type1.startPrb = pucchDedCfg->resrc->resrcToAddModList[resrcIdx].startPrb; ulSchedPucch->pucchFormat = pucchDedCfg->resrc->resrcToAddModList[resrcIdx].pucchFormat; ret = fillUlSchedPucchFormat(ulSchedPucch->pucchFormat, ulSchedPucch,\ &pucchDedCfg->resrc->resrcToAddModList[resrcIdx], NULLP); @@@ -365,6 -357,7 +358,6 @@@ if(pucchDedCfg->format1) { - memset(&ulSchedPucch->cmnFormatCfg, 0, sizeof(SchPucchFormatCfg)); ret = fillUlSchedPucchFormat(ulSchedPucch->pucchFormat, ulSchedPucch, NULLP, pucchDedCfg->format1); if(ret == RFAILED) return ret; @@@ -382,12 -375,14 +375,12 @@@ { srPeriodicity = pucchDedCfg->schedReq->schedAddModList[schedReqIdx].periodicity; srOffset = pucchDedCfg->schedReq->schedAddModList[schedReqIdx].offset; - break; + break; } if(((numSlots * slotInfo->sfn + slotInfo->slot - srOffset) % srPeriodicity) == 0) { ulSchedPucch->srFlag = true; - ulSchedPucch->uciFlag = true; } - ulSchedPucch->harqFlag = true;//check how to enable? } return ret; } @@@ -405,9 -400,9 +398,9 @@@ * @return ROK/RFAILED **/ -uint16_t fillPucchResourceInfo(SchPucchInfo *schPucchInfo, Inst inst, SlotTimingInfo slotInfo) +uint16_t fillPucchResourceInfo(uint8_t ueId, SchPucchInfo *schPucchInfo, Inst inst, SlotTimingInfo slotInfo) { - uint8_t ret = ROK, ueId = 0, ueIdx = 0, pucchIdx = 0; + uint8_t ret = ROK, ueIdx = 0, pucchIdx = 0; SchCellCb *cell = schCb[inst].cells[inst]; SchPucchCfgCmn *pucchCfg = NULLP; SchBwpParams *ulBwp = NULLP; @@@ -416,9 -411,10 +409,9 @@@ #endif uint16_t startPrb; - GET_UE_ID(schPucchInfo->rnti, ueId); ueIdx = ueId -1; #ifdef NR_DRX - ueCb = schGetUeCb(cell, schPucchInfo->rnti); + ueCb = &(cell->ueCb[ueIdx]); if(ueCb->ueDrxInfoPres) { if(!ueCb->drxUeCb.drxUlUeActiveStatus) @@@ -449,14 -445,15 +442,14 @@@ &startPrb, PUCCH_NUM_PRB_FORMAT_0_1_4); if (ret == ROK) { - schPucchInfo->fdAlloc.startPrb = ulBwp->freqAlloc.startPrb + pucchResourceSet[pucchIdx][3]; - schPucchInfo->fdAlloc.numPrb = PUCCH_NUM_PRB_FORMAT_0_1_4; + schPucchInfo->fdAlloc.resAlloc.type1.startPrb = ulBwp->freqAlloc.startPrb + pucchResourceSet[pucchIdx][3]; + schPucchInfo->fdAlloc.resAlloc.type1.numPrb = PUCCH_NUM_PRB_FORMAT_0_1_4; schPucchInfo->tdAlloc.startSymb = pucchResourceSet[pucchIdx][1]; schPucchInfo->tdAlloc.numSymb = pucchResourceSet[pucchIdx][2]; schPucchInfo->pucchFormat = pucchResourceSet[pucchIdx][0]; /* set SR and UCI flag to false */ schPucchInfo->srFlag = true; - schPucchInfo->uciFlag = true; } } return ROK; @@@ -500,7 -497,7 +493,7 @@@ uint8_t schUlResAlloc(SchCellCb *cell, schUlSlotInfo = cell->schUlSlotInfo[ulTimingInfo.slot]; if(schUlSlotInfo->schPuschInfo) { - ulSchedInfo.crnti = schUlSlotInfo->schPuschInfo->crnti; + GET_CRNTI(ulSchedInfo.crnti, schUlSlotInfo->puschUe); /* Check the ue drx status if the UE is active for uplink scheduling or not */ #ifdef NR_DRX ueCb = schGetUeCb(cell, ulSchedInfo.crnti); @@@ -519,8 -516,7 +512,8 @@@ if(schUlSlotInfo->pucchPres) { - ret = fillPucchResourceInfo(&schUlSlotInfo->schPucchInfo, schInst, ulTimingInfo); + GET_CRNTI(ulSchedInfo.crnti, schUlSlotInfo->pucchUe); + ret = fillPucchResourceInfo(schUlSlotInfo->pucchUe, &schUlSlotInfo->schPucchInfo, schInst, ulTimingInfo); if (ret == ROK) { ulSchedInfo.dataType |= SCH_DATATYPE_UCI; @@@ -762,10 -758,12 +755,10 @@@ uint16_t schAllocPucchResource(SchCellC memset(&schUlSlotInfo->schPucchInfo, 0, sizeof(SchPucchInfo)); schUlSlotInfo->pucchPres = true; - schUlSlotInfo->schPucchInfo.rnti = crnti; if(ueCb != NULLP) { /* set HARQ flag to true */ - schUlSlotInfo->schPucchInfo.harqFlag = true; - schUlSlotInfo->schPucchInfo.numHarqBits = 1; /* 1 bit for HARQ */ + schUlSlotInfo->schPucchInfo.harqInfo.harqBitLength = 1; /* 1 bit for HARQ */ ADD_DELTA_TO_TIME(pucchTime, pucchTime, 3, cell->numSlots); /* SLOT_DELAY=3 */ cmLListAdd2Tail(&(ueCb->hqDlmap[pucchTime.slot]->hqList), &hqP->ulSlotLnk); } @@@ -1647,7 -1645,7 +1640,7 @@@ void updateGrantSizeForBoRpt(CmLListCp lcNode->lcId,lcNode->reqBO, dlMsgSchInfo->numLc, *accumalatedBOSize); dlMsgSchInfo->numLc++; - /*The LC has been fully allocated, clean it*/ + /* The LC has been fully allocated, clean it */ if(lcNode->reqBO == 0) { handleLcLList(lcLL, lcNode->lcId, DELETE); @@@ -1842,137 -1840,64 +1835,64 @@@ uint8_t schProcessMsg4Req(SchCellCb *ce /******************************************************************* * - * @brief Handler to calculate TBS size for BSR requested + * @brief sch Process pending Sr or Bsr Req * * @details * - * Function : schCalculateUlTbs - * - * Functionality: Function will note the required TBS for each LCGIDX and use - * the Priority LCG List and RRM policy to allocate the TBS size + * Function : updateBsrAndLcList * - * @params [in] ueCb (Pointer to UE CB) - * [in] puschTime (Time slot where PUSCH will be sent) - * [in] symbLen (No of Symbols used for PUSCH transmission) - * [out] startPrb(Pointer to startPRB which will be calculated while - * finding the best Free Block) - * [out] totTBS(Pointer to total TBS size) - * [in] isRetx (to indicate retransmission) - * [in] hqP (UL Harq process pointer) + * Functionality: + * Updating the BSRInfo in UECB and Lclist * - * @return uint8_t : ROK > Scheduling of UL grant is successful - * RFAILED > vice versa + * @params[in] SchCellCb *cell, SlotTimingInfo currTime + * @return ROK - success + * RFAILED - failure * - * ****************************************************************/ - uint8_t schCalculateUlTbs(SchUeCb *ueCb, SlotTimingInfo puschTime, uint8_t symbLen,\ - uint16_t *startPrb, uint32_t *totTBS, bool isRetx, SchUlHqProcCb *hqP) + *******************************************************************/ + void updateBsrAndLcList(CmLListCp *lcLL, BsrInfo *bsrInfo, uint8_t status) { - uint16_t mcsIdx = 0; - CmLListCp *lcLL = NULLP; - uint16_t lcgIdx = 0, lcId =0, maxFreePRB = 0; - uint16_t rsvdDedicatedPRB; - *startPrb = 0; - *totTBS = 0; + CmLList *node = NULLP, *next = NULLP; + LcInfo *lcNode = NULLP; - /* check for BSR */ - for(lcgIdx=0; lcgIdxbsrInfo[lcgIdx].dataVol == 0) - { - continue; - } - - /*TODO: lcgIdx and LCID has been implemented as one to one mapping. - * Need to check the mapping to figure out the LCID and lcgIdx once L2 - * spec specifies any logic*/ - lcId = lcgIdx; - if(ueCb->ulInfo.ulLcCtxt[lcId].isDedicated) - { - lcLL = &(hqP->ulLcPrbEst.dedLcList); - rsvdDedicatedPRB = ueCb->ulInfo.ulLcCtxt[lcId].rsvdDedicatedPRB; - } - else - { - lcLL = &(hqP->ulLcPrbEst.defLcList); - } - - /*[Step2]: Update the reqPRB and Payloadsize for this LC in the appropriate List*/ - if(updateLcListReqPRB(lcLL, lcId, ueCb->bsrInfo[lcgIdx].dataVol) != ROK) - { - DU_LOG("\nERROR --> SCH: LcgId:%d updation failed",lcId); - return RFAILED; - } + DU_LOG("\nERROR --> SCH: LcList not present"); + return; } - if ((hqP->ulLcPrbEst.defLcList.count == 0) && (hqP->ulLcPrbEst.dedLcList.count == 0)) + if(lcLL->count) { - if( (ueCb->srRcvd) || (isRetx) ) - { - *startPrb = MAX_NUM_RB; - *totTBS = schCalcTbSize(UL_GRANT_SIZE); - } - /*Returning true when NO Grant is there for UE as this is not scheduling - * error*/ - return ROK; + node = lcLL->first; } - - maxFreePRB = searchLargestFreeBlock(ueCb->cellCb, puschTime, startPrb, DIR_UL); - - /*[Step4]: Estimation of PRB and BO which can be allocated to each LC in - * the list based on RRM policy*/ - - /*Either this UE contains no reservedPRB pool fir dedicated S-NSSAI or - * Num of Free PRB available is not enough to reserve Dedicated PRBs*/ - if(maxFreePRB != 0) + else { - mcsIdx = ueCb->ueCfg.ulModInfo.mcsIndex; - if((hqP->ulLcPrbEst.dedLcList.count == 0) || ((maxFreePRB < rsvdDedicatedPRB))) - { - hqP->ulLcPrbEst.sharedNumPrb = maxFreePRB; - DU_LOG("\nDEBUG --> SCH : UL Only Default Slice is scheduled, sharedPRB Count:%d",\ - hqP->ulLcPrbEst.sharedNumPrb); - - /*PRB Alloc for Default LCs*/ - prbAllocUsingRRMPolicy(&(hqP->ulLcPrbEst.defLcList), FALSE, mcsIdx, symbLen,\ - &(hqP->ulLcPrbEst.sharedNumPrb), NULLP, NULLP,&(ueCb->srRcvd)); - } - else - { - hqP->ulLcPrbEst.sharedNumPrb = maxFreePRB - rsvdDedicatedPRB; - - /*PRB Alloc for Dedicated LCs*/ - prbAllocUsingRRMPolicy(&(hqP->ulLcPrbEst.dedLcList), TRUE, mcsIdx, symbLen,\ - &(hqP->ulLcPrbEst.sharedNumPrb), &(rsvdDedicatedPRB),\ - NULLP,&(ueCb->srRcvd)); - - /*PRB Alloc for Default LCs*/ - prbAllocUsingRRMPolicy(&(hqP->ulLcPrbEst.defLcList), FALSE, mcsIdx, symbLen, \ - &(hqP->ulLcPrbEst.sharedNumPrb), &(rsvdDedicatedPRB),\ - NULLP,&(ueCb->srRcvd)); - } + /*lcLL is empty*/ + return; } - /*[Step5]:Traverse each LCID in LcList to calculate the exact Scheduled Bytes - * using allocated BO per LC and Update dlMsgAlloc(BO report for MAC*/ - if(hqP->ulLcPrbEst.dedLcList.count != 0) - updateGrantSizeForBoRpt(&(hqP->ulLcPrbEst.dedLcList), NULLP, ueCb->bsrInfo, totTBS); - - updateGrantSizeForBoRpt(&(hqP->ulLcPrbEst.defLcList), NULLP, ueCb->bsrInfo, totTBS); - /*Below case will hit if NO LC(s) are allocated due to resource crunch*/ - if (*totTBS == 0) + while(node) { - if(maxFreePRB == 0) + next = node->next; + lcNode = (LcInfo *)node->node; + if(lcNode != NULLP) { - DU_LOG("\nERROR --> SCH : NO FREE PRB!!"); + /*Only when Status is OK then allocation is marked as ZERO and reqBO + * is updated in UE's DB. If Failure, then allocation is added to reqBO + * and same is updated in Ue's DB inside BSR Info structure*/ + if(status == ROK) + { + lcNode->allocBO = 0; + } + + lcNode->reqBO += lcNode->allocBO; + bsrInfo[lcNode->lcId].dataVol = lcNode->reqBO; + if(lcNode->reqBO == 0) + { + handleLcLList(lcLL, lcNode->lcId, DELETE); + } } - else - { - /*Schedule the LC for next slot*/ - DU_LOG("\nDEBUG --> SCH : No LC has been scheduled"); - } - return RFAILED; - } - return ROK; + node = next; + } } /******************************************************************* @@@ -1995,14 -1920,9 +1915,9 @@@ bool schProcessSrOrBsrReq(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId, bool isRetx, SchUlHqProcCb **hqP) { bool k2Found = FALSE; - uint8_t ret = RFAILED; uint8_t startSymb = 0, symbLen = 0; uint8_t k2TblIdx = 0, k2Index = 0, k2Val = 0; - uint16_t startPrb = 0; - uint32_t totDataReq = 0; /* in bytes */ SchUeCb *ueCb; - SchPuschInfo *puschInfo; - DciInfo *dciInfo = NULLP; SchK2TimingInfoTbl *k2InfoTbl=NULLP; SlotTimingInfo dciTime, puschTime; @@@ -2077,52 -1997,8 +1992,8 @@@ if(k2Found == true) { - ret = schCalculateUlTbs(ueCb, puschTime, symbLen, &startPrb, &totDataReq, isRetx, *hqP); - - if(totDataReq > 0 && ret == ROK) - { - SCH_ALLOC(dciInfo, sizeof(DciInfo)); - if(!dciInfo) - { - DU_LOG("\nERROR --> SCH : Memory Allocation failed for dciInfo alloc"); - if(isRetx != TRUE) - { - if((*hqP)->ulLcPrbEst.dedLcList.count != 0) - updateBsrAndLcList(&((*hqP)->ulLcPrbEst.dedLcList), ueCb->bsrInfo, RFAILED); - - updateBsrAndLcList(&((*hqP)->ulLcPrbEst.defLcList), ueCb->bsrInfo, RFAILED); - } - return false; - } - cell->schDlSlotInfo[dciTime.slot]->ulGrant = dciInfo; - memset(dciInfo,0,sizeof(DciInfo)); - - /* Update PUSCH allocation */ - if(schFillPuschAlloc(ueCb, puschTime, totDataReq, startSymb, symbLen, startPrb, isRetx, *hqP) == ROK) - { - if(cell->schUlSlotInfo[puschTime.slot]->schPuschInfo) - { - puschInfo = cell->schUlSlotInfo[puschTime.slot]->schPuschInfo; - if(puschInfo != NULLP) - { - /* Fill DCI for UL grant */ - schFillUlDci(ueCb, puschInfo, dciInfo, isRetx, *hqP); - memcpy(&dciInfo->slotIndInfo, &dciTime, sizeof(SlotTimingInfo)); - ueCb->srRcvd = false; - ueCb->bsrRcvd = false; - cell->schUlSlotInfo[puschTime.slot]->puschUe = ueId; - if((*hqP)->ulLcPrbEst.dedLcList.count != 0) - updateBsrAndLcList(&((*hqP)->ulLcPrbEst.dedLcList), ueCb->bsrInfo, ROK); - updateBsrAndLcList(&((*hqP)->ulLcPrbEst.defLcList), ueCb->bsrInfo, ROK); - cmLListAdd2Tail(&(ueCb->hqUlmap[puschTime.slot]->hqList), &(*hqP)->ulSlotLnk); - return true; - } - } - } - if((*hqP)->ulLcPrbEst.dedLcList.count != 0) - updateBsrAndLcList(&((*hqP)->ulLcPrbEst.dedLcList), ueCb->bsrInfo, RFAILED); - updateBsrAndLcList(&((*hqP)->ulLcPrbEst.defLcList), ueCb->bsrInfo, RFAILED); - } + if(cell->api->SchScheduleUlLc(dciTime, puschTime, startSymb, symbLen, isRetx, hqP) != ROK) + return false; } else { @@@ -2132,69 -2008,6 +2003,6 @@@ return true; } - - /******************************************************************* - * - * @brief sch Process pending Sr or Bsr Req - * - * @details - * - * Function : updateBsrAndLcList - * - * Functionality: - * Updating the BSRInfo in UECB and Lclist - * - * @params[in] SchCellCb *cell, SlotTimingInfo currTime - * @return ROK - success - * RFAILED - failure - * - *******************************************************************/ - void updateBsrAndLcList(CmLListCp *lcLL, BsrInfo *bsrInfo, uint8_t status) - { - CmLList *node = NULLP, *next = NULLP; - LcInfo *lcNode = NULLP; - - if(lcLL == NULLP) - { - DU_LOG("\nERROR --> SCH: LcList not present"); - return; - } - - if(lcLL->count) - { - node = lcLL->first; - } - else - { - /*lcLL is empty*/ - return; - } - - while(node) - { - next = node->next; - lcNode = (LcInfo *)node->node; - if(lcNode != NULLP) - { - /*Only when Status is OK then allocation is marked as ZERO and reqBO - * is updated in UE's DB. If Failure, then allocation is added to reqBO - * and same is updated in Ue's DB inside BSR Info structure*/ - if(status == ROK) - { - lcNode->allocBO = 0; - } - - lcNode->reqBO += lcNode->allocBO; - bsrInfo[lcNode->lcId].dataVol = lcNode->reqBO; - if(lcNode->reqBO == 0) - { - handleLcLList(lcLL, lcNode->lcId, DELETE); - } - } - node = next; - } - } - /******************************************************************************** * * @brief Increment the Slot by a input factor diff --combined src/5gnrsch/sch_rach.c index bf4c11644,104061a7d..7694acb7d --- a/src/5gnrsch/sch_rach.c +++ b/src/5gnrsch/sch_rach.c @@@ -42,13 -42,6 +42,6 @@@ #include "sch.h" #include "sch_utils.h" - SchRachRsrcRspFunc SchRachRsrcRspOpts[] = - { - packSchRachRsrcRsp, /* LC */ - MacProcSchRachRsrcRsp, /* TC */ - packSchRachRsrcRsp /* LWLC */ - }; - /** * @brief Checks if PRACH can be scheduled in current slot * @@@ -196,7 -189,7 +189,7 @@@ void schPrachResAlloc(SchCellCb *cell, * * @details * - * Function : MacSchRachRsrcReq + * Function : SchProcRachRsrcReq * * This function processes RACH resorce request * from MAC for CFRA. It assigns a dedicated preamble @@@ -208,7 -201,7 +201,7 @@@ * @return ROK * RFAILED **/ - uint8_t MacSchRachRsrcReq(Pst *pst, SchRachRsrcReq *schRachRsrcReq) + uint8_t SchProcRachRsrcReq(Pst *pst, SchRachRsrcReq *schRachRsrcReq) { uint8_t ssbIdx = 0, cfraSsbIdx = 0; uint8_t firstCFPreambleIndex = 0, lastCFPreambleIndex = 0; @@@ -335,7 -328,7 +328,7 @@@ SCH_FREE(schRachRsrcReq, sizeof(SchRachRsrcReq)); /* Send RACH resource response to MAC */ - return (SchRachRsrcRspOpts[rspPst.selector](&rspPst, rachRsrcRsp)); + return(MacMessageRouter(&rspPst, (void *)rachRsrcRsp)); } /** @@@ -456,10 -449,11 +449,10 @@@ SchPuschInfo* schAllocMsg3Pusch(Inst sc tbSize = schCalcTbSizeFromNPrb(numRb, mcs, NUM_PDSCH_SYMBOL); tbSize = tbSize / 8 ; /*bits to byte conversion*/ - schUlSlotInfo->schPuschInfo->crnti = crnti; schUlSlotInfo->schPuschInfo->harqProcId = msg3HqProc->procId; - schUlSlotInfo->schPuschInfo->resAllocType = SCH_ALLOC_TYPE_1; - schUlSlotInfo->schPuschInfo->fdAlloc.startPrb = startRb; - schUlSlotInfo->schPuschInfo->fdAlloc.numPrb = numRb; + schUlSlotInfo->schPuschInfo->fdAlloc.resAllocType = SCH_ALLOC_TYPE_1; + schUlSlotInfo->schPuschInfo->fdAlloc.resAlloc.type1.startPrb = startRb; + schUlSlotInfo->schPuschInfo->fdAlloc.resAlloc.type1.numPrb = numRb; schUlSlotInfo->schPuschInfo->tdAlloc.startSymb = startSymb; schUlSlotInfo->schPuschInfo->tdAlloc.numSymb = symbLen; schUlSlotInfo->schPuschInfo->tbInfo.qamOrder = QPSK_MODULATION; /* QPSK modulation */ @@@ -468,30 -462,25 +461,30 @@@ schUlSlotInfo->schPuschInfo->tbInfo.ndi = NEW_TRANSMISSION; /* new transmission */ schUlSlotInfo->schPuschInfo->tbInfo.rv = 0; schUlSlotInfo->schPuschInfo->tbInfo.tbSize = tbSize; +#ifdef INTEL_FAPI schUlSlotInfo->schPuschInfo->dmrsMappingType = DMRS_MAP_TYPE_A; /* Setting Type-A */ schUlSlotInfo->schPuschInfo->nrOfDmrsSymbols = NUM_DMRS_SYMBOLS; schUlSlotInfo->schPuschInfo->dmrsAddPos = DMRS_ADDITIONAL_POS; +#endif + if(!isRetx) { msg3HqProc->strtSymbl = startSymb; msg3HqProc->numSymbl = symbLen; - msg3HqProc->puschResType = schUlSlotInfo->schPuschInfo->resAllocType; - msg3HqProc->puschStartPrb = schUlSlotInfo->schPuschInfo->fdAlloc.startPrb; - msg3HqProc->puschNumPrb = schUlSlotInfo->schPuschInfo->fdAlloc.numPrb; + msg3HqProc->puschResType = schUlSlotInfo->schPuschInfo->fdAlloc.resAllocType; + msg3HqProc->puschStartPrb = schUlSlotInfo->schPuschInfo->fdAlloc.resAlloc.type1.startPrb; + msg3HqProc->puschNumPrb = schUlSlotInfo->schPuschInfo->fdAlloc.resAlloc.type1.numPrb; msg3HqProc->tbInfo.qamOrder = schUlSlotInfo->schPuschInfo->tbInfo.qamOrder; msg3HqProc->tbInfo.iMcs = schUlSlotInfo->schPuschInfo->tbInfo.mcs; msg3HqProc->tbInfo.mcsTable = schUlSlotInfo->schPuschInfo->tbInfo.mcsTable; msg3HqProc->tbInfo.ndi = schUlSlotInfo->schPuschInfo->tbInfo.ndi; msg3HqProc->tbInfo.rv = schUlSlotInfo->schPuschInfo->tbInfo.rv; msg3HqProc->tbInfo.tbSzReq = schUlSlotInfo->schPuschInfo->tbInfo.tbSize; +#ifdef INTEL_FAPI msg3HqProc->dmrsMappingType = schUlSlotInfo->schPuschInfo->dmrsMappingType; msg3HqProc->nrOfDmrsSymbols = schUlSlotInfo->schPuschInfo->nrOfDmrsSymbols; msg3HqProc->dmrsAddPos = schUlSlotInfo->schPuschInfo->dmrsAddPos; +#endif } return schUlSlotInfo->schPuschInfo; } @@@ -715,8 -704,8 +708,8 @@@ bool schProcessRaReq(Inst schInst, SchC dciSlotAlloc->rarInfo.ulGrant.bwpSize = cell->cellCfg.schInitialUlBwp.bwp.freqAlloc.numPrb; /* Spec 38.213, section 8.2, 0 : MSG3 PUSCH will be transmitted without frequency hopping */ dciSlotAlloc->rarInfo.ulGrant.freqHopFlag = 0; - dciSlotAlloc->rarInfo.ulGrant.msg3FreqAlloc.startPrb = msg3PuschInfo->fdAlloc.startPrb; - dciSlotAlloc->rarInfo.ulGrant.msg3FreqAlloc.numPrb = msg3PuschInfo->fdAlloc.numPrb; + dciSlotAlloc->rarInfo.ulGrant.msg3FreqAlloc.startPrb = msg3PuschInfo->fdAlloc.resAlloc.type1.startPrb; + dciSlotAlloc->rarInfo.ulGrant.msg3FreqAlloc.numPrb = msg3PuschInfo->fdAlloc.resAlloc.type1.numPrb; dciSlotAlloc->rarInfo.ulGrant.k2Index = k2Index; dciSlotAlloc->rarInfo.ulGrant.mcs = msg3PuschInfo->tbInfo.mcs; dciSlotAlloc->rarInfo.ulGrant.tpc = 3; /* TODO : Check appropriate value to be filled */ @@@ -778,7 -767,7 +771,7 @@@ * * @details * - * Function : schProcessRachInd + * Function : SchProcRachInd * * This function process rach indication * @@@ -786,17 -775,20 +779,20 @@@ * @param[in] shed instance * @return ROK **/ - uint8_t schProcessRachInd(RachIndInfo *rachInd, Inst schInst) + uint8_t SchProcRachInd(Pst *pst, RachIndInfo *rachInd) { - SchCellCb *cell = schCb[schInst].cells[schInst]; SchRaReq *raReq = NULLP; - float slotDuration; - uint8_t winNumSlots; - uint8_t ueId; + float slotDuration; + uint8_t winNumSlots; + uint8_t ueId; + Inst schInst = pst->dstInst-SCH_INST_START; + SchCellCb *cell = schCb[schInst].cells[schInst]; + + DU_LOG("\nINFO --> SCH : Received Rach indication"); if(cell == NULLP) { - DU_LOG("\nERROR --> SCH: Failed to find cell in schProcessRachInd"); + DU_LOG("\nERROR --> SCH: Failed to find cell in SchProcRachInd"); return RFAILED; } @@@ -811,7 -803,7 +807,7 @@@ SCH_ALLOC(raReq, sizeof(SchRaReq)); if(!raReq) { - DU_LOG("\nERROR --> SCH : Memory allocation failure in schProcessRachInd"); + DU_LOG("\nERROR --> SCH : Memory allocation failure in SchProcRachInd"); SCH_FREE(rachInd, sizeof(RachIndInfo)); return RFAILED; } @@@ -838,8 -830,7 +834,7 @@@ cell->raReq[ueId -1] = raReq; /* Adding UE Id to list of pending UEs to be scheduled */ - addUeToBeScheduled(cell, ueId); - + cell->api->SchRachInd(cell, ueId); return ROK; } @@@ -1002,7 -993,7 +997,7 @@@ uint8_t schFillRar(SchCellCb *cell, Slo * * @details * - * Function : MacSchRachRsrcRel + * Function : SchProcRachRsrcRel * * This function processes RACH resorce release * from MAC after CFRA. It releases the dedicated @@@ -1013,7 -1004,7 +1008,7 @@@ * @return ROK * RFAILED */ - uint8_t MacSchRachRsrcRel(Pst *pst, SchRachRsrcRel *schRachRsrcRel) + uint8_t SchProcRachRsrcRel(Pst *pst, SchRachRsrcRel *schRachRsrcRel) { uint8_t ret = ROK; uint8_t ssbIdx = 0, cfraSsbIdx = 0; @@@ -1091,7 -1082,7 +1086,7 @@@ void schMsg4Complete(SchUeCb *ueCb { DU_LOG("\nINFO --> SCH: State change for ueId[%2d] to SCH_RA_STATE_MSG4_DONE\n",ueCb->ueId); ueCb->cellCb->raCb[ueCb->ueId-1].raState = SCH_RA_STATE_MSG4_DONE; - ueCb->msg4Proc = ueCb->retxMsg4HqProc = NULLP; + ueCb->msg4HqProc = ueCb->retxMsg4HqProc = NULLP; } /********************************************************************** End of file diff --combined src/5gnrsch/sch_ue_mgr.c index 0923f9558,1254674d8..0d84ba58a --- a/src/5gnrsch/sch_ue_mgr.c +++ b/src/5gnrsch/sch_ue_mgr.c @@@ -32,35 -32,6 +32,6 @@@ #include "sch_drx.h" #endif - /* local defines */ - SchUeCfgRspFunc SchUeCfgRspOpts[] = - { - packSchUeCfgRsp, /* LC */ - MacProcSchUeCfgRsp, /* TC */ - packSchUeCfgRsp /* LWLC */ - }; - - SchUeRecfgRspFunc SchUeRecfgRspOpts[] = - { - packSchUeRecfgRsp, /* LC */ - MacProcSchUeRecfgRsp, /* TC */ - packSchUeRecfgRsp /* LWLC */ - }; - - SchUeDeleteRspFunc SchUeDeleteRspOpts[] = - { - packSchUeDeleteRsp, /* LC */ - MacProcSchUeDeleteRsp, /* TC */ - packSchUeDeleteRsp /* LWLC */ - }; - - SchCellDeleteRspFunc SchCellDeleteRspOpts[]= - { - packSchCellDeleteRsp, /* LC */ - MacProcSchCellDeleteRsp, /* TC */ - packSchCellDeleteRsp /* LWLC */ - }; - /******************************************************************* * * @brief Fill and send UE cfg response to MAC @@@ -91,7 -62,7 +62,7 @@@ void SchSendUeCfgRspToMac(SchUeCfgReq * FILL_PST_SCH_TO_MAC(rspPst, inst); rspPst.event = EVENT_UE_CONFIG_RSP_TO_MAC; DU_LOG("\nINFO --> SCH : Sending UE Config response to MAC"); - SchUeCfgRspOpts[rspPst.selector](&rspPst, cfgRsp); + MacMessageRouter(&rspPst, (void *)cfgRsp); } /******************************************************************* @@@ -124,7 -95,7 +95,7 @@@ void SchSendUeRecfgRspToMac(SchUeRecfgR FILL_PST_SCH_TO_MAC(rspPst, inst); rspPst.event = EVENT_UE_RECONFIG_RSP_TO_MAC; DU_LOG("\nINFO --> SCH : Sending UE Reconfig response to MAC"); - SchUeRecfgRspOpts[rspPst.selector](&rspPst, reCfgRsp); + MacMessageRouter(&rspPst, (void *)reCfgRsp); } /******************************************************************* @@@ -236,13 -207,16 +207,13 @@@ uint8_t updateDedLcInfo(Inst inst, Snss { for(sliceCfgIdx = 0; sliceCfgIdxsnssai), sizeof(Snssai)) == 0) + if(memcmp(snssai, &(sliceCfg.listOfSlices[sliceCfgIdx]->snssai), sizeof(Snssai)) == 0) { - if(sliceCfg.listOfConfirguration[sliceCfgIdx]->rrmPolicyRatioInfo) - { - /*Updating latest RrmPolicy*/ - *rsvdDedicatedPRB = \ - (uint16_t)(((sliceCfg.listOfConfirguration[sliceCfgIdx]->rrmPolicyRatioInfo->policyDedicatedRatio)*(MAX_NUM_RB))/100); - *isDedicated = TRUE; - DU_LOG("\nINFO --> SCH : Updated RRM policy, reservedPOOL:%d",*rsvdDedicatedPRB); - } + /*Updating latest RrmPolicy*/ + *rsvdDedicatedPRB = \ + (uint16_t)(((sliceCfg.listOfSlices[sliceCfgIdx]->rrmPolicyRatioInfo.dedicatedRatio)*(MAX_NUM_RB))/100); + *isDedicated = TRUE; + DU_LOG("\nINFO --> SCH : Updated RRM policy, reservedPOOL:%d",*rsvdDedicatedPRB); } } /*case: This LcCtxt is either a Default LC or this LC is part of someother RRM_MemberList*/ @@@ -762,7 -736,7 +733,7 @@@ SchCellCb *getSchCellCb(uint16_t srcEve * * @details * - * Function : MacSchAddUeConfigReq + * Function : SchAddUeConfigReq * * Functionality: Function to Add Ue config request from MAC * @@@ -771,7 -745,7 +742,7 @@@ * RFAILED - failure * * ****************************************************************/ - uint8_t MacSchAddUeConfigReq(Pst *pst, SchUeCfgReq *ueCfg) + uint8_t SchAddUeConfigReq(Pst *pst, SchUeCfgReq *ueCfg) { uint8_t lcIdx = 0, ret = ROK, idx = 0; SchCellCb *cellCb = NULLP; @@@ -780,13 -754,9 +751,9 @@@ Inst inst = pst->dstInst - SCH_INST_START; memset(&cfgRsp, 0, sizeof(SchUeCfgRsp)); - #ifdef CALL_FLOW_DEBUG_LOG - DU_LOG("\nCall Flow: ENTMAC -> ENTSCH : EVENT_ADD_UE_CONFIG_REQ_TO_SCH\n"); - #endif - if(!ueCfg) { - DU_LOG("\nERROR --> SCH : Adding UE Config Request failed at MacSchAddUeConfigReq()"); + DU_LOG("\nERROR --> SCH : Adding UE Config Request failed at SchAddUeConfigReq()"); return RFAILED; } DU_LOG("\nDEBUG --> SCH : Adding UE Config Request for CRNTI[%d]", ueCfg->crnti); @@@ -862,6 -832,8 +829,8 @@@ SchSendUeCfgRspToMac(ueCfg, inst, RSP_OK, &cfgRsp); } + + cellCb->api->SchAddUeConfigReq(ueCb); return ret; } @@@ -909,10 -881,11 +878,10 @@@ uint8_t schFillPuschAlloc(SchUeCb *ueCb if (isRetx == FALSE) { - puschInfo.crnti = ueCb->crnti; - puschInfo.harqProcId = SCH_HARQ_PROC_ID; - puschInfo.resAllocType = SCH_ALLOC_TYPE_1; - puschInfo.fdAlloc.startPrb = startPrb; - puschInfo.fdAlloc.numPrb = numRb; + puschInfo.harqProcId = SCH_HARQ_PROC_ID; + puschInfo.fdAlloc.resAllocType = SCH_ALLOC_TYPE_1; + puschInfo.fdAlloc.resAlloc.type1.startPrb = startPrb; + puschInfo.fdAlloc.resAlloc.type1.numPrb = numRb; puschInfo.tdAlloc.startSymb = startSymb; puschInfo.tdAlloc.numSymb = symbLen; puschInfo.tbInfo.qamOrder = ueCb->ueCfg.ulModInfo.modOrder; @@@ -921,14 -894,12 +890,14 @@@ puschInfo.tbInfo.ndi = 1; /* new transmission */ puschInfo.tbInfo.rv = 0; puschInfo.tbInfo.tbSize = tbSize; +#ifdef INTEL_FAPI puschInfo.dmrsMappingType = DMRS_MAP_TYPE_A; /* Setting Type-A */ puschInfo.nrOfDmrsSymbols = NUM_DMRS_SYMBOLS; puschInfo.dmrsAddPos = DMRS_ADDITIONAL_POS; - hqP->puschResType = puschInfo.resAllocType; - hqP->puschStartPrb = puschInfo.fdAlloc.startPrb; - hqP->puschNumPrb = puschInfo.fdAlloc.numPrb; +#endif + hqP->puschResType = puschInfo.fdAlloc.resAllocType; + hqP->puschStartPrb = puschInfo.fdAlloc.resAlloc.type1.startPrb; + hqP->puschNumPrb = puschInfo.fdAlloc.resAlloc.type1.numPrb; hqP->strtSymbl = puschInfo.tdAlloc.startSymb; hqP->numSymbl = puschInfo.tdAlloc.numSymb; hqP->tbInfo.qamOrder = puschInfo.tbInfo.qamOrder; @@@ -938,18 -909,17 +907,18 @@@ hqP->tbInfo.rv = puschInfo.tbInfo.rv; hqP->tbInfo.rvIdx = 0; hqP->tbInfo.tbSzReq = puschInfo.tbInfo.tbSize; +#ifdef INTEL_FAPI hqP->dmrsMappingType = puschInfo.dmrsMappingType; hqP->nrOfDmrsSymbols = puschInfo.nrOfDmrsSymbols; hqP->dmrsAddPos = puschInfo.dmrsAddPos; +#endif } else { - puschInfo.crnti = ueCb->crnti; - puschInfo.harqProcId = hqP->procId; - puschInfo.resAllocType = hqP->puschResType; - puschInfo.fdAlloc.startPrb = hqP->puschStartPrb; - puschInfo.fdAlloc.numPrb = hqP->puschNumPrb; + puschInfo.harqProcId = hqP->procId; + puschInfo.fdAlloc.resAllocType = hqP->puschResType; + puschInfo.fdAlloc.resAlloc.type1.startPrb = hqP->puschStartPrb; + puschInfo.fdAlloc.resAlloc.type1.numPrb = hqP->puschNumPrb; puschInfo.tdAlloc.startSymb = hqP->strtSymbl; puschInfo.tdAlloc.numSymb = hqP->numSymbl; puschInfo.tbInfo.qamOrder = hqP->tbInfo.qamOrder; @@@ -959,12 -929,10 +928,12 @@@ hqP->tbInfo.rvIdx = (hqP->tbInfo.rvIdx +1) & 0x3; puschInfo.tbInfo.rv = schCmnDlRvTbl[hqP->tbInfo.rvIdx]; puschInfo.tbInfo.tbSize = hqP->tbInfo.tbSzReq; +#ifdef INTEL_FAPI puschInfo.dmrsMappingType = hqP->dmrsMappingType; /* Setting Type-A */ puschInfo.nrOfDmrsSymbols = hqP->nrOfDmrsSymbols; puschInfo.dmrsAddPos = hqP->dmrsAddPos; - } +#endif + } schUlSlotInfo = cellCb->schUlSlotInfo[puschTime.slot]; SCH_ALLOC(schUlSlotInfo->schPuschInfo, sizeof(SchPuschInfo)); if(!schUlSlotInfo->schPuschInfo) @@@ -1061,10 -1029,11 +1030,10 @@@ uint8_t schFillUlDciForMsg3Retx(SchRaC dciInfo->dciInfo.pdschCfg = NULL; /* No DL data being sent */ msg3HqProc->tbInfo.txCntr++; - puschInfo->crnti = raCb->tcrnti; - puschInfo->harqProcId = msg3HqProc->procId; - puschInfo->resAllocType = msg3HqProc->puschResType; - puschInfo->fdAlloc.startPrb = msg3HqProc->puschStartPrb; - puschInfo->fdAlloc.numPrb = msg3HqProc->puschNumPrb; + puschInfo->harqProcId = msg3HqProc->procId; + puschInfo->fdAlloc.resAllocType = msg3HqProc->puschResType; + puschInfo->fdAlloc.resAlloc.type1.startPrb = msg3HqProc->puschStartPrb; + puschInfo->fdAlloc.resAlloc.type1.numPrb = msg3HqProc->puschNumPrb; puschInfo->tdAlloc.startSymb = msg3HqProc->strtSymbl; puschInfo->tdAlloc.numSymb = msg3HqProc->numSymbl; puschInfo->tbInfo.qamOrder = msg3HqProc->tbInfo.qamOrder; @@@ -1073,11 -1042,10 +1042,11 @@@ puschInfo->tbInfo.ndi = msg3HqProc->tbInfo.ndi; /* retransmission */ puschInfo->tbInfo.rv = msg3HqProc->tbInfo.rvIdx; puschInfo->tbInfo.tbSize = msg3HqProc->tbInfo.tbSzReq; +#ifdef INTEL_FAPI puschInfo->dmrsMappingType = msg3HqProc->dmrsMappingType; /* Setting Type-A */ puschInfo->nrOfDmrsSymbols = msg3HqProc->nrOfDmrsSymbols; puschInfo->dmrsAddPos = msg3HqProc->dmrsAddPos; - +#endif return ROK; } @@@ -1137,9 -1105,9 +1106,9 @@@ uint8_t schFillUlDci(SchUeCb *ueCb, Sch dciInfo->formatType = FORMAT0_0; /* fill UL grant */ - dciInfo->format.format0_0.resourceAllocType = puschInfo->resAllocType; - dciInfo->format.format0_0.freqAlloc.startPrb = puschInfo->fdAlloc.startPrb; - dciInfo->format.format0_0.freqAlloc.numPrb = puschInfo->fdAlloc.numPrb; + dciInfo->format.format0_0.resourceAllocType = puschInfo->fdAlloc.resAllocType; + dciInfo->format.format0_0.freqAlloc.startPrb = puschInfo->fdAlloc.resAlloc.type1.startPrb; + dciInfo->format.format0_0.freqAlloc.numPrb = puschInfo->fdAlloc.resAlloc.type1.numPrb; dciInfo->format.format0_0.timeAlloc.startSymb = puschInfo->tdAlloc.startSymb; dciInfo->format.format0_0.timeAlloc.numSymb = puschInfo->tdAlloc.numSymb; dciInfo->format.format0_0.rowIndex = 0; /* row Index */ @@@ -1176,7 -1144,7 +1145,7 @@@ * * @details * - * Function : MacSchModUeConfigReq + * Function : SchModUeConfigReq * * Functionality: Function to modify Ue Config request from MAC * @@@ -1185,7 -1153,7 +1154,7 @@@ * RFAILED - failure * * ****************************************************************/ - uint8_t MacSchModUeConfigReq(Pst *pst, SchUeRecfgReq *ueRecfg) + uint8_t SchModUeConfigReq(Pst *pst, SchUeRecfgReq *ueRecfg) { uint8_t ueId, lcIdx, ret = ROK; SchCellCb *cellCb = NULLP; @@@ -1194,13 -1162,9 +1163,9 @@@ Inst inst = pst->dstInst - SCH_INST_START; memset(&recfgRsp, 0, sizeof(SchUeRecfgRsp)); - #ifdef CALL_FLOW_DEBUG_LOG - DU_LOG("\nCall Flow: ENTMAC -> ENTSCH : EVENT_MODIFY_UE_CONFIG_REQ_TO_SCH\n"); - #endif - if(!ueRecfg) { - DU_LOG("\nERROR --> SCH : Modifying Ue Config request failed at MacSchModUeConfigReq()"); + DU_LOG("\nERROR --> SCH : Modifying Ue Config request failed at SchModUeConfigReq()"); return RFAILED; } DU_LOG("\nDEBUG --> SCH : Modifying Ue Config Request for CRNTI[%d]", ueRecfg->crnti); @@@ -1218,7 -1182,7 +1183,7 @@@ if(!ueCb) { - DU_LOG("\nERROR --> SCH : SchUeCb not found at MacSchModUeConfigReq() "); + DU_LOG("\nERROR --> SCH : SchUeCb not found at SchModUeConfigReq() "); SchSendUeRecfgRspToMac(ueRecfg, inst, RSP_NOK, &recfgRsp); return RFAILED; } @@@ -1240,39 -1204,6 +1205,6 @@@ return ret; } - /******************************************************************* - * - * @brief Fill and send UE delete response to MAC - * - * @details - * - * Function : SchSendUeDeleteRspToMac - * - * Functionality: Fill and send UE delete response to MAC - * - * @params[in] Inst inst, SchUeDelete *ueDelete, SchMacRsp result, - * ErrorCause cause - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ - void SchSendUeDeleteRspToMac(Inst inst, SchUeDelete *ueDelete, SchMacRsp result, ErrorCause cause) - { - Pst rspPst; - SchUeDeleteRsp delRsp; - - memset(&delRsp, 0, sizeof(SchUeDeleteRsp)); - delRsp.cellId = ueDelete->cellId; - delRsp.crnti = ueDelete->crnti; - delRsp.rsp = result; - delRsp.cause = cause; - - /* Filling response post */ - memset(&rspPst, 0, sizeof(Pst)); - FILL_PST_SCH_TO_MAC(rspPst, inst); - rspPst.event = EVENT_UE_DELETE_RSP_TO_MAC; - SchUeDeleteRspOpts[rspPst.selector](&rspPst, &delRsp); - } /******************************************************************* * @@@ -1402,6 -1333,9 +1334,9 @@@ void deleteSchUeCb(SchUeCb *ueCb SCH_FREE(ueCb->hqUlmap, sizeof(SchHqUlMap*)*(ueCb->cellCb->numSlots)); } + schDlHqEntDelete(ueCb); + schUlHqEntDelete(ueCb); + SCH_FREE(ueCb->ueCfg.ambrCfg, sizeof(SchAmbrCfg)); if(ueCb->ueCfg.spCellCfgPres) { @@@ -1452,13 -1386,47 +1387,47 @@@ } } + /******************************************************************* + * + * @brief Fill and send UE delete response to MAC + * + * @details + * + * Function : SchSendUeDeleteRspToMac + * + * Functionality: Fill and send UE delete response to MAC + * + * @params[in] Inst inst, SchUeDelete *ueDelete, SchMacRsp result, + * ErrorCause cause + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + void SchSendUeDeleteRspToMac(Inst inst, SchUeDelete *ueDelete, SchMacRsp result, ErrorCause cause) + { + Pst rspPst; + SchUeDeleteRsp delRsp; + + memset(&delRsp, 0, sizeof(SchUeDeleteRsp)); + delRsp.cellId = ueDelete->cellId; + delRsp.crnti = ueDelete->crnti; + delRsp.rsp = result; + delRsp.cause = cause; + + /* Filling response post */ + memset(&rspPst, 0, sizeof(Pst)); + FILL_PST_SCH_TO_MAC(rspPst, inst); + rspPst.event = EVENT_UE_DELETE_RSP_TO_MAC; + MacMessageRouter(&rspPst, (void *)&delRsp); + } + /******************************************************************* * * @brief Function for Ue Delete request from MAC to SCH * * @details * - * Function : MacSchUeDeleteReq + * Function : SchProcUeDeleteReq * * Functionality: Function for Ue Delete request from MAC to SCH * @@@ -1467,21 -1435,16 +1436,16 @@@ * RFAILED - failure * * ****************************************************************/ - uint8_t MacSchUeDeleteReq(Pst *pst, SchUeDelete *ueDelete) + uint8_t SchProcUeDeleteReq(Pst *pst, SchUeDelete *ueDelete) { - uint8_t idx=0, ueId=0, ueIdToDel=0, ret=ROK; + uint8_t idx=0, ueId=0, ret=ROK; ErrorCause result; SchCellCb *cellCb = NULLP; Inst inst = pst->dstInst - SCH_INST_START; - CmLList *node = NULL, *next = NULL; - #ifdef CALL_FLOW_DEBUG_LOG - DU_LOG("\nCall Flow: ENTMAC -> ENTSCH : EVENT_UE_DELETE_REQ_TO_SCH\n"); - #endif - if(!ueDelete) { - DU_LOG("\nERROR --> SCH : MacSchUeDeleteReq(): Ue Delete request failed"); + DU_LOG("\nERROR --> SCH : SchProcUeDeleteReq(): Ue Delete request failed"); ret = RFAILED; } DU_LOG("\nDEBUG --> SCH : Ue Delete request received for crnti[%d]", ueDelete->crnti); @@@ -1490,7 -1453,7 +1454,7 @@@ if(cellCb->cellId != ueDelete->cellId) { - DU_LOG("\nERROR --> SCH : MacSchUeDeleteReq(): cell Id is not available"); + DU_LOG("\nERROR --> SCH : SchProcUeDeleteReq(): cell Id is not available"); result = INVALID_CELLID; } else @@@ -1498,28 -1461,15 +1462,15 @@@ GET_UE_ID(ueDelete->crnti, ueId); if(( cellCb->ueCb[ueId-1].crnti == ueDelete->crnti) && ( cellCb->ueCb[ueId-1].state == SCH_UE_STATE_ACTIVE)) { - deleteSchUeCb(&cellCb->ueCb[ueId-1]); - ueIdToDel = ueId; /* Remove UE from ueToBeScheduled list */ - node = cellCb->ueToBeScheduled.first; - while(node) - { - next = node->next; - ueId = *(uint8_t *)node->node; - if(ueId == ueIdToDel) - { - SCH_FREE(node->node, sizeof(uint8_t)); - deleteNodeFromLList(&cellCb->ueToBeScheduled, node); - break; - } - node = next; - } + cellCb->api->SchUeDeleteReq(&cellCb->ueCb[ueId-1]); + deleteSchUeCb(&cellCb->ueCb[ueId-1]); cellCb->numActvUe--; result = NOT_APPLICABLE; } else { - DU_LOG("\nERROR --> SCH : MacSchUeDeleteReq(): SchUeCb not found"); + DU_LOG("\nERROR --> SCH : SchProcUeDeleteReq(): SchUeCb not found"); result = INVALID_UEID; } } @@@ -1536,209 -1486,6 +1487,6 @@@ return ret; } - /******************************************************************* - * - * @brief Fill and send Cell delete response to MAC - * - * @details - * - * Function : SchSendCellDeleteRspToMac - * - * Functionality: Fill and send Cell delete response to MAC - * - * @params[in] SchCellDelete *ueDelete, Inst inst, SchMacRsp result - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ - uint8_t SchSendCellDeleteRspToMac(SchCellDeleteReq *ueDelete, Inst inst, SchMacRsp result) - { - Pst rspPst; - uint8_t ret=0; - - SchCellDeleteRsp delRsp; - - DU_LOG("\nINFO --> SCH : Filling Cell Delete response"); - memset(&delRsp, 0, sizeof(SchCellDeleteRsp)); - delRsp.cellId = ueDelete->cellId; - delRsp.rsp = result; - - /* Filling response post */ - memset(&rspPst, 0, sizeof(Pst)); - FILL_PST_SCH_TO_MAC(rspPst, inst); - rspPst.event = EVENT_CELL_DELETE_RSP_TO_MAC; - ret = SchCellDeleteRspOpts[rspPst.selector](&rspPst, &delRsp); - if(ret == RFAILED) - { - DU_LOG("\nERROR --> SCH : SchSendCellDeleteRspToMac(): failed to send the Cell Delete response"); - return ret; - } - return ret; - } - - /******************************************************************* - * - * @brief Function for cellCb Deletion - * - * @details - * - * Function : deleteSchCellCb - * - * Functionality: Function for cellCb Deletion - * - * @params[in] SchCellDelete *cellDelete - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ - void deleteSchCellCb(SchCellCb *cellCb) - { - uint8_t sliceIdx=0, slotIdx=0; - CmLListCp *list=NULL; - CmLList *node=NULL, *next=NULL; - SchPageInfo *tempNode = NULLP; - - if(cellCb->schDlSlotInfo) - { - for(slotIdx=0; slotIdxnumSlots; slotIdx++) - { - list = &cellCb->schDlSlotInfo[slotIdx]->prbAlloc.freePrbBlockList; - node = list->first; - while(node) - { - next = node->next; - SCH_FREE(node->node, sizeof(FreePrbBlock)); - deleteNodeFromLList(list, node); - node = next; - } - SCH_FREE(cellCb->schDlSlotInfo[slotIdx], sizeof(SchDlSlotInfo)); - } - SCH_FREE(cellCb->schDlSlotInfo, cellCb->numSlots *sizeof(SchDlSlotInfo*)); - } - - if(cellCb->schUlSlotInfo) - { - for(slotIdx=0; slotIdxnumSlots; slotIdx++) - { - list = &cellCb->schUlSlotInfo[slotIdx]->prbAlloc.freePrbBlockList; - node = list->first; - while(node) - { - next = node->next; - SCH_FREE(node->node, sizeof(FreePrbBlock)); - deleteNodeFromLList(list, node); - node = next; - } - SCH_FREE(cellCb->schUlSlotInfo[slotIdx], sizeof(SchUlSlotInfo)); - } - SCH_FREE(cellCb->schUlSlotInfo, cellCb->numSlots * sizeof(SchUlSlotInfo*)); - } - - if(cellCb->cellCfg.plmnInfoList.snssai) - { - for(sliceIdx=0; sliceIdxcellCfg.plmnInfoList.numSliceSupport; sliceIdx++) - { - SCH_FREE(cellCb->cellCfg.plmnInfoList.snssai[sliceIdx], sizeof(Snssai)); - } - SCH_FREE(cellCb->cellCfg.plmnInfoList.snssai, cellCb->cellCfg.plmnInfoList.numSliceSupport*sizeof(Snssai*)); - } - - for(uint16_t idx =0; idxpageCb.pageIndInfoRecord[idx]; - node = list->first; - while(node) - { - next = node->next; - if(node->node) - { - tempNode = (SchPageInfo*)(node->node); - SCH_FREE(tempNode->pagePdu, tempNode->msgLen); - SCH_FREE(node->node, sizeof(SchPageInfo)); - } - deleteNodeFromLList(list, node); - node = next; - } - } - - /* Remove all UE from ueToBeScheduled list and deallocate */ - node = cellCb->ueToBeScheduled.first; - while(node) - { - next = node->next; - SCH_FREE(node->node, sizeof(uint8_t)); - cmLListDelFrm(&cellCb->ueToBeScheduled, node); - SCH_FREE(node, sizeof(CmLList)); - node = next; - } - - memset(cellCb, 0, sizeof(SchCellCb)); - - } - - /******************************************************************* - * - * @brief Function for cell Delete request from MAC to SCH - * - * @details - * - * Function : MacSchCellDeleteReq - * - * Functionality: Function for cell Delete request from MAC to SCH - * - * @params[in] Pst *pst, SchCellDelete *cellDelete - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ - - uint8_t MacSchCellDeleteReq(Pst *pst, SchCellDeleteReq *cellDelete) - { - uint8_t cellIdx=0, ret = RFAILED; - Inst inst = pst->dstInst - SCH_INST_START; - SchMacRsp result= RSP_OK; - - #ifdef CALL_FLOW_DEBUG_LOG - DU_LOG("\nCall Flow: ENTMAC -> ENTSCH : EVENT_CELL_DELETE_REQ_TO_SCH\n"); - #endif - - if(!cellDelete) - { - DU_LOG("\nERROR --> SCH : MacSchCellDeleteReq(): Ue Delete request failed"); - } - else - { - GET_CELL_IDX(cellDelete->cellId, cellIdx); - if(schCb[inst].cells[cellIdx] == NULLP) - { - DU_LOG("\nERROR --> SCH : MacSchCellDeleteReq(): cell Id[%d] is not available", cellDelete->cellId); - result = RSP_NOK; - } - else - { - if(schCb[inst].cells[cellIdx]->cellId == cellDelete->cellId) - { - deleteSchCellCb(schCb[inst].cells[cellIdx]); - result = RSP_OK; - ret = ROK; - SCH_FREE(schCb[inst].cells[cellIdx], sizeof(SchCellCb)); - DU_LOG("\nINFO --> SCH : Sending Cell Delete response to MAC"); - } - else - { - DU_LOG("\nERROR --> SCH : MacSchCellDeleteReq(): cell Id[%d] is not available",cellDelete->cellId); - result = RSP_NOK; - } - } - - if(SchSendCellDeleteRspToMac(cellDelete, inst, result)!=ROK) - { - DU_LOG("\nERROR --> SCH : MacSchCellDeleteReq(): failed to send Cell Delete response"); - ret = RFAILED; - } - } - return ret; - } /******************************************************************* * * @brief Function updates DL HARQ Feedback diff --combined src/cm/mac_sch_interface.h index 13cbf5d15,70776d7d9..ef8b485b5 --- a/src/cm/mac_sch_interface.h +++ b/src/cm/mac_sch_interface.h @@@ -442,16 -442,12 +442,16 @@@ typedef struct timeDomainAllo uint16_t numSymb; }TimeDomainAlloc; -typedef struct freqDomainAlloc +typedef struct resAllocType0 +{ + uint8_t rbBitmap[36]; +}ResAllocType0; + +typedef struct resAllocType1 { uint16_t startPrb; uint16_t numPrb; -}FreqDomainAlloc; - +}ResAllocType1; typedef struct { @@@ -471,7 -467,7 +471,7 @@@ typedef struct bwpCf { uint8_t subcarrierSpacing; uint8_t cyclicPrefix; - FreqDomainAlloc freqAlloc; + ResAllocType1 freqAlloc; }BwpCfg; typedef struct prg @@@ -517,7 -513,7 +517,7 @@@ typedef struct pdschFreqAllo { uint8_t resourceAllocType; /* since we are using type-1, rbBitmap excluded */ - FreqDomainAlloc freqAlloc; + ResAllocType1 freqAlloc; uint8_t vrbPrbMapping; } PdschFreqAlloc; @@@ -644,7 -640,7 +644,7 @@@ typedef struct schRachCf typedef struct schBwpParams { - FreqDomainAlloc freqAlloc; + ResAllocType1 freqAlloc; uint8_t scs; uint8_t cyclicPrefix; }SchBwpParams; @@@ -849,7 -845,7 +849,7 @@@ typedef struct ssbInf { uint8_t ssbIdx; /* SSB Index */ TimeDomainAlloc tdAlloc; /* Time domain allocation */ - FreqDomainAlloc fdAlloc; /* Freq domain allocation */ + ResAllocType1 fdAlloc; /* Freq domain allocation */ }SsbInfo; typedef struct sib1AllocInfo @@@ -865,7 -861,7 +865,7 @@@ typedef struct prachSchInf uint8_t prachFormat; /* PRACH Format */ uint8_t numRa; /* Freq domain ocassion */ uint8_t prachStartSymb; /* Freq domain ocassion */ -}PrachSchInfo; +}SchPrachInfo; /* Interface structure signifying DL broadcast allocation for SSB, SIB1 */ typedef struct dlBrdcstAlloc @@@ -889,7 -885,7 +889,7 @@@ typedef struct msg3UlGran { uint8_t freqHopFlag; uint16_t bwpSize; - FreqDomainAlloc msg3FreqAlloc; + ResAllocType1 msg3FreqAlloc; uint8_t k2Index; uint8_t mcs; uint8_t tpc; @@@ -971,7 -967,7 +971,7 @@@ typedef struct format0_ { uint8_t resourceAllocType; /* since we are using type-1, hence rbBitmap excluded */ - FreqDomainAlloc freqAlloc; + ResAllocType1 freqAlloc; TimeDomainAlloc timeAlloc; uint16_t rowIndex; uint8_t mcs; @@@ -1056,59 -1052,27 +1056,59 @@@ typedef struct dlPageAllo typedef struct tbInfo { - uint8_t qamOrder; /* Modulation Order */ - uint8_t mcs; /* MCS */ + uint8_t mcs; /* MCS */ + uint8_t ndi; /* NDI */ + uint8_t rv; /* Redundancy Version */ + uint16_t tbSize; /* TB Size */ + uint8_t qamOrder; /* Modulation Order */ SchMcsTable mcsTable; /* MCS Table */ - uint8_t ndi; /* NDI */ - uint8_t rv; /* Redundancy Version */ - uint16_t tbSize; /* TB Size */ }TbInfo; +typedef struct freqDomainAlloc +{ + uint8_t resAllocType; /* Resource allocation type */ + union + { + ResAllocType0 type0; + ResAllocType1 type1; + }resAlloc; +}FreqDomainAlloc; + typedef struct schPuschInfo { - uint16_t crnti; uint8_t harqProcId; /* HARQ Process ID */ - uint8_t resAllocType; /* Resource allocation type */ FreqDomainAlloc fdAlloc; /* Freq domain allocation */ TimeDomainAlloc tdAlloc; /* Time domain allocation */ TbInfo tbInfo; /* TB info */ +#ifdef INTEL_FAPI uint8_t dmrsMappingType; uint8_t nrOfDmrsSymbols; uint8_t dmrsAddPos; +#endif }SchPuschInfo; +typedef struct harqInfo +{ + uint16_t harqAckBitLength; + uint8_t betaOffsetHarqAck; +}HarqInfo; + +typedef struct csiInfo +{ + uint16_t csiBits; + uint8_t betaOffsetCsi; +}CsiInfo; + +typedef struct harqAckInfo +{ + uint16_t harqBitLength; +}HarqFdbkInfo; + +typedef struct csiPartInfo +{ + uint16_t csiBits; +}csiFdbkInfo; + typedef struct schPucchFormatCfg { uint8_t interSlotFreqHop; @@@ -1121,43 -1085,33 +1121,43 @@@ typedef struct schPucchInfo { - uint16_t rnti; - uint8_t pucchFormat; - FreqDomainAlloc fdAlloc; /* Freq domain allocation */ - TimeDomainAlloc tdAlloc; /* Time domain allocation */ + FreqDomainAlloc fdAlloc; + TimeDomainAlloc tdAlloc; uint8_t srFlag; - uint8_t harqFlag; - uint8_t numHarqBits; - uint8_t uciFlag; - uint8_t numUciBits; + HarqFdbkInfo harqInfo; + csiFdbkInfo csiInfo; + BeamformingInfo beamPucchInfo; + uint8_t pucchFormat; uint8_t intraFreqHop; uint16_t secondPrbHop; uint8_t initialCyclicShift; uint8_t occLen; uint8_t occIdx; uint8_t timeDomOCC; - SchPucchFormatCfg cmnFormatCfg; + uint8_t addDmrs; + bool pi2BPSK; }SchPucchInfo; +typedef struct schPuschUci +{ + uint8_t harqProcId; /* HARQ Process ID */ + FreqDomainAlloc fdAlloc; /* Freq domain allocation */ + TimeDomainAlloc tdAlloc; /* Time domain allocation */ + TbInfo tbInfo; /* TB information */ + HarqInfo harqInfo; /* Harq Information */ + CsiInfo csiInfo; /* Csi information*/ +}SchPuschUci; + typedef struct ulSchedInfo { - uint16_t cellId; /* Cell Id */ - uint16_t crnti; /* CRNI */ + uint16_t cellId; /* Cell Id */ + uint16_t crnti; /* CRNI */ SlotTimingInfo slotIndInfo; /* Slot Info: sfn, slot number */ - uint8_t dataType; /* Type of info being scheduled */ - PrachSchInfo prachSchInfo; /* Prach scheduling info */ - SchPuschInfo schPuschInfo; /* Pusch scheduling info */ - SchPucchInfo schPucchInfo; /* Pusch scheduling info */ + uint8_t dataType; /* Type of info being scheduled */ + SchPrachInfo prachSchInfo; /* Prach scheduling info */ + SchPuschInfo schPuschInfo; /* Pusch scheduling info */ + SchPuschUci schPuschUci; /* Pusch Uci */ + SchPucchInfo schPucchInfo; /* Pucch and Uci scheduling info */ }UlSchedInfo; typedef struct rachIndInfo @@@ -1871,21 -1825,21 +1871,21 @@@ typedef struct dlHarqIn typedef struct schRrmPolicyRatio { - uint8_t policyMaxRatio; - uint8_t policyMinRatio; - uint8_t policyDedicatedRatio; + uint8_t maxRatio; + uint8_t minRatio; + uint8_t dedicatedRatio; }SchRrmPolicyRatio; typedef struct schRrmPolicyOfSlice { Snssai snssai; - SchRrmPolicyRatio *rrmPolicyRatioInfo; + SchRrmPolicyRatio rrmPolicyRatioInfo; }SchRrmPolicyOfSlice; typedef struct schSliceCfgReq { uint8_t numOfConfiguredSlice; - SchRrmPolicyOfSlice **listOfConfirguration; + SchRrmPolicyOfSlice **listOfSlices; }SchSliceCfgReq; typedef struct sliceRsp @@@ -1927,196 -1881,11 +1927,11 @@@ typedef struct schRlsHqInf SchUeHqInfo *ueHqInfo; }SchRlsHqInfo; - /* function pointers */ - typedef uint8_t (*SchCellCfgCfmFunc) ARGS(( - Pst *pst, /* Post Structure */ - SchCellCfgCfm *schCellCfgCfm /* Cell Cfg Cfm */ - )); - - typedef uint8_t (*SchCellCfgFunc) ARGS(( - Pst *pst, /* Post Structure */ - SchCellCfg *schCellCfg /* Cell Cfg */ - )); - - typedef uint8_t (*SchMacDlAllocFunc) ARGS(( - Pst *pst, /* Post Structure */ - DlSchedInfo *dlSchedInfo /* dl allocation Info */ - )); - - typedef uint8_t (*SchMacDlPageAllocFunc) ARGS(( - Pst *pst, /* Post Structure */ - DlPageAlloc *dlPageAlloc /* dl Page allocation Info */ - )); - - typedef uint8_t (*SchMacUlSchInfoFunc) ARGS(( - Pst *pst, /* Post Structure */ - UlSchedInfo *ulSchedInfo /* UL Alloc Sch Info */ - )); - - typedef uint8_t (*MacSchRachIndFunc) ARGS(( - Pst *pst, /* Post structure */ - RachIndInfo *rachInd)); /* Rach Indication Info */ - - typedef uint8_t (*MacSchCrcIndFunc) ARGS(( - Pst *pst, /* Post structure */ - CrcIndInfo *crcInd)); /* CRC Info */ - - typedef uint8_t (*MacSchDlRlcBoInfoFunc) ARGS(( - Pst *pst, /* Post structure */ - DlRlcBoInfo *dlBoInfo)); /* DL BO Info */ - - typedef uint8_t (*MacSchAddUeConfigReqFunc) ARGS(( - Pst *pst, /* Post structure */ - SchUeCfgReq *ueCfgToSch)); /* Scheduler UE Cfg */ - - typedef uint8_t (*SchUeCfgRspFunc) ARGS(( - Pst *pst, /* Post structure */ - SchUeCfgRsp *cfgRsp)); /* Scheduler UE Cfg response */ - - typedef uint8_t (*MacSchSlotIndFunc) ARGS(( - Pst *pst, /* Post structure */ - SlotTimingInfo *slotInd)); /* Slot Info */ - - typedef uint8_t (*MacSchBsrFunc) ARGS(( - Pst *pst, - UlBufferStatusRptInd *bsrInd - )); - - typedef uint8_t (*MacSchDlHarqIndFunc) ARGS(( - Pst *pst, /* Post structure */ - DlHarqInd *dlHarqInd)); /* Dl HARQ IND Info */ - - typedef uint8_t (*MacSchSrUciIndFunc) ARGS(( - Pst *pst, /* Post structure */ - SrUciIndInfo *uciInd)); /* UCI IND Info */ - - typedef uint8_t (*MacSchModUeConfigReqFunc) ARGS(( - Pst *pst, /* Post structure */ - SchUeRecfgReq *ueRecfgToSch)); /* Scheduler UE Recfg */ - - typedef uint8_t (*SchUeRecfgRspFunc) ARGS(( - Pst *pst, /* Post structure */ - SchUeRecfgRsp *recfgRsp)); /* Scheduler UE Cfg response */ - - typedef uint8_t (*MacSchRachRsrcReqFunc) ARGS(( - Pst *pst, /* Post structure */ - SchRachRsrcReq *schRachRsrcReq)); /* RACH resource request to SCH */ - - typedef uint8_t (*SchRachRsrcRspFunc) ARGS(( - Pst *pst, /* Post structure */ - SchRachRsrcRsp *schRachRsrcRsp)); /* RACH resource request to MAC */ - - typedef uint8_t (*MacSchRachRsrcRelFunc) ARGS(( - Pst *pst, /* Post structure */ - SchRachRsrcRel *schRachRsrcRel)); /* RACH resource release to SCH */ - - typedef uint8_t (*MacSchUeDeleteReqFunc) ARGS(( - Pst *pst, /* Post structure */ - SchUeDelete *schUeDel)); /*Scheduler UE Del*/ - - typedef uint8_t (*SchUeDeleteRspFunc) ARGS(( - Pst *pst, /* Post structure */ - SchUeDeleteRsp *delRsp)); /* Scheduler UE delete response */ - - typedef uint8_t (*MacSchCellDeleteReqFunc) ARGS(( - Pst *pst, /* Post structure */ - SchCellDeleteReq *schCellDelete)); /*Scheduler UE Del*/ - - typedef uint8_t (*SchCellDeleteRspFunc) ARGS(( - Pst *pst, /* Post structure */ - SchCellDeleteRsp *schCellDeleteRsp)); /* Scheduler UE delete response */ - - typedef uint8_t (*MacSchSliceCfgReqFunc) ARGS(( - Pst *pst, /* Post structure */ - SchSliceCfgReq *schSliceCfgReq)); /* Scheduler Slice Cfg Req */ - - typedef uint8_t (*SchSliceCfgRspFunc) ARGS(( - Pst *pst, /* Post Structure */ - SchSliceCfgRsp *schSliceCfgRsp /* Cell Cfg Cfm */ - )); - - typedef uint8_t (*MacSchSliceRecfgReqFunc) ARGS(( - Pst *pst, /* Post structure */ - SchSliceRecfgReq *schSliceRecfgReq)); /* Scheduler Slice Recfg Req */ - - typedef uint8_t (*SchSliceRecfgRspFunc) ARGS(( - Pst *pst, /* Post Structure */ - SchSliceRecfgRsp *schSliceRecfgRsp /* Cell Recfg Cfm */ - )); - - typedef uint8_t (*MacSchPagingIndFunc) ARGS(( - Pst *pst, /* Post structure */ - SchPageInd *schPagingInd)); /* Paging Indication */ - - typedef uint8_t (*SchMacDlReleaseHarqFunc) ARGS(( - Pst *pst, /* Post structure */ - SchRlsHqInfo *rlsHqInfo)); /* Release Harq proc */ - /* function declarations */ - uint8_t packMacSchSlotInd(Pst *pst, SlotTimingInfo *slotInd); - uint8_t packSchMacDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo); - uint8_t packSchMacUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo); - uint8_t packSchCellCfg(Pst *pst, SchCellCfg *schCellCfg); - uint8_t packSchCellCfgCfm(Pst *pst, SchCellCfgCfm *schCellCfgCfm); - uint8_t MacProcDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo); - uint8_t MacProcSchCellCfg(Pst *pst, SchCellCfg *schCellCfg); - uint8_t MacProcSchCellCfgCfm(Pst *pst, SchCellCfgCfm *schCellCfgCfm); - uint8_t SchHdlCellCfgReq(Pst *pst, SchCellCfg *schCellCfg); uint8_t schActvInit(Ent entity, Inst instId, Region region, Reason reason); - uint8_t MacProcUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo); - uint8_t packMacSchRachInd(Pst *pst, RachIndInfo *rachInd); - uint8_t MacSchRachInd(Pst *pst, RachIndInfo *rachInd); - uint8_t packMacSchCrcInd(Pst *pst, CrcIndInfo *crcInd); - uint8_t MacSchCrcInd(Pst *pst, CrcIndInfo *crcInd); - uint8_t packMacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo); - uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo); - uint8_t packMacSchAddUeConfigReq(Pst *pst, SchUeCfgReq *ueCfgToSch); - uint8_t MacSchAddUeConfigReq(Pst *pst, SchUeCfgReq *ueCfgToSch); - uint8_t packSchUeCfgRsp(Pst *pst, SchUeCfgRsp *cfgRsp); - uint8_t MacProcSchUeCfgRsp(Pst *pst, SchUeCfgRsp *cfgRsp); - uint8_t packSchUeRecfgRsp(Pst *pst, SchUeRecfgRsp *cfgRsp); - uint8_t MacProcSchUeRecfgRsp(Pst *pst, SchUeRecfgRsp *reCfgRsp); - uint8_t MacSchSlotInd ARGS((Pst * pst, SlotTimingInfo * slotInd)); - uint8_t packMacSchSlotInd(Pst * pst, SlotTimingInfo * slotInd); - uint8_t unpackMacSchSlotInd(MacSchSlotIndFunc func, Pst *pst, Buffer *mBuf); - uint8_t packMacSchBsr(Pst *pst, UlBufferStatusRptInd *bsrInd); - uint8_t MacSchBsr(Pst *pst, UlBufferStatusRptInd *bsrInd); - uint8_t packMacSchSrUciInd(Pst *pst, SrUciIndInfo *uciInd); - uint8_t packMacSchDlHarqInd(Pst *pst, DlHarqInd *dlHarqInd); - uint8_t MacSchDlHarqInd(Pst *pst, DlHarqInd *dlHarqInd); - uint8_t MacSchSrUciInd(Pst *pst, SrUciIndInfo *uciInd); - uint8_t packMacSchModUeConfigReq(Pst *pst, SchUeRecfgReq *ueRecfgToSch); - uint8_t MacSchModUeConfigReq(Pst *pst, SchUeRecfgReq *ueRecfgToSch); - uint8_t packSchUeReconfigRsp(Pst *pst, SchUeRecfgRsp *recfgRsp); - uint8_t MacProcSchUeReconfigRsp(Pst *pst, SchUeRecfgRsp *recfgRsp); - uint8_t packMacSchRachRsrcReq(Pst *pst, SchRachRsrcReq *schRachRsrcReq); - uint8_t MacSchRachRsrcReq(Pst *pst, SchRachRsrcReq *schRachRsrcReq); - uint8_t packSchRachRsrcRsp(Pst *pst, SchRachRsrcRsp *schRachRsrcRsp); - uint8_t MacProcSchRachRsrcRsp(Pst *pst, SchRachRsrcRsp *schRachRsrcRsp); - uint8_t packMacSchRachRsrcRel(Pst *pst, SchRachRsrcRel *schRachRsrcRel); - uint8_t MacSchRachRsrcRel(Pst *pst, SchRachRsrcRel *schRachRsrcRel); - uint8_t packMacSchUeDeleteReq(Pst *pst, SchUeDelete *schUeDel); - uint8_t MacSchUeDeleteReq(Pst *pst, SchUeDelete *ueDelete); - uint8_t packSchUeDeleteRsp(Pst *pst, SchUeDeleteRsp *delRsp); - uint8_t MacProcSchUeDeleteRsp(Pst *pst, SchUeDeleteRsp *schUeDelRsp); - uint8_t packMacSchCellDeleteReq(Pst *pst, SchCellDeleteReq *schCellDelete); - uint8_t MacSchCellDeleteReq(Pst *pst, SchCellDeleteReq *schCellDelete); - uint8_t packSchCellDeleteRsp(Pst *pst, SchCellDeleteRsp *schCellDeleteRsp); - uint8_t MacProcSchCellDeleteRsp(Pst *pst, SchCellDeleteRsp *schCellDeleteRsp); - uint8_t packMacSchSliceCfgReq(Pst *pst, SchSliceCfgReq *cfgReq); - uint8_t MacSchSliceCfgReq(Pst *pst, SchSliceCfgReq *schSliceCfgReq); - uint8_t packSchSliceCfgRsp(Pst *pst, SchSliceCfgRsp *cfgRsp); - uint8_t MacProcSchSliceCfgRsp(Pst *pst, SchSliceCfgRsp *cfgRsp); - uint8_t packMacSchSliceRecfgReq(Pst *pst, SchSliceRecfgReq *recfgReq); - uint8_t MacSchSliceRecfgReq(Pst *pst, SchSliceRecfgReq *schSliceRecfgReq); - uint8_t packSchSliceRecfgRsp(Pst *pst, SchSliceRecfgRsp *schSliceRecfgRsp); - uint8_t MacProcSchSliceRecfgRsp(Pst *pst, SchSliceRecfgRsp *sliceRecfgrsp); - uint8_t packMacSchPagingInd(Pst *pst, SchPageInd *pageInd); - uint8_t MacSchPagingInd(Pst *pst, SchPageInd *pageInd); - uint8_t packSchMacDlPageAlloc(Pst *pst, DlPageAlloc *dlPageAlloc); - uint8_t MacProcDlPageAlloc(Pst *pst, DlPageAlloc *dlPageAlloc); - uint8_t packSchMacDlReleaseHarq(Pst *pst, SchRlsHqInfo *rlsHqInfo); - uint8_t MacSchReleaseDlHarqProc(Pst *pst, SchRlsHqInfo *rlsHqInfo); + uint8_t MacMessageRouter(Pst *pst, void *msg); + uint8_t SchMessageRouter(Pst *pst, void *msg); + /********************************************************************** End of file **********************************************************************/ diff --combined src/du_app/du_mgr_main.c index 9bd71c119,40efc773e..fd2902c9c --- a/src/du_app/du_mgr_main.c +++ b/src/du_app/du_mgr_main.c @@@ -42,8 -42,8 +42,8 @@@ uint8_t rlcUlActvTsk (Pst *, Buffer *) uint8_t rlcUlActvInit (Ent, Inst, Region, Reason); uint8_t rlcDlActvTsk (Pst *, Buffer *); uint8_t rlcDlActvInit (Ent, Inst, Region, Reason); - uint8_t rgActvTsk (Pst *, Buffer *); - uint8_t rgActvInit (Ent, Inst, Region, Reason); + uint8_t macActvTsk (Pst *, Buffer *); + uint8_t macActvInit (Ent, Inst, Region, Reason); uint8_t lwrMacActvTsk(Pst *, Buffer *); uint8_t lwrMacActvInit(Ent, Inst, Region, Reason); #ifndef INTEL_WLS_MEM @@@ -162,11 -162,13 +162,11 @@@ uint8_t setRrmPolicy(RrmPolicyList rrmP { if(duCb.sliceState == SLICE_INFO_NOT_AVAILABLE) { - BuildAndSendSliceConfigReq(duCfgParam.tempSliceCfg.rrmPolicy, duCfgParam.tempSliceCfg.totalRrmPolicy,\ - duCfgParam.tempSliceCfg.totalSliceCount); + BuildAndSendSliceConfigReq(); } else { - BuildAndSendSliceRecfgReq(duCfgParam.tempSliceCfg.rrmPolicy, duCfgParam.tempSliceCfg.totalRrmPolicy,\ - duCfgParam.tempSliceCfg.totalSliceCount); + BuildAndSendSliceRecfgReq(); } } } @@@ -394,7 -396,7 +394,7 @@@ uint8_t rlcDlInit(SSTskId sysTskId /* Register MAC TAPA Task */ if(ODU_REG_TTSK((Ent)ENTMAC, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0, - rgActvInit, (ActvTsk)rgActvTsk) != ROK) + macActvInit, (ActvTsk)macActvTsk) != ROK) { return RFAILED; }