wifi: Add WifiStaticSetupHelper EML OMN exchange
This commit is contained in:
committed by
Stefano Avallone
parent
d91fd3df63
commit
cf88c1f486
@@ -12,6 +12,7 @@
|
||||
#include "ns3/ap-wifi-mac.h"
|
||||
#include "ns3/assert.h"
|
||||
#include "ns3/boolean.h"
|
||||
#include "ns3/emlsr-manager.h"
|
||||
#include "ns3/ht-configuration.h"
|
||||
#include "ns3/ht-frame-exchange-manager.h"
|
||||
#include "ns3/log.h"
|
||||
@@ -464,4 +465,76 @@ WifiStaticSetupHelper::GetBaRecipientAddr(Ptr<WifiMac> originatorMac, Ptr<WifiMa
|
||||
return GetBaOriginatorAddr(recipientMac, originatorMac);
|
||||
}
|
||||
|
||||
void
|
||||
WifiStaticSetupHelper::SetStaticEmlsr(Ptr<WifiNetDevice> apDev, Ptr<WifiNetDevice> clientDev)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS();
|
||||
|
||||
Simulator::ScheduleNow(&WifiStaticSetupHelper::SetStaticEmlsrPostInit, apDev, clientDev);
|
||||
}
|
||||
|
||||
void
|
||||
WifiStaticSetupHelper::SetStaticEmlsrPostInit(Ptr<WifiNetDevice> apDev,
|
||||
Ptr<WifiNetDevice> clientDev)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS();
|
||||
|
||||
auto clientMac = DynamicCast<StaWifiMac>(clientDev->GetMac());
|
||||
NS_ASSERT_MSG(clientMac, "Expected StaWifiMac");
|
||||
NS_ASSERT_MSG(clientMac->IsAssociated(), "Expected Association complete");
|
||||
auto setupLinks = clientMac->GetSetupLinkIds();
|
||||
|
||||
if (const auto isMldAssoc = (setupLinks.size() > 1); !isMldAssoc)
|
||||
{
|
||||
NS_LOG_DEBUG("Multi-link setup not performed, skipping EMLSR static setup");
|
||||
return;
|
||||
}
|
||||
if (!clientDev->IsEmlsrActivated())
|
||||
{
|
||||
NS_LOG_DEBUG("Non-AP MLD does not support EMLSR, not performing EMLSR static setup");
|
||||
return;
|
||||
}
|
||||
|
||||
auto emlsrManager = clientMac->GetEmlsrManager();
|
||||
NS_ASSERT_MSG(emlsrManager, "EMLSR Manager not set");
|
||||
emlsrManager->ComputeOperatingChannels();
|
||||
auto emlOmnReq = emlsrManager->GetEmlOmn();
|
||||
auto emlsrLinkId = emlsrManager->GetLinkToSendEmlOmn();
|
||||
emlsrManager->ChangeEmlsrMode();
|
||||
auto clientLinkAddr = clientMac->GetFrameExchangeManager(emlsrLinkId)->GetAddress();
|
||||
auto apMac = DynamicCast<ApWifiMac>(apDev->GetMac());
|
||||
NS_ASSERT_MSG(apMac, "Expected ApWifiMac");
|
||||
apMac->ReceiveEmlOmn(emlOmnReq, clientLinkAddr, emlsrLinkId);
|
||||
apMac->EmlOmnExchangeCompleted(emlOmnReq, clientLinkAddr, emlsrLinkId);
|
||||
}
|
||||
|
||||
void
|
||||
WifiStaticSetupHelper::SetStaticEmlsr(Ptr<WifiNetDevice> apDev,
|
||||
const NetDeviceContainer& clientDevs)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS();
|
||||
|
||||
auto apMac = DynamicCast<ApWifiMac>(apDev->GetMac());
|
||||
NS_ASSERT_MSG(apMac, "Expected ApWifiMac");
|
||||
// Check if AP supports EMLSR
|
||||
if ((!apMac->GetEhtSupported()) || (apMac->GetNLinks() == 1))
|
||||
{
|
||||
NS_LOG_DEBUG("AP does not support MLD, not performing EMLSR static setup");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!apDev->IsEmlsrActivated())
|
||||
{
|
||||
NS_LOG_DEBUG("AP MLD does not support EMLSR, not performing EMLSR static setup");
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto i = clientDevs.Begin(); i != clientDevs.End(); ++i)
|
||||
{
|
||||
auto clientDev = DynamicCast<WifiNetDevice>(*i);
|
||||
NS_ASSERT_MSG(clientDev, "WifiNetDevice expected");
|
||||
SetStaticEmlsr(apDev, clientDev);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -32,6 +32,7 @@ class WifiMacHeader;
|
||||
*
|
||||
* - association/ML setup (note that scanning is disabled for this purpose)
|
||||
* - block ack agreement(s)
|
||||
* - enabling EMLSR mode on EMLSR client links
|
||||
*/
|
||||
class WifiStaticSetupHelper
|
||||
{
|
||||
@@ -152,6 +153,25 @@ class WifiStaticSetupHelper
|
||||
/// @param recipientMac recipient MAC
|
||||
/// @return the Block Ack recipient address
|
||||
static Mac48Address GetBaRecipientAddr(Ptr<WifiMac> originatorMac, Ptr<WifiMac> recipientMac);
|
||||
|
||||
/// Bypass EML Operating Mode Notification exchange sequence between AP MLD
|
||||
/// and input non-AP devices
|
||||
/// @param apDev AP MLD
|
||||
/// @param clientDevs Non-AP devices
|
||||
static void SetStaticEmlsr(Ptr<WifiNetDevice> apDev, const NetDeviceContainer& clientDevs);
|
||||
|
||||
/// Bypass EML Operating Mode Notification exchange sequence between AP MLD and non-AP MLD
|
||||
/// to enable EMLSR mode on the links specified via the EmlsrManager::EmlsrLinkSet attribute
|
||||
/// @param apDev AP MLD
|
||||
/// @param clientDev Non-AP MLD
|
||||
static void SetStaticEmlsr(Ptr<WifiNetDevice> apDev, Ptr<WifiNetDevice> clientDev);
|
||||
|
||||
/// Perform EML Operating Mode Notification exchange sequence between AP MLD and non-AP MLD
|
||||
/// to enable EMLSR mode on the links specified via the EmlsrManager::EmlsrLinkSet attribute
|
||||
/// post initialization at runtime begin
|
||||
/// @param apDev AP MLD
|
||||
/// @param clientDev Non-AP MLD
|
||||
static void SetStaticEmlsrPostInit(Ptr<WifiNetDevice> apDev, Ptr<WifiNetDevice> clientDev);
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -80,6 +80,7 @@ class EmlsrManager : public Object
|
||||
{
|
||||
/// Allow test cases to access private members
|
||||
friend class ::EmlsrCcaBusyTest;
|
||||
friend class WifiStaticSetupHelper;
|
||||
|
||||
public:
|
||||
/**
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "sta-wifi-mac.h"
|
||||
#include "wifi-phy.h"
|
||||
|
||||
#include "ns3/boolean.h"
|
||||
#include "ns3/channel.h"
|
||||
#include "ns3/eht-configuration.h"
|
||||
#include "ns3/he-configuration.h"
|
||||
@@ -655,4 +656,20 @@ WifiNetDevice::GetEhtConfiguration() const
|
||||
return (m_standard >= WIFI_STANDARD_80211be ? m_ehtConfiguration : nullptr);
|
||||
}
|
||||
|
||||
bool
|
||||
WifiNetDevice::IsEmlsrActivated() const
|
||||
{
|
||||
if (!m_ehtConfiguration)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
BooleanValue emlsrActivated;
|
||||
if (!m_ehtConfiguration->GetAttributeFailSafe("EmlsrActivated", emlsrActivated))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return emlsrActivated.Get();
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -169,6 +169,11 @@ class WifiNetDevice : public NetDevice
|
||||
*/
|
||||
Ptr<EhtConfiguration> GetEhtConfiguration() const;
|
||||
|
||||
/**
|
||||
* @return true if device supports EMLSR, otherwise false
|
||||
*/
|
||||
bool IsEmlsrActivated() const;
|
||||
|
||||
void SetIfIndex(const uint32_t index) override;
|
||||
uint32_t GetIfIndex() const override;
|
||||
Ptr<Channel> GetChannel() const override;
|
||||
|
||||
Reference in New Issue
Block a user