wifi: Add MLD support to MPDU aggregator

This commit is contained in:
Stefano Avallone
2022-11-09 17:52:26 +01:00
committed by Stefano Avallone
parent dbc40797e3
commit d1850b6990
2 changed files with 17 additions and 5 deletions

View File

@@ -35,6 +35,7 @@
#include "ns3/he-capabilities.h"
#include "ns3/ht-capabilities.h"
#include "ns3/ht-frame-exchange-manager.h"
#include "ns3/log.h"
#include "ns3/packet.h"
#include "ns3/vht-capabilities.h"
@@ -60,6 +61,7 @@ void
MpduAggregator::DoDispose()
{
m_mac = nullptr;
m_htFem = nullptr;
Object::DoDispose();
}
@@ -68,6 +70,7 @@ MpduAggregator::SetWifiMac(const Ptr<WifiMac> mac)
{
NS_LOG_FUNCTION(this << mac);
m_mac = mac;
m_htFem = DynamicCast<HtFrameExchangeManager>(m_mac->GetFrameExchangeManager(m_linkId));
}
void
@@ -75,6 +78,10 @@ MpduAggregator::SetLinkId(uint8_t linkId)
{
NS_LOG_FUNCTION(this << +linkId);
m_linkId = linkId;
if (m_mac)
{
m_htFem = DynamicCast<HtFrameExchangeManager>(m_mac->GetFrameExchangeManager(m_linkId));
}
}
void
@@ -205,6 +212,7 @@ MpduAggregator::GetNextAmpdu(Ptr<WifiMpdu> mpdu,
Mac48Address recipient = mpdu->GetHeader().GetAddr1();
NS_ASSERT(mpdu->GetHeader().IsQosData() && !recipient.IsBroadcast());
uint8_t tid = mpdu->GetHeader().GetQosTid();
auto origRecipient = mpdu->GetOriginal()->GetHeader().GetAddr1();
Ptr<QosTxop> qosTxop = m_mac->GetQosTxop(tid);
NS_ASSERT(qosTxop);
@@ -227,16 +235,18 @@ MpduAggregator::GetNextAmpdu(Ptr<WifiMpdu> mpdu,
mpduList.push_back(nextMpdu);
// If allowed by the BA agreement, get the next MPDU
auto peekedMpdu = qosTxop->PeekNextMpdu(m_linkId, tid, recipient, nextMpdu);
auto peekedMpdu =
qosTxop->PeekNextMpdu(m_linkId, tid, origRecipient, nextMpdu->GetOriginal());
nextMpdu = nullptr;
if (peekedMpdu)
{
// PeekNextMpdu() does not return an MPDU that is beyond the transmit window
NS_ASSERT(IsInWindow(peekedMpdu->GetHeader().GetSequenceNumber(),
qosTxop->GetBaStartingSequence(recipient, tid),
qosTxop->GetBaBufferSize(recipient, tid)));
qosTxop->GetBaStartingSequence(origRecipient, tid),
qosTxop->GetBaBufferSize(origRecipient, tid)));
peekedMpdu = m_htFem->CreateAlias(peekedMpdu);
// get the next MPDU to aggregate, provided that the constraints on size
// and duration limit are met. Note that the returned MPDU differs from
// the peeked MPDU if A-MSDU aggregation is enabled.

View File

@@ -38,6 +38,7 @@ class Packet;
class WifiMac;
class WifiMpdu;
class WifiTxParameters;
class HtFrameExchangeManager;
/**
* \brief Aggregator used to construct A-MPDUs
@@ -165,8 +166,9 @@ class MpduAggregator : public Object
void DoDispose() override;
private:
Ptr<WifiMac> m_mac; //!< the MAC of this station
uint8_t m_linkId{0}; //!< ID of the link this object is connected to
Ptr<WifiMac> m_mac; //!< the MAC of this station
Ptr<HtFrameExchangeManager> m_htFem; //!< the HT Frame Exchange Manager of this station
uint8_t m_linkId{0}; //!< ID of the link this object is connected to
};
} // namespace ns3