[Click] Packet ordering

Eddie Kohler kohler at cs.ucla.edu
Tue Aug 31 11:25:54 EDT 2004


kevin_mitchell at agilent.com wrote:
> I have a simple question about packet order.  Suppose I have a simple element with one input and two outputs.  When a packet arrives at the input it is processed and sent out of output[0].  However, occasionally, as a result of this processing, an additional packet is constructed and sent to output[1], i.e. there is a call to output(1).push within the simple_action method.  Both outputs are connected to the same queue.  Are there any guarantees about the relative ordering of these packets in the queue, i.e. does the call to output(1).push result in this packet being queued before the output(0) packet?  Or does the "forwarding" of the packets to the next element(s) take place after the simple_action method has terminated?

Hi Kevin,

The call to output(1).push() is executed and completes before the 
simple_action() returns, so that packet -- the output(1).push() packet -- will 
always be enqueued before the returned packet.  Click push() and pull() 
functions don't "enqueue requests for later", they just go right ahead and move 
packets around.  You can get a more intuitive feeling for this by looking at the 
definition of Element::simple_action(), in lib/element.cc.

Eddie



More information about the click mailing list