diff --git a/src/mesh/helper/mesh-helper.cc b/src/mesh/helper/mesh-helper.cc index 17914f88c..74a60abd6 100644 --- a/src/mesh/helper/mesh-helper.cc +++ b/src/mesh/helper/mesh-helper.cc @@ -186,7 +186,10 @@ MeshHelper::CreateInterface (const WifiPhyHelper &phyHelper, Ptr node, uin return device; } - Ptr mac = m_mac.Create (); + // 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 mac = macObjectFactory.Create (); NS_ASSERT (mac != 0); mac->SetSsid (Ssid ()); mac->SetDevice (device); diff --git a/src/mesh/model/mesh-wifi-interface-mac.cc b/src/mesh/model/mesh-wifi-interface-mac.cc index d4d996415..bbd92af0c 100644 --- a/src/mesh/model/mesh-wifi-interface-mac.cc +++ b/src/mesh/model/mesh-wifi-interface-mac.cc @@ -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; diff --git a/src/wifi/helper/wifi-mac-helper.cc b/src/wifi/helper/wifi-mac-helper.cc index 9a055e0ff..a26862cc7 100644 --- a/src/wifi/helper/wifi-mac-helper.cc +++ b/src/wifi/helper/wifi-mac-helper.cc @@ -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 device, WifiStandard standard) const auto standardIt = wifiStandards.find (standard); NS_ABORT_MSG_IF (standardIt == wifiStandards.end (), "Selected standard is not defined!"); - Ptr mac = m_mac.Create (); + // 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 mac = macObjectFactory.Create (); mac->SetDevice (device); mac->SetAddress (Mac48Address::Allocate ()); mac->ConfigureStandard (standard); diff --git a/src/wifi/model/regular-wifi-mac.cc b/src/wifi/model/regular-wifi-mac.cc index 58375f5d3..c63d973bb 100644 --- a/src/wifi/model/regular-wifi-mac.cc +++ b/src/wifi/model/regular-wifi-mac.cc @@ -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); diff --git a/src/wifi/test/wifi-aggregation-test.cc b/src/wifi/test/wifi-aggregation-test.cc index bddb979ca..378266439 100644 --- a/src/wifi/test/wifi-aggregation-test.cc +++ b/src/wifi/test/wifi-aggregation-test.cc @@ -119,7 +119,7 @@ AmpduAggregationTest::DoRun (void) /* * Create and configure mac layer. */ - m_mac = CreateObject (); + m_mac = CreateObjectWithAttributes ("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 (); + m_mac = CreateObjectWithAttributes ("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 (); + m_mac = CreateObjectWithAttributes ("QosSupported", BooleanValue (true)); m_mac->SetDevice (m_device); m_mac->SetWifiRemoteStationManager (m_manager); m_mac->SetAddress (Mac48Address ("00:00:00:00:00:01")); diff --git a/src/wifi/test/wifi-test.cc b/src/wifi/test/wifi-test.cc index efae16596..57d2cbe50 100644 --- a/src/wifi/test/wifi-test.cc +++ b/src/wifi/test/wifi-test.cc @@ -1723,6 +1723,7 @@ Bug2831TestCase::DoRun (void) ObjectFactory mac; mac.SetTypeId ("ns3::ApWifiMac"); mac.Set ("EnableBeaconJitter", BooleanValue (false)); + mac.Set ("QosSupported", BooleanValue (true)); Ptr apMac = mac.Create (); apMac->SetDevice (apDev); apMac->SetAddress (Mac48Address::Allocate ());