diff --git a/examples/wireless/wifi-txop-aggregation.cc b/examples/wireless/wifi-txop-aggregation.cc index beb15628b..6957eac99 100644 --- a/examples/wireless/wifi-txop-aggregation.cc +++ b/examples/wireless/wifi-txop-aggregation.cc @@ -173,6 +173,8 @@ main(int argc, char* argv[]) SsidValue(ssid), "EnableBeaconJitter", BooleanValue(false)); + // Modify EDCA configuration (TXOP limit) for AC_BE + mac.SetEdca(AC_BE, "TxopLimits", StringValue(std::to_string(txopLimit) + "us")); apDeviceA = wifi.Install(phy, mac, wifiApNodes.Get(0)); // Modify EDCA configuration (TXOP limit) for AC_BE @@ -182,7 +184,6 @@ main(int argc, char* argv[]) Ptr edca; wifi_dev->GetMac()->GetAttribute("BE_Txop", ptr); edca = ptr.Get(); - edca->SetTxopLimit(MicroSeconds(txopLimit)); // Trace TXOP duration for BE on AP A TxopDurationTracer netA; @@ -205,6 +206,8 @@ main(int argc, char* argv[]) SsidValue(ssid), "EnableBeaconJitter", BooleanValue(false)); + // Modify EDCA configuration (TXOP limit) for AC_BE + mac.SetEdca(AC_BE, "TxopLimits", StringValue(std::to_string(txopLimit) + "us")); apDeviceB = wifi.Install(phy, mac, wifiApNodes.Get(1)); // Disable A-MPDU @@ -212,10 +215,8 @@ main(int argc, char* argv[]) wifi_dev = DynamicCast(dev); wifi_dev->GetMac()->SetAttribute("BE_MaxAmpduSize", UintegerValue(0)); - // Modify EDCA configuration (TXOP limit) for AC_BE wifi_dev->GetMac()->GetAttribute("BE_Txop", ptr); edca = ptr.Get(); - edca->SetTxopLimit(MicroSeconds(txopLimit)); // Trace TXOP duration for BE on AP B TxopDurationTracer netB; @@ -240,6 +241,8 @@ main(int argc, char* argv[]) SsidValue(ssid), "EnableBeaconJitter", BooleanValue(false)); + // Modify EDCA configuration (TXOP limit) for AC_BE + mac.SetEdca(AC_BE, "TxopLimits", StringValue(std::to_string(txopLimit) + "us")); apDeviceC = wifi.Install(phy, mac, wifiApNodes.Get(2)); // Disable A-MPDU and enable A-MSDU with the highest maximum size allowed by the standard (7935 @@ -249,10 +252,8 @@ main(int argc, char* argv[]) wifi_dev->GetMac()->SetAttribute("BE_MaxAmpduSize", UintegerValue(0)); wifi_dev->GetMac()->SetAttribute("BE_MaxAmsduSize", UintegerValue(7935)); - // Modify EDCA configuration (TXOP limit) for AC_BE wifi_dev->GetMac()->GetAttribute("BE_Txop", ptr); edca = ptr.Get(); - edca->SetTxopLimit(MicroSeconds(txopLimit)); // Trace TXOP duration for BE on AP C TxopDurationTracer netC; @@ -277,6 +278,8 @@ main(int argc, char* argv[]) SsidValue(ssid), "EnableBeaconJitter", BooleanValue(false)); + // Modify EDCA configuration (TXOP limit) for AC_BE + mac.SetEdca(AC_BE, "TxopLimits", StringValue(std::to_string(txopLimit) + "us")); apDeviceD = wifi.Install(phy, mac, wifiApNodes.Get(3)); // Enable A-MPDU with a smaller size than the default one and @@ -286,10 +289,8 @@ main(int argc, char* argv[]) wifi_dev->GetMac()->SetAttribute("BE_MaxAmpduSize", UintegerValue(32768)); wifi_dev->GetMac()->SetAttribute("BE_MaxAmsduSize", UintegerValue(3839)); - // Modify EDCA configuration (TXOP limit) for AC_BE wifi_dev->GetMac()->GetAttribute("BE_Txop", ptr); edca = ptr.Get(); - edca->SetTxopLimit(MicroSeconds(txopLimit)); // Trace TXOP duration for BE on AP D TxopDurationTracer netD; diff --git a/src/wifi/test/block-ack-test-suite.cc b/src/wifi/test/block-ack-test-suite.cc index 0138f641c..e06802cf2 100644 --- a/src/wifi/test/block-ack-test-suite.cc +++ b/src/wifi/test/block-ack-test-suite.cc @@ -18,6 +18,7 @@ */ #include "ns3/ap-wifi-mac.h" +#include "ns3/attribute-container.h" #include "ns3/boolean.h" #include "ns3/config.h" #include "ns3/ctrl-headers.h" @@ -1903,6 +1904,14 @@ BlockAckAggregationDisabledTest::DoRun() "BeaconGeneration", BooleanValue(true)); + if (m_txop) + { + // set the TXOP limit on BE AC + mac.SetEdca(AC_BE, + "TxopLimits", + AttributeContainerValue(std::list{MicroSeconds(4800)})); + } + NetDeviceContainer apDevices; apDevices = wifi.Install(phy, mac, wifiApNode); @@ -1931,10 +1940,6 @@ BlockAckAggregationDisabledTest::DoRun() ptr.Get()->TraceConnectWithoutContext( "TxopTrace", MakeCallback(&TxopDurationTracer::Trace, &txopTracer)); - - // set the TXOP limit on BE AC - ap_device->GetMac()->GetAttribute("BE_Txop", ptr); - ptr.Get()->SetTxopLimit(MicroSeconds(4800)); } PacketSocketAddress socket;