wifi: Switch main PHY back to primary link only if no TXOP is ongoing on another EMLSR link

Aux PHY sends RTS and schedules main PHY switch; no CTS is received and
CTS timeout occurs while main PHY is switching. Do not unconditionally
schedule switching the main PHY back to the primary link when the
ongoing channel switch terminates; indeed, channel access may be
obtained in the meantime and the main PHY will be requested to switch
the link on which channel access has been obtained.
This commit is contained in:
Stefano Avallone
2024-01-13 22:20:29 +01:00
parent 30f653a91c
commit 4b34ad4f5c
2 changed files with 16 additions and 7 deletions

View File

@@ -19,6 +19,8 @@
#include "default-emlsr-manager.h"
#include "eht-frame-exchange-manager.h"
#include "ns3/boolean.h"
#include "ns3/channel-access-manager.h"
#include "ns3/log.h"
@@ -161,13 +163,14 @@ DefaultEmlsrManager::DoNotifyTxopEnd(uint8_t linkId)
}
else
{
Simulator::Schedule(mainPhy->GetDelayUntilIdle(),
&DefaultEmlsrManager::SwitchMainPhy,
this,
GetMainPhyId(),
false,
DONT_RESET_BACKOFF,
REQUEST_ACCESS);
Simulator::Schedule(mainPhy->GetDelayUntilIdle(), [=, this]() {
// request the main PHY to switch back to the primary link only if in the meantime
// no TXOP started on another link (which will require the main PHY to switch link)
if (!GetEhtFem(linkId)->UsingOtherEmlsrLink())
{
SwitchMainPhy(GetMainPhyId(), false, DONT_RESET_BACKOFF, REQUEST_ACCESS);
}
});
}
return;
}

View File

@@ -3585,6 +3585,12 @@ EmlsrLinkSwitchTest::CheckResults()
// m_txPsdusPos points to ADDBA_RESPONSE, then ACK and then ICF
auto psduIt = std::next(m_txPsdus.cbegin(), m_txPsdusPos + 2);
// skip first PSDU if it contains a Beacon frame
if (psduIt->psduMap.at(SU_STA_ID)->GetHeader(0).IsBeacon())
{
psduIt++;
}
for (std::size_t i = 0; i < nRxOk; i++)
{
NS_TEST_EXPECT_MSG_EQ((psduIt->psduMap.size() == 1 &&