wifi: Receive WifiMacQueueItems instead of separate header and payload

which means that original MSDUs (i.e., packets) are preserved in case of
A-MSDU aggregation.
This commit is contained in:
Stefano Avallone
2019-09-01 01:29:03 +02:00
parent 063d86c096
commit de2f4d08c9
16 changed files with 125 additions and 105 deletions

View File

@@ -417,8 +417,10 @@ MeshWifiInterfaceMac::SendBeacon ()
ScheduleNextBeacon ();
}
void
MeshWifiInterfaceMac::Receive (Ptr<Packet> packet, WifiMacHeader const *hdr)
MeshWifiInterfaceMac::Receive (Ptr<WifiMacQueueItem> mpdu)
{
const WifiMacHeader* hdr = &mpdu->GetHeader ();
Ptr<Packet> packet = mpdu->GetPacket ()->Copy ();
// Process beacon
if ((hdr->GetAddr1 () != GetAddress ()) && (hdr->GetAddr1 () != Mac48Address::GetBroadcast ()))
{

View File

@@ -180,10 +180,9 @@ private:
/**
* Frame receive handler
*
* \param packet the received packet
* \param hdr the wifi MAC header
* \param mpdu the received MPDU
*/
void Receive (Ptr<Packet> packet, WifiMacHeader const *hdr);
void Receive (Ptr<WifiMacQueueItem> mpdu);
/**
* Send frame. Frame is supposed to be tagged by routing information.
*

View File

@@ -238,9 +238,13 @@ OcbWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to)
* here we only care about data packet and vsa management frame
*/
void
OcbWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
OcbWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu)
{
NS_LOG_FUNCTION (this << packet << hdr);
NS_LOG_FUNCTION (this << *mpdu);
const WifiMacHeader* hdr = &mpdu->GetHeader ();
// Create a copy of the MPDU payload because non-const operations like RemovePacketTag
// and RemoveHeader may need to be performed.
Ptr<Packet> packet = mpdu->GetPacket ()->Copy ();
NS_ASSERT (!hdr->IsCtl ());
NS_ASSERT (hdr->GetAddr3 () == WILDCARD_BSSID);
@@ -269,7 +273,7 @@ OcbWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
if (hdr->IsQosData () && hdr->IsQosAmsdu ())
{
NS_LOG_DEBUG ("Received A-MSDU from" << from);
DeaggregateAmsduAndForward (packet, hdr);
DeaggregateAmsduAndForward (mpdu);
}
else
{
@@ -320,7 +324,7 @@ OcbWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
// Invoke the receive handler of our parent class to deal with any
// other frames. Specifically, this will handle Block Ack-related
// Management Action frames.
RegularWifiMac::Receive (packet, hdr);
RegularWifiMac::Receive (Create<WifiMacQueueItem> (packet, *hdr));
}
void

View File

@@ -176,7 +176,7 @@ public:
protected:
virtual void FinishConfigureStandard (enum WifiPhyStandard standard);
private:
virtual void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
virtual void Receive (Ptr<WifiMacQueueItem> mpdu);
VendorSpecificContentManager m_vscManager; ///< VSC manager
};

View File

@@ -168,9 +168,10 @@ AdhocWifiMac::SetLinkUpCallback (Callback<void> linkUp)
}
void
AdhocWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
AdhocWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu)
{
NS_LOG_FUNCTION (this << packet << hdr);
NS_LOG_FUNCTION (this << *mpdu);
const WifiMacHeader* hdr = &mpdu->GetHeader ();
NS_ASSERT (!hdr->IsCtl ());
Mac48Address from = hdr->GetAddr2 ();
Mac48Address to = hdr->GetAddr1 ();
@@ -198,11 +199,11 @@ AdhocWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
if (hdr->IsQosData () && hdr->IsQosAmsdu ())
{
NS_LOG_DEBUG ("Received A-MSDU from" << from);
DeaggregateAmsduAndForward (packet, hdr);
DeaggregateAmsduAndForward (mpdu);
}
else
{
ForwardUp (packet, from, to);
ForwardUp (mpdu->GetPacket ()->Copy (), from, to);
}
return;
}
@@ -210,7 +211,7 @@ AdhocWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
//Invoke the receive handler of our parent class to deal with any
//other frames. Specifically, this will handle Block Ack-related
//Management Action frames.
RegularWifiMac::Receive (packet, hdr);
RegularWifiMac::Receive (mpdu);
}
} //namespace ns3

View File

@@ -66,7 +66,7 @@ public:
private:
void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
void Receive (Ptr<WifiMacQueueItem> mpdu);
};
} //namespace ns3

View File

@@ -1018,9 +1018,13 @@ ApWifiMac::TxFailed (const WifiMacHeader &hdr)
}
void
ApWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
ApWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu)
{
NS_LOG_FUNCTION (this << packet << hdr);
NS_LOG_FUNCTION (this << *mpdu);
const WifiMacHeader* hdr = &mpdu->GetHeader ();
// Create a copy of the MPDU payload because non-const operations like RemovePacketTag
// and RemoveHeader may need to be performed.
Ptr<Packet> packet = mpdu->GetPacket ()->Copy ();
Mac48Address from = hdr->GetAddr2 ();
if (hdr->IsData ())
{
@@ -1039,7 +1043,7 @@ ApWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
if (hdr->IsQosAmsdu ())
{
NS_LOG_DEBUG ("Received A-MSDU from=" << from << ", size=" << packet->GetSize ());
DeaggregateAmsduAndForward (packet, hdr);
DeaggregateAmsduAndForward (mpdu);
packet = 0;
}
else
@@ -1536,28 +1540,26 @@ ApWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
//Invoke the receive handler of our parent class to deal with any
//other frames. Specifically, this will handle Block Ack-related
//Management Action frames.
RegularWifiMac::Receive (packet, hdr);
RegularWifiMac::Receive (Create<WifiMacQueueItem> (packet, *hdr));
}
void
ApWifiMac::DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket, const WifiMacHeader *hdr)
ApWifiMac::DeaggregateAmsduAndForward (Ptr<WifiMacQueueItem> mpdu)
{
NS_LOG_FUNCTION (this << aggregatedPacket << hdr);
MsduAggregator::DeaggregatedMsdus packets = MsduAggregator::Deaggregate (aggregatedPacket);
for (MsduAggregator::DeaggregatedMsdusCI i = packets.begin ();
i != packets.end (); ++i)
NS_LOG_FUNCTION (this << *mpdu);
for (auto& i : *PeekPointer (mpdu))
{
if ((*i).second.GetDestinationAddr () == GetAddress ())
if (i.second.GetDestinationAddr () == GetAddress ())
{
ForwardUp ((*i).first, (*i).second.GetSourceAddr (),
(*i).second.GetDestinationAddr ());
ForwardUp (i.first, i.second.GetSourceAddr (),
i.second.GetDestinationAddr ());
}
else
{
Mac48Address from = (*i).second.GetSourceAddr ();
Mac48Address to = (*i).second.GetDestinationAddr ();
Mac48Address from = i.second.GetSourceAddr ();
Mac48Address to = i.second.GetDestinationAddr ();
NS_LOG_DEBUG ("forwarding QoS frame from=" << from << ", to=" << to);
ForwardDown ((*i).first, from, to, hdr->GetQosTid ());
ForwardDown (i.first, from, to, mpdu->GetHeader ().GetQosTid ());
}
}
}

View File

