src/lte/model/rr-ff-mac-scheduler.cc
changeset 9610 7719bb199e8b
parent 9587 8f669a9d4719
child 9625 f058482ae3ee
--- a/src/lte/model/rr-ff-mac-scheduler.cc	Fri Dec 21 17:50:19 2012 +0100
+++ b/src/lte/model/rr-ff-mac-scheduler.cc	Thu Jan 03 16:34:21 2013 +0100
@@ -1345,9 +1345,9 @@
 
   // Divide the remaining resources equally among the active users starting from the subsequent one served last scheduling trigger
   uint16_t rbPerFlow = (m_cschedCellConfig.m_ulBandwidth) / (nflows + rntiAllocated.size ());
-  if (rbPerFlow == 0)
+  if (rbPerFlow < 3)
     {
-      rbPerFlow = 1;              // at least 1 rbg per flow (till available resource)
+      rbPerFlow = 3;  // at least 3 rbg per flow (till available resource) to ensure TxOpportunity >= 7 bytes
     }
   uint16_t rbAllocated = 0;
 
@@ -1389,6 +1389,12 @@
         {
           // limit to physical resources last resource assignment
           rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated;
+          // at least 3 rbg per flow to ensure TxOpportunity >= 7 bytes
+          if (rbPerFlow < 3)
+            {
+              // terminate allocation
+              rbPerFlow = 0;      
+            }
         }
       NS_LOG_INFO (this << " try to allocate " << (*it).first);
       UlDciListElement_s uldci;
@@ -1427,11 +1433,18 @@
             {
               // limit to physical resources last resource assignment
               rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated;
+              // at least 3 rbg per flow to ensure TxOpportunity >= 7 bytes
+              if (rbPerFlow < 3)
+                {
+                  // terminate allocation
+                  rbPerFlow = 0;                 
+                }
             }
         }
       if (!allocated)
         {
           // unable to allocate new resource: finish scheduling
+          m_nextRntiUl = (*it).first;
           if (ret.m_dciList.size () > 0)
             {
               m_schedSapUser->SchedUlConfigInd (ret);
@@ -1520,7 +1533,7 @@
           // restart from the first
           it = m_ceBsrRxed.begin ();
         }
-      if (rbAllocated == m_cschedCellConfig.m_ulBandwidth)
+      if ((rbAllocated == m_cschedCellConfig.m_ulBandwidth) || (rbPerFlow == 0))
         {
           // Stop allocation: no more PRBs
           m_nextRntiUl = (*it).first;