A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 NS_LOG_COMPONENT_DEFINE ("LteRlc");
32 
33 namespace ns3 {
34 
35 
36 
38 
40 {
41 public:
43 
44  // Interface implemented from LteMacSapUser
45  virtual void NotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId);
46  virtual void NotifyHarqDeliveryFailure ();
47  virtual void ReceivePdu (Ptr<Packet> p);
48 
49 private:
52 };
53 
55  : m_rlc (rlc)
56 {
57 }
58 
60 {
61 }
62 
63 void
64 LteRlcSpecificLteMacSapUser::NotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId)
65 {
66  m_rlc->DoNotifyTxOpportunity (bytes, layer, harqId);
67 }
68 
69 void
71 {
73 }
74 
75 void
77 {
78  m_rlc->DoReceivePdu (p);
79 }
80 
81 
83 
85  ;
86 
88  : m_rlcSapUser (0),
89  m_macSapProvider (0),
90  m_rnti (0),
91  m_lcid (0)
92 {
93  NS_LOG_FUNCTION (this);
96 }
97 
99 {
100  NS_LOG_FUNCTION (this);
101 }
102 
104 {
105  static TypeId tid = TypeId ("ns3::LteRlc")
106  .SetParent<Object> ()
107  .AddTraceSource ("TxPDU",
108  "PDU transmission notified to the MAC.",
110  .AddTraceSource ("RxPDU",
111  "PDU received.",
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  ;
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  .AddConstructor<LteRlcSm> ()
190  ;
191  return tid;
192 }
193 
194 void
196 {
197  NS_LOG_FUNCTION (this);
199 }
200 
201 void
203 {
204  NS_LOG_FUNCTION (this);
206 }
207 
208 void
210 {
211  NS_LOG_FUNCTION (this << p);
212 }
213 
214 void
216 {
217  NS_LOG_FUNCTION (this << p);
218  // RLC Performance evaluation
219  RlcTag rlcTag;
220  Time delay;
221  if (p->FindFirstMatchingByteTag(rlcTag))
222  {
223  delay = Simulator::Now() - rlcTag.GetSenderTimestamp ();
224  }
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->AddByteTag (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:119
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:128
bool FindFirstMatchingByteTag(Tag &tag) const
Definition: packet.cc:824
keep track of time values and allow control of global simulation resolution
Definition: nstime.h:81
#define NS_LOG_FUNCTION(parameters)
Definition: log.h:345
NS_LOG_COMPONENT_DEFINE("LteRlc")
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:215
virtual ~LteRlc()
Definition: lte-rlc.cc:98
static TypeId GetTypeId(void)
Definition: lte-rlc.cc:185
virtual void DoDispose()
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
Definition: lte-rlc.cc:202
Tag to calculate the per-PDU delay from eNb RLC to UE RLC.
Definition: lte-rlc-tag.h:36
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
uint32_t GetSize(void) const
Definition: packet.h:650
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:122
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:76
uint8_t m_lcid
Definition: lte-rlc.h:123
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:126
uint16_t rnti
the C-RNTI identifying the UE
Definition: lte-mac-sap.h:68
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:64
LteRlcSapUser * m_rlcSapUser
Definition: lte-rlc.h:111
Ptr< SampleEmitter > s
uint16_t rnti
the C-RNTI identifying the UE
Definition: lte-mac-sap.h:48
virtual void DoDispose()
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
Definition: lte-rlc.cc:118
virtual void DoTransmitPdcpPdu(Ptr< Packet > p)
Definition: lte-rlc.cc:209
LteMacSapUser * GetLteMacSapUser()
Definition: lte-rlc.cc:161
LteMacSapProvider * m_macSapProvider
Definition: lte-rlc.h:120
void ReportBufferStatus()
Definition: lte-rlc.cc:262
#define NS_LOG_LOGIC(msg)
Definition: log.h:368
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
LteRlcSapProvider * m_rlcSapProvider
Definition: lte-rlc.h:112
void SetLteRlcSapUser(LteRlcSapUser *s)
Definition: lte-rlc.cc:140
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
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 time".
Definition: simulator.cc:180
void SetLcId(uint8_t lcId)
Definition: lte-rlc.cc:133
virtual void DoReceivePdu(Ptr< Packet > p)=0
int64_t GetNanoSeconds(void) const
Definition: nstime.h:299
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:70
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:132
a base class which provides memory management and object aggregation
Definition: object.h:63
virtual void DoInitialize()
This method is called only once by Object::Initialize.
Definition: lte-rlc.cc:195
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:49
TypeId SetParent(TypeId tid)
Definition: type-id.cc:611
LTE_RLC Saturation Mode (SM): simulation-specific mode used for experiments that do not need to consi...
Definition: lte-rlc.h:146
void SetLteMacSapProvider(LteMacSapProvider *s)
Definition: lte-rlc.cc:154
static TypeId GetTypeId(void)
Definition: lte-rlc.cc:103
void AddByteTag(const Tag &tag) const
Tag each byte included in this packet with a new byte tag.
Definition: packet.cc:808
Parameters for LteMacSapProvider::TransmitPdu.
Definition: lte-mac-sap.h:45