wifi: Make WifiMacQueue::Insert private

Also, reduce the usage of WifiMacQueue::PushFront. The goal is to
only allow enqueuing packets at the end of the wifi MAC queue, in
view of the introduction of a wifi MAC queue scheduler.
This commit is contained in:
Stefano Avallone
2021-10-07 12:28:44 +02:00
parent dae6bbca5b
commit 3ad1dde7a1
2 changed files with 17 additions and 19 deletions

View File

@@ -327,15 +327,12 @@ FrameExchangeManager::GetFirstFragmentIfNeeded (Ptr<WifiMacQueueItem> mpdu)
{
NS_LOG_DEBUG ("Fragmenting the MSDU");
m_fragmentedPacket = mpdu->GetPacket ()->Copy ();
AcIndex ac = mpdu->GetQueueAc ();
// dequeue the MSDU
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 ());
m_mac->GetTxopQueue (ac)->PushFront (item);
item->GetHeader ().SetMoreFragments ();
m_mac->GetTxopQueue (mpdu->GetQueueAc ())->Replace (mpdu, item);
return item;
}
return mpdu;
@@ -1142,16 +1139,17 @@ FrameExchangeManager::ReceivedNormalAck (Ptr<WifiMacQueueItem> mpdu, const WifiT
// a frame containing all or part of an MSDU or MMPDU (sec. 10.3.3 of 802.11-2016)
m_dcf->ResetCw ();
// The MPDU has been acknowledged, we can now dequeue it if it is stored in a queue
DequeueMpdu (mpdu);
if (mpdu->GetHeader ().IsMoreFragments ())
{
// enqueue the next fragment
Ptr<WifiMacQueueItem> next = GetNextFragment ();
m_dcf->GetWifiMacQueue ()->PushFront (next);
// replace the current fragment with the next one
m_dcf->GetWifiMacQueue ()->Replace (mpdu, GetNextFragment ());
m_moreFragments = true;
}
else
{
// the MPDU has been acknowledged, we can now dequeue it if it is stored in a queue
DequeueMpdu (mpdu);
}
TransmissionSucceeded ();
}

View File

@@ -115,14 +115,6 @@ public:
* \return true if success, false if the packet has been dropped
*/
bool PushFront (Ptr<WifiMacQueueItem> item);
/**
* Enqueue the given Wifi MAC queue item before the given position.
*
* \param pos the position before which the item is to be inserted
* \param item the Wifi MAC queue item to be enqueued
* \return true if success, false if the packet has been dropped
*/
bool Insert (ConstIterator pos, Ptr<WifiMacQueueItem> item);
/**
* Dequeue the packet in the front of the queue.
*
@@ -342,6 +334,14 @@ private:
*/
inline bool TtlExceeded (ConstIterator &it, const Time& now);
/**
* Enqueue the given Wifi MAC queue item before the given position.
*
* \param pos the position before which the item is to be inserted
* \param item the Wifi MAC queue item to be enqueued
* \return true if success, false if the packet has been dropped
*/
bool Insert (ConstIterator pos, Ptr<WifiMacQueueItem> item);
/**
* Wrapper for the DoEnqueue method provided by the base class that additionally
* sets the iterator field of the item and updates internal statistics, if