author | Marco Miozzo <marco.miozzo@cttc.es> |
Fri, 15 Jun 2012 16:49:51 +0200 | |
changeset 9035 | e40974228d94 |
parent 8763 | bac46543614f |
child 9036 | 5e09b29d4af5 |
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 |
* Author: Marco Miozzo <mmiozzo@cttc.es> |
|
20 |
*/ |
|
21 |
||
22 |
||
23 |
||
24 |
#include <ns3/log.h> |
|
25 |
#include <ns3/pointer.h> |
|
26 |
#include <ns3/packet.h> |
|
27 |
#include <ns3/packet-burst.h> |
|
28 |
||
29 |
#include "lte-ue-mac.h" |
|
7887 | 30 |
#include "lte-ue-net-device.h" |
8462
cf6a48994db5
renamed LteMacTag --> LteRadioBearerTag
Nicola Baldo <nbaldo@cttc.es>
parents:
8436
diff
changeset
|
31 |
#include "lte-radio-bearer-tag.h" |
7886 | 32 |
#include <ns3/ff-mac-common.h> |
9035
e40974228d94
Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8763
diff
changeset
|
33 |
#include <ns3/lte-control-messages.h> |
8415
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
34 |
#include <ns3/simulator.h> |
8435
6b0542a91970
Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents:
8416
diff
changeset
|
35 |
#include <ns3/lte-common.h> |
7886 | 36 |
|
37 |
||
38 |
NS_LOG_COMPONENT_DEFINE ("LteUeMac"); |
|
39 |
||
40 |
namespace ns3 { |
|
41 |
||
42 |
NS_OBJECT_ENSURE_REGISTERED (LteUeMac); |
|
43 |
||
44 |
||
8436
c5b3b5ba81be
Remove BufferSizeLevelBsr table in LteUeMac, moved to lte-common
mmiozzo
parents:
8435
diff
changeset
|
45 |
/////////////////////////////////////////////////////////// |
7886 | 46 |
// SAP forwarders |
47 |
/////////////////////////////////////////////////////////// |
|
48 |
||
49 |
||
50 |
class UeMemberLteUeCmacSapProvider : public LteUeCmacSapProvider |
|
51 |
{ |
|
52 |
public: |
|
53 |
UeMemberLteUeCmacSapProvider (LteUeMac* mac); |
|
54 |
||
55 |
// inherited from LteUeCmacSapProvider |
|
56 |
virtual void ConfigureUe (uint16_t rnti); |
|
57 |
virtual void AddLc (uint8_t lcId, LteMacSapUser* msu); |
|
58 |
virtual void RemoveLc (uint8_t lcId); |
|
8714
398bbcbb3f42
Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8496
diff
changeset
|
59 |
virtual void RrcUpdateConfigurationReq (LteUeConfig_t params); |
7886 | 60 |
|
61 |
private: |
|
62 |
LteUeMac* m_mac; |
|
63 |
}; |
|
64 |
||
65 |
||
66 |
UeMemberLteUeCmacSapProvider::UeMemberLteUeCmacSapProvider (LteUeMac* mac) |
|
67 |
: m_mac (mac) |
|
68 |
{ |
|
69 |
} |
|
70 |
||
71 |
void |
|
72 |
UeMemberLteUeCmacSapProvider::ConfigureUe (uint16_t rnti) |
|
73 |
{ |
|
74 |
m_mac->DoConfigureUe (rnti); |
|
75 |
} |
|
76 |
||
77 |
void |
|
78 |
UeMemberLteUeCmacSapProvider::AddLc (uint8_t lcId, LteMacSapUser* msu) |
|
79 |
{ |
|
80 |
m_mac->DoAddLc (lcId, msu); |
|
81 |
} |
|
82 |
||
83 |
void |
|
84 |
UeMemberLteUeCmacSapProvider::RemoveLc (uint8_t lcid) |
|
85 |
{ |
|
86 |
m_mac->DoRemoveLc (lcid); |
|
87 |
} |
|
88 |
||
8714
398bbcbb3f42
Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8496
diff
changeset
|
89 |
void |
398bbcbb3f42
Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8496
diff
changeset
|
90 |
UeMemberLteUeCmacSapProvider::RrcUpdateConfigurationReq (LteUeConfig_t params) |
398bbcbb3f42
Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8496
diff
changeset
|
91 |
{ |
398bbcbb3f42
Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8496
diff
changeset
|
92 |
m_mac->DoRrcUpdateConfigurationReq (params); |
398bbcbb3f42
Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8496
diff
changeset
|
93 |
} |
7886 | 94 |
|
95 |
||
96 |
class UeMemberLteMacSapProvider : public LteMacSapProvider |
|
97 |
{ |
|
98 |
public: |
|
99 |
UeMemberLteMacSapProvider (LteUeMac* mac); |
|
100 |
||
101 |
// inherited from LteMacSapProvider |
|
102 |
virtual void TransmitPdu (TransmitPduParameters params); |
|
103 |
virtual void ReportBufferStatus (ReportBufferStatusParameters params); |
|
104 |
||
105 |
private: |
|
106 |
LteUeMac* m_mac; |
|
107 |
}; |
|
108 |
||
109 |
||
110 |
UeMemberLteMacSapProvider::UeMemberLteMacSapProvider (LteUeMac* mac) |
|
111 |
: m_mac (mac) |
|
112 |
{ |
|
113 |
} |
|
114 |
||
115 |
void |
|
116 |
UeMemberLteMacSapProvider::TransmitPdu (TransmitPduParameters params) |
|
117 |
{ |
|
118 |
m_mac->DoTransmitPdu (params); |
|
119 |
} |
|
120 |
||
121 |
||
122 |
void |
|
123 |
UeMemberLteMacSapProvider::ReportBufferStatus (ReportBufferStatusParameters params) |
|
124 |
{ |
|
125 |
m_mac->DoReportBufferStatus (params); |
|
126 |
} |
|
127 |
||
128 |
||
129 |
||
130 |
||
7887 | 131 |
class UeMemberLteUePhySapUser : public LteUePhySapUser |
7886 | 132 |
{ |
133 |
public: |
|
7887 | 134 |
UeMemberLteUePhySapUser (LteUeMac* mac); |
7886 | 135 |
|
136 |
// inherited from LtePhySapUser |
|
137 |
virtual void ReceivePhyPdu (Ptr<Packet> p); |
|
138 |
virtual void SubframeIndication (uint32_t frameNo, uint32_t subframeNo); |
|
9035
e40974228d94
Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8763
diff
changeset
|
139 |
virtual void ReceiveLteControlMessage (Ptr<LteControlMessage> msg); |
7886 | 140 |
|
141 |
private: |
|
142 |
LteUeMac* m_mac; |
|
143 |
}; |
|
144 |
||
7887 | 145 |
UeMemberLteUePhySapUser::UeMemberLteUePhySapUser (LteUeMac* mac) : m_mac (mac) |
7886 | 146 |
{ |
147 |
||
148 |
} |
|
149 |
||
150 |
void |
|
7887 | 151 |
UeMemberLteUePhySapUser::ReceivePhyPdu (Ptr<Packet> p) |
7886 | 152 |
{ |
153 |
m_mac->DoReceivePhyPdu (p); |
|
154 |
} |
|
155 |
||
156 |
||
157 |
void |
|
7887 | 158 |
UeMemberLteUePhySapUser::SubframeIndication (uint32_t frameNo, uint32_t subframeNo) |
7886 | 159 |
{ |
8415
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
160 |
m_mac->DoSubframeIndication (frameNo, subframeNo); |
7886 | 161 |
} |
162 |
||
163 |
void |
|
9035
e40974228d94
Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8763
diff
changeset
|
164 |
UeMemberLteUePhySapUser::ReceiveLteControlMessage (Ptr<LteControlMessage> msg) |
7886 | 165 |
{ |
9035
e40974228d94
Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8763
diff
changeset
|
166 |
m_mac->DoReceiveLteControlMessage (msg); |
7886 | 167 |
} |
168 |
||
169 |
||
170 |
||
171 |
||
172 |
////////////////////////////////////////////////////////// |
|
173 |
// LteUeMac methods |
|
174 |
/////////////////////////////////////////////////////////// |
|
175 |
||
176 |
||
177 |
TypeId |
|
178 |
LteUeMac::GetTypeId (void) |
|
179 |
{ |
|
180 |
static TypeId tid = TypeId ("ns3::LteUeMac") |
|
181 |
.SetParent<Object> () |
|
182 |
.AddConstructor<LteUeMac> (); |
|
183 |
return tid; |
|
184 |
} |
|
185 |
||
186 |
||
187 |
LteUeMac::LteUeMac () |
|
8415
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
188 |
: m_bsrPeriodicity (MilliSeconds (1)), // ideal behavior |
8496
8d1759a15c2e
Update LteUeMac for sending BSR only when new BSR are received from RLC
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8462
diff
changeset
|
189 |
m_bsrLast (MilliSeconds (0)), |
8d1759a15c2e
Update LteUeMac for sending BSR only when new BSR are received from RLC
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8462
diff
changeset
|
190 |
m_freshUlBsr (false) |
8415
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
191 |
|
7886 | 192 |
{ |
7920
dd522ac64b64
added more logging to LteUeMac
Nicola Baldo <nbaldo@cttc.es>
parents:
7887
diff
changeset
|
193 |
NS_LOG_FUNCTION (this); |
7886 | 194 |
m_macSapProvider = new UeMemberLteMacSapProvider (this); |
195 |
m_cmacSapProvider = new UeMemberLteUeCmacSapProvider (this); |
|
7887 | 196 |
m_uePhySapUser = new UeMemberLteUePhySapUser (this); |
7886 | 197 |
} |
198 |
||
199 |
||
200 |
LteUeMac::~LteUeMac () |
|
201 |
{ |
|
7920
dd522ac64b64
added more logging to LteUeMac
Nicola Baldo <nbaldo@cttc.es>
parents:
7887
diff
changeset
|
202 |
NS_LOG_FUNCTION (this); |
7886 | 203 |
} |
204 |
||
205 |
void |
|
206 |
LteUeMac::DoDispose () |
|
207 |
{ |
|
7920
dd522ac64b64
added more logging to LteUeMac
Nicola Baldo <nbaldo@cttc.es>
parents:
7887
diff
changeset
|
208 |
NS_LOG_FUNCTION (this); |
7886 | 209 |
delete m_macSapProvider; |
210 |
delete m_cmacSapProvider; |
|
7930
ccb40542ae88
fixed memory leak in PHY SAP usage
Nicola Baldo <nbaldo@cttc.es>
parents:
7920
diff
changeset
|
211 |
delete m_uePhySapUser; |
7886 | 212 |
Object::DoDispose (); |
213 |
} |
|
214 |
||
215 |
||
216 |
LteUePhySapUser* |
|
217 |
LteUeMac::GetLteUePhySapUser (void) |
|
218 |
{ |
|
219 |
return m_uePhySapUser; |
|
220 |
} |
|
221 |
||
222 |
void |
|
223 |
LteUeMac::SetLteUePhySapProvider (LteUePhySapProvider* s) |
|
224 |
{ |
|
225 |
m_uePhySapProvider = s; |
|
226 |
} |
|
227 |
||
228 |
||
229 |
LteMacSapProvider* |
|
230 |
LteUeMac::GetLteMacSapProvider (void) |
|
231 |
{ |
|
232 |
return m_macSapProvider; |
|
233 |
} |
|
234 |
||
235 |
void |
|
236 |
LteUeMac::SetLteUeCmacSapUser (LteUeCmacSapUser* s) |
|
237 |
{ |
|
238 |
m_cmacSapUser = s; |
|
239 |
} |
|
240 |
||
241 |
LteUeCmacSapProvider* |
|
242 |
LteUeMac::GetLteUeCmacSapProvider (void) |
|
243 |
{ |
|
244 |
return m_cmacSapProvider; |
|
245 |
} |
|
246 |
||
247 |
||
248 |
void |
|
249 |
LteUeMac::DoTransmitPdu (LteMacSapProvider::TransmitPduParameters params) |
|
250 |
{ |
|
251 |
NS_LOG_FUNCTION (this); |
|
252 |
NS_ASSERT_MSG (m_rnti == params.rnti, "RNTI mismatch between RLC and MAC"); |
|
8714
398bbcbb3f42
Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8496
diff
changeset
|
253 |
LteRadioBearerTag tag (params.rnti, params.lcid, 0 /* UE works in SISO mode*/); |
7886 | 254 |
params.pdu->AddPacketTag (tag); |
255 |
// Ptr<PacketBurst> pb = CreateObject<PacketBurst> (); |
|
256 |
// pb->AddPacket (params.pdu); |
|
257 |
m_uePhySapProvider->SendMacPdu (params.pdu); |
|
258 |
// Uplink not implemented yet, so we wait can wait for the PHY SAP |
|
259 |
// to be defined before we implement the transmission method. |
|
260 |
} |
|
261 |
||
262 |
void |
|
263 |
LteUeMac::DoReportBufferStatus (LteMacSapProvider::ReportBufferStatusParameters params) |
|
264 |
{ |
|
265 |
NS_LOG_FUNCTION (this); |
|
8415
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
266 |
|
8671
8d0f6849e90c
Avoid negative queue statistics in updating BSR reports in LteUeMac::DoReceiveIdealControlMessage and remove long uint
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8496
diff
changeset
|
267 |
std::map <uint8_t, uint64_t>::iterator it; |
8415
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
268 |
|
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
269 |
|
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
270 |
it = m_ulBsrReceived.find (params.lcid); |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
271 |
if (it!=m_ulBsrReceived.end ()) |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
272 |
{ |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
273 |
// update entry |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
274 |
(*it).second = params.txQueueSize + params.retxQueueSize + params.statusPduSize; |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
275 |
} |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
276 |
else |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
277 |
{ |
8671
8d0f6849e90c
Avoid negative queue statistics in updating BSR reports in LteUeMac::DoReceiveIdealControlMessage and remove long uint
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8496
diff
changeset
|
278 |
m_ulBsrReceived.insert (std::pair<uint8_t, uint64_t> (params.lcid, params.txQueueSize + params.retxQueueSize + params.statusPduSize)); |
8415
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
279 |
} |
8496
8d1759a15c2e
Update LteUeMac for sending BSR only when new BSR are received from RLC
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8462
diff
changeset
|
280 |
m_freshUlBsr = true; |
8415
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
281 |
} |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
282 |
|
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
283 |
|
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
284 |
void |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
285 |
LteUeMac::SendReportBufferStatus (void) |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
286 |
{ |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
287 |
NS_LOG_FUNCTION (this); |
8496
8d1759a15c2e
Update LteUeMac for sending BSR only when new BSR are received from RLC
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8462
diff
changeset
|
288 |
if (m_ulBsrReceived.size () == 0) |
8d1759a15c2e
Update LteUeMac for sending BSR only when new BSR are received from RLC
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8462
diff
changeset
|
289 |
{ |
8d1759a15c2e
Update LteUeMac for sending BSR only when new BSR are received from RLC
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8462
diff
changeset
|
290 |
return; // No BSR report to transmit |
8d1759a15c2e
Update LteUeMac for sending BSR only when new BSR are received from RLC
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8462
diff
changeset
|
291 |
} |
7886 | 292 |
MacCeListElement_s bsr; |
293 |
bsr.m_rnti = m_rnti; |
|
294 |
bsr.m_macCeType = MacCeListElement_s::BSR; |
|
8415
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
295 |
// BSR |
8671
8d0f6849e90c
Avoid negative queue statistics in updating BSR reports in LteUeMac::DoReceiveIdealControlMessage and remove long uint
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8496
diff
changeset
|
296 |
std::map <uint8_t, uint64_t>::iterator it; |
8415
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
297 |
NS_ASSERT_MSG (m_ulBsrReceived.size () <=4, " Too many LCs (max is 4)"); |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
298 |
|
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
299 |
for (it = m_ulBsrReceived.begin (); it != m_ulBsrReceived.end (); it++) |
7886 | 300 |
{ |
8415
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
301 |
int queue = (*it).second; |
8435
6b0542a91970
Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents:
8416
diff
changeset
|
302 |
int index = BufferSizeLevelBsr::BufferSize2BsrId (queue); |
8415
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
303 |
bsr.m_macCeValue.m_bufferStatus.push_back (index); |
7886 | 304 |
} |
305 |
||
306 |
// create the feedback to eNB |
|
9035
e40974228d94
Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8763
diff
changeset
|
307 |
Ptr<BsrLteControlMessage> msg = Create<BsrLteControlMessage> (); |
7886 | 308 |
msg->SetBsr (bsr); |
9035
e40974228d94
Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8763
diff
changeset
|
309 |
m_uePhySapProvider->SendLteControlMessage (msg); |
7886 | 310 |
|
311 |
} |
|
312 |
||
313 |
void |
|
314 |
LteUeMac::DoConfigureUe (uint16_t rnti) |
|
315 |
{ |
|
316 |
NS_LOG_FUNCTION (this << " rnti" << rnti); |
|
317 |
m_rnti = rnti; |
|
318 |
} |
|
319 |
||
320 |
void |
|
321 |
LteUeMac::DoAddLc (uint8_t lcId, LteMacSapUser* msu) |
|
322 |
{ |
|
8666 | 323 |
NS_LOG_FUNCTION (this << " lcId" << (uint16_t) lcId); |
7886 | 324 |
NS_ASSERT_MSG (m_macSapUserMap.find (lcId) == m_macSapUserMap.end (), "cannot add channel because LCID " << lcId << " is already present"); |
325 |
m_macSapUserMap[lcId] = msu; |
|
326 |
} |
|
327 |
||
328 |
void |
|
329 |
LteUeMac::DoRemoveLc (uint8_t lcId) |
|
330 |
{ |
|
331 |
NS_LOG_FUNCTION (this << " lcId" << lcId); |
|
332 |
NS_ASSERT_MSG (m_macSapUserMap.find (lcId) == m_macSapUserMap.end (), "could not find LCID " << lcId); |
|
333 |
m_macSapUserMap.erase (lcId); |
|
334 |
} |
|
335 |
||
8714
398bbcbb3f42
Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8496
diff
changeset
|
336 |
void |
398bbcbb3f42
Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8496
diff
changeset
|
337 |
LteUeMac::DoRrcUpdateConfigurationReq (LteUeConfig_t params) |
398bbcbb3f42
Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8496
diff
changeset
|
338 |
{ |
398bbcbb3f42
Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8496
diff
changeset
|
339 |
NS_LOG_FUNCTION (this << " txMode " << (uint8_t) params.m_transmissionMode); |
398bbcbb3f42
Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8496
diff
changeset
|
340 |
// forward info to PHY layer |
398bbcbb3f42
Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8496
diff
changeset
|
341 |
m_uePhySapProvider->SetTransmissionMode (params.m_transmissionMode); |
398bbcbb3f42
Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8496
diff
changeset
|
342 |
} |
398bbcbb3f42
Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8496
diff
changeset
|
343 |
|
7886 | 344 |
|
345 |
void |
|
346 |
LteUeMac::DoReceivePhyPdu (Ptr<Packet> p) |
|
347 |
{ |
|
8462
cf6a48994db5
renamed LteMacTag --> LteRadioBearerTag
Nicola Baldo <nbaldo@cttc.es>
parents:
8436
diff
changeset
|
348 |
LteRadioBearerTag tag; |
7886 | 349 |
p->RemovePacketTag (tag); |
350 |
if (tag.GetRnti () == m_rnti) |
|
351 |
{ |
|
352 |
// packet is for the current user |
|
353 |
std::map <uint8_t, LteMacSapUser*>::const_iterator it = m_macSapUserMap.find (tag.GetLcid ()); |
|
354 |
NS_ASSERT_MSG (it != m_macSapUserMap.end (), "received packet with unknown lcid"); |
|
355 |
it->second->ReceivePdu (p); |
|
356 |
} |
|
357 |
} |
|
358 |
||
359 |
||
360 |
void |
|
9035
e40974228d94
Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8763
diff
changeset
|
361 |
LteUeMac::DoReceiveLteControlMessage (Ptr<LteControlMessage> msg) |
7886 | 362 |
{ |
363 |
NS_LOG_FUNCTION (this); |
|
9035
e40974228d94
Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8763
diff
changeset
|
364 |
if (msg->GetMessageType () == LteControlMessage::UL_DCI) |
7886 | 365 |
{ |
9035
e40974228d94
Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8763
diff
changeset
|
366 |
Ptr<UlDciLteControlMessage> msg2 = DynamicCast<UlDciLteControlMessage> (msg); |
7886 | 367 |
UlDciListElement_s dci = msg2->GetDci (); |
8671
8d0f6849e90c
Avoid negative queue statistics in updating BSR reports in LteUeMac::DoReceiveIdealControlMessage and remove long uint
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8496
diff
changeset
|
368 |
std::map <uint8_t, uint64_t>::iterator itBsr; |
8415
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
369 |
NS_ASSERT_MSG (m_ulBsrReceived.size () <=4, " Too many LCs (max is 4)"); |
8671
8d0f6849e90c
Avoid negative queue statistics in updating BSR reports in LteUeMac::DoReceiveIdealControlMessage and remove long uint
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8496
diff
changeset
|
370 |
uint16_t activeLcs = 0; |
8415
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
371 |
for (itBsr = m_ulBsrReceived.begin (); itBsr != m_ulBsrReceived.end (); itBsr++) |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
372 |
{ |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
373 |
if ((*itBsr).second > 0) |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
374 |
{ |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
375 |
activeLcs++; |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
376 |
} |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
377 |
} |
8763 | 378 |
if (activeLcs == 0) |
8415
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
379 |
{ |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
380 |
NS_LOG_ERROR (this << " No active flows for this UL-DCI"); |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
381 |
return; |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
382 |
} |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
383 |
std::map <uint8_t, LteMacSapUser*>::iterator it; |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
384 |
NS_LOG_FUNCTION (this << " UE: UL-CQI notified TxOpportunity of " << dci.m_tbSize); |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
385 |
for (it = m_macSapUserMap.begin (); it!=m_macSapUserMap.end (); it++) |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
386 |
{ |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
387 |
itBsr = m_ulBsrReceived.find ((*it).first); |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
388 |
if (itBsr!=m_ulBsrReceived.end ()) |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
389 |
{ |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
390 |
NS_LOG_FUNCTION (this << "\t" << dci.m_tbSize / m_macSapUserMap.size () << " bytes to LC " << (uint16_t)(*it).first << " queue " << (*itBsr).second); |
8729
74de12409ee5
Update m_macChTtiDelay fixed to 4 in UL (standard) and make schedulers unaware of channel delays (tests updated according to new delay)
mmiozzo
parents:
8726
diff
changeset
|
391 |
(*it).second->NotifyTxOpportunity (dci.m_tbSize / activeLcs, 0); |
8761
8675a3948f7c
type promotion causing signed/unsigned comparison warnings
Tom Henderson <tomh@tomh.org>
parents:
8729
diff
changeset
|
392 |
if ((*itBsr).second >= static_cast<uint64_t> (dci.m_tbSize / activeLcs)) |
8729
74de12409ee5
Update m_macChTtiDelay fixed to 4 in UL (standard) and make schedulers unaware of channel delays (tests updated according to new delay)
mmiozzo
parents:
8726
diff
changeset
|
393 |
{ |
74de12409ee5
Update m_macChTtiDelay fixed to 4 in UL (standard) and make schedulers unaware of channel delays (tests updated according to new delay)
mmiozzo
parents:
8726
diff
changeset
|
394 |
(*itBsr).second -= dci.m_tbSize / activeLcs; |
74de12409ee5
Update m_macChTtiDelay fixed to 4 in UL (standard) and make schedulers unaware of channel delays (tests updated according to new delay)
mmiozzo
parents:
8726
diff
changeset
|
395 |
} |
74de12409ee5
Update m_macChTtiDelay fixed to 4 in UL (standard) and make schedulers unaware of channel delays (tests updated according to new delay)
mmiozzo
parents:
8726
diff
changeset
|
396 |
else |
74de12409ee5
Update m_macChTtiDelay fixed to 4 in UL (standard) and make schedulers unaware of channel delays (tests updated according to new delay)
mmiozzo
parents:
8726
diff
changeset
|
397 |
{ |
74de12409ee5
Update m_macChTtiDelay fixed to 4 in UL (standard) and make schedulers unaware of channel delays (tests updated according to new delay)
mmiozzo
parents:
8726
diff
changeset
|
398 |
(*itBsr).second = 0; |
74de12409ee5
Update m_macChTtiDelay fixed to 4 in UL (standard) and make schedulers unaware of channel delays (tests updated according to new delay)
mmiozzo
parents:
8726
diff
changeset
|
399 |
} |
8415
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
400 |
} |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
401 |
} |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
7930
diff
changeset
|
402 |
|
7886 | 403 |
} |
404 |
else |
|
405 |
{ |
|
9035
e40974228d94
Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8763
diff
changeset
|
406 |
NS_LOG_FUNCTION (this << " LteControlMessage not recognized"); |
7886 | 407 |
} |
408 |
} |
|
409 |
||
410 |
||
8415
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
411 |
void |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
412 |
LteUeMac::DoSubframeIndication (uint32_t frameNo, uint32_t subframeNo) |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
413 |
{ |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
414 |
NS_LOG_FUNCTION (this); |
8496
8d1759a15c2e
Update LteUeMac for sending BSR only when new BSR are received from RLC
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8462
diff
changeset
|
415 |
if ((Simulator::Now () >= m_bsrLast + m_bsrPeriodicity) && (m_freshUlBsr==true)) |
8415
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
416 |
{ |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
417 |
SendReportBufferStatus (); |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
418 |
m_bsrLast = Simulator::Now (); |
8496
8d1759a15c2e
Update LteUeMac for sending BSR only when new BSR are received from RLC
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8462
diff
changeset
|
419 |
m_freshUlBsr = false; |
8415
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
420 |
} |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
421 |
} |
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
422 |
|
e9a27a8c6331
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents:
8148
diff
changeset
|
423 |
|
7886 | 424 |
} // namespace ns3 |