wifi: Include HE 6GHz Band Capabilities in management frames

This commit is contained in:
Rami Abdallah
2024-02-27 23:25:15 +01:00
committed by Stefano Avallone
parent e7b50e8144
commit b47358f4a6
6 changed files with 133 additions and 1 deletions

View File

@@ -1151,10 +1151,14 @@ ApWifiMac::SendProbeResp(Mac48Address to, uint8_t linkId)
{
probe.Get<HeCapabilities>() = GetHeCapabilities(linkId);
probe.Get<HeOperation>() = GetHeOperation(linkId);
if (auto muEdcaParameterSet = GetMuEdcaParameterSet(); muEdcaParameterSet.has_value())
if (auto muEdcaParameterSet = GetMuEdcaParameterSet())
{
probe.Get<MuEdcaParameterSet>() = std::move(*muEdcaParameterSet);
}
if (Is6GhzBand(linkId))
{
probe.Get<He6GhzBandCapabilities>() = GetHe6GhzBandCapabilities(linkId);
}
}
if (GetEhtSupported())
{
@@ -1254,6 +1258,10 @@ ApWifiMac::GetAssocResp(Mac48Address to, uint8_t linkId)
{
assoc.Get<MuEdcaParameterSet>() = std::move(*muEdcaParameterSet);
}
if (Is6GhzBand(linkId))
{
assoc.Get<He6GhzBandCapabilities>() = GetHe6GhzBandCapabilities(linkId);
}
}
if (GetEhtSupported())
{
@@ -1546,6 +1554,10 @@ ApWifiMac::SendOneBeacon(uint8_t linkId)
{
beacon.Get<MuEdcaParameterSet>() = std::move(*muEdcaParameterSet);
}
if (Is6GhzBand(linkId))
{
beacon.Get<He6GhzBandCapabilities>() = GetHe6GhzBandCapabilities(linkId);
}
}
if (GetEhtSupported())
{
@@ -2144,6 +2156,13 @@ ApWifiMac::ReceiveAssocRequest(const AssocReqRefVariant& assoc,
}
}
}
if (Is6GhzBand(linkId))
{
if (const auto& he6GhzCapabilities = frame.template Get<He6GhzBandCapabilities>())
{
remoteStationManager->AddStationHe6GhzCapabilities(from, *he6GhzCapabilities);
}
}
}
if (GetEhtSupported())
{

View File

@@ -383,6 +383,10 @@ StaWifiMac::SendProbeRequest(uint8_t linkId)
if (GetHeSupported())
{
probe.Get<HeCapabilities>() = GetHeCapabilities(linkId);
if (Is6GhzBand(linkId))
{
probe.Get<He6GhzBandCapabilities>() = GetHe6GhzBandCapabilities(linkId);
}
}
if (GetEhtSupported())
{
@@ -445,6 +449,10 @@ StaWifiMac::GetAssociationRequest(bool isReassoc, uint8_t linkId) const
if (GetHeSupported())
{
frame.template Get<HeCapabilities>() = GetHeCapabilities(linkId);
if (Is6GhzBand(linkId))
{
frame.template Get<He6GhzBandCapabilities>() = GetHe6GhzBandCapabilities(linkId);
}
}
if (GetEhtSupported())
{
@@ -1804,6 +1812,16 @@ StaWifiMac::UpdateApInfo(const MgtFrameType& frame,
linkId);
}
if (Is6GhzBand(linkId))
{
if (const auto& he6GhzCapabilities = frame.template Get<He6GhzBandCapabilities>())
{
GetWifiRemoteStationManager(linkId)->AddStationHe6GhzCapabilities(
apAddr,
*he6GhzCapabilities);
}
}
if (!GetEhtSupported())
{
return;

View File

@@ -40,6 +40,7 @@
#include "ns3/vht-configuration.h"
#include <algorithm>
#include <cmath>
#include <iterator>
#include <sstream>
@@ -1199,6 +1200,14 @@ WifiMac::SwapLinks(std::map<uint8_t, uint8_t> links)
}
}
bool
WifiMac::Is6GhzBand(uint8_t linkId) const
{
auto phy = GetLink(linkId).phy;
NS_ASSERT(phy);
return phy->GetPhyBand() == WIFI_PHY_BAND_6GHZ;
}
void
WifiMac::UpdateTidToLinkMapping(const Mac48Address& mldAddr,
WifiDirection dir,
@@ -2286,6 +2295,41 @@ WifiMac::GetHeCapabilities(uint8_t linkId) const
return capabilities;
}
He6GhzBandCapabilities
WifiMac::GetHe6GhzBandCapabilities(uint8_t linkId) const
{
auto phy = GetLink(linkId).phy;
NS_ASSERT_MSG(phy->GetPhyBand() == WIFI_PHY_BAND_6GHZ,
"Getting HE 6 GHz band capabilities on band different than 6 GHz");
He6GhzBandCapabilities capabilities;
// Set Maximum MPDU Length subfield
const auto maxAmsduSize =
std::max({m_voMaxAmsduSize, m_viMaxAmsduSize, m_beMaxAmsduSize, m_bkMaxAmsduSize});
if (maxAmsduSize <= 3839)
{
capabilities.SetMaxMpduLength(3895);
}
else if (maxAmsduSize <= 7935)
{
capabilities.SetMaxMpduLength(7991);
}
else
{
capabilities.SetMaxMpduLength(11454);
}
auto maxAmpduLength =
std::max({m_voMaxAmpduSize, m_viMaxAmpduSize, m_beMaxAmpduSize, m_bkMaxAmpduSize});
// round to the next power of two minus one
maxAmpduLength = (1UL << static_cast<uint32_t>(std::ceil(std::log2(maxAmpduLength + 1)))) - 1;
// The maximum A-MPDU length in HE 6 GHz Band Capabilities elements ranges from 2^13-1 to 2^20-1
capabilities.SetMaxAmpduLength(std::min(std::max(maxAmpduLength, 8191U), 1048575U));
return capabilities;
}
EhtCapabilities
WifiMac::GetEhtCapabilities(uint8_t linkId) const
{

View File

@@ -197,6 +197,14 @@ class WifiMac : public Object
*/
std::optional<uint8_t> GetLinkForPhy(std::size_t phyId) const;
/**
* Indicate if a given link is on the 6 GHz band.
*
* \param linkId the ID of the given link
* \return whether the given link is on the 6 GHz band
*/
bool Is6GhzBand(uint8_t linkId) const;
/**
* \param remoteAddr the (MLD or link) address of a remote device
* \return the MLD address of the remote device having the given (MLD or link) address, if
@@ -535,6 +543,13 @@ class WifiMac : public Object
* \return the HE capabilities that we support
*/
HeCapabilities GetHeCapabilities(uint8_t linkId) const;
/**
* Return the HE 6GHz band capabilities of the device for the given 6 GHz link.
*
* \param linkId the ID of the given 6 GHz link
* \return the HE 6GHz band capabilities that we support
*/
He6GhzBandCapabilities GetHe6GhzBandCapabilities(uint8_t linkId) const;
/**
* Return the EHT capabilities of the device for the given link.
*

View File

@@ -1600,6 +1600,18 @@ WifiRemoteStationManager::AddStationHeCapabilities(Mac48Address from, HeCapabili
SetQosSupport(from, true);
}
void
WifiRemoteStationManager::AddStationHe6GhzCapabilities(
const Mac48Address& from,
const He6GhzBandCapabilities& he6GhzCapabilities)
{
// Used by all stations to record HE 6GHz band capabilities of remote stations
NS_LOG_FUNCTION(this << from << he6GhzCapabilities);
auto state = LookupState(from);
state->m_he6GhzBandCapabilities = Create<const He6GhzBandCapabilities>(he6GhzCapabilities);
SetQosSupport(from, true);
}
void
WifiRemoteStationManager::AddStationEhtCapabilities(Mac48Address from,
EhtCapabilities ehtCapabilities)
@@ -1653,6 +1665,12 @@ WifiRemoteStationManager::GetStationHeCapabilities(Mac48Address from)
return LookupState(from)->m_heCapabilities;
}
Ptr<const He6GhzBandCapabilities>
WifiRemoteStationManager::GetStationHe6GhzCapabilities(const Mac48Address& from) const
{
return LookupState(from)->m_he6GhzBandCapabilities;
}
Ptr<const EhtCapabilities>
WifiRemoteStationManager::GetStationEhtCapabilities(Mac48Address from)
{

View File

@@ -27,6 +27,7 @@
#include "ns3/data-rate.h"
#include "ns3/eht-capabilities.h"
#include "ns3/he-6ghz-band-capabilities.h"
#include "ns3/he-capabilities.h"
#include "ns3/ht-capabilities.h"
#include "ns3/mac48-address.h"
@@ -112,6 +113,8 @@ struct WifiRemoteStationState
Ptr<const HtCapabilities> m_htCapabilities; //!< remote station HT capabilities
Ptr<const VhtCapabilities> m_vhtCapabilities; //!< remote station VHT capabilities
Ptr<const HeCapabilities> m_heCapabilities; //!< remote station HE capabilities
Ptr<const He6GhzBandCapabilities>
m_he6GhzBandCapabilities; //!< remote station HE 6GHz band capabilities
Ptr<const EhtCapabilities> m_ehtCapabilities; //!< remote station EHT capabilities
/// remote station Multi-Link Element Common Info
std::shared_ptr<CommonInfoBasicMle> m_mleCommonInfo;
@@ -261,6 +264,14 @@ class WifiRemoteStationManager : public Object
* \param heCapabilities the HE capabilities of the station
*/
void AddStationHeCapabilities(Mac48Address from, HeCapabilities heCapabilities);
/**
* Records HE 6 GHz Band Capabilities of a remote station
*
* \param from the address of the remote station
* \param he6GhzCapabilities the HE 6 GHz Band Capabilities of the remote station
*/
void AddStationHe6GhzCapabilities(const Mac48Address& from,
const He6GhzBandCapabilities& he6GhzCapabilities);
/**
* Records EHT capabilities of the remote station.
*
@@ -298,6 +309,13 @@ class WifiRemoteStationManager : public Object
* \return the HE capabilities sent by the remote station
*/
Ptr<const HeCapabilities> GetStationHeCapabilities(Mac48Address from);
/**
* Return the HE 6 GHz Band Capabilities sent by a remote station.
*
* \param from the address of the remote station
* \return the HE 6 GHz Band capabilities sent by the remote station
*/
Ptr<const He6GhzBandCapabilities> GetStationHe6GhzCapabilities(const Mac48Address& from) const;
/**
* Return the EHT capabilities sent by the remote station.
*