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