diff --git a/CHANGES.html b/CHANGES.html
index 4695f0e6f..a9b009e5c 100644
--- a/CHANGES.html
+++ b/CHANGES.html
@@ -55,7 +55,8 @@ us a note on ns-developers mailing list.
New API:
Added the attribute Release to the class EpsBearer, to select the release (e.g., release 15)
-
The attributes RegularWifiMac::HtSupported, RegularWifiMac::VhtSupported, RegularWifiMac::HeSupported, RegularWifiMac::RifsSupported, WifiPhy::ShortGuardEnabled, WifiPhy::GuardInterval and WifiPhy::GreenfieldEnabled have been deprecated. Intead, it is advised to use WifiNetDevice::HtConfiguration, WifiNetDevice::VhtConfiguration and WifiNetDevice::HeConfiguration.
+
The attributes RegularWifiMac::HtSupported, RegularWifiMac::VhtSupported, RegularWifiMac::HeSupported, RegularWifiMac::RifsSupported, WifiPhy::ShortGuardEnabled, WifiPhy::GuardInterval and WifiPhy::GreenfieldEnabled have been deprecated. Instead, it is advised to use WifiNetDevice::HtConfiguration, WifiNetDevice::VhtConfiguration and WifiNetDevice::HeConfiguration.
+
The attributes {Ht,Vht,He}Configuration::{Vo,Vi,Be,Bk}MaxAmsduSize and {Ht,Vht,He}Configuration::{Vo,Vi,Be,Bk}MaxAmpduSize have been deprecated. Instead, it is advised to use RegularWifiMac::{VO, VI, BE, BK}_MaxAmsduSize and RegularWifiMac::{VO, VI, BE, BK}_MaxAmpduSize.
A new attribute WifiPhy::PostReceptionErrorModel has been added to force specific packet drops.
A new attribute WifiPhy::PreambleDetectionModel has been added to decide whether PHY preambles are successfully detected.
New attributes QosTxop::AddBaResponseTimeout and QosTxop::FailedAddBaTimeout have been added to set the timeout to wait for an ADDBA response after the ACK to the ADDBA request is received and to set the timeout after a failed BA agreement, respectively.
diff --git a/examples/wireless/mixed-network.cc b/examples/wireless/mixed-network.cc
index 4d1260b01..f6f958ed8 100644
--- a/examples/wireless/mixed-network.cc
+++ b/examples/wireless/mixed-network.cc
@@ -250,7 +250,7 @@ Experiment::Run (Parameters params)
edca->SetTxopLimit (MicroSeconds (3008));
}
- Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/BeMaxAmpduSize", UintegerValue (0)); //Disable A-MPDU
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/BE_MaxAmpduSize", UintegerValue (0)); //Disable A-MPDU
// Define mobility model
MobilityHelper mobility;
diff --git a/examples/wireless/rate-adaptation-distance.cc b/examples/wireless/rate-adaptation-distance.cc
index 0d70c4069..3508a00c8 100644
--- a/examples/wireless/rate-adaptation-distance.cc
+++ b/examples/wireless/rate-adaptation-distance.cc
@@ -262,7 +262,7 @@ int main (int argc, char *argv[])
"Ssid", SsidValue (ssid));
wifiApDevices.Add (wifi.Install (wifiPhy, wifiMac, wifiApNodes.Get (0)));
- Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/BeMaxAmpduSize", UintegerValue (BeMaxAmpduSize));
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/BE_MaxAmpduSize", UintegerValue (BeMaxAmpduSize));
}
else if (standard == "802.11ac")
{
@@ -285,7 +285,7 @@ int main (int argc, char *argv[])
"Ssid", SsidValue (ssid));
wifiApDevices.Add (wifi.Install (wifiPhy, wifiMac, wifiApNodes.Get (0)));
- Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/VhtConfiguration/BeMaxAmpduSize", UintegerValue (BeMaxAmpduSize));
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/BE_MaxAmpduSize", UintegerValue (BeMaxAmpduSize));
}
wifiDevices.Add (wifiStaDevices);
diff --git a/examples/wireless/simple-ht-hidden-stations.cc b/examples/wireless/simple-ht-hidden-stations.cc
index 758aa34d9..066539231 100644
--- a/examples/wireless/simple-ht-hidden-stations.cc
+++ b/examples/wireless/simple-ht-hidden-stations.cc
@@ -119,7 +119,7 @@ int main (int argc, char *argv[])
NetDeviceContainer apDevice;
apDevice = wifi.Install (phy, mac, wifiApNode);
- Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/BeMaxAmpduSize", UintegerValue (maxAmpduSize));
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/BE_MaxAmpduSize", UintegerValue (maxAmpduSize));
// Setting mobility model
MobilityHelper mobility;
diff --git a/examples/wireless/wifi-aggregation.cc b/examples/wireless/wifi-aggregation.cc
index b7ad33bed..93d13d873 100644
--- a/examples/wireless/wifi-aggregation.cc
+++ b/examples/wireless/wifi-aggregation.cc
@@ -33,7 +33,7 @@
#include "ns3/packet-sink-helper.h"
#include "ns3/yans-wifi-channel.h"
#include "ns3/wifi-net-device.h"
-#include "ns3/ht-configuration.h"
+#include "ns3/wifi-mac.h"
// This is an example that illustrates how 802.11n aggregation is configured.
// It defines 4 independent Wi-Fi networks (working on different channels).
@@ -134,8 +134,7 @@ int main (int argc, char *argv[])
// Disable A-MPDU
Ptr dev = wifiStaNodes.Get (1)->GetDevice (0);
Ptr wifi_dev = DynamicCast (dev);
- Ptr htConfiguration = wifi_dev->GetHtConfiguration ();
- htConfiguration->SetAttribute ("BeMaxAmpduSize", UintegerValue (0));
+ wifi_dev->GetMac ()->SetAttribute ("BE_MaxAmpduSize", UintegerValue (0));
mac.SetType ("ns3::ApWifiMac",
"Ssid", SsidValue (ssid),
@@ -145,8 +144,7 @@ int main (int argc, char *argv[])
// Disable A-MPDU
dev = wifiApNodes.Get (1)->GetDevice (0);
wifi_dev = DynamicCast (dev);
- htConfiguration = wifi_dev->GetHtConfiguration ();
- htConfiguration->SetAttribute ("BeMaxAmpduSize", UintegerValue (0));
+ wifi_dev->GetMac ()->SetAttribute ("BE_MaxAmpduSize", UintegerValue (0));
// Network C
ssid = Ssid ("network-C");
@@ -159,9 +157,8 @@ int main (int argc, char *argv[])
// Disable A-MPDU and enable A-MSDU with the highest maximum size allowed by the standard (7935 bytes)
dev = wifiStaNodes.Get (2)->GetDevice (0);
wifi_dev = DynamicCast (dev);
- htConfiguration = wifi_dev->GetHtConfiguration ();
- htConfiguration->SetAttribute ("BeMaxAmpduSize", UintegerValue (0));
- htConfiguration->SetAttribute ("BeMaxAmsduSize", UintegerValue (7935));
+ wifi_dev->GetMac ()->SetAttribute ("BE_MaxAmpduSize", UintegerValue (0));
+ wifi_dev->GetMac ()->SetAttribute ("BE_MaxAmsduSize", UintegerValue (7935));
mac.SetType ("ns3::ApWifiMac",
"Ssid", SsidValue (ssid),
@@ -171,9 +168,8 @@ int main (int argc, char *argv[])
// Disable A-MPDU and enable A-MSDU with the highest maximum size allowed by the standard (7935 bytes)
dev = wifiApNodes.Get (2)->GetDevice (0);
wifi_dev = DynamicCast (dev);
- htConfiguration = wifi_dev->GetHtConfiguration ();
- htConfiguration->SetAttribute ("BeMaxAmpduSize", UintegerValue (0));
- htConfiguration->SetAttribute ("BeMaxAmsduSize", UintegerValue (7935));
+ wifi_dev->GetMac ()->SetAttribute ("BE_MaxAmpduSize", UintegerValue (0));
+ wifi_dev->GetMac ()->SetAttribute ("BE_MaxAmsduSize", UintegerValue (7935));
// Network D
ssid = Ssid ("network-D");
@@ -187,9 +183,8 @@ int main (int argc, char *argv[])
// enable A-MSDU with the smallest maximum size allowed by the standard (3839 bytes)
dev = wifiStaNodes.Get (3)->GetDevice (0);
wifi_dev = DynamicCast (dev);
- htConfiguration = wifi_dev->GetHtConfiguration ();
- htConfiguration->SetAttribute ("BeMaxAmpduSize", UintegerValue (32768));
- htConfiguration->SetAttribute ("BeMaxAmsduSize", UintegerValue (3839));
+ wifi_dev->GetMac ()->SetAttribute ("BE_MaxAmpduSize", UintegerValue (32768));
+ wifi_dev->GetMac ()->SetAttribute ("BE_MaxAmsduSize", UintegerValue (3839));
mac.SetType ("ns3::ApWifiMac",
"Ssid", SsidValue (ssid),
@@ -200,9 +195,8 @@ int main (int argc, char *argv[])
// enable A-MSDU with the smallest maximum size allowed by the standard (3839 bytes)
dev = wifiApNodes.Get (3)->GetDevice (0);
wifi_dev = DynamicCast (dev);
- htConfiguration = wifi_dev->GetHtConfiguration ();
- htConfiguration->SetAttribute ("BeMaxAmpduSize", UintegerValue (32768));
- htConfiguration->SetAttribute ("BeMaxAmsduSize", UintegerValue (3839));
+ wifi_dev->GetMac ()->SetAttribute ("BE_MaxAmpduSize", UintegerValue (32768));
+ wifi_dev->GetMac ()->SetAttribute ("BE_MaxAmsduSize", UintegerValue (3839));
// Setting mobility model
MobilityHelper mobility;
diff --git a/src/wifi/examples/wifi-manager-example.cc b/src/wifi/examples/wifi-manager-example.cc
index d10b878b7..237b241ae 100644
--- a/src/wifi/examples/wifi-manager-example.cc
+++ b/src/wifi/examples/wifi-manager-example.cc
@@ -372,9 +372,7 @@ int main (int argc, char *argv[])
wifi.AssignStreams (serverDevice, 100);
wifi.AssignStreams (clientDevice, 100);
- Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/BeMaxAmpduSize", UintegerValue (maxAmpduSize));
- Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/VhtConfiguration/BeMaxAmpduSize", UintegerValue (maxAmpduSize));
- Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HeConfiguration/BeMaxAmpduSize", UintegerValue (maxAmpduSize));
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/BE_MaxAmpduSize", UintegerValue (maxAmpduSize));
Config::ConnectWithoutContext ("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/RemoteStationManager/$ns3::" + wifiManager + "WifiManager/Rate", MakeCallback (&RateChange));
diff --git a/src/wifi/model/he-capabilities.cc b/src/wifi/model/he-capabilities.cc
index ae65a059b..58b154725 100644
--- a/src/wifi/model/he-capabilities.cc
+++ b/src/wifi/model/he-capabilities.cc
@@ -42,7 +42,7 @@ HeCapabilities::HeCapabilities ()
m_groupAddressedMultiStaBlockAckInDlMuSupport (0),
m_omiAcontrolSupport (0),
m_ofdmaRaSupport (0),
- m_maximumAmpduLengthExponent (0),
+ m_maxAmpduLengthExponent (0),
m_amsduFragmentationSupport (0),
m_flexibleTwtScheduleSupport (0),
m_rxControlFrameToMultiBss (0),
@@ -191,7 +191,7 @@ HeCapabilities::SetHeMacCapabilitiesInfo (uint32_t ctrl1, uint8_t ctrl2)
m_groupAddressedMultiStaBlockAckInDlMuSupport = (ctrl1 >> 24) & 0x01;
m_omiAcontrolSupport = (ctrl1 >> 25) & 0x03;
m_ofdmaRaSupport = (ctrl1 >> 26) & 0x01;
- m_maximumAmpduLengthExponent = (ctrl1 >> 27) & 0x03;
+ m_maxAmpduLengthExponent = (ctrl1 >> 27) & 0x03;
m_amsduFragmentationSupport = (ctrl1 >> 29) & 0x01;
m_flexibleTwtScheduleSupport = (ctrl1 >> 30) & 0x01;
m_rxControlFrameToMultiBss = (ctrl1 >> 31) & 0x01;
@@ -223,7 +223,7 @@ HeCapabilities::GetHeMacCapabilitiesInfo1 () const
val |= (m_groupAddressedMultiStaBlockAckInDlMuSupport & 0x01) << 24;
val |= (m_omiAcontrolSupport & 0x03) << 25;
val |= (m_ofdmaRaSupport & 0x01) << 26;
- val |= (m_maximumAmpduLengthExponent & 0x03) << 27;
+ val |= (m_maxAmpduLengthExponent & 0x03) << 27;
val |= (m_amsduFragmentationSupport & 0x01) << 29;
val |= (m_flexibleTwtScheduleSupport & 0x01) << 30;
val |= (m_rxControlFrameToMultiBss & 0x01) << 31;
@@ -433,10 +433,17 @@ HeCapabilities::SetHeLtfAndGiForHePpdus (uint8_t heLtfAndGiForHePpdus)
}
void
-HeCapabilities::SetMaxAmpduLengthExponent (uint8_t exponent)
+HeCapabilities::SetMaxAmpduLength (uint32_t maxampdulength)
{
- NS_ASSERT (exponent <= 7);
- m_maximumAmpduLengthExponent = exponent;
+ for (uint8_t i = 0; i <= 3; i++)
+ {
+ if ((1ul << (20 + i)) - 1 == maxampdulength)
+ {
+ m_maxAmpduLengthExponent = i;
+ return;
+ }
+ }
+ NS_ABORT_MSG ("Invalid A-MPDU Max Length value");
}
void
@@ -477,6 +484,12 @@ HeCapabilities::GetHighestNssSupported (void) const
return m_highestNssSupportedM1 + 1;
}
+uint32_t
+HeCapabilities::GetMaxAmpduLength (void) const
+{
+ return (1ul << (20 + m_maxAmpduLengthExponent)) - 1;
+}
+
/**
* output stream output operator
* \param os the output stream
diff --git a/src/wifi/model/he-capabilities.h b/src/wifi/model/he-capabilities.h
index 776ceb579..f2b2fcec6 100644
--- a/src/wifi/model/he-capabilities.h
+++ b/src/wifi/model/he-capabilities.h
@@ -159,11 +159,11 @@ public:
// MAC Capabilities Info fields
/**
- * Set maximum AMPDU length exponent.
+ * Set the maximum AMPDU length.
*
- * \param exponent the maximum AMPDU length exponent
+ * \param maxampdulength 2^(20 + x) - 1, x in the range 0 to 3
*/
- void SetMaxAmpduLengthExponent (uint8_t exponent);
+ void SetMaxAmpduLength (uint32_t maxampdulength);
// MCS and NSS field information
/**
@@ -194,6 +194,13 @@ public:
*/
bool IsSupportedRxMcs (uint8_t mcs) const;
+ /**
+ * Return the maximum A-MPDU length.
+ *
+ * \return the maximum A-MPDU length
+ */
+ uint32_t GetMaxAmpduLength (void) const;
+
/*
* This information element is a bit special in that it is only
* included if the STA is an HE STA. To support this we
@@ -237,7 +244,7 @@ private:
uint8_t m_groupAddressedMultiStaBlockAckInDlMuSupport; //!< group addressed multi STA block ack in DL support
uint8_t m_omiAcontrolSupport; //!< OMI A control support
uint8_t m_ofdmaRaSupport; //!< OFDM RA support
- uint8_t m_maximumAmpduLengthExponent; //!< maximum AMPDU length exponenet
+ uint8_t m_maxAmpduLengthExponent; //!< maximum AMPDU length exponenet
uint8_t m_amsduFragmentationSupport; //!< AMSDU fragmentation support
uint8_t m_flexibleTwtScheduleSupport; //!< flexible TWT schedule support
uint8_t m_rxControlFrameToMultiBss; //!< receive control frame to multi bias
diff --git a/src/wifi/model/he-configuration.cc b/src/wifi/model/he-configuration.cc
index efed62d51..726b36b63 100644
--- a/src/wifi/model/he-configuration.cc
+++ b/src/wifi/model/he-configuration.cc
@@ -57,54 +57,6 @@ HeConfiguration::GetTypeId (void)
MakeUintegerAccessor (&HeConfiguration::GetMpduBufferSize,
&HeConfiguration::SetMpduBufferSize),
MakeUintegerChecker (64, 256))
- .AddAttribute ("VoMaxAmsduSize",
- "Maximum length in bytes of an A-MSDU for AC_VO access class. "
- "Value 0 means A-MSDU is disabled for that AC.",
- UintegerValue (0),
- MakeUintegerAccessor (&HeConfiguration::m_voMaxAmsduSize),
- MakeUintegerChecker (0, 11454))
- .AddAttribute ("ViMaxAmsduSize",
- "Maximum length in bytes of an A-MSDU for AC_VI access class."
- "Value 0 means A-MSDU is disabled for that AC.",
- UintegerValue (0),
- MakeUintegerAccessor (&HeConfiguration::m_viMaxAmsduSize),
- MakeUintegerChecker (0, 11454))
- .AddAttribute ("BeMaxAmsduSize",
- "Maximum length in bytes of an A-MSDU for AC_BE access class."
- "Value 0 means A-MSDU is disabled for that AC.",
- UintegerValue (0),
- MakeUintegerAccessor (&HeConfiguration::m_beMaxAmsduSize),
- MakeUintegerChecker (0, 11454))
- .AddAttribute ("BkMaxAmsduSize",
- "Maximum length in bytes of an A-MSDU for AC_BK access class."
- "Value 0 means A-MSDU is disabled for that AC.",
- UintegerValue (0),
- MakeUintegerAccessor (&HeConfiguration::m_bkMaxAmsduSize),
- MakeUintegerChecker (0, 11454))
- .AddAttribute ("VoMaxAmpduSize",
- "Maximum length in bytes of an A-MPDU for AC_VO access class."
- "Value 0 means A-MPDU is disabled for that AC.",
- UintegerValue (0),
- MakeUintegerAccessor (&HeConfiguration::m_voMaxAmpduSize),
- MakeUintegerChecker (0, 4194303))
- .AddAttribute ("ViMaxAmpduSize",
- "Maximum length in bytes of an A-MPDU for AC_VI access class."
- "Value 0 means A-MPDU is disabled for that AC.",
- UintegerValue (4194303),
- MakeUintegerAccessor (&HeConfiguration::m_viMaxAmpduSize),
- MakeUintegerChecker (0, 4194303))
- .AddAttribute ("BeMaxAmpduSize",
- "Maximum length in bytes of an A-MPDU for AC_BE access class."
- "Value 0 means A-MPDU is disabled for that AC.",
- UintegerValue (4194303),
- MakeUintegerAccessor (&HeConfiguration::m_beMaxAmpduSize),
- MakeUintegerChecker (0, 4194303))
- .AddAttribute ("BkMaxAmpduSize",
- "Maximum length in bytes of an A-MPDU for AC_BK access class."
- "Value 0 means A-MPDU is disabled for that AC.",
- UintegerValue (0),
- MakeUintegerAccessor (&HeConfiguration::m_bkMaxAmpduSize),
- MakeUintegerChecker (0, 4194303))
;
return tid;
}
diff --git a/src/wifi/model/he-configuration.h b/src/wifi/model/he-configuration.h
index 733ca1a18..0e5f6d3e2 100644
--- a/src/wifi/model/he-configuration.h
+++ b/src/wifi/model/he-configuration.h
@@ -60,16 +60,6 @@ private:
Time m_guardInterval; //!< Supported HE guard interval
uint8_t m_bssColor; //!< BSS color
uint16_t m_mpduBufferSize; //!< MPDU buffer size
-
- uint16_t m_voMaxAmsduSize; ///< maximum A-MSDU size for AC_VO
- uint16_t m_viMaxAmsduSize; ///< maximum A-MSDU size for AC_VI
- uint16_t m_beMaxAmsduSize; ///< maximum A-MSDU size for AC_BE
- uint16_t m_bkMaxAmsduSize; ///< maximum A-MSDU size for AC_BK
-
- uint32_t m_voMaxAmpduSize; ///< maximum A-MPDU size for AC_VO
- uint32_t m_viMaxAmpduSize; ///< maximum A-MPDU size for AC_VI
- uint32_t m_beMaxAmpduSize; ///< maximum A-MPDU size for AC_BE
- uint32_t m_bkMaxAmpduSize; ///< maximum A-MPDU size for AC_BK
};
} //namespace ns3
diff --git a/src/wifi/model/ht-capabilities.cc b/src/wifi/model/ht-capabilities.cc
index ad56e65bc..810628731 100644
--- a/src/wifi/model/ht-capabilities.cc
+++ b/src/wifi/model/ht-capabilities.cc
@@ -38,7 +38,7 @@ HtCapabilities::HtCapabilities ()
m_psmpSupport (0),
m_fortyMhzIntolerant (0),
m_lsigProtectionSupport (0),
- m_maxAmpduLength (0),
+ m_maxAmpduLengthExponent (0),
m_minMpduStartSpace (0),
m_ampduReserved (0),
m_reservedMcsSet1 (0),
@@ -135,9 +135,11 @@ HtCapabilities::SetShortGuardInterval40 (uint8_t shortguardinterval)
}
void
-HtCapabilities::SetMaxAmsduLength (uint8_t maxamsdulength)
+HtCapabilities::SetMaxAmsduLength (uint16_t maxamsdulength)
{
- m_maxAmsduLength = maxamsdulength;
+ NS_ABORT_MSG_IF (maxamsdulength != 3839 && maxamsdulength != 7935,
+ "Invalid A-MSDU Max Length value");
+ m_maxAmsduLength = (maxamsdulength == 3839 ? 0 : 1);
}
void
@@ -147,9 +149,17 @@ HtCapabilities::SetLSigProtectionSupport (uint8_t lsigprotection)
}
void
-HtCapabilities::SetMaxAmpduLength (uint8_t maxampdulength)
+HtCapabilities::SetMaxAmpduLength (uint32_t maxampdulength)
{
- m_maxAmpduLength = maxampdulength;
+ for (uint8_t i = 0; i <= 3; i++)
+ {
+ if ((1ul << (13 + i)) - 1 == maxampdulength)
+ {
+ m_maxAmpduLengthExponent = i;
+ return;
+ }
+ }
+ NS_ABORT_MSG ("Invalid A-MPDU Max Length value");
}
void
@@ -212,6 +222,22 @@ HtCapabilities::GetShortGuardInterval20 (void) const
return m_shortGuardInterval20;
}
+uint16_t
+HtCapabilities::GetMaxAmsduLength (void) const
+{
+ if (m_maxAmsduLength == 0)
+ {
+ return 3839;
+ }
+ return 7935;
+}
+
+uint32_t
+HtCapabilities::GetMaxAmpduLength (void) const
+{
+ return (1ul << (13 + m_maxAmpduLengthExponent)) - 1;
+}
+
bool
HtCapabilities::IsSupportedMcs (uint8_t mcs) const
{
@@ -309,7 +335,7 @@ HtCapabilities::SetHtCapabilitiesInfo (uint16_t ctrl)
void
HtCapabilities::SetAmpduParameters (uint8_t ctrl)
{
- m_maxAmpduLength = ctrl & 0x03;
+ m_maxAmpduLengthExponent = ctrl & 0x03;
m_minMpduStartSpace = (ctrl >> 2) & 0x1b;
m_ampduReserved = (ctrl >> 5) & 0xe0;
}
@@ -318,7 +344,7 @@ uint8_t
HtCapabilities::GetAmpduParameters (void) const
{
uint8_t val = 0;
- val |= m_maxAmpduLength & 0x03;
+ val |= m_maxAmpduLengthExponent & 0x03;
val |= (m_minMpduStartSpace & 0x1b) << 2;
val |= (m_ampduReserved & 0xe0) << 5;
return val;
diff --git a/src/wifi/model/ht-capabilities.h b/src/wifi/model/ht-capabilities.h
index 229599fef..5f5e234db 100644
--- a/src/wifi/model/ht-capabilities.h
+++ b/src/wifi/model/ht-capabilities.h
@@ -122,9 +122,9 @@ public:
/**
* Set the maximum AMSDU length.
*
- * \param maxamsdulength
+ * \param maxamsdulength Either 3839 or 7935
*/
- void SetMaxAmsduLength (uint8_t maxamsdulength);
+ void SetMaxAmsduLength (uint16_t maxamsdulength);
/**
* Set the LSIG protection support.
*
@@ -135,9 +135,9 @@ public:
/**
* Set the maximum AMPDU length.
*
- * \param maxampdulength
+ * \param maxampdulength 2^(13 + x) - 1, x in the range 0 to 3
*/
- void SetMaxAmpduLength (uint8_t maxampdulength);
+ void SetMaxAmpduLength (uint32_t maxampdulength);
/**
* Set the receive MCS bitmask.
@@ -243,6 +243,18 @@ public:
* \return the short guard interval 20 value
*/
uint8_t GetShortGuardInterval20 (void) const;
+ /**
+ * Return the maximum A-MSDU length.
+ *
+ * \return the maximum A-MSDU length
+ */
+ uint16_t GetMaxAmsduLength (void) const;
+ /**
+ * Return the maximum A-MPDU length.
+ *
+ * \return the maximum A-MPDU length
+ */
+ uint32_t GetMaxAmpduLength (void) const;
/**
* Return the is MCS supported flag.
*
@@ -324,7 +336,7 @@ private:
uint8_t m_lsigProtectionSupport; ///< LSIG protection support
//A-MPDU Parameters field
- uint8_t m_maxAmpduLength; ///< maximum AMPDU length
+ uint8_t m_maxAmpduLengthExponent; ///< maximum AMPDU length
uint8_t m_minMpduStartSpace; ///< minimum MPDU start space
uint8_t m_ampduReserved; ///< AMPDU reserved
diff --git a/src/wifi/model/ht-configuration.cc b/src/wifi/model/ht-configuration.cc
index a9cc620cc..9f4ed0c08 100644
--- a/src/wifi/model/ht-configuration.cc
+++ b/src/wifi/model/ht-configuration.cc
@@ -64,54 +64,6 @@ HtConfiguration::GetTypeId (void)
MakeBooleanAccessor (&HtConfiguration::SetRifsSupported,
&HtConfiguration::GetRifsSupported),
MakeBooleanChecker ())
- .AddAttribute ("VoMaxAmsduSize",
- "Maximum length in bytes of an A-MSDU for AC_VO access class. "
- "Value 0 means A-MSDU is disabled for that AC.",
- UintegerValue (0),
- MakeUintegerAccessor (&HtConfiguration::m_voMaxAmsduSize),
- MakeUintegerChecker (0, 7935))
- .AddAttribute ("ViMaxAmsduSize",
- "Maximum length in bytes of an A-MSDU for AC_VI access class."
- "Value 0 means A-MSDU is disabled for that AC.",
- UintegerValue (0),
- MakeUintegerAccessor (&HtConfiguration::m_viMaxAmsduSize),
- MakeUintegerChecker (0, 7935))
- .AddAttribute ("BeMaxAmsduSize",
- "Maximum length in bytes of an A-MSDU for AC_BE access class."
- "Value 0 means A-MSDU is disabled for that AC.",
- UintegerValue (0),
- MakeUintegerAccessor (&HtConfiguration::m_beMaxAmsduSize),
- MakeUintegerChecker (0, 7935))
- .AddAttribute ("BkMaxAmsduSize",
- "Maximum length in bytes of an A-MSDU for AC_BK access class."
- "Value 0 means A-MSDU is disabled for that AC.",
- UintegerValue (0),
- MakeUintegerAccessor (&HtConfiguration::m_bkMaxAmsduSize),
- MakeUintegerChecker (0, 7935))
- .AddAttribute ("VoMaxAmpduSize",
- "Maximum length in bytes of an A-MPDU for AC_VO access class."
- "Value 0 means A-MPDU is disabled for that AC.",
- UintegerValue (0),
- MakeUintegerAccessor (&HtConfiguration::m_voMaxAmpduSize),
- MakeUintegerChecker (0, 65535))
- .AddAttribute ("ViMaxAmpduSize",
- "Maximum length in bytes of an A-MPDU for AC_VI access class."
- "Value 0 means A-MPDU is disabled for that AC.",
- UintegerValue (65535),
- MakeUintegerAccessor (&HtConfiguration::m_viMaxAmpduSize),
- MakeUintegerChecker (0, 65535))
- .AddAttribute ("BeMaxAmpduSize",
- "Maximum length in bytes of an A-MPDU for AC_BE access class."
- "Value 0 means A-MPDU is disabled for that AC.",
- UintegerValue (65535),
- MakeUintegerAccessor (&HtConfiguration::m_beMaxAmpduSize),
- MakeUintegerChecker (0, 65535))
- .AddAttribute ("BkMaxAmpduSize",
- "Maximum length in bytes of an A-MPDU for AC_BK access class."
- "Value 0 means A-MPDU is disabled for that AC.",
- UintegerValue (0),
- MakeUintegerAccessor (&HtConfiguration::m_bkMaxAmpduSize),
- MakeUintegerChecker (0, 65535))
;
return tid;
}
diff --git a/src/wifi/model/ht-configuration.h b/src/wifi/model/ht-configuration.h
index 3cac37855..f391c6b9f 100644
--- a/src/wifi/model/ht-configuration.h
+++ b/src/wifi/model/ht-configuration.h
@@ -89,16 +89,6 @@ private:
bool m_sgiSupported; ///< flag whether short guard interval is supported
bool m_rifsSupported; ///< flag whether RIFS is supported
bool m_greenfieldSupported; ///< flag whether Greenfield is supported
-
- uint16_t m_voMaxAmsduSize; ///< maximum A-MSDU size for AC_VO
- uint16_t m_viMaxAmsduSize; ///< maximum A-MSDU size for AC_VI
- uint16_t m_beMaxAmsduSize; ///< maximum A-MSDU size for AC_BE
- uint16_t m_bkMaxAmsduSize; ///< maximum A-MSDU size for AC_BK
-
- uint32_t m_voMaxAmpduSize; ///< maximum A-MPDU size for AC_VO
- uint32_t m_viMaxAmpduSize; ///< maximum A-MPDU size for AC_VI
- uint32_t m_beMaxAmpduSize; ///< maximum A-MPDU size for AC_BE
- uint32_t m_bkMaxAmpduSize; ///< maximum A-MPDU size for AC_BK
};
} //namespace ns3
diff --git a/src/wifi/model/mac-low.cc b/src/wifi/model/mac-low.cc
index 5b3bb0de2..9f37f110c 100644
--- a/src/wifi/model/mac-low.cc
+++ b/src/wifi/model/mac-low.cc
@@ -40,9 +40,7 @@
#include "wifi-phy.h"
#include "wifi-net-device.h"
#include "wifi-mac.h"
-#include "ht-configuration.h"
-#include "vht-configuration.h"
-#include "he-configuration.h"
+#include
#undef NS_LOG_APPEND_CONTEXT
#define NS_LOG_APPEND_CONTEXT std::clog << "[mac=" << m_self << "] "
@@ -3249,76 +3247,36 @@ MacLow::GetMaxAmsduSize (AcIndex ac) const
{
UintegerValue size;
WifiModulationClass modulation = GetDataTxVector (m_currentPacket, &m_currentHdr).GetMode ().GetModulationClass ();
+
+ switch (ac)
+ {
+ case AC_BE:
+ m_mac->GetAttribute ("BE_MaxAmsduSize", size);
+ break;
+ case AC_BK:
+ m_mac->GetAttribute ("BK_MaxAmsduSize", size);
+ break;
+ case AC_VI:
+ m_mac->GetAttribute ("VI_MaxAmsduSize", size);
+ break;
+ case AC_VO:
+ m_mac->GetAttribute ("VO_MaxAmsduSize", size);
+ break;
+ default:
+ NS_ASSERT (false);
+ return 0;
+ }
+
if (modulation == WIFI_MOD_CLASS_HT)
{
- Ptr htConfiguration = m_mac->GetHtConfiguration ();
- NS_ASSERT (htConfiguration); //If modulation to transmit A-MSDU is HT, we should have a HT configuration attached
- switch (ac)
- {
- case AC_BE:
- htConfiguration->GetAttribute ("BeMaxAmsduSize", size);
- break;
- case AC_BK:
- htConfiguration->GetAttribute ("BkMaxAmsduSize", size);
- break;
- case AC_VI:
- htConfiguration->GetAttribute ("ViMaxAmsduSize", size);
- break;
- case AC_VO:
- htConfiguration->GetAttribute ("VoMaxAmsduSize", size);
- break;
- default:
- NS_ASSERT (false);
- return 0;
- }
+ return std::min (size.Get (), static_cast (7935));
}
- else if (modulation == WIFI_MOD_CLASS_VHT)
+ if (modulation == WIFI_MOD_CLASS_VHT || modulation == WIFI_MOD_CLASS_HE)
{
- Ptr vhtConfiguration = m_mac->GetVhtConfiguration ();
- NS_ASSERT (vhtConfiguration); //If modulation to transmit A-MSDU is VHT, we should have a VHT configuration attached
- switch (ac)
- {
- case AC_BE:
- vhtConfiguration->GetAttribute ("BeMaxAmsduSize", size);
- break;
- case AC_BK:
- vhtConfiguration->GetAttribute ("BkMaxAmsduSize", size);
- break;
- case AC_VI:
- vhtConfiguration->GetAttribute ("ViMaxAmsduSize", size);
- break;
- case AC_VO:
- vhtConfiguration->GetAttribute ("VoMaxAmsduSize", size);
- break;
- default:
- NS_ASSERT (false);
- return 0;
- }
+ return std::min (size.Get (), static_cast (11398));
}
- else if (modulation == WIFI_MOD_CLASS_HE)
- {
- Ptr heConfiguration = m_mac->GetHeConfiguration ();
- NS_ASSERT (heConfiguration); //If modulation to transmit A-MSDU is HE, we should have a HE configuration attached
- switch (ac)
- {
- case AC_BE:
- heConfiguration->GetAttribute ("BeMaxAmsduSize", size);
- break;
- case AC_BK:
- heConfiguration->GetAttribute ("BkMaxAmsduSize", size);
- break;
- case AC_VI:
- heConfiguration->GetAttribute ("ViMaxAmsduSize", size);
- break;
- case AC_VO:
- heConfiguration->GetAttribute ("VoMaxAmsduSize", size);
- break;
- default:
- NS_ASSERT (false);
- return 0;
- }
- }
- return size.Get ();
+
+ return 0;
}
uint32_t
@@ -3326,76 +3284,40 @@ MacLow::GetMaxAmpduSize (AcIndex ac) const
{
UintegerValue size;
WifiModulationClass modulation = GetDataTxVector (m_currentPacket, &m_currentHdr).GetMode ().GetModulationClass ();
+
+ switch (ac)
+ {
+ case AC_BE:
+ m_mac->GetAttribute ("BE_MaxAmpduSize", size);
+ break;
+ case AC_BK:
+ m_mac->GetAttribute ("BK_MaxAmpduSize", size);
+ break;
+ case AC_VI:
+ m_mac->GetAttribute ("VI_MaxAmpduSize", size);
+ break;
+ case AC_VO:
+ m_mac->GetAttribute ("VO_MaxAmpduSize", size);
+ break;
+ default:
+ NS_ASSERT (false);
+ return 0;
+ }
+
if (modulation == WIFI_MOD_CLASS_HT)
{
- Ptr htConfiguration = m_mac->GetHtConfiguration ();
- NS_ASSERT (htConfiguration); //If modulation to transmit A-MPDU is HT, we should have a HT configuration attached
- switch (ac)
- {
- case AC_BE:
- htConfiguration->GetAttribute ("BeMaxAmpduSize", size);
- break;
- case AC_BK:
- htConfiguration->GetAttribute ("BkMaxAmpduSize", size);
- break;
- case AC_VI:
- htConfiguration->GetAttribute ("ViMaxAmpduSize", size);
- break;
- case AC_VO:
- htConfiguration->GetAttribute ("VoMaxAmpduSize", size);
- break;
- default:
- NS_ASSERT (false);
- return 0;
- }
+ return std::min (size.Get (), static_cast (65535));
}
- else if (modulation == WIFI_MOD_CLASS_VHT)
+ if (modulation == WIFI_MOD_CLASS_VHT)
{
- Ptr vhtConfiguration = m_mac->GetVhtConfiguration ();
- NS_ASSERT (vhtConfiguration); //If modulation to transmit A-MPDU is VHT, we should have a VHT configuration attached
- switch (ac)
- {
- case AC_BE:
- vhtConfiguration->GetAttribute ("BeMaxAmpduSize", size);
- break;
- case AC_BK:
- vhtConfiguration->GetAttribute ("BkMaxAmpduSize", size);
- break;
- case AC_VI:
- vhtConfiguration->GetAttribute ("ViMaxAmpduSize", size);
- break;
- case AC_VO:
- vhtConfiguration->GetAttribute ("VoMaxAmpduSize", size);
- break;
- default:
- NS_ASSERT (false);
- return 0;
- }
+ return std::min (size.Get (), static_cast (1048575));
}
- else if (modulation == WIFI_MOD_CLASS_HE)
+ if (modulation == WIFI_MOD_CLASS_HE)
{
- Ptr heConfiguration = m_mac->GetHeConfiguration ();
- NS_ASSERT (heConfiguration); //If modulation to transmit A-MPDU is HE, we should have a HE configuration attached
- switch (ac)
- {
- case AC_BE:
- heConfiguration->GetAttribute ("BeMaxAmpduSize", size);
- break;
- case AC_BK:
- heConfiguration->GetAttribute ("BkMaxAmpduSize", size);
- break;
- case AC_VI:
- heConfiguration->GetAttribute ("ViMaxAmpduSize", size);
- break;
- case AC_VO:
- heConfiguration->GetAttribute ("VoMaxAmpduSize", size);
- break;
- default:
- NS_ASSERT (false);
- return 0;
- }
+ return std::min (size.Get (), static_cast (8388607));
}
- return size.Get ();
+
+ return 0;
}
} //namespace ns3
diff --git a/src/wifi/model/regular-wifi-mac.cc b/src/wifi/model/regular-wifi-mac.cc
index 4bece0b61..3c9013d4d 100644
--- a/src/wifi/model/regular-wifi-mac.cc
+++ b/src/wifi/model/regular-wifi-mac.cc
@@ -35,6 +35,8 @@
#include "ht-configuration.h"
#include "vht-configuration.h"
#include "he-configuration.h"
+#include
+#include
namespace ns3 {
@@ -169,21 +171,25 @@ RegularWifiMac::GetHtCapabilities (void) const
capabilities.SetShortGuardInterval20 (sgiSupported);
capabilities.SetShortGuardInterval40 (m_phy->GetChannelWidth () >= 40 && sgiSupported);
capabilities.SetGreenfield (greenfieldSupported);
- uint32_t maxAmsduLength = std::max (std::max (m_beMaxAmsduSize, m_bkMaxAmsduSize), std::max (m_voMaxAmsduSize, m_viMaxAmsduSize));
- capabilities.SetMaxAmsduLength (maxAmsduLength > 3839); //0 if 3839 and 1 if 7935
+ // Set Maximum A-MSDU Length subfield
+ uint16_t maxAmsduSize = std::max ({m_voMaxAmsduSize, m_viMaxAmsduSize,
+ m_beMaxAmsduSize, m_bkMaxAmsduSize});
+ if (maxAmsduSize <= 3839)
+ {
+ capabilities.SetMaxAmsduLength (3839);
+ }
+ else
+ {
+ capabilities.SetMaxAmsduLength (7935);
+ }
+ uint32_t maxAmpduLength = std::max ({m_voMaxAmpduSize, m_viMaxAmpduSize,
+ m_beMaxAmpduSize, m_bkMaxAmpduSize});
+ // round to the next power of two minus one
+ maxAmpduLength = (1ul << static_cast (std::ceil (std::log2 (maxAmpduLength + 1)))) - 1;
+ // The maximum A-MPDU length in HT capabilities elements ranges from 2^13-1 to 2^16-1
+ capabilities.SetMaxAmpduLength (std::min (std::max (maxAmpduLength, 8191u), 65535u));
+
capabilities.SetLSigProtectionSupport (!greenfieldSupported);
- UintegerValue beMaxAmpduSize, bkMaxAmpduSize, voMaxAmpduSize, viMaxAmpduSize;
- htConfiguration->GetAttribute ("BeMaxAmpduSize", beMaxAmpduSize);
- htConfiguration->GetAttribute ("BkMaxAmpduSize", bkMaxAmpduSize);
- htConfiguration->GetAttribute ("ViMaxAmpduSize", voMaxAmpduSize);
- htConfiguration->GetAttribute ("VoMaxAmpduSize", viMaxAmpduSize);
- double maxAmpduLengthExponent = std::max (std::ceil ((std::log (std::max (std::max (beMaxAmpduSize.Get (), bkMaxAmpduSize.Get ()), std::max (voMaxAmpduSize.Get (), viMaxAmpduSize.Get ()))
- + 1.0)
- / std::log (2.0))
- - 13.0),
- 0.0);
- NS_ASSERT (maxAmpduLengthExponent >= 0 && maxAmpduLengthExponent <= 255);
- capabilities.SetMaxAmpduLength (std::max (3, static_cast (maxAmpduLengthExponent))); //0 to 3 for HT
uint64_t maxSupportedRate = 0; //in bit/s
for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
{
@@ -231,19 +237,31 @@ RegularWifiMac::GetVhtCapabilities (void) const
{
capabilities.SetSupportedChannelWidthSet (0);
}
- uint32_t maxMpduLength = std::max (std::max (m_beMaxAmsduSize, m_bkMaxAmsduSize), std::max (m_voMaxAmsduSize, m_viMaxAmsduSize)) + 56; //see section 9.11 of 11ac standard
- capabilities.SetMaxMpduLength (uint8_t (maxMpduLength > 3895) + uint8_t (maxMpduLength > 7991)); //0 if 3895, 1 if 7991, 2 for 11454
+ // Set Maximum MPDU Length subfield
+ uint16_t maxAmsduSize = std::max ({m_voMaxAmsduSize, m_viMaxAmsduSize,
+ m_beMaxAmsduSize, m_bkMaxAmsduSize});
+ if (maxAmsduSize <= 3839)
+ {
+ capabilities.SetMaxMpduLength (3895);
+ }
+ else if (maxAmsduSize <= 7935)
+ {
+ capabilities.SetMaxMpduLength (7991);
+ }
+ else
+ {
+ capabilities.SetMaxMpduLength (11454);
+ }
+ uint32_t maxAmpduLength = std::max ({m_voMaxAmpduSize, m_viMaxAmpduSize,
+ m_beMaxAmpduSize, m_bkMaxAmpduSize});
+ // round to the next power of two minus one
+ maxAmpduLength = (1ul << static_cast (std::ceil (std::log2 (maxAmpduLength + 1)))) - 1;
+ // The maximum A-MPDU length in VHT capabilities elements ranges from 2^13-1 to 2^20-1
+ capabilities.SetMaxAmpduLength (std::min (std::max (maxAmpduLength, 8191u), 1048575u));
+
capabilities.SetRxLdpc (0);
capabilities.SetShortGuardIntervalFor80Mhz ((m_phy->GetChannelWidth () == 80) && sgiSupported);
capabilities.SetShortGuardIntervalFor160Mhz ((m_phy->GetChannelWidth () == 160) && sgiSupported);
- UintegerValue beMaxAmpduSize, bkMaxAmpduSize, voMaxAmpduSize, viMaxAmpduSize;
- vhtConfiguration->GetAttribute ("BeMaxAmpduSize", beMaxAmpduSize);
- vhtConfiguration->GetAttribute ("BkMaxAmpduSize", bkMaxAmpduSize);
- vhtConfiguration->GetAttribute ("ViMaxAmpduSize", voMaxAmpduSize);
- vhtConfiguration->GetAttribute ("VoMaxAmpduSize", viMaxAmpduSize);
- double maxAmpduLengthExponent = std::max (std::ceil ((std::log (std::max (std::max (beMaxAmpduSize.Get (), bkMaxAmpduSize.Get ()), std::max (voMaxAmpduSize.Get (), viMaxAmpduSize.Get ())) + 1.0) / std::log (2.0)) - 13.0), 0.0);
- NS_ASSERT (maxAmpduLengthExponent >= 0 && maxAmpduLengthExponent <= 255);
- capabilities.SetMaxAmpduLengthExponent (std::max (7, static_cast (maxAmpduLengthExponent))); //0 to 7 for VHT
uint8_t maxMcs = 0;
for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
{
@@ -320,18 +338,13 @@ RegularWifiMac::GetHeCapabilities (void) const
gi |= 0x02;
}
capabilities.SetHeLtfAndGiForHePpdus (gi);
- UintegerValue beMaxAmpduSize, bkMaxAmpduSize, voMaxAmpduSize, viMaxAmpduSize;
- heConfiguration->GetAttribute ("BeMaxAmpduSize", beMaxAmpduSize);
- heConfiguration->GetAttribute ("BkMaxAmpduSize", bkMaxAmpduSize);
- heConfiguration->GetAttribute ("ViMaxAmpduSize", voMaxAmpduSize);
- heConfiguration->GetAttribute ("VoMaxAmpduSize", viMaxAmpduSize);
- double maxAmpduLengthExponent = std::max (std::ceil ((std::log (std::max (std::max (beMaxAmpduSize.Get (), bkMaxAmpduSize.Get ()), std::max (voMaxAmpduSize.Get (), viMaxAmpduSize.Get ()))
- + 1.0)
- / std::log (2.0))
- - 20.0),
- 0.0);
- NS_ASSERT (maxAmpduLengthExponent >= 0 && maxAmpduLengthExponent <= 255);
- capabilities.SetMaxAmpduLengthExponent (std::max (7, static_cast (maxAmpduLengthExponent))); //assume 0 to 7 for HE
+ uint32_t maxAmpduLength = std::max ({m_voMaxAmpduSize, m_viMaxAmpduSize,
+ m_beMaxAmpduSize, m_bkMaxAmpduSize});
+ // round to the next power of two minus one
+ maxAmpduLength = (1ul << static_cast (std::ceil (std::log2 (maxAmpduLength + 1)))) - 1;
+ // The maximum A-MPDU length in HE capabilities elements ranges from 2^20-1 to 2^23-1
+ capabilities.SetMaxAmpduLength (std::min (std::max (maxAmpduLength, 1048575u), 8388607u));
+
uint8_t maxMcs = 0;
for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
{
@@ -348,134 +361,6 @@ RegularWifiMac::GetHeCapabilities (void) const
return capabilities;
}
-void
-RegularWifiMac::SetVoMaxAmsduSize (uint16_t size)
-{
- NS_LOG_FUNCTION (this << size);
- Ptr device = DynamicCast (GetDevice ());
- if (device)
- {
- Ptr htConfiguration = device->GetHtConfiguration ();
- if (htConfiguration)
- {
- htConfiguration->SetAttribute ("VoMaxAmsduSize", UintegerValue (size));
- }
- }
- m_voMaxAmsduSize = size;
-}
-
-void
-RegularWifiMac::SetViMaxAmsduSize (uint16_t size)
-{
- NS_LOG_FUNCTION (this << size);
- Ptr device = DynamicCast (GetDevice ());
- if (device)
- {
- Ptr htConfiguration = device->GetHtConfiguration ();
- if (htConfiguration)
- {
- htConfiguration->SetAttribute ("ViMaxAmsduSize", UintegerValue (size));
- }
- }
- m_viMaxAmsduSize = size;
-}
-
-void
-RegularWifiMac::SetBeMaxAmsduSize (uint16_t size)
-{
- NS_LOG_FUNCTION (this << size);
- Ptr device = DynamicCast (GetDevice ());
- if (device)
- {
- Ptr htConfiguration = device->GetHtConfiguration ();
- if (htConfiguration)
- {
- htConfiguration->SetAttribute ("BeMaxAmsduSize", UintegerValue (size));
- }
- }
- m_beMaxAmsduSize = size;
-}
-
-void
-RegularWifiMac::SetBkMaxAmsduSize (uint16_t size)
-{
- NS_LOG_FUNCTION (this << size);
- Ptr device = DynamicCast (GetDevice ());
- if (device)
- {
- Ptr htConfiguration = device->GetHtConfiguration ();
- if (htConfiguration)
- {
- htConfiguration->SetAttribute ("BkMaxAmsduSize", UintegerValue (size));
- }
- }
- m_bkMaxAmsduSize = size;
-}
-
-void
-RegularWifiMac::SetVoMaxAmpduSize (uint32_t size)
-{
- NS_LOG_FUNCTION (this << size);
- Ptr device = DynamicCast (GetDevice ());
- if (device)
- {
- Ptr htConfiguration = device->GetHtConfiguration ();
- if (htConfiguration)
- {
- htConfiguration->SetAttribute ("VoMaxAmpduSize", UintegerValue (size));
- }
- }
- m_voMaxAmpduSize = size;
-}
-
-void
-RegularWifiMac::SetViMaxAmpduSize (uint32_t size)
-{
- NS_LOG_FUNCTION (this << size);
- Ptr device = DynamicCast (GetDevice ());
- if (device)
- {
- Ptr htConfiguration = device->GetHtConfiguration ();
- if (htConfiguration)
- {
- htConfiguration->SetAttribute ("ViMaxAmpduSize", UintegerValue (size));
- }
- }
- m_viMaxAmpduSize = size;
-}
-
-void
-RegularWifiMac::SetBeMaxAmpduSize (uint32_t size)
-{
- NS_LOG_FUNCTION (this << size);
- Ptr device = DynamicCast (GetDevice ());
- if (device)
- {
- Ptr htConfiguration = device->GetHtConfiguration ();
- if (htConfiguration)
- {
- htConfiguration->SetAttribute ("BeMaxAmpduSize", UintegerValue (size));
- }
- }
- m_beMaxAmpduSize = size;
-}
-
-void
-RegularWifiMac::SetBkMaxAmpduSize (uint32_t size)
-{
- NS_LOG_FUNCTION (this << size);
- Ptr device = DynamicCast (GetDevice ());
- if (device)
- {
- Ptr htConfiguration = device->GetHtConfiguration ();
- if (htConfiguration)
- {
- htConfiguration->SetAttribute ("BkMaxAmpduSize", UintegerValue (size));
- }
- }
- m_bkMaxAmpduSize = size;
-}
-
void
RegularWifiMac::SetVoBlockAckThreshold (uint8_t threshold)
{
@@ -1182,52 +1067,60 @@ RegularWifiMac::GetTypeId (void)
MakeBooleanAccessor (&RegularWifiMac::SetCtsToSelfSupported),
MakeBooleanChecker ())
.AddAttribute ("VO_MaxAmsduSize",
- "Maximum length in bytes of an A-MSDU for AC_VO access class. "
- "Value 0 means A-MSDU is disabled for that AC.",
+ "Maximum length in bytes of an A-MSDU for AC_VO access class "
+ "(capped to 7935 for HT PPDUs and 11398 for VHT/HE PPDUs). "
+ "Value 0 means A-MSDU aggregation is disabled for that AC.",
UintegerValue (0),
- MakeUintegerAccessor (&RegularWifiMac::SetVoMaxAmsduSize),
- MakeUintegerChecker (0, 11426))
+ MakeUintegerAccessor (&RegularWifiMac::m_voMaxAmsduSize),
+ MakeUintegerChecker (0, 11398))
.AddAttribute ("VI_MaxAmsduSize",
- "Maximum length in bytes of an A-MSDU for AC_VI access class."
- "Value 0 means A-MSDU is disabled for that AC.",
+ "Maximum length in bytes of an A-MSDU for AC_VI access class "
+ "(capped to 7935 for HT PPDUs and 11398 for VHT/HE PPDUs). "
+ "Value 0 means A-MSDU aggregation is disabled for that AC.",
UintegerValue (0),
- MakeUintegerAccessor (&RegularWifiMac::SetViMaxAmsduSize),
- MakeUintegerChecker (0, 11426))
+ MakeUintegerAccessor (&RegularWifiMac::m_viMaxAmsduSize),
+ MakeUintegerChecker (0, 11398))
.AddAttribute ("BE_MaxAmsduSize",
- "Maximum length in bytes of an A-MSDU for AC_BE access class."
- "Value 0 means A-MSDU is disabled for that AC.",
+ "Maximum length in bytes of an A-MSDU for AC_BE access class "
+ "(capped to 7935 for HT PPDUs and 11398 for VHT/HE PPDUs). "
+ "Value 0 means A-MSDU aggregation is disabled for that AC.",
UintegerValue (0),
- MakeUintegerAccessor (&RegularWifiMac::SetBeMaxAmsduSize),
- MakeUintegerChecker (0, 11426))
+ MakeUintegerAccessor (&RegularWifiMac::m_beMaxAmsduSize),
+ MakeUintegerChecker (0, 11398))
.AddAttribute ("BK_MaxAmsduSize",
- "Maximum length in bytes of an A-MSDU for AC_BK access class."
- "Value 0 means A-MSDU is disabled for that AC.",
+ "Maximum length in bytes of an A-MSDU for AC_BK access class "
+ "(capped to 7935 for HT PPDUs and 11398 for VHT/HE PPDUs). "
+ "Value 0 means A-MSDU aggregation is disabled for that AC.",
UintegerValue (0),
- MakeUintegerAccessor (&RegularWifiMac::SetBkMaxAmsduSize),
- MakeUintegerChecker (0, 11426))
+ MakeUintegerAccessor (&RegularWifiMac::m_bkMaxAmsduSize),
+ MakeUintegerChecker (0, 11398))
.AddAttribute ("VO_MaxAmpduSize",
- "Maximum length in bytes of an A-MPDU for AC_VO access class."
- "Value 0 means A-MPDU is disabled for that AC.",
+ "Maximum length in bytes of an A-MPDU for AC_VO access class "
+ "(capped to 65535 for HT PPDUs, 1048575 for VHT PPDUs, and 8388607 for HE PPDUs). "
+ "Value 0 means A-MPDU aggregation is disabled for that AC.",
UintegerValue (0),
- MakeUintegerAccessor (&RegularWifiMac::SetVoMaxAmpduSize),
+ MakeUintegerAccessor (&RegularWifiMac::m_voMaxAmpduSize),
MakeUintegerChecker ())
.AddAttribute ("VI_MaxAmpduSize",
- "Maximum length in bytes of an A-MPDU for AC_VI access class."
- "Value 0 means A-MPDU is disabled for that AC.",
+ "Maximum length in bytes of an A-MPDU for AC_VI access class "
+ "(capped to 65535 for HT PPDUs, 1048575 for VHT PPDUs, and 8388607 for HE PPDUs). "
+ "Value 0 means A-MPDU aggregation is disabled for that AC.",
UintegerValue (65535),
- MakeUintegerAccessor (&RegularWifiMac::SetViMaxAmpduSize),
+ MakeUintegerAccessor (&RegularWifiMac::m_viMaxAmpduSize),
MakeUintegerChecker ())
.AddAttribute ("BE_MaxAmpduSize",
- "Maximum length in bytes of an A-MPDU for AC_BE access class."
- "Value 0 means A-MPDU is disabled for that AC.",
+ "Maximum length in bytes of an A-MPDU for AC_BE access class "
+ "(capped to 65535 for HT PPDUs, 1048575 for VHT PPDUs, and 8388607 for HE PPDUs). "
+ "Value 0 means A-MPDU aggregation is disabled for that AC.",
UintegerValue (65535),
- MakeUintegerAccessor (&RegularWifiMac::SetBeMaxAmpduSize),
+ MakeUintegerAccessor (&RegularWifiMac::m_beMaxAmpduSize),
MakeUintegerChecker ())
.AddAttribute ("BK_MaxAmpduSize",
- "Maximum length in bytes of an A-MPDU for AC_BK access class."
- "Value 0 means A-MPDU is disabled for that AC.",
+ "Maximum length in bytes of an A-MPDU for AC_BK access class "
+ "(capped to 65535 for HT PPDUs, 1048575 for VHT PPDUs, and 8388607 for HE PPDUs). "
+ "Value 0 means A-MPDU aggregation is disabled for that AC.",
UintegerValue (0),
- MakeUintegerAccessor (&RegularWifiMac::SetBkMaxAmpduSize),
+ MakeUintegerAccessor (&RegularWifiMac::m_bkMaxAmpduSize),
MakeUintegerChecker ())
.AddAttribute ("VO_BlockAckThreshold",
"If number of packets in VO queue reaches this value, "
@@ -1356,14 +1249,6 @@ RegularWifiMac::FinishConfigureStandard (WifiPhyStandard standard)
Ptr htConfiguration = GetHtConfiguration ();
NS_ASSERT (htConfiguration);
htConfiguration->SetRifsSupported (m_rifsSupported);
- htConfiguration->SetAttribute ("BeMaxAmpduSize", UintegerValue (m_beMaxAmpduSize));
- htConfiguration->SetAttribute ("BkMaxAmpduSize", UintegerValue (m_bkMaxAmpduSize));
- htConfiguration->SetAttribute ("ViMaxAmpduSize", UintegerValue (m_viMaxAmpduSize));
- htConfiguration->SetAttribute ("VoMaxAmpduSize", UintegerValue (m_voMaxAmpduSize));
- htConfiguration->SetAttribute ("BeMaxAmsduSize", UintegerValue (m_beMaxAmsduSize));
- htConfiguration->SetAttribute ("BkMaxAmsduSize", UintegerValue (m_bkMaxAmsduSize));
- htConfiguration->SetAttribute ("ViMaxAmsduSize", UintegerValue (m_viMaxAmsduSize));
- htConfiguration->SetAttribute ("VoMaxAmsduSize", UintegerValue (m_voMaxAmsduSize));
SetQosSupported (true);
cwmin = 15;
cwmax = 1023;
@@ -1377,14 +1262,6 @@ RegularWifiMac::FinishConfigureStandard (WifiPhyStandard standard)
Ptr htConfiguration = GetHtConfiguration ();
NS_ASSERT (htConfiguration);
htConfiguration->SetRifsSupported (m_rifsSupported);
- htConfiguration->SetAttribute ("BeMaxAmpduSize", UintegerValue (m_beMaxAmpduSize));
- htConfiguration->SetAttribute ("BkMaxAmpduSize", UintegerValue (m_bkMaxAmpduSize));
- htConfiguration->SetAttribute ("ViMaxAmpduSize", UintegerValue (m_viMaxAmpduSize));
- htConfiguration->SetAttribute ("VoMaxAmpduSize", UintegerValue (m_voMaxAmpduSize));
- htConfiguration->SetAttribute ("BeMaxAmsduSize", UintegerValue (m_beMaxAmsduSize));
- htConfiguration->SetAttribute ("BkMaxAmsduSize", UintegerValue (m_bkMaxAmsduSize));
- htConfiguration->SetAttribute ("ViMaxAmsduSize", UintegerValue (m_viMaxAmsduSize));
- htConfiguration->SetAttribute ("VoMaxAmsduSize", UintegerValue (m_voMaxAmsduSize));
SetQosSupported (true);
}
case WIFI_PHY_STANDARD_80211g:
diff --git a/src/wifi/model/regular-wifi-mac.h b/src/wifi/model/regular-wifi-mac.h
index d6551b66b..ffb223695 100644
--- a/src/wifi/model/regular-wifi-mac.h
+++ b/src/wifi/model/regular-wifi-mac.h
@@ -515,7 +515,6 @@ protected:
*/
bool GetHeSupported () const;
-
private:
/// type conversion operator
RegularWifiMac (const RegularWifiMac &);
@@ -535,56 +534,6 @@ private:
*/
void SetupEdcaQueue (AcIndex ac);
- /**
- * Set the maximum A-MSDU size for AC_VO.
- *
- * \param size the maximum A-MSDU size for AC_VO.
- */
- void SetVoMaxAmsduSize (uint16_t size);
- /**
- * Set the maximum A-MSDU size for AC_VI.
- *
- * \param size the maximum A-MSDU size for AC_VI.
- */
- void SetViMaxAmsduSize (uint16_t size);
- /**
- * Set the maximum A-MSDU size for AC_BE.
- *
- * \param size the maximum A-MSDU size for AC_BE.
- */
- void SetBeMaxAmsduSize (uint16_t size);
- /**
- * Set the maximum A-MSDU size for AC_BK.
- *
- * \param size the maximum A-MSDU size for AC_BK.
- */
- void SetBkMaxAmsduSize (uint16_t size);
-
- /**
- * Set the maximum A-MPDU size for AC_VO.
- *
- * \param size the maximum A-MPDU size for AC_VO.
- */
- void SetVoMaxAmpduSize (uint32_t size);
- /**
- * Set the maximum A-MPDU size for AC_VI.
- *
- * \param size the maximum A-MPDU size for AC_VI.
- */
- void SetViMaxAmpduSize (uint32_t size);
- /**
- * Set the maximum A-MPDU size for AC_BE.
- *
- * \param size the maximum A-MPDU size for AC_BE.
- */
- void SetBeMaxAmpduSize (uint32_t size);
- /**
- * Set the maximum A-MPDU size for AC_BK.
- *
- * \param size the maximum A-MPDU size for AC_BK.
- */
- void SetBkMaxAmpduSize (uint32_t size);
-
/**
* Set the Block ACK threshold for AC_VO.
*
diff --git a/src/wifi/model/vht-capabilities.cc b/src/wifi/model/vht-capabilities.cc
index 842722701..36159580f 100644
--- a/src/wifi/model/vht-capabilities.cc
+++ b/src/wifi/model/vht-capabilities.cc
@@ -208,9 +208,22 @@ VhtCapabilities::GetSupportedMcsAndNssSet () const
}
void
-VhtCapabilities::SetMaxMpduLength (uint8_t length)
+VhtCapabilities::SetMaxMpduLength (uint16_t length)
{
- m_maxMpduLength = length;
+ NS_ABORT_MSG_IF (length != 3895 && length != 7991 && length == 11454,
+ "Invalid MPDU Max Length value");
+ if (length == 11454)
+ {
+ m_maxMpduLength = 2;
+ }
+ else if (length == 7991)
+ {
+ m_maxMpduLength = 1;
+ }
+ else
+ {
+ m_maxMpduLength = 0;
+ }
}
void
@@ -250,9 +263,17 @@ VhtCapabilities::SetTxStbc (uint8_t txstbc)
}
void
-VhtCapabilities::SetMaxAmpduLengthExponent (uint8_t exponent)
+VhtCapabilities::SetMaxAmpduLength (uint32_t maxampdulength)
{
- m_maxAmpduLengthExponent = exponent;
+ for (uint8_t i = 0; i <= 7; i++)
+ {
+ if ((1ul << (13 + i)) - 1 == maxampdulength)
+ {
+ m_maxAmpduLengthExponent = i;
+ return;
+ }
+ }
+ NS_ABORT_MSG ("Invalid A-MPDU Max Length value");
}
void
@@ -321,6 +342,24 @@ VhtCapabilities::SetTxHighestSupportedLgiDataRate (uint16_t supporteddatarate)
m_txHighestSupportedLongGuardIntervalDataRate = supporteddatarate;
}
+uint16_t
+VhtCapabilities::GetMaxMpduLength (void) const
+{
+ if (m_maxMpduLength == 0)
+ {
+ return 3895;
+ }
+ if (m_maxMpduLength == 1)
+ {
+ return 7991;
+ }
+ if (m_maxMpduLength == 2)
+ {
+ return 11454;
+ }
+ NS_ABORT_MSG ("The value 3 is reserved");
+}
+
uint8_t
VhtCapabilities::GetSupportedChannelWidthSet () const
{
@@ -345,6 +384,12 @@ VhtCapabilities::GetTxStbc () const
return m_txStbc;
}
+uint32_t
+VhtCapabilities::GetMaxAmpduLength (void) const
+{
+ return (1ul << (13 + m_maxAmpduLengthExponent)) - 1;
+}
+
bool
VhtCapabilities::IsSupportedMcs (uint8_t mcs, uint8_t nss) const
{
diff --git a/src/wifi/model/vht-capabilities.h b/src/wifi/model/vht-capabilities.h
index 718f08a91..fc19a9b5d 100644
--- a/src/wifi/model/vht-capabilities.h
+++ b/src/wifi/model/vht-capabilities.h
@@ -99,9 +99,9 @@ public:
/**
* Set the maximum MPDU length.
*
- * \param length the maximum MPDU length
+ * \param length the maximum MPDU length (3895, 7991 or 11454)
*/
- void SetMaxMpduLength (uint8_t length);
+ void SetMaxMpduLength (uint16_t length);
/**
* Set the supported channel width set.
*
@@ -139,12 +139,18 @@ public:
*/
void SetTxStbc (uint8_t txstbc);
/**
- * Set the maximum AMPDU length exponent.
+ * Set the maximum AMPDU length.
*
- * \param exponent the maximum AMPDU length exponent
+ * \param maxampdulength 2^(13 + x) - 1, x in the range 0 to 7
*/
- void SetMaxAmpduLengthExponent (uint8_t exponent);
+ void SetMaxAmpduLength (uint32_t maxampdulength);
+ /**
+ * Get the maximum MPDU length.
+ *
+ * \return the maximum MPDU length
+ */
+ uint16_t GetMaxMpduLength (void) const;
/**
* Get the supported channel width set.
*
@@ -223,6 +229,13 @@ public:
*/
bool IsSupportedRxMcs (uint8_t mcs) const;
+ /**
+ * Return the maximum A-MPDU length.
+ *
+ * \return the maximum A-MPDU length
+ */
+ uint32_t GetMaxAmpduLength (void) const;
+
/**
* This information element is a bit special in that it is only
* included if the STA is an VHT STA. To support this we
diff --git a/src/wifi/model/vht-configuration.cc b/src/wifi/model/vht-configuration.cc
index 1c393ccf8..73c2b6330 100644
--- a/src/wifi/model/vht-configuration.cc
+++ b/src/wifi/model/vht-configuration.cc
@@ -45,54 +45,6 @@ VhtConfiguration::GetTypeId (void)
.SetParent