when does packet remove after dequeue??

108 views
Skip to first unread message

phil Lin

unread,
Mar 10, 2020, 12:08:59 PM3/10/20
to ns-3-users
Dear all,

I want to ask when I using the wifi-net-device, when does packet remove after dequeue?
or which function trigger the remove packet in queue function after dequeue.

Because my queue is full but I don't know why the packet won't remove.
I want to know when the packet will be removed after wifi-net-device forward the packet to downstairs.

Can anyone give me some advices?  

Thanks,
Best regards.

Phil

Adil Alsuhaim

unread,
Mar 11, 2020, 8:42:23 AM3/11/20
to ns-3-users
When using WifiNetDevice, the queue has the following event that you can trace (i.e. run some code when they happen)

ns3::Queue<WifiMacQueueItem>

  • Enqueue: Enqueue a packet in the queue.
  • Dequeue: Dequeue a packet from the queue.
  • Drop: Drop a packet (for whatever reason).
  • DropBeforeEnqueue: Drop a packet before enqueue.
  • DropAfterDequeue: Drop a packet after dequeue.
For example, if you want to trace "DropAfterDequeue" then you connect to it as follows:

Config::Connect ("/NodeList/*/DeviceList/$ns3::WifiNetDevice/Mac/$ns3::RegularWifiMac/*/Queue/DropAfterDequeue" , MakeCallback(&DropAfterTrace));
and create a function DropAfterTrace
void DropAfterTrace (std::string context, Ptr<const WifiMacQueueItem> item)
{
    std
::cout << context << ": Timestamp: " << item->GetTimeStamp() std::endl;
}

You can create multiple functions for multiple events. I believe DropBeforeEnqueue is when you drop a packet because the queue is full. I am not sure when is DropAfterDequeue is called, maybe it's when the packet exceeds its maximum delay in the queue (it's called TTL, default is 500ms), so you may check the time stamp if you want to make sure the packet was dropped because of that.

Reply all
Reply to author
Forward
0 new messages