From 81b4f79c4351ae2a3614516e985c0dd7ac19f6ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Sat, 29 Nov 2014 09:57:24 -0800 Subject: [PATCH] bug 2020: Erroneous MCS field in 802.11n PCAP files --- RELEASE_NOTES | 1 + src/wifi/model/yans-wifi-phy.cc | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 0a4c3a427..51adb23ce 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -43,6 +43,7 @@ Bugs fixed - Bug 1997 - Fix PlotProbe() documentation and usage for GnuplotHelper and FileHelper - Bug 2011 - Default Speed attribute in ConstantSpeedPropagationDelayModel - Bug 2016 - Radvd do not consider the SendAdvert option and don't reply to RS +- Bug 2020 - Erroneous MCS field in 802.11n PCAP files - Bug 2021 - Missing const qualifier in TopologyReader::Link::Attributes{Begin,End}() Known issues diff --git a/src/wifi/model/yans-wifi-phy.cc b/src/wifi/model/yans-wifi-phy.cc index 46153c02f..9f75dc677 100644 --- a/src/wifi/model/yans-wifi-phy.cc +++ b/src/wifi/model/yans-wifi-phy.cc @@ -638,7 +638,15 @@ YansWifiPhy::SendPacket (Ptr packet, WifiTxVector txVector, WifiPr m_interference.NotifyRxEnd (); } NotifyTxBegin (packet); - uint32_t dataRate500KbpsUnits = txVector.GetMode().GetDataRate () * txVector.GetNss() / 500000; + uint32_t dataRate500KbpsUnits; + if (txVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT) + { + dataRate500KbpsUnits = 128 + WifiModeToMcs (txVector.GetMode()); + } + else + { + dataRate500KbpsUnits = txVector.GetMode().GetDataRate () * txVector.GetNss() / 500000; + } bool isShortPreamble = (WIFI_PREAMBLE_SHORT == preamble); NotifyMonitorSniffTx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, txVector.GetTxPowerLevel()); m_state->SwitchToTx (txDuration, packet, GetPowerDbm (txVector.GetTxPowerLevel()), txVector, preamble); @@ -904,7 +912,15 @@ YansWifiPhy::EndReceive (Ptr packet, Ptr even if (m_random->GetValue () > snrPer.per) { NotifyRxEnd (packet); - uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () * event->GetTxVector().GetNss()/ 500000; + uint32_t dataRate500KbpsUnits; + if ((event->GetPayloadMode ().GetModulationClass () == WIFI_MOD_CLASS_HT)) + { + dataRate500KbpsUnits = 128 + WifiModeToMcs (event->GetPayloadMode ()); + } + else + { + dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () * event->GetTxVector().GetNss()/ 500000; + } bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ()); double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30; double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;