From bc0a99c19bca000ef065d2f6a0ef810f86d271d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Sun, 7 Mar 2021 18:10:25 +0100 Subject: [PATCH] wifi: Fix use of YansErrorRateModel for PHY headers --- src/wifi/model/wifi-mode.cc | 5 +++++ src/wifi/model/wifi-mode.h | 13 +++++++++++++ src/wifi/model/yans-error-rate-model.cc | 4 ++-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/wifi/model/wifi-mode.cc b/src/wifi/model/wifi-mode.cc index e83cab701..345e72548 100644 --- a/src/wifi/model/wifi-mode.cc +++ b/src/wifi/model/wifi-mode.cc @@ -32,6 +32,11 @@ bool operator == (const WifiMode &a, const WifiMode &b) return a.GetUid () == b.GetUid (); } +bool operator != (const WifiMode &a, const WifiMode &b) +{ + return a.GetUid () != b.GetUid (); +} + bool operator < (const WifiMode &a, const WifiMode &b) { return a.GetUid () < b.GetUid (); diff --git a/src/wifi/model/wifi-mode.h b/src/wifi/model/wifi-mode.h index 21a571c8e..4f58105b9 100644 --- a/src/wifi/model/wifi-mode.h +++ b/src/wifi/model/wifi-mode.h @@ -222,6 +222,18 @@ private: * false otherwise */ bool operator == (const WifiMode &a, const WifiMode &b); + +/** + * Check if the two WifiModes are different. + * + * \param a WifiMode + * \param b WifiMode + * + * \return true if the two WifiModes are different, + * false otherwise + */ +bool operator != (const WifiMode &a, const WifiMode &b); + /** * Compare two WifiModes * @@ -232,6 +244,7 @@ bool operator == (const WifiMode &a, const WifiMode &b); * false otherwise */ bool operator < (const WifiMode &a, const WifiMode &b); + /** * Serialize WifiMode to ostream (human-readable). * diff --git a/src/wifi/model/yans-error-rate-model.cc b/src/wifi/model/yans-error-rate-model.cc index 5e7b0d52d..e1b964821 100644 --- a/src/wifi/model/yans-error-rate-model.cc +++ b/src/wifi/model/yans-error-rate-model.cc @@ -189,9 +189,9 @@ YansErrorRateModel::DoGetChunkSuccessRate (WifiMode mode, const WifiTxVector& tx || mode.GetModulationClass () == WIFI_MOD_CLASS_HE) { uint64_t phyRate; - if (txVector.IsMu () && (staId == SU_STA_ID)) + if ((mode != txVector.GetMode ()) || (txVector.IsMu () && (staId == SU_STA_ID))) { - phyRate = mode.GetPhyRate (20); //This is the PHY header: consider 20 MHz to calculate the PHY rate + phyRate = mode.GetPhyRate (txVector.GetChannelWidth () >= 40 ? 20 : txVector.GetChannelWidth ()); //This is the PHY header } else {