From 6a2e56c9fe3258b1ae6baef85c3c975da4d22d6b Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Fri, 15 Sep 2023 19:28:02 +0200 Subject: [PATCH] wifi: Allow creation of A-MSDUs containing a single MSDU --- src/wifi/model/wifi-mpdu.cc | 17 +++++++++++++---- src/wifi/model/wifi-mpdu.h | 4 +++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/wifi/model/wifi-mpdu.cc b/src/wifi/model/wifi-mpdu.cc index efaaefa29..5f10b1bc4 100644 --- a/src/wifi/model/wifi-mpdu.cc +++ b/src/wifi/model/wifi-mpdu.cc @@ -174,9 +174,15 @@ WifiMpdu::GetProtocolDataUnit() const void WifiMpdu::Aggregate(Ptr msdu) { - NS_ASSERT(msdu); - NS_LOG_FUNCTION(this << *msdu); - NS_ABORT_MSG_IF(!msdu->GetHeader().IsQosData() || msdu->GetHeader().IsQosAmsdu(), + if (msdu) + { + NS_LOG_FUNCTION(this << *msdu); + } + else + { + NS_LOG_FUNCTION(this); + } + NS_ABORT_MSG_IF(msdu && (!msdu->GetHeader().IsQosData() || msdu->GetHeader().IsQosAmsdu()), "Only QoS data frames that do not contain an A-MSDU can be aggregated"); NS_ABORT_MSG_IF(!std::holds_alternative(m_instanceInfo), "This method can only be called on the original version of the MPDU"); @@ -206,7 +212,10 @@ WifiMpdu::Aggregate(Ptr msdu) // to be set to the BSSID, but neither Address 1 nor Address 2 contain the // BSSID. Hence, it is left up to the caller to set these Address fields. } - DoAggregate(msdu); + if (msdu) + { + DoAggregate(msdu); + } } void diff --git a/src/wifi/model/wifi-mpdu.h b/src/wifi/model/wifi-mpdu.h index da6025d8a..b79849fe1 100644 --- a/src/wifi/model/wifi-mpdu.h +++ b/src/wifi/model/wifi-mpdu.h @@ -131,7 +131,9 @@ class WifiMpdu : public SimpleRefCount /** * \brief Aggregate the MSDU contained in the given MPDU to this MPDU (thus * constituting an A-MSDU). Note that the given MPDU cannot contain - * an A-MSDU. + * an A-MSDU. If the given MPDU is a null pointer, the effect of this + * call is to add only an A-MSDU subframe header, thus producing an A-MSDU + * containing a single MSDU. * \param msdu the MPDU containing the MSDU to aggregate */ void Aggregate(Ptr msdu);