From eaf6850df72f9d21fce3abf451a536b7512076e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Mon, 25 Sep 2023 19:45:38 +0200 Subject: [PATCH] wifi: Use GCR Block Ack policy when GCR Block Ack service is used for groupcast MPDUs --- src/wifi/model/wifi-default-ack-manager.cc | 43 +++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/src/wifi/model/wifi-default-ack-manager.cc b/src/wifi/model/wifi-default-ack-manager.cc index dd03e4fcf..1a8ab8d11 100644 --- a/src/wifi/model/wifi-default-ack-manager.cc +++ b/src/wifi/model/wifi-default-ack-manager.cc @@ -10,6 +10,7 @@ #include "ap-wifi-mac.h" #include "ctrl-headers.h" +#include "gcr-manager.h" #include "qos-utils.h" #include "wifi-mac-queue.h" #include "wifi-mpdu.h" @@ -292,8 +293,32 @@ WifiDefaultAckManager::TryAddMpdu(Ptr mpdu, const WifiTxParamete if (receiver.IsGroup()) { - NS_ABORT_MSG_IF(!IsGcr(m_mac, hdr) && !txParams.LastAddedIsFirstMpdu(receiver), + // if the current acknowledgment method (if any) is already BAR_BLOCK_ACK, it will not + // change by adding an MPDU + if (txParams.m_acknowledgment && + txParams.m_acknowledgment->method == WifiAcknowledgment::BAR_BLOCK_ACK) + { + return nullptr; + } + const auto isGcr = IsGcr(m_mac, hdr); + NS_ABORT_MSG_IF(!isGcr && !txParams.LastAddedIsFirstMpdu(receiver), "Unicast frames only can be aggregated if GCR is not used"); + if (auto apMac = DynamicCast(m_mac); + isGcr && apMac->GetGcrManager()->GetRetransmissionPolicyFor(hdr) == + GroupAddressRetransmissionPolicy::GCR_BLOCK_ACK) + { + NS_LOG_DEBUG("Request to schedule a GCR Block Ack Request"); + const auto recipient = + apMac->GetGcrManager()->GetIndividuallyAddressedRecipient(receiver); + auto acknowledgment = std::make_unique(); + acknowledgment->blockAckReqTxVector = + GetWifiRemoteStationManager()->GetBlockAckTxVector(recipient, txParams.m_txVector); + acknowledgment->blockAckTxVector = acknowledgment->blockAckReqTxVector; + acknowledgment->barType = BlockAckReqType::GCR; + acknowledgment->baType = BlockAckType::GCR; + acknowledgment->SetQosAckPolicy(receiver, hdr.GetQosTid(), WifiMacHeader::BLOCK_ACK); + return acknowledgment; + } auto acknowledgment = std::make_unique(); if (hdr.IsQosData()) { @@ -369,6 +394,22 @@ WifiDefaultAckManager::TryAddMpdu(Ptr mpdu, const WifiTxParamete return acknowledgment; } + if (hdr.IsBlockAckReq()) + { + CtrlBAckRequestHeader baReqHdr; + mpdu->GetPacket()->PeekHeader(baReqHdr); + if (baReqHdr.IsGcr()) + { + NS_LOG_DEBUG("GCR Block Ack Req, request GCR Block Ack"); + auto acknowledgment = std::make_unique(); + acknowledgment->blockAckTxVector = + GetWifiRemoteStationManager()->GetBlockAckTxVector(receiver, txParams.m_txVector); + acknowledgment->baType = BlockAckType::GCR; + acknowledgment->SetQosAckPolicy(receiver, tid, WifiMacHeader::NORMAL_ACK); + return acknowledgment; + } + } + NS_LOG_DEBUG( "A-MPDU using Implicit Block Ack Request policy or BlockAckReq, request Block Ack"); auto acknowledgment = std::make_unique();