wifi: Install a ConstantWifiAckPolicySelector on every QosTxop by default

This commit is contained in:
Stefano Avallone
2019-04-02 23:26:49 +02:00
parent 5b7428f667
commit 9e5a51a40c
8 changed files with 280 additions and 0 deletions

View File

@@ -27,6 +27,7 @@
#include "ns3/minstrel-wifi-manager.h"
#include "ns3/mesh-wifi-interface-mac.h"
#include "ns3/wifi-helper.h"
#include "ns3/wifi-ack-policy-selector.h"
namespace ns3
{
@@ -119,6 +120,10 @@ MeshHelper::Default (void)
MeshHelper helper;
helper.SetMacType ();
helper.SetRemoteStationManager ("ns3::ArfWifiManager");
helper.SetAckPolicySelectorForAc (AC_BE, "ns3::ConstantWifiAckPolicySelector");
helper.SetAckPolicySelectorForAc (AC_BK, "ns3::ConstantWifiAckPolicySelector");
helper.SetAckPolicySelectorForAc (AC_VI, "ns3::ConstantWifiAckPolicySelector");
helper.SetAckPolicySelectorForAc (AC_VO, "ns3::ConstantWifiAckPolicySelector");
helper.SetSpreadInterfaceChannels (SPREAD_CHANNELS);
return helper;
}
@@ -165,6 +170,28 @@ MeshHelper::SetRemoteStationManager (std::string type,
m_stationManager.Set (n6, v6);
m_stationManager.Set (n7, v7);
}
void
MeshHelper::SetAckPolicySelectorForAc (AcIndex ac, std::string type,
std::string n0, const AttributeValue &v0,
std::string n1, const AttributeValue &v1,
std::string n2, const AttributeValue &v2,
std::string n3, const AttributeValue &v3,
std::string n4, const AttributeValue &v4,
std::string n5, const AttributeValue &v5,
std::string n6, const AttributeValue &v6,
std::string n7, const AttributeValue &v7)
{
m_ackPolicySelector[ac] = ObjectFactory ();
m_ackPolicySelector[ac].SetTypeId (type);
m_ackPolicySelector[ac].Set (n0, v0);
m_ackPolicySelector[ac].Set (n1, v1);
m_ackPolicySelector[ac].Set (n2, v2);
m_ackPolicySelector[ac].Set (n3, v3);
m_ackPolicySelector[ac].Set (n4, v4);
m_ackPolicySelector[ac].Set (n5, v5);
m_ackPolicySelector[ac].Set (n6, v6);
m_ackPolicySelector[ac].Set (n7, v7);
}
void
MeshHelper::SetStandard (enum WifiPhyStandard standard)
{
@@ -191,6 +218,30 @@ MeshHelper::CreateInterface (const WifiPhyHelper &phyHelper, Ptr<Node> node, uin
device->SetRemoteStationManager (manager);
node->AddDevice (device);
mac->SwitchFrequencyChannel (channelId);
// Install ack policy selector
PointerValue ptr;
Ptr<WifiAckPolicySelector> ackSelector;
mac->GetAttributeFailSafe ("BE_Txop", ptr);
ackSelector = m_ackPolicySelector[AC_BE].Create<WifiAckPolicySelector> ();
ackSelector->SetQosTxop (ptr.Get<QosTxop> ());
ptr.Get<QosTxop> ()->SetAckPolicySelector (ackSelector);
mac->GetAttributeFailSafe ("BK_Txop", ptr);
ackSelector = m_ackPolicySelector[AC_BK].Create<WifiAckPolicySelector> ();
ackSelector->SetQosTxop (ptr.Get<QosTxop> ());
ptr.Get<QosTxop> ()->SetAckPolicySelector (ackSelector);
mac->GetAttributeFailSafe ("VI_Txop", ptr);
ackSelector = m_ackPolicySelector[AC_VI].Create<WifiAckPolicySelector> ();
ackSelector->SetQosTxop (ptr.Get<QosTxop> ());
ptr.Get<QosTxop> ()->SetAckPolicySelector (ackSelector);
mac->GetAttributeFailSafe ("VO_Txop", ptr);
ackSelector = m_ackPolicySelector[AC_VO].Create<WifiAckPolicySelector> ();
ackSelector->SetQosTxop (ptr.Get<QosTxop> ());
ptr.Get<QosTxop> ()->SetAckPolicySelector (ackSelector);
return device;
}
void

View File

@@ -25,6 +25,7 @@
#include "ns3/mesh-stack-installer.h"
#include "ns3/wifi-phy-standard.h"
#include "ns3/qos-utils.h"
#include "ns3/object-factory.h"
namespace ns3 {
@@ -120,6 +121,38 @@ public:
std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
/**
* \param ac the Access Category to attach the ack policy selector to.
* \param type the type of ns3::WifiAckPolicySelector to create.
* \param n0 the name of the attribute to set
* \param v0 the value of the attribute to set
* \param n1 the name of the attribute to set
* \param v1 the value of the attribute to set
* \param n2 the name of the attribute to set
* \param v2 the value of the attribute to set
* \param n3 the name of the attribute to set
* \param v3 the value of the attribute to set
* \param n4 the name of the attribute to set
* \param v4 the value of the attribute to set
* \param n5 the name of the attribute to set
* \param v5 the value of the attribute to set
* \param n6 the name of the attribute to set
* \param v6 the value of the attribute to set
* \param n7 the name of the attribute to set
* \param v7 the value of the attribute to set
*
* All the attributes specified in this method should exist
* in the requested ack policy selector.
*/
void SetAckPolicySelectorForAc (AcIndex ac, std::string type,
std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
/**
* Set PHY standard
* \param standard the wifi phy standard
@@ -231,6 +264,7 @@ private:
// Interface factory
ObjectFactory m_mac; ///< the MAC
ObjectFactory m_stationManager; ///< the station manager
ObjectFactory m_ackPolicySelector[4]; ///< ack policy selector for all ACs
enum WifiPhyStandard m_standard; ///< phy standard
};

View File

@@ -26,6 +26,7 @@
#include "ns3/minstrel-wifi-manager.h"
#include "ns3/radiotap-header.h"
#include "ns3/unused.h"
#include "ns3/wifi-ack-policy-selector.h"
#include "wave-mac-helper.h"
#include "wave-helper.h"
@@ -277,6 +278,10 @@ WaveHelper::Default (void)
"DataMode", StringValue ("OfdmRate6MbpsBW10MHz"),
"ControlMode",StringValue ("OfdmRate6MbpsBW10MHz"),
"NonUnicastMode", StringValue ("OfdmRate6MbpsBW10MHz"));
helper.SetAckPolicySelectorForAc (AC_BE, "ns3::ConstantWifiAckPolicySelector");
helper.SetAckPolicySelectorForAc (AC_BK, "ns3::ConstantWifiAckPolicySelector");
helper.SetAckPolicySelectorForAc (AC_VI, "ns3::ConstantWifiAckPolicySelector");
helper.SetAckPolicySelectorForAc (AC_VO, "ns3::ConstantWifiAckPolicySelector");
return helper;
}
@@ -334,6 +339,29 @@ WaveHelper::SetRemoteStationManager (std::string type,
m_stationManager.Set (n7, v7);
}
void
WaveHelper::SetAckPolicySelectorForAc (AcIndex ac, std::string type,
std::string n0, const AttributeValue &v0,
std::string n1, const AttributeValue &v1,
std::string n2, const AttributeValue &v2,
std::string n3, const AttributeValue &v3,
std::string n4, const AttributeValue &v4,
std::string n5, const AttributeValue &v5,
std::string n6, const AttributeValue &v6,
std::string n7, const AttributeValue &v7)
{
m_ackPolicySelector[ac] = ObjectFactory ();
m_ackPolicySelector[ac].SetTypeId (type);
m_ackPolicySelector[ac].Set (n0, v0);
m_ackPolicySelector[ac].Set (n1, v1);
m_ackPolicySelector[ac].Set (n2, v2);
m_ackPolicySelector[ac].Set (n3, v3);
m_ackPolicySelector[ac].Set (n4, v4);
m_ackPolicySelector[ac].Set (n5, v5);
m_ackPolicySelector[ac].Set (n6, v6);
m_ackPolicySelector[ac].Set (n7, v7);
}
void
WaveHelper::SetChannelScheduler (std::string type,
std::string n0, const AttributeValue &v0,
@@ -398,6 +426,34 @@ WaveHelper::Install (const WifiPhyHelper &phyHelper, const WifiMacHelper &macHe
ocbMac->EnableForWave (device);
ocbMac->SetWifiRemoteStationManager ( m_stationManager.Create<WifiRemoteStationManager> ());
ocbMac->ConfigureStandard (WIFI_PHY_STANDARD_80211_10MHZ);
// Install ack policy selector
BooleanValue qosSupported;
PointerValue ptr;
Ptr<WifiAckPolicySelector> ackSelector;
ocbMac->GetAttributeFailSafe ("QosSupported", qosSupported);
if (qosSupported.Get ())
{
ocbMac->GetAttributeFailSafe ("BE_Txop", ptr);
ackSelector = m_ackPolicySelector[AC_BE].Create<WifiAckPolicySelector> ();
ackSelector->SetQosTxop (ptr.Get<QosTxop> ());
ptr.Get<QosTxop> ()->SetAckPolicySelector (ackSelector);
ocbMac->GetAttributeFailSafe ("BK_Txop", ptr);
ackSelector = m_ackPolicySelector[AC_BK].Create<WifiAckPolicySelector> ();
ackSelector->SetQosTxop (ptr.Get<QosTxop> ());
ptr.Get<QosTxop> ()->SetAckPolicySelector (ackSelector);
ocbMac->GetAttributeFailSafe ("VI_Txop", ptr);
ackSelector = m_ackPolicySelector[AC_VI].Create<WifiAckPolicySelector> ();
ackSelector->SetQosTxop (ptr.Get<QosTxop> ());
ptr.Get<QosTxop> ()->SetAckPolicySelector (ackSelector);
ocbMac->GetAttributeFailSafe ("VO_Txop", ptr);
ackSelector = m_ackPolicySelector[AC_VO].Create<WifiAckPolicySelector> ();
ackSelector->SetQosTxop (ptr.Get<QosTxop> ());
ptr.Get<QosTxop> ()->SetAckPolicySelector (ackSelector);
}
device->AddMac (*k, ocbMac);
}

View File

@@ -165,6 +165,38 @@ public:
std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
/**
* \param ac the Access Category to attach the ack policy selector to.
* \param type the type of ns3::WifiAckPolicySelector to create.
* \param n0 the name of the attribute to set
* \param v0 the value of the attribute to set
* \param n1 the name of the attribute to set
* \param v1 the value of the attribute to set
* \param n2 the name of the attribute to set
* \param v2 the value of the attribute to set
* \param n3 the name of the attribute to set
* \param v3 the value of the attribute to set
* \param n4 the name of the attribute to set
* \param v4 the value of the attribute to set
* \param n5 the name of the attribute to set
* \param v5 the value of the attribute to set
* \param n6 the name of the attribute to set
* \param v6 the value of the attribute to set
* \param n7 the name of the attribute to set
* \param v7 the value of the attribute to set
*
* All the attributes specified in this method should exist
* in the requested ack policy selector.
*/
void SetAckPolicySelectorForAc (AcIndex ac, std::string type,
std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
/**
* \param type the type of ns3::ChannelScheduler to create.
* \param n0 the name of the attribute to set
@@ -245,6 +277,7 @@ public:
protected:
ObjectFactory m_stationManager; ///< station manager
ObjectFactory m_ackPolicySelector[4]; ///< ack policy selector for all ACs
ObjectFactory m_channelScheduler; ///< channel scheduler
std::vector<uint32_t> m_macsForChannelNumber; ///< MACs for channel number
uint32_t m_physNumber; ///< Phy number

View File

@@ -38,6 +38,7 @@
#include "ns3/vht-configuration.h"
#include "ns3/he-configuration.h"
#include "ns3/obss-pd-algorithm.h"
#include "ns3/wifi-ack-policy-selector.h"
#include "wifi-helper.h"
namespace ns3 {
@@ -655,6 +656,10 @@ WifiHelper::WifiHelper ()
m_selectQueueCallback (&SelectQueueByDSField)
{
SetRemoteStationManager ("ns3::ArfWifiManager");
SetAckPolicySelectorForAc (AC_BE, "ns3::ConstantWifiAckPolicySelector");
SetAckPolicySelectorForAc (AC_BK, "ns3::ConstantWifiAckPolicySelector");
SetAckPolicySelectorForAc (AC_VI, "ns3::ConstantWifiAckPolicySelector");
SetAckPolicySelectorForAc (AC_VO, "ns3::ConstantWifiAckPolicySelector");
}
void
@@ -703,6 +708,29 @@ WifiHelper::SetObssPdAlgorithm (std::string type,
m_obssPdAlgorithm.Set (n7, v7);
}
void
WifiHelper::SetAckPolicySelectorForAc (AcIndex ac, std::string type,
std::string n0, const AttributeValue &v0,
std::string n1, const AttributeValue &v1,
std::string n2, const AttributeValue &v2,
std::string n3, const AttributeValue &v3,
std::string n4, const AttributeValue &v4,
std::string n5, const AttributeValue &v5,
std::string n6, const AttributeValue &v6,
std::string n7, const AttributeValue &v7)
{
m_ackPolicySelector[ac] = ObjectFactory ();
m_ackPolicySelector[ac].SetTypeId (type);
m_ackPolicySelector[ac].Set (n0, v0);
m_ackPolicySelector[ac].Set (n1, v1);
m_ackPolicySelector[ac].Set (n2, v2);
m_ackPolicySelector[ac].Set (n3, v3);
m_ackPolicySelector[ac].Set (n4, v4);
m_ackPolicySelector[ac].Set (n5, v5);
m_ackPolicySelector[ac].Set (n6, v6);
m_ackPolicySelector[ac].Set (n7, v7);
}
void
WifiHelper::SetStandard (WifiPhyStandard standard)
{
@@ -767,6 +795,7 @@ WifiHelper::Install (const WifiPhyHelper &phyHelper,
BooleanValue qosSupported;
PointerValue ptr;
Ptr<WifiMacQueue> wmq;
Ptr<WifiAckPolicySelector> ackSelector;
rmac->GetAttributeFailSafe ("QosSupported", qosSupported);
if (qosSupported.Get ())
@@ -775,18 +804,30 @@ WifiHelper::Install (const WifiPhyHelper &phyHelper,
UintegerValue (4));
rmac->GetAttributeFailSafe ("BE_Txop", ptr);
ackSelector = m_ackPolicySelector[AC_BE].Create<WifiAckPolicySelector> ();
ackSelector->SetQosTxop (ptr.Get<QosTxop> ());
ptr.Get<QosTxop> ()->SetAckPolicySelector (ackSelector);
wmq = ptr.Get<QosTxop> ()->GetWifiMacQueue ();
ndqi->GetTxQueue (0)->ConnectQueueTraces (wmq);
rmac->GetAttributeFailSafe ("BK_Txop", ptr);
ackSelector = m_ackPolicySelector[AC_BK].Create<WifiAckPolicySelector> ();
ackSelector->SetQosTxop (ptr.Get<QosTxop> ());
ptr.Get<QosTxop> ()->SetAckPolicySelector (ackSelector);
wmq = ptr.Get<QosTxop> ()->GetWifiMacQueue ();
ndqi->GetTxQueue (1)->ConnectQueueTraces (wmq);
rmac->GetAttributeFailSafe ("VI_Txop", ptr);
ackSelector = m_ackPolicySelector[AC_VI].Create<WifiAckPolicySelector> ();
ackSelector->SetQosTxop (ptr.Get<QosTxop> ());
ptr.Get<QosTxop> ()->SetAckPolicySelector (ackSelector);
wmq = ptr.Get<QosTxop> ()->GetWifiMacQueue ();
ndqi->GetTxQueue (2)->ConnectQueueTraces (wmq);
rmac->GetAttributeFailSafe ("VO_Txop", ptr);
ackSelector = m_ackPolicySelector[AC_VO].Create<WifiAckPolicySelector> ();
ackSelector->SetQosTxop (ptr.Get<QosTxop> ());
ptr.Get<QosTxop> ()->SetAckPolicySelector (ackSelector);
wmq = ptr.Get<QosTxop> ()->GetWifiMacQueue ();
ndqi->GetTxQueue (3)->ConnectQueueTraces (wmq);
ndqi->SetSelectQueueCallback (m_selectQueueCallback);

View File

@@ -25,6 +25,7 @@
#include "ns3/trace-helper.h"
#include "ns3/wifi-phy.h"
#include "ns3/qos-utils.h"
#include "wifi-mac-helper.h"
#include <functional>
@@ -375,6 +376,39 @@ public:
std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
/**
* \param ac the Access Category to attach the ack policy selector to.
* \param type the type of ns3::WifiAckPolicySelector to create.
* \param n0 the name of the attribute to set
* \param v0 the value of the attribute to set
* \param n1 the name of the attribute to set
* \param v1 the value of the attribute to set
* \param n2 the name of the attribute to set
* \param v2 the value of the attribute to set
* \param n3 the name of the attribute to set
* \param v3 the value of the attribute to set
* \param n4 the name of the attribute to set
* \param v4 the value of the attribute to set
* \param n5 the name of the attribute to set
* \param v5 the value of the attribute to set
* \param n6 the name of the attribute to set
* \param v6 the value of the attribute to set
* \param n7 the name of the attribute to set
* \param v7 the value of the attribute to set
*
* All the attributes specified in this method should exist
* in the requested ack policy selector.
*/
void SetAckPolicySelectorForAc (AcIndex ac, std::string type,
std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
/// Callback invoked to determine the MAC queue selected for a given packet
typedef std::function<std::size_t (Ptr<QueueItem>)> SelectQueueCallback;
@@ -471,6 +505,7 @@ public:
protected:
ObjectFactory m_stationManager; ///< station manager
ObjectFactory m_ackPolicySelector[4]; ///< ack policy selector for all ACs
WifiPhyStandard m_standard; ///< wifi standard
SelectQueueCallback m_selectQueueCallback; ///< select queue callback
ObjectFactory m_obssPdAlgorithm; ///< OBSS PD algorithm

View File

@@ -38,6 +38,8 @@
#include "mpdu-aggregator.h"
#include "ctrl-headers.h"
#include "wifi-phy.h"
#include "wifi-ack-policy-selector.h"
#include "wifi-psdu.h"
#undef NS_LOG_APPEND_CONTEXT
#define NS_LOG_APPEND_CONTEXT if (m_low != 0) { std::clog << "[mac=" << m_low->GetAddress () << "] "; }
@@ -116,6 +118,7 @@ void
QosTxop::DoDispose (void)
{
NS_LOG_FUNCTION (this);
m_ackPolicySelector = 0;
m_baManager = 0;
m_qosBlockedDestinations = 0;
Txop::DoDispose ();
@@ -153,6 +156,19 @@ QosTxop::SetWifiRemoteStationManager (const Ptr<WifiRemoteStationManager> remote
m_baManager->SetWifiRemoteStationManager (m_stationManager);
}
void
QosTxop::SetAckPolicySelector (Ptr<WifiAckPolicySelector> ackSelector)
{
NS_LOG_FUNCTION (this << ackSelector);
m_ackPolicySelector = ackSelector;
}
Ptr<WifiAckPolicySelector>
QosTxop::GetAckPolicySelector (void) const
{
return m_ackPolicySelector;
}
void
QosTxop::SetTypeOfStation (TypeOfStation type)
{

View File

@@ -39,6 +39,7 @@ class MgtAddBaResponseHeader;
class MgtDelBaHeader;
class AggregationCapableTransmissionListener;
class WifiTxVector;
class WifiAckPolicySelector;
/**
* Enumeration for type of station
@@ -120,6 +121,18 @@ public:
* \param remoteManager WifiRemoteStationManager.
*/
void SetWifiRemoteStationManager (const Ptr<WifiRemoteStationManager> remoteManager);
/**
* Set the ack policy selector.
*
* \param ackSelector the ack policy selector.
*/
void SetAckPolicySelector (Ptr<WifiAckPolicySelector> ackSelector);
/**
* Return the ack policy selector.
*
* \return the ack policy selector.
*/
Ptr<WifiAckPolicySelector> GetAckPolicySelector (void) const;
/**
* Set type of station with the given type.
*
@@ -610,6 +623,7 @@ private:
AcIndex m_ac; //!< the access category
TypeOfStation m_typeOfStation; //!< the type of station
Ptr<WifiAckPolicySelector> m_ackPolicySelector; //!< Ack policy selector
Ptr<QosBlockedDestinations> m_qosBlockedDestinations; //!< QOS blocked destinations
Ptr<BlockAckManager> m_baManager; //!< the Block ACK manager
uint8_t m_blockAckThreshold; //!< the Block ACK threshold