5#include "nr-mac-scheduler-lcg.h"
7#include "nr-eps-bearer.h"
14NS_LOG_COMPONENT_DEFINE(
"NrMacSchedulerLCG");
17 : m_id(conf.m_logicalChannelIdentity)
32 NS_LOG_FUNCTION(
this);
53 NS_LOG_FUNCTION(
this);
60 NS_LOG_FUNCTION(
this);
61 return m_lcMap.find(lcId) != m_lcMap.end();
67 NS_LOG_FUNCTION(
this);
68 return static_cast<uint32_t
>(m_lcMap.size());
74 NS_LOG_FUNCTION(
this);
76 return m_lcMap.emplace(lc->m_id, std::move(lc)).second;
82 NS_LOG_FUNCTION(
this);
90 NS_LOG_FUNCTION(
this);
91 NS_ABORT_IF(m_lcMap.size() > 1);
92 uint32_t lcIdPart = lcgQueueSize / m_lcMap.size();
94 for (
auto& lc : m_lcMap)
96 lc.second->m_rlcTransmissionQueueSize = lcIdPart;
103 NS_LOG_FUNCTION(
this);
104 uint32_t totalSize = 0;
105 for (
const auto& lc : m_lcMap)
107 totalSize += lc.second->GetTotalSize();
109 NS_LOG_INFO(
"Total size: " << totalSize);
116 NS_LOG_FUNCTION(
this);
117 NS_ABORT_IF(m_lcMap.empty());
118 return m_lcMap.at(lcId)->GetTotalSize();
124 std::vector<uint8_t> ret;
125 ret.reserve(m_lcMap.size());
126 for (
const auto& lc : m_lcMap)
128 ret.emplace_back(lc.first);
136 NS_LOG_FUNCTION(
this);
137 std::vector<uint8_t> ret;
138 for (
const auto& lc : m_lcMap)
142 ret.emplace_back(lc.first);
151 NS_LOG_FUNCTION(
this);
152 return m_lcMap.at(lcId)->m_qci;
155std::unique_ptr<NrMacSchedulerLC>&
158 NS_LOG_FUNCTION(
this);
160 NS_ASSERT(!m_lcMap.empty());
163 return m_lcMap.at(lcId);
169 NS_LOG_FUNCTION(
this);
170 NS_ASSERT(!m_lcMap.empty());
172 NS_LOG_INFO(
"Assigning " << size <<
" bytes to lcId: " << +lcId);
175 NS_LOG_INFO(
"Status of LCID " <<
static_cast<uint32_t
>(lcId)
176 <<
" before: RLC PDU =" << m_lcMap.at(lcId)->m_rlcStatusPduSize
177 <<
", RLC RX=" << m_lcMap.at(lcId)->m_rlcRetransmissionQueueSize
178 <<
", RLC TX=" << m_lcMap.at(lcId)->m_rlcTransmissionQueueSize);
180 if ((m_lcMap.at(lcId)->m_rlcStatusPduSize > 0) &&
181 (size >= m_lcMap.at(lcId)->m_rlcStatusPduSize))
183 m_lcMap.at(lcId)->m_rlcStatusPduSize = 0;
185 else if ((m_lcMap.at(lcId)->m_rlcRetransmissionQueueSize > 0) &&
186 (size >= m_lcMap.at(lcId)->m_rlcRetransmissionQueueSize))
188 m_lcMap.at(lcId)->m_rlcRetransmissionQueueSize = 0;
190 else if (m_lcMap.at(lcId)->m_rlcTransmissionQueueSize >
194 uint32_t rlcOverhead = 0;
197 if (lcId == 1 && type ==
"DL")
211 if (size - rlcOverhead >= m_lcMap.at(lcId)->m_rlcTransmissionQueueSize)
214 m_lcMap.at(lcId)->m_rlcTransmissionQueueSize = 0;
220 m_lcMap.at(lcId)->m_rlcTransmissionQueueSize -= size - rlcOverhead;
231 if (type ==
"UL" && m_lcMap.at(lcId)->m_rlcTransmissionQueueSize > 0 &&
232 m_lcMap.at(lcId)->m_rlcTransmissionQueueSize < 12)
234 m_lcMap.at(lcId)->m_rlcTransmissionQueueSize = 12;
239 if (type ==
"DL" && m_lcMap.at(lcId)->m_rlcTransmissionQueueSize > 0 &&
240 m_lcMap.at(lcId)->m_rlcTransmissionQueueSize < 10)
242 m_lcMap.at(lcId)->m_rlcTransmissionQueueSize = 10;
247 NS_LOG_WARN(
" This opportunity cannot be used, not enough bytes to perform retransmission "
248 "or not active flows.");
251 NS_LOG_INFO(
"Status of LCID " <<
static_cast<uint32_t
>(lcId)
252 <<
" after: RLC PDU=" << m_lcMap.at(lcId)->m_rlcStatusPduSize
253 <<
", RLC RX=" << m_lcMap.at(lcId)->m_rlcRetransmissionQueueSize
254 <<
", RLC TX=" << m_lcMap.at(lcId)->m_rlcTransmissionQueueSize);
258NrMacSchedulerLCG::ReleaseLC(uint8_t lcId)
This class contains the specification of EPS Bearers.
uint16_t GetPacketDelayBudgetMs() const
uint8_t GetPriority() const
uint8_t GetResourceType() const
double GetPacketErrorLossRate() const
uint32_t NumOfLC() const
Get the number of LC currently in the LCG.
NrMacSchedulerLCG(uint8_t id)
NrMacSchedulerLCG constructor.
bool Insert(LCPtr &&lc)
Insert LC in the group.
std::vector< uint8_t > GetActiveLCIds() const
Get a vector of the active LC IDs.
std::unique_ptr< NrMacSchedulerLC > & GetLC(uint8_t lcId)
Get the LC Ptr for a specific LC ID.
bool Contains(uint8_t lcId) const
Check if the LCG contains the LC id specified.
uint32_t GetTotalSize() const
Get the total size of the LCG.
uint8_t GetQci(uint8_t lcId) const
Get the QoS Class Identifier of the flow.
std::vector< uint8_t > GetLCId() const
Get a vector of LC ID.
void UpdateInfo(const NrMacSchedSapProvider::SchedDlRlcBufferReqParameters ¶ms)
Update the LCG with a message coming from RLC in the gNB.
uint32_t GetTotalSizeOfLC(uint8_t lcId) const
Get TotalSize Of LC.
void AssignedData(uint8_t lcId, uint32_t size, std::string type)
Inform the LCG of the assigned data to a LC id.
void Update(const NrMacSchedSapProvider::SchedDlRlcBufferReqParameters ¶ms)
Overwrite all the parameters with the one contained in the message.
uint8_t m_resourceType
the resource type associated with the QCI of the flow
uint64_t m_eRabGuaranteedBitrateDl
ERAB guaranteed bit rate DL.
uint32_t GetTotalSize() const
Get the total size of the LC.
double m_PER
PER of the flow.
uint8_t m_qci
QoS Class Identifier of the flow.
uint32_t m_rlcTransmissionQueueSize
The current size of the new transmission queue in byte.
NrMacSchedulerLC()=delete
NrMacSchedulerLC default constructor (deletec)
uint16_t m_rlcTransmissionQueueHolDelay
Head of line delay of new transmissions in ms.
uint16_t m_rlcRetransmissionHolDelay
Head of line delay of retransmissions in ms.
uint32_t m_rlcRetransmissionQueueSize
The current size of the retransmission queue in byte.
uint16_t m_rlcStatusPduSize
The current size of the pending STATUS message in byte.
Time m_delayBudget
Delay budget of the flow.
uint32_t m_id
ID of the LC.
uint8_t m_priority
the priority associated with the QCI of the flow 3GPP 23.203
std::unique_ptr< NrMacSchedulerLC > LCPtr
Unique pointer to an instance of NrMacSchedulerLC.
uint16_t m_rlcTransmissionQueueHolDelay
Head of line delay of new transmissions in ms.
uint8_t m_logicalChannelIdentity
The logical channel ID, range: 0..10.
uint16_t m_rlcRetransmissionHolDelay
Head of line delay of retransmissions in ms.
uint32_t m_rlcRetransmissionQueueSize
The current size of the retransmission queue in byte.
uint16_t m_rlcStatusPduSize
The current size of the pending STATUS message in byte.
uint32_t m_rlcTransmissionQueueSize
The current size of the new transmission queue in byte.
See section 4.3.4 logicalChannelConfigListElement.
uint64_t m_eRabGuaranteedBitrateDl
ERAB guaranteed bit rate DL.