wifi: (fixes #2320) Add method to check whether a WifiTxVector contains a valid combination of WifiMode, number of spatial streams and channel width
--- a/RELEASE_NOTES Wed Mar 09 20:32:05 2016 +0100
+++ b/RELEASE_NOTES Wed Mar 09 20:37:26 2016 +0100
@@ -122,6 +122,7 @@
- Bug 2316 - MacLow shall use a single TXVECTOR for all MPDUs belonging to a same A-MPDU
- Bug 2318 - MPDU Aggregation fails with TCP
- Bug 2319 - BlockAckTimeout value is too low for 802.11n operating at 2.4 GHz
+- Bug 2320 - Add method to check whether a WifiTxVector contains a valid combination of WifiMode, number of spatial streams and channel width
- Bug 2321 - Wifi rate managers should not be triggered for each MPDU when A-MPDU is used
- Bug 2327 - CWmin value selection for 802.11g is not compliant with the standard rules
--- a/src/wifi/model/wifi-phy.cc Wed Mar 09 20:32:05 2016 +0100
+++ b/src/wifi/model/wifi-phy.cc Wed Mar 09 20:37:26 2016 +0100
@@ -1559,6 +1559,42 @@
return mcs;
}
+bool
+WifiPhy::IsValidTxVector (WifiTxVector txVector)
+{
+ uint32_t chWidth = txVector.GetChannelWidth();
+ uint8_t nss = txVector.GetNss();
+ std::string modeName = txVector.GetMode().GetUniqueName();
+
+ if (chWidth == 20)
+ {
+ if (nss != 3 && nss != 6)
+ {
+ return (modeName != "VhtMcs9");
+ }
+ }
+ else if (chWidth == 80)
+ {
+ if (nss == 3 || nss == 7)
+ {
+ return (modeName != "VhtMcs6");
+ }
+ else if (nss == 6)
+ {
+ return (modeName != "VhtMcs9");
+ }
+ }
+ else if (chWidth == 160)
+ {
+ if (nss == 3)
+ {
+ return (modeName != "VhtMcs9");
+ }
+ }
+
+ return true;
+}
+
std::ostream& operator<< (std::ostream& os, enum WifiPhy::State state)
{
switch (state)
--- a/src/wifi/model/wifi-phy.h Wed Mar 09 20:32:05 2016 +0100
+++ b/src/wifi/model/wifi-phy.h Wed Mar 09 20:37:26 2016 +0100
@@ -1056,6 +1056,15 @@
* \return MCS 9 from VHT MCS values
*/
static WifiMode GetVhtMcs9 ();
+ /**
+ * The standard disallows certain combinations of WifiMode, number of
+ * spatial streams, and channel widths. This method can be used to
+ * check whether this WifiTxVector contains an invalid combination.
+ *
+ * \param txVector the WifiTxVector to inspect
+ * \return true if the WifiTxVector parameters are allowed by the standard
+ */
+ static bool IsValidTxVector (WifiTxVector txVector);
/**
* Public method used to fire a PhyTxBegin trace.