wifi: Cleanup WifiMacQueue

This commit is contained in:
Sébastien Deronne
2018-04-01 11:10:39 +02:00
parent 94cad3c54a
commit 48119eba2a

View File

@@ -43,7 +43,7 @@ WifiMacQueue::GetTypeId (void)
.AddConstructor<WifiMacQueue> ()
.AddAttribute ("MaxDelay", "If a packet stays longer than this delay in the queue, it is dropped.",
TimeValue (MilliSeconds (500)),
MakeTimeAccessor (&WifiMacQueue::m_maxDelay),
MakeTimeAccessor (&WifiMacQueue::SetMaxDelay),
MakeTimeChecker ())
.AddAttribute ("DropPolicy", "Upon enqueue with full queue, drop oldest (DropOldest) or newest (DropNewest) packet",
EnumValue (DROP_NEWEST),
@@ -68,15 +68,12 @@ void
WifiMacQueue::SetMaxDelay (Time delay)
{
NS_LOG_FUNCTION (this << delay);
m_maxDelay = delay;
}
Time
WifiMacQueue::GetMaxDelay (void) const
{
NS_LOG_FUNCTION (this);
return m_maxDelay;
}
@@ -100,7 +97,6 @@ bool
WifiMacQueue::Enqueue (Ptr<WifiMacQueueItem> item)
{
NS_LOG_FUNCTION (this << item);
NS_ASSERT_MSG (GetMode () == QueueBase::QUEUE_MODE_PACKETS, "WifiMacQueues must be in packet mode");
// if the queue is full, remove the first stale packet (if any) encountered
@@ -127,7 +123,6 @@ bool
WifiMacQueue::PushFront (Ptr<WifiMacQueueItem> item)
{
NS_LOG_FUNCTION (this << item);
NS_ASSERT_MSG (GetMode () == QueueBase::QUEUE_MODE_PACKETS, "WifiMacQueues must be in packet mode");
// if the queue is full, remove the first stale packet (if any) encountered
@@ -154,7 +149,6 @@ Ptr<WifiMacQueueItem>
WifiMacQueue::Dequeue (void)
{
NS_LOG_FUNCTION (this);
for (auto it = Head (); it != Tail (); )
{
if (!TtlExceeded (it))
@@ -171,7 +165,6 @@ WifiMacQueue::DequeueByTidAndAddress (uint8_t tid,
WifiMacHeader::AddressType type, Mac48Address dest)
{
NS_LOG_FUNCTION (this << dest);
for (auto it = Head (); it != Tail (); )
{
if (!TtlExceeded (it))
@@ -193,7 +186,6 @@ Ptr<WifiMacQueueItem>
WifiMacQueue::DequeueFirstAvailable (const Ptr<QosBlockedDestinations> blockedPackets)
{
NS_LOG_FUNCTION (this);
for (auto it = Head (); it != Tail (); )
{
if (!TtlExceeded (it))
@@ -215,7 +207,6 @@ Ptr<const WifiMacQueueItem>
WifiMacQueue::Peek (void) const
{
NS_LOG_FUNCTION (this);
for (auto it = Head (); it != Tail (); it++)
{
// skip packets that stayed in the queue for too long. They will be
@@ -234,7 +225,6 @@ WifiMacQueue::PeekByTidAndAddress (uint8_t tid,
WifiMacHeader::AddressType type, Mac48Address dest)
{
NS_LOG_FUNCTION (this << dest);
for (auto it = Head (); it != Tail (); )
{
if (!TtlExceeded (it))
@@ -256,7 +246,6 @@ Ptr<const WifiMacQueueItem>
WifiMacQueue::PeekFirstAvailable (const Ptr<QosBlockedDestinations> blockedPackets)
{
NS_LOG_FUNCTION (this);
for (auto it = Head (); it != Tail (); )
{
if (!TtlExceeded (it))
@@ -294,7 +283,6 @@ bool
WifiMacQueue::Remove (Ptr<const Packet> packet)
{
NS_LOG_FUNCTION (this << packet);
for (auto it = Head (); it != Tail (); )
{
if (!TtlExceeded (it))
@@ -317,9 +305,7 @@ WifiMacQueue::GetNPacketsByTidAndAddress (uint8_t tid, WifiMacHeader::AddressTyp
Mac48Address dest)
{
NS_LOG_FUNCTION (this << dest);
uint32_t nPackets = 0;
for (auto it = Head (); it != Tail (); )
{
if (!TtlExceeded (it))
@@ -341,7 +327,6 @@ bool
WifiMacQueue::IsEmpty (void)
{
NS_LOG_FUNCTION (this);
for (auto it = Head (); it != Tail (); )
{
if (!TtlExceeded (it))
@@ -358,7 +343,6 @@ uint32_t
WifiMacQueue::GetNPackets (void)
{
NS_LOG_FUNCTION (this);
// remove packets that stayed in the queue for too long
for (auto it = Head (); it != Tail (); )
{
@@ -374,7 +358,6 @@ uint32_t
WifiMacQueue::GetNBytes (void)
{
NS_LOG_FUNCTION (this);
// remove packets that stayed in the queue for too long
for (auto it = Head (); it != Tail (); )
{