Update RR and PF scheduler for updating BSR queues avoiding overflows
authorMarco Miozzo <marco.miozzo@cttc.es>
Thu, 22 Dec 2011 17:59:01 +0100
changeset 8497 b06cd67bc6ba
parent 8496 8d1759a15c2e
child 8498 ae294058affc
Update RR and PF scheduler for updating BSR queues avoiding overflows
src/lte/model/pf-ff-mac-scheduler.cc
src/lte/model/rr-ff-mac-scheduler.cc
--- a/src/lte/model/pf-ff-mac-scheduler.cc	Thu Dec 22 17:56:49 2011 +0100
+++ b/src/lte/model/pf-ff-mac-scheduler.cc	Thu Dec 22 17:59:01 2011 +0100
@@ -1181,7 +1181,14 @@
   if (it!=m_ceBsrRxed.end ())
     {
 //       NS_LOG_DEBUG (this << " UE " << rnti << " size " << size << " BSR " << (*it).second);      
-      (*it).second -= size;
+      if ((*it).second >= size)
+        {
+          (*it).second -= size;
+        }
+      else
+        {
+          (*it).second = 0;
+        }
     }
   else
     {
--- a/src/lte/model/rr-ff-mac-scheduler.cc	Thu Dec 22 17:56:49 2011 +0100
+++ b/src/lte/model/rr-ff-mac-scheduler.cc	Thu Dec 22 17:59:01 2011 +0100
@@ -23,6 +23,7 @@
 
 #include "lte-amc.h"
 #include "rr-ff-mac-scheduler.h"
+#include <ns3/simulator.h>
 
 NS_LOG_COMPONENT_DEFINE ("RrFfMacScheduler");
 
@@ -816,6 +817,7 @@
             {
               // update the CQI value
               (*it).second = BufferSizeLevelBsr::BsrId2BufferSize (params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0));
+//               NS_LOG_DEBUG (this << " Update BSR with " << BufferSizeLevelBsr::BsrId2BufferSize (params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0)) << " at " << Simulator::Now ());
             }
         }
     }
@@ -1010,8 +1012,15 @@
   std::map <uint16_t,uint32_t>::iterator it = m_ceBsrRxed.find (rnti);
   if (it!=m_ceBsrRxed.end ())
     {
-//       NS_LOG_DEBUG (this << " UE " << rnti << " szie " << size << " BSR " << (*it).second);      
-      (*it).second -= size;
+//       NS_LOG_DEBUG (this << " Update RLC BSR UE " << rnti << " size " << size << " BSR " << (*it).second);      
+      if ((*it).second >= size)
+        {
+          (*it).second -= size;
+        }
+      else
+        {
+          (*it).second = 0;
+        }
     }
   else
     {