[Epic-ID: ODUHIGH-517][Task-ID: ODUHIGH-540][SubTask-Id: ODUHIGH-549] Multi PDSCH...
[o-du/l2.git] / src / 5gnrsch / sch_fcfs.c
index 09e2c64..28cc528 100644 (file)
@@ -1158,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)
       {
@@ -1215,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 */
@@ -1319,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;
+      }
    }
 }