Avoid negative queue statistics in updating BSR reports in LteUeMac::DoReceiveIdealControlMessage and remove long uint

This commit is contained in:
Marco Miozzo
2012-03-07 18:07:35 +01:00
parent 75c404b881
commit a3fd05fb7c
2 changed files with 14 additions and 7 deletions

View File

@@ -258,7 +258,7 @@ LteUeMac::DoReportBufferStatus (LteMacSapProvider::ReportBufferStatusParameters
{
NS_LOG_FUNCTION (this);
std::map <uint8_t, long uint>::iterator it;
std::map <uint8_t, uint64_t>::iterator it;
it = m_ulBsrReceived.find (params.lcid);
@@ -269,7 +269,7 @@ LteUeMac::DoReportBufferStatus (LteMacSapProvider::ReportBufferStatusParameters
}
else
{
m_ulBsrReceived.insert (std::pair<uint8_t, long uint> (params.lcid, params.txQueueSize + params.retxQueueSize + params.statusPduSize));
m_ulBsrReceived.insert (std::pair<uint8_t, uint64_t> (params.lcid, params.txQueueSize + params.retxQueueSize + params.statusPduSize));
}
m_freshUlBsr = true;
}
@@ -287,7 +287,7 @@ LteUeMac::SendReportBufferStatus (void)
bsr.m_rnti = m_rnti;
bsr.m_macCeType = MacCeListElement_s::BSR;
// BSR
std::map <uint8_t, long uint>::iterator it;
std::map <uint8_t, uint64_t>::iterator it;
NS_ASSERT_MSG (m_ulBsrReceived.size () <=4, " Too many LCs (max is 4)");
for (it = m_ulBsrReceived.begin (); it != m_ulBsrReceived.end (); it++)
@@ -351,9 +351,9 @@ LteUeMac::DoReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
{
Ptr<UlDciIdealControlMessage> msg2 = DynamicCast<UlDciIdealControlMessage> (msg);
UlDciListElement_s dci = msg2->GetDci ();
std::map <uint8_t, long uint>::iterator itBsr;
std::map <uint8_t, uint64_t>::iterator itBsr;
NS_ASSERT_MSG (m_ulBsrReceived.size () <=4, " Too many LCs (max is 4)");
int activeLcs = 0;
uint16_t activeLcs = 0;
for (itBsr = m_ulBsrReceived.begin (); itBsr != m_ulBsrReceived.end (); itBsr++)
{
if ((*itBsr).second > 0)
@@ -375,7 +375,14 @@ LteUeMac::DoReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
{
NS_LOG_FUNCTION (this << "\t" << dci.m_tbSize / m_macSapUserMap.size () << " bytes to LC " << (uint16_t)(*it).first << " queue " << (*itBsr).second);
(*it).second->NotifyTxOpportunity (dci.m_tbSize / activeLcs);
(*itBsr).second -= dci.m_tbSize / activeLcs;
if ((*itBsr).second >= dci.m_tbSize / activeLcs)
{
(*itBsr).second -= dci.m_tbSize / activeLcs;
}
else
{
(*itBsr).second = 0;
}
}
}

View File

@@ -99,7 +99,7 @@ private:
LteUePhySapProvider* m_uePhySapProvider;
LteUePhySapUser* m_uePhySapUser;
std::map <uint8_t, long uint> m_ulBsrReceived; // BSR received from RLC (BSR up to now)
std::map <uint8_t, uint64_t> m_ulBsrReceived; // BSR received from RLC (BSR up to now)
Time m_bsrPeriodicity;
Time m_bsrLast;