From 52ba3734e30e185fc7a678ffa624dfcd7d35aa6c Mon Sep 17 00:00:00 2001 From: Zoraze Ali Date: Thu, 6 Sep 2018 14:14:51 +0200 Subject: [PATCH] lte: (fixes #2980) reset MAC and PHY of secondary carriers upon handover --- src/lte/model/lte-enb-rrc.cc | 12 ++++++++- src/lte/model/lte-ue-ccm-rrc-sap.h | 13 +++++++++ src/lte/model/lte-ue-mac.cc | 2 +- src/lte/model/lte-ue-rrc.cc | 27 ++++++++++++++----- .../simple-ue-component-carrier-manager.cc | 21 +++++++++++++++ .../simple-ue-component-carrier-manager.h | 5 ++++ 6 files changed, 72 insertions(+), 8 deletions(-) diff --git a/src/lte/model/lte-enb-rrc.cc b/src/lte/model/lte-enb-rrc.cc index 558e1f600..d5029986e 100644 --- a/src/lte/model/lte-enb-rrc.cc +++ b/src/lte/model/lte-enb-rrc.cc @@ -651,6 +651,17 @@ UeManager::RecvHandoverRequestAck (EpcX2SapUser::HandoverRequestAckParams params Ptr encodedHandoverCommand = params.rrcContext; LteRrcSap::RrcConnectionReconfiguration handoverCommand = m_rrc->m_rrcSapUser->DecodeHandoverCommand (encodedHandoverCommand); + if (handoverCommand.haveNonCriticalExtension) + { + //Total number of component carriers = handoverCommand.nonCriticalExtension.sCellsToAddModList.size() + 1 (Primary carrier) + if (handoverCommand.nonCriticalExtension.sCellsToAddModList.size() + 1 != m_rrc->m_numberOfComponentCarriers) + { + //Currently handover is only possible if source and target eNBs have equal number of component carriers + NS_FATAL_ERROR ("The source and target eNBs have unequal number of component carriers. Target eNB CCs = " + << handoverCommand.nonCriticalExtension.sCellsToAddModList.size() + 1 + << " Source eNB CCs = " << m_rrc->m_numberOfComponentCarriers); + } + } m_rrc->m_rrcSapUser->SendRrcConnectionReconfiguration (m_rnti, handoverCommand); SwitchToState (HANDOVER_LEAVING); m_handoverLeavingTimeout = Simulator::Schedule (m_rrc->m_handoverLeavingTimeoutDuration, @@ -2348,7 +2359,6 @@ LteEnbRrc::DoRecvHandoverRequest (EpcX2SapUser::HandoverRequestParams req) handoverCommand.mobilityControlInfo.radioResourceConfigCommon.rachConfigCommon.preambleInfo.numberOfRaPreambles = rc.numberOfRaPreambles; handoverCommand.mobilityControlInfo.radioResourceConfigCommon.rachConfigCommon.raSupervisionInfo.preambleTransMax = rc.preambleTransMax; handoverCommand.mobilityControlInfo.radioResourceConfigCommon.rachConfigCommon.raSupervisionInfo.raResponseWindowSize = rc.raResponseWindowSize; - handoverCommand.haveNonCriticalExtension = false; Ptr encodedHandoverCommand = m_rrcSapUser->EncodeHandoverCommand (handoverCommand); diff --git a/src/lte/model/lte-ue-ccm-rrc-sap.h b/src/lte/model/lte-ue-ccm-rrc-sap.h index 8c193d9d9..1c20f8fb7 100644 --- a/src/lte/model/lte-ue-ccm-rrc-sap.h +++ b/src/lte/model/lte-ue-ccm-rrc-sap.h @@ -80,6 +80,11 @@ public: * where the bearer is enabled */ virtual std::vector RemoveLc (uint8_t lcid) = 0; + /** + * \brief Reset LC maps + * + */ + virtual void Reset () = 0; /// Notify reconfiguration msg function virtual void NotifyConnectionReconfigurationMsg () = 0; @@ -110,6 +115,7 @@ public: // inherited from LteUeCcmRrcSapProvider virtual std::vector RemoveLc (uint8_t lcid); + virtual void Reset (); virtual std::vector AddLc (uint8_t lcId, LteUeCmacSapProvider::LogicalChannelConfig lcConfig, LteMacSapUser* msu); virtual void NotifyConnectionReconfigurationMsg (); virtual LteMacSapUser* ConfigureSignalBearer (uint8_t lcid, LteUeCmacSapProvider::LogicalChannelConfig lcConfig, LteMacSapUser* msu); @@ -130,6 +136,13 @@ std::vector MemberLteUeCcmRrcSapProvider::RemoveLc (uint8_t lcid) return m_owner->DoRemoveLc (lcid); } +template +void MemberLteUeCcmRrcSapProvider::Reset () +{ + return m_owner->DoReset (); +} + + template std::vector MemberLteUeCcmRrcSapProvider::AddLc (uint8_t lcId, LteUeCmacSapProvider::LogicalChannelConfig lcConfig, LteMacSapUser* msu) { diff --git a/src/lte/model/lte-ue-mac.cc b/src/lte/model/lte-ue-mac.cc index 618688c6b..166ec159d 100644 --- a/src/lte/model/lte-ue-mac.cc +++ b/src/lte/model/lte-ue-mac.cc @@ -537,7 +537,7 @@ void LteUeMac::DoAddLc (uint8_t lcId, LteUeCmacSapProvider::LogicalChannelConfig lcConfig, LteMacSapUser* msu) { NS_LOG_FUNCTION (this << " lcId" << (uint32_t) lcId); - NS_ASSERT_MSG (m_lcInfoMap.find (lcId) == m_lcInfoMap.end (), "cannot add channel because LCID " << lcId << " is already present"); + NS_ASSERT_MSG (m_lcInfoMap.find (lcId) == m_lcInfoMap.end (), "cannot add channel because LCID " << (uint16_t)lcId << " is already present"); LcInfo lcInfo; lcInfo.lcConfig = lcConfig; diff --git a/src/lte/model/lte-ue-rrc.cc b/src/lte/model/lte-ue-rrc.cc index 17350e444..b350f30ba 100644 --- a/src/lte/model/lte-ue-rrc.cc +++ b/src/lte/model/lte-ue-rrc.cc @@ -990,8 +990,13 @@ LteUeRrc::DoRecvRrcConnectionReconfiguration (LteRrcSap::RrcConnectionReconfigur SwitchToState (CONNECTED_HANDOVER); const LteRrcSap::MobilityControlInfo& mci = msg.mobilityControlInfo; m_handoverStartTrace (m_imsi, m_cellId, m_rnti, mci.targetPhysCellId); - m_cmacSapProvider.at(0)->Reset (); - m_cphySapProvider.at(0)->Reset (); + //We should reset the MACs and PHYs for all the component carriers + for (uint16_t i = 0; i < m_numberOfComponentCarriers; i++) + { + m_cmacSapProvider.at(i)->Reset (); + m_cphySapProvider.at(i)->Reset (); + } + m_ccmRrcSapProvider->Reset(); m_cellId = mci.targetPhysCellId; NS_ASSERT (mci.haveCarrierFreq); NS_ASSERT (mci.haveCarrierBandwidth); @@ -1016,6 +1021,11 @@ LteUeRrc::DoRecvRrcConnectionReconfiguration (LteRrcSap::RrcConnectionReconfigur m_drbMap.clear (); // dispose all DRBs ApplyRadioResourceConfigDedicated (msg.radioResourceConfigDedicated); + if (msg.haveNonCriticalExtension) + { + NS_LOG_DEBUG (this << "RNTI " << m_rnti << " Handover. Configuring secondary carriers"); + ApplyRadioResourceConfigDedicatedSecondaryCarrier (msg.nonCriticalExtension); + } if (msg.haveMeasConfig) { @@ -1030,7 +1040,7 @@ LteUeRrc::DoRecvRrcConnectionReconfiguration (LteRrcSap::RrcConnectionReconfigur if (msg.haveNonCriticalExtension) { ApplyRadioResourceConfigDedicatedSecondaryCarrier (msg.nonCriticalExtension); - NS_LOG_FUNCTION ( this << "RNTI " << m_rnti << " Configured for CA" ); + NS_LOG_DEBUG (this << "RNTI " << m_rnti << " Configured for CA" ); } if (msg.haveRadioResourceConfigDedicated) { @@ -1111,8 +1121,10 @@ LteUeRrc::DoRecvRrcConnectionReject (LteRrcSap::RrcConnectionReject msg) { NS_LOG_FUNCTION (this); m_connectionTimeout.Cancel (); - - m_cmacSapProvider.at (0)->Reset (); // reset the MAC + for (uint16_t i = 0; i < m_numberOfComponentCarriers; i++) + { + m_cmacSapProvider.at(i)->Reset (); // reset the MAC + } m_hasReceivedSib2 = false; // invalidate the previously received SIB2 SwitchToState (IDLE_CAMPED_NORMALLY); m_asSapUser->NotifyConnectionFailed (); // inform upper layer @@ -2962,7 +2974,10 @@ void LteUeRrc::ConnectionTimeout () { NS_LOG_FUNCTION (this << m_imsi); - m_cmacSapProvider.at (0)->Reset (); // reset the MAC + for (uint16_t i = 0; i < m_numberOfComponentCarriers; i++) + { + m_cmacSapProvider.at(i)->Reset (); // reset the MAC + } m_hasReceivedSib2 = false; // invalidate the previously received SIB2 SwitchToState (IDLE_CAMPED_NORMALLY); m_connectionTimeoutTrace (m_imsi, m_cellId, m_rnti); diff --git a/src/lte/model/simple-ue-component-carrier-manager.cc b/src/lte/model/simple-ue-component-carrier-manager.cc index 9db2f986e..f3a084ad3 100644 --- a/src/lte/model/simple-ue-component-carrier-manager.cc +++ b/src/lte/model/simple-ue-component-carrier-manager.cc @@ -260,6 +260,27 @@ SimpleUeComponentCarrierManager::DoRemoveLc (uint8_t lcid) } +void +SimpleUeComponentCarrierManager::DoReset () +{ + NS_LOG_FUNCTION (this); + // same semantics as LteUeMac::DoRest + std::map::iterator it = m_lcAttached.begin (); + while (it != m_lcAttached.end ()) + { + // don't delete CCCH + if (it->first == 0) + { + ++it; + } + else + { + // note: use of postfix operator preserves validity of iterator + m_lcAttached.erase (it++); + } + } +} + std::vector SimpleUeComponentCarrierManager::DoAddLc (uint8_t lcId, LteUeCmacSapProvider::LogicalChannelConfig lcConfig, LteMacSapUser* msu) { diff --git a/src/lte/model/simple-ue-component-carrier-manager.h b/src/lte/model/simple-ue-component-carrier-manager.h index d94c5bcab..f59afaef3 100644 --- a/src/lte/model/simple-ue-component-carrier-manager.h +++ b/src/lte/model/simple-ue-component-carrier-manager.h @@ -131,6 +131,11 @@ protected: * \returns LteMacSapUser * */ LteMacSapUser* DoConfigureSignalBearer (uint8_t lcId, LteUeCmacSapProvider::LogicalChannelConfig lcConfig, LteMacSapUser* msu); + /** + * \brief Reset LC map + * + */ + void DoReset (); private: