Bug 2303 - WifiMacQueue::GetSize should cleanup queue beforehand
WifiMacQueue::GetSize should cleanup queue beforehand
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: wifi
pre-release
All All
: P5 major
Assigned To: sebastien.deronne
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-02-20 04:51 UTC by Alexander Krotov
Modified: 2016-02-22 18:33 UTC (History)
1 user (show)

See Also:


Attachments
wifi-mac-queue.cc patch (581 bytes, patch)
2016-02-20 04:51 UTC, Alexander Krotov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Krotov 2016-02-20 04:51:49 UTC
Created attachment 2286 [details]
wifi-mac-queue.cc patch

All other functions, including WifiMacQueue::IsEmpty, call Cleanup () to emulate removal of all timed out packets. GetSize() lacks Cleanup () call.

In rare cases it results in GetSize returning value > 0, for example at line

http://code.nsnam.org/ns-3-dev/file/5de21182cbb5/src/wifi/model/mac-low.cc#l1641

Then WifiMacQueue::Dequeue is called, which calls Cleanup (), and returns NULL because all packets have timed out:

http://code.nsnam.org/ns-3-dev/file/5de21182cbb5/src/wifi/model/mac-low.cc#l1665

I don't have testcase yet, but it is fairly obvious that GetSize should not count timed out packets. Patch is attached.

The script in which I get this error is still too large to be used as a testcase. If I manage to reduce it to something simple, I will probably post it as another bug, because in my case packets stored in m_aggregateQueue sometimes timeout during RTS-CTS exchange. What should happen if during RTS-CTS all packets in m_aggregate timeout and there is no A-MPDU to send by the time CTS is received? Probably simple vector should be used for m_aggregateQueue so packets prepared for A-MPDU should never timeout or something like this.
Comment 1 sebastien.deronne 2016-02-20 08:11:57 UTC
It looks indeed better to call cleanup before returning the size.
Comment 2 sebastien.deronne 2016-02-22 18:33:26 UTC
changeset 11899:19ad6005e0dc