This commit is contained in:
Nicola Baldo
2011-12-02 13:55:22 +01:00
7 changed files with 228 additions and 54 deletions

View File

@@ -98,6 +98,42 @@ LteFfConverter::getMinFpS11dot3Value ()
//static double g_lowestFpS11dot3Value = -4096; // 0x8001 (1000 0000 0000 0000)
uint32_t BufferSizeLevelBsrTable[64] = {
0, 10, 12, 14, 17, 19, 22, 26, 31, 36, 42, 49, 57, 67, 78, 91,
107, 125, 146, 171, 200, 234, 274, 321, 376, 440, 515, 603,
706, 826, 967, 1132, 1326, 1552, 1817, 2127, 2490, 2915, 3413,
3995, 4677, 5476, 6411, 7505, 8787, 10287, 12043, 14099, 16507,
19325, 22624, 26487, 31009, 36304, 42502, 49759, 58255,
68201, 79846, 93749, 109439, 128125, 150000, 150000
};
uint32_t
BufferSizeLevelBsr::BsrId2BufferSize (uint8_t val)
{
return BufferSizeLevelBsrTable[val];
}
uint8_t
BufferSizeLevelBsr::BufferSize2BsrId (uint32_t val)
{
int index = 0;
if (BufferSizeLevelBsrTable[63] < val)
{
index = 63;
}
else
{
while (BufferSizeLevelBsrTable[index] < val)
{
index++;
}
}
return (index);
}
}; // namespace ns3

View File

@@ -64,6 +64,18 @@ public:
//static const double MIN_FP_S11DOT3_VALUE = -4096;
};
class BufferSizeLevelBsr
{
public:
static uint32_t BsrId2BufferSize (uint8_t val);
static uint8_t BufferSize2BsrId (uint32_t val);
static int m_bufferSizeLevelBsr[64];
};

View File

