[Click] How do Click elements use Push and Pull?

Beyers Cronje bcronje at gmail.com
Thu Apr 21 18:54:33 EDT 2005


Hi Bita,

There is no requirement to implement both pull and push functions.
FastUDPSource implements pull as ToDevice pulls the packet from
FastUDPSource.

On a basic level, you can see packet flow as follows:
PollDevice/FromDevice receives a packet via either interrupt
(FromDevice) or a scheduled poll to the network device receive buffer
(PollDevice). PollDevice/FromDevice then calls it's next downstream
element's push function to pass the packet on via output(0).push().
Each element in turns processes the packet and passes it on to the
next downstream element via output(x).push(). This process repeats
until a packet is pushed into a Queue. A Queue has both push and pull
interfaces. Push is used as decribed above and stores the packet in n
memory buffer.

The pull process starts at ToDevice, which gets scheduled by Click's
scheduler. Once ToDevice is scheduled it starts the whole pull process
and calls it's upstream element's pull interface. Each upstream
element in turm calls it's upstream neighbour's pull interface all the
way up to the Queue element. Once Queue's pull interface is called it
pulls the previously stored packet from memory and return the packet
to the element that called Queue's pull interface.

Obviously you can create much more complex flows, but you get the basic idea.

Beyers



On 4/21/05, betamaz <betamaz at gmail.com> wrote:
> Hi,
> 
> In the FAQs it's mentioned that a new element should implement push
> and pull.  I'm trying to figure out how some of the existing elements
> use push and pull functions.  For example, in the udpgen.click
> configuration:
> 
> 1) fastudpsource.cc has pull defined. Since FastUDPSource goal is to
> create packets. Shouldn't it use push to send the new packets the next
> output?
> 
> 2) On the other hand, polldevice.cc makes sense that it is using push
> to send packets to the element ToHost.  It does this through
> skb_push(skb,...) and output(0).push.  What are these two functions? I
> couldn't pinpoint the file that called output.
> 
> I guess I dont' am confused how click defines pull and push, since
> comparing the processing type of FromDevice/ToDevice and
> FromHost/ToHost doesn't make sense. I thought push was implemented by
> the sender and pull by the receiver. I would appreciate any help.
> 
> Bita.
> 
> ----------------------------------
> 
> here is udpgen.click for reference:
> 
> elementclass UDPGen {
>   $device, $rate, $limit, $size,
>   $seth, $sip, $sport, $deth, $dip, $dport |
> 
>   source :: FastUDPSource($rate, $limit, $size, $seth, $sip, $sport,
>                                                 $deth, $dip, $dport);
>   pd :: PollDevice($device) -> ToHost;
>   source -> td :: ToDevice($device);
> }
> 
> // create a UDPGen
> 
> u :: UDPGen(eth0, 82000, 820000, 1500,
>             00:0C:41:1F:9C:8F, 128.111.40.189, 1234,
>             00:0C:41:1F:9C:70, 129.111.40.200, 1234);
> 
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>



More information about the click mailing list