X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrsch%2Fsch_slot_ind.c;h=16f67d2b3b4369d327e3bc541d9ca8bb07fde7a5;hb=53b8b63c2fff0f2adbf2c66ed182a32bb4682bf7;hp=7c08cf38af4c11c2cb9474e3736fe218c1753c70;hpb=d169699deebeb7cd144e15ee58bc8032acbd5299;p=o-du%2Fl2.git diff --git a/src/5gnrsch/sch_slot_ind.c b/src/5gnrsch/sch_slot_ind.c index 7c08cf38a..16f67d2b3 100644 --- a/src/5gnrsch/sch_slot_ind.c +++ b/src/5gnrsch/sch_slot_ind.c @@ -41,6 +41,9 @@ File: sch_slot_ind.c #include "mac_sch_interface.h" #include "sch.h" #include "sch_utils.h" +#ifdef NR_DRX +#include "sch_drx.h" +#endif SchMacDlAllocFunc schMacDlAllocOpts[] = { @@ -128,7 +131,7 @@ uint8_t sendDlPageAllocToMac(DlPageAlloc *dlPageAlloc, Inst inst) * RFAILED - failure * * ****************************************************************/ -void schCalcSlotValues(SlotTimingInfo slotInd, SchSlotValue *schSlotValue) +void schCalcSlotValues(SlotTimingInfo slotInd, SchSlotValue *schSlotValue, uint16_t numOfSlots) { /**************************************************************** * PHY_DELTA - the physical layer delta * @@ -143,11 +146,11 @@ void schCalcSlotValues(SlotTimingInfo slotInd, SchSlotValue *schSlotValue) * on PHY_DELTA + SCHED_DELTA + BO_DELTA * ****************************************************************/ - ADD_DELTA_TO_TIME(slotInd, schSlotValue->currentTime, PHY_DELTA_DL); - ADD_DELTA_TO_TIME(slotInd, schSlotValue->broadcastTime, PHY_DELTA_DL + SCHED_DELTA); - ADD_DELTA_TO_TIME(slotInd, schSlotValue->rarTime, PHY_DELTA_DL + SCHED_DELTA); - ADD_DELTA_TO_TIME(slotInd, schSlotValue->dlMsgTime, PHY_DELTA_DL + SCHED_DELTA); - ADD_DELTA_TO_TIME(slotInd, schSlotValue->ulDciTime, PHY_DELTA_DL + SCHED_DELTA); + ADD_DELTA_TO_TIME(slotInd, schSlotValue->currentTime, PHY_DELTA_DL, numOfSlots); + ADD_DELTA_TO_TIME(slotInd, schSlotValue->broadcastTime, PHY_DELTA_DL + SCHED_DELTA, numOfSlots); + ADD_DELTA_TO_TIME(slotInd, schSlotValue->rarTime, PHY_DELTA_DL + SCHED_DELTA, numOfSlots); + ADD_DELTA_TO_TIME(slotInd, schSlotValue->dlMsgTime, PHY_DELTA_DL + SCHED_DELTA, numOfSlots); + ADD_DELTA_TO_TIME(slotInd, schSlotValue->ulDciTime, PHY_DELTA_DL + SCHED_DELTA, numOfSlots); } /******************************************************************* @@ -252,7 +255,7 @@ bool findValidK0K1Value(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId, SchUeCb *ueCb = NULLP; SchK0K1TimingInfoTbl *k0K1InfoTbl; - ADD_DELTA_TO_TIME(currTime, (*pdcchTime), PHY_DELTA_DL + SCHED_DELTA); + ADD_DELTA_TO_TIME(currTime, (*pdcchTime), PHY_DELTA_DL + SCHED_DELTA, cell->numSlots); #ifdef NR_TDD if(schGetSlotSymbFrmt(pdcchTime->slot, cell->slotFrmtBitMap) != DL_SLOT) { @@ -269,7 +272,7 @@ bool findValidK0K1Value(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId, if(dedMsg == true) { ueCb = &cell->ueCb[ueId-1]; - k0K1InfoTbl = &ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.k0K1InfoTbl; + k0K1InfoTbl = &ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.k0K1InfoTbl; } else { @@ -288,15 +291,15 @@ bool findValidK0K1Value(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId, } else { - if(ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[k0Index].k0 != NULLP) + if(ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[k0Index].k0 != NULLP) { - k0Val = *(ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[k0Index].k0); - *pdschStartSymbol = ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[k0Index].startSymbol; - *pdschSymblLen = ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[k0Index].symbolLength; + k0Val = *(ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[k0Index].k0); + *pdschStartSymbol = ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[k0Index].startSymbol; + *pdschSymblLen = ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[k0Index].symbolLength; } } - ADD_DELTA_TO_TIME((*pdcchTime), (*pdschTime), k0Val); + ADD_DELTA_TO_TIME((*pdcchTime), (*pdschTime), k0Val, cell->numSlots); #ifdef NR_TDD if(schGetSlotSymbFrmt(pdschTime->slot, cell->slotFrmtBitMap) != DL_SLOT) { @@ -318,12 +321,12 @@ bool findValidK0K1Value(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId, } else { - if(ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.pucchCfg.dlDataToUlAck) + if(ueCb->ueCfg.spCellCfg.servCellRecfg.initUlBwp.pucchCfg.dlDataToUlAck) { - k1Val = ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.pucchCfg.dlDataToUlAck->dlDataToUlAckList[k1Index]; + k1Val = ueCb->ueCfg.spCellCfg.servCellRecfg.initUlBwp.pucchCfg.dlDataToUlAck->dlDataToUlAckList[k1Index]; } } - ADD_DELTA_TO_TIME((*pdschTime),(*pucchTime), k1Val); + ADD_DELTA_TO_TIME((*pdschTime),(*pucchTime), k1Val, cell->numSlots); #ifdef NR_TDD if(schGetSlotSymbFrmt(pucchTime->slot, cell->slotFrmtBitMap) == DL_SLOT) { @@ -334,6 +337,10 @@ bool findValidK0K1Value(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId, { continue; } + if(hqP) + { + ADD_DELTA_TO_TIME((*pucchTime), hqP->pucchTime, 0, cell->numSlots); + } return true; } } @@ -390,7 +397,7 @@ bool schFillBoGrantDlSchedInfo(SchCellCb *cell, SlotTimingInfo currTime, uint8_t } } - if(findValidK0K1Value(cell, currTime, ueId, ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.k0K1TblPrsnt,\ + 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 @@ -678,7 +685,7 @@ uint8_t schProcDlPageAlloc(SchCellCb *cell, SlotTimingInfo currTime, Inst schIns { dlPageAlloc.cellId = currTime.cellId; - ADD_DELTA_TO_TIME(currTime, dlPageAlloc.dlPageTime, PHY_DELTA_DL + SCHED_DELTA); + ADD_DELTA_TO_TIME(currTime, dlPageAlloc.dlPageTime, PHY_DELTA_DL + SCHED_DELTA, cell->numSlots); dlPageAlloc.shortMsgInd = FALSE; pdschTime = dlPageAlloc.dlPageTime; @@ -772,13 +779,8 @@ uint8_t schProcessSlotInd(SlotTimingInfo *slotInd, Inst schInst) SchCellCb *cell = NULLP; CmLList *node; uint8_t* ueNode; - SchDlHqProcCb *hqP = NULLP, *ulHqP = NULLP; - - memset(&dlSchedInfo, 0, sizeof(DlSchedInfo)); - schCalcSlotValues(*slotInd, &dlSchedInfo.schSlotValue); - dlBrdcstAlloc = &dlSchedInfo.brdcstAlloc; - dlBrdcstAlloc->ssbTrans = NO_TRANSMISSION; - dlBrdcstAlloc->sib1Trans = NO_TRANSMISSION; + SchDlHqProcCb *hqP = NULLP; + SchUlHqProcCb *ulHqP = NULLP; cell = schCb[schInst].cells[schInst]; if(cell == NULLP) @@ -786,12 +788,22 @@ uint8_t schProcessSlotInd(SlotTimingInfo *slotInd, Inst schInst) DU_LOG("\nERROR --> SCH : Cell Does not exist"); return RFAILED; } + memset(&dlSchedInfo, 0, sizeof(DlSchedInfo)); + schCalcSlotValues(*slotInd, &dlSchedInfo.schSlotValue, cell->numSlots); + dlBrdcstAlloc = &dlSchedInfo.brdcstAlloc; + dlBrdcstAlloc->ssbTrans = NO_TRANSMISSION; + dlBrdcstAlloc->sib1Trans = NO_TRANSMISSION; + memcpy(&cell->slotInfo, slotInd, sizeof(SlotTimingInfo)); dlBrdcstAlloc->ssbIdxSupported = SSB_IDX_SUPPORTED; dlSchedInfo.cellId = cell->cellId; slot = dlSchedInfo.schSlotValue.broadcastTime.slot; +#ifdef NR_DRX + schHandleStartDrxTimer(cell); +#endif + /* Check for SSB occassion */ dlBrdcstAlloc->ssbTrans = schCheckSsbOcc(cell, dlSchedInfo.schSlotValue.broadcastTime); if(dlBrdcstAlloc->ssbTrans) @@ -892,62 +904,99 @@ uint8_t schProcessSlotInd(SlotTimingInfo *slotInd, Inst schInst) } } - /* DL Data */ - node = cell->ueCb[ueId-1].dlRetxHqList.first; - if(node != NULLP) +#ifdef NR_DRX + if((cell->ueCb[ueId-1].ueDrxInfoPres == true) && (cell->ueCb[ueId-1].drxUeCb.drxDlUeActiveStatus != true)) { - /* DL Data ReTransmisson */ - isDlMsgPending = true; - isDlMsgScheduled = schFillBoGrantDlSchedInfo(cell, *slotInd, ueId, TRUE, ((SchDlHqProcCb**) &(node->node))); - cmLListDelFrm(&cell->ueCb[ueId-1].dlRetxHqList, node); + if(pendingUeNode->node) + { + cmLListAdd2Tail(&cell->ueToBeScheduled, cmLListDelFrm(&cell->ueToBeScheduled, pendingUeNode)); + } } - else + else +#endif { - /* DL Data new transmission */ - if((cell->boIndBitMap) & (1<ueCb[ueId-1].dlRetxHqList.first; + if(node != NULLP) { - isDlMsgPending = true; - isDlMsgScheduled = schFillBoGrantDlSchedInfo(cell, *slotInd, ueId, FALSE, &hqP); - - /* If DL scheduling failed, free the newly assigned HARQ process */ - if(!isDlMsgScheduled) - schDlReleaseHqProcess(hqP); + /* 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<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)); - cmLListDelFrm(&cell->ueCb[ueId-1].ulRetxHqList, node); - } - else - { - /* UL Data new transmission */ - if(cell->ueCb[ueId-1].srRcvd || cell->ueCb[ueId-1].bsrRcvd) + /* Scheduling of UL grant */ + node = cell->ueCb[ueId-1].ulRetxHqList.first; + if(node != NULLP) { + /* UL Data ReTransmisson */ isUlGrantPending = true; - isUlGrantScheduled = schProcessSrOrBsrReq(cell, *slotInd, ueId, FALSE, &ulHqP); - if(!isUlGrantScheduled) - schUlReleaseHqProcess(ulHqP, FALSE); + 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); + 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); + } } } } @@ -991,7 +1040,9 @@ uint8_t schProcessSlotInd(SlotTimingInfo *slotInd, Inst schInst) schInitDlSlot(cell->schDlSlotInfo[slot]); schUlResAlloc(cell, schInst); - +#ifdef NR_DRX + schHandleExpiryDrxTimer(cell); +#endif return ret; }