File: | /tmp/asd-nat/home/nat/Work/ns-3-dev-git/build/../src/lte/model/lte-enb-mac.cc |
Location: | line 495, column 11 |
Description: | Value stored to 'cqiNum' is never read |
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: Marco Miozzo <marco.miozzo@cttc.es> |
19 | * Nicola Baldo <nbaldo@cttc.es> |
20 | * Modified by: |
21 | * Danilo Abrignani <danilo.abrignani@unibo.it> (Carrier Aggregation - GSoC 2015) |
22 | * Biljana Bojovic <biljana.bojovic@cttc.es> (Carrier Aggregation) |
23 | */ |
24 | |
25 | |
26 | #include <ns3/log.h> |
27 | #include <ns3/pointer.h> |
28 | #include <ns3/packet.h> |
29 | #include <ns3/simulator.h> |
30 | |
31 | #include "lte-amc.h" |
32 | #include "lte-control-messages.h" |
33 | #include "lte-enb-net-device.h" |
34 | #include "lte-ue-net-device.h" |
35 | |
36 | #include <ns3/lte-enb-mac.h> |
37 | #include <ns3/lte-radio-bearer-tag.h> |
38 | #include <ns3/lte-ue-phy.h> |
39 | |
40 | #include "ns3/lte-mac-sap.h" |
41 | #include "ns3/lte-enb-cmac-sap.h" |
42 | #include <ns3/lte-common.h> |
43 | |
44 | |
45 | namespace ns3 { |
46 | |
47 | NS_LOG_COMPONENT_DEFINE ("LteEnbMac")static ns3::LogComponent g_log = ns3::LogComponent ("LteEnbMac" , "../src/lte/model/lte-enb-mac.cc"); |
48 | |
49 | NS_OBJECT_ENSURE_REGISTERED (LteEnbMac)static struct ObjectLteEnbMacRegistrationClass { ObjectLteEnbMacRegistrationClass () { ns3::TypeId tid = LteEnbMac::GetTypeId (); tid.SetSize ( sizeof (LteEnbMac)); tid.GetParent (); } } ObjectLteEnbMacRegistrationVariable; |
50 | |
51 | |
52 | |
53 | // ////////////////////////////////////// |
54 | // member SAP forwarders |
55 | // ////////////////////////////////////// |
56 | |
57 | |
58 | class EnbMacMemberLteEnbCmacSapProvider : public LteEnbCmacSapProvider |
59 | { |
60 | public: |
61 | EnbMacMemberLteEnbCmacSapProvider (LteEnbMac* mac); |
62 | |
63 | // inherited from LteEnbCmacSapProvider |
64 | virtual void ConfigureMac (uint8_t ulBandwidth, uint8_t dlBandwidth); |
65 | virtual void AddUe (uint16_t rnti); |
66 | virtual void RemoveUe (uint16_t rnti); |
67 | virtual void AddLc (LcInfo lcinfo, LteMacSapUser* msu); |
68 | virtual void ReconfigureLc (LcInfo lcinfo); |
69 | virtual void ReleaseLc (uint16_t rnti, uint8_t lcid); |
70 | virtual void UeUpdateConfigurationReq (UeConfig params); |
71 | virtual RachConfig GetRachConfig (); |
72 | virtual AllocateNcRaPreambleReturnValue AllocateNcRaPreamble (uint16_t rnti); |
73 | |
74 | |
75 | private: |
76 | LteEnbMac* m_mac; |
77 | }; |
78 | |
79 | |
80 | EnbMacMemberLteEnbCmacSapProvider::EnbMacMemberLteEnbCmacSapProvider (LteEnbMac* mac) |
81 | : m_mac (mac) |
82 | { |
83 | } |
84 | |
85 | void |
86 | EnbMacMemberLteEnbCmacSapProvider::ConfigureMac (uint8_t ulBandwidth, uint8_t dlBandwidth) |
87 | { |
88 | m_mac->DoConfigureMac (ulBandwidth, dlBandwidth); |
89 | } |
90 | |
91 | void |
92 | EnbMacMemberLteEnbCmacSapProvider::AddUe (uint16_t rnti) |
93 | { |
94 | m_mac->DoAddUe (rnti); |
95 | } |
96 | |
97 | void |
98 | EnbMacMemberLteEnbCmacSapProvider::RemoveUe (uint16_t rnti) |
99 | { |
100 | m_mac->DoRemoveUe (rnti); |
101 | } |
102 | |
103 | void |
104 | EnbMacMemberLteEnbCmacSapProvider::AddLc (LcInfo lcinfo, LteMacSapUser* msu) |
105 | { |
106 | m_mac->DoAddLc (lcinfo, msu); |
107 | } |
108 | |
109 | void |
110 | EnbMacMemberLteEnbCmacSapProvider::ReconfigureLc (LcInfo lcinfo) |
111 | { |
112 | m_mac->DoReconfigureLc (lcinfo); |
113 | } |
114 | |
115 | void |
116 | EnbMacMemberLteEnbCmacSapProvider::ReleaseLc (uint16_t rnti, uint8_t lcid) |
117 | { |
118 | m_mac->DoReleaseLc (rnti, lcid); |
119 | } |
120 | |
121 | void |
122 | EnbMacMemberLteEnbCmacSapProvider::UeUpdateConfigurationReq (UeConfig params) |
123 | { |
124 | m_mac->DoUeUpdateConfigurationReq (params); |
125 | } |
126 | |
127 | LteEnbCmacSapProvider::RachConfig |
128 | EnbMacMemberLteEnbCmacSapProvider::GetRachConfig () |
129 | { |
130 | return m_mac->DoGetRachConfig (); |
131 | } |
132 | |
133 | LteEnbCmacSapProvider::AllocateNcRaPreambleReturnValue |
134 | EnbMacMemberLteEnbCmacSapProvider::AllocateNcRaPreamble (uint16_t rnti) |
135 | { |
136 | return m_mac->DoAllocateNcRaPreamble (rnti); |
137 | } |
138 | |
139 | |
140 | class EnbMacMemberFfMacSchedSapUser : public FfMacSchedSapUser |
141 | { |
142 | public: |
143 | EnbMacMemberFfMacSchedSapUser (LteEnbMac* mac); |
144 | |
145 | |
146 | virtual void SchedDlConfigInd (const struct SchedDlConfigIndParameters& params); |
147 | virtual void SchedUlConfigInd (const struct SchedUlConfigIndParameters& params); |
148 | private: |
149 | LteEnbMac* m_mac; |
150 | }; |
151 | |
152 | |
153 | EnbMacMemberFfMacSchedSapUser::EnbMacMemberFfMacSchedSapUser (LteEnbMac* mac) |
154 | : m_mac (mac) |
155 | { |
156 | } |
157 | |
158 | |
159 | void |
160 | EnbMacMemberFfMacSchedSapUser::SchedDlConfigInd (const struct SchedDlConfigIndParameters& params) |
161 | { |
162 | m_mac->DoSchedDlConfigInd (params); |
163 | } |
164 | |
165 | |
166 | |
167 | void |
168 | EnbMacMemberFfMacSchedSapUser::SchedUlConfigInd (const struct SchedUlConfigIndParameters& params) |
169 | { |
170 | m_mac->DoSchedUlConfigInd (params); |
171 | } |
172 | |
173 | |
174 | |
175 | class EnbMacMemberFfMacCschedSapUser : public FfMacCschedSapUser |
176 | { |
177 | public: |
178 | EnbMacMemberFfMacCschedSapUser (LteEnbMac* mac); |
179 | |
180 | virtual void CschedCellConfigCnf (const struct CschedCellConfigCnfParameters& params); |
181 | virtual void CschedUeConfigCnf (const struct CschedUeConfigCnfParameters& params); |
182 | virtual void CschedLcConfigCnf (const struct CschedLcConfigCnfParameters& params); |
183 | virtual void CschedLcReleaseCnf (const struct CschedLcReleaseCnfParameters& params); |
184 | virtual void CschedUeReleaseCnf (const struct CschedUeReleaseCnfParameters& params); |
185 | virtual void CschedUeConfigUpdateInd (const struct CschedUeConfigUpdateIndParameters& params); |
186 | virtual void CschedCellConfigUpdateInd (const struct CschedCellConfigUpdateIndParameters& params); |
187 | |
188 | private: |
189 | LteEnbMac* m_mac; |
190 | }; |
191 | |
192 | |
193 | EnbMacMemberFfMacCschedSapUser::EnbMacMemberFfMacCschedSapUser (LteEnbMac* mac) |
194 | : m_mac (mac) |
195 | { |
196 | } |
197 | |
198 | void |
199 | EnbMacMemberFfMacCschedSapUser::CschedCellConfigCnf (const struct CschedCellConfigCnfParameters& params) |
200 | { |
201 | m_mac->DoCschedCellConfigCnf (params); |
202 | } |
203 | |
204 | void |
205 | EnbMacMemberFfMacCschedSapUser::CschedUeConfigCnf (const struct CschedUeConfigCnfParameters& params) |
206 | { |
207 | m_mac->DoCschedUeConfigCnf (params); |
208 | } |
209 | |
210 | void |
211 | EnbMacMemberFfMacCschedSapUser::CschedLcConfigCnf (const struct CschedLcConfigCnfParameters& params) |
212 | { |
213 | m_mac->DoCschedLcConfigCnf (params); |
214 | } |
215 | |
216 | void |
217 | EnbMacMemberFfMacCschedSapUser::CschedLcReleaseCnf (const struct CschedLcReleaseCnfParameters& params) |
218 | { |
219 | m_mac->DoCschedLcReleaseCnf (params); |
220 | } |
221 | |
222 | void |
223 | EnbMacMemberFfMacCschedSapUser::CschedUeReleaseCnf (const struct CschedUeReleaseCnfParameters& params) |
224 | { |
225 | m_mac->DoCschedUeReleaseCnf (params); |
226 | } |
227 | |
228 | void |
229 | EnbMacMemberFfMacCschedSapUser::CschedUeConfigUpdateInd (const struct CschedUeConfigUpdateIndParameters& params) |
230 | { |
231 | m_mac->DoCschedUeConfigUpdateInd (params); |
232 | } |
233 | |
234 | void |
235 | EnbMacMemberFfMacCschedSapUser::CschedCellConfigUpdateInd (const struct CschedCellConfigUpdateIndParameters& params) |
236 | { |
237 | m_mac->DoCschedCellConfigUpdateInd (params); |
238 | } |
239 | |
240 | |
241 | |
242 | // ---------- PHY-SAP |
243 | |
244 | |
245 | class EnbMacMemberLteEnbPhySapUser : public LteEnbPhySapUser |
246 | { |
247 | public: |
248 | EnbMacMemberLteEnbPhySapUser (LteEnbMac* mac); |
249 | |
250 | // inherited from LteEnbPhySapUser |
251 | virtual void ReceivePhyPdu (Ptr<Packet> p); |
252 | virtual void SubframeIndication (uint32_t frameNo, uint32_t subframeNo); |
253 | virtual void ReceiveLteControlMessage (Ptr<LteControlMessage> msg); |
254 | virtual void ReceiveRachPreamble (uint32_t prachId); |
255 | virtual void UlCqiReport (FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi); |
256 | virtual void UlInfoListElementHarqFeeback (UlInfoListElement_s params); |
257 | virtual void DlInfoListElementHarqFeeback (DlInfoListElement_s params); |
258 | |
259 | private: |
260 | LteEnbMac* m_mac; |
261 | }; |
262 | |
263 | EnbMacMemberLteEnbPhySapUser::EnbMacMemberLteEnbPhySapUser (LteEnbMac* mac) : m_mac (mac) |
264 | { |
265 | } |
266 | |
267 | |
268 | void |
269 | EnbMacMemberLteEnbPhySapUser::ReceivePhyPdu (Ptr<Packet> p) |
270 | { |
271 | m_mac->DoReceivePhyPdu (p); |
272 | } |
273 | |
274 | void |
275 | EnbMacMemberLteEnbPhySapUser::SubframeIndication (uint32_t frameNo, uint32_t subframeNo) |
276 | { |
277 | m_mac->DoSubframeIndication (frameNo, subframeNo); |
278 | } |
279 | |
280 | void |
281 | EnbMacMemberLteEnbPhySapUser::ReceiveLteControlMessage (Ptr<LteControlMessage> msg) |
282 | { |
283 | m_mac->DoReceiveLteControlMessage (msg); |
284 | } |
285 | |
286 | void |
287 | EnbMacMemberLteEnbPhySapUser::ReceiveRachPreamble (uint32_t prachId) |
288 | { |
289 | m_mac->DoReceiveRachPreamble (prachId); |
290 | } |
291 | |
292 | void |
293 | EnbMacMemberLteEnbPhySapUser::UlCqiReport (FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi) |
294 | { |
295 | m_mac->DoUlCqiReport (ulcqi); |
296 | } |
297 | |
298 | void |
299 | EnbMacMemberLteEnbPhySapUser::UlInfoListElementHarqFeeback (UlInfoListElement_s params) |
300 | { |
301 | m_mac->DoUlInfoListElementHarqFeeback (params); |
302 | } |
303 | |
304 | void |
305 | EnbMacMemberLteEnbPhySapUser::DlInfoListElementHarqFeeback (DlInfoListElement_s params) |
306 | { |
307 | m_mac->DoDlInfoListElementHarqFeeback (params); |
308 | } |
309 | |
310 | |
311 | // ////////////////////////////////////// |
312 | // generic LteEnbMac methods |
313 | // ////////////////////////////////////// |
314 | |
315 | |
316 | TypeId |
317 | LteEnbMac::GetTypeId (void) |
318 | { |
319 | static TypeId tid = TypeId ("ns3::LteEnbMac") |
320 | .SetParent<Object> () |
321 | .SetGroupName("Lte") |
322 | .AddConstructor<LteEnbMac> () |
323 | .AddAttribute ("NumberOfRaPreambles", |
324 | "how many random access preambles are available for the contention based RACH process", |
325 | UintegerValue (50), |
326 | MakeUintegerAccessor (&LteEnbMac::m_numberOfRaPreambles), |
327 | MakeUintegerChecker<uint8_t> (4, 64)) |
328 | .AddAttribute ("PreambleTransMax", |
329 | "Maximum number of random access preamble transmissions", |
330 | UintegerValue (50), |
331 | MakeUintegerAccessor (&LteEnbMac::m_preambleTransMax), |
332 | MakeUintegerChecker<uint8_t> (3, 200)) |
333 | .AddAttribute ("RaResponseWindowSize", |
334 | "length of the window (in TTIs) for the reception of the random access response (RAR); the resulting RAR timeout is this value + 3 ms", |
335 | UintegerValue (3), |
336 | MakeUintegerAccessor (&LteEnbMac::m_raResponseWindowSize), |
337 | MakeUintegerChecker<uint8_t> (2, 10)) |
338 | .AddTraceSource ("DlScheduling", |
339 | "Information regarding DL scheduling.", |
340 | MakeTraceSourceAccessor (&LteEnbMac::m_dlScheduling), |
341 | "ns3::LteEnbMac::DlSchedulingTracedCallback") |
342 | .AddTraceSource ("UlScheduling", |
343 | "Information regarding UL scheduling.", |
344 | MakeTraceSourceAccessor (&LteEnbMac::m_ulScheduling), |
345 | "ns3::LteEnbMac::UlSchedulingTracedCallback") |
346 | .AddAttribute ("ComponentCarrierId", |
347 | "ComponentCarrier Id, needed to reply on the appropriate sap.", |
348 | UintegerValue (0), |
349 | MakeUintegerAccessor (&LteEnbMac::m_componentCarrierId), |
350 | MakeUintegerChecker<uint8_t> (0,4)) |
351 | ; |
352 | |
353 | return tid; |
354 | } |
355 | |
356 | |
357 | LteEnbMac::LteEnbMac (): |
358 | m_ccmMacSapUser (0) |
359 | { |
360 | NS_LOG_FUNCTION (this)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this; std::clog << ")" << std::endl; } } while ( false); |
361 | m_macSapProvider = new EnbMacMemberLteMacSapProvider<LteEnbMac> (this); |
362 | m_cmacSapProvider = new EnbMacMemberLteEnbCmacSapProvider (this); |
363 | m_schedSapUser = new EnbMacMemberFfMacSchedSapUser (this); |
364 | m_cschedSapUser = new EnbMacMemberFfMacCschedSapUser (this); |
365 | m_enbPhySapUser = new EnbMacMemberLteEnbPhySapUser (this); |
366 | m_ccmMacSapProvider = new MemberLteCcmMacSapProvider<LteEnbMac> (this); |
367 | } |
368 | |
369 | |
370 | LteEnbMac::~LteEnbMac () |
371 | { |
372 | NS_LOG_FUNCTION (this)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this; std::clog << ")" << std::endl; } } while ( false); |
373 | } |
374 | |
375 | void |
376 | LteEnbMac::DoDispose () |
377 | { |
378 | NS_LOG_FUNCTION (this)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this; std::clog << ")" << std::endl; } } while ( false); |
379 | m_dlCqiReceived.clear (); |
380 | m_ulCqiReceived.clear (); |
381 | m_ulCeReceived.clear (); |
382 | m_dlInfoListReceived.clear (); |
383 | m_ulInfoListReceived.clear (); |
384 | m_miDlHarqProcessesPackets.clear (); |
385 | delete m_macSapProvider; |
386 | delete m_cmacSapProvider; |
387 | delete m_schedSapUser; |
388 | delete m_cschedSapUser; |
389 | delete m_enbPhySapUser; |
390 | delete m_ccmMacSapProvider; |
391 | } |
392 | |
393 | void |
394 | LteEnbMac::SetComponentCarrierId (uint8_t index) |
395 | { |
396 | m_componentCarrierId = index; |
397 | } |
398 | |
399 | void |
400 | LteEnbMac::SetFfMacSchedSapProvider (FfMacSchedSapProvider* s) |
401 | { |
402 | m_schedSapProvider = s; |
403 | } |
404 | |
405 | FfMacSchedSapUser* |
406 | LteEnbMac::GetFfMacSchedSapUser (void) |
407 | { |
408 | return m_schedSapUser; |
409 | } |
410 | |
411 | void |
412 | LteEnbMac::SetFfMacCschedSapProvider (FfMacCschedSapProvider* s) |
413 | { |
414 | m_cschedSapProvider = s; |
415 | } |
416 | |
417 | FfMacCschedSapUser* |
418 | LteEnbMac::GetFfMacCschedSapUser (void) |
419 | { |
420 | return m_cschedSapUser; |
421 | } |
422 | |
423 | |
424 | |
425 | void |
426 | LteEnbMac::SetLteMacSapUser (LteMacSapUser* s) |
427 | { |
428 | m_macSapUser = s; |
429 | } |
430 | |
431 | LteMacSapProvider* |
432 | LteEnbMac::GetLteMacSapProvider (void) |
433 | { |
434 | return m_macSapProvider; |
435 | } |
436 | |
437 | void |
438 | LteEnbMac::SetLteEnbCmacSapUser (LteEnbCmacSapUser* s) |
439 | { |
440 | m_cmacSapUser = s; |
441 | } |
442 | |
443 | LteEnbCmacSapProvider* |
444 | LteEnbMac::GetLteEnbCmacSapProvider (void) |
445 | { |
446 | return m_cmacSapProvider; |
447 | } |
448 | |
449 | void |
450 | LteEnbMac::SetLteEnbPhySapProvider (LteEnbPhySapProvider* s) |
451 | { |
452 | m_enbPhySapProvider = s; |
453 | } |
454 | |
455 | |
456 | LteEnbPhySapUser* |
457 | LteEnbMac::GetLteEnbPhySapUser () |
458 | { |
459 | return m_enbPhySapUser; |
460 | } |
461 | |
462 | void |
463 | LteEnbMac::SetLteCcmMacSapUser (LteCcmMacSapUser* s) |
464 | { |
465 | m_ccmMacSapUser = s; |
466 | } |
467 | |
468 | |
469 | LteCcmMacSapProvider* |
470 | LteEnbMac::GetLteCcmMacSapProvider () |
471 | { |
472 | return m_ccmMacSapProvider; |
473 | } |
474 | |
475 | void |
476 | LteEnbMac::DoSubframeIndication (uint32_t frameNo, uint32_t subframeNo) |
477 | { |
478 | NS_LOG_FUNCTION (this << " EnbMac - frame " << frameNo << " subframe " << subframeNo)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this << " EnbMac - frame " << frameNo << " subframe " << subframeNo; std::clog << ")" << std::endl ; } } while (false); |
479 | |
480 | // Store current frame / subframe number |
481 | m_frameNo = frameNo; |
482 | m_subframeNo = subframeNo; |
483 | |
484 | |
485 | // --- DOWNLINK --- |
486 | // Send Dl-CQI info to the scheduler |
487 | if (m_dlCqiReceived.size () > 0) |
488 | { |
489 | FfMacSchedSapProvider::SchedDlCqiInfoReqParameters dlcqiInfoReq; |
490 | dlcqiInfoReq.m_sfnSf = ((0x3FF & frameNo) << 4) | (0xF & subframeNo); |
491 | |
492 | int cqiNum = m_dlCqiReceived.size (); |
493 | if (cqiNum > MAX_CQI_LIST30) |
494 | { |
495 | cqiNum = MAX_CQI_LIST30; |
Value stored to 'cqiNum' is never read | |
496 | } |
497 | dlcqiInfoReq.m_cqiList.insert (dlcqiInfoReq.m_cqiList.begin (), m_dlCqiReceived.begin (), m_dlCqiReceived.end ()); |
498 | m_dlCqiReceived.erase (m_dlCqiReceived.begin (), m_dlCqiReceived.end ()); |
499 | m_schedSapProvider->SchedDlCqiInfoReq (dlcqiInfoReq); |
500 | } |
501 | |
502 | if (!m_receivedRachPreambleCount.empty ()) |
503 | { |
504 | // process received RACH preambles and notify the scheduler |
505 | FfMacSchedSapProvider::SchedDlRachInfoReqParameters rachInfoReqParams; |
506 | NS_ASSERT (subframeNo > 0 && subframeNo <= 10)do { if (!(subframeNo > 0 && subframeNo <= 10)) { std::cerr << "assert failed. cond=\"" << "subframeNo > 0 && subframeNo <= 10" << "\", "; do { std::cerr << "file=" << "../src/lte/model/lte-enb-mac.cc" << ", line=" << 506 << std::endl; ::ns3::FatalImpl ::FlushStreams (); if (true) std::terminate (); } while (false ); } } while (false); // subframe in 1..10 |
507 | for (std::map<uint8_t, uint32_t>::const_iterator it = m_receivedRachPreambleCount.begin (); |
508 | it != m_receivedRachPreambleCount.end (); |
509 | ++it) |
510 | { |
511 | NS_LOG_INFO (this << " preambleId " << (uint32_t) it->first << ": " << it->second << " received")do { if (g_log.IsEnabled (ns3::LOG_INFO)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; if (g_log.IsEnabled (ns3::LOG_PREFIX_FUNC)) { std ::clog << g_log.Name () << ":" << __FUNCTION__ << "(): "; }; if (g_log.IsEnabled (ns3::LOG_PREFIX_LEVEL )) { std::clog << "[" << g_log.GetLevelLabel (ns3 ::LOG_INFO) << "] "; }; std::clog << this << " preambleId " << (uint32_t) it->first << ": " << it->second << " received" << std::endl ; } } while (false); |
512 | NS_ASSERT (it->second != 0)do { if (!(it->second != 0)) { std::cerr << "assert failed. cond=\"" << "it->second != 0" << "\", "; do { std::cerr << "file=" << "../src/lte/model/lte-enb-mac.cc" << ", line=" << 512 << std::endl; ::ns3::FatalImpl:: FlushStreams (); if (true) std::terminate (); } while (false) ; } } while (false); |
513 | if (it->second > 1) |
514 | { |
515 | NS_LOG_INFO ("preambleId " << (uint32_t) it->first << ": collision")do { if (g_log.IsEnabled (ns3::LOG_INFO)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; if (g_log.IsEnabled (ns3::LOG_PREFIX_FUNC)) { std ::clog << g_log.Name () << ":" << __FUNCTION__ << "(): "; }; if (g_log.IsEnabled (ns3::LOG_PREFIX_LEVEL )) { std::clog << "[" << g_log.GetLevelLabel (ns3 ::LOG_INFO) << "] "; }; std::clog << "preambleId " << (uint32_t) it->first << ": collision" << std::endl; } } while (false); |
516 | // in case of collision we assume that no preamble is |
517 | // successfully received, hence no RAR is sent |
518 | } |
519 | else |
520 | { |
521 | uint16_t rnti; |
522 | std::map<uint8_t, NcRaPreambleInfo>::iterator jt = m_allocatedNcRaPreambleMap.find (it->first); |
523 | if (jt != m_allocatedNcRaPreambleMap.end ()) |
524 | { |
525 | rnti = jt->second.rnti; |
526 | NS_LOG_INFO ("preambleId previously allocated for NC based RA, RNTI =" << (uint32_t) rnti << ", sending RAR")do { if (g_log.IsEnabled (ns3::LOG_INFO)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; if (g_log.IsEnabled (ns3::LOG_PREFIX_FUNC)) { std ::clog << g_log.Name () << ":" << __FUNCTION__ << "(): "; }; if (g_log.IsEnabled (ns3::LOG_PREFIX_LEVEL )) { std::clog << "[" << g_log.GetLevelLabel (ns3 ::LOG_INFO) << "] "; }; std::clog << "preambleId previously allocated for NC based RA, RNTI =" << (uint32_t) rnti << ", sending RAR" << std ::endl; } } while (false); |
527 | |
528 | } |
529 | else |
530 | { |
531 | rnti = m_cmacSapUser->AllocateTemporaryCellRnti (); |
532 | NS_LOG_INFO ("preambleId " << (uint32_t) it->first << ": allocated T-C-RNTI " << (uint32_t) rnti << ", sending RAR")do { if (g_log.IsEnabled (ns3::LOG_INFO)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; if (g_log.IsEnabled (ns3::LOG_PREFIX_FUNC)) { std ::clog << g_log.Name () << ":" << __FUNCTION__ << "(): "; }; if (g_log.IsEnabled (ns3::LOG_PREFIX_LEVEL )) { std::clog << "[" << g_log.GetLevelLabel (ns3 ::LOG_INFO) << "] "; }; std::clog << "preambleId " << (uint32_t) it->first << ": allocated T-C-RNTI " << (uint32_t) rnti << ", sending RAR" << std ::endl; } } while (false); |
533 | } |
534 | |
535 | RachListElement_s rachLe; |
536 | rachLe.m_rnti = rnti; |
537 | rachLe.m_estimatedSize = 144; // to be confirmed |
538 | rachInfoReqParams.m_rachList.push_back (rachLe); |
539 | m_rapIdRntiMap.insert (std::pair <uint16_t, uint32_t> (rnti, it->first)); |
540 | } |
541 | } |
542 | m_schedSapProvider->SchedDlRachInfoReq (rachInfoReqParams); |
543 | m_receivedRachPreambleCount.clear (); |
544 | } |
545 | // Get downlink transmission opportunities |
546 | uint32_t dlSchedFrameNo = m_frameNo; |
547 | uint32_t dlSchedSubframeNo = m_subframeNo; |
548 | // NS_LOG_DEBUG (this << " sfn " << frameNo << " sbfn " << subframeNo); |
549 | if (dlSchedSubframeNo + m_macChTtiDelay > 10) |
550 | { |
551 | dlSchedFrameNo++; |
552 | dlSchedSubframeNo = (dlSchedSubframeNo + m_macChTtiDelay) % 10; |
553 | } |
554 | else |
555 | { |
556 | dlSchedSubframeNo = dlSchedSubframeNo + m_macChTtiDelay; |
557 | } |
558 | FfMacSchedSapProvider::SchedDlTriggerReqParameters dlparams; |
559 | dlparams.m_sfnSf = ((0x3FF & dlSchedFrameNo) << 4) | (0xF & dlSchedSubframeNo); |
560 | |
561 | // Forward DL HARQ feebacks collected during last TTI |
562 | if (m_dlInfoListReceived.size () > 0) |
563 | { |
564 | dlparams.m_dlInfoList = m_dlInfoListReceived; |
565 | // empty local buffer |
566 | m_dlInfoListReceived.clear (); |
567 | } |
568 | |
569 | m_schedSapProvider->SchedDlTriggerReq (dlparams); |
570 | |
571 | |
572 | // --- UPLINK --- |
573 | // Send UL-CQI info to the scheduler |
574 | std::vector <FfMacSchedSapProvider::SchedUlCqiInfoReqParameters>::iterator itCqi; |
575 | for (uint16_t i = 0; i < m_ulCqiReceived.size (); i++) |
576 | { |
577 | if (subframeNo > 1) |
578 | { |
579 | m_ulCqiReceived.at (i).m_sfnSf = ((0x3FF & frameNo) << 4) | (0xF & (subframeNo - 1)); |
580 | } |
581 | else |
582 | { |
583 | m_ulCqiReceived.at (i).m_sfnSf = ((0x3FF & (frameNo - 1)) << 4) | (0xF & 10); |
584 | } |
585 | m_schedSapProvider->SchedUlCqiInfoReq (m_ulCqiReceived.at (i)); |
586 | } |
587 | m_ulCqiReceived.clear (); |
588 | |
589 | // Send BSR reports to the scheduler |
590 | if (m_ulCeReceived.size () > 0) |
591 | { |
592 | FfMacSchedSapProvider::SchedUlMacCtrlInfoReqParameters ulMacReq; |
593 | ulMacReq.m_sfnSf = ((0x3FF & frameNo) << 4) | (0xF & subframeNo); |
594 | ulMacReq.m_macCeList.insert (ulMacReq.m_macCeList.begin (), m_ulCeReceived.begin (), m_ulCeReceived.end ()); |
595 | m_ulCeReceived.erase (m_ulCeReceived.begin (), m_ulCeReceived.end ()); |
596 | m_schedSapProvider->SchedUlMacCtrlInfoReq (ulMacReq); |
597 | } |
598 | |
599 | |
600 | // Get uplink transmission opportunities |
601 | uint32_t ulSchedFrameNo = m_frameNo; |
602 | uint32_t ulSchedSubframeNo = m_subframeNo; |
603 | // NS_LOG_DEBUG (this << " sfn " << frameNo << " sbfn " << subframeNo); |
604 | if (ulSchedSubframeNo + (m_macChTtiDelay + UL_PUSCH_TTIS_DELAY4) > 10) |
605 | { |
606 | ulSchedFrameNo++; |
607 | ulSchedSubframeNo = (ulSchedSubframeNo + (m_macChTtiDelay + UL_PUSCH_TTIS_DELAY4)) % 10; |
608 | } |
609 | else |
610 | { |
611 | ulSchedSubframeNo = ulSchedSubframeNo + (m_macChTtiDelay + UL_PUSCH_TTIS_DELAY4); |
612 | } |
613 | FfMacSchedSapProvider::SchedUlTriggerReqParameters ulparams; |
614 | ulparams.m_sfnSf = ((0x3FF & ulSchedFrameNo) << 4) | (0xF & ulSchedSubframeNo); |
615 | |
616 | // Forward DL HARQ feebacks collected during last TTI |
617 | if (m_ulInfoListReceived.size () > 0) |
618 | { |
619 | ulparams.m_ulInfoList = m_ulInfoListReceived; |
620 | // empty local buffer |
621 | m_ulInfoListReceived.clear (); |
622 | } |
623 | |
624 | m_schedSapProvider->SchedUlTriggerReq (ulparams); |
625 | |
626 | } |
627 | |
628 | |
629 | void |
630 | LteEnbMac::DoReceiveLteControlMessage (Ptr<LteControlMessage> msg) |
631 | { |
632 | NS_LOG_FUNCTION (this << msg)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this << msg; std::clog << ")" << std::endl ; } } while (false); |
633 | if (msg->GetMessageType () == LteControlMessage::DL_CQI) |
634 | { |
635 | Ptr<DlCqiLteControlMessage> dlcqi = DynamicCast<DlCqiLteControlMessage> (msg); |
636 | ReceiveDlCqiLteControlMessage (dlcqi); |
637 | } |
638 | else if (msg->GetMessageType () == LteControlMessage::BSR) |
639 | { |
640 | Ptr<BsrLteControlMessage> bsr = DynamicCast<BsrLteControlMessage> (msg); |
641 | ReceiveBsrMessage (bsr->GetBsr ()); |
642 | } |
643 | else if (msg->GetMessageType () == LteControlMessage::DL_HARQ) |
644 | { |
645 | Ptr<DlHarqFeedbackLteControlMessage> dlharq = DynamicCast<DlHarqFeedbackLteControlMessage> (msg); |
646 | DoDlInfoListElementHarqFeeback (dlharq->GetDlHarqFeedback ()); |
647 | } |
648 | else |
649 | { |
650 | NS_LOG_LOGIC (this << " LteControlMessage type " << msg->GetMessageType () << " not recognized")do { if (g_log.IsEnabled (ns3::LOG_LOGIC)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; if (g_log.IsEnabled (ns3::LOG_PREFIX_FUNC)) { std ::clog << g_log.Name () << ":" << __FUNCTION__ << "(): "; }; if (g_log.IsEnabled (ns3::LOG_PREFIX_LEVEL )) { std::clog << "[" << g_log.GetLevelLabel (ns3 ::LOG_LOGIC) << "] "; }; std::clog << this << " LteControlMessage type " << msg->GetMessageType ( ) << " not recognized" << std::endl; } } while (false ); |
651 | } |
652 | } |
653 | |
654 | void |
655 | LteEnbMac::DoReceiveRachPreamble (uint8_t rapId) |
656 | { |
657 | NS_LOG_FUNCTION (this << (uint32_t) rapId)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this << (uint32_t) rapId; std::clog << ")" << std::endl; } } while (false); |
658 | // just record that the preamble has been received; it will be processed later |
659 | ++m_receivedRachPreambleCount[rapId]; // will create entry if not exists |
660 | } |
661 | |
662 | void |
663 | LteEnbMac::DoUlCqiReport (FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi) |
664 | { |
665 | if (ulcqi.m_ulCqi.m_type == UlCqi_s::PUSCH) |
666 | { |
667 | NS_LOG_DEBUG (this << " eNB rxed an PUSCH UL-CQI")do { if (g_log.IsEnabled (ns3::LOG_DEBUG)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; if (g_log.IsEnabled (ns3::LOG_PREFIX_FUNC)) { std ::clog << g_log.Name () << ":" << __FUNCTION__ << "(): "; }; if (g_log.IsEnabled (ns3::LOG_PREFIX_LEVEL )) { std::clog << "[" << g_log.GetLevelLabel (ns3 ::LOG_DEBUG) << "] "; }; std::clog << this << " eNB rxed an PUSCH UL-CQI" << std::endl; } } while (false ); |
668 | } |
669 | else if (ulcqi.m_ulCqi.m_type == UlCqi_s::SRS) |
670 | { |
671 | NS_LOG_DEBUG (this << " eNB rxed an SRS UL-CQI")do { if (g_log.IsEnabled (ns3::LOG_DEBUG)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; if (g_log.IsEnabled (ns3::LOG_PREFIX_FUNC)) { std ::clog << g_log.Name () << ":" << __FUNCTION__ << "(): "; }; if (g_log.IsEnabled (ns3::LOG_PREFIX_LEVEL )) { std::clog << "[" << g_log.GetLevelLabel (ns3 ::LOG_DEBUG) << "] "; }; std::clog << this << " eNB rxed an SRS UL-CQI" << std::endl; } } while (false ); |
672 | } |
673 | m_ulCqiReceived.push_back (ulcqi); |
674 | } |
675 | |
676 | |
677 | void |
678 | LteEnbMac::ReceiveDlCqiLteControlMessage (Ptr<DlCqiLteControlMessage> msg) |
679 | { |
680 | NS_LOG_FUNCTION (this << msg)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this << msg; std::clog << ")" << std::endl ; } } while (false); |
681 | |
682 | CqiListElement_s dlcqi = msg->GetDlCqi (); |
683 | NS_LOG_LOGIC (this << "Enb Received DL-CQI rnti" << dlcqi.m_rnti)do { if (g_log.IsEnabled (ns3::LOG_LOGIC)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; if (g_log.IsEnabled (ns3::LOG_PREFIX_FUNC)) { std ::clog << g_log.Name () << ":" << __FUNCTION__ << "(): "; }; if (g_log.IsEnabled (ns3::LOG_PREFIX_LEVEL )) { std::clog << "[" << g_log.GetLevelLabel (ns3 ::LOG_LOGIC) << "] "; }; std::clog << this << "Enb Received DL-CQI rnti" << dlcqi.m_rnti << std ::endl; } } while (false); |
684 | NS_ASSERT (dlcqi.m_rnti != 0)do { if (!(dlcqi.m_rnti != 0)) { std::cerr << "assert failed. cond=\"" << "dlcqi.m_rnti != 0" << "\", "; do { std::cerr << "file=" << "../src/lte/model/lte-enb-mac.cc" << ", line=" << 684 << std::endl; ::ns3::FatalImpl:: FlushStreams (); if (true) std::terminate (); } while (false) ; } } while (false); |
685 | m_dlCqiReceived.push_back (dlcqi); |
686 | |
687 | } |
688 | |
689 | |
690 | void |
691 | LteEnbMac::ReceiveBsrMessage (MacCeListElement_s bsr) |
692 | { |
693 | NS_LOG_FUNCTION (this)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this; std::clog << ")" << std::endl; } } while ( false); |
694 | m_ccmMacSapUser->UlReceiveMacCe (bsr, m_componentCarrierId); |
695 | } |
696 | |
697 | void |
698 | LteEnbMac::DoReportMacCeToScheduler (MacCeListElement_s bsr) |
699 | { |
700 | NS_LOG_FUNCTION (this)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this; std::clog << ")" << std::endl; } } while ( false); |
701 | NS_LOG_DEBUG (this << " bsr Size " << (uint16_t) m_ulCeReceived.size ())do { if (g_log.IsEnabled (ns3::LOG_DEBUG)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; if (g_log.IsEnabled (ns3::LOG_PREFIX_FUNC)) { std ::clog << g_log.Name () << ":" << __FUNCTION__ << "(): "; }; if (g_log.IsEnabled (ns3::LOG_PREFIX_LEVEL )) { std::clog << "[" << g_log.GetLevelLabel (ns3 ::LOG_DEBUG) << "] "; }; std::clog << this << " bsr Size " << (uint16_t) m_ulCeReceived.size () << std::endl; } } while (false); |
702 | //send to LteCcmMacSapUser |
703 | m_ulCeReceived.push_back (bsr); // this to called when LteUlCcmSapProvider::ReportMacCeToScheduler is called |
704 | NS_LOG_DEBUG (this << " bsr Size after push_back " << (uint16_t) m_ulCeReceived.size ())do { if (g_log.IsEnabled (ns3::LOG_DEBUG)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; if (g_log.IsEnabled (ns3::LOG_PREFIX_FUNC)) { std ::clog << g_log.Name () << ":" << __FUNCTION__ << "(): "; }; if (g_log.IsEnabled (ns3::LOG_PREFIX_LEVEL )) { std::clog << "[" << g_log.GetLevelLabel (ns3 ::LOG_DEBUG) << "] "; }; std::clog << this << " bsr Size after push_back " << (uint16_t) m_ulCeReceived .size () << std::endl; } } while (false); |
705 | } |
706 | |
707 | |
708 | void |
709 | LteEnbMac::DoReceivePhyPdu (Ptr<Packet> p) |
710 | { |
711 | NS_LOG_FUNCTION (this)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this; std::clog << ")" << std::endl; } } while ( false); |
712 | LteRadioBearerTag tag; |
713 | p->RemovePacketTag (tag); |
714 | |
715 | // store info of the packet received |
716 | |
717 | // std::map <uint16_t,UlInfoListElement_s>::iterator it; |
718 | // u_int rnti = tag.GetRnti (); |
719 | // u_int lcid = tag.GetLcid (); |
720 | // it = m_ulInfoListElements.find (tag.GetRnti ()); |
721 | // if (it == m_ulInfoListElements.end ()) |
722 | // { |
723 | // // new RNTI |
724 | // UlInfoListElement_s ulinfonew; |
725 | // ulinfonew.m_rnti = tag.GetRnti (); |
726 | // // always allocate full size of ulReception vector, initializing all elements to 0 |
727 | // ulinfonew.m_ulReception.assign (MAX_LC_LIST+1, 0); |
728 | // // set the element for the current LCID |
729 | // ulinfonew.m_ulReception.at (tag.GetLcid ()) = p->GetSize (); |
730 | // ulinfonew.m_receptionStatus = UlInfoListElement_s::Ok; |
731 | // ulinfonew.m_tpc = 0; // Tx power control not implemented at this stage |
732 | // m_ulInfoListElements.insert (std::pair<uint16_t, UlInfoListElement_s > (tag.GetRnti (), ulinfonew)); |
733 | // |
734 | // } |
735 | // else |
736 | // { |
737 | // // existing RNTI: we just set the value for the current |
738 | // // LCID. Note that the corresponding element had already been |
739 | // // allocated previously. |
740 | // NS_ASSERT_MSG ((*it).second.m_ulReception.at (tag.GetLcid ()) == 0, "would overwrite previously written ulReception element"); |
741 | // (*it).second.m_ulReception.at (tag.GetLcid ()) = p->GetSize (); |
742 | // (*it).second.m_receptionStatus = UlInfoListElement_s::Ok; |
743 | // } |
744 | |
745 | |
746 | |
747 | // forward the packet to the correspondent RLC |
748 | uint16_t rnti = tag.GetRnti (); |
749 | uint8_t lcid = tag.GetLcid (); |
750 | std::map <uint16_t, std::map<uint8_t, LteMacSapUser*> >::iterator rntiIt = m_rlcAttached.find (rnti); |
751 | NS_ASSERT_MSG (rntiIt != m_rlcAttached.end (), "could not find RNTI" << rnti)do { if (!(rntiIt != m_rlcAttached.end ())) { std::cerr << "assert failed. cond=\"" << "rntiIt != m_rlcAttached.end ()" << "\", "; do { std::cerr << "msg=\"" << "could not find RNTI" << rnti << "\", "; do { std::cerr << "file=" << "../src/lte/model/lte-enb-mac.cc" << ", line=" << 751 << std::endl; ::ns3::FatalImpl::FlushStreams (); if (true) std::terminate (); } while (false); } while (false ); } } while (false); |
752 | std::map<uint8_t, LteMacSapUser*>::iterator lcidIt = rntiIt->second.find (lcid); |
753 | //NS_ASSERT_MSG (lcidIt != rntiIt->second.end (), "could not find LCID" << lcid); |
754 | |
755 | //Receive PDU only if LCID is found |
756 | if (lcidIt != rntiIt->second.end ()) |
757 | { |
758 | (*lcidIt).second->ReceivePdu (p, rnti, lcid); |
759 | } |
760 | } |
761 | |
762 | |
763 | |
764 | // //////////////////////////////////////////// |
765 | // CMAC SAP |
766 | // //////////////////////////////////////////// |
767 | |
768 | void |
769 | LteEnbMac::DoConfigureMac (uint8_t ulBandwidth, uint8_t dlBandwidth) |
770 | { |
771 | NS_LOG_FUNCTION (this << " ulBandwidth=" << (uint16_t) ulBandwidth << " dlBandwidth=" << (uint16_t) dlBandwidth)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this << " ulBandwidth=" << (uint16_t) ulBandwidth << " dlBandwidth=" << (uint16_t) dlBandwidth; std ::clog << ")" << std::endl; } } while (false); |
772 | FfMacCschedSapProvider::CschedCellConfigReqParameters params; |
773 | // Configure the subset of parameters used by FfMacScheduler |
774 | params.m_ulBandwidth = ulBandwidth; |
775 | params.m_dlBandwidth = dlBandwidth; |
776 | m_macChTtiDelay = m_enbPhySapProvider->GetMacChTtiDelay (); |
777 | // ...more parameters can be configured |
778 | m_cschedSapProvider->CschedCellConfigReq (params); |
779 | } |
780 | |
781 | |
782 | void |
783 | LteEnbMac::DoAddUe (uint16_t rnti) |
784 | { |
785 | NS_LOG_FUNCTION (this << " rnti=" << rnti)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this << " rnti=" << rnti; std::clog << ")" << std::endl; } } while (false); |
786 | std::map<uint8_t, LteMacSapUser*> empty; |
787 | std::pair <std::map <uint16_t, std::map<uint8_t, LteMacSapUser*> >::iterator, bool> |
788 | ret = m_rlcAttached.insert (std::pair <uint16_t, std::map<uint8_t, LteMacSapUser*> > |
789 | (rnti, empty)); |
790 | NS_ASSERT_MSG (ret.second, "element already present, RNTI already existed")do { if (!(ret.second)) { std::cerr << "assert failed. cond=\"" << "ret.second" << "\", "; do { std::cerr << "msg=\"" << "element already present, RNTI already existed" << "\", "; do { std::cerr << "file=" << "../src/lte/model/lte-enb-mac.cc" << ", line=" << 790 << std::endl; ::ns3::FatalImpl ::FlushStreams (); if (true) std::terminate (); } while (false ); } while (false); } } while (false); |
791 | |
792 | FfMacCschedSapProvider::CschedUeConfigReqParameters params; |
793 | params.m_rnti = rnti; |
794 | params.m_transmissionMode = 0; // set to default value (SISO) for avoiding random initialization (valgrind error) |
795 | |
796 | m_cschedSapProvider->CschedUeConfigReq (params); |
797 | |
798 | // Create DL trasmission HARQ buffers |
799 | std::vector < Ptr<PacketBurst> > dlHarqLayer0pkt; |
800 | dlHarqLayer0pkt.resize (8); |
801 | for (uint8_t i = 0; i < 8; i++) |
802 | { |
803 | Ptr<PacketBurst> pb = CreateObject <PacketBurst> (); |
804 | dlHarqLayer0pkt.at (i) = pb; |
805 | } |
806 | std::vector < Ptr<PacketBurst> > dlHarqLayer1pkt; |
807 | dlHarqLayer1pkt.resize (8); |
808 | for (uint8_t i = 0; i < 8; i++) |
809 | { |
810 | Ptr<PacketBurst> pb = CreateObject <PacketBurst> (); |
811 | dlHarqLayer1pkt.at (i) = pb; |
812 | } |
813 | DlHarqProcessesBuffer_t buf; |
814 | buf.push_back (dlHarqLayer0pkt); |
815 | buf.push_back (dlHarqLayer1pkt); |
816 | m_miDlHarqProcessesPackets.insert (std::pair <uint16_t, DlHarqProcessesBuffer_t> (rnti, buf)); |
817 | } |
818 | |
819 | void |
820 | LteEnbMac::DoRemoveUe (uint16_t rnti) |
821 | { |
822 | NS_LOG_FUNCTION (this << " rnti=" << rnti)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this << " rnti=" << rnti; std::clog << ")" << std::endl; } } while (false); |
823 | FfMacCschedSapProvider::CschedUeReleaseReqParameters params; |
824 | params.m_rnti = rnti; |
825 | m_cschedSapProvider->CschedUeReleaseReq (params); |
826 | m_rlcAttached.erase (rnti); |
827 | m_miDlHarqProcessesPackets.erase (rnti); |
828 | } |
829 | |
830 | void |
831 | LteEnbMac::DoAddLc (LteEnbCmacSapProvider::LcInfo lcinfo, LteMacSapUser* msu) |
832 | { |
833 | NS_LOG_FUNCTION (this << lcinfo.rnti << (uint16_t) lcinfo.lcId)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this << lcinfo.rnti << (uint16_t) lcinfo.lcId; std ::clog << ")" << std::endl; } } while (false); |
834 | |
835 | std::map <LteFlowId_t, LteMacSapUser* >::iterator it; |
836 | |
837 | LteFlowId_t flow (lcinfo.rnti, lcinfo.lcId); |
838 | |
839 | std::map <uint16_t, std::map<uint8_t, LteMacSapUser*> >::iterator rntiIt = m_rlcAttached.find (lcinfo.rnti); |
840 | NS_ASSERT_MSG (rntiIt != m_rlcAttached.end (), "RNTI not found")do { if (!(rntiIt != m_rlcAttached.end ())) { std::cerr << "assert failed. cond=\"" << "rntiIt != m_rlcAttached.end ()" << "\", "; do { std::cerr << "msg=\"" << "RNTI not found" << "\", "; do { std::cerr << "file=" << "../src/lte/model/lte-enb-mac.cc" << ", line=" << 840 << std::endl; ::ns3::FatalImpl ::FlushStreams (); if (true) std::terminate (); } while (false ); } while (false); } } while (false); |
841 | std::map<uint8_t, LteMacSapUser*>::iterator lcidIt = rntiIt->second.find (lcinfo.lcId); |
842 | if (lcidIt == rntiIt->second.end ()) |
843 | { |
844 | rntiIt->second.insert (std::pair<uint8_t, LteMacSapUser*> (lcinfo.lcId, msu)); |
845 | } |
846 | else |
847 | { |
848 | NS_LOG_ERROR ("LC already exists")do { if (g_log.IsEnabled (ns3::LOG_ERROR)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; if (g_log.IsEnabled (ns3::LOG_PREFIX_FUNC)) { std ::clog << g_log.Name () << ":" << __FUNCTION__ << "(): "; }; if (g_log.IsEnabled (ns3::LOG_PREFIX_LEVEL )) { std::clog << "[" << g_log.GetLevelLabel (ns3 ::LOG_ERROR) << "] "; }; std::clog << "LC already exists" << std::endl; } } while (false); |
849 | } |
850 | |
851 | // CCCH (LCID 0) is pre-configured |
852 | // see FF LTE MAC Scheduler |
853 | // Interface Specification v1.11, |
854 | // 4.3.4 logicalChannelConfigListElement |
855 | if (lcinfo.lcId != 0) |
856 | { |
857 | struct FfMacCschedSapProvider::CschedLcConfigReqParameters params; |
858 | params.m_rnti = lcinfo.rnti; |
859 | params.m_reconfigureFlag = false; |
860 | |
861 | struct LogicalChannelConfigListElement_s lccle; |
862 | lccle.m_logicalChannelIdentity = lcinfo.lcId; |
863 | lccle.m_logicalChannelGroup = lcinfo.lcGroup; |
864 | lccle.m_direction = LogicalChannelConfigListElement_s::DIR_BOTH; |
865 | lccle.m_qosBearerType = lcinfo.isGbr ? LogicalChannelConfigListElement_s::QBT_GBR : LogicalChannelConfigListElement_s::QBT_NON_GBR; |
866 | lccle.m_qci = lcinfo.qci; |
867 | lccle.m_eRabMaximulBitrateUl = lcinfo.mbrUl; |
868 | lccle.m_eRabMaximulBitrateDl = lcinfo.mbrDl; |
869 | lccle.m_eRabGuaranteedBitrateUl = lcinfo.gbrUl; |
870 | lccle.m_eRabGuaranteedBitrateDl = lcinfo.gbrDl; |
871 | params.m_logicalChannelConfigList.push_back (lccle); |
872 | |
873 | m_cschedSapProvider->CschedLcConfigReq (params); |
874 | } |
875 | } |
876 | |
877 | void |
878 | LteEnbMac::DoReconfigureLc (LteEnbCmacSapProvider::LcInfo lcinfo) |
879 | { |
880 | NS_FATAL_ERROR ("not implemented")do { std::cerr << "msg=\"" << "not implemented" << "\", "; do { std::cerr << "file=" << "../src/lte/model/lte-enb-mac.cc" << ", line=" << 880 << std::endl; ::ns3::FatalImpl ::FlushStreams (); if (true) std::terminate (); } while (false ); } while (false); |
881 | } |
882 | |
883 | void |
884 | LteEnbMac::DoReleaseLc (uint16_t rnti, uint8_t lcid) |
885 | { |
886 | NS_LOG_FUNCTION (this)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this; std::clog << ")" << std::endl; } } while ( false); |
887 | |
888 | //Find user based on rnti and then erase lcid stored against the same |
889 | std::map <uint16_t, std::map<uint8_t, LteMacSapUser*> >::iterator rntiIt = m_rlcAttached.find (rnti); |
890 | rntiIt->second.erase (lcid); |
891 | |
892 | struct FfMacCschedSapProvider::CschedLcReleaseReqParameters params; |
893 | params.m_rnti = rnti; |
894 | params.m_logicalChannelIdentity.push_back (lcid); |
895 | m_cschedSapProvider->CschedLcReleaseReq (params); |
896 | } |
897 | |
898 | void |
899 | LteEnbMac::DoUeUpdateConfigurationReq (LteEnbCmacSapProvider::UeConfig params) |
900 | { |
901 | NS_LOG_FUNCTION (this)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this; std::clog << ")" << std::endl; } } while ( false); |
902 | |
903 | // propagates to scheduler |
904 | FfMacCschedSapProvider::CschedUeConfigReqParameters req; |
905 | req.m_rnti = params.m_rnti; |
906 | req.m_transmissionMode = params.m_transmissionMode; |
907 | req.m_reconfigureFlag = true; |
908 | m_cschedSapProvider->CschedUeConfigReq (req); |
909 | } |
910 | |
911 | LteEnbCmacSapProvider::RachConfig |
912 | LteEnbMac::DoGetRachConfig () |
913 | { |
914 | struct LteEnbCmacSapProvider::RachConfig rc; |
915 | rc.numberOfRaPreambles = m_numberOfRaPreambles; |
916 | rc.preambleTransMax = m_preambleTransMax; |
917 | rc.raResponseWindowSize = m_raResponseWindowSize; |
918 | return rc; |
919 | } |
920 | |
921 | LteEnbCmacSapProvider::AllocateNcRaPreambleReturnValue |
922 | LteEnbMac::DoAllocateNcRaPreamble (uint16_t rnti) |
923 | { |
924 | bool found = false; |
925 | uint8_t preambleId; |
926 | for (preambleId = m_numberOfRaPreambles; preambleId < 64; ++preambleId) |
927 | { |
928 | std::map<uint8_t, NcRaPreambleInfo>::iterator it = m_allocatedNcRaPreambleMap.find (preambleId); |
929 | if ((it == m_allocatedNcRaPreambleMap.end ()) |
930 | || (it->second.expiryTime < Simulator::Now ())) |
931 | { |
932 | found = true; |
933 | NcRaPreambleInfo preambleInfo; |
934 | uint32_t expiryIntervalMs = (uint32_t) m_preambleTransMax * ((uint32_t) m_raResponseWindowSize + 5); |
935 | |
936 | preambleInfo.expiryTime = Simulator::Now () + MilliSeconds (expiryIntervalMs); |
937 | preambleInfo.rnti = rnti; |
938 | NS_LOG_INFO ("allocated preamble for NC based RA: preamble " << preambleId << ", RNTI " << preambleInfo.rnti << ", exiryTime " << preambleInfo.expiryTime)do { if (g_log.IsEnabled (ns3::LOG_INFO)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; if (g_log.IsEnabled (ns3::LOG_PREFIX_FUNC)) { std ::clog << g_log.Name () << ":" << __FUNCTION__ << "(): "; }; if (g_log.IsEnabled (ns3::LOG_PREFIX_LEVEL )) { std::clog << "[" << g_log.GetLevelLabel (ns3 ::LOG_INFO) << "] "; }; std::clog << "allocated preamble for NC based RA: preamble " << preambleId << ", RNTI " << preambleInfo .rnti << ", exiryTime " << preambleInfo.expiryTime << std::endl; } } while (false); |
939 | m_allocatedNcRaPreambleMap[preambleId] = preambleInfo; // create if not exist, update otherwise |
940 | break; |
941 | } |
942 | } |
943 | LteEnbCmacSapProvider::AllocateNcRaPreambleReturnValue ret; |
944 | if (found) |
945 | { |
946 | ret.valid = true; |
947 | ret.raPreambleId = preambleId; |
948 | ret.raPrachMaskIndex = 0; |
949 | } |
950 | else |
951 | { |
952 | ret.valid = false; |
953 | ret.raPreambleId = 0; |
954 | ret.raPrachMaskIndex = 0; |
955 | } |
956 | return ret; |
957 | } |
958 | |
959 | |
960 | |
961 | // //////////////////////////////////////////// |
962 | // MAC SAP |
963 | // //////////////////////////////////////////// |
964 | |
965 | |
966 | void |
967 | LteEnbMac::DoTransmitPdu (LteMacSapProvider::TransmitPduParameters params) |
968 | { |
969 | NS_LOG_FUNCTION (this)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this; std::clog << ")" << std::endl; } } while ( false); |
970 | LteRadioBearerTag tag (params.rnti, params.lcid, params.layer); |
971 | params.pdu->AddPacketTag (tag); |
972 | params.componentCarrierId = m_componentCarrierId; |
973 | // Store pkt in HARQ buffer |
974 | std::map <uint16_t, DlHarqProcessesBuffer_t>::iterator it = m_miDlHarqProcessesPackets.find (params.rnti); |
975 | NS_ASSERT (it != m_miDlHarqProcessesPackets.end ())do { if (!(it != m_miDlHarqProcessesPackets.end ())) { std::cerr << "assert failed. cond=\"" << "it != m_miDlHarqProcessesPackets.end ()" << "\", "; do { std::cerr << "file=" << "../src/lte/model/lte-enb-mac.cc" << ", line=" << 975 << std::endl; ::ns3::FatalImpl ::FlushStreams (); if (true) std::terminate (); } while (false ); } } while (false); |
976 | NS_LOG_DEBUG (this << " LAYER " << (uint16_t)tag.GetLayer () << " HARQ ID " << (uint16_t)params.harqProcessId)do { if (g_log.IsEnabled (ns3::LOG_DEBUG)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; if (g_log.IsEnabled (ns3::LOG_PREFIX_FUNC)) { std ::clog << g_log.Name () << ":" << __FUNCTION__ << "(): "; }; if (g_log.IsEnabled (ns3::LOG_PREFIX_LEVEL )) { std::clog << "[" << g_log.GetLevelLabel (ns3 ::LOG_DEBUG) << "] "; }; std::clog << this << " LAYER " << (uint16_t)tag.GetLayer () << " HARQ ID " << (uint16_t)params.harqProcessId << std::endl; } } while (false); |
977 | |
978 | //(*it).second.at (params.layer).at (params.harqProcessId) = params.pdu;//->Copy (); |
979 | (*it).second.at (params.layer).at (params.harqProcessId)->AddPacket (params.pdu); |
980 | m_enbPhySapProvider->SendMacPdu (params.pdu); |
981 | } |
982 | |
983 | void |
984 | LteEnbMac::DoReportBufferStatus (LteMacSapProvider::ReportBufferStatusParameters params) |
985 | { |
986 | NS_LOG_FUNCTION (this)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this; std::clog << ")" << std::endl; } } while ( false); |
987 | FfMacSchedSapProvider::SchedDlRlcBufferReqParameters req; |
988 | req.m_rnti = params.rnti; |
989 | req.m_logicalChannelIdentity = params.lcid; |
990 | req.m_rlcTransmissionQueueSize = params.txQueueSize; |
991 | req.m_rlcTransmissionQueueHolDelay = params.txQueueHolDelay; |
992 | req.m_rlcRetransmissionQueueSize = params.retxQueueSize; |
993 | req.m_rlcRetransmissionHolDelay = params.retxQueueHolDelay; |
994 | req.m_rlcStatusPduSize = params.statusPduSize; |
995 | m_schedSapProvider->SchedDlRlcBufferReq (req); |
996 | } |
997 | |
998 | |
999 | |
1000 | // //////////////////////////////////////////// |
1001 | // SCHED SAP |
1002 | // //////////////////////////////////////////// |
1003 | |
1004 | |
1005 | |
1006 | void |
1007 | LteEnbMac::DoSchedDlConfigInd (FfMacSchedSapUser::SchedDlConfigIndParameters ind) |
1008 | { |
1009 | NS_LOG_FUNCTION (this)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this; std::clog << ")" << std::endl; } } while ( false); |
1010 | // Create DL PHY PDU |
1011 | Ptr<PacketBurst> pb = CreateObject<PacketBurst> (); |
1012 | std::map <LteFlowId_t, LteMacSapUser* >::iterator it; |
1013 | |
1014 | for (unsigned int i = 0; i < ind.m_buildDataList.size (); i++) |
1015 | { |
1016 | for (uint16_t layer = 0; layer < ind.m_buildDataList.at (i).m_dci.m_ndi.size (); layer++) |
1017 | { |
1018 | if (ind.m_buildDataList.at (i).m_dci.m_ndi.at (layer) == 1) |
1019 | { |
1020 | // new data -> force emptying correspondent harq pkt buffer |
1021 | std::map <uint16_t, DlHarqProcessesBuffer_t>::iterator it = m_miDlHarqProcessesPackets.find (ind.m_buildDataList.at (i).m_rnti); |
1022 | NS_ASSERT (it != m_miDlHarqProcessesPackets.end ())do { if (!(it != m_miDlHarqProcessesPackets.end ())) { std::cerr << "assert failed. cond=\"" << "it != m_miDlHarqProcessesPackets.end ()" << "\", "; do { std::cerr << "file=" << "../src/lte/model/lte-enb-mac.cc" << ", line=" << 1022 << std::endl; ::ns3:: FatalImpl::FlushStreams (); if (true) std::terminate (); } while (false); } } while (false); |
1023 | for (uint16_t lcId = 0; lcId < (*it).second.size (); lcId++) |
1024 | { |
1025 | Ptr<PacketBurst> pb = CreateObject <PacketBurst> (); |
1026 | (*it).second.at (lcId).at (ind.m_buildDataList.at (i).m_dci.m_harqProcess) = pb; |
1027 | } |
1028 | } |
1029 | } |
1030 | for (unsigned int j = 0; j < ind.m_buildDataList.at (i).m_rlcPduList.size (); j++) |
1031 | { |
1032 | for (uint16_t k = 0; k < ind.m_buildDataList.at (i).m_rlcPduList.at (j).size (); k++) |
1033 | { |
1034 | if (ind.m_buildDataList.at (i).m_dci.m_ndi.at (k) == 1) |
1035 | { |
1036 | // New Data -> retrieve it from RLC |
1037 | uint16_t rnti = ind.m_buildDataList.at (i).m_rnti; |
1038 | uint8_t lcid = ind.m_buildDataList.at (i).m_rlcPduList.at (j).at (k).m_logicalChannelIdentity; |
1039 | std::map <uint16_t, std::map<uint8_t, LteMacSapUser*> >::iterator rntiIt = m_rlcAttached.find (rnti); |
1040 | NS_ASSERT_MSG (rntiIt != m_rlcAttached.end (), "could not find RNTI" << rnti)do { if (!(rntiIt != m_rlcAttached.end ())) { std::cerr << "assert failed. cond=\"" << "rntiIt != m_rlcAttached.end ()" << "\", "; do { std::cerr << "msg=\"" << "could not find RNTI" << rnti << "\", "; do { std::cerr << "file=" << "../src/lte/model/lte-enb-mac.cc" << ", line=" << 1040 << std::endl; ::ns3::FatalImpl::FlushStreams (); if (true) std::terminate (); } while (false); } while (false ); } } while (false); |
1041 | std::map<uint8_t, LteMacSapUser*>::iterator lcidIt = rntiIt->second.find (lcid); |
1042 | NS_ASSERT_MSG (lcidIt != rntiIt->second.end (), "could not find LCID" << (uint32_t)lcid<<" carrier id:"<<(uint16_t)m_componentCarrierId)do { if (!(lcidIt != rntiIt->second.end ())) { std::cerr << "assert failed. cond=\"" << "lcidIt != rntiIt->second.end ()" << "\", "; do { std::cerr << "msg=\"" << "could not find LCID" << (uint32_t)lcid<<" carrier id:"<<(uint16_t )m_componentCarrierId << "\", "; do { std::cerr << "file=" << "../src/lte/model/lte-enb-mac.cc" << ", line=" << 1042 << std::endl; ::ns3::FatalImpl::FlushStreams (); if (true) std::terminate (); } while (false); } while (false ); } } while (false); |
1043 | NS_LOG_DEBUG (this << " rnti= " << rnti << " lcid= " << (uint32_t) lcid << " layer= " << k)do { if (g_log.IsEnabled (ns3::LOG_DEBUG)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; if (g_log.IsEnabled (ns3::LOG_PREFIX_FUNC)) { std ::clog << g_log.Name () << ":" << __FUNCTION__ << "(): "; }; if (g_log.IsEnabled (ns3::LOG_PREFIX_LEVEL )) { std::clog << "[" << g_log.GetLevelLabel (ns3 ::LOG_DEBUG) << "] "; }; std::clog << this << " rnti= " << rnti << " lcid= " << (uint32_t ) lcid << " layer= " << k << std::endl; } } while (false); |
1044 | (*lcidIt).second->NotifyTxOpportunity (ind.m_buildDataList.at (i).m_rlcPduList.at (j).at (k).m_size, k, ind.m_buildDataList.at (i).m_dci.m_harqProcess, m_componentCarrierId, rnti, lcid); |
1045 | } |
1046 | else |
1047 | { |
1048 | if (ind.m_buildDataList.at (i).m_dci.m_tbsSize.at (k) > 0) |
1049 | { |
1050 | // HARQ retransmission -> retrieve TB from HARQ buffer |
1051 | std::map <uint16_t, DlHarqProcessesBuffer_t>::iterator it = m_miDlHarqProcessesPackets.find (ind.m_buildDataList.at (i).m_rnti); |
1052 | NS_ASSERT (it != m_miDlHarqProcessesPackets.end ())do { if (!(it != m_miDlHarqProcessesPackets.end ())) { std::cerr << "assert failed. cond=\"" << "it != m_miDlHarqProcessesPackets.end ()" << "\", "; do { std::cerr << "file=" << "../src/lte/model/lte-enb-mac.cc" << ", line=" << 1052 << std::endl; ::ns3:: FatalImpl::FlushStreams (); if (true) std::terminate (); } while (false); } } while (false); |
1053 | Ptr<PacketBurst> pb = (*it).second.at (k).at ( ind.m_buildDataList.at (i).m_dci.m_harqProcess); |
1054 | for (std::list<Ptr<Packet> >::const_iterator j = pb->Begin (); j != pb->End (); ++j) |
1055 | { |
1056 | Ptr<Packet> pkt = (*j)->Copy (); |
1057 | m_enbPhySapProvider->SendMacPdu (pkt); |
1058 | } |
1059 | } |
1060 | } |
1061 | } |
1062 | } |
1063 | // send the relative DCI |
1064 | Ptr<DlDciLteControlMessage> msg = Create<DlDciLteControlMessage> (); |
1065 | msg->SetDci (ind.m_buildDataList.at (i).m_dci); |
1066 | m_enbPhySapProvider->SendLteControlMessage (msg); |
1067 | } |
1068 | |
1069 | // Fire the trace with the DL information |
1070 | for ( uint32_t i = 0; i < ind.m_buildDataList.size (); i++ ) |
1071 | { |
1072 | // Only one TB used |
1073 | if (ind.m_buildDataList.at (i).m_dci.m_tbsSize.size () == 1) |
1074 | { |
1075 | DlSchedulingCallbackInfo dlSchedulingCallbackInfo; |
1076 | dlSchedulingCallbackInfo.frameNo = m_frameNo; |
1077 | dlSchedulingCallbackInfo.subframeNo = m_subframeNo; |
1078 | dlSchedulingCallbackInfo.rnti = ind.m_buildDataList.at (i).m_dci.m_rnti; |
1079 | dlSchedulingCallbackInfo.mcsTb1=ind.m_buildDataList.at (i).m_dci.m_mcs.at (0); |
1080 | dlSchedulingCallbackInfo.sizeTb1 = ind.m_buildDataList.at (i).m_dci.m_tbsSize.at (0); |
1081 | dlSchedulingCallbackInfo.mcsTb2 = 0; |
1082 | dlSchedulingCallbackInfo.sizeTb2 = 0; |
1083 | dlSchedulingCallbackInfo.componentCarrierId = m_componentCarrierId; |
1084 | m_dlScheduling(dlSchedulingCallbackInfo); |
1085 | } |
1086 | // Two TBs used |
1087 | else if (ind.m_buildDataList.at (i).m_dci.m_tbsSize.size () == 2) |
1088 | { |
1089 | DlSchedulingCallbackInfo dlSchedulingCallbackInfo; |
1090 | dlSchedulingCallbackInfo.frameNo = m_frameNo; |
1091 | dlSchedulingCallbackInfo.subframeNo = m_subframeNo; |
1092 | dlSchedulingCallbackInfo.rnti = ind.m_buildDataList.at (i).m_dci.m_rnti; |
1093 | dlSchedulingCallbackInfo.mcsTb1=ind.m_buildDataList.at (i).m_dci.m_mcs.at (0); |
1094 | dlSchedulingCallbackInfo.sizeTb1 = ind.m_buildDataList.at (i).m_dci.m_tbsSize.at (0); |
1095 | dlSchedulingCallbackInfo.mcsTb2 = ind.m_buildDataList.at (i).m_dci.m_mcs.at (1); |
1096 | dlSchedulingCallbackInfo.sizeTb2 = ind.m_buildDataList.at (i).m_dci.m_tbsSize.at (1); |
1097 | dlSchedulingCallbackInfo.componentCarrierId = m_componentCarrierId; |
1098 | m_dlScheduling(dlSchedulingCallbackInfo); |
1099 | } |
1100 | else |
1101 | { |
1102 | NS_FATAL_ERROR ("Found element with more than two transport blocks")do { std::cerr << "msg=\"" << "Found element with more than two transport blocks" << "\", "; do { std::cerr << "file=" << "../src/lte/model/lte-enb-mac.cc" << ", line=" << 1102 << std::endl; ::ns3:: FatalImpl::FlushStreams (); if (true) std::terminate (); } while (false); } while (false); |
1103 | } |
1104 | } |
1105 | |
1106 | // Random Access procedure: send RARs |
1107 | Ptr<RarLteControlMessage> rarMsg = Create<RarLteControlMessage> (); |
1108 | // see TS 36.321 5.1.4; preambles were sent two frames ago |
1109 | // (plus 3GPP counts subframes from 0, not 1) |
1110 | uint16_t raRnti; |
1111 | if (m_subframeNo < 3) |
1112 | { |
1113 | raRnti = m_subframeNo + 7; // equivalent to +10-3 |
1114 | } |
1115 | else |
1116 | { |
1117 | raRnti = m_subframeNo - 3; |
1118 | } |
1119 | rarMsg->SetRaRnti (raRnti); |
1120 | for (unsigned int i = 0; i < ind.m_buildRarList.size (); i++) |
1121 | { |
1122 | std::map <uint8_t, uint32_t>::iterator itRapId = m_rapIdRntiMap.find (ind.m_buildRarList.at (i).m_rnti); |
1123 | if (itRapId == m_rapIdRntiMap.end ()) |
1124 | { |
1125 | NS_FATAL_ERROR ("Unable to find rapId of RNTI " << ind.m_buildRarList.at (i).m_rnti)do { std::cerr << "msg=\"" << "Unable to find rapId of RNTI " << ind.m_buildRarList.at (i).m_rnti << "\", "; do { std::cerr << "file=" << "../src/lte/model/lte-enb-mac.cc" << ", line=" << 1125 << std::endl; ::ns3:: FatalImpl::FlushStreams (); if (true) std::terminate (); } while (false); } while (false); |
1126 | } |
1127 | RarLteControlMessage::Rar rar; |
1128 | rar.rapId = itRapId->second; |
1129 | rar.rarPayload = ind.m_buildRarList.at (i); |
1130 | rarMsg->AddRar (rar); |
1131 | NS_LOG_INFO (this << " Send RAR message to RNTI " << ind.m_buildRarList.at (i).m_rnti << " rapId " << itRapId->second)do { if (g_log.IsEnabled (ns3::LOG_INFO)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; if (g_log.IsEnabled (ns3::LOG_PREFIX_FUNC)) { std ::clog << g_log.Name () << ":" << __FUNCTION__ << "(): "; }; if (g_log.IsEnabled (ns3::LOG_PREFIX_LEVEL )) { std::clog << "[" << g_log.GetLevelLabel (ns3 ::LOG_INFO) << "] "; }; std::clog << this << " Send RAR message to RNTI " << ind.m_buildRarList.at ( i).m_rnti << " rapId " << itRapId->second << std::endl; } } while (false); |
1132 | } |
1133 | if (ind.m_buildRarList.size () > 0) |
1134 | { |
1135 | m_enbPhySapProvider->SendLteControlMessage (rarMsg); |
1136 | } |
1137 | m_rapIdRntiMap.clear (); |
1138 | } |
1139 | |
1140 | |
1141 | void |
1142 | LteEnbMac::DoSchedUlConfigInd (FfMacSchedSapUser::SchedUlConfigIndParameters ind) |
1143 | { |
1144 | NS_LOG_FUNCTION (this)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this; std::clog << ")" << std::endl; } } while ( false); |
1145 | |
1146 | for (unsigned int i = 0; i < ind.m_dciList.size (); i++) |
1147 | { |
1148 | // send the correspondent ul dci |
1149 | Ptr<UlDciLteControlMessage> msg = Create<UlDciLteControlMessage> (); |
1150 | msg->SetDci (ind.m_dciList.at (i)); |
1151 | m_enbPhySapProvider->SendLteControlMessage (msg); |
1152 | } |
1153 | |
1154 | // Fire the trace with the UL information |
1155 | for ( uint32_t i = 0; i < ind.m_dciList.size (); i++ ) |
1156 | { |
1157 | m_ulScheduling (m_frameNo, m_subframeNo, ind.m_dciList.at (i).m_rnti, |
1158 | ind.m_dciList.at (i).m_mcs, ind.m_dciList.at (i).m_tbSize, m_componentCarrierId); |
1159 | } |
1160 | |
1161 | |
1162 | |
1163 | } |
1164 | |
1165 | |
1166 | |
1167 | |
1168 | // //////////////////////////////////////////// |
1169 | // CSCHED SAP |
1170 | // //////////////////////////////////////////// |
1171 | |
1172 | |
1173 | void |
1174 | LteEnbMac::DoCschedCellConfigCnf (FfMacCschedSapUser::CschedCellConfigCnfParameters params) |
1175 | { |
1176 | NS_LOG_FUNCTION (this)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this; std::clog << ")" << std::endl; } } while ( false); |
1177 | } |
1178 | |
1179 | void |
1180 | LteEnbMac::DoCschedUeConfigCnf (FfMacCschedSapUser::CschedUeConfigCnfParameters params) |
1181 | { |
1182 | NS_LOG_FUNCTION (this)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this; std::clog << ")" << std::endl; } } while ( false); |
1183 | } |
1184 | |
1185 | void |
1186 | LteEnbMac::DoCschedLcConfigCnf (FfMacCschedSapUser::CschedLcConfigCnfParameters params) |
1187 | { |
1188 | NS_LOG_FUNCTION (this)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this; std::clog << ")" << std::endl; } } while ( false); |
1189 | // Call the CSCHED primitive |
1190 | // m_cschedSap->LcConfigCompleted(); |
1191 | } |
1192 | |
1193 | void |
1194 | LteEnbMac::DoCschedLcReleaseCnf (FfMacCschedSapUser::CschedLcReleaseCnfParameters params) |
1195 | { |
1196 | NS_LOG_FUNCTION (this)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this; std::clog << ")" << std::endl; } } while ( false); |
1197 | } |
1198 | |
1199 | void |
1200 | LteEnbMac::DoCschedUeReleaseCnf (FfMacCschedSapUser::CschedUeReleaseCnfParameters params) |
1201 | { |
1202 | NS_LOG_FUNCTION (this)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this; std::clog << ")" << std::endl; } } while ( false); |
1203 | } |
1204 | |
1205 | void |
1206 | LteEnbMac::DoCschedUeConfigUpdateInd (FfMacCschedSapUser::CschedUeConfigUpdateIndParameters params) |
1207 | { |
1208 | NS_LOG_FUNCTION (this)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this; std::clog << ")" << std::endl; } } while ( false); |
1209 | // propagates to RRC |
1210 | LteEnbCmacSapUser::UeConfig ueConfigUpdate; |
1211 | ueConfigUpdate.m_rnti = params.m_rnti; |
1212 | ueConfigUpdate.m_transmissionMode = params.m_transmissionMode; |
1213 | m_cmacSapUser->RrcConfigurationUpdateInd (ueConfigUpdate); |
1214 | } |
1215 | |
1216 | void |
1217 | LteEnbMac::DoCschedCellConfigUpdateInd (FfMacCschedSapUser::CschedCellConfigUpdateIndParameters params) |
1218 | { |
1219 | NS_LOG_FUNCTION (this)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this; std::clog << ")" << std::endl; } } while ( false); |
1220 | } |
1221 | |
1222 | void |
1223 | LteEnbMac::DoUlInfoListElementHarqFeeback (UlInfoListElement_s params) |
1224 | { |
1225 | NS_LOG_FUNCTION (this)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this; std::clog << ")" << std::endl; } } while ( false); |
1226 | m_ulInfoListReceived.push_back (params); |
1227 | } |
1228 | |
1229 | void |
1230 | LteEnbMac::DoDlInfoListElementHarqFeeback (DlInfoListElement_s params) |
1231 | { |
1232 | NS_LOG_FUNCTION (this)do { if (g_log.IsEnabled (ns3::LOG_FUNCTION)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; std::clog << g_log.Name () << ":" << __FUNCTION__ << "("; ns3::ParameterLogger (std::clog) << this; std::clog << ")" << std::endl; } } while ( false); |
1233 | // Update HARQ buffer |
1234 | std::map <uint16_t, DlHarqProcessesBuffer_t>::iterator it = m_miDlHarqProcessesPackets.find (params.m_rnti); |
1235 | NS_ASSERT (it != m_miDlHarqProcessesPackets.end ())do { if (!(it != m_miDlHarqProcessesPackets.end ())) { std::cerr << "assert failed. cond=\"" << "it != m_miDlHarqProcessesPackets.end ()" << "\", "; do { std::cerr << "file=" << "../src/lte/model/lte-enb-mac.cc" << ", line=" << 1235 << std::endl; ::ns3:: FatalImpl::FlushStreams (); if (true) std::terminate (); } while (false); } } while (false); |
1236 | for (uint8_t layer = 0; layer < params.m_harqStatus.size (); layer++) |
1237 | { |
1238 | if (params.m_harqStatus.at (layer) == DlInfoListElement_s::ACK) |
1239 | { |
1240 | // discard buffer |
1241 | Ptr<PacketBurst> emptyBuf = CreateObject <PacketBurst> (); |
1242 | (*it).second.at (layer).at (params.m_harqProcessId) = emptyBuf; |
1243 | NS_LOG_DEBUG (this << " HARQ-ACK UE " << params.m_rnti << " harqId " << (uint16_t)params.m_harqProcessId << " layer " << (uint16_t)layer)do { if (g_log.IsEnabled (ns3::LOG_DEBUG)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; if (g_log.IsEnabled (ns3::LOG_PREFIX_FUNC)) { std ::clog << g_log.Name () << ":" << __FUNCTION__ << "(): "; }; if (g_log.IsEnabled (ns3::LOG_PREFIX_LEVEL )) { std::clog << "[" << g_log.GetLevelLabel (ns3 ::LOG_DEBUG) << "] "; }; std::clog << this << " HARQ-ACK UE " << params.m_rnti << " harqId " << (uint16_t)params.m_harqProcessId << " layer " << (uint16_t)layer << std::endl; } } while (false); |
1244 | } |
1245 | else if (params.m_harqStatus.at (layer) == DlInfoListElement_s::NACK) |
1246 | { |
1247 | NS_LOG_DEBUG (this << " HARQ-NACK UE " << params.m_rnti << " harqId " << (uint16_t)params.m_harqProcessId << " layer " << (uint16_t)layer)do { if (g_log.IsEnabled (ns3::LOG_DEBUG)) { if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) { ns3::LogTimePrinter printer = ns3:: LogGetTimePrinter (); if (printer != 0) { (*printer)(std::clog ); std::clog << " "; } }; if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE )) { ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); if (printer != 0) { (*printer)(std::clog); std::clog << " "; } }; ; if (g_log.IsEnabled (ns3::LOG_PREFIX_FUNC)) { std ::clog << g_log.Name () << ":" << __FUNCTION__ << "(): "; }; if (g_log.IsEnabled (ns3::LOG_PREFIX_LEVEL )) { std::clog << "[" << g_log.GetLevelLabel (ns3 ::LOG_DEBUG) << "] "; }; std::clog << this << " HARQ-NACK UE " << params.m_rnti << " harqId " << (uint16_t)params.m_harqProcessId << " layer " << (uint16_t)layer << std::endl; } } while (false); |
1248 | } |
1249 | else |
1250 | { |
1251 | NS_FATAL_ERROR (" HARQ functionality not implemented")do { std::cerr << "msg=\"" << " HARQ functionality not implemented" << "\", "; do { std::cerr << "file=" << "../src/lte/model/lte-enb-mac.cc" << ", line=" << 1251 << std::endl; ::ns3:: FatalImpl::FlushStreams (); if (true) std::terminate (); } while (false); } while (false); |
1252 | } |
1253 | } |
1254 | m_dlInfoListReceived.push_back (params); |
1255 | } |
1256 | |
1257 | |
1258 | } // namespace ns3 |