From 6a6c33816ea5ea903f61569229a75e8f3762cf0d Mon Sep 17 00:00:00 2001 From: Manuel Requena Date: Wed, 7 Sep 2011 16:40:08 +0200 Subject: [PATCH] Add new RLC interfaces to the generic RLC entity --- src/lte/model/lte-rlc.cc | 60 ++++++++++++++++++++++++++++------------ src/lte/model/lte-rlc.h | 37 +++++++++++++++++++++---- src/lte/wscript | 4 ++- 3 files changed, 77 insertions(+), 24 deletions(-) diff --git a/src/lte/model/lte-rlc.cc b/src/lte/model/lte-rlc.cc index 96f42538f..5f19a5a7a 100644 --- a/src/lte/model/lte-rlc.cc +++ b/src/lte/model/lte-rlc.cc @@ -19,19 +19,21 @@ */ -#include "lte-rlc.h" -#include "lte-mac-sap.h" -#include "ff-mac-sched-sap.h" -#include "lte-rlc-tag.h" +#include "ns3/log.h" +#include "ns3/simulator.h" -#include -#include +#include "ns3/lte-rlc.h" +#include "ns3/lte-rlc-tag.h" +// #include "lte-mac-sap.h" +#include "ns3/lte-rlc-sap.h" +// #include "ff-mac-sched-sap.h" NS_LOG_COMPONENT_DEFINE ("LteRlc"); namespace ns3 { + /////////////////////////////////////// class LteRlcSpecificLteMacSapUser : public LteMacSapUser @@ -39,7 +41,7 @@ class LteRlcSpecificLteMacSapUser : public LteMacSapUser public: LteRlcSpecificLteMacSapUser (LteRlc* rlc); - // inherited from LteMacSapUser + // Interface implemented from LteMacSapUser virtual void NotifyTxOpportunity (uint32_t bytes); virtual void NotifyHarqDeliveryFailure (); virtual void ReceivePdu (Ptr p); @@ -78,14 +80,17 @@ LteRlcSpecificLteMacSapUser::ReceivePdu (Ptr p) /////////////////////////////////////// + NS_OBJECT_ENSURE_REGISTERED (LteRlc); LteRlc::LteRlc () - : m_macSapProvider (0), + : m_rlcSapUser (0), + m_macSapProvider (0), m_rnti (0), m_lcid (0) { NS_LOG_FUNCTION (this); + m_rlcSapProvider = new LteRlcSpecificLteRlcSapProvider (this); m_macSapUser = new LteRlcSpecificLteMacSapUser (this); } @@ -99,7 +104,7 @@ TypeId LteRlc::GetTypeId (void) .AddTraceSource ("RxPDU", "PDU received.", MakeTraceSourceAccessor (&LteRlc::m_rxPdu)) - ; + ; return tid; } @@ -120,9 +125,24 @@ LteRlc::SetLcId (uint8_t lcId) LteRlc::~LteRlc () { NS_LOG_FUNCTION (this); + delete (m_rlcSapProvider); delete (m_macSapUser); } +void +LteRlc::SetLteRlcSapUser (LteRlcSapUser * s) +{ + NS_LOG_FUNCTION (this << s); + m_rlcSapUser = s; +} + +LteRlcSapProvider* +LteRlc::GetLteRlcSapProvider () +{ + NS_LOG_FUNCTION (this); + return m_rlcSapProvider; +} + void LteRlc::SetLteMacSapProvider (LteMacSapProvider * s) { @@ -139,9 +159,7 @@ LteRlc::GetLteMacSapUser () - - -// ////////////////////////////////////// +//////////////////////////////////////// NS_OBJECT_ENSURE_REGISTERED (LteRlcSm); @@ -163,22 +181,28 @@ LteRlcSm::GetTypeId (void) static TypeId tid = TypeId ("ns3::LteRlcSm") .SetParent () .AddConstructor () - ; + ; return tid; } +void +LteRlcSm::DoTransmitPdcpPdu (Ptr p) +{ + NS_LOG_FUNCTION (this); +} + void LteRlcSm::DoReceivePdu (Ptr p) { // RLC Performance evaluation RlcTag rlcTag; Time delay; - if (p->FindFirstMatchingByteTag (rlcTag)) + if (p->FindFirstMatchingByteTag(rlcTag)) { - delay = Simulator::Now () - rlcTag.getSenderTimestamp (); + delay = Simulator::Now() - rlcTag.getSenderTimestamp (); } NS_LOG_FUNCTION (this << m_rnti << (uint32_t) m_lcid << p->GetSize () << delay.GetNanoSeconds ()); - m_rxPdu (m_rnti, m_lcid, p->GetSize (), delay.GetNanoSeconds () ); + m_rxPdu(m_rnti, m_lcid, p->GetSize (), delay.GetNanoSeconds () ); } void @@ -190,10 +214,10 @@ LteRlcSm::DoNotifyTxOpportunity (uint32_t bytes) params.lcid = m_lcid; // RLC Performance evaluation - RlcTag tag (Simulator::Now ()); + RlcTag tag (Simulator::Now()); params.pdu->AddByteTag (tag); NS_LOG_FUNCTION (this << m_rnti << (uint32_t) m_lcid << bytes); - m_txPdu (m_rnti, m_lcid, bytes); + m_txPdu(m_rnti, m_lcid, bytes); m_macSapProvider->TransmitPdu (params); } diff --git a/src/lte/model/lte-rlc.h b/src/lte/model/lte-rlc.h index c63b509cf..b00a63628 100644 --- a/src/lte/model/lte-rlc.h +++ b/src/lte/model/lte-rlc.h @@ -30,12 +30,17 @@ #include "ns3/object.h" +#include "ns3/lte-rlc-sap.h" +#include "ns3/lte-mac-sap.h" namespace ns3 { -class LteMacSapProvider; -class LteMacSapUser; +// class LteRlcSapProvider; +// class LteRlcSapUser; +// +// class LteMacSapProvider; +// class LteMacSapUser; /** * This abstract base class defines the API to interact with the Radio Link Control @@ -45,6 +50,7 @@ class LteMacSapUser; class LteRlc : public Object // SimpleRefCount { friend class LteRlcSpecificLteMacSapUser; + friend class LteRlcSpecificLteRlcSapProvider; public: LteRlc (); virtual ~LteRlc (); @@ -67,7 +73,21 @@ public: /** * * - * \param s the MAC SAP Providerto be used by this LTE_RLC + * \param s the RLC SAP user to be used by this LTE_RLC + */ + void SetLteRlcSapUser (LteRlcSapUser * s); + + /** + * + * + * \param s the RLC SAP Provider interface offered to the PDCP by this LTE_RLC + */ + LteRlcSapProvider* GetLteRlcSapProvider (); + + /** + * + * + * \param s the MAC SAP Provider to be used by this LTE_RLC */ void SetLteMacSapProvider (LteMacSapProvider * s); @@ -80,9 +100,15 @@ public: - + // TODO MRE What is the sense to duplicate all the interfaces here??? protected: - // methods forwarded by LteMacSapUser + // Interface forwarded by LteRlcSapProvider + virtual void DoTransmitPdcpPdu (Ptr p) = 0; + + LteRlcSapUser* m_rlcSapUser; + LteRlcSapProvider* m_rlcSapProvider; + + // Interface forwarded by LteMacSapUser virtual void DoNotifyTxOpportunity (uint32_t bytes) = 0; virtual void DoNotifyHarqDeliveryFailure () = 0; virtual void DoReceivePdu (Ptr p) = 0; @@ -121,6 +147,7 @@ public: virtual ~LteRlcSm (); static TypeId GetTypeId (void); + virtual void DoTransmitPdcpPdu (Ptr p); virtual void DoNotifyTxOpportunity (uint32_t bytes); virtual void DoNotifyHarqDeliveryFailure (); virtual void DoReceivePdu (Ptr p); diff --git a/src/lte/wscript b/src/lte/wscript index 5136fc10c..d4eb5a56d 100644 --- a/src/lte/wscript +++ b/src/lte/wscript @@ -25,7 +25,8 @@ def build(bld): 'model/lte-rlc-header.cc', 'model/lte-rlc-um.cc', 'model/lte-rlc-tag.cc', - 'model/eps-bearer.cc', + 'model/lte-rlc-sdu-status-tag.cc', + 'model/eps-bearer.cc', 'model/lte-net-device.cc', 'model/lte-enb-net-device.cc', 'model/lte-ue-net-device.cc', @@ -98,6 +99,7 @@ def build(bld): 'model/lte-rlc-header.h', 'model/lte-rlc-um.h', 'model/lte-rlc-tag.h', + 'model/lte-rlc-sdu-status-tag.h', 'model/eps-bearer.h', 'model/lte-net-device.h', 'model/lte-enb-net-device.h',