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
20class MgtEmlOmn;
21
22/**
23 * @ingroup wifi
24 * Reasons for an EMLSR client to drop an ICF
25 */
26enum class WifiIcfDrop : uint8_t
27{
28 USING_OTHER_LINK = 0, // another EMLSR link is being used
29 NOT_ENOUGH_TIME_TX, // not enough time for the main PHY to switch (because in TX state)
30 NOT_ENOUGH_TIME_RX, // not enough time for the main PHY to switch (because in RX state)
31 NOT_ENOUGH_TIME_SWITCH, // not enough time for the main PHY to switch (already switching)
32 NOT_ENOUGH_TIME_SLEEP, // not enough time for the main PHY to switch (because in SLEEP state)
33};
34
35/**
36 * @brief Stream insertion operator.
37 *
38 * @param os the stream
39 * @param reason the reason for dropping the ICF
40 * @returns a reference to the stream
41 */
42inline std::ostream&
43operator<<(std::ostream& os, WifiIcfDrop reason)
44{
45 switch (reason)
46 {
48 return (os << "USING_OTHER_LINK");
50 return (os << "NOT_ENOUGH_TIME_TX");
52 return (os << "NOT_ENOUGH_TIME_RX");
54 return (os << "NOT_ENOUGH_TIME_SWITCH");
56 return (os << "NOT_ENOUGH_TIME_SLEEP");
57 default:
58 NS_FATAL_ERROR("Unknown wifi ICF drop reason");
59 return (os << "UNKNOWN");
60 }
61}
62
63/**
64 * @ingroup wifi
65 *
66 * EhtFrameExchangeManager handles the frame exchange sequences
67 * for EHT stations.
68 */
70{
71 public:
72 /**
73 * @brief Get the type ID.
74 * @return the object TypeId
75 */
76 static TypeId GetTypeId();
78 ~EhtFrameExchangeManager() override;
79
80 void SetLinkId(uint8_t linkId) override;
82 bool StartTransmission(Ptr<Txop> edca, MHz_u allowedWidth) override;
83
84 /**
85 * Send an EML Operating Mode Notification frame to the given station.
86 *
87 * @param dest the MAC address of the receiver
88 * @param frame the EML Operating Mode Notification frame to send
89 */
90 void SendEmlOmn(const Mac48Address& dest, const MgtEmlOmn& frame);
91
92 /**
93 * Get the RSSI of the most recent packet received from the station having the given address. If
94 * there is no such information for the given station and the station is affiliated with an MLD,
95 * return the RSSI of the most recent packet received from another station of the same MLD.
96 *
97 * @param address of the remote station
98 * @return the RSSI of the most recent packet received from the remote station
99 */
100 std::optional<dBm_u> GetMostRecentRssi(const Mac48Address& address) const override;
101
102 /**
103 * @param psdu the given PSDU
104 * @param aid the AID of an EMLSR client
105 * @param address the link MAC address of an EMLSR client
106 * @return whether the EMLSR client having the given AID and MAC address shall switch back to
107 * the listening operation when receiving the given PSDU
108 */
110 uint16_t aid,
111 const Mac48Address& address) const;
112
113 /**
114 * Notify that the given PHY will switch channel to operate on another EMLSR link
115 * after the given delay.
116 *
117 * @param phy the given PHY
118 * @param linkId the ID of the EMLSR link on which the given PHY is operating
119 * @param delay the delay after which the channel switch will be completed
120 */
121 void NotifySwitchingEmlsrLink(Ptr<WifiPhy> phy, uint8_t linkId, Time delay);
122
123 /**
124 * @return whether this is an EMLSR link that has been blocked because another EMLSR link
125 * is being used
126 */
127 bool UsingOtherEmlsrLink() const;
128
129 /**
130 * Check if the frame received (or being received) is sent by an EMLSR client to start an
131 * UL TXOP. If so, take the appropriate actions (e.g., block transmission to the EMLSR client
132 * on the other links). This method is intended to be called when an MPDU (possibly within
133 * an A-MPDU) is received or when the reception of the MAC header in an MPDU is notified.
134 *
135 * @param hdr the MAC header of the received (or being received) MPDU
136 * @param txVector the TXVECTOR used to transmit the frame received (or being received)
137 * @return whether the frame received (or being received) is sent by an EMLSR client to start
138 * an UL TXOP
139 */
140 bool CheckEmlsrClientStartingTxop(const WifiMacHeader& hdr, const WifiTxVector& txVector);
141
142 /**
143 * This method is intended to be called when an AP MLD detects that an EMLSR client previously
144 * involved in the current TXOP will start waiting for the transition delay interval (to switch
145 * back to listening operation) after the given delay.
146 * This method blocks the transmissions on all the EMLSR links of the given EMLSR client until
147 * the transition delay advertised by the EMLSR client expires.
148 *
149 * @param address the link MAC address of the given EMLSR client
150 * @param delay the given delay
151 */
152 void EmlsrSwitchToListening(Mac48Address address, const Time& delay);
153
154 /**
155 * @return a reference to the event indicating the possible end of the current TXOP (of
156 * which this device is not the holder)
157 */
159
160 /**
161 * Set the padding and the TXVECTOR of the given Trigger Frame, in case it is an Initial
162 * Control Frame for some EMLSR client(s).
163 *
164 * @param trigger the given Trigger Frame
165 * @param txVector the TXVECTOR used to transmit the Trigger Frame
166 */
167 void SetIcfPaddingAndTxVector(CtrlTriggerHeader& trigger, WifiTxVector& txVector) const;
168
169 /// ICF drop reason traced callback (WifiMac exposes this trace source)
171
172 protected:
173 void DoDispose() override;
174 void RxStartIndication(WifiTxVector txVector, Time psduDuration) override;
175 void ForwardPsduDown(Ptr<const WifiPsdu> psdu, WifiTxVector& txVector) override;
176 void ForwardPsduMapDown(WifiConstPsduMap psduMap, WifiTxVector& txVector) override;
177 void CtsAfterMuRtsTimeout(Ptr<WifiMpdu> muRts, const WifiTxVector& txVector) override;
178 bool GetUpdateCwOnCtsTimeout() const override;
179 bool GetReportRtsFailed() const override;
180 void SendCtsAfterMuRts(const WifiMacHeader& muRtsHdr,
181 const CtrlTriggerHeader& trigger,
182 double muRtsSnr) override;
183 void TransmissionSucceeded() override;
184 void TransmissionFailed(bool forceCurrentCw = false) override;
185 void NotifyChannelReleased(Ptr<Txop> txop) override;
186 void PreProcessFrame(Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector) override;
187 void PostProcessFrame(Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector) override;
189 RxSignalInfo rxSignalInfo,
190 const WifiTxVector& txVector,
191 bool inAmpdu) override;
193 const RxSignalInfo& rxSignalInfo,
194 const WifiTxVector& txVector,
195 const std::vector<bool>& perMpduStatus) override;
196 void NavResetTimeout() override;
197 void IntraBssNavResetTimeout() override;
198 void SendCtsAfterRts(const WifiMacHeader& rtsHdr,
199 const WifiTxVector& rtsTxVector,
200 double rtsSnr) override;
201 void PsduRxError(Ptr<const WifiPsdu> psdu) override;
202 void ReceivedQosNullAfterBsrpTf(Mac48Address sender) override;
204 const WifiMacHeader& hdr) override;
205 void TbPpduTimeout(WifiPsduMap* psduMap, std::size_t nSolicitedStations) override;
206 void BlockAcksInTbPpduTimeout(WifiPsduMap* psduMap, std::size_t nSolicitedStations) override;
207 void ProtectionCompleted() override;
208
209 /**
210 * @return whether this is an EMLSR client that cannot respond to an ICF received a SIFS before
211 */
213
214 /**
215 * Check if the MPDU that has been received on this link shall be dropped. In our model,
216 * an aux PHY, or the main PHY that is not involved in any TXOP, can receive:
217 * - management frames
218 * - CTS
219 * - CF-End
220 * - broadcast data frames
221 * Note that this method does not attempt to detect if the given MPDU is an ICF (this is done
222 * by ReceiveMpdu).
223 *
224 * @param mpdu the MPDU that has been received
225 * @return whether the given MPDU shall be dropped
226 */
228
229 /**
230 * Check whether all the stations that did not respond (to a certain frame) are EMLSR clients
231 * trying to start an UL TXOP on another link.
232 *
233 * @param staMissedResponseFrom stations that did not respond
234 * @return whether all the stations that did not respond are EMLSR clients trying to start an
235 * UL TXOP on another link
236 */
237 bool IsCrossLinkCollision(const std::set<Mac48Address>& staMissedResponseFrom) const;
238
239 /**
240 * Unblock transmissions on all the links of the given EMLSR client, provided that the latter
241 * is not involved in any DL or UL TXOP on another link.
242 *
243 * @param address the link MAC address of the given EMLSR client
244 * @param checkThisLink whether to check if the EMLSR client is involved in a DL TXOP on
245 * this link
246 * @return whether transmissions could be unblocked
247 */
248 bool UnblockEmlsrLinksIfAllowed(Mac48Address address, bool checkThisLink);
249
250 private:
251 /**
252 * @return whether the received ICF must be dropped because we are unable to process it
253 * (e.g., another EMLSR link is being used or there is no time for main PHY switch)
254 */
255 bool DropReceivedIcf();
256
257 /**
258 * For each EMLSR client in the given set of clients that did not respond to a frame requesting
259 * a response from multiple clients, have the client switch to listening or simply unblock
260 * links depending on whether the EMLSR client was protected or not.
261 *
262 * @param clients the given set of clients
263 */
264 void SwitchToListeningOrUnblockLinks(const std::set<Mac48Address>& clients);
265
266 /**
267 * Generate an in-device interference of the given power for the given duration for the given
268 * PHY.
269 *
270 * @param phy the PHY for which in-device interference is generated
271 * @param duration the duration of the in-device interference
272 * @param txPower the TX power
273 */
274 void GenerateInDeviceInterference(Ptr<WifiPhy> phy, Time duration, Watt_u txPower);
275
276 /**
277 * Generate in-device interference caused by a transmission on this link for all the other PHYs
278 * of this EMLSR client.
279 *
280 * @param txDuration the duration of the transmission
281 * @param txVector the TXVECTOR used to transmit the frame
282 */
283 void GenerateInDeviceInterferenceForAll(const Time& txDuration, const WifiTxVector& txVector);
284
285 /**
286 * Update the TXOP end timer when starting a frame transmission.
287 *
288 * @param txDuration the TX duration of the frame being transmitted
289 * @param durationId the Duration/ID value carried by the frame being transmitted
290 */
291 void UpdateTxopEndOnTxStart(Time txDuration, Time durationId);
292
293 /**
294 * Update the TXOP end timer when receiving a PHY-RXSTART.indication.
295 *
296 * @param psduDuration the TX duration of the PSDU being received
297 */
298 void UpdateTxopEndOnRxStartIndication(Time psduDuration);
299
300 /**
301 * Update the TXOP end timer when a frame reception ends.
302 *
303 * @param durationId the Duration/ID value carried by the received frame
304 */
305 void UpdateTxopEndOnRxEnd(Time durationId);
306
307 /**
308 * Take actions when a TXOP (of which we are not the holder) ends.
309 *
310 * @param txopHolder the holder of the TXOP (if any)
311 */
312 void TxopEnd(const std::optional<Mac48Address>& txopHolder);
313
314 bool m_dlTxopStart{false}; //!< whether a DL TXOP start is detected and needs to be notified to
315 //!< the EMLSR manager after post-processing the initial frame
316 EventId m_ongoingTxopEnd; //!< event indicating the possible end of the current TXOP (of which
317 //!< we are not the holder)
318 std::unordered_map<Mac48Address, EventId, WifiAddressHash>
319 m_transDelayTimer; //!< MLD address-indexed map of transition delay timers
320};
321
322} // namespace ns3
323
324#endif /* EHT_FRAME_EXCHANGE_MANAGER_H */
Headers for Trigger frames.
EhtFrameExchangeManager handles the frame exchange sequences for EHT stations.
void GenerateInDeviceInterferenceForAll(const Time &txDuration, const WifiTxVector &txVector)
Generate in-device interference caused by a transmission on this link for all the other PHYs of this ...
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 TransmissionFailed(bool forceCurrentCw=false) override
Take necessary actions upon a transmission failure.
void ForwardPsduMapDown(WifiConstPsduMap psduMap, WifiTxVector &txVector) override
Forward a map of PSDUs down to the PHY layer.
void SendCtsAfterRts(const WifiMacHeader &rtsHdr, const WifiTxVector &rtsTxVector, double rtsSnr) override
Send CTS after receiving RTS.
void ReceivedQosNullAfterBsrpTf(Mac48Address sender) override
Perform the actions required when receiving QoS Null frame(s) from the given sender after a BSRP Trig...
void SetIcfPaddingAndTxVector(CtrlTriggerHeader &trigger, WifiTxVector &txVector) const
Set the padding and the TXVECTOR of the given Trigger Frame, in case it is an Initial Control Frame f...
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 EmlsrSwitchToListening(Mac48Address address, const Time &delay)
This method is intended to be called when an AP MLD detects that an EMLSR client previously involved ...
void BlockAcksInTbPpduTimeout(WifiPsduMap *psduMap, std::size_t nSolicitedStations) override
Take the necessary actions after that some BlockAck frames are missing in response to a DL MU PPDU.
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 ProtectionCompleted() override
Transmit prepared frame immediately, if no protection was used, or in a SIFS, if protection was compl...
void TbPpduTimeout(WifiPsduMap *psduMap, std::size_t nSolicitedStations) override
Take the necessary actions after that some TB PPDUs are missing in response to Trigger Frame.
void IntraBssNavResetTimeout() override
Reset the intra-BSS NAV upon expiration of the intra-BSS NAV reset timer.
void GenerateInDeviceInterference(Ptr< WifiPhy > phy, Time duration, Watt_u txPower)
Generate an in-device interference of the given power for the given duration for the given PHY.
bool ShallDropReceivedMpdu(Ptr< const WifiMpdu > mpdu) const
Check if the MPDU that has been received on this link shall be dropped.
void SendCtsAfterMuRts(const WifiMacHeader &muRtsHdr, const CtrlTriggerHeader &trigger, double muRtsSnr) override
Send CTS after receiving an MU-RTS.
void SwitchToListeningOrUnblockLinks(const std::set< Mac48Address > &clients)
For each EMLSR client in the given set of clients that did not respond to a frame requesting a respon...
bool IsCrossLinkCollision(const std::set< Mac48Address > &staMissedResponseFrom) const
Check whether all the stations that did not respond (to a certain frame) are EMLSR clients trying to ...
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.
WifiMac::IcfDropTracedCallback m_icfDropCallback
ICF drop reason traced callback (WifiMac exposes this trace source)
void EndReceiveAmpdu(Ptr< const WifiPsdu > psdu, const RxSignalInfo &rxSignalInfo, const WifiTxVector &txVector, const std::vector< bool > &perMpduStatus) override
This method is called when the reception of an A-MPDU including multiple MPDUs is completed.
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 SendQosNullFramesInTbPpdu(const CtrlTriggerHeader &trigger, const WifiMacHeader &hdr) override
Send QoS Null frames in response to a Basic or BSRP Trigger Frame.
void UpdateTxopEndOnRxStartIndication(Time psduDuration)
Update the TXOP end timer when receiving a PHY-RXSTART.indication.
void TxopEnd(const std::optional< Mac48Address > &txopHolder)
Take actions when a TXOP (of which we are not the holder) ends.
bool m_dlTxopStart
whether a DL TXOP start is detected and needs to be notified to the EMLSR manager after post-processi...
bool UnblockEmlsrLinksIfAllowed(Mac48Address address, bool checkThisLink)
Unblock transmissions on all the links of the given EMLSR client, provided that the latter is not inv...
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
a unique identifier for an interface.
Definition type-id.h:49
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...
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
WifiIcfDrop
Reasons for an EMLSR client to drop an ICF.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition angles.cc:148
std::unordered_map< uint16_t, Ptr< WifiPsdu > > WifiPsduMap
Map of PSDUs indexed by STA-ID.
Definition wifi-mac.h:78
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
Definition wifi-ppdu.h:38
RxSignalInfo structure containing info on the received signal.
Definition wifi-types.h:79