wifi: FEMs create and handle MPDU aliases

This commit is contained in:
Stefano Avallone
2022-09-14 14:07:04 +02:00
committed by Stefano Avallone
parent 396568a156
commit a9f4de2979
9 changed files with 39 additions and 6 deletions

View File

@@ -1406,7 +1406,8 @@ void
ApWifiMac::Receive(Ptr<const WifiMpdu> mpdu, uint8_t linkId)
{
NS_LOG_FUNCTION(this << *mpdu << +linkId);
const WifiMacHeader* hdr = &mpdu->GetHeader();
// consider the MAC header of the original MPDU (makes a difference for data frames only)
const WifiMacHeader* hdr = &mpdu->GetOriginal()->GetHeader();
Ptr<const Packet> packet = mpdu->GetPacket();
Mac48Address from = hdr->GetAddr2();
if (hdr->IsData())

View File

@@ -877,6 +877,10 @@ FrameExchangeManager::NormalAckTimeout(Ptr<WifiMpdu> mpdu, const WifiTxVector& t
else
{
NS_LOG_DEBUG("Missed Ack, retransmit MPDU");
if (mpdu->IsQueued()) // the MPDU may have been removed due to lifetime expiration
{
mpdu = m_mac->GetTxopQueue(mpdu->GetQueueAc())->GetOriginal(mpdu);
}
mpdu->GetHeader().SetRetry();
RetransmitMpduAfterMissedAck(mpdu);
m_dcf->UpdateFailedCw(m_linkId);

View File

@@ -29,6 +29,7 @@
#include "ns3/recipient-block-ack-agreement.h"
#include "ns3/snr-tag.h"
#include "ns3/sta-wifi-mac.h"
#include "ns3/wifi-mac-queue.h"
#include <algorithm>
#include <functional>
@@ -1102,7 +1103,7 @@ HeFrameExchangeManager::NormalAckTimeout(Ptr<WifiMpdu> mpdu, const WifiTxVector&
{
if (mpdu->IsQueued())
{
mpdu->GetHeader().SetRetry();
m_mac->GetTxopQueue(mpdu->GetQueueAc())->GetOriginal(mpdu)->GetHeader().SetRetry();
}
}
}

View File

@@ -421,7 +421,7 @@ HtFrameExchangeManager::StartFrameExchange(Ptr<QosTxop> edca, Time availableTime
// Use SendDataFrame if we can try aggregation
if (hdr.IsQosData() && !hdr.GetAddr1().IsGroup() && !peekedItem->IsFragment() &&
!GetWifiRemoteStationManager()->NeedFragmentation(peekedItem))
!GetWifiRemoteStationManager()->NeedFragmentation(peekedItem = CreateAlias(peekedItem)))
{
return SendDataFrame(peekedItem, availableTime, initialFrame);
}

View File

@@ -301,7 +301,8 @@ void
MacRxMiddle::Receive(Ptr<const WifiMpdu> mpdu, uint8_t linkId)
{
NS_LOG_FUNCTION(*mpdu << +linkId);
const WifiMacHeader* hdr = &mpdu->GetHeader();
// consider the MAC header of the original MPDU (makes a difference for data frames only)
const WifiMacHeader* hdr = &mpdu->GetOriginal()->GetHeader();
NS_ASSERT(hdr->IsData() || hdr->IsMgt());
OriginatorRxStatus* originator = Lookup(hdr);

View File

@@ -280,6 +280,7 @@ QosFrameExchangeManager::StartFrameExchange(Ptr<QosTxop> edca,
return false;
}
mpdu = CreateAlias(mpdu);
WifiTxParameters txParams;
txParams.m_txVector =
GetWifiRemoteStationManager()->GetDataTxVector(mpdu->GetHeader(), m_allowedWidth);
@@ -312,6 +313,12 @@ QosFrameExchangeManager::StartFrameExchange(Ptr<QosTxop> edca,
return true;
}
Ptr<WifiMpdu>
QosFrameExchangeManager::CreateAlias(Ptr<WifiMpdu> mpdu) const
{
return mpdu;
}
bool
QosFrameExchangeManager::TryAddMpdu(Ptr<const WifiMpdu> mpdu,
WifiTxParameters& txParams,

View File

@@ -92,6 +92,16 @@ class QosFrameExchangeManager : public FrameExchangeManager
const WifiTxParameters& txParams,
Time ppduDurationLimit) const;
/**
* Create an alias of the given MPDU for transmission by this Frame Exchange Manager.
* This is required by 11be MLDs to support translation of MAC addresses. For single
* link devices, the given MPDU is simply returned.
*
* \param mpdu the given MPDU
* \return the alias of the given MPDU for transmission on this link
*/
virtual Ptr<WifiMpdu> CreateAlias(Ptr<WifiMpdu> mpdu) const;
protected:
void DoDispose() override;

View File

@@ -526,8 +526,16 @@ QosTxop::AssignSequenceNumber(Ptr<WifiMpdu> mpdu) const
if (!mpdu->IsFragment() && !mpdu->GetHeader().IsRetry() && !mpdu->IsInFlight())
{
uint16_t sequence = m_txMiddle->GetNextSequenceNumberFor(&mpdu->GetHeader());
// in case of 11be MLDs, sequence numbers refer to the MLD address
auto origMpdu = m_queue->GetOriginal(mpdu);
uint16_t sequence = m_txMiddle->GetNextSequenceNumberFor(&origMpdu->GetHeader());
mpdu->GetHeader().SetSequenceNumber(sequence);
// if this is not the original copy of the MPDU, assign the sequence number to
// the original copy as well
if (!mpdu->IsOriginal())
{
origMpdu->GetHeader().SetSequenceNumber(sequence);
}
}
}

View File

@@ -795,7 +795,8 @@ void
StaWifiMac::Receive(Ptr<const WifiMpdu> mpdu, uint8_t linkId)
{
NS_LOG_FUNCTION(this << *mpdu << +linkId);
const WifiMacHeader* hdr = &mpdu->GetHeader();
// consider the MAC header of the original MPDU (makes a difference for data frames only)
const WifiMacHeader* hdr = &mpdu->GetOriginal()->GetHeader();
Ptr<const Packet> packet = mpdu->GetPacket();
NS_ASSERT(!hdr->IsCtl());
Mac48Address myAddr =