fixed bug with multiple LCs in UL BSR
authorNicola Baldo <nbaldo@cttc.es>
Mon, 02 Jul 2012 11:34:21 +0200
changeset 8887 90cbd09c8ff6
parent 8886 c571f89be146
child 8888 d70ef2af2572
fixed bug with multiple LCs in UL BSR
src/lte/model/lte-ue-mac.cc
src/lte/model/pf-ff-mac-scheduler.cc
src/lte/model/rr-ff-mac-scheduler.cc
--- a/src/lte/model/lte-ue-mac.cc	Tue Jun 26 14:07:07 2012 +0200
+++ b/src/lte/model/lte-ue-mac.cc	Mon Jul 02 11:34:21 2012 +0200
@@ -292,16 +292,22 @@
   MacCeListElement_s bsr;
   bsr.m_rnti = m_rnti;
   bsr.m_macCeType = MacCeListElement_s::BSR;
-  // BSR
-  std::map <uint8_t, uint64_t>::iterator it;
-  NS_ASSERT_MSG (m_ulBsrReceived.size () <=4, " Too many LCs (max is 4)");
-  
+
+  // BSR is reported for each LCG. As a simplification, we consider that all LCs belong to the first LCG.
+  std::map <uint8_t, uint64_t>::iterator it;  
+  int queue = 0;
   for (it = m_ulBsrReceived.begin (); it != m_ulBsrReceived.end (); it++)
     {
-      int queue = (*it).second;
-      int index = BufferSizeLevelBsr::BufferSize2BsrId (queue);
-      bsr.m_macCeValue.m_bufferStatus.push_back (index);
+      queue += (*it).second;
+  
     }
+  int index = BufferSizeLevelBsr::BufferSize2BsrId (queue);
+  bsr.m_macCeValue.m_bufferStatus.push_back (index);
+  // FF API says that all 4 LCGs are always present
+  // we do so but reporting a 0 size for all other LCGs
+  bsr.m_macCeValue.m_bufferStatus.push_back (BufferSizeLevelBsr::BufferSize2BsrId (0));
+  bsr.m_macCeValue.m_bufferStatus.push_back (BufferSizeLevelBsr::BufferSize2BsrId (0));
+  bsr.m_macCeValue.m_bufferStatus.push_back (BufferSizeLevelBsr::BufferSize2BsrId (0));
 
   // create the feedback to eNB
   Ptr<BsrIdealControlMessage> msg = Create<BsrIdealControlMessage> ();
--- a/src/lte/model/pf-ff-mac-scheduler.cc	Tue Jun 26 14:07:07 2012 +0200
+++ b/src/lte/model/pf-ff-mac-scheduler.cc	Mon Jul 02 11:34:21 2012 +0200
@@ -1025,6 +1025,8 @@
     if ( params.m_macCeList.at (i).m_macCeType == MacCeListElement_s::BSR )
     {
       // buffer status report
+      // note that we only consider LCG 0, the other three LCGs are neglected
+      // this is consistent with the assumption in LteUeMac that the first LCG gathers all LCs
       uint16_t rnti = params.m_macCeList.at (i).m_rnti;
       it = m_ceBsrRxed.find (rnti);
       if (it == m_ceBsrRxed.end ())
@@ -1032,11 +1034,11 @@
         // create the new entry
         uint8_t bsrId = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0);
         int buffer = BufferSizeLevelBsr::BsrId2BufferSize (bsrId);
-        m_ceBsrRxed.insert ( std::pair<uint16_t, uint32_t > (rnti, buffer)); // only 1 buffer status is working now
+        m_ceBsrRxed.insert ( std::pair<uint16_t, uint32_t > (rnti, buffer)); 
       }
       else
       {
-        // update the CQI value
+        // update the buffer size value
         (*it).second = BufferSizeLevelBsr::BsrId2BufferSize (params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0));
       }
     }
--- a/src/lte/model/rr-ff-mac-scheduler.cc	Tue Jun 26 14:07:07 2012 +0200
+++ b/src/lte/model/rr-ff-mac-scheduler.cc	Mon Jul 02 11:34:21 2012 +0200
@@ -827,6 +827,8 @@
       if ( params.m_macCeList.at (i).m_macCeType == MacCeListElement_s::BSR )
         {
           // buffer status report
+          // note that we only consider LCG 0, the other three LCGs are neglected
+          // this is consistent with the assumption in LteUeMac that the first LCG gathers all LCs
           uint16_t rnti = params.m_macCeList.at (i).m_rnti;
           it = m_ceBsrRxed.find (rnti);
           if (it == m_ceBsrRxed.end ())
@@ -834,13 +836,12 @@
               // create the new entry
               uint8_t bsrId = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0);
               int buffer = BufferSizeLevelBsr::BsrId2BufferSize (bsrId);
-              m_ceBsrRxed.insert ( std::pair<uint16_t, uint32_t > (rnti, buffer)); // only 1 buffer status is working now
+              m_ceBsrRxed.insert ( std::pair<uint16_t, uint32_t > (rnti, buffer));
             }
           else
             {
-              // update the CQI value
+              // update the buffer size 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 ());
             }
         }
     }