wifi: Use EmlOmn for EML Operating Mode Notification

This commit is contained in:
Stefano Avallone
2023-05-04 23:31:31 +02:00
committed by Stefano Avallone
parent eba13bbb59
commit 2210619b1c
11 changed files with 71 additions and 83 deletions

View File

@@ -1816,9 +1816,9 @@ ApWifiMac::Receive(Ptr<const WifiMpdu> mpdu, uint8_t linkId)
IsAssociated(hdr->GetAddr2()))
{
// received an EML Operating Mode Notification frame from an associated station
MgtEmlOperatingModeNotification frame;
MgtEmlOmn frame;
pkt->RemoveHeader(frame);
ReceiveEmlNotification(frame, hdr->GetAddr2(), linkId);
ReceiveEmlOmn(frame, hdr->GetAddr2(), linkId);
return;
}
break;
@@ -2152,9 +2152,7 @@ ApWifiMac::ParseReportedStaInfo(const AssocReqRefVariant& assoc, Mac48Address fr
}
void
ApWifiMac::ReceiveEmlNotification(MgtEmlOperatingModeNotification& frame,
const Mac48Address& sender,
uint8_t linkId)
ApWifiMac::ReceiveEmlOmn(MgtEmlOmn& frame, const Mac48Address& sender, uint8_t linkId)
{
NS_LOG_FUNCTION(this << frame << sender << linkId);
@@ -2288,7 +2286,7 @@ ApWifiMac::ReceiveEmlNotification(MgtEmlOperatingModeNotification& frame,
frame.m_emlsrParamUpdate.reset();
auto ehtFem = StaticCast<EhtFrameExchangeManager>(GetFrameExchangeManager(linkId));
ehtFem->SendEmlOperatingModeNotification(sender, frame);
ehtFem->SendEmlOmn(sender, frame);
}
void

View File

@@ -48,7 +48,7 @@ class UniformRandomVariable;
class MgtAssocRequestHeader;
class MgtReassocRequestHeader;
class MgtAssocResponseHeader;
class MgtEmlOperatingModeNotification;
class MgtEmlOmn;
/// variant holding a reference to a (Re)Association Request
using AssocReqRefVariant = std::variant<std::reference_wrapper<MgtAssocRequestHeader>,
@@ -246,9 +246,7 @@ class ApWifiMac : public WifiMac
* \param sender the MAC address of the sender of the frame
* \param linkId the ID of the link over which the frame was received
*/
void ReceiveEmlNotification(MgtEmlOperatingModeNotification& frame,
const Mac48Address& sender,
uint8_t linkId);
void ReceiveEmlOmn(MgtEmlOmn& frame, const Mac48Address& sender, uint8_t linkId);
/**
* The packet we sent was successfully received by the receiver

View File

@@ -66,7 +66,7 @@ DefaultEmlsrManager::DoNotifyMgtFrameReceived(Ptr<const WifiMpdu> mpdu, uint8_t
}
uint8_t
DefaultEmlsrManager::GetLinkToSendEmlNotification()
DefaultEmlsrManager::GetLinkToSendEmlOmn()
{
NS_LOG_FUNCTION(this);
auto linkId = GetStaMac()->GetLinkForPhy(m_mainPhyId);

View File

@@ -45,7 +45,7 @@ class DefaultEmlsrManager : public EmlsrManager
~DefaultEmlsrManager() override;
protected:
uint8_t GetLinkToSendEmlNotification() override;
uint8_t GetLinkToSendEmlOmn() override;
std::optional<uint8_t> ResendNotification(Ptr<const WifiMpdu> mpdu) override;
private:

View File

@@ -261,9 +261,7 @@ EhtFrameExchangeManager::NotifySwitchingEmlsrLink(Ptr<WifiPhy> phy, uint8_t link
}
void
EhtFrameExchangeManager::SendEmlOperatingModeNotification(
const Mac48Address& dest,
const MgtEmlOperatingModeNotification& frame)
EhtFrameExchangeManager::SendEmlOmn(const Mac48Address& dest, const MgtEmlOmn& frame)
{
NS_LOG_FUNCTION(this << dest << frame);

View File

@@ -52,8 +52,7 @@ class EhtFrameExchangeManager : public HeFrameExchangeManager
* \param dest the MAC address of the receiver
* \param frame the EML Operating Mode Notification frame to send
*/
void SendEmlOperatingModeNotification(const Mac48Address& dest,
const MgtEmlOperatingModeNotification& frame);
void SendEmlOmn(const Mac48Address& dest, const MgtEmlOmn& frame);
/**
* Get the RSSI (in dBm) of the most recent packet received from the station having

View File

@@ -194,7 +194,7 @@ EmlsrManager::SetEmlsrLinks(const std::set<uint8_t>& linkIds)
if (GetStaMac() && GetStaMac()->IsAssociated() && GetTransitionTimeout() && m_nextEmlsrLinks)
{
// Request to enable EMLSR mode on the given links, provided that they have been setup
SendEmlOperatingModeNotification();
SendEmlOmn();
}
}
@@ -216,7 +216,7 @@ EmlsrManager::NotifyMgtFrameReceived(Ptr<const WifiMpdu> mpdu, uint8_t linkId)
{
// a non-empty set of EMLSR links have been configured, hence enable EMLSR mode
// on those links
SendEmlOperatingModeNotification();
SendEmlOmn();
}
}
@@ -290,7 +290,7 @@ EmlsrManager::SwitchMainPhy(uint8_t linkId)
}
void
EmlsrManager::SendEmlOperatingModeNotification()
EmlsrManager::SendEmlOmn()
{
NS_LOG_FUNCTION(this);
@@ -298,7 +298,7 @@ EmlsrManager::SendEmlOperatingModeNotification()
"AP did not advertise a Transition Timeout, cannot send EML notification");
NS_ASSERT_MSG(m_nextEmlsrLinks, "Need to set EMLSR links before calling this method");
MgtEmlOperatingModeNotification frame;
MgtEmlOmn frame;
// Add the EMLSR Parameter Update field if needed
if (m_lastAdvPaddingDelay != m_emlsrPaddingDelay ||
@@ -307,7 +307,7 @@ EmlsrManager::SendEmlOperatingModeNotification()
m_lastAdvPaddingDelay = m_emlsrPaddingDelay;
m_lastAdvTransitionDelay = m_emlsrTransitionDelay;
frame.m_emlControl.emlsrParamUpdateCtrl = 1;
frame.m_emlsrParamUpdate = MgtEmlOperatingModeNotification::EmlsrParamUpdate{};
frame.m_emlsrParamUpdate = MgtEmlOmn::EmlsrParamUpdate{};
frame.m_emlsrParamUpdate->paddingDelay =
CommonInfoBasicMle::EncodeEmlsrPaddingDelay(m_lastAdvPaddingDelay);
frame.m_emlsrParamUpdate->transitionDelay =
@@ -344,8 +344,8 @@ EmlsrManager::SendEmlOperatingModeNotification()
// non-AP STA affiliated with the non-AP MLD that operates on one of the EMLSR links is
// in awake state. (Sec. 35.3.17 of 802.11be D3.0)
auto linkId = GetLinkToSendEmlNotification();
GetEhtFem(linkId)->SendEmlOperatingModeNotification(m_staMac->GetBssid(linkId), frame);
auto linkId = GetLinkToSendEmlOmn();
GetEhtFem(linkId)->SendEmlOmn(m_staMac->GetBssid(linkId), frame);
}
void
@@ -403,10 +403,9 @@ EmlsrManager::TxDropped(WifiMacDropReason reason, Ptr<const WifiMpdu> mpdu)
auto linkId = ResendNotification(mpdu);
if (linkId)
{
MgtEmlOperatingModeNotification frame;
MgtEmlOmn frame;
pkt->RemoveHeader(frame);
GetEhtFem(*linkId)->SendEmlOperatingModeNotification(m_staMac->GetBssid(*linkId),
frame);
GetEhtFem(*linkId)->SendEmlOmn(m_staMac->GetBssid(*linkId), frame);
}
else
{

View File

@@ -146,7 +146,7 @@ class EmlsrManager : public Object
/**
* \return the ID of the link on which the EML Operating Mode Notification frame has to be sent
*/
virtual uint8_t GetLinkToSendEmlNotification() = 0;
virtual uint8_t GetLinkToSendEmlOmn() = 0;
/**
* A previous EML Operating Mode Notification frame was dropped. Ask the subclass whether
@@ -188,7 +188,7 @@ class EmlsrManager : public Object
/**
* Send an EML Operating Mode Notification frame.
*/
void SendEmlOperatingModeNotification();
void SendEmlOmn();
/**
* Notify the subclass of the reception of a management frame addressed to us.

View File

@@ -1731,26 +1731,26 @@ MgtDelBaHeader::SetParameterSet(uint16_t params)
* EMLSR Operating Mode Notification
****************************************************/
NS_OBJECT_ENSURE_REGISTERED(MgtEmlOperatingModeNotification);
NS_OBJECT_ENSURE_REGISTERED(MgtEmlOmn);
TypeId
MgtEmlOperatingModeNotification::GetTypeId()
MgtEmlOmn::GetTypeId()
{
static TypeId tid = TypeId("ns3::MgtEmlOperatingModeNotification")
.SetParent<Header>()
.SetGroupName("Wifi")
.AddConstructor<MgtEmlOperatingModeNotification>();
.AddConstructor<MgtEmlOmn>();
return tid;
}
TypeId
MgtEmlOperatingModeNotification::GetInstanceTypeId() const
MgtEmlOmn::GetInstanceTypeId() const
{
return GetTypeId();
}
void
MgtEmlOperatingModeNotification::Print(std::ostream& os) const
MgtEmlOmn::Print(std::ostream& os) const
{
os << "EMLSR Mode=" << +m_emlControl.emlsrMode << " EMLMR Mode=" << +m_emlControl.emlmrMode
<< " EMLSR Parameter Update Control=" << +m_emlControl.emlsrParamUpdateCtrl;
@@ -1770,7 +1770,7 @@ MgtEmlOperatingModeNotification::Print(std::ostream& os) const
}
uint32_t
MgtEmlOperatingModeNotification::GetSerializedSize() const
MgtEmlOmn::GetSerializedSize() const
{
uint32_t size = 2; // Dialog Token (1) + first byte of EML Control
if (m_emlControl.linkBitmap)
@@ -1790,7 +1790,7 @@ MgtEmlOperatingModeNotification::GetSerializedSize() const
}
void
MgtEmlOperatingModeNotification::Serialize(Buffer::Iterator start) const
MgtEmlOmn::Serialize(Buffer::Iterator start) const
{
start.WriteU8(m_dialogToken);
@@ -1825,7 +1825,7 @@ MgtEmlOperatingModeNotification::Serialize(Buffer::Iterator start) const
}
uint32_t
MgtEmlOperatingModeNotification::Deserialize(Buffer::Iterator start)
MgtEmlOmn::Deserialize(Buffer::Iterator start)
{
Buffer::Iterator i = start;
@@ -1858,7 +1858,7 @@ MgtEmlOperatingModeNotification::Deserialize(Buffer::Iterator start)
}
void
MgtEmlOperatingModeNotification::SetLinkIdInBitmap(uint8_t linkId)
MgtEmlOmn::SetLinkIdInBitmap(uint8_t linkId)
{
NS_ABORT_MSG_IF(linkId > 15, "Link ID must not exceed 15");
if (!m_emlControl.linkBitmap)
@@ -1869,7 +1869,7 @@ MgtEmlOperatingModeNotification::SetLinkIdInBitmap(uint8_t linkId)
}
std::list<uint8_t>
MgtEmlOperatingModeNotification::GetLinkBitmap() const
MgtEmlOmn::GetLinkBitmap() const
{
std::list<uint8_t> list;
NS_ASSERT_MSG(m_emlControl.linkBitmap.has_value(), "No link bitmap");

View File

@@ -1109,10 +1109,10 @@ class MgtDelBaHeader : public Header
* \ingroup wifi
* Implement the header for Action frames of type EML Operating Mode Notification.
*/
class MgtEmlOperatingModeNotification : public Header
class MgtEmlOmn : public Header
{
public:
MgtEmlOperatingModeNotification() = default;
MgtEmlOmn() = default;
/**
* Register this type.

View File

@@ -83,7 +83,7 @@ EmlOperatingModeNotificationTest::EmlOperatingModeNotificationTest()
void
EmlOperatingModeNotificationTest::DoRun()
{
MgtEmlOperatingModeNotification frame;
MgtEmlOmn frame;
// Both EMLSR Mode and EMLMR Mode subfields set to 0 (no link bitmap);
TestHeaderSerialization(frame);
@@ -104,7 +104,7 @@ EmlOperatingModeNotificationTest::DoRun()
auto transition = MicroSeconds(128);
frame.m_emlControl.emlsrParamUpdateCtrl = 1;
frame.m_emlsrParamUpdate = MgtEmlOperatingModeNotification::EmlsrParamUpdate{};
frame.m_emlsrParamUpdate = MgtEmlOmn::EmlsrParamUpdate{};
frame.m_emlsrParamUpdate->paddingDelay = CommonInfoBasicMle::EncodeEmlsrPaddingDelay(padding);
frame.m_emlsrParamUpdate->transitionDelay =
CommonInfoBasicMle::EncodeEmlsrTransitionDelay(transition);
@@ -542,7 +542,7 @@ EmlsrOperationsTestBase::SetSsid(uint16_t aid, Mac48Address /* addr */)
* timeout expires and when an EML Notification response is received from the AP MLD (thus,
* the correct EMLSR link set is stored after whichever of the two events occur first)
*/
class EmlNotificationExchangeTest : public EmlsrOperationsTestBase
class EmlOmnExchangeTest : public EmlsrOperationsTestBase
{
public:
/**
@@ -551,9 +551,8 @@ class EmlNotificationExchangeTest : public EmlsrOperationsTestBase
* \param linksToEnableEmlsrOn IDs of links on which EMLSR mode should be enabled
* \param transitionTimeout the Transition Timeout advertised by the AP MLD
*/
EmlNotificationExchangeTest(const std::set<uint8_t>& linksToEnableEmlsrOn,
Time transitionTimeout);
~EmlNotificationExchangeTest() override = default;
EmlOmnExchangeTest(const std::set<uint8_t>& linksToEnableEmlsrOn, Time transitionTimeout);
~EmlOmnExchangeTest() override = default;
protected:
void DoSetup() override;
@@ -627,9 +626,8 @@ class EmlNotificationExchangeTest : public EmlsrOperationsTestBase
std::list<uint64_t> m_uidList; ///< list of UIDs of packets to corrupt
};
EmlNotificationExchangeTest::EmlNotificationExchangeTest(
const std::set<uint8_t>& linksToEnableEmlsrOn,
Time transitionTimeout)
EmlOmnExchangeTest::EmlOmnExchangeTest(const std::set<uint8_t>& linksToEnableEmlsrOn,
Time transitionTimeout)
: EmlsrOperationsTestBase("Check EML Notification exchange"),
m_checkEmlsrLinksCount(0),
m_emlNotificationDroppedCount(0)
@@ -642,7 +640,7 @@ EmlNotificationExchangeTest::EmlNotificationExchangeTest(
}
void
EmlNotificationExchangeTest::DoSetup()
EmlOmnExchangeTest::DoSetup()
{
EmlsrOperationsTestBase::DoSetup();
@@ -652,20 +650,18 @@ EmlNotificationExchangeTest::DoSetup()
m_apMac->GetWifiPhy(linkId)->SetPostReceptionErrorModel(m_errorModel);
}
m_staMacs[0]->TraceConnectWithoutContext(
"AckedMpdu",
MakeCallback(&EmlNotificationExchangeTest::TxOk, this));
m_staMacs[0]->TraceConnectWithoutContext(
"DroppedMpdu",
MakeCallback(&EmlNotificationExchangeTest::TxDropped, this));
m_staMacs[0]->TraceConnectWithoutContext("AckedMpdu",
MakeCallback(&EmlOmnExchangeTest::TxOk, this));
m_staMacs[0]->TraceConnectWithoutContext("DroppedMpdu",
MakeCallback(&EmlOmnExchangeTest::TxDropped, this));
}
void
EmlNotificationExchangeTest::Transmit(Ptr<WifiMac> mac,
uint8_t phyId,
WifiConstPsduMap psduMap,
WifiTxVector txVector,
double txPowerW)
EmlOmnExchangeTest::Transmit(Ptr<WifiMac> mac,
uint8_t phyId,
WifiConstPsduMap psduMap,
WifiTxVector txVector,
double txPowerW)
{
EmlsrOperationsTestBase::Transmit(mac, phyId, psduMap, txVector, txPowerW);
auto linkId = m_txPsdus.back().linkId;
@@ -706,9 +702,9 @@ EmlNotificationExchangeTest::Transmit(Ptr<WifiMac> mac,
}
void
EmlNotificationExchangeTest::CheckEmlCapabilitiesInAssocReq(Ptr<const WifiMpdu> mpdu,
const WifiTxVector& txVector,
uint8_t linkId)
EmlOmnExchangeTest::CheckEmlCapabilitiesInAssocReq(Ptr<const WifiMpdu> mpdu,
const WifiTxVector& txVector,
uint8_t linkId)
{
MgtAssocRequestHeader frame;
mpdu->GetPacket()->PeekHeader(frame);
@@ -731,9 +727,9 @@ EmlNotificationExchangeTest::CheckEmlCapabilitiesInAssocReq(Ptr<const WifiMpdu>
}
void
EmlNotificationExchangeTest::CheckEmlCapabilitiesInAssocResp(Ptr<const WifiMpdu> mpdu,
const WifiTxVector& txVector,
uint8_t linkId)
EmlOmnExchangeTest::CheckEmlCapabilitiesInAssocResp(Ptr<const WifiMpdu> mpdu,
const WifiTxVector& txVector,
uint8_t linkId)
{
bool sentToEmlsrClient =
(m_staMacs[0]->GetLinkIdByAddress(mpdu->GetHeader().GetAddr1()) == linkId);
@@ -763,11 +759,11 @@ EmlNotificationExchangeTest::CheckEmlCapabilitiesInAssocResp(Ptr<const WifiMpdu>
}
void
EmlNotificationExchangeTest::CheckEmlNotification(Ptr<const WifiPsdu> psdu,
const WifiTxVector& txVector,
uint8_t linkId)
EmlOmnExchangeTest::CheckEmlNotification(Ptr<const WifiPsdu> psdu,
const WifiTxVector& txVector,
uint8_t linkId)
{
MgtEmlOperatingModeNotification frame;
MgtEmlOmn frame;
auto mpdu = *psdu->begin();
auto pkt = mpdu->GetPacket()->Copy();
WifiActionHeader::Remove(pkt);
@@ -817,7 +813,7 @@ EmlNotificationExchangeTest::CheckEmlNotification(Ptr<const WifiPsdu> psdu,
txVector,
m_staMacs[0]->GetWifiPhy(linkId)->GetPhyBand()) +
MicroSeconds(1); // to account for propagation delay
Simulator::Schedule(delay, &EmlNotificationExchangeTest::CheckEmlsrLinks, this);
Simulator::Schedule(delay, &EmlOmnExchangeTest::CheckEmlsrLinks, this);
}
NS_TEST_EXPECT_MSG_EQ(+m_mainPhyId,
@@ -827,7 +823,7 @@ EmlNotificationExchangeTest::CheckEmlNotification(Ptr<const WifiPsdu> psdu,
}
void
EmlNotificationExchangeTest::TxOk(Ptr<const WifiMpdu> mpdu)
EmlOmnExchangeTest::TxOk(Ptr<const WifiMpdu> mpdu)
{
const auto& hdr = mpdu->GetHeader();
@@ -841,14 +837,14 @@ EmlNotificationExchangeTest::TxOk(Ptr<const WifiMpdu> mpdu)
// the EML Operating Mode Notification frame that the non-AP MLD sent has been
// acknowledged; after the transition timeout, the EMLSR links have been set
Simulator::Schedule(m_transitionTimeout + NanoSeconds(1),
&EmlNotificationExchangeTest::CheckEmlsrLinks,
&EmlOmnExchangeTest::CheckEmlsrLinks,
this);
}
}
}
void
EmlNotificationExchangeTest::TxDropped(WifiMacDropReason reason, Ptr<const WifiMpdu> mpdu)
EmlOmnExchangeTest::TxDropped(WifiMacDropReason reason, Ptr<const WifiMpdu> mpdu)
{
const auto& hdr = mpdu->GetHeader();
@@ -867,7 +863,7 @@ EmlNotificationExchangeTest::TxDropped(WifiMacDropReason reason, Ptr<const WifiM
}
void
EmlNotificationExchangeTest::CheckEmlsrLinks()
EmlOmnExchangeTest::CheckEmlsrLinks()
{
m_checkEmlsrLinksCount++;
@@ -885,7 +881,7 @@ EmlNotificationExchangeTest::CheckEmlsrLinks()
}
void
EmlNotificationExchangeTest::DoRun()
EmlOmnExchangeTest::DoRun()
{
Simulator::Stop(m_duration);
Simulator::Run();
@@ -1989,7 +1985,7 @@ EmlsrDlTxopTest::CheckEmlNotificationFrame(Ptr<const WifiMpdu> mpdu,
auto pkt = mpdu->GetPacket()->Copy();
const auto& hdr = mpdu->GetHeader();
WifiActionHeader::Remove(pkt);
MgtEmlOperatingModeNotification frame;
MgtEmlOmn frame;
pkt->RemoveHeader(frame);
std::optional<std::size_t> staId;
@@ -2974,10 +2970,10 @@ WifiEmlsrTestSuite::WifiEmlsrTestSuite()
: TestSuite("wifi-emlsr", UNIT)
{
AddTestCase(new EmlOperatingModeNotificationTest(), TestCase::QUICK);
AddTestCase(new EmlNotificationExchangeTest({1, 2}, MicroSeconds(0)), TestCase::QUICK);
AddTestCase(new EmlNotificationExchangeTest({1, 2}, MicroSeconds(2048)), TestCase::QUICK);
AddTestCase(new EmlNotificationExchangeTest({0, 1, 2, 3}, MicroSeconds(0)), TestCase::QUICK);
AddTestCase(new EmlNotificationExchangeTest({0, 1, 2, 3}, MicroSeconds(2048)), TestCase::QUICK);
AddTestCase(new EmlOmnExchangeTest({1, 2}, MicroSeconds(0)), TestCase::QUICK);
AddTestCase(new EmlOmnExchangeTest({1, 2}, MicroSeconds(2048)), TestCase::QUICK);
AddTestCase(new EmlOmnExchangeTest({0, 1, 2, 3}, MicroSeconds(0)), TestCase::QUICK);
AddTestCase(new EmlOmnExchangeTest({0, 1, 2, 3}, MicroSeconds(2048)), TestCase::QUICK);
for (const auto& emlsrLinks :
{std::set<uint8_t>{0, 1, 2}, std::set<uint8_t>{1, 2}, std::set<uint8_t>{0, 1}})
{