@@ -32,6 +32,7 @@
#include <ns3/ff-mac-common.h>
#include <ns3/ideal-control-messages.h>
#include <ns3/simulator.h>
#include <ns3/lte-common.h>
NS_LOG_COMPONENT_DEFINE ("LteUeMac");
@@ -41,18 +42,6 @@ namespace ns3 {
NS_OBJECT_ENSURE_REGISTERED (LteUeMac);
int BufferSizeLevelBsr[64] = {
0, 10, 12, 14, 17, 19, 22, 26, 31, 36, 42, 49, 57, 67, 78, 91, 107, 125, 146,
171, 200, 234, 274, 321, 376, 440, 515, 603, 706, 826, 967, 1132, 1326, 1552,
1817, 2127, 2490, 2915, 3413, 3995, 4677, 5476, 6411, 7505, 8787, 10287,
12043, 14099, 16507, 19325, 22624, 26487, 31009, 36304, 42502, 49759, 58255,
68201, 79846, 93749, 109439, 128125, 150000, 150000
};
///////////////////////////////////////////////////////////
// SAP forwarders
///////////////////////////////////////////////////////////
@@ -298,18 +287,7 @@ LteUeMac::SendReportBufferStatus (void)
for (it = m_ulBsrReceived.begin (); it != m_ulBsrReceived.end (); it++)
{
int queue = (*it).second;
int index = 0;
if (BufferSizeLevelBsr[63] < queue)
{
index = 63;
}
else
{
while (BufferSizeLevelBsr[index] < queue)
{
index++;
}
}
int index = BufferSizeLevelBsr::BufferSize2BsrId (queue);
bsr.m_macCeValue.m_bufferStatus.push_back (index);
}

View File

@@ -582,6 +582,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
// NS_LOG_DEBUG (this << " LCID " << (uint32_t) newRlcEl.m_logicalChannelIdentity << " size " << rlcPduSize);
newRlcEl.m_size = rlcPduSize;
newRlcPduLe.push_back (newRlcEl);
UpdateDlRlcBufferInfo (newDci.m_rnti, newRlcEl.m_logicalChannelIdentity, rlcPduSize);
}
if ((*itBufReq).first.m_rnti > (*itMap).first)
{
@@ -741,7 +742,7 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched
RefreshUlCqiMaps ();
std::map <uint16_t,uint8_t>::iterator it;
std::map <uint16_t,uint32_t>::iterator it;
int nflows = 0;
for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++)
@@ -858,7 +859,8 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched
rbgAllocationMap.push_back ((*it).first);
}
uldci.m_tbSize = (LteAmc::GetTbSizeFromMcs (uldci.m_mcs, rbPerFlow) / 8);
// 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);
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);
UpdateUlRlcBufferInfo (uldci.m_rnti, uldci.m_tbSize);
uldci.m_ndi = 1;
uldci.m_cceIndex = 0;
uldci.m_aggrLevel = 1;
@@ -941,29 +943,30 @@ PfFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvider::S
{
NS_LOG_FUNCTION (this);
std::map <uint16_t,uint8_t>::iterator it;
std::map <uint16_t,uint32_t>::iterator it;
for (unsigned int i = 0; i < params.m_macCeList.size (); i++)
{
if ( params.m_macCeList.at (i).m_macCeType == MacCeListElement_s::BSR )
{
if ( params.m_macCeList.at (i).m_macCeType == MacCeListElement_s::BSR )
{
// buffer status report
uint16_t rnti = params.m_macCeList.at (i).m_rnti;
it = m_ceBsrRxed.find (rnti);
if (it == m_ceBsrRxed.end ())
{
// create the new entry
uint8_t bsr = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0);
m_ceBsrRxed.insert ( std::pair<uint16_t, uint8_t > (rnti, bsr)); // only 1 buffer status is working now
}
else
{
// update the CQI value
(*it).second = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0);
}
}
// buffer status report
uint16_t rnti = params.m_macCeList.at (i).m_rnti;
it = m_ceBsrRxed.find (rnti);
if (it == m_ceBsrRxed.end ())
{
// create the new entry
uint8_t bsrId = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0);
int buffer = BufferSizeLevelBsr::BsrId2BufferSize (bsrId);
m_ceBsrRxed.insert ( std::pair<uint16_t, uint32_t > (rnti, buffer)); // only 1 buffer status is working now
}
else
{
// update the CQI value
(*it).second = BufferSizeLevelBsr::BsrId2BufferSize (params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0));
}
}
}
return;
}
@@ -1119,5 +1122,73 @@ PfFfMacScheduler::RefreshUlCqiMaps(void)
return;
}
void
PfFfMacScheduler::UpdateDlRlcBufferInfo (uint16_t rnti, uint8_t lcid, uint16_t size)
{
std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
LteFlowId_t flow (rnti, lcid);
it = m_rlcBufferReq.find (flow);
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);
// Update queues: RLC tx order Status, ReTx, Tx
// Update status queue
if ((*it).second.m_rlcStatusPduSize <= size)
{
size -= (*it).second.m_rlcStatusPduSize;
(*it).second.m_rlcStatusPduSize = 0;
}
else
{
(*it).second.m_rlcStatusPduSize -= size;
return;
}
// update retransmission queue
if ((*it).second.m_rlcRetransmissionQueueSize <= size)
{
size -= (*it).second.m_rlcRetransmissionQueueSize;
(*it).second.m_rlcRetransmissionQueueSize = 0;
}
else
{
(*it).second.m_rlcRetransmissionQueueSize -= size;
return;
}
// update transmission queue
if ((*it).second.m_rlcTransmissionQueueSize <= size)
{
size -= (*it).second.m_rlcTransmissionQueueSize;
(*it).second.m_rlcTransmissionQueueSize = 0;
}
else
{
(*it).second.m_rlcTransmissionQueueSize -= size;
return;
}
}
else
{
NS_LOG_ERROR (this << " Does not find DL RLC Buffer Report of UE " << rnti);
}
}
void
PfFfMacScheduler::UpdateUlRlcBufferInfo (uint16_t rnti, uint16_t size)
{
std::map <uint16_t,uint32_t>::iterator it = m_ceBsrRxed.find (rnti);
if (it!=m_ceBsrRxed.end ())
{
// NS_LOG_DEBUG (this << " UE " << rnti << " size " << size << " BSR " << (*it).second);
(*it).second -= size;
}
else
{
NS_LOG_ERROR (this << " Does not find BSR report info of UE " << rnti);
}
}
}

View File

@@ -137,6 +137,9 @@ private:
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);
/*
* Vectors of UE's LC info
@@ -191,7 +194,7 @@ private:
/*
* Map of UE's buffer status reports received
*/
std::map <uint16_t,uint8_t> m_ceBsrRxed;
std::map <uint16_t,uint32_t> m_ceBsrRxed;
// MAC SAPs
FfMacCschedSapUser* m_cschedSapUser;

View File

