A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lte-enb-mac.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Marco Miozzo <marco.miozzo@cttc.es>
18 * Nicola Baldo <nbaldo@cttc.es>
19 * Modified by:
20 * Danilo Abrignani <danilo.abrignani@unibo.it> (Carrier Aggregation - GSoC 2015)
21 * Biljana Bojovic <biljana.bojovic@cttc.es> (Carrier Aggregation)
22 */
23
24#include "lte-enb-mac.h"
25
26#include "lte-common.h"
28#include "lte-enb-cmac-sap.h"
29#include "lte-mac-sap.h"
31
32#include <ns3/log.h>
33#include <ns3/packet.h>
34#include <ns3/pointer.h>
35#include <ns3/simulator.h>
36
37namespace ns3
38{
39
40NS_LOG_COMPONENT_DEFINE("LteEnbMac");
41
43
44// //////////////////////////////////////
45// member SAP forwarders
46// //////////////////////////////////////
47
48/// EnbMacMemberLteEnbCmacSapProvider class
50{
51 public:
52 /**
53 * Constructor
54 *
55 * \param mac the MAC
56 */
58
59 // inherited from LteEnbCmacSapProvider
60 void ConfigureMac(uint16_t ulBandwidth, uint16_t dlBandwidth) override;
61 void AddUe(uint16_t rnti) override;
62 void RemoveUe(uint16_t rnti) override;
63 void AddLc(LcInfo lcinfo, LteMacSapUser* msu) override;
64 void ReconfigureLc(LcInfo lcinfo) override;
65 void ReleaseLc(uint16_t rnti, uint8_t lcid) override;
66 void UeUpdateConfigurationReq(UeConfig params) override;
67 RachConfig GetRachConfig() override;
69
70 private:
71 LteEnbMac* m_mac; ///< the MAC
72};
73
75 : m_mac(mac)
76{
77}
78
79void
80EnbMacMemberLteEnbCmacSapProvider::ConfigureMac(uint16_t ulBandwidth, uint16_t dlBandwidth)
81{
82 m_mac->DoConfigureMac(ulBandwidth, dlBandwidth);
83}
84
85void
87{
88 m_mac->DoAddUe(rnti);
89}
90
91void
93{
94 m_mac->DoRemoveUe(rnti);
95}
96
97void
99{
100 m_mac->DoAddLc(lcinfo, msu);
101}
102
103void
105{
106 m_mac->DoReconfigureLc(lcinfo);
107}
108
109void
111{
112 m_mac->DoReleaseLc(rnti, lcid);
113}
114
115void
117{
119}
120
123{
124 return m_mac->DoGetRachConfig();
125}
126
129{
130 return m_mac->DoAllocateNcRaPreamble(rnti);
131}
132
133/// EnbMacMemberFfMacSchedSapUser class
135{
136 public:
137 /**
138 * Constructor
139 *
140 * \param mac the MAC
141 */
143
144 void SchedDlConfigInd(const SchedDlConfigIndParameters& params) override;
145 void SchedUlConfigInd(const SchedUlConfigIndParameters& params) override;
146
147 private:
148 LteEnbMac* m_mac; ///< the MAC
149};
150
152 : m_mac(mac)
153{
154}
155
156void
158{
159 m_mac->DoSchedDlConfigInd(params);
160}
161
162void
164{
165 m_mac->DoSchedUlConfigInd(params);
166}
167
168/// EnbMacMemberFfMacCschedSapUser class
170{
171 public:
172 /**
173 * Constructor
174 *
175 * \param mac the MAC
176 */
178
179 void CschedCellConfigCnf(const CschedCellConfigCnfParameters& params) override;
180 void CschedUeConfigCnf(const CschedUeConfigCnfParameters& params) override;
181 void CschedLcConfigCnf(const CschedLcConfigCnfParameters& params) override;
182 void CschedLcReleaseCnf(const CschedLcReleaseCnfParameters& params) override;
183 void CschedUeReleaseCnf(const CschedUeReleaseCnfParameters& params) override;
186
187 private:
188 LteEnbMac* m_mac; ///< the MAC
189};
190
192 : m_mac(mac)
193{
194}
195
196void
198{
200}
201
202void
204{
205 m_mac->DoCschedUeConfigCnf(params);
206}
207
208void
210{
211 m_mac->DoCschedLcConfigCnf(params);
212}
213
214void
216{
218}
219
220void
222{
224}
225
226void
229{
231}
232
233void
236{
238}
239
240/// ---------- PHY-SAP
242{
243 public:
244 /**
245 * Constructor
246 *
247 * \param mac the MAC
248 */
250
251 // inherited from LteEnbPhySapUser
252 void ReceivePhyPdu(Ptr<Packet> p) override;
253 void SubframeIndication(uint32_t frameNo, uint32_t subframeNo) override;
255 void ReceiveRachPreamble(uint32_t prachId) override;
259
260 private:
261 LteEnbMac* m_mac; ///< the MAC
262};
263
265 : m_mac(mac)
266{
267}
268
269void
271{
273}
274
275void
277{
278 m_mac->DoSubframeIndication(frameNo, subframeNo);
279}
280
281void
283{
285}
286
287void
289{
291}
292
293void
295{
296 m_mac->DoUlCqiReport(ulcqi);
297}
298
299void
301{
303}
304
305void
307{
309}
310
311// //////////////////////////////////////
312// generic LteEnbMac methods
313// //////////////////////////////////////
314
315TypeId
317{
318 static TypeId tid =
319 TypeId("ns3::LteEnbMac")
320 .SetParent<Object>()
321 .SetGroupName("Lte")
322 .AddConstructor<LteEnbMac>()
323 .AddAttribute("NumberOfRaPreambles",
324 "how many random access preambles are available for the contention based "
325 "RACH process",
326 UintegerValue(52),
328 MakeUintegerChecker<uint8_t>(4, 64))
329 .AddAttribute("PreambleTransMax",
330 "Maximum number of random access preamble transmissions",
331 UintegerValue(50),
333 MakeUintegerChecker<uint8_t>(3, 200))
334 .AddAttribute("RaResponseWindowSize",
335 "length of the window (in TTIs) for the reception of the random access "
336 "response (RAR); the resulting RAR timeout is this value + 3 ms",
337 UintegerValue(3),
339 MakeUintegerChecker<uint8_t>(2, 10))
340 .AddAttribute("ConnEstFailCount",
341 "how many time T300 timer can expire on the same cell",
342 UintegerValue(1),
344 MakeUintegerChecker<uint8_t>(1, 4))
345 .AddTraceSource("DlScheduling",
346 "Information regarding DL scheduling.",
348 "ns3::LteEnbMac::DlSchedulingTracedCallback")
349 .AddTraceSource("UlScheduling",
350 "Information regarding UL scheduling.",
352 "ns3::LteEnbMac::UlSchedulingTracedCallback")
353 .AddAttribute("ComponentCarrierId",
354 "ComponentCarrier Id, needed to reply on the appropriate sap.",
355 UintegerValue(0),
357 MakeUintegerChecker<uint8_t>(0, 4));
358
359 return tid;
360}
361
363 : m_ccmMacSapUser(nullptr)
364{
365 NS_LOG_FUNCTION(this);
372}
373
375{
376 NS_LOG_FUNCTION(this);
377}
378
379void
381{
382 NS_LOG_FUNCTION(this);
383 m_dlCqiReceived.clear();
384 m_ulCqiReceived.clear();
385 m_ulCeReceived.clear();
386 m_dlInfoListReceived.clear();
387 m_ulInfoListReceived.clear();
389 delete m_macSapProvider;
390 delete m_cmacSapProvider;
391 delete m_schedSapUser;
392 delete m_cschedSapUser;
393 delete m_enbPhySapUser;
394 delete m_ccmMacSapProvider;
395}
396
397void
399{
400 m_componentCarrierId = index;
401}
402
403void
405{
407}
408
411{
412 return m_schedSapUser;
413}
414
415void
417{
419}
420
423{
424 return m_cschedSapUser;
425}
426
427void
429{
430 m_macSapUser = s;
431}
432
435{
436 return m_macSapProvider;
437}
438
439void
441{
442 m_cmacSapUser = s;
443}
444
447{
448 return m_cmacSapProvider;
449}
450
451void
453{
455}
456
459{
460 return m_enbPhySapUser;
461}
462
463void
465{
466 m_ccmMacSapUser = s;
467}
468
471{
472 return m_ccmMacSapProvider;
473}
474
475void
477{
478 NS_LOG_FUNCTION(this << " EnbMac - frame " << frameNo << " subframe " << subframeNo);
479
480 // Store current frame / subframe number
481 m_frameNo = frameNo;
482 m_subframeNo = subframeNo;
483
484 // --- DOWNLINK ---
485 // Send Dl-CQI info to the scheduler
486 if (!m_dlCqiReceived.empty())
487 {
489 dlcqiInfoReq.m_sfnSf = ((0x3FF & frameNo) << 4) | (0xF & subframeNo);
490 dlcqiInfoReq.m_cqiList.insert(dlcqiInfoReq.m_cqiList.begin(),
491 m_dlCqiReceived.begin(),
492 m_dlCqiReceived.end());
493 m_dlCqiReceived.erase(m_dlCqiReceived.begin(), m_dlCqiReceived.end());
495 }
496
497 if (!m_receivedRachPreambleCount.empty())
498 {
499 // process received RACH preambles and notify the scheduler
501 NS_ASSERT(subframeNo > 0 && subframeNo <= 10); // subframe in 1..10
502 for (auto it = m_receivedRachPreambleCount.begin(); it != m_receivedRachPreambleCount.end();
503 ++it)
504 {
505 NS_LOG_INFO(this << " preambleId " << (uint32_t)it->first << ": " << it->second
506 << " received");
507 NS_ASSERT(it->second != 0);
508 if (it->second > 1)
509 {
510 NS_LOG_INFO("preambleId " << (uint32_t)it->first << ": collision");
511 // in case of collision we assume that no preamble is
512 // successfully received, hence no RAR is sent
513 }
514 else
515 {
516 uint16_t rnti;
517 auto jt = m_allocatedNcRaPreambleMap.find(it->first);
518 if (jt != m_allocatedNcRaPreambleMap.end())
519 {
520 rnti = jt->second.rnti;
521 NS_LOG_INFO("preambleId previously allocated for NC based RA, RNTI ="
522 << (uint32_t)rnti << ", sending RAR");
523 }
524 else
525 {
527
528 if (rnti == 0)
529 {
530 // If rnti = 0, UE context was not created (not enough SRS)
531 // Therefore don't send RAR for this preamble
532 NS_LOG_INFO("UE context not created, no RAR to send");
533 continue;
534 }
535 NS_LOG_INFO("preambleId " << (uint32_t)it->first << ": allocated T-C-RNTI "
536 << (uint32_t)rnti << ", sending RAR");
537 }
538
539 RachListElement_s rachLe;
540 rachLe.m_rnti = rnti;
541 rachLe.m_estimatedSize = 144; // to be confirmed
542 rachInfoReqParams.m_rachList.push_back(rachLe);
543 m_rapIdRntiMap.insert(std::pair<uint16_t, uint32_t>(rnti, it->first));
544 }
545 }
546 m_schedSapProvider->SchedDlRachInfoReq(rachInfoReqParams);
548 }
549 // Get downlink transmission opportunities
550 uint32_t dlSchedFrameNo = m_frameNo;
551 uint32_t dlSchedSubframeNo = m_subframeNo;
552 // NS_LOG_DEBUG (this << " sfn " << frameNo << " sbfn " << subframeNo);
553 if (dlSchedSubframeNo + m_macChTtiDelay > 10)
554 {
555 dlSchedFrameNo++;
556 dlSchedSubframeNo = (dlSchedSubframeNo + m_macChTtiDelay) % 10;
557 }
558 else
559 {
560 dlSchedSubframeNo = dlSchedSubframeNo + m_macChTtiDelay;
561 }
563 dlparams.m_sfnSf = ((0x3FF & dlSchedFrameNo) << 4) | (0xF & dlSchedSubframeNo);
564
565 // Forward DL HARQ Feedbacks collected during last TTI
566 if (!m_dlInfoListReceived.empty())
567 {
569 // empty local buffer
570 m_dlInfoListReceived.clear();
571 }
572
574
575 // --- UPLINK ---
576 // Send UL-CQI info to the scheduler
577 for (std::size_t i = 0; i < m_ulCqiReceived.size(); i++)
578 {
579 if (subframeNo > 1)
580 {
581 m_ulCqiReceived.at(i).m_sfnSf = ((0x3FF & frameNo) << 4) | (0xF & (subframeNo - 1));
582 }
583 else
584 {
585 m_ulCqiReceived.at(i).m_sfnSf = ((0x3FF & (frameNo - 1)) << 4) | (0xF & 10);
586 }
588 }
589 m_ulCqiReceived.clear();
590
591 // Send BSR reports to the scheduler
592 if (!m_ulCeReceived.empty())
593 {
595 ulMacReq.m_sfnSf = ((0x3FF & frameNo) << 4) | (0xF & subframeNo);
596 ulMacReq.m_macCeList.insert(ulMacReq.m_macCeList.begin(),
597 m_ulCeReceived.begin(),
598 m_ulCeReceived.end());
599 m_ulCeReceived.erase(m_ulCeReceived.begin(), m_ulCeReceived.end());
601 }
602
603 // Get uplink transmission opportunities
604 uint32_t ulSchedFrameNo = m_frameNo;
605 uint32_t ulSchedSubframeNo = m_subframeNo;
606 // NS_LOG_DEBUG (this << " sfn " << frameNo << " sbfn " << subframeNo);
607 if (ulSchedSubframeNo + (m_macChTtiDelay + UL_PUSCH_TTIS_DELAY) > 10)
608 {
609 ulSchedFrameNo++;
610 ulSchedSubframeNo = (ulSchedSubframeNo + (m_macChTtiDelay + UL_PUSCH_TTIS_DELAY)) % 10;
611 }
612 else
613 {
614 ulSchedSubframeNo = ulSchedSubframeNo + (m_macChTtiDelay + UL_PUSCH_TTIS_DELAY);
615 }
617 ulparams.m_sfnSf = ((0x3FF & ulSchedFrameNo) << 4) | (0xF & ulSchedSubframeNo);
618
619 // Forward DL HARQ Feedbacks collected during last TTI
620 if (!m_ulInfoListReceived.empty())
621 {
623 // empty local buffer
624 m_ulInfoListReceived.clear();
625 }
626
628}
629
630void
632{
633 NS_LOG_FUNCTION(this << msg);
634 if (msg->GetMessageType() == LteControlMessage::DL_CQI)
635 {
636 Ptr<DlCqiLteControlMessage> dlcqi = DynamicCast<DlCqiLteControlMessage>(msg);
638 }
639 else if (msg->GetMessageType() == LteControlMessage::BSR)
640 {
641 Ptr<BsrLteControlMessage> bsr = DynamicCast<BsrLteControlMessage>(msg);
642 ReceiveBsrMessage(bsr->GetBsr());
643 }
644 else if (msg->GetMessageType() == LteControlMessage::DL_HARQ)
645 {
647 DynamicCast<DlHarqFeedbackLteControlMessage>(msg);
648 DoDlInfoListElementHarqFeedback(dlharq->GetDlHarqFeedback());
649 }
650 else
651 {
652 NS_LOG_LOGIC(this << " LteControlMessage type " << msg->GetMessageType()
653 << " not recognized");
654 }
655}
656
657void
659{
660 NS_LOG_FUNCTION(this << (uint32_t)rapId);
661 // just record that the preamble has been received; it will be processed later
662 ++m_receivedRachPreambleCount[rapId]; // will create entry if not exists
663}
664
665void
667{
668 if (ulcqi.m_ulCqi.m_type == UlCqi_s::PUSCH)
669 {
670 NS_LOG_DEBUG(this << " eNB rxed an PUSCH UL-CQI");
671 }
672 else if (ulcqi.m_ulCqi.m_type == UlCqi_s::SRS)
673 {
674 NS_LOG_DEBUG(this << " eNB rxed an SRS UL-CQI");
675 }
676 m_ulCqiReceived.push_back(ulcqi);
677}
678
679void
681{
682 NS_LOG_FUNCTION(this << msg);
683
684 CqiListElement_s dlcqi = msg->GetDlCqi();
685 NS_LOG_LOGIC(this << "Enb Received DL-CQI rnti" << dlcqi.m_rnti);
686 NS_ASSERT(dlcqi.m_rnti != 0);
687 m_dlCqiReceived.push_back(dlcqi);
688}
689
690void
692{
693 NS_LOG_FUNCTION(this);
695}
696
697void
699{
700 NS_LOG_FUNCTION(this);
701 NS_LOG_DEBUG(this << " bsr Size " << (uint16_t)m_ulCeReceived.size());
702 // send to LteCcmMacSapUser
703 m_ulCeReceived.push_back(
704 bsr); // this to called when LteUlCcmSapProvider::ReportMacCeToScheduler is called
705 NS_LOG_DEBUG(this << " bsr Size after push_back " << (uint16_t)m_ulCeReceived.size());
706}
707
708void
710{
711 NS_LOG_FUNCTION(this);
713 p->RemovePacketTag(tag);
714
715 // store info of the packet received
716
717 // u_int rnti = tag.GetRnti ();
718 // u_int lcid = tag.GetLcid ();
719 // auto it = m_ulInfoListElements.find (tag.GetRnti ());
720 // if (it == m_ulInfoListElements.end ())
721 // {
722 // // new RNTI
723 // UlInfoListElement_s ulinfonew;
724 // ulinfonew.m_rnti = tag.GetRnti ();
725 // // always allocate full size of ulReception vector, initializing all elements to 0
726 // ulinfonew.m_ulReception.assign (MAX_LC_LIST+1, 0);
727 // // set the element for the current LCID
728 // ulinfonew.m_ulReception.at (tag.GetLcid ()) = p->GetSize ();
729 // ulinfonew.m_receptionStatus = UlInfoListElement_s::Ok;
730 // ulinfonew.m_tpc = 0; // Tx power control not implemented at this stage
731 // m_ulInfoListElements.insert (std::pair<uint16_t, UlInfoListElement_s > (tag.GetRnti (),
732 // ulinfonew));
733 //
734 // }
735 // else
736 // {
737 // // existing RNTI: we just set the value for the current
738 // // LCID. Note that the corresponding element had already been
739 // // allocated previously.
740 // NS_ASSERT_MSG ((*it).second.m_ulReception.at (tag.GetLcid ()) == 0, "would overwrite
741 // previously written ulReception element");
742 // (*it).second.m_ulReception.at (tag.GetLcid ()) = p->GetSize ();
743 // (*it).second.m_receptionStatus = UlInfoListElement_s::Ok;
744 // }
745
746 // forward the packet to the correspondent RLC
747 uint16_t rnti = tag.GetRnti();
748 uint8_t lcid = tag.GetLcid();
749 auto rntiIt = m_rlcAttached.find(rnti);
750 NS_ASSERT_MSG(rntiIt != m_rlcAttached.end(), "could not find RNTI" << rnti);
751 auto lcidIt = rntiIt->second.find(lcid);
752 // NS_ASSERT_MSG (lcidIt != rntiIt->second.end (), "could not find LCID" << lcid);
753
755 rxPduParams.p = p;
756 rxPduParams.rnti = rnti;
757 rxPduParams.lcid = lcid;
758
759 // Receive PDU only if LCID is found
760 if (lcidIt != rntiIt->second.end())
761 {
762 (*lcidIt).second->ReceivePdu(rxPduParams);
763 }
764}
765
766// ////////////////////////////////////////////
767// CMAC SAP
768// ////////////////////////////////////////////
769
770void
771LteEnbMac::DoConfigureMac(uint16_t ulBandwidth, uint16_t dlBandwidth)
772{
773 NS_LOG_FUNCTION(this << " ulBandwidth=" << ulBandwidth << " dlBandwidth=" << dlBandwidth);
775 // Configure the subset of parameters used by FfMacScheduler
776 params.m_ulBandwidth = ulBandwidth;
777 params.m_dlBandwidth = dlBandwidth;
779 // ...more parameters can be configured
781}
782
783void
784LteEnbMac::DoAddUe(uint16_t rnti)
785{
786 NS_LOG_FUNCTION(this << " rnti=" << rnti);
787 std::map<uint8_t, LteMacSapUser*> empty;
788 auto ret =
789 m_rlcAttached.insert(std::pair<uint16_t, std::map<uint8_t, LteMacSapUser*>>(rnti, empty));
790 NS_ASSERT_MSG(ret.second, "element already present, RNTI already existed");
791
793 params.m_rnti = rnti;
794 params.m_transmissionMode =
795 0; // set to default value (SISO) for avoiding random initialization (valgrind error)
796
798
799 // Create DL transmission HARQ buffers
800 std::vector<Ptr<PacketBurst>> dlHarqLayer0pkt;
801 dlHarqLayer0pkt.resize(8);
802 for (uint8_t i = 0; i < 8; i++)
803 {
804 Ptr<PacketBurst> pb = CreateObject<PacketBurst>();
805 dlHarqLayer0pkt.at(i) = pb;
806 }
807 std::vector<Ptr<PacketBurst>> dlHarqLayer1pkt;
808 dlHarqLayer1pkt.resize(8);
809 for (uint8_t i = 0; i < 8; i++)
810 {
811 Ptr<PacketBurst> pb = CreateObject<PacketBurst>();
812 dlHarqLayer1pkt.at(i) = pb;
813 }
815 buf.push_back(dlHarqLayer0pkt);
816 buf.push_back(dlHarqLayer1pkt);
817 m_miDlHarqProcessesPackets.insert(std::pair<uint16_t, DlHarqProcessesBuffer_t>(rnti, buf));
818}
819
820void
822{
823 NS_LOG_FUNCTION(this << " rnti=" << rnti);
825 params.m_rnti = rnti;
827 m_rlcAttached.erase(rnti);
828 m_miDlHarqProcessesPackets.erase(rnti);
829
830 NS_LOG_DEBUG("start checking for unprocessed preamble for rnti: " << rnti);
831 // remove unprocessed preamble received for RACH during handover
832 auto jt = m_allocatedNcRaPreambleMap.begin();
833 while (jt != m_allocatedNcRaPreambleMap.end())
834 {
835 if (jt->second.rnti == rnti)
836 {
837 auto it = m_receivedRachPreambleCount.find(jt->first);
838 if (it != m_receivedRachPreambleCount.end())
839 {
840 m_receivedRachPreambleCount.erase(it->first);
841 }
842 jt = m_allocatedNcRaPreambleMap.erase(jt);
843 }
844 else
845 {
846 ++jt;
847 }
848 }
849
850 auto itCeRxd = m_ulCeReceived.begin();
851 while (itCeRxd != m_ulCeReceived.end())
852 {
853 if (itCeRxd->m_rnti == rnti)
854 {
855 itCeRxd = m_ulCeReceived.erase(itCeRxd);
856 }
857 else
858 {
859 itCeRxd++;
860 }
861 }
862}
863
864void
866{
867 NS_LOG_FUNCTION(this << lcinfo.rnti << (uint16_t)lcinfo.lcId);
868
869 LteFlowId_t flow(lcinfo.rnti, lcinfo.lcId);
870
871 auto rntiIt = m_rlcAttached.find(lcinfo.rnti);
872 NS_ASSERT_MSG(rntiIt != m_rlcAttached.end(), "RNTI not found");
873 auto lcidIt = rntiIt->second.find(lcinfo.lcId);
874 if (lcidIt == rntiIt->second.end())
875 {
876 rntiIt->second.insert(std::pair<uint8_t, LteMacSapUser*>(lcinfo.lcId, msu));
877 }
878 else
879 {
880 NS_LOG_ERROR("LC already exists");
881 }
882
883 // CCCH (LCID 0) is pre-configured
884 // see FF LTE MAC Scheduler
885 // Interface Specification v1.11,
886 // 4.3.4 logicalChannelConfigListElement
887 if (lcinfo.lcId != 0)
888 {
890 params.m_rnti = lcinfo.rnti;
891 params.m_reconfigureFlag = false;
892
894 lccle.m_logicalChannelIdentity = lcinfo.lcId;
895 lccle.m_logicalChannelGroup = lcinfo.lcGroup;
897 lccle.m_qci = lcinfo.qci;
898 lccle.m_eRabMaximulBitrateUl = lcinfo.mbrUl;
899 lccle.m_eRabMaximulBitrateDl = lcinfo.mbrDl;
900 lccle.m_eRabGuaranteedBitrateUl = lcinfo.gbrUl;
901 lccle.m_eRabGuaranteedBitrateDl = lcinfo.gbrDl;
902 lccle.m_qosBearerType =
904
905 params.m_logicalChannelConfigList.push_back(lccle);
906
908 }
909}
910
911void
913{
914 NS_FATAL_ERROR("not implemented");
915}
916
917void
918LteEnbMac::DoReleaseLc(uint16_t rnti, uint8_t lcid)
919{
920 NS_LOG_FUNCTION(this);
921
922 // Find user based on rnti and then erase lcid stored against the same
923 auto rntiIt = m_rlcAttached.find(rnti);
924 rntiIt->second.erase(lcid);
925
927 params.m_rnti = rnti;
928 params.m_logicalChannelIdentity.push_back(lcid);
930}
931
932void
934{
935 NS_LOG_FUNCTION(this);
936
937 // propagates to scheduler
939 req.m_rnti = params.m_rnti;
940 req.m_transmissionMode = params.m_transmissionMode;
941 req.m_reconfigureFlag = true;
943}
944
947{
949 rc.numberOfRaPreambles = m_numberOfRaPreambles;
950 rc.preambleTransMax = m_preambleTransMax;
951 rc.raResponseWindowSize = m_raResponseWindowSize;
952 rc.connEstFailCount = m_connEstFailCount;
953 return rc;
954}
955
958{
959 bool found = false;
960 uint8_t preambleId;
961 for (preambleId = m_numberOfRaPreambles; preambleId < 64; ++preambleId)
962 {
963 auto it = m_allocatedNcRaPreambleMap.find(preambleId);
964 /**
965 * Allocate preamble only if its free. The non-contention preamble
966 * assigned to UE during handover or PDCCH order is valid only until the
967 * time duration of the “expiryTime” of the preamble is reached. This
968 * timer value is only maintained at the eNodeB and the UE has no way of
969 * knowing if this timer has expired. If the UE tries to send the preamble
970 * again after the expiryTime and the preamble is re-assigned to another
971 * UE, it results in errors. This has been solved by re-assigning the
972 * preamble to another UE only if it is not being used (An UE can be using
973 * the preamble even after the expiryTime duration).
974 */
975 if ((it != m_allocatedNcRaPreambleMap.end()) && (it->second.expiryTime < Simulator::Now()))
976 {
977 if (!m_cmacSapUser->IsRandomAccessCompleted(it->second.rnti))
978 {
979 // random access of the UE is not completed,
980 // check other preambles
981 continue;
982 }
983 }
984 if ((it == m_allocatedNcRaPreambleMap.end()) || (it->second.expiryTime < Simulator::Now()))
985 {
986 found = true;
987 NcRaPreambleInfo preambleInfo;
988 uint32_t expiryIntervalMs =
990
991 preambleInfo.expiryTime = Simulator::Now() + MilliSeconds(expiryIntervalMs);
992 preambleInfo.rnti = rnti;
993 NS_LOG_INFO("allocated preamble for NC based RA: preamble "
994 << preambleId << ", RNTI " << preambleInfo.rnti << ", exiryTime "
995 << preambleInfo.expiryTime);
996 m_allocatedNcRaPreambleMap[preambleId] =
997 preambleInfo; // create if not exist, update otherwise
998 break;
999 }
1000 }
1002 if (found)
1003 {
1004 ret.valid = true;
1005 ret.raPreambleId = preambleId;
1006 ret.raPrachMaskIndex = 0;
1007 }
1008 else
1009 {
1010 ret.valid = false;
1011 ret.raPreambleId = 0;
1012 ret.raPrachMaskIndex = 0;
1013 }
1014 return ret;
1015}
1016
1017// ////////////////////////////////////////////
1018// MAC SAP
1019// ////////////////////////////////////////////
1020
1021void
1023{
1024 NS_LOG_FUNCTION(this);
1025 LteRadioBearerTag tag(params.rnti, params.lcid, params.layer);
1026 params.pdu->AddPacketTag(tag);
1027 params.componentCarrierId = m_componentCarrierId;
1028 // Store pkt in HARQ buffer
1029 auto it = m_miDlHarqProcessesPackets.find(params.rnti);
1031 NS_LOG_DEBUG(this << " LAYER " << (uint16_t)tag.GetLayer() << " HARQ ID "
1032 << (uint16_t)params.harqProcessId);
1033
1034 //(*it).second.at (params.layer).at (params.harqProcessId) = params.pdu;//->Copy ();
1035 (*it).second.at(params.layer).at(params.harqProcessId)->AddPacket(params.pdu);
1036 m_enbPhySapProvider->SendMacPdu(params.pdu);
1037}
1038
1039void
1041{
1042 NS_LOG_FUNCTION(this);
1044 req.m_rnti = params.rnti;
1045 req.m_logicalChannelIdentity = params.lcid;
1046 req.m_rlcTransmissionQueueSize = params.txQueueSize;
1047 req.m_rlcTransmissionQueueHolDelay = params.txQueueHolDelay;
1048 req.m_rlcRetransmissionQueueSize = params.retxQueueSize;
1049 req.m_rlcRetransmissionHolDelay = params.retxQueueHolDelay;
1050 req.m_rlcStatusPduSize = params.statusPduSize;
1052}
1053
1054// ////////////////////////////////////////////
1055// SCHED SAP
1056// ////////////////////////////////////////////
1057
1058void
1060{
1061 NS_LOG_FUNCTION(this);
1062 // Create DL PHY PDU
1063 Ptr<PacketBurst> pb = CreateObject<PacketBurst>();
1065
1066 for (std::size_t i = 0; i < ind.m_buildDataList.size(); i++)
1067 {
1068 for (std::size_t layer = 0; layer < ind.m_buildDataList.at(i).m_dci.m_ndi.size(); layer++)
1069 {
1070 if (ind.m_buildDataList.at(i).m_dci.m_ndi.at(layer) == 1)
1071 {
1072 // new data -> force emptying correspondent harq pkt buffer
1073 auto it = m_miDlHarqProcessesPackets.find(ind.m_buildDataList.at(i).m_rnti);
1075 for (std::size_t lcId = 0; lcId < (*it).second.size(); lcId++)
1076 {
1077 Ptr<PacketBurst> pb = CreateObject<PacketBurst>();
1078 (*it).second.at(lcId).at(ind.m_buildDataList.at(i).m_dci.m_harqProcess) = pb;
1079 }
1080 }
1081 }
1082 for (std::size_t j = 0; j < ind.m_buildDataList.at(i).m_rlcPduList.size(); j++)
1083 {
1084 for (std::size_t k = 0; k < ind.m_buildDataList.at(i).m_rlcPduList.at(j).size(); k++)
1085 {
1086 if (ind.m_buildDataList.at(i).m_dci.m_ndi.at(k) == 1)
1087 {
1088 // New Data -> retrieve it from RLC
1089 uint16_t rnti = ind.m_buildDataList.at(i).m_rnti;
1090 uint8_t lcid =
1091 ind.m_buildDataList.at(i).m_rlcPduList.at(j).at(k).m_logicalChannelIdentity;
1092 auto rntiIt = m_rlcAttached.find(rnti);
1093 NS_ASSERT_MSG(rntiIt != m_rlcAttached.end(), "could not find RNTI" << rnti);
1094 auto lcidIt = rntiIt->second.find(lcid);
1095 NS_ASSERT_MSG(lcidIt != rntiIt->second.end(),
1096 "could not find LCID" << (uint32_t)lcid << " carrier id:"
1097 << (uint16_t)m_componentCarrierId);
1098 NS_LOG_DEBUG(this << " rnti= " << rnti << " lcid= " << (uint32_t)lcid
1099 << " layer= " << k);
1100 txOpParams.bytes = ind.m_buildDataList.at(i).m_rlcPduList.at(j).at(k).m_size;
1101 txOpParams.layer = k;
1102 txOpParams.harqId = ind.m_buildDataList.at(i).m_dci.m_harqProcess;
1104 txOpParams.rnti = rnti;
1105 txOpParams.lcid = lcid;
1106 (*lcidIt).second->NotifyTxOpportunity(txOpParams);
1107 }
1108 else
1109 {
1110 if (ind.m_buildDataList.at(i).m_dci.m_tbsSize.at(k) > 0)
1111 {
1112 // HARQ retransmission -> retrieve TB from HARQ buffer
1113 auto it = m_miDlHarqProcessesPackets.find(ind.m_buildDataList.at(i).m_rnti);
1115 Ptr<PacketBurst> pb =
1116 (*it).second.at(k).at(ind.m_buildDataList.at(i).m_dci.m_harqProcess);
1117 for (auto j = pb->Begin(); j != pb->End(); ++j)
1118 {
1119 Ptr<Packet> pkt = (*j)->Copy();
1121 }
1122 }
1123 }
1124 }
1125 }
1126 // send the relative DCI
1127 Ptr<DlDciLteControlMessage> msg = Create<DlDciLteControlMessage>();
1128 msg->SetDci(ind.m_buildDataList.at(i).m_dci);
1130 }
1131
1132 // Fire the trace with the DL information
1133 for (uint32_t i = 0; i < ind.m_buildDataList.size(); i++)
1134 {
1135 // Only one TB used
1136 if (ind.m_buildDataList.at(i).m_dci.m_tbsSize.size() == 1)
1137 {
1138 DlSchedulingCallbackInfo dlSchedulingCallbackInfo;
1139 dlSchedulingCallbackInfo.frameNo = m_frameNo;
1140 dlSchedulingCallbackInfo.subframeNo = m_subframeNo;
1141 dlSchedulingCallbackInfo.rnti = ind.m_buildDataList.at(i).m_dci.m_rnti;
1142 dlSchedulingCallbackInfo.mcsTb1 = ind.m_buildDataList.at(i).m_dci.m_mcs.at(0);
1143 dlSchedulingCallbackInfo.sizeTb1 = ind.m_buildDataList.at(i).m_dci.m_tbsSize.at(0);
1144 dlSchedulingCallbackInfo.mcsTb2 = 0;
1145 dlSchedulingCallbackInfo.sizeTb2 = 0;
1146 dlSchedulingCallbackInfo.componentCarrierId = m_componentCarrierId;
1147 m_dlScheduling(dlSchedulingCallbackInfo);
1148 }
1149 // Two TBs used
1150 else if (ind.m_buildDataList.at(i).m_dci.m_tbsSize.size() == 2)
1151 {
1152 DlSchedulingCallbackInfo dlSchedulingCallbackInfo;
1153 dlSchedulingCallbackInfo.frameNo = m_frameNo;
1154 dlSchedulingCallbackInfo.subframeNo = m_subframeNo;
1155 dlSchedulingCallbackInfo.rnti = ind.m_buildDataList.at(i).m_dci.m_rnti;
1156 dlSchedulingCallbackInfo.mcsTb1 = ind.m_buildDataList.at(i).m_dci.m_mcs.at(0);
1157 dlSchedulingCallbackInfo.sizeTb1 = ind.m_buildDataList.at(i).m_dci.m_tbsSize.at(0);
1158 dlSchedulingCallbackInfo.mcsTb2 = ind.m_buildDataList.at(i).m_dci.m_mcs.at(1);
1159 dlSchedulingCallbackInfo.sizeTb2 = ind.m_buildDataList.at(i).m_dci.m_tbsSize.at(1);
1160 dlSchedulingCallbackInfo.componentCarrierId = m_componentCarrierId;
1161 m_dlScheduling(dlSchedulingCallbackInfo);
1162 }
1163 else
1164 {
1165 NS_FATAL_ERROR("Found element with more than two transport blocks");
1166 }
1167 }
1168
1169 // Random Access procedure: send RARs
1170 Ptr<RarLteControlMessage> rarMsg = Create<RarLteControlMessage>();
1171 // see TS 36.321 5.1.4; preambles were sent two frames ago
1172 // (plus 3GPP counts subframes from 0, not 1)
1173 uint16_t raRnti;
1174 if (m_subframeNo < 3)
1175 {
1176 raRnti = m_subframeNo + 7; // equivalent to +10-3
1177 }
1178 else
1179 {
1180 raRnti = m_subframeNo - 3;
1181 }
1182 rarMsg->SetRaRnti(raRnti);
1183 for (unsigned int i = 0; i < ind.m_buildRarList.size(); i++)
1184 {
1185 auto itRapId = m_rapIdRntiMap.find(ind.m_buildRarList.at(i).m_rnti);
1186 if (itRapId == m_rapIdRntiMap.end())
1187 {
1188 NS_FATAL_ERROR("Unable to find rapId of RNTI " << ind.m_buildRarList.at(i).m_rnti);
1189 }
1191 rar.rapId = itRapId->second;
1192 rar.rarPayload = ind.m_buildRarList.at(i);
1193 rarMsg->AddRar(rar);
1194 NS_LOG_INFO(this << " Send RAR message to RNTI " << ind.m_buildRarList.at(i).m_rnti
1195 << " rapId " << itRapId->second);
1196 }
1197 if (!ind.m_buildRarList.empty())
1198 {
1200 }
1201 m_rapIdRntiMap.clear();
1202}
1203
1204void
1206{
1207 NS_LOG_FUNCTION(this);
1208
1209 for (unsigned int i = 0; i < ind.m_dciList.size(); i++)
1210 {
1211 // send the correspondent ul dci
1212 Ptr<UlDciLteControlMessage> msg = Create<UlDciLteControlMessage>();
1213 msg->SetDci(ind.m_dciList.at(i));
1215 }
1216
1217 // Fire the trace with the UL information
1218 for (uint32_t i = 0; i < ind.m_dciList.size(); i++)
1219 {
1222 ind.m_dciList.at(i).m_rnti,
1223 ind.m_dciList.at(i).m_mcs,
1224 ind.m_dciList.at(i).m_tbSize,
1226 }
1227}
1228
1229// ////////////////////////////////////////////
1230// CSCHED SAP
1231// ////////////////////////////////////////////
1232
1233void
1235{
1236 NS_LOG_FUNCTION(this);
1237}
1238
1239void
1241{
1242 NS_LOG_FUNCTION(this);
1243}
1244
1245void
1247{
1248 NS_LOG_FUNCTION(this);
1249 // Call the CSCHED primitive
1250 // m_cschedSap->LcConfigCompleted();
1251}
1252
1253void
1255{
1256 NS_LOG_FUNCTION(this);
1257}
1258
1259void
1261{
1262 NS_LOG_FUNCTION(this);
1263}
1264
1265void
1267{
1268 NS_LOG_FUNCTION(this);
1269 // propagates to RRC
1270 LteEnbCmacSapUser::UeConfig ueConfigUpdate;
1271 ueConfigUpdate.m_rnti = params.m_rnti;
1272 ueConfigUpdate.m_transmissionMode = params.m_transmissionMode;
1274}
1275
1276void
1279{
1280 NS_LOG_FUNCTION(this);
1281}
1282
1283void
1285{
1286 NS_LOG_FUNCTION(this);
1287 m_ulInfoListReceived.push_back(params);
1288}
1289
1290void
1292{
1293 NS_LOG_FUNCTION(this);
1294 // Update HARQ buffer
1295 auto it = m_miDlHarqProcessesPackets.find(params.m_rnti);
1297 for (std::size_t layer = 0; layer < params.m_harqStatus.size(); layer++)
1298 {
1299 if (params.m_harqStatus.at(layer) == DlInfoListElement_s::ACK)
1300 {
1301 // discard buffer
1302 Ptr<PacketBurst> emptyBuf = CreateObject<PacketBurst>();
1303 (*it).second.at(layer).at(params.m_harqProcessId) = emptyBuf;
1304 NS_LOG_DEBUG(this << " HARQ-ACK UE " << params.m_rnti << " harqId "
1305 << (uint16_t)params.m_harqProcessId << " layer " << (uint16_t)layer);
1306 }
1307 else if (params.m_harqStatus.at(layer) == DlInfoListElement_s::NACK)
1308 {
1309 NS_LOG_DEBUG(this << " HARQ-NACK UE " << params.m_rnti << " harqId "
1310 << (uint16_t)params.m_harqProcessId << " layer " << (uint16_t)layer);
1311 }
1312 else
1313 {
1314 NS_FATAL_ERROR(" HARQ functionality not implemented");
1315 }
1316 }
1317 m_dlInfoListReceived.push_back(params);
1318}
1319
1320} // namespace ns3
EnbMacMemberFfMacCschedSapUser class.
Definition: lte-enb-mac.cc:170
void CschedLcReleaseCnf(const CschedLcReleaseCnfParameters &params) override
CSCHED_LC_RELEASE_CNF.
Definition: lte-enb-mac.cc:215
void CschedUeConfigCnf(const CschedUeConfigCnfParameters &params) override
CSCHED_UE_CONFIG_CNF.
Definition: lte-enb-mac.cc:203
EnbMacMemberFfMacCschedSapUser(LteEnbMac *mac)
Constructor.
Definition: lte-enb-mac.cc:191
void CschedLcConfigCnf(const CschedLcConfigCnfParameters &params) override
CSCHED_LC_CONFIG_CNF.
Definition: lte-enb-mac.cc:209
void CschedCellConfigUpdateInd(const CschedCellConfigUpdateIndParameters &params) override
CSCHED_UE_CONFIG_IND.
Definition: lte-enb-mac.cc:234
void CschedUeReleaseCnf(const CschedUeReleaseCnfParameters &params) override
CSCHED_UE_RELEASE_CNF.
Definition: lte-enb-mac.cc:221
void CschedCellConfigCnf(const CschedCellConfigCnfParameters &params) override
CSCHED_CELL_CONFIG_CNF.
Definition: lte-enb-mac.cc:197
void CschedUeConfigUpdateInd(const CschedUeConfigUpdateIndParameters &params) override
CSCHED_UE_UPDATE_IND.
Definition: lte-enb-mac.cc:227
EnbMacMemberFfMacSchedSapUser class.
Definition: lte-enb-mac.cc:135
void SchedDlConfigInd(const SchedDlConfigIndParameters &params) override
SCHED_DL_CONFIG_IND.
Definition: lte-enb-mac.cc:157
EnbMacMemberFfMacSchedSapUser(LteEnbMac *mac)
Constructor.
Definition: lte-enb-mac.cc:151
void SchedUlConfigInd(const SchedUlConfigIndParameters &params) override
SCHED_UL_CONFIG_IND.
Definition: lte-enb-mac.cc:163
EnbMacMemberLteEnbCmacSapProvider class.
Definition: lte-enb-mac.cc:50
void AddLc(LcInfo lcinfo, LteMacSapUser *msu) override
Add a new logical channel.
Definition: lte-enb-mac.cc:98
void UeUpdateConfigurationReq(UeConfig params) override
update the configuration of the UE
Definition: lte-enb-mac.cc:116
void RemoveUe(uint16_t rnti) override
remove the UE, e.g., after handover or termination of the RRC connection
Definition: lte-enb-mac.cc:92
void AddUe(uint16_t rnti) override
Add UE function.
Definition: lte-enb-mac.cc:86
void ReconfigureLc(LcInfo lcinfo) override
Reconfigure an existing logical channel.
Definition: lte-enb-mac.cc:104
AllocateNcRaPreambleReturnValue AllocateNcRaPreamble(uint16_t rnti) override
Allocate a random access preamble for non-contention based random access (e.g., for handover).
Definition: lte-enb-mac.cc:128
void ConfigureMac(uint16_t ulBandwidth, uint16_t dlBandwidth) override
Definition: lte-enb-mac.cc:80
EnbMacMemberLteEnbCmacSapProvider(LteEnbMac *mac)
Constructor.
Definition: lte-enb-mac.cc:74
void ReleaseLc(uint16_t rnti, uint8_t lcid) override
release an existing logical channel
Definition: lte-enb-mac.cc:110
void SubframeIndication(uint32_t frameNo, uint32_t subframeNo) override
Trigger the start from a new frame (input from Phy layer)
Definition: lte-enb-mac.cc:276
void ReceivePhyPdu(Ptr< Packet > p) override
Called by the Phy to notify the MAC of the reception of a new PHY-PDU.
Definition: lte-enb-mac.cc:270
void ReceiveLteControlMessage(Ptr< LteControlMessage > msg) override
Receive SendLteControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel.
Definition: lte-enb-mac.cc:282
void ReceiveRachPreamble(uint32_t prachId) override
notify the reception of a RACH preamble on the PRACH
Definition: lte-enb-mac.cc:288
EnbMacMemberLteEnbPhySapUser(LteEnbMac *mac)
Constructor.
Definition: lte-enb-mac.cc:264
void DlInfoListElementHarqFeedback(DlInfoListElement_s params) override
Notify the HARQ on the DL transmission status.
Definition: lte-enb-mac.cc:306
void UlCqiReport(FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi) override
Returns to MAC level the UL-CQI evaluated.
Definition: lte-enb-mac.cc:294
void UlInfoListElementHarqFeedback(UlInfoListElement_s params) override
Notify the HARQ on the UL transmission status.
Definition: lte-enb-mac.cc:300
Provides the CSCHED SAP.
virtual void CschedLcConfigReq(const CschedLcConfigReqParameters &params)=0
CSCHED_LC_CONFIG_REQ.
virtual void CschedLcReleaseReq(const CschedLcReleaseReqParameters &params)=0
CSCHED_LC_RELEASE_REQ.
virtual void CschedUeConfigReq(const CschedUeConfigReqParameters &params)=0
CSCHED_UE_CONFIG_REQ.
virtual void CschedUeReleaseReq(const CschedUeReleaseReqParameters &params)=0
CSCHED_UE_RELEASE_REQ.
virtual void CschedCellConfigReq(const CschedCellConfigReqParameters &params)=0
CSCHED_CELL_CONFIG_REQ.
FfMacCschedSapUser class.
Provides the SCHED SAP.
virtual void SchedDlTriggerReq(const SchedDlTriggerReqParameters &params)=0
SCHED_DL_TRIGGER_REQ.
virtual void SchedDlRachInfoReq(const SchedDlRachInfoReqParameters &params)=0
SCHED_DL_RACH_INFO_REQ.
virtual void SchedUlMacCtrlInfoReq(const SchedUlMacCtrlInfoReqParameters &params)=0
SCHED_UL_MAC_CTRL_INFO_REQ.
virtual void SchedUlCqiInfoReq(const SchedUlCqiInfoReqParameters &params)=0
SCHED_UL_CQI_INFO_REQ.
virtual void SchedUlTriggerReq(const SchedUlTriggerReqParameters &params)=0
SCHED_UL_TRIGGER_REQ.
virtual void SchedDlRlcBufferReq(const SchedDlRlcBufferReqParameters &params)=0
SCHED_DL_RLC_BUFFER_REQ.
virtual void SchedDlCqiInfoReq(const 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:58
void SetFfMacCschedSapProvider(FfMacCschedSapProvider *s)
Set the control scheduler SAP provider.
Definition: lte-enb-mac.cc:416
~LteEnbMac() override
Definition: lte-enb-mac.cc:374
void DoReceivePhyPdu(Ptr< Packet > p)
legacy public for use the Phy callback
Definition: lte-enb-mac.cc:709
void DoSchedDlConfigInd(FfMacSchedSapUser::SchedDlConfigIndParameters ind)
Sched DL Config Indication function.
FfMacSchedSapUser * m_schedSapUser
the Sched SAP user
Definition: lte-enb-mac.h:401
void DoCschedCellConfigCnf(FfMacCschedSapUser::CschedCellConfigCnfParameters params)
CSched Cell Config configure function.
FfMacCschedSapProvider * m_cschedSapProvider
the Csched SAP provider
Definition: lte-enb-mac.h:400
void SetLteEnbPhySapProvider(LteEnbPhySapProvider *s)
Set the PHY SAP Provider.
Definition: lte-enb-mac.cc:452
uint32_t m_frameNo
frame number of current subframe indication
Definition: lte-enb-mac.h:414
void DoDispose() override
Destructor implementation.
Definition: lte-enb-mac.cc:380
LteEnbPhySapProvider * m_enbPhySapProvider
the ENB Phy SAP provider
Definition: lte-enb-mac.h:405
void DoReportBufferStatus(LteMacSapProvider::ReportBufferStatusParameters params)
Report Buffer Status function.
FfMacCschedSapUser * GetFfMacCschedSapUser()
Get the control scheduler SAP user.
Definition: lte-enb-mac.cc:422
FfMacCschedSapUser * m_cschedSapUser
the CSched SAP user
Definition: lte-enb-mac.h:402
static TypeId GetTypeId()
Get the type ID.
Definition: lte-enb-mac.cc:316
friend class EnbMacMemberFfMacCschedSapUser
allow EnbMacMemberFfMacCschedSapUser class friend access
Definition: lte-enb-mac.h:66
LteCcmMacSapUser * m_ccmMacSapUser
CCM MAC SAP user.
Definition: lte-enb-mac.h:410
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:440
LteEnbPhySapUser * GetLteEnbPhySapUser()
Get the eNB-PHY SAP User.
Definition: lte-enb-mac.cc:458
void DoUlInfoListElementHarqFeedback(UlInfoListElement_s params)
UL Info List ELements HARQ Feedback function.
std::vector< CqiListElement_s > m_dlCqiReceived
DL-CQI received.
Definition: lte-enb-mac.h:380
std::map< uint8_t, uint32_t > m_receivedRachPreambleCount
received RACH preamble count
Definition: lte-enb-mac.h:460
LteCcmMacSapProvider * m_ccmMacSapProvider
CCM MAC SAP provider.
Definition: lte-enb-mac.h:409
FfMacSchedSapProvider * m_schedSapProvider
the Sched SAP provider
Definition: lte-enb-mac.h:399
void DoReceiveRachPreamble(uint8_t prachId)
Receive RACH Preamble function.
Definition: lte-enb-mac.cc:658
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:465
void DoCschedUeConfigCnf(FfMacCschedSapUser::CschedUeConfigCnfParameters params)
CSched UE Config configure 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:430
void DoReleaseLc(uint16_t rnti, uint8_t lcid)
Release LC function.
Definition: lte-enb-mac.cc:918
void DoReceiveLteControlMessage(Ptr< LteControlMessage > msg)
Receive a DL CQI ideal control message.
Definition: lte-enb-mac.cc:631
friend class EnbMacMemberLteEnbCmacSapProvider
allow EnbMacMemberLteEnbCmacSapProvider class friend access
Definition: lte-enb-mac.h:60
void SetLteCcmMacSapUser(LteCcmMacSapUser *s)
Set the ComponentCarrierManager SAP user.
Definition: lte-enb-mac.cc:464
std::map< uint16_t, std::map< uint8_t, LteMacSapUser * > > m_rlcAttached
RNTI, LC ID, SAP of the RLC instance.
Definition: lte-enb-mac.h:378
LteMacSapUser * m_macSapUser
the MAC SAP user
Definition: lte-enb-mac.h:396
std::vector< MacCeListElement_s > m_ulCeReceived
CE received (BSR up to now)
Definition: lte-enb-mac.h:383
LteEnbPhySapUser * m_enbPhySapUser
the ENB Phy SAP user
Definition: lte-enb-mac.h:406
void DoTransmitPdu(LteMacSapProvider::TransmitPduParameters params)
Transmit PDU function.
std::vector< FfMacSchedSapProvider::SchedUlCqiInfoReqParameters > m_ulCqiReceived
UL-CQI received.
Definition: lte-enb-mac.h:382
LteEnbCmacSapProvider * m_cmacSapProvider
the CMAC SAP provider
Definition: lte-enb-mac.h:395
friend class EnbMacMemberFfMacSchedSapUser
allow EnbMacMemberFfMacSchedSapUser class friend access
Definition: lte-enb-mac.h:64
TracedCallback< DlSchedulingCallbackInfo > m_dlScheduling
Trace information regarding DL scheduling Frame number, Subframe number, RNTI, MCS of TB1,...
Definition: lte-enb-mac.h:424
void SetFfMacSchedSapProvider(FfMacSchedSapProvider *s)
Set the scheduler SAP provider.
Definition: lte-enb-mac.cc:404
void ReceiveBsrMessage(MacCeListElement_s bsr)
Receive a CE element containing the buffer status report.
Definition: lte-enb-mac.cc:691
uint8_t m_connEstFailCount
the counter value for T300 timer expiration
Definition: lte-enb-mac.h:440
LteMacSapProvider * m_macSapProvider
the MAC SAP provider
Definition: lte-enb-mac.h:394
uint8_t m_raResponseWindowSize
RA response window size.
Definition: lte-enb-mac.h:439
void DoUeUpdateConfigurationReq(LteEnbCmacSapProvider::UeConfig params)
UE Update configuration request function.
Definition: lte-enb-mac.cc:933
void DoReconfigureLc(LteEnbCmacSapProvider::LcInfo lcinfo)
Reconfigure LC function.
Definition: lte-enb-mac.cc:912
uint8_t m_macChTtiDelay
delay of MAC, PHY and channel in terms of TTIs
Definition: lte-enb-mac.h:432
FfMacSchedSapUser * GetFfMacSchedSapUser()
Get the scheduler SAP user.
Definition: lte-enb-mac.cc:410
LteCcmMacSapProvider * GetLteCcmMacSapProvider()
Get the eNB-ComponentCarrierManager SAP User.
Definition: lte-enb-mac.cc:470
void DoDlInfoListElementHarqFeedback(DlInfoListElement_s params)
DL Info List ELements HARQ Feedback function.
uint8_t m_preambleTransMax
preamble transmit maximum
Definition: lte-enb-mac.h:438
void DoConfigureMac(uint16_t ulBandwidth, uint16_t dlBandwidth)
Configure MAC function.
Definition: lte-enb-mac.cc:771
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:458
uint8_t m_numberOfRaPreambles
number of RA preambles
Definition: lte-enb-mac.h:437
LteEnbCmacSapProvider * GetLteEnbCmacSapProvider()
Get the control MAC SAP provider.
Definition: lte-enb-mac.cc:446
std::map< uint16_t, DlHarqProcessesBuffer_t > m_miDlHarqProcessesPackets
Packet under transmission of the DL HARQ process.
Definition: lte-enb-mac.h:435
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:865
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:476
void SetLteMacSapUser(LteMacSapUser *s)
Set the MAC SAP user.
Definition: lte-enb-mac.cc:428
void ReceiveDlCqiLteControlMessage(Ptr< DlCqiLteControlMessage > msg)
Receive a DL CQI ideal control message.
Definition: lte-enb-mac.cc:680
LteEnbCmacSapProvider::AllocateNcRaPreambleReturnValue DoAllocateNcRaPreamble(uint16_t rnti)
Allocate NC RA preamble function.
Definition: lte-enb-mac.cc:957
void DoRemoveUe(uint16_t rnti)
Remove UE function.
Definition: lte-enb-mac.cc:821
friend class EnbMacMemberLteMacSapProvider< LteEnbMac >
allow EnbMacMemberLteMacSapProvider<LteEnbMac> class friend access
Definition: lte-enb-mac.h:62
LteEnbCmacSapProvider::RachConfig DoGetRachConfig() const
Get RACH configuration function.
Definition: lte-enb-mac.cc:946
std::vector< DlInfoListElement_s > m_dlInfoListReceived
DL HARQ feedback received.
Definition: lte-enb-mac.h:385
void DoSchedUlConfigInd(FfMacSchedSapUser::SchedUlConfigIndParameters params)
Sched UL Config Indication function.
LteMacSapProvider * GetLteMacSapProvider()
Get the MAC SAP provider.
Definition: lte-enb-mac.cc:434
LteEnbCmacSapUser * m_cmacSapUser
the CMAC SAP user
Definition: lte-enb-mac.h:397
uint32_t m_subframeNo
subframe number of current subframe indication
Definition: lte-enb-mac.h:418
friend class MemberLteCcmMacSapProvider< LteEnbMac >
allow MemberLteCcmMacSapProvider<LteEnbMac> class friend access
Definition: lte-enb-mac.h:70
void DoCschedLcReleaseCnf(FfMacCschedSapUser::CschedLcReleaseCnfParameters params)
CSched LC Release configure function.
void DoAddUe(uint16_t rnti)
Add UE function.
Definition: lte-enb-mac.cc:784
friend class EnbMacMemberLteEnbPhySapUser
allow EnbMacMemberLteEnbPhySapUser class friend access
Definition: lte-enb-mac.h:68
void DoReportMacCeToScheduler(MacCeListElement_s bsr)
Report MAC CE to scheduler.
Definition: lte-enb-mac.cc:698
void SetComponentCarrierId(uint8_t index)
Set the component carrier ID.
Definition: lte-enb-mac.cc:398
void DoUlCqiReport(FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi)
UL CQI report.
Definition: lte-enb-mac.cc:666
std::vector< UlInfoListElement_s > m_ulInfoListReceived
UL HARQ feedback received.
Definition: lte-enb-mac.h:387
std::map< uint16_t, uint32_t > m_rapIdRntiMap
RAPID RNTI map.
Definition: lte-enb-mac.h:462
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:36
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 transmitted.
uint16_t GetRnti() const
Get RNTI function.
uint8_t GetLcid() const
Get LCID function.
uint8_t GetLayer() const
Get layer function.
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:208
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:932
Hold an unsigned integer type.
Definition: uinteger.h:45
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:66
#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:86
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition: uinteger.h:46
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:179
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Definition: log.h:254
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:282
#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:275
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1331
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:52
See section 4.3.24 cqiListElement.
uint16_t m_rnti
RNTI.
See section 4.3.23 dlInfoListElement.
DlSchedulingCallbackInfo structure.
Definition: lte-common.h:237
uint32_t subframeNo
subframe number
Definition: lte-common.h:239
uint16_t sizeTb2
size TB2
Definition: lte-common.h:244
uint16_t sizeTb1
size TB1
Definition: lte-common.h:242
uint8_t componentCarrierId
component carrier ID
Definition: lte-common.h:245
uint32_t frameNo
frame number
Definition: lte-common.h:238
Parameters of the CSCHED_LC_CONFIG_REQ primitive.
Parameters of the CSCHED_LC_RELEASE_REQ primitive.
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< CqiListElement_s > m_cqiList
CQI list.
Parameters of the SCHED_DL_RACH_INFO_REQ primitive.
std::vector< 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< 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< MacCeListElement_s > m_macCeList
MAC CE list.
Parameters of the SCHED_UL_TRIGGER_REQ primitive.
std::vector< UlInfoListElement_s > m_ulInfoList
UL info list.
std::vector< BuildDataListElement_s > m_buildDataList
build data list
std::vector< BuildRarListElement_s > m_buildRarList
build rar list
Parameters of the SCHED_UL_CONFIG_IND primitive.
std::vector< 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
uint8_t resourceType
0 if the bearer is NON-GBR, 1 if the bearer is GBR, 2 if the bearer in DC-GBR
uint64_t gbrDl
guaranteed bitrate in downlink
uint8_t lcId
logical channel identifier
uint16_t rnti
C-RNTI identifying the UE.
struct defining the RACH configuration of the MAC
Parameters for [re]configuring the UE.
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:447
Time expiryTime
value the expiration time of this allocation (so that stale preambles can be reused)
Definition: lte-enb-mac.h:449
uint16_t rnti
rnti previously allocated for this non-contention based RA procedure
Definition: lte-enb-mac.h:448
LteFlowId structure.
Definition: lte-common.h:43
Parameters for LteMacSapProvider::ReportBufferStatus.
Definition: lte-mac-sap.h:69
Parameters for LteMacSapProvider::TransmitPdu.
Definition: lte-mac-sap.h:45
Parameters for LteMacSapUser::ReceivePdu.
Definition: lte-mac-sap.h:166
Ptr< Packet > p
the RLC PDU to be received
Definition: lte-mac-sap.h:187
uint8_t lcid
the logical channel id
Definition: lte-mac-sap.h:189
uint16_t rnti
the C-RNTI identifying the UE
Definition: lte-mac-sap.h:188
Parameters for LteMacSapUser::NotifyTxOpportunity.
Definition: lte-mac-sap.h:105
uint16_t rnti
the C-RNTI identifying the UE
Definition: lte-mac-sap.h:141
uint32_t bytes
the number of bytes to transmit
Definition: lte-mac-sap.h:137
uint8_t componentCarrierId
the component carrier id
Definition: lte-mac-sap.h:140
uint8_t layer
the layer of transmission (MIMO)
Definition: lte-mac-sap.h:138
uint8_t lcid
the logical channel id
Definition: lte-mac-sap.h:142
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.