@@ -154,7 +154,7 @@ public:
private:
void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
void Receive (Ptr<WifiMacQueueItem> mpdu);
/**
* The packet we sent was successfully received by the receiver
* (i.e. we received an ACK from the receiver). If the packet
@@ -180,11 +180,9 @@ private:
* here because, as an AP, we also need to think about redistributing
* to other associated STAs.
*
* \param aggregatedPacket the Packet containing the A-MSDU.
* \param hdr a pointer to the MAC header for \c aggregatedPacket.
* \param mpdu the MPDU containing the A-MSDU.
*/
void DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket,
const WifiMacHeader *hdr);
void DeaggregateAmsduAndForward (Ptr<WifiMacQueueItem> mpdu);
/**
* Forward the packet down to DCF/EDCAF (enqueue the packet). This method
* is a wrapper for ForwardDown with traffic id.

View File

@@ -475,7 +475,7 @@ MacLow::IsPromisc (void) const
}
void
MacLow::SetRxCallback (Callback<void, Ptr<Packet>, const WifiMacHeader *> callback)
MacLow::SetRxCallback (Callback<void, Ptr<WifiMacQueueItem>> callback)
{
m_rxCallback = callback;
}
@@ -783,7 +783,7 @@ MacLow::ReceiveOk (Ptr<WifiMacQueueItem> mpdu, double rxSnr, WifiTxVector txVect
* we handle any packet present in the
* packet queue.
*/
WifiMacHeader hdr = mpdu->GetHeader ();
const WifiMacHeader& hdr = mpdu->GetHeader ();
Ptr<Packet> packet = mpdu->GetPacket ()->Copy ();
bool isPrevNavZero = IsNavZero ();
@@ -1026,7 +1026,7 @@ MacLow::ReceiveOk (Ptr<WifiMacQueueItem> mpdu, double rxSnr, WifiTxVector txVect
}
m_stationManager->ReportRxOk (hdr.GetAddr2 (), &hdr,
rxSnr, txVector.GetMode ());
if (hdr.IsQosData () && ReceiveMpdu (packet, hdr))
if (hdr.IsQosData () && ReceiveMpdu (mpdu))
{
/* From section 9.10.4 in IEEE 802.11:
Upon the receipt of a QoS data frame from the originator for which
@@ -1090,6 +1090,7 @@ MacLow::ReceiveOk (Ptr<WifiMacQueueItem> mpdu, double rxSnr, WifiTxVector txVect
SnrTag tag;
tag.Set (rxSnr);
packet->AddPacketTag (tag);
mpdu = Create<WifiMacQueueItem> (packet, hdr);
}
if (hdr.IsMgt () && ampduSubframe)
{
@@ -1137,6 +1138,7 @@ MacLow::ReceiveOk (Ptr<WifiMacQueueItem> mpdu, double rxSnr, WifiTxVector txVect
SnrTag tag;
tag.Set (rxSnr);
packet->AddPacketTag (tag);
mpdu = Create<WifiMacQueueItem> (packet, hdr);
}
goto rxPacket;
}
@@ -1168,7 +1170,7 @@ rxPacket:
NS_ASSERT (m_currentTxop != 0);
m_currentTxop->GotAck ();
}
m_rxCallback (packet, &hdr);
m_rxCallback (mpdu);
return;
}
@@ -2148,8 +2150,10 @@ MacLow::SendAckAfterData (Mac48Address source, Time duration, WifiMode dataTxMod
}
bool
MacLow::ReceiveMpdu (Ptr<Packet> packet, WifiMacHeader hdr)
MacLow::ReceiveMpdu (Ptr<WifiMacQueueItem> mpdu)
{
const WifiMacHeader& hdr = mpdu->GetHeader ();
if (m_stationManager->GetHtSupported ()
|| m_stationManager->GetVhtSupported ()
|| m_stationManager->GetHeSupported ())
@@ -2167,7 +2171,7 @@ MacLow::ReceiveMpdu (Ptr<Packet> packet, WifiMacHeader hdr)
//Implement HT immediate Block Ack support for HT Delayed Block Ack is not added yet
if (!QosUtilsIsOldPacket ((*it).second.first.GetStartingSequence (), seqNumber))
{
StoreMpduIfNeeded (packet, hdr);
StoreMpduIfNeeded (mpdu);
if (!IsInWindow (hdr.GetSequenceNumber (), (*it).second.first.GetStartingSequence (), (*it).second.first.GetBufferSize ()))
{
uint16_t delta = (seqNumber - (*it).second.first.GetWinEnd () + 4096) % 4096;
@@ -2183,26 +2187,26 @@ MacLow::ReceiveMpdu (Ptr<Packet> packet, WifiMacHeader hdr)
}
return false;
}
return StoreMpduIfNeeded (packet, hdr);
return StoreMpduIfNeeded (mpdu);
}
bool
MacLow::StoreMpduIfNeeded (Ptr<Packet> packet, WifiMacHeader hdr)
MacLow::StoreMpduIfNeeded (Ptr<WifiMacQueueItem> mpdu)
{
const WifiMacHeader& hdr = mpdu->GetHeader ();
AgreementsI it = m_bAckAgreements.find (std::make_pair (hdr.GetAddr2 (), hdr.GetQosTid ()));
if (it != m_bAckAgreements.end ())
{
BufferedPacket bufferedPacket (packet, hdr);
uint16_t endSequence = ((*it).second.first.GetStartingSequence () + 2047) % 4096;
uint32_t mappedSeqControl = QosUtilsMapSeqControlToUniqueInteger (hdr.GetSequenceControl (), endSequence);
BufferedPacketI i = (*it).second.second.begin ();
for (; i != (*it).second.second.end ()
&& QosUtilsMapSeqControlToUniqueInteger ((*i).second.GetSequenceControl (), endSequence) < mappedSeqControl; i++)
&& QosUtilsMapSeqControlToUniqueInteger ((*i)->GetHeader ().GetSequenceControl (), endSequence) < mappedSeqControl; i++)
{
}
(*it).second.second.insert (i, bufferedPacket);
(*it).second.second.insert (i, mpdu);
//Update block ack cache
BlockAckCachesI j = m_bAckCaches.find (std::make_pair (hdr.GetAddr2 (), hdr.GetQosTid ()));
@@ -2233,7 +2237,7 @@ MacLow::CreateBlockAckAgreement (const MgtAddBaResponseHeader *respHdr, Mac48Add
agreement.SetTimeout (respHdr->GetTimeout ());
agreement.SetStartingSequence (startingSeq);
std::list<BufferedPacket> buffer (0);
std::list<Ptr<WifiMacQueueItem>> buffer (0);
AgreementKey key (originator, respHdr->GetTid ());
AgreementValue value (agreement, buffer);
m_bAckAgreements.insert (std::make_pair (key, value));
@@ -2283,31 +2287,31 @@ MacLow::RxCompleteBufferedPacketsWithSmallerSequence (uint16_t seq, Mac48Address
uint16_t guard = 0;
if (last != (*it).second.second.end ())
{
guard = (*it).second.second.begin ()->second.GetSequenceControl ();
guard = (*(*it).second.second.begin ())->GetHeader ().GetSequenceControl ();
}
BufferedPacketI i = (*it).second.second.begin ();
for (; i != (*it).second.second.end ()
&& QosUtilsMapSeqControlToUniqueInteger ((*i).second.GetSequenceControl (), endSequence) < mappedStart; )
&& QosUtilsMapSeqControlToUniqueInteger ((*i)->GetHeader ().GetSequenceControl (), endSequence) < mappedStart; )
{
if (guard == (*i).second.GetSequenceControl ())
if (guard == (*i)->GetHeader ().GetSequenceControl ())
{
if (!(*i).second.IsMoreFragments ())
if (!(*i)->GetHeader ().IsMoreFragments ())
{
while (last != i)
{
m_rxCallback ((*last).first, &(*last).second);
m_rxCallback (*last);
last++;
}
m_rxCallback ((*last).first, &(*last).second);
m_rxCallback (*last);
last++;
/* go to next packet */
while (i != (*it).second.second.end () && guard == (*i).second.GetSequenceControl ())
while (i != (*it).second.second.end () && guard == (*i)->GetHeader ().GetSequenceControl ())
{
i++;
}
if (i != (*it).second.second.end ())
{
guard = (*i).second.GetSequenceControl ();
guard = (*i)->GetHeader ().GetSequenceControl ();
last = i;
}
}
@@ -2319,13 +2323,13 @@ MacLow::RxCompleteBufferedPacketsWithSmallerSequence (uint16_t seq, Mac48Address
else
{
/* go to next packet */
while (i != (*it).second.second.end () && guard == (*i).second.GetSequenceControl ())
while (i != (*it).second.second.end () && guard == (*i)->GetHeader ().GetSequenceControl ())
{
i++;
}
if (i != (*it).second.second.end ())
{
guard = (*i).second.GetSequenceControl ();
guard = (*i)->GetHeader ().GetSequenceControl ();
last = i;
}
}
@@ -2343,19 +2347,19 @@ MacLow::RxCompleteBufferedPacketsUntilFirstLost (Mac48Address originator, uint8_
uint16_t guard = (*it).second.first.GetStartingSequenceControl ();
BufferedPacketI lastComplete = (*it).second.second.begin ();
BufferedPacketI i = (*it).second.second.begin ();
for (; i != (*it).second.second.end () && guard == (*i).second.GetSequenceControl (); i++)
for (; i != (*it).second.second.end () && guard == (*i)->GetHeader ().GetSequenceControl (); i++)
{
if (!(*i).second.IsMoreFragments ())
if (!(*i)->GetHeader ().IsMoreFragments ())
{
while (lastComplete != i)
{
m_rxCallback ((*lastComplete).first, &(*lastComplete).second);
m_rxCallback (*lastComplete);
lastComplete++;
}
m_rxCallback ((*lastComplete).first, &(*lastComplete).second);
m_rxCallback (*lastComplete);
lastComplete++;
}
guard = (*i).second.IsMoreFragments () ? (guard + 1) : ((guard + 16) & 0xfff0);
guard = (*i)->GetHeader ().IsMoreFragments () ? (guard + 1) : ((guard + 16) & 0xfff0);
}
(*it).second.first.SetStartingSequenceControl (guard);
/* All packets already forwarded to WifiMac must be removed from buffer:

View File

@@ -63,7 +63,7 @@ public:
/**
* typedef for a callback for MacLowRx
*/
typedef Callback<void, Ptr<Packet>, const WifiMacHeader*> MacLowRxCallback;
typedef Callback<void, Ptr<WifiMacQueueItem>> MacLowRxCallback;
MacLow ();
virtual ~MacLow ();
@@ -270,7 +270,7 @@ public:
* This callback typically forwards incoming packets to
* an instance of ns3::MacRxMiddle.
*/
void SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *> callback);
void SetRxCallback (Callback<void, Ptr<WifiMacQueueItem>> callback);
/**
* \param dcf listen to NAV events for every incoming and outgoing packet.
*/
@@ -813,18 +813,16 @@ private:
*/
void RxCompleteBufferedPacketsUntilFirstLost (Mac48Address originator, uint8_t tid);
/**
* \param packet the packet
* \param hdr the header
* \param mpdu the MPDU
* \returns true if MPDU received
*
* This method updates the reorder buffer and the scoreboard when an MPDU is received in an HT station
* and stores the MPDU if needed when an MPDU is received in an non-HT Station (implements HT
* immediate block Ack)
*/
bool ReceiveMpdu (Ptr<Packet> packet, WifiMacHeader hdr);
bool ReceiveMpdu (Ptr<WifiMacQueueItem> mpdu);
/**
* \param packet the packet
* \param hdr the header
* \param mpdu the MPDU
* \returns true if the MPDU stored
*
* This method checks if exists a valid established block ack agreement.
@@ -832,7 +830,7 @@ private:
* in order of increasing sequence control field. All comparison are performed
* circularly modulo 2^12.
*/
bool StoreMpduIfNeeded (Ptr<Packet> packet, WifiMacHeader hdr);
bool StoreMpduIfNeeded (Ptr<WifiMacQueueItem> mpdu);
/**
* Invoked after that a block ack request has been received. Looks for corresponding
* block ack agreement and creates block ack bitmap on a received packets basis.
@@ -961,11 +959,10 @@ private:
/*
* BlockAck data structures.
*/
typedef std::pair<Ptr<Packet>, WifiMacHeader> BufferedPacket; //!< buffered packet typedef
typedef std::list<BufferedPacket>::iterator BufferedPacketI; //!< buffered packet iterator typedef
typedef std::list<Ptr<WifiMacQueueItem>>::iterator BufferedPacketI; //!< buffered packet iterator typedef
typedef std::pair<Mac48Address, uint8_t> AgreementKey; //!< agreement key typedef
typedef std::pair<BlockAckAgreement, std::list<BufferedPacket> > AgreementValue; //!< agreement value typedef
typedef std::pair<BlockAckAgreement, std::list<Ptr<WifiMacQueueItem>> > AgreementValue; //!< agreement value typedef
typedef std::map<AgreementKey, AgreementValue> Agreements; //!< agreements
typedef std::map<AgreementKey, AgreementValue>::iterator AgreementsI; //!< agreements iterator

View File

@@ -22,7 +22,7 @@
#include "ns3/sequence-number.h"
#include "ns3/packet.h"
#include "mac-rx-middle.h"
#include "wifi-mac-header.h"
#include "wifi-mac-queue-item.h"
namespace ns3 {
@@ -296,9 +296,11 @@ MacRxMiddle::HandleFragments (Ptr<Packet> packet, const WifiMacHeader *hdr,
}
void
MacRxMiddle::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
MacRxMiddle::Receive (Ptr<WifiMacQueueItem> mpdu)
{
NS_LOG_FUNCTION (packet << hdr);
NS_LOG_FUNCTION (*mpdu);
const WifiMacHeader* hdr = &mpdu->GetHeader ();
Ptr<Packet> packet = mpdu->GetPacket ()->Copy ();
NS_ASSERT (hdr->IsData () || hdr->IsMgt ());
if (!m_pcfCallback.IsNull ())
{
@@ -339,7 +341,18 @@ MacRxMiddle::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
{
originator->SetSequenceControl (hdr->GetSequenceControl ());
}
m_callback (aggregate, hdr);
if (aggregate == packet)
{
m_callback (mpdu);
}
else
{
// We could do this in all cases, but passing the received mpdu in case of
// A-MSDUs saves us the time to deaggregate the A-MSDU in MSDUs (which are
// kept separate in the received mpdu) and allows us to pass the originally
// transmitted packets (i.e., with the same UID) to the receiver.
m_callback (Create<WifiMacQueueItem> (aggregate, *hdr));
}
}
void

View File

@@ -31,6 +31,7 @@ class WifiMacHeader;
class OriginatorRxStatus;
class Packet;
class Mac48Address;
class WifiMacQueueItem;
/**
* \ingroup wifi
@@ -43,7 +44,7 @@ public:
/**
* typedef for callback
*/
typedef Callback<void, Ptr<Packet>, const WifiMacHeader*> ForwardUpCallback;
typedef Callback<void, Ptr<WifiMacQueueItem>> ForwardUpCallback;
MacRxMiddle ();
~MacRxMiddle ();
@@ -65,10 +66,9 @@ public:
/**
* Receive a packet.
*
* \param packet the packet
* \param hdr MAC header
* \param mpdu the MPDU
*/
void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
void Receive (Ptr<WifiMacQueueItem> mpdu);
private:

View File

@@ -857,10 +857,12 @@ RegularWifiMac::ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address t
}
void
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
RegularWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu)
{
NS_LOG_FUNCTION (this << packet << hdr);
NS_LOG_FUNCTION (this << *mpdu);
const WifiMacHeader* hdr = &mpdu->GetHeader ();
Ptr<Packet> packet = mpdu->GetPacket ()->Copy ();
Mac48Address to = hdr->GetAddr1 ();
Mac48Address from = hdr->GetAddr2 ();
@@ -955,15 +957,13 @@ RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
}
void
RegularWifiMac::DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket, const WifiMacHeader *hdr)
RegularWifiMac::DeaggregateAmsduAndForward (Ptr<WifiMacQueueItem> mpdu)
{
NS_LOG_FUNCTION (this << aggregatedPacket << hdr);
MsduAggregator::DeaggregatedMsdus packets = MsduAggregator::Deaggregate (aggregatedPacket);
for (MsduAggregator::DeaggregatedMsdusCI i = packets.begin ();
i != packets.end (); ++i)
NS_LOG_FUNCTION (this << *mpdu);
for (auto& msduPair : *PeekPointer (mpdu))
{
ForwardUp ((*i).first, (*i).second.GetSourceAddr (),
(*i).second.GetDestinationAddr ());
ForwardUp (msduPair.first, msduPair.second.GetSourceAddr (),
msduPair.second.GetDestinationAddr ());
}
}

