wifi: Use a scoped enum for receiver address types
This commit is contained in:
@@ -1000,7 +1000,10 @@ BlockAckManager::ScheduleBar(const CtrlBAckRequestHeader& reqHdr, const WifiMacH
|
||||
|
||||
uint8_t tid = reqHdr.GetTidInfo();
|
||||
|
||||
WifiContainerQueueId queueId(WIFI_CTL_QUEUE, WIFI_UNICAST, hdr.GetAddr1(), std::nullopt);
|
||||
WifiContainerQueueId queueId(WIFI_CTL_QUEUE,
|
||||
WifiRcvAddr::UNICAST,
|
||||
hdr.GetAddr1(),
|
||||
std::nullopt);
|
||||
auto pkt = Create<Packet>();
|
||||
pkt->AddHeader(reqHdr);
|
||||
Ptr<WifiMpdu> item = nullptr;
|
||||
|
||||
@@ -213,7 +213,10 @@ EhtFrameExchangeManager::StartTransmission(Ptr<Txop> edca, MHz_u allowedWidth)
|
||||
}
|
||||
|
||||
// check that this link is blocked as expected
|
||||
WifiContainerQueueId queueId(WIFI_QOSDATA_QUEUE, WIFI_UNICAST, *mldAddress, 0);
|
||||
WifiContainerQueueId queueId(WIFI_QOSDATA_QUEUE,
|
||||
WifiRcvAddr::UNICAST,
|
||||
*mldAddress,
|
||||
0);
|
||||
auto mask =
|
||||
m_apMac->GetMacQueueScheduler()->GetQueueLinkMask(AC_BE, queueId, m_linkId);
|
||||
NS_ASSERT_MSG(mask,
|
||||
@@ -1109,7 +1112,10 @@ EhtFrameExchangeManager::SendCtsAfterRts(const WifiMacHeader& rtsHdr,
|
||||
m_mac->GetWifiRemoteStationManager(linkId)->GetEmlsrEnabled(*mldAddress))
|
||||
{
|
||||
// check that other links are blocked as expected
|
||||
WifiContainerQueueId queueId(WIFI_QOSDATA_QUEUE, WIFI_UNICAST, *mldAddress, 0);
|
||||
WifiContainerQueueId queueId(WIFI_QOSDATA_QUEUE,
|
||||
WifiRcvAddr::UNICAST,
|
||||
*mldAddress,
|
||||
0);
|
||||
auto mask =
|
||||
m_apMac->GetMacQueueScheduler()->GetQueueLinkMask(AC_BE, queueId, linkId);
|
||||
NS_ASSERT_MSG(mask, "No mask for client " << *mldAddress << " on link " << +linkId);
|
||||
|
||||
@@ -320,11 +320,11 @@ RrMultiUserScheduler::CanSolicitStaInBsrpTf(const MasterInfo& info) const
|
||||
// check if the station is an EMLSR client that is using another link
|
||||
if (GetWifiRemoteStationManager(m_linkId)->GetEmlsrEnabled(info.address) &&
|
||||
(m_apMac->GetTxBlockedOnLink(AC_BE,
|
||||
{WIFI_QOSDATA_QUEUE, WIFI_UNICAST, *mldAddr, 0},
|
||||
{WIFI_QOSDATA_QUEUE, WifiRcvAddr::UNICAST, *mldAddr, 0},
|
||||
m_linkId,
|
||||
WifiQueueBlockedReason::USING_OTHER_EMLSR_LINK) ||
|
||||
m_apMac->GetTxBlockedOnLink(AC_BE,
|
||||
{WIFI_QOSDATA_QUEUE, WIFI_UNICAST, *mldAddr, 0},
|
||||
{WIFI_QOSDATA_QUEUE, WifiRcvAddr::UNICAST, *mldAddr, 0},
|
||||
m_linkId,
|
||||
WifiQueueBlockedReason::WAITING_EMLSR_TRANSITION_DELAY)))
|
||||
{
|
||||
|
||||
@@ -126,7 +126,7 @@ HtFrameExchangeManager::NeedSetupBlockAck(Mac48Address recipient, uint8_t tid)
|
||||
// NOLINTEND(bugprone-branch-clone)
|
||||
else
|
||||
{
|
||||
WifiContainerQueueId queueId{WIFI_QOSDATA_QUEUE, WIFI_UNICAST, recipient, tid};
|
||||
WifiContainerQueueId queueId{WIFI_QOSDATA_QUEUE, WifiRcvAddr::UNICAST, recipient, tid};
|
||||
uint32_t packets = qosTxop->GetWifiMacQueue()->GetNPackets(queueId);
|
||||
establish =
|
||||
(m_mac->Is6GhzBand(m_linkId) ||
|
||||
@@ -152,7 +152,7 @@ HtFrameExchangeManager::NeedSetupGcrBlockAck(const WifiMacHeader& header)
|
||||
m_mpduAggregator->GetMaxAmpduSize(groupAddress, tid, WIFI_MOD_CLASS_HT);
|
||||
const auto isGcrBa = (m_apMac->GetGcrManager()->GetRetransmissionPolicy() ==
|
||||
GroupAddressRetransmissionPolicy::GCR_BLOCK_ACK);
|
||||
WifiContainerQueueId queueId{WIFI_QOSDATA_QUEUE, WIFI_GROUPCAST, groupAddress, tid};
|
||||
WifiContainerQueueId queueId{WIFI_QOSDATA_QUEUE, WifiRcvAddr::GROUPCAST, groupAddress, tid};
|
||||
|
||||
for (const auto& recipients =
|
||||
m_apMac->GetGcrManager()->GetMemberStasForGroupAddress(groupAddress);
|
||||
@@ -570,7 +570,7 @@ HtFrameExchangeManager::GetBar(AcIndex ac,
|
||||
if (bar->GetHeader().GetAddr2() == m_self && recipientMld)
|
||||
{
|
||||
WifiContainerQueueId queueId{WIFI_CTL_QUEUE,
|
||||
WIFI_UNICAST,
|
||||
WifiRcvAddr::UNICAST,
|
||||
*recipientMld,
|
||||
std::nullopt};
|
||||
Ptr<WifiMpdu> otherBar;
|
||||
@@ -606,7 +606,7 @@ HtFrameExchangeManager::GetBar(AcIndex ac,
|
||||
{
|
||||
WifiContainerQueueId queueId(
|
||||
WIFI_QOSDATA_QUEUE,
|
||||
WIFI_UNICAST,
|
||||
WifiRcvAddr::UNICAST,
|
||||
GetWifiRemoteStationManager()->GetMldAddress(recipient).value_or(recipient),
|
||||
tid);
|
||||
// check if data is queued and can be transmitted on this link
|
||||
|
||||
@@ -177,7 +177,7 @@ QosTxop::GetLink(uint8_t linkId) const
|
||||
uint8_t
|
||||
QosTxop::GetQosQueueSize(uint8_t tid, Mac48Address receiver) const
|
||||
{
|
||||
WifiContainerQueueId queueId{WIFI_QOSDATA_QUEUE, WIFI_UNICAST, receiver, tid};
|
||||
WifiContainerQueueId queueId{WIFI_QOSDATA_QUEUE, WifiRcvAddr::UNICAST, receiver, tid};
|
||||
uint32_t bufferSize = m_queue->GetNBytes(queueId);
|
||||
// A queue size value of 254 is used for all sizes greater than 64 768 octets.
|
||||
uint8_t queueSize = static_cast<uint8_t>(std::ceil(std::min(bufferSize, 64769U) / 256.0));
|
||||
@@ -393,7 +393,8 @@ QosTxop::PeekNextMpdu(uint8_t linkId, uint8_t tid, Mac48Address recipient, Ptr<c
|
||||
return m_queue->PeekFirstAvailable(linkId, mpdu);
|
||||
}
|
||||
WifiContainerQueueId queueId(WIFI_QOSDATA_QUEUE,
|
||||
recipient.IsGroup() ? WIFI_GROUPCAST : WIFI_UNICAST,
|
||||
recipient.IsGroup() ? WifiRcvAddr::GROUPCAST
|
||||
: WifiRcvAddr::UNICAST,
|
||||
recipient,
|
||||
tid);
|
||||
if (auto mask = m_mac->GetMacQueueScheduler()->GetQueueLinkMask(m_ac, queueId, linkId);
|
||||
|
||||
@@ -152,7 +152,8 @@ WifiDefaultAckManager::IsResponseNeeded(Ptr<const WifiMpdu> mpdu,
|
||||
}
|
||||
// * no other frame belonging to this BA agreement is queued (because, in such
|
||||
// a case, a Block Ack is not going to be requested anytime soon)
|
||||
if (auto queueId = WifiContainerQueueId(WIFI_QOSDATA_QUEUE, WIFI_UNICAST, origReceiver, tid);
|
||||
if (auto queueId =
|
||||
WifiContainerQueueId(WIFI_QOSDATA_QUEUE, WifiRcvAddr::UNICAST, origReceiver, tid);
|
||||
edca->GetWifiMacQueue()->GetNPackets(queueId) -
|
||||
edca->GetBaManager()->GetNBufferedPackets(origReceiver, tid) - seqNumbers.size() <
|
||||
1)
|
||||
|
||||
@@ -70,21 +70,21 @@ WifiMacQueueContainer::GetQueueId(Ptr<const WifiMpdu> mpdu)
|
||||
{
|
||||
const WifiMacHeader& hdr = mpdu->GetHeader();
|
||||
|
||||
WifiReceiverAddressType addrType;
|
||||
WifiRcvAddr addrType;
|
||||
Mac48Address address;
|
||||
if (hdr.GetAddr1().IsBroadcast())
|
||||
{
|
||||
addrType = WIFI_BROADCAST;
|
||||
addrType = WifiRcvAddr::BROADCAST;
|
||||
address = hdr.GetAddr2();
|
||||
}
|
||||
else if (hdr.GetAddr1().IsGroup())
|
||||
{
|
||||
addrType = WIFI_GROUPCAST;
|
||||
addrType = WifiRcvAddr::GROUPCAST;
|
||||
address = hdr.IsQosAmsdu() ? mpdu->begin()->second.GetDestinationAddr() : hdr.GetAddr1();
|
||||
}
|
||||
else
|
||||
{
|
||||
addrType = WIFI_UNICAST;
|
||||
addrType = WifiRcvAddr::UNICAST;
|
||||
address = hdr.GetAddr1();
|
||||
}
|
||||
|
||||
|
||||
@@ -30,14 +30,29 @@ enum WifiContainerQueueType
|
||||
WIFI_DATA_QUEUE = 3
|
||||
};
|
||||
|
||||
/// enumeration of frame directions
|
||||
enum WifiReceiverAddressType : uint8_t
|
||||
/// enumeration of frame types based on receiver address
|
||||
enum class WifiRcvAddr : uint8_t
|
||||
{
|
||||
WIFI_UNICAST = 0,
|
||||
WIFI_BROADCAST,
|
||||
WIFI_GROUPCAST
|
||||
UNICAST = 0,
|
||||
BROADCAST,
|
||||
GROUPCAST,
|
||||
COUNT
|
||||
};
|
||||
|
||||
/**
|
||||
* Deprecated frame types enums.
|
||||
*
|
||||
* Use `WifiRcvAddr` class enum values instead.
|
||||
* @{
|
||||
*/
|
||||
NS_DEPRECATED_3_46("Use WifiRcvAddr::UNICAST instead")
|
||||
static constexpr auto WIFI_UNICAST = WifiRcvAddr::UNICAST;
|
||||
NS_DEPRECATED_3_46("Use WifiRcvAddr::BROADCAST instead")
|
||||
static constexpr auto WIFI_BROADCAST = WifiRcvAddr::BROADCAST;
|
||||
NS_DEPRECATED_3_46("Use WifiRcvAddr::GROUPCAST instead")
|
||||
static constexpr auto WIFI_GROUPCAST = WifiRcvAddr::GROUPCAST;
|
||||
/**@}*/
|
||||
|
||||
/**
|
||||
* Tuple (queue type, receiver address type, Address, TID) identifying a container queue.
|
||||
*
|
||||
@@ -65,8 +80,8 @@ enum WifiReceiverAddressType : uint8_t
|
||||
*
|
||||
* The TID is only specified for container queue types holding QoS data frames.
|
||||
*/
|
||||
using WifiContainerQueueId = std::
|
||||
tuple<WifiContainerQueueType, WifiReceiverAddressType, Mac48Address, std::optional<uint8_t>>;
|
||||
using WifiContainerQueueId =
|
||||
std::tuple<WifiContainerQueueType, WifiRcvAddr, Mac48Address, std::optional<uint8_t>>;
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
|
||||
@@ -318,7 +318,7 @@ WifiMacQueue::PeekByTidAndAddress(uint8_t tid, Mac48Address dest, Ptr<const Wifi
|
||||
NS_LOG_FUNCTION(this << +tid << dest << item);
|
||||
NS_ABORT_IF(dest.IsBroadcast());
|
||||
WifiContainerQueueId queueId(WIFI_QOSDATA_QUEUE,
|
||||
dest.IsGroup() ? WIFI_GROUPCAST : WIFI_UNICAST,
|
||||
dest.IsGroup() ? WifiRcvAddr::GROUPCAST : WifiRcvAddr::UNICAST,
|
||||
dest,
|
||||
tid);
|
||||
return PeekByQueueId(queueId, item);
|
||||
|
||||
@@ -626,7 +626,7 @@ EmlsrOperationsTestBase::CheckBlockedLink(Ptr<WifiMac> mac,
|
||||
std::string description,
|
||||
bool testUnblockedForOtherReasons)
|
||||
{
|
||||
WifiContainerQueueId queueId(WIFI_QOSDATA_QUEUE, WIFI_UNICAST, dest, 0);
|
||||
WifiContainerQueueId queueId(WIFI_QOSDATA_QUEUE, WifiRcvAddr::UNICAST, dest, 0);
|
||||
auto mask = mac->GetMacQueueScheduler()->GetQueueLinkMask(AC_BE, queueId, linkId);
|
||||
NS_TEST_EXPECT_MSG_EQ(mask.has_value(),
|
||||
true,
|
||||
|
||||
@@ -214,8 +214,8 @@ WifiExtractExpiredMpdusTest::DoRun()
|
||||
Enqueue(rxAddr2, false, MilliSeconds(70));
|
||||
Enqueue(rxAddr2, false, MilliSeconds(75));
|
||||
|
||||
WifiContainerQueueId queueId1{WIFI_QOSDATA_QUEUE, WIFI_UNICAST, rxAddr1, 0};
|
||||
WifiContainerQueueId queueId2{WIFI_QOSDATA_QUEUE, WIFI_UNICAST, rxAddr2, 0};
|
||||
WifiContainerQueueId queueId1{WIFI_QOSDATA_QUEUE, WifiRcvAddr::UNICAST, rxAddr1, 0};
|
||||
WifiContainerQueueId queueId2{WIFI_QOSDATA_QUEUE, WifiRcvAddr::UNICAST, rxAddr2, 0};
|
||||
|
||||
Simulator::Schedule(MilliSeconds(25), [&]() {
|
||||
/**
|
||||
|
||||
@@ -1581,7 +1581,7 @@ MultiLinkSetupTest::CheckDisabledLinks()
|
||||
(legacyAssoc
|
||||
? m_staMacs[0]->GetFrameExchangeManager(m_staSetupLinks.front())->GetAddress()
|
||||
: m_staMacs[0]->GetAddress());
|
||||
WifiContainerQueueId queueId(WIFI_QOSDATA_QUEUE, WIFI_UNICAST, addr, 0);
|
||||
WifiContainerQueueId queueId(WIFI_QOSDATA_QUEUE, WifiRcvAddr::UNICAST, addr, 0);
|
||||
|
||||
// the queue on the AP should have a mask if and only if the link has been setup
|
||||
auto mask = m_apMac->GetMacQueueScheduler()->GetQueueLinkMask(AC_BE, queueId, linkId);
|
||||
|
||||
@@ -309,7 +309,7 @@ WifiRetransmitTest::CheckValues(const std::map<uint16_t, uint32_t>& seqNoRetryCo
|
||||
{
|
||||
const auto psduNumber = std::distance(m_events.cbegin(), m_eventIt);
|
||||
const auto apAddr = Mac48Address::ConvertFrom(m_apDevice.Get(0)->GetAddress());
|
||||
WifiContainerQueueId queueId{WIFI_QOSDATA_QUEUE, WIFI_UNICAST, apAddr, 0};
|
||||
WifiContainerQueueId queueId{WIFI_QOSDATA_QUEUE, WifiRcvAddr::UNICAST, apAddr, 0};
|
||||
const auto staQueue = m_staMac->GetTxopQueue(AC_BE);
|
||||
NS_TEST_EXPECT_MSG_EQ(seqNoRetryCountMap.size(),
|
||||
staQueue->GetNPackets(queueId),
|
||||
|
||||
Reference in New Issue
Block a user