OLD | NEW |
(Empty) | |
| 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: Nicola Baldo <nbaldo@cttc.es> |
| 19 * Modified by: NIST |
| 20 */ |
| 21 |
| 22 |
| 23 #include "ns3/log.h" |
| 24 #include "ns3/simulator.h" |
| 25 |
| 26 #include "ns3/nist-lte-rlc.h" |
| 27 #include "ns3/nist-lte-rlc-tag.h" |
| 28 // #include "nist-lte-mac-sap.h" |
| 29 #include "ns3/nist-lte-rlc-sap.h" |
| 30 // #include "nist-ff-mac-sched-sap.h" |
| 31 |
| 32 namespace ns3 { |
| 33 |
| 34 NS_LOG_COMPONENT_DEFINE ("NistLteRlc"); |
| 35 |
| 36 |
| 37 /////////////////////////////////////// |
| 38 |
| 39 class NistLteRlcSpecificLteMacSapUser : public NistLteMacSapUser |
| 40 { |
| 41 public: |
| 42 NistLteRlcSpecificLteMacSapUser (NistLteRlc* rlc); |
| 43 |
| 44 // Interface implemented from NistLteMacSapUser |
| 45 virtual void NotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqI
d); |
| 46 virtual void NotifyHarqDeliveryFailure (); |
| 47 virtual void ReceivePdu (Ptr<Packet> p); |
| 48 |
| 49 private: |
| 50 NistLteRlcSpecificLteMacSapUser (); |
| 51 NistLteRlc* m_rlc; |
| 52 }; |
| 53 |
| 54 NistLteRlcSpecificLteMacSapUser::NistLteRlcSpecificLteMacSapUser (NistLteRlc* rl
c) |
| 55 : m_rlc (rlc) |
| 56 { |
| 57 } |
| 58 |
| 59 NistLteRlcSpecificLteMacSapUser::NistLteRlcSpecificLteMacSapUser () |
| 60 { |
| 61 } |
| 62 |
| 63 void |
| 64 NistLteRlcSpecificLteMacSapUser::NotifyTxOpportunity (uint32_t bytes, uint8_t la
yer, uint8_t harqId) |
| 65 { |
| 66 m_rlc->DoNotifyTxOpportunity (bytes, layer, harqId); |
| 67 } |
| 68 |
| 69 void |
| 70 NistLteRlcSpecificLteMacSapUser::NotifyHarqDeliveryFailure () |
| 71 { |
| 72 m_rlc->DoNotifyHarqDeliveryFailure (); |
| 73 } |
| 74 |
| 75 void |
| 76 NistLteRlcSpecificLteMacSapUser::ReceivePdu (Ptr<Packet> p) |
| 77 { |
| 78 m_rlc->DoReceivePdu (p); |
| 79 } |
| 80 |
| 81 |
| 82 /////////////////////////////////////// |
| 83 |
| 84 NS_OBJECT_ENSURE_REGISTERED (NistLteRlc); |
| 85 |
| 86 NistLteRlc::NistLteRlc () |
| 87 : m_rlcSapUser (0), |
| 88 m_macSapProvider (0), |
| 89 m_rnti (0), |
| 90 m_lcid (0), |
| 91 m_srcL2Id (0), |
| 92 m_dstL2Id (0) |
| 93 { |
| 94 NS_LOG_FUNCTION (this); |
| 95 m_rlcSapProvider = new NistLteRlcSpecificLteRlcSapProvider<NistLteRlc> (this); |
| 96 m_macSapUser = new NistLteRlcSpecificLteMacSapUser (this); |
| 97 } |
| 98 |
| 99 NistLteRlc::~NistLteRlc () |
| 100 { |
| 101 NS_LOG_FUNCTION (this); |
| 102 } |
| 103 |
| 104 TypeId NistLteRlc::GetTypeId (void) |
| 105 { |
| 106 static TypeId tid = TypeId ("ns3::NistLteRlc") |
| 107 .SetParent<Object> () |
| 108 .AddTraceSource ("TxPDU", |
| 109 "PDU transmission notified to the MAC.", |
| 110 MakeTraceSourceAccessor (&NistLteRlc::m_txPdu), |
| 111 "ns3::NistLteRlc::NotifyTxTracedCallback") |
| 112 .AddTraceSource ("RxPDU", |
| 113 "PDU received.", |
| 114 MakeTraceSourceAccessor (&NistLteRlc::m_rxPdu), |
| 115 "ns3::NistLteRlc::ReceiveTracedCallback") |
| 116 ; |
| 117 return tid; |
| 118 } |
| 119 |
| 120 void |
| 121 NistLteRlc::DoDispose () |
| 122 { |
| 123 NS_LOG_FUNCTION (this); |
| 124 delete (m_rlcSapProvider); |
| 125 delete (m_macSapUser); |
| 126 } |
| 127 |
| 128 void |
| 129 NistLteRlc::SetRnti (uint16_t rnti) |
| 130 { |
| 131 NS_LOG_FUNCTION (this << (uint32_t) rnti); |
| 132 m_rnti = rnti; |
| 133 } |
| 134 |
| 135 void |
| 136 NistLteRlc::SetLcId (uint8_t lcId) |
| 137 { |
| 138 NS_LOG_FUNCTION (this << (uint32_t) lcId); |
| 139 m_lcid = lcId; |
| 140 } |
| 141 |
| 142 void |
| 143 NistLteRlc::SetSourceL2Id (uint32_t src) |
| 144 { |
| 145 NS_LOG_FUNCTION (this << src); |
| 146 m_srcL2Id = src; |
| 147 } |
| 148 ·· |
| 149 void |
| 150 NistLteRlc::SetDestinationL2Id (uint32_t dst) |
| 151 { |
| 152 NS_LOG_FUNCTION (this << dst); |
| 153 m_dstL2Id = dst; |
| 154 } |
| 155 ·· |
| 156 |
| 157 void |
| 158 NistLteRlc::SetNistLteRlcSapUser (NistLteRlcSapUser * s) |
| 159 { |
| 160 NS_LOG_FUNCTION (this << s); |
| 161 m_rlcSapUser = s; |
| 162 } |
| 163 |
| 164 NistLteRlcSapProvider* |
| 165 NistLteRlc::GetNistLteRlcSapProvider () |
| 166 { |
| 167 NS_LOG_FUNCTION (this); |
| 168 return m_rlcSapProvider; |
| 169 } |
| 170 |
| 171 void |
| 172 NistLteRlc::SetNistLteMacSapProvider (NistLteMacSapProvider * s) |
| 173 { |
| 174 NS_LOG_FUNCTION (this << s); |
| 175 m_macSapProvider = s; |
| 176 } |
| 177 |
| 178 NistLteMacSapUser* |
| 179 NistLteRlc::GetNistLteMacSapUser () |
| 180 { |
| 181 NS_LOG_FUNCTION (this); |
| 182 return m_macSapUser; |
| 183 } |
| 184 |
| 185 |
| 186 |
| 187 //////////////////////////////////////// |
| 188 |
| 189 NS_OBJECT_ENSURE_REGISTERED (NistLteRlcSm); |
| 190 |
| 191 NistLteRlcSm::NistLteRlcSm () |
| 192 { |
| 193 NS_LOG_FUNCTION (this); |
| 194 } |
| 195 |
| 196 NistLteRlcSm::~NistLteRlcSm () |
| 197 { |
| 198 NS_LOG_FUNCTION (this); |
| 199 } |
| 200 |
| 201 TypeId |
| 202 NistLteRlcSm::GetTypeId (void) |
| 203 { |
| 204 static TypeId tid = TypeId ("ns3::NistLteRlcSm") |
| 205 .SetParent<NistLteRlc> () |
| 206 .AddConstructor<NistLteRlcSm> () |
| 207 ; |
| 208 return tid; |
| 209 } |
| 210 |
| 211 void |
| 212 NistLteRlcSm::DoInitialize () |
| 213 { |
| 214 NS_LOG_FUNCTION (this); |
| 215 ReportBufferNistStatus (); |
| 216 } |
| 217 |
| 218 void |
| 219 NistLteRlcSm::DoDispose () |
| 220 { |
| 221 NS_LOG_FUNCTION (this); |
| 222 NistLteRlc::DoDispose (); |
| 223 } |
| 224 |
| 225 void |
| 226 NistLteRlcSm::DoTransmitPdcpPdu (Ptr<Packet> p) |
| 227 { |
| 228 NS_LOG_FUNCTION (this << p); |
| 229 } |
| 230 |
| 231 void |
| 232 NistLteRlcSm::DoReceivePdu (Ptr<Packet> p) |
| 233 { |
| 234 NS_LOG_FUNCTION (this << p); |
| 235 // RLC Performance evaluation |
| 236 NistRlcTag rlcTag; |
| 237 Time delay; |
| 238 if (p->FindFirstMatchingByteTag(rlcTag)) |
| 239 { |
| 240 delay = Simulator::Now() - rlcTag.GetSenderTimestamp (); |
| 241 } |
| 242 NS_LOG_LOGIC (" RNTI=" << m_rnti· |
| 243 << " LCID=" << (uint32_t) m_lcid· |
| 244 << " size=" << p->GetSize ()· |
| 245 << " delay=" << delay.GetNanoSeconds ()); |
| 246 m_rxPdu(m_rnti, m_lcid, p->GetSize (), delay.GetNanoSeconds () ); |
| 247 } |
| 248 |
| 249 void |
| 250 NistLteRlcSm::DoNotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harq
Id) |
| 251 { |
| 252 NS_LOG_FUNCTION (this << bytes); |
| 253 NistLteMacSapProvider::NistTransmitPduParameters params; |
| 254 params.pdu = Create<Packet> (bytes); |
| 255 params.rnti = m_rnti; |
| 256 params.lcid = m_lcid; |
| 257 params.srcL2Id = m_srcL2Id; |
| 258 params.dstL2Id = m_dstL2Id; |
| 259 params.layer = layer; |
| 260 params.harqProcessId = harqId; |
| 261 |
| 262 // RLC Performance evaluation |
| 263 NistRlcTag tag (Simulator::Now()); |
| 264 params.pdu->AddByteTag (tag); |
| 265 NS_LOG_LOGIC (" RNTI=" << m_rnti· |
| 266 << " LCID=" << (uint32_t) m_lcid· |
| 267 << " size=" << bytes); |
| 268 m_txPdu(m_rnti, m_lcid, bytes); |
| 269 |
| 270 m_macSapProvider->TransmitPdu (params); |
| 271 ReportBufferNistStatus (); |
| 272 } |
| 273 |
| 274 void |
| 275 NistLteRlcSm::DoNotifyHarqDeliveryFailure () |
| 276 { |
| 277 NS_LOG_FUNCTION (this); |
| 278 } |
| 279 |
| 280 void |
| 281 NistLteRlcSm::ReportBufferNistStatus () |
| 282 { |
| 283 NS_LOG_FUNCTION (this); |
| 284 NistLteMacSapProvider::NistReportBufferNistStatusParameters p; |
| 285 p.rnti = m_rnti; |
| 286 p.lcid = m_lcid; |
| 287 p.srcL2Id = m_srcL2Id; |
| 288 p.dstL2Id = m_dstL2Id; |
| 289 p.txQueueSize = 80000; |
| 290 p.txQueueHolDelay = 10; |
| 291 p.retxQueueSize = 0; |
| 292 p.retxQueueHolDelay = 0; |
| 293 p.statusPduSize = 0; |
| 294 m_macSapProvider->ReportBufferNistStatus (p); |
| 295 } |
| 296 |
| 297 |
| 298 |
| 299 |
| 300 ////////////////////////////////////////// |
| 301 |
| 302 // NistLteRlcTm::~NistLteRlcTm () |
| 303 // { |
| 304 // } |
| 305 |
| 306 ////////////////////////////////////////// |
| 307 |
| 308 // NistLteRlcUm::~NistLteRlcUm () |
| 309 // { |
| 310 // } |
| 311 |
| 312 ////////////////////////////////////////// |
| 313 |
| 314 // NistLteRlcAm::~NistLteRlcAm () |
| 315 // { |
| 316 // } |
| 317 |
| 318 |
| 319 } // namespace ns3 |
OLD | NEW |