[Epic-ID: ODUHIGH-462][Task-ID: ODUHIGH-472] Implementation of in-active timer 34/9734/2
authorlal.harshita <Harshita.Lal@radisys.com>
Mon, 21 Nov 2022 17:01:46 +0000 (22:31 +0530)
committerlal.harshita <Harshita.Lal@radisys.com>
Tue, 22 Nov 2022 07:59:42 +0000 (13:29 +0530)
Signed-off-by: lal.harshita <Harshita.Lal@radisys.com>
Change-Id: I171bfaacd5a027b99c4a303734a67379de02eac1
Signed-off-by: lal.harshita <Harshita.Lal@radisys.com>
src/5gnrsch/sch_drx.c
src/5gnrsch/sch_slot_ind.c

index 02e6f10..bcff9a0 100644 (file)
@@ -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
index 0877485..1e87a21 100644 (file)
@@ -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
+                  }
                }
             }