wifi: Add function to determine whether GCR is used to transmit a given packet

This commit is contained in:
Sébastien Deronne
2025-01-18 13:10:34 +01:00
parent fa91d46b2c
commit 4233077b67
2 changed files with 47 additions and 0 deletions

View File

@@ -290,6 +290,45 @@ ApWifiMac::GetGcrManager() const
return m_gcrManager;
}
bool
ApWifiMac::UseGcr(const WifiMacHeader& hdr) const
{
if (!hdr.IsQosData())
{
return false;
}
if (!IsGroupcast(hdr.GetAddr1()))
{
return false;
}
if (!m_gcrManager)
{
return false;
}
if (m_gcrManager->GetRetransmissionPolicy() ==
GroupAddressRetransmissionPolicy::NO_ACK_NO_RETRY)
{
return false;
}
/*
* 802.11-2020 11.21.16.3.4 (GCR operation):
* An AP or mesh STA shall transmit a frame belonging to a group address
* via the GCR service if any associated STA or peer mesh STA has a GCR
* agreement for the group address and, otherwise, does not transmit the
* frame via the GCR service.
*/
if (m_gcrManager->GetMemberStasForGroupAddress(hdr.GetAddr1()).empty())
{
return false;
}
return true;
}
void
ApWifiMac::DoCompleteConfig()
{

View File

@@ -177,6 +177,14 @@ class ApWifiMac : public WifiMac
*/
uint8_t GetMaxBufferStatus(Mac48Address address) const;
/**
* Return whether GCR is used to transmit a packet.
*
* @param hdr the header of the packet to transmit
* @return true if a GCR manager is set and the packet is a groupcast QoS data, false otherwise
*/
bool UseGcr(const WifiMacHeader& hdr) const;
/// ACI-indexed map of access parameters of type unsigned integer (CWmin, CWmax and AIFSN)
using UintAccessParamsMap = std::map<AcIndex, std::vector<uint64_t>>;