--- a/CHANGES.html Mon Oct 29 16:00:09 2018 +0300
+++ b/CHANGES.html Tue Oct 30 13:42:31 2018 +0100
@@ -54,6 +54,8 @@
<h1>Changes from ns-3.29 to ns-3.30</h1>
<h2>New API:</h2>
<ul>
+<li>The attributes <b>RegularWifiMac::HtSupported</b>, <b>RegularWifiMac::VhtSupported</b>, <b>RegularWifiMac::HeSupported</b>, <b>RegularWifiMac::RifsSupported</b>, <b>WifiPhy::ShortGuardEnabled</b>, <b>WifiPhy::GuardInterval</b> and <b>WifiPhy::GreenfieldEnabled</b> have been deprecated. Intead, it is advised to use <b>WifiNetDevice::HtConfiguration</b>, <b>WifiNetDevice::VhtConfiguration</b> and <b>WifiNetDevice::HeConfiguration</b>.
+</li>
</ul>
<h2>Changes to existing API:</h2>
<ul>
--- a/examples/wireless/80211n-mimo.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/examples/wireless/80211n-mimo.cc Tue Oct 30 13:42:31 2018 +0100
@@ -137,8 +137,6 @@
YansWifiPhyHelper phy = YansWifiPhyHelper::Default ();
phy.SetChannel (channel.Create ());
- // Set guard interval
- phy.Set ("ShortGuardEnabled", BooleanValue (shortGuardInterval));
// Set MIMO capabilities
phy.Set ("Antennas", UintegerValue (nStreams));
phy.Set ("MaxSupportedTxSpatialStreams", UintegerValue (nStreams));
@@ -184,6 +182,9 @@
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (40));
}
+ // Set guard interval
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (shortGuardInterval));
+
// mobility.
MobilityHelper mobility;
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
--- a/examples/wireless/he-wifi-network.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/examples/wireless/he-wifi-network.cc Tue Oct 30 13:42:31 2018 +0100
@@ -127,9 +127,6 @@
YansWifiPhyHelper phy = YansWifiPhyHelper::Default ();
phy.SetChannel (channel.Create ());
- // Set guard interval
- phy.Set ("GuardInterval", TimeValue (NanoSeconds (gi)));
-
WifiMacHelper mac;
WifiHelper wifi;
if (frequency == 5.0)
@@ -167,8 +164,9 @@
NetDeviceContainer apDevice;
apDevice = wifi.Install (phy, mac, wifiApNode);
- // Set channel width
+ // Set channel width and guard interval
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (channelWidth));
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HeConfiguration/GuardInterval", TimeValue (NanoSeconds (gi)));
// mobility.
MobilityHelper mobility;
--- a/examples/wireless/ht-wifi-network.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/examples/wireless/ht-wifi-network.cc Tue Oct 30 13:42:31 2018 +0100
@@ -127,9 +127,6 @@
YansWifiPhyHelper phy = YansWifiPhyHelper::Default ();
phy.SetChannel (channel.Create ());
- // Set guard interval
- phy.Set ("ShortGuardEnabled", BooleanValue (sgi));
-
WifiMacHelper mac;
WifiHelper wifi;
if (frequency == 5.0)
@@ -169,6 +166,9 @@
// Set channel width
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (channelWidth));
+
+ // Set guard interval
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (sgi));
// mobility.
MobilityHelper mobility;
--- a/examples/wireless/mixed-network.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/examples/wireless/mixed-network.cc Tue Oct 30 13:42:31 2018 +0100
@@ -36,6 +36,7 @@
#include "ns3/wifi-mac.h"
#include "ns3/packet-sink-helper.h"
#include "ns3/packet-sink.h"
+#include "ns3/ht-configuration.h"
// This example shows how to configure mixed networks (i.e. mixed b/g and HT/non-HT) and how are performance in several scenarios.
//
@@ -191,14 +192,11 @@
wifi.SetStandard (WIFI_PHY_STANDARD_80211n_2_4GHZ);
NetDeviceContainer nNGFStaDevice, nGFStaDevice;
mac.SetType ("ns3::StaWifiMac",
- "RifsSupported", BooleanValue (params.rifsSupported),
"Ssid", SsidValue (ssid),
"BE_MaxAmpduSize", UintegerValue (0),
"BE_BlockAckThreshold", UintegerValue (2),
"ShortSlotTimeSupported", BooleanValue (params.enableShortSlotTime));
- phy.Set ("GreenfieldEnabled", BooleanValue (false));
nNGFStaDevice = wifi.Install (phy, mac, wifiNNGFStaNodes);
- phy.Set ("GreenfieldEnabled", BooleanValue (true));
nGFStaDevice = wifi.Install (phy, mac, wifiNGFStaNodes);
// AP
@@ -209,11 +207,9 @@
"EnableBeaconJitter", BooleanValue (false),
"BE_MaxAmpduSize", UintegerValue (0),
"BE_BlockAckThreshold", UintegerValue (2),
- "RifsSupported", BooleanValue (params.rifsSupported),
"RifsMode", BooleanValue (params.rifsMode),
"EnableNonErpProtection", BooleanValue (params.enableErpProtection),
"ShortSlotTimeSupported", BooleanValue (params.enableShortSlotTime));
- phy.Set ("GreenfieldEnabled", BooleanValue (params.apSupportsGreenfield));
apDevice = wifi.Install (phy, mac, wifiApNode);
// Set TXOP limit
@@ -221,6 +217,9 @@
{
Ptr<NetDevice> dev = wifiApNode.Get (0)->GetDevice (0);
Ptr<WifiNetDevice> wifi_dev = DynamicCast<WifiNetDevice> (dev);
+ Ptr<HtConfiguration> htConfiguration = wifi_dev->GetHtConfiguration ();
+ htConfiguration->SetGreenfieldSupported (params.apSupportsGreenfield);
+ htConfiguration->SetRifsSupported (params.rifsSupported);
Ptr<WifiMac> wifi_mac = wifi_dev->GetMac ();
PointerValue ptr;
wifi_mac->GetAttribute ("BE_Txop", ptr);
@@ -231,6 +230,8 @@
{
Ptr<NetDevice> dev = wifiNNGFStaNodes.Get (0)->GetDevice (0);
Ptr<WifiNetDevice> wifi_dev = DynamicCast<WifiNetDevice> (dev);
+ Ptr<HtConfiguration> htConfiguration = wifi_dev->GetHtConfiguration ();
+ htConfiguration->SetRifsSupported (params.rifsSupported);
Ptr<WifiMac> wifi_mac = wifi_dev->GetMac ();
PointerValue ptr;
wifi_mac->GetAttribute ("BE_Txop", ptr);
@@ -241,6 +242,9 @@
{
Ptr<NetDevice> dev = wifiNGFStaNodes.Get (0)->GetDevice (0);
Ptr<WifiNetDevice> wifi_dev = DynamicCast<WifiNetDevice> (dev);
+ Ptr<HtConfiguration> htConfiguration = wifi_dev->GetHtConfiguration ();
+ htConfiguration->SetGreenfieldSupported (true);
+ htConfiguration->SetRifsSupported (params.rifsSupported);
Ptr<WifiMac> wifi_mac = wifi_dev->GetMac ();
PointerValue ptr;
wifi_mac->GetAttribute ("BE_Txop", ptr);
--- a/examples/wireless/rate-adaptation-distance.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/examples/wireless/rate-adaptation-distance.cc Tue Oct 30 13:42:31 2018 +0100
@@ -196,8 +196,6 @@
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
wifiPhy.SetChannel (wifiChannel.Create ());
- wifiPhy.Set ("ShortGuardEnabled", BooleanValue (shortGuardInterval));
-
NetDeviceContainer wifiApDevices;
NetDeviceContainer wifiStaDevices;
NetDeviceContainer wifiDevices;
@@ -296,6 +294,9 @@
// Set channel width
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (chWidth));
+ // Set guard interval
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (shortGuardInterval));
+
// Configure the mobility.
MobilityHelper mobility;
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
--- a/examples/wireless/vht-wifi-network.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/examples/wireless/vht-wifi-network.cc Tue Oct 30 13:42:31 2018 +0100
@@ -129,9 +129,6 @@
YansWifiPhyHelper phy = YansWifiPhyHelper::Default ();
phy.SetChannel (channel.Create ());
- // Set guard interval
- phy.Set ("ShortGuardEnabled", BooleanValue (sgi));
-
WifiHelper wifi;
wifi.SetStandard (WIFI_PHY_STANDARD_80211ac);
WifiMacHelper mac;
@@ -159,6 +156,9 @@
// Set channel width
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (channelWidth));
+ // Set guard interval
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (sgi));
+
// mobility.
MobilityHelper mobility;
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
--- a/examples/wireless/wifi-multi-tos.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/examples/wireless/wifi-multi-tos.cc Tue Oct 30 13:42:31 2018 +0100
@@ -74,9 +74,6 @@
YansWifiPhyHelper phy = YansWifiPhyHelper::Default ();
phy.SetChannel (channel.Create ());
- // Set guard interval
- phy.Set ("ShortGuardEnabled", BooleanValue (useShortGuardInterval));
-
WifiMacHelper mac;
WifiHelper wifi;
wifi.SetStandard (WIFI_PHY_STANDARD_80211n_5GHZ);
@@ -105,6 +102,9 @@
// Set channel width
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (channelWidth));
+ // Set guard interval
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (useShortGuardInterval));
+
// mobility
MobilityHelper mobility;
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
--- a/examples/wireless/wifi-spectrum-per-example.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/examples/wireless/wifi-spectrum-per-example.cc Tue Oct 30 13:42:31 2018 +0100
@@ -180,27 +180,6 @@
phy.Set ("TxPowerStart", DoubleValue (1)); // dBm (1.26 mW)
phy.Set ("TxPowerEnd", DoubleValue (1));
phy.Set ("Frequency", UintegerValue (5180));
-
- if (i <= 7)
- {
- phy.Set ("ShortGuardEnabled", BooleanValue (false));
- phy.Set ("ChannelWidth", UintegerValue (20));
- }
- else if (i > 7 && i <= 15)
- {
- phy.Set ("ShortGuardEnabled", BooleanValue (true));
- phy.Set ("ChannelWidth", UintegerValue (20));
- }
- else if (i > 15 && i <= 23)
- {
- phy.Set ("ShortGuardEnabled", BooleanValue (false));
- phy.Set ("ChannelWidth", UintegerValue (40));
- }
- else
- {
- phy.Set ("ShortGuardEnabled", BooleanValue (true));
- phy.Set ("ChannelWidth", UintegerValue (40));
- }
}
else if (wifiType == "ns3::SpectrumWifiPhy")
{
@@ -223,27 +202,6 @@
spectrumPhy.Set ("Frequency", UintegerValue (5180));
spectrumPhy.Set ("TxPowerStart", DoubleValue (1)); // dBm (1.26 mW)
spectrumPhy.Set ("TxPowerEnd", DoubleValue (1));
-
- if (i <= 7)
- {
- spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (false));
- spectrumPhy.Set ("ChannelWidth", UintegerValue (20));
- }
- else if (i > 7 && i <= 15)
- {
- spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (true));
- spectrumPhy.Set ("ChannelWidth", UintegerValue (20));
- }
- else if (i > 15 && i <= 23)
- {
- spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (false));
- spectrumPhy.Set ("ChannelWidth", UintegerValue (40));
- }
- else
- {
- spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (true));
- spectrumPhy.Set ("ChannelWidth", UintegerValue (40));
- }
}
else
{
@@ -446,6 +404,27 @@
apDevice = wifi.Install (spectrumPhy, mac, wifiApNode);
}
+ if (i <= 7)
+ {
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (20));
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (false));
+ }
+ else if (i > 7 && i <= 15)
+ {
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (20));
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (true));
+ }
+ else if (i > 15 && i <= 23)
+ {
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (40));
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (false));
+ }
+ else
+ {
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (40));
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (true));
+ }
+
// mobility.
MobilityHelper mobility;
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
--- a/examples/wireless/wifi-spectrum-per-interference.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/examples/wireless/wifi-spectrum-per-interference.cc Tue Oct 30 13:42:31 2018 +0100
@@ -209,27 +209,6 @@
channel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
phy.SetChannel (channel.Create ());
phy.Set ("Frequency", UintegerValue (5180));
-
- if (i <= 7)
- {
- phy.Set ("ShortGuardEnabled", BooleanValue (false));
- phy.Set ("ChannelWidth", UintegerValue (20));
- }
- else if (i > 7 && i <= 15)
- {
- phy.Set ("ShortGuardEnabled", BooleanValue (true));
- phy.Set ("ChannelWidth", UintegerValue (20));
- }
- else if (i > 15 && i <= 23)
- {
- phy.Set ("ShortGuardEnabled", BooleanValue (false));
- phy.Set ("ChannelWidth", UintegerValue (40));
- }
- else
- {
- phy.Set ("ShortGuardEnabled", BooleanValue (true));
- phy.Set ("ChannelWidth", UintegerValue (40));
- }
}
else if (wifiType == "ns3::SpectrumWifiPhy")
{
@@ -250,27 +229,6 @@
spectrumPhy.SetChannel (spectrumChannel);
spectrumPhy.SetErrorRateModel (errorModelType);
spectrumPhy.Set ("Frequency", UintegerValue (5180)); // channel 36 at 20 MHz
-
- if (i <= 7)
- {
- spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (false));
- spectrumPhy.Set ("ChannelWidth", UintegerValue (20));
- }
- else if (i > 7 && i <= 15)
- {
- spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (true));
- spectrumPhy.Set ("ChannelWidth", UintegerValue (20));
- }
- else if (i > 15 && i <= 23)
- {
- spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (false));
- spectrumPhy.Set ("ChannelWidth", UintegerValue (40));
- }
- else
- {
- spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (true));
- spectrumPhy.Set ("ChannelWidth", UintegerValue (40));
- }
}
else
{
@@ -472,6 +430,27 @@
apDevice = wifi.Install (spectrumPhy, mac, wifiApNode);
}
+ if (i <= 7)
+ {
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (20));
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (false));
+ }
+ else if (i > 7 && i <= 15)
+ {
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (20));
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (true));
+ }
+ else if (i > 15 && i <= 23)
+ {
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (40));
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (false));
+ }
+ else
+ {
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (40));
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (true));
+ }
+
// mobility.
MobilityHelper mobility;
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
--- a/examples/wireless/wifi-spectrum-saturation-example.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/examples/wireless/wifi-spectrum-saturation-example.cc Tue Oct 30 13:42:31 2018 +0100
@@ -151,57 +151,29 @@
phy.Set ("TxPowerStart", DoubleValue (1));
phy.Set ("TxPowerEnd", DoubleValue (1));
- if (i <= 7)
- {
- phy.Set ("ShortGuardEnabled", BooleanValue (false));
- channelWidth = 20;
- }
- else if (i > 7 && i <= 15)
- {
- phy.Set ("ShortGuardEnabled", BooleanValue (true));
- channelWidth = 20;
- }
- else if (i > 15 && i <= 23)
+ if (i > 31 && i <= 39)
{
- phy.Set ("ShortGuardEnabled", BooleanValue (false));
- channelWidth = 40;
+ phy.Set ("Antennas", UintegerValue (2));
+ phy.Set ("MaxSupportedTxSpatialStreams", UintegerValue (2));
+ phy.Set ("MaxSupportedRxSpatialStreams", UintegerValue (2));
}
- else if (i > 23 && i <= 31)
+ else if (i > 39 && i <= 47)
{
- phy.Set ("ShortGuardEnabled", BooleanValue (true));
- channelWidth = 40;
- }
- else if (i > 31 && i <= 39)
- {
- phy.Set ("ShortGuardEnabled", BooleanValue (false));
phy.Set ("Antennas", UintegerValue (2));
phy.Set ("MaxSupportedTxSpatialStreams", UintegerValue (2));
phy.Set ("MaxSupportedRxSpatialStreams", UintegerValue (2));
- channelWidth = 20;
- }
- else if (i > 39 && i <= 47)
- {
- phy.Set ("ShortGuardEnabled", BooleanValue (true));
- phy.Set ("Antennas", UintegerValue (2));
- phy.Set ("MaxSupportedTxSpatialStreams", UintegerValue (2));
- phy.Set ("MaxSupportedRxSpatialStreams", UintegerValue (2));
- channelWidth = 20;
}
else if (i > 47 && i <= 55)
{
- phy.Set ("ShortGuardEnabled", BooleanValue (false));
phy.Set ("Antennas", UintegerValue (2));
phy.Set ("MaxSupportedTxSpatialStreams", UintegerValue (2));
phy.Set ("MaxSupportedRxSpatialStreams", UintegerValue (2));
- channelWidth = 40;
}
else if (i > 55 && i <= 63)
{
- phy.Set ("ShortGuardEnabled", BooleanValue (true));
phy.Set ("Antennas", UintegerValue (2));
phy.Set ("MaxSupportedTxSpatialStreams", UintegerValue (2));
phy.Set ("MaxSupportedRxSpatialStreams", UintegerValue (2));
- channelWidth = 40;
}
}
else if (wifiType == "ns3::SpectrumWifiPhy")
@@ -225,57 +197,29 @@
spectrumPhy.Set ("TxPowerStart", DoubleValue (1));
spectrumPhy.Set ("TxPowerEnd", DoubleValue (1));
- if (i <= 7)
- {
- spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (false));
- channelWidth = 20;
- }
- else if (i > 7 && i <= 15)
- {
- spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (true));
- channelWidth = 20;
- }
- else if (i > 15 && i <= 23)
+ if (i > 31 && i <= 39)
{
- spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (false));
- channelWidth = 40;
+ spectrumPhy.Set ("Antennas", UintegerValue (2));
+ spectrumPhy.Set ("MaxSupportedTxSpatialStreams", UintegerValue (2));
+ spectrumPhy.Set ("MaxSupportedRxSpatialStreams", UintegerValue (2));
}
- else if (i > 23 && i <= 31)
+ else if (i > 39 && i <= 47)
{
- spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (true));
- channelWidth = 40;
- }
- else if (i > 31 && i <= 39)
- {
- spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (false));
spectrumPhy.Set ("Antennas", UintegerValue (2));
spectrumPhy.Set ("MaxSupportedTxSpatialStreams", UintegerValue (2));
spectrumPhy.Set ("MaxSupportedRxSpatialStreams", UintegerValue (2));
- channelWidth = 20;
- }
- else if (i > 39 && i <= 47)
- {
- spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (true));
- spectrumPhy.Set ("Antennas", UintegerValue (2));
- spectrumPhy.Set ("MaxSupportedTxSpatialStreams", UintegerValue (2));
- spectrumPhy.Set ("MaxSupportedRxSpatialStreams", UintegerValue (2));
- channelWidth = 20;
}
else if (i > 47 && i <= 55)
{
- spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (false));
spectrumPhy.Set ("Antennas", UintegerValue (2));
spectrumPhy.Set ("MaxSupportedTxSpatialStreams", UintegerValue (2));
spectrumPhy.Set ("MaxSupportedRxSpatialStreams", UintegerValue (2));
- channelWidth = 40;
}
else if (i > 55 && i <= 63)
{
- spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (true));
spectrumPhy.Set ("Antennas", UintegerValue (2));
spectrumPhy.Set ("MaxSupportedTxSpatialStreams", UintegerValue (2));
spectrumPhy.Set ("MaxSupportedRxSpatialStreams", UintegerValue (2));
- channelWidth = 40;
}
}
else
@@ -642,9 +586,26 @@
apDevice = wifi.Install (spectrumPhy, mac, wifiApNode);
}
- // Channel width must be set *after* installation because the attribute
- // is overwritten by the ConfigureStandard method ()
- Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (channelWidth));
+ if ((i <= 7) || (i > 31 && i <= 39))
+ {
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (20));
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (false));
+ }
+ else if ((i > 7 && i <= 15) || (i > 39 && i <= 47))
+ {
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (20));
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (true));
+ }
+ else if ((i > 15 && i <= 23) || (i > 47 && i <= 55))
+ {
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (40));
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (false));
+ }
+ else
+ {
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (40));
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (true));
+ }
// mobility.
MobilityHelper mobility;
--- a/src/wave/helper/wave-helper.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wave/helper/wave-helper.cc Tue Oct 30 13:42:31 2018 +0100
@@ -392,7 +392,7 @@
for (std::vector<uint32_t>::const_iterator k = m_macsForChannelNumber.begin ();
k != m_macsForChannelNumber.end (); ++k)
{
- Ptr<WifiMac> wifiMac = macHelper.Create ();
+ Ptr<WifiMac> wifiMac = macHelper.Create (device);
Ptr<OcbWifiMac> ocbMac = DynamicCast<OcbWifiMac> (wifiMac);
// we use WaveMacLow to replace original MacLow
ocbMac->EnableForWave (device);
--- a/src/wave/model/wave-net-device.h Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wave/model/wave-net-device.h Tue Oct 30 13:42:31 2018 +0100
@@ -25,7 +25,7 @@
#include "ns3/packet.h"
#include "ns3/traced-callback.h"
#include "ns3/mac48-address.h"
-#include "ns3/net-device.h"
+#include "ns3/wifi-net-device.h"
#include "ocb-wifi-mac.h"
#include "vendor-specific-action.h"
#include "channel-coordinator.h"
@@ -157,7 +157,7 @@
* UtcTime GetUtcTime ();
* void SetUtcTime ();
*/
-class WaveNetDevice : public NetDevice
+class WaveNetDevice : public WifiNetDevice
{
public:
/**
--- a/src/wifi/doc/source/wifi-user.rst Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/doc/source/wifi-user.rst Tue Oct 30 13:42:31 2018 +0100
@@ -151,14 +151,6 @@
prepared the YansWifiPhyHelper by telling it which channel it is connected to.
The Phy objects are created in the next step.
-802.11n/ac PHY layer can use either either long (800 ns) or short (400 ns) OFDM guard intervals. To configure this parameter, the following line of code could be used (in this example, it enables the support of a short guard interval)::
-
- wifiPhyHelper.Set ("ShortGuardEnabled", BooleanValue(true));
-
-802.11ax PHY layer can use either either 3200 ns, 1600 ns or 800 ns OFDM guard intervals. To configure this parameter, the following line of code could be used (in this example, it enables the support of 1600 ns guard interval)::
-
- wifiPhyHelper.Set ("GuardInterval", TimeValue(NanoSeconds (1600)));
-
In order to enable 802.11n/ac/ax MIMO, the number of antennas as well as the number of supported spatial streams need to be configured.
For example, this code enables MIMO with 2 antennas and 2 spatial streams::
@@ -173,18 +165,14 @@
wifiPhyHelper.Set ("MaxSupportedTxSpatialStreams", UintegerValue (2));
wifiPhyHelper.Set ("MaxSupportedRxSpatialStreams", UintegerValue (1));
-Furthermore, 802.11n provides an optional mode (GreenField mode) to reduce preamble durations and which is only compatible with 802.11n devices. This mode is enabled as follows::
-
- wifiPhyHelper.Set ("GreenfieldEnabled",BooleanValue(true));
-
802.11n PHY layer can support both 20 (default) or 40 MHz channel width, and 802.11ac/ax PHY layer can use either 20, 40, 80 (default) or 160 MHz channel width. See below for further documentation on setting the frequency, channel width, and channel number.
::
WifiHelper wifi;
wifi.SetStandard (WIFI_PHY_STANDARD_80211ac);
- wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
- "DataMode", StringValue ("VhtMcs9"),
+ wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
+ "DataMode", StringValue ("VhtMcs9"),
"ControlMode", StringValue ("VhtMcs0"));
//Install PHY and MAC
@@ -254,7 +242,8 @@
``WifiHelper::SetStandard ()`` is a method to set various parameters
in the Mac and Phy to standard values and some reasonable defaults.
For example, ``SetStandard (WIFI_PHY_STANDARD_80211a)`` will set the
-WifiPhy to Channel 36 in the 5 GHz band, among other settings.
+WifiPhy to Channel 36 in the 5 GHz band, among other settings appropriate
+for 802.11a.
The following values for WifiPhyStandard are defined in
``src/wifi/model/wifi-phy-standard.h``:
@@ -751,6 +740,56 @@
deviate from the default behavior; the example scripts show how to do some of
this reconfiguration.
+HT configuration
+================
+
+HT is an acronym for High Throughput, a term synonymous with the IEEE 802.11n
+standard. Once the ``ns3::WifiHelper::Install`` has been called and the
+user sets the standard to a variant that supports HT capabilities (802.11n,
+802.11ac, or 802.11ax), an HT configuration object will automatically be
+created for the device. The configuration object is used to store and
+manage HT-specific attributes.
+
+802.11n/ac PHY layer can use either either long (800 ns) or short (400 ns) OFDM guard intervals. To configure this parameter for a given device, the following lines of code could be used (in this example, it enables the support of a short guard interval for the first station)::
+
+ Ptr<NetDevice> nd = wifiStaDevices.Get (0);
+ Ptr<WifiNetDevice> wnd = nd->GetObject<WifiNetDevice> ();
+ Ptr<HtConfiguration> htConfiguration = wnd->GetHtConfiguration ();
+ htConfiguration->SetShortGuardIntervalSupported (true);
+
+It is also possible to configure HT-specific attributes using ``Config::Set``.
+The following line of code enables the support of a short guard interval for all stations:
+
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (true));
+
+Furthermore, 802.11n provides an optional mode (Greenfield mode) to reduce preamble durations and which is only compatible with 802.11n devices. This mode is enabled as follows::
+
+ htConfiguration->SetGreenfieldSupported (true);
+
+VHT configuration
+=================
+
+IEEE 802.11ac devices are also known as supporting Very High Throughput (VHT). Once the ``ns3::WifiHelper::Install`` has been called and either the 802.11ac
+or 802.11ax 5 GHz standards are configured, a VHT configuration object will be
+automatically created to manage VHT-specific attributes.
+
+As of ns-3.29, however, there are no VHT-specific configuration items to
+manage; therefore, this object is a placeholder for future growth.
+
+HE configuration
+================
+
+IEEE 802.11ax is also known as High Efficiency (HE). Once the ``ns3::WifiHelper::Install`` has been called and IEEE 802.11ax configured as the standard, an
+HE configuration object will automatically be created to manage HE-specific
+attributes for 802.11ax devices.
+
+802.11ax PHY layer can use either either 3200 ns, 1600 ns or 800 ns OFDM guard intervals. To configure this parameter, the following line of code could be used (in this example, it enables the support of 1600 ns guard interval), such as in this example code snippet::
+
+ Ptr<NetDevice> nd = wifiStaDevices.Get (0);
+ Ptr<WifiNetDevice> wnd = nd->GetObject<WifiNetDevice> ();
+ Ptr<HeConfiguration> heConfiguration = wnd->GetHeConfiguration ();
+ heConfiguration->SetGuardInterval (NanoSeconds (1600));
+
Mobility configuration
======================
--- a/src/wifi/examples/wifi-manager-example.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/examples/wifi-manager-example.cc Tue Oct 30 13:42:31 2018 +0100
@@ -54,6 +54,8 @@
#include "ns3/packet-socket-helper.h"
#include "ns3/packet-socket-client.h"
#include "ns3/packet-socket-server.h"
+#include "ns3/ht-configuration.h"
+#include "ns3/he-configuration.h"
using namespace ns3;
@@ -420,17 +422,19 @@
|| serverSelectedStandard.m_name == "802.11ac")
{
wifiPhyPtrServer->SetChannelWidth (serverSelectedStandard.m_width);
- wifiPhyPtrServer->SetShortGuardInterval (serverShortGuardInterval == 400);
wifiPhyPtrClient->SetChannelWidth (clientSelectedStandard.m_width);
- wifiPhyPtrClient->SetShortGuardInterval (clientShortGuardInterval == 400);
+ Ptr<HtConfiguration> clientHtConfiguration = wndClient->GetHtConfiguration ();
+ clientHtConfiguration->SetShortGuardIntervalSupported (clientShortGuardInterval == 400);
+ Ptr<HtConfiguration> serverHtConfiguration = wndServer->GetHtConfiguration ();
+ serverHtConfiguration->SetShortGuardIntervalSupported (serverShortGuardInterval == 400);
}
else if (serverSelectedStandard.m_name == "802.11ax-5GHz"
|| serverSelectedStandard.m_name == "802.11ax-2.4GHz")
{
wifiPhyPtrServer->SetChannelWidth (serverSelectedStandard.m_width);
- wifiPhyPtrServer->SetGuardInterval (NanoSeconds (serverShortGuardInterval));
wifiPhyPtrClient->SetChannelWidth (clientSelectedStandard.m_width);
- wifiPhyPtrClient->SetGuardInterval (NanoSeconds (clientShortGuardInterval));
+ wndServer->GetHeConfiguration ()->SetGuardInterval (NanoSeconds (clientShortGuardInterval));
+ wndClient->GetHeConfiguration ()->SetGuardInterval (NanoSeconds (clientShortGuardInterval));
}
NS_LOG_DEBUG ("Channel width " << wifiPhyPtrClient->GetChannelWidth () << " noiseDbm " << noiseDbm);
NS_LOG_DEBUG ("NSS " << wifiPhyPtrClient->GetMaxSupportedTxSpatialStreams ());
--- a/src/wifi/helper/wifi-helper.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/helper/wifi-helper.cc Tue Oct 30 13:42:31 2018 +0100
@@ -34,6 +34,9 @@
#include "ns3/net-device-queue-interface.h"
#include "ns3/wifi-mac-queue.h"
#include "ns3/qos-utils.h"
+#include "ns3/ht-configuration.h"
+#include "ns3/vht-configuration.h"
+#include "ns3/he-configuration.h"
#include "wifi-helper.h"
namespace ns3 {
@@ -646,8 +649,23 @@
{
Ptr<Node> node = *i;
Ptr<WifiNetDevice> device = CreateObject<WifiNetDevice> ();
+ if (m_standard >= WIFI_PHY_STANDARD_80211n_2_4GHZ)
+ {
+ Ptr<HtConfiguration> htConfiguration = CreateObject<HtConfiguration> ();
+ device->SetHtConfiguration (htConfiguration);
+ }
+ if ((m_standard == WIFI_PHY_STANDARD_80211ac) || (m_standard == WIFI_PHY_STANDARD_80211ax_5GHZ))
+ {
+ Ptr<VhtConfiguration> vhtConfiguration = CreateObject<VhtConfiguration> ();
+ device->SetVhtConfiguration (vhtConfiguration);
+ }
+ if (m_standard >= WIFI_PHY_STANDARD_80211ax_2_4GHZ)
+ {
+ Ptr<HeConfiguration> heConfiguration = CreateObject<HeConfiguration> ();
+ device->SetHeConfiguration (heConfiguration);
+ }
Ptr<WifiRemoteStationManager> manager = m_stationManager.Create<WifiRemoteStationManager> ();
- Ptr<WifiMac> mac = macHelper.Create ();
+ Ptr<WifiMac> mac = macHelper.Create (device);
Ptr<WifiPhy> phy = phyHelper.Create (node, device);
mac->SetAddress (Mac48Address::Allocate ());
mac->ConfigureStandard (m_standard);
--- a/src/wifi/helper/wifi-mac-helper.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/helper/wifi-mac-helper.cc Tue Oct 30 13:42:31 2018 +0100
@@ -18,6 +18,7 @@
* Author: Sébastien Deronne <sebastien.deronne@gmail.com>
*/
+#include "ns3/net-device.h"
#include "wifi-mac-helper.h"
#include "ns3/wifi-mac.h"
#include "ns3/boolean.h"
@@ -64,9 +65,10 @@
}
Ptr<WifiMac>
-WifiMacHelper::Create (void) const
+WifiMacHelper::Create (Ptr<NetDevice> device) const
{
Ptr<WifiMac> mac = m_mac.Create<WifiMac> ();
+ mac->SetDevice (device);
return mac;
}
--- a/src/wifi/helper/wifi-mac-helper.h Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/helper/wifi-mac-helper.h Tue Oct 30 13:42:31 2018 +0100
@@ -26,6 +26,7 @@
namespace ns3 {
class WifiMac;
+class NetDevice;
/**
* \brief create MAC layers for a ns3::WifiNetDevice.
@@ -103,7 +104,7 @@
*
* This allows the ns3::WifiHelper class to create MAC objects from ns3::WifiHelper::Install.
*/
- virtual Ptr<WifiMac> Create (void) const;
+ virtual Ptr<WifiMac> Create (Ptr<NetDevice> device) const;
protected:
--- a/src/wifi/model/aarf-wifi-manager.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/aarf-wifi-manager.cc Tue Oct 30 13:42:31 2018 +0100
@@ -100,6 +100,24 @@
NS_LOG_FUNCTION (this);
}
+void
+AarfWifiManager::DoInitialize ()
+{
+ NS_LOG_FUNCTION (this);
+ if (GetHtSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HT rates");
+ }
+ if (GetVhtSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support VHT rates");
+ }
+ if (GetHeSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rates");
+ }
+}
+
WifiRemoteStation *
AarfWifiManager::DoCreateStation (void) const
{
@@ -285,34 +303,4 @@
return true;
}
-void
-AarfWifiManager::SetHtSupported (bool enable)
-{
- //HT is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HT rates");
- }
-}
-
-void
-AarfWifiManager::SetVhtSupported (bool enable)
-{
- //VHT is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support VHT rates");
- }
-}
-
-void
-AarfWifiManager::SetHeSupported (bool enable)
-{
- //HE is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rates");
- }
-}
-
} //namespace ns3
--- a/src/wifi/model/aarf-wifi-manager.h Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/aarf-wifi-manager.h Tue Oct 30 13:42:31 2018 +0100
@@ -50,13 +50,10 @@
AarfWifiManager ();
virtual ~AarfWifiManager ();
- // Inherited from WifiRemoteStationManager
- void SetHtSupported (bool enable);
- void SetVhtSupported (bool enable);
- void SetHeSupported (bool enable);
private:
- //overridden from base class
+ // Overridden from base class.
+ void DoInitialize (void);
WifiRemoteStation * DoCreateStation (void) const;
void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
--- a/src/wifi/model/aarfcd-wifi-manager.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/aarfcd-wifi-manager.cc Tue Oct 30 13:42:31 2018 +0100
@@ -126,6 +126,24 @@
NS_LOG_FUNCTION (this);
}
+void
+AarfcdWifiManager::DoInitialize ()
+{
+ NS_LOG_FUNCTION (this);
+ if (GetHtSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HT rates");
+ }
+ if (GetVhtSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support VHT rates");
+ }
+ if (GetHeSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rates");
+ }
+}
+
WifiRemoteStation *
AarfcdWifiManager::DoCreateStation (void) const
{
@@ -412,34 +430,4 @@
station->m_rtsWnd = m_minRtsWnd;
}
-void
-AarfcdWifiManager::SetHtSupported (bool enable)
-{
- //HT is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HT rates");
- }
-}
-
-void
-AarfcdWifiManager::SetVhtSupported (bool enable)
-{
- //VHT is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support VHT rates");
- }
-}
-
-void
-AarfcdWifiManager::SetHeSupported (bool enable)
-{
- //HE is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rates");
- }
-}
-
} //namespace ns3
--- a/src/wifi/model/aarfcd-wifi-manager.h Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/aarfcd-wifi-manager.h Tue Oct 30 13:42:31 2018 +0100
@@ -52,13 +52,10 @@
AarfcdWifiManager ();
virtual ~AarfcdWifiManager ();
- // Inherited from WifiRemoteStationManager
- void SetHtSupported (bool enable);
- void SetVhtSupported (bool enable);
- void SetHeSupported (bool enable);
private:
- // overridden from base class
+ // Overridden from base class.
+ void DoInitialize (void);
WifiRemoteStation * DoCreateStation (void) const;
void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
--- a/src/wifi/model/amrr-wifi-manager.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/amrr-wifi-manager.cc Tue Oct 30 13:42:31 2018 +0100
@@ -103,6 +103,24 @@
NS_LOG_FUNCTION (this);
}
+void
+AmrrWifiManager::DoInitialize ()
+{
+ NS_LOG_FUNCTION (this);
+ if (GetHtSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HT rates");
+ }
+ if (GetVhtSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support VHT rates");
+ }
+ if (GetHeSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rates");
+ }
+}
+
WifiRemoteStation *
AmrrWifiManager::DoCreateStation (void) const
{
@@ -392,34 +410,4 @@
return true;
}
-void
-AmrrWifiManager::SetHtSupported (bool enable)
-{
- //HT is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HT rates");
- }
-}
-
-void
-AmrrWifiManager::SetVhtSupported (bool enable)
-{
- //VHT is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support VHT rates");
- }
-}
-
-void
-AmrrWifiManager::SetHeSupported (bool enable)
-{
- //HE is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rates");
- }
-}
-
} //namespace ns3
--- a/src/wifi/model/amrr-wifi-manager.h Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/amrr-wifi-manager.h Tue Oct 30 13:42:31 2018 +0100
@@ -53,14 +53,10 @@
AmrrWifiManager ();
virtual ~AmrrWifiManager ();
- // Inherited from WifiRemoteStationManager
- void SetHtSupported (bool enable);
- void SetVhtSupported (bool enable);
- void SetHeSupported (bool enable);
-
private:
- //overridden from base class
+ // Overridden from base class.
+ void DoInitialize (void);
WifiRemoteStation * DoCreateStation (void) const;
void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
--- a/src/wifi/model/ap-wifi-mac.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/ap-wifi-mac.cc Tue Oct 30 13:42:31 2018 +0100
@@ -34,6 +34,8 @@
#include "msdu-aggregator.h"
#include "amsdu-subframe-header.h"
#include "wifi-phy.h"
+#include "wifi-net-device.h"
+#include "ht-configuration.h"
namespace ns3 {
@@ -562,6 +564,8 @@
HtOperation operation;
if (GetHtSupported ())
{
+ Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
+ Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
operation.SetHtSupported (1);
operation.SetPrimaryChannel (m_phy->GetChannelNumber ());
operation.SetRifsMode (GetRifsMode ());
@@ -589,7 +593,7 @@
}
uint8_t nss = (mcs.GetMcsValue () / 8) + 1;
NS_ASSERT (nss > 0 && nss < 5);
- uint64_t dataRate = mcs.GetDataRate (m_phy->GetChannelWidth (), m_phy->GetShortGuardInterval () ? 400 : 800, nss);
+ uint64_t dataRate = mcs.GetDataRate (m_phy->GetChannelWidth (), htConfiguration->GetShortGuardIntervalSupported () ? 400 : 800, nss);
if (dataRate > maxSupportedRate)
{
maxSupportedRate = dataRate;
@@ -612,7 +616,7 @@
}
uint8_t nss = (mcs.GetMcsValue () / 8) + 1;
NS_ASSERT (nss > 0 && nss < 5);
- uint64_t dataRate = mcs.GetDataRate (m_stationManager->GetChannelWidthSupported (i->second), m_stationManager->GetShortGuardInterval (i->second) ? 400 : 800, nss);
+ uint64_t dataRate = mcs.GetDataRate (m_stationManager->GetChannelWidthSupported (i->second), m_stationManager->GetShortGuardIntervalSupported (i->second) ? 400 : 800, nss);
if (dataRate > maxSupportedRateByHtSta)
{
maxSupportedRateByHtSta = dataRate;
@@ -1584,7 +1588,9 @@
rifsMode = true;
}
}
- if (GetRifsSupported () && rifsMode)
+ Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
+ Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
+ if (htConfiguration && htConfiguration->GetRifsSupported () && rifsMode)
{
m_stationManager->SetRifsPermitted (true);
}
--- a/src/wifi/model/aparf-wifi-manager.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/aparf-wifi-manager.cc Tue Oct 30 13:42:31 2018 +0100
@@ -134,6 +134,24 @@
WifiRemoteStationManager::SetupPhy (phy);
}
+void
+AparfWifiManager::DoInitialize ()
+{
+ NS_LOG_FUNCTION (this);
+ if (GetHtSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HT rates");
+ }
+ if (GetVhtSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support VHT rates");
+ }
+ if (GetHeSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rates");
+ }
+}
+
WifiRemoteStation *
AparfWifiManager::DoCreateStation (void) const
{
@@ -380,34 +398,4 @@
return true;
}
-void
-AparfWifiManager::SetHtSupported (bool enable)
-{
- //HT is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HT rates");
- }
-}
-
-void
-AparfWifiManager::SetVhtSupported (bool enable)
-{
- //VHT is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support VHT rates");
- }
-}
-
-void
-AparfWifiManager::SetHeSupported (bool enable)
-{
- //HE is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rates");
- }
-}
-
} //namespace ns3
--- a/src/wifi/model/aparf-wifi-manager.h Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/aparf-wifi-manager.h Tue Oct 30 13:42:31 2018 +0100
@@ -55,9 +55,6 @@
// Inherited from WifiRemoteStationManager
void SetupPhy (const Ptr<WifiPhy> phy);
- void SetHtSupported (bool enable);
- void SetVhtSupported (bool enable);
- void SetHeSupported (bool enable);
/**
* Enumeration of the possible states of the channel.
@@ -71,7 +68,8 @@
private:
- //overridden from base class
+ // Overridden from base class.
+ void DoInitialize (void);
WifiRemoteStation * DoCreateStation (void) const;
void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
--- a/src/wifi/model/arf-wifi-manager.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/arf-wifi-manager.cc Tue Oct 30 13:42:31 2018 +0100
@@ -84,6 +84,24 @@
NS_LOG_FUNCTION (this);
}
+void
+ArfWifiManager::DoInitialize ()
+{
+ NS_LOG_FUNCTION (this);
+ if (GetHtSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HT rates");
+ }
+ if (GetVhtSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support VHT rates");
+ }
+ if (GetHeSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rates");
+ }
+}
+
WifiRemoteStation *
ArfWifiManager::DoCreateStation (void) const
{
@@ -262,34 +280,4 @@
return true;
}
-void
-ArfWifiManager::SetHtSupported (bool enable)
-{
- //HT is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HT rates");
- }
-}
-
-void
-ArfWifiManager::SetVhtSupported (bool enable)
-{
- //VHT is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support VHT rates");
- }
-}
-
-void
-ArfWifiManager::SetHeSupported (bool enable)
-{
- //HE is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rates");
- }
-}
-
} //namespace ns3
--- a/src/wifi/model/arf-wifi-manager.h Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/arf-wifi-manager.h Tue Oct 30 13:42:31 2018 +0100
@@ -56,14 +56,10 @@
ArfWifiManager ();
virtual ~ArfWifiManager ();
- // Inherited from WifiRemoteStationManager
- void SetHtSupported (bool enable);
- void SetVhtSupported (bool enable);
- void SetHeSupported (bool enable);
-
private:
- //overridden from base class
+ // Overridden from base class.
+ void DoInitialize (void);
WifiRemoteStation * DoCreateStation (void) const;
void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
--- a/src/wifi/model/block-ack-manager.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/block-ack-manager.cc Tue Oct 30 13:42:31 2018 +0100
@@ -126,7 +126,7 @@
agreement.SetWinEnd ((agreement.GetStartingSequence () + agreement.GetBufferSize () - 1) % 4096);
agreement.SetTimeout (reqHdr->GetTimeout ());
agreement.SetAmsduSupport (reqHdr->IsAmsduSupported ());
- agreement.SetHtSupported (m_stationManager->HasHtSupported ());
+ agreement.SetHtSupported (m_stationManager->GetHtSupported ());
if (reqHdr->IsImmediateBlockAck ())
{
agreement.SetImmediateBlockAck ();
--- a/src/wifi/model/cara-wifi-manager.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/cara-wifi-manager.cc Tue Oct 30 13:42:31 2018 +0100
@@ -91,6 +91,24 @@
NS_LOG_FUNCTION (this);
}
+void
+CaraWifiManager::DoInitialize ()
+{
+ NS_LOG_FUNCTION (this);
+ if (GetHtSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HT rates");
+ }
+ if (GetVhtSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support VHT rates");
+ }
+ if (GetHeSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rates");
+ }
+}
+
WifiRemoteStation *
CaraWifiManager::DoCreateStation (void) const
{
@@ -240,34 +258,4 @@
return true;
}
-void
-CaraWifiManager::SetHtSupported (bool enable)
-{
- //HT is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HT rates");
- }
-}
-
-void
-CaraWifiManager::SetVhtSupported (bool enable)
-{
- //VHT is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support VHT rates");
- }
-}
-
-void
-CaraWifiManager::SetHeSupported (bool enable)
-{
- //HE is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rates");
- }
-}
-
} //namespace ns3
--- a/src/wifi/model/cara-wifi-manager.h Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/cara-wifi-manager.h Tue Oct 30 13:42:31 2018 +0100
@@ -52,14 +52,10 @@
CaraWifiManager ();
virtual ~CaraWifiManager ();
- // Inherited from WifiRemoteStationManager
- void SetHtSupported (bool enable);
- void SetVhtSupported (bool enable);
- void SetHeSupported (bool enable);
-
private:
- //overridden from base class
+ // Overridden from base class.
+ void DoInitialize (void);
WifiRemoteStation * DoCreateStation (void) const;
void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
--- a/src/wifi/model/constant-rate-wifi-manager.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/constant-rate-wifi-manager.cc Tue Oct 30 13:42:31 2018 +0100
@@ -118,14 +118,14 @@
ConstantRateWifiManager::DoGetDataTxVector (WifiRemoteStation *st)
{
NS_LOG_FUNCTION (this << st);
- return WifiTxVector (m_dataMode, GetDefaultTxPowerLevel (), GetPreambleForTransmission (m_dataMode, GetAddress (st)), ConvertGuardIntervalToNanoSeconds (m_dataMode, GetShortGuardInterval (st), NanoSeconds (GetGuardInterval (st))), GetNumberOfAntennas (), Min (GetMaxNumberOfTransmitStreams (), GetNumberOfSupportedStreams (st)), 0, GetChannelWidthForTransmission (m_dataMode, GetChannelWidth (st)), GetAggregation (st), false);
+ return WifiTxVector (m_dataMode, GetDefaultTxPowerLevel (), GetPreambleForTransmission (m_dataMode, GetAddress (st)), ConvertGuardIntervalToNanoSeconds (m_dataMode, GetShortGuardIntervalSupported (st), NanoSeconds (GetGuardInterval (st))), GetNumberOfAntennas (), Min (GetMaxNumberOfTransmitStreams (), GetNumberOfSupportedStreams (st)), 0, GetChannelWidthForTransmission (m_dataMode, GetChannelWidth (st)), GetAggregation (st), false);
}
WifiTxVector
ConstantRateWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
{
NS_LOG_FUNCTION (this << st);
- return WifiTxVector (m_ctlMode, GetDefaultTxPowerLevel (), GetPreambleForTransmission (m_ctlMode, GetAddress (st)), ConvertGuardIntervalToNanoSeconds (m_ctlMode, GetShortGuardInterval (st), NanoSeconds (GetGuardInterval (st))), 1, 1, 0, GetChannelWidthForTransmission (m_ctlMode, GetChannelWidth (st)), GetAggregation (st), false);
+ return WifiTxVector (m_ctlMode, GetDefaultTxPowerLevel (), GetPreambleForTransmission (m_ctlMode, GetAddress (st)), ConvertGuardIntervalToNanoSeconds (m_ctlMode, GetShortGuardIntervalSupported (st), NanoSeconds (GetGuardInterval (st))), 1, 1, 0, GetChannelWidthForTransmission (m_ctlMode, GetChannelWidth (st)), GetAggregation (st), false);
}
bool
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/wifi/model/he-configuration.cc Tue Oct 30 13:42:31 2018 +0100
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2018 University of Washington
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "ns3/log.h"
+#include "ns3/nstime.h"
+#include "ns3/uinteger.h"
+#include "he-configuration.h"
+
+namespace ns3 {
+
+NS_LOG_COMPONENT_DEFINE ("HeConfiguration");
+NS_OBJECT_ENSURE_REGISTERED (HeConfiguration);
+
+HeConfiguration::HeConfiguration ()
+{
+ NS_LOG_FUNCTION (this);
+}
+
+TypeId
+HeConfiguration::GetTypeId (void)
+{
+ static ns3::TypeId tid = ns3::TypeId ("ns3::HeConfiguration")
+ .SetParent<Object> ()
+ .SetGroupName ("Wifi")
+ .AddConstructor<HeConfiguration> ()
+ .AddAttribute ("GuardInterval",
+ "Specify the shortest guard interval duration that can be used for HE transmissions."
+ "Possible values are 800ns, 1600ns or 3200ns.",
+ TimeValue (NanoSeconds (3200)),
+ MakeTimeAccessor (&HeConfiguration::GetGuardInterval,
+ &HeConfiguration::SetGuardInterval),
+ MakeTimeChecker (NanoSeconds (800), NanoSeconds (3200)))
+ ;
+ return tid;
+}
+
+void
+HeConfiguration::SetGuardInterval (Time guardInterval)
+{
+ NS_LOG_FUNCTION (this << guardInterval);
+ NS_ASSERT (guardInterval == NanoSeconds (800) || guardInterval == NanoSeconds (1600) || guardInterval == NanoSeconds (3200));
+ m_guardInterval = guardInterval;
+}
+
+Time
+HeConfiguration::GetGuardInterval (void) const
+{
+ return m_guardInterval;
+}
+
+} //namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/wifi/model/he-configuration.h Tue Oct 30 13:42:31 2018 +0100
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2018 University of Washington
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef HE_CONFIGURATION_H
+#define HE_CONFIGURATION_H
+
+#include "ns3/object.h"
+
+namespace ns3 {
+
+/**
+ * \brief HE configuration
+ * \ingroup wifi
+ *
+ * This object stores HE configuration information, for use in modifying
+ * AP or STA behavior and for constructing HE-related information elements.
+ *
+ */
+class HeConfiguration : public Object
+{
+public:
+ HeConfiguration ();
+ static TypeId GetTypeId (void);
+
+ /**
+ * \param guardInterval the supported HE guard interval
+ */
+ void SetGuardInterval (Time guardInterval);
+ /**
+ * \return the supported HE guard interval
+ */
+ Time GetGuardInterval (void) const;
+
+
+private:
+ Time m_guardInterval; //!< Supported HE guard interval
+};
+
+} //namespace ns3
+
+#endif /* HE_CONFIGURATION_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/wifi/model/ht-configuration.cc Tue Oct 30 13:42:31 2018 +0100
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2018 Sébastien Deronne
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Sébastien Deronne <sebastien.deronne@gmail.com>
+ */
+
+#include "ns3/log.h"
+#include "ns3/boolean.h"
+#include "ht-configuration.h"
+
+namespace ns3 {
+
+NS_LOG_COMPONENT_DEFINE ("HtConfiguration");
+
+NS_OBJECT_ENSURE_REGISTERED (HtConfiguration);
+
+HtConfiguration::HtConfiguration ()
+{
+ NS_LOG_FUNCTION (this);
+}
+
+HtConfiguration::~HtConfiguration ()
+{
+ NS_LOG_FUNCTION (this);
+}
+
+TypeId
+HtConfiguration::GetTypeId (void)
+{
+ static ns3::TypeId tid = ns3::TypeId ("ns3::HtConfiguration")
+ .SetParent<Object> ()
+ .SetGroupName ("Wifi")
+ .AddConstructor<HtConfiguration> ()
+ .AddAttribute ("ShortGuardIntervalSupported",
+ "Whether or not short guard interval is supported.",
+ BooleanValue (false),
+ MakeBooleanAccessor (&HtConfiguration::GetShortGuardIntervalSupported,
+ &HtConfiguration::SetShortGuardIntervalSupported),
+ MakeBooleanChecker ())
+ .AddAttribute ("GreenfieldSupported",
+ "Whether or not Greenfield is supported.",
+ BooleanValue (false),
+ MakeBooleanAccessor (&HtConfiguration::GetGreenfieldSupported,
+ &HtConfiguration::SetGreenfieldSupported),
+ MakeBooleanChecker ())
+ .AddAttribute ("RifsSupported",
+ "Whether or not RIFS is supported.",
+ BooleanValue (false),
+ MakeBooleanAccessor (&HtConfiguration::SetRifsSupported,
+ &HtConfiguration::GetRifsSupported),
+ MakeBooleanChecker ())
+ ;
+ return tid;
+}
+
+void
+HtConfiguration::SetShortGuardIntervalSupported (bool enable)
+{
+ NS_LOG_FUNCTION (this << enable);
+ m_sgiSupported = enable;
+}
+
+bool
+HtConfiguration::GetShortGuardIntervalSupported (void) const
+{
+ return m_sgiSupported;
+}
+
+void
+HtConfiguration::SetGreenfieldSupported (bool enable)
+{
+ NS_LOG_FUNCTION (this << enable);
+ m_greenfieldSupported = enable;
+}
+
+bool
+HtConfiguration::GetGreenfieldSupported (void) const
+{
+ return m_greenfieldSupported;
+}
+
+void
+HtConfiguration::SetRifsSupported (bool enable)
+{
+ NS_LOG_FUNCTION (this << enable);
+ m_rifsSupported = enable;
+}
+
+bool
+HtConfiguration::GetRifsSupported (void) const
+{
+ return m_rifsSupported;
+}
+
+} //namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/wifi/model/ht-configuration.h Tue Oct 30 13:42:31 2018 +0100
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2018 Sébastien Deronne
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Sébastien Deronne <sebastien.deronne@gmail.com>
+ */
+
+#ifndef HT_CONFIGURATION_H
+#define HT_CONFIGURATION_H
+
+#include "ns3/object.h"
+
+namespace ns3 {
+
+/**
+ * \brief HT configuration
+ * \ingroup wifi
+ *
+ * This object stores HT configuration information, for use in modifying
+ * AP or STA behavior and for constructing HT-related information elements.
+ *
+ */
+class HtConfiguration : public Object
+{
+public:
+ HtConfiguration ();
+ virtual ~HtConfiguration ();
+
+ static TypeId GetTypeId (void);
+
+ /**
+ * Enable or disable SGI support.
+ *
+ * \param enable true if SGI is to be supported,
+ * false otherwise
+ */
+ void SetShortGuardIntervalSupported (bool enable);
+ /**
+ * \return whether the device supports SGI.
+ *
+ * \return true if SGI is supported,
+ * false otherwise.
+ */
+ bool GetShortGuardIntervalSupported (void) const;
+
+ /**
+ * Enable or disable Greenfield support.
+ *
+ * \param enable true if Greenfield is to be supported,
+ * false otherwise
+ */
+ void SetGreenfieldSupported (bool enable);
+ /**
+ * \return whether the device supports Greenfield.
+ *
+ * \return true if Greenfield is supported,
+ * false otherwise.
+ */
+ bool GetGreenfieldSupported (void) const;
+
+ /**
+ * Enable or disable RIFS support.
+ *
+ * \param enable true if RIFS is to be supported,
+ * false otherwise
+ */
+ void SetRifsSupported (bool enable);
+ /**
+ * \return whether the device supports RIFS capability.
+ *
+ * \return true if short RIFS is supported,
+ * false otherwise.
+ */
+ bool GetRifsSupported (void) const;
+
+
+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
+};
+
+} //namespace ns3
+
+#endif /* HT_CONFIGURATION_H */
--- a/src/wifi/model/ideal-wifi-manager.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/ideal-wifi-manager.cc Tue Oct 30 13:42:31 2018 +0100
@@ -118,7 +118,7 @@
AddSnrThreshold (txVector, GetPhy ()->CalculateSnr (txVector, m_ber));
}
// Add all Ht and Vht MCSes
- if (HasVhtSupported () == true || HasHtSupported () == true || HasHeSupported () == true)
+ if (GetHtSupported () || GetVhtSupported () || GetHeSupported ())
{
nModes = GetPhy ()->GetNMcs ();
for (uint8_t i = 0; i < nModes; i++)
@@ -129,7 +129,7 @@
mode = GetPhy ()->GetMcs (i);
if (mode.GetModulationClass () == WIFI_MOD_CLASS_HT)
{
- uint16_t guardInterval = GetPhy ()->GetShortGuardInterval () ? 400 : 800;
+ uint16_t guardInterval = GetShortGuardIntervalSupported () ? 400 : 800;
txVector.SetGuardInterval (guardInterval);
//derive NSS from the MCS index
nss = (mode.GetMcsValue () / 8) + 1;
@@ -147,11 +147,11 @@
uint16_t guardInterval;
if (mode.GetModulationClass () == WIFI_MOD_CLASS_VHT)
{
- guardInterval = GetPhy ()->GetShortGuardInterval () ? 400 : 800;
+ guardInterval = GetShortGuardIntervalSupported () ? 400 : 800;
}
else
{
- guardInterval = static_cast<uint16_t> (GetPhy ()->GetGuardInterval ().GetNanoSeconds ());
+ guardInterval = GetGuardInterval ();
}
txVector.SetGuardInterval (guardInterval);
for (uint8_t k = 1; k <= GetPhy ()->GetMaxSupportedTxSpatialStreams (); k++)
@@ -316,8 +316,8 @@
}
else
{
- if ((HasVhtSupported () == true || HasHtSupported () == true || HasHeSupported () == true)
- && (GetHtSupported (st) == true || GetVhtSupported (st) == true || GetHeSupported (st) == true))
+ if ((GetHtSupported () || GetVhtSupported () || GetHeSupported ())
+ && (GetHtSupported (st) || GetVhtSupported (st) || GetHeSupported (st)))
{
for (uint8_t i = 0; i < GetNMcsSupported (station); i++)
{
@@ -325,15 +325,15 @@
txVector.SetMode (mode);
if (mode.GetModulationClass () == WIFI_MOD_CLASS_HT)
{
- guardInterval = static_cast<uint16_t> (std::max (GetShortGuardInterval (station) ? 400 : 800, GetPhy ()->GetShortGuardInterval () ? 400 : 800));
+ guardInterval = static_cast<uint16_t> (std::max (GetShortGuardIntervalSupported (station) ? 400 : 800, GetShortGuardIntervalSupported () ? 400 : 800));
txVector.SetGuardInterval (guardInterval);
// If the node and peer are both VHT capable, only search VHT modes
- if (HasVhtSupported () && GetVhtSupported (station))
+ if (GetVhtSupported () && GetVhtSupported (station))
{
continue;
}
// If the node and peer are both HE capable, only search HE modes
- if (HasHeSupported () && GetHeSupported (station))
+ if (GetHeSupported () && GetHeSupported (station))
{
continue;
}
@@ -369,15 +369,15 @@
}
else if (mode.GetModulationClass () == WIFI_MOD_CLASS_VHT)
{
- guardInterval = static_cast<uint16_t> (std::max (GetShortGuardInterval (station) ? 400 : 800, GetPhy ()->GetShortGuardInterval () ? 400 : 800));
+ guardInterval = static_cast<uint16_t> (std::max (GetShortGuardIntervalSupported (station) ? 400 : 800, GetShortGuardIntervalSupported () ? 400 : 800));
txVector.SetGuardInterval (guardInterval);
// If the node and peer are both HE capable, only search HE modes
- if (HasHeSupported () && GetHeSupported (station))
+ if (GetHeSupported () && GetHeSupported (station))
{
continue;
}
// If the node and peer are not both VHT capable, only search HT modes
- if (!HasVhtSupported () || !GetVhtSupported (station))
+ if (!GetVhtSupported () || !GetVhtSupported (station))
{
continue;
}
@@ -413,10 +413,10 @@
}
else //HE
{
- guardInterval = std::max (GetGuardInterval (station), static_cast<uint16_t> (GetPhy ()->GetGuardInterval ().GetNanoSeconds ()));
+ guardInterval = std::max (GetGuardInterval (station), GetGuardInterval ());
txVector.SetGuardInterval (guardInterval);
// If the node and peer are not both HE capable, only search (V)HT modes
- if (!HasHeSupported () || !GetHeSupported (station))
+ if (!GetHeSupported () || !GetHeSupported (station))
{
continue;
}
@@ -488,11 +488,15 @@
NS_LOG_DEBUG ("Found maxMode: " << maxMode << " channelWidth: " << channelWidth);
if (maxMode.GetModulationClass () == WIFI_MOD_CLASS_HE)
{
- guardInterval = std::max (GetGuardInterval (station), static_cast<uint16_t> (GetPhy ()->GetGuardInterval ().GetNanoSeconds ()));
+ guardInterval = std::max (GetGuardInterval (station), GetGuardInterval ());
+ }
+ else if ((maxMode.GetModulationClass () == WIFI_MOD_CLASS_HT) || (maxMode.GetModulationClass () == WIFI_MOD_CLASS_VHT))
+ {
+ guardInterval = static_cast<uint16_t> (std::max (GetShortGuardIntervalSupported (station) ? 400 : 800, GetShortGuardIntervalSupported () ? 400 : 800));
}
else
{
- guardInterval = static_cast<uint16_t> (std::max (GetShortGuardInterval (station) ? 400 : 800, GetPhy ()->GetShortGuardInterval () ? 400 : 800));
+ guardInterval = 800;
}
if (m_currentRate != maxMode.GetDataRate (channelWidth, guardInterval, selectedNss))
{
--- a/src/wifi/model/mac-low.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/mac-low.cc Tue Oct 30 13:42:31 2018 +0100
@@ -1356,11 +1356,11 @@
", seq=0x" << std::hex << m_currentHdr.GetSequenceControl () << std::dec);
if (!m_ampdu || hdr->IsAck () || hdr->IsRts () || hdr->IsCts () || hdr->IsBlockAck () || hdr->IsMgt ())
{
- if (hdr->IsCfPoll () && m_stationManager->HasPcfSupported ())
+ if (hdr->IsCfPoll () && m_stationManager->GetPcfSupported ())
{
Simulator::Schedule (GetPifs () + m_phy->CalculateTxDuration (packet->GetSize (), txVector, m_phy->GetFrequency ()), &MacLow::CfPollTimeout, this);
}
- if (hdr->IsBeacon () && m_stationManager->HasPcfSupported ())
+ if (hdr->IsBeacon () && m_stationManager->GetPcfSupported ())
{
if (Simulator::Now () > m_lastBeacon + m_beaconInterval)
{
@@ -1368,7 +1368,7 @@
}
m_lastBeacon = Simulator::Now ();
}
- else if (hdr->IsCfEnd () && m_stationManager->HasPcfSupported ())
+ else if (hdr->IsCfEnd () && m_stationManager->GetPcfSupported ())
{
m_cfpStart = NanoSeconds (0);
m_cfpForeshortening = NanoSeconds (0);
@@ -1989,7 +1989,7 @@
MacLow::EndTxNoAck (void)
{
NS_LOG_FUNCTION (this);
- if (m_currentHdr.IsBeacon () && m_stationManager->HasPcfSupported ())
+ if (m_currentHdr.IsBeacon () && m_stationManager->GetPcfSupported ())
{
m_cfpStart = Simulator::Now ();
}
@@ -2039,9 +2039,9 @@
bool
MacLow::ReceiveMpdu (Ptr<Packet> packet, WifiMacHeader hdr)
{
- if (m_stationManager->HasHtSupported ()
- || m_stationManager->HasVhtSupported ()
- || m_stationManager->HasHeSupported ())
+ if (m_stationManager->GetHtSupported ()
+ || m_stationManager->GetVhtSupported ()
+ || m_stationManager->GetHeSupported ())
{
Mac48Address originator = hdr.GetAddr2 ();
uint8_t tid = 0;
@@ -2380,9 +2380,9 @@
(*i).second.FillBlockAckBitmap (&blockAck);
NS_LOG_DEBUG ("Got block Ack Req with seq " << reqHdr.GetStartingSequence ());
- if (!m_stationManager->HasHtSupported ()
- && !m_stationManager->HasVhtSupported ()
- && !m_stationManager->HasHeSupported ())
+ if (!m_stationManager->GetHtSupported ()
+ && !m_stationManager->GetVhtSupported ()
+ && !m_stationManager->GetHeSupported ())
{
/* All packets with smaller sequence than starting sequence control must be passed up to Wifimac
* See 9.10.3 in IEEE 802.11e standard.
@@ -2539,7 +2539,7 @@
AcIndex ac = QosUtilsMapTidToAc (tid);
std::map<AcIndex, Ptr<QosTxop> >::const_iterator edcaIt = m_edca.find (ac);
- if (m_phy->GetGreenfield ())
+ if (m_stationManager->GetGreenfieldSupported ())
{
aPPDUMaxTime = MicroSeconds (10000);
}
@@ -2966,7 +2966,7 @@
bool
MacLow::IsCfPeriod (void) const
{
- return (m_stationManager->HasPcfSupported () && m_cfpStart.IsStrictlyPositive ());
+ return (m_stationManager->GetPcfSupported () && m_cfpStart.IsStrictlyPositive ());
}
bool
--- a/src/wifi/model/minstrel-ht-wifi-manager.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/minstrel-ht-wifi-manager.cc Tue Oct 30 13:42:31 2018 +0100
@@ -139,13 +139,10 @@
MinstrelHtWifiManager::~MinstrelHtWifiManager ()
{
NS_LOG_FUNCTION (this);
- if (HasHtSupported ())
+ for (uint8_t i = 0; i < m_numGroups; i++)
{
- for (uint8_t i = 0; i < m_numGroups; i++)
- {
- m_minstrelGroups[i].ratesFirstMpduTxTimeTable.clear ();
- m_minstrelGroups[i].ratesTxTimeTable.clear ();
- }
+ m_minstrelGroups[i].ratesFirstMpduTxTimeTable.clear ();
+ m_minstrelGroups[i].ratesTxTimeTable.clear ();
}
}
@@ -170,10 +167,21 @@
}
void
+MinstrelHtWifiManager::SetupMac (const Ptr<WifiMac> mac)
+{
+ NS_LOG_FUNCTION (this << mac);
+ m_legacyManager->SetupMac (mac);
+ WifiRemoteStationManager::SetupMac (mac);
+}
+
+void
MinstrelHtWifiManager::DoInitialize ()
{
NS_LOG_FUNCTION (this);
-
+ if (GetHeSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rates");
+ }
/**
* Here we initialize m_minstrelGroups with all the possible groups.
* If a group is not supported by the device, then it is marked as not supported.
@@ -181,12 +189,12 @@
*/
// Check if the device supports HT or VHT
- if (HasHtSupported () || HasVhtSupported ())
+ if (GetHtSupported () || GetVhtSupported ())
{
m_numGroups = MAX_SUPPORTED_STREAMS * MAX_HT_STREAM_GROUPS;
m_numRates = MAX_HT_GROUP_RATES;
- if (HasVhtSupported ())
+ if (GetVhtSupported ())
{
m_numGroups += MAX_SUPPORTED_STREAMS * MAX_VHT_STREAM_GROUPS;
m_numRates = MAX_VHT_GROUP_RATES;
@@ -221,7 +229,7 @@
m_minstrelGroups[groupId].isSupported = false;
// Check capabilities of the device
- if (!(!GetPhy ()->GetShortGuardInterval () && m_minstrelGroups[groupId].sgi) ///Is SGI supported by the transmitter?
+ if (!(!GetShortGuardIntervalSupported () && m_minstrelGroups[groupId].sgi) ///Is SGI supported by the transmitter?
&& (GetPhy ()->GetChannelWidth () >= m_minstrelGroups[groupId].chWidth) ///Is channel width supported by the transmitter?
&& (GetPhy ()->GetMaxSupportedTxSpatialStreams () >= m_minstrelGroups[groupId].streams)) ///Are streams supported by the transmitter?
{
@@ -242,7 +250,7 @@
}
}
- if (HasVhtSupported ())
+ if (GetVhtSupported ())
{
// Initialize all VHT groups
for (uint16_t chWidth = 20; chWidth <= MAX_VHT_WIDTH; chWidth *= 2)
@@ -260,7 +268,7 @@
m_minstrelGroups[groupId].isSupported = false;
// Check capabilities of the device
- if (!(!GetPhy ()->GetShortGuardInterval () && m_minstrelGroups[groupId].sgi) ///Is SGI supported by the transmitter?
+ if (!(!GetShortGuardIntervalSupported () && m_minstrelGroups[groupId].sgi) ///Is SGI supported by the transmitter?
&& (GetPhy ()->GetChannelWidth () >= m_minstrelGroups[groupId].chWidth) ///Is channel width supported by the transmitter?
&& (GetPhy ()->GetMaxSupportedTxSpatialStreams () >= m_minstrelGroups[groupId].streams)) ///Are streams supported by the transmitter?
{
@@ -287,14 +295,6 @@
}
}
-void
-MinstrelHtWifiManager::SetupMac (const Ptr<WifiMac> mac)
-{
- NS_LOG_FUNCTION (this << mac);
- m_legacyManager->SetupMac (mac);
- WifiRemoteStationManager::SetupMac (mac);
-}
-
bool
MinstrelHtWifiManager::IsValidMcs (Ptr<WifiPhy> phy, uint8_t streams, uint16_t chWidth, WifiMode mode)
{
@@ -315,7 +315,7 @@
txvector.SetGuardInterval (sgi ? 400 : 800);
txvector.SetChannelWidth (chWidth);
txvector.SetNess (0);
- txvector.SetStbc (phy->GetStbc ());
+ txvector.SetStbc (0);
txvector.SetMode (mode);
txvector.SetPreambleType (WIFI_PREAMBLE_HT_MF);
return phy->CalculateTxDuration (m_frameLength, txvector, phy->GetFrequency (), MPDU_IN_AGGREGATE, 0);
@@ -330,7 +330,7 @@
txvector.SetGuardInterval (sgi ? 400 : 800);
txvector.SetChannelWidth (chWidth);
txvector.SetNess (0);
- txvector.SetStbc (phy->GetStbc ());
+ txvector.SetStbc (0);
txvector.SetMode (mode);
txvector.SetPreambleType (WIFI_PREAMBLE_NONE);
return phy->CalculateTxDuration (m_frameLength, txvector, phy->GetFrequency (), MPDU_IN_AGGREGATE, 0);
@@ -404,7 +404,7 @@
station->m_ampduPacketCount = 0;
// If the device supports HT
- if (HasHtSupported () || HasVhtSupported ())
+ if (GetHtSupported () || GetVhtSupported ())
{
/**
* Assume the station is HT.
@@ -860,12 +860,12 @@
McsGroup group = m_minstrelGroups[groupId];
// Check consistency of rate selected.
- if ((group.sgi && !GetShortGuardInterval (station)) || group.chWidth > GetChannelWidth (station) || group.streams > GetNumberOfSupportedStreams (station))
+ if ((group.sgi && !GetShortGuardIntervalSupported (station)) || group.chWidth > GetChannelWidth (station) || group.streams > GetNumberOfSupportedStreams (station))
{
NS_FATAL_ERROR ("Inconsistent group selected. Group: (" << +group.streams <<
"," << +group.sgi << "," << group.chWidth << ")" <<
" Station capabilities: (" << GetNumberOfSupportedStreams (station) <<
- "," << GetShortGuardInterval (station) << "," << GetChannelWidth (station) << ")");
+ "," << GetShortGuardIntervalSupported (station) << "," << GetChannelWidth (station) << ")");
}
WifiMode mode = GetMcsSupported (station, mcsIndex);
uint64_t dataRate = mode.GetDataRate (group.chWidth, group.sgi ? 400 : 800, group.streams);
@@ -1453,7 +1453,7 @@
station->m_groupsTable[groupId].m_supported = false;
if (!(!GetVhtSupported (station) && m_minstrelGroups[groupId].isVht) ///Is VHT supported by the receiver?
&& (m_minstrelGroups[groupId].isVht || !GetVhtSupported (station) || !m_useVhtOnly) ///If it is an HT MCS, check if VHT only is disabled
- && !(!GetShortGuardInterval (station) && m_minstrelGroups[groupId].sgi) ///Is SGI supported by the receiver?
+ && !(!GetShortGuardIntervalSupported (station) && m_minstrelGroups[groupId].sgi) ///Is SGI supported by the receiver?
&& (GetChannelWidth (station) >= m_minstrelGroups[groupId].chWidth) ///Is channel width supported by the receiver?
&& (GetNumberOfSupportedStreams (station) >= m_minstrelGroups[groupId].streams)) ///Are streams supported by the receiver?
{
@@ -1829,14 +1829,4 @@
return htMcsList;
}
-void
-MinstrelHtWifiManager::SetHeSupported (bool enable)
-{
- //HE is not supported yet by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rates");
- }
-}
-
} // namespace ns3
--- a/src/wifi/model/minstrel-ht-wifi-manager.h Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/minstrel-ht-wifi-manager.h Tue Oct 30 13:42:31 2018 +0100
@@ -204,7 +204,6 @@
// Inherited from WifiRemoteStationManager
void SetupPhy (const Ptr<WifiPhy> phy);
void SetupMac (const Ptr<WifiMac> mac);
- void SetHeSupported (bool enable); //HE rates not yet supported
/**
* TracedCallback signature for rate change events.
--- a/src/wifi/model/minstrel-wifi-manager.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/minstrel-wifi-manager.cc Tue Oct 30 13:42:31 2018 +0100
@@ -132,6 +132,24 @@
WifiRemoteStationManager::SetupMac (mac);
}
+void
+MinstrelWifiManager::DoInitialize ()
+{
+ NS_LOG_FUNCTION (this);
+ if (GetHtSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HT rates");
+ }
+ if (GetVhtSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support VHT rates");
+ }
+ if (GetHeSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rates");
+ }
+}
+
int64_t
MinstrelWifiManager::AssignStreams (int64_t stream)
{
@@ -1083,34 +1101,4 @@
station->m_statsFile.flush ();
}
-void
-MinstrelWifiManager::SetHtSupported (bool enable)
-{
- //HT is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HT rates");
- }
-}
-
-void
-MinstrelWifiManager::SetVhtSupported (bool enable)
-{
- //VHT is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support VHT rates");
- }
-}
-
-void
-MinstrelWifiManager::SetHeSupported (bool enable)
-{
- //HE is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rates");
- }
-}
-
} //namespace ns3
--- a/src/wifi/model/minstrel-wifi-manager.h Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/minstrel-wifi-manager.h Tue Oct 30 13:42:31 2018 +0100
@@ -168,9 +168,6 @@
// Inherited from WifiRemoteStationManager
void SetupPhy (const Ptr<WifiPhy> phy);
void SetupMac (const Ptr<WifiMac> mac);
- void SetHtSupported (bool enable);
- void SetVhtSupported (bool enable);
- void SetHeSupported (bool enable);
/**
* Assign a fixed random variable stream number to the random variables
@@ -258,7 +255,8 @@
void InitSampleTable (MinstrelWifiRemoteStation *station);
private:
- //overridden from base class
+ // Overridden from base class.
+ void DoInitialize (void);
WifiRemoteStation * DoCreateStation (void) const;
void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
--- a/src/wifi/model/onoe-wifi-manager.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/onoe-wifi-manager.cc Tue Oct 30 13:42:31 2018 +0100
@@ -89,6 +89,24 @@
NS_LOG_FUNCTION (this);
}
+void
+OnoeWifiManager::DoInitialize ()
+{
+ NS_LOG_FUNCTION (this);
+ if (GetHtSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HT rates");
+ }
+ if (GetVhtSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support VHT rates");
+ }
+ if (GetHeSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rates");
+ }
+}
+
WifiRemoteStation *
OnoeWifiManager::DoCreateStation (void) const
{
@@ -344,34 +362,4 @@
return false;
}
-void
-OnoeWifiManager::SetHtSupported (bool enable)
-{
- //HT is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HT rates");
- }
-}
-
-void
-OnoeWifiManager::SetVhtSupported (bool enable)
-{
- //VHT is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support VHT rates");
- }
-}
-
-void
-OnoeWifiManager::SetHeSupported (bool enable)
-{
- //HE is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rates");
- }
-}
-
} //namespace ns3
--- a/src/wifi/model/onoe-wifi-manager.h Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/onoe-wifi-manager.h Tue Oct 30 13:42:31 2018 +0100
@@ -54,14 +54,10 @@
OnoeWifiManager ();
virtual ~OnoeWifiManager ();
- // Inherited from WifiRemoteStationManager
- void SetHtSupported (bool enable);
- void SetVhtSupported (bool enable);
- void SetHeSupported (bool enable);
-
private:
- //overridden from base class
+ // Overridden from base class.
+ void DoInitialize (void);
WifiRemoteStation * DoCreateStation (void) const;
void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
--- a/src/wifi/model/parf-wifi-manager.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/parf-wifi-manager.cc Tue Oct 30 13:42:31 2018 +0100
@@ -102,6 +102,24 @@
WifiRemoteStationManager::SetupPhy (phy);
}
+void
+ParfWifiManager::DoInitialize ()
+{
+ NS_LOG_FUNCTION (this);
+ if (GetHtSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HT rates");
+ }
+ if (GetVhtSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support VHT rates");
+ }
+ if (GetHeSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rates");
+ }
+}
+
WifiRemoteStation *
ParfWifiManager::DoCreateStation (void) const
{
@@ -352,34 +370,4 @@
return true;
}
-void
-ParfWifiManager::SetHtSupported (bool enable)
-{
- //HT is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HT rates");
- }
-}
-
-void
-ParfWifiManager::SetVhtSupported (bool enable)
-{
- //VHT is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support VHT rates");
- }
-}
-
-void
-ParfWifiManager::SetHeSupported (bool enable)
-{
- //HE is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rates");
- }
-}
-
} //namespace ns3
--- a/src/wifi/model/parf-wifi-manager.h Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/parf-wifi-manager.h Tue Oct 30 13:42:31 2018 +0100
@@ -53,13 +53,11 @@
// Inherited from WifiRemoteStationManager
void SetupPhy (const Ptr<WifiPhy> phy);
- void SetHtSupported (bool enable);
- void SetVhtSupported (bool enable);
- void SetHeSupported (bool enable);
private:
- //overridden from base class
+ // Overridden from base class.
+ void DoInitialize (void);
WifiRemoteStation * DoCreateStation (void) const;
void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
--- a/src/wifi/model/qos-txop.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/qos-txop.cc Tue Oct 30 13:42:31 2018 +0100
@@ -950,10 +950,10 @@
QosTxop::NeedFragmentation (void) const
{
NS_LOG_FUNCTION (this);
- if (m_stationManager->HasVhtSupported ()
- || m_stationManager->HasHeSupported ()
+ if (m_stationManager->GetVhtSupported ()
+ || m_stationManager->GetHeSupported ()
|| GetAmpduExist (m_currentHdr.GetAddr1 ())
- || (m_stationManager->HasHtSupported ()
+ || (m_stationManager->GetHtSupported ()
&& m_currentHdr.IsQosData ()
&& GetBaAgreementExists (m_currentHdr.GetAddr1 (), GetTid (m_currentPacket, m_currentHdr))
&& GetMpduAggregator ()->GetMaxAmpduSize () >= m_currentPacket->GetSize ()))
@@ -1347,8 +1347,8 @@
uint32_t packets = m_queue->GetNPacketsByTidAndAddress (tid, recipient);
if ((GetBlockAckThreshold () > 0 && packets >= GetBlockAckThreshold ())
|| (m_mpduAggregator != 0 && m_mpduAggregator->GetMaxAmpduSize () > 0 && packets > 1)
- || m_stationManager->HasVhtSupported ()
- || m_stationManager->HasHeSupported ())
+ || m_stationManager->GetVhtSupported ()
+ || m_stationManager->GetHeSupported ())
{
/* Block ack setup */
uint16_t startingSequence = m_txMiddle->GetNextSeqNumberByTidAndAddress (tid, recipient);
--- a/src/wifi/model/regular-wifi-mac.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/regular-wifi-mac.cc Tue Oct 30 13:42:31 2018 +0100
@@ -31,6 +31,10 @@
#include "wifi-utils.h"
#include "mgt-headers.h"
#include "amsdu-subframe-header.h"
+#include "wifi-net-device.h"
+#include "ht-configuration.h"
+#include "vht-configuration.h"
+#include "he-configuration.h"
namespace ns3 {
@@ -40,11 +44,8 @@
RegularWifiMac::RegularWifiMac ()
: m_qosSupported (0),
- m_htSupported (0),
- m_vhtSupported (0),
m_erpSupported (0),
- m_dsssSupported (0),
- m_heSupported (0)
+ m_dsssSupported (0)
{
NS_LOG_FUNCTION (this);
m_rxMiddle = Create<MacRxMiddle> ();
@@ -117,6 +118,8 @@
m_channelAccessManager->Dispose ();
m_channelAccessManager = 0;
+
+ WifiMac::DoDispose ();
}
void
@@ -124,13 +127,8 @@
{
NS_LOG_FUNCTION (this << stationManager);
m_stationManager = stationManager;
- m_stationManager->SetHtSupported (GetHtSupported ());
- m_stationManager->SetVhtSupported (GetVhtSupported ());
- m_stationManager->SetHeSupported (GetHeSupported ());
m_low->SetWifiRemoteStationManager (stationManager);
-
m_txop->SetWifiRemoteStationManager (stationManager);
-
for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
{
i->second->SetWifiRemoteStationManager (stationManager);
@@ -148,17 +146,8 @@
{
NS_LOG_FUNCTION (this);
ExtendedCapabilities capabilities;
- if (m_htSupported || m_vhtSupported)
- {
- if (m_htSupported)
- {
- capabilities.SetHtSupported (1);
- }
- if (m_vhtSupported)
- {
- capabilities.SetVhtSupported (1);
- }
- }
+ capabilities.SetHtSupported (GetHtSupported ());
+ capabilities.SetVhtSupported (GetVhtSupported ());
//TODO: to be completed
return capabilities;
}
@@ -168,17 +157,21 @@
{
NS_LOG_FUNCTION (this);
HtCapabilities capabilities;
- if (m_htSupported)
+ if (GetHtSupported ())
{
+ Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
+ Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
+ bool greenfieldSupported = htConfiguration->GetGreenfieldSupported ();
+ bool sgiSupported = htConfiguration->GetShortGuardIntervalSupported ();
capabilities.SetHtSupported (1);
- capabilities.SetLdpc (m_phy->GetLdpc ());
+ capabilities.SetLdpc (0);
capabilities.SetSupportedChannelWidth (m_phy->GetChannelWidth () >= 40);
- capabilities.SetShortGuardInterval20 (m_phy->GetShortGuardInterval ());
- capabilities.SetShortGuardInterval40 (m_phy->GetChannelWidth () >= 40 && m_phy->GetShortGuardInterval ());
- capabilities.SetGreenfield (m_phy->GetGreenfield ());
+ 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
- capabilities.SetLSigProtectionSupport (!m_phy->GetGreenfield ());
+ capabilities.SetLSigProtectionSupport (!greenfieldSupported);
double maxAmpduLengthExponent = std::max (std::ceil ((std::log (std::max (std::max (m_beMaxAmpduSize, m_bkMaxAmpduSize), std::max (m_voMaxAmpduSize, m_viMaxAmpduSize))
+ 1.0)
/ std::log (2.0))
@@ -197,7 +190,7 @@
capabilities.SetRxMcsBitmask (mcs.GetMcsValue ());
uint8_t nss = (mcs.GetMcsValue () / 8) + 1;
NS_ASSERT (nss > 0 && nss < 5);
- uint64_t dataRate = mcs.GetDataRate (m_phy->GetChannelWidth (), m_phy->GetShortGuardInterval () ? 400 : 800, nss);
+ uint64_t dataRate = mcs.GetDataRate (m_phy->GetChannelWidth (), sgiSupported ? 400 : 800, nss);
if (dataRate > maxSupportedRate)
{
maxSupportedRate = dataRate;
@@ -219,8 +212,11 @@
{
NS_LOG_FUNCTION (this);
VhtCapabilities capabilities;
- if (m_vhtSupported)
+ if (GetVhtSupported ())
{
+ Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
+ Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
+ bool sgiSupported = htConfiguration->GetShortGuardIntervalSupported ();
capabilities.SetVhtSupported (1);
if (m_phy->GetChannelWidth () == 160)
{
@@ -232,9 +228,9 @@
}
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
- capabilities.SetRxLdpc (m_phy->GetLdpc ());
- capabilities.SetShortGuardIntervalFor80Mhz ((m_phy->GetChannelWidth () == 80) && m_phy->GetShortGuardInterval ());
- capabilities.SetShortGuardIntervalFor160Mhz ((m_phy->GetChannelWidth () == 160) && m_phy->GetShortGuardInterval ());
+ capabilities.SetRxLdpc (0);
+ capabilities.SetShortGuardIntervalFor80Mhz ((m_phy->GetChannelWidth () == 80) && sgiSupported);
+ capabilities.SetShortGuardIntervalFor160Mhz ((m_phy->GetChannelWidth () == 160) && sgiSupported);
double maxAmpduLengthExponent = std::max (std::ceil ((std::log (std::max (std::max (m_beMaxAmpduSize, m_bkMaxAmpduSize), std::max (m_voMaxAmpduSize, m_viMaxAmpduSize)) + 1.0) / std::log (2.0)) - 13.0), 0.0);
NS_ASSERT (maxAmpduLengthExponent >= 0 && maxAmpduLengthExponent <= 255);
capabilities.SetMaxAmpduLengthExponent (std::max<uint8_t> (7, static_cast<uint8_t> (maxAmpduLengthExponent))); //0 to 7 for VHT
@@ -285,8 +281,10 @@
{
NS_LOG_FUNCTION (this);
HeCapabilities capabilities;
- if (m_heSupported)
+ if (GetHeSupported ())
{
+ Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
+ Ptr<HeConfiguration> heConfiguration = device->GetHeConfiguration ();
capabilities.SetHeSupported (1);
uint8_t channelWidthSet = 0;
if (m_phy->GetChannelWidth () >= 40 && Is2_4Ghz (m_phy->GetFrequency ()))
@@ -303,12 +301,12 @@
}
capabilities.SetChannelWidthSet (channelWidthSet);
uint8_t gi = 0;
- if (m_phy->GetGuardInterval () <= NanoSeconds (1600))
+ if (heConfiguration->GetGuardInterval () <= NanoSeconds (1600))
{
//todo: We assume for now that if we support 800ns GI then 1600ns GI is supported as well
gi |= 0x01;
}
- if (m_phy->GetGuardInterval () == NanoSeconds (800))
+ if (heConfiguration->GetGuardInterval () == NanoSeconds (800))
{
gi |= 0x02;
}
@@ -580,76 +578,52 @@
void
RegularWifiMac::SetVhtSupported (bool enable)
{
- NS_LOG_FUNCTION (this << enable);
- m_vhtSupported = enable;
- if (enable)
- {
- SetQosSupported (true);
- }
- if (!enable && !m_htSupported)
- {
- DisableAggregation ();
- }
- else
- {
- EnableAggregation ();
- }
+ //To be removed once deprecated API is cleaned up
}
void
RegularWifiMac::SetHtSupported (bool enable)
{
- NS_LOG_FUNCTION (this << enable);
- m_htSupported = enable;
- if (enable)
- {
- SetQosSupported (true);
- }
- if (!enable && !m_vhtSupported)
- {
- DisableAggregation ();
- }
- else
- {
- EnableAggregation ();
- }
+ //To be removed once deprecated API is cleaned up
}
void
RegularWifiMac::SetHeSupported (bool enable)
{
- NS_LOG_FUNCTION (this << enable);
- m_heSupported = enable;
- if (enable)
+ //To be removed once deprecated API is cleaned up
+}
+
+bool
+RegularWifiMac::GetHtSupported () const
+{
+ Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
+ if (device->GetHtConfiguration ())
{
- SetQosSupported (true);
+ return true;
}
- if (!enable && !m_htSupported && !m_vhtSupported)
- {
- DisableAggregation ();
- }
- else
- {
- EnableAggregation ();
- }
+ return false;
}
bool
RegularWifiMac::GetVhtSupported () const
{
- return m_vhtSupported;
-}
-
-bool
-RegularWifiMac::GetHtSupported () const
-{
- return m_htSupported;
+ Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
+ if (device->GetVhtConfiguration ())
+ {
+ return true;
+ }
+ return false;
}
bool
RegularWifiMac::GetHeSupported () const
{
- return m_heSupported;
+ Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
+ if (device->GetHeConfiguration ())
+ {
+ return true;
+ }
+ return false;
}
bool
@@ -870,12 +844,30 @@
RegularWifiMac::SetRifsSupported (bool enable)
{
NS_LOG_FUNCTION (this << enable);
+ Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
+ if (device)
+ {
+ Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
+ if (htConfiguration)
+ {
+ htConfiguration->SetRifsSupported (enable);
+ }
+ }
m_rifsSupported = enable;
}
bool
RegularWifiMac::GetRifsSupported (void) const
{
+ Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
+ if (device)
+ {
+ Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
+ if (htConfiguration)
+ {
+ return htConfiguration->GetRifsSupported ();
+ }
+ }
return m_rifsSupported;
}
@@ -1090,19 +1082,22 @@
BooleanValue (false),
MakeBooleanAccessor (&RegularWifiMac::SetHtSupported,
&RegularWifiMac::GetHtSupported),
- MakeBooleanChecker ())
+ MakeBooleanChecker (),
+ TypeId::DEPRECATED, "Not used anymore")
.AddAttribute ("VhtSupported",
"This Boolean attribute is set to enable 802.11ac support at this STA.",
BooleanValue (false),
MakeBooleanAccessor (&RegularWifiMac::SetVhtSupported,
&RegularWifiMac::GetVhtSupported),
- MakeBooleanChecker ())
+ MakeBooleanChecker (),
+ TypeId::DEPRECATED, "Not used anymore")
.AddAttribute ("HeSupported",
"This Boolean attribute is set to enable 802.11ax support at this STA.",
BooleanValue (false),
MakeBooleanAccessor (&RegularWifiMac::SetHeSupported,
&RegularWifiMac::GetHeSupported),
- MakeBooleanChecker ())
+ MakeBooleanChecker (),
+ TypeId::DEPRECATED, "Not used anymore")
.AddAttribute ("CtsToSelfSupported",
"Use CTS to Self when using a rate that is not in the basic rate set.",
BooleanValue (false),
@@ -1227,7 +1222,8 @@
BooleanValue (false),
MakeBooleanAccessor (&RegularWifiMac::SetRifsSupported,
&RegularWifiMac::GetRifsSupported),
- MakeBooleanChecker ())
+ MakeBooleanChecker (),
+ TypeId::DEPRECATED, "Use the HtConfiguration instead")
.AddAttribute ("Txop",
"The Txop object.",
PointerValue (),
@@ -1274,18 +1270,31 @@
switch (standard)
{
case WIFI_PHY_STANDARD_80211ax_5GHZ:
- SetHeSupported (true);
case WIFI_PHY_STANDARD_80211ac:
- SetVhtSupported (true);
case WIFI_PHY_STANDARD_80211n_5GHZ:
- SetHtSupported (true);
- cwmin = 15;
- cwmax = 1023;
- break;
+ {
+ EnableAggregation ();
+ //To be removed once deprecated RifsSupported attribute is removed
+ Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
+ Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
+ NS_ASSERT (htConfiguration);
+ htConfiguration->SetRifsSupported (m_rifsSupported);
+ SetQosSupported (true);
+ cwmin = 15;
+ cwmax = 1023;
+ break;
+ }
case WIFI_PHY_STANDARD_80211ax_2_4GHZ:
- SetHeSupported (true);
case WIFI_PHY_STANDARD_80211n_2_4GHZ:
- SetHtSupported (true);
+ {
+ EnableAggregation ();
+ //To be removed once deprecated RifsSupported attribute is removed
+ Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
+ Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
+ NS_ASSERT (htConfiguration);
+ htConfiguration->SetRifsSupported (m_rifsSupported);
+ SetQosSupported (true);
+ }
case WIFI_PHY_STANDARD_80211g:
SetErpSupported (true);
case WIFI_PHY_STANDARD_holland:
--- a/src/wifi/model/regular-wifi-mac.h Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/regular-wifi-mac.h Tue Oct 30 13:42:31 2018 +0100
@@ -138,6 +138,7 @@
*
* \param enable true if RIFS is to be supported,
* false otherwise
+ * \deprecated
*/
void SetRifsSupported (bool enable);
/**
@@ -145,9 +146,9 @@
*
* \return true if short RIFS is supported,
* false otherwise.
+ * \deprecated
*/
bool GetRifsSupported (void) const;
-
/**
* \return the MAC address associated to this MAC layer.
*/
@@ -649,24 +650,6 @@
*/
bool m_qosSupported;
/**
- * This Boolean is set \c true iff this WifiMac is to model
- * 802.11n. It is exposed through the attribute system.
- *
- * At the moment, this flag is the sole selection between HT and
- * non-HT operation for the STA (whether IBSS, AP, or
- * non-AP). Ultimately, we will want a HT-enabled STA to be able to
- * fall back to non-HT operation with a non-HT peer. This'll
- * require further intelligence - i.e., per-association HT
- * state. Having a big switch seems like a good intermediate stage,
- * however.
- */
- bool m_htSupported;
- /**
- * This Boolean is set \c true iff this WifiMac is to model
- * 802.11ac. It is exposed through the attribute system.
- */
- bool m_vhtSupported;
- /**
* This Boolean is set \c true iff this WifiMac is to model
* 802.11g. It is exposed through the attribute system.
*/
@@ -676,11 +659,6 @@
* 802.11b. It is exposed through the attribute system.
*/
bool m_dsssSupported;
- /**
- * This Boolean is set \c true iff this WifiMac is to model
- * 802.11ax. It is exposed through the attribute system.
- */
- bool m_heSupported;
/// Configure aggregation function
void ConfigureAggregation (void);
@@ -703,7 +681,7 @@
TracedCallback<const WifiMacHeader &> m_txErrCallback; ///< transmit error callback
bool m_shortSlotTimeSupported; ///< flag whether short slot time is supported
- bool m_rifsSupported; ///< flag whether RIFS is supported
+ bool m_rifsSupported; ///< flag whether RIFS is supported (deprecated)
};
} //namespace ns3
--- a/src/wifi/model/rraa-wifi-manager.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/rraa-wifi-manager.cc Tue Oct 30 13:42:31 2018 +0100
@@ -105,7 +105,6 @@
return tid;
}
-
RraaWifiManager::RraaWifiManager ()
: WifiRemoteStationManager (),
m_currentRate (0)
@@ -147,6 +146,24 @@
WifiRemoteStationManager::SetupMac (mac);
}
+void
+RraaWifiManager::DoInitialize ()
+{
+ NS_LOG_FUNCTION (this);
+ if (GetHtSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HT rates");
+ }
+ if (GetVhtSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support VHT rates");
+ }
+ if (GetHeSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rates");
+ }
+}
+
Time
RraaWifiManager::GetCalcTxTime (WifiMode mode) const
{
@@ -463,34 +480,4 @@
return true;
}
-void
-RraaWifiManager::SetHtSupported (bool enable)
-{
- //HT is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HT rates");
- }
-}
-
-void
-RraaWifiManager::SetVhtSupported (bool enable)
-{
- //VHT is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support VHT rates");
- }
-}
-
-void
-RraaWifiManager::SetHeSupported (bool enable)
-{
- //HE is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rates");
- }
-}
-
} //namespace ns3
--- a/src/wifi/model/rraa-wifi-manager.h Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/rraa-wifi-manager.h Tue Oct 30 13:42:31 2018 +0100
@@ -70,13 +70,11 @@
// Inherited from WifiRemoteStationManager
virtual void SetupPhy (const Ptr<WifiPhy> phy);
virtual void SetupMac (const Ptr<WifiMac> mac);
- void SetHtSupported (bool enable);
- void SetVhtSupported (bool enable);
- void SetHeSupported (bool enable);
private:
- //overridden from base class
+ // Overridden from base class.
+ void DoInitialize (void);
WifiRemoteStation * DoCreateStation (void) const;
void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
--- a/src/wifi/model/rrpaa-wifi-manager.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/rrpaa-wifi-manager.cc Tue Oct 30 13:42:31 2018 +0100
@@ -176,6 +176,24 @@
WifiRemoteStationManager::SetupMac (mac);
}
+void
+RrpaaWifiManager::DoInitialize ()
+{
+ NS_LOG_FUNCTION (this);
+ if (GetHtSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HT rates");
+ }
+ if (GetVhtSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support VHT rates");
+ }
+ if (GetHeSupported ())
+ {
+ NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rates");
+ }
+}
+
Time
RrpaaWifiManager::GetCalcTxTime (WifiMode mode) const
{
@@ -600,34 +618,4 @@
return true;
}
-void
-RrpaaWifiManager::SetHtSupported (bool enable)
-{
- //HT is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HT rates");
- }
-}
-
-void
-RrpaaWifiManager::SetVhtSupported (bool enable)
-{
- //VHT is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support VHT rates");
- }
-}
-
-void
-RrpaaWifiManager::SetHeSupported (bool enable)
-{
- //HE is not supported by this algorithm.
- if (enable)
- {
- NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rates");
- }
-}
-
} // namespace ns3
--- a/src/wifi/model/rrpaa-wifi-manager.h Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/rrpaa-wifi-manager.h Tue Oct 30 13:42:31 2018 +0100
@@ -82,9 +82,6 @@
// Inherited from WifiRemoteStationManager
virtual void SetupPhy (const Ptr<WifiPhy> phy);
virtual void SetupMac (const Ptr<WifiMac> mac);
- virtual void SetHtSupported (bool enable);
- virtual void SetVhtSupported (bool enable);
- virtual void SetHeSupported (bool enable);
/**
* Assign a fixed random variable stream number to the random variables
@@ -98,7 +95,8 @@
int64_t AssignStreams (int64_t stream);
private:
- //overridden from base class
+ // Overridden from base class.
+ void DoInitialize (void);
virtual WifiRemoteStation * DoCreateStation (void) const;
virtual void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
--- a/src/wifi/model/sta-wifi-mac.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/sta-wifi-mac.cc Tue Oct 30 13:42:31 2018 +0100
@@ -28,6 +28,8 @@
#include "mac-low.h"
#include "mgt-headers.h"
#include "snr-tag.h"
+#include "wifi-net-device.h"
+#include "ht-configuration.h"
namespace ns3 {
@@ -802,7 +804,9 @@
{
m_stationManager->SetUseGreenfieldProtection (false);
}
- if (!GetVhtSupported () && GetRifsSupported () && htOperation.GetRifsMode ())
+ Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
+ Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
+ if (!GetVhtSupported () && htConfiguration && htConfiguration->GetRifsSupported () && htOperation.GetRifsMode ())
{
m_stationManager->SetRifsPermitted (true);
}
@@ -1001,7 +1005,9 @@
{
m_stationManager->SetUseGreenfieldProtection (false);
}
- if (!GetVhtSupported () && GetRifsSupported () && htOperation.GetRifsMode ())
+ Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
+ Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
+ if (!GetVhtSupported () && htConfiguration && htConfiguration->GetRifsSupported () && htOperation.GetRifsMode ())
{
m_stationManager->SetRifsPermitted (true);
}
--- a/src/wifi/model/sta-wifi-mac.h Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/sta-wifi-mac.h Tue Oct 30 13:42:31 2018 +0100
@@ -26,6 +26,9 @@
#include "infrastructure-wifi-mac.h"
#include "mgt-headers.h"
+class TwoLevelAggregationTest;
+class AmpduAggregationTest;
+
namespace ns3 {
class SupportedRates;
@@ -102,6 +105,11 @@
class StaWifiMac : public InfrastructureWifiMac
{
public:
+ /// Allow test cases to access private members
+ friend class ::TwoLevelAggregationTest;
+ /// Allow test cases to access private members
+ friend class ::AmpduAggregationTest;
+
/**
* \brief Get the type ID.
* \return the object TypeId
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/wifi/model/vht-configuration.cc Tue Oct 30 13:42:31 2018 +0100
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2018 Sébastien Deronne
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Sébastien Deronne <sebastien.deronne@gmail.com>
+ */
+
+#include "ns3/log.h"
+#include "vht-configuration.h"
+
+namespace ns3 {
+
+NS_LOG_COMPONENT_DEFINE ("VhtConfiguration");
+
+NS_OBJECT_ENSURE_REGISTERED (VhtConfiguration);
+
+VhtConfiguration::VhtConfiguration ()
+{
+ NS_LOG_FUNCTION (this);
+}
+
+VhtConfiguration::~VhtConfiguration ()
+{
+ NS_LOG_FUNCTION (this);
+}
+
+TypeId
+VhtConfiguration::GetTypeId (void)
+{
+ static ns3::TypeId tid = ns3::TypeId ("ns3::VhtConfiguration")
+ .SetParent<Object> ()
+ .SetGroupName ("Wifi")
+ .AddConstructor<VhtConfiguration> ()
+ ;
+ return tid;
+}
+
+} //namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/wifi/model/vht-configuration.h Tue Oct 30 13:42:31 2018 +0100
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2018 Sébastien Deronne
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Sébastien Deronne <sebastien.deronne@gmail.com>
+ */
+
+#ifndef VHT_CONFIGURATION_H
+#define VHT_CONFIGURATION_H
+
+#include "ns3/object.h"
+
+namespace ns3 {
+
+/**
+ * \brief VHT configuration
+ * \ingroup wifi
+ *
+ * This object stores VHT configuration information, for use in modifying
+ * AP or STA behavior and for constructing VHT-related information elements.
+ *
+ */
+class VhtConfiguration : public Object
+{
+public:
+ VhtConfiguration ();
+ virtual ~VhtConfiguration ();
+
+ static TypeId GetTypeId (void);
+};
+
+} //namespace ns3
+
+#endif /* VHT_CONFIGURATION_H */
--- a/src/wifi/model/wifi-mac.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/wifi-mac.cc Tue Oct 30 13:42:31 2018 +0100
@@ -208,6 +208,24 @@
}
void
+WifiMac::DoDispose ()
+{
+ m_device = 0;
+}
+
+void
+WifiMac::SetDevice (const Ptr<NetDevice> device)
+{
+ m_device = device;
+}
+
+Ptr<NetDevice>
+WifiMac::GetDevice (void) const
+{
+ return m_device;
+}
+
+void
WifiMac::SetMaxPropagationDelay (Time delay)
{
NS_LOG_FUNCTION (this << delay);
--- a/src/wifi/model/wifi-mac.h Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/wifi-mac.h Tue Oct 30 13:42:31 2018 +0100
@@ -21,6 +21,7 @@
#ifndef WIFI_MAC_H
#define WIFI_MAC_H
+#include "ns3/net-device.h"
#include "wifi-phy-standard.h"
#include "wifi-remote-station-manager.h"
#include "qos-utils.h"
@@ -42,6 +43,8 @@
class WifiMac : public Object
{
public:
+ virtual void DoDispose ();
+
/**
* \brief Get the type ID.
* \return the object TypeId
@@ -49,6 +52,19 @@
static TypeId GetTypeId (void);
/**
+ * Sets the device this PHY is associated with.
+ *
+ * \param device the device this PHY is associated with
+ */
+ void SetDevice (const Ptr<NetDevice> device);
+ /**
+ * Return the device this PHY is associated with
+ *
+ * \return the device this PHY is associated with
+ */
+ Ptr<NetDevice> GetDevice (void) const;
+
+ /**
* \param slotTime the slot duration
*/
virtual void SetSlot (Time slotTime) = 0;
@@ -151,10 +167,6 @@
* \return whether the device supports short slot time capability.
*/
virtual bool GetShortSlotTimeSupported (void) const = 0;
- /**
- * \return whether the device supports RIFS capability.
- */
- virtual bool GetRifsSupported (void) const = 0;
/**
* \param packet the packet to send.
@@ -398,6 +410,7 @@
virtual void FinishConfigureStandard (WifiPhyStandard standard) = 0;
Time m_maxPropagationDelay; ///< maximum propagation delay
+ Ptr<NetDevice> m_device; ///< Pointer to the device
/**
* This method sets 802.11a standards-compliant defaults for following attributes:
--- a/src/wifi/model/wifi-net-device.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/wifi-net-device.cc Tue Oct 30 13:42:31 2018 +0100
@@ -27,6 +27,9 @@
#include "wifi-net-device.h"
#include "wifi-phy.h"
#include "wifi-mac.h"
+#include "ht-configuration.h"
+#include "vht-configuration.h"
+#include "he-configuration.h"
namespace ns3 {
@@ -65,6 +68,21 @@
MakePointerAccessor (&WifiNetDevice::SetRemoteStationManager,
&WifiNetDevice::GetRemoteStationManager),
MakePointerChecker<WifiRemoteStationManager> ())
+ .AddAttribute ("HtConfiguration",
+ "The HtConfiguration object.",
+ PointerValue (),
+ MakePointerAccessor (&WifiNetDevice::GetHtConfiguration),
+ MakePointerChecker<HtConfiguration> ())
+ .AddAttribute ("VhtConfiguration",
+ "The VhtConfiguration object.",
+ PointerValue (),
+ MakePointerAccessor (&WifiNetDevice::GetVhtConfiguration),
+ MakePointerChecker<VhtConfiguration> ())
+ .AddAttribute ("HeConfiguration",
+ "The HeConfiguration object.",
+ PointerValue (),
+ MakePointerAccessor (&WifiNetDevice::GetHeConfiguration),
+ MakePointerChecker<HeConfiguration> ())
;
return tid;
}
@@ -394,4 +412,40 @@
return m_mac->SupportsSendFrom ();
}
+void
+WifiNetDevice::SetHtConfiguration (Ptr<HtConfiguration> htConfiguration)
+{
+ m_htConfiguration = htConfiguration;
+}
+
+Ptr<HtConfiguration>
+WifiNetDevice::GetHtConfiguration (void) const
+{
+ return m_htConfiguration;
+}
+
+void
+WifiNetDevice::SetVhtConfiguration (Ptr<VhtConfiguration> vhtConfiguration)
+{
+ m_vhtConfiguration = vhtConfiguration;
+}
+
+Ptr<VhtConfiguration>
+WifiNetDevice::GetVhtConfiguration (void) const
+{
+ return m_vhtConfiguration;
+}
+
+void
+WifiNetDevice::SetHeConfiguration (Ptr<HeConfiguration> heConfiguration)
+{
+ m_heConfiguration = heConfiguration;
+}
+
+Ptr<HeConfiguration>
+WifiNetDevice::GetHeConfiguration (void) const
+{
+ return m_heConfiguration;
+}
+
} //namespace ns3
--- a/src/wifi/model/wifi-net-device.h Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/wifi-net-device.h Tue Oct 30 13:42:31 2018 +0100
@@ -29,6 +29,9 @@
class WifiRemoteStationManager;
class WifiPhy;
class WifiMac;
+class HtConfiguration;
+class VhtConfiguration;
+class HeConfiguration;
/// This value conforms to the 802.11 specification
static const uint16_t MAX_MSDU_SIZE = 2304;
@@ -84,6 +87,31 @@
*/
Ptr<WifiRemoteStationManager> GetRemoteStationManager (void) const;
+ /**
+ * \param htConfiguration pointer to HtConfiguration
+ */
+ void SetHtConfiguration (Ptr<HtConfiguration> htConfiguration);
+ /**
+ * \return pointer to HtConfiguration if it exists
+ */
+ Ptr<HtConfiguration> GetHtConfiguration (void) const;
+ /**
+ * \param vhtConfiguration pointer to VhtConfiguration
+ */
+ void SetVhtConfiguration (Ptr<VhtConfiguration> vhtConfiguration);
+ /**
+ * \return pointer to VhtConfiguration if it exists
+ */
+ Ptr<VhtConfiguration> GetVhtConfiguration (void) const;
+ /**
+ * \param heConfiguration pointer to HeConfiguration
+ */
+ void SetHeConfiguration (Ptr<HeConfiguration> heConfiguration);
+ /**
+ * \return pointer to HeConfiguration if it exists
+ */
+ Ptr<HeConfiguration> GetHeConfiguration (void) const;
+
//inherited from NetDevice base class.
void SetIfIndex (const uint32_t index);
uint32_t GetIfIndex (void) const;
@@ -162,6 +190,9 @@
Ptr<WifiPhy> m_phy; //!< the phy
Ptr<WifiMac> m_mac; //!< the MAC
Ptr<WifiRemoteStationManager> m_stationManager; //!< the station manager
+ Ptr<HtConfiguration> m_htConfiguration; //!< the HtConfiguration
+ Ptr<VhtConfiguration> m_vhtConfiguration; //!< the VhtConfiguration
+ Ptr<HeConfiguration> m_heConfiguration; //!< the HeConfiguration
NetDevice::ReceiveCallback m_forwardUp; //!< forward up callback
NetDevice::PromiscReceiveCallback m_promiscRx; //!< promiscious receive callback
--- a/src/wifi/model/wifi-phy.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/wifi-phy.cc Tue Oct 30 13:42:31 2018 +0100
@@ -31,6 +31,9 @@
#include "frame-capture-model.h"
#include "wifi-radio-energy-model.h"
#include "error-rate-model.h"
+#include "wifi-net-device.h"
+#include "ht-configuration.h"
+#include "he-configuration.h"
namespace ns3 {
@@ -264,33 +267,24 @@
BooleanValue (false),
MakeBooleanAccessor (&WifiPhy::GetShortGuardInterval,
&WifiPhy::SetShortGuardInterval),
- MakeBooleanChecker ())
+ MakeBooleanChecker (),
+ TypeId::DEPRECATED, "Use the HtConfiguration instead")
.AddAttribute ("GuardInterval",
"Whether 800ns, 1600ns or 3200ns guard interval is used for HE transmissions."
"This parameter is only valuable for 802.11ax STAs and APs.",
TimeValue (NanoSeconds (3200)),
MakeTimeAccessor (&WifiPhy::GetGuardInterval,
&WifiPhy::SetGuardInterval),
- MakeTimeChecker (NanoSeconds (400), NanoSeconds (3200)))
- .AddAttribute ("LdpcEnabled",
- "Whether or not LDPC is enabled (not supported yet!).",
- BooleanValue (false),
- MakeBooleanAccessor (&WifiPhy::GetLdpc,
- &WifiPhy::SetLdpc),
- MakeBooleanChecker ())
- .AddAttribute ("STBCEnabled",
- "Whether or not STBC is enabled (not supported yet!).",
- BooleanValue (false),
- MakeBooleanAccessor (&WifiPhy::GetStbc,
- &WifiPhy::SetStbc),
- MakeBooleanChecker ())
+ MakeTimeChecker (NanoSeconds (800), NanoSeconds (3200)),
+ TypeId::DEPRECATED, "Use the HeConfiguration instead")
.AddAttribute ("GreenfieldEnabled",
"Whether or not Greenfield is enabled."
"This parameter is only valuable for 802.11n STAs and APs.",
BooleanValue (false),
MakeBooleanAccessor (&WifiPhy::GetGreenfield,
&WifiPhy::SetGreenfield),
- MakeBooleanChecker ())
+ MakeBooleanChecker (),
+ TypeId::DEPRECATED, "Use the HtConfiguration instead")
.AddAttribute ("ShortPlcpPreambleSupported",
"Whether or not short PLCP preamble is supported."
"This parameter is only valuable for 802.11b STAs and APs."
@@ -568,41 +562,33 @@
}
void
-WifiPhy::SetLdpc (bool ldpc)
-{
- NS_LOG_FUNCTION (this << ldpc);
- m_ldpc = ldpc;
-}
-
-bool
-WifiPhy::GetLdpc (void) const
-{
- return m_ldpc;
-}
-
-void
-WifiPhy::SetStbc (bool stbc)
-{
- NS_LOG_FUNCTION (this << stbc);
- m_stbc = stbc;
-}
-
-bool
-WifiPhy::GetStbc (void) const
-{
- return m_stbc;
-}
-
-void
WifiPhy::SetGreenfield (bool greenfield)
{
NS_LOG_FUNCTION (this << greenfield);
+ Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
+ if (device)
+ {
+ Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
+ if (htConfiguration)
+ {
+ htConfiguration->SetGreenfieldSupported (greenfield);
+ }
+ }
m_greenfield = greenfield;
}
bool
WifiPhy::GetGreenfield (void) const
{
+ Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
+ if (device)
+ {
+ Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
+ if (htConfiguration)
+ {
+ return htConfiguration->GetGreenfieldSupported ();
+ }
+ }
return m_greenfield;
}
@@ -610,12 +596,30 @@
WifiPhy::SetShortGuardInterval (bool shortGuardInterval)
{
NS_LOG_FUNCTION (this << shortGuardInterval);
+ Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
+ if (device)
+ {
+ Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
+ if (htConfiguration)
+ {
+ htConfiguration->SetShortGuardIntervalSupported (shortGuardInterval);
+ }
+ }
m_shortGuardInterval = shortGuardInterval;
}
bool
WifiPhy::GetShortGuardInterval (void) const
{
+ Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
+ if (device)
+ {
+ Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
+ if (htConfiguration)
+ {
+ return htConfiguration->GetShortGuardIntervalSupported ();
+ }
+ }
return m_shortGuardInterval;
}
@@ -624,12 +628,30 @@
{
NS_LOG_FUNCTION (this << guardInterval);
NS_ASSERT (guardInterval == NanoSeconds (800) || guardInterval == NanoSeconds (1600) || guardInterval == NanoSeconds (3200));
+ Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
+ if (device)
+ {
+ Ptr<HeConfiguration> heConfiguration = device->GetHeConfiguration ();
+ if (heConfiguration)
+ {
+ heConfiguration->SetGuardInterval (guardInterval);
+ }
+ }
m_guardInterval = guardInterval;
}
Time
WifiPhy::GetGuardInterval (void) const
{
+ Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
+ if (device)
+ {
+ Ptr<HeConfiguration> heConfiguration = device->GetHeConfiguration ();
+ if (heConfiguration)
+ {
+ return heConfiguration->GetGuardInterval ();
+ }
+ }
return m_guardInterval;
}
@@ -650,6 +672,18 @@
WifiPhy::SetDevice (const Ptr<NetDevice> device)
{
m_device = device;
+ //TODO: to be removed once deprecated API is cleaned up
+ Ptr<HtConfiguration> htConfiguration = DynamicCast<WifiNetDevice> (device)->GetHtConfiguration ();
+ if (htConfiguration)
+ {
+ htConfiguration->SetShortGuardIntervalSupported (m_shortGuardInterval);
+ htConfiguration->SetGreenfieldSupported (m_greenfield);
+ }
+ Ptr<HeConfiguration> heConfiguration = DynamicCast<WifiNetDevice> (device)->GetHeConfiguration ();
+ if (heConfiguration)
+ {
+ heConfiguration->SetGuardInterval (m_guardInterval);
+ }
}
Ptr<NetDevice>
--- a/src/wifi/model/wifi-phy.h Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/wifi-phy.h Tue Oct 30 13:42:31 2018 +0100
@@ -1350,55 +1350,44 @@
* Enable or disable support for HT/VHT short guard interval.
*
* \param shortGuardInterval Enable or disable support for short guard interval
+ *
+ * \deprecated
*/
void SetShortGuardInterval (bool shortGuardInterval);
/**
* Return whether short guard interval is supported.
*
* \return true if short guard interval is supported, false otherwise
+ *
+ * \deprecated
*/
bool GetShortGuardInterval (void) const;
/**
* \param guardInterval the supported HE guard interval
+ *
+ * \deprecated
*/
void SetGuardInterval (Time guardInterval);
/**
* \return the supported HE guard interval
+ *
+ * \deprecated
*/
Time GetGuardInterval (void) const;
/**
- * Enable or disable LDPC.
- * \param ldpc Enable or disable LDPC
- */
- void SetLdpc (bool ldpc);
- /**
- * Return if LDPC is supported.
- *
- * \return true if LDPC is supported, false otherwise
- */
- bool GetLdpc (void) const;
- /**
- * Enable or disable STBC.
- *
- * \param stbc Enable or disable STBC
- */
- void SetStbc (bool stbc);
- /**
- * Return whether STBC is supported.
- *
- * \return true if STBC is supported, false otherwise
- */
- bool GetStbc (void) const;
- /**
* Enable or disable Greenfield support.
*
* \param greenfield Enable or disable Greenfield
+ *
+ * \deprecated
*/
void SetGreenfield (bool greenfield);
/**
* Return whether Greenfield is supported.
*
* \return true if Greenfield is supported, false otherwise
+ *
+ * \deprecated
*/
bool GetGreenfield (void) const;
/**
@@ -1761,13 +1750,11 @@
double m_txPowerEndDbm; //!< Maximum transmission power (dBm)
uint8_t m_nTxPower; //!< Number of available transmission power levels
- bool m_ldpc; //!< Flag if LDPC is used
- bool m_stbc; //!< Flag if STBC is used
- bool m_greenfield; //!< Flag if GreenField format is supported
- bool m_shortGuardInterval; //!< Flag if HT/VHT short guard interval is supported
+ bool m_greenfield; //!< Flag if GreenField format is supported (deprecated)
+ bool m_shortGuardInterval; //!< Flag if HT/VHT short guard interval is supported (deprecated)
bool m_shortPreamble; //!< Flag if short PLCP preamble is supported
- Time m_guardInterval; //!< Supported HE guard interval
+ Time m_guardInterval; //!< Supported HE guard interval (deprecated)
uint8_t m_numberOfAntennas; //!< Number of transmitters
uint8_t m_txSpatialStreams; //!< Number of supported TX spatial streams
--- a/src/wifi/model/wifi-remote-station-manager.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/wifi-remote-station-manager.cc Tue Oct 30 13:42:31 2018 +0100
@@ -22,9 +22,7 @@
#include "ns3/boolean.h"
#include "ns3/uinteger.h"
#include "ns3/enum.h"
-#include "ns3/packet.h"
#include "ns3/simulator.h"
-#include "ns3/tag.h"
#include "wifi-remote-station-manager.h"
#include "wifi-phy.h"
#include "wifi-mac.h"
@@ -34,10 +32,10 @@
#include "ht-capabilities.h"
#include "vht-capabilities.h"
#include "he-capabilities.h"
-
-/***************************************************************
- * Packet Mode Tagger
- ***************************************************************/
+#include "ht-configuration.h"
+#include "vht-configuration.h"
+#include "he-configuration.h"
+#include "wifi-net-device.h"
namespace ns3 {
@@ -403,10 +401,7 @@
}
WifiRemoteStationManager::WifiRemoteStationManager ()
- : m_htSupported (false),
- m_vhtSupported (false),
- m_heSupported (false),
- m_pcfSupported (false),
+ : m_pcfSupported (false),
m_useNonErpProtection (false),
m_useNonHtProtection (false),
m_useGreenfieldProtection (false),
@@ -441,7 +436,7 @@
m_wifiPhy = phy;
m_defaultTxMode = phy->GetMode (0);
NS_ASSERT (m_defaultTxMode.IsMandatory ());
- if (HasHtSupported () || HasVhtSupported () || HasHeSupported ())
+ if (GetHtSupported () || GetVhtSupported () || GetHeSupported ())
{
m_defaultTxMcs = phy->GetMcs (0);
}
@@ -480,13 +475,6 @@
}
void
-WifiRemoteStationManager::SetHtSupported (bool enable)
-{
- NS_LOG_FUNCTION (this << enable);
- m_htSupported = enable;
-}
-
-void
WifiRemoteStationManager::SetFragmentationThreshold (uint32_t threshold)
{
NS_LOG_FUNCTION (this << threshold);
@@ -533,33 +521,39 @@
}
bool
-WifiRemoteStationManager::HasHtSupported (void) const
+WifiRemoteStationManager::GetHtSupported (void) const
{
- return m_htSupported;
-}
-
-void
-WifiRemoteStationManager::SetVhtSupported (bool enable)
-{
- m_vhtSupported = enable;
+ Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ());
+ Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
+ if (htConfiguration)
+ {
+ return true;
+ }
+ return false;
}
bool
-WifiRemoteStationManager::HasVhtSupported (void) const
+WifiRemoteStationManager::GetVhtSupported (void) const
{
- return m_vhtSupported;
-}
-
-void
-WifiRemoteStationManager::SetHeSupported (bool enable)
-{
- m_heSupported = enable;
+ Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ());
+ Ptr<VhtConfiguration> vhtConfiguration = device->GetVhtConfiguration ();
+ if (vhtConfiguration)
+ {
+ return true;
+ }
+ return false;
}
bool
-WifiRemoteStationManager::HasHeSupported (void) const
+WifiRemoteStationManager::GetHeSupported (void) const
{
- return m_heSupported;
+ Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ());
+ Ptr<HeConfiguration> heConfiguration = device->GetHeConfiguration ();
+ if (heConfiguration)
+ {
+ return true;
+ }
+ return false;
}
void
@@ -569,11 +563,57 @@
}
bool
-WifiRemoteStationManager::HasPcfSupported (void) const
+WifiRemoteStationManager::GetPcfSupported (void) const
{
return m_pcfSupported;
}
+bool
+WifiRemoteStationManager::GetGreenfieldSupported (void) const
+{
+ if (GetHtSupported ())
+ {
+ Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ());
+ Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
+ NS_ASSERT (htConfiguration); //If HT is supported, we should have a HT configuration attached
+ if (htConfiguration->GetGreenfieldSupported ())
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool
+WifiRemoteStationManager::GetShortGuardIntervalSupported (void) const
+{
+ if (GetHtSupported ())
+ {
+ Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ());
+ Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
+ NS_ASSERT (htConfiguration); //If HT is supported, we should have a HT configuration attached
+ if (htConfiguration->GetShortGuardIntervalSupported ())
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+uint16_t
+WifiRemoteStationManager::GetGuardInterval (void) const
+{
+ uint16_t gi = 0;
+ if (GetHeSupported ())
+ {
+ Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ());
+ Ptr<HeConfiguration> heConfiguration = device->GetHeConfiguration ();
+ NS_ASSERT (heConfiguration); //If HE is supported, we should have a HE configuration attached
+ gi = static_cast<uint16_t>(heConfiguration->GetGuardInterval ().GetNanoSeconds ());
+ }
+ return gi;
+}
+
uint32_t
WifiRemoteStationManager::GetFragmentationThreshold (void) const
{
@@ -808,11 +848,11 @@
v.SetPreambleType (GetPreambleForTransmission (mode, address));
v.SetTxPowerLevel (m_defaultTxPowerLevel);
v.SetChannelWidth (GetChannelWidthForTransmission (mode, m_wifiPhy->GetChannelWidth ()));
- v.SetGuardInterval (ConvertGuardIntervalToNanoSeconds (mode, m_wifiPhy->GetShortGuardInterval (), m_wifiPhy->GetGuardInterval ()));
+ v.SetGuardInterval (ConvertGuardIntervalToNanoSeconds (mode, DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ())));
v.SetNTx (1);
v.SetNss (1);
v.SetNess (0);
- v.SetStbc (m_wifiPhy->GetStbc ());
+ v.SetStbc (0);
return v;
}
if (!IsLowLatency ())
@@ -838,7 +878,7 @@
txVector.SetMode (mgtMode);
txVector.SetPreambleType (GetPreambleForTransmission (mgtMode, address));
txVector.SetChannelWidth (GetChannelWidthForTransmission (mgtMode, m_wifiPhy->GetChannelWidth ()));
- txVector.SetGuardInterval (ConvertGuardIntervalToNanoSeconds (mgtMode, m_wifiPhy->GetShortGuardInterval (), m_wifiPhy->GetGuardInterval ()));
+ txVector.SetGuardInterval (ConvertGuardIntervalToNanoSeconds (mgtMode, DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ())));
}
return txVector;
}
@@ -883,7 +923,7 @@
return WifiTxVector (defaultMode,
GetDefaultTxPowerLevel (),
defaultPreamble,
- ConvertGuardIntervalToNanoSeconds (defaultMode, m_wifiPhy->GetShortGuardInterval (), m_wifiPhy->GetGuardInterval ()),
+ ConvertGuardIntervalToNanoSeconds (defaultMode, DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ())),
GetNumberOfAntennas (),
GetMaxNumberOfTransmitStreams (),
0,
@@ -1102,7 +1142,7 @@
return false;
}
}
- if (HasHtSupported ())
+ if (GetHtSupported ())
{
//search for the BSS Basic MCS set, if the used mode is in the basic set then there is no need for Cts To Self
for (WifiModeListIterator i = m_bssBasicMcsSet.begin (); i != m_bssBasicMcsSet.end (); i++)
@@ -1364,7 +1404,7 @@
found = true;
}
}
- if (HasHtSupported () || HasVhtSupported () || HasHeSupported ())
+ if (GetHtSupported () || GetVhtSupported () || GetHeSupported ())
{
if (!found)
{
@@ -1433,7 +1473,7 @@
found = true;
}
}
- if (HasHtSupported () || HasVhtSupported () || HasHeSupported ())
+ if (GetHtSupported () || GetVhtSupported () || GetHeSupported ())
{
for (uint8_t idx = 0; idx < m_wifiPhy->GetNMcs (); idx++)
{
@@ -1484,7 +1524,7 @@
v.SetGuardInterval (DoGetCtsTxGuardInterval (address, ctsMode));
v.SetNss (DoGetCtsTxNss (address, ctsMode));
v.SetNess (DoGetCtsTxNess (address, ctsMode));
- v.SetStbc (m_wifiPhy->GetStbc ());
+ v.SetStbc (0);
return v;
}
@@ -1501,7 +1541,7 @@
v.SetGuardInterval (DoGetAckTxGuardInterval (address, ackMode));
v.SetNss (DoGetAckTxNss (address, ackMode));
v.SetNess (DoGetAckTxNess (address, ackMode));
- v.SetStbc (m_wifiPhy->GetStbc ());
+ v.SetStbc (0);
return v;
}
@@ -1518,7 +1558,7 @@
v.SetGuardInterval (DoGetBlockAckTxGuardInterval (address, blockAckMode));
v.SetNss (DoGetBlockAckTxNss (address, blockAckMode));
v.SetNess (DoGetBlockAckTxNess (address, blockAckMode));
- v.SetStbc (m_wifiPhy->GetStbc ());
+ v.SetStbc (0);
return v;
}
@@ -1537,7 +1577,7 @@
uint16_t
WifiRemoteStationManager::DoGetCtsTxGuardInterval (Mac48Address address, WifiMode ctsMode)
{
- return ConvertGuardIntervalToNanoSeconds (ctsMode, m_wifiPhy->GetShortGuardInterval (), m_wifiPhy->GetGuardInterval ());
+ return ConvertGuardIntervalToNanoSeconds (ctsMode, DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ()));
}
uint8_t
@@ -1567,7 +1607,7 @@
uint16_t
WifiRemoteStationManager::DoGetAckTxGuardInterval (Mac48Address address, WifiMode ackMode)
{
- return ConvertGuardIntervalToNanoSeconds (ackMode, m_wifiPhy->GetShortGuardInterval (), m_wifiPhy->GetGuardInterval ());
+ return ConvertGuardIntervalToNanoSeconds (ackMode, DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ()));
}
uint8_t
@@ -1597,7 +1637,7 @@
uint16_t
WifiRemoteStationManager::DoGetBlockAckTxGuardInterval (Mac48Address address, WifiMode blockAckMode)
{
- return ConvertGuardIntervalToNanoSeconds (blockAckMode, m_wifiPhy->GetShortGuardInterval (), m_wifiPhy->GetGuardInterval ());
+ return ConvertGuardIntervalToNanoSeconds (blockAckMode, DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ()));
}
uint8_t
@@ -1643,9 +1683,9 @@
state->m_operationalRateSet.push_back (GetDefaultMode ());
state->m_operationalMcsSet.push_back (GetDefaultMcs ());
state->m_channelWidth = m_wifiPhy->GetChannelWidth ();
- state->m_shortGuardInterval = m_wifiPhy->GetShortGuardInterval ();
- state->m_guardInterval = static_cast<uint16_t> (m_wifiPhy->GetGuardInterval ().GetNanoSeconds ());
- state->m_greenfield = m_wifiPhy->GetGreenfield ();
+ state->m_shortGuardInterval = GetShortGuardIntervalSupported ();
+ state->m_guardInterval = GetGuardInterval ();
+ state->m_greenfield = GetGreenfieldSupported ();
state->m_streams = 1;
state->m_ness = 0;
state->m_aggregation = false;
@@ -2069,7 +2109,7 @@
}
bool
-WifiRemoteStationManager::GetShortGuardInterval (const WifiRemoteStation *station) const
+WifiRemoteStationManager::GetShortGuardIntervalSupported (const WifiRemoteStation *station) const
{
return station->m_state->m_shortGuardInterval;
}
@@ -2174,7 +2214,7 @@
}
bool
-WifiRemoteStationManager::GetShortGuardInterval (Mac48Address address) const
+WifiRemoteStationManager::GetShortGuardIntervalSupported (Mac48Address address) const
{
return LookupState (address)->m_shortGuardInterval;
}
@@ -2240,7 +2280,7 @@
{
preamble = WIFI_PREAMBLE_VHT;
}
- else if (mode.GetModulationClass () == WIFI_MOD_CLASS_HT && m_wifiPhy->GetGreenfield () && GetGreenfieldSupported (dest) && !GetUseGreenfieldProtection ())
+ else if (mode.GetModulationClass () == WIFI_MOD_CLASS_HT && GetGreenfieldSupported () && GetGreenfieldSupported (dest) && !GetUseGreenfieldProtection ())
{
//If protection for greenfield is used we go for HT_MF preamble which is the default protection for GF format defined in the standard.
preamble = WIFI_PREAMBLE_HT_GF;
--- a/src/wifi/model/wifi-remote-station-manager.h Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/wifi-remote-station-manager.h Tue Oct 30 13:42:31 2018 +0100
@@ -191,53 +191,53 @@
*/
void AddStationHeCapabilities (Mac48Address from, HeCapabilities hecapabilities);
/**
- * Enable or disable HT capability support.
- *
- * \param enable enable or disable HT capability support
- */
- virtual void SetHtSupported (bool enable);
- /**
* Return whether the device has HT capability support enabled.
*
* \return true if HT capability support is enabled, false otherwise
*/
- bool HasHtSupported (void) const;
- /**
- * Enable or disable VHT capability support.
- *
- * \param enable enable or disable VHT capability support
- */
- virtual void SetVhtSupported (bool enable);
+ bool GetHtSupported (void) const;
/**
* Return whether the device has VHT capability support enabled.
*
* \return true if VHT capability support is enabled, false otherwise
*/
- bool HasVhtSupported (void) const;
- /**
- * Enable or disable HE capability support.
- *
- * \param enable enable or disable HE capability support
- */
- virtual void SetHeSupported (bool enable);
+ bool GetVhtSupported (void) const;
/**
* Return whether the device has HE capability support enabled.
*
* \return true if HE capability support is enabled, false otherwise
*/
- bool HasHeSupported (void) const;
+ bool GetHeSupported (void) const;
/**
* Enable or disable PCF capability support.
*
* \param enable enable or disable PCF capability support
*/
- virtual void SetPcfSupported (bool enable);
+ void SetPcfSupported (bool enable);
/**
* Return whether the device has PCF capability support enabled.
*
* \return true if PCF capability support is enabled, false otherwise
*/
- bool HasPcfSupported (void) const;
+ bool GetPcfSupported (void) const;
+ /**
+ * Return whether the device has HT Greenfield support enabled.
+ *
+ * \return true if HT Grenfield support is enabled, false otherwise
+ */
+ bool GetGreenfieldSupported (void) const;
+ /**
+ * Return whether the device has SGI support enabled.
+ *
+ * \return true if SGI support is enabled, false otherwise
+ */
+ bool GetShortGuardIntervalSupported (void) const;
+ /**
+ * Return the supported HE guard interval duration (in nanoseconds).
+ *
+ * \return the supported HE guard interval duration (in nanoseconds)
+ */
+ uint16_t GetGuardInterval (void) const;
/**
* Enable or disable protection for non-ERP stations.
*
@@ -450,7 +450,7 @@
* \return true if the station supports HT/VHT short guard interval,
* false otherwise
*/
- bool GetShortGuardInterval (Mac48Address address) const;
+ bool GetShortGuardIntervalSupported (Mac48Address address) const;
/**
* Return the number of spatial streams supported by the station.
*
@@ -993,7 +993,7 @@
* \return true if the station supports HT/VHT short guard interval,
* false otherwise
*/
- bool GetShortGuardInterval (const WifiRemoteStation *station) const;
+ bool GetShortGuardIntervalSupported (const WifiRemoteStation *station) const;
/**
* Return the HE guard interval duration supported by the station.
*
@@ -1438,9 +1438,6 @@
WifiMode m_defaultTxMode; //!< The default transmission mode
WifiMode m_defaultTxMcs; //!< The default transmission modulation-coding scheme (MCS)
- bool m_htSupported; //!< Flag if HT capability is supported
- bool m_vhtSupported; //!< Flag if VHT capability is supported
- bool m_heSupported; //!< Flag if HE capability is supported
bool m_pcfSupported; //!< Flag if PCF capability is supported
uint32_t m_maxSsrc; //!< Maximum STA short retry count (SSRC)
uint32_t m_maxSlrc; //!< Maximum STA long retry count (SLRC)
--- a/src/wifi/model/wifi-utils.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/wifi-utils.cc Tue Oct 30 13:42:31 2018 +0100
@@ -18,12 +18,14 @@
* Author: Sébastien Deronne <sebastien.deronne@gmail.com>
*/
-#include "ns3/packet.h"
#include "ns3/nstime.h"
#include "wifi-utils.h"
#include "ctrl-headers.h"
#include "wifi-mac-header.h"
#include "wifi-mac-trailer.h"
+#include "wifi-net-device.h"
+#include "ht-configuration.h"
+#include "he-configuration.h"
#include "wifi-mode.h"
namespace ns3 {
@@ -65,6 +67,25 @@
}
uint16_t
+ConvertGuardIntervalToNanoSeconds (WifiMode mode, const Ptr<WifiNetDevice> device)
+{
+ uint16_t gi = 800;
+ if (mode.GetModulationClass () == WIFI_MOD_CLASS_HE)
+ {
+ Ptr<HeConfiguration> heConfiguration = device->GetHeConfiguration ();
+ NS_ASSERT (heConfiguration); //If HE modulation is used, we should have a HE configuration attached
+ gi = static_cast<uint16_t> (heConfiguration->GetGuardInterval ().GetNanoSeconds ());
+ }
+ else if (mode.GetModulationClass () == WIFI_MOD_CLASS_HT || mode.GetModulationClass () == WIFI_MOD_CLASS_VHT)
+ {
+ Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
+ NS_ASSERT (htConfiguration); //If HT/VHT modulation is used, we should have a HT configuration attached
+ gi = htConfiguration->GetShortGuardIntervalSupported () ? 400 : 800;
+ }
+ return gi;
+}
+
+uint16_t
ConvertGuardIntervalToNanoSeconds (WifiMode mode, bool htShortGuardInterval, Time heGuardInterval)
{
uint16_t gi;
--- a/src/wifi/model/wifi-utils.h Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/model/wifi-utils.h Tue Oct 30 13:42:31 2018 +0100
@@ -25,6 +25,7 @@
namespace ns3 {
+class WifiNetDevice;
class WifiMacHeader;
class WifiMode;
class Packet;
@@ -76,6 +77,15 @@
* Convert the guard interval to nanoseconds based on the wifimode.
*
* \param mode the wifimode
+ * \param device pointer to the WifiNetDevice object
+ *
+ * \return the guard interval duration in nanoseconds
+ */
+uint16_t ConvertGuardIntervalToNanoSeconds (WifiMode mode, const Ptr<WifiNetDevice> device);
+/**
+ * Convert the guard interval to nanoseconds based on the wifimode.
+ *
+ * \param mode the wifimode
* \param htShortGuardInterval whether HT/VHT short guard interval is enabled
* \param heGuardInterval the HE guard interval duration
*
--- a/src/wifi/test/power-rate-adaptation-test.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/test/power-rate-adaptation-test.cc Tue Oct 30 13:42:31 2018 +0100
@@ -73,7 +73,9 @@
/*
* Create mac layer. We use Adhoc because association is not needed to get supported rates.
*/
+ Ptr<WifiNetDevice> dev = CreateObject<WifiNetDevice> ();
Ptr<AdhocWifiMac> mac = CreateObject<AdhocWifiMac> ();
+ mac->SetDevice (dev);
mac->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
/*
@@ -84,7 +86,6 @@
/*
* Create and configure phy layer.
*/
- Ptr<WifiNetDevice> dev = CreateObject<WifiNetDevice> ();
Ptr<YansWifiPhy> phy = CreateObject<YansWifiPhy> ();
phy->SetChannel (channel);
phy->SetDevice (dev);
--- a/src/wifi/test/wifi-aggregation-test.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/test/wifi-aggregation-test.cc Tue Oct 30 13:42:31 2018 +0100
@@ -22,14 +22,14 @@
#include "ns3/test.h"
#include "ns3/simulator.h"
#include "ns3/wifi-mac-queue.h"
-#include "ns3/mac-low.h"
-#include "ns3/qos-txop.h"
+#include "ns3/sta-wifi-mac.h"
#include "ns3/yans-wifi-phy.h"
#include "ns3/mac-tx-middle.h"
+#include "ns3/mac-low.h"
#include "ns3/msdu-aggregator.h"
#include "ns3/mpdu-aggregator.h"
-#include "ns3/mgt-headers.h"
-#include "ns3/wifi-remote-station-manager.h"
+#include "ns3/wifi-net-device.h"
+#include "ns3/ht-configuration.h"
using namespace ns3;
@@ -46,14 +46,11 @@
private:
virtual void DoRun (void);
- Ptr<MacLow> m_low; ///< MacLow
+ Ptr<WifiNetDevice> m_device; ///<WifiNetDevice
+ Ptr<StaWifiMac> m_mac; ///< Mac
Ptr<YansWifiPhy> m_phy; ///< Phy
- Ptr<QosTxop> m_txop; ///< QosTxop
- Ptr<MacTxMiddle> m_txMiddle; ///< MacTxMiddle
Ptr<WifiRemoteStationManager> m_manager; ///< remote station manager
ObjectFactory m_factory; ///< factory
- Ptr<MpduAggregator> m_mpduAggregator; ///< A-MPDU aggregrator
- Ptr<ChannelAccessManager> m_channelAccessManager; ///< channel access manager
};
AmpduAggregationTest::AmpduAggregationTest ()
@@ -65,10 +62,19 @@
AmpduAggregationTest::DoRun (void)
{
/*
+ * Create device and attach HT configuration.
+ */
+ m_device = CreateObject<WifiNetDevice> ();
+ Ptr<HtConfiguration> htConfiguration = CreateObject<HtConfiguration> ();
+ m_device->SetHtConfiguration (htConfiguration);
+
+ /*
* Create and configure phy layer.
*/
m_phy = CreateObject<YansWifiPhy> ();
+ m_phy->SetDevice (m_device);
m_phy->ConfigureStandard (WIFI_PHY_STANDARD_80211n_5GHZ);
+ m_device->SetPhy (m_phy);
/*
* Create and configure manager.
@@ -78,39 +84,23 @@
m_factory.Set ("DataMode", StringValue ("HtMcs7"));
m_manager = m_factory.Create<WifiRemoteStationManager> ();
m_manager->SetupPhy (m_phy);
- m_manager->SetHtSupported (true);
+ m_device->SetRemoteStationManager (m_manager);
/*
* Create and configure mac layer.
*/
- m_low = CreateObject<MacLow> ();
- m_low->SetPhy (m_phy);
- m_low->SetWifiRemoteStationManager (m_manager);
- m_low->SetAddress (Mac48Address ("00:00:00:00:00:01"));
-
- m_channelAccessManager = CreateObject<ChannelAccessManager> ();
- m_channelAccessManager->SetupLow (m_low);
- m_channelAccessManager->SetupPhyListener (m_phy);
- m_channelAccessManager->SetSlot (MicroSeconds (9));
-
- m_txop = CreateObject<QosTxop> ();
- m_txop->SetMacLow (m_low);
- m_txop->SetAccessCategory (AC_BE);
- m_txop->SetWifiRemoteStationManager (m_manager);
- m_txop->SetChannelAccessManager (m_channelAccessManager);
-
- m_txMiddle = Create<MacTxMiddle> ();
- m_txop->SetTxMiddle (m_txMiddle);
- m_txop->CompleteConfig ();
+ m_mac = CreateObject<StaWifiMac> ();
+ m_mac->SetDevice (m_device);
+ m_mac->SetWifiPhy (m_phy);
+ m_mac->SetWifiRemoteStationManager (m_manager);
+ m_mac->SetAddress (Mac48Address ("00:00:00:00:00:01"));
+ m_mac->ConfigureStandard (WIFI_PHY_STANDARD_80211n_5GHZ);
+ m_device->SetMac (m_mac);
/*
* Configure MPDU aggregation.
*/
- m_factory = ObjectFactory ();
- m_factory.SetTypeId ("ns3::MpduAggregator");
- m_mpduAggregator = m_factory.Create<MpduAggregator> ();
- m_mpduAggregator->SetMaxAmpduSize (65535);
- m_txop->SetMpduAggregator (m_mpduAggregator);
+ m_mac->GetBEQueue ()->GetMpduAggregator ()->SetMaxAmpduSize (65535);
/*
* Create a dummy packet of 1500 bytes and fill mac header fields.
@@ -122,7 +112,7 @@
hdr.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
hdr.SetType (WIFI_MAC_QOSDATA);
hdr.SetQosTid (0);
- uint16_t sequence = m_txMiddle->GetNextSequenceNumberFor (&hdr);
+ uint16_t sequence = m_mac->m_txMiddle->GetNextSequenceNumberFor (&hdr);
hdr.SetSequenceNumber (sequence);
hdr.SetFragmentNumber (0);
hdr.SetNoMoreFragments ();
@@ -137,20 +127,20 @@
reqHdr.SetBufferSize (0);
reqHdr.SetTimeout (0);
reqHdr.SetStartingSequence (0);
- m_txop->m_baManager->CreateAgreement (&reqHdr, hdr.GetAddr1 ());
+ m_mac->GetBEQueue ()->m_baManager->CreateAgreement (&reqHdr, hdr.GetAddr1 ());
//-----------------------------------------------------------------------------------------------------
/*
* Test behavior when no other packets are in the queue
*/
- m_low->m_currentHdr = hdr;
- m_low->m_currentPacket = pkt->Copy ();
- m_low->m_currentTxVector = m_low->GetDataTxVector (m_low->m_currentPacket, &m_low->m_currentHdr);
+ m_mac->GetBEQueue ()->GetLow ()->m_currentHdr = hdr;
+ m_mac->GetBEQueue ()->GetLow ()->m_currentPacket = pkt->Copy ();
+ m_mac->GetBEQueue ()->GetLow ()->m_currentTxVector = m_mac->GetBEQueue ()->GetLow ()->GetDataTxVector (m_mac->GetBEQueue ()->GetLow ()->m_currentPacket, &m_mac->GetBEQueue ()->GetLow ()->m_currentHdr);
- bool isAmpdu = m_low->IsAmpdu (pkt, hdr);
+ bool isAmpdu = m_mac->GetBEQueue ()->GetLow ()->IsAmpdu (pkt, hdr);
NS_TEST_EXPECT_MSG_EQ (isAmpdu, false, "a single packet should not result in an A-MPDU");
- NS_TEST_EXPECT_MSG_EQ (m_low->m_aggregateQueue[0]->GetNPackets (), 0, "aggregation queue is not flushed");
+ NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetLow ()->m_aggregateQueue[0]->GetNPackets (), 0, "aggregation queue is not flushed");
//-----------------------------------------------------------------------------------------------------
@@ -171,22 +161,22 @@
hdr2.SetType (WIFI_MAC_QOSDATA);
hdr2.SetQosTid (0);
- m_txop->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt1, hdr1));
- m_txop->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt2, hdr2));
+ m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt1, hdr1));
+ m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt2, hdr2));
- isAmpdu = m_low->IsAmpdu (pkt, hdr);
- uint32_t aggregationQueueSize = m_low->m_aggregateQueue[0]->GetNPackets ();
+ isAmpdu = m_mac->GetBEQueue ()->GetLow ()->IsAmpdu (pkt, hdr);
+ uint32_t aggregationQueueSize = m_mac->GetBEQueue ()->GetLow ()->m_aggregateQueue[0]->GetNPackets ();
NS_TEST_EXPECT_MSG_EQ (isAmpdu, true, "MPDU aggregation failed");
- NS_TEST_EXPECT_MSG_EQ (m_low->m_currentPacket->GetSize (), 4606, "A-MPDU size is not correct");
+ NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetLow ()->m_currentPacket->GetSize (), 4606, "A-MPDU size is not correct");
NS_TEST_EXPECT_MSG_EQ (aggregationQueueSize, 3, "aggregation queue should not be empty");
- NS_TEST_EXPECT_MSG_EQ (m_txop->GetWifiMacQueue ()->GetNPackets (), 0, "queue should be empty");
+ NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetWifiMacQueue ()->GetNPackets (), 0, "queue should be empty");
Ptr <WifiMacQueueItem> dequeuedItem;
WifiMacHeader dequeuedHdr;
uint32_t i = 0;
for (; aggregationQueueSize > 0; aggregationQueueSize--, i++)
{
- dequeuedItem = m_low->m_aggregateQueue[0]->Dequeue ();
+ dequeuedItem = m_mac->GetBEQueue ()->GetLow ()->m_aggregateQueue[0]->Dequeue ();
dequeuedHdr = dequeuedItem->GetHeader ();
NS_TEST_EXPECT_MSG_EQ (dequeuedHdr.GetSequenceNumber (), i, "wrong sequence number");
}
@@ -219,36 +209,33 @@
hdr3.SetType (WIFI_MAC_DATA);
hdr3.SetQosTid (0);
- m_txop->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt3, hdr3));
+ m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt3, hdr3));
- isAmpdu = m_low->IsAmpdu (pkt1, hdr1);
+ isAmpdu = m_mac->GetBEQueue ()->GetLow ()->IsAmpdu (pkt1, hdr1);
NS_TEST_EXPECT_MSG_EQ (isAmpdu, false, "a single packet for this destination should not result in an A-MPDU");
- NS_TEST_EXPECT_MSG_EQ (m_low->m_aggregateQueue[0]->GetNPackets (), 0, "aggregation queue is not flushed");
+ NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetLow ()->m_aggregateQueue[0]->GetNPackets (), 0, "aggregation queue is not flushed");
- m_txop->m_currentHdr = hdr2;
- m_txop->m_currentPacket = pkt2->Copy ();
- isAmpdu = m_low->IsAmpdu (pkt2, hdr2);
+ m_mac->GetBEQueue ()->m_currentHdr = hdr2;
+ m_mac->GetBEQueue ()->m_currentPacket = pkt2->Copy ();
+ isAmpdu = m_mac->GetBEQueue ()->GetLow ()->IsAmpdu (pkt2, hdr2);
NS_TEST_EXPECT_MSG_EQ (isAmpdu, false, "no MPDU aggregation should be performed if there is no agreement");
- NS_TEST_EXPECT_MSG_EQ (m_low->m_aggregateQueue[0]->GetNPackets (), 0, "aggregation queue is not flushed");
+ NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetLow ()->m_aggregateQueue[0]->GetNPackets (), 0, "aggregation queue is not flushed");
m_manager->SetMaxSsrc (0); //set to 0 in order to fake that the maximum number of retries has been reached
- m_txop->MissedAck ();
+ m_mac->GetBEQueue ()->MissedAck ();
- NS_TEST_EXPECT_MSG_EQ (m_txop->m_currentPacket, 0, "packet should be discarded");
- m_txop->GetWifiMacQueue ()->Remove (pkt3);
+ NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->m_currentPacket, 0, "packet should be discarded");
+ m_mac->GetBEQueue ()->GetWifiMacQueue ()->Remove (pkt3);
Simulator::Destroy ();
- m_txMiddle = 0;
-
- m_low->Dispose ();
- m_low = 0;
+ m_manager->Dispose ();
+ m_manager = 0;
- m_txop->Dispose ();
- m_txop = 0;
+ m_device->Dispose ();
+ m_device = 0;
- m_channelAccessManager->Dispose ();
- m_channelAccessManager = 0;
+ htConfiguration = 0;
}
/**
@@ -264,13 +251,11 @@
private:
virtual void DoRun (void);
- Ptr<MacLow> m_low; ///< MacLow
+ Ptr<WifiNetDevice> m_device; ///<WifiNetDevice
+ Ptr<StaWifiMac> m_mac; ///< Mac
Ptr<YansWifiPhy> m_phy; ///< Phy
- Ptr<QosTxop> m_txop; ///< QosTxop
Ptr<WifiRemoteStationManager> m_manager; ///< remote station manager
ObjectFactory m_factory; ///< factory
- Ptr<MsduAggregator> m_msduAggregator; ///< A-MSDU aggregator
- Ptr<MpduAggregator> m_mpduAggregator; ///< A-MPDU aggregator
};
TwoLevelAggregationTest::TwoLevelAggregationTest ()
@@ -282,10 +267,19 @@
TwoLevelAggregationTest::DoRun (void)
{
/*
+ * Create device and attach HT configuration.
+ */
+ m_device = CreateObject<WifiNetDevice> ();
+ Ptr<HtConfiguration> htConfiguration = CreateObject<HtConfiguration> ();
+ m_device->SetHtConfiguration (htConfiguration);
+
+ /*
* Create and configure phy layer.
*/
m_phy = CreateObject<YansWifiPhy> ();
+ m_phy->SetDevice (m_device);
m_phy->ConfigureStandard (WIFI_PHY_STANDARD_80211n_5GHZ);
+ m_device->SetPhy (m_phy);
/*
* Create and configure manager.
@@ -295,31 +289,24 @@
m_factory.Set ("DataMode", StringValue ("HtMcs7"));
m_manager = m_factory.Create<WifiRemoteStationManager> ();
m_manager->SetupPhy (m_phy);
+ m_device->SetRemoteStationManager (m_manager);
/*
- * Create and configure maclayer.
+ * Create and configure mac layer.
*/
- m_low = CreateObject<MacLow> ();
- m_low->SetPhy (m_phy);
- m_low->SetWifiRemoteStationManager (m_manager);
-
- m_txop = CreateObject<QosTxop> ();
- m_txop->SetMacLow (m_low);
- m_txop->SetAccessCategory (AC_BE);
- m_txop->SetWifiRemoteStationManager (m_manager);
- m_txop->CompleteConfig ();
+ m_mac = CreateObject<StaWifiMac> ();
+ m_mac->SetDevice (m_device);
+ m_mac->SetWifiPhy (m_phy);
+ m_mac->SetWifiRemoteStationManager (m_manager);
+ m_mac->SetAddress (Mac48Address ("00:00:00:00:00:01"));
+ m_mac->ConfigureStandard (WIFI_PHY_STANDARD_80211n_5GHZ);
+ m_device->SetMac (m_mac);
/*
* Configure aggregation.
*/
- m_msduAggregator = CreateObject<MsduAggregator> ();
- m_mpduAggregator = CreateObject<MpduAggregator> ();
-
- m_msduAggregator->SetMaxAmsduSize (4095);
- m_mpduAggregator->SetMaxAmpduSize (65535);
-
- m_txop->SetMsduAggregator (m_msduAggregator);
- m_txop->SetMpduAggregator (m_mpduAggregator);
+ m_mac->GetBEQueue ()->GetMsduAggregator ()->SetMaxAmsduSize (4095);
+ m_mac->GetBEQueue ()->GetMpduAggregator ()->SetMaxAmpduSize (65535);
/*
* Create dummy packets of 1500 bytes and fill mac header fields that will be used for the tests.
@@ -342,23 +329,23 @@
* - A-MSDU frame size should be 3030 bytes (= 2 packets + headers + padding);
* - one packet should be removed from the queue (the other packet is removed later in MacLow::AggregateToAmpdu) .
*/
- m_txop->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt, hdr));
- m_txop->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt, hdr));
+ m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt, hdr));
+ m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt, hdr));
- Ptr<const WifiMacQueueItem> peekedItem = m_txop->GetWifiMacQueue ()->PeekByTidAndAddress (0, hdr.GetAddr1 ());
+ Ptr<const WifiMacQueueItem> peekedItem = m_mac->GetBEQueue ()->GetWifiMacQueue ()->PeekByTidAndAddress (0, hdr.GetAddr1 ());
Ptr<const Packet> peekedPacket = peekedItem->GetPacket ();
peekedHdr = peekedItem->GetHeader ();
tstamp = peekedItem->GetTimeStamp ();
- m_low->m_currentPacket = peekedPacket->Copy ();
- m_low->m_currentHdr = peekedHdr;
- m_low->m_currentTxVector = m_low->GetDataTxVector (m_low->m_currentPacket, &m_low->m_currentHdr);
+ m_mac->GetBEQueue ()->GetLow ()->m_currentPacket = peekedPacket->Copy ();
+ m_mac->GetBEQueue ()->GetLow ()->m_currentHdr = peekedHdr;
+ m_mac->GetBEQueue ()->GetLow ()->m_currentTxVector = m_mac->GetBEQueue ()->GetLow ()->GetDataTxVector (m_mac->GetBEQueue ()->GetLow ()->m_currentPacket, &m_mac->GetBEQueue ()->GetLow ()->m_currentHdr);
- Ptr<Packet> packet = m_low->PerformMsduAggregation (peekedPacket, &peekedHdr, &tstamp, currentAggregatedPacket, 0);
+ Ptr<Packet> packet = m_mac->GetBEQueue ()->GetLow ()->PerformMsduAggregation (peekedPacket, &peekedHdr, &tstamp, currentAggregatedPacket, 0);
bool result = (packet != 0);
NS_TEST_EXPECT_MSG_EQ (result, true, "aggregation failed");
NS_TEST_EXPECT_MSG_EQ (packet->GetSize (), 3030, "wrong packet size");
- NS_TEST_EXPECT_MSG_EQ (m_txop->GetWifiMacQueue ()->GetNPackets (), 0, "aggregated packets not removed from the queue");
+ NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetWifiMacQueue ()->GetNPackets (), 0, "aggregated packets not removed from the queue");
//-----------------------------------------------------------------------------------------------------
@@ -367,14 +354,10 @@
* It checks whether MSDU aggregation has been rejected because the maximum MPDU size is set to 0 (returned packet should be equal to 0).
* This test is needed to ensure that no packets are removed from the queue in MacLow::PerformMsduAggregation, since aggregation will no occur in MacLow::AggregateToAmpdu.
*/
- m_factory = ObjectFactory ();
- m_factory.SetTypeId ("ns3::MpduAggregator");
- m_mpduAggregator = m_factory.Create<MpduAggregator> ();
- m_mpduAggregator->SetMaxAmpduSize (65535);
- m_txop->SetMpduAggregator (m_mpduAggregator);
+ m_mac->GetBEQueue ()->GetMpduAggregator ()->SetMaxAmpduSize (65535);
- m_txop->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt, hdr));
- packet = m_low->PerformMsduAggregation (peekedPacket, &peekedHdr, &tstamp, currentAggregatedPacket, 0);
+ m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt, hdr));
+ packet = m_mac->GetBEQueue ()->GetLow ()->PerformMsduAggregation (peekedPacket, &peekedHdr, &tstamp, currentAggregatedPacket, 0);
result = (packet != 0);
NS_TEST_EXPECT_MSG_EQ (result, false, "maximum aggregated frame size check failed");
@@ -386,25 +369,21 @@
* It checks whether MSDU aggregation has been rejected because there is no packets ready in the queue (returned packet should be equal to 0).
* This test is needed to ensure that there is no issue when the queue is empty.
*/
- m_mpduAggregator->SetMaxAmpduSize (4095);
+ m_mac->GetBEQueue ()->GetMpduAggregator ()->SetMaxAmpduSize (4095);
- m_txop->GetWifiMacQueue ()->Remove (pkt);
- m_txop->GetWifiMacQueue ()->Remove (pkt);
- packet = m_low->PerformMsduAggregation (peekedPacket, &peekedHdr, &tstamp, currentAggregatedPacket, 0);
+ m_mac->GetBEQueue ()->GetWifiMacQueue ()->Remove (pkt);
+ m_mac->GetBEQueue ()->GetWifiMacQueue ()->Remove (pkt);
+ packet = m_mac->GetBEQueue ()->GetLow ()->PerformMsduAggregation (peekedPacket, &peekedHdr, &tstamp, currentAggregatedPacket, 0);
result = (packet != 0);
NS_TEST_EXPECT_MSG_EQ (result, false, "aggregation failed to stop as queue is empty");
Simulator::Destroy ();
- m_low->Dispose ();
- m_low = 0;
-
- m_txop->Dispose ();
- m_txop = 0;
+ m_device = 0;
+ htConfiguration = 0;
}
-
/**
* \ingroup wifi-test
* \ingroup tests
--- a/src/wifi/test/wifi-test.cc Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/test/wifi-test.cc Tue Oct 30 13:42:31 2018 +0100
@@ -43,6 +43,7 @@
#include "ns3/wifi-phy-tag.h"
#include "ns3/yans-wifi-phy.h"
#include "ns3/mgt-headers.h"
+#include "ns3/ht-configuration.h"
using namespace ns3;
@@ -131,6 +132,7 @@
Ptr<WifiNetDevice> dev = CreateObject<WifiNetDevice> ();
Ptr<WifiMac> mac = m_mac.Create<WifiMac> ();
+ mac->SetDevice (dev);
mac->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
Ptr<ConstantPositionMobilityModel> mobility = CreateObject<ConstantPositionMobilityModel> ();
Ptr<YansWifiPhy> phy = CreateObject<YansWifiPhy> ();
@@ -298,6 +300,7 @@
Ptr<WifiNetDevice> dev = CreateObject<WifiNetDevice> ();
Ptr<WifiMac> mac = m_mac.Create<WifiMac> ();
+ mac->SetDevice (dev);
mac->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
Ptr<ConstantPositionMobilityModel> mobility = CreateObject<ConstantPositionMobilityModel> ();
Ptr<YansWifiPhy> phy = CreateObject<YansWifiPhy> ();
@@ -492,6 +495,7 @@
Ptr<Node> txNode = CreateObject<Node> ();
Ptr<WifiNetDevice> txDev = CreateObject<WifiNetDevice> ();
Ptr<WifiMac> txMac = m_mac.Create<WifiMac> ();
+ txMac->SetDevice (txDev);
txMac->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
//Fix the stream assignment to the Dcf Txop objects (backoffs)
//The below stream assignment will result in the Txop object
@@ -1447,16 +1451,22 @@
Ptr<Node> apNode = CreateObject<Node> ();
Ptr<WifiNetDevice> apDev = CreateObject<WifiNetDevice> ();
+ Ptr<HtConfiguration> apHtConfiguration = CreateObject<HtConfiguration> ();
+ apDev->SetHtConfiguration (apHtConfiguration);
ObjectFactory mac;
mac.SetTypeId ("ns3::ApWifiMac");
mac.Set ("EnableBeaconJitter", BooleanValue (false));
Ptr<WifiMac> apMac = mac.Create<WifiMac> ();
+ apMac->SetDevice (apDev);
apMac->ConfigureStandard (WIFI_PHY_STANDARD_80211ax_5GHZ);
Ptr<Node> staNode = CreateObject<Node> ();
Ptr<WifiNetDevice> staDev = CreateObject<WifiNetDevice> ();
+ Ptr<HtConfiguration> staHtConfiguration = CreateObject<HtConfiguration> ();
+ staDev->SetHtConfiguration (staHtConfiguration);
mac.SetTypeId ("ns3::StaWifiMac");
Ptr<WifiMac> staMac = mac.Create<WifiMac> ();
+ staMac->SetDevice (staDev);
staMac->ConfigureStandard (WIFI_PHY_STANDARD_80211ax_5GHZ);
Ptr<ConstantPositionMobilityModel> apMobility = CreateObject<ConstantPositionMobilityModel> ();
--- a/src/wifi/wscript Mon Oct 29 16:00:09 2018 +0300
+++ b/src/wifi/wscript Tue Oct 30 13:42:31 2018 +0100
@@ -84,9 +84,12 @@
'model/frame-capture-model.cc',
'model/simple-frame-capture-model.cc',
'model/he-operation.cc',
+ 'model/he-configuration.cc',
'model/extended-capabilities.cc',
'model/cf-parameter-set.cc',
'model/wifi-mac-queue-item.cc',
+ 'model/ht-configuration.cc',
+ 'model/vht-configuration.cc',
'helper/wifi-radio-energy-model-helper.cc',
'helper/athstats-helper.cc',
'helper/wifi-helper.cc',
@@ -194,6 +197,7 @@
'model/simple-frame-capture-model.h',
'model/qos-blocked-destinations.h',
'model/he-operation.h',
+ 'model/he-configuration.h',
'model/extended-capabilities.h',
'model/cf-parameter-set.h',
'model/wifi-mac-queue-item.h',
@@ -201,6 +205,8 @@
'model/wifi-phy-listener.h',
'model/block-ack-type.h',
'model/wifi-mpdu-type.h',
+ 'model/ht-configuration.h',
+ 'model/vht-configuration.h',
'helper/wifi-radio-energy-model-helper.h',
'helper/athstats-helper.h',
'helper/wifi-helper.h',