From 44a25859e118787a4d4b2f0eabd7654b153d84aa Mon Sep 17 00:00:00 2001 From: Nicola Baldo Date: Wed, 5 Dec 2012 13:29:38 +0100 Subject: [PATCH] defer DRB activation to rx of RRC connection setup completed --- src/lte/helper/lte-helper.cc | 31 +++++++++++++++++++------------ src/lte/test/test-lte-rrc.cc | 3 ++- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/lte/helper/lte-helper.cc b/src/lte/helper/lte-helper.cc index 80e08127a..7c4b10d51 100644 --- a/src/lte/helper/lte-helper.cc +++ b/src/lte/helper/lte-helper.cc @@ -648,17 +648,19 @@ class DrbActivator : public SimpleRefCount public: DrbActivator (Ptr ueDevice, EpsBearer bearer); static void ActivateCallback (Ptr a, std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti); - void ActivateDrb (); + void ActivateDrb (uint64_t imsi, uint16_t cellId, uint16_t rnti); private: bool m_active; Ptr m_ueDevice; EpsBearer m_bearer; + uint64_t m_imsi; }; DrbActivator::DrbActivator (Ptr ueDevice, EpsBearer bearer) : m_active (false), m_ueDevice (ueDevice), - m_bearer (bearer) + m_bearer (bearer), + m_imsi (m_ueDevice->GetObject ()->GetImsi ()) { } @@ -666,14 +668,14 @@ void DrbActivator::ActivateCallback (Ptr a, std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti) { NS_LOG_FUNCTION (a << context << imsi << cellId << rnti); - a->ActivateDrb (); + a->ActivateDrb (imsi, cellId, rnti); } void -DrbActivator::ActivateDrb () +DrbActivator::ActivateDrb (uint64_t imsi, uint16_t cellId, uint16_t rnti) { - NS_LOG_FUNCTION (this << m_active); - if (!m_active) + NS_LOG_FUNCTION (this << imsi << cellId << rnti << m_active); + if ((!m_active) && (imsi == m_imsi)) { Ptr ueRrc = m_ueDevice->GetObject ()->GetRrc (); NS_ASSERT (ueRrc->GetState () == LteUeRrc::CONNECTED_NORMALLY); @@ -682,7 +684,8 @@ DrbActivator::ActivateDrb () Ptr enbRrc = enbLteDevice->GetObject ()->GetRrc (); NS_ASSERT (ueRrc->GetCellId () == enbLteDevice->GetCellId ()); Ptr ueManager = enbRrc->GetUeManager (rnti); - NS_ASSERT (ueManager->GetState () == UeManager::CONNECTION_SETUP); + NS_ASSERT (ueManager->GetState () == UeManager::CONNECTED_NORMALLY || + ueManager->GetState () == UeManager::CONNECTION_RECONFIGURATION); EpcEnbS1SapUser::DataRadioBearerSetupRequestParameters params; params.rnti = rnti; params.bearer = m_bearer; @@ -699,15 +702,19 @@ LteHelper::ActivateDataRadioBearer (Ptr ueDevice, EpsBearer bearer) { NS_LOG_FUNCTION (this << ueDevice); NS_ASSERT_MSG (m_epcHelper == 0, "this method must not be used when EPC is being used"); - + // Normally it is the EPC that takes care of activating DRBs // after the UE gets connected. When the EPC is not used, we achieve // the same behavior by hooking a dedicated DRB activation function - // to the UE RRC Connection Established trace source + // to the Enb RRC Connection Established trace source + + + Ptr enbLteDevice = ueDevice->GetObject ()->GetTargetEnb (); + std::ostringstream path; - path << "/NodeList/" << ueDevice->GetNode ()->GetId () - << "/DeviceList/" << ueDevice->GetIfIndex () - << "/LteUeRrc/ConnectionEstablished"; + path << "/NodeList/" << enbLteDevice->GetNode ()->GetId () + << "/DeviceList/" << enbLteDevice->GetIfIndex () + << "/LteEnbRrc/ConnectionEstablished"; Ptr arg = Create (ueDevice, bearer); Config::Connect (path.str (), MakeBoundCallback (&DrbActivator::ActivateCallback, arg)); } diff --git a/src/lte/test/test-lte-rrc.cc b/src/lte/test/test-lte-rrc.cc index 71de14549..89dfdae92 100644 --- a/src/lte/test/test-lte-rrc.cc +++ b/src/lte/test/test-lte-rrc.cc @@ -68,7 +68,7 @@ std::string LteRrcConnectionEstablishmentTestCase::BuildNameString (uint32_t nUe { std::ostringstream oss; oss << "nUes=" << nUes - << "nBearers=" << nBearers + << ", nBearers=" << nBearers << ", tConnBase=" << tConnBase << ", tConnIncrPerUe=" << tConnIncrPerUe << ", delayDiscStart=" << delayDiscStart; @@ -99,6 +99,7 @@ LteRrcConnectionEstablishmentTestCase::LteRrcConnectionEstablishmentTestCase (ui void LteRrcConnectionEstablishmentTestCase::DoRun () { + NS_LOG_FUNCTION (this << GetName ()); // normal code m_lteHelper = CreateObject ();