A Discrete-Event Network Simulator
API
lte-enb-mac.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: 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 namespace ns3 {
42 
43 NS_LOG_COMPONENT_DEFINE ("LteEnbMac");
44 
45 NS_OBJECT_ENSURE_REGISTERED (LteEnbMac);
46 
47 
48 
49 // //////////////////////////////////////
50 // member SAP forwarders
51 // //////////////////////////////////////
52 
53 
55 {
56 public:
58 
59  // inherited from LteEnbCmacSapProvider
60  virtual void ConfigureMac (uint8_t ulBandwidth, uint8_t dlBandwidth);
61  virtual void AddUe (uint16_t rnti);
62  virtual void RemoveUe (uint16_t rnti);
63  virtual void AddLc (LcInfo lcinfo, LteMacSapUser* msu);
64  virtual void ReconfigureLc (LcInfo lcinfo);
65  virtual void ReleaseLc (uint16_t rnti, uint8_t lcid);
66  virtual void UeUpdateConfigurationReq (UeConfig params);
67  virtual RachConfig GetRachConfig ();
69 
70 
71 private:
73 };
74 
75 
77  : m_mac (mac)
78 {
79 }
80 
81 void
82 EnbMacMemberLteEnbCmacSapProvider::ConfigureMac (uint8_t ulBandwidth, uint8_t dlBandwidth)
83 {
84  m_mac->DoConfigureMac (ulBandwidth, dlBandwidth);
85 }
86 
87 void
89 {
90  m_mac->DoAddUe (rnti);
91 }
92 
93 void
95 {
96  m_mac->DoRemoveUe (rnti);
97 }
98 
99 void
101 {
102  m_mac->DoAddLc (lcinfo, msu);
103 }
104 
105 void
107 {
108  m_mac->DoReconfigureLc (lcinfo);
109 }
110 
111 void
112 EnbMacMemberLteEnbCmacSapProvider::ReleaseLc (uint16_t rnti, uint8_t lcid)
113 {
114  m_mac->DoReleaseLc (rnti, lcid);
115 }
116 
117 void
119 {
121 }
122 
125 {
126  return m_mac->DoGetRachConfig ();
127 }
128 
131 {
132  return m_mac->DoAllocateNcRaPreamble (rnti);
133 }
134 
135 
137 {
138 public:
140 
141 
142  virtual void SchedDlConfigInd (const struct SchedDlConfigIndParameters& params);
143  virtual void SchedUlConfigInd (const struct SchedUlConfigIndParameters& params);
144 private:
146 };
147 
148 
150  : m_mac (mac)
151 {
152 }
153 
154 
155 void
157 {
158  m_mac->DoSchedDlConfigInd (params);
159 }
160 
161 
162 
163 void
165 {
166  m_mac->DoSchedUlConfigInd (params);
167 }
168 
169 
170 
172 {
173 public:
175 
176  virtual void CschedCellConfigCnf (const struct CschedCellConfigCnfParameters& params);
177  virtual void CschedUeConfigCnf (const struct CschedUeConfigCnfParameters& params);
178  virtual void CschedLcConfigCnf (const struct CschedLcConfigCnfParameters& params);
179  virtual void CschedLcReleaseCnf (const struct CschedLcReleaseCnfParameters& params);
180  virtual void CschedUeReleaseCnf (const struct CschedUeReleaseCnfParameters& params);
181  virtual void CschedUeConfigUpdateInd (const struct CschedUeConfigUpdateIndParameters& params);
182  virtual void CschedCellConfigUpdateInd (const struct CschedCellConfigUpdateIndParameters& params);
183 
184 private:
186 };
187 
188 
190  : m_mac (mac)
191 {
192 }
193 
194 void
196 {
197  m_mac->DoCschedCellConfigCnf (params);
198 }
199 
200 void
202 {
203  m_mac->DoCschedUeConfigCnf (params);
204 }
205 
206 void
208 {
209  m_mac->DoCschedLcConfigCnf (params);
210 }
211 
212 void
214 {
215  m_mac->DoCschedLcReleaseCnf (params);
216 }
217 
218 void
220 {
221  m_mac->DoCschedUeReleaseCnf (params);
222 }
223 
224 void
226 {
228 }
229 
230 void
232 {
234 }
235 
236 
237 
238 // ---------- PHY-SAP
239 
240 
242 {
243 public:
245 
246  // inherited from LteEnbPhySapUser
247  virtual void ReceivePhyPdu (Ptr<Packet> p);
248  virtual void SubframeIndication (uint32_t frameNo, uint32_t subframeNo);
250  virtual void ReceiveRachPreamble (uint32_t prachId);
254 
255 private:
257 };
258 
260 {
261 }
262 
263 
264 void
266 {
267  m_mac->DoReceivePhyPdu (p);
268 }
269 
270 void
271 EnbMacMemberLteEnbPhySapUser::SubframeIndication (uint32_t frameNo, uint32_t subframeNo)
272 {
273  m_mac->DoSubframeIndication (frameNo, subframeNo);
274 }
275 
276 void
278 {
280 }
281 
282 void
284 {
285  m_mac->DoReceiveRachPreamble (prachId);
286 }
287 
288 void
290 {
291  m_mac->DoUlCqiReport (ulcqi);
292 }
293 
294 void
296 {
298 }
299 
300 void
302 {
304 }
305 
306 
307 // //////////////////////////////////////
308 // generic LteEnbMac methods
309 // //////////////////////////////////////
310 
311 
312 TypeId
314 {
315  static TypeId tid = TypeId ("ns3::LteEnbMac")
316  .SetParent<Object> ()
317  .AddConstructor<LteEnbMac> ()
318  .AddAttribute ("NumberOfRaPreambles",
319  "how many random access preambles are available for the contention based RACH process",
320  UintegerValue (50),
322  MakeUintegerChecker<uint8_t> (4, 64))
323  .AddAttribute ("PreambleTransMax",
324  "Maximum number of random access preamble transmissions",
325  UintegerValue (50),
327  MakeUintegerChecker<uint8_t> (3, 200))
328  .AddAttribute ("RaResponseWindowSize",
329  "length of the window (in TTIs) for the reception of the random access response (RAR); the resulting RAR timeout is this value + 3 ms",
330  UintegerValue (3),
332  MakeUintegerChecker<uint8_t> (2, 10))
333  .AddTraceSource ("DlScheduling",
334  "Information regarding DL scheduling.",
336  "ns3::LteEnbMac::DlSchedulingTracedCallback")
337  .AddTraceSource ("UlScheduling",
338  "Information regarding UL scheduling.",
340  "ns3::LteEnbMac::UlSchedulingTracedCallback")
341  ;
342 
343  return tid;
344 }
345 
346 
348 {
349  NS_LOG_FUNCTION (this);
355 }
356 
357 
359 {
360  NS_LOG_FUNCTION (this);
361 }
362 
363 void
365 {
366  NS_LOG_FUNCTION (this);
367  m_dlCqiReceived.clear ();
368  m_ulCqiReceived.clear ();
369  m_ulCeReceived.clear ();
370  m_dlInfoListReceived.clear ();
371  m_ulInfoListReceived.clear ();
373  delete m_macSapProvider;
374  delete m_cmacSapProvider;
375  delete m_schedSapUser;
376  delete m_cschedSapUser;
377  delete m_enbPhySapUser;
378 }
379 
380 
381 void
383 {
385 }
386 
389 {
390  return m_schedSapUser;
391 }
392 
393 void
395 {
397 }
398 
401 {
402  return m_cschedSapUser;
403 }
404 
405 
406 
407 void
409 {
410  m_macSapUser = s;
411 }
412 
415 {
416  return m_macSapProvider;
417 }
418 
419 void
421 {
422  m_cmacSapUser = s;
423 }
424 
427 {
428  return m_cmacSapProvider;
429 }
430 
431 void
433 {
435 }
436 
437 
440 {
441  return m_enbPhySapUser;
442 }
443 
444 
445 
446 void
447 LteEnbMac::DoSubframeIndication (uint32_t frameNo, uint32_t subframeNo)
448 {
449  NS_LOG_FUNCTION (this << " EnbMac - frame " << frameNo << " subframe " << subframeNo);
450 
451  // Store current frame / subframe number
452  m_frameNo = frameNo;
453  m_subframeNo = subframeNo;
454 
455 
456  // --- DOWNLINK ---
457  // Send Dl-CQI info to the scheduler
458  if (m_dlCqiReceived.size () > 0)
459  {
461  dlcqiInfoReq.m_sfnSf = ((0x3FF & frameNo) << 4) | (0xF & subframeNo);
462 
463  int cqiNum = m_dlCqiReceived.size ();
464  if (cqiNum > MAX_CQI_LIST)
465  {
466  cqiNum = MAX_CQI_LIST;
467  }
468  dlcqiInfoReq.m_cqiList.insert (dlcqiInfoReq.m_cqiList.begin (), m_dlCqiReceived.begin (), m_dlCqiReceived.end ());
469  m_dlCqiReceived.erase (m_dlCqiReceived.begin (), m_dlCqiReceived.end ());
470  m_schedSapProvider->SchedDlCqiInfoReq (dlcqiInfoReq);
471  }
472 
473  if (!m_receivedRachPreambleCount.empty ())
474  {
475  // process received RACH preambles and notify the scheduler
477  NS_ASSERT (subframeNo > 0 && subframeNo <= 10); // subframe in 1..10
478  for (std::map<uint8_t, uint32_t>::const_iterator it = m_receivedRachPreambleCount.begin ();
479  it != m_receivedRachPreambleCount.end ();
480  ++it)
481  {
482  NS_LOG_INFO (this << " preambleId " << (uint32_t) it->first << ": " << it->second << " received");
483  NS_ASSERT (it->second != 0);
484  if (it->second > 1)
485  {
486  NS_LOG_INFO ("preambleId " << (uint32_t) it->first << ": collision");
487  // in case of collision we assume that no preamble is
488  // successfully received, hence no RAR is sent
489  }
490  else
491  {
492  uint16_t rnti;
493  std::map<uint8_t, NcRaPreambleInfo>::iterator jt = m_allocatedNcRaPreambleMap.find (it->first);
494  if (jt != m_allocatedNcRaPreambleMap.end ())
495  {
496  rnti = jt->second.rnti;
497  NS_LOG_INFO ("preambleId previously allocated for NC based RA, RNTI =" << (uint32_t) rnti << ", sending RAR");
498 
499  }
500  else
501  {
503  NS_LOG_INFO ("preambleId " << (uint32_t) it->first << ": allocated T-C-RNTI " << (uint32_t) rnti << ", sending RAR");
504  }
505 
506  RachListElement_s rachLe;
507  rachLe.m_rnti = rnti;
508  rachLe.m_estimatedSize = 144; // to be confirmed
509  rachInfoReqParams.m_rachList.push_back (rachLe);
510  m_rapIdRntiMap.insert (std::pair <uint16_t, uint32_t> (rnti, it->first));
511  }
512  }
513  m_schedSapProvider->SchedDlRachInfoReq (rachInfoReqParams);
515  }
516  // Get downlink transmission opportunities
517  uint32_t dlSchedFrameNo = m_frameNo;
518  uint32_t dlSchedSubframeNo = m_subframeNo;
519  // NS_LOG_DEBUG (this << " sfn " << frameNo << " sbfn " << subframeNo);
520  if (dlSchedSubframeNo + m_macChTtiDelay > 10)
521  {
522  dlSchedFrameNo++;
523  dlSchedSubframeNo = (dlSchedSubframeNo + m_macChTtiDelay) % 10;
524  }
525  else
526  {
527  dlSchedSubframeNo = dlSchedSubframeNo + m_macChTtiDelay;
528  }
530  dlparams.m_sfnSf = ((0x3FF & dlSchedFrameNo) << 4) | (0xF & dlSchedSubframeNo);
531 
532  // Forward DL HARQ feebacks collected during last TTI
533  if (m_dlInfoListReceived.size () > 0)
534  {
536  // empty local buffer
537  m_dlInfoListReceived.clear ();
538  }
539 
541 
542 
543  // --- UPLINK ---
544  // Send UL-CQI info to the scheduler
545  std::vector <FfMacSchedSapProvider::SchedUlCqiInfoReqParameters>::iterator itCqi;
546  for (uint16_t i = 0; i < m_ulCqiReceived.size (); i++)
547  {
548  if (subframeNo > 1)
549  {
550  m_ulCqiReceived.at (i).m_sfnSf = ((0x3FF & frameNo) << 4) | (0xF & (subframeNo - 1));
551  }
552  else
553  {
554  m_ulCqiReceived.at (i).m_sfnSf = ((0x3FF & (frameNo - 1)) << 4) | (0xF & 10);
555  }
557  }
558  m_ulCqiReceived.clear ();
559 
560  // Send BSR reports to the scheduler
561  if (m_ulCeReceived.size () > 0)
562  {
564  ulMacReq.m_sfnSf = ((0x3FF & frameNo) << 4) | (0xF & subframeNo);
565  ulMacReq.m_macCeList.insert (ulMacReq.m_macCeList.begin (), m_ulCeReceived.begin (), m_ulCeReceived.end ());
566  m_ulCeReceived.erase (m_ulCeReceived.begin (), m_ulCeReceived.end ());
568  }
569 
570 
571  // Get uplink transmission opportunities
572  uint32_t ulSchedFrameNo = m_frameNo;
573  uint32_t ulSchedSubframeNo = m_subframeNo;
574  // NS_LOG_DEBUG (this << " sfn " << frameNo << " sbfn " << subframeNo);
575  if (ulSchedSubframeNo + (m_macChTtiDelay + UL_PUSCH_TTIS_DELAY) > 10)
576  {
577  ulSchedFrameNo++;
578  ulSchedSubframeNo = (ulSchedSubframeNo + (m_macChTtiDelay + UL_PUSCH_TTIS_DELAY)) % 10;
579  }
580  else
581  {
582  ulSchedSubframeNo = ulSchedSubframeNo + (m_macChTtiDelay + UL_PUSCH_TTIS_DELAY);
583  }
585  ulparams.m_sfnSf = ((0x3FF & ulSchedFrameNo) << 4) | (0xF & ulSchedSubframeNo);
586 
587  // Forward DL HARQ feebacks collected during last TTI
588  if (m_ulInfoListReceived.size () > 0)
589  {
591  // empty local buffer
592  m_ulInfoListReceived.clear ();
593  }
594 
596 
597 }
598 
599 
600 void
602 {
603  NS_LOG_FUNCTION (this << msg);
604  if (msg->GetMessageType () == LteControlMessage::DL_CQI)
605  {
606  Ptr<DlCqiLteControlMessage> dlcqi = DynamicCast<DlCqiLteControlMessage> (msg);
608  }
609  else if (msg->GetMessageType () == LteControlMessage::BSR)
610  {
611  Ptr<BsrLteControlMessage> bsr = DynamicCast<BsrLteControlMessage> (msg);
612  ReceiveBsrMessage (bsr->GetBsr ());
613  }
614  else if (msg->GetMessageType () == LteControlMessage::DL_HARQ)
615  {
616  Ptr<DlHarqFeedbackLteControlMessage> dlharq = DynamicCast<DlHarqFeedbackLteControlMessage> (msg);
617  DoDlInfoListElementHarqFeeback (dlharq->GetDlHarqFeedback ());
618  }
619  else
620  {
621  NS_LOG_LOGIC (this << " LteControlMessage type " << msg->GetMessageType () << " not recognized");
622  }
623 }
624 
625 void
627 {
628  NS_LOG_FUNCTION (this << (uint32_t) rapId);
629  // just record that the preamble has been received; it will be processed later
630  ++m_receivedRachPreambleCount[rapId]; // will create entry if not exists
631 }
632 
633 void
635 {
636  if (ulcqi.m_ulCqi.m_type == UlCqi_s::PUSCH)
637  {
638  NS_LOG_DEBUG (this << " eNB rxed an PUSCH UL-CQI");
639  }
640  else if (ulcqi.m_ulCqi.m_type == UlCqi_s::SRS)
641  {
642  NS_LOG_DEBUG (this << " eNB rxed an SRS UL-CQI");
643  }
644  m_ulCqiReceived.push_back (ulcqi);
645 }
646 
647 
648 void
650 {
651  NS_LOG_FUNCTION (this << msg);
652 
653  CqiListElement_s dlcqi = msg->GetDlCqi ();
654  NS_LOG_LOGIC (this << "Enb Received DL-CQI rnti" << dlcqi.m_rnti);
655  NS_ASSERT (dlcqi.m_rnti != 0);
656  m_dlCqiReceived.push_back (dlcqi);
657 
658 }
659 
660 
661 void
663 {
664  NS_LOG_FUNCTION (this);
665 
666  m_ulCeReceived.push_back (bsr);
667 }
668 
669 
670 void
672 {
673  NS_LOG_FUNCTION (this);
674  LteRadioBearerTag tag;
675  p->RemovePacketTag (tag);
676 
677  // store info of the packet received
678 
679 // std::map <uint16_t,UlInfoListElement_s>::iterator it;
680 // u_int rnti = tag.GetRnti ();
681 // u_int lcid = tag.GetLcid ();
682 // it = m_ulInfoListElements.find (tag.GetRnti ());
683 // if (it == m_ulInfoListElements.end ())
684 // {
685 // // new RNTI
686 // UlInfoListElement_s ulinfonew;
687 // ulinfonew.m_rnti = tag.GetRnti ();
688 // // always allocate full size of ulReception vector, initializing all elements to 0
689 // ulinfonew.m_ulReception.assign (MAX_LC_LIST+1, 0);
690 // // set the element for the current LCID
691 // ulinfonew.m_ulReception.at (tag.GetLcid ()) = p->GetSize ();
692 // ulinfonew.m_receptionStatus = UlInfoListElement_s::Ok;
693 // ulinfonew.m_tpc = 0; // Tx power control not implemented at this stage
694 // m_ulInfoListElements.insert (std::pair<uint16_t, UlInfoListElement_s > (tag.GetRnti (), ulinfonew));
695 //
696 // }
697 // else
698 // {
699 // // existing RNTI: we just set the value for the current
700 // // LCID. Note that the corresponding element had already been
701 // // allocated previously.
702 // NS_ASSERT_MSG ((*it).second.m_ulReception.at (tag.GetLcid ()) == 0, "would overwrite previously written ulReception element");
703 // (*it).second.m_ulReception.at (tag.GetLcid ()) = p->GetSize ();
704 // (*it).second.m_receptionStatus = UlInfoListElement_s::Ok;
705 // }
706 
707 
708 
709  // forward the packet to the correspondent RLC
710  uint16_t rnti = tag.GetRnti ();
711  uint8_t lcid = tag.GetLcid ();
712  std::map <uint16_t, std::map<uint8_t, LteMacSapUser*> >::iterator rntiIt = m_rlcAttached.find (rnti);
713  NS_ASSERT_MSG (rntiIt != m_rlcAttached.end (), "could not find RNTI" << rnti);
714  std::map<uint8_t, LteMacSapUser*>::iterator lcidIt = rntiIt->second.find (lcid);
715  //NS_ASSERT_MSG (lcidIt != rntiIt->second.end (), "could not find LCID" << lcid);
716 
717  //Receive PDU only if LCID is found
718  if (lcidIt != rntiIt->second.end ())
719  {
720  (*lcidIt).second->ReceivePdu (p);
721  }
722 }
723 
724 
725 
726 // ////////////////////////////////////////////
727 // CMAC SAP
728 // ////////////////////////////////////////////
729 
730 void
731 LteEnbMac::DoConfigureMac (uint8_t ulBandwidth, uint8_t dlBandwidth)
732 {
733  NS_LOG_FUNCTION (this << " ulBandwidth=" << (uint16_t) ulBandwidth << " dlBandwidth=" << (uint16_t) dlBandwidth);
735  // Configure the subset of parameters used by FfMacScheduler
736  params.m_ulBandwidth = ulBandwidth;
737  params.m_dlBandwidth = dlBandwidth;
739  // ...more parameters can be configured
741 }
742 
743 
744 void
745 LteEnbMac::DoAddUe (uint16_t rnti)
746 {
747  NS_LOG_FUNCTION (this << " rnti=" << rnti);
748  std::map<uint8_t, LteMacSapUser*> empty;
749  std::pair <std::map <uint16_t, std::map<uint8_t, LteMacSapUser*> >::iterator, bool>
750  ret = m_rlcAttached.insert (std::pair <uint16_t, std::map<uint8_t, LteMacSapUser*> >
751  (rnti, empty));
752  NS_ASSERT_MSG (ret.second, "element already present, RNTI already existed");
753 
755  params.m_rnti = rnti;
756  params.m_transmissionMode = 0; // set to default value (SISO) for avoiding random initialization (valgrind error)
757 
759 
760  // Create DL trasmission HARQ buffers
761  std::vector < Ptr<PacketBurst> > dlHarqLayer0pkt;
762  dlHarqLayer0pkt.resize (8);
763  for (uint8_t i = 0; i < 8; i++)
764  {
765  Ptr<PacketBurst> pb = CreateObject <PacketBurst> ();
766  dlHarqLayer0pkt.at (i) = pb;
767  }
768  std::vector < Ptr<PacketBurst> > dlHarqLayer1pkt;
769  dlHarqLayer1pkt.resize (8);
770  for (uint8_t i = 0; i < 8; i++)
771  {
772  Ptr<PacketBurst> pb = CreateObject <PacketBurst> ();
773  dlHarqLayer1pkt.at (i) = pb;
774  }
776  buf.push_back (dlHarqLayer0pkt);
777  buf.push_back (dlHarqLayer1pkt);
778  m_miDlHarqProcessesPackets.insert (std::pair <uint16_t, DlHarqProcessesBuffer_t> (rnti, buf));
779 }
780 
781 void
782 LteEnbMac::DoRemoveUe (uint16_t rnti)
783 {
784  NS_LOG_FUNCTION (this << " rnti=" << rnti);
786  params.m_rnti = rnti;
788  m_rlcAttached.erase (rnti);
789  m_miDlHarqProcessesPackets.erase (rnti);
790 }
791 
792 void
794 {
795  NS_LOG_FUNCTION (this);
796 
797  std::map <LteFlowId_t, LteMacSapUser* >::iterator it;
798 
799  LteFlowId_t flow (lcinfo.rnti, lcinfo.lcId);
800 
801  std::map <uint16_t, std::map<uint8_t, LteMacSapUser*> >::iterator rntiIt = m_rlcAttached.find (lcinfo.rnti);
802  NS_ASSERT_MSG (rntiIt != m_rlcAttached.end (), "RNTI not found");
803  std::map<uint8_t, LteMacSapUser*>::iterator lcidIt = rntiIt->second.find (lcinfo.lcId);
804  if (lcidIt == rntiIt->second.end ())
805  {
806  rntiIt->second.insert (std::pair<uint8_t, LteMacSapUser*> (lcinfo.lcId, msu));
807  }
808  else
809  {
810  NS_LOG_ERROR ("LC already exists");
811  }
812 
813  // CCCH (LCID 0) is pre-configured
814  // see FF LTE MAC Scheduler
815  // Interface Specification v1.11,
816  // 4.3.4 logicalChannelConfigListElement
817  if (lcinfo.lcId != 0)
818  {
820  params.m_rnti = lcinfo.rnti;
821  params.m_reconfigureFlag = false;
822 
824  lccle.m_logicalChannelIdentity = lcinfo.lcId;
825  lccle.m_logicalChannelGroup = lcinfo.lcGroup;
828  lccle.m_qci = lcinfo.qci;
829  lccle.m_eRabMaximulBitrateUl = lcinfo.mbrUl;
830  lccle.m_eRabMaximulBitrateDl = lcinfo.mbrDl;
831  lccle.m_eRabGuaranteedBitrateUl = lcinfo.gbrUl;
832  lccle.m_eRabGuaranteedBitrateDl = lcinfo.gbrDl;
833  params.m_logicalChannelConfigList.push_back (lccle);
834 
836  }
837 }
838 
839 void
841 {
842  NS_FATAL_ERROR ("not implemented");
843 }
844 
845 void
846 LteEnbMac::DoReleaseLc (uint16_t rnti, uint8_t lcid)
847 {
848  NS_LOG_FUNCTION (this);
849 
850  //Find user based on rnti and then erase lcid stored against the same
851  std::map <uint16_t, std::map<uint8_t, LteMacSapUser*> >::iterator rntiIt = m_rlcAttached.find (rnti);
852  rntiIt->second.erase (lcid);
853 
855  params.m_rnti = rnti;
856  params.m_logicalChannelIdentity.push_back (lcid);
858 }
859 
860 void
862 {
863  NS_LOG_FUNCTION (this);
864 
865  // propagates to scheduler
867  req.m_rnti = params.m_rnti;
869  req.m_reconfigureFlag = true;
871 }
872 
875 {
880  return rc;
881 }
882 
885 {
886  bool found = false;
887  uint8_t preambleId;
888  for (preambleId = m_numberOfRaPreambles; preambleId < 64; ++preambleId)
889  {
890  std::map<uint8_t, NcRaPreambleInfo>::iterator it = m_allocatedNcRaPreambleMap.find (preambleId);
891  if ((it == m_allocatedNcRaPreambleMap.end ())
892  || (it->second.expiryTime < Simulator::Now ()))
893  {
894  found = true;
895  NcRaPreambleInfo preambleInfo;
896  uint32_t expiryIntervalMs = (uint32_t) m_preambleTransMax * ((uint32_t) m_raResponseWindowSize + 5);
897 
898  preambleInfo.expiryTime = Simulator::Now () + MilliSeconds (expiryIntervalMs);
899  preambleInfo.rnti = rnti;
900  NS_LOG_INFO ("allocated preamble for NC based RA: preamble " << preambleId << ", RNTI " << preambleInfo.rnti << ", exiryTime " << preambleInfo.expiryTime);
901  m_allocatedNcRaPreambleMap[preambleId] = preambleInfo; // create if not exist, update otherwise
902  break;
903  }
904  }
906  if (found)
907  {
908  ret.valid = true;
909  ret.raPreambleId = preambleId;
910  ret.raPrachMaskIndex = 0;
911  }
912  else
913  {
914  ret.valid = false;
915  ret.raPreambleId = 0;
916  ret.raPrachMaskIndex = 0;
917  }
918  return ret;
919 }
920 
921 
922 
923 // ////////////////////////////////////////////
924 // MAC SAP
925 // ////////////////////////////////////////////
926 
927 
928 void
930 {
931  NS_LOG_FUNCTION (this);
932  LteRadioBearerTag tag (params.rnti, params.lcid, params.layer);
933  params.pdu->AddPacketTag (tag);
934  // Store pkt in HARQ buffer
935  std::map <uint16_t, DlHarqProcessesBuffer_t>::iterator it = m_miDlHarqProcessesPackets.find (params.rnti);
936  NS_ASSERT (it != m_miDlHarqProcessesPackets.end ());
937  NS_LOG_DEBUG (this << " LAYER " << (uint16_t)tag.GetLayer () << " HARQ ID " << (uint16_t)params.harqProcessId);
938 
939  //(*it).second.at (params.layer).at (params.harqProcessId) = params.pdu;//->Copy ();
940  (*it).second.at (params.layer).at (params.harqProcessId)->AddPacket (params.pdu);
942 }
943 
944 void
946 {
947  NS_LOG_FUNCTION (this);
949  req.m_rnti = params.rnti;
950  req.m_logicalChannelIdentity = params.lcid;
955  req.m_rlcStatusPduSize = params.statusPduSize;
957 }
958 
959 
960 
961 // ////////////////////////////////////////////
962 // SCHED SAP
963 // ////////////////////////////////////////////
964 
965 
966 
967 void
969 {
970  NS_LOG_FUNCTION (this);
971  // Create DL PHY PDU
972  Ptr<PacketBurst> pb = CreateObject<PacketBurst> ();
973  std::map <LteFlowId_t, LteMacSapUser* >::iterator it;
974 
975  for (unsigned int i = 0; i < ind.m_buildDataList.size (); i++)
976  {
977  for (uint16_t layer = 0; layer < ind.m_buildDataList.at (i).m_dci.m_ndi.size (); layer++)
978  {
979  if (ind.m_buildDataList.at (i).m_dci.m_ndi.at (layer) == 1)
980  {
981  // new data -> force emptying correspondent harq pkt buffer
982  std::map <uint16_t, DlHarqProcessesBuffer_t>::iterator it = m_miDlHarqProcessesPackets.find (ind.m_buildDataList.at (i).m_rnti);
983  NS_ASSERT (it != m_miDlHarqProcessesPackets.end ());
984  for (uint16_t lcId = 0; lcId < (*it).second.size (); lcId++)
985  {
986  Ptr<PacketBurst> pb = CreateObject <PacketBurst> ();
987  (*it).second.at (lcId).at (ind.m_buildDataList.at (i).m_dci.m_harqProcess) = pb;
988  }
989  }
990  }
991  for (unsigned int j = 0; j < ind.m_buildDataList.at (i).m_rlcPduList.size (); j++)
992  {
993  for (uint16_t k = 0; k < ind.m_buildDataList.at (i).m_rlcPduList.at (j).size (); k++)
994  {
995  if (ind.m_buildDataList.at (i).m_dci.m_ndi.at (k) == 1)
996  {
997  // New Data -> retrieve it from RLC
998  uint16_t rnti = ind.m_buildDataList.at (i).m_rnti;
999  uint8_t lcid = ind.m_buildDataList.at (i).m_rlcPduList.at (j).at (k).m_logicalChannelIdentity;
1000  std::map <uint16_t, std::map<uint8_t, LteMacSapUser*> >::iterator rntiIt = m_rlcAttached.find (rnti);
1001  NS_ASSERT_MSG (rntiIt != m_rlcAttached.end (), "could not find RNTI" << rnti);
1002  std::map<uint8_t, LteMacSapUser*>::iterator lcidIt = rntiIt->second.find (lcid);
1003  NS_ASSERT_MSG (lcidIt != rntiIt->second.end (), "could not find LCID" << lcid);
1004  NS_LOG_DEBUG (this << " rnti= " << rnti << " lcid= " << (uint32_t) lcid << " layer= " << k);
1005  (*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);
1006  }
1007  else
1008  {
1009  if (ind.m_buildDataList.at (i).m_dci.m_tbsSize.at (k) > 0)
1010  {
1011  // HARQ retransmission -> retrieve TB from HARQ buffer
1012  std::map <uint16_t, DlHarqProcessesBuffer_t>::iterator it = m_miDlHarqProcessesPackets.find (ind.m_buildDataList.at (i).m_rnti);
1013  NS_ASSERT (it != m_miDlHarqProcessesPackets.end ());
1014  Ptr<PacketBurst> pb = (*it).second.at (k).at ( ind.m_buildDataList.at (i).m_dci.m_harqProcess);
1015  for (std::list<Ptr<Packet> >::const_iterator j = pb->Begin (); j != pb->End (); ++j)
1016  {
1017  Ptr<Packet> pkt = (*j)->Copy ();
1019  }
1020  }
1021  }
1022  }
1023  }
1024  // send the relative DCI
1025  Ptr<DlDciLteControlMessage> msg = Create<DlDciLteControlMessage> ();
1026  msg->SetDci (ind.m_buildDataList.at (i).m_dci);
1028  }
1029 
1030  // Fire the trace with the DL information
1031  for ( uint32_t i = 0; i < ind.m_buildDataList.size (); i++ )
1032  {
1033  // Only one TB used
1034  if (ind.m_buildDataList.at (i).m_dci.m_tbsSize.size () == 1)
1035  {
1036  m_dlScheduling (m_frameNo, m_subframeNo, ind.m_buildDataList.at (i).m_dci.m_rnti,
1037  ind.m_buildDataList.at (i).m_dci.m_mcs.at (0),
1038  ind.m_buildDataList.at (i).m_dci.m_tbsSize.at (0),
1039  0, 0
1040  );
1041 
1042  }
1043  // Two TBs used
1044  else if (ind.m_buildDataList.at (i).m_dci.m_tbsSize.size () == 2)
1045  {
1046  m_dlScheduling (m_frameNo, m_subframeNo, ind.m_buildDataList.at (i).m_dci.m_rnti,
1047  ind.m_buildDataList.at (i).m_dci.m_mcs.at (0),
1048  ind.m_buildDataList.at (i).m_dci.m_tbsSize.at (0),
1049  ind.m_buildDataList.at (i).m_dci.m_mcs.at (1),
1050  ind.m_buildDataList.at (i).m_dci.m_tbsSize.at (1)
1051  );
1052  }
1053  else
1054  {
1055  NS_FATAL_ERROR ("Found element with more than two transport blocks");
1056  }
1057  }
1058 
1059  // Random Access procedure: send RARs
1060  Ptr<RarLteControlMessage> rarMsg = Create<RarLteControlMessage> ();
1061  // see TS 36.321 5.1.4; preambles were sent two frames ago
1062  // (plus 3GPP counts subframes from 0, not 1)
1063  uint16_t raRnti;
1064  if (m_subframeNo < 3)
1065  {
1066  raRnti = m_subframeNo + 7; // equivalent to +10-3
1067  }
1068  else
1069  {
1070  raRnti = m_subframeNo - 3;
1071  }
1072  rarMsg->SetRaRnti (raRnti);
1073  for (unsigned int i = 0; i < ind.m_buildRarList.size (); i++)
1074  {
1075  std::map <uint8_t, uint32_t>::iterator itRapId = m_rapIdRntiMap.find (ind.m_buildRarList.at (i).m_rnti);
1076  if (itRapId == m_rapIdRntiMap.end ())
1077  {
1078  NS_FATAL_ERROR ("Unable to find rapId of RNTI " << ind.m_buildRarList.at (i).m_rnti);
1079  }
1081  rar.rapId = itRapId->second;
1082  rar.rarPayload = ind.m_buildRarList.at (i);
1083  rarMsg->AddRar (rar);
1084  NS_LOG_INFO (this << " Send RAR message to RNTI " << ind.m_buildRarList.at (i).m_rnti << " rapId " << itRapId->second);
1085  }
1086  if (ind.m_buildRarList.size () > 0)
1087  {
1089  }
1090  m_rapIdRntiMap.clear ();
1091 }
1092 
1093 
1094 void
1096 {
1097  NS_LOG_FUNCTION (this);
1098 
1099  for (unsigned int i = 0; i < ind.m_dciList.size (); i++)
1100  {
1101  // send the correspondent ul dci
1102  Ptr<UlDciLteControlMessage> msg = Create<UlDciLteControlMessage> ();
1103  msg->SetDci (ind.m_dciList.at (i));
1105  }
1106 
1107  // Fire the trace with the UL information
1108  for ( uint32_t i = 0; i < ind.m_dciList.size (); i++ )
1109  {
1110  m_ulScheduling (m_frameNo, m_subframeNo, ind.m_dciList.at (i).m_rnti,
1111  ind.m_dciList.at (i).m_mcs, ind.m_dciList.at (i).m_tbSize);
1112  }
1113 
1114 
1115 
1116 }
1117 
1118 
1119 
1120 
1121 // ////////////////////////////////////////////
1122 // CSCHED SAP
1123 // ////////////////////////////////////////////
1124 
1125 
1126 void
1128 {
1129  NS_LOG_FUNCTION (this);
1130 }
1131 
1132 void
1134 {
1135  NS_LOG_FUNCTION (this);
1136 }
1137 
1138 void
1140 {
1141  NS_LOG_FUNCTION (this);
1142  // Call the CSCHED primitive
1143  // m_cschedSap->LcConfigCompleted();
1144 }
1145 
1146 void
1148 {
1149  NS_LOG_FUNCTION (this);
1150 }
1151 
1152 void
1154 {
1155  NS_LOG_FUNCTION (this);
1156 }
1157 
1158 void
1160 {
1161  NS_LOG_FUNCTION (this);
1162  // propagates to RRC
1163  LteEnbCmacSapUser::UeConfig ueConfigUpdate;
1164  ueConfigUpdate.m_rnti = params.m_rnti;
1165  ueConfigUpdate.m_transmissionMode = params.m_transmissionMode;
1166  m_cmacSapUser->RrcConfigurationUpdateInd (ueConfigUpdate);
1167 }
1168 
1169 void
1171 {
1172  NS_LOG_FUNCTION (this);
1173 }
1174 
1175 void
1177 {
1178  NS_LOG_FUNCTION (this);
1179  m_ulInfoListReceived.push_back (params);
1180 }
1181 
1182 void
1184 {
1185  NS_LOG_FUNCTION (this);
1186  // Update HARQ buffer
1187  std::map <uint16_t, DlHarqProcessesBuffer_t>::iterator it = m_miDlHarqProcessesPackets.find (params.m_rnti);
1188  NS_ASSERT (it != m_miDlHarqProcessesPackets.end ());
1189  for (uint8_t layer = 0; layer < params.m_harqStatus.size (); layer++)
1190  {
1191  if (params.m_harqStatus.at (layer) == DlInfoListElement_s::ACK)
1192  {
1193  // discard buffer
1194  Ptr<PacketBurst> emptyBuf = CreateObject <PacketBurst> ();
1195  (*it).second.at (layer).at (params.m_harqProcessId) = emptyBuf;
1196  NS_LOG_DEBUG (this << " HARQ-ACK UE " << params.m_rnti << " harqId " << (uint16_t)params.m_harqProcessId << " layer " << (uint16_t)layer);
1197  }
1198  else if (params.m_harqStatus.at (layer) == DlInfoListElement_s::NACK)
1199  {
1200  NS_LOG_DEBUG (this << " HARQ-NACK UE " << params.m_rnti << " harqId " << (uint16_t)params.m_harqProcessId << " layer " << (uint16_t)layer);
1201  }
1202  else
1203  {
1204  NS_FATAL_ERROR (" HARQ functionality not implemented");
1205  }
1206  }
1207  m_dlInfoListReceived.push_back (params);
1208 }
1209 
1210 
1211 } // namespace ns3
std::vector< struct UlInfoListElement_s > m_ulInfoList
void DoConfigureMac(uint8_t ulBandwidth, uint8_t dlBandwidth)
Definition: lte-enb-mac.cc:731
void DoReconfigureLc(LteEnbCmacSapProvider::LcInfo lcinfo)
Definition: lte-enb-mac.cc:840
FfMacSchedSapUser * m_schedSapUser
Definition: lte-enb-mac.h:241
Parameters of the CSCHED_LC_CONFIG_CNF primitive.
virtual void UlCqiReport(FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi)
Returns to MAC level the UL-CQI evaluated.
Definition: lte-enb-mac.cc:289
uint8_t GetLcid(void) const
EnbMacMemberFfMacCschedSapUser(LteEnbMac *mac)
Definition: lte-enb-mac.cc:189
void DoDlInfoListElementHarqFeeback(DlInfoListElement_s params)
a MAC RAR and the corresponding RAPID subheader
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
std::vector< FfMacSchedSapProvider::SchedUlCqiInfoReqParameters > m_ulCqiReceived
Definition: lte-enb-mac.h:218
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:44
uint16_t m_rnti
UE id within this cell.
virtual void CschedUeConfigReq(const struct CschedUeConfigReqParameters &params)=0
Parameters of the CSCHED_UE_CONFIG_CNF primitive.
Parameters of the CSCHED_UE_RELEASE_REQ primitive.
uint8_t m_transmissionMode
Transmission mode 1..7
void DoReceivePhyPdu(Ptr< Packet > p)
Definition: lte-enb-mac.cc:671
virtual void ReconfigureLc(LcInfo lcinfo)
Reconfigure an existing logical channel.
Definition: lte-enb-mac.cc:106
uint16_t GetRnti(void) const
Parameters of the CSCHED_CELL_CONFIG_UPDATE_IND primitive.
void DoUlInfoListElementHarqFeeback(UlInfoListElement_s params)
LteEnbCmacSapProvider * m_cmacSapProvider
Definition: lte-enb-mac.h:234
std::map< uint16_t, std::map< uint8_t, LteMacSapUser * > > m_rlcAttached
Definition: lte-enb-mac.h:215
enum ns3::UlCqi_s::Type_e m_type
void DoAddLc(LteEnbCmacSapProvider::LcInfo lcinfo, LteMacSapUser *msu)
Definition: lte-enb-mac.cc:793
LteEnbCmacSapProvider::RachConfig DoGetRachConfig()
Definition: lte-enb-mac.cc:874
virtual void SchedDlConfigInd(const struct SchedDlConfigIndParameters &params)
Definition: lte-enb-mac.cc:156
void DoCschedCellConfigUpdateInd(FfMacCschedSapUser::CschedCellConfigUpdateIndParameters params)
void DoReleaseLc(uint16_t rnti, uint8_t lcid)
Definition: lte-enb-mac.cc:846
void SetLteEnbCmacSapUser(LteEnbCmacSapUser *s)
Set the control MAC SAP user.
Definition: lte-enb-mac.cc:420
void AddPacketTag(const Tag &tag) const
Add a packet tag.
Definition: packet.cc:836
void DoSchedUlConfigInd(FfMacSchedSapUser::SchedUlConfigIndParameters params)
std::vector< struct LogicalChannelConfigListElement_s > m_logicalChannelConfigList
uint8_t qci
QoS Class Identifier.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition: assert.h:61
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:867
virtual void SchedUlTriggerReq(const struct SchedUlTriggerReqParameters &params)=0
virtual void ReceiveRachPreamble(uint32_t prachId)
notify the reception of a RACH preamble on the PRACH
Definition: lte-enb-mac.cc:283
uint8_t m_preambleTransMax
Definition: lte-enb-mac.h:268
Provides the CSCHED SAP.
uint8_t m_transmissionMode
Transmission mode 1..7
virtual uint8_t GetMacChTtiDelay()=0
Get the delay from MAC to Channel expressed in TTIs.
std::vector< struct UlDciListElement_s > m_dciList
See section 4.3.24 cqiListElement.
uint32_t retxQueueSize
the current size of the RLC retransmission queue in bytes
Definition: lte-mac-sap.h:72
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:244
#define NS_FATAL_ERROR(msg)
Fatal error handling.
Definition: fatal-error.h:100
TracedCallback< uint32_t, uint32_t, uint16_t, uint8_t, uint16_t > m_ulScheduling
Trace information regarding UL scheduling Frame number, Subframe number, RNTI, MCS of TB...
Definition: lte-enb-mac.h:260
#define MAX_CQI_LIST
Definition: ff-mac-common.h:50
Parameters of the CSCHED_UE_CONFIG_UPDATE_IND primitive.
virtual void AddLc(LcInfo lcinfo, LteMacSapUser *msu)
Add a new logical channel.
Definition: lte-enb-mac.cc:100
uint64_t mbrDl
maximum bitrate in downlink
void DoTransmitPdu(LteMacSapProvider::TransmitPduParameters)
Definition: lte-enb-mac.cc:929
Parameters of the CSCHED_LC_RELEASE_REQ primitive.
friend class EnbMacMemberFfMacCschedSapUser
Definition: lte-enb-mac.h:55
Service Access Point (SAP) offered by the eNB-PHY to the eNB-MAC.
virtual void SchedDlTriggerReq(const struct SchedDlTriggerReqParameters &params)=0
See section 4.3.12 ulInfoListElement.
void DoAddUe(uint16_t rnti)
Definition: lte-enb-mac.cc:745
virtual void SchedDlRlcBufferReq(const struct SchedDlRlcBufferReqParameters &params)=0
Parameters of the SCHED_DL_TRIGGER_REQ primitive.
uint8_t lcid
the logical channel id corresponding to the sending RLC instance
Definition: lte-mac-sap.h:49
virtual void ConfigureMac(uint8_t ulBandwidth, uint8_t dlBandwidth)
Definition: lte-enb-mac.cc:82
Service Access Point (SAP) offered by the eNB-PHY to the eNB-MAC.
uint16_t rnti
the C-RNTI identifying the UE
Definition: lte-mac-sap.h:68
FfMacCschedSapUser * GetFfMacCschedSapUser(void)
Get the control scheduler SAP user.
Definition: lte-enb-mac.cc:400
virtual AllocateNcRaPreambleReturnValue AllocateNcRaPreamble(uint16_t rnti)
Allocate a random access preamble for non-contention based random access (e.g., for handover)...
Definition: lte-enb-mac.cc:130
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
LteMacSapProvider * GetLteMacSapProvider(void)
Get the MAC SAP provider.
Definition: lte-enb-mac.cc:414
Parameters for LteMacSapProvider::ReportBufferStatus.
Definition: lte-mac-sap.h:66
std::map< uint8_t, uint32_t > m_receivedRachPreambleCount
Definition: lte-enb-mac.h:288
FfMacCschedSapUser * m_cschedSapUser
Definition: lte-enb-mac.h:242
See section 4.3.4 logicalChannelConfigListElement.
Service Access Point (SAP) offered by the MAC to the RRC See Femto Forum MAC Scheduler Interface Spec...
uint16_t txQueueHolDelay
the Head Of Line delay of the transmission queue
Definition: lte-mac-sap.h:71
void SetFfMacCschedSapProvider(FfMacCschedSapProvider *s)
Set the control scheduler SAP provider.
Definition: lte-enb-mac.cc:394
uint8_t lcId
logical channel identifier
Parameters of the CSCHED_LC_RELEASE_CNF primitive.
uint16_t m_rnti
UE id within this cell.
LteEnbPhySapProvider * m_enbPhySapProvider
Definition: lte-enb-mac.h:245
enum ns3::LogicalChannelConfigListElement_s::Direction_e m_direction
virtual void CschedLcConfigCnf(const struct CschedLcConfigCnfParameters &params)
Definition: lte-enb-mac.cc:207
LteEnbPhySapUser * m_enbPhySapUser
Definition: lte-enb-mac.h:246
FfMacSchedSapUser * GetFfMacSchedSapUser(void)
Get the scheduler SAP user.
Definition: lte-enb-mac.cc:388
make Callback use a separate empty type
Definition: empty.h:27
void DoCschedUeConfigCnf(FfMacCschedSapUser::CschedUeConfigCnfParameters params)
virtual void RrcConfigurationUpdateInd(UeConfig params)=0
Notify the RRC of a UE config updated requested by the MAC (normally, by the scheduler) ...
virtual void SendMacPdu(Ptr< Packet > p)=0
Send the MAC PDU to the channel.
virtual void CschedLcReleaseCnf(const struct CschedLcReleaseCnfParameters &params)
Definition: lte-enb-mac.cc:213
void DoUeUpdateConfigurationReq(LteEnbCmacSapProvider::UeConfig params)
Definition: lte-enb-mac.cc:861
Parameters of the SCHED_UL_TRIGGER_REQ primitive.
Hold an unsigned integer type.
Definition: uinteger.h:44
EnbMacMemberLteEnbCmacSapProvider(LteEnbMac *mac)
Definition: lte-enb-mac.cc:76
Logical Channel information to be passed to CmacSapProvider::ConfigureLc.
std::map< uint8_t, uint32_t > m_rapIdRntiMap
Definition: lte-enb-mac.h:290
Ptr< SampleEmitter > s
uint16_t rnti
rnti previously allocated for this non-contention based RA procedure
Definition: lte-enb-mac.h:277
uint8_t m_macChTtiDelay
Definition: lte-enb-mac.h:262
uint16_t rnti
the C-RNTI identifying the UE
Definition: lte-mac-sap.h:48
void DoCschedLcReleaseCnf(FfMacCschedSapUser::CschedLcReleaseCnfParameters params)
static TypeId GetTypeId(void)
Definition: lte-enb-mac.cc:313
void DoUlCqiReport(FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi)
Definition: lte-enb-mac.cc:634
virtual void UlInfoListElementHarqFeeback(UlInfoListElement_s params)
Notify the HARQ on the UL tranmission status.
Definition: lte-enb-mac.cc:295
virtual void SchedDlRachInfoReq(const struct SchedDlRachInfoReqParameters &params)=0
virtual void AddUe(uint16_t rnti)
Definition: lte-enb-mac.cc:88
Provides the SCHED SAP.
friend class EnbMacMemberLteEnbCmacSapProvider
Definition: lte-enb-mac.h:52
virtual void DoDispose(void)
Destructor implementation.
Definition: lte-enb-mac.cc:364
enum ns3::LogicalChannelConfigListElement_s::QosBearerType_e m_qosBearerType
void ReceiveBsrMessage(MacCeListElement_s bsr)
Receive a CE element containing the buffer status report.
Definition: lte-enb-mac.cc:662
virtual void SchedUlConfigInd(const struct SchedUlConfigIndParameters &params)
Definition: lte-enb-mac.cc:164
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:252
std::vector< struct CqiListElement_s > m_cqiList
uint8_t m_raResponseWindowSize
Definition: lte-enb-mac.h:269
#define list
std::vector< struct DlInfoListElement_s > m_dlInfoList
See section 4.3.23 dlInfoListElement.
virtual void CschedCellConfigReq(const struct CschedCellConfigReqParameters &params)=0
CSCHED_CELL_CONFIG_REQ.
void DoReceiveRachPreamble(uint8_t prachId)
Definition: lte-enb-mac.cc:626
void DoRemoveUe(uint16_t rnti)
Definition: lte-enb-mac.cc:782
See section 4.3.14 macCEListElement.
Parameters for [re]configuring the UE.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Definition: packet.cc:122
virtual void ReleaseLc(uint16_t rnti, uint8_t lcid)
release an existing logical channel
Definition: lte-enb-mac.cc:112
uint32_t m_subframeNo
Definition: lte-enb-mac.h:249
LteEnbCmacSapProvider::AllocateNcRaPreambleReturnValue DoAllocateNcRaPreamble(uint16_t rnti)
Definition: lte-enb-mac.cc:884
uint8_t m_numberOfRaPreambles
Definition: lte-enb-mac.h:267
uint8_t layer
the layer value that was passed by the MAC in the call to NotifyTxOpportunity that generated this PDU...
Definition: lte-mac-sap.h:50
virtual void CschedUeConfigCnf(const struct CschedUeConfigCnfParameters &params)
Definition: lte-enb-mac.cc:201
virtual void CschedUeReleaseReq(const struct CschedUeReleaseReqParameters &params)=0
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t lcGroup
logical channel group
void DoReportBufferStatus(LteMacSapProvider::ReportBufferStatusParameters)
Definition: lte-enb-mac.cc:945
virtual void CschedUeReleaseCnf(const struct CschedUeReleaseCnfParameters &params)
Definition: lte-enb-mac.cc:219
Parameters of the CSCHED_LC_CONFIG_REQ primitive.
std::vector< enum HarqStatus_e > m_harqStatus
virtual void CschedCellConfigUpdateInd(const struct CschedCellConfigUpdateIndParameters &params)
Definition: lte-enb-mac.cc:231
LteEnbCmacSapProvider * GetLteEnbCmacSapProvider(void)
Get the control MAC SAP provider.
Definition: lte-enb-mac.cc:426
Parameters for [re]configuring the UE.
uint8_t lcid
the logical channel id corresponding to the sending RLC instance
Definition: lte-mac-sap.h:69
std::vector< UlInfoListElement_s > m_ulInfoListReceived
Definition: lte-enb-mac.h:223
uint32_t txQueueSize
the current size of the RLC transmission queue
Definition: lte-mac-sap.h:70
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:223
EnbMacMemberLteEnbPhySapUser(LteEnbMac *mac)
Definition: lte-enb-mac.cc:259
See section 4.3.6 rachListElement.
LteMacSapProvider * m_macSapProvider
Definition: lte-enb-mac.h:233
std::vector< CqiListElement_s > m_dlCqiReceived
Definition: lte-enb-mac.h:217
virtual void CschedCellConfigCnf(const struct CschedCellConfigCnfParameters &params)
Definition: lte-enb-mac.cc:195
virtual void UeUpdateConfigurationReq(UeConfig params)
update the configuration of the UE
Definition: lte-enb-mac.cc:118
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:84
virtual void SchedUlCqiInfoReq(const struct SchedUlCqiInfoReqParameters &params)=0
uint16_t rnti
C-RNTI identifying the UE.
std::vector< MacCeListElement_s > m_ulCeReceived
Definition: lte-enb-mac.h:219
Parameters of the SCHED_DL_CQI_INFO_REQ primitive.
std::vector< struct MacCeListElement_s > m_macCeList
virtual void SchedUlMacCtrlInfoReq(const struct SchedUlMacCtrlInfoReqParameters &params)=0
std::vector< std::vector< Ptr< PacketBurst > > > DlHarqProcessesBuffer_t
Definition: lte-enb-mac.h:43
uint64_t mbrUl
maximum bitrate in uplink
void DoCschedUeReleaseCnf(FfMacCschedSapUser::CschedUeReleaseCnfParameters params)
std::vector< struct RachListElement_s > m_rachList
std::vector< DlInfoListElement_s > m_dlInfoListReceived
Definition: lte-enb-mac.h:221
void SetLteEnbPhySapProvider(LteEnbPhySapProvider *s)
Set the PHY SAP Provider.
Definition: lte-enb-mac.cc:432
LteEnbCmacSapUser * m_cmacSapUser
Definition: lte-enb-mac.h:236
uint64_t gbrUl
guaranteed bitrate in uplink
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:271
uint16_t statusPduSize
the current size of the pending STATUS RLC PDU message in bytes
Definition: lte-mac-sap.h:74
Parameters of the SCHED_UL_CQI_INFO_REQ primitive.
LteEnbPhySapUser * GetLteEnbPhySapUser()
Get the eNB-PHY SAP User.
Definition: lte-enb-mac.cc:439
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition: lte-mac-sap.h:94
struct defining the RACH configuration of the MAC
FfMacSchedSapProvider * m_schedSapProvider
Definition: lte-enb-mac.h:239
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
Definition: packet.cc:843
Parameters of the SCHED_UL_MAC_CTRL_INFO_REQ primitive.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:236
virtual void ReceivePhyPdu(Ptr< Packet > p)
Called by the Phy to notify the MAC of the reception of a new PHY-PDU.
Definition: lte-enb-mac.cc:265
void DoCschedUeConfigUpdateInd(FfMacCschedSapUser::CschedUeConfigUpdateIndParameters params)
LteMacSapUser * m_macSapUser
Definition: lte-enb-mac.h:235
void DoSchedDlConfigInd(FfMacSchedSapUser::SchedDlConfigIndParameters ind)
Definition: lte-enb-mac.cc:968
uint16_t retxQueueHolDelay
the Head Of Line delay of the retransmission queue
Definition: lte-mac-sap.h:73
virtual void CschedLcConfigReq(const struct CschedLcConfigReqParameters &params)=0
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition: lte-mac-sap.h:36
Tag used to define the RNTI and LC id for each MAC packet trasmitted.
bool valid
true if a valid RA config was allocated, false otherwise
void SetLteMacSapUser(LteMacSapUser *s)
Set the MAC SAP user.
Definition: lte-enb-mac.cc:408
virtual void SendLteControlMessage(Ptr< LteControlMessage > msg)=0
Send SendLteControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel.
virtual void ReceiveLteControlMessage(Ptr< LteControlMessage > msg)
Receive SendLteControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel.
Definition: lte-enb-mac.cc:277
uint32_t m_frameNo
Definition: lte-enb-mac.h:248
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Definition: log.h:220
Parameters of the SCHED_DL_RACH_INFO_REQ primitive.
void DoCschedLcConfigCnf(FfMacCschedSapUser::CschedLcConfigCnfParameters params)
Parameters of the SCHED_UL_CONFIG_IND primitive.
virtual void SchedDlCqiInfoReq(const struct SchedDlCqiInfoReqParameters &params)=0
void DoReceiveLteControlMessage(Ptr< LteControlMessage > msg)
Definition: lte-enb-mac.cc:601
A base class which provides memory management and object aggregation.
Definition: object.h:87
virtual void CschedUeConfigUpdateInd(const struct CschedUeConfigUpdateIndParameters &params)
Definition: lte-enb-mac.cc:225
friend class EnbMacMemberLteEnbPhySapUser
Definition: lte-enb-mac.h:56
Parameters of the CSCHED_UE_CONFIG_REQ primitive.
std::map< uint8_t, NcRaPreambleInfo > m_allocatedNcRaPreambleMap
map storing as key the random acccess preamble IDs allocated for non-contention based access...
Definition: lte-enb-mac.h:286
Service Access Point (SAP) offered by the eNB MAC to the eNB RRC See Femto Forum MAC Scheduler Interf...
uint64_t gbrDl
guaranteed bitrate in downlink
virtual ~LteEnbMac(void)
Definition: lte-enb-mac.cc:358
uint8_t harqProcessId
the HARQ process id that was passed by the MAC in the call to NotifyTxOpportunity that generated this...
Definition: lte-mac-sap.h:51
friend class EnbMacMemberFfMacSchedSapUser
Definition: lte-enb-mac.h:54
TracedCallback< uint32_t, uint32_t, uint16_t, uint8_t, uint16_t, uint8_t, uint16_t > m_dlScheduling
Trace information regarding DL scheduling Frame number, Subframe number, RNTI, MCS of TB1...
Definition: lte-enb-mac.h:255
virtual void DlInfoListElementHarqFeeback(DlInfoListElement_s params)
Notify the HARQ on the DL tranmission status.
Definition: lte-enb-mac.cc:301
std::vector< struct BuildRarListElement_s > m_buildRarList
std::map< uint16_t, DlHarqProcessesBuffer_t > m_miDlHarqProcessesPackets
Definition: lte-enb-mac.h:265
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: uinteger.h:45
info associated with a preamble allocated for non-contention based RA
Definition: lte-enb-mac.h:275
a unique identifier for an interface.
Definition: type-id.h:51
void DoSubframeIndication(uint32_t frameNo, uint32_t subframeNo)
Definition: lte-enb-mac.cc:447
EnbMacMemberFfMacSchedSapUser(LteEnbMac *mac)
Definition: lte-enb-mac.cc:149
uint8_t GetLayer(void) const
TypeId SetParent(TypeId tid)
Definition: type-id.cc:631
virtual uint16_t AllocateTemporaryCellRnti()=0
request the allocation of a Temporary C-RNTI
This class implements the MAC layer of the eNodeB device.
Definition: lte-enb-mac.h:50
Parameters of the CSCHED_UE_RELEASE_CNF primitive.
void SetFfMacSchedSapProvider(FfMacSchedSapProvider *s)
Set the scheduler SAP provider.
Definition: lte-enb-mac.cc:382
virtual void RemoveUe(uint16_t rnti)
remove the UE, e.g., after handover or termination of the RRC connection
Definition: lte-enb-mac.cc:94
FfMacCschedSapProvider * m_cschedSapProvider
Definition: lte-enb-mac.h:240
bool isGbr
true if the bearer is GBR, false if the bearer is NON-GBR
std::vector< struct BuildDataListElement_s > m_buildDataList
virtual void CschedLcReleaseReq(const struct CschedLcReleaseReqParameters &params)=0
#define UL_PUSCH_TTIS_DELAY
Definition: lte-common.h:28
Time expiryTime
value the expiration time of this allocation (so that stale preambles can be reused) ...
Definition: lte-enb-mac.h:278
void ReceiveDlCqiLteControlMessage(Ptr< DlCqiLteControlMessage > msg)
Receive a DL CQI ideal control message.
Definition: lte-enb-mac.cc:649
void DoCschedCellConfigCnf(FfMacCschedSapUser::CschedCellConfigCnfParameters params)
Parameters for LteMacSapProvider::TransmitPdu.
Definition: lte-mac-sap.h:45