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  .AddTraceSource ("TxPDU",
106  "PDU transmission notified to the MAC.",
108  "ns3::LteRlc::NotifyTxTracedCallback")
109  .AddTraceSource ("RxPDU",
110  "PDU received.",
112  "ns3::LteRlc::ReceiveTracedCallback")
113  ;
114  return tid;
115 }
116 
117 void
119 {
120  NS_LOG_FUNCTION (this);
121  delete (m_rlcSapProvider);
122  delete (m_macSapUser);
123 }
124 
125 void
126 LteRlc::SetRnti (uint16_t rnti)
127 {
128  NS_LOG_FUNCTION (this << (uint32_t) rnti);
129  m_rnti = rnti;
130 }
131 
132 void
133 LteRlc::SetLcId (uint8_t lcId)
134 {
135  NS_LOG_FUNCTION (this << (uint32_t) lcId);
136  m_lcid = lcId;
137 }
138 
139 void
141 {
142  NS_LOG_FUNCTION (this << s);
143  m_rlcSapUser = s;
144 }
145 
148 {
149  NS_LOG_FUNCTION (this);
150  return m_rlcSapProvider;
151 }
152 
153 void
155 {
156  NS_LOG_FUNCTION (this << s);
158 }
159 
162 {
163  NS_LOG_FUNCTION (this);
164  return m_macSapUser;
165 }
166 
167 
168 
170 
172 
174 {
175  NS_LOG_FUNCTION (this);
176 }
177 
179 {
180  NS_LOG_FUNCTION (this);
181 }
182 
183 TypeId
185 {
186  static TypeId tid = TypeId ("ns3::LteRlcSm")
187  .SetParent<LteRlc> ()
188  .AddConstructor<LteRlcSm> ()
189  ;
190  return tid;
191 }
192 
193 void
195 {
196  NS_LOG_FUNCTION (this);
198 }
199 
200 void
202 {
203  NS_LOG_FUNCTION (this);
205 }
206 
207 void
209 {
210  NS_LOG_FUNCTION (this << p);
211 }
212 
213 void
215 {
216  NS_LOG_FUNCTION (this << p);
217  // RLC Performance evaluation
218  RlcTag rlcTag;
219  Time delay;
220  if (p->FindFirstMatchingByteTag(rlcTag))
221  {
222  delay = Simulator::Now() - rlcTag.GetSenderTimestamp ();
223  }
224  NS_LOG_LOGIC (" RNTI=" << m_rnti
225  << " LCID=" << (uint32_t) m_lcid
226  << " size=" << p->GetSize ()
227  << " delay=" << delay.GetNanoSeconds ());
228  m_rxPdu(m_rnti, m_lcid, p->GetSize (), delay.GetNanoSeconds () );
229 }
230 
231 void
232 LteRlcSm::DoNotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId)
233 {
234  NS_LOG_FUNCTION (this << bytes);
236  params.pdu = Create<Packet> (bytes);
237  params.rnti = m_rnti;
238  params.lcid = m_lcid;
239  params.layer = layer;
240  params.harqProcessId = harqId;
241 
242  // RLC Performance evaluation
243  RlcTag tag (Simulator::Now());
244  params.pdu->AddByteTag (tag);
245  NS_LOG_LOGIC (" RNTI=" << m_rnti
246  << " LCID=" << (uint32_t) m_lcid
247  << " size=" << bytes);
248  m_txPdu(m_rnti, m_lcid, bytes);
249 
250  m_macSapProvider->TransmitPdu (params);
252 }
253 
254 void
256 {
257  NS_LOG_FUNCTION (this);
258 }
259 
260 void
262 {
263  NS_LOG_FUNCTION (this);
265  p.rnti = m_rnti;
266  p.lcid = m_lcid;
267  p.txQueueSize = 80000;
268  p.txQueueHolDelay = 10;
269  p.retxQueueSize = 0;
270  p.retxQueueHolDelay = 0;
271  p.statusPduSize = 0;
273 }
274 
275 
276 
277 
279 
280 // LteRlcTm::~LteRlcTm ()
281 // {
282 // }
283 
285 
286 // LteRlcUm::~LteRlcUm ()
287 // {
288 // }
289 
291 
292 // LteRlcAm::~LteRlcAm ()
293 // {
294 // }
295 
296 
297 } // 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:142
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:151
bool FindFirstMatchingByteTag(Tag &tag) const
Finds the first tag matching the parameter Tag type.
Definition: packet.cc:819
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:95
#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:178
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:214
#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:184
virtual void DoDispose()
Destructor implementation.
Definition: lte-rlc.cc:201
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:766
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:145
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:146
virtual void DoNotifyTxOpportunity(uint32_t bytes, uint8_t layer, uint8_t harqId)
Definition: lte-rlc.cc:232
virtual void DoNotifyHarqDeliveryFailure()
Definition: lte-rlc.cc:255
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:126
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
LteRlcSapUser * m_rlcSapUser
Definition: lte-rlc.h:134
Ptr< SampleEmitter > s
uint16_t rnti
the C-RNTI identifying the UE
Definition: lte-mac-sap.h:48
virtual void DoDispose()
Destructor implementation.
Definition: lte-rlc.cc:118
virtual void DoTransmitPdcpPdu(Ptr< Packet > p)
Definition: lte-rlc.cc:208
LteMacSapUser * GetLteMacSapUser()
Definition: lte-rlc.cc:161
LteMacSapProvider * m_macSapProvider
Definition: lte-rlc.h:143
void ReportBufferStatus()
Definition: lte-rlc.cc:261
#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:135
void SetLteRlcSapUser(LteRlcSapUser *s)
Definition: lte-rlc.cc:140
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:223
void SetLcId(uint8_t lcId)
Definition: lte-rlc.cc:133
virtual void DoReceivePdu(Ptr< Packet > p)=0
int64_t GetNanoSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:339
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
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:147
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:155
A base class which provides memory management and object aggregation.
Definition: object.h:87
virtual void DoInitialize()
Initialize() implementation.
Definition: lte-rlc.cc:194
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:51
TypeId SetParent(TypeId tid)
Definition: type-id.cc:631
LTE_RLC Saturation Mode (SM): simulation-specific mode used for experiments that do not need to consi...
Definition: lte-rlc.h:169
void SetLteMacSapProvider(LteMacSapProvider *s)
Definition: lte-rlc.cc:154
static TypeId GetTypeId(void)
Definition: lte-rlc.cc:101
void AddByteTag(const Tag &tag) const
Tag each byte included in this packet with a new byte tag.
Definition: packet.cc:803
Parameters for LteMacSapProvider::TransmitPdu.
Definition: lte-mac-sap.h:45