wifi: Update a few examples to configure TXOP limit from helper

This commit is contained in:
Stefano Avallone
2024-03-27 16:35:39 +01:00
parent dd49dbfac8
commit b889917a05
2 changed files with 17 additions and 11 deletions

View File

@@ -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<QosTxop> edca;
wifi_dev->GetMac()->GetAttribute("BE_Txop", ptr);
edca = ptr.Get<QosTxop>();
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<WifiNetDevice>(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<QosTxop>();
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<QosTxop>();
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<QosTxop>();
edca->SetTxopLimit(MicroSeconds(txopLimit));
// Trace TXOP duration for BE on AP D
TxopDurationTracer netD;

View File

@@ -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<TimeValue>(std::list{MicroSeconds(4800)}));
}
NetDeviceContainer apDevices;
apDevices = wifi.Install(phy, mac, wifiApNode);
@@ -1931,10 +1940,6 @@ BlockAckAggregationDisabledTest::DoRun()
ptr.Get<QosTxop>()->TraceConnectWithoutContext(
"TxopTrace",
MakeCallback(&TxopDurationTracer::Trace, &txopTracer));
// set the TXOP limit on BE AC
ap_device->GetMac()->GetAttribute("BE_Txop", ptr);
ptr.Get<QosTxop>()->SetTxopLimit(MicroSeconds(4800));
}
PacketSocketAddress socket;