From 7284b3ab4d6d58eb3f24dd4810bb65a28bb9bb6a Mon Sep 17 00:00:00 2001 From: ZorazeAli Date: Mon, 22 Apr 2019 18:47:21 +0200 Subject: [PATCH] lte: Add TxFailParam in RachConfigCommon This patch adds TxFailParam in RachConfigCommon, which enables the eNB to indicate how many times T300 timer can expire at the UE. Upon reaching this count, the UE aborts the connection establishment, and performs the cell selection again. See TS 36.331 5.3.3.6. Thanks to Sandra Lagen --- src/lte/model/lte-enb-cmac-sap.h | 1 + src/lte/model/lte-enb-mac.cc | 6 +++++ src/lte/model/lte-enb-mac.h | 1 + src/lte/model/lte-enb-rrc.cc | 8 +++++-- src/lte/model/lte-rrc-header.cc | 39 ++++++++++++++++++++++++++++++++ src/lte/model/lte-rrc-sap.h | 7 ++++++ src/lte/model/lte-ue-cmac-sap.h | 1 + src/lte/model/lte-ue-rrc.cc | 39 ++++++++++++++++++++++++++------ src/lte/model/lte-ue-rrc.h | 17 +++++++++++++- 9 files changed, 109 insertions(+), 10 deletions(-) diff --git a/src/lte/model/lte-enb-cmac-sap.h b/src/lte/model/lte-enb-cmac-sap.h index 77b05d308..993fc205c 100644 --- a/src/lte/model/lte-enb-cmac-sap.h +++ b/src/lte/model/lte-enb-cmac-sap.h @@ -139,6 +139,7 @@ public: uint8_t numberOfRaPreambles; ///< number of RA preambles uint8_t preambleTransMax; ///< preamble transmit maximum uint8_t raResponseWindowSize; ///< RA response window size + uint8_t connEstFailCount; ///< the counter value for T300 timer expiration }; /** diff --git a/src/lte/model/lte-enb-mac.cc b/src/lte/model/lte-enb-mac.cc index 5d78b91af..08b328d1e 100644 --- a/src/lte/model/lte-enb-mac.cc +++ b/src/lte/model/lte-enb-mac.cc @@ -355,6 +355,11 @@ LteEnbMac::GetTypeId (void) UintegerValue (3), MakeUintegerAccessor (&LteEnbMac::m_raResponseWindowSize), MakeUintegerChecker (2, 10)) + .AddAttribute ("ConnEstFailCount", + "how many time T300 timer can expire on the same cell", + UintegerValue (1), + MakeUintegerAccessor (&LteEnbMac::m_connEstFailCount), + MakeUintegerChecker (1, 4)) .AddTraceSource ("DlScheduling", "Information regarding DL scheduling.", MakeTraceSourceAccessor (&LteEnbMac::m_dlScheduling), @@ -966,6 +971,7 @@ LteEnbMac::DoGetRachConfig () rc.numberOfRaPreambles = m_numberOfRaPreambles; rc.preambleTransMax = m_preambleTransMax; rc.raResponseWindowSize = m_raResponseWindowSize; + rc.connEstFailCount = m_connEstFailCount; return rc; } diff --git a/src/lte/model/lte-enb-mac.h b/src/lte/model/lte-enb-mac.h index f25a65933..94bd61237 100644 --- a/src/lte/model/lte-enb-mac.h +++ b/src/lte/model/lte-enb-mac.h @@ -441,6 +441,7 @@ private: uint8_t m_numberOfRaPreambles; ///< number of RA preambles uint8_t m_preambleTransMax; ///< preamble transmit maximum uint8_t m_raResponseWindowSize; ///< RA response window size + uint8_t m_connEstFailCount; ///< the counter value for T300 timer expiration /** * info associated with a preamble allocated for non-contention based RA diff --git a/src/lte/model/lte-enb-rrc.cc b/src/lte/model/lte-enb-rrc.cc index 5e6b933c0..a1469be67 100644 --- a/src/lte/model/lte-enb-rrc.cc +++ b/src/lte/model/lte-enb-rrc.cc @@ -663,6 +663,7 @@ UeManager::PrepareHandover (uint16_t cellId) hpi.asConfig.sourceSystemInformationBlockType2.radioResourceConfigCommon.rachConfigCommon.preambleInfo.numberOfRaPreambles = rc.numberOfRaPreambles; hpi.asConfig.sourceSystemInformationBlockType2.radioResourceConfigCommon.rachConfigCommon.raSupervisionInfo.preambleTransMax = rc.preambleTransMax; hpi.asConfig.sourceSystemInformationBlockType2.radioResourceConfigCommon.rachConfigCommon.raSupervisionInfo.raResponseWindowSize = rc.raResponseWindowSize; + hpi.asConfig.sourceSystemInformationBlockType2.radioResourceConfigCommon.rachConfigCommon.txFailParam.connEstFailCount = rc.connEstFailCount; hpi.asConfig.sourceSystemInformationBlockType2.freqInfo.ulCarrierFreq = m_rrc->m_ulEarfcn; hpi.asConfig.sourceSystemInformationBlockType2.freqInfo.ulBandwidth = m_rrc->m_ulBandwidth; params.rrcContext = m_rrc->m_rrcSapUser->EncodeHandoverPreparationInformation (hpi); @@ -1720,10 +1721,11 @@ LteEnbRrc::GetTypeId (void) "After a RA attempt, if no RRC CONNECTION REQUEST is " "received before this time, the UE context is destroyed. " "Must account for reception of RAR and transmission of " - "RRC CONNECTION REQUEST over UL GRANT.", + "RRC CONNECTION REQUEST over UL GRANT. The value of this" + "timer should not be greater than T300 timer at UE RRC", TimeValue (MilliSeconds (15)), MakeTimeAccessor (&LteEnbRrc::m_connectionRequestTimeoutDuration), - MakeTimeChecker ()) + MakeTimeChecker (MilliSeconds (1), MilliSeconds (15))) .AddAttribute ("ConnectionSetupTimeoutDuration", "After accepting connection request, if no RRC CONNECTION " "SETUP COMPLETE is received before this time, the UE " @@ -2533,6 +2535,7 @@ 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.mobilityControlInfo.radioResourceConfigCommon.rachConfigCommon.txFailParam.connEstFailCount = rc.connEstFailCount; Ptr encodedHandoverCommand = m_rrcSapUser->EncodeHandoverCommand (handoverCommand); @@ -3059,6 +3062,7 @@ LteEnbRrc::SendSystemInformation () rachConfigCommon.preambleInfo.numberOfRaPreambles = rc.numberOfRaPreambles; rachConfigCommon.raSupervisionInfo.preambleTransMax = rc.preambleTransMax; rachConfigCommon.raSupervisionInfo.raResponseWindowSize = rc.raResponseWindowSize; + rachConfigCommon.txFailParam.connEstFailCount = rc.connEstFailCount; si.sib2.radioResourceConfigCommon.rachConfigCommon = rachConfigCommon; m_rrcSapUser->SendSystemInformation (it.second->GetCellId (), si); diff --git a/src/lte/model/lte-rrc-header.cc b/src/lte/model/lte-rrc-header.cc index 372ba95d4..c01734fd9 100644 --- a/src/lte/model/lte-rrc-header.cc +++ b/src/lte/model/lte-rrc-header.cc @@ -927,6 +927,25 @@ RrcAsn1Header::SerializeRachConfigCommon (LteRrcSap::RachConfigCommon rachConfig SerializeEnum (8,0); // mac-ContentionResolutionTimer SerializeInteger (1,1,8); // maxHARQ-Msg3Tx + + // connEstFailCount + switch (rachConfigCommon.txFailParam.connEstFailCount) + { + case 1: + SerializeEnum (8,1); + break; + case 2: + SerializeEnum (8,2); + break; + case 3: + SerializeEnum (8,3); + break; + case 4: + SerializeEnum (8,4); + break; + default: + SerializeEnum (8,1); + } } void @@ -3384,6 +3403,26 @@ RrcAsn1Header::DeserializeRachConfigCommon (LteRrcSap::RachConfigCommon * rachCo bIterator = DeserializeEnum (8,&n,bIterator); // mac-ContentionResolutionTimer bIterator = DeserializeInteger (&n,1,8,bIterator); //maxHARQ-Msg3Tx + + // connEstFailCount + bIterator = DeserializeEnum (8,&n,bIterator); + switch (n) + { + case 1: + rachConfigCommon->txFailParam.connEstFailCount = 1; + break; + case 2: + rachConfigCommon->txFailParam.connEstFailCount = 2; + break; + case 3: + rachConfigCommon->txFailParam.connEstFailCount = 3; + break; + case 4: + rachConfigCommon->txFailParam.connEstFailCount = 4; + break; + default: + rachConfigCommon->txFailParam.connEstFailCount = 1; + } return bIterator; } diff --git a/src/lte/model/lte-rrc-sap.h b/src/lte/model/lte-rrc-sap.h index a68ba626b..2a3cadb7b 100644 --- a/src/lte/model/lte-rrc-sap.h +++ b/src/lte/model/lte-rrc-sap.h @@ -254,11 +254,18 @@ public: uint8_t raResponseWindowSize; ///< RA response window size }; + ///TxFailParams structure + struct TxFailParam + { + uint8_t connEstFailCount; ///< Number of times that the UE detects T300 expiry on the same cell + }; + /// RachConfigCommon structure struct RachConfigCommon { PreambleInfo preambleInfo; ///< preamble info RaSupervisionInfo raSupervisionInfo; ///< RA supervision info + TxFailParam txFailParam; ///< txFailParams }; /// RadioResourceConfigCommon structure diff --git a/src/lte/model/lte-ue-cmac-sap.h b/src/lte/model/lte-ue-cmac-sap.h index 6382b5910..f2a8dfcfd 100644 --- a/src/lte/model/lte-ue-cmac-sap.h +++ b/src/lte/model/lte-ue-cmac-sap.h @@ -48,6 +48,7 @@ public: uint8_t numberOfRaPreambles; ///< number of RA preambles uint8_t preambleTransMax; ///< preamble transmit maximum uint8_t raResponseWindowSize; ///< RA response window size + uint8_t connEstFailCount; ///< the counter value for T300 timer expiration }; /** diff --git a/src/lte/model/lte-ue-rrc.cc b/src/lte/model/lte-ue-rrc.cc index bf4806a48..8fbee59aa 100644 --- a/src/lte/model/lte-ue-rrc.cc +++ b/src/lte/model/lte-ue-rrc.cc @@ -149,6 +149,8 @@ LteUeRrc::LteUeRrc () m_noOfSyncIndications (0), m_leaveConnectedMode (false), m_previousCellId (0), + m_connEstFailCountLimit (0), + m_connEstFailCount (0), m_numberOfComponentCarriers (MIN_NO_CC) { NS_LOG_FUNCTION (this); @@ -282,7 +284,7 @@ LteUeRrc::GetTypeId (void) .AddTraceSource ("ConnectionTimeout", "trace fired upon timeout RRC connection establishment because of T300", MakeTraceSourceAccessor (&LteUeRrc::m_connectionTimeoutTrace), - "ns3::LteUeRrc::ImsiCidRntiTracedCallback") + "ns3::LteUeRrc::ImsiCidRntiCountTracedCallback") .AddTraceSource ("ConnectionReconfiguration", "trace fired upon RRC connection reconfiguration", MakeTraceSourceAccessor (&LteUeRrc::m_connectionReconfigurationTrace), @@ -986,6 +988,11 @@ LteUeRrc::DoRecvSystemInformation (LteRrcSap::SystemInformation msg) rc.numberOfRaPreambles = msg.sib2.radioResourceConfigCommon.rachConfigCommon.preambleInfo.numberOfRaPreambles; rc.preambleTransMax = msg.sib2.radioResourceConfigCommon.rachConfigCommon.raSupervisionInfo.preambleTransMax; rc.raResponseWindowSize = msg.sib2.radioResourceConfigCommon.rachConfigCommon.raSupervisionInfo.raResponseWindowSize; + rc.connEstFailCount = msg.sib2.radioResourceConfigCommon.rachConfigCommon.txFailParam.connEstFailCount; + m_connEstFailCountLimit = rc.connEstFailCount; + NS_ASSERT_MSG (m_connEstFailCountLimit > 0 && m_connEstFailCountLimit < 5, + "SIB2 msg contains wrong value " + << m_connEstFailCountLimit << "of connEstFailCount"); m_cmacSapProvider.at (0)->ConfigureRach (rc); m_cphySapProvider.at (0)->ConfigureUplink (m_ulEarfcn, m_ulBandwidth); m_cphySapProvider.at (0)->ConfigureReferenceSignalPower (msg.sib2.radioResourceConfigCommon.pdschConfigCommon.referenceSignalPower); @@ -1014,6 +1021,7 @@ LteUeRrc::DoRecvRrcConnectionSetup (LteRrcSap::RrcConnectionSetup msg) case IDLE_CONNECTING: { ApplyRadioResourceConfigDedicated (msg.radioResourceConfigDedicated); + m_connEstFailCount = 0; m_connectionTimeout.Cancel (); SwitchToState (CONNECTED_NORMALLY); m_leaveConnectedMode = false; @@ -3096,14 +3104,31 @@ void LteUeRrc::ConnectionTimeout () { NS_LOG_FUNCTION (this << m_imsi); - for (uint16_t i = 0; i < m_numberOfComponentCarriers; i++) + ++m_connEstFailCount; + if (m_connEstFailCount >= m_connEstFailCountLimit) { - m_cmacSapProvider.at(i)->Reset (); // reset the MAC + m_connectionTimeoutTrace (m_imsi, m_cellId, m_rnti, m_connEstFailCount); + SwitchToState (CONNECTED_PHY_PROBLEM); + //Assumption: The eNB connection request timer would expire + //before the expiration of T300 at UE. Upon which, the eNB deletes + //the UE context. Therefore, here we don't need to send the UE context + //deletion request to the eNB. + m_asSapUser->NotifyConnectionReleased (); + m_connEstFailCount = 0; + } + else + { + 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, m_connEstFailCount); + //Following call to UE NAS will force the UE to immediately + //perform the random access to the same cell again. + m_asSapUser->NotifyConnectionFailed (); // inform upper layer } - m_hasReceivedSib2 = false; // invalidate the previously received SIB2 - SwitchToState (IDLE_CAMPED_NORMALLY); - m_connectionTimeoutTrace (m_imsi, m_cellId, m_rnti); - m_asSapUser->NotifyConnectionFailed (); // inform upper layer } void diff --git a/src/lte/model/lte-ue-rrc.h b/src/lte/model/lte-ue-rrc.h index 59b39a241..c32c01aaf 100644 --- a/src/lte/model/lte-ue-rrc.h +++ b/src/lte/model/lte-ue-rrc.h @@ -388,6 +388,18 @@ public: typedef void (*PhySyncDetectionTracedCallback) (uint64_t imsi, uint16_t rnti, uint16_t cellId, std::string type, uint16_t count); + /** + * TracedCallback signature for imsi, cellId, rnti and counter for + * random access events. + * + * \param [in] imsi + * \param [in] cellId + * \param [in] rnti + * \param [in] count + */ + typedef void (* ImsiCidRntiCountTracedCallback) + (uint64_t imsi, uint16_t cellId, uint16_t rnti, uint8_t count); + private: @@ -867,7 +879,7 @@ private: * The `ConnectionTimeout` trace source. Fired upon timeout RRC connection * establishment because of T300. Exporting IMSI, cell ID, and RNTI. */ - TracedCallback m_connectionTimeoutTrace; + TracedCallback m_connectionTimeoutTrace; /** * The `ConnectionReconfiguration` trace source. Fired upon RRC connection * reconfiguration. Exporting IMSI, cell ID, and RNTI. @@ -1265,6 +1277,9 @@ private: uint16_t m_previousCellId; ///< the cell id of the previous cell UE was attached to + uint8_t m_connEstFailCountLimit; ///< the counter value for T300 timer expiration received from the eNB + + uint8_t m_connEstFailCount; ///< the counter to count T300 timer expiration /** * \brief Radio link failure detected function *