src/lte/model/lte-ue-mac.cc
changeset 8671 8d0f6849e90c
parent 8496 8d1759a15c2e
child 8672 d02df5f59a0b
--- a/src/lte/model/lte-ue-mac.cc	Mon Mar 05 11:48:15 2012 +0100
+++ b/src/lte/model/lte-ue-mac.cc	Wed Mar 07 18:07:35 2012 +0100
@@ -258,7 +258,7 @@
 {
   NS_LOG_FUNCTION (this);
   
-  std::map <uint8_t, long uint>::iterator it;
+  std::map <uint8_t, uint64_t>::iterator it;
   
   
   it = m_ulBsrReceived.find (params.lcid);
@@ -269,7 +269,7 @@
     }
   else
     {
-      m_ulBsrReceived.insert (std::pair<uint8_t, long uint> (params.lcid, params.txQueueSize + params.retxQueueSize + params.statusPduSize));
+      m_ulBsrReceived.insert (std::pair<uint8_t, uint64_t> (params.lcid, params.txQueueSize + params.retxQueueSize + params.statusPduSize));
     }
   m_freshUlBsr = true;
 }
@@ -287,7 +287,7 @@
   bsr.m_rnti = m_rnti;
   bsr.m_macCeType = MacCeListElement_s::BSR;
   // BSR
-  std::map <uint8_t, long uint>::iterator it;
+  std::map <uint8_t, uint64_t>::iterator it;
   NS_ASSERT_MSG (m_ulBsrReceived.size () <=4, " Too many LCs (max is 4)");
   
   for (it = m_ulBsrReceived.begin (); it != m_ulBsrReceived.end (); it++)
@@ -351,9 +351,9 @@
     {
       Ptr<UlDciIdealControlMessage> msg2 = DynamicCast<UlDciIdealControlMessage> (msg);
       UlDciListElement_s dci = msg2->GetDci ();
-      std::map <uint8_t, long uint>::iterator itBsr;
+      std::map <uint8_t, uint64_t>::iterator itBsr;
       NS_ASSERT_MSG (m_ulBsrReceived.size () <=4, " Too many LCs (max is 4)");
-      int activeLcs = 0;
+      uint16_t activeLcs = 0;
       for (itBsr = m_ulBsrReceived.begin (); itBsr != m_ulBsrReceived.end (); itBsr++)
         {
           if ((*itBsr).second > 0)
@@ -375,7 +375,14 @@
             {
               NS_LOG_FUNCTION (this << "\t" << dci.m_tbSize / m_macSapUserMap.size () << " bytes to LC " << (uint16_t)(*it).first << " queue " << (*itBsr).second);
               (*it).second->NotifyTxOpportunity (dci.m_tbSize / activeLcs);
-              (*itBsr).second -= dci.m_tbSize / activeLcs;
+              if ((*itBsr).second >=  dci.m_tbSize / activeLcs)
+                {
+                  (*itBsr).second -= dci.m_tbSize / activeLcs;
+                }
+              else
+                {
+                  (*itBsr).second = 0;
+                }
             }
         }