A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
advanced-emlsr-manager.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Universita' di Napoli Federico II
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Stefano Avallone <stavallo@unina.it>
7 */
8
9#ifndef ADVANCED_EMLSR_MANAGER_H
10#define ADVANCED_EMLSR_MANAGER_H
11
13
14namespace ns3
15{
16
17/**
18 * @ingroup wifi
19 *
20 * AdvancedEmlsrManager is an advanced EMLSR manager.
21 */
23{
24 public:
25 /**
26 * @brief Get the type ID.
27 * @return the object TypeId
28 */
29 static TypeId GetTypeId();
30
32 ~AdvancedEmlsrManager() override;
33
34 protected:
35 void DoDispose() override;
36 void DoSetWifiMac(Ptr<StaWifiMac> mac) override;
37 std::pair<bool, Time> DoGetDelayUntilAccessRequest(uint8_t linkId) override;
38 std::pair<bool, Time> GetDelayUnlessMainPhyTakesOverUlTxop(uint8_t linkId) override;
39 void SwitchMainPhyIfTxopGainedByAuxPhy(uint8_t linkId, AcIndex aci) override;
40 void NotifyEmlsrModeChanged() override;
41
42 /**
43 * Possibly take actions when notified of the MAC header of the MPDU being received by the
44 * given PHY.
45 *
46 * @param phy the given PHY
47 * @param macHdr the MAC header of the MPDU being received
48 * @param txVector the TXVECTOR used to transmit the PSDU
49 * @param psduDuration the remaining duration of the PSDU
50 */
52 const WifiMacHeader& macHdr,
53 const WifiTxVector& txVector,
54 Time psduDuration);
55
56 /**
57 * Use information from NAV and CCA performed by the given PHY on the given link in the last
58 * PIFS interval to determine whether the given EDCAF can start a TXOP. This function is
59 * intended to be used when the main PHY switches channel to start an UL TXOP on a link where
60 * channel access was obtained by a non-TX capable aux PHY.
61 *
62 * @param phy the PHY that performed CCA in the last PIFS interval
63 * @param linkId the ID of the given link
64 * @param edca the given EDCAF
65 */
66 void CheckNavAndCcaLastPifs(Ptr<WifiPhy> phy, uint8_t linkId, Ptr<QosTxop> edca);
67
68 /**
69 * Determine whether the main PHY shall be requested to switch to the link of an aux PHY that
70 * is expected to gain channel access through the given AC in the given delay but it is not
71 * TX capable.
72 *
73 * @param linkId the ID of the link on which the aux PHY is operating
74 * @param aci the index of the given AC
75 * @param delay the delay after which the given AC is expected to gain channel access. Zero
76 * indicates that channel access has been actually gained
77 * @return whether the main PHY shall be requested to switch to the link of the aux PHY
78 */
79 bool RequestMainPhyToSwitch(uint8_t linkId, AcIndex aci, const Time& delay);
80
81 /**
82 * This method is called when the given AC of the EMLSR client is expected to get channel
83 * access in the given delay on the given link, on which an aux PHY that is not TX capable
84 * is operating. This method has to decide whether to request the main PHY to switch to the
85 * given link to try to start a TXOP.
86 *
87 * @param linkId the ID of the given link
88 * @param aci the index of the given AC
89 * @param delay the delay after which the given AC is expected to gain channel access
90 */
91 void SwitchMainPhyIfTxopToBeGainedByAuxPhy(uint8_t linkId, AcIndex aci, const Time& delay);
92
93 private:
94 void DoNotifyTxopEnd(uint8_t linkId) override;
95 void DoNotifyIcfReceived(uint8_t linkId) override;
96 void DoNotifyUlTxopStart(uint8_t linkId) override;
97
98 bool m_useNotifiedMacHdr; //!< whether to use the information about the MAC header of
99 //!< the MPDU being received (if notified by the PHY)
100 bool m_allowUlTxopInRx; //!< whether a (main or aux) PHY is allowed to start an UL
101 //!< TXOP if another PHY is receiving a PPDU
102 bool m_interruptSwitching; //!< whether a main PHY switching can be interrupted to start
103 //!< switching to another link
104 bool m_useAuxPhyCca; //!< whether the CCA performed in the last PIFS interval by a
105 //!< non-TX capable aux PHY should be used when the main PHY
106 //!< ends switching to the aux PHY's link to determine whether
107 //!< TX can start or not
108 Time m_switchMainPhyBackDelay; //!< duration of the timer started in case of non-TX capable aux
109 //!< PHY when medium is sensed busy during the PIFS interval
110 //!< preceding/following the main PHY switch end
111 EventId m_ccaLastPifs; //!< event scheduled in case of non-TX capable aux PHY to
112 //!< determine whether TX can be started based on whether
113 //!< the medium has been idle during the last PIFS interval
114 EventId m_switchMainPhyBackEvent; //!< event scheduled in case of non-TX capable aux PHY when
115 //!< medium is sensed busy during the PIFS interval
116 //!< preceding/following the main PHY switch end
117};
118
119/**
120 * Struct to trace that main PHY switched to leave a link on which an aux PHY was expected to gain
121 * a TXOP but the main PHY did not manage to gain a TXOP in the pre-configured amount of time.
122 */
123struct EmlsrSwitchMainPhyBackTrace : public EmlsrMainPhySwitchTraceImpl<EmlsrSwitchMainPhyBackTrace>
124{
125 static constexpr std::string_view m_name = "TxopNotGainedOnAuxPhyLink"; //!< trace name
126
127 bool nothingToTx; //!< if true, the main PHY managed to gain a TXOP but had nothing to transmit
128
129 /**
130 * Constructor provided because this struct is not an aggregate (it has a base struct), hence
131 * we cannot use designated initializers.
132 *
133 * @param nothing the value for the nothingToTx field
134 */
136 : nothingToTx(nothing)
137 {
138 }
139};
140
141} // namespace ns3
142
143#endif /* ADVANCED_EMLSR_MANAGER_H */
AdvancedEmlsrManager is an advanced EMLSR manager.
std::pair< bool, Time > DoGetDelayUntilAccessRequest(uint8_t linkId) override
Subclasses have to provide an implementation for this method, that is called by the base class when t...
std::pair< bool, Time > GetDelayUnlessMainPhyTakesOverUlTxop(uint8_t linkId) override
Subclasses have to provide an implementation for this method, that is called by the base class when t...
bool m_useAuxPhyCca
whether the CCA performed in the last PIFS interval by a non-TX capable aux PHY should be used when t...
bool RequestMainPhyToSwitch(uint8_t linkId, AcIndex aci, const Time &delay)
Determine whether the main PHY shall be requested to switch to the link of an aux PHY that is expecte...
void SwitchMainPhyIfTxopToBeGainedByAuxPhy(uint8_t linkId, AcIndex aci, const Time &delay)
This method is called when the given AC of the EMLSR client is expected to get channel access in the ...
void DoNotifyIcfReceived(uint8_t linkId) override
Notify the subclass of the reception of an initial Control frame on the given link.
bool m_allowUlTxopInRx
whether a (main or aux) PHY is allowed to start an UL TXOP if another PHY is receiving a PPDU
void CheckNavAndCcaLastPifs(Ptr< WifiPhy > phy, uint8_t linkId, Ptr< QosTxop > edca)
Use information from NAV and CCA performed by the given PHY on the given link in the last PIFS interv...
void DoNotifyTxopEnd(uint8_t linkId) override
Notify the subclass of the end of a TXOP on the given link.
void NotifyEmlsrModeChanged() override
Notify subclass that EMLSR mode changed.
static TypeId GetTypeId()
Get the type ID.
bool m_useNotifiedMacHdr
whether to use the information about the MAC header of the MPDU being received (if notified by the PH...
void DoNotifyUlTxopStart(uint8_t linkId) override
Notify the subclass of the start of an UL TXOP on the given link.
Time m_switchMainPhyBackDelay
duration of the timer started in case of non-TX capable aux PHY when medium is sensed busy during the...
void DoDispose() override
Destructor implementation.
EventId m_switchMainPhyBackEvent
event scheduled in case of non-TX capable aux PHY when medium is sensed busy during the PIFS interval...
void SwitchMainPhyIfTxopGainedByAuxPhy(uint8_t linkId, AcIndex aci) override
Subclasses have to provide an implementation for this method, that is called by the base class when t...
void DoSetWifiMac(Ptr< StaWifiMac > mac) override
Allow subclasses to take actions when the MAC is set.
void ReceivedMacHdr(Ptr< WifiPhy > phy, const WifiMacHeader &macHdr, const WifiTxVector &txVector, Time psduDuration)
Possibly take actions when notified of the MAC header of the MPDU being received by the given PHY.
EventId m_ccaLastPifs
event scheduled in case of non-TX capable aux PHY to determine whether TX can be started based on whe...
bool m_interruptSwitching
whether a main PHY switching can be interrupted to start switching to another link
DefaultEmlsrManager is the default EMLSR manager.
An identifier for simulation events.
Definition event-id.h:45
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
a unique identifier for an interface.
Definition type-id.h:48
Implements the IEEE 802.11 MAC header.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition qos-utils.h:62
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Implementation for the EMLSR Main PHY switch trace base struct.
Struct to trace that main PHY switched to leave a link on which an aux PHY was expected to gain a TXO...
bool nothingToTx
if true, the main PHY managed to gain a TXOP but had nothing to transmit
EmlsrSwitchMainPhyBackTrace(bool nothing)
Constructor provided because this struct is not an aggregate (it has a base struct),...
static constexpr std::string_view m_name
trace name