A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lte-rlc.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Nicola Baldo <nbaldo@cttc.es>
7 */
8
9#include "lte-rlc.h"
10
11#include "lte-rlc-sap.h"
12#include "lte-rlc-tag.h"
13// #include "lte-mac-sap.h"
14// #include "ff-mac-sched-sap.h"
15
16#include "ns3/log.h"
17#include "ns3/simulator.h"
18
19namespace ns3
20{
21
23
24/// LteRlcSpecificLteMacSapUser class
26{
27 public:
28 /**
29 * Constructor
30 *
31 * \param rlc the RLC
32 */
34
35 // Interface implemented from LteMacSapUser
37 void NotifyHarqDeliveryFailure() override;
39
40 private:
42 LteRlc* m_rlc; ///< the RLC
43};
44
49
53
54void
59
60void
65
66void
71
72///////////////////////////////////////
73
75
77 : m_rlcSapUser(nullptr),
78 m_macSapProvider(nullptr),
79 m_rnti(0),
80 m_lcid(0)
81{
82 NS_LOG_FUNCTION(this);
85}
86
88{
89 NS_LOG_FUNCTION(this);
90}
91
94{
95 static TypeId tid = TypeId("ns3::LteRlc")
97 .SetGroupName("Lte")
98 .AddTraceSource("TxPDU",
99 "PDU transmission notified to the MAC.",
101 "ns3::LteRlc::NotifyTxTracedCallback")
102 .AddTraceSource("RxPDU",
103 "PDU received.",
105 "ns3::LteRlc::ReceiveTracedCallback")
106 .AddTraceSource("TxDrop",
107 "Trace source indicating a packet "
108 "has been dropped before transmission",
110 "ns3::Packet::TracedCallback");
111 return tid;
112}
113
114void
116{
117 NS_LOG_FUNCTION(this);
118 delete (m_rlcSapProvider);
119 delete (m_macSapUser);
120}
121
122void
123LteRlc::SetRnti(uint16_t rnti)
124{
125 NS_LOG_FUNCTION(this << (uint32_t)rnti);
126 m_rnti = rnti;
127}
128
129void
130LteRlc::SetLcId(uint8_t lcId)
131{
132 NS_LOG_FUNCTION(this << (uint32_t)lcId);
133 m_lcid = lcId;
134}
135
136void
137LteRlc::SetPacketDelayBudgetMs(uint16_t packetDelayBudget)
138{
139 NS_LOG_FUNCTION(this << +packetDelayBudget);
140 m_packetDelayBudgetMs = packetDelayBudget;
141}
142
143void
149
156
157void
163
166{
167 NS_LOG_FUNCTION(this);
168 return m_macSapUser;
169}
170
171////////////////////////////////////////
172
174
176{
177 NS_LOG_FUNCTION(this);
178}
179
184
185TypeId
187{
188 static TypeId tid =
189 TypeId("ns3::LteRlcSm").SetParent<LteRlc>().SetGroupName("Lte").AddConstructor<LteRlcSm>();
190 return tid;
191}
192
193void
199
200void
206
207void
212
213void
215{
216 NS_LOG_FUNCTION(this << rxPduParams.p);
217 // RLC Performance evaluation
218 RlcTag rlcTag;
219 Time delay;
220 bool ret = rxPduParams.p->FindFirstMatchingByteTag(rlcTag);
221 NS_ASSERT_MSG(ret, "RlcTag is missing");
222 delay = Simulator::Now() - rlcTag.GetSenderTimestamp();
223 NS_LOG_LOGIC(" RNTI=" << m_rnti << " LCID=" << (uint32_t)m_lcid << " size="
224 << rxPduParams.p->GetSize() << " delay=" << delay.As(Time::NS));
225 m_rxPdu(m_rnti, m_lcid, rxPduParams.p->GetSize(), delay.GetNanoSeconds());
226}
227
228void
230{
231 NS_LOG_FUNCTION(this << txOpParams.bytes);
233 RlcTag tag(Simulator::Now());
234
235 params.pdu = Create<Packet>(txOpParams.bytes);
236 NS_ABORT_MSG_UNLESS(txOpParams.bytes > 0, "Bytes must be > 0");
237 /**
238 * For RLC SM, the packets are not passed to the upper layers, therefore,
239 * in the absence of an header we can safely byte tag the entire packet.
240 */
241 params.pdu->AddByteTag(tag, 1, params.pdu->GetSize());
242
243 params.rnti = m_rnti;
244 params.lcid = m_lcid;
245 params.layer = txOpParams.layer;
246 params.harqProcessId = txOpParams.harqId;
247 params.componentCarrierId = txOpParams.componentCarrierId;
248
249 // RLC Performance evaluation
250 NS_LOG_LOGIC(" RNTI=" << m_rnti << " LCID=" << (uint32_t)m_lcid
251 << " size=" << txOpParams.bytes);
252 m_txPdu(m_rnti, m_lcid, txOpParams.bytes);
253
256}
257
258void
263
264void
278
279//////////////////////////////////////////
280
281// LteRlcTm::~LteRlcTm ()
282// {
283// }
284
285//////////////////////////////////////////
286
287// LteRlcUm::~LteRlcUm ()
288// {
289// }
290
291//////////////////////////////////////////
292
293// LteRlcAm::~LteRlcAm ()
294// {
295// }
296
297} // namespace ns3
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition lte-mac-sap.h:25
virtual void TransmitPdu(TransmitPduParameters params)=0
send an RLC PDU to the MAC for transmission.
virtual void ReportBufferStatus(ReportBufferStatusParameters params)=0
Report the RLC buffer status to the MAC.
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition lte-mac-sap.h:85
This abstract base class defines the API to interact with the Radio Link Control (LTE_RLC) in LTE,...
Definition lte-rlc.h:38
LteRlcSapUser * m_rlcSapUser
RLC SAP user.
Definition lte-rlc.h:137
uint8_t m_lcid
LCID.
Definition lte-rlc.h:162
void SetPacketDelayBudgetMs(uint16_t packetDelayBudget)
Definition lte-rlc.cc:137
friend class LteRlcSpecificLteMacSapUser
allow LteRlcSpecificLteMacSapUser class friend access
Definition lte-rlc.h:40
virtual void DoNotifyTxOpportunity(LteMacSapUser::TxOpportunityParameters params)=0
Notify transmit opportunity.
TracedCallback< Ptr< const Packet > > m_txDropTrace
The trace source fired when the RLC drops a packet before transmission.
Definition lte-rlc.h:178
uint16_t m_rnti
RNTI.
Definition lte-rlc.h:161
TracedCallback< uint16_t, uint8_t, uint32_t, uint64_t > m_rxPdu
Used to inform of a PDU reception from the MAC SAP user.
Definition lte-rlc.h:173
void DoDispose() override
Destructor implementation.
Definition lte-rlc.cc:115
LteRlcSapProvider * m_rlcSapProvider
RLC SAP provider.
Definition lte-rlc.h:138
LteMacSapUser * m_macSapUser
MAC SAP user.
Definition lte-rlc.h:158
LteMacSapProvider * m_macSapProvider
MAC SAP provider.
Definition lte-rlc.h:159
void SetLteRlcSapUser(LteRlcSapUser *s)
Definition lte-rlc.cc:144
uint16_t m_packetDelayBudgetMs
the packet delay budget in ms of the corresponding logical channel
Definition lte-rlc.h:163
friend class LteRlcSpecificLteRlcSapProvider< LteRlc >
allow LteRlcSpecificLteRlcSapProvider<LteRlc> class friend access
Definition lte-rlc.h:42
TracedCallback< uint16_t, uint8_t, uint32_t > m_txPdu
Used to inform of a PDU delivery to the MAC SAP provider.
Definition lte-rlc.h:169
void SetRnti(uint16_t rnti)
Definition lte-rlc.cc:123
virtual void DoNotifyHarqDeliveryFailure()=0
Notify HARQ delivery failure.
void SetLteMacSapProvider(LteMacSapProvider *s)
Definition lte-rlc.cc:158
virtual void DoReceivePdu(LteMacSapUser::ReceivePduParameters params)=0
Receive PDU function.
~LteRlc() override
Definition lte-rlc.cc:87
LteMacSapUser * GetLteMacSapUser()
Definition lte-rlc.cc:165
void SetLcId(uint8_t lcId)
Definition lte-rlc.cc:130
static TypeId GetTypeId()
Get the type ID.
Definition lte-rlc.cc:93
LteRlcSapProvider * GetLteRlcSapProvider()
Definition lte-rlc.cc:151
Service Access Point (SAP) offered by the UM-RLC and AM-RLC entities to the PDCP entity See 3GPP 36....
Definition lte-rlc-sap.h:25
Service Access Point (SAP) offered by the UM-RLC and AM-RLC entities to the PDCP entity See 3GPP 36....
Definition lte-rlc-sap.h:56
LTE_RLC Saturation Mode (SM): simulation-specific mode used for experiments that do not need to consi...
Definition lte-rlc.h:190
void DoDispose() override
Destructor implementation.
Definition lte-rlc.cc:201
void DoInitialize() override
Initialize() implementation.
Definition lte-rlc.cc:194
static TypeId GetTypeId()
Get the type ID.
Definition lte-rlc.cc:186
~LteRlcSm() override
Definition lte-rlc.cc:180
void DoReceivePdu(LteMacSapUser::ReceivePduParameters rxPduParams) override
Receive PDU function.
Definition lte-rlc.cc:214
void DoTransmitPdcpPdu(Ptr< Packet > p) override
Transmit PDCP PDU.
Definition lte-rlc.cc:208
void DoNotifyHarqDeliveryFailure() override
Notify HARQ delivery failure.
Definition lte-rlc.cc:259
void ReportBufferStatus()
Report buffer status.
Definition lte-rlc.cc:265
void DoNotifyTxOpportunity(LteMacSapUser::TxOpportunityParameters txOpParams) override
Notify transmit opportunity.
Definition lte-rlc.cc:229
LteRlcSpecificLteMacSapUser class.
Definition lte-rlc.cc:26
void NotifyTxOpportunity(LteMacSapUser::TxOpportunityParameters params) override
Called by the MAC to notify the RLC that the scheduler granted a transmission opportunity to this RLC...
Definition lte-rlc.cc:55
void ReceivePdu(LteMacSapUser::ReceivePduParameters params) override
Called by the MAC to notify the RLC of the reception of a new PDU.
Definition lte-rlc.cc:67
void NotifyHarqDeliveryFailure() override
Called by the MAC to notify the RLC that an HARQ process related to this RLC instance has failed.
Definition lte-rlc.cc:61
A base class which provides memory management and object aggregation.
Definition object.h:78
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition packet.h:850
bool FindFirstMatchingByteTag(Tag &tag) const
Finds the first tag matching the parameter Tag type.
Definition packet.cc:932
Smart pointer class similar to boost::intrusive_ptr.
Tag to calculate the per-PDU delay from eNb RLC to UE RLC.
Definition lte-rlc-tag.h:25
Time GetSenderTimestamp() const
Get the instant when the RLC delivers the PDU to the MAC SAP provider.
Definition lte-rlc-tag.h:53
static Time Now()
Return the current simulation virtual time.
Definition simulator.cc:197
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
int64_t GetNanoSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition nstime.h:407
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition time.cc:404
@ NS
nanosecond
Definition nstime.h:108
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition assert.h:75
#define NS_ABORT_MSG_UNLESS(cond, msg)
Abnormal program termination if a condition is false, with a message.
Definition abort.h:133
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition log.h:271
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Parameters for LteMacSapProvider::ReportBufferStatus.
Definition lte-mac-sap.h:58
uint32_t txQueueSize
the current size of the RLC transmission queue
Definition lte-mac-sap.h:61
uint16_t retxQueueHolDelay
the Head Of Line delay of the retransmission queue
Definition lte-mac-sap.h:64
uint16_t txQueueHolDelay
the Head Of Line delay of the transmission queue
Definition lte-mac-sap.h:62
uint32_t retxQueueSize
the current size of the RLC retransmission queue in bytes
Definition lte-mac-sap.h:63
uint8_t lcid
the logical channel id corresponding to the sending RLC instance
Definition lte-mac-sap.h:60
uint16_t rnti
the C-RNTI identifying the UE
Definition lte-mac-sap.h:59
uint16_t statusPduSize
the current size of the pending STATUS RLC PDU message in bytes
Definition lte-mac-sap.h:66
Parameters for LteMacSapProvider::TransmitPdu.
Definition lte-mac-sap.h:34
Parameters for LteMacSapUser::ReceivePdu.
Ptr< Packet > p
the RLC PDU to be received
Parameters for LteMacSapUser::NotifyTxOpportunity.
Definition lte-mac-sap.h:94
uint32_t bytes
the number of bytes to transmit
uint8_t componentCarrierId
the component carrier id
uint8_t layer
the layer of transmission (MIMO)