From 7639d631a6347df73ee650e2f2f73b86c9c7fa99 Mon Sep 17 00:00:00 2001 From: Jaume Nin Date: Wed, 14 Nov 2012 15:42:40 +0100 Subject: [PATCH] Fix JIRA LENA-284, cellId was not being reported in some callbacks and in some situations cellId was being reported 0, now fixed and reporting always correct cellId --- src/lte/helper/lte-helper.cc | 51 ++++++++++++++++++- .../helper/radio-bearer-stats-calculator.cc | 6 ++- .../helper/radio-bearer-stats-calculator.h | 6 ++- src/lte/test/lte-simple-helper.cc | 6 ++- 4 files changed, 61 insertions(+), 8 deletions(-) diff --git a/src/lte/helper/lte-helper.cc b/src/lte/helper/lte-helper.cc index ae7581c41..ea133e4ac 100644 --- a/src/lte/helper/lte-helper.cc +++ b/src/lte/helper/lte-helper.cc @@ -794,6 +794,31 @@ FindImsiFromUeRlcPath (std::string path) } +uint16_t +FindCellIdFromUeRlcPath (std::string path) +{ + NS_LOG_FUNCTION (path); + // Sample path input: + // /NodeList/#NodeId/DeviceList/#DeviceId/LteUeRrc/RadioBearer/#LCID/RxPDU + + // We retrieve the LteUeNetDevice path + std::string lteUeNetDevicePath = path.substr (0, path.find ("/LteUeRrc")); + Config::MatchContainer match = Config::LookupMatches (lteUeNetDevicePath); + + if (match.GetN () != 0) + { + Ptr ueNetDevice = match.Get (0); + NS_LOG_LOGIC ("FindImsiFromUeRlcPath: " << path << ", " << ueNetDevice->GetObject ()->GetImsi ()); + return ueNetDevice->GetObject ()->GetRrc ()->GetCellId (); + } + else + { + NS_FATAL_ERROR ("Lookup " << lteUeNetDevicePath << " got no matches"); + } + +} + + uint64_t FindImsiFromEnbMac (std::string path, uint16_t rnti) { @@ -866,7 +891,18 @@ DlRxPduCallback (Ptr rlcStats, std::string path, imsi = FindImsiFromUeRlcPath (path); rlcStats->SetImsiPath (path, imsi); } - rlcStats->DlRxPdu (imsi, rnti, lcid, packetSize, delay); + + uint16_t cellId = 0; + if (rlcStats->ExistsCellIdPath (path) == true) + { + cellId = rlcStats->GetCellIdPath (path); + } + else + { + cellId = FindCellIdFromUeRlcPath (path); + rlcStats->SetCellIdPath (path, cellId); + } + rlcStats->DlRxPdu (cellId, imsi, rnti, lcid, packetSize, delay); } void @@ -894,7 +930,18 @@ UlTxPduCallback (Ptr rlcStats, std::string path, imsi = FindImsiFromUeRlcPath (path); rlcStats->SetImsiPath (path, imsi); } - rlcStats->UlTxPdu (imsi, rnti, lcid, packetSize); + + uint16_t cellId = 0; + if (rlcStats->ExistsCellIdPath (path) == true) + { + cellId = rlcStats->GetCellIdPath (path); + } + else + { + cellId = FindCellIdFromUeRlcPath (path); + rlcStats->SetCellIdPath (path, cellId); + } + rlcStats->UlTxPdu (cellId, imsi, rnti, lcid, packetSize); } void diff --git a/src/lte/helper/radio-bearer-stats-calculator.cc b/src/lte/helper/radio-bearer-stats-calculator.cc index 2288ff90a..f4fd7c44d 100644 --- a/src/lte/helper/radio-bearer-stats-calculator.cc +++ b/src/lte/helper/radio-bearer-stats-calculator.cc @@ -96,13 +96,14 @@ RadioBearerStatsCalculator::DoDispose () } void -RadioBearerStatsCalculator::UlTxPdu (uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize) +RadioBearerStatsCalculator::UlTxPdu (uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize) { NS_LOG_FUNCTION (this << "UlTxPDU" << imsi << rnti << (uint32_t) lcid << packetSize); CheckEpoch (); ImsiLcidPair_t p (imsi, lcid); if (Simulator::Now () > m_startTime) { + m_ulCellId[p] = cellId; m_flowId[p] = LteFlowId_t (rnti, lcid); m_ulTxPackets[p]++; m_ulTxData[p] += packetSize; @@ -154,13 +155,14 @@ RadioBearerStatsCalculator::UlRxPdu (uint16_t cellId, uint64_t imsi, uint16_t rn } void -RadioBearerStatsCalculator::DlRxPdu (uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay) +RadioBearerStatsCalculator::DlRxPdu (uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay) { NS_LOG_FUNCTION (this << "DlRxPDU" << imsi << rnti << (uint32_t) lcid << packetSize << delay); CheckEpoch (); ImsiLcidPair_t p (imsi, lcid); if (Simulator::Now () > m_startTime) { + m_dlCellId[p] = cellId; m_dlRxPackets[p]++; m_dlRxData[p] += packetSize; diff --git a/src/lte/helper/radio-bearer-stats-calculator.h b/src/lte/helper/radio-bearer-stats-calculator.h index 6e0f0bfbf..bbb32760f 100644 --- a/src/lte/helper/radio-bearer-stats-calculator.h +++ b/src/lte/helper/radio-bearer-stats-calculator.h @@ -113,13 +113,14 @@ public: /** * Notifies the stats calculator that an uplink transmission has occurred. + * @param cellId CellId of the attached Enb * @param imsi IMSI of the UE who transmitted the PDU * @param rnti C-RNTI of the UE who transmitted the PDU * @param lcid LCID through which the PDU has been transmitted * @param packetSize size of the PDU in bytes */ void - UlTxPdu (uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize); + UlTxPdu (uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize); /** * Notifies the stats calculator that an uplink reception has occurred. @@ -146,6 +147,7 @@ public: /** * Notifies the stats calculator that an downlink reception has occurred. + * @param cellId CellId of the attached Enb * @param imsi IMSI of the UE who received the PDU * @param rnti C-RNTI of the UE who received the PDU * @param lcid LCID through which the PDU has been transmitted @@ -153,7 +155,7 @@ public: * @param delay RLC to RLC delay in nanoseconds */ void - DlRxPdu (uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay); + DlRxPdu (uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay); /** * Gets the number of transmitted uplink packets. diff --git a/src/lte/test/lte-simple-helper.cc b/src/lte/test/lte-simple-helper.cc index 3e5a78cea..00c3f9f58 100644 --- a/src/lte/test/lte-simple-helper.cc +++ b/src/lte/test/lte-simple-helper.cc @@ -261,7 +261,8 @@ LteSimpleHelperDlRxPduCallback (Ptr rlcStats, std::s { NS_LOG_FUNCTION (rlcStats << path << rnti << (uint16_t)lcid << packetSize << delay); uint64_t imsi = 333; - rlcStats->DlRxPdu (imsi, rnti, lcid, packetSize, delay); + uint16_t cellId = 555; + rlcStats->DlRxPdu (cellId, imsi, rnti, lcid, packetSize, delay); } void @@ -281,7 +282,8 @@ LteSimpleHelperUlTxPduCallback (Ptr rlcStats, std::s { NS_LOG_FUNCTION (rlcStats << path << rnti << (uint16_t)lcid << packetSize); uint64_t imsi = 1111; - rlcStats->UlTxPdu (imsi, rnti, lcid, packetSize); + uint16_t cellId = 555; + rlcStats->UlTxPdu (cellId, imsi, rnti, lcid, packetSize); } void