wifi: Install GCR manager for AP STAs if Robust AV Streaming is enabled

This commit is contained in:
Sébastien Deronne
2023-06-11 14:16:20 +02:00
parent da9a8a92e6
commit b4d14129f7
4 changed files with 73 additions and 0 deletions

View File

@@ -14,6 +14,7 @@
#include "ns3/emlsr-manager.h"
#include "ns3/enum.h"
#include "ns3/frame-exchange-manager.h"
#include "ns3/gcr-manager.h"
#include "ns3/multi-user-scheduler.h"
#include "ns3/pointer.h"
#include "ns3/wifi-ack-manager.h"
@@ -167,6 +168,13 @@ WifiMacHelper::Create(Ptr<WifiNetDevice> device, WifiStandard standard) const
apMac->SetApEmlsrManager(apEmlsrManager);
}
// create and install the GCR Manager if this is a HT-capable AP
if (apMac && apMac->GetRobustAVStreamingSupported() && m_gcrManager.IsTypeIdSet())
{
auto gcrManager = m_gcrManager.Create<GcrManager>();
apMac->SetGcrManager(gcrManager);
}
return mac;
}

View File

@@ -168,6 +168,16 @@ class WifiMacHelper
template <typename... Args>
void SetApEmlsrManager(std::string type, Args&&... args);
/**
* Helper function used to set the GCR Manager that can be installed on a QoS AP.
*
* @tparam Args \deduced Template type parameter pack for the sequence of name-value pairs.
* @param type the type of GCR Manager
* @param args A sequence of name-value pairs of the attributes to set.
*/
template <typename... Args>
void SetGcrManager(std::string type, Args&&... args);
/**
* @param device the device within which the MAC object will reside
* @param standard the standard to configure during installation
@@ -190,6 +200,7 @@ class WifiMacHelper
ObjectFactory m_muScheduler; ///< Multi-user Scheduler object factory
ObjectFactory m_emlsrManager; ///< EMLSR Manager object factory
ObjectFactory m_apEmlsrManager; ///< AP EMLSR Manager object factory
ObjectFactory m_gcrManager; ///< GCR Manager object factory
};
} // namespace ns3
@@ -295,6 +306,14 @@ WifiMacHelper::SetApEmlsrManager(std::string type, Args&&... args)
m_apEmlsrManager.Set(args...);
}
template <typename... Args>
void
WifiMacHelper::SetGcrManager(std::string type, Args&&... args)
{
m_gcrManager.SetTypeId(type);
m_gcrManager.Set(args...);
}
} // namespace ns3
#endif /* WIFI_MAC_HELPER_H */

View File

@@ -12,6 +12,7 @@
#include "amsdu-subframe-header.h"
#include "channel-access-manager.h"
#include "gcr-manager.h"
#include "mac-rx-middle.h"
#include "mac-tx-middle.h"
#include "mgt-action-headers.h"
@@ -168,6 +169,13 @@ ApWifiMac::GetTypeId()
MakeAttributeContainerAccessor<TimeAccessParamsPairValue, ';'>(
&ApWifiMac::m_txopLimitsForSta),
GetTimeAccessParamsChecker())
.AddAttribute("GcrManager",
"The GCR manager object.",
TypeId::ATTR_GET |
TypeId::ATTR_CONSTRUCT, // prevent setting after construction
PointerValue(),
MakePointerAccessor(&ApWifiMac::GetGcrManager, &ApWifiMac::SetGcrManager),
MakePointerChecker<GcrManager>())
.AddTraceSource("AssociatedSta",
"A station associated with this access point.",
MakeTraceSourceAccessor(&ApWifiMac::m_assocLogger),
@@ -228,6 +236,11 @@ ApWifiMac::DoDispose()
m_apEmlsrManager->Dispose();
}
m_apEmlsrManager = nullptr;
if (m_gcrManager)
{
m_gcrManager->Dispose();
}
m_gcrManager = nullptr;
WifiMac::DoDispose();
}
@@ -263,6 +276,20 @@ ApWifiMac::GetApEmlsrManager() const
return m_apEmlsrManager;
}
void
ApWifiMac::SetGcrManager(Ptr<GcrManager> gcrManager)
{
NS_LOG_FUNCTION(this << gcrManager);
m_gcrManager = gcrManager;
m_gcrManager->SetWifiMac(this);
}
Ptr<GcrManager>
ApWifiMac::GetGcrManager() const
{
return m_gcrManager;
}
void
ApWifiMac::DoCompleteConfig()
{
@@ -2568,6 +2595,11 @@ ApWifiMac::DoInitialize()
UpdateShortPreambleEnabled(linkId);
}
if (m_gcrManager)
{
m_gcrManager->Initialize();
}
NS_ABORT_IF(!TraceConnectWithoutContext("AckedMpdu", MakeCallback(&ApWifiMac::TxOk, this)));
NS_ABORT_IF(
!TraceConnectWithoutContext("DroppedMpdu", MakeCallback(&ApWifiMac::TxFailed, this)));

View File

@@ -39,6 +39,7 @@ class CfParameterSet;
class UniformRandomVariable;
class MgtEmlOmn;
class ApEmlsrManager;
class GcrManager;
/// variant holding a reference to a (Re)Association Request
using AssocReqRefVariant = std::variant<std::reference_wrapper<MgtAssocRequestHeader>,
@@ -85,6 +86,18 @@ class ApWifiMac : public WifiMac
*/
Ptr<ApEmlsrManager> GetApEmlsrManager() const;
/**
* Set the GCR Manager.
*
* @param gcrManager the GCR Manager
*/
void SetGcrManager(Ptr<GcrManager> gcrManager);
/**
* @return the GCR Manager
*/
Ptr<GcrManager> GetGcrManager() const;
/**
* @param interval the interval between two beacon transmissions.
*/
@@ -607,6 +620,7 @@ class ApWifiMac : public WifiMac
/// transition timeout events running for EMLSR clients
std::map<Mac48Address, EventId> m_transitionTimeoutEvents;
Ptr<ApEmlsrManager> m_apEmlsrManager; ///< AP EMLSR Manager
Ptr<GcrManager> m_gcrManager; //!< GCR Manager
UintAccessParamsMap m_cwMinsForSta; //!< Per-AC CW min values to advertise to stations
UintAccessParamsMap m_cwMaxsForSta; //!< Per-AC CW max values to advertise to stations