diff --git a/src/wifi/model/eht/advanced-emlsr-manager.cc b/src/wifi/model/eht/advanced-emlsr-manager.cc index 4c85ae84c..1fd7dc76f 100644 --- a/src/wifi/model/eht/advanced-emlsr-manager.cc +++ b/src/wifi/model/eht/advanced-emlsr-manager.cc @@ -252,7 +252,7 @@ AdvancedEmlsrManager::DoGetDelayUntilAccessRequest(uint8_t linkId) continue; } - if (phy && phy->IsReceivingPhyHeader()) + if (phy && phy->GetInfoIfRxingPhyHeader()) { // we don't know yet the type of the frame being received; prevent or allow // the UL TXOP based on user configuration diff --git a/src/wifi/model/eht/eht-frame-exchange-manager.cc b/src/wifi/model/eht/eht-frame-exchange-manager.cc index a552d8bce..21cecb3a5 100644 --- a/src/wifi/model/eht/eht-frame-exchange-manager.cc +++ b/src/wifi/model/eht/eht-frame-exchange-manager.cc @@ -1654,7 +1654,7 @@ EhtFrameExchangeManager::TxopEnd(const std::optional& txopHolder) { NS_LOG_FUNCTION(this << txopHolder.has_value()); - if (m_phy && m_phy->IsReceivingPhyHeader()) + if (m_phy && m_phy->GetInfoIfRxingPhyHeader()) { // we may get here because the PHY has not issued the PHY-RXSTART.indication before // the expiration of the timer started to detect new received frames, but the PHY is diff --git a/src/wifi/model/wifi-phy.cc b/src/wifi/model/wifi-phy.cc index 00c4a2cb7..22f6ade71 100644 --- a/src/wifi/model/wifi-phy.cc +++ b/src/wifi/model/wifi-phy.cc @@ -1997,10 +1997,15 @@ WifiPhy::StartReceivePreamble(Ptr ppdu, } } -bool -WifiPhy::IsReceivingPhyHeader() const +std::optional> +WifiPhy::GetInfoIfRxingPhyHeader() const { - return m_endPhyRxEvent.IsPending(); + if (m_endPhyRxEvent.IsPending()) + { + NS_ASSERT_MSG(m_currentEvent, "No current event while receiving PHY header"); + return std::cref(m_currentEvent->GetPpdu()->GetTxVector()); + } + return std::nullopt; } void diff --git a/src/wifi/model/wifi-phy.h b/src/wifi/model/wifi-phy.h index 510339bc6..36029bc65 100644 --- a/src/wifi/model/wifi-phy.h +++ b/src/wifi/model/wifi-phy.h @@ -114,9 +114,10 @@ class WifiPhy : public Object Time rxDuration); /** - * @return whether the PHY is busy decoding the PHY header fields of a PPDU + * @return if the PHY is busy decoding the PHY header fields of a PPDU, return the TXVECTOR + * used to transmit the PPDU; otherwise, return a null optional value */ - bool IsReceivingPhyHeader() const; + std::optional> GetInfoIfRxingPhyHeader() const; /** * For HE receptions only, check and possibly modify the transmit power restriction state at diff --git a/src/wifi/test/wifi-emlsr-test.cc b/src/wifi/test/wifi-emlsr-test.cc index a4aa150fe..6e41be6e5 100644 --- a/src/wifi/test/wifi-emlsr-test.cc +++ b/src/wifi/test/wifi-emlsr-test.cc @@ -4832,12 +4832,12 @@ EmlsrCcaBusyTest::CheckPoint1() NS_TEST_EXPECT_MSG_NE(mainPhy, auxPhy, "Main PHY is operating on an unexpected link"); // 2. Aux PHY is receiving the PHY header - NS_TEST_EXPECT_MSG_EQ(auxPhy->IsReceivingPhyHeader(), + NS_TEST_EXPECT_MSG_EQ(auxPhy->GetInfoIfRxingPhyHeader().has_value(), true, "Aux PHY is not receiving a PHY header"); // 3. Main PHY dropped the preamble because it is switching - NS_TEST_EXPECT_MSG_EQ(mainPhy->IsReceivingPhyHeader(), + NS_TEST_EXPECT_MSG_EQ(mainPhy->GetInfoIfRxingPhyHeader().has_value(), false, "Main PHY is receiving a PHY header");