wifi: WifiMacQueueItem does not keep a pointer to the queue it is stored into
Instead, it keeps the AC index associated with the queue it is stored into
This commit is contained in:
committed by
Stefano Avallone
parent
97c888cd55
commit
62542e5fb9
@@ -133,7 +133,7 @@ WaveFrameExchangeManager::StartTransmission (Ptr<Txop> dcf)
|
||||
}
|
||||
|
||||
m_dcf->NotifyChannelAccessed ();
|
||||
Ptr<WifiMacQueueItem> mpdu = *queue->Peek ()->GetQueueIteratorPair ().it;
|
||||
Ptr<WifiMacQueueItem> mpdu = *queue->Peek ()->GetQueueIterator ();
|
||||
NS_ASSERT (mpdu != 0);
|
||||
|
||||
// assign a sequence number if this is not a fragment nor a retransmission
|
||||
|
||||
@@ -309,10 +309,9 @@ BlockAckManager::GetBar (bool remove, uint8_t tid, Mac48Address address)
|
||||
continue;
|
||||
}
|
||||
|
||||
WifiMacQueue::ConstIterator queueIt = (*mpduIt)->GetQueueIteratorPair ().it;
|
||||
WifiMacQueue* queue = (*mpduIt)->GetQueueIteratorPair ().queue;
|
||||
WifiMacQueue::ConstIterator queueIt = (*mpduIt)->GetQueueIterator ();
|
||||
|
||||
if ((*mpduIt)->GetTimeStamp () + queue->GetMaxDelay () <= now)
|
||||
if ((*mpduIt)->GetTimeStamp () + m_queue->GetMaxDelay () <= now)
|
||||
{
|
||||
// MPDU expired
|
||||
it->second.first.NotifyDiscardedMpdu (*mpduIt);
|
||||
@@ -320,7 +319,7 @@ BlockAckManager::GetBar (bool remove, uint8_t tid, Mac48Address address)
|
||||
// consequent call to NotifyDiscardedMpdu does nothing (in particular,
|
||||
// does not schedule a BAR) because we have advanced the transmit window
|
||||
// and hence this MPDU became an old packet
|
||||
queue->TtlExceeded (queueIt, now);
|
||||
m_queue->TtlExceeded (queueIt, now);
|
||||
mpduIt = it->second.second.erase (mpduIt);
|
||||
}
|
||||
else
|
||||
@@ -392,8 +391,7 @@ BlockAckManager::HandleInFlightMpdu (PacketQueueI mpduIt, MpduStatus status,
|
||||
}
|
||||
|
||||
WifiMacHeader& hdr = (*mpduIt)->GetHeader ();
|
||||
WifiMacQueue::ConstIterator queueIt = (*mpduIt)->GetQueueIteratorPair ().it;
|
||||
WifiMacQueue* queue = (*mpduIt)->GetQueueIteratorPair ().queue;
|
||||
WifiMacQueue::ConstIterator queueIt = (*mpduIt)->GetQueueIterator ();
|
||||
|
||||
NS_ASSERT (hdr.GetAddr1 () == it->first.first);
|
||||
NS_ASSERT (hdr.IsQosData () && hdr.GetQosTid () == it->first.second);
|
||||
@@ -405,13 +403,13 @@ BlockAckManager::HandleInFlightMpdu (PacketQueueI mpduIt, MpduStatus status,
|
||||
{
|
||||
m_droppedOldMpduCallback (*queueIt);
|
||||
}
|
||||
queue->Remove (queueIt);
|
||||
m_queue->Remove (queueIt);
|
||||
return it->second.second.erase (mpduIt);
|
||||
}
|
||||
|
||||
auto nextIt = std::next (mpduIt);
|
||||
|
||||
if (queue->TtlExceeded (queueIt, now))
|
||||
if (m_queue->TtlExceeded (queueIt, now))
|
||||
{
|
||||
// WifiMacQueue::TtlExceeded() has removed the MPDU from the EDCA queue
|
||||
// and fired the Expired trace source, which called NotifyDiscardedMpdu,
|
||||
|
||||
@@ -281,7 +281,7 @@ FrameExchangeManager::StartTransmission (Ptr<Txop> dcf)
|
||||
}
|
||||
|
||||
m_dcf->NotifyChannelAccessed ();
|
||||
Ptr<WifiMacQueueItem> mpdu = *queue->Peek ()->GetQueueIteratorPair ().it;
|
||||
Ptr<WifiMacQueueItem> mpdu = *queue->Peek ()->GetQueueIterator ();
|
||||
NS_ASSERT (mpdu != 0);
|
||||
NS_ASSERT (mpdu->GetHeader ().IsData () || mpdu->GetHeader ().IsMgt ());
|
||||
|
||||
@@ -327,15 +327,15 @@ FrameExchangeManager::GetFirstFragmentIfNeeded (Ptr<WifiMacQueueItem> mpdu)
|
||||
{
|
||||
NS_LOG_DEBUG ("Fragmenting the MSDU");
|
||||
m_fragmentedPacket = mpdu->GetPacket ()->Copy ();
|
||||
AcIndex ac = mpdu->GetQueueAc ();
|
||||
// dequeue the MSDU
|
||||
WifiMacQueueItem::QueueIteratorPair queueIt = mpdu->GetQueueIteratorPair ();
|
||||
queueIt.queue->DequeueIfQueued (*queueIt.it);
|
||||
DequeueMpdu (mpdu);
|
||||
// create the first fragment
|
||||
mpdu->GetHeader ().SetMoreFragments ();
|
||||
Ptr<Packet> fragment = m_fragmentedPacket->CreateFragment (0, m_mac->GetWifiRemoteStationManager ()->GetFragmentSize (mpdu, 0));
|
||||
// enqueue the first fragment
|
||||
Ptr<WifiMacQueueItem> item = Create<WifiMacQueueItem> (fragment, mpdu->GetHeader (), mpdu->GetTimeStamp ());
|
||||
queueIt.queue->PushFront (item);
|
||||
m_mac->GetTxopQueue (ac)->PushFront (item);
|
||||
return item;
|
||||
}
|
||||
return mpdu;
|
||||
@@ -453,8 +453,7 @@ FrameExchangeManager::DequeueMpdu (Ptr<const WifiMacQueueItem> mpdu)
|
||||
|
||||
if (mpdu->IsQueued ())
|
||||
{
|
||||
const WifiMacQueueItem::QueueIteratorPair& queueIt = mpdu->GetQueueIteratorPair ();
|
||||
queueIt.queue->DequeueIfQueued (*queueIt.it);
|
||||
m_mac->GetTxopQueue (mpdu->GetQueueAc ())->DequeueIfQueued (mpdu);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1191,7 +1191,7 @@ HeFrameExchangeManager::ReceiveBasicTrigger (const CtrlTriggerHeader& trigger, c
|
||||
// otherwise, check if a suitable data frame is available
|
||||
if ((mpdu = edca->PeekNextMpdu (tid, hdr.GetAddr2 ())) != 0)
|
||||
{
|
||||
WifiMacQueueItem::QueueIteratorPair queueIt;
|
||||
WifiMacQueueItem::ConstIterator queueIt;
|
||||
Ptr<WifiMacQueueItem> item = edca->GetNextMpdu (mpdu, txParams, ppduDuration, false, queueIt);
|
||||
|
||||
if (item != 0)
|
||||
|
||||
@@ -728,10 +728,9 @@ RrMultiUserScheduler::ComputeDlMuInfo (void)
|
||||
NS_ASSERT (receiver == candidate.first->address);
|
||||
|
||||
NS_ASSERT (mpdu->IsQueued ());
|
||||
WifiMacQueueItem::QueueIteratorPair queueIt = mpdu->GetQueueIteratorPair ();
|
||||
NS_ASSERT (queueIt.queue != nullptr);
|
||||
Ptr<WifiMacQueueItem> item = *queueIt.it;
|
||||
queueIt.it++;
|
||||
WifiMacQueueItem::ConstIterator queueIt = mpdu->GetQueueIterator ();
|
||||
Ptr<WifiMacQueueItem> item = *queueIt;
|
||||
queueIt++;
|
||||
|
||||
if (!mpdu->GetHeader ().IsRetry ())
|
||||
{
|
||||
@@ -742,7 +741,7 @@ RrMultiUserScheduler::ComputeDlMuInfo (void)
|
||||
if (item == nullptr)
|
||||
{
|
||||
// A-MSDU aggregation failed or disabled
|
||||
item = *mpdu->GetQueueIteratorPair ().it;
|
||||
item = *mpdu->GetQueueIterator ();
|
||||
}
|
||||
m_apMac->GetQosTxop (QosUtilsMapTidToAc (tid))->AssignSequenceNumber (item);
|
||||
}
|
||||
|
||||
@@ -447,7 +447,7 @@ HtFrameExchangeManager::SendDataFrame (Ptr<const WifiMacQueueItem> peekedItem,
|
||||
Ptr<QosTxop> edca = m_mac->GetQosTxop (peekedItem->GetHeader ().GetQosTid ());
|
||||
WifiTxParameters txParams;
|
||||
txParams.m_txVector = m_mac->GetWifiRemoteStationManager ()->GetDataTxVector (peekedItem->GetHeader ());
|
||||
WifiMacQueueItem::QueueIteratorPair queueIt;
|
||||
WifiMacQueueItem::ConstIterator queueIt;
|
||||
Ptr<WifiMacQueueItem> mpdu = edca->GetNextMpdu (peekedItem, txParams, availableTime, initialFrame, queueIt);
|
||||
|
||||
if (mpdu == nullptr)
|
||||
|
||||
@@ -192,7 +192,7 @@ MpduAggregator::GetAmpduSubframeHeader (uint16_t mpduSize, bool isSingle)
|
||||
|
||||
std::vector<Ptr<WifiMacQueueItem>>
|
||||
MpduAggregator::GetNextAmpdu (Ptr<WifiMacQueueItem> mpdu, WifiTxParameters& txParams,
|
||||
Time availableTime, WifiMacQueueItem::QueueIteratorPair queueIt) const
|
||||
Time availableTime, WifiMacQueueItem::ConstIterator queueIt) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << *mpdu << &txParams << availableTime);
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
std::vector<Ptr<WifiMacQueueItem>> GetNextAmpdu (Ptr<WifiMacQueueItem> mpdu,
|
||||
WifiTxParameters& txParams,
|
||||
Time availableTime,
|
||||
WifiMacQueueItem::QueueIteratorPair queueIt) const;
|
||||
WifiMacQueueItem::ConstIterator queueIt) const;
|
||||
|
||||
/**
|
||||
* Set the MAC layer to use.
|
||||
|
||||
@@ -84,12 +84,12 @@ MsduAggregator::GetSizeIfAggregated (uint16_t msduSize, uint16_t amsduSize)
|
||||
|
||||
Ptr<WifiMacQueueItem>
|
||||
MsduAggregator::GetNextAmsdu (Ptr<const WifiMacQueueItem> peekedItem, WifiTxParameters& txParams,
|
||||
Time availableTime, WifiMacQueueItem::QueueIteratorPair& queueIt) const
|
||||
Time availableTime, WifiMacQueueItem::ConstIterator& queueIt) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << *peekedItem << &txParams << availableTime);
|
||||
|
||||
WifiMacQueue* queue = peekedItem->GetQueueIteratorPair ().queue;
|
||||
WifiMacQueue::ConstIterator it = peekedItem->GetQueueIteratorPair ().it;
|
||||
Ptr<WifiMacQueue> queue = m_mac->GetTxopQueue (peekedItem->GetQueueAc ());
|
||||
auto it = peekedItem->GetQueueIterator ();
|
||||
NS_ASSERT ((*it)->GetPacket () == peekedItem->GetPacket ());
|
||||
|
||||
uint8_t tid = peekedItem->GetHeader ().GetQosTid ();
|
||||
@@ -132,7 +132,7 @@ MsduAggregator::GetNextAmsdu (Ptr<const WifiMacQueueItem> peekedItem, WifiTxPara
|
||||
Ptr<WifiMacQueueItem> msdu = *it++;
|
||||
queue->DequeueIfQueued (msdu);
|
||||
|
||||
auto pos = std::next (amsdu->GetQueueIteratorPair ().it);
|
||||
auto pos = std::next (amsdu->GetQueueIterator ());
|
||||
queue->DequeueIfQueued (amsdu);
|
||||
|
||||
amsdu->Aggregate (msdu);
|
||||
@@ -151,7 +151,7 @@ MsduAggregator::GetNextAmsdu (Ptr<const WifiMacQueueItem> peekedItem, WifiTxPara
|
||||
}
|
||||
|
||||
// Aggregation succeeded
|
||||
queueIt = {queue, it};
|
||||
queueIt = it;
|
||||
|
||||
return amsdu;
|
||||
}
|
||||
|
||||
@@ -96,13 +96,13 @@ public:
|
||||
* \param peekedItem the MSDU which we attempt to aggregate other MSDUs to
|
||||
* \param txParams the TX parameters for the current frame
|
||||
* \param availableTime the time available for the frame exchange
|
||||
* \param[out] queueIt a QueueIteratorPair pointing to the queue item following the
|
||||
* \param[out] queueIt a queue iterator pointing to the queue item following the
|
||||
* last item used to prepare the returned A-MSDU, if any; otherwise,
|
||||
* its value is unchanged
|
||||
* \return the resulting A-MSDU, if aggregation is possible, a null pointer otherwise.
|
||||
*/
|
||||
Ptr<WifiMacQueueItem> GetNextAmsdu (Ptr<const WifiMacQueueItem> peekedItem, WifiTxParameters& txParams,
|
||||
Time availableTime, WifiMacQueueItem::QueueIteratorPair& queueIt) const;
|
||||
Time availableTime, WifiMacQueueItem::ConstIterator& queueIt) const;
|
||||
|
||||
/**
|
||||
* Determine the maximum size for an A-MSDU of the given TID that can be sent
|
||||
|
||||
@@ -277,7 +277,7 @@ QosFrameExchangeManager::StartFrameExchange (Ptr<QosTxop> edca, Time availableTi
|
||||
WifiTxParameters txParams;
|
||||
txParams.m_txVector = m_mac->GetWifiRemoteStationManager ()->GetDataTxVector (mpdu->GetHeader ());
|
||||
|
||||
WifiMacQueueItem::QueueIteratorPair queueIt;
|
||||
WifiMacQueueItem::ConstIterator queueIt;
|
||||
Ptr<WifiMacQueueItem> item = edca->GetNextMpdu (mpdu, txParams, availableTime, initialFrame, queueIt);
|
||||
|
||||
if (item == nullptr)
|
||||
|
||||
@@ -356,11 +356,11 @@ QosTxop::IsQosOldPacket (Ptr<const WifiMacQueueItem> mpdu)
|
||||
Ptr<const WifiMacQueueItem>
|
||||
QosTxop::PeekNextMpdu (uint8_t tid, Mac48Address recipient)
|
||||
{
|
||||
return PeekNextMpdu ({nullptr, WifiMacQueue::EMPTY}, tid, recipient);
|
||||
return PeekNextMpdu (WifiMacQueue::EMPTY, tid, recipient);
|
||||
}
|
||||
|
||||
Ptr<const WifiMacQueueItem>
|
||||
QosTxop::PeekNextMpdu (WifiMacQueueItem::QueueIteratorPair queueIt, uint8_t tid, Mac48Address recipient)
|
||||
QosTxop::PeekNextMpdu (WifiMacQueueItem::ConstIterator queueIt, uint8_t tid, Mac48Address recipient)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << +tid << recipient);
|
||||
|
||||
@@ -369,52 +369,46 @@ QosTxop::PeekNextMpdu (WifiMacQueueItem::QueueIteratorPair queueIt, uint8_t tid,
|
||||
{
|
||||
if (tid == 8 && recipient.IsBroadcast ()) // undefined TID and recipient
|
||||
{
|
||||
return queueIt.queue->PeekFirstAvailable (m_qosBlockedDestinations, queueIt.it);
|
||||
return m_queue->PeekFirstAvailable (m_qosBlockedDestinations, queueIt);
|
||||
}
|
||||
if (m_qosBlockedDestinations->IsBlocked (recipient, tid))
|
||||
{
|
||||
return queueIt.queue->end ();
|
||||
return m_queue->end ();
|
||||
}
|
||||
return queueIt.queue->PeekByTidAndAddress (tid, recipient, queueIt.it);
|
||||
return m_queue->PeekByTidAndAddress (tid, recipient, queueIt);
|
||||
};
|
||||
|
||||
if (queueIt.queue == nullptr && queueIt.it == WifiMacQueue::EMPTY)
|
||||
{
|
||||
// check if there is a packet in the EDCA queue
|
||||
queueIt.queue = PeekPointer (m_queue);
|
||||
}
|
||||
|
||||
queueIt.it = peek ();
|
||||
queueIt = peek ();
|
||||
// remove old packets (must be retransmissions or in flight, otherwise they did
|
||||
// not get a sequence number assigned)
|
||||
while (queueIt.it != m_queue->end () && !(*queueIt.it)->IsFragment ())
|
||||
while (queueIt != m_queue->end () && !(*queueIt)->IsFragment ())
|
||||
{
|
||||
if (((*queueIt.it)->GetHeader ().IsRetry () || (*queueIt.it)->IsInFlight ())
|
||||
&& IsQosOldPacket (*queueIt.it))
|
||||
if (((*queueIt)->GetHeader ().IsRetry () || (*queueIt)->IsInFlight ())
|
||||
&& IsQosOldPacket (*queueIt))
|
||||
{
|
||||
NS_LOG_DEBUG ("Removing an old packet from EDCA queue: " << **queueIt.it);
|
||||
NS_LOG_DEBUG ("Removing an old packet from EDCA queue: " << **queueIt);
|
||||
if (!m_droppedMpduCallback.IsNull ())
|
||||
{
|
||||
m_droppedMpduCallback (WIFI_MAC_DROP_QOS_OLD_PACKET, *queueIt.it);
|
||||
m_droppedMpduCallback (WIFI_MAC_DROP_QOS_OLD_PACKET, *queueIt);
|
||||
}
|
||||
queueIt.it = m_queue->Remove (queueIt.it);
|
||||
queueIt.it = peek ();
|
||||
queueIt = m_queue->Remove (queueIt);
|
||||
queueIt = peek ();
|
||||
}
|
||||
else if ((*queueIt.it)->IsInFlight ())
|
||||
else if ((*queueIt)->IsInFlight ())
|
||||
{
|
||||
NS_LOG_DEBUG ("Skipping in flight MPDU: " << **queueIt.it);
|
||||
++queueIt.it;
|
||||
queueIt.it = peek ();
|
||||
NS_LOG_DEBUG ("Skipping in flight MPDU: " << **queueIt);
|
||||
++queueIt;
|
||||
queueIt = peek ();
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (queueIt.it != m_queue->end ())
|
||||
if (queueIt != m_queue->end ())
|
||||
{
|
||||
NS_ASSERT (!(*queueIt.it)->IsInFlight ());
|
||||
WifiMacHeader& hdr = (*queueIt.it)->GetHeader ();
|
||||
NS_ASSERT (!(*queueIt)->IsInFlight ());
|
||||
WifiMacHeader& hdr = (*queueIt)->GetHeader ();
|
||||
|
||||
// peek the next sequence number and check if it is within the transmit window
|
||||
// in case of QoS data frame
|
||||
@@ -434,12 +428,12 @@ QosTxop::PeekNextMpdu (WifiMacQueueItem::QueueIteratorPair queueIt, uint8_t tid,
|
||||
}
|
||||
|
||||
// Assign a sequence number if this is not a fragment nor a retransmission
|
||||
if (!(*queueIt.it)->IsFragment () && !hdr.IsRetry ())
|
||||
if (!(*queueIt)->IsFragment () && !hdr.IsRetry ())
|
||||
{
|
||||
hdr.SetSequenceNumber (sequence);
|
||||
}
|
||||
NS_LOG_DEBUG ("Packet peeked from EDCA queue: " << **queueIt.it);
|
||||
return *queueIt.it;
|
||||
NS_LOG_DEBUG ("Packet peeked from EDCA queue: " << **queueIt);
|
||||
return *queueIt;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -447,7 +441,7 @@ QosTxop::PeekNextMpdu (WifiMacQueueItem::QueueIteratorPair queueIt, uint8_t tid,
|
||||
|
||||
Ptr<WifiMacQueueItem>
|
||||
QosTxop::GetNextMpdu (Ptr<const WifiMacQueueItem> peekedItem, WifiTxParameters& txParams,
|
||||
Time availableTime, bool initialFrame, WifiMacQueueItem::QueueIteratorPair& queueIt)
|
||||
Time availableTime, bool initialFrame, WifiMacQueueItem::ConstIterator& queueIt)
|
||||
{
|
||||
NS_ASSERT (peekedItem != 0);
|
||||
NS_ASSERT (m_qosFem != 0);
|
||||
@@ -467,9 +461,9 @@ QosTxop::GetNextMpdu (Ptr<const WifiMacQueueItem> peekedItem, WifiTxParameters&
|
||||
}
|
||||
|
||||
NS_ASSERT (peekedItem->IsQueued ());
|
||||
WifiMacQueueItem::QueueIteratorPair peekedIt = peekedItem->GetQueueIteratorPair ();
|
||||
NS_ASSERT ((*peekedIt.it)->GetPacket () == peekedItem->GetPacket ());
|
||||
NS_ASSERT (peekedIt.queue == PeekPointer (m_queue));
|
||||
WifiMacQueueItem::ConstIterator peekedIt = peekedItem->GetQueueIterator ();
|
||||
NS_ASSERT ((*peekedIt)->GetPacket () == peekedItem->GetPacket ());
|
||||
NS_ASSERT ((*peekedIt)->GetQueueAc () == m_ac);
|
||||
Ptr<WifiMacQueueItem> mpdu;
|
||||
|
||||
// If it is a non-broadcast QoS Data frame and it is not a retransmission nor a fragment,
|
||||
@@ -504,8 +498,8 @@ QosTxop::GetNextMpdu (Ptr<const WifiMacQueueItem> peekedItem, WifiTxParameters&
|
||||
|
||||
if (mpdu == 0)
|
||||
{
|
||||
mpdu = *peekedIt.it;
|
||||
peekedIt.it++;
|
||||
mpdu = *peekedIt;
|
||||
peekedIt++;
|
||||
}
|
||||
|
||||
// Assign a sequence number if this is not a fragment nor a retransmission
|
||||
|
||||
@@ -335,7 +335,7 @@ public:
|
||||
* \param recipient the receiver station address.
|
||||
* \returns the peeked frame.
|
||||
*/
|
||||
Ptr<const WifiMacQueueItem> PeekNextMpdu (WifiMacQueueItem::QueueIteratorPair queueIt,
|
||||
Ptr<const WifiMacQueueItem> PeekNextMpdu (WifiMacQueueItem::ConstIterator queueIt,
|
||||
uint8_t tid = 8,
|
||||
Mac48Address recipient = Mac48Address::GetBroadcast ());
|
||||
/**
|
||||
@@ -354,14 +354,14 @@ public:
|
||||
(including protection and acknowledgment); a value of
|
||||
* Time::Min() indicates no time constraint
|
||||
* \param initialFrame true if the frame is the initial PPDU of a TXOP
|
||||
* \param[out] queueIt a QueueIteratorPair pointing to the queue item following the
|
||||
* \param[out] queueIt a queue iterator pointing to the queue item following the
|
||||
* last item used to prepare the returned MPDU, if any; if no MPDU
|
||||
* is returned, its value is unchanged
|
||||
* \return the frame to transmit or a null pointer if no frame meets the time constraints
|
||||
*/
|
||||
Ptr<WifiMacQueueItem> GetNextMpdu (Ptr<const WifiMacQueueItem> peekedItem, WifiTxParameters& txParams,
|
||||
Time availableTime, bool initialFrame,
|
||||
WifiMacQueueItem::QueueIteratorPair& queueIt);
|
||||
WifiMacQueueItem::ConstIterator& queueIt);
|
||||
|
||||
/**
|
||||
* Assign a sequence number to the given MPDU, if it is not a fragment
|
||||
|
||||
@@ -41,13 +41,13 @@ WifiMacQueueItem::WifiMacQueueItem (Ptr<const Packet> p, const WifiMacHeader & h
|
||||
WifiMacQueueItem::WifiMacQueueItem (Ptr<const Packet> p, const WifiMacHeader & header, Time tstamp)
|
||||
: m_packet (p),
|
||||
m_header (header),
|
||||
m_tstamp (tstamp)
|
||||
m_tstamp (tstamp),
|
||||
m_queueAc (AC_UNDEF)
|
||||
{
|
||||
if (header.IsQosData () && header.IsQosAmsdu ())
|
||||
{
|
||||
m_msduList = MsduAggregator::Deaggregate (p->Copy ());
|
||||
}
|
||||
m_queueIt.queue = nullptr;
|
||||
m_inFlight = false;
|
||||
}
|
||||
|
||||
@@ -204,11 +204,18 @@ WifiMacQueueItem::DoAggregate (Ptr<const WifiMacQueueItem> msdu)
|
||||
bool
|
||||
WifiMacQueueItem::IsQueued (void) const
|
||||
{
|
||||
return m_queueIt.queue != nullptr;
|
||||
return m_queueAc != AC_UNDEF;
|
||||
}
|
||||
|
||||
const WifiMacQueueItem::QueueIteratorPair&
|
||||
WifiMacQueueItem::GetQueueIteratorPair (void) const
|
||||
AcIndex
|
||||
WifiMacQueueItem::GetQueueAc (void) const
|
||||
{
|
||||
NS_ASSERT (IsQueued ());
|
||||
return m_queueAc;
|
||||
}
|
||||
|
||||
WifiMacQueueItem::ConstIterator
|
||||
WifiMacQueueItem::GetQueueIterator (void) const
|
||||
{
|
||||
NS_ASSERT (IsQueued ());
|
||||
return m_queueIt;
|
||||
|
||||
@@ -27,13 +27,13 @@
|
||||
#include "ns3/nstime.h"
|
||||
#include "wifi-mac-header.h"
|
||||
#include "amsdu-subframe-header.h"
|
||||
#include "qos-utils.h"
|
||||
#include <list>
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class QosBlockedDestinations;
|
||||
class Packet;
|
||||
class WifiMacQueue;
|
||||
|
||||
/**
|
||||
* \ingroup wifi
|
||||
@@ -142,12 +142,6 @@ public:
|
||||
|
||||
/// Const iterator typedef
|
||||
typedef std::list<Ptr<WifiMacQueueItem>>::const_iterator ConstIterator;
|
||||
/// Information needed to remove an MSDU from the queue
|
||||
struct QueueIteratorPair
|
||||
{
|
||||
WifiMacQueue* queue; //!< pointer to the queue where the MSDU is enqueued
|
||||
ConstIterator it; //!< iterator pointing to the MSDU in the queue
|
||||
};
|
||||
|
||||
/**
|
||||
* Return true if this item is stored in some queue, false otherwise.
|
||||
@@ -155,16 +149,20 @@ public:
|
||||
* \return true if this item is stored in some queue, false otherwise
|
||||
*/
|
||||
bool IsQueued (void) const;
|
||||
|
||||
/**
|
||||
* Get a const reference to the QueueIteratorPair struct variable containing
|
||||
* a pointer to the queue where the MPDU is stored and an iterator pointing to
|
||||
* the position of the MPDU in the queue. This method should not be called if
|
||||
* the MPDU is not stored in a queue.
|
||||
* Get the AC of the queue this item is stored into. Abort if this item
|
||||
* is not stored in a queue.
|
||||
*
|
||||
* \return the AC of the queue this item is stored into
|
||||
*/
|
||||
AcIndex GetQueueAc (void) const;
|
||||
/**
|
||||
* Get a const iterator pointing to the position of the MPDU in the queue. This
|
||||
* method should not be called if the MPDU is not stored in a queue.
|
||||
*
|
||||
* \return an iterator pointing to the position of the MPDU in the queue
|
||||
*/
|
||||
const QueueIteratorPair& GetQueueIteratorPair (void) const;
|
||||
ConstIterator GetQueueIterator (void) const;
|
||||
|
||||
/**
|
||||
* \brief Get the MAC protocol data unit (MPDU) corresponding to this item
|
||||
@@ -204,13 +202,14 @@ private:
|
||||
*/
|
||||
void DoAggregate (Ptr<const WifiMacQueueItem> msdu);
|
||||
|
||||
friend class WifiMacQueue; // to set QueueIteratorPair information
|
||||
friend class WifiMacQueue; // to set queue AC and iterator information
|
||||
|
||||
Ptr<const Packet> m_packet; //!< The packet (MSDU or A-MSDU) contained in this queue item
|
||||
WifiMacHeader m_header; //!< Wifi MAC header associated with the packet
|
||||
Time m_tstamp; //!< timestamp when the packet arrived at the queue
|
||||
DeaggregatedMsdus m_msduList; //!< The list of aggregated MSDUs included in this MPDU
|
||||
QueueIteratorPair m_queueIt; //!< Queue iterator pointing to this MPDU, if queued
|
||||
ConstIterator m_queueIt; //!< Queue iterator pointing to this MPDU, if queued
|
||||
AcIndex m_queueAc; //!< AC associated with the queue this MPDU is stored into
|
||||
bool m_inFlight; //!< whether the MPDU is in flight
|
||||
};
|
||||
|
||||
|
||||
@@ -179,10 +179,10 @@ WifiMacQueue::DequeueIfQueued (Ptr<const WifiMacQueueItem> mpdu)
|
||||
|
||||
if (mpdu->IsQueued ())
|
||||
{
|
||||
NS_ASSERT (mpdu->m_queueIt.queue == this);
|
||||
NS_ASSERT (*mpdu->m_queueIt.it == mpdu);
|
||||
NS_ASSERT (mpdu->m_queueAc == m_ac);
|
||||
NS_ASSERT (*mpdu->m_queueIt == mpdu);
|
||||
|
||||
DoDequeue (mpdu->m_queueIt.it);
|
||||
DoDequeue (mpdu->m_queueIt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -516,7 +516,8 @@ WifiMacQueue::DoEnqueue (ConstIterator pos, Ptr<WifiMacQueueItem> item)
|
||||
m_nQueuedBytes[addressTidPair] += item->GetSize ();
|
||||
}
|
||||
// set item's information about its position in the queue
|
||||
item->m_queueIt = {this, ret};
|
||||
item->m_queueAc = m_ac;
|
||||
item->m_queueIt = ret;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -549,7 +550,7 @@ WifiMacQueue::DoDequeue (ConstIterator pos)
|
||||
if (item != 0)
|
||||
{
|
||||
NS_ASSERT (item->IsQueued ());
|
||||
item->m_queueIt.queue = nullptr;
|
||||
item->m_queueAc = AC_UNDEF;
|
||||
}
|
||||
|
||||
return item;
|
||||
@@ -574,7 +575,7 @@ WifiMacQueue::DoRemove (ConstIterator pos)
|
||||
if (item != 0)
|
||||
{
|
||||
NS_ASSERT (item->IsQueued ());
|
||||
item->m_queueIt.queue = nullptr;
|
||||
item->m_queueAc = AC_UNDEF;
|
||||
}
|
||||
|
||||
return item;
|
||||
|
||||
@@ -192,7 +192,7 @@ AmpduAggregationTest::DoRun (void)
|
||||
Ptr<const WifiMacQueueItem> peeked = m_mac->GetBEQueue ()->PeekNextMpdu ();
|
||||
WifiTxParameters txParams;
|
||||
txParams.m_txVector = m_mac->GetWifiRemoteStationManager ()->GetDataTxVector (peeked->GetHeader ());
|
||||
WifiMacQueueItem::QueueIteratorPair queueIt;
|
||||
WifiMacQueueItem::ConstIterator queueIt;
|
||||
Ptr<WifiMacQueueItem> item = m_mac->GetBEQueue ()->GetNextMpdu (peeked, txParams, Time::Min (),
|
||||
true, queueIt);
|
||||
|
||||
@@ -276,7 +276,7 @@ AmpduAggregationTest::DoRun (void)
|
||||
peeked = m_mac->GetBEQueue ()->PeekNextMpdu ();
|
||||
txParams.Clear ();
|
||||
txParams.m_txVector = m_mac->GetWifiRemoteStationManager ()->GetDataTxVector (peeked->GetHeader ());
|
||||
queueIt = {nullptr, WifiMacQueue::EMPTY}; // reset queueIt
|
||||
queueIt = WifiMacQueue::EMPTY; // reset queueIt
|
||||
item = m_mac->GetBEQueue ()->GetNextMpdu (peeked, txParams, Time::Min (), true, queueIt);
|
||||
|
||||
mpduList = mpduAggregator->GetNextAmpdu (item, txParams, Time::Min (), queueIt);
|
||||
@@ -288,7 +288,7 @@ AmpduAggregationTest::DoRun (void)
|
||||
peeked = m_mac->GetBEQueue ()->PeekNextMpdu ();
|
||||
txParams.Clear ();
|
||||
txParams.m_txVector = m_mac->GetWifiRemoteStationManager ()->GetDataTxVector (peeked->GetHeader ());
|
||||
queueIt = {nullptr, WifiMacQueue::EMPTY}; // reset queueIt
|
||||
queueIt = WifiMacQueue::EMPTY; // reset queueIt
|
||||
item = m_mac->GetBEQueue ()->GetNextMpdu (peeked, txParams, Time::Min (), true, queueIt);
|
||||
|
||||
mpduList = mpduAggregator->GetNextAmpdu (item, txParams, Time::Min (), queueIt);
|
||||
@@ -424,7 +424,7 @@ TwoLevelAggregationTest::DoRun (void)
|
||||
WifiTxParameters txParams;
|
||||
txParams.m_txVector = m_mac->GetWifiRemoteStationManager ()->GetDataTxVector (peeked->GetHeader ());
|
||||
htFem->TryAddMpdu (peeked, txParams, Time::Min ());
|
||||
WifiMacQueueItem::QueueIteratorPair queueIt;
|
||||
WifiMacQueueItem::ConstIterator queueIt;
|
||||
Ptr<WifiMacQueueItem> item = msduAggregator->GetNextAmsdu (peeked, txParams, Time::Min (), queueIt);
|
||||
|
||||
bool result = (item != 0);
|
||||
@@ -451,7 +451,7 @@ TwoLevelAggregationTest::DoRun (void)
|
||||
|
||||
NS_TEST_EXPECT_MSG_EQ ((item == 0), true, "A-MSDU aggregation did not fail");
|
||||
|
||||
htFem->DequeueMpdu (*peeked->GetQueueIteratorPair ().it);
|
||||
htFem->DequeueMpdu (*peeked->GetQueueIterator ());
|
||||
|
||||
NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetWifiMacQueue ()->GetNPackets (), 0, "queue should be empty");
|
||||
|
||||
@@ -502,7 +502,7 @@ TwoLevelAggregationTest::DoRun (void)
|
||||
|
||||
// Compute the first MPDU to be aggregated in an A-MPDU. It must contain an A-MSDU
|
||||
// aggregating two MSDUs
|
||||
queueIt = {nullptr, WifiMacQueue::EMPTY}; // reset queueIt
|
||||
queueIt = WifiMacQueue::EMPTY; // reset queueIt
|
||||
item = m_mac->GetVIQueue ()->GetNextMpdu (peeked, txParams, txopLimit, true, queueIt);
|
||||
|
||||
NS_TEST_EXPECT_MSG_EQ (std::distance (item->begin (), item->end ()), 2, "There must be 2 MSDUs in the A-MSDU");
|
||||
@@ -684,7 +684,7 @@ HeAggregationTest::DoRunSubTest (uint16_t bufferSize)
|
||||
Ptr<const WifiMacQueueItem> peeked = m_mac->GetBEQueue ()->PeekNextMpdu ();
|
||||
WifiTxParameters txParams;
|
||||
txParams.m_txVector = m_mac->GetWifiRemoteStationManager ()->GetDataTxVector (peeked->GetHeader ());
|
||||
WifiMacQueueItem::QueueIteratorPair queueIt;
|
||||
WifiMacQueueItem::ConstIterator queueIt;
|
||||
Ptr<WifiMacQueueItem> item = m_mac->GetBEQueue ()->GetNextMpdu (peeked, txParams, Time::Min (),
|
||||
true, queueIt);
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@ TestMultiUserScheduler::SelectTxFormat (void)
|
||||
return SU_TX;
|
||||
}
|
||||
|
||||
WifiMacQueueItem::QueueIteratorPair queueIt;
|
||||
WifiMacQueueItem::ConstIterator queueIt;
|
||||
Ptr<WifiMacQueueItem> mpdu = m_apMac->GetQosTxop (AC_BE)->GetNextMpdu (peeked, m_txParams,
|
||||
m_availableTime,
|
||||
m_initialFrame, queueIt);
|
||||
|
||||
Reference in New Issue
Block a user