wifi: Convert BA retransmit queue to WifiMacQueue
Also, remove a few unused methods
This commit is contained in:
@@ -66,6 +66,7 @@ BlockAckManager::GetTypeId (void)
|
||||
BlockAckManager::BlockAckManager ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_retryPackets = CreateObject<WifiMacQueue> ();
|
||||
}
|
||||
|
||||
BlockAckManager::~BlockAckManager ()
|
||||
@@ -73,7 +74,7 @@ BlockAckManager::~BlockAckManager ()
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_queue = 0;
|
||||
m_agreements.clear ();
|
||||
m_retryPackets.clear ();
|
||||
m_retryPackets = 0;
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -154,11 +155,11 @@ BlockAckManager::DestroyAgreement (Mac48Address recipient, uint8_t tid)
|
||||
AgreementsI it = m_agreements.find (std::make_pair (recipient, tid));
|
||||
if (it != m_agreements.end ())
|
||||
{
|
||||
for (std::list<PacketQueueI>::const_iterator i = m_retryPackets.begin (); i != m_retryPackets.end (); )
|
||||
for (WifiMacQueue::ConstIterator i = m_retryPackets->begin (); i != m_retryPackets->end (); )
|
||||
{
|
||||
if ((*i)->GetHeader ().GetAddr1 () == recipient && (*i)->GetHeader ().GetQosTid () == tid)
|
||||
{
|
||||
i = m_retryPackets.erase (i);
|
||||
i = m_retryPackets->Remove (i);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -219,7 +220,7 @@ BlockAckManager::UpdateAgreement (const MgtAddBaResponseHeader *respHdr, Mac48Ad
|
||||
}
|
||||
|
||||
void
|
||||
BlockAckManager::StorePacket (Ptr<const WifiMacQueueItem> mpdu)
|
||||
BlockAckManager::StorePacket (Ptr<WifiMacQueueItem> mpdu)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << mpdu);
|
||||
NS_ASSERT (mpdu->GetHeader ().IsQosData ());
|
||||
@@ -232,9 +233,9 @@ BlockAckManager::StorePacket (Ptr<const WifiMacQueueItem> mpdu)
|
||||
PacketQueueI queueIt = it->second.second.begin ();
|
||||
for (; queueIt != it->second.second.end (); )
|
||||
{
|
||||
if (((mpdu->GetHeader ().GetSequenceNumber () - queueIt->GetHeader ().GetSequenceNumber () + 4096) % 4096) > 2047)
|
||||
if (((mpdu->GetHeader ().GetSequenceNumber () - (*queueIt)->GetHeader ().GetSequenceNumber () + 4096) % 4096) > 2047)
|
||||
{
|
||||
queueIt = it->second.second.insert (queueIt, *mpdu);
|
||||
queueIt = it->second.second.insert (queueIt, mpdu);
|
||||
break;
|
||||
}
|
||||
else
|
||||
@@ -244,7 +245,7 @@ BlockAckManager::StorePacket (Ptr<const WifiMacQueueItem> mpdu)
|
||||
}
|
||||
if (queueIt == it->second.second.end ())
|
||||
{
|
||||
it->second.second.push_back (*mpdu);
|
||||
it->second.second.push_back (mpdu);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,11 +257,11 @@ BlockAckManager::GetNextPacket (bool removePacket)
|
||||
uint8_t tid;
|
||||
Mac48Address recipient;
|
||||
CleanupBuffers ();
|
||||
if (!m_retryPackets.empty ())
|
||||
if (!m_retryPackets->IsEmpty ())
|
||||
{
|
||||
NS_LOG_DEBUG ("Retry buffer size is " << m_retryPackets.size ());
|
||||
std::list<PacketQueueI>::const_iterator it = m_retryPackets.begin ();
|
||||
while (it != m_retryPackets.end ())
|
||||
NS_LOG_DEBUG ("Retry buffer size is " << m_retryPackets->GetNPackets ());
|
||||
WifiMacQueue::ConstIterator it = m_retryPackets->begin ();
|
||||
while (it != m_retryPackets->end ())
|
||||
{
|
||||
if ((*it)->GetHeader ().IsQosData ())
|
||||
{
|
||||
@@ -281,8 +282,8 @@ BlockAckManager::GetNextPacket (bool removePacket)
|
||||
NS_LOG_DEBUG ("The Retry packet have sequence number < WinStartO --> Discard "
|
||||
<< (*it)->GetHeader ().GetSequenceNumber () << " "
|
||||
<< agreement->second.first.GetStartingSequence ());
|
||||
agreement->second.second.erase ((*it));
|
||||
it = m_retryPackets.erase (it);
|
||||
agreement->second.second.remove ((*it));
|
||||
it = m_retryPackets->Remove (it);
|
||||
continue;
|
||||
}
|
||||
else if (((((*it)->GetHeader ().GetSequenceNumber () - agreement->second.first.GetStartingSequence ()) + 4096) % 4096) > (agreement->second.first.GetBufferSize () - 1))
|
||||
@@ -290,7 +291,7 @@ BlockAckManager::GetNextPacket (bool removePacket)
|
||||
agreement->second.first.SetStartingSequence ((*it)->GetHeader ().GetSequenceNumber ());
|
||||
}
|
||||
}
|
||||
item = Create<WifiMacQueueItem> (**it);
|
||||
item = *it;
|
||||
item->GetHeader ().SetRetry ();
|
||||
if (item->GetHeader ().IsQosData ())
|
||||
{
|
||||
@@ -320,14 +321,14 @@ BlockAckManager::GetNextPacket (bool removePacket)
|
||||
if (removePacket)
|
||||
{
|
||||
AgreementsI i = m_agreements.find (std::make_pair (recipient, tid));
|
||||
i->second.second.erase (*it);
|
||||
i->second.second.remove (*it);
|
||||
}
|
||||
}
|
||||
if (removePacket)
|
||||
{
|
||||
NS_LOG_INFO ("Retry packet seq = " << item->GetHeader ().GetSequenceNumber ());
|
||||
it = m_retryPackets.erase (it);
|
||||
NS_LOG_DEBUG ("Removed one packet, retry buffer size = " << m_retryPackets.size ());
|
||||
it = m_retryPackets->Remove (it);
|
||||
NS_LOG_DEBUG ("Removed one packet, retry buffer size = " << m_retryPackets->GetNPackets ());
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -343,8 +344,8 @@ BlockAckManager::PeekNextPacketByTidAndAddress (uint8_t tid, Mac48Address recipi
|
||||
CleanupBuffers ();
|
||||
AgreementsI agreement = m_agreements.find (std::make_pair (recipient, tid));
|
||||
NS_ASSERT (agreement != m_agreements.end ());
|
||||
std::list<PacketQueueI>::const_iterator it = m_retryPackets.begin ();
|
||||
for (; it != m_retryPackets.end (); it++)
|
||||
WifiMacQueue::ConstIterator it = m_retryPackets->begin ();
|
||||
for (; it != m_retryPackets->end (); it++)
|
||||
{
|
||||
if (!(*it)->GetHeader ().IsQosData ())
|
||||
{
|
||||
@@ -358,8 +359,8 @@ BlockAckManager::PeekNextPacketByTidAndAddress (uint8_t tid, Mac48Address recipi
|
||||
NS_LOG_DEBUG ("The Retry packet have sequence number < WinStartO --> Discard "
|
||||
<< (*it)->GetHeader ().GetSequenceNumber () << " "
|
||||
<< agreement->second.first.GetStartingSequence ());
|
||||
agreement->second.second.erase ((*it));
|
||||
it = m_retryPackets.erase (it);
|
||||
agreement->second.second.remove ((*it));
|
||||
it = m_retryPackets->Remove (it);
|
||||
it--;
|
||||
continue;
|
||||
}
|
||||
@@ -388,7 +389,7 @@ BlockAckManager::PeekNextPacketByTidAndAddress (uint8_t tid, Mac48Address recipi
|
||||
*/
|
||||
hdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK);
|
||||
}
|
||||
NS_LOG_DEBUG ("Peeked one packet from retry buffer size = " << m_retryPackets.size () );
|
||||
NS_LOG_DEBUG ("Peeked one packet from retry buffer size = " << m_retryPackets->GetNPackets () );
|
||||
return item;
|
||||
}
|
||||
}
|
||||
@@ -399,8 +400,8 @@ bool
|
||||
BlockAckManager::RemovePacket (uint8_t tid, Mac48Address recipient, uint16_t seqnumber)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << seqnumber);
|
||||
std::list<PacketQueueI>::const_iterator it = m_retryPackets.begin ();
|
||||
for (; it != m_retryPackets.end (); it++)
|
||||
WifiMacQueue::ConstIterator it = m_retryPackets->begin ();
|
||||
for (; it != m_retryPackets->end (); it++)
|
||||
{
|
||||
if (!(*it)->GetHeader ().IsQosData ())
|
||||
{
|
||||
@@ -411,9 +412,9 @@ BlockAckManager::RemovePacket (uint8_t tid, Mac48Address recipient, uint16_t seq
|
||||
{
|
||||
WifiMacHeader hdr = (*it)->GetHeader ();
|
||||
AgreementsI i = m_agreements.find (std::make_pair (recipient, tid));
|
||||
i->second.second.erase ((*it));
|
||||
m_retryPackets.erase (it);
|
||||
NS_LOG_DEBUG ("Removed Packet from retry queue = " << hdr.GetSequenceNumber () << " " << +tid << " " << recipient << " Buffer Size = " << m_retryPackets.size ());
|
||||
i->second.second.remove ((*it));
|
||||
m_retryPackets->Remove (it);
|
||||
NS_LOG_DEBUG ("Removed Packet from retry queue = " << hdr.GetSequenceNumber () << " " << +tid << " " << recipient << " Buffer Size = " << m_retryPackets->GetNPackets ());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -440,7 +441,7 @@ bool
|
||||
BlockAckManager::HasPackets (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return (m_retryPackets.size () > 0 || m_bars.size () > 0);
|
||||
return (!m_retryPackets->IsEmpty () || m_bars.size () > 0);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
@@ -456,10 +457,10 @@ BlockAckManager::GetNBufferedPackets (Mac48Address recipient, uint8_t tid) const
|
||||
PacketQueueCI queueIt = (*it).second.second.begin ();
|
||||
while (queueIt != (*it).second.second.end ())
|
||||
{
|
||||
uint16_t currentSeq = (*queueIt).GetHeader ().GetSequenceNumber ();
|
||||
uint16_t currentSeq = (*queueIt)->GetHeader ().GetSequenceNumber ();
|
||||
nPackets++;
|
||||
/* a fragmented packet must be counted as one packet */
|
||||
while (queueIt != (*it).second.second.end () && (*queueIt).GetHeader ().GetSequenceNumber () == currentSeq)
|
||||
while (queueIt != (*it).second.second.end () && (*queueIt)->GetHeader ().GetSequenceNumber () == currentSeq)
|
||||
{
|
||||
queueIt++;
|
||||
}
|
||||
@@ -467,41 +468,6 @@ BlockAckManager::GetNBufferedPackets (Mac48Address recipient, uint8_t tid) const
|
||||
return nPackets;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
BlockAckManager::GetNRetryNeededPackets (Mac48Address recipient, uint8_t tid) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << recipient << +tid);
|
||||
uint32_t nPackets = 0;
|
||||
uint16_t currentSeq = 0;
|
||||
if (ExistsAgreement (recipient, tid))
|
||||
{
|
||||
std::list<PacketQueueI>::const_iterator it = m_retryPackets.begin ();
|
||||
while (it != m_retryPackets.end ())
|
||||
{
|
||||
if (!(*it)->GetHeader ().IsQosData ())
|
||||
{
|
||||
NS_FATAL_ERROR ("Packet in blockAck manager retry queue is not Qos Data");
|
||||
}
|
||||
if ((*it)->GetHeader ().GetAddr1 () == recipient && (*it)->GetHeader ().GetQosTid () == tid)
|
||||
{
|
||||
currentSeq = (*it)->GetHeader ().GetSequenceNumber ();
|
||||
nPackets++;
|
||||
/* a fragmented packet must be counted as one packet */
|
||||
while (it != m_retryPackets.end () && (*it)->GetHeader ().GetSequenceNumber () == currentSeq)
|
||||
{
|
||||
it++;
|
||||
}
|
||||
}
|
||||
//go to next packet
|
||||
else
|
||||
{
|
||||
it++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nPackets;
|
||||
}
|
||||
|
||||
void
|
||||
BlockAckManager::SetBlockAckThreshold (uint8_t nPackets)
|
||||
{
|
||||
@@ -519,8 +485,8 @@ BlockAckManager::SetWifiRemoteStationManager (const Ptr<WifiRemoteStationManager
|
||||
bool
|
||||
BlockAckManager::AlreadyExists (uint16_t currentSeq, Mac48Address recipient, uint8_t tid) const
|
||||
{
|
||||
std::list<PacketQueueI>::const_iterator it = m_retryPackets.begin ();
|
||||
while (it != m_retryPackets.end ())
|
||||
WifiMacQueue::ConstIterator it = m_retryPackets->begin ();
|
||||
while (it != m_retryPackets->end ())
|
||||
{
|
||||
if (!(*it)->GetHeader ().IsQosData ())
|
||||
{
|
||||
@@ -568,11 +534,11 @@ BlockAckManager::NotifyGotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac4
|
||||
{
|
||||
for (PacketQueueI queueIt = it->second.second.begin (); queueIt != queueEnd; )
|
||||
{
|
||||
if (blockAck->IsFragmentReceived ((*queueIt).GetHeader ().GetSequenceNumber (),
|
||||
(*queueIt).GetHeader ().GetFragmentNumber ()))
|
||||
if (blockAck->IsFragmentReceived ((*queueIt)->GetHeader ().GetSequenceNumber (),
|
||||
(*queueIt)->GetHeader ().GetFragmentNumber ()))
|
||||
{
|
||||
nSuccessfulMpdus++;
|
||||
RemoveFromRetryQueue (recipient, tid, (*queueIt).GetHeader ().GetSequenceNumber ());
|
||||
RemoveFromRetryQueue (recipient, tid, (*queueIt)->GetHeader ().GetSequenceNumber ());
|
||||
queueIt = it->second.second.erase (queueIt);
|
||||
}
|
||||
else
|
||||
@@ -580,13 +546,13 @@ BlockAckManager::NotifyGotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac4
|
||||
if (!foundFirstLost)
|
||||
{
|
||||
foundFirstLost = true;
|
||||
sequenceFirstLost = (*queueIt).GetHeader ().GetSequenceNumber ();
|
||||
sequenceFirstLost = (*queueIt)->GetHeader ().GetSequenceNumber ();
|
||||
(*it).second.first.SetStartingSequence (sequenceFirstLost);
|
||||
}
|
||||
nFailedMpdus++;
|
||||
if (!AlreadyExists ((*queueIt).GetHeader ().GetSequenceNumber (), recipient, tid))
|
||||
if (!AlreadyExists ((*queueIt)->GetHeader ().GetSequenceNumber (), recipient, tid))
|
||||
{
|
||||
InsertInRetryQueue (queueIt);
|
||||
InsertInRetryQueue (*queueIt);
|
||||
}
|
||||
queueIt++;
|
||||
}
|
||||
@@ -596,16 +562,16 @@ BlockAckManager::NotifyGotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac4
|
||||
{
|
||||
for (PacketQueueI queueIt = it->second.second.begin (); queueIt != queueEnd; )
|
||||
{
|
||||
uint16_t currentSeq = (*queueIt).GetHeader ().GetSequenceNumber ();
|
||||
uint16_t currentSeq = (*queueIt)->GetHeader ().GetSequenceNumber ();
|
||||
if (blockAck->IsPacketReceived (currentSeq))
|
||||
{
|
||||
while (queueIt != queueEnd
|
||||
&& (*queueIt).GetHeader ().GetSequenceNumber () == currentSeq)
|
||||
&& (*queueIt)->GetHeader ().GetSequenceNumber () == currentSeq)
|
||||
{
|
||||
nSuccessfulMpdus++;
|
||||
if (!m_txOkCallback.IsNull ())
|
||||
{
|
||||
m_txOkCallback ((*queueIt).GetHeader ());
|
||||
m_txOkCallback ((*queueIt)->GetHeader ());
|
||||
}
|
||||
RemoveFromRetryQueue (recipient, tid, currentSeq);
|
||||
queueIt = it->second.second.erase (queueIt);
|
||||
@@ -616,17 +582,17 @@ BlockAckManager::NotifyGotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac4
|
||||
if (!foundFirstLost)
|
||||
{
|
||||
foundFirstLost = true;
|
||||
sequenceFirstLost = (*queueIt).GetHeader ().GetSequenceNumber ();
|
||||
sequenceFirstLost = (*queueIt)->GetHeader ().GetSequenceNumber ();
|
||||
(*it).second.first.SetStartingSequence (sequenceFirstLost);
|
||||
}
|
||||
nFailedMpdus++;
|
||||
if (!m_txFailedCallback.IsNull ())
|
||||
{
|
||||
m_txFailedCallback ((*queueIt).GetHeader ());
|
||||
m_txFailedCallback ((*queueIt)->GetHeader ());
|
||||
}
|
||||
if (!AlreadyExists ((*queueIt).GetHeader ().GetSequenceNumber (), recipient, tid))
|
||||
if (!AlreadyExists ((*queueIt)->GetHeader ().GetSequenceNumber (), recipient, tid))
|
||||
{
|
||||
InsertInRetryQueue (queueIt);
|
||||
InsertInRetryQueue (*queueIt);
|
||||
}
|
||||
queueIt++;
|
||||
}
|
||||
@@ -649,14 +615,13 @@ BlockAckManager::NotifyMissedBlockAck (Mac48Address recipient, uint8_t tid)
|
||||
if (ExistsAgreementInState (recipient, tid, OriginatorBlockAckAgreement::ESTABLISHED))
|
||||
{
|
||||
AgreementsI it = m_agreements.find (std::make_pair (recipient, tid));
|
||||
PacketQueueI queueEnd = it->second.second.end ();
|
||||
for (PacketQueueI queueIt = it->second.second.begin (); queueIt != queueEnd; ++queueIt)
|
||||
for (auto& item : it->second.second)
|
||||
{
|
||||
//Queue previously transmitted packets that do not already exist in the retry queue.
|
||||
//The first packet is not placed in the retry queue since it should be retransmitted by the invoker.
|
||||
if (!AlreadyExists ((*queueIt).GetHeader ().GetSequenceNumber (), recipient, tid))
|
||||
if (!AlreadyExists (item->GetHeader ().GetSequenceNumber (), recipient, tid))
|
||||
{
|
||||
InsertInRetryQueue (queueIt);
|
||||
InsertInRetryQueue (item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -828,14 +793,14 @@ BlockAckManager::RemoveFromRetryQueue (Mac48Address address, uint8_t tid, uint16
|
||||
{
|
||||
NS_LOG_FUNCTION (this << address << +tid << seq);
|
||||
/* remove retry packet iterator if it's present in retry queue */
|
||||
std::list<PacketQueueI>::const_iterator it = m_retryPackets.begin ();
|
||||
while (it != m_retryPackets.end ())
|
||||
WifiMacQueue::ConstIterator it = m_retryPackets->begin ();
|
||||
while (it != m_retryPackets->end ())
|
||||
{
|
||||
if ((*it)->GetHeader ().GetAddr1 () == address
|
||||
&& (*it)->GetHeader ().GetQosTid () == tid
|
||||
&& (*it)->GetHeader ().GetSequenceNumber () == seq)
|
||||
{
|
||||
it = m_retryPackets.erase (it);
|
||||
it = m_retryPackets->Remove (it);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -858,7 +823,7 @@ BlockAckManager::CleanupBuffers (void)
|
||||
Time now = Simulator::Now ();
|
||||
for (PacketQueueI i = j->second.second.begin (); i != j->second.second.end (); )
|
||||
{
|
||||
if (i->GetTimeStamp () + m_maxDelay > now)
|
||||
if ((*i)->GetTimeStamp () + m_maxDelay > now)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -866,8 +831,8 @@ BlockAckManager::CleanupBuffers (void)
|
||||
{
|
||||
RemoveFromRetryQueue (j->second.first.GetPeer (),
|
||||
j->second.first.GetTid (),
|
||||
i->GetHeader ().GetSequenceNumber ());
|
||||
j->second.first.SetStartingSequence ((i->GetHeader ().GetSequenceNumber () + 1) % 4096);
|
||||
(*i)->GetHeader ().GetSequenceNumber ());
|
||||
j->second.first.SetStartingSequence (((*i)->GetHeader ().GetSequenceNumber () + 1) % 4096);
|
||||
i = j->second.second.erase (i);
|
||||
removed = true;
|
||||
continue;
|
||||
@@ -918,26 +883,6 @@ BlockAckManager::SetTxMiddle (const Ptr<MacTxMiddle> txMiddle)
|
||||
m_txMiddle = txMiddle;
|
||||
}
|
||||
|
||||
uint16_t
|
||||
BlockAckManager::GetSeqNumOfNextRetryPacket (Mac48Address recipient, uint8_t tid) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << recipient << +tid);
|
||||
std::list<PacketQueueI>::const_iterator it = m_retryPackets.begin ();
|
||||
while (it != m_retryPackets.end ())
|
||||
{
|
||||
if (!(*it)->GetHeader ().IsQosData ())
|
||||
{
|
||||
NS_FATAL_ERROR ("Packet in blockAck manager retry queue is not Qos Data");
|
||||
}
|
||||
if ((*it)->GetHeader ().GetAddr1 () == recipient && (*it)->GetHeader ().GetQosTid () == tid)
|
||||
{
|
||||
return (*it)->GetHeader ().GetSequenceNumber ();
|
||||
}
|
||||
it++;
|
||||
}
|
||||
return 4096;
|
||||
}
|
||||
|
||||
void
|
||||
BlockAckManager::SetTxOkCallback (TxOk callback)
|
||||
{
|
||||
@@ -951,28 +896,28 @@ BlockAckManager::SetTxFailedCallback (TxFailed callback)
|
||||
}
|
||||
|
||||
void
|
||||
BlockAckManager::InsertInRetryQueue (PacketQueueI item)
|
||||
BlockAckManager::InsertInRetryQueue (Ptr<WifiMacQueueItem> item)
|
||||
{
|
||||
NS_LOG_INFO ("Adding to retry queue " << (*item).GetHeader ().GetSequenceNumber ());
|
||||
if (m_retryPackets.size () == 0)
|
||||
NS_LOG_INFO ("Adding to retry queue " << *item);
|
||||
if (m_retryPackets->GetNPackets () == 0)
|
||||
{
|
||||
m_retryPackets.push_back (item);
|
||||
m_retryPackets->Enqueue (item);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (std::list<PacketQueueI>::const_iterator it = m_retryPackets.begin (); it != m_retryPackets.end (); )
|
||||
for (WifiMacQueue::ConstIterator it = m_retryPackets->begin (); it != m_retryPackets->end (); )
|
||||
{
|
||||
if (((item->GetHeader ().GetSequenceNumber () - (*it)->GetHeader ().GetSequenceNumber () + 4096) % 4096) > 2047)
|
||||
{
|
||||
it = m_retryPackets.insert (it, item);
|
||||
m_retryPackets->Insert (it, item);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
it++;
|
||||
if (it == m_retryPackets.end ())
|
||||
if (it == m_retryPackets->end ())
|
||||
{
|
||||
m_retryPackets.push_back (item);
|
||||
m_retryPackets->Enqueue (item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ public:
|
||||
* Stores <i>mpdu</i> for a possible future retransmission. Retransmission occurs
|
||||
* if the packet, in a block ack frame, is indicated by recipient as not received.
|
||||
*/
|
||||
void StorePacket (Ptr<const WifiMacQueueItem> mpdu);
|
||||
void StorePacket (Ptr<WifiMacQueueItem> mpdu);
|
||||
/**
|
||||
* \param removePacket flag to indicate whether the packet should be removed from the queue.
|
||||
*
|
||||
@@ -211,16 +211,6 @@ public:
|
||||
* number of buffered MPDUs but number of buffered MSDUs.
|
||||
*/
|
||||
uint32_t GetNBufferedPackets (Mac48Address recipient, uint8_t tid) const;
|
||||
/**
|
||||
* \param recipient Address of peer station involved in block ack mechanism.
|
||||
* \param tid Traffic ID.
|
||||
*
|
||||
* \return the number of packets for a specific agreement that need retransmission
|
||||
*
|
||||
* Returns number of packets for a specific agreement that need retransmission.
|
||||
* This method doesn't return number of MPDUs that need retransmission but number of MSDUs.
|
||||
*/
|
||||
uint32_t GetNRetryNeededPackets (Mac48Address recipient, uint8_t tid) const;
|
||||
/**
|
||||
* \param recipient Address of peer station involved in block ack mechanism.
|
||||
* \param tid Traffic ID of transmitted packet.
|
||||
@@ -328,17 +318,6 @@ public:
|
||||
* the value of BufferSize in the corresponding OriginatorBlockAckAgreement object.
|
||||
*/
|
||||
bool SwitchToBlockAckIfNeeded (Mac48Address recipient, uint8_t tid, uint16_t startingSeq);
|
||||
/**
|
||||
* \param recipient the destination address
|
||||
* \param tid the Traffic ID
|
||||
*
|
||||
* \return the sequence number of the next retry packet for a specific agreement
|
||||
*
|
||||
* Returns the sequence number of the next retry packet for a specific agreement.
|
||||
* If there are no packets that need retransmission for the specified agreement or
|
||||
* the agreement doesn't exist the function returns 4096;
|
||||
*/
|
||||
uint16_t GetSeqNumOfNextRetryPacket (Mac48Address recipient, uint8_t tid) const;
|
||||
/**
|
||||
* Checks if the packet already exists in the retransmit queue or not if it does then it doesn't add it again
|
||||
*
|
||||
@@ -458,15 +437,15 @@ private:
|
||||
/**
|
||||
* typedef for a list of WifiMacQueueItem.
|
||||
*/
|
||||
typedef std::list<WifiMacQueueItem> PacketQueue;
|
||||
typedef std::list<Ptr<WifiMacQueueItem>> PacketQueue;
|
||||
/**
|
||||
* typedef for an iterator for PacketQueue.
|
||||
*/
|
||||
typedef std::list<WifiMacQueueItem>::iterator PacketQueueI;
|
||||
typedef std::list<Ptr<WifiMacQueueItem>>::iterator PacketQueueI;
|
||||
/**
|
||||
* typedef for a const iterator for PacketQueue.
|
||||
*/
|
||||
typedef std::list<WifiMacQueueItem>::const_iterator PacketQueueCI;
|
||||
typedef std::list<Ptr<WifiMacQueueItem>>::const_iterator PacketQueueCI;
|
||||
/**
|
||||
* typedef for a map between MAC address and block ACK agreement.
|
||||
*/
|
||||
@@ -484,12 +463,12 @@ private:
|
||||
std::pair<OriginatorBlockAckAgreement, PacketQueue> >::const_iterator AgreementsCI;
|
||||
|
||||
/**
|
||||
* \param item
|
||||
* \param item the packet to insert in the retransmission queue
|
||||
*
|
||||
* Insert item in retransmission queue.
|
||||
* This method ensures packets are retransmitted in the correct order.
|
||||
*/
|
||||
void InsertInRetryQueue (PacketQueueI item);
|
||||
void InsertInRetryQueue (Ptr<WifiMacQueueItem> item);
|
||||
|
||||
/**
|
||||
* Remove items from retransmission queue.
|
||||
@@ -514,7 +493,7 @@ private:
|
||||
* A packet needs retransmission if it's indicated as not correctly received in a block ack
|
||||
* frame.
|
||||
*/
|
||||
std::list<PacketQueueI> m_retryPackets;
|
||||
Ptr<WifiMacQueue> m_retryPackets;
|
||||
std::list<Bar> m_bars; ///< list of BARs
|
||||
|
||||
uint8_t m_blockAckThreshold; ///< block ack threshold
|
||||
|
||||
@@ -179,12 +179,6 @@ QosTxop::PeekNextRetransmitPacket (uint8_t tid, Mac48Address recipient)
|
||||
return m_baManager->PeekNextPacketByTidAndAddress (tid, recipient);
|
||||
}
|
||||
|
||||
void
|
||||
QosTxop::RemoveRetransmitPacket (uint8_t tid, Mac48Address recipient, uint16_t seqnumber)
|
||||
{
|
||||
m_baManager->RemovePacket (tid, recipient, seqnumber);
|
||||
}
|
||||
|
||||
Ptr<const WifiMacQueueItem>
|
||||
QosTxop::PeekNextFrame (void)
|
||||
{
|
||||
@@ -1680,8 +1674,8 @@ QosTxop::CompleteTx (void)
|
||||
{
|
||||
if (!m_currentHdr.IsRetry ())
|
||||
{
|
||||
m_baManager->StorePacket (Create<const WifiMacQueueItem> (m_currentPacket, m_currentHdr,
|
||||
m_currentPacketTimestamp));
|
||||
m_baManager->StorePacket (Create<WifiMacQueueItem> (m_currentPacket, m_currentHdr,
|
||||
m_currentPacketTimestamp));
|
||||
}
|
||||
m_baManager->NotifyMpduTransmission (m_currentHdr.GetAddr1 (), m_currentHdr.GetQosTid (),
|
||||
m_txMiddle->GetNextSeqNumberByTidAndAddress (m_currentHdr.GetQosTid (),
|
||||
@@ -1690,7 +1684,7 @@ QosTxop::CompleteTx (void)
|
||||
}
|
||||
|
||||
void
|
||||
QosTxop::CompleteMpduTx (Ptr<const WifiMacQueueItem> mpdu)
|
||||
QosTxop::CompleteMpduTx (Ptr<WifiMacQueueItem> mpdu)
|
||||
{
|
||||
NS_ASSERT (mpdu->GetHeader ().IsQosData ());
|
||||
m_baManager->StorePacket (mpdu);
|
||||
|
||||
@@ -322,7 +322,7 @@ public:
|
||||
*
|
||||
* \param mpdu received MPDU.
|
||||
*/
|
||||
void CompleteMpduTx (Ptr<const WifiMacQueueItem> mpdu);
|
||||
void CompleteMpduTx (Ptr<WifiMacQueueItem> mpdu);
|
||||
/**
|
||||
* Return whether A-MPDU is used to transmit data to a peer station.
|
||||
*
|
||||
@@ -379,14 +379,6 @@ public:
|
||||
* \return the next sequence number.
|
||||
*/
|
||||
uint16_t PeekNextSequenceNumberFor (const WifiMacHeader *hdr);
|
||||
/**
|
||||
* Remove a packet after you peek in the retransmit queue and get it.
|
||||
*
|
||||
* \param tid traffic ID of the packet to be removed.
|
||||
* \param recipient address of the recipient the packet was intended for.
|
||||
* \param seqnumber sequence number of the packet to be removed.
|
||||
*/
|
||||
void RemoveRetransmitPacket (uint8_t tid, Mac48Address recipient, uint16_t seqnumber);
|
||||
/**
|
||||
* Peek in retransmit queue and get the next packet without removing it from the queue.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user