wifi: Take preamble detection period into account in CheckPossiblyReceivingIcf()

This commit is contained in:
Stefano Avallone
2025-03-04 19:05:21 +01:00
parent b227e1614d
commit 879929f3f9
3 changed files with 22 additions and 8 deletions

View File

@@ -590,7 +590,12 @@ EmlsrManager::CheckPossiblyReceivingIcf(uint8_t linkId) const
return {false, Time{0}};
}
if (auto macHdr = GetEhtFem(linkId)->GetReceivedMacHdr(); macHdr && m_useNotifiedMacHdr)
if (auto endPreamble = phy->GetTimeToPreambleDetectionEnd())
{
NS_LOG_DEBUG("Detecting a PPDU preamble, postpone by " << endPreamble->As(Time::US));
return {true, endPreamble.value()};
}
else if (auto macHdr = GetEhtFem(linkId)->GetReceivedMacHdr(); macHdr && m_useNotifiedMacHdr)
{
NS_LOG_DEBUG("Receiving the MAC payload of a PSDU and MAC header info can be used");
NS_ASSERT(phy->GetState()->GetLastTime({WifiPhyState::RX}) == Simulator::Now());

View File

@@ -5506,6 +5506,9 @@ EmlsrIcfSentDuringMainPhySwitchTest::RunOne()
switch (m_csdIndex)
{
case DURING_PREAMBLE_DETECTION:
channelSwitchDelay = MicroSeconds(1);
break;
case BEFORE_PHY_HDR_END:
channelSwitchDelay = phyHdrDuration - margin;
break;
@@ -5581,6 +5584,11 @@ EmlsrIcfSentDuringMainPhySwitchTest::RunOne()
true,
m_testStr << ": Expected to be receiving the PHY header");
break;
case DURING_PREAMBLE_DETECTION:
NS_TEST_EXPECT_MSG_EQ(auxPhy->GetTimeToPreambleDetectionEnd().has_value(),
true,
m_testStr
<< ": Expected to be in preamble detection period");
default:
NS_ABORT_MSG("Unexpected channel switch duration index");
}

View File

@@ -1110,14 +1110,14 @@ class SingleLinkEmlsrTest : public EmlsrOperationsTestBase
*
* The channel switch delay for the main PHY varies across test scenarios and is computed so that
* the channel switch terminates during one of the different steps of the reception of the ICF:
* before the PHY header end, before the MAC header end, before the padding start and after the
* padding start.
* during preamble detection period, before the PHY header end, before the MAC header end, before
* the padding start and after the padding start.
*
\verbatim
┌──────┬──────┬────────────────────┬───────┐
│ PHY │ MAC │ MAC PAYLOAD │ │
│HEADER│HEADER│(COMMON & USER INFO)│PADDING│
└──────┴──────┴────────────────────┴───────┘
┌────────┬──────┬──────┬────────────────────┬───────┐
PREAMBLE│ PHY │ MAC │ MAC PAYLOAD │ │
DETECT │HEADER│HEADER│(COMMON & USER INFO)│PADDING│
└────────┴──────┴──────┴────────────────────┴───────┘
\endverbatim
*
* All the combinations of the following are tested:
@@ -1148,7 +1148,8 @@ class EmlsrIcfSentDuringMainPhySwitchTest : public EmlsrOperationsTestBase
*/
enum ChannelSwitchEnd : uint8_t
{
BEFORE_PHY_HDR_END = 0,
DURING_PREAMBLE_DETECTION = 0,
BEFORE_PHY_HDR_END,
BEFORE_MAC_HDR_END,
BEFORE_MAC_PAYLOAD_END,
BEFORE_PADDING_END,