wifi: Move enum for TID-to-Link Mapping IE direction values to wifi-utils
Also, use a more generic name given that it can be used in other contexts
This commit is contained in:
@@ -66,7 +66,7 @@ TidToLinkMapping::Control::Deserialize(Buffer::Iterator start)
|
||||
auto val = i.ReadU8();
|
||||
count++;
|
||||
|
||||
direction = static_cast<TidLinkMapDir>(val & 0x03);
|
||||
direction = static_cast<WifiDirection>(val & 0x03);
|
||||
defaultMapping = (((val >> 2) & 0x01) == 1);
|
||||
mappingSwitchTimePresent = (((val >> 3) & 0x01) == 1);
|
||||
expectedDurationPresent = (((val >> 4) & 0x01) == 1);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "ns3/nstime.h"
|
||||
#include "ns3/wifi-information-element.h"
|
||||
#include "ns3/wifi-utils.h"
|
||||
|
||||
#include <map>
|
||||
#include <optional>
|
||||
@@ -30,21 +31,10 @@
|
||||
namespace ns3
|
||||
{
|
||||
|
||||
/**
|
||||
* TID-to-Link Mapping Control Direction
|
||||
* IEEE 802.11be D2.0 Figure 9-1002an
|
||||
*/
|
||||
enum class TidLinkMapDir : uint8_t
|
||||
{
|
||||
DOWNLINK = 0,
|
||||
UPLINK = 1,
|
||||
BOTH_DIRECTIONS = 2,
|
||||
};
|
||||
|
||||
/// whether to enforce the default link mapping
|
||||
constexpr auto DEFAULT_WIFI_TID_LINK_MAPPING{true};
|
||||
/// default value for the Direction subfield of the TID-To-Link Control field
|
||||
constexpr auto DEFAULT_WIFI_TID_LINK_MAP_DIR{TidLinkMapDir::BOTH_DIRECTIONS};
|
||||
constexpr auto DEFAULT_WIFI_TID_LINK_MAP_DIR{WifiDirection::BOTH_DIRECTIONS};
|
||||
/// size in bytes of the TID-To-Link Control field with default link mapping
|
||||
constexpr uint16_t WIFI_TID_TO_LINK_MAPPING_CONTROL_BASIC_SIZE_B =
|
||||
1; // IEEE 802.11be D2.0 9.4.2.314
|
||||
@@ -71,7 +61,7 @@ class TidToLinkMapping : public WifiInformationElement
|
||||
{
|
||||
friend class TidToLinkMapping;
|
||||
|
||||
TidLinkMapDir direction{DEFAULT_WIFI_TID_LINK_MAP_DIR}; ///< Direction
|
||||
WifiDirection direction{DEFAULT_WIFI_TID_LINK_MAP_DIR}; ///< Direction
|
||||
bool defaultMapping{DEFAULT_WIFI_TID_LINK_MAPPING}; ///< Default link mapping
|
||||
|
||||
/// \return Serialized size of TID-to-Link Mapping Control in octets
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "block-ack-type.h"
|
||||
|
||||
#include "ns3/fatal-error.h"
|
||||
#include "ns3/ptr.h"
|
||||
|
||||
#include <list>
|
||||
@@ -34,6 +35,41 @@ namespace ns3
|
||||
class WifiMacHeader;
|
||||
class Packet;
|
||||
|
||||
/**
|
||||
* Wifi direction. Values are those defined for the TID-to-Link Mapping Control Direction
|
||||
* field in IEEE 802.11be D3.1 Figure 9-1002ap
|
||||
*/
|
||||
enum class WifiDirection : uint8_t
|
||||
{
|
||||
DOWNLINK = 0,
|
||||
UPLINK = 1,
|
||||
BOTH_DIRECTIONS = 2,
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Stream insertion operator.
|
||||
*
|
||||
* \param os the stream
|
||||
* \param direction the direction
|
||||
* \returns a reference to the stream
|
||||
*/
|
||||
inline std::ostream&
|
||||
operator<<(std::ostream& os, const WifiDirection& direction)
|
||||
{
|
||||
switch (direction)
|
||||
{
|
||||
case WifiDirection::DOWNLINK:
|
||||
return (os << "DOWNLINK");
|
||||
case WifiDirection::UPLINK:
|
||||
return (os << "UPLINK");
|
||||
case WifiDirection::BOTH_DIRECTIONS:
|
||||
return (os << "BOTH_DIRECTIONS");
|
||||
default:
|
||||
NS_FATAL_ERROR("Invalid direction");
|
||||
return (os << "INVALID");
|
||||
}
|
||||
}
|
||||
|
||||
/// @brief TID-indexed map of the link set to which the TID is mapped
|
||||
using WifiTidLinkMapping = std::map<uint8_t, std::set<uint8_t>>;
|
||||
|
||||
|
||||
@@ -1212,7 +1212,7 @@ class TidToLinkMappingElementTest : public HeaderSerializationTestCase
|
||||
* \param expectedDuration the Expected Duration
|
||||
* \param mappings A TID-indexed map of the link sets the TIDs are mapped to
|
||||
*/
|
||||
TidToLinkMappingElementTest(TidLinkMapDir direction,
|
||||
TidToLinkMappingElementTest(WifiDirection direction,
|
||||
std::optional<Time> mappingSwitchTime,
|
||||
std::optional<Time> expectedDuration,
|
||||
const WifiTidLinkMapping& mappings);
|
||||
@@ -1223,14 +1223,14 @@ class TidToLinkMappingElementTest : public HeaderSerializationTestCase
|
||||
void DoSetup() override;
|
||||
void DoRun() override;
|
||||
|
||||
TidLinkMapDir m_direction; ///< the direction for the TID-to-link mapping
|
||||
WifiDirection m_direction; ///< the direction for the TID-to-link mapping
|
||||
std::optional<Time> m_mappingSwitchTime; ///< the Mapping Switching Time
|
||||
std::optional<Time> m_expectedDuration; ///< the Expected Duration
|
||||
WifiTidLinkMapping m_mappings; ///< maps TIDs to link sets
|
||||
TidToLinkMapping m_tidToLinkMapping; ///< TID-To-Link Mapping element
|
||||
};
|
||||
|
||||
TidToLinkMappingElementTest::TidToLinkMappingElementTest(TidLinkMapDir direction,
|
||||
TidToLinkMappingElementTest::TidToLinkMappingElementTest(WifiDirection direction,
|
||||
std::optional<Time> mappingSwitchTime,
|
||||
std::optional<Time> expectedDuration,
|
||||
const WifiTidLinkMapping& mappings)
|
||||
@@ -1380,20 +1380,20 @@ WifiEhtInfoElemsTestSuite::WifiEhtInfoElemsTestSuite()
|
||||
AddTestCase(new WifiEhtCapabilitiesIeTest(false, 160), TestCase::QUICK);
|
||||
AddTestCase(new WifiEhtCapabilitiesIeTest(false, 320), TestCase::QUICK);
|
||||
AddTestCase(
|
||||
new TidToLinkMappingElementTest(TidLinkMapDir::DOWNLINK, std::nullopt, std::nullopt, {}),
|
||||
new TidToLinkMappingElementTest(WifiDirection::DOWNLINK, std::nullopt, std::nullopt, {}),
|
||||
TestCase::QUICK);
|
||||
AddTestCase(new TidToLinkMappingElementTest(TidLinkMapDir::UPLINK,
|
||||
AddTestCase(new TidToLinkMappingElementTest(WifiDirection::UPLINK,
|
||||
MicroSeconds(500 * 1024),
|
||||
MicroSeconds(300 * 1024),
|
||||
{{3, std::set<uint8_t>{0, 4, 6}}}),
|
||||
TestCase::QUICK);
|
||||
AddTestCase(new TidToLinkMappingElementTest(
|
||||
TidLinkMapDir::BOTH_DIRECTIONS,
|
||||
WifiDirection::BOTH_DIRECTIONS,
|
||||
std::nullopt,
|
||||
MicroSeconds(100 * 1024),
|
||||
{{3, std::set<uint8_t>{0, 4, 6}}, {6, std::set<uint8_t>{3, 7, 11, 14}}}),
|
||||
TestCase::QUICK);
|
||||
AddTestCase(new TidToLinkMappingElementTest(TidLinkMapDir::DOWNLINK,
|
||||
AddTestCase(new TidToLinkMappingElementTest(WifiDirection::DOWNLINK,
|
||||
MicroSeconds(100 * 1024),
|
||||
std::nullopt,
|
||||
{{0, std::set<uint8_t>{0, 1, 2}},
|
||||
|
||||
Reference in New Issue
Block a user