View File

@@ -389,10 +389,9 @@ protected:
* classes so that they can perform their data handling before
* invoking the base version.
*
* \param packet the packet that has been received.
* \param hdr a pointer to the MAC header of the received frame.
* \param mpdu the MPDU that has been received.
*/
virtual void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
virtual void Receive (Ptr<WifiMacQueueItem> mpdu);
/**
* The packet we sent was successfully received by the receiver
* (i.e. we received an ACK from the receiver).
@@ -421,11 +420,9 @@ protected:
* This method can be called to de-aggregate an A-MSDU and forward
* the constituent packets up the stack.
*
* \param aggregatedPacket the Packet containing the A-MSDU.
* \param hdr a pointer to the MAC header for \c aggregatedPacket.
* \param mpdu the MPDU containing the A-MSDU.
*/
virtual void DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket,
const WifiMacHeader *hdr);
virtual void DeaggregateAmsduAndForward (Ptr<WifiMacQueueItem> mpdu);
/**
* This method can be called to accept a received ADDBA Request. An

View File

@@ -502,9 +502,13 @@ StaWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to)
}
void
StaWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
StaWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu)
{
NS_LOG_FUNCTION (this << packet << hdr);
NS_LOG_FUNCTION (this << *mpdu);
const WifiMacHeader* hdr = &mpdu->GetHeader ();
// Create a copy of the MPDU payload because non-const operations like RemovePacketTag
// and RemoveHeader may need to be performed.
Ptr<Packet> packet = mpdu->GetPacket ()->Copy ();
NS_ASSERT (!hdr->IsCtl ());
if (hdr->GetAddr3 () == GetAddress ())
{
@@ -547,7 +551,7 @@ StaWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
if (hdr->IsQosAmsdu ())
{
NS_ASSERT (hdr->GetAddr3 () == GetBssid ());
DeaggregateAmsduAndForward (packet, hdr);
DeaggregateAmsduAndForward (mpdu);
packet = 0;
}
else
@@ -712,7 +716,7 @@ StaWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
//Invoke the receive handler of our parent class to deal with any
//other frames. Specifically, this will handle Block Ack-related
//Management Action frames.
RegularWifiMac::Receive (packet, hdr);
RegularWifiMac::Receive (Create<WifiMacQueueItem> (packet, *hdr));
}
void

View File

@@ -187,10 +187,9 @@ private:
/**
* Handle a received packet.
*
* \param packet the received packet
* \param hdr the MAC header of the received packet
* \param mpdu the received MPDU
*/
void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
void Receive (Ptr<WifiMacQueueItem> mpdu);
/**
* Update associated AP's information from beacon. If STA is not associated,
* this information will used for the association process.