A Discrete-Event Network Simulator
API
lte-rlc.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Nicola Baldo <nbaldo@cttc.es>
19  */
20 
21 
22 #include "ns3/log.h"
23 #include "ns3/simulator.h"
24 
25 #include "ns3/lte-rlc.h"
26 #include "ns3/lte-rlc-tag.h"
27 // #include "lte-mac-sap.h"
28 #include "ns3/lte-rlc-sap.h"
29 // #include "ff-mac-sched-sap.h"
30 
31 namespace ns3 {
32 
33 NS_LOG_COMPONENT_DEFINE ("LteRlc");
34 
35 
37 
39 {
40 public:
42 
43  // Interface implemented from LteMacSapUser
44  virtual void NotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId);
45  virtual void NotifyHarqDeliveryFailure ();
46  virtual void ReceivePdu (Ptr<Packet> p);
47 
48 private:
51 };
52 
54  : m_rlc (rlc)
55 {
56 }
57 
59 {
60 }
61 
62 void
63 LteRlcSpecificLteMacSapUser::NotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId)
64 {
65  m_rlc->DoNotifyTxOpportunity (bytes, layer, harqId);
66 }
67 
68 void
70 {
72 }
73 
74 void
76 {
77  m_rlc->DoReceivePdu (p);
78 }
79 
80 
82 
84 
86  : m_rlcSapUser (0),
87  m_macSapProvider (0),
88  m_rnti (0),
89  m_lcid (0)
90 {
91  NS_LOG_FUNCTION (this);
94 }
95 
97 {
98  NS_LOG_FUNCTION (this);
99 }
100 
102 {
103  static TypeId tid = TypeId ("ns3::LteRlc")
104  .SetParent<Object> ()
105  .SetGroupName("Lte")
106  .AddTraceSource ("TxPDU",
107  "PDU transmission notified to the MAC.",
109  "ns3::LteRlc::NotifyTxTracedCallback")
110  .AddTraceSource ("RxPDU",
111  "PDU received.",
113  "ns3::LteRlc::ReceiveTracedCallback")
114  ;
115  return tid;
116 }
117 
118 void
120 {
121  NS_LOG_FUNCTION (this);
122  delete (m_rlcSapProvider);
123  delete (m_macSapUser);
124 }
125 
126 void
127 LteRlc::SetRnti (uint16_t rnti)
128 {
129  NS_LOG_FUNCTION (this << (uint32_t) rnti);
130  m_rnti = rnti;
131 }
132 
133 void
134 LteRlc::SetLcId (uint8_t lcId)
135 {
136  NS_LOG_FUNCTION (this << (uint32_t) lcId);
137  m_lcid = lcId;
138 }
139 
140 void
142 {
143  NS_LOG_FUNCTION (this << s);
144  m_rlcSapUser = s;
145 }
146 
149 {
150  NS_LOG_FUNCTION (this);
151  return m_rlcSapProvider;
152 }
153 
154 void
156 {
157  NS_LOG_FUNCTION (this << s);
158  m_macSapProvider = s;
159 }
160 
163 {
164  NS_LOG_FUNCTION (this);
165  return m_macSapUser;
166 }
167 
168 
169 
171 
173 
175 {
176  NS_LOG_FUNCTION (this);
177 }
178 
180 {
181  NS_LOG_FUNCTION (this);
182 }
183 
184 TypeId
186 {
187  static TypeId tid = TypeId ("ns3::LteRlcSm")
188  .SetParent<LteRlc> ()
189  .SetGroupName("Lte")
190  .AddConstructor<LteRlcSm> ()
191  ;
192  return tid;
193 }
194 
195 void
197 {
198  NS_LOG_FUNCTION (this);
200 }
201 
202 void
204 {
205  NS_LOG_FUNCTION (this);
207 }
208 
209 void
211 {
212  NS_LOG_FUNCTION (this << p);
213 }
214 
215 void
217 {
218  NS_LOG_FUNCTION (this << p);
219  // RLC Performance evaluation
220  RlcTag rlcTag;
221  Time delay;
222  NS_ASSERT_MSG (p->PeekPacketTag (rlcTag), "RlcTag is missing");
223  p->RemovePacketTag (rlcTag);
224  delay = Simulator::Now() - rlcTag.GetSenderTimestamp ();
225  NS_LOG_LOGIC (" RNTI=" << m_rnti
226  << " LCID=" << (uint32_t) m_lcid
227  << " size=" << p->GetSize ()
228  << " delay=" << delay.GetNanoSeconds ());
229  m_rxPdu(m_rnti, m_lcid, p->GetSize (), delay.GetNanoSeconds () );
230 }
231 
232 void
233 LteRlcSm::DoNotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId)
234 {
235  NS_LOG_FUNCTION (this << bytes);
237  params.pdu = Create<Packet> (bytes);
238  params.rnti = m_rnti;
239  params.lcid = m_lcid;
240  params.layer = layer;
241  params.harqProcessId = harqId;
242 
243  // RLC Performance evaluation
244  RlcTag tag (Simulator::Now());
245  params.pdu->AddPacketTag (tag);
246  NS_LOG_LOGIC (" RNTI=" << m_rnti
247  << " LCID=" << (uint32_t) m_lcid
248  << " size=" << bytes);
249  m_txPdu(m_rnti, m_lcid, bytes);
250 
251  m_macSapProvider->TransmitPdu (params);
253 }
254 
255 void
257 {
258  NS_LOG_FUNCTION (this);
259 }
260 
261 void
263 {
264  NS_LOG_FUNCTION (this);
266  p.rnti = m_rnti;
267  p.lcid = m_lcid;
268  p.txQueueSize = 80000;
269  p.txQueueHolDelay = 10;
270  p.retxQueueSize = 0;
271  p.retxQueueHolDelay = 0;
272  p.statusPduSize = 0;
274 }
275 
276 
277 
278 
280 
281 // LteRlcTm::~LteRlcTm ()
282 // {
283 // }
284 
286 
287 // LteRlcUm::~LteRlcUm ()
288 // {
289 // }
290 
292 
293 // LteRlcAm::~LteRlcAm ()
294 // {
295 // }
296 
297 
298 } // namespace ns3
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:66
LteMacSapUser * m_macSapUser
Definition: lte-rlc.h:141
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:150
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
virtual ~LteRlcSm()
Definition: lte-rlc.cc:179
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:35
virtual void DoReceivePdu(Ptr< Packet > p)
Definition: lte-rlc.cc:216
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:44
virtual ~LteRlc()
Definition: lte-rlc.cc:96
static TypeId GetTypeId(void)
Definition: lte-rlc.cc:185
void AddPacketTag(const Tag &tag) const
Add a packet tag.
Definition: packet.cc:824
virtual void DoDispose()
Destructor implementation.
Definition: lte-rlc.cc:203
Tag to calculate the per-PDU delay from eNb RLC to UE RLC.
Definition: lte-rlc-tag.h:36
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:792
uint32_t retxQueueSize
the current size of the RLC retransmission queue in bytes
Definition: lte-mac-sap.h:72
uint16_t m_rnti
Definition: lte-rlc.h:144
virtual void ReceivePdu(Ptr< Packet > p)
Called by the MAC to notify the RLC of the reception of a new PDU.
Definition: lte-rlc.cc:75
uint8_t m_lcid
Definition: lte-rlc.h:145
virtual void DoNotifyTxOpportunity(uint32_t bytes, uint8_t layer, uint8_t harqId)
Definition: lte-rlc.cc:233
virtual void DoNotifyHarqDeliveryFailure()
Definition: lte-rlc.cc:256
uint8_t lcid
the logical channel id corresponding to the sending RLC instance
Definition: lte-mac-sap.h:49
void SetRnti(uint16_t rnti)
Definition: lte-rlc.cc:127
uint16_t rnti
the C-RNTI identifying the UE
Definition: lte-mac-sap.h:68
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Parameters for LteMacSapProvider::ReportBufferStatus.
Definition: lte-mac-sap.h:66
uint16_t txQueueHolDelay
the Head Of Line delay of the transmission queue
Definition: lte-mac-sap.h:71
virtual void NotifyTxOpportunity(uint32_t bytes, uint8_t layer, uint8_t harqId)
Called by the MAC to notify the RLC that the scheduler granted a transmission opportunity to this RLC...
Definition: lte-rlc.cc:63
bool PeekPacketTag(Tag &tag) const
Search a matching tag and call Tag::Deserialize if it is found.
Definition: packet.cc:846
LteRlcSapUser * m_rlcSapUser
Definition: lte-rlc.h:133
uint16_t rnti
the C-RNTI identifying the UE
Definition: lte-mac-sap.h:48
virtual void DoDispose()
Destructor implementation.
Definition: lte-rlc.cc:119
virtual void DoTransmitPdcpPdu(Ptr< Packet > p)
Definition: lte-rlc.cc:210
LteMacSapUser * GetLteMacSapUser()
Definition: lte-rlc.cc:162
LteMacSapProvider * m_macSapProvider
Definition: lte-rlc.h:142
void ReportBufferStatus()
Definition: lte-rlc.cc:262
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:252
virtual void DoNotifyTxOpportunity(uint32_t bytes, uint8_t layer, uint8_t harqId)=0
uint8_t layer
the layer value that was passed by the MAC in the call to NotifyTxOpportunity that generated this PDU...
Definition: lte-mac-sap.h:50
Every class exported by the ns3 library is enclosed in the ns3 namespace.
LteRlcSapProvider * m_rlcSapProvider
Definition: lte-rlc.h:134
void SetLteRlcSapUser(LteRlcSapUser *s)
Definition: lte-rlc.cc:141
Time GetSenderTimestamp(void) const
Get the instant when the RLC delivers the PDU to the MAC SAP provider.
Definition: lte-rlc-tag.h:60
uint8_t lcid
the logical channel id corresponding to the sending RLC instance
Definition: lte-mac-sap.h:69
uint32_t txQueueSize
the current size of the RLC transmission queue
Definition: lte-mac-sap.h:70
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:224
void SetLcId(uint8_t lcId)
Definition: lte-rlc.cc:134
virtual void DoReceivePdu(Ptr< Packet > p)=0
#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:90
int64_t GetNanoSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:353
uint16_t statusPduSize
the current size of the pending STATUS RLC PDU message in bytes
Definition: lte-mac-sap.h:74
virtual void DoNotifyHarqDeliveryFailure()=0
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition: lte-mac-sap.h:94
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
Definition: packet.cc:831
virtual void NotifyHarqDeliveryFailure()
Called by the MAC to notify the RLC that an HARQ process related to this RLC instance has failed...
Definition: lte-rlc.cc:69
uint16_t retxQueueHolDelay
the Head Of Line delay of the retransmission queue
Definition: lte-mac-sap.h:73
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 ReportBufferStatus(ReportBufferStatusParameters params)=0
Report the RLC buffer status to the MAC.
friend class LteRlcSpecificLteMacSapUser
Definition: lte-rlc.h:52
LteRlcSapProvider * GetLteRlcSapProvider()
Definition: lte-rlc.cc:148
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:154
A base class which provides memory management and object aggregation.
Definition: object.h:87
virtual void DoInitialize()
Initialize() implementation.
Definition: lte-rlc.cc:196
uint8_t harqProcessId
the HARQ process id that was passed by the MAC in the call to NotifyTxOpportunity that generated this...
Definition: lte-mac-sap.h:51
virtual void TransmitPdu(TransmitPduParameters params)=0
send an RLC PDU to the MAC for transmission.
This abstract base class defines the API to interact with the Radio Link Control (LTE_RLC) in LTE...
Definition: lte-rlc.h:50
a unique identifier for an interface.
Definition: type-id.h:58
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:904
LTE_RLC Saturation Mode (SM): simulation-specific mode used for experiments that do not need to consi...
Definition: lte-rlc.h:168
void SetLteMacSapProvider(LteMacSapProvider *s)
Definition: lte-rlc.cc:155
static TypeId GetTypeId(void)
Definition: lte-rlc.cc:101
Parameters for LteMacSapProvider::TransmitPdu.
Definition: lte-mac-sap.h:45