A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
lte-enb-mac.h
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 {
53  friend class EnbMacMemberLteMacSapProvider<LteEnbMac>;
54  friend class EnbMacMemberFfMacSchedSapUser;
55  friend class EnbMacMemberFfMacCschedSapUser;
56  friend class EnbMacMemberLteEnbPhySapUser;
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 
123 
124 private:
125 
131 
132  void DoReceiveLteControlMessage (Ptr<LteControlMessage> msg);
133 
139 
140 
141  void DoUlCqiReport (FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi);
142 
143 
144 
145  // forwarded from LteEnbCmacSapProvider
146  void DoConfigureMac (uint8_t ulBandwidth, uint8_t dlBandwidth);
147  void DoAddUe (uint16_t rnti);
148  void DoRemoveUe (uint16_t rnti);
149  void DoAddLc (LteEnbCmacSapProvider::LcInfo lcinfo, LteMacSapUser* msu);
150  void DoReconfigureLc (LteEnbCmacSapProvider::LcInfo lcinfo);
151  void DoReleaseLc (uint16_t rnti, uint8_t lcid);
152  void DoUeUpdateConfigurationReq (LteEnbCmacSapProvider::UeConfig params);
153  LteEnbCmacSapProvider::RachConfig DoGetRachConfig ();
154  LteEnbCmacSapProvider::AllocateNcRaPreambleReturnValue DoAllocateNcRaPreamble (uint16_t rnti);
155 
156  // forwarded from LteMacSapProvider
157  void DoTransmitPdu (LteMacSapProvider::TransmitPduParameters);
158  void DoReportBufferStatus (LteMacSapProvider::ReportBufferStatusParameters);
159 
160 
161  // forwarded from FfMacCchedSapUser
162  void DoCschedCellConfigCnf (FfMacCschedSapUser::CschedCellConfigCnfParameters params);
163  void DoCschedUeConfigCnf (FfMacCschedSapUser::CschedUeConfigCnfParameters params);
164  void DoCschedLcConfigCnf (FfMacCschedSapUser::CschedLcConfigCnfParameters params);
165  void DoCschedLcReleaseCnf (FfMacCschedSapUser::CschedLcReleaseCnfParameters params);
166  void DoCschedUeReleaseCnf (FfMacCschedSapUser::CschedUeReleaseCnfParameters params);
167  void DoCschedUeConfigUpdateInd (FfMacCschedSapUser::CschedUeConfigUpdateIndParameters params);
168  void DoCschedCellConfigUpdateInd (FfMacCschedSapUser::CschedCellConfigUpdateIndParameters params);
169 
170  // forwarded from FfMacSchedSapUser
171  void DoSchedDlConfigInd (FfMacSchedSapUser::SchedDlConfigIndParameters ind);
172  void DoSchedUlConfigInd (FfMacSchedSapUser::SchedUlConfigIndParameters params);
173 
174  // forwarded from LteEnbPhySapUser
175  void DoSubframeIndication (uint32_t frameNo, uint32_t subframeNo);
176  void DoReceiveRachPreamble (uint8_t prachId);
177 
178 public:
179  // legacy public for use the Phy callback
180  void DoReceivePhyPdu (Ptr<Packet> p);
181 
182 private:
183  void DoUlInfoListElementHarqFeeback (UlInfoListElement_s params);
184  void DoDlInfoListElementHarqFeeback (DlInfoListElement_s params);
185 
186  // rnti, lcid, SAP of the RLC instance
187  std::map <uint16_t, std::map<uint8_t, LteMacSapUser*> > m_rlcAttached;
188 
189  std::vector <CqiListElement_s> m_dlCqiReceived; // DL-CQI received
190  std::vector <FfMacSchedSapProvider::SchedUlCqiInfoReqParameters> m_ulCqiReceived; // UL-CQI received
191  std::vector <MacCeListElement_s> m_ulCeReceived; // CE received (BSR up to now)
192 
193  std::vector <DlInfoListElement_s> m_dlInfoListReceived; // DL HARQ feedback received
194 
195  std::vector <UlInfoListElement_s> m_ulInfoListReceived; // UL HARQ feedback received
196 
197 
198  /*
199  * Map of UE's info element (see 4.3.12 of FF MAC Scheduler API)
200  */
201 // std::map <uint16_t,UlInfoListElement_s> m_ulInfoListElements;
202 
203 
204 
205  LteMacSapProvider* m_macSapProvider;
206  LteEnbCmacSapProvider* m_cmacSapProvider;
207  LteMacSapUser* m_macSapUser;
208  LteEnbCmacSapUser* m_cmacSapUser;
209 
210 
211  FfMacSchedSapProvider* m_schedSapProvider;
212  FfMacCschedSapProvider* m_cschedSapProvider;
213  FfMacSchedSapUser* m_schedSapUser;
214  FfMacCschedSapUser* m_cschedSapUser;
215 
216  // PHY-SAP
217  LteEnbPhySapProvider* m_enbPhySapProvider;
218  LteEnbPhySapUser* m_enbPhySapUser;
219 
220  uint32_t m_frameNo;
221  uint32_t m_subframeNo;
233 
234  uint8_t m_macChTtiDelay; // delay of MAC, PHY and channel in terms of TTIs
235 
236 
237  std::map <uint16_t, DlHarqProcessesBuffer_t> m_miDlHarqProcessesPackets; // Packet under trasmission of the DL HARQ process
238 
239  uint8_t m_numberOfRaPreambles;
240  uint8_t m_preambleTransMax;
241  uint8_t m_raResponseWindowSize;
242 
248  {
249  uint16_t rnti;
251  };
252 
258  std::map<uint8_t, NcRaPreambleInfo> m_allocatedNcRaPreambleMap;
259 
260  std::map<uint8_t, uint32_t> m_receivedRachPreambleCount;
261 
262  std::map<uint8_t, uint32_t> m_rapIdRntiMap;
263 };
264 
265 } // end namespace ns3
266 
267 #endif /* LTE_ENB_MAC_ENTITY_H */
keep track of time unit.
Definition: nstime.h:149
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
void SetLteEnbCmacSapUser(LteEnbCmacSapUser *s)
Set the control MAC SAP user.
Definition: lte-enb-mac.cc:419
Provides the CSCHED SAP.
TracedCallback< uint32_t, uint32_t, uint16_t, uint8_t, uint16_t > m_ulScheduling
Definition: lte-enb-mac.h:232
See section 4.3.12 ulInfoListElement.
FfMacCschedSapUser * GetFfMacCschedSapUser(void)
Get the control scheduler SAP user.
Definition: lte-enb-mac.cc:399
LteMacSapProvider * GetLteMacSapProvider(void)
Get the MAC SAP provider.
Definition: lte-enb-mac.cc:413
void SetFfMacCschedSapProvider(FfMacCschedSapProvider *s)
Set the control scheduler SAP provider.
Definition: lte-enb-mac.cc:393
FfMacSchedSapUser * GetFfMacSchedSapUser(void)
Get the scheduler SAP user.
Definition: lte-enb-mac.cc:387
uint16_t rnti
rnti previously allocated for this non-contention based RA procedure
Definition: lte-enb-mac.h:249
Provides the SCHED SAP.
virtual void DoDispose(void)
Definition: lte-enb-mac.cc:363
void ReceiveBsrMessage(MacCeListElement_s bsr)
Receive a CE element containing the buffer status report.
Definition: lte-enb-mac.cc:657
See section 4.3.23 dlInfoListElement.
See section 4.3.14 macCEListElement.
Parameters for [re]configuring the UE.
LteEnbCmacSapProvider * GetLteEnbCmacSapProvider(void)
Get the control MAC SAP provider.
Definition: lte-enb-mac.cc:425
void SetLteEnbPhySapProvider(LteEnbPhySapProvider *s)
Set the PHY SAP Provider.
Definition: lte-enb-mac.cc:431
LteEnbPhySapUser * GetLteEnbPhySapUser()
Get the eNB-PHY SAP User.
Definition: lte-enb-mac.cc:438
void SetLteMacSapUser(LteMacSapUser *s)
Set the MAC SAP user.
Definition: lte-enb-mac.cc:407
a base class which provides memory management and object aggregation
Definition: object.h:63
std::map< uint8_t, NcRaPreambleInfo > m_allocatedNcRaPreambleMap
Definition: lte-enb-mac.h:258
TracedCallback< uint32_t, uint32_t, uint16_t, uint8_t, uint16_t, uint8_t, uint16_t > m_dlScheduling
Definition: lte-enb-mac.h:227
a unique identifier for an interface.
Definition: type-id.h:44
void SetFfMacSchedSapProvider(FfMacSchedSapProvider *s)
Set the scheduler SAP provider.
Definition: lte-enb-mac.cc:381
Time expiryTime
value the expiration time of this allocation (so that stale preambles can be reused) ...
Definition: lte-enb-mac.h:250
void ReceiveDlCqiLteControlMessage(Ptr< DlCqiLteControlMessage > msg)
Receive a DL CQI ideal control message.
Definition: lte-enb-mac.cc:644