wifi: RegularWifiMac::QosSupported attribute must be properly set

We don't override it later (when setting the standard) anymore
This commit is contained in:
Stefano Avallone
2021-10-12 12:15:30 +02:00
parent f25866e922
commit 8e1c5525ab
6 changed files with 21 additions and 11 deletions

View File

@@ -186,7 +186,10 @@ MeshHelper::CreateInterface (const WifiPhyHelper &phyHelper, Ptr<Node> node, uin
return device;
}
Ptr<MeshWifiInterfaceMac> mac = m_mac.Create<MeshWifiInterfaceMac> ();
// this is a const method, but we need to force the correct QoS setting
ObjectFactory macObjectFactory = m_mac;
macObjectFactory.Set ("QosSupported", BooleanValue (true)); // a mesh station is a QoS station
Ptr<MeshWifiInterfaceMac> mac = macObjectFactory.Create<MeshWifiInterfaceMac> ();
NS_ASSERT (mac != 0);
mac->SetSsid (Ssid ());
mac->SetDevice (device);

View File

@@ -540,7 +540,7 @@ MeshWifiInterfaceMac::ResetStats ()
void
MeshWifiInterfaceMac::ConfigureStandard (enum WifiStandard standard)
{
SetQosSupported (true); // a mesh station is a QoS station
NS_ABORT_IF (!GetQosSupported ());
RegularWifiMac::ConfigureStandard (standard);
m_standard = standard;

View File

@@ -30,9 +30,8 @@ namespace ns3 {
WifiMacHelper::WifiMacHelper ()
{
//By default, we create an AdHoc MAC layer without QoS.
SetType ("ns3::AdhocWifiMac",
"QosSupported", BooleanValue (false));
//By default, we create an AdHoc MAC layer (without QoS).
SetType ("ns3::AdhocWifiMac");
m_protectionManager.SetTypeId ("ns3::WifiDefaultProtectionManager");
m_ackManager.SetTypeId ("ns3::WifiDefaultAckManager");
@@ -48,7 +47,14 @@ WifiMacHelper::Create (Ptr<NetDevice> device, WifiStandard standard) const
auto standardIt = wifiStandards.find (standard);
NS_ABORT_MSG_IF (standardIt == wifiStandards.end (), "Selected standard is not defined!");
Ptr<WifiMac> mac = m_mac.Create<WifiMac> ();
// this is a const method, but we need to force the correct QoS setting
ObjectFactory macObjectFactory = m_mac;
if (standard >= WIFI_STANDARD_80211n_2_4GHZ)
{
macObjectFactory.Set ("QosSupported", BooleanValue (true));
}
Ptr<WifiMac> mac = macObjectFactory.Create<WifiMac> ();
mac->SetDevice (device);
mac->SetAddress (Mac48Address::Allocate ());
mac->ConfigureStandard (standard);

View File

@@ -1115,7 +1115,7 @@ RegularWifiMac::ConfigureStandard (WifiStandard standard)
case WIFI_STANDARD_80211ax_5GHZ:
case WIFI_STANDARD_80211ax_6GHZ:
{
SetQosSupported (true);
NS_ABORT_IF (!m_qosSupported);
cwmin = 15;
cwmax = 1023;
break;
@@ -1123,7 +1123,7 @@ RegularWifiMac::ConfigureStandard (WifiStandard standard)
case WIFI_STANDARD_80211ax_2_4GHZ:
case WIFI_STANDARD_80211n_2_4GHZ:
{
SetQosSupported (true);
NS_ABORT_IF (!m_qosSupported);
}
case WIFI_STANDARD_80211g:
SetErpSupported (true);

View File

@@ -119,7 +119,7 @@ AmpduAggregationTest::DoRun (void)
/*
* Create and configure mac layer.
*/
m_mac = CreateObject<StaWifiMac> ();
m_mac = CreateObjectWithAttributes<StaWifiMac> ("QosSupported", BooleanValue (true));
m_mac->SetDevice (m_device);
m_mac->SetWifiRemoteStationManager (m_manager);
m_mac->SetAddress (Mac48Address ("00:00:00:00:00:01"));
@@ -370,7 +370,7 @@ TwoLevelAggregationTest::DoRun (void)
/*
* Create and configure mac layer.
*/
m_mac = CreateObject<StaWifiMac> ();
m_mac = CreateObjectWithAttributes<StaWifiMac> ("QosSupported", BooleanValue (true));
m_mac->SetDevice (m_device);
m_mac->SetWifiRemoteStationManager (m_manager);
m_mac->SetAddress (Mac48Address ("00:00:00:00:00:01"));
@@ -605,7 +605,7 @@ HeAggregationTest::DoRunSubTest (uint16_t bufferSize)
/*
* Create and configure mac layer.
*/
m_mac = CreateObject<StaWifiMac> ();
m_mac = CreateObjectWithAttributes<StaWifiMac> ("QosSupported", BooleanValue (true));
m_mac->SetDevice (m_device);
m_mac->SetWifiRemoteStationManager (m_manager);
m_mac->SetAddress (Mac48Address ("00:00:00:00:00:01"));

View File

@@ -1723,6 +1723,7 @@ Bug2831TestCase::DoRun (void)
ObjectFactory mac;
mac.SetTypeId ("ns3::ApWifiMac");
mac.Set ("EnableBeaconJitter", BooleanValue (false));
mac.Set ("QosSupported", BooleanValue (true));
Ptr<RegularWifiMac> apMac = mac.Create<RegularWifiMac> ();
apMac->SetDevice (apDev);
apMac->SetAddress (Mac48Address::Allocate ());