From 69d650520ec72f8745a6f808a0ccaf8e7e9ae4a4 Mon Sep 17 00:00:00 2001 From: Nicola Baldo Date: Tue, 18 Dec 2012 11:28:48 +0100 Subject: [PATCH] dispose SRB1 in a separate event rather than in LteUeRrc::DoRecvRrcConnectionReconfiguration --- src/lte/model/lte-ue-rrc.cc | 17 ++++++++++++++++- src/lte/model/lte-ue-rrc.h | 2 ++ src/lte/test/test-lte-x2-handover.cc | 3 +++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/lte/model/lte-ue-rrc.cc b/src/lte/model/lte-ue-rrc.cc index ac1730ffa..5a7d0ae7e 100644 --- a/src/lte/model/lte-ue-rrc.cc +++ b/src/lte/model/lte-ue-rrc.cc @@ -24,6 +24,7 @@ #include #include #include +#include #include "lte-ue-rrc.h" #include "lte-enb-rrc.h" @@ -629,7 +630,15 @@ LteUeRrc::DoRecvRrcConnectionReconfiguration (LteRrcSap::RrcConnectionReconfigur m_cphySapProvider->SetRnti (m_rnti); m_lastRrcTransactionIdentifier = msg.rrcTransactionIdentifier; NS_ASSERT (msg.haveRadioResourceConfigDedicated); - m_srb1 = 0; // dispose SRB1 + + // we re-establish SRB1 by creating a new entity + // note that we can't dispose the old entity now, because + // it's in the current stack, so we would corrupt the stack + // if we did so. Hence we schedule it for later disposal + m_srb1Old = m_srb1; + Simulator::ScheduleNow (&LteUeRrc::DisposeOldSrb1, this); + m_srb1 = 0; // new instance will be be created within ApplyRadioResourceConfigDedicated + m_drbMap.clear (); // dispose all DRBs ApplyRadioResourceConfigDedicated (msg.radioResourceConfigDedicated); // RRC connection reconfiguration completed will be sent @@ -903,6 +912,12 @@ LteUeRrc::LeaveConnectedMode () SwitchToState (IDLE_CAMPED_NORMALLY); } +void +LteUeRrc::DisposeOldSrb1 () +{ + NS_LOG_FUNCTION (this); + m_srb1Old = 0; +} uint8_t LteUeRrc::Bid2Drbid (uint8_t bid) diff --git a/src/lte/model/lte-ue-rrc.h b/src/lte/model/lte-ue-rrc.h index 6a3e305e2..48c5be837 100644 --- a/src/lte/model/lte-ue-rrc.h +++ b/src/lte/model/lte-ue-rrc.h @@ -260,6 +260,7 @@ private: void ApplyRadioResourceConfigDedicated (LteRrcSap::RadioResourceConfigDedicated rrcd); void StartConnection (); void LeaveConnectedMode (); + void DisposeOldSrb1 (); uint8_t Bid2Drbid (uint8_t bid); void SwitchToState (State s); @@ -288,6 +289,7 @@ private: Ptr m_srb0; Ptr m_srb1; + Ptr m_srb1Old; std::map > m_drbMap; bool m_useRlcSm; diff --git a/src/lte/test/test-lte-x2-handover.cc b/src/lte/test/test-lte-x2-handover.cc index 9495ac455..b4fa3cd81 100644 --- a/src/lte/test/test-lte-x2-handover.cc +++ b/src/lte/test/test-lte-x2-handover.cc @@ -141,6 +141,7 @@ LteX2HandoverTestCase::DoRun () { NS_LOG_FUNCTION (this << BuildNameString (m_nUes, m_nDedicatedBearers, m_handoverEventListName, m_useUdp, m_schedulerType, m_admitHo, m_useIdealRrc)); + Config::Reset (); Config::SetDefault ("ns3::UdpClient::Interval", TimeValue (MilliSeconds(100))); Config::SetDefault ("ns3::UdpClient::MaxPackets", UintegerValue(1000000)); Config::SetDefault ("ns3::UdpClient::PacketSize", UintegerValue(100)); @@ -613,6 +614,8 @@ LteX2HandoverTestSuite::LteX2HandoverTestSuite () hel7.push_back (ue2fwd); hel7.push_back (ue2bwd); + AddTestCase (new LteX2HandoverTestCase ( 1, 0, hel1, hel1name, true, "ns3::RrFfMacScheduler", true, false)); + std::vector schedulers; schedulers.push_back ("ns3::RrFfMacScheduler"); schedulers.push_back ("ns3::PfrFfMacScheduler");