wifi: EHT FEM can send EML Operating Mode Notification frames

This commit is contained in:
Stefano Avallone
2023-01-31 20:02:40 +01:00
committed by Stefano Avallone
parent af8006617a
commit ce7e7b257e
2 changed files with 43 additions and 0 deletions

View File

@@ -23,6 +23,7 @@
#include "ns3/abort.h"
#include "ns3/log.h"
#include "ns3/wifi-mac-queue.h"
#undef NS_LOG_APPEND_CONTEXT
#define NS_LOG_APPEND_CONTEXT std::clog << "[link=" << +m_linkId << "][mac=" << m_self << "] "
@@ -121,6 +122,38 @@ EhtFrameExchangeManager::ForwardPsduDown(Ptr<const WifiPsdu> psdu, WifiTxVector&
HeFrameExchangeManager::ForwardPsduDown(psdu, txVector);
}
void
EhtFrameExchangeManager::SendEmlOperatingModeNotification(
const Mac48Address& dest,
const MgtEmlOperatingModeNotification& frame)
{
NS_LOG_FUNCTION(this << dest << frame);
WifiMacHeader hdr;
hdr.SetType(WIFI_MAC_MGT_ACTION);
hdr.SetAddr1(dest);
hdr.SetAddr2(m_self);
hdr.SetAddr3(m_bssid);
hdr.SetDsNotTo();
hdr.SetDsNotFrom();
// get the sequence number for the TWT Setup management frame
const auto sequence = m_txMiddle->GetNextSequenceNumberFor(&hdr);
hdr.SetSequenceNumber(sequence);
WifiActionHeader actionHdr;
WifiActionHeader::ActionValue action;
action.protectedEhtAction = WifiActionHeader::PROTECTED_EHT_EML_OPERATING_MODE_NOTIFICATION;
actionHdr.SetAction(WifiActionHeader::PROTECTED_EHT, action);
auto packet = Create<Packet>();
packet->AddHeader(frame);
packet->AddHeader(actionHdr);
// Use AC_VO to send management frame addressed to a QoS STA (Sec. 10.2.3.2 of 802.11-2020)
m_mac->GetQosTxop(AC_VO)->Queue(Create<WifiMpdu>(packet, hdr));
}
std::optional<double>
EhtFrameExchangeManager::GetMostRecentRssi(const Mac48Address& address) const
{

View File

@@ -21,6 +21,7 @@
#define EHT_FRAME_EXCHANGE_MANAGER_H
#include "ns3/he-frame-exchange-manager.h"
#include "ns3/mgt-headers.h"
namespace ns3
{
@@ -45,6 +46,15 @@ class EhtFrameExchangeManager : public HeFrameExchangeManager
void SetLinkId(uint8_t linkId) override;
Ptr<WifiMpdu> CreateAliasIfNeeded(Ptr<WifiMpdu> mpdu) const override;
/**
* Send an EML Operating Mode Notification frame to the given station.
*
* \param dest the MAC address of the receiver
* \param frame the EML Operating Mode Notification frame to send
*/
void SendEmlOperatingModeNotification(const Mac48Address& dest,
const MgtEmlOperatingModeNotification& frame);
/**
* Get the RSSI (in dBm) of the most recent packet received from the station having
* the given address. If there is no such information for the given station and the