@@ -36,6 +36,8 @@ int Type0AllocationRbg[4] = {
}; // see table 7.1.6.1-1 of 36.213
NS_OBJECT_ENSURE_REGISTERED (RrFfMacScheduler);
@@ -522,6 +524,7 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
newRlcEl.m_logicalChannelIdentity = (*it).m_logicalChannelIdentity;
NS_LOG_DEBUG (this << "LCID " << (uint32_t) newRlcEl.m_logicalChannelIdentity << " size " << rlcPduSize << " ID " << (*it).m_rnti);
newRlcEl.m_size = rlcPduSize;
UpdateDlRlcBufferInfo ((*it).m_rnti, newRlcEl.m_logicalChannelIdentity, rlcPduSize);
newRlcPduLe.push_back (newRlcEl);
it++;
if (it == m_rlcBufferReq.end ())
@@ -629,7 +632,7 @@ RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched
RefreshUlCqiMaps ();
std::map <uint16_t,uint8_t>::iterator it;
std::map <uint16_t,uint32_t>::iterator it;
int nflows = 0;
for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++)
@@ -737,7 +740,8 @@ RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched
rbgAllocationMap.push_back ((*it).first);
}
uldci.m_tbSize = (LteAmc::GetTbSizeFromMcs (uldci.m_mcs, rbPerFlow) / 8); // MCS 0 -> UL-AMC TBD
uldci.m_tbSize = (LteAmc::GetTbSizeFromMcs (uldci.m_mcs, rbPerFlow) / 8);
UpdateUlRlcBufferInfo (uldci.m_rnti, uldci.m_tbSize);
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);
uldci.m_ndi = 1;
uldci.m_cceIndex = 0;
@@ -792,7 +796,7 @@ RrFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvider::S
{
NS_LOG_FUNCTION (this);
std::map <uint16_t,uint8_t>::iterator it;
std::map <uint16_t,uint32_t>::iterator it;
for (unsigned int i = 0; i < params.m_macCeList.size (); i++)
{
@@ -804,13 +808,14 @@ RrFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvider::S
if (it == m_ceBsrRxed.end ())
{
// create the new entry
uint8_t bsr = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0);
m_ceBsrRxed.insert ( std::pair<uint16_t, uint8_t > (rnti, bsr)); // only 1 buffer status is working now
uint8_t bsrId = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0);
int buffer = BufferSizeLevelBsr::BsrId2BufferSize (bsrId);
m_ceBsrRxed.insert ( std::pair<uint16_t, uint32_t > (rnti, buffer)); // only 1 buffer status is working now
}
else
{
// update the CQI value
(*it).second = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0);
(*it).second = BufferSizeLevelBsr::BsrId2BufferSize (params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0));
}
}
}
@@ -949,4 +954,70 @@ RrFfMacScheduler::RefreshUlCqiMaps(void)
return;
}
void
RrFfMacScheduler::UpdateDlRlcBufferInfo (uint16_t rnti, uint8_t lcid, uint16_t size)
{
std::list<FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
for (it = m_rlcBufferReq.begin (); it != m_rlcBufferReq.end (); it++)
{
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);
// Update queues: RLC tx order Status, ReTx, Tx
// Update status queue
if ((*it).m_rlcStatusPduSize <= size)
{
size -= (*it).m_rlcStatusPduSize;
(*it).m_rlcStatusPduSize = 0;
}
else
{
(*it).m_rlcStatusPduSize -= size;
return;
}
// update retransmission queue
if ((*it).m_rlcRetransmissionQueueSize <= size)
{
size -= (*it).m_rlcRetransmissionQueueSize;
(*it).m_rlcRetransmissionQueueSize = 0;
}
else
{
(*it).m_rlcRetransmissionQueueSize -= size;
return;
}
// update transmission queue
if ((*it).m_rlcTransmissionQueueSize <= size)
{
size -= (*it).m_rlcTransmissionQueueSize;
(*it).m_rlcTransmissionQueueSize = 0;
}
else
{
(*it).m_rlcTransmissionQueueSize -= size;
return;
}
return;
}
}
}
void
RrFfMacScheduler::UpdateUlRlcBufferInfo (uint16_t rnti, uint16_t size)
{
std::map <uint16_t,uint32_t>::iterator it = m_ceBsrRxed.find (rnti);
if (it!=m_ceBsrRxed.end ())
{
// NS_LOG_DEBUG (this << " UE " << rnti << " szie " << size << " BSR " << (*it).second);
(*it).second -= size;
}
else
{
NS_LOG_ERROR (this << " Does not find BSR report info of UE " << rnti);
}
}
}

View File

@@ -123,6 +123,9 @@ private:
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);
/*
* Vectors of UE's RLC info
@@ -158,7 +161,7 @@ private:
/*
* Map of UE's buffer status reports received
*/
std::map <uint16_t,uint8_t> m_ceBsrRxed;
std::map <uint16_t,uint32_t> m_ceBsrRxed;
// MAC SAPs
FfMacCschedSapUser* m_cschedSapUser;