diff --git a/src/wifi/model/fcfs-wifi-queue-scheduler.cc b/src/wifi/model/fcfs-wifi-queue-scheduler.cc index e48e5fac4..825c5b3e9 100644 --- a/src/wifi/model/fcfs-wifi-queue-scheduler.cc +++ b/src/wifi/model/fcfs-wifi-queue-scheduler.cc @@ -140,7 +140,7 @@ FcfsWifiQueueScheduler::DoNotifyEnqueue(AcIndex ac, Ptr mpdu) return; } - SetPriority(ac, queueId, {mpdu->GetExpiryTime(), std::get(queueId)}); + SetPriority(ac, queueId, {mpdu->GetTimestamp(), std::get(queueId)}); } void @@ -161,7 +161,7 @@ FcfsWifiQueueScheduler::DoNotifyDequeue(AcIndex ac, const std::listGetExpiryTime(), std::get(queueId)}); + {item->GetTimestamp(), std::get(queueId)}); } } } @@ -184,7 +184,7 @@ FcfsWifiQueueScheduler::DoNotifyRemove(AcIndex ac, const std::list { SetPriority(ac, queueId, - {item->GetExpiryTime(), std::get(queueId)}); + {item->GetTimestamp(), std::get(queueId)}); } } } diff --git a/src/wifi/model/wifi-mpdu.cc b/src/wifi/model/wifi-mpdu.cc index 37fbc38bf..efaaefa29 100644 --- a/src/wifi/model/wifi-mpdu.cc +++ b/src/wifi/model/wifi-mpdu.cc @@ -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 p, const WifiMacHeader& header) +WifiMpdu::WifiMpdu(Ptr p, const WifiMacHeader& header, Time stamp) : m_header(header) { auto& original = std::get(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(&m_instanceInfo)) + { + return original->m_timestamp; + } + const auto& origInstanceInfo = std::get>(m_instanceInfo)->m_instanceInfo; + return std::get(origInstanceInfo).m_timestamp; +} + const WifiMacHeader& WifiMpdu::GetHeader() const { diff --git a/src/wifi/model/wifi-mpdu.h b/src/wifi/model/wifi-mpdu.h index 7b388f7ce..da6025d8a 100644 --- a/src/wifi/model/wifi-mpdu.h +++ b/src/wifi/model/wifi-mpdu.h @@ -28,6 +28,7 @@ #include "wifi-mac-queue-elem.h" #include "ns3/packet.h" +#include "ns3/simulator.h" #include #include @@ -64,8 +65,9 @@ class WifiMpdu : public SimpleRefCount * \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 p, const WifiMacHeader& header); + WifiMpdu(Ptr p, const WifiMacHeader& header, Time stamp = Simulator::Now()); virtual ~WifiMpdu(); @@ -182,6 +184,10 @@ class WifiMpdu : public SimpleRefCount * \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 struct OriginalInfo { Ptr 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 m_queueIt; //!< Queue iterator pointing to this MPDU, if queued bool m_seqNoAssigned; //!< whether a sequence number has been assigned