A Discrete-Event Network Simulator
API
lte-rlc.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Nicola Baldo <nbaldo@cttc.es>
18 */
19
20#include "ns3/lte-rlc.h"
21
22#include "ns3/log.h"
23#include "ns3/lte-rlc-tag.h"
24#include "ns3/simulator.h"
25// #include "lte-mac-sap.h"
26#include "ns3/lte-rlc-sap.h"
27
28// #include "ff-mac-sched-sap.h"
29
30namespace ns3
31{
32
34
37{
38 public:
45
46 // Interface implemented from LteMacSapUser
48 void NotifyHarqDeliveryFailure() override;
50
51 private:
54};
55
57 : m_rlc(rlc)
58{
59}
60
62{
63}
64
65void
67{
69}
70
71void
73{
75}
76
77void
79{
81}
82
84
86
88 : m_rlcSapUser(nullptr),
89 m_macSapProvider(nullptr),
90 m_rnti(0),
91 m_lcid(0)
92{
93 NS_LOG_FUNCTION(this);
96}
97
99{
100 NS_LOG_FUNCTION(this);
101}
102
103TypeId
105{
106 static TypeId tid = TypeId("ns3::LteRlc")
107 .SetParent<Object>()
108 .SetGroupName("Lte")
109 .AddTraceSource("TxPDU",
110 "PDU transmission notified to the MAC.",
112 "ns3::LteRlc::NotifyTxTracedCallback")
113 .AddTraceSource("RxPDU",
114 "PDU received.",
116 "ns3::LteRlc::ReceiveTracedCallback")
117 .AddTraceSource("TxDrop",
118 "Trace source indicating a packet "
119 "has been dropped before transmission",
121 "ns3::Packet::TracedCallback");
122 return tid;
123}
124
125void
127{
128 NS_LOG_FUNCTION(this);
129 delete (m_rlcSapProvider);
130 delete (m_macSapUser);
131}
132
133void
134LteRlc::SetRnti(uint16_t rnti)
135{
136 NS_LOG_FUNCTION(this << (uint32_t)rnti);
137 m_rnti = rnti;
138}
139
140void
141LteRlc::SetLcId(uint8_t lcId)
142{
143 NS_LOG_FUNCTION(this << (uint32_t)lcId);
144 m_lcid = lcId;
145}
146
147void
149{
150 NS_LOG_FUNCTION(this << s);
151 m_rlcSapUser = s;
152}
153
156{
157 NS_LOG_FUNCTION(this);
158 return m_rlcSapProvider;
159}
160
161void
163{
164 NS_LOG_FUNCTION(this << s);
166}
167
170{
171 NS_LOG_FUNCTION(this);
172 return m_macSapUser;
173}
174
176
178
180{
181 NS_LOG_FUNCTION(this);
182}
183
185{
186 NS_LOG_FUNCTION(this);
187}
188
189TypeId
191{
192 static TypeId tid =
193 TypeId("ns3::LteRlcSm").SetParent<LteRlc>().SetGroupName("Lte").AddConstructor<LteRlcSm>();
194 return tid;
195}
196
197void
199{
200 NS_LOG_FUNCTION(this);
202}
203
204void
206{
207 NS_LOG_FUNCTION(this);
209}
210
211void
213{
214 NS_LOG_FUNCTION(this << p);
215}
216
217void
219{
220 NS_LOG_FUNCTION(this << rxPduParams.p);
221 // RLC Performance evaluation
222 RlcTag rlcTag;
223 Time delay;
224 bool ret = rxPduParams.p->FindFirstMatchingByteTag(rlcTag);
225 NS_ASSERT_MSG(ret, "RlcTag is missing");
226 delay = Simulator::Now() - rlcTag.GetSenderTimestamp();
227 NS_LOG_LOGIC(" RNTI=" << m_rnti << " LCID=" << (uint32_t)m_lcid << " size="
228 << rxPduParams.p->GetSize() << " delay=" << delay.As(Time::NS));
229 m_rxPdu(m_rnti, m_lcid, rxPduParams.p->GetSize(), delay.GetNanoSeconds());
230}
231
232void
234{
235 NS_LOG_FUNCTION(this << txOpParams.bytes);
237 RlcTag tag(Simulator::Now());
238
239 params.pdu = Create<Packet>(txOpParams.bytes);
240 NS_ABORT_MSG_UNLESS(txOpParams.bytes > 0, "Bytes must be > 0");
245 params.pdu->AddByteTag(tag, 1, params.pdu->GetSize());
246
247 params.rnti = m_rnti;
248 params.lcid = m_lcid;
249 params.layer = txOpParams.layer;
250 params.harqProcessId = txOpParams.harqId;
251 params.componentCarrierId = txOpParams.componentCarrierId;
252
253 // RLC Performance evaluation
254 NS_LOG_LOGIC(" RNTI=" << m_rnti << " LCID=" << (uint32_t)m_lcid
255 << " size=" << txOpParams.bytes);
256 m_txPdu(m_rnti, m_lcid, txOpParams.bytes);
257
260}
261
262void
264{
265 NS_LOG_FUNCTION(this);
266}
267
268void
270{
271 NS_LOG_FUNCTION(this);
273 p.rnti = m_rnti;
274 p.lcid = m_lcid;
275 p.txQueueSize = 80000;
276 p.txQueueHolDelay = 10;
277 p.retxQueueSize = 0;
278 p.retxQueueHolDelay = 0;
279 p.statusPduSize = 0;
281}
282
284
285// LteRlcTm::~LteRlcTm ()
286// {
287// }
288
290
291// LteRlcUm::~LteRlcUm ()
292// {
293// }
294
296
297// LteRlcAm::~LteRlcAm ()
298// {
299// }
300
301} // 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:36
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:96
This abstract base class defines the API to interact with the Radio Link Control (LTE_RLC) in LTE,...
Definition: lte-rlc.h:48
LteRlcSapUser * m_rlcSapUser
RLC SAP user.
Definition: lte-rlc.h:142
uint8_t m_lcid
LCID.
Definition: lte-rlc.h:167
friend class LteRlcSpecificLteMacSapUser
allow LteRlcSpecificLteMacSapUser class friend access
Definition: lte-rlc.h:50
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:181
uint16_t m_rnti
RNTI.
Definition: lte-rlc.h:166
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:176
void DoDispose() override
Destructor implementation.
Definition: lte-rlc.cc:126
LteRlcSapProvider * m_rlcSapProvider
RLC SAP provider.
Definition: lte-rlc.h:143
LteMacSapUser * m_macSapUser
MAC SAP user.
Definition: lte-rlc.h:163
LteMacSapProvider * m_macSapProvider
MAC SAP provider.
Definition: lte-rlc.h:164
void SetLteRlcSapUser(LteRlcSapUser *s)
Definition: lte-rlc.cc:148
friend class LteRlcSpecificLteRlcSapProvider< LteRlc >
allow LteRlcSpecificLteRlcSapProvider<LteRlc> class friend access
Definition: lte-rlc.h:52
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:172
void SetRnti(uint16_t rnti)
Definition: lte-rlc.cc:134
virtual void DoNotifyHarqDeliveryFailure()=0
Notify HARQ delivery failure.
void SetLteMacSapProvider(LteMacSapProvider *s)
Definition: lte-rlc.cc:162
virtual void DoReceivePdu(LteMacSapUser::ReceivePduParameters params)=0
Receive PDU function.
~LteRlc() override
Definition: lte-rlc.cc:98
LteMacSapUser * GetLteMacSapUser()
Definition: lte-rlc.cc:169
void SetLcId(uint8_t lcId)
Definition: lte-rlc.cc:141
static TypeId GetTypeId()
Get the type ID.
Definition: lte-rlc.cc:104
LteRlcSapProvider * GetLteRlcSapProvider()
Definition: lte-rlc.cc:155
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:36
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:67
LTE_RLC Saturation Mode (SM): simulation-specific mode used for experiments that do not need to consi...
Definition: lte-rlc.h:193
void DoDispose() override
Destructor implementation.
Definition: lte-rlc.cc:205
void DoInitialize() override
Initialize() implementation.
Definition: lte-rlc.cc:198
static TypeId GetTypeId()
Get the type ID.
Definition: lte-rlc.cc:190
~LteRlcSm() override
Definition: lte-rlc.cc:184
void DoReceivePdu(LteMacSapUser::ReceivePduParameters rxPduParams) override
Receive PDU function.
Definition: lte-rlc.cc:218
void DoTransmitPdcpPdu(Ptr< Packet > p) override
Transmit PDCP PDU.
Definition: lte-rlc.cc:212
void DoNotifyHarqDeliveryFailure() override
Notify HARQ delivery failure.
Definition: lte-rlc.cc:263
void ReportBufferStatus()
Report buffer status.
Definition: lte-rlc.cc:269
void DoNotifyTxOpportunity(LteMacSapUser::TxOpportunityParameters txOpParams) override
Notify transmit opportunity.
Definition: lte-rlc.cc:233
LteRlcSpecificLteMacSapUser class.
Definition: lte-rlc.cc:37
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:66
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:78
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:72
A base class which provides memory management and object aggregation.
Definition: object.h:89
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:862
bool FindFirstMatchingByteTag(Tag &tag) const
Finds the first tag matching the parameter Tag type.
Definition: packet.cc:962
Tag to calculate the per-PDU delay from eNb RLC to UE RLC.
Definition: lte-rlc-tag.h:36
Time GetSenderTimestamp() const
Get the instant when the RLC delivers the PDU to the MAC SAP provider.
Definition: lte-rlc-tag.h:64
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:199
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
int64_t GetNanoSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:417
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition: time.cc:417
@ NS
nanosecond
Definition: nstime.h:119
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:935
#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:86
#define NS_ABORT_MSG_UNLESS(cond, msg)
Abnormal program termination if a condition is false, with a message.
Definition: abort.h:144
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:282
#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:46
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.
params
Fit Fluctuating Two Ray model to the 3GPP TR 38.901 using the Anderson-Darling goodness-of-fit ##.
Parameters for LteMacSapProvider::ReportBufferStatus.
Definition: lte-mac-sap.h:69
uint32_t txQueueSize
the current size of the RLC transmission queue
Definition: lte-mac-sap.h:72
uint16_t retxQueueHolDelay
the Head Of Line delay of the retransmission queue
Definition: lte-mac-sap.h:75
uint16_t txQueueHolDelay
the Head Of Line delay of the transmission queue
Definition: lte-mac-sap.h:73
uint32_t retxQueueSize
the current size of the RLC retransmission queue in bytes
Definition: lte-mac-sap.h:74
uint8_t lcid
the logical channel id corresponding to the sending RLC instance
Definition: lte-mac-sap.h:71
uint16_t rnti
the C-RNTI identifying the UE
Definition: lte-mac-sap.h:70
uint16_t statusPduSize
the current size of the pending STATUS RLC PDU message in bytes
Definition: lte-mac-sap.h:77
Parameters for LteMacSapProvider::TransmitPdu.
Definition: lte-mac-sap.h:45
Parameters for LteMacSapUser::ReceivePdu.
Definition: lte-mac-sap.h:166
Ptr< Packet > p
the RLC PDU to be received
Definition: lte-mac-sap.h:187
Parameters for LteMacSapUser::NotifyTxOpportunity.
Definition: lte-mac-sap.h:105
uint32_t bytes
the number of bytes to transmit
Definition: lte-mac-sap.h:137
uint8_t componentCarrierId
the component carrier id
Definition: lte-mac-sap.h:140
uint8_t layer
the layer of transmission (MIMO)
Definition: lte-mac-sap.h:138