From 7829a4fb3440700e46e341ec6e463a3853c6fe6f Mon Sep 17 00:00:00 2001 From: Nicola Baldo Date: Fri, 7 Dec 2012 13:34:53 +0100 Subject: [PATCH] really defer DRB activation to rx of RRC connection setup/reconfiguration completed --- src/lte/examples/lena-simple.cc | 2 +- src/lte/helper/lte-helper.cc | 2 +- src/lte/model/lte-enb-rrc.cc | 36 ++++++++++++++++++++++++--------- src/lte/model/lte-enb-rrc.h | 13 +++++++++--- src/lte/model/lte-rlc.cc | 28 ++++++++++++------------- src/lte/model/lte-rlc.h | 3 ++- src/lte/model/lte-ue-rrc.cc | 1 + 7 files changed, 54 insertions(+), 31 deletions(-) diff --git a/src/lte/examples/lena-simple.cc b/src/lte/examples/lena-simple.cc index 787563f10..4b635773f 100644 --- a/src/lte/examples/lena-simple.cc +++ b/src/lte/examples/lena-simple.cc @@ -81,7 +81,7 @@ int main (int argc, char *argv[]) EpsBearer bearer (q); lteHelper->ActivateDataRadioBearer (ueDevs, bearer); - Simulator::Stop (Seconds (0.010)); + Simulator::Stop (Seconds (0.100)); Simulator::Run (); diff --git a/src/lte/helper/lte-helper.cc b/src/lte/helper/lte-helper.cc index 7c4b10d51..40c681c4a 100644 --- a/src/lte/helper/lte-helper.cc +++ b/src/lte/helper/lte-helper.cc @@ -704,7 +704,7 @@ LteHelper::ActivateDataRadioBearer (Ptr ueDevice, EpsBearer bearer) 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 + // when the UE gets connected. When the EPC is not used, we achieve // the same behavior by hooking a dedicated DRB activation function // to the Enb RRC Connection Established trace source diff --git a/src/lte/model/lte-enb-rrc.cc b/src/lte/model/lte-enb-rrc.cc index 2f648ba66..419c41a51 100644 --- a/src/lte/model/lte-enb-rrc.cc +++ b/src/lte/model/lte-enb-rrc.cc @@ -277,8 +277,8 @@ UeManager::SetImsi (uint64_t imsi) m_imsi = imsi; } -uint8_t -UeManager::SetupDataRadioBearer (EpsBearer bearer, uint32_t gtpTeid, Ipv4Address transportLayerAddress) +void +UeManager::SetupDataRadioBearer (EpsBearer bearer, uint8_t bearerId, uint32_t gtpTeid, Ipv4Address transportLayerAddress) { NS_LOG_FUNCTION (this << (uint32_t) m_rnti); @@ -286,6 +286,7 @@ UeManager::SetupDataRadioBearer (EpsBearer bearer, uint32_t gtpTeid, Ipv4Address uint8_t drbid = AddDataRadioBearerInfo (drbInfo); uint8_t lcid = Drbid2Lcid (drbid); uint8_t bid = Drbid2Bid (drbid); + NS_ASSERT_MSG ( bearerId == 0 || bid == bearerId, "bearer ID mismatch (" << (uint32_t) bid << " != " << (uint32_t) bearerId << ", the assumption that ID are allocated in the same way by MME and RRC is not valid any more"); drbInfo->m_epsBearerIdentity = bid; drbInfo->m_drbIdentity = drbid; drbInfo->m_logicalChannelIdentity = lcid; @@ -351,7 +352,23 @@ UeManager::SetupDataRadioBearer (EpsBearer bearer, uint32_t gtpTeid, Ipv4Address } drbInfo->m_logicalChannelConfig.bucketSizeDurationMs = 1000; - return drbid; + ScheduleRrcConnectionReconfiguration (); +} + +void +UeManager::StartDataRadioBearers () +{ + NS_LOG_FUNCTION (this << (uint32_t) m_rnti); + for (std::map >::iterator it = m_drbMap.begin (); + it != m_drbMap.end (); + ++it) + { + it->second->m_rlc->Start (); + if (it->second->m_pdcp) + { + it->second->m_pdcp->Start (); + } + } } @@ -594,7 +611,8 @@ UeManager::RecvRrcConnectionSetupCompleted (LteRrcSap::RrcConnectionSetupComplet NS_LOG_FUNCTION (this); switch (m_state) { - case CONNECTION_SETUP: + case CONNECTION_SETUP: + StartDataRadioBearers (); SwitchToState (CONNECTED_NORMALLY); m_rrc->m_connectionEstablishedTrace (m_imsi, m_rrc->m_cellId, m_rnti); break; @@ -611,7 +629,8 @@ UeManager::RecvRrcConnectionReconfigurationCompleted (LteRrcSap::RrcConnectionRe NS_LOG_FUNCTION (this); switch (m_state) { - case CONNECTION_RECONFIGURATION: + case CONNECTION_RECONFIGURATION: + StartDataRadioBearers (); SwitchToState (CONNECTED_NORMALLY); m_rrc->m_connectionReconfigurationTrace (m_imsi, m_rrc->m_cellId, m_rnti); break; @@ -1219,11 +1238,8 @@ LteEnbRrc::DoRecvRrcConnectionReestablishmentComplete (uint16_t rnti, LteRrcSap: void LteEnbRrc::DoDataRadioBearerSetupRequest (EpcEnbS1SapUser::DataRadioBearerSetupRequestParameters request) { - Ptr ueManager = GetUeManager (request.rnti); - uint8_t bid = ueManager->SetupDataRadioBearer (request.bearer, request.gtpTeid, request.transportLayerAddress); - NS_ASSERT_MSG ( request.bearerId == 0 || bid == request.bearerId, "bearer ID mismatch (" << (uint32_t) bid << " != " << (uint32_t) request.bearerId << ", the assumption that ID are allocated in the same way by MME and RRC is not valid any more"); - ueManager->ScheduleRrcConnectionReconfiguration (); + ueManager->SetupDataRadioBearer (request.bearer, request.bearerId, request.gtpTeid, request.transportLayerAddress); } void @@ -1278,7 +1294,7 @@ LteEnbRrc::DoRecvHandoverRequest (EpcX2SapUser::HandoverRequestParams req) it != req.bearers.end (); ++it) { - ueManager->SetupDataRadioBearer (it->erabLevelQosParameters, it->gtpTeid, it->transportLayerAddress); + ueManager->SetupDataRadioBearer (it->erabLevelQosParameters, it->erabId, it->gtpTeid, it->transportLayerAddress); } LteRrcSap::RrcConnectionReconfiguration handoverCommand = ueManager->GetRrcConnectionReconfigurationForHandover (); diff --git a/src/lte/model/lte-enb-rrc.h b/src/lte/model/lte-enb-rrc.h index bd78e05c2..bd5cbfd57 100644 --- a/src/lte/model/lte-enb-rrc.h +++ b/src/lte/model/lte-enb-rrc.h @@ -120,14 +120,21 @@ public: * Setup a new data radio bearer, including both the configuration * within the eNB and the necessary RRC signaling with the UE * - * \param bearer + * \param bearer the QoS characteristics of the bearer + * \param bearerId the EPS bearer identifier * \param gtpTeid S1-bearer GTP tunnel endpoint identifier, see 36.423 9.2.1 * \param transportLayerAddress IP Address of the SGW, see 36.423 9.2.1 * - * \return the EPS Bearer Id */ - uint8_t SetupDataRadioBearer (EpsBearer bearer, uint32_t gtpTeid, Ipv4Address transportLayerAddress); + void SetupDataRadioBearer (EpsBearer bearer, uint8_t bearerId, uint32_t gtpTeid, Ipv4Address transportLayerAddress); + /** + * Start all configured data radio bearers. It is safe to call this + * method if any bearer had been already started previously. + * + */ + void StartDataRadioBearers (); + /** * * Release a given radio bearer diff --git a/src/lte/model/lte-rlc.cc b/src/lte/model/lte-rlc.cc index 89e47ea10..a79f68eaf 100644 --- a/src/lte/model/lte-rlc.cc +++ b/src/lte/model/lte-rlc.cc @@ -108,12 +108,6 @@ TypeId LteRlc::GetTypeId (void) return tid; } -void -LteRlcSm::DoDispose () -{ - NS_LOG_FUNCTION (this); -} - void LteRlc::SetRnti (uint16_t rnti) { @@ -171,9 +165,7 @@ NS_OBJECT_ENSURE_REGISTERED (LteRlcSm); LteRlcSm::LteRlcSm () { - NS_LOG_FUNCTION (this); - Simulator::ScheduleNow (&LteRlcSm::Start, this); } LteRlcSm::~LteRlcSm () @@ -191,6 +183,19 @@ LteRlcSm::GetTypeId (void) return tid; } +void +LteRlcSm::DoStart () +{ + NS_LOG_FUNCTION (this); + ReportBufferStatus (); +} + +void +LteRlcSm::DoDispose () +{ + NS_LOG_FUNCTION (this); +} + void LteRlcSm::DoTransmitPdcpPdu (Ptr p) { @@ -244,13 +249,6 @@ LteRlcSm::DoNotifyHarqDeliveryFailure () NS_LOG_FUNCTION (this); } -void -LteRlcSm::Start () -{ - NS_LOG_FUNCTION (this); - ReportBufferStatus (); -} - void LteRlcSm::ReportBufferStatus () { diff --git a/src/lte/model/lte-rlc.h b/src/lte/model/lte-rlc.h index 35b617cde..39b5690f4 100644 --- a/src/lte/model/lte-rlc.h +++ b/src/lte/model/lte-rlc.h @@ -148,6 +148,7 @@ public: LteRlcSm (); virtual ~LteRlcSm (); static TypeId GetTypeId (void); + virtual void DoStart (); virtual void DoDispose (); virtual void DoTransmitPdcpPdu (Ptr p); @@ -155,7 +156,7 @@ public: virtual void DoNotifyHarqDeliveryFailure (); virtual void DoReceivePdu (Ptr p); - void Start (); + private: void ReportBufferStatus (); diff --git a/src/lte/model/lte-ue-rrc.cc b/src/lte/model/lte-ue-rrc.cc index 97db3ea47..4e0f222fb 100644 --- a/src/lte/model/lte-ue-rrc.cc +++ b/src/lte/model/lte-ue-rrc.cc @@ -841,6 +841,7 @@ LteUeRrc::ApplyRadioResourceConfigDedicated (LteRrcSap::RadioResourceConfigDedic m_cmacSapProvider->AddLc (dtamIt->logicalChannelIdentity, lcConfig, rlc->GetLteMacSapUser ()); + rlc->Start (); } else {