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