From 690fb3f7b658bd3bb367ce0377c08758b8cb74e1 Mon Sep 17 00:00:00 2001 From: Marco Miozzo Date: Tue, 6 Nov 2012 17:42:40 +0100 Subject: [PATCH] Run check-style and polish logs on RR and PF schedulers --- src/lte/model/pf-ff-mac-scheduler.cc | 438 +++++++++++----------- src/lte/model/pf-ff-mac-scheduler.h | 30 +- src/lte/model/rr-ff-mac-scheduler.cc | 527 +++++++++++++-------------- src/lte/model/rr-ff-mac-scheduler.h | 32 +- 4 files changed, 496 insertions(+), 531 deletions(-) diff --git a/src/lte/model/pf-ff-mac-scheduler.cc b/src/lte/model/pf-ff-mac-scheduler.cc index 00d476682..52532460a 100644 --- a/src/lte/model/pf-ff-mac-scheduler.cc +++ b/src/lte/model/pf-ff-mac-scheduler.cc @@ -19,7 +19,7 @@ */ #ifdef __FreeBSD__ -#define log2(x) (log(x) / M_LN2) +#define log2(x) (log (x) / M_LN2) #endif /* __FreeBSD__ */ #include @@ -256,11 +256,11 @@ PfFfMacScheduler::GetTypeId (void) MakeUintegerAccessor (&PfFfMacScheduler::m_cqiTimersThreshold), MakeUintegerChecker ()) .AddAttribute ("HarqEnabled", - "Activate/Deactivate the HARQ [by default is active].", - BooleanValue (true), - MakeBooleanAccessor (&PfFfMacScheduler::m_harqOn), - MakeBooleanChecker ()) - ; + "Activate/Deactivate the HARQ [by default is active].", + BooleanValue (true), + MakeBooleanAccessor (&PfFfMacScheduler::m_harqOn), + MakeBooleanChecker ()) + ; return tid; } @@ -307,7 +307,7 @@ PfFfMacScheduler::DoCschedUeConfigReq (const struct FfMacCschedSapProvider::Csch { NS_LOG_FUNCTION (this << " RNTI " << params.m_rnti << " txMode " << (uint16_t)params.m_transmissionMode); std::map ::iterator it = m_uesTxMode.find (params.m_rnti); - if (it==m_uesTxMode.end ()) + if (it == m_uesTxMode.end ()) { m_uesTxMode.insert (std::pair (params.m_rnti, params.m_transmissionMode)); // generate HARQ buffers @@ -444,7 +444,7 @@ PfFfMacScheduler::GetRbgSize (int dlbandwidth) } -int +int PfFfMacScheduler::LcActivePerFlow (uint16_t rnti) { std::map ::iterator it; @@ -473,12 +473,12 @@ PfFfMacScheduler::HarqProcessAvailability (uint16_t rnti) NS_LOG_FUNCTION (this << rnti); std::map ::iterator it = m_dlHarqCurrentProcessId.find (rnti); - if (it==m_dlHarqCurrentProcessId.end ()) + if (it == m_dlHarqCurrentProcessId.end ()) { NS_FATAL_ERROR ("No Process Id found for this RNTI " << rnti); } std::map ::iterator itStat = m_dlHarqProcessesStatus.find (rnti); - if (itStat==m_dlHarqProcessesStatus.end ()) + if (itStat == m_dlHarqProcessesStatus.end ()) { NS_FATAL_ERROR ("No Process Id Statusfound for this RNTI " << rnti); } @@ -486,9 +486,9 @@ PfFfMacScheduler::HarqProcessAvailability (uint16_t rnti) do { i = (i + 1) % HARQ_PROC_NUM; - // NS_LOG_DEBUG (this << " check i " << (uint16_t)i << " stat " << (uint16_t)(*itStat).second.at (i)); - } while ( ((*itStat).second.at (i)!=0)&&(i!=(*it).second)); - if ((*itStat).second.at (i)==0) + } + while ( ((*itStat).second.at (i) != 0)&&(i != (*it).second)); + if ((*itStat).second.at (i) == 0) { return (true); } @@ -510,14 +510,14 @@ PfFfMacScheduler::UpdateHarqProcessId (uint16_t rnti) return (0); } - + std::map ::iterator it = m_dlHarqCurrentProcessId.find (rnti); - if (it==m_dlHarqCurrentProcessId.end ()) + if (it == m_dlHarqCurrentProcessId.end ()) { NS_FATAL_ERROR ("No Process Id found for this RNTI " << rnti); } std::map ::iterator itStat = m_dlHarqProcessesStatus.find (rnti); - if (itStat==m_dlHarqProcessesStatus.end ()) + if (itStat == m_dlHarqProcessesStatus.end ()) { NS_FATAL_ERROR ("No Process Id Statusfound for this RNTI " << rnti); } @@ -525,9 +525,9 @@ PfFfMacScheduler::UpdateHarqProcessId (uint16_t rnti) do { i = (i + 1) % HARQ_PROC_NUM; - // NS_LOG_DEBUG (this << " check i " << (uint16_t)i << " stat " << (uint16_t)(*itStat).second.at (i)); - } while ( ((*itStat).second.at (i)!=0)&&(i!=(*it).second)); - if ((*itStat).second.at (i)==0) + } + while ( ((*itStat).second.at (i) != 0)&&(i != (*it).second)); + if ((*itStat).second.at (i) == 0) { (*it).second = i; (*itStat).second.at (i) = 1; @@ -536,7 +536,7 @@ PfFfMacScheduler::UpdateHarqProcessId (uint16_t rnti) { NS_FATAL_ERROR ("No HARQ process available for RNTI " << rnti << " check before update with HarqProcessAvailability"); } - + return ((*it).second); } @@ -548,57 +548,56 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched // API generated by RLC for triggering the scheduling of a DL subframe - // evaluate the relative channel quality indicator for each UE per each RBG + // evaluate the relative channel quality indicator for each UE per each RBG // (since we are using allocation type 0 the small unit of allocation is RBG) // Resource allocation type 0 (see sec 7.1.6.1 of 36.213) - + RefreshDlCqiMaps (); - + int rbgSize = GetRbgSize (m_cschedCellConfig.m_dlBandwidth); int rbgNum = m_cschedCellConfig.m_dlBandwidth / rbgSize; std::map > allocationMap; // RBs map per RNTI std::vector rbgMap; // global RBGs map uint16_t rbgAllocatedNum = 0; std::set rntiAllocated; - rbgMap.resize (m_cschedCellConfig.m_dlBandwidth/rbgSize, false); + rbgMap.resize (m_cschedCellConfig.m_dlBandwidth / rbgSize, false); FfMacSchedSapUser::SchedDlConfigIndParameters ret; - - + + // Process DL HARQ feedback // retrieve past HARQ retx buffered - if (m_dlInfoListBuffered.size ()>0) + if (m_dlInfoListBuffered.size () > 0) { - if (params.m_dlInfoList.size ()>0) + if (params.m_dlInfoList.size () > 0) { - NS_LOG_DEBUG (this << " RECEIVED DL-HARQ"); + NS_LOG_INFO (this << " Received DL-HARQ feedback"); m_dlInfoListBuffered.insert (m_dlInfoListBuffered.end (), params.m_dlInfoList.begin (), params.m_dlInfoList.end ()); } } else { - if (params.m_dlInfoList.size ()>0) + if (params.m_dlInfoList.size () > 0) { m_dlInfoListBuffered = params.m_dlInfoList; } } if (m_harqOn == false) { - // Ignore HARQ feedbacks + // Ignore HARQ feedback m_dlInfoListBuffered.clear (); - NS_LOG_DEBUG (this << " HARQ OFF"); } std::vector dlInfoListUntxed; for (uint8_t i = 0; i < m_dlInfoListBuffered.size (); i++) { std::set ::iterator itRnti = rntiAllocated.find (m_dlInfoListBuffered.at (i).m_rnti); - if (itRnti!=rntiAllocated.end ()) + if (itRnti != rntiAllocated.end ()) { // RNTI already allocated for retx continue; } uint8_t nLayers = m_dlInfoListBuffered.at (i).m_harqStatus.size (); std::vector retx; - NS_LOG_DEBUG (this << " Processing DLHARQ-FEEDBACK"); + NS_LOG_INFO (this << " Processing DLHARQ feedback"); if (nLayers == 1) { retx.push_back (m_dlInfoListBuffered.at (i).m_harqStatus.at (0) == DlInfoListElement_s::NACK); @@ -614,16 +613,16 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched // retrieve HARQ process information uint16_t rnti = m_dlInfoListBuffered.at (i).m_rnti; uint8_t harqId = m_dlInfoListBuffered.at (i).m_harqProcessId; - NS_LOG_DEBUG (this << " HARQ retx RNTI " << rnti << " harqId " << (uint16_t)harqId); + NS_LOG_INFO (this << " HARQ retx RNTI " << rnti << " harqId " << (uint16_t)harqId); std::map ::iterator itHarq = m_dlHarqProcessesDciBuffer.find (rnti); - if (itHarq==m_dlHarqProcessesDciBuffer.end ()) + if (itHarq == m_dlHarqProcessesDciBuffer.end ()) { NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << rnti); } - + DlDciListElement_s dci = (*itHarq).second.at (harqId); int rv = 0; - if (dci.m_rv.size ()==1) + if (dci.m_rv.size () == 1) { rv = dci.m_rv.at (0); } @@ -631,19 +630,19 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched { rv = (dci.m_rv.at (0) > dci.m_rv.at (1) ? dci.m_rv.at (0) : dci.m_rv.at (1)); } - + if (rv == 3) { // maximum number of retx reached -> drop process - NS_LOG_DEBUG ("Max number of retransmissions reached -> drop process"); + NS_LOG_INFO ("Maximum number of retransmissions reached -> drop process"); std::map ::iterator it = m_dlHarqProcessesStatus.find (rnti); - if (it==m_dlHarqProcessesStatus.end ()) + if (it == m_dlHarqProcessesStatus.end ()) { - NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << m_dlInfoListBuffered.at (i).m_rnti); + NS_FATAL_ERROR ("No info found in HARQ buffer for UE " << m_dlInfoListBuffered.at (i).m_rnti); } (*it).second.at (harqId) = 0; std::map ::iterator itRlcPdu = m_dlHarqProcessesRlcPduListBuffer.find (rnti); - if (itRlcPdu==m_dlHarqProcessesRlcPduListBuffer.end ()) + if (itRlcPdu == m_dlHarqProcessesRlcPduListBuffer.end ()) { NS_FATAL_ERROR ("Unable to find RlcPdcList in HARQ buffer for RNTI " << m_dlInfoListBuffered.at (i).m_rnti); } @@ -657,25 +656,20 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched // translate the DCI to Spectrum framework std::vector dciRbg; uint32_t mask = 0x1; - NS_LOG_DEBUG ("Original RBGs " << dci.m_rbBitmap << " rnti " << dci.m_rnti); + NS_LOG_INFO ("Original RBGs " << dci.m_rbBitmap << " rnti " << dci.m_rnti); for (int j = 0; j < 32; j++) { if (((dci.m_rbBitmap & mask) >> j) == 1) { dciRbg.push_back (j); - NS_LOG_DEBUG ("\t"< rbgMapCopy = rbgMap; - while ((j < dciRbg.size ())&&(startRbg!=rbgId)) + while ((j < dciRbg.size ())&&(startRbg != rbgId)) { if (rbgMapCopy.at (rbgId) == false) { @@ -718,24 +712,23 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched for (uint16_t k = 0; k < dciRbg.size (); k++) { rbgMask = rbgMask + (0x1 << dciRbg.at (k)); - // NS_LOG_DEBUG (this << " Allocated PRB " << (*itMap).second.at (k)); rbgAllocatedNum++; } dci.m_rbBitmap = rbgMask; rbgMap = rbgMapCopy; - NS_LOG_DEBUG (this << " Move retx in RBGs " << dciRbg.size ()); + NS_LOG_INFO (this << " Move retx in RBGs " << dciRbg.size ()); } else { // HARQ retx cannot be performed on this TTI -> store it dlInfoListUntxed.push_back (params.m_dlInfoList.at (i)); - NS_LOG_DEBUG (this << " No resource for this retx -> buffer it"); + NS_LOG_INFO (this << " No resource for this retx -> buffer it"); } - } + } // retrieve RLC PDU list for retx TBsize and update DCI BuildDataListElement_s newEl; std::map ::iterator itRlcPdu = m_dlHarqProcessesRlcPduListBuffer.find (rnti); - if (itRlcPdu==m_dlHarqProcessesRlcPduListBuffer.end ()) + if (itRlcPdu == m_dlHarqProcessesRlcPduListBuffer.end ()) { NS_FATAL_ERROR ("Unable to find RlcPdcList in HARQ buffer for RNTI " << rnti); } @@ -750,15 +743,14 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched dci.m_rv.push_back (0); dci.m_mcs.push_back (0); dci.m_tbsSize.push_back (0); - NS_LOG_DEBUG (this << " layer " << (uint16_t)j << " no txed (MIMO transition)"); - + NS_LOG_INFO (this << " layer " << (uint16_t)j << " no txed (MIMO transition)"); } else { dci.m_ndi.at (j) = 0; - dci.m_rv.at (j) ++; + dci.m_rv.at (j)++; (*itHarq).second.at (harqId).m_rv.at (j)++; - NS_LOG_DEBUG (this << " layer " << (uint16_t)j << " RV " << (uint16_t)dci.m_rv.at (j)); + NS_LOG_INFO (this << " layer " << (uint16_t)j << " RV " << (uint16_t)dci.m_rv.at (j)); } } else @@ -768,7 +760,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched dci.m_rv.at (j) = 0; dci.m_mcs.at (j) = 0; dci.m_tbsSize.at (j) = 0; - NS_LOG_DEBUG (this << " layer " << (uint16_t)j << " no retx"); + NS_LOG_INFO (this << " layer " << (uint16_t)j << " no retx"); } } for (uint16_t k = 0; k < (*itRlcPdu).second.at (0).at (dci.m_harqProcess).size (); k++) @@ -785,7 +777,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched } } - if (rlcPduListPerLc.size ()>0) + if (rlcPduListPerLc.size () > 0) { newEl.m_rlcPduList.push_back (rlcPduListPerLc); } @@ -799,15 +791,15 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched else { // update HARQ process status - NS_LOG_DEBUG (this << " RR HARQ ACK UE " << m_dlInfoListBuffered.at (i).m_rnti); + NS_LOG_INFO (this << " HARQ received ACK for UE " << m_dlInfoListBuffered.at (i).m_rnti); std::map ::iterator it = m_dlHarqProcessesStatus.find (m_dlInfoListBuffered.at (i).m_rnti); - if (it==m_dlHarqProcessesStatus.end ()) + if (it == m_dlHarqProcessesStatus.end ()) { NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << m_dlInfoListBuffered.at (i).m_rnti); } (*it).second.at (m_dlInfoListBuffered.at (i).m_harqProcessId) = 0; std::map ::iterator itRlcPdu = m_dlHarqProcessesRlcPduListBuffer.find (m_dlInfoListBuffered.at (i).m_rnti); - if (itRlcPdu==m_dlHarqProcessesRlcPduListBuffer.end ()) + if (itRlcPdu == m_dlHarqProcessesRlcPduListBuffer.end ()) { NS_FATAL_ERROR ("Unable to find RlcPdcList in HARQ buffer for RNTI " << m_dlInfoListBuffered.at (i).m_rnti); } @@ -819,13 +811,13 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched } m_dlInfoListBuffered.clear (); m_dlInfoListBuffered = dlInfoListUntxed; - - - + + + for (int i = 0; i < rbgNum; i++) { -// NS_LOG_DEBUG (this << " ALLOCATION for RBG " << i << " of " << rbgNum); - if (rbgMap.at (i)==false) + NS_LOG_INFO (this << " ALLOCATION for RBG " << i << " of " << rbgNum); + if (rbgMap.at (i) == false) { std::map ::iterator it; std::map ::iterator itMax = m_flowStatsDl.end (); @@ -842,7 +834,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched itCqi = m_a30CqiRxed.find ((*it).first); std::map ::iterator itTxMode; itTxMode = m_uesTxMode.find ((*it).first); - if (itTxMode == m_uesTxMode.end()) + if (itTxMode == m_uesTxMode.end ()) { NS_FATAL_ERROR ("No Transmission Mode info on user " << (*it).first); } @@ -850,7 +842,6 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched std::vector sbCqi; if (itCqi == m_a30CqiRxed.end ()) { - // NS_LOG_DEBUG (this << " No DL-CQI for this UE " << (*it).first); for (uint8_t k = 0; k < nLayer; k++) { sbCqi.push_back (1); // start with lowest value @@ -859,27 +850,25 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched else { sbCqi = (*itCqi).second.m_higherLayerSelected.at (i).m_sbCqi; - // NS_LOG_INFO (this << " CQI " << (uint32_t)cqi); } - uint8_t cqi1 = sbCqi.at(0); + uint8_t cqi1 = sbCqi.at (0); uint8_t cqi2 = 1; if (sbCqi.size () > 1) { - cqi2 = sbCqi.at(1); + cqi2 = sbCqi.at (1); } - + if ((cqi1 > 0)||(cqi2 > 0)) // CQI == 0 means "out of range" (see table 7.2.3-1 of 36.213) { - // NS_LOG_DEBUG (this << " LC active " << LcActivePerFlow ((*it).first)); if (LcActivePerFlow ((*it).first) > 0) { // this UE has data to transmit double achievableRate = 0.0; - for (uint8_t k = 0; k < nLayer; k++) + uint8_t mcs = 0; + for (uint8_t k = 0; k < nLayer; k++) { - uint8_t mcs = 0; if (sbCqi.size () > k) - { + { mcs = m_amc->GetMcsFromCqi (sbCqi.at (k)); } else @@ -887,11 +876,11 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched // no info on this subband -> worst MCS mcs = 0; } - achievableRate += ((m_amc->GetTbSizeFromMcs (mcs, rbgSize) / 8) / 0.001); // = TB size / TTI + achievableRate += ((m_amc->GetTbSizeFromMcs (mcs, rbgSize) / 8) / 0.001); // = TB size / TTI } - + double rcqi = achievableRate / (*it).second.lastAveragedThroughput; - // NS_LOG_DEBUG (this << " RNTI " << (*it).first << " MCS " << (uint32_t)mcs << " achievableRate " << achievableRate << " avgThr " << (*it).second.lastAveragedThroughput << " RCQI " << rcqi); + NS_LOG_INFO (this << " RNTI " << (*it).first << " MCS " << (uint32_t)mcs << " achievableRate " << achievableRate << " avgThr " << (*it).second.lastAveragedThroughput << " RCQI " << rcqi); if (rcqi > rcqiMax) { @@ -905,7 +894,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched if (itMax == m_flowStatsDl.end ()) { // no UE available for this RB - NS_LOG_DEBUG (this << " no UE found"); + NS_LOG_INFO (this << " any UE found"); } else { @@ -923,7 +912,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched { (*itMap).second.push_back (i); } - // NS_LOG_DEBUG (this << " UE assigned " << (*itMax).first); + NS_LOG_INFO (this << " UE assigned " << (*itMax).first); } } // end for RBG free } // end for RBGs @@ -949,13 +938,13 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched newDci.m_harqProcess = UpdateHarqProcessId ((*itMap).first); uint16_t lcActives = LcActivePerFlow ((*itMap).first); -// NS_LOG_DEBUG (this << "Allocate user " << newEl.m_rnti << " rbg " << lcActives); + NS_LOG_INFO (this << "Allocate user " << newEl.m_rnti << " rbg " << lcActives); uint16_t RgbPerRnti = (*itMap).second.size (); std::map ::iterator itCqi; itCqi = m_a30CqiRxed.find ((*itMap).first); std::map ::iterator itTxMode; itTxMode = m_uesTxMode.find ((*itMap).first); - if (itTxMode == m_uesTxMode.end()) + if (itTxMode == m_uesTxMode.end ()) { NS_FATAL_ERROR ("No Transmission Mode info on user " << (*itMap).first); } @@ -967,10 +956,10 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched { if ((*itCqi).second.m_higherLayerSelected.size () > (*itMap).second.at (k)) { -// NS_LOG_DEBUG (this << " RBG " << (*itMap).second.at (k) << " CQI " << (uint16_t)((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.at (0)) ); - for (uint8_t j = 0; j < nLayer; j++) + NS_LOG_INFO (this << " RBG " << (*itMap).second.at (k) << " CQI " << (uint16_t)((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.at (0)) ); + for (uint8_t j = 0; j < nLayer; j++) { - if ((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.size ()> j) + if ((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.size () > j) { if (((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.at (j)) < worstCqi.at (j)) { @@ -1000,14 +989,17 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched worstCqi.at (j) = 1; // try with lowest MCS in RBG with no info on channel } } -// NS_LOG_DEBUG (this << " CQI " << (uint16_t)worstCqi); + for (uint8_t j = 0; j < nLayer; j++) + { + NS_LOG_INFO (this << " Layer " << (uint16_t)j << " CQI selected " << (uint16_t)worstCqi.at (j)); + } uint32_t bytesTxed = 0; for (uint8_t j = 0; j < nLayer; j++) { newDci.m_mcs.push_back (m_amc->GetMcsFromCqi (worstCqi.at (j))); int tbSize = (m_amc->GetTbSizeFromMcs (newDci.m_mcs.at (j), RgbPerRnti * rbgSize) / 8); // (size of TB in bytes according to table 7.1.7.2.1-1 of 36.213) newDci.m_tbsSize.push_back (tbSize); - NS_LOG_DEBUG (this << " MCS " << m_amc->GetMcsFromCqi (worstCqi.at (j))); + NS_LOG_INFO (this << " Layer " << (uint16_t)j << " MCS selected" << m_amc->GetMcsFromCqi (worstCqi.at (j))); bytesTxed += tbSize; } @@ -1017,7 +1009,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched for (uint16_t k = 0; k < (*itMap).second.size (); k++) { rbgMask = rbgMask + (0x1 << (*itMap).second.at (k)); -// NS_LOG_DEBUG (this << " Allocated PRB " << (*itMap).second.at (k)); + NS_LOG_INFO (this << " Allocated RBG " << (*itMap).second.at (k)); } newDci.m_rbBitmap = rbgMask; // (32 bit bitmap see 7.1.6 of 36.213) @@ -1025,10 +1017,10 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched std::map ::iterator itBufReq; for (itBufReq = m_rlcBufferReq.begin (); itBufReq != m_rlcBufferReq.end (); itBufReq++) { - if (((*itBufReq).first.m_rnti == (*itMap).first) && - (((*itBufReq).second.m_rlcTransmissionQueueSize > 0) - || ((*itBufReq).second.m_rlcRetransmissionQueueSize > 0) - || ((*itBufReq).second.m_rlcStatusPduSize > 0) )) + if (((*itBufReq).first.m_rnti == (*itMap).first) + && (((*itBufReq).second.m_rlcTransmissionQueueSize > 0) + || ((*itBufReq).second.m_rlcRetransmissionQueueSize > 0) + || ((*itBufReq).second.m_rlcStatusPduSize > 0) )) { std::vector newRlcPduLe; for (uint8_t j = 0; j < nLayer; j++) @@ -1036,14 +1028,14 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched RlcPduListElement_s newRlcEl; newRlcEl.m_logicalChannelIdentity = (*itBufReq).first.m_lcId; newRlcEl.m_size = newDci.m_tbsSize.at (j) / lcActives; - NS_LOG_DEBUG (this << " LCID " << (uint32_t) newRlcEl.m_logicalChannelIdentity << " size " << newRlcEl.m_size << " layer " << (uint16_t)j); + NS_LOG_INFO (this << " LCID " << (uint32_t) newRlcEl.m_logicalChannelIdentity << " size " << newRlcEl.m_size << " layer " << (uint16_t)j); newRlcPduLe.push_back (newRlcEl); UpdateDlRlcBufferInfo (newDci.m_rnti, newRlcEl.m_logicalChannelIdentity, newRlcEl.m_size); if (m_harqOn == true) { // store RLC PDU list for HARQ std::map ::iterator itRlcPdu = m_dlHarqProcessesRlcPduListBuffer.find ((*itMap).first); - if (itRlcPdu==m_dlHarqProcessesRlcPduListBuffer.end ()) + if (itRlcPdu == m_dlHarqProcessesRlcPduListBuffer.end ()) { NS_FATAL_ERROR ("Unable to find RlcPdcList in HARQ buffer for RNTI " << (*itMap).first); } @@ -1064,18 +1056,18 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched } newEl.m_dci = newDci; - + if (m_harqOn == true) { // store DCI for HARQ std::map ::iterator itDci = m_dlHarqProcessesDciBuffer.find (newEl.m_rnti); - if (itDci==m_dlHarqProcessesDciBuffer.end ()) + if (itDci == m_dlHarqProcessesDciBuffer.end ()) { NS_FATAL_ERROR ("Unable to find RNTI entry in DCI HARQ buffer for RNTI " << newEl.m_rnti); } (*itDci).second.at (newDci.m_harqProcess) = newDci; } - + // ...more parameters -> ingored in this version ret.m_buildDataList.push_back (newEl); @@ -1085,13 +1077,13 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched if (it != m_flowStatsDl.end ()) { (*it).second.lastTtiBytesTrasmitted = bytesTxed; -// NS_LOG_DEBUG (this << " UE bytes txed " << (*it).second.lastTtiBytesTrasmitted); + NS_LOG_INFO (this << " UE total bytes txed " << (*it).second.lastTtiBytesTrasmitted); } else { - NS_LOG_DEBUG (this << " No Stats for this allocated UE"); + NS_FATAL_ERROR (this << " No Stats for this allocated UE"); } itMap++; @@ -1100,19 +1092,20 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched // update UEs stats + NS_LOG_INFO (this << " Update UEs statistics"); for (itStats = m_flowStatsDl.begin (); itStats != m_flowStatsDl.end (); itStats++) { (*itStats).second.totalBytesTransmitted += (*itStats).second.lastTtiBytesTrasmitted; // update average throughput (see eq. 12.3 of Sec 12.3.1.2 of LTE – The UMTS Long Term Evolution, Ed Wiley) (*itStats).second.lastAveragedThroughput = ((1.0 - (1.0 / m_timeWindow)) * (*itStats).second.lastAveragedThroughput) + ((1.0 / m_timeWindow) * (double)((*itStats).second.lastTtiBytesTrasmitted / 0.001)); -// NS_LOG_DEBUG (this << " UE tot bytes " << (*itStats).second.totalBytesTransmitted); -// NS_LOG_DEBUG (this << " UE avg thr " << (*itStats).second.lastAveragedThroughput); + NS_LOG_INFO (this << " UE total bytes " << (*itStats).second.totalBytesTransmitted); + NS_LOG_INFO (this << " UE average throughput " << (*itStats).second.lastAveragedThroughput); (*itStats).second.lastTtiBytesTrasmitted = 0; } m_schedSapUser->SchedDlConfigInd (ret); - + return; } @@ -1220,9 +1213,9 @@ void PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::SchedUlTriggerReqParameters& params) { NS_LOG_FUNCTION (this << " UL - Frame no. " << (params.m_sfnSf >> 4) << " subframe no. " << (0xF & params.m_sfnSf)); - + RefreshUlCqiMaps (); - + // Generate RBs map FfMacSchedSapUser::SchedUlConfigIndParameters ret; std::vector rbMap; @@ -1230,42 +1223,42 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched std::set rntiAllocated; std::vector rbgAllocationMap; rbgAllocationMap.resize (m_cschedCellConfig.m_ulBandwidth, 0); - + rbMap.resize (m_cschedCellConfig.m_ulBandwidth, false); - - + + // Process UL HARQ feedback // update UL HARQ proc id std::map ::iterator itProcId; - for (itProcId = m_ulHarqCurrentProcessId.begin (); itProcId!= m_ulHarqCurrentProcessId.end (); itProcId++) + for (itProcId = m_ulHarqCurrentProcessId.begin (); itProcId != m_ulHarqCurrentProcessId.end (); itProcId++) { (*itProcId).second = ((*itProcId).second + 1) % HARQ_PROC_NUM; } for (uint8_t i = 0; i < params.m_ulInfoList.size (); i++) { - if (params.m_ulInfoList.at (i).m_receptionStatus==UlInfoListElement_s::NotOk) + if (params.m_ulInfoList.at (i).m_receptionStatus == UlInfoListElement_s::NotOk) { // retx correspondent block: retrieve the UL-DCI uint16_t rnti = params.m_ulInfoList.at (i).m_rnti; uint8_t harqId = (uint8_t)((*itProcId).second - HARQ_PERIOD) % HARQ_PROC_NUM; - NS_LOG_DEBUG (this << " UL-HARQ retx RNTI " << rnti << " harqId " << (uint16_t)harqId); + NS_LOG_INFO (this << " UL-HARQ retx RNTI " << rnti << " harqId " << (uint16_t)harqId); std::map ::iterator itHarq = m_ulHarqProcessesDciBuffer.find (rnti); - if (itHarq==m_ulHarqProcessesDciBuffer.end ()) + if (itHarq == m_ulHarqProcessesDciBuffer.end ()) { NS_FATAL_ERROR ("No info find in UL-HARQ buffer for UE " << rnti); } itProcId = m_ulHarqCurrentProcessId.find (rnti); - if (itProcId==m_ulHarqCurrentProcessId.end ()) + if (itProcId == m_ulHarqCurrentProcessId.end ()) { NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << rnti); } UlDciListElement_s dci = (*itHarq).second.at (harqId); std::map ::iterator itStat = m_ulHarqProcessesStatus.find (rnti); - if (itStat==m_ulHarqProcessesStatus.end ()) + if (itStat == m_ulHarqProcessesStatus.end ()) { NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << rnti); } - if ((*itStat).second.at (harqId)>3) + if ((*itStat).second.at (harqId) > 3) { NS_LOG_DEBUG ("Max number of retransmissions reached (UL)-> drop process"); continue; @@ -1273,10 +1266,10 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched bool free = true; for (int j = dci.m_rbStart; j < dci.m_rbStart + dci.m_rbLen; j++) { - if (rbMap.at (j)==true) + if (rbMap.at (j) == true) { free = false; - NS_LOG_DEBUG (this << " BUSY " << j); + NS_LOG_INFO (this << " BUSY " << j); } } if (free) @@ -1286,10 +1279,10 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched { rbMap.at (j) = true; rbgAllocationMap.at (j) = dci.m_rnti; - NS_LOG_DEBUG ("\t" << j); + NS_LOG_INFO ("\t" << j); rbAllocatedNum++; } - NS_LOG_DEBUG (this << " Send retx in the same RBGs " << (uint16_t)dci.m_rbStart << " to " << dci.m_rbStart + dci.m_rbLen); + NS_LOG_INFO (this << " Send retx in the same RBGs " << (uint16_t)dci.m_rbStart << " to " << dci.m_rbStart + dci.m_rbLen); } else { @@ -1298,12 +1291,12 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched dci.m_ndi = 0; ret.m_dciList.push_back (dci); rntiAllocated.insert (dci.m_rnti); - + } } - - std::map ::iterator it; + + std::map ::iterator it; int nflows = 0; for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++) @@ -1317,7 +1310,7 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched if (nflows == 0) { - return ; // no flows to be scheduled + return; // no flows to be scheduled } @@ -1353,7 +1346,7 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched do { std::set ::iterator itRnti = rntiAllocated.find ((*it).first); - if ((itRnti!=rntiAllocated.end ())||((*it).second == 0)) + if ((itRnti != rntiAllocated.end ())||((*it).second == 0)) { // UE already allocated for UL-HARQ -> skip it it++; @@ -1369,13 +1362,12 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched // limit to physical resources last resource assignment rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated; } - + UlDciListElement_s uldci; uldci.m_rnti = (*it).first; -// uldci.m_rbStart = rbAllocated; uldci.m_rbLen = rbPerFlow; bool allocated = false; - while ((!allocated)&&(rbAllocated0) + if (ret.m_dciList.size () > 0) { m_schedSapUser->SchedUlConfigInd (ret); } m_allocationMaps.insert (std::pair > (params.m_sfnSf, rbgAllocationMap)); return; } - - - + + + std::map >::iterator itCqi = m_ueCqi.find ((*it).first); int cqi = 0; if (itCqi == m_ueCqi.end ()) { // no cqi info about this UE uldci.m_mcs = 0; // MCS 0 -> UL-AMC TBD -// NS_LOG_DEBUG (this << " UE does not have ULCQI " << (*it).first ); } else { @@ -1435,7 +1425,6 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched } for (uint16_t i = uldci.m_rbStart; i < uldci.m_rbStart + uldci.m_rbLen; i++) { -// NS_LOG_DEBUG (this << " UE " << (*it).first << " has SINR " << (*itCqi).second.at(i)); double sinr = (*itCqi).second.at (i); if (sinr == NO_SINR) { @@ -1463,10 +1452,8 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched continue; // CQI == 0 means "out of range" (see table 7.2.3-1 of 36.213) } uldci.m_mcs = m_amc->GetMcsFromCqi (cqi); -// NS_LOG_DEBUG (this << " UE " << (*it).first << " minsinr " << minSinr << " -> mcs " << (uint16_t)uldci.m_mcs); - } - + uldci.m_tbSize = (m_amc->GetTbSizeFromMcs (uldci.m_mcs, rbPerFlow) / 8); UpdateUlRlcBufferInfo (uldci.m_rnti, uldci.m_tbSize); uldci.m_ndi = 1; @@ -1482,35 +1469,32 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched uldci.m_freqHopping = 0; uldci.m_pdcchPowerOffset = 0; // not used ret.m_dciList.push_back (uldci); - + // store DCI for HARQ_PERIOD uint8_t harqId = 0; - if (m_harqOn==true) + if (m_harqOn == true) { itProcId = m_ulHarqCurrentProcessId.find (uldci.m_rnti); - if (itProcId==m_ulHarqCurrentProcessId.end ()) + if (itProcId == m_ulHarqCurrentProcessId.end ()) { NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << uldci.m_rnti); } harqId = (*itProcId).second; std::map ::iterator itDci = m_ulHarqProcessesDciBuffer.find (uldci.m_rnti); - if (itDci==m_ulHarqProcessesDciBuffer.end ()) + if (itDci == m_ulHarqProcessesDciBuffer.end ()) { NS_FATAL_ERROR ("Unable to find RNTI entry in UL DCI HARQ buffer for RNTI " << uldci.m_rnti); } (*itDci).second.at (harqId) = uldci; } - - NS_LOG_DEBUG (this << " UE " << (*it).first << " startPRB " << (uint32_t)uldci.m_rbStart << " nPRB " << (uint32_t)uldci.m_rbLen << " CQI " << cqi << " MCS " << (uint32_t)uldci.m_mcs << " TBsize " << uldci.m_tbSize << " RbAlloc " << rbAllocated << " harqId " << (uint16_t)harqId); + + NS_LOG_INFO (this << " UE " << (*it).first << " startPRB " << (uint32_t)uldci.m_rbStart << " nPRB " << (uint32_t)uldci.m_rbLen << " CQI " << cqi << " MCS " << (uint32_t)uldci.m_mcs << " TBsize " << uldci.m_tbSize << " RbAlloc " << rbAllocated << " harqId " << (uint16_t)harqId); // update TTI UE stats itStats = m_flowStatsUl.find ((*it).first); if (itStats != m_flowStatsUl.end ()) { (*itStats).second.lastTtiBytesTrasmitted = uldci.m_tbSize; -// NS_LOG_DEBUG (this << " UE bytes txed " << (*it).second.lastTtiBytesTrasmitted); - - } else { @@ -1541,8 +1525,8 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched (*itStats).second.totalBytesTransmitted += (*itStats).second.lastTtiBytesTrasmitted; // update average throughput (see eq. 12.3 of Sec 12.3.1.2 of LTE – The UMTS Long Term Evolution, Ed Wiley) (*itStats).second.lastAveragedThroughput = ((1.0 - (1.0 / m_timeWindow)) * (*itStats).second.lastAveragedThroughput) + ((1.0 / m_timeWindow) * (double)((*itStats).second.lastTtiBytesTrasmitted / 0.001)); - // NS_LOG_DEBUG (this << " UE tot bytes " << (*itStats).second.totalBytesTransmitted); - // NS_LOG_DEBUG (this << " UE avg thr " << (*itStats).second.lastAveragedThroughput); + NS_LOG_INFO (this << " UE total bytes " << (*itStats).second.totalBytesTransmitted); + NS_LOG_INFO (this << " UE average throughput " << (*itStats).second.lastAveragedThroughput); (*itStats).second.lastTtiBytesTrasmitted = 0; } m_allocationMaps.insert (std::pair > (params.m_sfnSf, rbgAllocationMap)); @@ -1572,7 +1556,7 @@ PfFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvider::S NS_LOG_FUNCTION (this); std::map ::iterator it; - + for (unsigned int i = 0; i < params.m_macCeList.size (); i++) { if ( params.m_macCeList.at (i).m_macCeType == MacCeListElement_s::BSR ) @@ -1605,7 +1589,7 @@ PfFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvider::S } } } - + return; } @@ -1613,36 +1597,35 @@ void PfFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters& params) { NS_LOG_FUNCTION (this); -// NS_LOG_DEBUG (this << " RX SFNID " << params.m_sfnSf); - // retrieve the allocation for this subframe +// retrieve the allocation for this subframe switch (m_ulCqiFilter) { - case FfMacScheduler::SRS_UL_CQI: - { - // filter all the CQIs that are not SRS based - if (params.m_ulCqi.m_type!=UlCqi_s::SRS) - { - return; - } - } + case FfMacScheduler::SRS_UL_CQI: + { + // filter all the CQIs that are not SRS based + if (params.m_ulCqi.m_type != UlCqi_s::SRS) + { + return; + } + } break; - case FfMacScheduler::PUSCH_UL_CQI: - { - // filter all the CQIs that are not SRS based - if (params.m_ulCqi.m_type!=UlCqi_s::PUSCH) - { - return; - } - } - case FfMacScheduler::ALL_UL_CQI: + case FfMacScheduler::PUSCH_UL_CQI: + { + // filter all the CQIs that are not SRS based + if (params.m_ulCqi.m_type != UlCqi_s::PUSCH) + { + return; + } + } + case FfMacScheduler::ALL_UL_CQI: break; - - default: - NS_FATAL_ERROR ("Unknown UL CQI type"); + + default: + NS_FATAL_ERROR ("Unknown UL CQI type"); } switch (params.m_ulCqi.m_type) - { + { case UlCqi_s::PUSCH: { std::map >::iterator itMap; @@ -1650,15 +1633,12 @@ PfFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::Sched itMap = m_allocationMaps.find (params.m_sfnSf); if (itMap == m_allocationMaps.end ()) { - NS_LOG_DEBUG (this << " Does not find info on allocation, size : " << m_allocationMaps.size ()); return; } for (uint32_t i = 0; i < (*itMap).second.size (); i++) { // convert from fixed point notation Sxxxxxxxxxxx.xxx to double - // NS_LOG_INFO (this << " i " << i << " size " << params.m_ulCqi.m_sinr.size () << " mapSIze " << (*itMap).second.size ()); double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (i)); - //NS_LOG_DEBUG (this << " UE " << (*itMap).second.at (i) << " SINRfp " << params.m_ulCqi.m_sinr.at (i) << " sinrdb " << sinr); itCqi = m_ueCqi.find ((*itMap).second.at (i)); if (itCqi == m_ueCqi.end ()) { @@ -1689,7 +1669,7 @@ PfFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::Sched std::map ::iterator itTimers; itTimers = m_ueCqiTimers.find ((*itMap).second.at (i)); (*itTimers).second = m_cqiTimersThreshold; - + } } @@ -1717,33 +1697,33 @@ PfFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::Sched // create a new entry std::vector newCqi; for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++) - { - double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (j)); - newCqi.push_back (sinr); - NS_LOG_DEBUG (this << " RNTI " << rnti << " new SRS-CQI for RB " << j << " value " << sinr); - - } + { + double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (j)); + newCqi.push_back (sinr); + NS_LOG_INFO (this << " RNTI " << rnti << " new SRS-CQI for RB " << j << " value " << sinr); + + } m_ueCqi.insert (std::pair > (rnti, newCqi)); // generate correspondent timer m_ueCqiTimers.insert (std::pair (rnti, m_cqiTimersThreshold)); } else - { - // update the values - for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++) - { - double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (j)); - (*itCqi).second.at (j) = sinr; - NS_LOG_DEBUG (this << " RNTI " << rnti << " update SRS-CQI for RB " << j << " value " << sinr); - } - // update correspondent timer - std::map ::iterator itTimers; - itTimers = m_ueCqiTimers.find (rnti); - (*itTimers).second = m_cqiTimersThreshold; - - } - - + { + // update the values + for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++) + { + double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (j)); + (*itCqi).second.at (j) = sinr; + NS_LOG_INFO (this << " RNTI " << rnti << " update SRS-CQI for RB " << j << " value " << sinr); + } + // update correspondent timer + std::map ::iterator itTimers; + itTimers = m_ueCqiTimers.find (rnti); + (*itTimers).second = m_cqiTimersThreshold; + + } + + } break; case UlCqi_s::PUCCH_1: @@ -1755,18 +1735,18 @@ PfFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::Sched break; default: NS_FATAL_ERROR ("Unknown type of UL-CQI"); - } + } return; } void -PfFfMacScheduler::RefreshDlCqiMaps(void) +PfFfMacScheduler::RefreshDlCqiMaps (void) { // refresh DL CQI P01 Map std::map ::iterator itP10 = m_p10CqiTimers.begin (); - while (itP10!=m_p10CqiTimers.end ()) + while (itP10 != m_p10CqiTimers.end ()) { -// NS_LOG_INFO (this << " P10-CQI for user " << (*itP10).first << " is " << (uint32_t)(*itP10).second << " thr " << (uint32_t)m_cqiTimersThreshold); + NS_LOG_INFO (this << " P10-CQI for user " << (*itP10).first << " is " << (uint32_t)(*itP10).second << " thr " << (uint32_t)m_cqiTimersThreshold); if ((*itP10).second == 0) { // delete correspondent entries @@ -1784,12 +1764,12 @@ PfFfMacScheduler::RefreshDlCqiMaps(void) itP10++; } } - + // refresh DL CQI A30 Map std::map ::iterator itA30 = m_a30CqiTimers.begin (); - while (itA30!=m_a30CqiTimers.end ()) + while (itA30 != m_a30CqiTimers.end ()) { -// NS_LOG_INFO (this << " A30-CQI for user " << (*itA30).first << " is " << (uint32_t)(*itA30).second << " thr " << (uint32_t)m_cqiTimersThreshold); + NS_LOG_INFO (this << " A30-CQI for user " << (*itA30).first << " is " << (uint32_t)(*itA30).second << " thr " << (uint32_t)m_cqiTimersThreshold); if ((*itA30).second == 0) { // delete correspondent entries @@ -1807,19 +1787,19 @@ PfFfMacScheduler::RefreshDlCqiMaps(void) itA30++; } } - - return; + + return; } void -PfFfMacScheduler::RefreshUlCqiMaps(void) +PfFfMacScheduler::RefreshUlCqiMaps (void) { // refresh UL CQI Map std::map ::iterator itUl = m_ueCqiTimers.begin (); - while (itUl!=m_ueCqiTimers.end ()) + while (itUl != m_ueCqiTimers.end ()) { -// NS_LOG_INFO (this << " UL-CQI for user " << (*itUl).first << " is " << (uint32_t)(*itUl).second << " thr " << (uint32_t)m_cqiTimersThreshold); + NS_LOG_INFO (this << " UL-CQI for user " << (*itUl).first << " is " << (uint32_t)(*itUl).second << " thr " << (uint32_t)m_cqiTimersThreshold); if ((*itUl).second == 0) { // delete correspondent entries @@ -1838,8 +1818,8 @@ PfFfMacScheduler::RefreshUlCqiMaps(void) itUl++; } } - - return; + + return; } void @@ -1849,9 +1829,9 @@ PfFfMacScheduler::UpdateDlRlcBufferInfo (uint16_t rnti, uint8_t lcid, uint16_t s std::map::iterator it; LteFlowId_t flow (rnti, lcid); it = m_rlcBufferReq.find (flow); - if (it!=m_rlcBufferReq.end ()) + if (it != m_rlcBufferReq.end ()) { -// NS_LOG_DEBUG (this << " UE " << rnti << " LC " << (uint16_t)lcid << " txqueue " << (*it).second.m_rlcTransmissionQueueSize << " retxqueue " << (*it).second.m_rlcRetransmissionQueueSize << " status " << (*it).second.m_rlcStatusPduSize << " decrease " << size); + NS_LOG_INFO (this << " UE " << rnti << " LC " << (uint16_t)lcid << " txqueue " << (*it).second.m_rlcTransmissionQueueSize << " retxqueue " << (*it).second.m_rlcRetransmissionQueueSize << " status " << (*it).second.m_rlcStatusPduSize << " decrease " << size); // Update queues: RLC tx order Status, ReTx, Tx // Update status queue if ((*it).second.m_rlcStatusPduSize <= size) @@ -1864,7 +1844,7 @@ PfFfMacScheduler::UpdateDlRlcBufferInfo (uint16_t rnti, uint8_t lcid, uint16_t s (*it).second.m_rlcStatusPduSize -= size; return; } - // update retransmission queue + // update retransmission queue if ((*it).second.m_rlcRetransmissionQueueSize <= size) { size -= (*it).second.m_rlcRetransmissionQueueSize; @@ -1896,12 +1876,12 @@ PfFfMacScheduler::UpdateDlRlcBufferInfo (uint16_t rnti, uint8_t lcid, uint16_t s void PfFfMacScheduler::UpdateUlRlcBufferInfo (uint16_t rnti, uint16_t size) { - + size = size - 2; // remove the minimum RLC overhead std::map ::iterator it = m_ceBsrRxed.find (rnti); - if (it!=m_ceBsrRxed.end ()) + if (it != m_ceBsrRxed.end ()) { -// NS_LOG_DEBUG (this << " UE " << rnti << " size " << size << " BSR " << (*it).second); + NS_LOG_INFO (this << " UE " << rnti << " size " << size << " BSR " << (*it).second); if ((*it).second >= size) { (*it).second -= size; @@ -1915,7 +1895,7 @@ PfFfMacScheduler::UpdateUlRlcBufferInfo (uint16_t rnti, uint16_t size) { NS_LOG_ERROR (this << " Does not find BSR report info of UE " << rnti); } - + } void diff --git a/src/lte/model/pf-ff-mac-scheduler.h b/src/lte/model/pf-ff-mac-scheduler.h index cacb99598..c85e67ae3 100644 --- a/src/lte/model/pf-ff-mac-scheduler.h +++ b/src/lte/model/pf-ff-mac-scheduler.h @@ -39,8 +39,8 @@ #define HARQ_PROC_NUM 8 namespace ns3 { - - + + typedef std::vector < uint8_t > DlHarqProcessesStatus_t; typedef std::vector < DlDciListElement_s > DlHarqProcessesDciBuffer_t; typedef std::vector < std::vector > RlcPduList_t; // vector of the LCs and layers per UE @@ -53,7 +53,7 @@ typedef std::vector < uint8_t > UlHarqProcessesStatus_t; struct pfsFlowPerf_t { Time flowStart; - unsigned long totalBytesTransmitted; + unsigned long totalBytesTransmitted; unsigned int lastTtiBytesTrasmitted; double lastAveragedThroughput; }; @@ -97,7 +97,7 @@ public: friend class PfSchedulerMemberCschedSapProvider; friend class PfSchedulerMemberSchedSapProvider; - + void TransmissionModeConfigurationUpdate (uint16_t rnti, uint8_t txMode); private: @@ -149,16 +149,16 @@ private: int LcActivePerFlow (uint16_t rnti); double EstimateUlSinr (uint16_t rnti, uint16_t rb); - - void RefreshDlCqiMaps(void); - void RefreshUlCqiMaps(void); - + + void RefreshDlCqiMaps (void); + void RefreshUlCqiMaps (void); + void UpdateDlRlcBufferInfo (uint16_t rnti, uint8_t lcid, uint16_t size); void UpdateUlRlcBufferInfo (uint16_t rnti, uint16_t size); - + /** * \brief Update and return a new process Id for the RNTI specified - * + * * \param rnti the RNTI of the UE to be updated * \return the process id value */ @@ -171,7 +171,7 @@ private: * \return the process id value */ uint8_t HarqProcessAvailability (uint16_t rnti); - + Ptr m_amc; /* @@ -243,11 +243,11 @@ private: double m_timeWindow; uint16_t m_nextRntiUl; // RNTI of the next user to be served next scheduling in UL - + uint32_t m_cqiTimersThreshold; // # of TTIs for which a CQI canbe considered valid std::map m_uesTxMode; // txMode of the UEs - + // HARQ attributes /** * m_harqOn when false inhibit te HARQ mechanisms (by default active) @@ -261,14 +261,14 @@ private: std::map m_dlHarqProcessesDciBuffer; std::map m_dlHarqProcessesRlcPduListBuffer; std::vector m_dlInfoListBuffered; // HARQ retx buffered - + std::map m_ulHarqCurrentProcessId; //HARQ status // 0: process Id available // x>0: process Id equal to `x` trasmission count std::map m_ulHarqProcessesStatus; std::map m_ulHarqProcessesDciBuffer; - + }; } // namespace ns3 diff --git a/src/lte/model/rr-ff-mac-scheduler.cc b/src/lte/model/rr-ff-mac-scheduler.cc index 49621305b..fd46cef4b 100644 --- a/src/lte/model/rr-ff-mac-scheduler.cc +++ b/src/lte/model/rr-ff-mac-scheduler.cc @@ -19,7 +19,7 @@ */ #ifdef __FreeBSD__ -#define log2(x) (log(x) / M_LN2) +#define log2(x) (log (x) / M_LN2) #endif /* __FreeBSD__ */ #include @@ -262,7 +262,7 @@ RrFfMacScheduler::GetTypeId (void) BooleanValue (true), MakeBooleanAccessor (&RrFfMacScheduler::m_harqOn), MakeBooleanChecker ()) - ; + ; return tid; } @@ -309,7 +309,7 @@ RrFfMacScheduler::DoCschedUeConfigReq (const struct FfMacCschedSapProvider::Csch { NS_LOG_FUNCTION (this << " RNTI " << params.m_rnti << " txMode " << (uint16_t)params.m_transmissionMode); std::map ::iterator it = m_uesTxMode.find (params.m_rnti); - if (it==m_uesTxMode.end ()) + if (it == m_uesTxMode.end ()) { m_uesTxMode.insert (std::pair (params.m_rnti, params.m_transmissionMode)); // generate HARQ buffers @@ -431,7 +431,7 @@ RrFfMacScheduler::GetRbgSize (int dlbandwidth) bool RrFfMacScheduler::SortRlcBufferReq (FfMacSchedSapProvider::SchedDlRlcBufferReqParameters i,FfMacSchedSapProvider::SchedDlRlcBufferReqParameters j) { - return (i.m_rnti::iterator it = m_dlHarqCurrentProcessId.find (rnti); - if (it==m_dlHarqCurrentProcessId.end ()) + if (it == m_dlHarqCurrentProcessId.end ()) { NS_FATAL_ERROR ("No Process Id found for this RNTI " << rnti); } std::map ::iterator itStat = m_dlHarqProcessesStatus.find (rnti); - if (itStat==m_dlHarqProcessesStatus.end ()) + if (itStat == m_dlHarqProcessesStatus.end ()) { NS_FATAL_ERROR ("No Process Id Statusfound for this RNTI " << rnti); } @@ -454,9 +454,9 @@ RrFfMacScheduler::HarqProcessAvailability (uint16_t rnti) do { i = (i + 1) % HARQ_PROC_NUM; - // NS_LOG_DEBUG (this << " check i " << (uint16_t)i << " stat " << (uint16_t)(*itStat).second.at (i)); - } while ( ((*itStat).second.at (i)!=0)&&(i!=(*it).second)); - if ((*itStat).second.at (i)==0) + } + while ( ((*itStat).second.at (i) != 0)&&(i != (*it).second)); + if ((*itStat).second.at (i) == 0) { return (true); } @@ -480,22 +480,22 @@ RrFfMacScheduler::UpdateHarqProcessId (uint16_t rnti) } std::map ::iterator it = m_dlHarqCurrentProcessId.find (rnti); - if (it==m_dlHarqCurrentProcessId.end ()) + if (it == m_dlHarqCurrentProcessId.end ()) { NS_FATAL_ERROR ("No Process Id found for this RNTI " << rnti); } std::map ::iterator itStat = m_dlHarqProcessesStatus.find (rnti); - if (itStat==m_dlHarqProcessesStatus.end ()) + if (itStat == m_dlHarqProcessesStatus.end ()) { NS_FATAL_ERROR ("No Process Id Statusfound for this RNTI " << rnti); } uint8_t i = (*it).second; do - { - i = (i + 1) % HARQ_PROC_NUM; -// NS_LOG_DEBUG (this << " check i " << (uint16_t)i << " stat " << (uint16_t)(*itStat).second.at (i)); - } while ( ((*itStat).second.at (i)!=0)&&(i!=(*it).second)); - if ((*itStat).second.at (i)==0) + { + i = (i + 1) % HARQ_PROC_NUM; + } + while ( ((*itStat).second.at (i) != 0)&&(i != (*it).second)); + if ((*itStat).second.at (i) == 0) { (*it).second = i; (*itStat).second.at (i) = 1; @@ -504,7 +504,7 @@ RrFfMacScheduler::UpdateHarqProcessId (uint16_t rnti) { return (9); // return a not valid harq proc id } - + return ((*it).second); } @@ -514,7 +514,7 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched { NS_LOG_FUNCTION (this << " DL Frame no. " << (params.m_sfnSf >> 4) << " subframe no. " << (0xF & params.m_sfnSf)); // API generated by RLC for triggering the scheduling of a DL subframe - + RefreshDlCqiMaps (); int rbgSize = GetRbgSize (m_cschedCellConfig.m_dlBandwidth); int rbgNum = m_cschedCellConfig.m_dlBandwidth / rbgSize; @@ -524,43 +524,42 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched std::vector rbgMap; uint16_t rbgAllocatedNum = 0; std::set rntiAllocated; - rbgMap.resize (m_cschedCellConfig.m_dlBandwidth/rbgSize, false); + rbgMap.resize (m_cschedCellConfig.m_dlBandwidth / rbgSize, false); // Process DL HARQ feedback // retrieve past HARQ retx buffered - if (m_dlInfoListBuffered.size ()>0) + if (m_dlInfoListBuffered.size () > 0) { - if (params.m_dlInfoList.size ()>0) + if (params.m_dlInfoList.size () > 0) { - NS_LOG_DEBUG (this << " RECEIVED DL-HARQ"); + NS_LOG_INFO (this << " Received DL-HARQ feedback"); m_dlInfoListBuffered.insert (m_dlInfoListBuffered.end (), params.m_dlInfoList.begin (), params.m_dlInfoList.end ()); } } else { - if (params.m_dlInfoList.size ()>0) + if (params.m_dlInfoList.size () > 0) { m_dlInfoListBuffered = params.m_dlInfoList; } } if (m_harqOn == false) { - // Ignore HARQ feedbacks + // Ignore HARQ feedback m_dlInfoListBuffered.clear (); - NS_LOG_DEBUG (this << " HARQ OFF"); } std::vector dlInfoListUntxed; for (uint8_t i = 0; i < m_dlInfoListBuffered.size (); i++) { std::set ::iterator itRnti = rntiAllocated.find (m_dlInfoListBuffered.at (i).m_rnti); - if (itRnti!=rntiAllocated.end ()) + if (itRnti != rntiAllocated.end ()) { // RNTI already allocated for retx continue; } uint8_t nLayers = m_dlInfoListBuffered.at (i).m_harqStatus.size (); std::vector retx; - NS_LOG_DEBUG (this << " Processing DLHARQ-FEEDBACK"); + NS_LOG_INFO (this << " Processing DLHARQ feedback"); if (nLayers == 1) { retx.push_back (m_dlInfoListBuffered.at (i).m_harqStatus.at (0) == DlInfoListElement_s::NACK); @@ -576,68 +575,63 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched // retrieve HARQ process information uint16_t rnti = m_dlInfoListBuffered.at (i).m_rnti; uint8_t harqId = m_dlInfoListBuffered.at (i).m_harqProcessId; - NS_LOG_DEBUG (this << " HARQ retx RNTI " << rnti << " harqId " << (uint16_t)harqId); + NS_LOG_INFO (this << " HARQ retx RNTI " << rnti << " harqId " << (uint16_t)harqId); std::map ::iterator itHarq = m_dlHarqProcessesDciBuffer.find (rnti); - if (itHarq==m_dlHarqProcessesDciBuffer.end ()) + if (itHarq == m_dlHarqProcessesDciBuffer.end ()) { NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << rnti); } DlDciListElement_s dci = (*itHarq).second.at (harqId); int rv = 0; - if (dci.m_rv.size ()==1) + if (dci.m_rv.size () == 1) { rv = dci.m_rv.at (0); } - else + else { rv = (dci.m_rv.at (0) > dci.m_rv.at (1) ? dci.m_rv.at (0) : dci.m_rv.at (1)); } - + if (rv == 3) { // maximum number of retx reached -> drop process - NS_LOG_DEBUG ("Max number of retransmissions reached -> drop process"); + NS_LOG_INFO ("Max number of retransmissions reached -> drop process"); std::map ::iterator it = m_dlHarqProcessesStatus.find (rnti); - if (it==m_dlHarqProcessesStatus.end ()) - { - NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << m_dlInfoListBuffered.at (i).m_rnti); - } + if (it == m_dlHarqProcessesStatus.end ()) + { + NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << m_dlInfoListBuffered.at (i).m_rnti); + } (*it).second.at (harqId) = 0; std::map ::iterator itRlcPdu = m_dlHarqProcessesRlcPduListBuffer.find (rnti); - if (itRlcPdu==m_dlHarqProcessesRlcPduListBuffer.end ()) - { - NS_FATAL_ERROR ("Unable to find RlcPdcList in HARQ buffer for RNTI " << m_dlInfoListBuffered.at (i).m_rnti); - } + if (itRlcPdu == m_dlHarqProcessesRlcPduListBuffer.end ()) + { + NS_FATAL_ERROR ("Unable to find RlcPdcList in HARQ buffer for RNTI " << m_dlInfoListBuffered.at (i).m_rnti); + } for (uint16_t k = 0; k < (*itRlcPdu).second.size (); k++) - { - (*itRlcPdu).second.at (k).at (harqId).clear (); - } + { + (*itRlcPdu).second.at (k).at (harqId).clear (); + } continue; } // check the feasibility of retransmitting on the same RBGs // translate the DCI to Spectrum framework std::vector dciRbg; uint32_t mask = 0x1; - NS_LOG_DEBUG ("Original RBGs " << dci.m_rbBitmap << " rnti " << dci.m_rnti); + NS_LOG_INFO ("Original RBGs " << dci.m_rbBitmap << " rnti " << dci.m_rnti); for (int j = 0; j < 32; j++) { if (((dci.m_rbBitmap & mask) >> j) == 1) { dciRbg.push_back (j); - NS_LOG_DEBUG ("\t"< rbgMapCopy = rbgMap; - while ((j < dciRbg.size ())&&(startRbg!=rbgId)) + while ((j < dciRbg.size ())&&(startRbg != rbgId)) { if (rbgMapCopy.at (rbgId) == false) { @@ -680,24 +674,23 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched for (uint16_t k = 0; k < dciRbg.size (); k++) { rbgMask = rbgMask + (0x1 << dciRbg.at (k)); - // NS_LOG_DEBUG (this << " Allocated PRB " << (*itMap).second.at (k)); + NS_LOG_INFO (this << " New allocated RBG " << dciRbg.at (k)); rbgAllocatedNum++; } dci.m_rbBitmap = rbgMask; rbgMap = rbgMapCopy; - NS_LOG_DEBUG (this << " Move retx in RBGs " << dciRbg.size ()); } else { // HARQ retx cannot be performed on this TTI -> store it dlInfoListUntxed.push_back (params.m_dlInfoList.at (i)); - NS_LOG_DEBUG (this << " No resource for this retx -> buffer it"); + NS_LOG_INFO (this << " No resource for this retx -> buffer it"); } } // retrieve RLC PDU list for retx TBsize and update DCI BuildDataListElement_s newEl; std::map ::iterator itRlcPdu = m_dlHarqProcessesRlcPduListBuffer.find (rnti); - if (itRlcPdu==m_dlHarqProcessesRlcPduListBuffer.end ()) + if (itRlcPdu == m_dlHarqProcessesRlcPduListBuffer.end ()) { NS_FATAL_ERROR ("Unable to find RlcPdcList in HARQ buffer for RNTI " << rnti); } @@ -712,15 +705,15 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched dci.m_rv.push_back (0); dci.m_mcs.push_back (0); dci.m_tbsSize.push_back (0); - NS_LOG_DEBUG (this << " layer " << (uint16_t)j << " no txed (MIMO transition)"); - + NS_LOG_INFO (this << " layer " << (uint16_t)j << " no txed (MIMO transition)"); + } else { dci.m_ndi.at (j) = 0; - dci.m_rv.at (j) ++; + dci.m_rv.at (j)++; (*itHarq).second.at (harqId).m_rv.at (j)++; - NS_LOG_DEBUG (this << " layer " << (uint16_t)j << " RV " << (uint16_t)dci.m_rv.at (j)); + NS_LOG_INFO (this << " layer " << (uint16_t)j << " RV " << (uint16_t)dci.m_rv.at (j)); } } else @@ -730,7 +723,7 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched dci.m_rv.at (j) = 0; dci.m_mcs.at (j) = 0; dci.m_tbsSize.at (j) = 0; - NS_LOG_DEBUG (this << " layer " << (uint16_t)j << " no retx"); + NS_LOG_INFO (this << " layer " << (uint16_t)j << " no retx"); } } @@ -748,7 +741,7 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched } } - if (rlcPduListPerLc.size ()>0) + if (rlcPduListPerLc.size () > 0) { newEl.m_rlcPduList.push_back (rlcPduListPerLc); } @@ -762,24 +755,24 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched else { // update HARQ process status - NS_LOG_DEBUG (this << " RR HARQ ACK UE " << m_dlInfoListBuffered.at (i).m_rnti); + NS_LOG_INFO (this << " HARQ ACK UE " << m_dlInfoListBuffered.at (i).m_rnti); std::map ::iterator it = m_dlHarqProcessesStatus.find (m_dlInfoListBuffered.at (i).m_rnti); - if (it==m_dlHarqProcessesStatus.end ()) + if (it == m_dlHarqProcessesStatus.end ()) { NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << m_dlInfoListBuffered.at (i).m_rnti); } (*it).second.at (m_dlInfoListBuffered.at (i).m_harqProcessId) = 0; std::map ::iterator itRlcPdu = m_dlHarqProcessesRlcPduListBuffer.find (m_dlInfoListBuffered.at (i).m_rnti); - if (itRlcPdu==m_dlHarqProcessesRlcPduListBuffer.end ()) + if (itRlcPdu == m_dlHarqProcessesRlcPduListBuffer.end ()) { NS_FATAL_ERROR ("Unable to find RlcPdcList in HARQ buffer for RNTI " << m_dlInfoListBuffered.at (i).m_rnti); } - for (uint16_t k = 0; k < (*itRlcPdu).second.size (); k++) - { - (*itRlcPdu).second.at (k).at (m_dlInfoListBuffered.at (i).m_harqProcessId).clear (); - } + for (uint16_t k = 0; k < (*itRlcPdu).second.size (); k++) + { + (*itRlcPdu).second.at (k).at (m_dlInfoListBuffered.at (i).m_harqProcessId).clear (); + } } - } + } m_dlInfoListBuffered.clear (); m_dlInfoListBuffered = dlInfoListUntxed; @@ -796,11 +789,11 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched // remove old entries of this UE-LC std::set ::iterator itRnti = rntiAllocated.find ((*it).m_rnti); if ( (((*it).m_rlcTransmissionQueueSize > 0) - || ((*it).m_rlcRetransmissionQueueSize > 0) - || ((*it).m_rlcStatusPduSize > 0)) + || ((*it).m_rlcRetransmissionQueueSize > 0) + || ((*it).m_rlcStatusPduSize > 0)) && (itRnti == rntiAllocated.end ()) // UE must not be allocated for HARQ retx && (HarqProcessAvailability ((*it).m_rnti)) ) // UE needs HARQ proc free - + { std::map ::iterator itCqi = m_p10CqiRxed.find ((*it).m_rnti); uint8_t cqi = 0; @@ -826,22 +819,22 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched lcActivesPerRnti.insert (std::pair ((*it).m_rnti, 1)); nTbs++; } - + } } } - + if (nflows == 0) { - if (ret.m_buildDataList.size ()>0) + if (ret.m_buildDataList.size () > 0) { m_schedSapUser->SchedDlConfigInd (ret); } - return; + return; } // Divide the resource equally among the active users according to // Resource allocation type 0 (see sec 7.1.6.1 of 36.213) - + int rbgPerTb = (rbgNum - rbgAllocatedNum) / nTbs; if (rbgPerTb == 0) { @@ -876,7 +869,7 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched { itLcRnti = lcActivesPerRnti.find ((*it).m_rnti); std::set ::iterator itRnti = rntiAllocated.find ((*it).m_rnti); - if ((itLcRnti == lcActivesPerRnti.end ())||(itRnti!=rntiAllocated.end ())) + if ((itLcRnti == lcActivesPerRnti.end ())||(itRnti != rntiAllocated.end ())) { // skip this entry (no active queue or yet allocated for HARQ) it++; @@ -888,12 +881,11 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched continue; } itTxMode = m_uesTxMode.find ((*it).m_rnti); - if (itTxMode == m_uesTxMode.end()) + if (itTxMode == m_uesTxMode.end ()) { NS_FATAL_ERROR ("No Transmission Mode info on user " << (*it).m_rnti); } int nLayer = TransmissionModesLayers::TxMode2LayerNum ((*itTxMode).second); - NS_LOG_DEBUG (this << " NLAYERS " << nLayer); int lcNum = (*itLcRnti).second; // create new BuildDataListElement_s for this RNTI BuildDataListElement_s newEl; @@ -905,7 +897,7 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched newDci.m_resAlloc = 0; newDci.m_rbBitmap = 0; std::map ::iterator itCqi = m_p10CqiRxed.find (newEl.m_rnti); - for (uint8_t i = 0; i < nLayer; i++) + for (uint8_t i = 0; i < nLayer; i++) { if (itCqi == m_p10CqiRxed.end ()) { @@ -918,7 +910,7 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched } int tbSize = (m_amc->GetTbSizeFromMcs (newDci.m_mcs.at (0), rbgPerTb * rbgSize) / 8); uint16_t rlcPduSize = tbSize / lcNum; - while (lcNum>0) + while (lcNum > 0) { if ( ((*it).m_rlcTransmissionQueueSize > 0) || ((*it).m_rlcRetransmissionQueueSize > 0) @@ -929,16 +921,16 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched { RlcPduListElement_s newRlcEl; newRlcEl.m_logicalChannelIdentity = (*it).m_logicalChannelIdentity; - // NS_LOG_DEBUG (this << "LCID " << (uint32_t) newRlcEl.m_logicalChannelIdentity << " size " << rlcPduSize << " ID " << (*it).m_rnti << " layer " << (uint16_t)j); + NS_LOG_INFO (this << "LCID " << (uint32_t) newRlcEl.m_logicalChannelIdentity << " size " << rlcPduSize << " ID " << (*it).m_rnti << " layer " << (uint16_t)j); newRlcEl.m_size = rlcPduSize; UpdateDlRlcBufferInfo ((*it).m_rnti, newRlcEl.m_logicalChannelIdentity, rlcPduSize); newRlcPduLe.push_back (newRlcEl); - + if (m_harqOn == true) { // store RLC PDU list for HARQ std::map ::iterator itRlcPdu = m_dlHarqProcessesRlcPduListBuffer.find ((*it).m_rnti); - if (itRlcPdu==m_dlHarqProcessesRlcPduListBuffer.end ()) + if (itRlcPdu == m_dlHarqProcessesRlcPduListBuffer.end ()) { NS_FATAL_ERROR ("Unable to find RlcPdcList in HARQ buffer for RNTI " << (*it).m_rnti); } @@ -958,18 +950,18 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched } uint32_t rbgMask = 0; uint16_t i = 0; - NS_LOG_DEBUG (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_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:"); while (i < rbgPerTb) { - if (rbgMap.at (rbgAllocated)==false) + if (rbgMap.at (rbgAllocated) == false) { rbgMask = rbgMask + (0x1 << rbgAllocated); NS_LOG_DEBUG ("\t " << rbgAllocated); i++; rbgMap.at (rbgAllocated) = true; } - rbgAllocated++; + rbgAllocated++; } newDci.m_rbBitmap = rbgMask; // (32 bit bitmap see 7.1.6 of 36.213) @@ -984,7 +976,7 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched { // store DCI for HARQ std::map ::iterator itDci = m_dlHarqProcessesDciBuffer.find (newEl.m_rnti); - if (itDci==m_dlHarqProcessesDciBuffer.end ()) + if (itDci == m_dlHarqProcessesDciBuffer.end ()) { NS_FATAL_ERROR ("Unable to find RNTI entry in DCI HARQ buffer for RNTI " << (*it).m_rnti); } @@ -995,7 +987,6 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched ret.m_buildDataList.push_back (newEl); if (rbgAllocated == rbgNum) { - //NS_LOG_DEBUG (this << " FULL " << (*it).m_rnti); m_nextRntiDl = (*it).m_rnti; // store last RNTI served break; // no more RGB to be allocated } @@ -1049,7 +1040,7 @@ RrFfMacScheduler::DoSchedDlCqiInfoReq (const struct FfMacSchedSapProvider::Sched } else if ( params.m_cqiList.at (i).m_cqiType == CqiListElement_s::A30 ) { - // subband CQI reporting high layer configured + // subband CQI reporting high layer configured // Not used by RR Scheduler } else @@ -1078,50 +1069,50 @@ RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched rbgAllocationMap.resize (m_cschedCellConfig.m_ulBandwidth, 0); rbMap.resize (m_cschedCellConfig.m_ulBandwidth, false); - + // Process UL HARQ feedback // update UL HARQ proc id std::map ::iterator itProcId; - for (itProcId = m_ulHarqCurrentProcessId.begin (); itProcId!= m_ulHarqCurrentProcessId.end (); itProcId++) + for (itProcId = m_ulHarqCurrentProcessId.begin (); itProcId != m_ulHarqCurrentProcessId.end (); itProcId++) { (*itProcId).second = ((*itProcId).second + 1) % HARQ_PROC_NUM; } for (uint8_t i = 0; i < params.m_ulInfoList.size (); i++) { - if (params.m_ulInfoList.at (i).m_receptionStatus==UlInfoListElement_s::NotOk) + if (params.m_ulInfoList.at (i).m_receptionStatus == UlInfoListElement_s::NotOk) { // retx correspondent block: retrieve the UL-DCI uint16_t rnti = params.m_ulInfoList.at (i).m_rnti; uint8_t harqId = (uint8_t)((*itProcId).second - HARQ_PERIOD) % HARQ_PROC_NUM; - NS_LOG_DEBUG (this << " UL-HARQ retx RNTI " << rnti << " harqId " << (uint16_t)harqId); + NS_LOG_INFO (this << " UL-HARQ retx RNTI " << rnti << " harqId " << (uint16_t)harqId); std::map ::iterator itHarq = m_ulHarqProcessesDciBuffer.find (rnti); - if (itHarq==m_ulHarqProcessesDciBuffer.end ()) + if (itHarq == m_ulHarqProcessesDciBuffer.end ()) { NS_FATAL_ERROR ("No info find in UL-HARQ buffer for UE " << rnti); } itProcId = m_ulHarqCurrentProcessId.find (rnti); - if (itProcId==m_ulHarqCurrentProcessId.end ()) + if (itProcId == m_ulHarqCurrentProcessId.end ()) { NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << rnti); } UlDciListElement_s dci = (*itHarq).second.at (harqId); std::map ::iterator itStat = m_ulHarqProcessesStatus.find (rnti); - if (itStat==m_ulHarqProcessesStatus.end ()) + if (itStat == m_ulHarqProcessesStatus.end ()) { NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << rnti); } - if ((*itStat).second.at (harqId)>3) + if ((*itStat).second.at (harqId) > 3) { - NS_LOG_DEBUG ("Max number of retransmissions reached (UL)-> drop process"); + NS_LOG_INFO ("Max number of retransmissions reached (UL)-> drop process"); continue; } bool free = true; for (int j = dci.m_rbStart; j < dci.m_rbStart + dci.m_rbLen; j++) { - if (rbMap.at (j)==true) + if (rbMap.at (j) == true) { free = false; - NS_LOG_DEBUG (this << " BUSY " << j); + NS_LOG_INFO (this << " BUSY " << j); } } if (free) @@ -1131,10 +1122,10 @@ RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched { rbMap.at (j) = true; rbgAllocationMap.at (j) = dci.m_rnti; - NS_LOG_DEBUG ("\t" << j); + NS_LOG_INFO ("\t" << j); rbAllocatedNum++; } - NS_LOG_DEBUG (this << " Send retx in the same RBGs " << (uint16_t)dci.m_rbStart << " to " << dci.m_rbStart + dci.m_rbLen); + NS_LOG_INFO (this << " Send retx in the same RBGs " << (uint16_t)dci.m_rbStart << " to " << dci.m_rbStart + dci.m_rbLen); } else { @@ -1146,8 +1137,8 @@ RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched } } - - std::map ::iterator it; + + std::map ::iterator it; int nflows = 0; for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++) @@ -1162,19 +1153,18 @@ RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched if (nflows == 0) { - return ; // no flows to be scheduled + return; // no flows to be scheduled } // 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 - rbAllocatedNum) / nflows; uint16_t rbPerFlow = (m_cschedCellConfig.m_ulBandwidth) / (nflows + rntiAllocated.size ()); if (rbPerFlow == 0) { rbPerFlow = 1; // at least 1 rbg per flow (till available resource) } uint16_t rbAllocated = 0; - + if (m_nextRntiUl != 0) { for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++) @@ -1194,11 +1184,11 @@ RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched it = m_ceBsrRxed.begin (); m_nextRntiUl = (*it).first; } - NS_LOG_DEBUG (this << " rbPerFlow " << rbPerFlow); + NS_LOG_INFO (this << " RB per Flow " << rbPerFlow); do { std::set ::iterator itRnti = rntiAllocated.find ((*it).first); - if ((itRnti!=rntiAllocated.end ())||((*it).second == 0)) + if ((itRnti != rntiAllocated.end ())||((*it).second == 0)) { // UE already allocated for UL-HARQ -> skip it it++; @@ -1214,12 +1204,12 @@ RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched // limit to physical resources last resource assignment rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated; } - + UlDciListElement_s uldci; uldci.m_rnti = (*it).first; uldci.m_rbLen = rbPerFlow; bool allocated = false; - while ((!allocated)&&(rbAllocated0) + if (ret.m_dciList.size () > 0) { m_schedSapUser->SchedUlConfigInd (ret); } @@ -1264,7 +1254,7 @@ RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched { // no cqi info about this UE uldci.m_mcs = 0; // MCS 0 -> UL-AMC TBD - NS_LOG_DEBUG (this << " UE does not have ULCQI " << (*it).first ); + NS_LOG_INFO (this << " UE does not have ULCQI " << (*it).first ); } else { @@ -1295,8 +1285,6 @@ RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched continue; // CQI == 0 means "out of range" (see table 7.2.3-1 of 36.213) } uldci.m_mcs = m_amc->GetMcsFromCqi (cqi); -// NS_LOG_DEBUG (this << " UE " << (*it).first << " minsinr " << minSinr << " -> mcs " << (uint16_t)uldci.m_mcs); - } uldci.m_tbSize = (m_amc->GetTbSizeFromMcs (uldci.m_mcs, rbPerFlow) / 8); // MCS 0 -> UL-AMC TBD @@ -1316,23 +1304,23 @@ RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched ret.m_dciList.push_back (uldci); // store DCI for HARQ_PERIOD uint8_t harqId = 0; - if (m_harqOn==true) + if (m_harqOn == true) { itProcId = m_ulHarqCurrentProcessId.find (uldci.m_rnti); - if (itProcId==m_ulHarqCurrentProcessId.end ()) + if (itProcId == m_ulHarqCurrentProcessId.end ()) { NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << uldci.m_rnti); } harqId = (*itProcId).second; std::map ::iterator itDci = m_ulHarqProcessesDciBuffer.find (uldci.m_rnti); - if (itDci==m_ulHarqProcessesDciBuffer.end ()) + if (itDci == m_ulHarqProcessesDciBuffer.end ()) { NS_FATAL_ERROR ("Unable to find RNTI entry in UL DCI HARQ buffer for RNTI " << uldci.m_rnti); } (*itDci).second.at (harqId) = uldci; } - NS_LOG_DEBUG (this << " UL Allocation - UE " << (*it).first << " startPRB " << (uint32_t)uldci.m_rbStart << " nPRB " << (uint32_t)uldci.m_rbLen << " CQI " << cqi << " MCS " << (uint32_t)uldci.m_mcs << " TBsize " << uldci.m_tbSize << " harqId " << (uint16_t)harqId); - + NS_LOG_INFO (this << " UL Allocation - UE " << (*it).first << " startPRB " << (uint32_t)uldci.m_rbStart << " nPRB " << (uint32_t)uldci.m_rbLen << " CQI " << cqi << " MCS " << (uint32_t)uldci.m_mcs << " TBsize " << uldci.m_tbSize << " harqId " << (uint16_t)harqId); + it++; if (it == m_ceBsrRxed.end ()) { @@ -1415,159 +1403,156 @@ void RrFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters& params) { NS_LOG_FUNCTION (this); - NS_LOG_DEBUG (this << " RX SFNID " << params.m_sfnSf); -// NS_LOG_DEBUG (this << " Actual sfn " << frameNo << " sbfn " << subframeNo << " sfnSf " << sfnSf); + switch (m_ulCqiFilter) { - case FfMacScheduler::SRS_UL_CQI: - { - // filter all the CQIs that are not SRS based - if (params.m_ulCqi.m_type!=UlCqi_s::SRS) - { - return; - } - } + case FfMacScheduler::SRS_UL_CQI: + { + // filter all the CQIs that are not SRS based + if (params.m_ulCqi.m_type != UlCqi_s::SRS) + { + return; + } + } break; - case FfMacScheduler::PUSCH_UL_CQI: - { - // filter all the CQIs that are not SRS based - if (params.m_ulCqi.m_type!=UlCqi_s::PUSCH) - { - return; - } - } - case FfMacScheduler::ALL_UL_CQI: - break; - - default: - NS_FATAL_ERROR ("Unknown UL CQI type"); + case FfMacScheduler::PUSCH_UL_CQI: + { + // filter all the CQIs that are not SRS based + if (params.m_ulCqi.m_type != UlCqi_s::PUSCH) + { + return; + } + } + case FfMacScheduler::ALL_UL_CQI: + break; + + default: + NS_FATAL_ERROR ("Unknown UL CQI type"); } - switch (params.m_ulCqi.m_type) + switch (params.m_ulCqi.m_type) { - case UlCqi_s::PUSCH: - { - std::map >::iterator itMap; - std::map >::iterator itCqi; - itMap = m_allocationMaps.find (params.m_sfnSf); - if (itMap == m_allocationMaps.end ()) - { - NS_LOG_DEBUG (this << " Does not find info on allocation, size : " << m_allocationMaps.size ()); - return; - } - for (uint32_t i = 0; i < (*itMap).second.size (); i++) - { - // convert from fixed point notation Sxxxxxxxxxxx.xxx to double - // NS_LOG_INFO (this << " i " << i << " size " << params.m_ulCqi.m_sinr.size () << " mapSIze " << (*itMap).second.size ()); - double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (i)); - //NS_LOG_DEBUG (this << " UE " << (*itMap).second.at (i) << " SINRfp " << params.m_ulCqi.m_sinr.at (i) << " sinrdb " << sinr); - itCqi = m_ueCqi.find ((*itMap).second.at (i)); - if (itCqi == m_ueCqi.end ()) - { - // create a new entry - std::vector newCqi; - for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++) - { - if (i == j) - { - newCqi.push_back (sinr); - } - else - { - // initialize with NO_SINR value. - newCqi.push_back (30.0); - } - - } - m_ueCqi.insert (std::pair > ((*itMap).second.at (i), newCqi)); - // generate correspondent timer - m_ueCqiTimers.insert (std::pair ((*itMap).second.at (i), m_cqiTimersThreshold)); - } - else - { - // update the value - (*itCqi).second.at (i) = sinr; - // update correspondent timer - std::map ::iterator itTimers; - itTimers = m_ueCqiTimers.find ((*itMap).second.at (i)); - (*itTimers).second = m_cqiTimersThreshold; - - } - - } - // remove obsolete info on allocation - m_allocationMaps.erase (itMap); - } + case UlCqi_s::PUSCH: + { + std::map >::iterator itMap; + std::map >::iterator itCqi; + itMap = m_allocationMaps.find (params.m_sfnSf); + if (itMap == m_allocationMaps.end ()) + { + NS_LOG_INFO (this << " Does not find info on allocation, size : " << m_allocationMaps.size ()); + return; + } + for (uint32_t i = 0; i < (*itMap).second.size (); i++) + { + // convert from fixed point notation Sxxxxxxxxxxx.xxx to double + double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (i)); + itCqi = m_ueCqi.find ((*itMap).second.at (i)); + if (itCqi == m_ueCqi.end ()) + { + // create a new entry + std::vector newCqi; + for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++) + { + if (i == j) + { + newCqi.push_back (sinr); + } + else + { + // initialize with NO_SINR value. + newCqi.push_back (30.0); + } + + } + m_ueCqi.insert (std::pair > ((*itMap).second.at (i), newCqi)); + // generate correspondent timer + m_ueCqiTimers.insert (std::pair ((*itMap).second.at (i), m_cqiTimersThreshold)); + } + else + { + // update the value + (*itCqi).second.at (i) = sinr; + // update correspondent timer + std::map ::iterator itTimers; + itTimers = m_ueCqiTimers.find ((*itMap).second.at (i)); + (*itTimers).second = m_cqiTimersThreshold; + + } + + } + // remove obsolete info on allocation + m_allocationMaps.erase (itMap); + } break; - case UlCqi_s::SRS: - { - // get the RNTI from vendor specific parameters - uint16_t rnti = 0; - NS_ASSERT (params.m_vendorSpecificList.size () > 0); - for (uint16_t i = 0; i < params.m_vendorSpecificList.size (); i++) - { - if (params.m_vendorSpecificList.at (i).m_type == SRS_CQI_RNTI_VSP) - { - Ptr vsp = DynamicCast (params.m_vendorSpecificList.at (i).m_value); - rnti = vsp->GetRnti (); - } - } - std::map >::iterator itCqi; - itCqi = m_ueCqi.find (rnti); - if (itCqi == m_ueCqi.end ()) - { - // create a new entry - std::vector newCqi; - for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++) - { - double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (j)); - newCqi.push_back (sinr); - NS_LOG_DEBUG (this << " RNTI " << rnti << " new SRS-CQI for RB " << j << " value " << sinr); - - } - m_ueCqi.insert (std::pair > (rnti, newCqi)); - // generate correspondent timer - m_ueCqiTimers.insert (std::pair (rnti, m_cqiTimersThreshold)); - } - else - { - // update the values - for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++) - { - double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (j)); - (*itCqi).second.at (j) = sinr; - NS_LOG_DEBUG (this << " RNTI " << rnti << " update SRS-CQI for RB " << j << " value " << sinr); - } - // update correspondent timer - std::map ::iterator itTimers; - itTimers = m_ueCqiTimers.find (rnti); - (*itTimers).second = m_cqiTimersThreshold; - - } - - - } + case UlCqi_s::SRS: + { + // get the RNTI from vendor specific parameters + uint16_t rnti = 0; + NS_ASSERT (params.m_vendorSpecificList.size () > 0); + for (uint16_t i = 0; i < params.m_vendorSpecificList.size (); i++) + { + if (params.m_vendorSpecificList.at (i).m_type == SRS_CQI_RNTI_VSP) + { + Ptr vsp = DynamicCast (params.m_vendorSpecificList.at (i).m_value); + rnti = vsp->GetRnti (); + } + } + std::map >::iterator itCqi; + itCqi = m_ueCqi.find (rnti); + if (itCqi == m_ueCqi.end ()) + { + // create a new entry + std::vector newCqi; + for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++) + { + double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (j)); + newCqi.push_back (sinr); + NS_LOG_INFO (this << " RNTI " << rnti << " new SRS-CQI for RB " << j << " value " << sinr); + + } + m_ueCqi.insert (std::pair > (rnti, newCqi)); + // generate correspondent timer + m_ueCqiTimers.insert (std::pair (rnti, m_cqiTimersThreshold)); + } + else + { + // update the values + for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++) + { + double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (j)); + (*itCqi).second.at (j) = sinr; + NS_LOG_INFO (this << " RNTI " << rnti << " update SRS-CQI for RB " << j << " value " << sinr); + } + // update correspondent timer + std::map ::iterator itTimers; + itTimers = m_ueCqiTimers.find (rnti); + (*itTimers).second = m_cqiTimersThreshold; + + } + + + } break; - case UlCqi_s::PUCCH_1: - case UlCqi_s::PUCCH_2: - case UlCqi_s::PRACH: - { - NS_FATAL_ERROR ("PfFfMacScheduler supports only PUSCH and SRS UL-CQIs"); - } + case UlCqi_s::PUCCH_1: + case UlCqi_s::PUCCH_2: + case UlCqi_s::PRACH: + { + NS_FATAL_ERROR ("PfFfMacScheduler supports only PUSCH and SRS UL-CQIs"); + } break; - default: - NS_FATAL_ERROR ("Unknown type of UL-CQI"); + default: + NS_FATAL_ERROR ("Unknown type of UL-CQI"); } return; } void -RrFfMacScheduler::RefreshDlCqiMaps(void) +RrFfMacScheduler::RefreshDlCqiMaps (void) { NS_LOG_FUNCTION (this << m_p10CqiTimers.size ()); // refresh DL CQI P01 Map std::map ::iterator itP10 = m_p10CqiTimers.begin (); - while (itP10!=m_p10CqiTimers.end ()) + while (itP10 != m_p10CqiTimers.end ()) { NS_LOG_INFO (this << " P10-CQI for user " << (*itP10).first << " is " << (uint32_t)(*itP10).second << " thr " << (uint32_t)m_cqiTimersThreshold); if ((*itP10).second == 0) @@ -1587,17 +1572,17 @@ RrFfMacScheduler::RefreshDlCqiMaps(void) itP10++; } } - + return; } void -RrFfMacScheduler::RefreshUlCqiMaps(void) +RrFfMacScheduler::RefreshUlCqiMaps (void) { // refresh UL CQI Map std::map ::iterator itUl = m_ueCqiTimers.begin (); - while (itUl!=m_ueCqiTimers.end ()) + while (itUl != m_ueCqiTimers.end ()) { NS_LOG_INFO (this << " UL-CQI for user " << (*itUl).first << " is " << (uint32_t)(*itUl).second << " thr " << (uint32_t)m_cqiTimersThreshold); if ((*itUl).second == 0) @@ -1618,7 +1603,7 @@ RrFfMacScheduler::RefreshUlCqiMaps(void) itUl++; } } - + return; } @@ -1631,7 +1616,7 @@ RrFfMacScheduler::UpdateDlRlcBufferInfo (uint16_t rnti, uint8_t lcid, uint16_t s { if (((*it).m_rnti == rnti) && ((*it).m_logicalChannelIdentity)) { -// NS_LOG_DEBUG (this << " UE " << rnti << " LC " << (uint16_t)lcid << " txqueue " << (*it).m_rlcTransmissionQueueSize << " retxqueue " << (*it).m_rlcRetransmissionQueueSize << " status " << (*it).m_rlcStatusPduSize << " decrease " << size); + NS_LOG_INFO (this << " UE " << rnti << " LC " << (uint16_t)lcid << " txqueue " << (*it).m_rlcTransmissionQueueSize << " retxqueue " << (*it).m_rlcRetransmissionQueueSize << " status " << (*it).m_rlcStatusPduSize << " decrease " << size); // Update queues: RLC tx order Status, ReTx, Tx // Update status queue if ((*it).m_rlcStatusPduSize <= size) @@ -1644,7 +1629,7 @@ RrFfMacScheduler::UpdateDlRlcBufferInfo (uint16_t rnti, uint8_t lcid, uint16_t s (*it).m_rlcStatusPduSize -= size; return; } - // update retransmission queue + // update retransmission queue if ((*it).m_rlcRetransmissionQueueSize <= size) { size -= (*it).m_rlcRetransmissionQueueSize; @@ -1677,9 +1662,9 @@ RrFfMacScheduler::UpdateUlRlcBufferInfo (uint16_t rnti, uint16_t size) size = size - 2; // remove the minimum RLC overhead std::map ::iterator it = m_ceBsrRxed.find (rnti); - if (it!=m_ceBsrRxed.end ()) + if (it != m_ceBsrRxed.end ()) { -// NS_LOG_DEBUG (this << " Update RLC BSR UE " << rnti << " size " << size << " BSR " << (*it).second); + NS_LOG_INFO (this << " Update RLC BSR UE " << rnti << " size " << size << " BSR " << (*it).second); if ((*it).second >= size) { (*it).second -= size; @@ -1693,7 +1678,7 @@ RrFfMacScheduler::UpdateUlRlcBufferInfo (uint16_t rnti, uint16_t size) { NS_LOG_ERROR (this << " Does not find BSR report info of UE " << rnti); } - + } diff --git a/src/lte/model/rr-ff-mac-scheduler.h b/src/lte/model/rr-ff-mac-scheduler.h index 07edf3896..11f636eb0 100644 --- a/src/lte/model/rr-ff-mac-scheduler.h +++ b/src/lte/model/rr-ff-mac-scheduler.h @@ -84,7 +84,7 @@ public: friend class RrSchedulerMemberCschedSapProvider; friend class RrSchedulerMemberSchedSapProvider; - + void TransmissionModeConfigurationUpdate (uint16_t rnti, uint8_t txMode); private: @@ -132,31 +132,31 @@ private: int GetRbgSize (int dlbandwidth); - + static bool SortRlcBufferReq (FfMacSchedSapProvider::SchedDlRlcBufferReqParameters i,FfMacSchedSapProvider::SchedDlRlcBufferReqParameters j); - - void RefreshDlCqiMaps(void); - void RefreshUlCqiMaps(void); - + + void RefreshDlCqiMaps (void); + void RefreshUlCqiMaps (void); + void UpdateDlRlcBufferInfo (uint16_t rnti, uint8_t lcid, uint16_t size); void UpdateUlRlcBufferInfo (uint16_t rnti, uint16_t size); /** * \brief Update and return a new process Id for the RNTI specified - * + * * \param rnti the RNTI of the UE to be updated * \return the process id value */ uint8_t UpdateHarqProcessId (uint16_t rnti); - /** - * \brief Return the availability of free process for the RNTI specified - * - * \param rnti the RNTI of the UE to be updated - * \return the process id value - */ + /** +* \brief Return the availability of free process for the RNTI specified +* +* \param rnti the RNTI of the UE to be updated +* \return the process id value +*/ uint8_t HarqProcessAvailability (uint16_t rnti); - + Ptr m_amc; /* @@ -207,9 +207,9 @@ private: uint16_t m_nextRntiDl; // RNTI of the next user to be served next scheduling in DL uint16_t m_nextRntiUl; // RNTI of the next user to be served next scheduling in UL - + uint32_t m_cqiTimersThreshold; // # of TTIs for which a CQI canbe considered valid - + std::map m_uesTxMode; // txMode of the UEs