Introduced high priority to status PDU trasmission in case of reduced resource at LteUeMac
authorMarco Miozzo <marco.miozzo@cttc.es>
Tue, 18 Dec 2012 10:32:08 +0100
changeset 9571 2840bae9607f
parent 9570 fda36a257171
child 9572 e07415ca12c9
child 9573 0243c2781970
Introduced high priority to status PDU trasmission in case of reduced resource at LteUeMac
src/lte/model/lte-ue-mac.cc
src/lte/model/rr-ff-mac-scheduler.cc
--- a/src/lte/model/lte-ue-mac.cc	Tue Dec 18 10:31:08 2012 +0100
+++ b/src/lte/model/lte-ue-mac.cc	Tue Dec 18 10:32:08 2012 +0100
@@ -541,11 +541,20 @@
           // New transmission -> retrieve data from RLC
           std::map <uint8_t, LteMacSapProvider::ReportBufferStatusParameters>::iterator itBsr;
           uint16_t activeLcs = 0;
+          uint32_t statusPduMinSize = 0;
           for (itBsr = m_ulBsrReceived.begin (); itBsr != m_ulBsrReceived.end (); itBsr++)
             {
               if (((*itBsr).second.statusPduSize > 0) || ((*itBsr).second.retxQueueSize > 0) || ((*itBsr).second.txQueueSize > 0))
                 {
                   activeLcs++;
+                  if (((*itBsr).second.statusPduSize!=0)&&((*itBsr).second.statusPduSize < statusPduMinSize))
+                    {
+                      statusPduMinSize = (*itBsr).second.statusPduSize;
+                    }
+                  if (((*itBsr).second.statusPduSize!=0)&&(statusPduMinSize == 0))
+                    {
+                      statusPduMinSize = (*itBsr).second.statusPduSize;
+                    }
                 }
             }
           if (activeLcs == 0)
@@ -555,7 +564,18 @@
             }
           std::map <uint8_t, LcInfo>::iterator it;
           uint32_t bytesPerActiveLc = dci.m_tbSize / activeLcs;
