Bug-fix LteSpectrumPhy send HARQ feedback per TB basis

This commit is contained in:
mmiozzo
2012-12-18 18:20:20 +01:00
parent 12b19fe028
commit 9d82db382e
4 changed files with 70 additions and 61 deletions

View File

@@ -802,7 +802,7 @@ LteSpectrumPhy::AddExpectedTb (uint16_t rnti, uint8_t ndi, uint16_t size, uint8
m_expectedTbs.erase (it);
}
// insert new entry
tbInfo_t tbInfo = {ndi, size, mcs, map, harqId, rv, 0.0, downlink, false};
tbInfo_t tbInfo = {ndi, size, mcs, map, harqId, rv, 0.0, downlink, false, false};
m_expectedTbs.insert (std::pair<TbId_t, tbInfo_t> (tbId,tbInfo));
}
@@ -909,69 +909,73 @@ LteSpectrumPhy::EndRxData ()
m_phyRxEndErrorTrace (*j);
}
// send HARQ feedback
if (!(*itTb).second.downlink)
// send HARQ feedback (if not already done for this TB)
if (!(*itTb).second.harqFeedbackSent)
{
UlInfoListElement_s harqUlInfo;
harqUlInfo.m_rnti = tbId.m_rnti;
if ((*itTb).second.corrupt)
(*itTb).second.harqFeedbackSent = true;
if (!(*itTb).second.downlink)
{
harqUlInfo.m_receptionStatus = UlInfoListElement_s::NotOk;
NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " send UL-HARQ-NACK");
m_harqPhyModule->UpdateUlHarqProcessStatus (tbId.m_rnti, (*itTb).second.mi, (*itTb).second.size, (*itTb).second.size / EffectiveCodingRate [(*itTb).second.mcs]);
}
else
{
harqUlInfo.m_receptionStatus = UlInfoListElement_s::Ok;
NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " send UL-HARQ-ACK");
m_harqPhyModule->ResetUlHarqProcessStatus (tbId.m_rnti, (*itTb).second.harqProcessId);
}
if (!m_ltePhyUlHarqFeedbackCallback.IsNull ())
{
m_ltePhyUlHarqFeedbackCallback (harqUlInfo);
}
}
else
{
std::map <uint16_t, DlInfoListElement_s>::iterator itHarq = harqDlInfoMap.find (tbId.m_rnti);
if (itHarq==harqDlInfoMap.end ())
{
DlInfoListElement_s harqDlInfo;
harqDlInfo.m_harqStatus.resize (m_layersNum, DlInfoListElement_s::NACK);
harqDlInfo.m_rnti = tbId.m_rnti;
harqDlInfo.m_harqProcessId = (*itTb).second.harqProcessId;
UlInfoListElement_s harqUlInfo;
harqUlInfo.m_rnti = tbId.m_rnti;
if ((*itTb).second.corrupt)
{
harqDlInfo.m_harqStatus.at (tbId.m_layer) = DlInfoListElement_s::NACK;
NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " harqId " << (uint16_t)(*itTb).second.harqProcessId << " layer " <<(uint16_t)tbId.m_layer << " send DL-HARQ-NACK");
m_harqPhyModule->UpdateDlHarqProcessStatus ((*itTb).second.harqProcessId, tbId.m_layer, (*itTb).second.mi, (*itTb).second.size, (*itTb).second.size / EffectiveCodingRate [(*itTb).second.mcs]);
harqUlInfo.m_receptionStatus = UlInfoListElement_s::NotOk;
NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " send UL-HARQ-NACK");
m_harqPhyModule->UpdateUlHarqProcessStatus (tbId.m_rnti, (*itTb).second.mi, (*itTb).second.size, (*itTb).second.size / EffectiveCodingRate [(*itTb).second.mcs]);
}
else
{
harqDlInfo.m_harqStatus.at (tbId.m_layer) = DlInfoListElement_s::ACK;
NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " harqId " << (uint16_t)(*itTb).second.harqProcessId << " layer " <<(uint16_t)tbId.m_layer << " size " << (*itTb).second.size << " send DL-HARQ-ACK");
m_harqPhyModule->ResetDlHarqProcessStatus ((*itTb).second.harqProcessId);
harqUlInfo.m_receptionStatus = UlInfoListElement_s::Ok;
NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " send UL-HARQ-ACK");
m_harqPhyModule->ResetUlHarqProcessStatus (tbId.m_rnti, (*itTb).second.harqProcessId);
}
harqDlInfoMap.insert (std::pair <uint16_t, DlInfoListElement_s> (tbId.m_rnti, harqDlInfo));
if (!m_ltePhyUlHarqFeedbackCallback.IsNull ())
{
m_ltePhyUlHarqFeedbackCallback (harqUlInfo);
}
}
else
{
if ((*itTb).second.corrupt)
{
std::map <uint16_t, DlInfoListElement_s>::iterator itHarq = harqDlInfoMap.find (tbId.m_rnti);
if (itHarq==harqDlInfoMap.end ())
{
DlInfoListElement_s harqDlInfo;
harqDlInfo.m_harqStatus.resize (m_layersNum, DlInfoListElement_s::NACK);
harqDlInfo.m_rnti = tbId.m_rnti;
harqDlInfo.m_harqProcessId = (*itTb).second.harqProcessId;
if ((*itTb).second.corrupt)
{
harqDlInfo.m_harqStatus.at (tbId.m_layer) = DlInfoListElement_s::NACK;
NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " harqId " << (uint16_t)(*itTb).second.harqProcessId << " layer " <<(uint16_t)tbId.m_layer << " send DL-HARQ-NACK");
m_harqPhyModule->UpdateDlHarqProcessStatus ((*itTb).second.harqProcessId, tbId.m_layer, (*itTb).second.mi, (*itTb).second.size, (*itTb).second.size / EffectiveCodingRate [(*itTb).second.mcs]);
}
else
{
harqDlInfo.m_harqStatus.at (tbId.m_layer) = DlInfoListElement_s::ACK;
NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " harqId " << (uint16_t)(*itTb).second.harqProcessId << " layer " <<(uint16_t)tbId.m_layer << " size " << (*itTb).second.size << " send DL-HARQ-ACK");
m_harqPhyModule->ResetDlHarqProcessStatus ((*itTb).second.harqProcessId);
}
harqDlInfoMap.insert (std::pair <uint16_t, DlInfoListElement_s> (tbId.m_rnti, harqDlInfo));
}
else
{
(*itHarq).second.m_harqStatus.at (tbId.m_layer) = DlInfoListElement_s::NACK;
NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " harqId " << (uint16_t)(*itTb).second.harqProcessId << " layer " <<(uint16_t)tbId.m_layer << " size " << (*itHarq).second.m_harqStatus.size () << " send DL-HARQ-NACK");
m_harqPhyModule->UpdateDlHarqProcessStatus ((*itTb).second.harqProcessId, tbId.m_layer, (*itTb).second.mi, (*itTb).second.size, (*itTb).second.size / EffectiveCodingRate [(*itTb).second.mcs]);
if ((*itTb).second.corrupt)
{
(*itHarq).second.m_harqStatus.at (tbId.m_layer) = DlInfoListElement_s::NACK;
NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " harqId " << (uint16_t)(*itTb).second.harqProcessId << " layer " <<(uint16_t)tbId.m_layer << " size " << (*itHarq).second.m_harqStatus.size () << " send DL-HARQ-NACK");
m_harqPhyModule->UpdateDlHarqProcessStatus ((*itTb).second.harqProcessId, tbId.m_layer, (*itTb).second.mi, (*itTb).second.size, (*itTb).second.size / EffectiveCodingRate [(*itTb).second.mcs]);
}
else
{
NS_ASSERT_MSG (tbId.m_layer < (*itHarq).second.m_harqStatus.size (), " layer " << (uint16_t)tbId.m_layer);
(*itHarq).second.m_harqStatus.at (tbId.m_layer) = DlInfoListElement_s::ACK;
NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " harqId " << (uint16_t)(*itTb).second.harqProcessId << " layer " << (uint16_t)tbId.m_layer << " size " << (*itHarq).second.m_harqStatus.size () << " send DL-HARQ-ACK");
m_harqPhyModule->ResetDlHarqProcessStatus ((*itTb).second.harqProcessId);
}
}
else
{
NS_ASSERT_MSG (tbId.m_layer < (*itHarq).second.m_harqStatus.size (), " layer " << (uint16_t)tbId.m_layer);
(*itHarq).second.m_harqStatus.at (tbId.m_layer) = DlInfoListElement_s::ACK;
NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " harqId " << (uint16_t)(*itTb).second.harqProcessId << " layer " << (uint16_t)tbId.m_layer << " size " << (*itHarq).second.m_harqStatus.size () << " send DL-HARQ-ACK");
m_harqPhyModule->ResetDlHarqProcessStatus ((*itTb).second.harqProcessId);
}
}
} // end if ((*itTb).second.downlink) HARQ
} // end if ((*itTb).second.downlink) HARQ
} // end if (!(*itTb).second.harqFeedbackSent)
}
}
}

