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  * 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");
48 
49 NS_OBJECT_ENSURE_REGISTERED (LteEnbMac);
50 
51 
52 
53 // //////////////////////////////////////
54 // member SAP forwarders
55 // //////////////////////////////////////
56 
57 
60 {
61 public:
68 
69  // inherited from LteEnbCmacSapProvider
70  virtual void ConfigureMac (uint8_t ulBandwidth, uint8_t dlBandwidth);
71  virtual void AddUe (uint16_t rnti);
72  virtual void RemoveUe (uint16_t rnti);
73  virtual void AddLc (LcInfo lcinfo, LteMacSapUser* msu);
74  virtual void ReconfigureLc (LcInfo lcinfo);
75  virtual void ReleaseLc (uint16_t rnti, uint8_t lcid);
76  virtual void UeUpdateConfigurationReq (UeConfig params);
77  virtual RachConfig GetRachConfig ();
79 
80 
81 private:
83 };
84 
85 
87  : m_mac (mac)
88 {
89 }
90 
91 void
92 EnbMacMemberLteEnbCmacSapProvider::ConfigureMac (uint8_t ulBandwidth, uint8_t dlBandwidth)
93 {
94  m_mac->DoConfigureMac (ulBandwidth, dlBandwidth);
95 }
96 
97 void
99 {
100  m_mac->DoAddUe (rnti);
101 }
102 
103 void
105 {
106  m_mac->DoRemoveUe (rnti);
107 }
108 
109 void
111 {
112  m_mac->DoAddLc (lcinfo, msu);
113 }
114 
115 void
117 {
118  m_mac->DoReconfigureLc (lcinfo);
119 }
120 
121 void
122 EnbMacMemberLteEnbCmacSapProvider::ReleaseLc (uint16_t rnti, uint8_t lcid)
123 {
124  m_mac->DoReleaseLc (rnti, lcid);
125 }
126 
127 void
129 {
131 }
132 
135 {
136  return m_mac->DoGetRachConfig ();
137 }
138 
141 {
142  return m_mac->DoAllocateNcRaPreamble (rnti);
143 }
144 
145 
148 {
149 public:
156 
157 
158  virtual void SchedDlConfigInd (const struct SchedDlConfigIndParameters& params);
159  virtual void SchedUlConfigInd (const struct SchedUlConfigIndParameters& params);
160 private:
162 };
163 
164 
166  : m_mac (mac)
167 {
168 }
169 
170 
171 void
173 {
174  m_mac->DoSchedDlConfigInd (params);
175 }
176 
177 
178 
179 void
181 {
182  m_mac->DoSchedUlConfigInd (params);
183 }
184 
185 
188 {
189 public:
196 
197  virtual void CschedCellConfigCnf (const struct CschedCellConfigCnfParameters& params);
198  virtual void CschedUeConfigCnf (const struct CschedUeConfigCnfParameters& params);
199  virtual void CschedLcConfigCnf (const struct CschedLcConfigCnfParameters& params);
200  virtual void CschedLcReleaseCnf (const struct CschedLcReleaseCnfParameters& params);
201  virtual void CschedUeReleaseCnf (const struct CschedUeReleaseCnfParameters& params);
202  virtual void CschedUeConfigUpdateInd (const struct CschedUeConfigUpdateIndParameters& params);
203  virtual void CschedCellConfigUpdateInd (const struct CschedCellConfigUpdateIndParameters& params);
204 
205 private:
207 };
208 
209 
211  : m_mac (mac)
212 {
213 }
214 
215 void
217 {
218  m_mac->DoCschedCellConfigCnf (params);
219 }
220 
221 void
223 {
224  m_mac->DoCschedUeConfigCnf (params);
225 }
226 
227 void
229 {
230  m_mac->DoCschedLcConfigCnf (params);
231 }
232 
233 void
235 {
236  m_mac->DoCschedLcReleaseCnf (params);
237 }
238 
239 void
241 {
242  m_mac->DoCschedUeReleaseCnf (params);
243 }
244 
245 void
247 {
249 }
250 
251 void
253 {
255 }
256 
257 
258 
261 {
262 public:
269 
270  // inherited from LteEnbPhySapUser
271  virtual void ReceivePhyPdu (Ptr<Packet> p);
272  virtual void SubframeIndication (uint32_t frameNo, uint32_t subframeNo);
274  virtual void ReceiveRachPreamble (uint32_t prachId);
278 
279 private:
281 };
282 
284 {
285 }
286 
287 
288 void
290 {
291  m_mac->DoReceivePhyPdu (p);
292 }
293 
294 void
295 EnbMacMemberLteEnbPhySapUser::SubframeIndication (uint32_t frameNo, uint32_t subframeNo)
296 {
297  m_mac->DoSubframeIndication (frameNo, subframeNo);
298 }
299 
300 void
302 {
304 }
305 
306 void
308 {
309  m_mac->DoReceiveRachPreamble (prachId);
310 }
311 
312 void
314 {
315  m_mac->DoUlCqiReport (ulcqi);
316 }
317 
318 void
320 {
322 }
323 
324 void
326 {
328 }
329 
330 
331 // //////////////////////////////////////
332 // generic LteEnbMac methods
333 // //////////////////////////////////////
334 
335 
336 TypeId
338 {
339  static TypeId tid = TypeId ("ns3::LteEnbMac")
340  .SetParent<Object> ()
341  .SetGroupName("Lte")
342  .AddConstructor<LteEnbMac> ()
343  .AddAttribute ("NumberOfRaPreambles",
344  "how many random access preambles are available for the contention based RACH process",
345  UintegerValue (52),
347  MakeUintegerChecker<uint8_t> (4, 64))
348  .AddAttribute ("PreambleTransMax",
349  "Maximum number of random access preamble transmissions",
350  UintegerValue (50),
352  MakeUintegerChecker<uint8_t> (3, 200))
353  .AddAttribute ("RaResponseWindowSize",
354  "length of the window (in TTIs) for the reception of the random access response (RAR); the resulting RAR timeout is this value + 3 ms",
355  UintegerValue (3),
357  MakeUintegerChecker<uint8_t> (2, 10))
358  .AddTraceSource ("DlScheduling",
359  "Information regarding DL scheduling.",
361  "ns3::LteEnbMac::DlSchedulingTracedCallback")
362  .AddTraceSource ("UlScheduling",
363  "Information regarding UL scheduling.",
365  "ns3::LteEnbMac::UlSchedulingTracedCallback")
366  .AddAttribute ("ComponentCarrierId",
367  "ComponentCarrier Id, needed to reply on the appropriate sap.",
368  UintegerValue (0),
370  MakeUintegerChecker<uint8_t> (0,4))
371  ;
372 
373  return tid;
374 }
375 
376 
378 m_ccmMacSapUser (0)
379 {
380  NS_LOG_FUNCTION (this);
387 }
388 
389 
391 {
392  NS_LOG_FUNCTION (this);
393 }
394 
395 void
397 {
398  NS_LOG_FUNCTION (this);
399  m_dlCqiReceived.clear ();
400  m_ulCqiReceived.clear ();
401  m_ulCeReceived.clear ();
402  m_dlInfoListReceived.clear ();
403  m_ulInfoListReceived.clear ();
405  delete m_macSapProvider;
406  delete m_cmacSapProvider;
407  delete m_schedSapUser;
408  delete m_cschedSapUser;
409  delete m_enbPhySapUser;
410  delete m_ccmMacSapProvider;
411 }
412 
413 void
415 {
416  m_componentCarrierId = index;
417 }
418 
419 void
421 {
422  m_schedSapProvider = s;
423 }
424 
427 {
428  return m_schedSapUser;
429 }
430 
431 void
433 {
435 }
436 
439 {
440  return m_cschedSapUser;
441 }
442 
443 
444 
445 void
447 {
448  m_macSapUser = s;
449 }
450 
453 {
454  return m_macSapProvider;
455 }
456 
457 void
459 {
460  m_cmacSapUser = s;
461 }
462 
465 {
466  return m_cmacSapProvider;
467 }
468 
469 void
471 {
473 }
474 
475 
478 {
479  return m_enbPhySapUser;
480 }
481 
482 void
484 {
485  m_ccmMacSapUser = s;
486 }
487 
488 
491 {
492  return m_ccmMacSapProvider;
493 }
494 
495 void
496 LteEnbMac::DoSubframeIndication (uint32_t frameNo, uint32_t subframeNo)
497 {
498  NS_LOG_FUNCTION (this << " EnbMac - frame " << frameNo << " subframe " << subframeNo);
499 
500  // Store current frame / subframe number
501  m_frameNo = frameNo;
502  m_subframeNo = subframeNo;
503 
504 
505  // --- DOWNLINK ---
506  // Send Dl-CQI info to the scheduler
507  if (m_dlCqiReceived.size () > 0)
508  {
510  dlcqiInfoReq.m_sfnSf = ((0x3FF & frameNo) << 4) | (0xF & subframeNo);
511  dlcqiInfoReq.m_cqiList.insert (dlcqiInfoReq.m_cqiList.begin (), m_dlCqiReceived.begin (), m_dlCqiReceived.end ());
512  m_dlCqiReceived.erase (m_dlCqiReceived.begin (), m_dlCqiReceived.end ());
513  m_schedSapProvider->SchedDlCqiInfoReq (dlcqiInfoReq);
514  }
515 
516  if (!m_receivedRachPreambleCount.empty ())
517  {
518  // process received RACH preambles and notify the scheduler
520  NS_ASSERT (subframeNo > 0 && subframeNo <= 10); // subframe in 1..10
521  for (std::map<uint8_t, uint32_t>::const_iterator it = m_receivedRachPreambleCount.begin ();
522  it != m_receivedRachPreambleCount.end ();
523  ++it)
524  {
525  NS_LOG_INFO (this << " preambleId " << (uint32_t) it->first << ": " << it->second << " received");
526  NS_ASSERT (it->second != 0);
527  if (it->second > 1)
528  {
529  NS_LOG_INFO ("preambleId " << (uint32_t) it->first << ": collision");
530  // in case of collision we assume that no preamble is
531  // successfully received, hence no RAR is sent
532  }
533  else
534  {
535  uint16_t rnti;
536  std::map<uint8_t, NcRaPreambleInfo>::iterator jt = m_allocatedNcRaPreambleMap.find (it->first);
537  if (jt != m_allocatedNcRaPreambleMap.end ())
538  {
539  rnti = jt->second.rnti;
540  NS_LOG_INFO ("preambleId previously allocated for NC based RA, RNTI =" << (uint32_t) rnti << ", sending RAR");
541 
542  }
543  else
544  {
546  NS_LOG_INFO ("preambleId " << (uint32_t) it->first << ": allocated T-C-RNTI " << (uint32_t) rnti << ", sending RAR");
547  }
548 
549  RachListElement_s rachLe;
550  rachLe.m_rnti = rnti;
551  rachLe.m_estimatedSize = 144; // to be confirmed
552  rachInfoReqParams.m_rachList.push_back (rachLe);
553  m_rapIdRntiMap.insert (std::pair <uint16_t, uint32_t> (rnti, it->first));
554  }
555  }
556  m_schedSapProvider->SchedDlRachInfoReq (rachInfoReqParams);
558  }
559  // Get downlink transmission opportunities
560  uint32_t dlSchedFrameNo = m_frameNo;
561  uint32_t dlSchedSubframeNo = m_subframeNo;
562  // NS_LOG_DEBUG (this << " sfn " << frameNo << " sbfn " << subframeNo);
563  if (dlSchedSubframeNo + m_macChTtiDelay > 10)
564  {
565  dlSchedFrameNo++;
566  dlSchedSubframeNo = (dlSchedSubframeNo + m_macChTtiDelay) % 10;
567  }
568  else
569  {
570  dlSchedSubframeNo = dlSchedSubframeNo + m_macChTtiDelay;
571  }
573  dlparams.m_sfnSf = ((0x3FF & dlSchedFrameNo) << 4) | (0xF & dlSchedSubframeNo);
574 
575  // Forward DL HARQ feebacks collected during last TTI
576  if (m_dlInfoListReceived.size () > 0)
577  {
579  // empty local buffer
580  m_dlInfoListReceived.clear ();
581  }
582 
584 
585 
586  // --- UPLINK ---
587  // Send UL-CQI info to the scheduler
588  for (uint16_t i = 0; i < m_ulCqiReceived.size (); i++)
589  {
590  if (subframeNo > 1)
591  {
592  m_ulCqiReceived.at (i).m_sfnSf = ((0x3FF & frameNo) << 4) | (0xF & (subframeNo - 1));
593  }
594  else
595  {
596  m_ulCqiReceived.at (i).m_sfnSf = ((0x3FF & (frameNo - 1)) << 4) | (0xF & 10);
597  }
599  }
600  m_ulCqiReceived.clear ();
601 
602  // Send BSR reports to the scheduler
603  if (m_ulCeReceived.size () > 0)
604  {
606  ulMacReq.m_sfnSf = ((0x3FF & frameNo) << 4) | (0xF & subframeNo);
607  ulMacReq.m_macCeList.insert (ulMacReq.m_macCeList.begin (), m_ulCeReceived.begin (), m_ulCeReceived.end ());
608  m_ulCeReceived.erase (m_ulCeReceived.begin (), m_ulCeReceived.end ());
610  }
611 
612 
613  // Get uplink transmission opportunities
614  uint32_t ulSchedFrameNo = m_frameNo;
615  uint32_t ulSchedSubframeNo = m_subframeNo;
616  // NS_LOG_DEBUG (this << " sfn " << frameNo << " sbfn " << subframeNo);
617  if (ulSchedSubframeNo + (m_macChTtiDelay + UL_PUSCH_TTIS_DELAY) > 10)
618  {
619  ulSchedFrameNo++;
620  ulSchedSubframeNo = (ulSchedSubframeNo + (m_macChTtiDelay + UL_PUSCH_TTIS_DELAY)) % 10;
621  }
622  else
623  {
624  ulSchedSubframeNo = ulSchedSubframeNo + (m_macChTtiDelay + UL_PUSCH_TTIS_DELAY);
625  }
627  ulparams.m_sfnSf = ((0x3FF & ulSchedFrameNo) << 4) | (0xF & ulSchedSubframeNo);
628 
629  // Forward DL HARQ feebacks collected during last TTI
630  if (m_ulInfoListReceived.size () > 0)
631  {
633  // empty local buffer
634  m_ulInfoListReceived.clear ();
635  }
636 
638 
639 }
640 
641 
642 void
644 {
645  NS_LOG_FUNCTION (this << msg);
646  if (msg->GetMessageType () == LteControlMessage::DL_CQI)
647  {
648  Ptr<DlCqiLteControlMessage> dlcqi = DynamicCast<DlCqiLteControlMessage> (msg);
650  }
651  else if (msg->GetMessageType () == LteControlMessage::BSR)
652  {
653  Ptr<BsrLteControlMessage> bsr = DynamicCast<BsrLteControlMessage> (msg);
654  ReceiveBsrMessage (bsr->GetBsr ());
655  }
656  else if (msg->GetMessageType () == LteControlMessage::DL_HARQ)
657  {
658  Ptr<DlHarqFeedbackLteControlMessage> dlharq = DynamicCast<DlHarqFeedbackLteControlMessage> (msg);
659  DoDlInfoListElementHarqFeeback (dlharq->GetDlHarqFeedback ());
660  }
661  else
662  {
663  NS_LOG_LOGIC (this << " LteControlMessage type " << msg->GetMessageType () << " not recognized");
664  }
665 }
666 
667 void
669 {
670  NS_LOG_FUNCTION (this << (uint32_t) rapId);
671  // just record that the preamble has been received; it will be processed later
672  ++m_receivedRachPreambleCount[rapId]; // will create entry if not exists
673 }
674 
675 void
677 {
678  if (ulcqi.m_ulCqi.m_type == UlCqi_s::PUSCH)
679  {
680  NS_LOG_DEBUG (this << " eNB rxed an PUSCH UL-CQI");
681  }
682  else if (ulcqi.m_ulCqi.m_type == UlCqi_s::SRS)
683  {
684  NS_LOG_DEBUG (this << " eNB rxed an SRS UL-CQI");
685  }
686  m_ulCqiReceived.push_back (ulcqi);
687 }
688 
689 
690 void
692 {
693  NS_LOG_FUNCTION (this << msg);
694 
695  CqiListElement_s dlcqi = msg->GetDlCqi ();
696  NS_LOG_LOGIC (this << "Enb Received DL-CQI rnti" << dlcqi.m_rnti);
697  NS_ASSERT (dlcqi.m_rnti != 0);
698  m_dlCqiReceived.push_back (dlcqi);
699 
700 }
701 
702 
703 void
705 {
706  NS_LOG_FUNCTION (this);
708 }
709 
710 void
712 {
713  NS_LOG_FUNCTION (this);
714  NS_LOG_DEBUG (this << " bsr Size " << (uint16_t) m_ulCeReceived.size ());
715  //send to LteCcmMacSapUser
716  m_ulCeReceived.push_back (bsr); // this to called when LteUlCcmSapProvider::ReportMacCeToScheduler is called
717  NS_LOG_DEBUG (this << " bsr Size after push_back " << (uint16_t) m_ulCeReceived.size ());
718 }
719 
720 
721 void
723 {
724  NS_LOG_FUNCTION (this);
725  LteRadioBearerTag tag;
726  p->RemovePacketTag (tag);
727 
728  // store info of the packet received
729 
730 // std::map <uint16_t,UlInfoListElement_s>::iterator it;
731 // u_int rnti = tag.GetRnti ();
732 // u_int lcid = tag.GetLcid ();
733 // it = m_ulInfoListElements.find (tag.GetRnti ());
734 // if (it == m_ulInfoListElements.end ())
735 // {
736 // // new RNTI
737 // UlInfoListElement_s ulinfonew;
738 // ulinfonew.m_rnti = tag.GetRnti ();
739 // // always allocate full size of ulReception vector, initializing all elements to 0
740 // ulinfonew.m_ulReception.assign (MAX_LC_LIST+1, 0);
741 // // set the element for the current LCID
742 // ulinfonew.m_ulReception.at (tag.GetLcid ()) = p->GetSize ();
743 // ulinfonew.m_receptionStatus = UlInfoListElement_s::Ok;
744 // ulinfonew.m_tpc = 0; // Tx power control not implemented at this stage
745 // m_ulInfoListElements.insert (std::pair<uint16_t, UlInfoListElement_s > (tag.GetRnti (), ulinfonew));
746 //
747 // }
748 // else
749 // {
750 // // existing RNTI: we just set the value for the current
751 // // LCID. Note that the corresponding element had already been
752 // // allocated previously.
753 // NS_ASSERT_MSG ((*it).second.m_ulReception.at (tag.GetLcid ()) == 0, "would overwrite previously written ulReception element");
754 // (*it).second.m_ulReception.at (tag.GetLcid ()) = p->GetSize ();
755 // (*it).second.m_receptionStatus = UlInfoListElement_s::Ok;
756 // }
757 
758 
759 
760  // forward the packet to the correspondent RLC
761  uint16_t rnti = tag.GetRnti ();
762  uint8_t lcid = tag.GetLcid ();
763  std::map <uint16_t, std::map<uint8_t, LteMacSapUser*> >::iterator rntiIt = m_rlcAttached.find (rnti);
764  NS_ASSERT_MSG (rntiIt != m_rlcAttached.end (), "could not find RNTI" << rnti);
765  std::map<uint8_t, LteMacSapUser*>::iterator lcidIt = rntiIt->second.find (lcid);
766  //NS_ASSERT_MSG (lcidIt != rntiIt->second.end (), "could not find LCID" << lcid);
767 
768  //Receive PDU only if LCID is found
769  if (lcidIt != rntiIt->second.end ())
770  {
771  (*lcidIt).second->ReceivePdu (p, rnti, lcid);
772  }
773 }
774 
775 
776 
777 // ////////////////////////////////////////////
778 // CMAC SAP
779 // ////////////////////////////////////////////
780 
781 void
782 LteEnbMac::DoConfigureMac (uint8_t ulBandwidth, uint8_t dlBandwidth)
783 {
784  NS_LOG_FUNCTION (this << " ulBandwidth=" << (uint16_t) ulBandwidth << " dlBandwidth=" << (uint16_t) dlBandwidth);
786  // Configure the subset of parameters used by FfMacScheduler
787  params.m_ulBandwidth = ulBandwidth;
788  params.m_dlBandwidth = dlBandwidth;
790  // ...more parameters can be configured
792 }
793 
794 
795 void
796 LteEnbMac::DoAddUe (uint16_t rnti)
797 {
798  NS_LOG_FUNCTION (this << " rnti=" << rnti);
799  std::map<uint8_t, LteMacSapUser*> empty;
800  std::pair <std::map <uint16_t, std::map<uint8_t, LteMacSapUser*> >::iterator, bool>
801  ret = m_rlcAttached.insert (std::pair <uint16_t, std::map<uint8_t, LteMacSapUser*> >
802  (rnti, empty));
803  NS_ASSERT_MSG (ret.second, "element already present, RNTI already existed");
804 
806  params.m_rnti = rnti;
807  params.m_transmissionMode = 0; // set to default value (SISO) for avoiding random initialization (valgrind error)
808 
810 
811  // Create DL transmission HARQ buffers
812  std::vector < Ptr<PacketBurst> > dlHarqLayer0pkt;
813  dlHarqLayer0pkt.resize (8);
814  for (uint8_t i = 0; i < 8; i++)
815  {
816  Ptr<PacketBurst> pb = CreateObject <PacketBurst> ();
817  dlHarqLayer0pkt.at (i) = pb;
818  }
819  std::vector < Ptr<PacketBurst> > dlHarqLayer1pkt;
820  dlHarqLayer1pkt.resize (8);
821  for (uint8_t i = 0; i < 8; i++)
822  {
823  Ptr<PacketBurst> pb = CreateObject <PacketBurst> ();
824  dlHarqLayer1pkt.at (i) = pb;
825  }
827  buf.push_back (dlHarqLayer0pkt);
828  buf.push_back (dlHarqLayer1pkt);
829  m_miDlHarqProcessesPackets.insert (std::pair <uint16_t, DlHarqProcessesBuffer_t> (rnti, buf));
830 }
831 
832 void
833 LteEnbMac::DoRemoveUe (uint16_t rnti)
834 {
835  NS_LOG_FUNCTION (this << " rnti=" << rnti);
837  params.m_rnti = rnti;
839  m_rlcAttached.erase (rnti);
840  m_miDlHarqProcessesPackets.erase (rnti);
841 }
842 
843 void
845 {
846  NS_LOG_FUNCTION (this << lcinfo.rnti << (uint16_t) lcinfo.lcId);
847 
848  std::map <LteFlowId_t, LteMacSapUser* >::iterator it;
849 
850  LteFlowId_t flow (lcinfo.rnti, lcinfo.lcId);
851 
852  std::map <uint16_t, std::map<uint8_t, LteMacSapUser*> >::iterator rntiIt = m_rlcAttached.find (lcinfo.rnti);
853  NS_ASSERT_MSG (rntiIt != m_rlcAttached.end (), "RNTI not found");
854  std::map<uint8_t, LteMacSapUser*>::iterator lcidIt = rntiIt->second.find (lcinfo.lcId);
855  if (lcidIt == rntiIt->second.end ())
856  {
857  rntiIt->second.insert (std::pair<uint8_t, LteMacSapUser*> (lcinfo.lcId, msu));
858  }
859  else
860  {
861  NS_LOG_ERROR ("LC already exists");
862  }
863 
864  // CCCH (LCID 0) is pre-configured
865  // see FF LTE MAC Scheduler
866  // Interface Specification v1.11,
867  // 4.3.4 logicalChannelConfigListElement
868  if (lcinfo.lcId != 0)
869  {
871  params.m_rnti = lcinfo.rnti;
872  params.m_reconfigureFlag = false;
873 
875  lccle.m_logicalChannelIdentity = lcinfo.lcId;
876  lccle.m_logicalChannelGroup = lcinfo.lcGroup;
879  lccle.m_qci = lcinfo.qci;
880  lccle.m_eRabMaximulBitrateUl = lcinfo.mbrUl;
881  lccle.m_eRabMaximulBitrateDl = lcinfo.mbrDl;
882  lccle.m_eRabGuaranteedBitrateUl = lcinfo.gbrUl;
883  lccle.m_eRabGuaranteedBitrateDl = lcinfo.gbrDl;
884  params.m_logicalChannelConfigList.push_back (lccle);
885 
887  }
888 }
889 
890 void
892 {
893  NS_FATAL_ERROR ("not implemented");
894 }
895 
896 void
897 LteEnbMac::DoReleaseLc (uint16_t rnti, uint8_t lcid)
898 {
899  NS_LOG_FUNCTION (this);
900 
901  //Find user based on rnti and then erase lcid stored against the same
902  std::map <uint16_t, std::map<uint8_t, LteMacSapUser*> >::iterator rntiIt = m_rlcAttached.find (rnti);
903  rntiIt->second.erase (lcid);
904 
906  params.m_rnti = rnti;
907  params.m_logicalChannelIdentity.push_back (lcid);
909 }
910 
911 void
913 {
914  NS_LOG_FUNCTION (this);
915 
916  // propagates to scheduler
918  req.m_rnti = params.m_rnti;
920  req.m_reconfigureFlag = true;
922 }
923 
926 {
931  return rc;
932 }
933 
936 {
937  bool found = false;
938  uint8_t preambleId;
939  for (preambleId = m_numberOfRaPreambles; preambleId < 64; ++preambleId)
940  {
941  std::map<uint8_t, NcRaPreambleInfo>::iterator it = m_allocatedNcRaPreambleMap.find (preambleId);
942  if ((it == m_allocatedNcRaPreambleMap.end ())
943  || (it->second.expiryTime < Simulator::Now ()))
944  {
945  found = true;
946  NcRaPreambleInfo preambleInfo;
947  uint32_t expiryIntervalMs = (uint32_t) m_preambleTransMax * ((uint32_t) m_raResponseWindowSize + 5);
948 
949  preambleInfo.expiryTime = Simulator::Now () + MilliSeconds (expiryIntervalMs);
950  preambleInfo.rnti = rnti;
951  NS_LOG_INFO ("allocated preamble for NC based RA: preamble " << preambleId << ", RNTI " << preambleInfo.rnti << ", exiryTime " << preambleInfo.expiryTime);
952  m_allocatedNcRaPreambleMap[preambleId] = preambleInfo; // create if not exist, update otherwise
953  break;
954  }
955  }
957  if (found)
958  {
959  ret.valid = true;
960  ret.raPreambleId = preambleId;
961  ret.raPrachMaskIndex = 0;
962  }
963  else
964  {
965  ret.valid = false;
966  ret.raPreambleId = 0;
967  ret.raPrachMaskIndex = 0;
968  }
969  return ret;
970 }
971 
972 
973 
974 // ////////////////////////////////////////////
975 // MAC SAP
976 // ////////////////////////////////////////////
977 
978 
979 void
981 {
982  NS_LOG_FUNCTION (this);
983  LteRadioBearerTag tag (params.rnti, params.lcid, params.layer);
984  params.pdu->AddPacketTag (tag);
986  // Store pkt in HARQ buffer
987  std::map <uint16_t, DlHarqProcessesBuffer_t>::iterator it = m_miDlHarqProcessesPackets.find (params.rnti);
988  NS_ASSERT (it != m_miDlHarqProcessesPackets.end ());
989  NS_LOG_DEBUG (this << " LAYER " << (uint16_t)tag.GetLayer () << " HARQ ID " << (uint16_t)params.harqProcessId);
990 
991  //(*it).second.at (params.layer).at (params.harqProcessId) = params.pdu;//->Copy ();
992  (*it).second.at (params.layer).at (params.harqProcessId)->AddPacket (params.pdu);
994 }
995 
996 void
998 {
999  NS_LOG_FUNCTION (this);
1001  req.m_rnti = params.rnti;
1002  req.m_logicalChannelIdentity = params.lcid;
1007  req.m_rlcStatusPduSize = params.statusPduSize;
1009 }
1010 
1011 
1012 
1013 // ////////////////////////////////////////////
1014 // SCHED SAP
1015 // ////////////////////////////////////////////
1016 
1017 
1018 
1019 void
1021 {
1022  NS_LOG_FUNCTION (this);
1023  // Create DL PHY PDU
1024  Ptr<PacketBurst> pb = CreateObject<PacketBurst> ();
1025  std::map <LteFlowId_t, LteMacSapUser* >::iterator it;
1026 
1027  for (unsigned int i = 0; i < ind.m_buildDataList.size (); i++)
1028  {
1029  for (uint16_t layer = 0; layer < ind.m_buildDataList.at (i).m_dci.m_ndi.size (); layer++)
1030  {
1031  if (ind.m_buildDataList.at (i).m_dci.m_ndi.at (layer) == 1)
1032  {
1033  // new data -> force emptying correspondent harq pkt buffer
1034  std::map <uint16_t, DlHarqProcessesBuffer_t>::iterator it = m_miDlHarqProcessesPackets.find (ind.m_buildDataList.at (i).m_rnti);
1035  NS_ASSERT (it != m_miDlHarqProcessesPackets.end ());
1036  for (uint16_t lcId = 0; lcId < (*it).second.size (); lcId++)
1037  {
1038  Ptr<PacketBurst> pb = CreateObject <PacketBurst> ();
1039  (*it).second.at (lcId).at (ind.m_buildDataList.at (i).m_dci.m_harqProcess) = pb;
1040  }
1041  }
1042  }
1043  for (unsigned int j = 0; j < ind.m_buildDataList.at (i).m_rlcPduList.size (); j++)
1044  {
1045  for (uint16_t k = 0; k < ind.m_buildDataList.at (i).m_rlcPduList.at (j).size (); k++)
1046  {
1047  if (ind.m_buildDataList.at (i).m_dci.m_ndi.at (k) == 1)
1048  {
1049  // New Data -> retrieve it from RLC
1050  uint16_t rnti = ind.m_buildDataList.at (i).m_rnti;
1051  uint8_t lcid = ind.m_buildDataList.at (i).m_rlcPduList.at (j).at (k).m_logicalChannelIdentity;
1052  std::map <uint16_t, std::map<uint8_t, LteMacSapUser*> >::iterator rntiIt = m_rlcAttached.find (rnti);
1053  NS_ASSERT_MSG (rntiIt != m_rlcAttached.end (), "could not find RNTI" << rnti);
1054  std::map<uint8_t, LteMacSapUser*>::iterator lcidIt = rntiIt->second.find (lcid);
1055  NS_ASSERT_MSG (lcidIt != rntiIt->second.end (), "could not find LCID" << (uint32_t)lcid<<" carrier id:"<<(uint16_t)m_componentCarrierId);
1056  NS_LOG_DEBUG (this << " rnti= " << rnti << " lcid= " << (uint32_t) lcid << " layer= " << k);
1057  (*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);
1058  }
1059  else
1060  {
1061  if (ind.m_buildDataList.at (i).m_dci.m_tbsSize.at (k) > 0)
1062  {
1063  // HARQ retransmission -> retrieve TB from HARQ buffer
1064  std::map <uint16_t, DlHarqProcessesBuffer_t>::iterator it = m_miDlHarqProcessesPackets.find (ind.m_buildDataList.at (i).m_rnti);
1065  NS_ASSERT (it != m_miDlHarqProcessesPackets.end ());
1066  Ptr<PacketBurst> pb = (*it).second.at (k).at ( ind.m_buildDataList.at (i).m_dci.m_harqProcess);
1067  for (std::list<Ptr<Packet> >::const_iterator j = pb->Begin (); j != pb->End (); ++j)
1068  {
1069  Ptr<Packet> pkt = (*j)->Copy ();
1071  }
1072  }
1073  }
1074  }
1075  }
1076  // send the relative DCI
1077  Ptr<DlDciLteControlMessage> msg = Create<DlDciLteControlMessage> ();
1078  msg->SetDci (ind.m_buildDataList.at (i).m_dci);
1080  }
1081 
1082  // Fire the trace with the DL information
1083  for ( uint32_t i = 0; i < ind.m_buildDataList.size (); i++ )
1084  {
1085  // Only one TB used
1086  if (ind.m_buildDataList.at (i).m_dci.m_tbsSize.size () == 1)
1087  {
1088  DlSchedulingCallbackInfo dlSchedulingCallbackInfo;
1089  dlSchedulingCallbackInfo.frameNo = m_frameNo;
1090  dlSchedulingCallbackInfo.subframeNo = m_subframeNo;
1091  dlSchedulingCallbackInfo.rnti = ind.m_buildDataList.at (i).m_dci.m_rnti;
1092  dlSchedulingCallbackInfo.mcsTb1=ind.m_buildDataList.at (i).m_dci.m_mcs.at (0);
1093  dlSchedulingCallbackInfo.sizeTb1 = ind.m_buildDataList.at (i).m_dci.m_tbsSize.at (0);
1094  dlSchedulingCallbackInfo.mcsTb2 = 0;
1095  dlSchedulingCallbackInfo.sizeTb2 = 0;
1096  dlSchedulingCallbackInfo.componentCarrierId = m_componentCarrierId;
1097  m_dlScheduling(dlSchedulingCallbackInfo);
1098  }
1099  // Two TBs used
1100  else if (ind.m_buildDataList.at (i).m_dci.m_tbsSize.size () == 2)
1101  {
1102  DlSchedulingCallbackInfo dlSchedulingCallbackInfo;
1103  dlSchedulingCallbackInfo.frameNo = m_frameNo;
1104  dlSchedulingCallbackInfo.subframeNo = m_subframeNo;
1105  dlSchedulingCallbackInfo.rnti = ind.m_buildDataList.at (i).m_dci.m_rnti;
1106  dlSchedulingCallbackInfo.mcsTb1=ind.m_buildDataList.at (i).m_dci.m_mcs.at (0);
1107  dlSchedulingCallbackInfo.sizeTb1 = ind.m_buildDataList.at (i).m_dci.m_tbsSize.at (0);
1108  dlSchedulingCallbackInfo.mcsTb2 = ind.m_buildDataList.at (i).m_dci.m_mcs.at (1);
1109  dlSchedulingCallbackInfo.sizeTb2 = ind.m_buildDataList.at (i).m_dci.m_tbsSize.at (1);
1110  dlSchedulingCallbackInfo.componentCarrierId = m_componentCarrierId;
1111  m_dlScheduling(dlSchedulingCallbackInfo);
1112  }
1113  else
1114  {
1115  NS_FATAL_ERROR ("Found element with more than two transport blocks");
1116  }
1117  }
1118 
1119  // Random Access procedure: send RARs
1120  Ptr<RarLteControlMessage> rarMsg = Create<RarLteControlMessage> ();
1121  // see TS 36.321 5.1.4; preambles were sent two frames ago
1122  // (plus 3GPP counts subframes from 0, not 1)
1123  uint16_t raRnti;
1124  if (m_subframeNo < 3)
1125  {
1126  raRnti = m_subframeNo + 7; // equivalent to +10-3
1127  }
1128  else
1129  {
1130  raRnti = m_subframeNo - 3;
1131  }
1132  rarMsg->SetRaRnti (raRnti);
1133  for (unsigned int i = 0; i < ind.m_buildRarList.size (); i++)
1134  {
1135  std::map <uint8_t, uint32_t>::iterator itRapId = m_rapIdRntiMap.find (ind.m_buildRarList.at (i).m_rnti);
1136  if (itRapId == m_rapIdRntiMap.end ())
1137  {
1138  NS_FATAL_ERROR ("Unable to find rapId of RNTI " << ind.m_buildRarList.at (i).m_rnti);
1139  }
1141  rar.rapId = itRapId->second;
1142  rar.rarPayload = ind.m_buildRarList.at (i);
1143  rarMsg->AddRar (rar);
1144  NS_LOG_INFO (this << " Send RAR message to RNTI " << ind.m_buildRarList.at (i).m_rnti << " rapId " << itRapId->second);
1145  }
1146  if (ind.m_buildRarList.size () > 0)
1147  {
1149  }
1150  m_rapIdRntiMap.clear ();
1151 }
1152 
1153 
1154 void
1156 {
1157  NS_LOG_FUNCTION (this);
1158 
1159  for (unsigned int i = 0; i < ind.m_dciList.size (); i++)
1160  {
1161  // send the correspondent ul dci
1162  Ptr<UlDciLteControlMessage> msg = Create<UlDciLteControlMessage> ();
1163  msg->SetDci (ind.m_dciList.at (i));
1165  }
1166 
1167  // Fire the trace with the UL information
1168  for ( uint32_t i = 0; i < ind.m_dciList.size (); i++ )
1169  {
1170  m_ulScheduling (m_frameNo, m_subframeNo, ind.m_dciList.at (i).m_rnti,
1171  ind.m_dciList.at (i).m_mcs, ind.m_dciList.at (i).m_tbSize, m_componentCarrierId);
1172  }
1173 
1174 
1175 
1176 }
1177 
1178 
1179 
1180 
1181 // ////////////////////////////////////////////
1182 // CSCHED SAP
1183 // ////////////////////////////////////////////
1184 
1185 
1186 void
1188 {
1189  NS_LOG_FUNCTION (this);
1190 }
1191 
1192 void
1194 {
1195  NS_LOG_FUNCTION (this);
1196 }
1197 
1198 void
1200 {
1201  NS_LOG_FUNCTION (this);
1202  // Call the CSCHED primitive
1203  // m_cschedSap->LcConfigCompleted();
1204 }
1205 
1206 void
1208 {
1209  NS_LOG_FUNCTION (this);
1210 }
1211 
1212 void
1214 {
1215  NS_LOG_FUNCTION (this);
1216 }
1217 
1218 void
1220 {
1221  NS_LOG_FUNCTION (this);
1222  // propagates to RRC
1223  LteEnbCmacSapUser::UeConfig ueConfigUpdate;
1224  ueConfigUpdate.m_rnti = params.m_rnti;
1225  ueConfigUpdate.m_transmissionMode = params.m_transmissionMode;
1226  m_cmacSapUser->RrcConfigurationUpdateInd (ueConfigUpdate);
1227 }
1228 
1229 void
1231 {
1232  NS_LOG_FUNCTION (this);
1233 }
1234 
1235 void
1237 {
1238  NS_LOG_FUNCTION (this);
1239  m_ulInfoListReceived.push_back (params);
1240 }
1241 
1242 void
1244 {
1245  NS_LOG_FUNCTION (this);
1246  // Update HARQ buffer
1247  std::map <uint16_t, DlHarqProcessesBuffer_t>::iterator it = m_miDlHarqProcessesPackets.find (params.m_rnti);
1248  NS_ASSERT (it != m_miDlHarqProcessesPackets.end ());
1249  for (uint8_t layer = 0; layer < params.m_harqStatus.size (); layer++)
1250  {
1251  if (params.m_harqStatus.at (layer) == DlInfoListElement_s::ACK)
1252  {
1253  // discard buffer
1254  Ptr<PacketBurst> emptyBuf = CreateObject <PacketBurst> ();
1255  (*it).second.at (layer).at (params.m_harqProcessId) = emptyBuf;
1256  NS_LOG_DEBUG (this << " HARQ-ACK UE " << params.m_rnti << " harqId " << (uint16_t)params.m_harqProcessId << " layer " << (uint16_t)layer);
1257  }
1258  else if (params.m_harqStatus.at (layer) == DlInfoListElement_s::NACK)
1259  {
1260  NS_LOG_DEBUG (this << " HARQ-NACK UE " << params.m_rnti << " harqId " << (uint16_t)params.m_harqProcessId << " layer " << (uint16_t)layer);
1261  }
1262  else
1263  {
1264  NS_FATAL_ERROR (" HARQ functionality not implemented");
1265  }
1266  }
1267  m_dlInfoListReceived.push_back (params);
1268 }
1269 
1270 
1271 } // namespace ns3
Service Access Point (SAP) offered by the component carrier manager (CCM) by MAC to CCM...
std::vector< struct UlInfoListElement_s > m_ulInfoList
UL info list.
void DoConfigureMac(uint8_t ulBandwidth, uint8_t dlBandwidth)
Configure MAC function.
Definition: lte-enb-mac.cc:782
void DoReconfigureLc(LteEnbCmacSapProvider::LcInfo lcinfo)
Reconfigure LC function.
Definition: lte-enb-mac.cc:891
FfMacSchedSapUser * m_schedSapUser
the Sched SAP user
Definition: lte-enb-mac.h:393
Parameters of the CSCHED_LC_CONFIG_CNF primitive.
AllocateNcRaPreambleReturnValue structure.
virtual void UlCqiReport(FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi)
Returns to MAC level the UL-CQI evaluated.
Definition: lte-enb-mac.cc:313
EnbMacMemberFfMacCschedSapUser(LteEnbMac *mac)
Constructor.
Definition: lte-enb-mac.cc:210
void DoDlInfoListElementHarqFeeback(DlInfoListElement_s params)
DL Info List ELements HARQ Feedback function.
EnbMacMemberLteMacSapProvider class.
Definition: lte-mac-sap.h:134
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 "...
uint16_t m_rnti
RNTI.
uint16_t m_rnti
RNTI.
std::vector< FfMacSchedSapProvider::SchedUlCqiInfoReqParameters > m_ulCqiReceived
UL-CQI received.
Definition: lte-enb-mac.h:370
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
uint8_t m_logicalChannelIdentity
logical channel indentity
uint16_t m_rnti
UE id within this cell.
virtual void CschedUeConfigReq(const struct CschedUeConfigReqParameters &params)=0
CSCHED_UE_CONFIG_REQ.
uint16_t sizeTb2
size TB2
Definition: lte-common.h:247
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
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)
legacy public for use the Phy callback
Definition: lte-enb-mac.cc:722
virtual void ReconfigureLc(LcInfo lcinfo)
Reconfigure an existing logical channel.
Definition: lte-enb-mac.cc:116
uint32_t frameNo
frame number
Definition: lte-common.h:241
uint8_t preambleTransMax
preamble transmit maximum
Parameters of the CSCHED_CELL_CONFIG_UPDATE_IND primitive.
void DoUlInfoListElementHarqFeeback(UlInfoListElement_s params)
UL Info List ELements HARQ Feedback function.
TracedCallback< uint32_t, uint32_t, uint16_t, uint8_t, uint16_t, uint8_t > m_ulScheduling
Trace information regarding UL scheduling Frame number, Subframe number, RNTI, MCS of TB...
Definition: lte-enb-mac.h:423
LteEnbCmacSapProvider * m_cmacSapProvider
the CMAC SAP provider
Definition: lte-enb-mac.h:386
std::map< uint16_t, std::map< uint8_t, LteMacSapUser * > > m_rlcAttached
rnti, lcid, SAP of the RLC instance
Definition: lte-enb-mac.h:367
enum ns3::UlCqi_s::Type_e m_type
type
void DoAddLc(LteEnbCmacSapProvider::LcInfo lcinfo, LteMacSapUser *msu)
Add LC function.
Definition: lte-enb-mac.cc:844
LteEnbCmacSapProvider::RachConfig DoGetRachConfig()
Get RACH configuration function.
Definition: lte-enb-mac.cc:925
virtual void SchedDlConfigInd(const struct SchedDlConfigIndParameters &params)
SCHED_DL_CONFIG_IND.
Definition: lte-enb-mac.cc:172
void DoCschedCellConfigUpdateInd(FfMacCschedSapUser::CschedCellConfigUpdateIndParameters params)
CSched Cell Config Update Indication function.
void DoReleaseLc(uint16_t rnti, uint8_t lcid)
Release LC function.
Definition: lte-enb-mac.cc:897
void SetLteEnbCmacSapUser(LteEnbCmacSapUser *s)
Set the control MAC SAP user.
Definition: lte-enb-mac.cc:458
void SetComponentCarrierId(uint8_t index)
Set the component carrier ID.
Definition: lte-enb-mac.cc:414
void DoSchedUlConfigInd(FfMacSchedSapUser::SchedUlConfigIndParameters params)
Sched UL Config Indication function.
uint8_t raResponseWindowSize
RA response window size.
void DoReportMacCeToScheduler(MacCeListElement_s bsr)
Report MAC CE to scheduler.
Definition: lte-enb-mac.cc:711
std::vector< struct LogicalChannelConfigListElement_s > m_logicalChannelConfigList
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:67
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1022
virtual void SchedUlTriggerReq(const struct SchedUlTriggerReqParameters &params)=0
SCHED_UL_TRIGGER_REQ.
virtual void ReceiveRachPreamble(uint32_t prachId)
notify the reception of a RACH preamble on the PRACH
Definition: lte-enb-mac.cc:307
uint8_t m_preambleTransMax
preamble transmit maximum
Definition: lte-enb-mac.h:431
Provides the CSCHED SAP.
uint8_t m_transmissionMode
Transmission mode 1..7
void DoTransmitPdu(LteMacSapProvider::TransmitPduParameters params)
Transmit PDU function.
Definition: lte-enb-mac.cc:980
virtual uint8_t GetMacChTtiDelay()=0
Get the delay from MAC to Channel expressed in TTIs.
std::vector< struct UlDciListElement_s > m_dciList
DCI list.
See section 4.3.24 cqiListElement.
uint32_t retxQueueSize
the current size of the RLC retransmission queue in bytes
Definition: lte-mac-sap.h:73
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:278
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:162
LteCcmMacSapProvider * GetLteCcmMacSapProvider()
Get the eNB-ComponentCarrierManager SAP User.
Definition: lte-enb-mac.cc:490
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:110
uint64_t mbrDl
maximum bitrate in downlink
Parameters of the CSCHED_LC_RELEASE_REQ primitive.
friend class EnbMacMemberFfMacCschedSapUser
allow EnbMacMemberFfMacCschedSapUser class friend access
Definition: lte-enb-mac.h:64
Service Access Point (SAP) offered by the eNB-PHY to the eNB-MAC.
uint32_t m_rlcRetransmissionQueueSize
RLC retransmission queue size.
virtual void SchedDlTriggerReq(const struct SchedDlTriggerReqParameters &params)=0
SCHED_DL_TRIGGER_REQ.
See section 4.3.12 ulInfoListElement.
void DoAddUe(uint16_t rnti)
Add UE function.
Definition: lte-enb-mac.cc:796
virtual void SchedDlRlcBufferReq(const struct SchedDlRlcBufferReqParameters &params)=0
SCHED_DL_RLC_BUFFER_REQ.
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
uint8_t componentCarrierId
the component carrier id corresponding to the sending Mac istance
Definition: lte-mac-sap.h:52
uint8_t m_componentCarrierId
component carrier Id used to address sap
Definition: lte-enb-mac.h:456
uint16_t sizeTb1
size TB1
Definition: lte-common.h:245
void SetLteCcmMacSapUser(LteCcmMacSapUser *s)
Set the ComponentCarrierManager SAP user.
Definition: lte-enb-mac.cc:483
virtual void ConfigureMac(uint8_t ulBandwidth, uint8_t dlBandwidth)
Definition: lte-enb-mac.cc:92
uint8_t componentCarrierId
component carrier ID
Definition: lte-common.h:248
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:69
FfMacCschedSapUser * GetFfMacCschedSapUser(void)
Get the control scheduler SAP user.
Definition: lte-enb-mac.cc:438
uint64_t m_eRabGuaranteedBitrateDl
ERAB guaranteed bit rate DL.
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:140
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:452
Parameters for LteMacSapProvider::ReportBufferStatus.
Definition: lte-mac-sap.h:67
std::map< uint8_t, uint32_t > m_receivedRachPreambleCount
received RACH preamble count
Definition: lte-enb-mac.h:451
FfMacCschedSapUser * m_cschedSapUser
the CSched SAP user
Definition: lte-enb-mac.h:394
See section 4.3.4 logicalChannelConfigListElement.
Service Access Point (SAP) offered by the MAC to the RRC See Femto Forum MAC Scheduler Interface Spec...
virtual void UlReceiveMacCe(MacCeListElement_s bsr, uint8_t componentCarrierId)=0
When the Primary Component carrier receive a buffer status report it is sent to the CCM...
uint16_t txQueueHolDelay
the Head Of Line delay of the transmission queue
Definition: lte-mac-sap.h:72
void SetFfMacCschedSapProvider(FfMacCschedSapProvider *s)
Set the control scheduler SAP provider.
Definition: lte-enb-mac.cc:432
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
the ENB Phy SAP provider
Definition: lte-enb-mac.h:397
enum ns3::LogicalChannelConfigListElement_s::Direction_e m_direction
the direction
virtual void CschedLcConfigCnf(const struct CschedLcConfigCnfParameters &params)
CSCHED_LC_CONFIG_CNF.
Definition: lte-enb-mac.cc:228
uint16_t GetRnti(void) const
Get RNTI function.
LteEnbPhySapUser * m_enbPhySapUser
the ENB Phy SAP user
Definition: lte-enb-mac.h:398
FfMacSchedSapUser * GetFfMacSchedSapUser(void)
Get the scheduler SAP user.
Definition: lte-enb-mac.cc:426
make Callback use a separate empty type
Definition: empty.h:33
void DoCschedUeConfigCnf(FfMacCschedSapUser::CschedUeConfigCnfParameters params)
CSched UE Config configure function.
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)
CSCHED_LC_RELEASE_CNF.
Definition: lte-enb-mac.cc:234
EnbMacMemberFfMacSchedSapUser class.
Definition: lte-enb-mac.cc:147
void DoUeUpdateConfigurationReq(LteEnbCmacSapProvider::UeConfig params)
UE Update configuration request function.
Definition: lte-enb-mac.cc:912
Parameters of the SCHED_UL_TRIGGER_REQ primitive.
Hold an unsigned integer type.
Definition: uinteger.h:44
EnbMacMemberLteEnbCmacSapProvider(LteEnbMac *mac)
Constructor.
Definition: lte-enb-mac.cc:86
Logical Channel information to be passed to CmacSapProvider::ConfigureLc.
std::map< uint8_t, uint32_t > m_rapIdRntiMap
RAPID RNTI map.
Definition: lte-enb-mac.h:453
EnbMacMemberFfMacCschedSapUser class.
Definition: lte-enb-mac.cc:187
uint16_t rnti
rnti previously allocated for this non-contention based RA procedure
Definition: lte-enb-mac.h:440
uint8_t m_macChTtiDelay
delay of MAC, PHY and channel in terms of TTIs
Definition: lte-enb-mac.h:425
uint16_t rnti
the C-RNTI identifying the UE
Definition: lte-mac-sap.h:48
void DoCschedLcReleaseCnf(FfMacCschedSapUser::CschedLcReleaseCnfParameters params)
CSched LC Release configure function.
mac
Definition: third.py:92
static TypeId GetTypeId(void)
Get the type ID.
Definition: lte-enb-mac.cc:337
void DoUlCqiReport(FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi)
UL CQI report.
Definition: lte-enb-mac.cc:676
virtual void UlInfoListElementHarqFeeback(UlInfoListElement_s params)
Notify the HARQ on the UL tranmission status.
Definition: lte-enb-mac.cc:319
virtual void SchedDlRachInfoReq(const struct SchedDlRachInfoReqParameters &params)=0
SCHED_DL_RACH_INFO_REQ.
virtual void AddUe(uint16_t rnti)
Add UE function.
Definition: lte-enb-mac.cc:98
uint64_t m_eRabGuaranteedBitrateUl
ERAB guaranteed bit rate UL.
Provides the SCHED SAP.
friend class EnbMacMemberLteEnbCmacSapProvider
allow EnbMacMemberLteEnbCmacSapProvider class friend access
Definition: lte-enb-mac.h:58
virtual void DoDispose(void)
Destructor implementation.
Definition: lte-enb-mac.cc:396
enum ns3::LogicalChannelConfigListElement_s::QosBearerType_e m_qosBearerType
the QOS bearer type
void ReceiveBsrMessage(MacCeListElement_s bsr)
Receive a CE element containing the buffer status report.
Definition: lte-enb-mac.cc:704
uint32_t subframeNo
subframe number
Definition: lte-common.h:242
std::vector< uint8_t > m_logicalChannelIdentity
logical channel identity
virtual void SchedUlConfigInd(const struct SchedUlConfigIndParameters &params)
SCHED_UL_CONFIG_IND.
Definition: lte-enb-mac.cc:180
MemberLteCcmMacSapProvider class.
uint16_t m_rlcRetransmissionHolDelay
RLC retransmission HOL delay.
std::vector< struct CqiListElement_s > m_cqiList
CQI list.
uint8_t m_raResponseWindowSize
RA response window size.
Definition: lte-enb-mac.h:432
#define list
std::vector< struct DlInfoListElement_s > m_dlInfoList
DL info list.
See section 4.3.23 dlInfoListElement.
virtual void CschedCellConfigReq(const struct CschedCellConfigReqParameters &params)=0
CSCHED_CELL_CONFIG_REQ.
BuildRarListElement_s rarPayload
RAR payload.
void DoReceiveRachPreamble(uint8_t prachId)
Receive RACH Preamble function.
Definition: lte-enb-mac.cc:668
void DoRemoveUe(uint16_t rnti)
Remove UE function.
Definition: lte-enb-mac.cc:833
See section 4.3.14 macCEListElement.
Parameters for [re]configuring the UE.
virtual void ReleaseLc(uint16_t rnti, uint8_t lcid)
release an existing logical channel
Definition: lte-enb-mac.cc:122
uint32_t m_subframeNo
subframe number of current subframe indication
Definition: lte-enb-mac.h:410
uint64_t m_eRabMaximulBitrateUl
ERAB maximum bit rate UL.
LteEnbCmacSapProvider::AllocateNcRaPreambleReturnValue DoAllocateNcRaPreamble(uint16_t rnti)
Allocate NC RA preamble function.
Definition: lte-enb-mac.cc:935
uint8_t m_numberOfRaPreambles
number of RA preambles
Definition: lte-enb-mac.h:430
uint8_t numberOfRaPreambles
number of RA preambles
uint8_t GetLayer(void) const
Get layer function.
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)
CSCHED_UE_CONFIG_CNF.
Definition: lte-enb-mac.cc:222
virtual void CschedUeReleaseReq(const struct CschedUeReleaseReqParameters &params)=0
CSCHED_UE_RELEASE_REQ.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t lcGroup
logical channel group
uint64_t m_eRabMaximulBitrateDl
ERAB mqximum bit rate DL.
virtual void CschedUeReleaseCnf(const struct CschedUeReleaseCnfParameters &params)
CSCHED_UE_RELEASE_CNF.
Definition: lte-enb-mac.cc:240
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Definition: packet.cc:121
Parameters of the CSCHED_LC_CONFIG_REQ primitive.
std::vector< enum HarqStatus_e > m_harqStatus
HARQ status.
virtual void CschedCellConfigUpdateInd(const struct CschedCellConfigUpdateIndParameters &params)
CSCHED_UE_CONFIG_IND.
Definition: lte-enb-mac.cc:252
LteEnbCmacSapProvider * GetLteEnbCmacSapProvider(void)
Get the control MAC SAP provider.
Definition: lte-enb-mac.cc:464
Service Access Point (SAP) offered by MAC to the component carrier manager (CCM). ...
uint32_t m_rlcTransmissionQueueSize
RLC transmission queue size.
Parameters for [re]configuring the UE.
uint8_t lcid
the logical channel id corresponding to the sending RLC instance
Definition: lte-mac-sap.h:70
std::vector< UlInfoListElement_s > m_ulInfoListReceived
UL HARQ feedback received.
Definition: lte-enb-mac.h:375
uint32_t txQueueSize
the current size of the RLC transmission queue
Definition: lte-mac-sap.h:71
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:249
EnbMacMemberLteEnbPhySapUser(LteEnbMac *mac)
Constructor.
Definition: lte-enb-mac.cc:283
See section 4.3.6 rachListElement.
LteMacSapProvider * m_macSapProvider
the MAC SAP provider
Definition: lte-enb-mac.h:385
std::vector< CqiListElement_s > m_dlCqiReceived
DL-CQI received.
Definition: lte-enb-mac.h:369
virtual void CschedCellConfigCnf(const struct CschedCellConfigCnfParameters &params)
CSCHED_CELL_CONFIG_CNF.
Definition: lte-enb-mac.cc:216
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
virtual void UeUpdateConfigurationReq(UeConfig params)
update the configuration of the UE
Definition: lte-enb-mac.cc:128
uint8_t m_harqProcessId
HARQ process ID.
FfMacCschedSapUser class.
virtual void SchedUlCqiInfoReq(const struct SchedUlCqiInfoReqParameters &params)=0
SCHED_UL_CQI_INFO_REQ.
uint16_t rnti
C-RNTI identifying the UE.
LteCcmMacSapUser * m_ccmMacSapUser
CCM MAC SAP user.
Definition: lte-enb-mac.h:402
std::vector< MacCeListElement_s > m_ulCeReceived
CE received (BSR up to now)
Definition: lte-enb-mac.h:371
Parameters of the SCHED_DL_CQI_INFO_REQ primitive.
std::vector< struct MacCeListElement_s > m_macCeList
MAC CE list.
virtual void SchedUlMacCtrlInfoReq(const struct SchedUlMacCtrlInfoReqParameters &params)=0
SCHED_UL_MAC_CTRL_INFO_REQ.
std::vector< std::vector< Ptr< PacketBurst > > > DlHarqProcessesBuffer_t
DlHarqProcessesBuffer_t typedef.
Definition: lte-enb-mac.h:47
uint64_t mbrUl
maximum bitrate in uplink
void DoCschedUeReleaseCnf(FfMacCschedSapUser::CschedUeReleaseCnfParameters params)
CSched UE Release configure function.
std::vector< struct RachListElement_s > m_rachList
RACH list.
EnbMacMemberLteEnbCmacSapProvider class.
Definition: lte-enb-mac.cc:59
std::vector< DlInfoListElement_s > m_dlInfoListReceived
DL HARQ feedback received.
Definition: lte-enb-mac.h:373
void SetLteEnbPhySapProvider(LteEnbPhySapProvider *s)
Set the PHY SAP Provider.
Definition: lte-enb-mac.cc:470
LteEnbCmacSapUser * m_cmacSapUser
the CMAC SAP user
Definition: lte-enb-mac.h:388
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:295
uint16_t statusPduSize
the current size of the pending STATUS RLC PDU message in bytes
Definition: lte-mac-sap.h:75
uint8_t GetLcid(void) const
Get LCID function.
Parameters of the SCHED_UL_CQI_INFO_REQ primitive.
LteEnbPhySapUser * GetLteEnbPhySapUser()
Get the eNB-PHY SAP User.
Definition: lte-enb-mac.cc:477
void AddPacketTag(const Tag &tag) const
Add a packet tag.
Definition: packet.cc:852
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition: lte-mac-sap.h:95
struct defining the RACH configuration of the MAC
FfMacSchedSapProvider * m_schedSapProvider
the Sched SAP provider
Definition: lte-enb-mac.h:391
LteFlowId structure.
Definition: lte-common.h:36
void DoReportBufferStatus(LteMacSapProvider::ReportBufferStatusParameters params)
Report Buffer Status function.
Definition: lte-enb-mac.cc:997
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
Definition: packet.cc:859
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:270
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:289
LteCcmMacSapProvider * m_ccmMacSapProvider
CCM MAC SAP provider.
Definition: lte-enb-mac.h:401
void DoCschedUeConfigUpdateInd(FfMacCschedSapUser::CschedUeConfigUpdateIndParameters params)
CSched UE Config Update Indication function.
LteMacSapUser * m_macSapUser
the MAC SAP user
Definition: lte-enb-mac.h:387
void DoSchedDlConfigInd(FfMacSchedSapUser::SchedDlConfigIndParameters ind)
Sched DL Config Indication function.
uint16_t retxQueueHolDelay
the Head Of Line delay of the retransmission queue
Definition: lte-mac-sap.h:74
virtual void CschedLcConfigReq(const struct CschedLcConfigReqParameters &params)=0
CSCHED_LC_CONFIG_REQ.
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.
uint16_t m_estimatedSize
estimated size
TracedCallback< DlSchedulingCallbackInfo > m_dlScheduling
Trace information regarding DL scheduling Frame number, Subframe number, RNTI, MCS of TB1...
Definition: lte-enb-mac.h:416
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:446
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:301
uint32_t m_frameNo
frame number of current subframe indication
Definition: lte-enb-mac.h:406
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Definition: log.h:254
Parameters of the SCHED_DL_RACH_INFO_REQ primitive.
void DoCschedLcConfigCnf(FfMacCschedSapUser::CschedLcConfigCnfParameters params)
CSched LC Config configure function.
Parameters of the SCHED_UL_CONFIG_IND primitive.
virtual void SchedDlCqiInfoReq(const struct SchedDlCqiInfoReqParameters &params)=0
SCHED_DL_CQI_INFO_REQ.
void DoReceiveLteControlMessage(Ptr< LteControlMessage > msg)
Receive a DL CQI ideal control message.
Definition: lte-enb-mac.cc:643
A base class which provides memory management and object aggregation.
Definition: object.h:87
uint16_t m_rlcTransmissionQueueHolDelay
RLC transmission queue HOL delay.
virtual void CschedUeConfigUpdateInd(const struct CschedUeConfigUpdateIndParameters &params)
CSCHED_UE_UPDATE_IND.
Definition: lte-enb-mac.cc:246
friend class EnbMacMemberLteEnbPhySapUser
allow EnbMacMemberLteEnbPhySapUser class friend access
Definition: lte-enb-mac.h:66
DlSchedulingCallbackInfo structure.
Definition: lte-common.h:239
Parameters of the CSCHED_UE_CONFIG_REQ primitive.
std::map< uint8_t, NcRaPreambleInfo > m_allocatedNcRaPreambleMap
map storing as key the random access preamble IDs allocated for non-contention based access...
Definition: lte-enb-mac.h:449
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:390
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
allow EnbMacMemberFfMacSchedSapUser class friend access
Definition: lte-enb-mac.h:62
virtual void DlInfoListElementHarqFeeback(DlInfoListElement_s params)
Notify the HARQ on the DL tranmission status.
Definition: lte-enb-mac.cc:325
std::vector< struct BuildRarListElement_s > m_buildRarList
build rar list
std::map< uint16_t, DlHarqProcessesBuffer_t > m_miDlHarqProcessesPackets
Packet under transmission of the DL HARQ process.
Definition: lte-enb-mac.h:428
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:438
a unique identifier for an interface.
Definition: type-id.h:58
void DoSubframeIndication(uint32_t frameNo, uint32_t subframeNo)
Subrame Indication function.
Definition: lte-enb-mac.cc:496
EnbMacMemberFfMacSchedSapUser(LteEnbMac *mac)
Constructor.
Definition: lte-enb-mac.cc:165
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:915
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:55
FfMacSchedSapUser class.
Parameters of the CSCHED_UE_RELEASE_CNF primitive.
void SetFfMacSchedSapProvider(FfMacSchedSapProvider *s)
Set the scheduler SAP provider.
Definition: lte-enb-mac.cc:420
virtual void RemoveUe(uint16_t rnti)
remove the UE, e.g., after handover or termination of the RRC connection
Definition: lte-enb-mac.cc:104
FfMacCschedSapProvider * m_cschedSapProvider
the Csched SAP provider
Definition: lte-enb-mac.h:392
bool isGbr
true if the bearer is GBR, false if the bearer is NON-GBR
std::vector< struct BuildDataListElement_s > m_buildDataList
build data list
virtual void CschedLcReleaseReq(const struct CschedLcReleaseReqParameters &params)=0
CSCHED_LC_RELEASE_REQ.
#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:441
void ReceiveDlCqiLteControlMessage(Ptr< DlCqiLteControlMessage > msg)
Receive a DL CQI ideal control message.
Definition: lte-enb-mac.cc:691
void DoCschedCellConfigCnf(FfMacCschedSapUser::CschedCellConfigCnfParameters params)
CSched Cell Config configure function.
uint8_t m_logicalChannelGroup
logical channel group
Parameters for LteMacSapProvider::TransmitPdu.
Definition: lte-mac-sap.h:45