From 61bf1294a77d51d028d2e2b650df3cf6b478cdc8 Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Sun, 28 May 2023 17:49:26 +0200 Subject: [PATCH] wifi: Add attributes to set TID-to-Link Mapping to EHT Configuration --- src/wifi/model/eht/eht-configuration.cc | 110 +++++++++++++++++++++++- src/wifi/model/eht/eht-configuration.h | 38 +++++++- 2 files changed, 145 insertions(+), 3 deletions(-) diff --git a/src/wifi/model/eht/eht-configuration.cc b/src/wifi/model/eht/eht-configuration.cc index d45e0ec81..27fe563a1 100644 --- a/src/wifi/model/eht/eht-configuration.cc +++ b/src/wifi/model/eht/eht-configuration.cc @@ -14,13 +14,19 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Author: Sébastien Deronne + * Authors: Sébastien Deronne + * Stefano Avallone */ #include "eht-configuration.h" +#include "ns3/attribute-container.h" #include "ns3/boolean.h" +#include "ns3/enum.h" #include "ns3/log.h" +#include "ns3/pair.h" +#include "ns3/string.h" +#include "ns3/uinteger.h" namespace ns3 { @@ -42,6 +48,9 @@ EhtConfiguration::~EhtConfiguration() TypeId EhtConfiguration::GetTypeId() { + using TidLinkMapValue = + PairValue, AttributeContainerValue>; + static ns3::TypeId tid = ns3::TypeId("ns3::EhtConfiguration") .SetParent() @@ -60,8 +69,105 @@ EhtConfiguration::GetTypeId() "Possible values are 0us or 2^n us, with n=7..16.", TimeValue(MicroSeconds(0)), MakeTimeAccessor(&EhtConfiguration::m_transitionTimeout), - MakeTimeChecker(MicroSeconds(0), MicroSeconds(65536))); + MakeTimeChecker(MicroSeconds(0), MicroSeconds(65536))) + .AddAttribute( + "TidToLinkMappingNegSupport", + "TID-to-Link Mapping Negotiation Support.", + EnumValue(WifiTidToLinkMappingNegSupport::WIFI_TID_TO_LINK_MAPPING_ANY_LINK_SET), + MakeEnumAccessor(&EhtConfiguration::m_tidLinkMappingSupport), + MakeEnumChecker( + WifiTidToLinkMappingNegSupport::WIFI_TID_TO_LINK_MAPPING_NOT_SUPPORTED, + "NOT_SUPPORTED", + WifiTidToLinkMappingNegSupport::WIFI_TID_TO_LINK_MAPPING_SAME_LINK_SET, + "SAME_LINK_SET", + WifiTidToLinkMappingNegSupport::WIFI_TID_TO_LINK_MAPPING_ANY_LINK_SET, + "ANY_LINK_SET")) + .AddAttribute( + "TidToLinkMappingDl", + "A list-of-TIDs-indexed map of the list of links where the TIDs are mapped to " + "for the downlink direction. " + "In case a string is used to set this attribute, the string shall contain the " + "(TID list, link list) pairs separated by a semicolon (;); in every pair, the " + "TID list and the link list are separated by a blank space, and the elements of " + "each list are separated by a comma (,) without spaces. " + "E.g., \"0,4 1,2,3; 1 0;2 0,1\" means that TIDs 0 and 4 are mapped on links " + "1, 2 and 3; TID 1 is mapped on link 0 and TID 2 is mapped on links 0 and 1. " + "An empty map indicates the default mapping, i.e., all TIDs are mapped to all " + "setup links. If the map contains the mapping for some TID(s), the mapping " + "corresponding to the missing TID(s) remains unchanged. " + "A non-AP MLD includes this mapping in the Association Request frame sent to " + "an AP MLD, unless the AP MLD advertises a negotiation support of 1 and this " + "mapping is such that TIDs are mapped to distinct link sets, in which case " + "the default mapping is included.", + StringValue(""), + MakeAttributeContainerAccessor( + &EhtConfiguration::m_linkMappingDl), + MakeAttributeContainerChecker( + MakePairChecker, + AttributeContainerValue>( + MakeAttributeContainerChecker( + MakeUintegerChecker()), + MakeAttributeContainerChecker( + MakeUintegerChecker())))) + .AddAttribute( + "TidToLinkMappingUl", + "A list-of-TIDs-indexed map of the list of links where the TIDs are mapped to " + "for the uplink direction. " + "In case a string is used to set this attribute, the string shall contain the " + "(TID list, link list) pairs separated by a semicolon (;); in every pair, the " + "TID list and the link list are separated by a blank space, and the elements of " + "each list are separated by a comma (,) without spaces. " + "E.g., \"0,4 1,2,3; 1 0;2 0,1\" means that TIDs 0 and 4 are mapped on links " + "1, 2 and 3; TID 1 is mapped on link 0 and TID 2 is mapped on links 0 and 1. " + "An empty map indicates the default mapping, i.e., all TIDs are mapped to all " + "setup links. If the map contains the mapping for some TID(s), the mapping " + "corresponding to the missing TID(s) remains unchanged. " + "A non-AP MLD includes this mapping in the Association Request frame sent to " + "an AP MLD, unless the AP MLD advertises a negotiation support of 1 and this " + "mapping is such that TIDs are mapped to distinct link sets, in which case " + "the default mapping is included.", + StringValue(""), + MakeAttributeContainerAccessor( + &EhtConfiguration::m_linkMappingUl), + MakeAttributeContainerChecker( + MakePairChecker, + AttributeContainerValue>( + MakeAttributeContainerChecker( + MakeUintegerChecker()), + MakeAttributeContainerChecker( + MakeUintegerChecker())))); return tid; } +WifiTidLinkMapping +EhtConfiguration::GetTidLinkMapping(WifiDirection dir) const +{ + NS_ASSERT(dir != WifiDirection::BOTH_DIRECTIONS); + WifiTidLinkMapping ret; + const auto& linkMapping = (dir == WifiDirection::DOWNLINK ? m_linkMappingDl : m_linkMappingUl); + + for (const auto& [tids, links] : linkMapping) + { + for (auto tid : tids) + { + ret[tid] = std::set(links.cbegin(), links.cend()); + } + } + return ret; +} + +void +EhtConfiguration::SetTidLinkMapping(WifiDirection dir, + const std::map, std::list>& mapping) +{ + NS_ASSERT(dir != WifiDirection::BOTH_DIRECTIONS); + auto& linkMapping = (dir == WifiDirection::DOWNLINK ? m_linkMappingDl : m_linkMappingUl); + linkMapping.clear(); + for (const auto& [tids, links] : mapping) + { + linkMapping.emplace(std::list(tids.cbegin(), tids.cend()), + std::list(links.cbegin(), links.cend())); + } +} + } // namespace ns3 diff --git a/src/wifi/model/eht/eht-configuration.h b/src/wifi/model/eht/eht-configuration.h index 773462167..87284a636 100644 --- a/src/wifi/model/eht/eht-configuration.h +++ b/src/wifi/model/eht/eht-configuration.h @@ -14,7 +14,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Author: Sébastien Deronne + * Authors: Sébastien Deronne + * Stefano Avallone */ #ifndef EHT_CONFIGURATION_H @@ -22,10 +23,24 @@ #include "ns3/nstime.h" #include "ns3/object.h" +#include "ns3/wifi-utils.h" + +#include +#include namespace ns3 { +/** + * \brief TID-to-Link Mapping Negotiation Support + */ +enum 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 +}; + /** * \brief EHT configuration * \ingroup wifi @@ -46,9 +61,30 @@ class EhtConfiguration : public Object */ static TypeId GetTypeId(); + /** + * \param dir the direction for the requested TID-to-Link Mapping + * \return a TID-indexed map of the list of links where each TID is mapped to + */ + WifiTidLinkMapping GetTidLinkMapping(WifiDirection dir) const; + + /** + * Set the TID-to-Link mapping for the given direction. + * + * \param dir the direction for the TID-to-Link Mapping + * \param mapping a list-of-TIDs-indexed map of the list of links where the TIDs are mapped to + */ + void SetTidLinkMapping(WifiDirection dir, + const std::map, std::list>& mapping); + private: bool m_emlsrActivated; //!< whether EMLSR option is activated Time m_transitionTimeout; //!< Transition timeout + WifiTidToLinkMappingNegSupport + m_tidLinkMappingSupport; //!< TID-to-Link Mapping Negotiation Support + std::map, std::list> + m_linkMappingDl; //!< TIDs-indexed Link Mapping for downlink + std::map, std::list> + m_linkMappingUl; //!< TIDs-indexed Link Mapping for uplink }; } // namespace ns3