refactoring lteFlowId_t struct
This commit is contained in:
@@ -67,7 +67,7 @@ void
|
||||
RlcStatsCalculator::TxPdu (uint16_t rnti, uint8_t lcid, uint32_t packetSize)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << "TxPDU" << rnti << (uint32_t) lcid << packetSize);
|
||||
lteFlowId_t pair = lteFlowId_t(rnti, lcid);
|
||||
lteFlowId_t pair (rnti, lcid);
|
||||
|
||||
m_txPackets[pair]++;
|
||||
}
|
||||
@@ -76,7 +76,7 @@ void
|
||||
RlcStatsCalculator::RxPdu (uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << "RxPDU" << rnti << (uint32_t) lcid << packetSize << delay);
|
||||
lteFlowId_t pair = lteFlowId_t(rnti, lcid);
|
||||
lteFlowId_t pair (rnti, lcid);
|
||||
|
||||
m_rxPackets [pair]++;
|
||||
m_rxData [pair] += packetSize;
|
||||
@@ -183,36 +183,36 @@ RlcStatsCalculator::GetThroughput (lteFlowId_t p)
|
||||
uint32_t
|
||||
RlcStatsCalculator::GetTxPackets (uint16_t rnti, uint8_t lcid)
|
||||
{
|
||||
lteFlowId_t p = lteFlowId_t (rnti, lcid);
|
||||
return GetTxPackets(p);
|
||||
lteFlowId_t p (rnti, lcid);
|
||||
return GetTxPackets (p);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
RlcStatsCalculator::GetRxPackets (uint16_t rnti, uint8_t lcid)
|
||||
{
|
||||
lteFlowId_t p = lteFlowId_t (rnti, lcid);
|
||||
return GetRxPackets(p);
|
||||
lteFlowId_t p (rnti, lcid);
|
||||
return GetRxPackets (p);
|
||||
}
|
||||
|
||||
uint64_t
|
||||
RlcStatsCalculator::GetRxData (uint16_t rnti, uint8_t lcid)
|
||||
{
|
||||
lteFlowId_t p = lteFlowId_t (rnti, lcid);
|
||||
return GetRxData(p);
|
||||
lteFlowId_t p (rnti, lcid);
|
||||
return GetRxData (p);
|
||||
}
|
||||
|
||||
uint64_t
|
||||
RlcStatsCalculator::GetDelay (uint16_t rnti, uint8_t lcid)
|
||||
{
|
||||
lteFlowId_t p = lteFlowId_t (rnti, lcid);
|
||||
return GetDelay(p);
|
||||
lteFlowId_t p (rnti, lcid);
|
||||
return GetDelay (p);
|
||||
}
|
||||
|
||||
double
|
||||
RlcStatsCalculator::GetThroughput (uint16_t rnti, uint8_t lcid)
|
||||
{
|
||||
lteFlowId_t p = lteFlowId_t (rnti, lcid);
|
||||
return GetThroughput(p);
|
||||
lteFlowId_t p (rnti, lcid);
|
||||
return GetThroughput (p);
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -41,19 +41,6 @@ namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (LteEnbMac);
|
||||
|
||||
bool
|
||||
operator< (const flowId_t& lhs, const flowId_t& rhs)
|
||||
{
|
||||
if (lhs.m_rnti == rhs.m_rnti)
|
||||
{
|
||||
return (lhs.m_lcId < rhs.m_lcId);
|
||||
}
|
||||
else
|
||||
{
|
||||
return (lhs.m_rnti < rhs.m_rnti);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// //////////////////////////////////////
|
||||
@@ -571,10 +558,8 @@ LteEnbMac::DoReceivePhyPdu (Ptr<Packet> p)
|
||||
|
||||
|
||||
// forward the packet to the correspondent RLC
|
||||
flowId_t flow;
|
||||
flow.m_rnti = tag.GetRnti ();
|
||||
flow.m_lcId = tag.GetLcid ();
|
||||
std::map <flowId_t, LteMacSapUser* >::iterator it2;
|
||||
lteFlowId_t flow ( tag.GetRnti (), tag.GetLcid () );
|
||||
std::map <lteFlowId_t, LteMacSapUser* >::iterator it2;
|
||||
it2 = m_rlcAttached.find (flow);
|
||||
NS_ASSERT_MSG (it2 != m_rlcAttached.end (), "UE not attached rnti=" << flow.m_rnti << " lcid=" << (uint32_t) flow.m_lcId);
|
||||
(*it2).second->ReceivePdu (p);
|
||||
@@ -615,16 +600,14 @@ void
|
||||
LteEnbMac::DoAddLc (LteEnbCmacSapProvider::LcInfo lcinfo, LteMacSapUser* msu)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
std::map <flowId_t, LteMacSapUser* >::iterator it;
|
||||
std::map <lteFlowId_t, LteMacSapUser* >::iterator it;
|
||||
|
||||
flowId_t flow;
|
||||
flow.m_rnti = lcinfo.rnti;
|
||||
flow.m_lcId = lcinfo.lcId;
|
||||
lteFlowId_t flow (lcinfo.rnti, lcinfo.lcId);
|
||||
|
||||
it = m_rlcAttached.find (flow);
|
||||
if (it == m_rlcAttached.end ())
|
||||
{
|
||||
m_rlcAttached.insert (std::pair<flowId_t, LteMacSapUser* > (flow, msu));
|
||||
m_rlcAttached.insert (std::pair<lteFlowId_t, LteMacSapUser* > (flow, msu));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -711,15 +694,14 @@ LteEnbMac::DoSchedDlConfigInd (FfMacSchedSapUser::SchedDlConfigIndParameters ind
|
||||
NS_LOG_FUNCTION (this);
|
||||
// Create DL PHY PDU
|
||||
Ptr<PacketBurst> pb = CreateObject<PacketBurst> ();
|
||||
std::map <flowId_t, LteMacSapUser* >::iterator it;
|
||||
std::map <lteFlowId_t, LteMacSapUser* >::iterator it;
|
||||
|
||||
for (unsigned int i = 0; i < ind.m_buildDataList.size (); i++)
|
||||
{
|
||||
for (unsigned int j = 0; j < ind.m_buildDataList.at (i).m_rlcPduList.size (); j++)
|
||||
{
|
||||
flowId_t flow;
|
||||
flow.m_rnti = ind.m_buildDataList.at (i).m_rnti;
|
||||
flow.m_lcId = ind.m_buildDataList.at (i).m_rlcPduList.at (j).at (0).m_logicalChannelIdentity;
|
||||
lteFlowId_t flow (ind.m_buildDataList.at (i).m_rnti,
|
||||
ind.m_buildDataList.at (i).m_rlcPduList.at (j).at (0).m_logicalChannelIdentity);
|
||||
it = m_rlcAttached.find (flow);
|
||||
NS_ASSERT_MSG (it != m_rlcAttached.end (), "rnti=" << flow.m_rnti << " lcid=" << (uint32_t) flow.m_lcId);
|
||||
(*it).second->NotifyTxOpportunity (ind.m_buildDataList.at (i).m_rlcPduList.at (j).at (0).m_size); // second [] is for TB
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <ns3/lte-common.h>
|
||||
#include <ns3/lte-mac-sap.h>
|
||||
#include <ns3/lte-enb-cmac-sap.h>
|
||||
#include <ns3/ff-mac-csched-sap.h>
|
||||
@@ -38,14 +39,6 @@ class UlCqiIdealControlMessage;
|
||||
class PdcchMapIdealControlMessage;
|
||||
|
||||
|
||||
struct flowId_t
|
||||
{
|
||||
uint16_t m_rnti;
|
||||
uint8_t m_lcId;
|
||||
};
|
||||
|
||||
bool operator< (const flowId_t& lhs, const flowId_t& rhs);
|
||||
|
||||
|
||||
/**
|
||||
* This class implements the MAC layer of the eNodeB device
|
||||
@@ -192,7 +185,7 @@ public:
|
||||
private:
|
||||
private:
|
||||
// std::map <uint16_t, std::map <uint8_t,Ptr<LteMacSapUser> > > m_rlcAttached;
|
||||
std::map <flowId_t, LteMacSapUser*> m_rlcAttached;
|
||||
std::map <lteFlowId_t, LteMacSapUser*> m_rlcAttached;
|
||||
|
||||
std::vector <CqiListElement_s> m_dlCqiReceived; // CQI received
|
||||
std::vector <MacCeListElement_s> m_ulCeReceived; // CE received (BSR up to now)
|
||||
|
||||
@@ -40,19 +40,6 @@ int PfType0AllocationRbg[4] = {
|
||||
NS_OBJECT_ENSURE_REGISTERED (PfFfMacScheduler);
|
||||
|
||||
|
||||
bool
|
||||
operator< (const pfsFlowId_t& lhs, const pfsFlowId_t& rhs)
|
||||
{
|
||||
if (lhs.m_rnti == rhs.m_rnti)
|
||||
{
|
||||
return (lhs.m_lcId < rhs.m_lcId);
|
||||
}
|
||||
else
|
||||
{
|
||||
return (lhs.m_rnti < rhs.m_rnti);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class PfSchedulerMemberCschedSapProvider : public FfMacCschedSapProvider
|
||||
{
|
||||
@@ -302,12 +289,10 @@ PfFfMacScheduler::DoCschedLcConfigReq (const struct FfMacCschedSapProvider::Csch
|
||||
{
|
||||
NS_LOG_FUNCTION (this << " New LC, rnti: " << params.m_rnti);
|
||||
|
||||
std::map <pfsFlowId_t, pfsFlowPerf_t>::iterator it;
|
||||
std::map <lteFlowId_t, pfsFlowPerf_t>::iterator it;
|
||||
for (uint16_t i = 0; i < params.m_logicalChannelConfigList.size (); i++)
|
||||
{
|
||||
pfsFlowId_t flow;
|
||||
flow.m_rnti = params.m_rnti;
|
||||
flow.m_lcId = params.m_logicalChannelConfigList.at (i).m_logicalChannelIdentity;
|
||||
lteFlowId_t flow (params.m_rnti, params.m_logicalChannelConfigList.at (i).m_logicalChannelIdentity);
|
||||
|
||||
it = m_flowStats.find (flow);
|
||||
|
||||
@@ -321,7 +306,7 @@ PfFfMacScheduler::DoCschedLcConfigReq (const struct FfMacCschedSapProvider::Csch
|
||||
flowStats.rlcBufferReq.m_rlcTransmissionQueueSize = 0;
|
||||
flowStats.rlcBufferReq.m_rlcRetransmissionQueueSize = 0;
|
||||
flowStats.rlcBufferReq.m_rlcStatusPduSize = 0;
|
||||
m_flowStats.insert (std::pair<pfsFlowId_t, pfsFlowPerf_t> (flow, flowStats));
|
||||
m_flowStats.insert (std::pair<lteFlowId_t, pfsFlowPerf_t> (flow, flowStats));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -356,11 +341,9 @@ PfFfMacScheduler::DoSchedDlRlcBufferReq (const struct FfMacSchedSapProvider::Sch
|
||||
// API generated by RLC for updating RLC parameters on a LC (tx and retx queues)
|
||||
|
||||
|
||||
std::map <pfsFlowId_t, pfsFlowPerf_t>::iterator it;
|
||||
std::map <lteFlowId_t, pfsFlowPerf_t>::iterator it;
|
||||
|
||||
pfsFlowId_t flow;
|
||||
flow.m_rnti = params.m_rnti;
|
||||
flow.m_lcId = params.m_logicalChannelIdentity;
|
||||
lteFlowId_t flow (params.m_rnti, params.m_logicalChannelIdentity);
|
||||
|
||||
it = m_flowStats.find (flow);
|
||||
|
||||
@@ -419,12 +402,12 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
|
||||
// Resource allocation type 0 (see sec 7.1.6.1 of 36.213)
|
||||
int rbgSize = GetRbgSize (m_cschedCellConfig.m_dlBandwidth);
|
||||
int rbgNum = m_cschedCellConfig.m_dlBandwidth / rbgSize;
|
||||
std::vector <pfsFlowId_t> rbgAllocationMap;
|
||||
std::vector <lteFlowId_t> rbgAllocationMap;
|
||||
for (int i = 0; i < rbgNum; i++)
|
||||
{
|
||||
//NS_LOG_DEBUG (this << " ALLOCATION for RBG " << i << " of " << rbgNum);
|
||||
std::map <pfsFlowId_t, pfsFlowPerf_t>::iterator it;
|
||||
std::map <pfsFlowId_t, pfsFlowPerf_t>::iterator itMax = m_flowStats.begin ();
|
||||
std::map <lteFlowId_t, pfsFlowPerf_t>::iterator it;
|
||||
std::map <lteFlowId_t, pfsFlowPerf_t>::iterator itMax = m_flowStats.begin ();
|
||||
double rcqiMax = 0.0;
|
||||
for (it = m_flowStats.begin (); it != m_flowStats.end (); it++)
|
||||
{
|
||||
@@ -466,7 +449,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
|
||||
{
|
||||
// no UE available for this RB
|
||||
//NS_LOG_DEBUG (this << " no UE found");
|
||||
pfsFlowId_t nullFlow;
|
||||
lteFlowId_t nullFlow;
|
||||
nullFlow.m_rnti = 0;
|
||||
rbgAllocationMap.push_back (nullFlow);
|
||||
}
|
||||
@@ -480,7 +463,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
|
||||
// generate the transmission opportunities by grouping the adjacent RBGs and
|
||||
// creating the correspondent DCIs
|
||||
FfMacSchedSapUser::SchedDlConfigIndParameters ret;
|
||||
std::vector <pfsFlowId_t>:: iterator flowIt = rbgAllocationMap.begin ();
|
||||
std::vector <lteFlowId_t>:: iterator flowIt = rbgAllocationMap.begin ();
|
||||
int rbgAllocated = 0;
|
||||
while (flowIt != rbgAllocationMap.end ())
|
||||
{
|
||||
@@ -557,7 +540,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
|
||||
ret.m_buildDataList.push_back (newEl);
|
||||
|
||||
// update UE-LC stats
|
||||
std::map <pfsFlowId_t, pfsFlowPerf_t>::iterator it;
|
||||
std::map <lteFlowId_t, pfsFlowPerf_t>::iterator it;
|
||||
it = m_flowStats.find ((*flowIt));
|
||||
if (it != m_flowStats.end())
|
||||
{
|
||||
@@ -587,7 +570,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
|
||||
ret.m_nrOfPdcchOfdmSymbols = 1; // TODO: check correct value according the DCIs txed
|
||||
|
||||
// update the UE-LC stats
|
||||
std::map <pfsFlowId_t, pfsFlowPerf_t>::iterator it;
|
||||
std::map <lteFlowId_t, pfsFlowPerf_t>::iterator it;
|
||||
for (it = m_flowStats.begin (); it != m_flowStats.end (); it++)
|
||||
{
|
||||
(*it).second.totalBytesTransmitted += (*it).second.lastTtiBytesTrasmitted;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#ifndef PF_FF_MAC_SCHEDULER_H
|
||||
#define PF_FF_MAC_SCHEDULER_H
|
||||
|
||||
#include <ns3/lte-common.h>
|
||||
#include <ns3/ff-mac-csched-sap.h>
|
||||
#include <ns3/ff-mac-sched-sap.h>
|
||||
#include <ns3/ff-mac-scheduler.h>
|
||||
@@ -30,15 +31,7 @@
|
||||
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
|
||||
struct pfsFlowId_t
|
||||
{
|
||||
uint16_t m_rnti;
|
||||
uint8_t m_lcId;
|
||||
};
|
||||
|
||||
bool operator< (const pfsFlowId_t& lhs, const pfsFlowId_t& rhs);
|
||||
|
||||
struct pfsFlowPerf_t
|
||||
{
|
||||
@@ -145,7 +138,7 @@ private:
|
||||
/*
|
||||
* Map of UE-LC statistics
|
||||
*/
|
||||
std::map <pfsFlowId_t, pfsFlowPerf_t> m_flowStats;
|
||||
std::map <lteFlowId_t, pfsFlowPerf_t> m_flowStats;
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user