[Epic-ID: ODUHIGH-462][Task-ID: ODUHIGH-472] Implementation of Ul Harq Rtt timer...
[o-du/l2.git] / src / 5gnrsch / sch_common.c
index c441a0c..f98610a 100644 (file)
@@ -413,10 +413,21 @@ uint16_t fillPucchResourceInfo(SchPucchInfo *schPucchInfo, Inst inst, SlotTiming
    SchCellCb  *cell = schCb[inst].cells[inst];
    SchPucchCfgCmn *pucchCfg = NULLP;
    SchBwpParams *ulBwp = NULLP;
+#ifdef NR_DRX 
+   SchUeCb *ueCb = NULLP;
+#endif
    uint16_t startPrb;
 
    GET_UE_ID(schPucchInfo->rnti, ueId);
    ueIdx = ueId -1;
+#ifdef NR_DRX 
+   ueCb = schGetUeCb(cell, schPucchInfo->rnti);
+   if(ueCb->ueDrxInfoPres)
+   {
+      if(!ueCb->drxUeCb.drxUlUeActiveStatus)
+         return RFAILED;
+   }
+#endif
    if(cell->ueCb[ueIdx].ueCfg.spCellCfg.servCellCfg.initUlBwp.pucchCfgPres)
    {
       /* fill pucch dedicated cfg */
@@ -470,6 +481,9 @@ uint16_t fillPucchResourceInfo(SchPucchInfo *schPucchInfo, Inst inst, SlotTiming
 uint8_t schUlResAlloc(SchCellCb *cell, Inst schInst)
 {
    int ret = ROK;
+#ifdef NR_DRX 
+   SchUeCb   *ueCb;
+#endif
    UlSchedInfo ulSchedInfo;
    SchUlSlotInfo  *schUlSlotInfo = NULLP;
    SlotTimingInfo ulTimingInfo;
@@ -491,6 +505,15 @@ uint8_t schUlResAlloc(SchCellCb *cell, Inst schInst)
    if(schUlSlotInfo->schPuschInfo)
    {
       ulSchedInfo.crnti = schUlSlotInfo->schPuschInfo->crnti;
+      /* Check the ue drx status if the UE is active for uplink scheduling or not  */
+#ifdef NR_DRX 
+      ueCb = schGetUeCb(cell, ulSchedInfo.crnti);
+      if(ueCb->ueDrxInfoPres)
+      {
+         if(!ueCb->drxUeCb.drxUlUeActiveStatus)
+            return RFAILED;
+      }
+#endif
       ulSchedInfo.dataType |= SCH_DATATYPE_PUSCH;
       memcpy(&ulSchedInfo.schPuschInfo, schUlSlotInfo->schPuschInfo,
            sizeof(SchPuschInfo));
@@ -507,6 +530,10 @@ uint8_t schUlResAlloc(SchCellCb *cell, Inst schInst)
          memcpy(&ulSchedInfo.schPucchInfo, &schUlSlotInfo->schPucchInfo,
                sizeof(SchPucchInfo));
       }
+      else
+      {
+         return RFAILED;
+      }
       memset(&schUlSlotInfo->schPucchInfo, 0, sizeof(SchPucchInfo));
    }
 
@@ -2045,6 +2072,10 @@ bool schProcessSrOrBsrReq(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId
             continue;
          }
          k2Found = true;
+         if(hqP)
+         {
+            ADD_DELTA_TO_TIME(puschTime, (*hqP)->puschTime, 0, cell->numSlots);
+         }
          break;
       }
    }
@@ -2052,7 +2083,7 @@ bool schProcessSrOrBsrReq(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId
    if(k2Found == true)
    {
       ret = schCalculateUlTbs(ueCb, puschTime, symbLen, &startPrb, &totDataReq, isRetx, *hqP);
-
+   
       if(totDataReq > 0 && ret == ROK)
       {
          SCH_ALLOC(dciInfo, sizeof(DciInfo));