From f756e8c39a614bd832918e8b3ad19a46a6c6328b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Tue, 24 Oct 2023 22:01:15 +0200 Subject: [PATCH] wifi: Add functions to indicate whether GCR Block Agreement has been established with all group member --- src/wifi/model/ap-wifi-mac.cc | 11 +++++++++++ src/wifi/model/ap-wifi-mac.h | 12 ++++++++++++ src/wifi/model/block-ack-manager.cc | 17 +++++++++++++++++ src/wifi/model/block-ack-manager.h | 15 +++++++++++++++ 4 files changed, 55 insertions(+) diff --git a/src/wifi/model/ap-wifi-mac.cc b/src/wifi/model/ap-wifi-mac.cc index 4c9dc062a..67951ab81 100644 --- a/src/wifi/model/ap-wifi-mac.cc +++ b/src/wifi/model/ap-wifi-mac.cc @@ -2745,4 +2745,15 @@ ApWifiMac::GetMaxBufferStatus(Mac48Address address) const return 255; } +bool +ApWifiMac::IsGcrBaAgreementEstablishedWithAllMembers(const Mac48Address& groupAddress, + uint8_t tid) const +{ + NS_ASSERT(m_gcrManager); + return GetQosTxop(tid)->GetBaManager()->IsGcrAgreementEstablished( + groupAddress, + tid, + m_gcrManager->GetMemberStasForGroupAddress(groupAddress)); +} + } // namespace ns3 diff --git a/src/wifi/model/ap-wifi-mac.h b/src/wifi/model/ap-wifi-mac.h index 74d8d341d..59e484c8f 100644 --- a/src/wifi/model/ap-wifi-mac.h +++ b/src/wifi/model/ap-wifi-mac.h @@ -185,6 +185,18 @@ class ApWifiMac : public WifiMac */ bool UseGcr(const WifiMacHeader& hdr) const; + /** + * Check if a GCR Block Ack agreement has been successfully established with all members of + * its group. + * + * @param groupAddress the GCR group address. + * @param tid the traffic ID. + * @return true if a GCR Block Ack agreement has been successfully established with all members + * of its group, false otherwise. + */ + bool IsGcrBaAgreementEstablishedWithAllMembers(const Mac48Address& groupAddress, + uint8_t tid) const; + /// ACI-indexed map of access parameters of type unsigned integer (CWmin, CWmax and AIFSN) using UintAccessParamsMap = std::map>; diff --git a/src/wifi/model/block-ack-manager.cc b/src/wifi/model/block-ack-manager.cc index 2ca8d86c4..53143325b 100644 --- a/src/wifi/model/block-ack-manager.cc +++ b/src/wifi/model/block-ack-manager.cc @@ -1078,4 +1078,21 @@ BlockAckManager::GetGcrBufferSize(const Mac48Address& groupAddress, uint8_t tid) return gcrBufferSize; } +bool +BlockAckManager::IsGcrAgreementEstablished(const Mac48Address& gcrGroupAddress, + uint8_t tid, + const GcrManager::GcrMembers& members) const +{ + NS_ASSERT(!members.empty()); + for (const auto& member : members) + { + if (const auto agreement = GetAgreementAsOriginator(member, tid, gcrGroupAddress); + !agreement || !agreement->get().IsEstablished()) + { + return false; + } + } + return true; +} + } // namespace ns3 diff --git a/src/wifi/model/block-ack-manager.h b/src/wifi/model/block-ack-manager.h index 8ee7c7163..4137b9a9a 100644 --- a/src/wifi/model/block-ack-manager.h +++ b/src/wifi/model/block-ack-manager.h @@ -10,6 +10,7 @@ #define BLOCK_ACK_MANAGER_H #include "block-ack-type.h" +#include "gcr-manager.h" #include "originator-block-ack-agreement.h" #include "recipient-block-ack-agreement.h" #include "wifi-mac-header.h" @@ -467,6 +468,20 @@ class BlockAckManager : public Object */ uint16_t GetGcrStartingSequence(const Mac48Address& groupAddress, uint8_t tid) const; + /** + * Check if a GCR Block Ack agreement has been successfully established with all members of + * the group. + * + * @param gcrGroupAddress the GCR Group Address. + * @param tid the traffic ID. + * @param members members of the group. + * @return true if a GCR Block Ack agreement has been successfully established with all members + * of the group, false otherwise. + */ + bool IsGcrAgreementEstablished(const Mac48Address& gcrGroupAddress, + uint8_t tid, + const GcrManager::GcrMembers& members) const; + protected: void DoDispose() override;