A Discrete-Event Network Simulator
API
lte-enb-mac.h
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 #ifndef LTE_ENB_MAC_H
26 #define LTE_ENB_MAC_H
27 
28 
29 #include <map>
30 #include <vector>
31 #include <ns3/lte-common.h>
32 #include <ns3/lte-mac-sap.h>
33 #include <ns3/lte-enb-cmac-sap.h>
34 #include <ns3/ff-mac-csched-sap.h>
35 #include <ns3/ff-mac-sched-sap.h>
36 #include <ns3/lte-enb-phy-sap.h>
37 #include "ns3/traced-value.h"
38 #include "ns3/trace-source-accessor.h"
39 #include <ns3/packet.h>
40 #include <ns3/packet-burst.h>
41 #include <ns3/lte-ccm-mac-sap.h>
42 
43 namespace ns3 {
44 
45 class DlCqiLteControlMessage;
46 class UlCqiLteControlMessage;
47 class PdcchMapLteControlMessage;
48 
50 typedef std::vector <std::vector < Ptr<PacketBurst> > > DlHarqProcessesBuffer_t;
51 
55 class LteEnbMac : public Object
56 {
69 
70 public:
75  static TypeId GetTypeId (void);
76 
77  LteEnbMac (void);
78  virtual ~LteEnbMac (void);
79  virtual void DoDispose (void);
80 
85  void SetComponentCarrierId (uint8_t index);
106 
107 
108 
129 
130 
136 
142 
148 
154 
155 
168  typedef void (* DlSchedulingTracedCallback)
169  (const uint32_t frame, const uint32_t subframe, const uint16_t rnti,
170  const uint8_t mcs0, const uint16_t tbs0Size,
171  const uint8_t mcs1, const uint16_t tbs1Size, const uint8_t ccId);
172 
182  typedef void (* UlSchedulingTracedCallback)
183  (const uint32_t frame, const uint32_t subframe, const uint16_t rnti,
184  const uint8_t mcs, const uint16_t tbsSize);
185 
186 private:
187 
193 
199 
205 
211 
212 
213 
214  // forwarded from LteEnbCmacSapProvider
220  void DoConfigureMac (uint16_t ulBandwidth, uint16_t dlBandwidth);
225  void DoAddUe (uint16_t rnti);
230  void DoRemoveUe (uint16_t rnti);
247  void DoReleaseLc (uint16_t rnti, uint8_t lcid);
264 
265  // forwarded from LteMacSapProvider
276 
277 
278  // forwarded from FfMacCchedSapUser
314 
315  // forwarded from FfMacSchedSapUser
326 
327  // forwarded from LteEnbPhySapUser
333  void DoSubframeIndication (uint32_t frameNo, uint32_t subframeNo);
338  void DoReceiveRachPreamble (uint8_t prachId);
339 
340  // forwarded by LteCcmMacSapProvider
346 
353  void DoReportSrToScheduler (uint16_t rnti)
354  {
355  NS_UNUSED (rnti);
356  }
357 
358 public:
363  void DoReceivePhyPdu (Ptr<Packet> p);
364 
365 private:
376 
378  std::map <uint16_t, std::map<uint8_t, LteMacSapUser*> > m_rlcAttached;
379 
380  std::vector <CqiListElement_s> m_dlCqiReceived;
381  std::vector <FfMacSchedSapProvider::SchedUlCqiInfoReqParameters> m_ulCqiReceived;
382  std::vector <MacCeListElement_s> m_ulCeReceived;
383 
384  std::vector <DlInfoListElement_s> m_dlInfoListReceived;
385 
386  std::vector <UlInfoListElement_s> m_ulInfoListReceived;
387 
388 
389  /*
390  * Map of UE's info element (see 4.3.12 of FF MAC Scheduler API)
391  */
392  //std::map <uint16_t,UlInfoListElement_s> m_ulInfoListElements;
393 
394 
395 
400 
401 
406 
407  // PHY-SAP
410 
411  // Sap For ComponentCarrierManager 'Uplink case'
414 
417  uint32_t m_frameNo;
421  uint32_t m_subframeNo;
428 
433  TracedCallback<uint32_t, uint32_t, uint16_t,
434  uint8_t, uint16_t, uint8_t> m_ulScheduling;
435 
436  uint8_t m_macChTtiDelay;
437 
438 
439  std::map <uint16_t, DlHarqProcessesBuffer_t> m_miDlHarqProcessesPackets;
440 
445 
451  {
452  uint16_t rnti;
454  };
455 
461  std::map<uint8_t, NcRaPreambleInfo> m_allocatedNcRaPreambleMap;
462 
463  std::map<uint8_t, uint32_t> m_receivedRachPreambleCount;
464 
465  std::map<uint16_t, uint32_t> m_rapIdRntiMap;
466 
469 
470 };
471 
472 } // end namespace ns3
473 
474 #endif /* LTE_ENB_MAC_ENTITY_H */
Service Access Point (SAP) offered by the component carrier manager (CCM) by MAC to CCM...
void DoReconfigureLc(LteEnbCmacSapProvider::LcInfo lcinfo)
Reconfigure LC function.
Definition: lte-enb-mac.cc:934
FfMacSchedSapUser * m_schedSapUser
the Sched SAP user
Definition: lte-enb-mac.h:404
Parameters of the CSCHED_LC_CONFIG_CNF primitive.
AllocateNcRaPreambleReturnValue structure.
void(* UlSchedulingTracedCallback)(const uint32_t frame, const uint32_t subframe, const uint16_t rnti, const uint8_t mcs, const uint16_t tbsSize)
TracedCallback signature for UL scheduling events.
Definition: lte-enb-mac.h:183
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
void DoDlInfoListElementHarqFeeback(DlInfoListElement_s params)
DL Info List ELements HARQ Feedback function.
EnbMacMemberLteMacSapProvider class.
Definition: lte-mac-sap.h:190
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
std::vector< FfMacSchedSapProvider::SchedUlCqiInfoReqParameters > m_ulCqiReceived
UL-CQI received.
Definition: lte-enb-mac.h:381
Parameters of the CSCHED_UE_CONFIG_CNF primitive.
void DoReceivePhyPdu(Ptr< Packet > p)
legacy public for use the Phy callback
Definition: lte-enb-mac.cc:727
Parameters of the CSCHED_CELL_CONFIG_UPDATE_IND primitive.
void DoUlInfoListElementHarqFeeback(UlInfoListElement_s params)
UL Info List ELements HARQ Feedback function.
TracedCallback< uint32_t, uint32_t, uint16_t, uint8_t, uint16_t, uint8_t > m_ulScheduling
Trace information regarding UL scheduling Frame number, Subframe number, RNTI, MCS of TB...
Definition: lte-enb-mac.h:434
LteEnbCmacSapProvider * m_cmacSapProvider
the CMAC SAP provider
Definition: lte-enb-mac.h:397
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
void DoAddLc(LteEnbCmacSapProvider::LcInfo lcinfo, LteMacSapUser *msu)
Add LC function.
Definition: lte-enb-mac.cc:887
LteEnbCmacSapProvider::RachConfig DoGetRachConfig()
Get RACH configuration function.
Definition: lte-enb-mac.cc:968
void DoCschedCellConfigUpdateInd(FfMacCschedSapUser::CschedCellConfigUpdateIndParameters params)
CSched Cell Config Update Indication function.
void DoReleaseLc(uint16_t rnti, uint8_t lcid)
Release LC function.
Definition: lte-enb-mac.cc:940
void SetLteEnbCmacSapUser(LteEnbCmacSapUser *s)
Set the control MAC SAP user.
Definition: lte-enb-mac.cc:463
Forward calls to a chain of Callback.
void SetComponentCarrierId(uint8_t index)
Set the component carrier ID.
Definition: lte-enb-mac.cc:419
void DoSchedUlConfigInd(FfMacSchedSapUser::SchedUlConfigIndParameters params)
Sched UL Config Indication function.
void DoReportMacCeToScheduler(MacCeListElement_s bsr)
Report MAC CE to scheduler.
Definition: lte-enb-mac.cc:716
uint8_t m_preambleTransMax
preamble transmit maximum
Definition: lte-enb-mac.h:442
#define NS_UNUSED(x)
Mark a local variable as unused.
Definition: unused.h:36
Provides the CSCHED SAP.
void DoTransmitPdu(LteMacSapProvider::TransmitPduParameters params)
Transmit PDU function.
LteCcmMacSapProvider * GetLteCcmMacSapProvider()
Get the eNB-ComponentCarrierManager SAP User.
Definition: lte-enb-mac.cc:495
Parameters of the CSCHED_UE_CONFIG_UPDATE_IND primitive.
void(* DlSchedulingTracedCallback)(const uint32_t frame, const uint32_t subframe, const uint16_t rnti, const uint8_t mcs0, const uint16_t tbs0Size, const uint8_t mcs1, const uint16_t tbs1Size, const uint8_t ccId)
TracedCallback signature for DL scheduling events.
Definition: lte-enb-mac.h:169
Service Access Point (SAP) offered by the eNB-PHY to the eNB-MAC.
See section 4.3.12 ulInfoListElement.
void DoAddUe(uint16_t rnti)
Add UE function.
Definition: lte-enb-mac.cc:806
uint8_t m_componentCarrierId
component carrier Id used to address sap
Definition: lte-enb-mac.h:468
void SetLteCcmMacSapUser(LteCcmMacSapUser *s)
Set the ComponentCarrierManager SAP user.
Definition: lte-enb-mac.cc:488
Service Access Point (SAP) offered by the eNB-PHY to the eNB-MAC.
FfMacCschedSapUser * GetFfMacCschedSapUser(void)
Get the control scheduler SAP user.
Definition: lte-enb-mac.cc:443
LteMacSapProvider * GetLteMacSapProvider(void)
Get the MAC SAP provider.
Definition: lte-enb-mac.cc:457
Parameters for LteMacSapProvider::ReportBufferStatus.
Definition: lte-mac-sap.h:67
std::map< uint8_t, uint32_t > m_receivedRachPreambleCount
received RACH preamble count
Definition: lte-enb-mac.h:463
FfMacCschedSapUser * m_cschedSapUser
the CSched SAP user
Definition: lte-enb-mac.h:405
Service Access Point (SAP) offered by the MAC to the RRC See Femto Forum MAC Scheduler Interface Spec...
void SetFfMacCschedSapProvider(FfMacCschedSapProvider *s)
Set the control scheduler SAP provider.
Definition: lte-enb-mac.cc:437
Parameters of the CSCHED_LC_RELEASE_CNF primitive.
LteEnbPhySapProvider * m_enbPhySapProvider
the ENB Phy SAP provider
Definition: lte-enb-mac.h:408
LteEnbPhySapUser * m_enbPhySapUser
the ENB Phy SAP user
Definition: lte-enb-mac.h:409
FfMacSchedSapUser * GetFfMacSchedSapUser(void)
Get the scheduler SAP user.
Definition: lte-enb-mac.cc:431
void DoCschedUeConfigCnf(FfMacCschedSapUser::CschedUeConfigCnfParameters params)
CSched UE Config configure function.
EnbMacMemberFfMacSchedSapUser class.
Definition: lte-enb-mac.cc:147
void DoUeUpdateConfigurationReq(LteEnbCmacSapProvider::UeConfig params)
UE Update configuration request function.
Definition: lte-enb-mac.cc:955
Logical Channel information to be passed to CmacSapProvider::ConfigureLc.
EnbMacMemberFfMacCschedSapUser class.
Definition: lte-enb-mac.cc:187
uint16_t rnti
rnti previously allocated for this non-contention based RA procedure
Definition: lte-enb-mac.h:452
uint8_t m_macChTtiDelay
delay of MAC, PHY and channel in terms of TTIs
Definition: lte-enb-mac.h:436
void DoCschedLcReleaseCnf(FfMacCschedSapUser::CschedLcReleaseCnfParameters params)
CSched LC Release configure function.
static TypeId GetTypeId(void)
Get the type ID.
Definition: lte-enb-mac.cc:337
void DoReportSrToScheduler(uint16_t rnti)
Report SR to scheduler.
Definition: lte-enb-mac.h:353
void DoUlCqiReport(FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi)
UL CQI report.
Definition: lte-enb-mac.cc:681
Provides the SCHED SAP.
virtual void DoDispose(void)
Destructor implementation.
Definition: lte-enb-mac.cc:401
void ReceiveBsrMessage(MacCeListElement_s bsr)
Receive a CE element containing the buffer status report.
Definition: lte-enb-mac.cc:709
MemberLteCcmMacSapProvider class.
uint8_t m_raResponseWindowSize
RA response window size.
Definition: lte-enb-mac.h:443
See section 4.3.23 dlInfoListElement.
void DoReceiveRachPreamble(uint8_t prachId)
Receive RACH Preamble function.
Definition: lte-enb-mac.cc:673
void DoRemoveUe(uint16_t rnti)
Remove UE function.
Definition: lte-enb-mac.cc:843
See section 4.3.14 macCEListElement.
uint8_t m_connEstFailCount
the counter value for T300 timer expiration
Definition: lte-enb-mac.h:444
Parameters for [re]configuring the UE.
uint32_t m_subframeNo
subframe number of current subframe indication
Definition: lte-enb-mac.h:421
LteEnbCmacSapProvider::AllocateNcRaPreambleReturnValue DoAllocateNcRaPreamble(uint16_t rnti)
Allocate NC RA preamble function.
Definition: lte-enb-mac.cc:979
uint8_t m_numberOfRaPreambles
number of RA preambles
Definition: lte-enb-mac.h:441
void DoConfigureMac(uint16_t ulBandwidth, uint16_t dlBandwidth)
Configure MAC function.
Definition: lte-enb-mac.cc:792
Every class exported by the ns3 library is enclosed in the ns3 namespace.
LteEnbCmacSapProvider * GetLteEnbCmacSapProvider(void)
Get the control MAC SAP provider.
Definition: lte-enb-mac.cc:469
Service Access Point (SAP) offered by MAC to the component carrier manager (CCM). ...
std::vector< UlInfoListElement_s > m_ulInfoListReceived
UL HARQ feedback received.
Definition: lte-enb-mac.h:386
LteMacSapProvider * m_macSapProvider
the MAC SAP provider
Definition: lte-enb-mac.h:396
std::vector< CqiListElement_s > m_dlCqiReceived
DL-CQI received.
Definition: lte-enb-mac.h:380
FfMacCschedSapUser class.
LteCcmMacSapUser * m_ccmMacSapUser
CCM MAC SAP user.
Definition: lte-enb-mac.h:413
std::vector< MacCeListElement_s > m_ulCeReceived
CE received (BSR up to now)
Definition: lte-enb-mac.h:382
std::vector< std::vector< Ptr< PacketBurst > > > DlHarqProcessesBuffer_t
DlHarqProcessesBuffer_t typedef.
Definition: lte-enb-mac.h:47
void DoCschedUeReleaseCnf(FfMacCschedSapUser::CschedUeReleaseCnfParameters params)
CSched UE Release configure function.
EnbMacMemberLteEnbCmacSapProvider class.
Definition: lte-enb-mac.cc:59
std::vector< DlInfoListElement_s > m_dlInfoListReceived
DL HARQ feedback received.
Definition: lte-enb-mac.h:384
void SetLteEnbPhySapProvider(LteEnbPhySapProvider *s)
Set the PHY SAP Provider.
Definition: lte-enb-mac.cc:475
LteEnbCmacSapUser * m_cmacSapUser
the CMAC SAP user
Definition: lte-enb-mac.h:399
Parameters of the SCHED_UL_CQI_INFO_REQ primitive.
LteEnbPhySapUser * GetLteEnbPhySapUser()
Get the eNB-PHY SAP User.
Definition: lte-enb-mac.cc:482
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition: lte-mac-sap.h:95
struct defining the RACH configuration of the MAC
FfMacSchedSapProvider * m_schedSapProvider
the Sched SAP provider
Definition: lte-enb-mac.h:402
void DoReportBufferStatus(LteMacSapProvider::ReportBufferStatusParameters params)
Report Buffer Status function.
LteCcmMacSapProvider * m_ccmMacSapProvider
CCM MAC SAP provider.
Definition: lte-enb-mac.h:412
void DoCschedUeConfigUpdateInd(FfMacCschedSapUser::CschedUeConfigUpdateIndParameters params)
CSched UE Config Update Indication function.
LteMacSapUser * m_macSapUser
the MAC SAP user
Definition: lte-enb-mac.h:398
void DoSchedDlConfigInd(FfMacSchedSapUser::SchedDlConfigIndParameters ind)
Sched DL Config Indication function.
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition: lte-mac-sap.h:36
TracedCallback< DlSchedulingCallbackInfo > m_dlScheduling
Trace information regarding DL scheduling Frame number, Subframe number, RNTI, MCS of TB1...
Definition: lte-enb-mac.h:427
void SetLteMacSapUser(LteMacSapUser *s)
Set the MAC SAP user.
Definition: lte-enb-mac.cc:451
uint32_t m_frameNo
frame number of current subframe indication
Definition: lte-enb-mac.h:417
void DoCschedLcConfigCnf(FfMacCschedSapUser::CschedLcConfigCnfParameters params)
CSched LC Config configure function.
Parameters of the SCHED_UL_CONFIG_IND primitive.
void DoReceiveLteControlMessage(Ptr< LteControlMessage > msg)
Receive a DL CQI ideal control message.
Definition: lte-enb-mac.cc:648
A base class which provides memory management and object aggregation.
Definition: object.h:87
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:461
Service Access Point (SAP) offered by the eNB MAC to the eNB RRC See Femto Forum MAC Scheduler Interf...
virtual ~LteEnbMac(void)
Definition: lte-enb-mac.cc:395
std::map< uint16_t, uint32_t > m_rapIdRntiMap
RAPID RNTI map.
Definition: lte-enb-mac.h:465
std::map< uint16_t, DlHarqProcessesBuffer_t > m_miDlHarqProcessesPackets
Packet under transmission of the DL HARQ process.
Definition: lte-enb-mac.h:439
info associated with a preamble allocated for non-contention based RA
Definition: lte-enb-mac.h:450
a unique identifier for an interface.
Definition: type-id.h:58
void DoSubframeIndication(uint32_t frameNo, uint32_t subframeNo)
Subrame Indication function.
Definition: lte-enb-mac.cc:501
This class implements the MAC layer of the eNodeB device.
Definition: lte-enb-mac.h:55
FfMacSchedSapUser class.
Parameters of the CSCHED_UE_RELEASE_CNF primitive.
void SetFfMacSchedSapProvider(FfMacSchedSapProvider *s)
Set the scheduler SAP provider.
Definition: lte-enb-mac.cc:425
FfMacCschedSapProvider * m_cschedSapProvider
the Csched SAP provider
Definition: lte-enb-mac.h:403
Time expiryTime
value the expiration time of this allocation (so that stale preambles can be reused) ...
Definition: lte-enb-mac.h:453
void ReceiveDlCqiLteControlMessage(Ptr< DlCqiLteControlMessage > msg)
Receive a DL CQI ideal control message.
Definition: lte-enb-mac.cc:696
void DoCschedCellConfigCnf(FfMacCschedSapUser::CschedCellConfigCnfParameters params)
CSched Cell Config configure function.
Parameters for LteMacSapProvider::TransmitPdu.
Definition: lte-mac-sap.h:45