author | Nicola Baldo <nbaldo@cttc.es> |
Fri, 17 Jun 2011 17:32:20 +0200 | |
changeset 8148 | 09e2d03022a2 |
parent 8090 | bb044038a72a |
child 8364 | 0d7da39de404 |
permissions | -rw-r--r-- |
7886 | 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 "lte-rlc.h" |
|
23 |
#include "lte-mac-sap.h" |
|
24 |
#include "ff-mac-sched-sap.h" |
|
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7886
diff
changeset
|
25 |
#include "lte-rlc-tag.h" |
7886 | 26 |
|
27 |
#include <ns3/log.h> |
|
28 |
#include <ns3/simulator.h> |
|
29 |
||
30 |
NS_LOG_COMPONENT_DEFINE ("LteRlc"); |
|
31 |
||
32 |
namespace ns3 { |
|
33 |
||
34 |
||
35 |
/////////////////////////////////////// |
|
36 |
||
37 |
class LteRlcSpecificLteMacSapUser : public LteMacSapUser |
|
38 |
{ |
|
39 |
public: |
|
40 |
LteRlcSpecificLteMacSapUser (LteRlc* rlc); |
|
41 |
||
42 |
// inherited from LteMacSapUser |
|
43 |
virtual void NotifyTxOpportunity (uint32_t bytes); |
|
44 |
virtual void NotifyHarqDeliveryFailure (); |
|
45 |
virtual void ReceivePdu (Ptr<Packet> p); |
|
46 |
||
47 |
private: |
|
48 |
LteRlcSpecificLteMacSapUser (); |
|
49 |
LteRlc* m_rlc; |
|
50 |
}; |
|
51 |
||
52 |
LteRlcSpecificLteMacSapUser::LteRlcSpecificLteMacSapUser (LteRlc* rlc) |
|
53 |
: m_rlc (rlc) |
|
54 |
{ |
|
55 |
} |
|
56 |
||
57 |
LteRlcSpecificLteMacSapUser::LteRlcSpecificLteMacSapUser () |
|
58 |
{ |
|
59 |
} |
|
60 |
||
61 |
void |
|
62 |
LteRlcSpecificLteMacSapUser::NotifyTxOpportunity (uint32_t bytes) |
|
63 |
{ |
|
64 |
m_rlc->DoNotifyTxOpportunity (bytes); |
|
65 |
} |
|
66 |
||
67 |
void |
|
68 |
LteRlcSpecificLteMacSapUser::NotifyHarqDeliveryFailure () |
|
69 |
{ |
|
70 |
m_rlc->DoNotifyHarqDeliveryFailure (); |
|
71 |
} |
|
72 |
||
73 |
void |
|
74 |
LteRlcSpecificLteMacSapUser::ReceivePdu (Ptr<Packet> p) |
|
75 |
{ |
|
76 |
m_rlc->DoReceivePdu (p); |
|
77 |
} |
|
78 |
||
79 |
||
80 |
/////////////////////////////////////// |
|
7905
80557b09aa7f
Added missing NS_OBJECT_ENSURE_REGISTERED to all ns3::Objects created.
jnin
parents:
7901
diff
changeset
|
81 |
NS_OBJECT_ENSURE_REGISTERED (LteRlc); |
7886 | 82 |
|
83 |
LteRlc::LteRlc () |
|
84 |
: m_macSapProvider (0), |
|
85 |
m_rnti (0), |
|
86 |
m_lcid (0) |
|
87 |
{ |
|
88 |
NS_LOG_FUNCTION (this); |
|
89 |
m_macSapUser = new LteRlcSpecificLteMacSapUser (this); |
|
90 |
} |
|
91 |
||
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7886
diff
changeset
|
92 |
TypeId LteRlc::GetTypeId (void) |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7886
diff
changeset
|
93 |
{ |
7905
80557b09aa7f
Added missing NS_OBJECT_ENSURE_REGISTERED to all ns3::Objects created.
jnin
parents:
7901
diff
changeset
|
94 |
static TypeId tid = TypeId ("ns3::LteRlc") |
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7886
diff
changeset
|
95 |
.SetParent<Object> () |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7886
diff
changeset
|
96 |
.AddTraceSource ("TxPDU", |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7886
diff
changeset
|
97 |
"PDU transmission notified to the MAC.", |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7886
diff
changeset
|
98 |
MakeTraceSourceAccessor (&LteRlc::m_txPdu)) |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7886
diff
changeset
|
99 |
.AddTraceSource ("RxPDU", |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7886
diff
changeset
|
100 |
"PDU received.", |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7886
diff
changeset
|
101 |
MakeTraceSourceAccessor (&LteRlc::m_rxPdu)) |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8090
diff
changeset
|
102 |
; |
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7886
diff
changeset
|
103 |
return tid; |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7886
diff
changeset
|
104 |
} |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7886
diff
changeset
|
105 |
|
7886 | 106 |
void |
107 |
LteRlc::SetRnti (uint8_t rnti) |
|
108 |
{ |
|
109 |
NS_LOG_FUNCTION (this << (uint32_t) rnti); |
|
110 |
m_rnti = rnti; |
|
111 |
} |
|
112 |
||
113 |
void |
|
114 |
LteRlc::SetLcId (uint8_t lcId) |
|
115 |
{ |
|
116 |
NS_LOG_FUNCTION (this << (uint32_t) lcId); |
|
117 |
m_lcid = lcId; |
|
118 |
} |
|
119 |
||
120 |
LteRlc::~LteRlc () |
|
121 |
{ |
|
122 |
NS_LOG_FUNCTION (this); |
|
123 |
delete (m_macSapUser); |
|
124 |
} |
|
125 |
||
126 |
void |
|
127 |
LteRlc::SetLteMacSapProvider (LteMacSapProvider * s) |
|
128 |
{ |
|
129 |
NS_LOG_FUNCTION (this << s); |
|
130 |
m_macSapProvider = s; |
|
131 |
} |
|
132 |
||
133 |
LteMacSapUser* |
|
134 |
LteRlc::GetLteMacSapUser () |
|
135 |
{ |
|
136 |
NS_LOG_FUNCTION (this); |
|
137 |
return m_macSapUser; |
|
138 |
} |
|
139 |
||
140 |
||
141 |
||
142 |
||
143 |
||
144 |
// ////////////////////////////////////// |
|
145 |
||
7905
80557b09aa7f
Added missing NS_OBJECT_ENSURE_REGISTERED to all ns3::Objects created.
jnin
parents:
7901
diff
changeset
|
146 |
NS_OBJECT_ENSURE_REGISTERED (LteRlcSm); |
80557b09aa7f
Added missing NS_OBJECT_ENSURE_REGISTERED to all ns3::Objects created.
jnin
parents:
7901
diff
changeset
|
147 |
|
8090
bb044038a72a
LteRlc: Remove debug code
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8034
diff
changeset
|
148 |
LteRlcSm::LteRlcSm () |
7886 | 149 |
{ |
7905
80557b09aa7f
Added missing NS_OBJECT_ENSURE_REGISTERED to all ns3::Objects created.
jnin
parents:
7901
diff
changeset
|
150 |
|
7886 | 151 |
NS_LOG_FUNCTION (this); |
152 |
Simulator::ScheduleNow (&LteRlcSm::Start, this); |
|
153 |
} |
|
154 |
||
155 |
LteRlcSm::~LteRlcSm () |
|
156 |
{ |
|
8090
bb044038a72a
LteRlc: Remove debug code
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8034
diff
changeset
|
157 |
|
7886 | 158 |
} |
159 |
||
7905
80557b09aa7f
Added missing NS_OBJECT_ENSURE_REGISTERED to all ns3::Objects created.
jnin
parents:
7901
diff
changeset
|
160 |
TypeId |
80557b09aa7f
Added missing NS_OBJECT_ENSURE_REGISTERED to all ns3::Objects created.
jnin
parents:
7901
diff
changeset
|
161 |
LteRlcSm::GetTypeId (void) |
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7886
diff
changeset
|
162 |
{ |
7905
80557b09aa7f
Added missing NS_OBJECT_ENSURE_REGISTERED to all ns3::Objects created.
jnin
parents:
7901
diff
changeset
|
163 |
static TypeId tid = TypeId ("ns3::LteRlcSm") |
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7886
diff
changeset
|
164 |
.SetParent<LteRlc> () |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7886
diff
changeset
|
165 |
.AddConstructor<LteRlcSm> () |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8090
diff
changeset
|
166 |
; |
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7886
diff
changeset
|
167 |
return tid; |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7886
diff
changeset
|
168 |
} |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7886
diff
changeset
|
169 |
|
7886 | 170 |
void |
171 |
LteRlcSm::DoReceivePdu (Ptr<Packet> p) |
|
172 |
{ |
|
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7886
diff
changeset
|
173 |
// RLC Performance evaluation |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7886
diff
changeset
|
174 |
RlcTag rlcTag; |
7905
80557b09aa7f
Added missing NS_OBJECT_ENSURE_REGISTERED to all ns3::Objects created.
jnin
parents:
7901
diff
changeset
|
175 |
Time delay; |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8090
diff
changeset
|
176 |
if (p->FindFirstMatchingByteTag (rlcTag)) |
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7886
diff
changeset
|
177 |
{ |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8090
diff
changeset
|
178 |
delay = Simulator::Now () - rlcTag.getSenderTimestamp (); |
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7886
diff
changeset
|
179 |
} |
7905
80557b09aa7f
Added missing NS_OBJECT_ENSURE_REGISTERED to all ns3::Objects created.
jnin
parents:
7901
diff
changeset
|
180 |
NS_LOG_FUNCTION (this << m_rnti << (uint32_t) m_lcid << p->GetSize () << delay.GetNanoSeconds ()); |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8090
diff
changeset
|
181 |
m_rxPdu (m_rnti, m_lcid, p->GetSize (), delay.GetNanoSeconds () ); |
7886 | 182 |
} |
183 |
||
184 |
void |
|
185 |
LteRlcSm::DoNotifyTxOpportunity (uint32_t bytes) |
|
186 |
{ |
|
187 |
LteMacSapProvider::TransmitPduParameters params; |
|
188 |
params.pdu = Create<Packet> (bytes); |
|
189 |
params.rnti = m_rnti; |
|
190 |
params.lcid = m_lcid; |
|
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7886
diff
changeset
|
191 |
|
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7886
diff
changeset
|
192 |
// RLC Performance evaluation |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8090
diff
changeset
|
193 |
RlcTag tag (Simulator::Now ()); |
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7886
diff
changeset
|
194 |
params.pdu->AddByteTag (tag); |
7905
80557b09aa7f
Added missing NS_OBJECT_ENSURE_REGISTERED to all ns3::Objects created.
jnin
parents:
7901
diff
changeset
|
195 |
NS_LOG_FUNCTION (this << m_rnti << (uint32_t) m_lcid << bytes); |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8090
diff
changeset
|
196 |
m_txPdu (m_rnti, m_lcid, bytes); |
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7886
diff
changeset
|
197 |
|
7886 | 198 |
m_macSapProvider->TransmitPdu (params); |
199 |
} |
|
200 |
||
201 |
void |
|
202 |
LteRlcSm::DoNotifyHarqDeliveryFailure () |
|
203 |
{ |
|
204 |
NS_LOG_FUNCTION (this); |
|
205 |
} |
|
206 |
||
207 |
void |
|
208 |
LteRlcSm::Start () |
|
209 |
{ |
|
210 |
NS_LOG_FUNCTION (this); |
|
211 |
LteMacSapProvider::ReportBufferStatusParameters p; |
|
212 |
p.rnti = m_rnti; |
|
213 |
p.lcid = m_lcid; |
|
214 |
p.txQueueSize = 1000000000; |
|
7942
c0036edce3a5
Complete initialization of struct ReportBufferStatusParameters
mmiozzo
parents:
7905
diff
changeset
|
215 |
p.txQueueHolDelay = 10000; |
c0036edce3a5
Complete initialization of struct ReportBufferStatusParameters
mmiozzo
parents:
7905
diff
changeset
|
216 |
p.retxQueueSize = 1000000000; |
c0036edce3a5
Complete initialization of struct ReportBufferStatusParameters
mmiozzo
parents:
7905
diff
changeset
|
217 |
p.retxQueueHolDelay = 10000; |
c0036edce3a5
Complete initialization of struct ReportBufferStatusParameters
mmiozzo
parents:
7905
diff
changeset
|
218 |
p.statusPduSize = 1000; |
7886 | 219 |
|
220 |
m_macSapProvider->ReportBufferStatus (p); |
|
221 |
} |
|
222 |
||
223 |
||
224 |
||
225 |
||
226 |
////////////////////////////////////////// |
|
227 |
||
228 |
// LteRlcTm::~LteRlcTm () |
|
229 |
// { |
|
230 |
// } |
|
231 |
||
232 |
////////////////////////////////////////// |
|
233 |
||
234 |
// LteRlcUm::~LteRlcUm () |
|
235 |
// { |
|
236 |
// } |
|
237 |
||
238 |
////////////////////////////////////////// |
|
239 |
||
240 |
// LteRlcAm::~LteRlcAm () |
|
241 |
// { |
|
242 |
// } |
|
243 |
||
244 |
||
245 |
} // namespace ns3 |