-          NS_LOG_LOGIC (this << " UE: UL-CQI notified TxOpportunity of " << dci.m_tbSize << " => " << bytesPerActiveLc << " bytes per active LC");
+          bool statusPduPriority = false;
+          if ((statusPduMinSize != 0)&&(bytesPerActiveLc < statusPduMinSize))
+            {
+              // send only the status PDU which has highest priority
+              statusPduPriority = true;
+              NS_LOG_DEBUG (this << " Reduced resource -> send only Status, b ytes " << statusPduMinSize);
+              if (dci.m_tbSize < statusPduMinSize)
+                {
+                  NS_FATAL_ERROR ("Insufficient Tx Opportunity for sending a status message");
+                }
+            }
+          NS_LOG_LOGIC (this << " UE " << m_rnti << ": UL-CQI notified TxOpportunity of " << dci.m_tbSize << " => " << bytesPerActiveLc << " bytes per active LC");
           for (it = m_lcInfoMap.begin (); it!=m_lcInfoMap.end (); it++)
             {
               itBsr = m_ulBsrReceived.find ((*it).first);
@@ -564,40 +584,59 @@
                   ((*itBsr).second.retxQueueSize > 0) ||
                   ((*itBsr).second.txQueueSize > 0)) )
                 {
-                  uint32_t bytesForThisLc = bytesPerActiveLc;
-                  NS_LOG_LOGIC (this << "\t" << bytesPerActiveLc << " bytes to LC " << (uint32_t)(*it).first << " statusQueue " << (*itBsr).second.statusPduSize << " retxQueue" << (*itBsr).second.retxQueueSize << " txQueue" <<  (*itBsr).second.txQueueSize);
-                  if (((*itBsr).second.statusPduSize > 0) && (bytesForThisLc > (*itBsr).second.statusPduSize))
+                  if ((statusPduPriority) && ((*itBsr).second.statusPduSize == statusPduMinSize))
                     {
                       (*it).second.macSapUser->NotifyTxOpportunity ((*itBsr).second.statusPduSize, 0, 0);
-                      bytesForThisLc -= (*itBsr).second.statusPduSize;
+                      NS_LOG_LOGIC (this << "\t" << bytesPerActiveLc << " send  " << (*itBsr).second.statusPduSize << " status bytes to LC " << (uint32_t)(*it).first << " statusQueue " << (*itBsr).second.statusPduSize << " retxQueue" << (*itBsr).second.retxQueueSize << " txQueue" <<  (*itBsr).second.txQueueSize);
                       (*itBsr).second.statusPduSize = 0;
+                      break;
                     }
-                  if ((bytesForThisLc > 0) && (((*itBsr).second.retxQueueSize > 0) || ((*itBsr).second.txQueueSize > 0)))
+                  else
                     {
-                      if ((*itBsr).second.retxQueueSize > 0)
+                      uint32_t bytesForThisLc = bytesPerActiveLc;
+                      NS_LOG_LOGIC (this << "\t" << bytesPerActiveLc << " bytes to LC " << (uint32_t)(*it).first << " statusQueue " << (*itBsr).second.statusPduSize << " retxQueue" << (*itBsr).second.retxQueueSize << " txQueue" <<  (*itBsr).second.txQueueSize);
+                      if (((*itBsr).second.statusPduSize > 0) && (bytesForThisLc > (*itBsr).second.statusPduSize))
                         {
-                          (*it).second.macSapUser->NotifyTxOpportunity (bytesForThisLc, 0, 0);
-                          if ((*itBsr).second.retxQueueSize >= bytesForThisLc)
+                          (*it).second.macSapUser->NotifyTxOpportunity ((*itBsr).second.statusPduSize, 0, 0);
+                          bytesForThisLc -= (*itBsr).second.statusPduSize;
+                          (*itBsr).second.statusPduSize = 0;
+
+                        }
+                      else
+                        {
+                          if ((*itBsr).second.statusPduSize>bytesForThisLc)
                             {
-                              (*itBsr).second.retxQueueSize -= bytesForThisLc;
-                            }
-                          else
-                            {
-                              (*itBsr).second.retxQueueSize = 0;
+                              NS_FATAL_ERROR ("Insufficient Tx Opportunity for sending a status message");
                             }
                         }
-                      else if ((*itBsr).second.txQueueSize > 0)
+                      if ((bytesForThisLc > 0) && (((*itBsr).second.retxQueueSize > 0) || ((*itBsr).second.txQueueSize > 0)))
                         {
-                          (*it).second.macSapUser->NotifyTxOpportunity (bytesForThisLc, 0, 0);
-                          if ((*itBsr).second.txQueueSize >= bytesForThisLc - 2)
+                          if ((*itBsr).second.retxQueueSize > 0)
                             {
-                              (*itBsr).second.txQueueSize -= bytesForThisLc - 2;
+                              (*it).second.macSapUser->NotifyTxOpportunity (bytesForThisLc, 0, 0);
+                              if ((*itBsr).second.retxQueueSize >= bytesForThisLc)
+                                {
+                                  (*itBsr).second.retxQueueSize -= bytesForThisLc;
+                                }
+                              else
+                                {
+                                  (*itBsr).second.retxQueueSize = 0;
+                                }
                             }
-                          else
+                          else if ((*itBsr).second.txQueueSize > 0)
                             {
-                              (*itBsr).second.txQueueSize = 0;
+                              (*it).second.macSapUser->NotifyTxOpportunity (bytesForThisLc, 0, 0);
+                              if ((*itBsr).second.txQueueSize >= bytesForThisLc - 2)
+                                {
+                                  (*itBsr).second.txQueueSize -= bytesForThisLc - 2;
+                                }
+                              else
+                                {
+                                  (*itBsr).second.txQueueSize = 0;
+                                }
                             }
                         }
+                      NS_LOG_LOGIC (this << "\t" << bytesPerActiveLc << "\t new queues " << (uint32_t)(*it).first << " statusQueue " << (*itBsr).second.statusPduSize << " retxQueue" << (*itBsr).second.retxQueueSize << " txQueue" <<  (*itBsr).second.txQueueSize);
                     }
 
                 }
