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  */
21 
22 #ifndef LTE_ENB_MAC_H
23 #define LTE_ENB_MAC_H
24 
25 
26 #include <map>
27 #include <vector>
28 #include <ns3/lte-common.h>
29 #include <ns3/lte-mac-sap.h>
30 #include <ns3/lte-enb-cmac-sap.h>
31 #include <ns3/ff-mac-csched-sap.h>
32 #include <ns3/ff-mac-sched-sap.h>
33 #include <ns3/lte-enb-phy-sap.h>
34 #include "ns3/traced-value.h"
35 #include "ns3/trace-source-accessor.h"
36 #include <ns3/packet.h>
37 #include <ns3/packet-burst.h>
38 
39 namespace ns3 {
40 
41 class DlCqiLteControlMessage;
42 class UlCqiLteControlMessage;
43 class PdcchMapLteControlMessage;
44 
45 typedef std::vector <std::vector < Ptr<PacketBurst> > > DlHarqProcessesBuffer_t;
46 
50 class LteEnbMac : public Object
51 {
57 
58 public:
59  static TypeId GetTypeId (void);
60 
61  LteEnbMac (void);
62  virtual ~LteEnbMac (void);
63  virtual void DoDispose (void);
64 
65 
86 
87 
88 
109 
110 
116 
122 
134  typedef void (* DlSchedulingTracedCallback)
135  (uint32_t frame, uint32_t subframe, uint16_t rnti,
136  uint8_t mcs0, uint16_t tbs0Size,
137  uint8_t mcs1, uint16_t tbs1Size);
138 
148  typedef void (* UlSchedulingTracedCallback)
149  (uint32_t frame, uint32_t subframe, uint16_t rnti,
150  uint8_t mcs, uint16_t tbsSize);
151 
152 private:
153 
159 
161 
167 
168 
170 
171 
172 
173  // forwarded from LteEnbCmacSapProvider
174  void DoConfigureMac (uint8_t ulBandwidth, uint8_t dlBandwidth);
175  void DoAddUe (uint16_t rnti);
176  void DoRemoveUe (uint16_t rnti);
179  void DoReleaseLc (uint16_t rnti, uint8_t lcid);
183 
184  // forwarded from LteMacSapProvider
187 
188 
189  // forwarded from FfMacCchedSapUser
197 
198  // forwarded from FfMacSchedSapUser
201 
202  // forwarded from LteEnbPhySapUser
203  void DoSubframeIndication (uint32_t frameNo, uint32_t subframeNo);
204  void DoReceiveRachPreamble (uint8_t prachId);
205 
206 public:
207  // legacy public for use the Phy callback
208  void DoReceivePhyPdu (Ptr<Packet> p);
209 
210 private:
213 
214  // rnti, lcid, SAP of the RLC instance
215  std::map <uint16_t, std::map<uint8_t, LteMacSapUser*> > m_rlcAttached;
216 
217  std::vector <CqiListElement_s> m_dlCqiReceived; // DL-CQI received
218  std::vector <FfMacSchedSapProvider::SchedUlCqiInfoReqParameters> m_ulCqiReceived; // UL-CQI received
219  std::vector <MacCeListElement_s> m_ulCeReceived; // CE received (BSR up to now)
220 
221  std::vector <DlInfoListElement_s> m_dlInfoListReceived; // DL HARQ feedback received
222 
223  std::vector <UlInfoListElement_s> m_ulInfoListReceived; // UL HARQ feedback received
224 
225 
226  /*
227  * Map of UE's info element (see 4.3.12 of FF MAC Scheduler API)
228  */
229 // std::map <uint16_t,UlInfoListElement_s> m_ulInfoListElements;
230 
231 
232 
237 
238 
243 
244  // PHY-SAP
247 
248  uint32_t m_frameNo;
249  uint32_t m_subframeNo;
255  TracedCallback<uint32_t, uint32_t, uint16_t,
256  uint8_t, uint16_t, uint8_t, uint16_t> m_dlScheduling;
261  TracedCallback<uint32_t, uint32_t, uint16_t,
262  uint8_t, uint16_t> m_ulScheduling;
263 
264  uint8_t m_macChTtiDelay; // delay of MAC, PHY and channel in terms of TTIs
265 
266 
267  std::map <uint16_t, DlHarqProcessesBuffer_t> m_miDlHarqProcessesPackets; // Packet under trasmission of the DL HARQ process
268 
272 
278  {
279  uint16_t rnti;
281  };
282 
288  std::map<uint8_t, NcRaPreambleInfo> m_allocatedNcRaPreambleMap;
289 
290  std::map<uint8_t, uint32_t> m_receivedRachPreambleCount;
291 
292  std::map<uint8_t, uint32_t> m_rapIdRntiMap;
293 };
294 
295 } // end namespace ns3
296 
297 #endif /* LTE_ENB_MAC_ENTITY_H */
void DoConfigureMac(uint8_t ulBandwidth, uint8_t dlBandwidth)
Definition: lte-enb-mac.cc:732
void DoReconfigureLc(LteEnbCmacSapProvider::LcInfo lcinfo)
Definition: lte-enb-mac.cc:841
FfMacSchedSapUser * m_schedSapUser
Definition: lte-enb-mac.h:241
Parameters of the CSCHED_LC_CONFIG_CNF primitive.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
void DoDlInfoListElementHarqFeeback(DlInfoListElement_s params)
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
std::vector< FfMacSchedSapProvider::SchedUlCqiInfoReqParameters > m_ulCqiReceived
Definition: lte-enb-mac.h:218
Parameters of the CSCHED_UE_CONFIG_CNF primitive.
void DoReceivePhyPdu(Ptr< Packet > p)
Definition: lte-enb-mac.cc:672
Parameters of the CSCHED_CELL_CONFIG_UPDATE_IND primitive.
void DoUlInfoListElementHarqFeeback(UlInfoListElement_s params)
LteEnbCmacSapProvider * m_cmacSapProvider
Definition: lte-enb-mac.h:234
std::map< uint16_t, std::map< uint8_t, LteMacSapUser * > > m_rlcAttached
Definition: lte-enb-mac.h:215
void DoAddLc(LteEnbCmacSapProvider::LcInfo lcinfo, LteMacSapUser *msu)
Definition: lte-enb-mac.cc:794
LteEnbCmacSapProvider::RachConfig DoGetRachConfig()
Definition: lte-enb-mac.cc:875
void DoCschedCellConfigUpdateInd(FfMacCschedSapUser::CschedCellConfigUpdateIndParameters params)
void DoReleaseLc(uint16_t rnti, uint8_t lcid)
Definition: lte-enb-mac.cc:847
void SetLteEnbCmacSapUser(LteEnbCmacSapUser *s)
Set the control MAC SAP user.
Definition: lte-enb-mac.cc:421
Forward calls to a chain of Callback.
void DoSchedUlConfigInd(FfMacSchedSapUser::SchedUlConfigIndParameters params)
uint8_t m_preambleTransMax
Definition: lte-enb-mac.h:270
Provides the CSCHED SAP.
TracedCallback< uint32_t, uint32_t, uint16_t, uint8_t, uint16_t > m_ulScheduling
Trace information regarding UL scheduling Frame number, Subframe number, RNTI, MCS of TB...
Definition: lte-enb-mac.h:262
Parameters of the CSCHED_UE_CONFIG_UPDATE_IND primitive.
void DoTransmitPdu(LteMacSapProvider::TransmitPduParameters)
Definition: lte-enb-mac.cc:930
Service Access Point (SAP) offered by the eNB-PHY to the eNB-MAC.
See section 4.3.12 ulInfoListElement.
void DoAddUe(uint16_t rnti)
Definition: lte-enb-mac.cc:746
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:401
LteMacSapProvider * GetLteMacSapProvider(void)
Get the MAC SAP provider.
Definition: lte-enb-mac.cc:415
Parameters for LteMacSapProvider::ReportBufferStatus.
Definition: lte-mac-sap.h:66
std::map< uint8_t, uint32_t > m_receivedRachPreambleCount
Definition: lte-enb-mac.h:290
FfMacCschedSapUser * m_cschedSapUser
Definition: lte-enb-mac.h:242
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:395
Parameters of the CSCHED_LC_RELEASE_CNF primitive.
LteEnbPhySapProvider * m_enbPhySapProvider
Definition: lte-enb-mac.h:245
LteEnbPhySapUser * m_enbPhySapUser
Definition: lte-enb-mac.h:246
FfMacSchedSapUser * GetFfMacSchedSapUser(void)
Get the scheduler SAP user.
Definition: lte-enb-mac.cc:389
void DoCschedUeConfigCnf(FfMacCschedSapUser::CschedUeConfigCnfParameters params)
void DoUeUpdateConfigurationReq(LteEnbCmacSapProvider::UeConfig params)
Definition: lte-enb-mac.cc:862
Logical Channel information to be passed to CmacSapProvider::ConfigureLc.
std::map< uint8_t, uint32_t > m_rapIdRntiMap
Definition: lte-enb-mac.h:292
uint16_t rnti
rnti previously allocated for this non-contention based RA procedure
Definition: lte-enb-mac.h:279
uint8_t m_macChTtiDelay
Definition: lte-enb-mac.h:264
void DoCschedLcReleaseCnf(FfMacCschedSapUser::CschedLcReleaseCnfParameters params)
static TypeId GetTypeId(void)
Definition: lte-enb-mac.cc:313
void DoUlCqiReport(FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi)
Definition: lte-enb-mac.cc:635
Provides the SCHED SAP.
virtual void DoDispose(void)
Destructor implementation.
Definition: lte-enb-mac.cc:365
void ReceiveBsrMessage(MacCeListElement_s bsr)
Receive a CE element containing the buffer status report.
Definition: lte-enb-mac.cc:663
uint8_t m_raResponseWindowSize
Definition: lte-enb-mac.h:271
See section 4.3.23 dlInfoListElement.
void DoReceiveRachPreamble(uint8_t prachId)
Definition: lte-enb-mac.cc:627
void DoRemoveUe(uint16_t rnti)
Definition: lte-enb-mac.cc:783
See section 4.3.14 macCEListElement.
Parameters for [re]configuring the UE.
uint32_t m_subframeNo
Definition: lte-enb-mac.h:249
LteEnbCmacSapProvider::AllocateNcRaPreambleReturnValue DoAllocateNcRaPreamble(uint16_t rnti)
Definition: lte-enb-mac.cc:885
uint8_t m_numberOfRaPreambles
Definition: lte-enb-mac.h:269
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void DoReportBufferStatus(LteMacSapProvider::ReportBufferStatusParameters)
Definition: lte-enb-mac.cc:946
LteEnbCmacSapProvider * GetLteEnbCmacSapProvider(void)
Get the control MAC SAP provider.
Definition: lte-enb-mac.cc:427
void(* UlSchedulingTracedCallback)(uint32_t frame, uint32_t subframe, uint16_t rnti, uint8_t mcs, uint16_t tbsSize)
TracedCallback signature for UL scheduling events.
Definition: lte-enb-mac.h:149
std::vector< UlInfoListElement_s > m_ulInfoListReceived
Definition: lte-enb-mac.h:223
LteMacSapProvider * m_macSapProvider
Definition: lte-enb-mac.h:233
std::vector< CqiListElement_s > m_dlCqiReceived
Definition: lte-enb-mac.h:217
std::vector< MacCeListElement_s > m_ulCeReceived
Definition: lte-enb-mac.h:219
std::vector< std::vector< Ptr< PacketBurst > > > DlHarqProcessesBuffer_t
Definition: lte-enb-mac.h:43
void DoCschedUeReleaseCnf(FfMacCschedSapUser::CschedUeReleaseCnfParameters params)
std::vector< DlInfoListElement_s > m_dlInfoListReceived
Definition: lte-enb-mac.h:221
void SetLteEnbPhySapProvider(LteEnbPhySapProvider *s)
Set the PHY SAP Provider.
Definition: lte-enb-mac.cc:433
LteEnbCmacSapUser * m_cmacSapUser
Definition: lte-enb-mac.h:236
Parameters of the SCHED_UL_CQI_INFO_REQ primitive.
LteEnbPhySapUser * GetLteEnbPhySapUser()
Get the eNB-PHY SAP User.
Definition: lte-enb-mac.cc:440
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition: lte-mac-sap.h:94
struct defining the RACH configuration of the MAC
void(* DlSchedulingTracedCallback)(uint32_t frame, uint32_t subframe, uint16_t rnti, uint8_t mcs0, uint16_t tbs0Size, uint8_t mcs1, uint16_t tbs1Size)
TracedCallback signature for DL scheduling events.
Definition: lte-enb-mac.h:135
FfMacSchedSapProvider * m_schedSapProvider
Definition: lte-enb-mac.h:239
void DoCschedUeConfigUpdateInd(FfMacCschedSapUser::CschedUeConfigUpdateIndParameters params)
LteMacSapUser * m_macSapUser
Definition: lte-enb-mac.h:235
void DoSchedDlConfigInd(FfMacSchedSapUser::SchedDlConfigIndParameters ind)
Definition: lte-enb-mac.cc:969
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition: lte-mac-sap.h:36
void SetLteMacSapUser(LteMacSapUser *s)
Set the MAC SAP user.
Definition: lte-enb-mac.cc:409
uint32_t m_frameNo
Definition: lte-enb-mac.h:248
void DoCschedLcConfigCnf(FfMacCschedSapUser::CschedLcConfigCnfParameters params)
Parameters of the SCHED_UL_CONFIG_IND primitive.
void DoReceiveLteControlMessage(Ptr< LteControlMessage > msg)
Definition: lte-enb-mac.cc:602
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 acccess preamble IDs allocated for non-contention based access...
Definition: lte-enb-mac.h:288
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:359
TracedCallback< uint32_t, uint32_t, uint16_t, uint8_t, uint16_t, uint8_t, uint16_t > m_dlScheduling
Trace information regarding DL scheduling Frame number, Subframe number, RNTI, MCS of TB1...
Definition: lte-enb-mac.h:256
std::map< uint16_t, DlHarqProcessesBuffer_t > m_miDlHarqProcessesPackets
Definition: lte-enb-mac.h:267
info associated with a preamble allocated for non-contention based RA
Definition: lte-enb-mac.h:277
a unique identifier for an interface.
Definition: type-id.h:58
void DoSubframeIndication(uint32_t frameNo, uint32_t subframeNo)
Definition: lte-enb-mac.cc:448
This class implements the MAC layer of the eNodeB device.
Definition: lte-enb-mac.h:50
Parameters of the CSCHED_UE_RELEASE_CNF primitive.
void SetFfMacSchedSapProvider(FfMacSchedSapProvider *s)
Set the scheduler SAP provider.
Definition: lte-enb-mac.cc:383
FfMacCschedSapProvider * m_cschedSapProvider
Definition: lte-enb-mac.h:240
Time expiryTime
value the expiration time of this allocation (so that stale preambles can be reused) ...
Definition: lte-enb-mac.h:280
void ReceiveDlCqiLteControlMessage(Ptr< DlCqiLteControlMessage > msg)
Receive a DL CQI ideal control message.
Definition: lte-enb-mac.cc:650
void DoCschedCellConfigCnf(FfMacCschedSapUser::CschedCellConfigCnfParameters params)
Parameters for LteMacSapProvider::TransmitPdu.
Definition: lte-mac-sap.h:45