bug 2020: Erroneous MCS field in 802.11n PCAP files
authorS?bastien Deronne <sebastien.deronne@gmail.com>
Sat, 29 Nov 2014 09:57:24 -0800
changeset 11078 f7c64e56df22
parent 11077 5c8dea49a671
child 11079 fde91036410a
bug 2020: Erroneous MCS field in 802.11n PCAP files
RELEASE_NOTES
src/wifi/model/yans-wifi-phy.cc
--- a/RELEASE_NOTES	Wed Nov 26 16:03:44 2014 -0800
+++ b/RELEASE_NOTES	Sat Nov 29 09:57:24 2014 -0800
@@ -43,6 +43,7 @@
 - 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
--- a/src/wifi/model/yans-wifi-phy.cc	Wed Nov 26 16:03:44 2014 -0800
+++ b/src/wifi/model/yans-wifi-phy.cc	Sat Nov 29 09:57:24 2014 -0800
@@ -638,7 +638,15 @@
       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 @@
   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;