[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [ns] Mac & IFq communication query
--
Free Dmitry Sklyarov !
http://www.freesklyarov.org
> -----Original Message-----
> From: Andrew Tang [SMTP:atang@cse.unsw.EDU.AU]
> Sent: Monday, September 17, 2001 6:49 AM
> To: ns-users@ISI.EDU
> Subject: [ns] Mac & IFq communication query
>
>
>
> Hi,
>
> I'm having some trouble understanding how the IFq communicates with MAC,
> this line in particular
>
> ll.cc
> // let mac decide when to take a new packet from the queue.
> s.schedule(downtarget_, p, delay_);
>
This line means that after delay the Scheduler calls downtarget.handle(p). This means that Queue::recv(p) is called. This appends p to the Queue. Now we have to cases. If the queue is not blocked, the Queue calls itself downtarget->recv(p) where as p is now the first packet from the queue. Bye calling downtarget.recv() the queue changes into blocked state. In this state Queue::recv(p) doesn't yield a call to downtarget(of the queue).recv(), but it simply means that p will be added to the queue.
Mac received in the first case the first packet from the queue. After it has finished processing this packet, it will call handler->handle(); whereas handler is the handler from the recv() method, i.e. the queue. Queue::handle() calls Queue::resume(), which dequeues the next packet and sends it to the down target.
Fortunately this doesn't lead to a recursion (although I don't understand exactly why, probably due to the scheduler).
Bye
Alex