From aae1fb8fd1e149a7b3a6a6ca799c56aceadc6184 Mon Sep 17 00:00:00 2001 From: "lal.harshita" Date: Mon, 21 Nov 2022 22:31:46 +0530 Subject: [PATCH] [Epic-ID: ODUHIGH-462][Task-ID: ODUHIGH-472] Implementation of in-active timer Signed-off-by: lal.harshita Change-Id: I171bfaacd5a027b99c4a303734a67379de02eac1 Signed-off-by: lal.harshita --- src/5gnrsch/sch_drx.c | 166 +++++++++++++++++++++++++++++++++++++++++++++ src/5gnrsch/sch_slot_ind.c | 12 ++++ 2 files changed, 178 insertions(+) diff --git a/src/5gnrsch/sch_drx.c b/src/5gnrsch/sch_drx.c index 02e6f1050..bcff9a0cc 100644 --- a/src/5gnrsch/sch_drx.c +++ b/src/5gnrsch/sch_drx.c @@ -666,6 +666,53 @@ void schHdlDrxOnDurStrtTimer(SchCellCb *cell) schHdlDrxOnDurStrtTimerForUlDirection(cell, ulIndx); } +/** + * @brief Handling of the DRX in-active start timer + * + * @details + * + * Function : + * + * Handling of DRX in-active start timer + * + * @param[in] SchCellCb *cell + * @return + * -# ROK + * -# RFAILED + **/ + +void schHdlDrxInActvStrtTmr(SchCellCb *cell, SchUeCb *ueCb, uint8_t delta) +{ + uint16_t slotIndx = 0; + SlotTimingInfo tmpSlotInfo; + + if(ueCb->drxUeCb.inActvTimerLen == 0) + { + return; + } + + ADD_DELTA_TO_TIME(cell->slotInfo, tmpSlotInfo, delta, cell->numSlots); + slotIndx = (tmpSlotInfo.sfn*MAX_SLOTS+tmpSlotInfo.slot)%MAX_DRX_SIZE; + + /* if there is any entry present in the in-active exp list then remove the entry */ + if(ueCb->drxUeCb.inActvExpiryIndex != SCH_DRX_INVALID_INDEX) + { + cmLListDelFrm(&cell->drxCb[ueCb->drxUeCb.inActvExpiryIndex].inActvTmrExpiryList, ueCb->drxUeCb.inActvTimerExpiryNodeInfo); + SCH_FREE(ueCb->drxUeCb.inActvTimerExpiryNodeInfo, sizeof(CmLList)); + ueCb->drxUeCb.inActvExpiryIndex= SCH_DRX_INVALID_INDEX; + ueCb->drxUeCb.inActiveTmrExpiryDistance= SCH_DRX_INVALID_DISTANCE; + } + + /* Adding the new entry in in-activity timer list */ + ueCb->drxUeCb.inActvExpiryIndex = (slotIndx + ueCb->drxUeCb.inActvTimerLen) % MAX_DRX_SIZE; + ueCb->drxUeCb.inActiveTmrExpiryDistance = (ueCb->drxUeCb.inActvTimerLen) / MAX_DRX_SIZE; + schAddDrxTimerIntoList(&cell->drxCb[ueCb->drxUeCb.inActvExpiryIndex].inActvTmrExpiryList, ueCb, ueCb->drxUeCb.inActvTimerExpiryNodeInfo); + + /* Set the UE active for UL And Dl transfer */ + ueCb->drxUeCb.drxDlUeActiveStatus |= UE_ACTIVE_FOR_INACTIVE_TIMER; + ueCb->drxUeCb.drxUlUeActiveStatus |= UE_ACTIVE_FOR_INACTIVE_TIMER; +} + /** * @brief Handling of the DRX timers start * @@ -793,6 +840,124 @@ void schHdlDrxOnDurExpiryTimer(SchCellCb *cell) schHdlDrxOnDurExpiryTimerForUlDirection(cell, ulIndx); } +/** + * @brief Handling of the expiry of in-active DRX timers in Dl + * + * @details + * + * Function : schHdlDrxInActvExpiryTimerForDlDirection + * + * Handling of expiry of in-active DRX timers at Dl index + * + * @param[in] SchCellCb *cell, uint16_t dlIndx + * @return + * -# ROK + * -# RFAILED + **/ + +void schHdlDrxInActvExpiryTimerForDlDirection(SchCellCb *cell, uint16_t dlIndx) +{ + CmLList *drxNode; + SchUeCb *ueCb = NULLP; + + drxNode = cell->drxCb[dlIndx].inActvTmrExpiryList.first; + if(drxNode) + { + /* Handling of dl On duration drx start list */ + while(drxNode) + { + ueCb = (SchUeCb*)drxNode->node; + drxNode = drxNode->next; + ueCb->drxUeCb.inActiveTmrExpiryDistance--; + + if(ueCb->drxUeCb.onDurationExpiryDistance != SCH_DRX_INVALID_DISTANCE) + { + continue; + } + + ueCb->drxUeCb.drxDlUeActiveStatus &= ~UE_ACTIVE_FOR_INACTIVE_TIMER; + } + } +} + +/** + * @brief Handling of the expiry of in-active DRX timers in Ul + * + * @details + * + * Function : schHdlDrxInActvExpiryTimerForUlDirection + * + * Handling of expiry of in-active DRX timers at Ul index + * + * @param[in] SchCellCb *cell, uint16_t ulIndx + * @return + * -# ROK + * -# RFAILED + **/ + +void schHdlDrxInActvExpiryTimerForUlDirection(SchCellCb *cell, uint16_t ulIndx) +{ + CmLList *drxNode; + SchUeCb *ueCb = NULLP; + + drxNode = cell->drxCb[ulIndx].inActvTmrExpiryList.first; + if(drxNode) + { + /* Handling of dl On duration drx start list */ + while(drxNode) + { + ueCb = (SchUeCb*)drxNode->node; + drxNode = drxNode->next; + + if(ueCb->drxUeCb.onDurationExpiryDistance != SCH_DRX_INVALID_DISTANCE) + { + continue; + } + + ueCb->drxUeCb.drxUlUeActiveStatus &= ~UE_ACTIVE_FOR_INACTIVE_TIMER; + + /* Remove the entry from the in-active exp timer list */ + cmLListDelFrm(&cell->drxCb[ulIndx].inActvTmrExpiryList, ueCb->drxUeCb.inActvTimerExpiryNodeInfo); + SCH_FREE(ueCb->drxUeCb.inActvTimerExpiryNodeInfo, sizeof(CmLList)); + ueCb->drxUeCb.inActvExpiryIndex = SCH_DRX_INVALID_INDEX; + + if(ueCb->drxUeCb.shortCyclePresent) + { + /* Start short cycle timer */ + /* TODO Will implement this in next gerrit */ + } + } + } +} + +/** + * @brief Handling of the expiry of in-active DRX timers + * + * @details + * + * Function :schHdlDrxInActvExpiryTimer + * + * Handling of expiry of in-active DRX timers + * + * @param[in] SchCellCb *cell + * @return + * -# ROK + * -# RFAILED + **/ +void schHdlDrxInActvExpiryTimer(SchCellCb *cell) +{ + uint16_t dlIndx = 0, ulIndx = 0; + SlotTimingInfo dlSlotInfo, ulSlotInfo; + + ADD_DELTA_TO_TIME(cell->slotInfo, dlSlotInfo, PHY_DELTA_DL + SCHED_DELTA, cell->numSlots); + ADD_DELTA_TO_TIME(cell->slotInfo, ulSlotInfo, PHY_DELTA_UL + SCHED_DELTA, cell->numSlots); + dlIndx = (dlSlotInfo.sfn*MAX_SLOTS+dlSlotInfo.slot)%MAX_DRX_SIZE; + ulIndx = (ulSlotInfo.sfn*MAX_SLOTS+ulSlotInfo.slot)%MAX_DRX_SIZE; + + schHdlDrxInActvExpiryTimerForDlDirection(cell, dlIndx); + schHdlDrxInActvExpiryTimerForUlDirection(cell, ulIndx); +} + /** * @brief Handling of the expiry DRX timers * @@ -811,6 +976,7 @@ void schHandleExpiryDrxTimer(SchCellCb *cell) { /* Handling the onduration start timer */ schHdlDrxOnDurExpiryTimer(cell); + schHdlDrxInActvExpiryTimer(cell); } #endif diff --git a/src/5gnrsch/sch_slot_ind.c b/src/5gnrsch/sch_slot_ind.c index 08774854c..1e87a21d7 100644 --- a/src/5gnrsch/sch_slot_ind.c +++ b/src/5gnrsch/sch_slot_ind.c @@ -932,6 +932,12 @@ uint8_t schProcessSlotInd(SlotTimingInfo *slotInd, Inst schInst) /* 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 + } } } @@ -953,6 +959,12 @@ uint8_t schProcessSlotInd(SlotTimingInfo *slotInd, Inst schInst) 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 + } } } -- 2.16.6