From 21d12b3a0f637415ba9fc82965561c45c5cd1a65 Mon Sep 17 00:00:00 2001 From: tommaso Date: Fri, 2 Nov 2018 17:18:30 +0100 Subject: [PATCH] Fix missing DRB conf for DC in LteUeRrc --- src/lte/model/lte-ue-rrc.cc | 185 +++++++++++++++++++++++++++++++++++- 1 file changed, 181 insertions(+), 4 deletions(-) diff --git a/src/lte/model/lte-ue-rrc.cc b/src/lte/model/lte-ue-rrc.cc index baa3b370f1..e52dcf707e 100644 --- a/src/lte/model/lte-ue-rrc.cc +++ b/src/lte/model/lte-ue-rrc.cc @@ -2276,12 +2276,189 @@ LteUeRrc::ApplyRadioResourceConfigDedicated (LteRrcSap::RadioResourceConfigDedic rlc->Initialize (); } else + { + NS_LOG_INFO ("request to modify existing DRBID"); + Ptr drbInfo = drbMapIt->second; + NS_LOG_INFO ("Is MC " << dtamIt->is_mc); + if(dtamIt->is_mc == true) // we need to setup the RLC for MmWave communications { - NS_LOG_INFO ("request to modify existing DRBID"); - Ptr drbInfo = drbMapIt->second; - /// \todo currently not implemented. Would need to modify drbInfo, and then propagate changes to the MAC + Ptr pdcp = DynamicCast (drbInfo->m_pdcp); + if(pdcp !=0) + { + // create Rlc + TypeId rlcTypeId; + if (m_useRlcSm) + { + rlcTypeId = LteRlcSm::GetTypeId (); + NS_LOG_INFO("SM"); + } + else + { + switch (dtamIt->rlcConfig.choice) + { + case LteRrcSap::RlcConfig::AM: + rlcTypeId = LteRlcAm::GetTypeId (); + NS_LOG_INFO("AM"); + break; + + case LteRrcSap::RlcConfig::UM_BI_DIRECTIONAL: + rlcTypeId = LteRlcUm::GetTypeId (); + NS_LOG_INFO("UM"); + break; + + default: + NS_FATAL_ERROR ("unsupported RLC configuration"); + break; + } + } + + ObjectFactory rlcObjectFactory; + rlcObjectFactory.SetTypeId (rlcTypeId); + Ptr rlc = rlcObjectFactory.Create ()->GetObject (); + rlc->SetLteMacSapProvider (m_mmWaveMacSapProvider); + rlc->SetRnti (m_mmWaveRnti); + rlc->SetLcId (dtamIt->logicalChannelIdentity); + + struct LteUeCmacSapProvider::LogicalChannelConfig lcConfig; + lcConfig.priority = dtamIt->logicalChannelConfig.priority; + lcConfig.prioritizedBitRateKbps = dtamIt->logicalChannelConfig.prioritizedBitRateKbps; + lcConfig.bucketSizeDurationMs = dtamIt->logicalChannelConfig.bucketSizeDurationMs; + lcConfig.logicalChannelGroup = dtamIt->logicalChannelConfig.logicalChannelGroup; + + //This is executed only if this is a secondary (mmWave) rrc + for (uint32_t i = 0; i < m_numberOfMmWaveComponentCarriers; i++) + { + m_mmWaveCmacSapProvider.at (i)->AddLc (dtamIt->logicalChannelIdentity, + lcConfig, + rlc->GetLteMacSapUser ()); + } + if (rlcTypeId != LteRlcSm::GetTypeId ()) + { + pdcp->SetMmWaveRnti (m_mmWaveRnti); + pdcp->SetMmWaveRlcSapProvider (rlc->GetLteRlcSapProvider ()); + rlc->SetLteRlcSapUser (pdcp->GetLteRlcSapUser ()); + } + rlc->Initialize(); + + Ptr rlcInfo = CreateObject(); + rlcInfo->m_rlc = rlc; + rlcInfo->rlcConfig.choice = dtamIt->rlcConfig.choice; + rlcInfo->logicalChannelIdentity = dtamIt->logicalChannelIdentity; + rlcInfo->mmWaveRnti = m_mmWaveRnti; + + LteRrcSap::LogicalChannelConfig logicalChannelConfig; + logicalChannelConfig.priority = dtamIt->logicalChannelConfig.priority; + logicalChannelConfig.prioritizedBitRateKbps = dtamIt->logicalChannelConfig.prioritizedBitRateKbps; + logicalChannelConfig.bucketSizeDurationMs = dtamIt->logicalChannelConfig.bucketSizeDurationMs; + logicalChannelConfig.logicalChannelGroup = dtamIt->logicalChannelConfig.logicalChannelGroup; + + rlcInfo->logicalChannelConfig = logicalChannelConfig; + + // switch to the mmWave RLC + bool useMmWaveConnection = true; + pdcp->SwitchConnection(useMmWaveConnection); + NS_LOG_INFO("LteUeRrc SwitchToMmWave and create new rlc " << m_imsi << m_mmWaveCellId << m_mmWaveRnti << " at time " << Simulator::Now().GetSeconds()); + m_switchToMmWaveTrace(m_imsi, m_mmWaveCellId, m_mmWaveRnti); + + // check if this rlc is already in the map + if(m_rlcMap.find(dtamIt->drbIdentity) != m_rlcMap.end()) + { + // get the RLC buffer content and store it in this RLC + CopyRlcBuffers(m_rlcMap.find(dtamIt->drbIdentity)->second->m_rlc, drbInfo->m_pdcp, drbInfo->m_logicalChannelIdentity); + } + m_rlcMap[dtamIt->drbIdentity] = rlcInfo; + } + else + { + NS_FATAL_ERROR("MC setup on a non MC-capable bearer"); + } + } - } + else + { + NS_LOG_INFO ("Modify Data Radio Bearer : not implemented"); + // TypeId rlcTypeId; + // if (m_useRlcSm) + // { + // rlcTypeId = LteRlcSm::GetTypeId (); + // } + // else + // { + // switch (dtamIt->rlcConfig.choice) + // { + // case LteRrcSap::RlcConfig::AM: + // rlcTypeId = LteRlcAm::GetTypeId (); + // break; + + // case LteRrcSap::RlcConfig::UM_BI_DIRECTIONAL: + // rlcTypeId = LteRlcUm::GetTypeId (); + // break; + + // default: + // NS_FATAL_ERROR ("unsupported RLC configuration"); + // break; + // } + // } + + // ObjectFactory rlcObjectFactory; + // rlcObjectFactory.SetTypeId (rlcTypeId); + // Ptr rlc = rlcObjectFactory.Create ()->GetObject (); + // rlc->SetLteMacSapProvider (m_macSapProvider); + // rlc->SetRnti (m_rnti); + // rlc->SetLcId (dtamIt->logicalChannelIdentity); + + // Ptr drbInfo = CreateObject (); + // drbInfo->m_rlc = rlc; + // drbInfo->m_epsBearerIdentity = dtamIt->epsBearerIdentity; + // drbInfo->m_logicalChannelIdentity = dtamIt->logicalChannelIdentity; + // drbInfo->m_drbIdentity = dtamIt->drbIdentity; + // drbInfo->m_rlcConfig.choice = dtamIt->rlcConfig.choice; + + // // we need PDCP only for real RLC, i.e., RLC/UM or RLC/AM + // // if we are using RLC/SM we don't care of anything above RLC + // if (rlcTypeId != LteRlcSm::GetTypeId ()) + // { + // Ptr pdcp = CreateObject (); + // pdcp->SetRnti (m_rnti); + // pdcp->SetLcId (dtamIt->logicalChannelIdentity); + // pdcp->SetLtePdcpSapUser (m_drbPdcpSapUser); + // pdcp->SetLteRlcSapProvider (rlc->GetLteRlcSapProvider ()); + // rlc->SetLteRlcSapUser (pdcp->GetLteRlcSapUser ()); + // drbInfo->m_pdcp = pdcp; + // } + + // m_bid2DrbidMap[dtamIt->epsBearerIdentity] = dtamIt->drbIdentity; + + // struct LteRrcSap::LogicalChannelConfig lcConfigToStore; + // lcConfigToStore.priority = dtamIt->logicalChannelConfig.priority; + // lcConfigToStore.prioritizedBitRateKbps = dtamIt->logicalChannelConfig.prioritizedBitRateKbps; + // lcConfigToStore.bucketSizeDurationMs = dtamIt->logicalChannelConfig.bucketSizeDurationMs; + // lcConfigToStore.logicalChannelGroup = dtamIt->logicalChannelConfig.logicalChannelGroup; + // drbInfo->m_logicalChannelConfig = lcConfigToStore; + + // struct LteUeCmacSapProvider::LogicalChannelConfig lcConfig; + // lcConfig.priority = dtamIt->logicalChannelConfig.priority; + // lcConfig.prioritizedBitRateKbps = dtamIt->logicalChannelConfig.prioritizedBitRateKbps; + // lcConfig.bucketSizeDurationMs = dtamIt->logicalChannelConfig.bucketSizeDurationMs; + // lcConfig.logicalChannelGroup = dtamIt->logicalChannelConfig.logicalChannelGroup; + + // rlc->Initialize (); + + // // check if an RLC for this drbid is already in the map + // if(m_drbMap.find(dtamIt->drbIdentity) != m_drbMap.end()) + // { + // // get the RLC buffer content and store it in this RLC + // CopyRlcBuffers(m_drbMap.find(dtamIt->drbIdentity)->second->m_rlc, drbInfo->m_pdcp, drbInfo->m_logicalChannelIdentity); + // } + // m_drbMap[dtamIt->drbIdentity] = drbInfo; + + // m_cmacSapProvider->AddLc (dtamIt->logicalChannelIdentity, + // lcConfig, + // rlc->GetLteMacSapUser ()); + + } + } + } std::list::iterator dtdmIt; for (dtdmIt = rrcd.drbToReleaseList.begin ();