MacCb macCb;
/* Function declarations */
+uint8_t macActvInit ARGS((Ent entity, Inst inst, Region region, Reason reason));
+uint8_t macActvTsk(Pst *pst, Buffer *mBuf);
short int macActvTmr(Ent ent,Inst inst);
+
void fillRarPdu(RarInfo *rarInfo);
void fillMsg4DlData(MacDlData *dlData, uint16_t msg4PduLen, uint8_t *msg4Pdu);
void fillMacCe(MacCeInfo *macCeData, uint8_t *msg3Pdu);
void buildAndSendMuxPdu(SlotTimingInfo currTimingInfo);
uint8_t macProcUlCcchInd(uint16_t cellId, uint16_t crnti, uint16_t rrcContSize, uint8_t *rrcContainer);
uint8_t macProcShortBsr(uint16_t cellId, uint16_t crnti, uint8_t lcgId, uint32_t bufferSize);
-uint8_t macProcUlData(uint16_t cellId, uint16_t rnti, SlotTimingInfo slotInfo, \
- uint8_t lcId, uint16_t pduLen, uint8_t *pdu);
+uint8_t macProcUlData(uint16_t cellId, uint16_t rnti, SlotTimingInfo slotInfo, uint8_t lcId, uint16_t pduLen, uint8_t *pdu);
uint8_t sendSchedRptToRlc(DlSchedInfo dlInfo, SlotTimingInfo slotInfo, uint8_t ueIdx, uint8_t schInfoIdx);
-uint8_t macProcLongBsr(uint16_t cellId, uint16_t crnti,uint8_t numLcg,\
- DataVolInfo dataVolInfo[MAX_NUM_LOGICAL_CHANNEL_GROUPS]);
+uint8_t macProcLongBsr(uint16_t cellId, uint16_t crnti,uint8_t numLcg, DataVolInfo dataVolInfo[MAX_NUM_LOGICAL_CHANNEL_GROUPS]);
void freeMacSliceCfgReq(MacSliceCfgReq *cfgReq,Pst *pst);
void deleteMacRaCb(uint16_t cellIdx, MacUeCb *ueCb);
+
+uint8_t MacProcSchSliceCfgRsp(Pst *pst, SchSliceCfgRsp *schSliceCfgRsp);
+uint8_t MacProcSchSliceRecfgRsp(Pst *pst, SchSliceRecfgRsp *sliceRecfgrsp);
+uint8_t MacProcSchCellCfgCfm(Pst *pst, SchCellCfgCfm *schCellCfgCfm);
+uint8_t MacProcDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo);
+uint8_t MacProcUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo);
+uint8_t MacProcSchRachRsrcRsp(Pst *pst, SchRachRsrcRsp *schRachRsrcRsp);
+uint8_t MacProcDlPageAlloc(Pst *pst, DlPageAlloc *dlPageAlloc);
+uint8_t MacProcSchCellDeleteRsp(Pst *pst, SchCellDeleteRsp *schCellDeleteRsp);
#endif
/**********************************************************************
End of file
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 */
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
*
{
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));
}
/**
**/
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;
{
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));
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 */
{
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));
}
/*******************************************************************
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);
}
}
}
void addDlHqProcInUe(SlotTimingInfo dlMsgTime, MacUeCb *ueCb, DlMsgSchInfo schedInfo);
uint8_t updateNewTbInDlHqProcCb(SlotTimingInfo slotInfo, MacUeCb *ueCb, uint32_t tbSize, uint8_t *txPdu);
uint8_t* fetchTbfromDlHarqProc(SlotTimingInfo slotInfo, MacUeCb *ueCb, uint8_t hqProcId, uint32_t tbSize);
+uint8_t MacSchReleaseDlHarqProc(Pst *pst, SchRlsHqInfo *rlsHqInfo);
/**********************************************************************
End of file
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
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));
}
/*******************************************************************
Pst pst;
FILL_PST_MAC_TO_SCH(pst, EVENT_CRC_IND_TO_SCH);
- return(*macSchCrcIndOpts[pst.selector])(&pst, crcInd);
+ return(SchMessageRouter(&pst, (void *)crcInd));
}
/*******************************************************************
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));
}
/*******************************************************************
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));
}
/*******************************************************************
/* 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);
}
/* Fill Pst */
FILL_PST_MAC_TO_SCH(pst, EVENT_UCI_IND_TO_SCH);
- return(*macSchSrUciIndOpts[pst.selector])(&pst, &srUciInd);
+ return(SchMessageRouter(&pst, (void *)&srUciInd));
}
/*******************************************************************
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);
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);
}
}
#include "rg.x" /* typedefs for MAC */
#include "rlc_mac_inf.h"
#include "lwr_mac_upr_inf.h"
+#include "mac_sch_interface.h"
+#include "mac.h"
+#include "mac_ue_mgr.h"
+#include "mac_harq_dl.h"
/**
- * @brief Task Activation callback function Entity SM.
+ * @brief Task Activation callback function Entity DU APP.
*
* @details
*
- * Function : rgHdlSMEvents
+ * Function : MacHdlDuappEvents
*
- * Process Messages received from Entity SM
+ * Process Messages received from Entity DU APP
*
* @param[in] Pst *pst, Post structure of the primitive.
* @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
* @param[in] Reason reason.
* @return void
**/
-static inline void rgHdlSMEvents
-(
-Pst *pst, /* post structure */
-Buffer *mBuf /* message buffer */
-)
+void MacHdlDuappEvents(Pst *pst, Buffer *mBuf)
{
switch(pst->event)
{
}
}
-
-/**
- * @brief Task Activation callback function Entity NH.
- *
- * @details
- *
- * Function : rgHdlNHEvents
- *
- * Process Messages received from Entity NH
- *
- * @param[in] Pst *pst, Post structure of the primitive.
- * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
- * @param[in] Reason reason.
- * @return void
- **/
-static inline void rgHdlNHEvents
-(
-Pst *pst, /* post structure */
-Buffer *mBuf /* message buffer */
-)
-{
- switch(pst->event)
- {
-#ifdef LCRGUICRG
- case EVTCRGBNDREQ:
- cmUnpkCrgBndReq(RgUiCrgBndReq, pst, mBuf);
- break;
- case EVTCRGUBNDREQ:
- cmUnpkCrgUbndReq(RgUiCrgUbndReq, pst, mBuf);
- break;
-#endif
- default:
- RG_FREE_MSG(mBuf);
- break;
- }
-}
-
/**
- * @brief Task Activation callback function Entity KW.
+ * @brief Task Activation callback function Entity RLC.
*
* @details
*
- * Function : rgHdlKWEvents
+ * Function : MacHdlRlcEvents
*
- * Process Messages received from Entity KW
+ * Process Messages received from Entity RLC
*
* @param[in] Pst *pst, Post structure of the primitive.
* @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
* @param[in] Reason reason.
* @return void
**/
-static inline void rgHdlKWEvents
-(
-Pst *pst, /* post structure */
-Buffer *mBuf /* message buffer */
-)
+void MacHdlRlcEvents(Pst *pst, Buffer *mBuf)
{
switch(pst->event)
{
-#ifdef LCRGUIRGU
case EVTRGUBNDREQ:
cmUnpkRguBndReq(RgUiRguBndReq, pst, mBuf);
break;
case EVENT_BO_STATUS_TO_MAC:
unpackRlcBoStatus(MacProcRlcBoStatus, pst, mBuf);
break;
-#ifdef LTE_L2_MEAS
-
- case EVTRGUL2MULTHRPMEASREQ:
- cmUnpkRguL2MUlThrpMeasReq(RgUiRguL2MUlThrpMeasReq, pst,mBuf);
- break;
-
-#endif
-#endif
default:
RG_FREE_MSG(mBuf);
break;
}
/**
- * @brief Task Activation callback function Entity TF.
+ * @brief Task Activation callback function Entity Lower MAC
*
* @details
*
- * Function : rgHdlTFEvents
+ * Function : MacHdlLwrMacEvents
*
- * Process Messages received from Entity TF
+ * Process Messages received from Entity Lower MAC
*
* @param[in] Pst *pst, Post structure of the primitive.
* @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
* @param[in] Reason reason.
* @return void
**/
-static inline void rgHdlTFEvents
-(
-Pst *pst, /* post structure */
-Buffer *mBuf /* message buffer */
-)
+void MacHdlLwrMacEvents(Pst *pst, Buffer *mBuf)
{
switch(pst->event)
{
case EVENT_SLOT_IND_TO_MAC:
- unpackSlotInd(fapiMacSlotInd, pst, mBuf);
+ unpackSlotInd(fapiMacSlotInd, pst, mBuf);
break;
case EVENT_STOP_IND_TO_MAC:
- unpackStopInd(fapiMacStopInd, pst, mBuf);
- break;
- case EVENT_RACH_IND_TO_MAC:
- unpackRachInd(fapiMacRachInd, pst, mBuf);
- break;
- case EVENT_CRC_IND_TO_MAC:
- unpackCrcInd(fapiMacCrcInd, pst, mBuf);
- break;
- case EVENT_RX_DATA_IND_TO_MAC:
- unpackRxDataInd(fapiMacRxDataInd, pst, mBuf);
- break;
- case EVENT_UCI_IND_TO_MAC:
- unpackUciInd(FapiMacUciInd, pst, mBuf);
- break;
- default:
- RG_FREE_MSG(mBuf);
+ unpackStopInd(fapiMacStopInd, pst, mBuf);
break;
- }
-}
-
-
-/**
- * @brief Task Activation callback function Entity RG SCH.
- *
- * @details
- *
- * Function : rgHdlRGEvents
- *
- * Process Messages received from Entity RG SCH
- *
- * @param[in] Pst *pst, Post structure of the primitive.
- * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
- * @param[in] Reason reason.
- * @return void
- **/
-static inline void rgHdlRGEvents
-(
-Pst *pst, /* post structure */
-Buffer *mBuf /* message buffer */
-)
-{
- switch(pst->event)
- {
-#ifdef LCRG
- case EVTINFCELLREGREQ:
- cmUnpkSchMacCellRegReq(RgSchMacCellRegReq, pst, mBuf);
- break;
- case EVTINFSFALLOCREQ:
- cmUnpkSchMacSfAllocReq(RgSchMacSfAllocReq, pst, mBuf);
- break;
- case EVTINFRLSHQREQ:
- cmUnpkSchMacRlsHqReq(RgSchMacRlsHqReq, pst, mBuf);
- break;
- case EVTINFHQENTRESET:
- cmUnpkSchMacRstHqEntReq(RgSchMacRstHqEntReq, pst, mBuf);
- break;
- case EVTINFRLSRNTIREQ:
- cmUnpkSchMacRlsRntiReq(RgSchMacRlsRntiReq, pst, mBuf);
+ case EVENT_RACH_IND_TO_MAC:
+ unpackRachInd(fapiMacRachInd, pst, mBuf);
break;
-#ifdef LTE_L2_MEAS
- case EVTINFL2MEASREQ:
- cmUnpkSchMacL2MeasReq(RgSchMacL2MeasReq, pst, mBuf);
+ case EVENT_CRC_IND_TO_MAC:
+ unpackCrcInd(fapiMacCrcInd, pst, mBuf);
break;
- case EVTINFL2MEASSENDREQ :
- cmUnpkSchMacL2MeasSendReq(RgSchMacL2MeasSendReq, pst , mBuf);
+ case EVENT_RX_DATA_IND_TO_MAC:
+ unpackRxDataInd(fapiMacRxDataInd, pst, mBuf);
break;
- case EVTINFL2MEASSTOPREQ:
- cmUnpkSchMacL2MeasStopReq(RgSchMacL2MeasStopReq, pst , mBuf);
+ case EVENT_UCI_IND_TO_MAC:
+ unpackUciInd(FapiMacUciInd, pst, mBuf);
break;
-#endif/* LTE_L2_MEAS */
-#endif /* LCRG */
-#if defined(LTE_ADV) && defined(LCPRG)
- case EVTPRGUESCELLCFGREQ:
- {
- cmUnpkPrgPMacSMacUeSCellCfgReq(RgPrgPMacSMacUeSCellCfgReq, pst, mBuf);
- }
- break;
- case EVTPRGUESCELLCFGCFM:
- case EVTPRGUESCELLLCHMODCFM:
- case EVTPRGUESCELLLCHDELCFMDEL:
- case EVTPRGUESCELLLCHADDCFM:
- {
- cmUnpkPrgSMacPMacCfgCfm(RgPrgSMacPMacCfgCfm, pst, mBuf);
- }
- break;
- case EVTPRGUESCELLDELREQ:
- {
- cmUnpkPrgPMacSMacUeSCellDelReq(RgPrgPMacSMacUeSCellDelReq, pst, mBuf);
- }
- break;
- case EVTPRGUESCELLLCHMODREQ:
- {
- cmUnpkPrgPMacSMacUeSCellLchModReq(RgPrgPMacSMacUeSCellLchModReq, pst,
- mBuf);
- }
- break;
- case EVTPRGUESCELLLCHDELREQ:
- {
- cmUnpkPrgPMacSMacUeSCellLchDelReq(RgPrgPMacSMacUeSCellLchDelReq, pst,
- mBuf);
- }
- break;
- case EVTPRGUESCELLLCHADDREQ:
- {
- cmUnpkPrgPMacSMacUeSCellLchAddReq(RgPrgPMacSMacUeSCellLchAddReq, pst,
- mBuf);
- }
- break;
-
-#endif
default:
- {
RG_FREE_MSG(mBuf);
break;
- }
-
}
}
*
* @details
*
-* Function : callFlowRgActvTsk
+* Function : callFlowMacActvTsk
*
* Function prints src, dest, msg infor about all the msgs that received
*
* @return void
**/
-void callFlowRgActvTsk(Pst *pst)
+void callFlowMacActvTsk(Pst *pst)
{
char sourceTask[50];
char destTask[50]="ENTMAC";
break;
}
- case ENTMAC: /* When scheduler instance sends msg to MAC */
+ case ENTMAC:
{
- strcpy(sourceTask,"ENTMAC");
- switch(pst->event)
+ if(pst->srcInst == 1)
{
-#ifdef LCRG
- case EVTINFCELLREGREQ:
- strcpy(message,"EVTINFCELLREGREQ");
- break;
- case EVTINFSFALLOCREQ:
- strcpy(message,"EVTINFSFALLOCREQ");
- break;
- case EVTINFRLSHQREQ:
- strcpy(message,"EVTINFRLSHQREQ");
- break;
- case EVTINFHQENTRESET:
- strcpy(message,"EVTINFHQENTRESET");
- break;
- case EVTINFRLSRNTIREQ:
- strcpy(message,"EVTINFRLSRNTIREQ");
- break;
-#endif
-#if defined(LTE_ADV) && defined(LCPRG)
- case EVTPRGUESCELLCFGREQ:
- strcpy(message,"EVTPRGUESCELLCFGREQ");
- break;
- case EVTPRGUESCELLCFGCFM:
- strcpy(message,"EVTPRGUESCELLCFGCFM");
- break;
- case EVTPRGUESCELLLCHMODCFM:
- strcpy(message,"EVTPRGUESCELLLCHMODCFM");
- break;
- case EVTPRGUESCELLLCHDELCFMDEL:
- strcpy(message,"EVTPRGUESCELLLCHDELCFMDEL");
- break;
- case EVTPRGUESCELLLCHADDCFM:
- strcpy(message,"EVTPRGUESCELLLCHADDCFM");
- break;
- case EVTPRGUESCELLDELREQ:
- strcpy(message,"EVTPRGUESCELLDELREQ");
- break;
- case EVTPRGUESCELLLCHMODREQ:
- strcpy(message,"EVTPRGUESCELLLCHMODREQ");
- break;
- case EVTPRGUESCELLLCHDELREQ:
- strcpy(message,"EVTPRGUESCELLLCHDELREQ");
- break;
- case EVTPRGUESCELLLCHADDREQ:
- strcpy(message,"EVTPRGUESCELLLCHADDREQ");
- break;
-
-#endif
- default:
- strcpy(message,"Invalid Event");
- break;
+ strcpy(sourceTask,"ENTSCH");
+ switch(pst->event)
+ {
+ case EVENT_SLICE_CFG_RSP_TO_MAC:
+ {
+ strcpy(message,"EVENT_SLICE_CFG_RSP_TO_MAC");
+ break;
+ }
+ case EVENT_SLICE_RECFG_RSP_TO_MAC:
+ {
+ strcpy(message,"EVENT_SLICE_RECFG_RSP_TO_MAC");
+ break;
+ }
+ case EVENT_SCH_CELL_CFG_CFM:
+ {
+ strcpy(message,"EVENT_SCH_CELL_CFG_CFM");
+ break;
+ }
+ case EVENT_UE_CONFIG_RSP_TO_MAC:
+ {
+ strcpy(message,"EVENT_UE_CONFIG_RSP_TO_MAC");
+ break;
+ }
+ case EVENT_UE_RECONFIG_RSP_TO_MAC:
+ {
+ strcpy(message,"EVENT_UE_RECONFIG_RSP_TO_MAC");
+ break;
+ }
+ case EVENT_DL_SCH_INFO:
+ {
+ strcpy(message,"EVENT_DL_SCH_INFO");
+ break;
+ }
+ case EVENT_UL_SCH_INFO:
+ {
+ strcpy(message,"EVENT_UL_SCH_INFO");
+ break;
+ }
+ case EVENT_RACH_RESOURCE_RESPONSE_TO_MAC:
+ {
+ strcpy(message,"EVENT_RACH_RESOURCE_RESPONSE_TO_MAC");
+ break;
+ }
+ case EVENT_DL_PAGING_ALLOC:
+ {
+ strcpy(message,"EVENT_DL_PAGING_ALLOC");
+ break;
+ }
+ case EVENT_UE_DELETE_RSP_TO_MAC:
+ {
+ strcpy(message,"EVENT_UE_DELETE_RSP_TO_MAC");
+ break;
+ }
+ case EVENT_CELL_DELETE_RSP_TO_MAC:
+ {
+ strcpy(message,"EVENT_CELL_DELETE_RSP_TO_MAC");
+ break;
+ }
+ case EVENT_DL_REL_HQ_PROC:
+ {
+ strcpy(message,"EVENT_DL_REL_HQ_PROC");
+ break;
+ }
+ default:
+ strcpy(message,"Invalid Event");
+ break;
+ }
}
break;
}
-
default:
{
strcpy(sourceTask,"Invalid Source Entity Id");
*
* @details
*
- * Function : rgActvTsk
+ * Function : macActvTsk
*
* Primitives invoked by MAC's users/providers through
* a loosely coupled interface arrive here by means of
* @param[in] Pst *pst, Post structure of the primitive.
* @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
* @param[in] Reason reason.
- * @return S16
+ * @return uint8_t
* -# ROK
**/
-S16 rgActvTsk
-(
-Pst *pst, /* post structure */
-Buffer *mBuf /* message buffer */
-)
+uint8_t macActvTsk(Pst *pst, Buffer *mBuf)
{
#ifdef CALL_FLOW_DEBUG_LOG
- callFlowRgActvTsk(pst);
+ callFlowMacActvTsk(pst);
#endif
switch(pst->srcEnt)
{
- /* The originator of this message is the stack manager,
- * unpack and go to the respective primitive processing function */
case ENTDUAPP:
- rgHdlSMEvents(pst, mBuf);
- break;
- case ENTNH:
- rgHdlNHEvents(pst, mBuf);
- break;
+ MacHdlDuappEvents(pst, mBuf);
+ break;
case ENTRLC:
- rgHdlKWEvents(pst, mBuf);
- break;
+ MacHdlRlcEvents(pst, mBuf);
+ break;
case ENTLWRMAC:
- rgHdlTFEvents(pst, mBuf);
- break;
- case ENTMAC: /* When scheduler instance sends msg to MAC */
- rgHdlRGEvents(pst, mBuf);
- break;
- default:
- RG_FREE_MSG(mBuf);
- break;
+ MacHdlLwrMacEvents(pst, mBuf);
+ break;
+ default:
+ RG_FREE_MSG(mBuf);
+ break;
}
ODU_EXIT_TASK();
return ROK;
-}/* end of rgActvTsk */
+}/* end of MacActvTsk */
+
+/**
+ * @brief Callback function for events from entity SCH
+ *
+ * @details
+ *
+ * Function :MacMessageRouter
+ *
+ * Process Messages received from Entity SCH
+ *
+ * @param[in] Pst *pst, Post structure of the primitive.
+ * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
+ * @param[in] Reason reason.
+ * @return void
+ **/
+uint8_t MacMessageRouter(Pst *pst, void *msg)
+{
+#ifdef CALL_FLOW_DEBUG_LOG
+ callFlowMacActvTsk(pst);
+#endif
+
+ switch(pst->event)
+ {
+ case EVENT_SLICE_CFG_RSP_TO_MAC:
+ {
+ MacProcSchSliceCfgRsp(pst, (SchSliceCfgRsp *)msg);
+ break;
+ }
+ case EVENT_SLICE_RECFG_RSP_TO_MAC:
+ {
+ MacProcSchSliceRecfgRsp(pst, (SchSliceRecfgRsp *)msg);
+ break;
+ }
+ case EVENT_SCH_CELL_CFG_CFM:
+ {
+ MacProcSchCellCfgCfm(pst, (SchCellCfgCfm *)msg);
+ break;
+ }
+ case EVENT_UE_CONFIG_RSP_TO_MAC:
+ {
+ MacProcSchUeCfgRsp(pst, (SchUeCfgRsp *)msg);
+ break;
+ }
+ case EVENT_UE_RECONFIG_RSP_TO_MAC:
+ {
+ MacProcSchUeRecfgRsp(pst, (SchUeRecfgRsp *)msg);
+ break;
+ }
+ case EVENT_DL_SCH_INFO:
+ {
+ MacProcDlAlloc(pst, (DlSchedInfo *)msg);
+ break;
+ }
+ case EVENT_UL_SCH_INFO:
+ {
+ MacProcUlSchInfo(pst, (UlSchedInfo *)msg);
+ break;
+ }
+ case EVENT_RACH_RESOURCE_RESPONSE_TO_MAC:
+ {
+ MacProcSchRachRsrcRsp(pst, (SchRachRsrcRsp *)msg);
+ break;
+ }
+ case EVENT_DL_PAGING_ALLOC:
+ {
+ MacProcDlPageAlloc(pst, (DlPageAlloc *)msg);
+ break;
+ }
+ case EVENT_UE_DELETE_RSP_TO_MAC:
+ {
+ MacProcSchUeDeleteRsp(pst, (SchUeDeleteRsp *)msg);
+ break;
+ }
+ case EVENT_CELL_DELETE_RSP_TO_MAC:
+ {
+ MacProcSchCellDeleteRsp(pst, (SchCellDeleteRsp *)msg);
+ break;
+ }
+ case EVENT_DL_REL_HQ_PROC:
+ {
+ MacSchReleaseDlHarqProc(pst, (SchRlsHqInfo *)msg);
+ break;
+ }
+ default:
+ {
+ return RFAILED;
+ }
+ }
+ return ROK;
+}
\f
/**********************************************************************
#include "mac.h"
#include "mac_utils.h"
-/* Function pointer for sending rach ind from MAC to SCH */
-MacSchRachIndFunc macSchRachIndOpts[]=
-{
- packMacSchRachInd, /* packing for loosely coupled */
- MacSchRachInd, /* packing for tightly coupled */
- packMacSchRachInd /* packing for light weight loosely coupled */
-};
-
-/* Function pointer for sending RACH resource request from MAC to SCH */
-MacSchRachRsrcReqFunc macSchRachRsrcReqOpts[] =
-{
- packMacSchRachRsrcReq, /* packing for loosely coupled */
- MacSchRachRsrcReq, /* packing for tightly coupled */
- packMacSchRachRsrcReq /* packing for light weight loosely coupled */
-};
-
/* Function pointer for sending RACH resource response from MAC to DU APP */
MacDuRachRsrcRspFunc macDuRachRsrcRspOpts[] =
{
packDuMacRachRsrcRsp /* packing for light weight loosly coupled */
};
-/* Function pointer for sending RACH resource release from MAC to SCH */
-MacSchRachRsrcRelFunc macSchRachRsrcRelOpts[] =
-{
- packMacSchRachRsrcRel, /* packing for loosely coupled */
- MacSchRachRsrcRel, /* packing for tightly coupled */
- packMacSchRachRsrcRel /* packing for light weight loosely coupled */
-};
-
/*******************************************************************
*
* @brief Sends RACH indication to SCH
Pst pst;
FILL_PST_MAC_TO_SCH(pst, EVENT_RACH_IND_TO_SCH);
- return(*macSchRachIndOpts[pst.selector])(&pst, rachInd);
+ return(SchMessageRouter(&pst, (void *)rachInd));
}
/*******************************************************************
/* Send RACH resource request from MAC to SCH */
FILL_PST_MAC_TO_SCH(schPst, EVENT_RACH_RESOURCE_REQUEST_TO_SCH);
- ret = (*macSchRachRsrcReqOpts[schPst.selector])(&schPst, schRachRsrcReq);
+ ret = SchMessageRouter(&schPst, (void *)schRachRsrcReq);
}
else
DU_LOG("\nERROR --> MAC : Memory allocation failed for RACH resource request to SCH");
/* Send RACH resource release from MAC to SCH */
FILL_PST_MAC_TO_SCH(schPst, EVENT_RACH_RESOURCE_RELEASE_TO_SCH);
- ret = (*macSchRachRsrcRelOpts[schPst.selector])(&schPst, schRachRsrcRel);
+ ret = SchMessageRouter(&schPst, (void *)schRachRsrcRel);
}
else
DU_LOG("\nERROR --> MAC : Memory allocation failed for RACH resource release to SCH");
#include "mac_harq_dl.h"
#include "lwr_mac_phy.h"
-/* function pointers for packing slot ind from mac to sch */
-MacSchSlotIndFunc macSchSlotIndOpts[] =
-{
- packMacSchSlotInd,
- MacSchSlotInd,
- packMacSchSlotInd
-};
-
/**
* @brief process DL allocation from scheduler
*
Pst pst;
FILL_PST_MAC_TO_SCH(pst, EVENT_SLOT_IND_TO_SCH);
- return(*macSchSlotIndOpts[pst.selector])(&pst,slotInd);
+ return(SchMessageRouter(&pst, (void *)slotInd));
}
/*******************************************************************
#include "mac.h"
#include "mac_utils.h"
-/* function pointers for packing slot ind from mac to sch */
-MacSchAddUeConfigReqFunc macSchAddUeConfigReqOpts[] =
-{
- packMacSchAddUeConfigReq, /* packing for loosely coupled */
- MacSchAddUeConfigReq, /* packing for tightly coupled */
- packMacSchAddUeConfigReq /* packing for light weight loosely coupled */
-};
-
MacDuUeCfgRspFunc macDuUeCfgRspOpts[] =
{
packDuMacUeCfgRsp, /* packing for loosely coupled */
packDuMacUeRecfgRsp /* packing for light weight loosly coupled */
};
-MacSchModUeConfigReqFunc macSchModUeConfigReqOpts[] =
-{
- packMacSchModUeConfigReq, /* packing for loosely coupled */
- MacSchModUeConfigReq, /* packing for tightly coupled */
- packMacSchModUeConfigReq /* packing for light weight loosely coupled */
-};
-
-MacSchUeDeleteReqFunc macSchUeDeleteReqOpts[] =
-{
- packMacSchUeDeleteReq, /* packing for loosely coupled */
- MacSchUeDeleteReq, /* packing for tightly coupled */
- packMacSchUeDeleteReq /* packing for light weight loosely coupled */
-};
-
MacDuUeDeleteRspFunc macDuUeDeleteRspOpts[] =
{
packDuMacUeDeleteRsp, /* packing for loosely coupled */
SchUeCfgReq *schUeCfgReq = NULLP;
schUeCfgReq = (SchUeCfgReq *)schUeCfg;
FILL_PST_MAC_TO_SCH(schPst, EVENT_ADD_UE_CONFIG_REQ_TO_SCH);
- return(*macSchAddUeConfigReqOpts[schPst.selector])(&schPst, schUeCfgReq);
+ return(SchMessageRouter(&schPst, (void *)schUeCfgReq));
}
case EVENT_MAC_UE_RECONFIG_REQ:
{
SchUeRecfgReq *schUeRecfgReq = NULLP;
schUeRecfgReq = (SchUeRecfgReq *)schUeCfg;
FILL_PST_MAC_TO_SCH(schPst, EVENT_MODIFY_UE_CONFIG_REQ_TO_SCH);
- return(*macSchModUeConfigReqOpts[schPst.selector])(&schPst,schUeRecfgReq);
+ return(SchMessageRouter(&schPst, (void *)schUeRecfgReq));
}
default:
{
schUeDel.crnti = ueDelete->crnti;
MAC_FREE_SHRABL_BUF(pst->region, pst->pool, ueDelete, sizeof(MacUeDelete));
FILL_PST_MAC_TO_SCH(schPst, EVENT_UE_DELETE_REQ_TO_SCH);
- return(*macSchUeDeleteReqOpts[schPst.selector])(&schPst, &schUeDel);
+ return(SchMessageRouter(&schPst, (void *)&schUeDel));
}
else
{
*******************************************************************************/
void deleteMacRaCb(uint16_t cellIdx, MacUeCb *ueCb);
+uint8_t MacProcSchUeCfgRsp(Pst *pst, SchUeCfgRsp *cfgRsp);
+uint8_t MacProcSchUeRecfgRsp(Pst *pst, SchUeRecfgRsp *reCfgRsp);
+uint8_t MacProcSchUeDeleteRsp(Pst *pst, SchUeDeleteRsp *schUeDelRsp);
+
/**********************************************************************
End of file
**********************************************************************/
S16 rgLMMTmrExpiry ARGS((PTR cb, S16 tmrEvnt));
/* To send a Unsolicited Status Indication to Layer Manager */
S16 rgLMMStaInd ARGS((Inst inst,uint16_t category, uint16_t event, uint16_t cause, RgUstaDgn *dgn));
-/* LIM uses this to forward the BndCfm to LMM. This function invokes a
- * Control Confirmation to the LM. */
-S16 rgActvTmr ARGS((Ent ent, Inst inst ));
-S16 rgActvInit ARGS((Ent entity, Inst inst, Region
- region, Reason reason));
-S16 rgActvTsk ARGS((Pst *pst, Buffer *mBuf));
/* APIs Exposed by UIM */
S16 rgUIMRguBndCfm ARGS ((Inst inst,SuId suId, uint8_t status));
*
* @details
*
- * Function : rgActvInit
+ * Function : macActvInit
*
* This function is supplied as one of parameters during MAC's
* task registration. SSI will invoke this function once, after
* @return S16
* -# ROK
**/
-S16 rgActvInit
+uint8_t macActvInit
(
Ent entity, /* entity */
Inst inst, /* instance */
return ROK;
-} /* rgActvInit */
+} /* macActvInit */
\f
/**
* @brief Layer Manager Configuration request handler.
#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.
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.
*
/* Set Config done in TskInit */
schCb[inst].schInit.cfgDone = TRUE;
DU_LOG("\nINFO --> SCH : Scheduler gen config done");
-
+
+ schAllApisInit(inst);
return ret;
}
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");
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
cell->firstSsbTransmitted = false;
cell->firstSib1Transmitted = false;
fillSsbStartSymb(cell);
- cmLListInit(&cell->ueToBeScheduled);
#ifdef NR_DRX
memset(cell->drxCb, 0, MAX_DRX_SIZE*sizeof(SchDrxCb));
* -# ROK
* -# RFAILED
**/
-uint8_t SchHdlCellCfgReq(Pst *pst, SchCellCfg *schCellCfg)
+uint8_t SchProcCellCfgReq(Pst *pst, SchCellCfg *schCellCfg)
{
uint8_t ret = ROK;
SchCellCb *cellCb;
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;
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);
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; slotIdx<cellCb->numSlots; 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; slotIdx<cellCb->numSlots; 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; sliceIdx<cellCb->cellCfg.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; idx<MAX_SFN; idx++)
+ {
+ list = &cellCb->pageCb.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;
}
/*******************************************************************
*
* @details
*
- * Function : MacSchDlRlcBoInfo
+ * Function : SchProcDlRlcBoInfo
*
* Functionality:
* Processes DL RLC BO info from MAC
* RFAILED - failure
*
* ****************************************************************/
-uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo)
+uint8_t SchProcDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo)
{
uint8_t lcId = 0;
uint16_t ueId = 0;
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;
}
}
}
/* Adding UE Id to list of pending UEs to be scheduled */
- addUeToBeScheduled(cell, ueId);
+ cell->api->SchDlRlcBoInfo(cell, ueId);
return ROK;
}
*
* @details
*
- * Function : MacSchBsr
+ * Function : SchProcBsr
*
* Functionality:
* Processes DL BSR from MAC
* 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)
{
}
/* Adding UE Id to list of pending UEs to be scheduled */
- addUeToBeScheduled(cellCb, ueCb->ueId);
+ cellCb->api->SchBsr(cellCb, ueCb->ueId);
return ROK;
}
*
* @details
*
- * Function : MacSchSrUciInd
+ * Function : SchProcSrUciInd
*
* Functionality:
* Processes SR UCI indication from MAC
* 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);
{
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;
}
*
* @details
*
- * Function : MacSchDlHarqInd
+ * Function : SchProcDlHarqInd
*
* Functionality:
* Processes DL HARQ indication from MAC
* 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);
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
FILL_PST_SCH_TO_MAC(rspPst, inst);
rspPst.event = EVENT_SLICE_CFG_RSP_TO_MAC;
- SchSliceCfgRspOpts[rspPst.selector](&rspPst, &sliceCfgRsp);
+ MacMessageRouter(&rspPst, (void *)&sliceCfgRsp);
}
/*******************************************************************************
*
* @details
*
- * Function : MacSchSliceCfgReq
+ * Function : SchProcSliceCfgReq
*
* Functionality:
* function is used to store the slice configuration Sch DB
* 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;
FILL_PST_SCH_TO_MAC(rspPst, inst);
rspPst.event = EVENT_SLICE_RECFG_RSP_TO_MAC;
- SchSliceRecfgRspOpts[rspPst.selector](&rspPst, &schSliceRecfgRsp);
+ MacMessageRouter(&rspPst, (void *)&schSliceRecfgRsp);
}
/*******************************************************************************
*
*
* @details
*
- * Function : MacSchSliceRecfgReq
+ * Function : SchProcSliceRecfgReq
*
* Functionality:
* function is used to store the slice re configuration Sch DB
* 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;
*
* @details
*
- * Function : MacSchPagingInd
+ * Function : SchProcPagingInd
*
* Functionality: Process paging indication at SCH recevied form MAC
*
* @return void
*
*************************************************************************/
-uint8_t MacSchPagingInd(Pst *pst, SchPageInd *pageInd)
+uint8_t SchProcPagingInd(Pst *pst, SchPageInd *pageInd)
{
uint8_t ret = RFAILED;
uint16_t cellIdx = 0;
{
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
{
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
{
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");
}
}
}
}
else
{
- DU_LOG("\nERROR --> SCH : MacSchPagingInd(): Received null pointer");
+ DU_LOG("\nERROR --> SCH : SchProcPagingInd(): Received null pointer");
}
return ret;
}
#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;
typedef struct schCellCb SchCellCb;
typedef struct schUeCb SchUeCb;
+typedef enum
+{
+ SCH_FCFS
+}SchType;
+
typedef enum
{
SCH_NUMEROLOGY_0,
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;
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;
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
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;
}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.
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 */
#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 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]; /*!<List of All Scheduler Type dependent Function pointers*/
+ SchCellCb *cells[MAX_NUM_CELL]; /* Array to store cellCb ptr */
+ SchSliceCfg sliceCfg;
}SchCb;
/* Declaration for scheduler control blocks */
uint8_t addUeToBeScheduled(SchCellCb *cell, uint8_t ueId);
/* Incoming message handler function declarations */
-uint8_t schProcessSlotInd(SlotTimingInfo *slotInd, Inst inst);
-uint8_t schProcessRachInd(RachIndInfo *rachInd, Inst schInst);
-uint8_t schProcessCrcInd(CrcIndInfo *crcInd, Inst schInst);
+uint8_t SchProcCellCfgReq(Pst *pst, SchCellCfg *schCellCfg);
+uint8_t SchProcSlotInd(Pst *pst, SlotTimingInfo *slotInd);
+uint8_t SchProcRachInd(Pst *pst, RachIndInfo *rachInd);
+uint8_t SchProcCrcInd(Pst *pst, CrcIndInfo *crcInd);
+uint8_t SchProcDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo);
+uint8_t SchAddUeConfigReq(Pst *pst, SchUeCfgReq *ueCfgToSch);
+uint8_t SchProcBsr(Pst *pst, UlBufferStatusRptInd *bsrInd);
+uint8_t SchProcSrUciInd(Pst *pst, SrUciIndInfo *uciInd);
+uint8_t SchModUeConfigReq(Pst *pst, SchUeRecfgReq *ueRecfgToSch);
+uint8_t SchProcUeDeleteReq(Pst *pst, SchUeDelete *ueDelete);
+uint8_t SchProcCellDeleteReq(Pst *pst, SchCellDeleteReq *schCellDelete);
+uint8_t SchProcSliceCfgReq(Pst *pst, SchSliceCfgReq *schSliceCfgReq);
+uint8_t SchProcSliceRecfgReq(Pst *pst, SchSliceRecfgReq *schSliceRecfgReq);
+uint8_t SchProcRachRsrcReq(Pst *pst, SchRachRsrcReq *schRachRsrcReq);
+uint8_t SchProcRachRsrcRel(Pst *pst, SchRachRsrcRel *schRachRsrcRel);
+uint8_t SchProcPagingInd(Pst *pst, SchPageInd *pageInd);
+uint8_t SchProcDlHarqInd(Pst *pst, DlHarqInd *dlHarqInd);
/* DL scheduling related function declarations */
PduTxOccsaion schCheckSsbOcc(SchCellCb *cell, SlotTimingInfo slotTime);
bool schProcessRaReq(Inst schInst, SchCellCb *cellCb, SlotTimingInfo currTime, uint8_t ueId);
uint8_t schProcessMsg4Req(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId,bool isRetxMsg4, SchDlHqProcCb **hqP);
uint8_t schFillRar(SchCellCb *cell, SlotTimingInfo rarTime, uint16_t ueId, RarAlloc *rarAlloc, uint8_t k0Index);
+bool schFillBoGrantDlSchedInfo(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId, bool isRetx, SchDlHqProcCb **hqP);
uint8_t schDlRsrcAllocDlMsg(SchCellCb *cell, SlotTimingInfo slotTime, uint16_t crnti,
uint32_t tbSize, DlMsgAlloc *dlMsgAlloc, uint16_t startPRB, uint8_t pdschStartSymbol, uint8_t pdschNumSymbols,bool isRetx, SchDlHqProcCb* hqP);
uint8_t schDlRsrcAllocMsg4(SchCellCb *cell, SlotTimingInfo msg4Time, uint8_t ueId, DlMsgAlloc *msg4Alloc,\
bool findValidK0K1Value(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId, bool dedMsg, uint8_t *pdschStartSymbol,\
uint8_t *pdschSymblLen, SlotTimingInfo *pdcchTime, SlotTimingInfo *pdschTime, SlotTimingInfo *pucchTime, bool isRetx, SchDlHqProcCb *hqP);
RaRspWindowStatus isInRaRspWindow(SchRaReq *raReq, SlotTimingInfo frameToCheck, uint16_t numSlotsPerSystemFrame);
+
/* UL scheduling related function declarations */
uint8_t schUlResAlloc(SchCellCb *cell, Inst schInst);
bool schCheckPrachOcc(SchCellCb *cell, SlotTimingInfo prachOccasionTimingInfo);
uint8_t allocatePrbUl(SchCellCb *cell, SlotTimingInfo slotTime, uint8_t startSymbol, uint8_t symbolLength, \
uint16_t *startPrb, uint16_t numPrb);
bool schProcessSrOrBsrReq(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId, bool isRetx, SchUlHqProcCb **hqP);
-uint8_t schCalculateUlTbs(SchUeCb *ueCb, SlotTimingInfo puschTime, uint8_t symbLen,\
- uint16_t *startPrb, uint32_t *totTBS, bool isRetx, SchUlHqProcCb *hqP);
/*Generic Functions*/
void updateGrantSizeForBoRpt(CmLListCp *lcLL, DlMsgAlloc *dlMsgAlloc, BsrInfo *bsrInfo, uint32_t *accumalatedBOSize);
void schDlHqFeedbackUpdate(SchDlHqProcCb *hqP, uint8_t fdbk1, uint8_t fdbk2);
uint8_t schDlGetAvlHqProcess(SchCellCb *cellCb, SchUeCb *ueCb, SchDlHqProcCb **hqP);
void schDlReleaseHqProcess(SchDlHqProcCb *hqP);
+void schDlHqEntDelete(SchUeCb *ueCb);
/*UL HARQ Functions*/
void schUlHqEntInit(SchCellCb *cellCb, SchUeCb *ueCb);
void schUlHqProcessAck(SchUlHqProcCb *hqP);
uint8_t schUlGetAvlHqProcess(SchCellCb *cellCb, SchUeCb *ueCb, SchUlHqProcCb **hqP);
void schUlReleaseHqProcess(SchUlHqProcCb *hqP, Bool togNdi);
+void schUlHqEntDelete(SchUeCb *ueCb);
/* UE Manager HARQ Fun*/
void schUpdateHarqFdbk(SchUeCb *ueCb, uint8_t numHarq, uint8_t *harqPayload,SlotTimingInfo *slotInd);
#include "sch.h"
#include "sch_utils.h"
-SchMacUlSchInfoFunc schMacUlSchInfoOpts[] =
-{
- packSchMacUlSchInfo,
- MacProcUlSchInfo,
- packSchMacUlSchInfo
-};
-
/**
* @brief common resource allocation for SSB
*
FILL_PST_SCH_TO_MAC(pst, inst);
pst.event = EVENT_UL_SCH_INFO;
- return(*schMacUlSchInfoOpts[pst.selector])(&pst, ulSchedInfo);
+ return(MacMessageRouter(&pst, (void *)ulSchedInfo));
}
/**
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);
/*******************************************************************
*
- * @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; lcgIdx<MAX_NUM_LOGICAL_CHANNEL_GROUPS; lcgIdx++)
+ if(lcLL == NULLP)
{
- if(ueCb->bsrInfo[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;
+ }
}
/*******************************************************************
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;
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
{
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
*
* @details
*
- * Function : schProcessCrcInd
+ * Function : SchProcCrcInd
*
* This function process CRC indication
*
* -# ROK
* -# RFAILED
**/
-uint8_t schProcessCrcInd(CrcIndInfo *crcInd, Inst schInst)
+uint8_t SchProcCrcInd(Pst *pst, CrcIndInfo *crcInd)
{
- SchCellCb *cell = schCb[schInst].cells[schInst];
uint16_t count=0;
uint8_t ueId=0;
SchUlHqProcCb *hqP = NULLP;
-
+ Inst schInst = pst->dstInst - SCH_INST_START;
+ SchCellCb *cell = schCb[schInst].cells[schInst];
+
while(count <crcInd->numCrcInd)
{
GET_UE_ID(crcInd->crnti, ueId);
/* failure case*/
if (cell->raCb[ueId-1].msg3HqProc.tbInfo.txCntr < cell->cellCfg.schRachCfg.maxMsg3Tx)
{
- addUeToBeScheduled(cell, ueId);
+ cell->api->SchCrcInd(cell, ueId);
cell->raCb[ueId - 1].retxMsg3HqProc = &cell->raCb[ueId - 1].msg3HqProc;
}
else
}
/**********************************************************************
End of file
- **********************************************************************/
\ No newline at end of file
+ **********************************************************************/
{
hqP = (SchDlHqProcCb*)currNode->node;
currNode = currNode->next;
- addUeToBeScheduled(hqP->hqEnt->cell, hqP->hqEnt->ue->ueId);
+ cell->api->SchAddUeToSchedule(hqP->hqEnt->cell, hqP->hqEnt->ue->ueId);
ueCb = hqP->hqEnt->ue;
/* calculate the retransmission exp index */
{
hqP = (SchUlHqProcCb*)currNode->node;
currNode = currNode->next;
- addUeToBeScheduled(hqP->hqEnt->cell, hqP->hqEnt->ue->ueId);
+ cell->api->SchAddUeToSchedule(hqP->hqEnt->cell, hqP->hqEnt->ue->ueId);
ueCb = hqP->hqEnt->ue;
/* calculate the retransmission exp index */
--- /dev/null
+/*******************************************************************************
+################################################################################
+# Copyright (c) [2017-2019] [Radisys] #
+# #
+# Licensed under the Apache License, Version 2.0 (the "License"); #
+# you may not use this file except in compliance with the License. #
+# You may obtain a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an "AS IS" BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+################################################################################
+ *******************************************************************************/
+
+/************************************************************************
+
+Name: 5G NR SCH layer
+
+Type: C source file
+
+Desc: C source code for scheduling based on First Come First Serve
+ algorithm
+
+File: sch_fcfs.c
+
+ **********************************************************************/
+
+/** @file sch_slot_ind.c
+ @brief This module processes slot indications
+ */
+#include "common_def.h"
+#include "tfu.h"
+#include "lrg.h"
+#include "tfu.x"
+#include "lrg.x"
+#include "du_log.h"
+#include "du_app_mac_inf.h"
+#include "mac_sch_interface.h"
+#include "sch.h"
+#include "sch_utils.h"
+#include "sch_fcfs.h"
+#ifdef NR_DRX
+#include "sch_drx.h"
+#endif
+
+/*******************************************************************
+ *
+ * @brief Function to handle Cell configuration request
+ *
+ * @details
+ *
+ * Function : schFcfsCellCfgReq
+ *
+ * Functionality: This function configures cell paremeters
+ * required for FCFS scheduling
+ *
+ * @params[in] SchCellCb *cellCb, Cell control block
+ * @return ROK
+ * RFAILED
+ *
+ * ****************************************************************/
+uint8_t schFcfsCellCfgReq(SchCellCb *cellCb)
+{
+ SchFcfsCellCb *fcfsCellCb = NULLP;
+
+ SCH_ALLOC(fcfsCellCb, sizeof(SchFcfsCellCb));
+ if(!fcfsCellCb)
+ {
+ DU_LOG("\nERROR --> SCH: Memory allocation failed in schFcfsCellCfgReq");
+ return RFAILED;
+ }
+ cmLListInit(&fcfsCellCb->ueToBeScheduled);
+ cellCb->schSpcCell = (void *)fcfsCellCb;
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Function to handle Cell configuration request
+ *
+ * @details
+ *
+ * Function : schFcfsCellDelReq
+ *
+ * Functionality: This function deletes/frees cell params
+ * specific to FCFS scheduling
+ *
+ * @params[in] Pointer to Cell control block
+ * @return void
+ *
+ * ****************************************************************/
+void schFcfsCellDelReq(SchCellCb *cellCb)
+{
+ SchFcfsCellCb *fcfsCellCb = NULLP;
+ CmLList *node=NULL, *next=NULL;
+
+ fcfsCellCb = (SchFcfsCellCb *)cellCb->schSpcCell;
+ /* Remove all UE from ueToBeScheduled list and deallocate */
+ node = fcfsCellCb->ueToBeScheduled.first;
+ while(node)
+ {
+ next = node->next;
+ SCH_FREE(node->node, sizeof(uint8_t));
+ cmLListDelFrm(&fcfsCellCb->ueToBeScheduled, node);
+ SCH_FREE(node, sizeof(CmLList));
+ node = next;
+ }
+ SCH_FREE(fcfsCellCb, sizeof(SchFcfsCellCb));
+ cellCb->schSpcCell = NULLP;
+}
+
+/*******************************************************************
+ *
+ * @brief Function to handle UE configuration request
+ *
+ * @details
+ *
+ * Function : SchFcfsAddUeConfigReq
+ *
+ * Functionality: Adds/Configures UE parameters required for
+ * FCFS scheduling
+ *
+ * @params[in] Pointer to UE control block
+ * @return ROK
+ * RFAILED
+ *
+ * ****************************************************************/
+uint8_t SchFcfsAddUeConfigReq(SchUeCb *ueCb)
+{
+ SchFcfsUeCb *ueFcfsCb;
+
+ SCH_ALLOC(ueFcfsCb, sizeof(SchFcfsHqCb));
+ if(!ueFcfsCb)
+ {
+ DU_LOG("\nERROR --> SCH: Memory allocation failed in SchFcfsAddUeConfigReq");
+ return RFAILED;
+ }
+
+ cmLListInit(&ueFcfsCb->hqRetxCb.ulRetxHqList);
+ cmLListInit(&ueFcfsCb->hqRetxCb.dlRetxHqList);
+ ueCb->schSpcUeCb = (void *)ueFcfsCb;
+
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Handles UE reconfiguration request
+ *
+ * @details
+ *
+ * Function : SchFcfsModUeConfigReq
+ *
+ * Functionality:
+ *
+ * @params[in] Pointer to UE control block
+ * @return void
+ *
+ * ****************************************************************/
+void SchFcfsModUeConfigReq(SchUeCb *ueCb)
+{
+ /*TBD: No action required for FCFS*/
+ return;
+}
+
+/*******************************************************************
+ *
+ * @brief Handles UE Delete Request
+ *
+ * @details
+ *
+ * Function : SchFcfsUeDeleteReq
+ *
+ * Functionality: Deletes/Frees UE parameters specific to
+ * FCFS scheduling
+ *
+ * @params[in] Pointer to UE control block
+ * @return void
+ *
+ * ****************************************************************/
+void SchFcfsUeDeleteReq(SchUeCb *ueCb)
+{
+ SchFcfsCellCb *fcfsCellCb = NULLP;
+ SchFcfsUeCb *ueFcfsCb = NULLP;
+ CmLList *node=NULL, *next=NULL;
+ uint8_t ueId = 0;
+
+ fcfsCellCb = (SchFcfsCellCb *)ueCb->cellCb->schSpcCell;
+ /* Remove all UE from ueToBeScheduled list and deallocate */
+ node = fcfsCellCb->ueToBeScheduled.first;
+ while(node)
+ {
+ next = node->next;
+ ueId = *(uint8_t *)node->node;
+ if(ueId == ueCb->ueId)
+ {
+ SCH_FREE(node->node, sizeof(uint8_t));
+ cmLListDelFrm(&fcfsCellCb->ueToBeScheduled, node);
+ SCH_FREE(node, sizeof(CmLList));
+ break;
+ }
+ node = next;
+ }
+
+ ueFcfsCb = (SchFcfsUeCb *)ueCb->schSpcUeCb;
+ cmLListDeleteLList(&ueFcfsCb->hqRetxCb.ulRetxHqList);
+ cmLListDeleteLList(&ueFcfsCb->hqRetxCb.dlRetxHqList);
+
+ SCH_FREE(ueFcfsCb, sizeof(SchFcfsUeCb));
+ ueCb->schSpcUeCb = NULLP;
+ return;
+}
+
+/*******************************************************************
+ *
+ * @brief Intializes HARQ Process control block
+ *
+ * @details
+ *
+ * Function : schFcfsInitDlHqProcCb
+ *
+ * Functionality: Intitialized parameters of HARQ process control
+ * block specific to FCFS scheduling in Downlink
+ *
+ * @params[in] Pointer to Downlink HARQ Process control block
+ * @return ROK
+ * RFAILED
+ *
+ * ****************************************************************/
+uint8_t schFcfsInitDlHqProcCb(SchDlHqProcCb *hqP)
+{
+ SchFcfsHqProcCb *fcfsHqP;
+
+ SCH_ALLOC(fcfsHqP, sizeof(SchFcfsHqProcCb));
+ if(!fcfsHqP)
+ {
+ DU_LOG("\nERROR --> SCH: Memory allocation failed in schFcfsInitDlHqProcCb");
+ return RFAILED;
+ }
+
+ cmLListInit(&fcfsHqP->lcCb.dedLcList);
+ cmLListInit(&fcfsHqP->lcCb.defLcList);
+ hqP->schSpcDlHqProcCb = (void *)fcfsHqP;
+
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Handles HARQ Process delete request
+ *
+ * @details
+ *
+ * Function : schFcfsDeleteDlHqProcCb
+ *
+ * Functionality: Deletes HARQ Process parameters specific to
+ * FCFS scheduling in Downlink
+ *
+ * @params[in] Pointer to Downlink HARQ Process control block
+ * @return void
+ *
+ * ****************************************************************/
+void schFcfsDeleteDlHqProcCb(SchDlHqProcCb *hqP)
+{
+ SchFcfsHqProcCb *fcfsHqP = (SchFcfsHqProcCb *)hqP->schSpcDlHqProcCb;
+ cmLListDeleteLList(&fcfsHqP->lcCb.dedLcList);
+ cmLListDeleteLList(&fcfsHqP->lcCb.defLcList);
+ SCH_FREE(fcfsHqP, sizeof(SchFcfsHqProcCb));
+ hqP->schSpcDlHqProcCb = NULLP;
+}
+
+/*******************************************************************
+ *
+ * @brief Intializes HARQ Process control block
+ *
+ * @details
+ *
+ * Function : schFcfsInitUlHqProcCb
+ *
+ * Functionality: Intitialized parameters of HARQ process control
+ * block specific to FCFS scheduling in Uplink
+ *
+ * @params[in] Pointer to Uplink HARQ Process control block
+ * @return ROK
+ * RFAILED
+ *
+ * ****************************************************************/
+uint8_t schFcfsInitUlHqProcCb(SchUlHqProcCb *hqP)
+{
+ SchFcfsHqProcCb *fcfsHqP;
+
+ SCH_ALLOC(fcfsHqP, sizeof(SchFcfsHqProcCb));
+ if(!fcfsHqP)
+ {
+ DU_LOG("\nERROR --> SCH: Memory allocation failed in schFcfsInitUlHqProcCb");
+ return RFAILED;
+ }
+ cmLListInit(&fcfsHqP->lcCb.dedLcList);
+ cmLListInit(&fcfsHqP->lcCb.defLcList);
+ hqP->schSpcUlHqProcCb = (void *)fcfsHqP;
+
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Handled Deletion of HARQ Process control block
+ *
+ * @details
+ *
+ * Function : schFcfsDeleteUlHqProcCb
+ *
+ * Functionality: Deletes HARQ Process parameters specific to
+ * FCFS scheduling in Uplink
+ *
+ * @params[in] Pointer to Uplink HARQ Process Control block
+ * @return void
+ *
+ * ****************************************************************/
+void schFcfsDeleteUlHqProcCb(SchUlHqProcCb *hqP)
+{
+ SchFcfsHqProcCb *fcfsHqP = (SchFcfsHqProcCb *)hqP->schSpcUlHqProcCb;
+ cmLListDeleteLList(&fcfsHqP->lcCb.dedLcList);
+ cmLListDeleteLList(&fcfsHqP->lcCb.defLcList);
+ SCH_FREE(fcfsHqP, sizeof(SchFcfsHqProcCb));
+ hqP->schSpcUlHqProcCb = NULLP;
+}
+
+/*******************************************************************
+ *
+ * @brief Handles freeing of HARQ Process
+ *
+ * @details
+ *
+ * Function : schFcfsFreeDlHqProcCb
+ *
+ * Functionality: Frees HARQ Process parameters specific to
+ * FCFS scheduling in Downlink when HARQ process becomes free
+ *
+ * @params[in] Pointer to HARQ process control block
+ * @return void
+ *
+ * ****************************************************************/
+void schFcfsFreeDlHqProcCb(SchDlHqProcCb *hqP)
+{
+ SchFcfsHqProcCb *fcfsHqP = (SchFcfsHqProcCb *)hqP->schSpcDlHqProcCb;
+
+ cmLListDeleteLList(&fcfsHqP->lcCb.dedLcList);
+ cmLListDeleteLList(&fcfsHqP->lcCb.defLcList);
+}
+
+/*******************************************************************
+ *
+ * @brief Handles freeing of HARQ Process
+ *
+ * @details
+ *
+ * Function : schFcfsFreeUlHqProcCb
+ *
+ * Functionality: Frees HARQ Process parameters specific to
+ * FCFS scheduling in Uplink when HARQ process becomes free
+ *
+ * @params[in] Pointer to HARQ process control block
+ * @return void
+ *
+ * ****************************************************************/
+void schFcfsFreeUlHqProcCb(SchUlHqProcCb *hqP)
+{
+ SchFcfsHqProcCb *fcfsHqP = (SchFcfsHqProcCb *)hqP->schSpcUlHqProcCb;
+
+ cmLListDeleteLList(&fcfsHqP->lcCb.dedLcList);
+ cmLListDeleteLList(&fcfsHqP->lcCb.defLcList);
+}
+
+/*******************************************************************
+ *
+ * @brief Adds HARQ process to retransmission list
+ *
+ * @details
+ *
+ * Function : schFcfsAddToDlHqRetxList
+ *
+ * Functionality: Adds HARQ process to retransmission list
+ *
+ * @params[in] Pointer to Downlink HARQ Process
+ * @return void
+ *
+ * ****************************************************************/
+void schFcfsAddToDlHqRetxList(SchDlHqProcCb *hqP)
+{
+ SchFcfsUeCb *fcfsUeCb;
+
+ fcfsUeCb = (SchFcfsUeCb *)hqP->hqEnt->ue->schSpcUeCb;
+ cmLListAdd2Tail(&(fcfsUeCb->hqRetxCb.dlRetxHqList),&hqP->dlHqProcLink);
+#ifdef NR_DRX
+ if(hqP->hqEnt->ue->ueDrxInfoPres == true)
+ {
+ schDrxStrtDlHqRttTmr(hqP);
+ }
+ else
+#endif
+ {
+ schFcfsAddUeToSchedule(hqP->hqEnt->cell, hqP->hqEnt->ue->ueId);
+ }
+}
+
+/*******************************************************************
+ *
+ * @brief Adds HARQ process to retransmission list
+ *
+ * @details
+ *
+ * Function : schFcfsAddToUlHqRetxList
+ *
+ * Functionality: Adds HARQ process to retransmission list
+ *
+ * @params[in] Pointer to Uplink HARQ Process
+ * @return void
+ *
+ * ****************************************************************/
+void schFcfsAddToUlHqRetxList(SchUlHqProcCb *hqP)
+{
+ SchFcfsUeCb *fcfsUeCb;
+
+ fcfsUeCb = (SchFcfsUeCb *)hqP->hqEnt->ue->schSpcUeCb;
+ cmLListAdd2Tail(&(fcfsUeCb->hqRetxCb.ulRetxHqList),&hqP->ulHqProcLink);
+#ifdef NR_DRX
+ if(hqP->hqEnt->ue->ueDrxInfoPres == true)
+ {
+ schDrxStrtUlHqRttTmr(hqP);
+ }
+ else
+#endif
+ {
+ schFcfsAddUeToSchedule(hqP->hqEnt->cell, hqP->hqEnt->ue->ueId);
+ }
+}
+
+/*******************************************************************
+ *
+ * @brief Add UE to ueToBeScheduled List
+ *
+ * @details
+ *
+ * Function : schFcfsAddUeToSchedule
+ *
+ * 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 Id to be added
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t schFcfsAddUeToSchedule(SchCellCb *cellCb, uint16_t ueIdToAdd)
+{
+ SchFcfsCellCb *fcfsCellCb = NULLP;
+ uint8_t *ueId;
+ CmLList *node;
+
+ fcfsCellCb = (SchFcfsCellCb *)cellCb->schSpcCell;
+ /* Search if UE entry is already present in ueToBeScheduled list.
+ * If yes, another entry for same UE not needed. Hence, return */
+ node = fcfsCellCb->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 schFcfsAddUeToSchedule");
+ return RFAILED;
+ }
+ *ueId = ueIdToAdd;
+ if(addNodeToLList(&fcfsCellCb->ueToBeScheduled, ueId, NULLP) != ROK)
+ {
+ DU_LOG("\nERROR --> SCH : Failed to add ueId [%d] to cell->ueToBeScheduled list", *ueId);
+ return RFAILED;
+ }
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Handled CRC Indication
+ *
+ * @details
+ *
+ * Function : schFcfsProcessCrcInd
+ *
+ * Functionality: Processes CRC Indication as required for FCFS
+ * scheduling
+ *
+ * @params[in] Pointer to Cell control block
+ * UE Id
+ * @return void
+ *
+ * ****************************************************************/
+void schFcfsProcessCrcInd(SchCellCb *cellCb, uint16_t ueId)
+{
+ schFcfsAddUeToSchedule(cellCb, ueId);
+}
+
+/*******************************************************************
+ *
+ * @brief Processes Buffer Occupancy report from RLC
+ *
+ * @details
+ *
+ * Function : schFcfsDlRlcBoInfo
+ *
+ * Functionality: Process buffer occupany report
+ *
+ * @params[in]
+ * @return
+ *
+ * ****************************************************************/
+void schFcfsDlRlcBoInfo(SchCellCb *cellCb, uint16_t ueId)
+{
+ schFcfsAddUeToSchedule(cellCb, ueId);
+}
+
+/*******************************************************************
+ *
+ * @brief Processes BSR request
+ *
+ * @details
+ *
+ * Function : schFcfsBsr
+ *
+ * Functionality: Processes BSR as per FCFS scheduling
+ *
+ * @params[in] Pointer to Cell
+ * UE ID
+ * @return void
+ *
+ * ****************************************************************/
+void schFcfsBsr(SchCellCb *cellCb, uint16_t ueId)
+{
+ schFcfsAddUeToSchedule(cellCb, ueId);
+}
+
+/*******************************************************************
+ *
+ * @brief Processed UCI Indication
+ *
+ * @details
+ *
+ * Function : schFcfsSrUciInd
+ *
+ * Functionality: Processing of UCI indication specific to
+ * FCFS scheduling
+ *
+ * @params[in] Pointer to Cell
+ * UE Id
+ * @return void
+ *
+ * ****************************************************************/
+void schFcfsSrUciInd(SchCellCb *cellCb, uint16_t ueId)
+{
+ schFcfsAddUeToSchedule(cellCb, ueId);
+}
+
+/*******************************************************************
+ *
+ * @brief Processing of RACH Indication
+ *
+ * @details
+ *
+ * Function : schFcfsProcessRachInd
+ *
+ * Functionality: Processing of RACH Indication specific to
+ * FCFS scheduling
+ *
+ * @params[in] Pointer to Cell Cb
+ * UE Id
+ * @return void
+ *
+ * ****************************************************************/
+void schFcfsProcessRachInd(SchCellCb *cellCb, uint16_t ueId)
+{
+ schFcfsAddUeToSchedule(cellCb, ueId);
+}
+
+/*******************************************************************
+ *
+ * @brief Processing of DL HARQ Indication
+ *
+ * @details
+ *
+ * Function : SchFcfsDlHarqInd
+ *
+ * Functionality:
+ *
+ * @params[in]
+ * @return void
+ *
+ * ****************************************************************/
+void SchFcfsDlHarqInd()
+{
+ return;
+}
+
+/*******************************************************************
+ *
+ * @brief Processing of Paging indication
+ *
+ * @details
+ *
+ * Function : schFcfsPagingInd
+ *
+ * Functionality:
+ *
+ * @params[in]
+ * @return void
+ *
+ * ****************************************************************/
+void schFcfsPagingInd()
+{
+ return;
+}
+
+/*******************************************************************
+ *
+ * @brief Processing of RACH Resource Request
+ *
+ * @details
+ *
+ * Function : schFcfsRachRsrcReq
+ *
+ * Functionality:
+ *
+ * @params[in]
+ * @return void
+ *
+ * ****************************************************************/
+void schFcfsRachRsrcReq()
+{
+ return;
+}
+
+/*******************************************************************
+ *
+ * @brief Processing of RACH Resource Release
+ *
+ * @details
+ *
+ * Function : schFcfsRachRsrcRel
+ *
+ * Functionality:
+ *
+ * @params[in]
+ * @return void
+ *
+ * ****************************************************************/
+void schFcfsRachRsrcRel()
+{
+ return;
+}
+
+/*******************************************************************
+ *
+ * @brief Remove entry from HARQ retransmission list
+ *
+ * @details
+ *
+ * Function : schFcfsRemoveFrmDlHqRetxList
+ *
+ * Functionality: Remove entry from HARQ retransmission list
+ *
+ * @params[in] Pointer to UE
+ * Node to be deleted
+ * @return void
+ *
+ * ****************************************************************/
+void schFcfsRemoveFrmDlHqRetxList(SchUeCb *ueCb, CmLList *node)
+{
+ SchFcfsUeCb *fcfsUeCb;
+
+ fcfsUeCb = (SchFcfsUeCb *)ueCb->schSpcUeCb;
+ cmLListDelFrm(&fcfsUeCb->hqRetxCb.dlRetxHqList, node);
+}
+
+/*******************************************************************
+ *
+ * @brief Remove entry from HARQ retransmission list
+ *
+ * @details
+ *
+ * Function : schFcfsRemoveFrmUlHqRetxList
+ *
+ * Functionality: Remove entry from HARQ retransmission list
+ *
+ * @params[in] Pointer to UE
+ * Node to be deleted
+ * @return void
+ *
+ * ****************************************************************/
+void schFcfsRemoveFrmUlHqRetxList(SchUeCb *ueCb, CmLList *node)
+{
+ SchFcfsUeCb *fcfsUeCb;
+
+ fcfsUeCb = (SchFcfsUeCb *)ueCb->schSpcUeCb;
+ cmLListDelFrm(&fcfsUeCb->hqRetxCb.ulRetxHqList, node);
+}
+
+/*******************************************************************
+ *
+ * @brief Remove UE from Scheduling List
+ *
+ * @details
+ *
+ * Function : schFcfsRemoveUeFrmScheduleLst
+ *
+ * Functionality: Remove UE from Scheduling List
+ *
+ * @params[in] Pointer to Cell
+ * Node to be removed
+ * @return void
+ *
+ * ****************************************************************/
+void schFcfsRemoveUeFrmScheduleLst(SchCellCb *cell, CmLList *node)
+{
+ SchFcfsCellCb *fcfsCell;
+
+ fcfsCell = (SchFcfsCellCb *)cell->schSpcCell;
+ SCH_FREE(node->node, sizeof(uint8_t));
+ deleteNodeFromLList(&fcfsCell->ueToBeScheduled, node);
+}
+
+/*******************************************************************
+ *
+ * @brief Handler to calculate TBS size for BSR requested
+ *
+ * @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
+ *
+ * @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)
+ *
+ * @return uint8_t : ROK > Scheduling of UL grant is successful
+ * RFAILED > vice versa
+ *
+ * ****************************************************************/
+uint8_t schCalculateUlTbs(SchUeCb *ueCb, SlotTimingInfo puschTime, uint8_t symbLen,\
+ uint16_t *startPrb, uint32_t *totTBS, bool isRetx, SchUlHqProcCb *hqP, SchFcfsHqProcCb *fcfsHqP)
+{
+ uint16_t mcsIdx = 0;
+ CmLListCp *lcLL = NULLP;
+ uint16_t lcgIdx = 0, lcId =0, maxFreePRB = 0;
+ uint16_t rsvdDedicatedPRB;
+ *startPrb = 0;
+ *totTBS = 0;
+
+ /* check for BSR */
+ for(lcgIdx=0; lcgIdx<MAX_NUM_LOGICAL_CHANNEL_GROUPS; lcgIdx++)
+ {
+ if(ueCb->bsrInfo[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 = &(fcfsHqP->lcCb.dedLcList);
+ rsvdDedicatedPRB = ueCb->ulInfo.ulLcCtxt[lcId].rsvdDedicatedPRB;
+ }
+ else
+ {
+ lcLL = &(fcfsHqP->lcCb.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;
+ }
+ }
+
+ if ((fcfsHqP->lcCb.defLcList.count == 0) && (fcfsHqP->lcCb.dedLcList.count == 0))
+ {
+ 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;
+ }
+
+ 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)
+ {
+ mcsIdx = ueCb->ueCfg.ulModInfo.mcsIndex;
+ if((fcfsHqP->lcCb.dedLcList.count == 0) || ((maxFreePRB < rsvdDedicatedPRB)))
+ {
+ fcfsHqP->lcCb.sharedNumPrb = maxFreePRB;
+ DU_LOG("\nDEBUG --> SCH : UL Only Default Slice is scheduled, sharedPRB Count:%d",\
+ fcfsHqP->lcCb.sharedNumPrb);
+
+ /*PRB Alloc for Default LCs*/
+ prbAllocUsingRRMPolicy(&(fcfsHqP->lcCb.defLcList), FALSE, mcsIdx, symbLen,\
+ &(fcfsHqP->lcCb.sharedNumPrb), NULLP, NULLP,&(ueCb->srRcvd));
+ }
+ else
+ {
+ fcfsHqP->lcCb.sharedNumPrb = maxFreePRB - rsvdDedicatedPRB;
+
+ /*PRB Alloc for Dedicated LCs*/
+ prbAllocUsingRRMPolicy(&(fcfsHqP->lcCb.dedLcList), TRUE, mcsIdx, symbLen,\
+ &(fcfsHqP->lcCb.sharedNumPrb), &(rsvdDedicatedPRB),\
+ NULLP, &(ueCb->srRcvd));
+
+ /*PRB Alloc for Default LCs*/
+ prbAllocUsingRRMPolicy(&(fcfsHqP->lcCb.defLcList), FALSE, mcsIdx, symbLen, \
+ &(fcfsHqP->lcCb.sharedNumPrb), &(rsvdDedicatedPRB),\
+ NULLP,&(ueCb->srRcvd));
+ }
+ }
+ /*[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(fcfsHqP->lcCb.dedLcList.count != 0)
+ updateGrantSizeForBoRpt(&(fcfsHqP->lcCb.dedLcList), NULLP, ueCb->bsrInfo, totTBS);
+
+ updateGrantSizeForBoRpt(&(fcfsHqP->lcCb.defLcList), NULLP, ueCb->bsrInfo, totTBS);
+
+ /*Below case will hit if NO LC(s) are allocated due to resource crunch*/
+ if (*totTBS == 0)
+ {
+ if(maxFreePRB == 0)
+ {
+ DU_LOG("\nERROR --> SCH : NO FREE PRB!!");
+ }
+ else
+ {
+ /*Schedule the LC for next slot*/
+ DU_LOG("\nDEBUG --> SCH : No LC has been scheduled");
+ }
+ return RFAILED;
+ }
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Grants resources to LC in uplink
+ *
+ * @details
+ *
+ * Function : schProcessSrOrBsrReq
+ *
+ * Functionality:
+ * Grants resources to LC in uplink
+ *
+ * @params[in] PDCCH Time
+ * PUSCH Time
+ * Start Symbol
+ * Number of symbols
+ * Is retransmission
+ * HARQ process
+ * @return ROK
+ * RFAILED
+ *
+ *******************************************************************/
+uint8_t schFcfsScheduleUlLc(SlotTimingInfo dciTime, SlotTimingInfo puschTime, uint8_t startSymb , uint8_t symbLen, bool isRetx, SchUlHqProcCb **hqP)
+{
+ SchCellCb *cell;
+ SchFcfsHqProcCb *fcfsHqProcCb;
+ uint8_t ret = RFAILED;
+ uint16_t startPrb = 0;
+ uint32_t totDataReq = 0; /* in bytes */
+ SchUeCb *ueCb;
+ SchPuschInfo *puschInfo;
+ DciInfo *dciInfo = NULLP;
+
+ cell = (*hqP)->hqEnt->cell;
+ ueCb = (*hqP)->hqEnt->ue;
+ fcfsHqProcCb = (SchFcfsHqProcCb *)(*hqP)->schSpcUlHqProcCb;
+ ret = schCalculateUlTbs(ueCb, puschTime, symbLen, &startPrb, &totDataReq, isRetx, *hqP, fcfsHqProcCb);
+
+ 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(fcfsHqProcCb->lcCb.dedLcList.count != 0)
+ updateBsrAndLcList(&(fcfsHqProcCb->lcCb.dedLcList), ueCb->bsrInfo, RFAILED);
+
+ updateBsrAndLcList(&(fcfsHqProcCb->lcCb.defLcList), ueCb->bsrInfo, RFAILED);
+ }
+ return RFAILED;
+ }
+ 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 = ueCb->ueId;
+ if(fcfsHqProcCb->lcCb.dedLcList.count != 0)
+ updateBsrAndLcList(&(fcfsHqProcCb->lcCb.dedLcList), ueCb->bsrInfo, ROK);
+ updateBsrAndLcList(&(fcfsHqProcCb->lcCb.defLcList), ueCb->bsrInfo, ROK);
+ cmLListAdd2Tail(&(ueCb->hqUlmap[puschTime.slot]->hqList), &(*hqP)->ulSlotLnk);
+ return ROK;
+ }
+ }
+ }
+ if(fcfsHqProcCb->lcCb.dedLcList.count != 0)
+ updateBsrAndLcList(&(fcfsHqProcCb->lcCb.dedLcList), ueCb->bsrInfo, RFAILED);
+ updateBsrAndLcList(&(fcfsHqProcCb->lcCb.defLcList), ueCb->bsrInfo, RFAILED);
+ }
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Grants resources to LC in downlink
+ *
+ * @details
+ *
+ * Function : schFcfsScheduleDlLc
+ *
+ * Functionality: Grants resources to LC in uplink
+ *
+ * @params[in] PDCCH Time
+ *
+ * @return ROK
+ * RFAILED
+ *
+ * ****************************************************************/
+uint32_t schFcfsScheduleDlLc(SlotTimingInfo pdcchTime, SlotTimingInfo pdschTime, uint8_t pdschNumSymbols, bool isRetx, SchDlHqProcCb **hqP)
+{
+ SchFcfsHqProcCb *fcfsHqProcCb;
+ SchUeCb *ueCb;
+ uint8_t lcIdx = 0;
+ uint16_t startPrb = 0, maxFreePRB = 0;
+ uint16_t mcsIdx = 0;
+ uint32_t accumalatedSize = 0;
+ CmLListCp *lcLL = NULLP;
+ uint16_t rsvdDedicatedPRB = 0;
+ DlMsgAlloc *dciSlotAlloc;
+
+ /* TX_PAYLOAD_HDR_LEN: Overhead which is to be Added once for any UE while estimating Accumulated TB Size
+ * Following flag added to keep the record whether TX_PAYLOAD_HDR_LEN is added to the first Node getting allocated.
+ * If both Dedicated and Default LC lists are present then First LC in Dedicated List will include this overhead
+ * else if only Default list is present then first node in this List will add this overhead len*/
+ bool isTxPayloadLenAdded = FALSE;
+
+ ueCb = (*hqP)->hqEnt->ue;
+ dciSlotAlloc = (*hqP)->hqEnt->cell->schDlSlotInfo[pdcchTime.slot]->dlMsgAlloc[ueCb->ueId -1];
+ fcfsHqProcCb = (SchFcfsHqProcCb *)((*hqP)->schSpcDlHqProcCb);
+
+ if (isRetx == FALSE)
+ {
+ /*Re-Initalization per UE*/
+ /* scheduled LC data fill */
+ dciSlotAlloc->dlMsgSchedInfo[dciSlotAlloc->numSchedInfo].numLc = 0;
+ isTxPayloadLenAdded = FALSE; /*Re-initlaize the flag for every UE*/
+ accumalatedSize = 0;
+
+ for(lcIdx = 0; lcIdx < MAX_NUM_LC; lcIdx++)
+ {
+ if(ueCb->dlInfo.dlLcCtxt[lcIdx].bo)
+ {
+ /*Check the LC is Dedicated or default and accordingly LCList will
+ * be used*/
+ if(ueCb->dlInfo.dlLcCtxt[lcIdx].isDedicated)
+ {
+ lcLL = &(fcfsHqProcCb->lcCb.dedLcList);
+ rsvdDedicatedPRB = ueCb->dlInfo.dlLcCtxt[lcIdx].rsvdDedicatedPRB;
+ }
+ else
+ {
+ lcLL = &(fcfsHqProcCb->lcCb.defLcList);
+ }
+
+ /*[Step2]: Update the reqPRB and Payloadsize for this LC in the appropriate List*/
+ if(updateLcListReqPRB(lcLL, ueCb->dlInfo.dlLcCtxt[lcIdx].lcId,\
+ (ueCb->dlInfo.dlLcCtxt[lcIdx].bo + MAC_HDR_SIZE)) != ROK)
+ {
+ DU_LOG("\nERROR --> SCH : Updation in LC List Failed");
+ /* Free the dl ded msg info allocated in macSchDlRlcBoInfo */
+ if(dciSlotAlloc->numSchedInfo == 0)
+ {
+ SCH_FREE(dciSlotAlloc, sizeof(DlMsgAlloc));
+ (*hqP)->hqEnt->cell->schDlSlotInfo[pdcchTime.slot]->dlMsgAlloc[ueCb->ueId -1] = NULL;
+ }
+ else
+ memset(&dciSlotAlloc->dlMsgSchedInfo[dciSlotAlloc->numSchedInfo], 0, sizeof(DlMsgSchInfo));
+ return false;
+ }
+ }
+ ueCb->dlInfo.dlLcCtxt[lcIdx].bo = 0;
+ }//End of for loop
+
+ if ((fcfsHqProcCb->lcCb.defLcList.count == 0) && (fcfsHqProcCb->lcCb.dedLcList.count == 0))
+ {
+ DU_LOG("\nDEBUG --> SCH : No pending BO for any LC id\n");
+ UNSET_ONE_BIT((*hqP)->hqEnt->ue->ueId, (*hqP)->hqEnt->cell->boIndBitMap);
+
+ /* Free the dl ded msg info allocated in macSchDlRlcBoInfo */
+ if(dciSlotAlloc->numSchedInfo == 0)
+ {
+ SCH_FREE(dciSlotAlloc, sizeof(DlMsgAlloc));
+ (*hqP)->hqEnt->cell->schDlSlotInfo[pdcchTime.slot]->dlMsgAlloc[ueCb->ueId -1] = NULL;
+ }
+ else
+ memset(&dciSlotAlloc->dlMsgSchedInfo[dciSlotAlloc->numSchedInfo], 0, sizeof(DlMsgSchInfo));
+
+ /*TRUE because this UE has nothing to be scheduled*/
+ return true;
+ }
+ }
+
+ /*[Step3]: Calculate Best FREE BLOCK with MAX PRB count*/
+ maxFreePRB = searchLargestFreeBlock((*hqP)->hqEnt->cell, pdschTime, &startPrb, DIR_DL);
+
+ /*[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(isRetx == FALSE)
+ {
+ if(maxFreePRB != 0)
+ {
+ mcsIdx = ueCb->ueCfg.dlModInfo.mcsIndex;
+
+ if((fcfsHqProcCb->lcCb.dedLcList.count == NULLP) || ((maxFreePRB < rsvdDedicatedPRB)))
+ {
+ fcfsHqProcCb->lcCb.sharedNumPrb = maxFreePRB;
+ DU_LOG("\nDEBUG --> SCH : DL Only Default Slice is scheduled, sharedPRB Count:%d",\
+ fcfsHqProcCb->lcCb.sharedNumPrb);
+
+ /*PRB Alloc for Default LCs*/
+ prbAllocUsingRRMPolicy(&(fcfsHqProcCb->lcCb.defLcList), FALSE, mcsIdx, pdschNumSymbols,\
+ &(fcfsHqProcCb->lcCb.sharedNumPrb), NULLP, &isTxPayloadLenAdded, NULLP);
+ }
+ else
+ {
+ fcfsHqProcCb->lcCb.sharedNumPrb = maxFreePRB - rsvdDedicatedPRB;
+ /*PRB Alloc for Dedicated LCs*/
+ prbAllocUsingRRMPolicy(&(fcfsHqProcCb->lcCb.dedLcList), TRUE, mcsIdx, pdschNumSymbols,\
+ &(fcfsHqProcCb->lcCb.sharedNumPrb), &(rsvdDedicatedPRB), &isTxPayloadLenAdded, NULLP);
+
+ /*PRB Alloc for Default LCs*/
+ prbAllocUsingRRMPolicy(&(fcfsHqProcCb->lcCb.defLcList), FALSE, mcsIdx, pdschNumSymbols, \
+ &(fcfsHqProcCb->lcCb.sharedNumPrb), &(rsvdDedicatedPRB), &isTxPayloadLenAdded, NULLP);
+ }
+ }
+ }
+
+ /*[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 (isRetx == FALSE)
+ {
+ if(fcfsHqProcCb->lcCb.dedLcList.count != 0)
+ updateGrantSizeForBoRpt(&(fcfsHqProcCb->lcCb.dedLcList), dciSlotAlloc, NULLP, &(accumalatedSize));
+
+ updateGrantSizeForBoRpt(&(fcfsHqProcCb->lcCb.defLcList), dciSlotAlloc, NULLP, &(accumalatedSize));
+ }
+ else
+ {
+ accumalatedSize = (*hqP)->tbInfo[0].tbSzReq;
+ }
+
+ /*Below case will hit if NO LC(s) are allocated due to resource crunch*/
+ if (!accumalatedSize)
+ {
+ if(maxFreePRB == 0)
+ {
+ DU_LOG("\nERROR --> SCH : NO FREE PRB!!");
+ }
+ else
+ {
+ /*Schedule the LC for next slot*/
+ DU_LOG("\nDEBUG --> SCH : No LC has been scheduled");
+ }
+ /* Not Freeing dlMsgAlloc as ZERO BO REPORT to be sent to RLC so that
+ * Allocation can be done in next slot*/
+ accumalatedSize = 0;
+ }
+
+ return accumalatedSize;
+}
+
+/*******************************************************************
+ *
+ * @brief Scheduling of Slots in UL And DL
+ *
+ * @details
+ *
+ * Function : schFcfsScheduleSlot
+ *
+ * Functionality: Scheduling of slots in UL and DL specific to
+ * FCFS scheduling
+ *
+ * @params[in] Pointer to Cell
+ * Slot timing info
+ * Scheduler instance
+ * @return void
+ *
+ * ****************************************************************/
+void schFcfsScheduleSlot(SchCellCb *cell, SlotTimingInfo *slotInd, Inst schInst)
+{
+ SchFcfsCellCb *fcfsCell;
+ SchFcfsUeCb *fcfsUeCb;
+ SchDlHqProcCb *hqP = NULLP;
+ SchUlHqProcCb *ulHqP = NULLP;
+ CmLList *pendingUeNode;
+ CmLList *node;
+ uint8_t ueId;
+ bool isRarPending = false, isRarScheduled = false;
+ bool isMsg4Pending = false, isMsg4Scheduled = false;
+ bool isDlMsgPending = false, isDlMsgScheduled = false;
+ bool isUlGrantPending = false, isUlGrantScheduled = false;
+
+ fcfsCell = (SchFcfsCellCb *)cell->schSpcCell;
+
+ /* Select first UE in the linked list to be scheduled next */
+ pendingUeNode = fcfsCell->ueToBeScheduled.first;
+ if(pendingUeNode)
+ {
+ if(pendingUeNode->node)
+ {
+ ueId = *(uint8_t *)(pendingUeNode->node);
+ fcfsUeCb = (SchFcfsUeCb *)cell->ueCb[ueId-1].schSpcUeCb;
+
+ /* If RAR is pending for this UE, schedule PDCCH,PDSCH to send RAR and
+ * PUSCH to receive MSG3 as per k0-k2 configuration*/
+ if(cell->raReq[ueId-1] != NULLP)
+ {
+ isRarPending = true;
+ isRarScheduled = schProcessRaReq(schInst, cell, *slotInd, ueId);
+ }
+
+ /*MSG3 retransmisson*/
+ if(cell->raCb[ueId-1].retxMsg3HqProc)
+ {
+ schMsg3RetxSchedulingForUe(&(cell->raCb[ueId-1]));
+ }
+
+ /* If MSG4 is pending for this UE, schedule PDCCH,PDSCH to send MSG4 and
+ * PUCCH to receive UL msg as per k0-k1 configuration */
+ if (cell->ueCb[ueId-1].retxMsg4HqProc) //should work from dlmap later tbd
+ {
+ /* Retransmission of MSG4 */
+ isMsg4Pending = true;
+ if(schProcessMsg4Req(cell, *slotInd, ueId, TRUE, &cell->ueCb[ueId-1].retxMsg4HqProc) == ROK)
+ isMsg4Scheduled = true;
+ }
+ else
+ {
+ /* First transmission of MSG4 */
+ if(cell->raCb[ueId-1].msg4recvd)
+ {
+ isMsg4Pending = true;
+ if(schProcessMsg4Req(cell, *slotInd, ueId, FALSE, &cell->ueCb[ueId-1].msg4HqProc) == ROK)
+ isMsg4Scheduled = true;
+
+ /* If MSG4 scheduling failed, free the newly assigned HARQ process */
+ if(!isMsg4Scheduled)
+ schDlReleaseHqProcess(cell->ueCb[ueId-1].msg4HqProc);
+ }
+ }
+
+ if(isRarPending || isMsg4Pending)
+ {
+ /* If RAR or MSG is successfully scheduled then
+ * remove UE from linked list since no pending msgs for this UE */
+ if(isRarScheduled || isMsg4Scheduled)
+ {
+ schFcfsRemoveUeFrmScheduleLst(cell, pendingUeNode);
+ }
+ /* If RAR/MSG4 is pending but couldnt be scheduled then,
+ * put this UE at the end of linked list to be scheduled later */
+ else
+ {
+ cmLListAdd2Tail(&fcfsCell->ueToBeScheduled, cmLListDelFrm(&fcfsCell->ueToBeScheduled, pendingUeNode));
+ }
+ }
+
+#ifdef NR_DRX
+ if((cell->ueCb[ueId-1].ueDrxInfoPres == true) && (cell->ueCb[ueId-1].drxUeCb.drxDlUeActiveStatus != true))
+ {
+ if(pendingUeNode->node)
+ {
+ cmLListAdd2Tail(&fcfsCell->ueToBeScheduled, cmLListDelFrm(&fcfsCell->ueToBeScheduled, pendingUeNode));
+ }
+ }
+ else
+#endif
+ {
+
+ /* DL Data */
+ node = NULLP;
+ if(fcfsUeCb)
+ node = fcfsUeCb->hqRetxCb.dlRetxHqList.first;
+ if(node != NULLP)
+ {
+ /* DL Data ReTransmisson */
+ isDlMsgPending = true;
+ isDlMsgScheduled = schFillBoGrantDlSchedInfo(cell, *slotInd, ueId, TRUE, ((SchDlHqProcCb**) &(node->node)));
+ if(isDlMsgScheduled)
+ {
+#ifdef NR_DRX
+ schDrxStopDlHqRetxTmr(cell, &cell->ueCb[ueId-1], ((SchDlHqProcCb**) &(node->node)));
+#endif
+ schFcfsRemoveFrmDlHqRetxList(&cell->ueCb[ueId-1], node);
+ }
+ }
+ else
+ {
+ /* DL Data new transmission */
+ if((cell->boIndBitMap) & (1<<ueId))
+ {
+ isDlMsgPending = true;
+ isDlMsgScheduled = schFillBoGrantDlSchedInfo(cell, *slotInd, ueId, FALSE, &hqP);
+
+ /* If DL scheduling failed, free the newly assigned HARQ process */
+ if(!isDlMsgScheduled)
+ schDlReleaseHqProcess(hqP);
+ else
+ {
+#ifdef NR_DRX
+ schHdlDrxInActvStrtTmr(cell, &cell->ueCb[ueId-1], PHY_DELTA_DL + SCHED_DELTA);
+#endif
+ }
+ }
+ }
+
+ /* Scheduling of UL grant */
+ node = NULLP;
+ if(fcfsUeCb)
+ node = fcfsUeCb->hqRetxCb.ulRetxHqList.first;
+ if(node != NULLP)
+ {
+ /* UL Data ReTransmisson */
+ isUlGrantPending = true;
+ isUlGrantScheduled = schProcessSrOrBsrReq(cell, *slotInd, ueId, TRUE, (SchUlHqProcCb**) &(node->node));
+ if(isUlGrantScheduled)
+ {
+#ifdef NR_DRX
+ schDrxStopUlHqRetxTmr(cell, &cell->ueCb[ueId-1], ((SchUlHqProcCb**) &(node->node)));
+#endif
+ schFcfsRemoveFrmUlHqRetxList(&cell->ueCb[ueId-1], node);
+ }
+ }
+ else
+ {
+ /* UL Data new transmission */
+ if(cell->ueCb[ueId-1].srRcvd || cell->ueCb[ueId-1].bsrRcvd)
+ {
+ isUlGrantPending = true;
+ isUlGrantScheduled = schProcessSrOrBsrReq(cell, *slotInd, ueId, FALSE, &ulHqP);
+ if(!isUlGrantScheduled)
+ schUlReleaseHqProcess(ulHqP, FALSE);
+ else
+ {
+#ifdef NR_DRX
+ schHdlDrxInActvStrtTmr(cell, &cell->ueCb[ueId-1], PHY_DELTA_UL + SCHED_DELTA);
+#endif
+ }
+ }
+ }
+
+ if(!isUlGrantPending && !isDlMsgPending)
+ {
+ /* No action required */
+ }
+ else if((isUlGrantPending && !isUlGrantScheduled) || (isDlMsgPending && !isDlMsgScheduled))
+ {
+ cmLListAdd2Tail(&fcfsCell->ueToBeScheduled, cmLListDelFrm(&fcfsCell->ueToBeScheduled, pendingUeNode));
+ }
+ else
+ {
+ schFcfsRemoveUeFrmScheduleLst(cell, pendingUeNode);
+ }
+ }
+ }
+ }
+}
+
+/*******************************************************************
+ *
+ * @brief Initializes all function pointers to FCFS function handler
+ *
+ * @details
+ *
+ * Function : schFcfsAllApisInit
+ *
+ * Functionality: Initializes all function pointers to FCFS
+ * function handler
+ *
+ * @params[in] Function pointer array
+ * @return void
+ *
+ * ****************************************************************/
+void schFcfsAllApisInit(SchAllApis *allFcfsApi)
+{
+ /* Interface API function pointers */
+ allFcfsApi->SchCellCfgReq = schFcfsCellCfgReq;
+ allFcfsApi->SchCellDeleteReq = schFcfsCellDelReq;
+ allFcfsApi->SchAddUeConfigReq = SchFcfsAddUeConfigReq;
+ allFcfsApi->SchModUeConfigReq = SchFcfsModUeConfigReq;
+ allFcfsApi->SchUeDeleteReq = SchFcfsUeDeleteReq;
+ allFcfsApi->SchDlHarqInd = SchFcfsDlHarqInd;
+ allFcfsApi->SchCrcInd = schFcfsProcessCrcInd;
+ allFcfsApi->SchRachInd = schFcfsProcessRachInd;
+ allFcfsApi->SchPagingInd = schFcfsPagingInd;
+ allFcfsApi->SchRachRsrcReq = schFcfsRachRsrcReq;
+ allFcfsApi->SchRachRsrcRel = schFcfsRachRsrcRel;
+ allFcfsApi->SchDlRlcBoInfo = schFcfsDlRlcBoInfo;
+ allFcfsApi->SchSrUciInd = schFcfsSrUciInd;
+ allFcfsApi->SchBsr = schFcfsBsr;
+
+ /* Internal API function pointers */
+ allFcfsApi->SchAddToDlHqRetxList = schFcfsAddToDlHqRetxList;
+ allFcfsApi->SchAddToUlHqRetxList = schFcfsAddToUlHqRetxList;
+ allFcfsApi->SchRemoveFrmDlHqRetxList = schFcfsRemoveFrmDlHqRetxList;
+ allFcfsApi->SchRemoveFrmUlHqRetxList = schFcfsRemoveFrmUlHqRetxList;
+ allFcfsApi->SchAddUeToSchedule = schFcfsAddUeToSchedule;
+ allFcfsApi->SchRemoveUeFrmScheduleLst = schFcfsRemoveUeFrmScheduleLst;
+ allFcfsApi->SchInitDlHqProcCb = schFcfsInitDlHqProcCb;
+ allFcfsApi->SchInitUlHqProcCb = schFcfsInitUlHqProcCb;
+ allFcfsApi->SchFreeDlHqProcCb = schFcfsFreeDlHqProcCb;
+ allFcfsApi->SchFreeUlHqProcCb = schFcfsFreeUlHqProcCb;
+ allFcfsApi->SchDeleteDlHqProcCb = schFcfsDeleteDlHqProcCb;
+ allFcfsApi->SchDeleteUlHqProcCb = schFcfsDeleteUlHqProcCb;
+ allFcfsApi->SchScheduleSlot = schFcfsScheduleSlot;
+ allFcfsApi->SchScheduleDlLc = schFcfsScheduleDlLc;
+ allFcfsApi->SchScheduleUlLc = schFcfsScheduleUlLc;
+}
+/**********************************************************************
+ End of file
+**********************************************************************/
+
--- /dev/null
+/*******************************************************************************
+################################################################################
+# Copyright (c) [2017-2019] [Radisys] #
+# #
+# Licensed under the Apache License, Version 2.0 (the "License"); #
+# you may not use this file except in compliance with the License. #
+# You may obtain a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an "AS IS" BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+################################################################################
+*******************************************************************************/
+
+typedef struct schFcfsCellCb
+{
+ CmLListCp ueToBeScheduled; /*!< Linked list to store UEs pending to be scheduled, */
+}SchFcfsCellCb;
+
+typedef struct schFcfsLcCb
+{
+ /* 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;
+}SchFcfsLcCb;
+
+typedef struct schFcfsHqProcCb
+{
+ SchFcfsLcCb lcCb;
+}SchFcfsHqProcCb;
+
+typedef struct schFcfsHqCb
+{
+ CmLListCp ulRetxHqList;
+ CmLListCp dlRetxHqList;
+}SchFcfsHqCb;
+
+typedef struct schFcfsUeCb
+{
+ SchFcfsHqCb hqRetxCb;
+}SchFcfsUeCb;
+
+uint8_t schFcfsAddUeToSchedule(SchCellCb *cellCb, uint16_t ueIdToAdd);
+void schFcfsAllApisInit(SchAllApis *allFcfsApi);
+
+/**********************************************************************
+ End of file
+ *********************************************************************/
+
#include "sch_drx.h"
#endif
-SchMacDlReleaseHarqFunc schMacDlReleaseHarqOpts[] =
-{
- packSchMacDlReleaseHarq,
- MacSchReleaseDlHarqProc,
- packSchMacDlReleaseHarq
-};
-
typedef struct schCellCb SchCellCb;
typedef struct schUeCb SchUeCb;
void schDlHqEntReset(SchCellCb *cellCb, SchUeCb *ueCb, SchDlHqEnt *hqE);
hqP->dlHqEntLnk.node = (PTR)hqP;
hqP->dlHqProcLink.node = (PTR)hqP;
hqP->ulSlotLnk.node = (PTR)hqP;
+ cellCb->api->SchInitDlHqProcCb(hqP);
schDlHqAddToFreeList(hqP);
}
}
**/
void schDlReleaseHqProcess(SchDlHqProcCb *hqP)
{
+ SchCellCb *cellCb = NULLP;
if(hqP)
{
- cmLListDeleteLList(&hqP->dlLcPrbEst.dedLcList);
- cmLListDeleteLList(&hqP->dlLcPrbEst.defLcList);
+ cellCb = hqP->hqEnt->cell;
+ cellCb->api->SchFreeDlHqProcCb(hqP);
schDlHqDeleteFromInUseList(hqP);
schDlHqAddToFreeList(hqP);
}
rlsHqInfo->ueHqInfo[0].crnti = hqP->hqEnt->ue->crnti;
rlsHqInfo->ueHqInfo[0].hqProcId = hqP->procId;
- return(*schMacDlReleaseHarqOpts[pst.selector])(&pst, rlsHqInfo);
+ return(MacMessageRouter(&pst, (void *)rlsHqInfo));
}
/**
* @brief Release Harq process TB from the DL Harq process
hqP->tbInfo[tbIdx].state = HQ_TB_NACKED;
if (HQ_TB_WAITING == hqP->tbInfo[tbIdx^1].state)
{
- cmLListAdd2Tail( &(hqP->hqEnt->ue->dlRetxHqList), &hqP->dlHqProcLink);
+ hqP->hqEnt->cell->api->SchAddToDlHqRetxList(hqP);
}
}
}
if( hqP->tbInfo[0].txCntr >= hqP->hqEnt->cell->cellCfg.schHqCfg.maxMsg4HqTx)
{
schDlReleaseHqProcess(hqP);
- hqP->hqEnt->ue->msg4Proc = NULLP;
+ hqP->hqEnt->ue->msg4HqProc = NULLP;
hqP->hqEnt->ue->retxMsg4HqProc = NULLP;
/* Delete UE and RA context */
}
- addUeToBeScheduled(hqP->hqEnt->cell,hqP->hqEnt->ue->ueId);
+ hqP->hqEnt->cell->api->SchAddUeToSchedule(hqP->hqEnt->cell,hqP->hqEnt->ue->ueId);
hqP->hqEnt->ue->retxMsg4HqProc = hqP;
}
}
+
/**
* @brief Handles Harq feedback for DL Data
*
else
{
schDlHqTbFail(hqP, tbIdx, FALSE);
-#ifdef NR_DRX
- if(hqP->hqEnt->ue->ueDrxInfoPres == true)
- {
- schDrxStrtDlHqRttTmr(hqP);
- }
- else
-#endif
- {
- addUeToBeScheduled(hqP->hqEnt->cell, hqP->hqEnt->ue->ueId);
- }
}
}
}
}
}
+
+/**
+ * @brief Deletes HARQ Entity
+ *
+ * @details
+ *
+ * Function : schDlHqEntDelete
+ *
+ * This function deletes HARQ entity and its member paremeters
+ *
+ * @param[in] Pointer to UE
+ * @return
+ * -# void
+ **/
+void schDlHqEntDelete(SchUeCb *ueCb)
+{
+ uint8_t count;
+ SchDlHqProcCb *hqP;
+
+ cmLListDeleteLList(&ueCb->dlHqEnt.free);
+ cmLListDeleteLList(&ueCb->dlHqEnt.inUse);
+ for(count=0; count < ueCb->dlHqEnt.numHqPrcs; count++)
+ {
+ hqP = &(ueCb->dlHqEnt.procs[count]);
+ ueCb->cellCb->api->SchDeleteDlHqProcCb(hqP);
+ }
+ memset(&ueCb->dlHqEnt, 0, sizeof(SchDlHqEnt));
+}
+
/**********************************************************************
End of file
**********************************************************************/
hqP->ulHqEntLnk.node = (PTR)hqP;
hqP->ulHqProcLink.node = (PTR)hqP;
hqP->ulSlotLnk.node = (PTR)hqP;
+ cellCb->api->SchInitUlHqProcCb(hqP);
schUlHqAddToFreeList(hqP);
}
}
+
/**
* @brief Add hq process to free list of UL Harq entity
*
**/
void schUlReleaseHqProcess(SchUlHqProcCb *hqP, Bool togNdi)
{
+ SchCellCb *cellCb = NULLP;
if (togNdi == TRUE)
{
hqP->tbInfo.ndi ^= 1;
}
- cmLListDeleteLList(&hqP->ulLcPrbEst.dedLcList);
- cmLListDeleteLList(&hqP->ulLcPrbEst.defLcList);
+
+ cellCb = hqP->hqEnt->cell;
+ cellCb->api->SchFreeUlHqProcCb(hqP);
+
schUlHqDeleteFromInUseList(hqP);
schUlHqAddToFreeList(hqP);
}
{
if (hqP->tbInfo.txCntr < hqP->maxHqTxPerHqP)
{
- cmLListAdd2Tail(&(hqP->hqEnt->ue->ulRetxHqList), &hqP->ulHqProcLink);
-#ifdef NR_DRX
- if(hqP->hqEnt->ue->ueDrxInfoPres == true)
- {
- schDrxStrtUlHqRttTmr(hqP);
- }
- else
-#endif
- {
- addUeToBeScheduled(hqP->hqEnt->cell, hqP->hqEnt->ue->ueId);
- }
+ hqP->hqEnt->cell->api->SchAddToUlHqRetxList(hqP);
}
else
{
{
schUlReleaseHqProcess(hqP, TRUE);
}
+
+/**
+ * @brief Deletes HARQ Entity
+ *
+ * @details
+ *
+ * Function : schUlHqEntDelete
+ *
+ * This function deletes HARQ entity and its member paremeters
+ *
+ * @param[in] Pointer to UE
+ * @return
+ * -# void
+ **/
+void schUlHqEntDelete(SchUeCb *ueCb)
+{
+ uint8_t count;
+ SchUlHqProcCb *hqP;
+
+ cmLListDeleteLList(&ueCb->ulHqEnt.free);
+ cmLListDeleteLList(&ueCb->ulHqEnt.inUse);
+ for(count=0; count < ueCb->ulHqEnt.numHqPrcs; count++)
+ {
+ hqP = &(ueCb->ulHqEnt.procs[count]);
+ ueCb->cellCb->api->SchDeleteUlHqProcCb(hqP);
+ }
+ memset(&ueCb->ulHqEnt, 0, sizeof(SchUlHqEnt));
+}
+
/**********************************************************************
End of file
**********************************************************************/
**********************************************************************/
-#if 0 /*MAC-SCH Interface working as Tightly Coupled thus Commenting*/
-
-/** @file sch_msg_router.c
-@brief This file contains the implementation of callback functions
-registered with SSI during the LTE MAC Task initialization.
-*/
-/* header include files -- defines (.h) */
#include "common_def.h"
-#include "tfu.h" /* RGU defines */
-#include "lrg.h" /* layer management defines for LTE-MAC */
-#include "rgr.h" /* layer management defines for LTE-MAC */
-#include "rgm.h" /* layer management defines for LTE-MAC */
-#include "rg_env.h" /* customisable defines and macros for LTE-MAC */
-#include "rg_sch_err.h" /* defines and macros for Scheduler */
-#include "rg_sch_inf.h" /* defines and macros for Scheduler */
-#include "rg_sch.h" /* defines and macros for Scheduler */
-
+#include "lrg.h"
+#include "tfu.h"
+#include "du_log.h"
+#include "rgr.h"
+#include "rg_sch_inf.h"
+#include "rg_sch.h"
+#include "mac_sch_interface.h"
-/* header/extern include files (.x) */
-#include "tfu.x" /* RGU types */
+#include "tfu.x" /* TFU types */
#include "lrg.x" /* layer management typedefs for MAC */
#include "rgr.x" /* layer management typedefs for MAC */
-#include "rgm.x" /* layer management typedefs for MAC */
-#include "rg_sch_inf.x" /* typedefs for Scheduler */
-#include "rg_sch.x" /* typedefs for Scheduler */
-#include "mac_sch_interface.h"
+#include "rg_sch_inf.x" /* typedefs for Scheduler */
+#include "sch.h"
#ifdef CALL_FLOW_DEBUG_LOG
-/*
-* @brief
+/**
+* @brief Function prints src, dest, msg infor about all the msgs that received.
*
-* Function:
-* name : callFlowSchActvTsk
+* @details
*
-* @b Description:
-* Function used to print values of src, dest, message
-* received at the layer
+* Function : callFlowSchMsgRouter
*
-* @param[in] pst - Pst Structure
+* Function prints src, dest, msg infor about all the msgs that received
*
-* @return void
-*/
+* @param[in] Pst *pst, Post structure of the primitive.
+*
+* @return void
+**/
-void callFlowSchActvTsk(Pst *pst)
+void callFlowSchMsgRouter(Pst *pst)
{
char sourceTask[50];
char destTask[50]="ENTSCH";
char message[100];
- switch(pst->srcEnt)
+ strcpy(sourceTask,"ENTMAC");
+ switch(pst->event)
{
- case ENTMAC: /* When MAC sends a msg to Scheduler instance */
- {
- strcpy(sourceTask,"ENTMAC");
- switch(pst->event)
- {
-#ifdef LCSCH
- case EVTINFDEDBOUPDTREQ:
- strcpy(message,"EVTINFDEDBOUPDTREQ");
- break;
- case EVTINFCMNBOUPDTREQ:
- strcpy(message,"EVTINFCMNBOUPDTREQ");
- break;
- case EVTINFSFRECPIND:
- strcpy(message,"EVTINFSFRECPIND");
- break;
- /*Fix: start: Inform UE delete to scheduler*/
- case EVTINFUEDELIND:
- strcpy(message,"EVTINFUEDELIND");
- break;
- /*Fix: end: Inform UE delete to scheduler*/
-#ifdef LTE_L2_MEAS
- case EVTINFL2MEASCFM:
- strcpy(message,"EVTINFL2MEASCFM");
- break;
- case EVTINFL2MEASSTOPCFM:
- strcpy(message,"EVTINFL2MEASSTOPCFM");
- break;
-#endif
-#endif
- case EVENT_SLOT_IND_TO_SCH:
- strcpy(message,"EVENT_SLOT_IND_TO_SCH");
- break;
- default:
- strcpy(message,"Invalid Event");
- break;
- }
+ case EVENT_SCH_GEN_CFG:
+ {
+ strcpy(message,"EVENT_SCH_GEN_CFG");
+ break;
+ }
+ case EVENT_SLICE_CFG_REQ_TO_SCH:
+ {
+ strcpy(message,"EVENT_SLICE_CFG_REQ_TO_SCH");
+ break;
+ }
+ case EVENT_SLICE_RECFG_REQ_TO_SCH:
+ {
+ strcpy(message,"EVENT_SLICE_RECFG_REQ_TO_SCH");
+ break;
+ }
+ case EVENT_SCH_CELL_CFG:
+ {
+ strcpy(message,"EVENT_SCH_CELL_CFG");
+ break;
+ }
+ case EVENT_SLOT_IND_TO_SCH:
+ {
+ strcpy(message,"EVENT_SLOT_IND_TO_SCH");
+ break;
+ }
+ case EVENT_ADD_UE_CONFIG_REQ_TO_SCH:
+ {
+ strcpy(message,"EVENT_ADD_UE_CONFIG_REQ_TO_SCH");
+ break;
+ }
+ case EVENT_MODIFY_UE_CONFIG_REQ_TO_SCH:
+ {
+ strcpy(message,"EVENT_MODIFY_UE_CONFIG_REQ_TO_SCH");
+ break;
+ }
+ case EVENT_RACH_IND_TO_SCH:
+ {
+ strcpy(message,"EVENT_RACH_IND_TO_SCH");
+ break;
+ }
+ case EVENT_CRC_IND_TO_SCH:
+ {
+ strcpy(message,"EVENT_CRC_IND_TO_SCH");
+ break;
+ }
+ case EVENT_DL_RLC_BO_INFO_TO_SCH:
+ {
+ strcpy(message,"EVENT_DL_RLC_BO_INFO_TO_SCH");
+ break;
+ }
+ case EVENT_SHORT_BSR:
+ {
+ strcpy(message,"EVENT_SHORT_BSR");
+ break;
+ }
+ case EVENT_LONG_BSR:
+ {
+ strcpy(message,"EVENT_LONG_BSR");
+ break;
+ }
+ case EVENT_UCI_IND_TO_SCH:
+ {
+ strcpy(message,"EVENT_UCI_IND_TO_SCH");
+ break;
+ }
+ case EVENT_UE_DELETE_REQ_TO_SCH:
+ {
+ strcpy(message,"EVENT_UE_DELETE_REQ_TO_SCH");
+ break;
+ }
+ case EVENT_CELL_DELETE_REQ_TO_SCH:
+ {
+ strcpy(message,"EVENT_CELL_DELETE_REQ_TO_SCH");
+ break;
+ }
+ case EVENT_RACH_RESOURCE_REQUEST_TO_SCH:
+ {
+ strcpy(message,"EVENT_RACH_RESOURCE_REQUEST_TO_SCH");
+ break;
+ }
+ case EVENT_RACH_RESOURCE_RELEASE_TO_SCH:
+ {
+ strcpy(message,"EVENT_RACH_RESOURCE_RELEASE_TO_SCH");
+ break;
+ }
+ case EVENT_PAGING_IND_TO_SCH:
+ {
+ strcpy(message,"EVENT_PAGING_IND_TO_SCH");
+ break;
+ }
+ case EVENT_DL_HARQ_IND_TO_SCH:
+ {
+ strcpy(message,"EVENT_DL_HARQ_IND_TO_SCH");
break;
}
default:
- strcpy(sourceTask,"Invalid Source Entity Id");
+ strcpy(message,"Invalid Event");
break;
}
DU_LOG("\nCall Flow: %s -> %s : %s\n", sourceTask, destTask, message);
}
#endif
-/**
- * @brief Task Activation callback function.
- *
- * @details
- *
- * Function : schActvTsk
- *
- * Primitives invoked by MAC's users/providers through
- * a loosely coupled interface arrive here by means of
- * SSI's message handling. This API is registered with
- * SSI during the Task Registration of MAC.
- *
- * @param[in] Pst *pst, post structure of the Primitive.
- * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
- * @param[in] Reason reason.
- * @return S16
- * -# ROK
- **/
-S16 schActvTsk
-(
-Pst *pst, /* post structure */
-Buffer *mBuf /* message buffer */
-)
+uint8_t SchMessageRouter(Pst *pst, void *msg)
{
-
#ifdef CALL_FLOW_DEBUG_LOG
- callFlowSchActvTsk(pst);
+ callFlowSchMsgRouter(pst);
#endif
- switch(pst->srcEnt)
+ switch(pst->event)
{
- /* The originator of this message is the stack manager,
- * unpack and go to the respective primitive processing function */
- case ENTSM:
- switch(pst->event)
- {
-#ifdef LCRGMILRG
- case EVTMACSCHGENCFGREQ:
- /* Process a config. request */
- cmUnpkLrgSchCfgReq(SchProcGenCfgReq, pst, mBuf);
- break;
- case EVTLRGSCHSTAIND:
- /* Process a control request */
- cmUnpkLrgSchStaInd(RgMiLrgSchStaInd, pst, mBuf);
- break;
-#ifdef LTE_L2_MEAS
- case EVTLRGSCHL2MEASREQ:
- /* Process L2 Measurement request */
- cmUnpkLrgSchL2MeasReq(RgMiLrgSchL2MeasReq, pst, mBuf);
- break;
- case EVTLRGSCHL2MEASSTOPREQ:
- /* Process L2 Measurement Stop request */
- cmUnpkLrgSchL2MeasStopReq(RgMiLrgSchL2MeasStopReq, pst, mBuf);
- break;
- case EVTLRGSCHL2MEASSENDREQ:
- /* Process L2 Measurement Send request */
- cmUnpkLrgSchL2MeasSendReq(RgMiLrgSchL2MeasSendReq, pst, mBuf);
- break;
-#endif
-#endif /* LCRGMILRG */
- default:
- RGSCH_FREE_MSG(mBuf);
- break;
- }
+ case EVENT_SCH_GEN_CFG:
+ {
+ SchProcGenCfgReq(pst, (RgMngmt *)msg);
break;
- case ENTMAC: /* When MAC sends a msg to Scheduler instance */
- switch(pst->event)
- {
-#ifdef LCSCH
- case EVTINFDEDBOUPDTREQ:
- cmUnpkMacSchDedBoUpdtReq(RgMacSchDedBoUpdtReq, pst, mBuf);
- break;
- case EVTINFCMNBOUPDTREQ:
- cmUnpkMacSchCmnBoUpdtReq(RgMacSchCmnBoUpdtReq, pst, mBuf);
- break;
- case EVTINFSFRECPIND:
- cmUnpkMacSchSfRecpInd(RgMacSchSfRecpInd, pst, mBuf);
- break;
- /*Fix: start: Inform UE delete to scheduler*/
- case EVTINFUEDELIND:
- cmUnpkMacSchUeDelInd(RgMacSchUeDelInd, pst, mBuf);
- break;
- /*Fix: end: Inform UE delete to scheduler*/
-#ifdef LTE_L2_MEAS
- case EVTINFL2MEASCFM:
- cmUnpkMacSchL2MeasCfm(RgMacSchL2MeasCfm, pst, mBuf);
- break;
- case EVTINFL2MEASSTOPCFM:
- cmUnpkMacSchL2MeasCfm(RgMacSchL2MeasStopCfm, pst, mBuf);
- break;
-#endif
-#endif
- case EVENT_SLOT_IND_TO_SCH:
- unpackMacSchSlotInd(MacSchSlotInd, pst, mBuf);
- break;
- default:
- RGSCH_FREE_MSG(mBuf);
- break;
- }
+ }
+ case EVENT_SLICE_CFG_REQ_TO_SCH:
+ {
+ SchProcSliceCfgReq(pst, (SchSliceCfgReq *)msg);
+ break;
+ }
+ case EVENT_SLICE_RECFG_REQ_TO_SCH:
+ {
+ SchProcSliceRecfgReq(pst, (SchSliceRecfgReq *)msg);
+ break;
+ }
+ case EVENT_SCH_CELL_CFG:
+ {
+ SchProcCellCfgReq(pst, (SchCellCfg *)msg);
+ break;
+ }
+ case EVENT_SLOT_IND_TO_SCH:
+ {
+ SchProcSlotInd(pst, (SlotTimingInfo *)msg);
+ break;
+ }
+ case EVENT_ADD_UE_CONFIG_REQ_TO_SCH:
+ {
+ SchAddUeConfigReq(pst, (SchUeCfgReq *)msg);
+ break;
+ }
+ case EVENT_MODIFY_UE_CONFIG_REQ_TO_SCH:
+ {
+ SchModUeConfigReq(pst, (SchUeRecfgReq *)msg);
+ break;
+ }
+ case EVENT_RACH_IND_TO_SCH:
+ {
+ SchProcRachInd(pst, (RachIndInfo *)msg);
+ break;
+ }
+ case EVENT_CRC_IND_TO_SCH:
+ {
+ SchProcCrcInd(pst, (CrcIndInfo *)msg);
+ break;
+ }
+ case EVENT_DL_RLC_BO_INFO_TO_SCH:
+ {
+ SchProcDlRlcBoInfo(pst, (DlRlcBoInfo *)msg);
+ break;
+ }
+ case EVENT_SHORT_BSR:
+ case EVENT_LONG_BSR:
+ {
+ SchProcBsr(pst, (UlBufferStatusRptInd *)msg);
break;
+ }
+ case EVENT_UCI_IND_TO_SCH:
+ {
+ SchProcSrUciInd(pst, (SrUciIndInfo *)msg);
+ break;
+ }
+ case EVENT_UE_DELETE_REQ_TO_SCH:
+ {
+ SchProcUeDeleteReq(pst, (SchUeDelete *)msg);
+ break;
+ }
+ case EVENT_CELL_DELETE_REQ_TO_SCH:
+ {
+ SchProcCellDeleteReq(pst, (SchCellDeleteReq *)msg);
+ break;
+ }
+ case EVENT_RACH_RESOURCE_REQUEST_TO_SCH:
+ {
+ SchProcRachRsrcReq(pst, (SchRachRsrcReq *)msg);
+ break;
+ }
+ case EVENT_RACH_RESOURCE_RELEASE_TO_SCH:
+ {
+ SchProcRachRsrcRel(pst, (SchRachRsrcRel *)msg);
+ break;
+ }
+ case EVENT_PAGING_IND_TO_SCH:
+ {
+ SchProcPagingInd(pst, (SchPageInd *)msg);
+ break;
+ }
+ case EVENT_DL_HARQ_IND_TO_SCH:
+ {
+ SchProcDlHarqInd(pst, (DlHarqInd *)msg);
+ break;
+ }
default:
- RGSCH_FREE_MSG(mBuf);
- break;
+ {
+ DU_LOG("\nERROR --> SCH : SchMessageRouter(): Invalid event [%d] received", pst->event);
+ return RFAILED;
+ }
}
- ODU_EXIT_TASK();
return ROK;
-}/* end of schActvTsk */
+}
-#endif
\f
/**********************************************************************
#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
*
*
* @details
*
- * Function : MacSchRachRsrcReq
+ * Function : SchProcRachRsrcReq
*
* This function processes RACH resorce request
* from MAC for CFRA. It assigns a dedicated preamble
* @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;
SCH_FREE(schRachRsrcReq, sizeof(SchRachRsrcReq));
/* Send RACH resource response to MAC */
- return (SchRachRsrcRspOpts[rspPst.selector](&rspPst, rachRsrcRsp));
+ return(MacMessageRouter(&rspPst, (void *)rachRsrcRsp));
}
/**
*
* @details
*
- * Function : schProcessRachInd
+ * Function : SchProcRachInd
*
* This function process rach indication
*
* @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;
}
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;
}
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;
}
*
* @details
*
- * Function : MacSchRachRsrcRel
+ * Function : SchProcRachRsrcRel
*
* This function processes RACH resorce release
* from MAC after CFRA. It releases the dedicated
* @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;
{
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
#include "sch_drx.h"
#endif
-SchMacDlAllocFunc schMacDlAllocOpts[] =
-{
- packSchMacDlAlloc,
- MacProcDlAlloc,
- packSchMacDlAlloc
-};
-
-SchMacDlPageAllocFunc schMacDlPageAllocOpts[] =
-{
- packSchMacDlPageAlloc,
- MacProcDlPageAlloc,
- packSchMacDlPageAlloc
-};
-
/*******************************************************************
*
* @brief Handles sending DL broadcast alloc to MAC
FILL_PST_SCH_TO_MAC(pst, inst);
pst.event = EVENT_DL_SCH_INFO;
- return(*schMacDlAllocOpts[pst.selector])(&pst, dlSchedInfo);
+ return(MacMessageRouter(&pst, (void *)dlSchedInfo));
+}
+
+/*******************************************************************
+ *
+ * @brief
+ *
+ * @details
+ *
+ * Function : schFillBoGrantDlSchedInfo
+ *
+ * Functionality:
+
+ *
+ * @params[in] SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId
+ * @params[in] bool isRetx, SchDlHqProcCb **hqP
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+bool schFillBoGrantDlSchedInfo(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId, bool isRetx, SchDlHqProcCb **hqP)
+{
+ uint8_t pdschNumSymbols = 0, pdschStartSymbol = 0;
+ uint16_t startPrb = 0;
+ uint16_t crnti = 0;
+ uint32_t accumalatedSize = 0;
+ SchUeCb *ueCb = NULLP;
+ DlMsgAlloc *dciSlotAlloc, *dlMsgAlloc;
+ SlotTimingInfo pdcchTime, pdschTime, pucchTime;
+
+ GET_CRNTI(crnti,ueId);
+ ueCb = &cell->ueCb[ueId-1];
+
+ if (isRetx == FALSE)
+ {
+ if(schDlGetAvlHqProcess(cell, ueCb, hqP) != ROK)
+ {
+ return false;
+ }
+ }
+
+ if(findValidK0K1Value(cell, currTime, ueId, ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.k0K1TblPrsnt,\
+ &pdschStartSymbol, &pdschNumSymbols, &pdcchTime, &pdschTime, &pucchTime, isRetx, *hqP) != true )
+ {
+ /* If a valid combination of slots to scheduled PDCCH, PDSCH and PUCCH is
+ * not found, do not perform resource allocation. Return from here. */
+ return false;
+ }
+
+ /* allocate PDCCH and PDSCH resources for the ue */
+ if(cell->schDlSlotInfo[pdcchTime.slot]->dlMsgAlloc[ueId-1] == NULL)
+ {
+
+ SCH_ALLOC(dciSlotAlloc, sizeof(DlMsgAlloc));
+ if(!dciSlotAlloc)
+ {
+ DU_LOG("\nERROR --> SCH : Memory Allocation failed for ded DL msg alloc");
+ return false;
+ }
+ cell->schDlSlotInfo[pdcchTime.slot]->dlMsgAlloc[ueId -1] = dciSlotAlloc;
+ memset(dciSlotAlloc, 0, sizeof(DlMsgAlloc));
+ dciSlotAlloc->crnti = crnti;
+ }
+ else
+ {
+ dciSlotAlloc = cell->schDlSlotInfo[pdcchTime.slot]->dlMsgAlloc[ueId -1];
+ }
+ /* Dl ded Msg info is copied, this was earlier filled in macSchDlRlcBoInfo */
+ fillDlMsgInfo(&dciSlotAlloc->dlMsgSchedInfo[dciSlotAlloc->numSchedInfo].dlMsgInfo, dciSlotAlloc->crnti, isRetx, *hqP);
+ dciSlotAlloc->dlMsgSchedInfo[dciSlotAlloc->numSchedInfo].isRetx = isRetx;
+
+ accumalatedSize = cell->api->SchScheduleDlLc(pdcchTime, pdschTime, pdschNumSymbols, isRetx, hqP);
+
+ /*Below case will hit if NO LC(s) are allocated due to resource crunch*/
+ if (!accumalatedSize)
+ return false;
+
+ /*[Step6]: pdcch and pdsch data is filled */
+ if((schDlRsrcAllocDlMsg(cell, pdschTime, crnti, accumalatedSize, dciSlotAlloc, startPrb, pdschStartSymbol, pdschNumSymbols, isRetx, *hqP)) != ROK)
+ {
+ DU_LOG("\nERROR --> SCH : Scheduling of DL dedicated message failed");
+
+ /* Free the dl ded msg info allocated in macSchDlRlcBoInfo */
+ if(dciSlotAlloc->numSchedInfo == 0)
+ {
+ SCH_FREE(dciSlotAlloc, sizeof(DlMsgAlloc));
+ cell->schDlSlotInfo[pdcchTime.slot]->dlMsgAlloc[ueId -1] = NULL;
+ }
+ else
+ {
+ memset(&dciSlotAlloc->dlMsgSchedInfo[dciSlotAlloc->numSchedInfo], 0, sizeof(DlMsgSchInfo));
+ }
+ return false;
+ }
+
+ /* TODO : Update the scheduling byte report for multiple LC based on QCI
+ * and Priority */
+ /* As of now, the total number of bytes scheduled for a slot is divided
+ * equally amongst all LC with pending data. This is avoid starving of any
+ * LC
+ * */
+#if 0
+ accumalatedSize = accumalatedSize/dlMsgAlloc->numLc;
+ for(lcIdx = 0; lcIdx < dlMsgAlloc->numLc; lcIdx ++)
+ dlMsgAlloc->lcSchInfo[lcIdx].schBytes = accumalatedSize;
+#endif
+
+ /* Check if both DCI and DL_MSG are sent in the same slot.
+ * If not, allocate memory for DL_MSG PDSCH slot to store PDSCH info */
+ if(pdcchTime.slot == pdschTime.slot)
+ {
+ dciSlotAlloc->dlMsgSchedInfo[dciSlotAlloc->numSchedInfo].pduPres = BOTH;
+ dciSlotAlloc->numSchedInfo++;
+ }
+ else
+ {
+ /* Allocate memory to schedule dlMsgAlloc to send DL_Msg, pointer will be checked at schProcessSlotInd() */
+ if(cell->schDlSlotInfo[pdschTime.slot]->dlMsgAlloc[ueId-1] == NULLP)
+ {
+ SCH_ALLOC(dlMsgAlloc, sizeof(DlMsgAlloc));
+ if(dlMsgAlloc == NULLP)
+ {
+ DU_LOG("\nERROR --> SCH : Memory Allocation failed for dlMsgAlloc");
+ if(dciSlotAlloc->numSchedInfo == 0)
+ {
+ SCH_FREE(dciSlotAlloc, sizeof(DlMsgAlloc));
+ cell->schDlSlotInfo[pdcchTime.slot]->dlMsgAlloc[ueId-1] = NULLP;
+ }
+ else
+ memset(&dciSlotAlloc->dlMsgSchedInfo[dciSlotAlloc->numSchedInfo], 0, sizeof(DlMsgSchInfo));
+ return false;
+ }
+ cell->schDlSlotInfo[pdschTime.slot]->dlMsgAlloc[ueId-1] = dlMsgAlloc;
+ memset(dlMsgAlloc, 0, sizeof(DlMsgAlloc));
+ dlMsgAlloc->crnti = dciSlotAlloc->crnti;
+ }
+ else
+ dlMsgAlloc = cell->schDlSlotInfo[pdschTime.slot]->dlMsgAlloc[ueId-1];
+
+ /* Copy all DL_MSG info */
+ memcpy(&dlMsgAlloc->dlMsgSchedInfo[dlMsgAlloc->numSchedInfo], \
+ &dciSlotAlloc->dlMsgSchedInfo[dciSlotAlloc->numSchedInfo], sizeof(DlMsgSchInfo));
+ dlMsgAlloc->dlMsgSchedInfo[dlMsgAlloc->numSchedInfo].dlMsgPdcchCfg.dci.pdschCfg = \
+ &dlMsgAlloc->dlMsgSchedInfo[dlMsgAlloc->numSchedInfo].dlMsgPdschCfg;
+
+ /* Assign correct PDU types in corresponding slots */
+ dlMsgAlloc->dlMsgSchedInfo[dlMsgAlloc->numSchedInfo].pduPres = PDSCH_PDU;
+ dciSlotAlloc->dlMsgSchedInfo[dciSlotAlloc->numSchedInfo].pduPres = PDCCH_PDU;
+ dciSlotAlloc->dlMsgSchedInfo[dciSlotAlloc->numSchedInfo].pdschSlot = pdschTime.slot;
+
+ dciSlotAlloc->numSchedInfo++;
+ dlMsgAlloc->numSchedInfo++;
+ }
+
+ schAllocPucchResource(cell, pucchTime, crnti, ueCb, isRetx, *hqP);
+
+ cell->schDlSlotInfo[pdcchTime.slot]->pdcchUe = ueId;
+ cell->schDlSlotInfo[pdschTime.slot]->pdschUe = ueId;
+ cell->schUlSlotInfo[pucchTime.slot]->pucchUe = ueId;
+
+ /* after allocation is done, unset the bo bit for that ue */
+ UNSET_ONE_BIT(ueId, cell->boIndBitMap);
+ return true;
}
/*******************************************************************
FILL_PST_SCH_TO_MAC(pst, inst);
pst.event = EVENT_DL_PAGING_ALLOC;
- return(*schMacDlPageAllocOpts[pst.selector])(&pst, dlPageAlloc);
-
+ return(MacMessageRouter(&pst, (void *)dlPageAlloc));
}
/*******************************************************************
return false;
}
-/*******************************************************************
- *
- * @brief
- *
- * @details
- *
- * Function : schFillBoGrantDlSchedInfo
- *
- * Functionality:
-
- *
- * @params[in] SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId
- * @params[in] bool isRetx, SchDlHqProcCb **hqP
- * @return ROK - success
- * RFAILED - failure
- *
- * ****************************************************************/
-bool schFillBoGrantDlSchedInfo(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId, bool isRetx, SchDlHqProcCb **hqP)
-{
- uint8_t lcIdx = 0;
- uint8_t pdschNumSymbols = 0, pdschStartSymbol = 0;
- uint16_t startPrb = 0, maxFreePRB = 0;
- uint16_t crnti = 0, mcsIdx = 0;
- uint32_t accumalatedSize = 0;
- SchUeCb *ueCb = NULLP;
- CmLListCp *lcLL = NULLP;
- DlMsgAlloc *dciSlotAlloc, *dlMsgAlloc;
- SlotTimingInfo pdcchTime, pdschTime, pucchTime;
- uint16_t rsvdDedicatedPRB = 0;
-
- /* TX_PAYLOAD_HDR_LEN: Overhead which is to be Added once for any UE while estimating Accumulated TB Size
- * Following flag added to keep the record whether TX_PAYLOAD_HDR_LEN is added to the first Node getting allocated.
- * If both Dedicated and Default LC lists are present then First LC in Dedicated List will include this overhead
- * else if only Default list is present then first node in this List will add this overhead len*/
- bool isTxPayloadLenAdded = FALSE;
- GET_CRNTI(crnti,ueId);
- ueCb = &cell->ueCb[ueId-1];
-
- if (isRetx == FALSE)
- {
- if(schDlGetAvlHqProcess(cell, ueCb, hqP) != ROK)
- {
- return false;
- }
- }
-
- if(findValidK0K1Value(cell, currTime, ueId, ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.k0K1TblPrsnt,\
- &pdschStartSymbol, &pdschNumSymbols, &pdcchTime, &pdschTime, &pucchTime, isRetx, *hqP) != true )
- {
- /* If a valid combination of slots to scheduled PDCCH, PDSCH and PUCCH is
- * not found, do not perform resource allocation. Return from here. */
- return false;
- }
-
- /* allocate PDCCH and PDSCH resources for the ue */
- if(cell->schDlSlotInfo[pdcchTime.slot]->dlMsgAlloc[ueId-1] == NULL)
- {
-
- SCH_ALLOC(dciSlotAlloc, sizeof(DlMsgAlloc));
- if(!dciSlotAlloc)
- {
- DU_LOG("\nERROR --> SCH : Memory Allocation failed for ded DL msg alloc");
- return false;
- }
- cell->schDlSlotInfo[pdcchTime.slot]->dlMsgAlloc[ueId -1] = dciSlotAlloc;
- memset(dciSlotAlloc, 0, sizeof(DlMsgAlloc));
- dciSlotAlloc->crnti = crnti;
- }
- else
- {
- dciSlotAlloc = cell->schDlSlotInfo[pdcchTime.slot]->dlMsgAlloc[ueId -1];
- }
- /* Dl ded Msg info is copied, this was earlier filled in macSchDlRlcBoInfo */
- fillDlMsgInfo(&dciSlotAlloc->dlMsgSchedInfo[dciSlotAlloc->numSchedInfo].dlMsgInfo, dciSlotAlloc->crnti, isRetx, *hqP);
- dciSlotAlloc->dlMsgSchedInfo[dciSlotAlloc->numSchedInfo].isRetx = isRetx;
-
-
- if (isRetx == FALSE)
- {
- /*Re-Initalization per UE*/
- /* scheduled LC data fill */
- dciSlotAlloc->dlMsgSchedInfo[dciSlotAlloc->numSchedInfo].numLc = 0;
- isTxPayloadLenAdded = FALSE; /*Re-initlaize the flag for every UE*/
- accumalatedSize = 0;
-
- for(lcIdx = 0; lcIdx < MAX_NUM_LC; lcIdx++)
- {
- if(ueCb->dlInfo.dlLcCtxt[lcIdx].bo)
- {
- /*Check the LC is Dedicated or default and accordingly LCList will
- * be used*/
- if(ueCb->dlInfo.dlLcCtxt[lcIdx].isDedicated)
- {
- lcLL = &((*hqP)->dlLcPrbEst.dedLcList);
- rsvdDedicatedPRB = ueCb->dlInfo.dlLcCtxt[lcIdx].rsvdDedicatedPRB;
- }
- else
- {
- lcLL = &((*hqP)->dlLcPrbEst.defLcList);
- }
-
- /*[Step2]: Update the reqPRB and Payloadsize for this LC in the appropriate List*/
- if(updateLcListReqPRB(lcLL, ueCb->dlInfo.dlLcCtxt[lcIdx].lcId,\
- (ueCb->dlInfo.dlLcCtxt[lcIdx].bo + MAC_HDR_SIZE)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Updation in LC List Failed");
- /* Free the dl ded msg info allocated in macSchDlRlcBoInfo */
- if(dciSlotAlloc->numSchedInfo == 0)
- {
- SCH_FREE(dciSlotAlloc, sizeof(DlMsgAlloc));
- cell->schDlSlotInfo[pdcchTime.slot]->dlMsgAlloc[ueId -1] = NULL;
- }
- else
- memset(&dciSlotAlloc->dlMsgSchedInfo[dciSlotAlloc->numSchedInfo], 0, sizeof(DlMsgSchInfo));
- return false;
- }
- }
- ueCb->dlInfo.dlLcCtxt[lcIdx].bo = 0;
- }//End of for loop
- if (((*hqP)->dlLcPrbEst.defLcList.count == 0) && ( ((*hqP)->dlLcPrbEst.dedLcList.count == 0)))
- {
- DU_LOG("\nDEBUG --> SCH : No pending BO for any LC id\n");
- UNSET_ONE_BIT(ueId, cell->boIndBitMap);
-
- /* Free the dl ded msg info allocated in macSchDlRlcBoInfo */
- if(dciSlotAlloc->numSchedInfo == 0)
- {
- SCH_FREE(dciSlotAlloc, sizeof(DlMsgAlloc));
- cell->schDlSlotInfo[pdcchTime.slot]->dlMsgAlloc[ueId -1] = NULL;
- }
- else
- memset(&dciSlotAlloc->dlMsgSchedInfo[dciSlotAlloc->numSchedInfo], 0, sizeof(DlMsgSchInfo));
-
- /*TRUE because this UE has nothing to be scheduled*/
- return true;
- }
- }
-
- /*[Step3]: Calculate Best FREE BLOCK with MAX PRB count*/
- maxFreePRB = searchLargestFreeBlock(cell, pdschTime, &startPrb, DIR_DL);
-
- /*[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(isRetx == FALSE)
- {
- if(maxFreePRB != 0)
- {
- mcsIdx = ueCb->ueCfg.dlModInfo.mcsIndex;
-
- if(((*hqP)->dlLcPrbEst.dedLcList.count == NULLP)
- || ((maxFreePRB < rsvdDedicatedPRB)))
- {
- (*hqP)->dlLcPrbEst.sharedNumPrb = maxFreePRB;
- DU_LOG("\nDEBUG --> SCH : DL Only Default Slice is scheduled, sharedPRB Count:%d",\
- (*hqP)->dlLcPrbEst.sharedNumPrb);
-
- /*PRB Alloc for Default LCs*/
- prbAllocUsingRRMPolicy(&((*hqP)->dlLcPrbEst.defLcList), FALSE, mcsIdx, pdschNumSymbols,\
- &((*hqP)->dlLcPrbEst.sharedNumPrb), NULLP, &isTxPayloadLenAdded, NULLP);
- }
- else
- {
- (*hqP)->dlLcPrbEst.sharedNumPrb = maxFreePRB - rsvdDedicatedPRB;
- /*PRB Alloc for Dedicated LCs*/
- prbAllocUsingRRMPolicy(&((*hqP)->dlLcPrbEst.dedLcList), TRUE, mcsIdx, pdschNumSymbols,\
- &((*hqP)->dlLcPrbEst.sharedNumPrb), &(rsvdDedicatedPRB), &isTxPayloadLenAdded, NULLP);
-
- /*PRB Alloc for Default LCs*/
- prbAllocUsingRRMPolicy(&((*hqP)->dlLcPrbEst.defLcList), FALSE, mcsIdx, pdschNumSymbols, \
- &((*hqP)->dlLcPrbEst.sharedNumPrb), &(rsvdDedicatedPRB), &isTxPayloadLenAdded, NULLP);
- }
- }
- }
-
- /*[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 (isRetx == FALSE)
- {
- if((*hqP)->dlLcPrbEst.dedLcList.count != 0)
- updateGrantSizeForBoRpt(&((*hqP)->dlLcPrbEst.dedLcList), dciSlotAlloc, NULLP, &(accumalatedSize));
-
- updateGrantSizeForBoRpt(&((*hqP)->dlLcPrbEst.defLcList), dciSlotAlloc, NULLP, &(accumalatedSize));
- }
- else
- {
- accumalatedSize = (*hqP)->tbInfo[0].tbSzReq;
- }
-
- /*Below case will hit if NO LC(s) are allocated due to resource crunch*/
- if (!accumalatedSize)
- {
- if(maxFreePRB == 0)
- {
- DU_LOG("\nERROR --> SCH : NO FREE PRB!!");
- }
- else
- {
- /*Schedule the LC for next slot*/
- DU_LOG("\nDEBUG --> SCH : No LC has been scheduled");
- }
- /* Not Freeing dlMsgAlloc as ZERO BO REPORT to be sent to RLC so that
- * Allocation can be done in next slot*/
- return false;
- }
-
- /*[Step6]: pdcch and pdsch data is filled */
- if((schDlRsrcAllocDlMsg(cell, pdschTime, crnti, accumalatedSize, dciSlotAlloc, startPrb, pdschStartSymbol, pdschNumSymbols, isRetx, *hqP)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Scheduling of DL dedicated message failed");
-
- /* Free the dl ded msg info allocated in macSchDlRlcBoInfo */
- if(dciSlotAlloc->numSchedInfo == 0)
- {
- SCH_FREE(dciSlotAlloc, sizeof(DlMsgAlloc));
- cell->schDlSlotInfo[pdcchTime.slot]->dlMsgAlloc[ueId -1] = NULL;
- }
- else
- {
- memset(&dciSlotAlloc->dlMsgSchedInfo[dciSlotAlloc->numSchedInfo], 0, sizeof(DlMsgSchInfo));
- }
- return false;
- }
-
- /* TODO : Update the scheduling byte report for multiple LC based on QCI
- * and Priority */
- /* As of now, the total number of bytes scheduled for a slot is divided
- * equally amongst all LC with pending data. This is avoid starving of any
- * LC
- * */
-#if 0
- accumalatedSize = accumalatedSize/dlMsgAlloc->numLc;
- for(lcIdx = 0; lcIdx < dlMsgAlloc->numLc; lcIdx ++)
- dlMsgAlloc->lcSchInfo[lcIdx].schBytes = accumalatedSize;
-#endif
-
- /* Check if both DCI and DL_MSG are sent in the same slot.
- * If not, allocate memory for DL_MSG PDSCH slot to store PDSCH info */
-
- if(pdcchTime.slot == pdschTime.slot)
- {
- dciSlotAlloc->dlMsgSchedInfo[dciSlotAlloc->numSchedInfo].pduPres = BOTH;
- dciSlotAlloc->numSchedInfo++;
- }
- else
- {
- /* Allocate memory to schedule dlMsgAlloc to send DL_Msg, pointer will be checked at schProcessSlotInd() */
- if(cell->schDlSlotInfo[pdschTime.slot]->dlMsgAlloc[ueId-1] == NULLP)
- {
- SCH_ALLOC(dlMsgAlloc, sizeof(DlMsgAlloc));
- if(dlMsgAlloc == NULLP)
- {
- DU_LOG("\nERROR --> SCH : Memory Allocation failed for dlMsgAlloc");
- if(dciSlotAlloc->numSchedInfo == 0)
- {
- SCH_FREE(dciSlotAlloc, sizeof(DlMsgAlloc));
- cell->schDlSlotInfo[pdcchTime.slot]->dlMsgAlloc[ueId-1] = NULLP;
- }
- else
- memset(&dciSlotAlloc->dlMsgSchedInfo[dciSlotAlloc->numSchedInfo], 0, sizeof(DlMsgSchInfo));
- return false;
- }
- cell->schDlSlotInfo[pdschTime.slot]->dlMsgAlloc[ueId-1] = dlMsgAlloc;
- memset(dlMsgAlloc, 0, sizeof(DlMsgAlloc));
- dlMsgAlloc->crnti = dciSlotAlloc->crnti;
- }
- else
- dlMsgAlloc = cell->schDlSlotInfo[pdschTime.slot]->dlMsgAlloc[ueId-1];
-
- /* Copy all DL_MSG info */
- memcpy(&dlMsgAlloc->dlMsgSchedInfo[dlMsgAlloc->numSchedInfo], \
- &dciSlotAlloc->dlMsgSchedInfo[dciSlotAlloc->numSchedInfo], sizeof(DlMsgSchInfo));
- dlMsgAlloc->dlMsgSchedInfo[dlMsgAlloc->numSchedInfo].dlMsgPdcchCfg.dci.pdschCfg = \
- &dlMsgAlloc->dlMsgSchedInfo[dlMsgAlloc->numSchedInfo].dlMsgPdschCfg;
-
- /* Assign correct PDU types in corresponding slots */
- dlMsgAlloc->dlMsgSchedInfo[dlMsgAlloc->numSchedInfo].pduPres = PDSCH_PDU;
- dciSlotAlloc->dlMsgSchedInfo[dciSlotAlloc->numSchedInfo].pduPres = PDCCH_PDU;
- dciSlotAlloc->dlMsgSchedInfo[dciSlotAlloc->numSchedInfo].pdschSlot = pdschTime.slot;
-
- dciSlotAlloc->numSchedInfo++;
- dlMsgAlloc->numSchedInfo++;
- }
-
- schAllocPucchResource(cell, pucchTime, crnti, ueCb, isRetx, *hqP);
-
- cell->schDlSlotInfo[pdcchTime.slot]->pdcchUe = ueId;
- cell->schDlSlotInfo[pdschTime.slot]->pdschUe = ueId;
- cell->schUlSlotInfo[pucchTime.slot]->pucchUe = ueId;
-
- /* after allocation is done, unset the bo bit for that ue */
- UNSET_ONE_BIT(ueId, cell->boIndBitMap);
- return true;
-}
-
/*******************************************************************
*
* @brief Process DL Resource allocation for Page
*
* @details
*
- * Function : schProcessSlotInd
+ * Function : SchProcSlotInd
*
* Functionality:
* Handles TTI indication received from PHY
* RFAILED - failure
*
* ****************************************************************/
-uint8_t schProcessSlotInd(SlotTimingInfo *slotInd, Inst schInst)
+uint8_t SchProcSlotInd(Pst *pst, SlotTimingInfo *slotInd)
{
- uint8_t ueId, ueIdx, ret = ROK;
- uint16_t slot;
- bool isRarPending = false, isRarScheduled = false;
- bool isMsg4Pending = false, isMsg4Scheduled = false;
- bool isUlGrantPending = false, isUlGrantScheduled = false;
- bool isDlMsgPending = false, isDlMsgScheduled = false;
- CmLList *pendingUeNode;
+ uint8_t ueIdx, ret = ROK;
+ uint16_t slot;
DlSchedInfo dlSchedInfo;
DlBrdcstAlloc *dlBrdcstAlloc = NULLP;
SchCellCb *cell = NULLP;
- CmLList *node;
- uint8_t* ueNode;
- SchDlHqProcCb *hqP = NULLP;
- SchUlHqProcCb *ulHqP = NULLP;
+ Inst schInst = pst->dstInst-SCH_INST_START;
cell = schCb[schInst].cells[schInst];
if(cell == NULLP)
/*Process Paging Msg*/
schProcDlPageAlloc(cell, *slotInd, schInst);
- /* Select first UE in the linked list to be scheduled next */
- pendingUeNode = cell->ueToBeScheduled.first;
- if(pendingUeNode)
- {
- if(pendingUeNode->node)
- {
- ueNode = (uint8_t *)pendingUeNode->node;
- ueId = *(uint8_t *)(pendingUeNode->node);
- /* If RAR is pending for this UE, schedule PDCCH,PDSCH to send RAR and
- * PUSCH to receive MSG3 as per k0-k2 configuration*/
- if(cell->raReq[ueId-1] != NULLP)
- {
- isRarPending = true;
- isRarScheduled = schProcessRaReq(schInst, cell, *slotInd, ueId);
- }
-
- /*MSG3 retransmisson*/
- if(cell->raCb[ueId-1].retxMsg3HqProc)
- {
- schMsg3RetxSchedulingForUe(&(cell->raCb[ueId-1]));
- }
-
- /* If MSG4 is pending for this UE, schedule PDCCH,PDSCH to send MSG4 and
- * PUCCH to receive UL msg as per k0-k1 configuration */
- if (cell->ueCb[ueId-1].retxMsg4HqProc) //should work from dlmap later tbd
- {
- /* Retransmission of MSG4 */
- isMsg4Pending = true;
- if(schProcessMsg4Req(cell, *slotInd, ueId, TRUE, &cell->ueCb[ueId-1].retxMsg4HqProc) == ROK)
- isMsg4Scheduled = true;
- }
- else
- {
- /* First transmission of MSG4 */
- if(cell->raCb[ueId-1].msg4recvd)
- {
- isMsg4Pending = true;
- if(schProcessMsg4Req(cell, *slotInd, ueId, FALSE, &cell->ueCb[ueId-1].msg4Proc) == ROK)
- isMsg4Scheduled = true;
-
- /* If MSG4 scheduling failed, free the newly assigned HARQ process */
- if(!isMsg4Scheduled)
- schDlReleaseHqProcess(cell->ueCb[ueId-1].msg4Proc);
- }
- }
-
- if(isRarPending || isMsg4Pending)
- {
- /* If RAR or MSG is successfully scheduled then
- * remove UE from linked list since no pending msgs for this UE */
- if(isRarScheduled || isMsg4Scheduled)
- {
- SCH_FREE(pendingUeNode->node, sizeof(uint8_t));
- deleteNodeFromLList(&cell->ueToBeScheduled, pendingUeNode);
- }
- /* If RAR/MSG4 is pending but couldnt be scheduled then,
- * put this UE at the end of linked list to be scheduled later */
- else
- {
- cmLListAdd2Tail(&cell->ueToBeScheduled, cmLListDelFrm(&cell->ueToBeScheduled, pendingUeNode));
- }
- }
-
-#ifdef NR_DRX
- if((cell->ueCb[ueId-1].ueDrxInfoPres == true) && (cell->ueCb[ueId-1].drxUeCb.drxDlUeActiveStatus != true))
- {
- if(pendingUeNode->node)
- {
- cmLListAdd2Tail(&cell->ueToBeScheduled, cmLListDelFrm(&cell->ueToBeScheduled, pendingUeNode));
- }
- }
- else
-#endif
- {
-
- /* DL Data */
- node = cell->ueCb[ueId-1].dlRetxHqList.first;
- if(node != NULLP)
- {
- /* DL Data ReTransmisson */
- isDlMsgPending = true;
- isDlMsgScheduled = schFillBoGrantDlSchedInfo(cell, *slotInd, ueId, TRUE, ((SchDlHqProcCb**) &(node->node)));
- if(isDlMsgScheduled)
- {
-#ifdef NR_DRX
- schDrxStopDlHqRetxTmr(cell, &cell->ueCb[ueId-1], ((SchDlHqProcCb**) &(node->node)));
-#endif
- cmLListDelFrm(&cell->ueCb[ueId-1].dlRetxHqList, node);
- }
- }
- else
- {
- /* DL Data new transmission */
- if((cell->boIndBitMap) & (1<<ueId))
- {
- isDlMsgPending = true;
- isDlMsgScheduled = schFillBoGrantDlSchedInfo(cell, *slotInd, ueId, FALSE, &hqP);
-
- /* If DL scheduling failed, free the newly assigned HARQ process */
- if(!isDlMsgScheduled)
- schDlReleaseHqProcess(hqP);
- else
- {
-#ifdef NR_DRX
- schHdlDrxInActvStrtTmr(cell, &cell->ueCb[ueId-1], PHY_DELTA_DL + SCHED_DELTA);
-#endif
- }
- }
- }
-
- /* Scheduling of UL grant */
- node = cell->ueCb[ueId-1].ulRetxHqList.first;
- if(node != NULLP)
- {
- /* UL Data ReTransmisson */
- isUlGrantPending = true;
- isUlGrantScheduled = schProcessSrOrBsrReq(cell, *slotInd, ueId, TRUE, (SchUlHqProcCb**) &(node->node));
- if(isUlGrantScheduled)
- {
-#ifdef NR_DRX
- schDrxStopUlHqRetxTmr(cell, &cell->ueCb[ueId-1], ((SchUlHqProcCb**) &(node->node)));
-#endif
- cmLListDelFrm(&cell->ueCb[ueId-1].ulRetxHqList, node);
- }
- }
- else
- {
- /* UL Data new transmission */
- if(cell->ueCb[ueId-1].srRcvd || cell->ueCb[ueId-1].bsrRcvd)
- {
- isUlGrantPending = true;
- isUlGrantScheduled = schProcessSrOrBsrReq(cell, *slotInd, ueId, FALSE, &ulHqP);
- if(!isUlGrantScheduled)
- schUlReleaseHqProcess(ulHqP, FALSE);
- else
- {
-#ifdef NR_DRX
- schHdlDrxInActvStrtTmr(cell, &cell->ueCb[ueId-1], PHY_DELTA_UL + SCHED_DELTA);
-#endif
- }
- }
- }
-
- if(!isUlGrantPending && !isDlMsgPending)
- {
- /* No action required */
- }
- else if((isUlGrantPending && !isUlGrantScheduled) || (isDlMsgPending && !isDlMsgScheduled))
- {
- cmLListAdd2Tail(&cell->ueToBeScheduled, cmLListDelFrm(&cell->ueToBeScheduled, pendingUeNode));
- }
- else
- {
- SCH_FREE(ueNode, sizeof(uint8_t));
- deleteNodeFromLList(&cell->ueToBeScheduled, pendingUeNode);
- }
- }
- }
- }
+ cell->api->SchScheduleSlot(cell, slotInd, schInst);
/* Check if any PDU is scheduled at this slot for any UE */
for(ueIdx=0; ueIdx<MAX_NUM_UE; ueIdx++)
#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
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);
}
/*******************************************************************
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);
}
/*******************************************************************
*
* @details
*
- * Function : MacSchAddUeConfigReq
+ * Function : SchAddUeConfigReq
*
* Functionality: Function to Add Ue config request from MAC
*
* 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;
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);
SchSendUeCfgRspToMac(ueCfg, inst, RSP_OK, &cfgRsp);
}
+
+ cellCb->api->SchAddUeConfigReq(ueCb);
return ret;
}
*
* @details
*
- * Function : MacSchModUeConfigReq
+ * Function : SchModUeConfigReq
*
* Functionality: Function to modify Ue Config request from MAC
*
* 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;
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);
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;
}
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);
-}
/*******************************************************************
*
SCH_FREE(ueCb->hqUlmap, sizeof(SchHqUlMap*)*(ueCb->cellCb->numSlots));
}
+ schDlHqEntDelete(ueCb);
+ schUlHqEntDelete(ueCb);
+
SCH_FREE(ueCb->ueCfg.ambrCfg, sizeof(SchAmbrCfg));
if(ueCb->ueCfg.spCellCfgPres)
{
}
}
+/*******************************************************************
+*
+* @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
*
* 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);
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
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;
}
}
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; slotIdx<cellCb->numSlots; 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; slotIdx<cellCb->numSlots; 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; sliceIdx<cellCb->cellCfg.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; idx<MAX_SFN; idx++)
- {
- list = &cellCb->pageCb.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
return ODU_POST_TASK(pst,mBuf);
}
-/**
- * @brief function to unpack Slot ind message from MAC
- * to scheduler with loose coupling
- *
- * @details
- *
- * Function : unpackMacSchSlotInd
- *
- *
- * @param[in] Pst *pst, the post structure
- * @param[in] Buffer *mBuf, the message buffer
- * @return S16
- * -# ROK
- **/
-uint8_t unpackMacSchSlotInd(MacSchSlotIndFunc func, Pst *pst, Buffer *mBuf)
-{
- /* TODO */
- return ROK;
-}
-
-
/*******************************************************************
*
* @brief Pack and Send Rach Ind from MAC to SCH
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
**********************************************************************/
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
/* 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;
}