10#define EMLSR_MANAGER_H
12#include "ns3/ctrl-headers.h"
13#include "ns3/mac48-address.h"
14#include "ns3/object.h"
15#include "ns3/sta-wifi-mac.h"
16#include "ns3/wifi-phy-operating-channel.h"
30class EhtFrameExchangeManager;
43 virtual std::string_view
GetName()
const = 0;
46 virtual std::shared_ptr<EmlsrMainPhySwitchTrace>
Clone()
const = 0;
67 std::shared_ptr<EmlsrMainPhySwitchTrace>
Clone()
const override
69 return std::shared_ptr<EmlsrMainPhySwitchTrace>(
new T(
static_cast<const T&
>(*
this)));
82 friend class ::EmlsrCcaBusyTest;
278 void NotifyTxopEnd(uint8_t linkId,
bool ulTxopNotStarted =
false,
bool ongoingDlTxop =
false);
645 std::map<uint8_t, MediumSyncDelayStatus>
664 std::map<uint8_t, WifiPhyOperatingChannel>
666 std::map<uint8_t, WifiPhyOperatingChannel>
668 std::map<uint8_t, Time>
678 static constexpr std::string_view
m_name =
"DlTxopIcfReceivedByAuxPhy";
688 static constexpr std::string_view
m_name =
"UlTxopRtsSentByAuxPhy";
735 static constexpr std::string_view
m_name =
"TxopEnded";
760 static constexpr std::string_view
m_name =
"UlTxopAuxPhyNotTxCapable";
Test CCA busy notifications on EMLSR clients.
EmlsrManager is an abstract base class defining the API that EHT non-AP MLDs with EMLSR activated can...
void SendEmlOmn()
Send an EML Operating Mode Notification frame.
Time GetMediumSyncDuration() const
void ComputeOperatingChannels()
Compute the operating channels that the main PHY and the aux PHY(s) must switch to in order to operat...
void(* MainPhySwitchCallback)(const EmlsrMainPhySwitchTrace &info)
TracedCallback signature for main PHY switch events.
std::map< uint8_t, Time > m_startSleep
PHY ID-indexed map of last time sleep mode started.
void NotifyProtectionCompleted(uint8_t linkId)
Notify that protection (if required) is completed and data frame exchange can start on the given link...
void SetTransitionTimeout(Time timeout)
Set the Transition Timeout advertised by the associated AP with EMLSR activated.
void CancelMediumSyncDelayTimer(uint8_t linkId)
Cancel the MediumSyncDelay timer associated with the given link and take the appropriate actions.
static constexpr uint16_t MEDIUM_SYNC_THRESHOLD_USEC
The aMediumSyncThreshold defined by Sec. 35.3.16.18.1 of 802.11be D4.0.
bool m_auxPhyTxCapable
whether Aux PHYs are capable of transmitting PPDUs
bool MediumSyncDelayNTxopsExceeded(uint8_t linkId)
Return whether no more TXOP attempt is allowed on the given link.
std::optional< Time > GetTransitionTimeout() const
void ChangeEmlsrMode()
This method is called to make an EMLSR mode change effective after the transition delay has elapsed o...
std::pair< bool, Time > GetDelayUntilAccessRequest(uint8_t linkId, AcIndex aci)
Notify that an UL TXOP is gained on the given link by the given AC.
virtual std::pair< bool, Time > DoGetDelayUntilAccessRequest(uint8_t linkId)=0
Subclasses have to provide an implementation for this method, that is called by the base class when t...
Ptr< EhtFrameExchangeManager > GetEhtFem(uint8_t linkId) const
void TxDropped(WifiMacDropReason reason, Ptr< const WifiMpdu > mpdu)
Notify that the given MPDU has been discarded for the given reason.
void NotifyUlTxopStart(uint8_t linkId)
Notify the start of an UL TXOP on the given link.
void TxOk(Ptr< const WifiMpdu > mpdu)
Notify the acknowledgment of the given MPDU.
void MediumSyncDelayTimerExpired(uint8_t linkId)
Take the appropriate actions when the MediumSyncDelay timer expires or is cancelled.
void NotifyTxopEnd(uint8_t linkId, bool ulTxopNotStarted=false, bool ongoingDlTxop=false)
Notify the end of a TXOP on the given link.
std::map< uint8_t, EventId > m_ulMainPhySwitch
link ID-indexed map of timers started when an aux PHY gains an UL TXOP and schedules a channel switch...
bool m_inDeviceInterference
whether in-device interference is such that a PHY cannot decode anything and cannot decrease the back...
bool GetCamStateReset() const
void SetEmlsrLinks(const std::set< uint8_t > &linkIds)
Take actions to enable EMLSR mode on the given set of links, if non-empty, or disable EMLSR mode,...
void SetMediumSyncOfdmEdThreshold(int8_t threshold)
Set the Medium Synchronization OFDM ED threshold (dBm) to use while the MediumSyncDelay timer is runn...
uint8_t m_mainPhyId
ID of main PHY (position in the vector of PHYs held by WifiNetDevice)
int8_t GetMediumSyncOfdmEdThreshold() const
void NotifyIcfReceived(uint8_t linkId)
Notify the reception of an initial Control frame on the given link.
std::map< uint8_t, EventId > m_auxPhyToSleepEvents
PHY ID-indexed map of events scheduled to put an Aux PHY to sleep.
std::map< uint8_t, MediumSyncDelayStatus > m_mediumSyncDelayStatus
the status of MediumSyncDelay timers (link ID-indexed)
bool m_auxPhyToSleep
whether Aux PHYs should be put into sleep mode while the Main PHY is carrying out a (DL or UL) TXOP
virtual std::pair< bool, Time > GetDelayUnlessMainPhyTakesOverUlTxop(uint8_t linkId)=0
Subclasses have to provide an implementation for this method, that is called by the base class when t...
virtual void SwitchMainPhyIfTxopGainedByAuxPhy(uint8_t linkId, AcIndex aci)=0
Subclasses have to provide an implementation for this method, that is called by the base class when t...
void NotifyMgtFrameReceived(Ptr< const WifiMpdu > mpdu, uint8_t linkId)
Notify the reception of a management frame addressed to us.
virtual uint8_t GetLinkToSendEmlOmn()=0
std::map< uint8_t, WifiPhyOperatingChannel > m_auxPhyChannels
link ID-indexed map of operating channels for the aux PHYs
virtual void DoNotifyUlTxopStart(uint8_t linkId)=0
Notify the subclass of the start of an UL TXOP on the given link.
Ptr< StaWifiMac > m_staMac
the MAC of the managed non-AP MLD
virtual void DoNotifyMgtFrameReceived(Ptr< const WifiMpdu > mpdu, uint8_t linkId)=0
Notify the subclass of the reception of a management frame addressed to us.
Time m_emlsrPaddingDelay
EMLSR Padding delay.
bool GetInDeviceInterference() const
virtual void NotifyMainPhySwitch(std::optional< uint8_t > currLinkId, uint8_t nextLinkId, Ptr< WifiPhy > auxPhy, Time duration)=0
Notify subclass that the main PHY is switching channel to operate on another link.
MHz_u m_auxPhyMaxWidth
max channel width supported by aux PHYs
virtual void NotifyInDeviceInterferenceStart(uint8_t linkId, Time duration)
Notify that an STA affiliated with the EMLSR client is causing in-device interference for the given a...
void SetMediumSyncMaxNTxops(std::optional< uint8_t > nTxops)
Set the maximum number of TXOPs a non-AP STA is allowed to attempt to initiate while the MediumSyncDe...
Time m_emlsrTransitionDelay
EMLSR Transition delay.
void SetWifiMac(Ptr< StaWifiMac > mac)
Set the wifi MAC.
void DecrementMediumSyncDelayNTxops(uint8_t linkId)
Decrement the counter indicating the number of TXOP attempts left while the MediumSyncDelay timer is ...
bool GetAuxPhyTxCapable() const
const std::set< uint8_t > & GetEmlsrLinks() const
MainPhySwitchTracedCallback m_mainPhySwitchTrace
main PHY switch trace source
virtual void EmlsrLinkSwitchCallback(uint8_t linkId, Ptr< WifiPhy > phy)
Callback connected to the EmlsrLinkSwitch trace source of StaWifiMac.
void CancelAllSleepEvents()
Cancel all pending events to put aux PHYs into sleep/awake state.
Time m_mediumSyncDuration
duration of the MediumSyncDelay timer
std::optional< Time > m_emlsrTransitionTimeout
Transition timeout advertised by APs with EMLSR activated.
void SwitchAuxPhy(Ptr< WifiPhy > auxPhy, uint8_t currLinkId, uint8_t nextLinkId)
Switch channel on the Aux PHY operating on the given current link so that it operates on the given ne...
std::map< Ptr< WifiPhy >, dBm_u > m_prevCcaEdThreshold
the CCA sensitivity threshold to restore once the MediumSyncDelay timer expires or the PHY moves to a...
void ResetMediumSyncDelayNTxops(uint8_t linkId)
Reset the counter indicating the number of TXOP attempts left while the MediumSyncDelay timer is runn...
std::optional< Time > GetElapsedMediumSyncDelayTimer(uint8_t linkId) const
Check whether the MediumSyncDelay timer is running for the STA operating on the given link.
virtual void DoNotifyTxopEnd(uint8_t linkId)=0
Notify the subclass of the end of a TXOP on the given link.
virtual void DoSetWifiMac(Ptr< StaWifiMac > mac)
Allow subclasses to take actions when the MAC is set.
std::map< uint8_t, Time > m_noPhySince
link ID-indexed map of the time since no PHY is operating on the link
void SetAuxPhyTxCapable(bool capable)
Set the member variable indicating whether Aux PHYs are capable of transmitting PPDUs.
std::optional< std::set< uint8_t > > m_nextEmlsrLinks
ID of the links that will become the EMLSR links when the pending notification frame is acknowledged.
void SetCcaEdThresholdOnLinkSwitch(Ptr< WifiPhy > phy, uint8_t linkId)
Set the CCA ED threshold (if needed) on the given PHY that is switching channel to operate on the giv...
virtual void NotifyEmlsrModeChanged()=0
Notify subclass that EMLSR mode changed.
void SetMainPhyId(uint8_t mainPhyId)
Set the ID of main PHY (position in the vector of PHYs held by WifiNetDevice).
const WifiPhyOperatingChannel & GetChannelForMainPhy(uint8_t linkId) const
void ApplyMaxChannelWidthAndModClassOnAuxPhys()
Adjust the operating channel of all the aux PHYs to meet the constraint on the maximum channel width ...
void SetMediumSyncDuration(Time duration)
Set the duration of the MediumSyncDelay timer.
void SwitchMainPhy(uint8_t linkId, bool noSwitchDelay, bool resetBackoff, bool requestAccess, EmlsrMainPhySwitchTrace &&traceInfo)
Switch channel on the Main PHY so that it operates on the given link.
static constexpr bool RESET_BACKOFF
reset backoff on main PHY switch
Time m_lastAdvTransitionDelay
last advertised transition delay
static constexpr bool REQUEST_ACCESS
request channel access when PHY switch ends
static constexpr bool DONT_REQUEST_ACCESS
do not request channel access when PHY switch ends
void DoDispose() override
Destructor implementation.
void StartMediumSyncDelayTimer(uint8_t linkId)
Start the MediumSyncDelay timer and take the appropriate actions.
int8_t m_msdOfdmEdThreshold
MediumSyncDelay OFDM ED threshold.
std::map< uint8_t, WifiPhyOperatingChannel > m_mainPhyChannels
link ID-indexed map of operating channels for the main PHY
std::optional< uint8_t > m_msdMaxNTxops
MediumSyncDelay max number of TXOPs.
virtual std::optional< uint8_t > ResendNotification(Ptr< const WifiMpdu > mpdu)=0
A previous EML Operating Mode Notification frame was dropped.
Ptr< StaWifiMac > GetStaMac() const
Time m_lastAdvPaddingDelay
last advertised padding delay
WifiModulationClass m_auxPhyMaxModClass
max modulation class supported by aux PHYs
uint8_t GetMainPhyId() const
std::optional< uint8_t > GetMediumSyncMaxNTxops() const
void SetCamStateReset(bool enable)
Set the member variable indicating whether the state of the CAM should be reset when the main PHY swi...
virtual void NotifyRtsSent(uint8_t linkId, Ptr< const WifiPsdu > rts, const WifiTxVector &txVector)
Notify that RTS transmission is starting on the given link.
EventId m_transitionTimeoutEvent
Timer started after the successful transmission of an EML Operating Mode Notification frame.
virtual void DoNotifyIcfReceived(uint8_t linkId)=0
Notify the subclass of the reception of an initial Control frame on the given link.
void SetInDeviceInterference(bool enable)
Set the member variable indicating whether in-device interference is such that a PHY cannot decode an...
const WifiPhyOperatingChannel & GetChannelForAuxPhy(uint8_t linkId) const
bool m_resetCamState
whether to reset the state of CAM when main PHY switches channel
static TypeId GetTypeId()
Get the type ID.
std::set< uint8_t > m_emlsrLinks
ID of the EMLSR links (empty if EMLSR mode is disabled)
static constexpr bool DONT_RESET_BACKOFF
do not reset backoff on main PHY switch
void SetSleepStateForAllAuxPhys(bool sleep)
Set sleep state or awake state for all aux PHYs.
An identifier for simulation events.
Implement the header for Action frames of type EML Operating Mode Notification.
A base class which provides memory management and object aggregation.
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
a unique identifier for an interface.
Class that keeps track of all information about the current PHY operating channel.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
WifiMacDropReason
The reason why an MPDU was dropped.
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802....
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static constexpr uint8_t WIFI_LINKID_UNDEFINED
Invalid link identifier.
Struct to trace that main PHY switched to start a DL TXOP after that an aux PHY received an ICF.
static constexpr std::string_view m_name
trace name
Base struct for EMLSR Main PHY switch traces.
virtual ~EmlsrMainPhySwitchTrace()=default
uint8_t toLinkId
ID of the link the main PHY is moving to.
std::optional< uint8_t > fromLinkId
ID of the link the main PHY is moving from (if any)
virtual std::string_view GetName() const =0
virtual std::shared_ptr< EmlsrMainPhySwitchTrace > Clone() const =0
Implementation for the EMLSR Main PHY switch trace base struct.
std::string_view GetName() const override
std::shared_ptr< EmlsrMainPhySwitchTrace > Clone() const override
Information about the status of the MediumSyncDelay timer associated with a link.
std::optional< uint8_t > msdNTxopsLeft
number of TXOP attempts left while the MediumSyncDelay timer is running
EventId timer
the MediumSyncDelay timer
Struct to trace that main PHY switched when a (DL or UL) TXOP ended.
EmlsrTxopEndedTrace(const Time &t)
Constructor provided because this struct is not an aggregate (it has a base struct),...
Time remTime
the remaining time (at TXOP end) until the main PHY completes the channel switch, in case the main PH...
static constexpr std::string_view m_name
trace name
Struct to trace that main PHY switched to operate on a link on which an aux PHY that is not TX capabl...
Time remTime
Remaining time to complete backoff countdown on the aux PHY link.
EmlsrUlTxopAuxPhyNotTxCapableTrace(AcIndex aci, const Time &delay, const Time &navLeft)
Constructor provided because this struct is not an aggregate (it has a base struct),...
static constexpr std::string_view m_name
trace name
AcIndex acIndex
Access category of TXOP on aux PHY.
Time remNav
the remaining NAV on main PHY link when main PHY is requested to switch
Struct to trace that main PHY switched to start an UL TXOP after that an aux PHY transmitted an RTS.
static constexpr std::string_view m_name
trace name