wifi: Pass a const WifiMpdu to QosTxop::PeekNextMpdu()
This commit is contained in:
committed by
Stefano Avallone
parent
1df846296e
commit
d2dbd6678f
@@ -363,24 +363,24 @@ QosTxop::IsQosOldPacket(Ptr<const WifiMpdu> mpdu)
|
||||
}
|
||||
|
||||
Ptr<WifiMpdu>
|
||||
QosTxop::PeekNextMpdu(uint8_t linkId, uint8_t tid, Mac48Address recipient, Ptr<WifiMpdu> item)
|
||||
QosTxop::PeekNextMpdu(uint8_t linkId, uint8_t tid, Mac48Address recipient, Ptr<const WifiMpdu> mpdu)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << +linkId << +tid << recipient << item);
|
||||
NS_LOG_FUNCTION(this << +linkId << +tid << recipient << mpdu);
|
||||
|
||||
// lambda to peek the next frame
|
||||
auto peek = [this, &linkId, &tid, &recipient, &item]() -> Ptr<WifiMpdu> {
|
||||
auto peek = [this, &linkId, &tid, &recipient, &mpdu]() -> Ptr<WifiMpdu> {
|
||||
if (tid == 8 && recipient.IsBroadcast()) // undefined TID and recipient
|
||||
{
|
||||
return m_queue->PeekFirstAvailable(linkId, m_qosBlockedDestinations, item);
|
||||
return m_queue->PeekFirstAvailable(linkId, m_qosBlockedDestinations, mpdu);
|
||||
}
|
||||
if (m_qosBlockedDestinations->IsBlocked(recipient, tid))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
return m_queue->PeekByTidAndAddress(tid, recipient, item);
|
||||
return m_queue->PeekByTidAndAddress(tid, recipient, mpdu);
|
||||
};
|
||||
|
||||
item = peek();
|
||||
auto item = peek();
|
||||
// remove old packets (must be retransmissions or in flight, otherwise they did
|
||||
// not get a sequence number assigned)
|
||||
while (item && !item->IsFragment())
|
||||
@@ -392,9 +392,9 @@ QosTxop::PeekNextMpdu(uint8_t linkId, uint8_t tid, Mac48Address recipient, Ptr<W
|
||||
{
|
||||
m_droppedMpduCallback(WIFI_MAC_DROP_QOS_OLD_PACKET, item);
|
||||
}
|
||||
auto oldItem = item;
|
||||
mpdu = item;
|
||||
item = peek();
|
||||
m_queue->Remove(oldItem);
|
||||
m_queue->Remove(mpdu);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -418,6 +418,7 @@ QosTxop::PeekNextMpdu(uint8_t linkId, uint8_t tid, Mac48Address recipient, Ptr<W
|
||||
}
|
||||
|
||||
NS_LOG_DEBUG("Skipping in flight MPDU: " << *item);
|
||||
mpdu = item;
|
||||
item = peek();
|
||||
continue;
|
||||
}
|
||||
@@ -426,6 +427,7 @@ QosTxop::PeekNextMpdu(uint8_t linkId, uint8_t tid, Mac48Address recipient, Ptr<W
|
||||
!m_mac->CanForwardPacketsTo(item->GetHeader().GetAddr1()))
|
||||
{
|
||||
NS_LOG_DEBUG("Skipping frame that cannot be forwarded: " << *item);
|
||||
mpdu = item;
|
||||
item = peek();
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -271,8 +271,8 @@ class QosTxop : public Txop
|
||||
/**
|
||||
* Peek the next frame to transmit on the given link to the given receiver and of the given TID
|
||||
* from the EDCA queue. If <i>tid</i> is equal to 8 (invalid value) and <i>recipient</i>
|
||||
* is the broadcast address, the first available frame is returned. If <i>item</i>
|
||||
* is not a null pointer, the search starts from the packet following <i>item</i>
|
||||
* is the broadcast address, the first available frame is returned. If <i>mpdu</i>
|
||||
* is not a null pointer, the search starts from the MPDU following <i>mpdu</i>
|
||||
* in the queue; otherwise, the search starts from the head of the queue.
|
||||
* Note that A-MSDU aggregation is never attempted. If the frame has never been
|
||||
* transmitted, it is assigned a sequence number peeked from MacTxMiddle.
|
||||
@@ -281,13 +281,13 @@ class QosTxop : public Txop
|
||||
* \param linkId the ID of the given link
|
||||
* \param tid traffic ID.
|
||||
* \param recipient the receiver station address.
|
||||
* \param item the item after which the search starts from
|
||||
* \param mpdu the MPDU after which the search starts from
|
||||
* \returns the peeked frame.
|
||||
*/
|
||||
Ptr<WifiMpdu> PeekNextMpdu(uint8_t linkId,
|
||||
uint8_t tid = 8,
|
||||
Mac48Address recipient = Mac48Address::GetBroadcast(),
|
||||
Ptr<WifiMpdu> item = nullptr);
|
||||
Ptr<const WifiMpdu> mpdu = nullptr);
|
||||
/**
|
||||
* Prepare the frame to transmit on the given link starting from the MPDU that has been
|
||||
* previously peeked by calling PeekNextMpdu. A frame is only returned if it meets the
|
||||
|
||||
Reference in New Issue
Block a user