wifi: Convert WifiTidToLinkMappingNegSupport to scoped enum

This commit is contained in:
André Apitzsch
2024-02-15 09:05:58 +01:00
parent dc06225749
commit 18af29a3ff
7 changed files with 61 additions and 25 deletions

View File

@@ -22,6 +22,7 @@ Changes from ns-3.41 to ns-3-dev
* `InetSocketAddress::SetTos()` and `InetSocketAddress::GetTos()` have been removed.
Applications have a new Attribute to set the IPv4 ToS field.
* (wifi) Deprecated `WIFI_TID_TO_LINK_MAPPING_{NOT_SUPPORTED,SAME_LINK_SET,ANY_LINK_SET}`. They have been replaced by `WifiTidToLinkMappingNegSupport::{NOT_SUPPORTED,SAME_LINK_SET,ANY_LINK_SET}`, respectively.
### Changes to build system

View File

@@ -721,7 +721,7 @@ ApWifiMac::GetMultiLinkElement(uint8_t linkId, WifiMacType frameType, const Mac4
mldCapabilities->srsSupport = 0;
EnumValue<WifiTidToLinkMappingNegSupport> negSupport;
ehtConfiguration->GetAttributeFailSafe("TidToLinkMappingNegSupport", negSupport);
mldCapabilities->tidToLinkMappingSupport = negSupport.Get();
mldCapabilities->tidToLinkMappingSupport = static_cast<uint8_t>(negSupport.Get());
mldCapabilities->freqSepForStrApMld = 0; // not supported yet
mldCapabilities->aarSupport = 0; // not supported yet
}
@@ -1981,7 +1981,7 @@ ApWifiMac::ReceiveAssocRequest(const AssocReqRefVariant& assoc,
EnumValue<WifiTidToLinkMappingNegSupport> negSupport;
ehtConfig->GetAttributeFailSafe("TidToLinkMappingNegSupport", negSupport);
if (negSupport.Get() == 0)
if (negSupport.Get() == WifiTidToLinkMappingNegSupport::NOT_SUPPORTED)
{
return failure("TID-to-Link Mapping negotiation not supported");
}
@@ -2019,7 +2019,7 @@ ApWifiMac::ReceiveAssocRequest(const AssocReqRefVariant& assoc,
break;
}
if (negSupport.Get() == 1 &&
if (negSupport.Get() == WifiTidToLinkMappingNegSupport::SAME_LINK_SET &&
!TidToLinkMappingValidForNegType1(dlMapping, ulMapping))
{
return failure("Mapping TIDs to distinct link sets is incompatible with "

View File

@@ -36,6 +36,21 @@ NS_LOG_COMPONENT_DEFINE("EhtConfiguration");
NS_OBJECT_ENSURE_REGISTERED(EhtConfiguration);
std::ostream&
operator<<(std::ostream& os, WifiTidToLinkMappingNegSupport negsupport)
{
switch (negsupport)
{
case WifiTidToLinkMappingNegSupport::NOT_SUPPORTED:
return os << "NOT_SUPPORTED";
case WifiTidToLinkMappingNegSupport::SAME_LINK_SET:
return os << "SAME_LINK_SET";
case WifiTidToLinkMappingNegSupport::ANY_LINK_SET:
return os << "ANY_LINK_SET";
};
return os << "UNKNOWN(" << static_cast<uint32_t>(negsupport) << ")";
}
EhtConfiguration::EhtConfiguration()
{
NS_LOG_FUNCTION(this);
@@ -94,18 +109,16 @@ EhtConfiguration::GetTypeId()
UintegerValue(DEFAULT_MSD_MAX_N_TXOPS),
MakeUintegerAccessor(&EhtConfiguration::m_msdMaxNTxops),
MakeUintegerChecker<uint8_t>(0, 15))
.AddAttribute(
"TidToLinkMappingNegSupport",
.AddAttribute("TidToLinkMappingNegSupport",
"TID-to-Link Mapping Negotiation Support.",
EnumValue(WifiTidToLinkMappingNegSupport::WIFI_TID_TO_LINK_MAPPING_ANY_LINK_SET),
EnumValue(WifiTidToLinkMappingNegSupport::ANY_LINK_SET),
MakeEnumAccessor<WifiTidToLinkMappingNegSupport>(
&EhtConfiguration::m_tidLinkMappingSupport),
MakeEnumChecker(
WifiTidToLinkMappingNegSupport::WIFI_TID_TO_LINK_MAPPING_NOT_SUPPORTED,
MakeEnumChecker(WifiTidToLinkMappingNegSupport::NOT_SUPPORTED,
"NOT_SUPPORTED",
WifiTidToLinkMappingNegSupport::WIFI_TID_TO_LINK_MAPPING_SAME_LINK_SET,
WifiTidToLinkMappingNegSupport::SAME_LINK_SET,
"SAME_LINK_SET",
WifiTidToLinkMappingNegSupport::WIFI_TID_TO_LINK_MAPPING_ANY_LINK_SET,
WifiTidToLinkMappingNegSupport::ANY_LINK_SET,
"ANY_LINK_SET"))
.AddAttribute(
"TidToLinkMappingDl",

View File

@@ -21,6 +21,7 @@
#ifndef EHT_CONFIGURATION_H
#define EHT_CONFIGURATION_H
#include "ns3/deprecated.h"
#include "ns3/nstime.h"
#include "ns3/object.h"
#include "ns3/wifi-utils.h"
@@ -43,13 +44,32 @@ static constexpr uint8_t DEFAULT_MSD_MAX_N_TXOPS = 1;
/**
* \brief TID-to-Link Mapping Negotiation Support
*/
enum WifiTidToLinkMappingNegSupport : uint8_t
enum class WifiTidToLinkMappingNegSupport : uint8_t
{
WIFI_TID_TO_LINK_MAPPING_NOT_SUPPORTED = 0,
WIFI_TID_TO_LINK_MAPPING_SAME_LINK_SET = 1,
WIFI_TID_TO_LINK_MAPPING_ANY_LINK_SET = 3
NOT_SUPPORTED = 0,
SAME_LINK_SET = 1,
ANY_LINK_SET = 3
};
NS_DEPRECATED_3_42("Use WifiTidToLinkMappingNegSupport::NOT_SUPPORTED instead")
static constexpr auto WIFI_TID_TO_LINK_MAPPING_NOT_SUPPORTED = WifiTidToLinkMappingNegSupport::
NOT_SUPPORTED; //!< \deprecated See WifiTidToLinkMappingNegSupport::NOT_SUPPORTED
NS_DEPRECATED_3_42("Use WifiTidToLinkMappingNegSupport::SAME_LINK_SET instead")
static constexpr auto WIFI_TID_TO_LINK_MAPPING_SAME_LINK_SET = WifiTidToLinkMappingNegSupport::
SAME_LINK_SET; //!< \deprecated See WifiTidToLinkMappingNegSupport::SAME_LINK_SET
NS_DEPRECATED_3_42("Use WifiTidToLinkMappingNegSupport::ANY_LINK_SET instead")
static constexpr auto WIFI_TID_TO_LINK_MAPPING_ANY_LINK_SET =
WifiTidToLinkMappingNegSupport::ANY_LINK_SET; //!< \deprecated See
//!< WifiTidToLinkMappingNegSupport::ANY_LINK_SET
/**
* \brief Stream insertion operator.
* \param [in] os The reference to the output stream.
* \param [in] negsupport The WifiTidToLinkMappingNegSupport.
* \return The reference to the output stream.
*/
std::ostream& operator<<(std::ostream& os, WifiTidToLinkMappingNegSupport negsupport);
/**
* \brief EHT configuration
* \ingroup wifi

View File

@@ -484,7 +484,7 @@ StaWifiMac::GetMultiLinkElement(bool isReassoc, uint8_t linkId) const
EnumValue<WifiTidToLinkMappingNegSupport> negSupport;
ehtConfiguration->GetAttributeFailSafe("TidToLinkMappingNegSupport", negSupport);
mldCapabilities->tidToLinkMappingSupport = negSupport.Get();
mldCapabilities->tidToLinkMappingSupport = static_cast<uint8_t>(negSupport.Get());
mldCapabilities->freqSepForStrApMld = 0; // not supported yet
mldCapabilities->aarSupport = 0; // not supported yet
@@ -532,7 +532,7 @@ StaWifiMac::GetTidToLinkMappingElements(uint8_t apNegSupport)
EnumValue<WifiTidToLinkMappingNegSupport> negSupport;
ehtConfig->GetAttributeFailSafe("TidToLinkMappingNegSupport", negSupport);
NS_ABORT_MSG_IF(negSupport.Get() == 0,
NS_ABORT_MSG_IF(negSupport.Get() == WifiTidToLinkMappingNegSupport::NOT_SUPPORTED,
"Cannot request TID-to-Link Mapping if negotiation is not supported");
// store the mappings, so that we can enforce them when the AP MLD accepts them
@@ -542,7 +542,8 @@ StaWifiMac::GetTidToLinkMappingElements(uint8_t apNegSupport)
bool mappingValidForNegType1 = TidToLinkMappingValidForNegType1(m_dlTidLinkMappingInAssocReq,
m_ulTidLinkMappingInAssocReq);
NS_ABORT_MSG_IF(
negSupport.Get() == 1 && !mappingValidForNegType1,
negSupport.Get() == WifiTidToLinkMappingNegSupport::SAME_LINK_SET &&
!mappingValidForNegType1,
"Mapping TIDs to distinct link sets is incompatible with negotiation support of 1");
if (apNegSupport == 1 && !mappingValidForNegType1)

View File

@@ -314,7 +314,8 @@ WifiAssocManager::CanSetupMultiLink(OptMleConstRef& mle, OptRnrConstRef& rnr)
// mapping negotiation with the TID-To-Link Mapping Negotiation Support subfield of the
// MLD Capabilities field of the Basic Multi-Link element it transmits to at least 1.
// (Sec. 35.3.7.1.1 of 802.11be D3.1)
if (mldCapabilities->tidToLinkMappingSupport > 0 && negSupport.Get() == 0)
if (mldCapabilities->tidToLinkMappingSupport > 0 &&
negSupport.Get() == WifiTidToLinkMappingNegSupport::NOT_SUPPORTED)
{
NS_LOG_DEBUG("AP MLD supports TID-to-Link Mapping negotiation, while we don't");
return false;

View File

@@ -939,7 +939,7 @@ MultiLinkSetupTest::DoSetup()
// also advertises 0) or 1 (the AP MLD is discarded if it advertises a support of 3)
auto staEhtConfig = m_staMacs[0]->GetEhtConfiguration();
staEhtConfig->SetAttribute("TidToLinkMappingNegSupport",
EnumValue(WIFI_TID_TO_LINK_MAPPING_ANY_LINK_SET));
EnumValue(WifiTidToLinkMappingNegSupport::ANY_LINK_SET));
staEhtConfig->SetAttribute("TidToLinkMappingDl", StringValue(m_dlTidLinkMappingStr));
staEhtConfig->SetAttribute("TidToLinkMappingUl", StringValue(m_ulTidLinkMappingStr));