View File

@@ -69,6 +69,7 @@ struct tbInfo_t
double mi;
bool downlink;
bool corrupt;
bool harqFeedbackSent;
};
typedef std::map<TbId_t, tbInfo_t> expectedTbs_t;

View File

@@ -724,7 +724,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
m_dlInfoListBuffered.clear ();
}
std::vector <struct DlInfoListElement_s> dlInfoListUntxed;
for (uint8_t i = 0; i < m_dlInfoListBuffered.size (); i++)
for (uint16_t i = 0; i < m_dlInfoListBuffered.size (); i++)
{
std::set <uint16_t>::iterator itRnti = rntiAllocated.find (m_dlInfoListBuffered.at (i).m_rnti);
if (itRnti != rntiAllocated.end ())
@@ -1373,7 +1373,7 @@ PfFfMacScheduler::EstimateUlSinr (uint16_t rnti, uint16_t rb)
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));
NS_LOG_FUNCTION (this << " UL - Frame no. " << (params.m_sfnSf >> 4) << " subframe no. " << (0xF & params.m_sfnSf) << " size " << params.m_ulInfoList.size ());
RefreshUlCqiMaps ();
@@ -1410,8 +1410,9 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched
{
(*itProcId).second = ((*itProcId).second + 1) % HARQ_PROC_NUM;
}
for (uint8_t i = 0; i < params.m_ulInfoList.size (); i++)
{
for (uint16_t i = 0; i < params.m_ulInfoList.size (); i++)
{
if (params.m_ulInfoList.at (i).m_receptionStatus == UlInfoListElement_s::NotOk)
{
// retx correspondent block: retrieve the UL-DCI
@@ -1422,7 +1423,7 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched
NS_LOG_ERROR ("No info find in HARQ buffer for UE (might change eNB) " << rnti);
}
uint8_t harqId = (uint8_t)((*itProcId).second - HARQ_PERIOD) % HARQ_PROC_NUM;
NS_LOG_INFO (this << " UL-HARQ retx RNTI " << rnti << " harqId " << (uint16_t)harqId);
NS_LOG_INFO (this << " UL-HARQ retx RNTI " << rnti << " harqId " << (uint16_t)harqId << " i " << i << " size " << params.m_ulInfoList.size ());
std::map <uint16_t, UlHarqProcessesDciBuffer_t>::iterator itHarq = m_ulHarqProcessesDciBuffer.find (rnti);
if (itHarq == m_ulHarqProcessesDciBuffer.end ())
{
@@ -1436,7 +1437,7 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched
}
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;
@@ -1473,10 +1474,13 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched
ret.m_dciList.push_back (dci);
rntiAllocated.insert (dci.m_rnti);
}
else
{
NS_LOG_INFO (this << " HARQ-ACK feedback from RNTI " << params.m_ulInfoList.at (i).m_rnti);
}
}
}
std::map <uint16_t,uint32_t>::iterator it;
int nflows = 0;

View File

@@ -686,7 +686,7 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
m_dlInfoListBuffered.clear ();
}
std::vector <struct DlInfoListElement_s> dlInfoListUntxed;
for (uint8_t i = 0; i < m_dlInfoListBuffered.size (); i++)
for (uint16_t i = 0; i < m_dlInfoListBuffered.size (); i++)
{
std::set <uint16_t>::iterator itRnti = rntiAllocated.find (m_dlInfoListBuffered.at (i).m_rnti);
if (itRnti != rntiAllocated.end ())
@@ -1253,7 +1253,7 @@ RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched
{
(*itProcId).second = ((*itProcId).second + 1) % HARQ_PROC_NUM;
}
for (uint8_t i = 0; i < params.m_ulInfoList.size (); i++)
for (uint16_t i = 0; i < params.m_ulInfoList.size (); i++)
{
if (params.m_ulInfoList.at (i).m_receptionStatus == UlInfoListElement_s::NotOk)
{