A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
eht-frame-exchange-manager.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Universita' degli Studi 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 EHT_FRAME_EXCHANGE_MANAGER_H
10#define EHT_FRAME_EXCHANGE_MANAGER_H
11
12#include "ns3/he-frame-exchange-manager.h"
13#include "ns3/mgt-headers.h"
14
15#include <unordered_map>
16
17namespace ns3
18{
19
20/// aRxPHYStartDelay value to use when waiting for a new frame in the context of EMLSR operations
21/// (Sec. 35.3.17 of 802.11be D3.1)
23
24class MgtEmlOmn;
25
26/**
27 * \ingroup wifi
28 * Reasons for an EMLSR client to drop an ICF
29 */
30enum class WifiIcfDrop : uint8_t
31{
32 USING_OTHER_LINK = 0, // another EMLSR link is being used
33 NOT_ENOUGH_TIME_TX, // not enough time for the main PHY to switch (because in TX state)
34 NOT_ENOUGH_TIME_RX, // not enough time for the main PHY to switch (because in RX state)
35 NOT_ENOUGH_TIME_SWITCH, // not enough time for the main PHY to switch (already switching)
36 NOT_ENOUGH_TIME_SLEEP, // not enough time for the main PHY to switch (because in SLEEP state)
37};
38
39/**
40 * \brief Stream insertion operator.
41 *
42 * \param os the stream
43 * \param reason the reason for dropping the ICF
44 * \returns a reference to the stream
45 */
46inline std::ostream&
47operator<<(std::ostream& os, WifiIcfDrop reason)
48{
49 switch (reason)
50 {
52 return (os << "USING_OTHER_LINK");
54 return (os << "NOT_ENOUGH_TIME_TX");
56 return (os << "NOT_ENOUGH_TIME_RX");
58 return (os << "NOT_ENOUGH_TIME_SWITCH");
60 return (os << "NOT_ENOUGH_TIME_SLEEP");
61 default:
62 NS_FATAL_ERROR("Unknown wifi ICF drop reason");
63 return (os << "UNKNOWN");
64 }
65}
66
67/**
68 * \ingroup wifi
69 *
70 * EhtFrameExchangeManager handles the frame exchange sequences
71 * for EHT stations.
72 */
74{
75 public:
76 /**
77 * \brief Get the type ID.
78 * \return the object TypeId
79 */
80 static TypeId GetTypeId();
82 ~EhtFrameExchangeManager() override;
83
84 void SetLinkId(uint8_t linkId) override;
86 bool StartTransmission(Ptr<Txop> edca, MHz_u allowedWidth) override;
87
88 /**
89 * Send an EML Operating Mode Notification frame to the given station.
90 *
91 * \param dest the MAC address of the receiver
92 * \param frame the EML Operating Mode Notification frame to send
93 */
94 void SendEmlOmn(const Mac48Address& dest, const MgtEmlOmn& frame);
95
96 /**
97 * Get the RSSI of the most recent packet received from the station having the given address. If
98 * there is no such information for the given station and the station is affiliated with an MLD,
99 * return the RSSI of the most recent packet received from another station of the same MLD.
100 *
101 * \param address of the remote station
102 * \return the RSSI of the most recent packet received from the remote station
103 */
104 std::optional<dBm_u> GetMostRecentRssi(const Mac48Address& address) const override;
105
106 /**
107 * \param psdu the given PSDU
108 * \param aid the AID of an EMLSR client
109 * \param address the link MAC address of an EMLSR client
110 * \return whether the EMLSR client having the given AID and MAC address shall switch back to
111 * the listening operation when receiving the given PSDU
112 */
114 uint16_t aid,
115 const Mac48Address& address) const;
116
117 /**
118 * Notify that the given PHY will switch channel to operate on another EMLSR link
119 * after the given delay.
120 *
121 * \param phy the given PHY
122 * \param linkId the ID of the EMLSR link on which the given PHY is operating
123 * \param delay the delay after which the channel switch will be completed
124 */
125 void NotifySwitchingEmlsrLink(Ptr<WifiPhy> phy, uint8_t linkId, Time delay);
126
127 /**
128 * \return whether this is an EMLSR link that has been blocked because another EMLSR link
129 * is being used
130 */
131 bool UsingOtherEmlsrLink() const;
132
133 /**
134 * Check if the frame received (or being received) is sent by an EMLSR client to start an
135 * UL TXOP. If so, take the appropriate actions (e.g., block transmission to the EMLSR client
136 * on the other links). This method is intended to be called when an MPDU (possibly within
137 * an A-MPDU) is received or when the reception of the MAC header in an MPDU is notified.
138 *
139 * \param hdr the MAC header of the received (or being received) MPDU
140 * \param txVector the TXVECTOR used to transmit the frame received (or being received)
141 * \return whether the frame received (or being received) is sent by an EMLSR client to start
142 * an UL TXOP
143 */
144 bool CheckEmlsrClientStartingTxop(const WifiMacHeader& hdr, const WifiTxVector& txVector);
145
146 /**
147 * This method is intended to be called when an AP MLD detects that an EMLSR client previously
148 * involved in the current TXOP will start waiting for the transition delay interval (to switch
149 * back to listening operation) after the given delay.
150 * This method blocks the transmissions on all the EMLSR links of the given EMLSR client until
151 * the transition delay advertised by the EMLSR client expires.
152 *
153 * \param address the link MAC address of the given EMLSR client
154 * \param delay the given delay
155 */
156 void EmlsrSwitchToListening(const Mac48Address& address, const Time& delay);
157
158 /**
159 * \return a reference to the event indicating the possible end of the current TXOP (of
160 * which this device is not the holder)
161 */
163
164 /// ICF drop reason traced callback (WifiMac exposes this trace source)
166
167 protected:
168 void DoDispose() override;
169 void RxStartIndication(WifiTxVector txVector, Time psduDuration) override;
170 void ForwardPsduDown(Ptr<const WifiPsdu> psdu, WifiTxVector& txVector) override;
171 void ForwardPsduMapDown(WifiConstPsduMap psduMap, WifiTxVector& txVector) override;
172 void SendMuRts(const WifiTxParameters& txParams) override;
173 void CtsAfterMuRtsTimeout(Ptr<WifiMpdu> muRts, const WifiTxVector& txVector) override;
174 void SendCtsAfterMuRts(const WifiMacHeader& muRtsHdr,
175 const CtrlTriggerHeader& trigger,
176 double muRtsSnr) override;
177 void TransmissionSucceeded() override;
178 void TransmissionFailed() override;
179 void NotifyChannelReleased(Ptr<Txop> txop) override;
180 void PreProcessFrame(Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector) override;
181 void PostProcessFrame(Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector) override;
183 RxSignalInfo rxSignalInfo,
184 const WifiTxVector& txVector,
185 bool inAmpdu) override;
186 void NavResetTimeout() override;
187 void IntraBssNavResetTimeout() override;
188 void SendCtsAfterRts(const WifiMacHeader& rtsHdr, WifiMode rtsTxMode, double rtsSnr) override;
189 void PsduRxError(Ptr<const WifiPsdu> psdu) override;
190
191 private:
192 /**
193 * \return whether the received ICF must be dropped because we are unable to process it
194 * (e.g., another EMLSR link is being used or there is no time for main PHY switch)
195 */
196 bool DropReceivedIcf();
197
198 /**
199 * Generate an in-device interference of the given power on the given link for the given
200 * duration.
201 *
202 * \param linkId the ID of the link on which in-device interference is generated
203 * \param duration the duration of the in-device interference
204 * \param txPower the TX power
205 */
206 void GenerateInDeviceInterference(uint8_t linkId, Time duration, Watt_u txPower);
207
208 /**
209 * Update the TXOP end timer when starting a frame transmission.
210 *
211 * \param txDuration the TX duration of the frame being transmitted
212 * \param durationId the Duration/ID value carried by the frame being transmitted
213 */
214 void UpdateTxopEndOnTxStart(Time txDuration, Time durationId);
215
216 /**
217 * Update the TXOP end timer when receiving a PHY-RXSTART.indication.
218 *
219 * \param psduDuration the TX duration of the PSDU being received
220 */
221 void UpdateTxopEndOnRxStartIndication(Time psduDuration);
222
223 /**
224 * Update the TXOP end timer when a frame reception ends.
225 *
226 * \param durationId the Duration/ID value carried by the received frame
227 */
228 void UpdateTxopEndOnRxEnd(Time durationId);
229
230 /**
231 * Take actions when a TXOP (of which we are not the holder) ends.
232 *
233 * \param txopHolder the holder of the TXOP (if any)
234 */
235 void TxopEnd(const std::optional<Mac48Address>& txopHolder);
236
237 EventId m_ongoingTxopEnd; //!< event indicating the possible end of the current TXOP (of which
238 //!< we are not the holder)
239 std::unordered_map<Mac48Address, EventId, WifiAddressHash>
240 m_transDelayTimer; //!< MLD address-indexed map of transition delay timers
241};
242
243} // namespace ns3
244
245#endif /* EHT_FRAME_EXCHANGE_MANAGER_H */
Headers for Trigger frames.
EhtFrameExchangeManager handles the frame exchange sequences for EHT stations.
void PostProcessFrame(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector) override
Perform actions that are possibly needed after receiving any frame, independently of whether the fram...
void ForwardPsduMapDown(WifiConstPsduMap psduMap, WifiTxVector &txVector) override
Forward a map of PSDUs down to the PHY layer.
TracedCallback< WifiIcfDrop, uint8_t > m_icfDropCallback
ICF drop reason traced callback (WifiMac exposes this trace source)
void PreProcessFrame(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector) override
Perform actions that are possibly needed when receiving any frame, independently of whether the frame...
void NavResetTimeout() override
Reset the NAV upon expiration of the NAV reset timer.
void ForwardPsduDown(Ptr< const WifiPsdu > psdu, WifiTxVector &txVector) override
Forward a PSDU down to the PHY layer.
void PsduRxError(Ptr< const WifiPsdu > psdu) override
This method is called when the reception of a PSDU fails.
void SendEmlOmn(const Mac48Address &dest, const MgtEmlOmn &frame)
Send an EML Operating Mode Notification frame to the given station.
Ptr< WifiMpdu > CreateAliasIfNeeded(Ptr< WifiMpdu > mpdu) const override
Create an alias of the given MPDU for transmission by this Frame Exchange Manager.
void TransmissionFailed() override
Take necessary actions upon a transmission failure.
void IntraBssNavResetTimeout() override
Reset the intra-BSS NAV upon expiration of the intra-BSS NAV reset timer.
void SendMuRts(const WifiTxParameters &txParams) override
Send an MU-RTS to begin an MU-RTS/CTS frame exchange protecting an MU PPDU.
void SendCtsAfterMuRts(const WifiMacHeader &muRtsHdr, const CtrlTriggerHeader &trigger, double muRtsSnr) override
Send CTS after receiving an MU-RTS.
std::optional< dBm_u > GetMostRecentRssi(const Mac48Address &address) const override
Get the RSSI of the most recent packet received from the station having the given address.
void UpdateTxopEndOnRxEnd(Time durationId)
Update the TXOP end timer when a frame reception ends.
bool CheckEmlsrClientStartingTxop(const WifiMacHeader &hdr, const WifiTxVector &txVector)
Check if the frame received (or being received) is sent by an EMLSR client to start an UL TXOP.
void TransmissionSucceeded() override
Take necessary actions upon a transmission success.
bool GetEmlsrSwitchToListening(Ptr< const WifiPsdu > psdu, uint16_t aid, const Mac48Address &address) const
static TypeId GetTypeId()
Get the type ID.
void DoDispose() override
Destructor implementation.
std::unordered_map< Mac48Address, EventId, WifiAddressHash > m_transDelayTimer
MLD address-indexed map of transition delay timers.
void NotifyChannelReleased(Ptr< Txop > txop) override
Notify the given Txop that channel has been released.
EventId m_ongoingTxopEnd
event indicating the possible end of the current TXOP (of which we are not the holder)
void RxStartIndication(WifiTxVector txVector, Time psduDuration) override
void ReceiveMpdu(Ptr< const WifiMpdu > mpdu, RxSignalInfo rxSignalInfo, const WifiTxVector &txVector, bool inAmpdu) override
This method handles the reception of an MPDU (possibly included in an A-MPDU)
void UpdateTxopEndOnTxStart(Time txDuration, Time durationId)
Update the TXOP end timer when starting a frame transmission.
void GenerateInDeviceInterference(uint8_t linkId, Time duration, Watt_u txPower)
Generate an in-device interference of the given power on the given link for the given duration.
void SendCtsAfterRts(const WifiMacHeader &rtsHdr, WifiMode rtsTxMode, double rtsSnr) override
Send CTS after receiving RTS.
void UpdateTxopEndOnRxStartIndication(Time psduDuration)
Update the TXOP end timer when receiving a PHY-RXSTART.indication.
void EmlsrSwitchToListening(const Mac48Address &address, const Time &delay)
This method is intended to be called when an AP MLD detects that an EMLSR client previously involved ...
void TxopEnd(const std::optional< Mac48Address > &txopHolder)
Take actions when a TXOP (of which we are not the holder) ends.
void CtsAfterMuRtsTimeout(Ptr< WifiMpdu > muRts, const WifiTxVector &txVector) override
Called when no CTS frame is received after an MU-RTS.
void NotifySwitchingEmlsrLink(Ptr< WifiPhy > phy, uint8_t linkId, Time delay)
Notify that the given PHY will switch channel to operate on another EMLSR link after the given delay.
bool StartTransmission(Ptr< Txop > edca, MHz_u allowedWidth) override
Request the FrameExchangeManager to start a frame exchange sequence.
void SetLinkId(uint8_t linkId) override
Set the ID of the link this Frame Exchange Manager is associated with.
An identifier for simulation events.
Definition event-id.h:45
HeFrameExchangeManager handles the frame exchange sequences for HE stations.
an EUI-48 address
Implement the header for Action frames of type EML Operating Mode Notification.
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition type-id.h:48
Implements the IEEE 802.11 MAC header.
represent a single transmission mode
Definition wifi-mode.h:40
This class stores the TX parameters (TX vector, protection mechanism, acknowledgment mechanism,...
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
WifiIcfDrop
Reasons for an EMLSR client to drop an ICF.
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Definition nstime.h:828
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition angles.cc:148
const Time EMLSR_RX_PHY_START_DELAY
aRxPHYStartDelay value to use when waiting for a new frame in the context of EMLSR operations (Sec.
RxSignalInfo structure containing info on the received signal.
Definition wifi-types.h:72