[Task-ID: ODUHIGH-550] Tag and Commit Id update in I-release documents
[o-du/l2.git] / src / 5gnrsch / sch_fcfs.c
index edfad66..28cc528 100644 (file)
@@ -41,6 +41,7 @@ File:     sch_fcfs.c
 #include "du_app_mac_inf.h"
 #include "mac_sch_interface.h"
 #include "sch.h"
+#include "sch_tmr.h"
 #include "sch_utils.h"
 #include "sch_fcfs.h"
 #ifdef NR_DRX 
@@ -1157,12 +1158,13 @@ void schFcfsScheduleSlot(SchCellCb *cell, SlotTimingInfo *slotInd, Inst schInst)
    bool           isMsg4Pending = false, isMsg4Scheduled = false;
    bool           isDlMsgPending = false, isDlMsgScheduled = false;
    bool           isUlGrantPending = false, isUlGrantScheduled = false;
+   bool           isNodeFreed = false;
 
    fcfsCell = (SchFcfsCellCb *)cell->schSpcCell;
    
    /* Select first UE in the linked list to be scheduled next */
    pendingUeNode = fcfsCell->ueToBeScheduled.first;
-   if(pendingUeNode)
+   while(pendingUeNode)
    {
       if(pendingUeNode->node)
       {
@@ -1214,6 +1216,7 @@ void schFcfsScheduleSlot(SchCellCb *cell, SlotTimingInfo *slotInd, Inst schInst)
             if(isRarScheduled || isMsg4Scheduled)
             {
                schFcfsRemoveUeFrmScheduleLst(cell, pendingUeNode);
+               isNodeFreed = true;
             }
             /* If RAR/MSG4 is pending but couldnt be scheduled then,
              * put this UE at the end of linked list to be scheduled later */
@@ -1318,9 +1321,23 @@ void schFcfsScheduleSlot(SchCellCb *cell, SlotTimingInfo *slotInd, Inst schInst)
             else
             {
                schFcfsRemoveUeFrmScheduleLst(cell, pendingUeNode);
+               isNodeFreed = true;
             }
          }
       }
+      if(cell->schDlSlotInfo[slotInd->slot]->prbAlloc.numPrbAlloc >= MAX_NUM_RB)
+      {
+        DU_LOG("\nINFO   -->  SCH: No PRB available to proceed with next UE");
+        return;     
+      }
+      if(isNodeFreed == false)
+      {
+         pendingUeNode= pendingUeNode->next;
+      }
+      else
+      {
+        pendingUeNode = fcfsCell->ueToBeScheduled.first;
+      }
    }
 }