--- a/src/lte/model/rr-ff-mac-scheduler.cc	Tue Dec 18 10:31:08 2012 +0100
+++ b/src/lte/model/rr-ff-mac-scheduler.cc	Tue Dec 18 10:32:08 2012 +0100
@@ -400,7 +400,7 @@
     {
       if ((*it).m_rnti == params.m_rnti)
         {
-          NS_LOG_DEBUG (this << " Erase RNTI " << (*it).m_rnti << " LC " << (uint16_t)(*it).m_logicalChannelIdentity);
+          NS_LOG_INFO (this << " Erase RNTI " << (*it).m_rnti << " LC " << (uint16_t)(*it).m_logicalChannelIdentity);
           it = m_rlcBufferReq.erase (it);
         }
       else
@@ -581,7 +581,7 @@
             {
               // reset HARQ process
 
-              NS_LOG_DEBUG (this << " Reset HARQ proc " << i << " for RNTI " << (*itTimers).first);
+              NS_LOG_INFO (this << " Reset HARQ proc " << i << " for RNTI " << (*itTimers).first);
               std::map <uint16_t, DlHarqProcessesStatus_t>::iterator itStat = m_dlHarqProcessesStatus.find ((*itTimers).first);
               if (itStat == m_dlHarqProcessesStatus.end ())
                 {
@@ -980,7 +980,7 @@
   // Resource allocation type 0 (see sec 7.1.6.1 of 36.213)
 
   int rbgPerTb = (rbgNum - rbgAllocatedNum) / nTbs;
-  NS_LOG_DEBUG (this << " Flows to be transmitted " << nflows << " rbgPerTb " << rbgPerTb);
+  NS_LOG_INFO (this << " Flows to be transmitted " << nflows << " rbgPerTb " << rbgPerTb);
   if (rbgPerTb == 0)
     {
       rbgPerTb = 1;                // at least 1 rbg per TB (till available resource)
@@ -1104,13 +1104,13 @@
       uint32_t rbgMask = 0;
       uint16_t i = 0;
       NS_LOG_INFO (this << " DL - Allocate user " << newEl.m_rnti << " LCs " << (uint16_t)(*itLcRnti).second << " bytes " << tbSize << " mcs " << (uint16_t) newDci.m_mcs.at (0) << " harqId " << (uint16_t)newDci.m_harqProcess <<  " layers " << nLayer);
-      NS_LOG_DEBUG ("RBG:");
+      NS_LOG_INFO ("RBG:");
       while (i < rbgPerTb)
         {
           if (rbgMap.at (rbgAllocated) == false)
             {
               rbgMask = rbgMask + (0x1 << rbgAllocated);
-              NS_LOG_DEBUG ("\t " << rbgAllocated);
+              NS_LOG_INFO ("\t " << rbgAllocated);
               i++;
               rbgMap.at (rbgAllocated) = true;
             }
@@ -1326,6 +1326,7 @@
     {
       std::set <uint16_t>::iterator itRnti = rntiAllocated.find ((*it).first);
       // select UEs with queues not empty and not yet allocated for HARQ
+      NS_LOG_INFO (this << " UE " << (*it).first << " queue " << (*it).second);
       if (((*it).second > 0)&&(itRnti == rntiAllocated.end ()))
         {
           nflows++;
@@ -1389,7 +1390,7 @@
           // limit to physical resources last resource assignment
           rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated;
         }
-      NS_LOG_DEBUG (this << " try to allocate " << (*it).first);
+      NS_LOG_INFO (this << " try to allocate " << (*it).first);
       UlDciListElement_s uldci;
       uldci.m_rnti = (*it).first;
       uldci.m_rbLen = rbPerFlow;
@@ -1415,7 +1416,7 @@
                   rbMap.at (j) = true;
                   // store info on allocation for managing ul-cqi interpretation
                   rbgAllocationMap.at (j) = (*it).first;
-                  NS_LOG_DEBUG ("\t " << j);
+                  NS_LOG_INFO ("\t " << j);
                 }
               rbAllocated += rbPerFlow;
               allocated = true;
@@ -1472,7 +1473,7 @@
                   // restart from the first
                   it = m_ceBsrRxed.begin ();
                 }
-              NS_LOG_DEBUG (this << " CQI = 0");
+              NS_LOG_INFO (this << " UE discarded for CQI = 0");
               continue; // CQI == 0 means "out of range" (see table 7.2.3-1 of 36.213)
             }
           uldci.m_mcs = m_amc->GetMcsFromCqi (cqi);
@@ -1529,6 +1530,7 @@
   while (((*it).first != m_nextRntiUl)&&(rbPerFlow!=0));
 
   m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> > (params.m_sfnSf, rbgAllocationMap));
+
   m_schedSapUser->SchedUlConfigInd (ret);
   return;
 }
@@ -1580,13 +1582,13 @@
             {
               // create the new entry
               m_ceBsrRxed.insert ( std::pair<uint16_t, uint32_t > (rnti, buffer));
-              NS_LOG_INFO (this << " Insert RNTI " << rnti);
+              NS_LOG_INFO (this << " Insert RNTI " << rnti << " queue " << buffer);
             }
           else
             {
               // update the buffer size value
               (*it).second = buffer;
-              NS_LOG_INFO (this << " Update RNTI " << rnti);
+              NS_LOG_INFO (this << " Update RNTI " << rnti << " queue " << buffer);
             }
         }
     }