wifi: Reintroduce a timestamp for MPDUs
... and use it as the priority of the default FCFS queue scheduler
This commit is contained in:
@@ -140,7 +140,7 @@ FcfsWifiQueueScheduler::DoNotifyEnqueue(AcIndex ac, Ptr<WifiMpdu> mpdu)
|
||||
return;
|
||||
}
|
||||
|
||||
SetPriority(ac, queueId, {mpdu->GetExpiryTime(), std::get<WifiContainerQueueType>(queueId)});
|
||||
SetPriority(ac, queueId, {mpdu->GetTimestamp(), std::get<WifiContainerQueueType>(queueId)});
|
||||
}
|
||||
|
||||
void
|
||||
@@ -161,7 +161,7 @@ FcfsWifiQueueScheduler::DoNotifyDequeue(AcIndex ac, const std::list<Ptr<WifiMpdu
|
||||
{
|
||||
SetPriority(ac,
|
||||
queueId,
|
||||
{item->GetExpiryTime(), std::get<WifiContainerQueueType>(queueId)});
|
||||
{item->GetTimestamp(), std::get<WifiContainerQueueType>(queueId)});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -184,7 +184,7 @@ FcfsWifiQueueScheduler::DoNotifyRemove(AcIndex ac, const std::list<Ptr<WifiMpdu>
|
||||
{
|
||||
SetPriority(ac,
|
||||
queueId,
|
||||
{item->GetExpiryTime(), std::get<WifiContainerQueueType>(queueId)});
|
||||
{item->GetTimestamp(), std::get<WifiContainerQueueType>(queueId)});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,18 +28,18 @@
|
||||
|
||||
#include "ns3/log.h"
|
||||
#include "ns3/packet.h"
|
||||
#include "ns3/simulator.h"
|
||||
|
||||
namespace ns3
|
||||
{
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE("WifiMpdu");
|
||||
|
||||
WifiMpdu::WifiMpdu(Ptr<const Packet> p, const WifiMacHeader& header)
|
||||
WifiMpdu::WifiMpdu(Ptr<const Packet> p, const WifiMacHeader& header, Time stamp)
|
||||
: m_header(header)
|
||||
{
|
||||
auto& original = std::get<OriginalInfo>(m_instanceInfo);
|
||||
original.m_packet = p;
|
||||
original.m_timestamp = stamp;
|
||||
|
||||
if (header.IsQosData() && header.IsQosAmsdu())
|
||||
{
|
||||
@@ -115,6 +115,17 @@ WifiMpdu::GetPacket() const
|
||||
return GetOriginalInfo().m_packet;
|
||||
}
|
||||
|
||||
Time
|
||||
WifiMpdu::GetTimestamp() const
|
||||
{
|
||||
if (auto original = std::get_if<ORIGINAL>(&m_instanceInfo))
|
||||
{
|
||||
return original->m_timestamp;
|
||||
}
|
||||
const auto& origInstanceInfo = std::get<Ptr<WifiMpdu>>(m_instanceInfo)->m_instanceInfo;
|
||||
return std::get<OriginalInfo>(origInstanceInfo).m_timestamp;
|
||||
}
|
||||
|
||||
const WifiMacHeader&
|
||||
WifiMpdu::GetHeader() const
|
||||
{
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "wifi-mac-queue-elem.h"
|
||||
|
||||
#include "ns3/packet.h"
|
||||
#include "ns3/simulator.h"
|
||||
|
||||
#include <list>
|
||||
#include <optional>
|
||||
@@ -64,8 +65,9 @@ class WifiMpdu : public SimpleRefCount<WifiMpdu>
|
||||
* \brief Create a Wifi MAC queue item containing a packet and a Wifi MAC header.
|
||||
* \param p the const packet included in the created item.
|
||||
* \param header the Wifi MAC header included in the created item.
|
||||
* \param stamp the timestamp to associate with the MPDU
|
||||
*/
|
||||
WifiMpdu(Ptr<const Packet> p, const WifiMacHeader& header);
|
||||
WifiMpdu(Ptr<const Packet> p, const WifiMacHeader& header, Time stamp = Simulator::Now());
|
||||
|
||||
virtual ~WifiMpdu();
|
||||
|
||||
@@ -182,6 +184,10 @@ class WifiMpdu : public SimpleRefCount<WifiMpdu>
|
||||
* \return the AC of the queue this item is stored into
|
||||
*/
|
||||
AcIndex GetQueueAc() const;
|
||||
/**
|
||||
* \return the time this MPDU was constructed
|
||||
*/
|
||||
Time GetTimestamp() const;
|
||||
/**
|
||||
* \return the expiry time of this MPDU
|
||||
*/
|
||||
@@ -278,6 +284,7 @@ class WifiMpdu : public SimpleRefCount<WifiMpdu>
|
||||
struct OriginalInfo
|
||||
{
|
||||
Ptr<const Packet> m_packet; //!< MSDU or A-MSDU contained in this queue item
|
||||
Time m_timestamp; //!< construction time
|
||||
DeaggregatedMsdus m_msduList; //!< list of aggregated MSDUs included in this MPDU
|
||||
std::optional<Iterator> m_queueIt; //!< Queue iterator pointing to this MPDU, if queued
|
||||
bool m_seqNoAssigned; //!< whether a sequence number has been assigned
|
||||
|
||||
Reference in New Issue
Block a user