From 55bae2ed3fa3cc8147ccfef38b39eefaec76faf7 Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Fri, 26 Jan 2024 17:22:11 +0100 Subject: [PATCH] wifi: FEM forwards PSDU RX error/OK notification to AP EMLSR manager --- src/wifi/model/eht/ap-emlsr-manager.cc | 19 +++++++ src/wifi/model/eht/ap-emlsr-manager.h | 24 +++++++++ .../model/eht/eht-frame-exchange-manager.cc | 17 +++++++ .../model/eht/eht-frame-exchange-manager.h | 51 ++++++++++--------- src/wifi/model/frame-exchange-manager.cc | 8 +++ src/wifi/model/frame-exchange-manager.h | 7 +++ 6 files changed, 101 insertions(+), 25 deletions(-) diff --git a/src/wifi/model/eht/ap-emlsr-manager.cc b/src/wifi/model/eht/ap-emlsr-manager.cc index b272c4714..9f6bcb543 100644 --- a/src/wifi/model/eht/ap-emlsr-manager.cc +++ b/src/wifi/model/eht/ap-emlsr-manager.cc @@ -70,6 +70,13 @@ ApEmlsrManager::SetWifiMac(Ptr mac) NS_ABORT_MSG_IF(m_apMac->GetNLinks() <= 1, "ApEmlsrManager can only be installed on MLDs"); NS_ABORT_MSG_IF(m_apMac->GetTypeOfStation() != AP, "ApEmlsrManager can only be installed on AP MLDs"); + DoSetWifiMac(mac); +} + +void +ApEmlsrManager::DoSetWifiMac(Ptr mac) +{ + NS_LOG_FUNCTION(this << mac); } Ptr @@ -84,4 +91,16 @@ ApEmlsrManager::GetEhtFem(uint8_t linkId) const return StaticCast(m_apMac->GetFrameExchangeManager(linkId)); } +void +ApEmlsrManager::NotifyPsduRxOk(uint8_t linkId, Ptr psdu) +{ + NS_LOG_FUNCTION(this << linkId << *psdu); +} + +void +ApEmlsrManager::NotifyPsduRxError(uint8_t linkId, Ptr psdu) +{ + NS_LOG_FUNCTION(this << linkId << *psdu); +} + } // namespace ns3 diff --git a/src/wifi/model/eht/ap-emlsr-manager.h b/src/wifi/model/eht/ap-emlsr-manager.h index 2230dba85..3f05a7813 100644 --- a/src/wifi/model/eht/ap-emlsr-manager.h +++ b/src/wifi/model/eht/ap-emlsr-manager.h @@ -27,6 +27,7 @@ namespace ns3 class ApWifiMac; class EhtFrameExchangeManager; +class WifiPsdu; /** * \ingroup wifi @@ -52,9 +53,32 @@ class ApEmlsrManager : public Object */ void SetWifiMac(Ptr mac); + /** + * This method is called when the reception of a PSDU succeeds on the given link. + * + * \param linkId the ID of the given link + * \param psdu the PSDU whose reception succeeded + */ + virtual void NotifyPsduRxOk(uint8_t linkId, Ptr psdu); + + /** + * This method is called when the reception of a PSDU fails on the given link. + * + * \param linkId the ID of the given link + * \param psdu the PSDU whose reception failed + */ + virtual void NotifyPsduRxError(uint8_t linkId, Ptr psdu); + protected: void DoDispose() override; + /** + * Allow subclasses to take actions when the MAC is set. + * + * \param mac the wifi MAC + */ + virtual void DoSetWifiMac(Ptr mac); + /** * \return the MAC of the AP MLD managed by this AP EMLSR Manager. */ diff --git a/src/wifi/model/eht/eht-frame-exchange-manager.cc b/src/wifi/model/eht/eht-frame-exchange-manager.cc index cae79a416..9786bef01 100644 --- a/src/wifi/model/eht/eht-frame-exchange-manager.cc +++ b/src/wifi/model/eht/eht-frame-exchange-manager.cc @@ -19,6 +19,7 @@ #include "eht-frame-exchange-manager.h" +#include "ap-emlsr-manager.h" #include "eht-phy.h" #include "emlsr-manager.h" @@ -1068,6 +1069,11 @@ EhtFrameExchangeManager::PostProcessFrame(Ptr psdu, const WifiTx HeFrameExchangeManager::PostProcessFrame(psdu, txVector); + if (m_apMac && m_apMac->GetApEmlsrManager()) + { + m_apMac->GetApEmlsrManager()->NotifyPsduRxOk(m_linkId, psdu); + } + if (m_apMac && m_txopHolder == psdu->GetAddr2() && GetWifiRemoteStationManager()->GetEmlsrEnabled(*m_txopHolder)) { @@ -1159,6 +1165,17 @@ EhtFrameExchangeManager::CheckEmlsrClientStartingTxop(const WifiMacHeader& hdr, return true; } +void +EhtFrameExchangeManager::PsduRxError(Ptr psdu) +{ + NS_LOG_FUNCTION(this << psdu); + + if (m_apMac && m_apMac->GetApEmlsrManager()) + { + m_apMac->GetApEmlsrManager()->NotifyPsduRxError(m_linkId, psdu); + } +} + void EhtFrameExchangeManager::ReceiveMpdu(Ptr mpdu, RxSignalInfo rxSignalInfo, diff --git a/src/wifi/model/eht/eht-frame-exchange-manager.h b/src/wifi/model/eht/eht-frame-exchange-manager.h index 2c349d43c..f59b39d78 100644 --- a/src/wifi/model/eht/eht-frame-exchange-manager.h +++ b/src/wifi/model/eht/eht-frame-exchange-manager.h @@ -97,6 +97,31 @@ class EhtFrameExchangeManager : public HeFrameExchangeManager */ bool UsingOtherEmlsrLink() const; + /** + * Check if the frame received (or being received) is sent by an EMLSR client to start an + * UL TXOP. If so, take the appropriate actions (e.g., block transmission to the EMLSR client + * on the other links). This method is intended to be called when an MPDU (possibly within + * an A-MPDU) is received or when the reception of the MAC header in an MPDU is notified. + * + * \param hdr the MAC header of the received (or being received) MPDU + * \param txVector the TXVECTOR used to transmit the frame received (or being received) + * \return whether the frame received (or being received) is sent by an EMLSR client to start + * an UL TXOP + */ + bool CheckEmlsrClientStartingTxop(const WifiMacHeader& hdr, const WifiTxVector& txVector); + + /** + * This method is intended to be called when an AP MLD detects that an EMLSR client previously + * involved in the current TXOP will start waiting for the transition delay interval (to switch + * back to listening operation) after the given delay. + * This method blocks the transmissions on all the EMLSR links of the given EMLSR client until + * the transition delay advertised by the EMLSR client expires. + * + * \param address the link MAC address of the given EMLSR client + * \param delay the given delay + */ + void EmlsrSwitchToListening(const Mac48Address& address, const Time& delay); + protected: void DoDispose() override; void RxStartIndication(WifiTxVector txVector, Time psduDuration) override; @@ -119,33 +144,9 @@ class EhtFrameExchangeManager : public HeFrameExchangeManager void NavResetTimeout() override; void IntraBssNavResetTimeout() override; void SendCtsAfterRts(const WifiMacHeader& rtsHdr, WifiMode rtsTxMode, double rtsSnr) override; - - /** - * This method is intended to be called when an AP MLD detects that an EMLSR client previously - * involved in the current TXOP will start waiting for the transition delay interval (to switch - * back to listening operation) after the given delay. - * This method blocks the transmissions on all the EMLSR links of the given EMLSR client until - * the transition delay advertised by the EMLSR client expires. - * - * \param address the link MAC address of the given EMLSR client - * \param delay the given delay - */ - void EmlsrSwitchToListening(const Mac48Address& address, const Time& delay); + void PsduRxError(Ptr psdu) override; private: - /** - * Check if the frame received (or being received) is sent by an EMLSR client to start an - * UL TXOP. If so, take the appropriate actions (e.g., block transmission to the EMLSR client - * on the other links). This method is intended to be called when an MPDU (possibly within - * an A-MPDU) is received or when the reception of the MAC header in an MPDU is notified. - * - * \param hdr the MAC header of the received (or being received) MPDU - * \param txVector the TXVECTOR used to transmit the frame received (or being received) - * \return whether the frame received (or being received) is sent by an EMLSR client to start - * an UL TXOP - */ - bool CheckEmlsrClientStartingTxop(const WifiMacHeader& hdr, const WifiTxVector& txVector); - /** * Generate an in-device interference of the given power on the given link for the given * duration. diff --git a/src/wifi/model/frame-exchange-manager.cc b/src/wifi/model/frame-exchange-manager.cc index 122a4afe5..06f974500 100644 --- a/src/wifi/model/frame-exchange-manager.cc +++ b/src/wifi/model/frame-exchange-manager.cc @@ -176,6 +176,7 @@ FrameExchangeManager::SetWifiPhy(Ptr phy) m_phy->TraceConnectWithoutContext("PhyRxMacHeaderEnd", MakeCallback(&FrameExchangeManager::ReceivedMacHdr, this)); m_phy->SetReceiveOkCallback(MakeCallback(&FrameExchangeManager::Receive, this)); + m_phy->SetReceiveErrorCallback(MakeCallback(&FrameExchangeManager::PsduRxError, this)); } void @@ -197,6 +198,7 @@ FrameExchangeManager::ResetPhy() RxSignalInfo, WifiTxVector, std::vector>()); + m_phy->SetReceiveErrorCallback(MakeNullCallback>()); } m_phy = nullptr; m_ongoingRxInfo.macHdr.reset(); @@ -1142,6 +1144,12 @@ FrameExchangeManager::NotifyOffNow() Reset(); } +void +FrameExchangeManager::PsduRxError(Ptr psdu) +{ + NS_LOG_FUNCTION(this << psdu); +} + void FrameExchangeManager::Receive(Ptr psdu, RxSignalInfo rxSignalInfo, diff --git a/src/wifi/model/frame-exchange-manager.h b/src/wifi/model/frame-exchange-manager.h index 6677c2690..3ca4cc824 100644 --- a/src/wifi/model/frame-exchange-manager.h +++ b/src/wifi/model/frame-exchange-manager.h @@ -360,6 +360,13 @@ class FrameExchangeManager : public Object */ virtual void NavResetTimeout(); + /** + * This method is called when the reception of a PSDU fails. + * + * \param psdu the PSDU whose reception failed + */ + virtual void PsduRxError(Ptr psdu); + /** * This method handles the reception of an MPDU (possibly included in an A-MPDU) *