03.08.2013 Views

Design and Implementation of TinyGALS: A Programming Model for ...

Design and Implementation of TinyGALS: A Programming Model for ...

Design and Implementation of TinyGALS: A Programming Model for ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>and</strong> a pull port is illegal. Every push output <strong>and</strong> every pull input must be connected exactly<br />

once. However, push inputs <strong>and</strong> pull outputs may be connected more than once. There are<br />

no implicit queues on input <strong>and</strong> output ports (or the associated per<strong>for</strong>mance <strong>and</strong> complexity<br />

costs). Queues in Click must be defined explicitly <strong>and</strong> appear as Queue elements. A Queue<br />

has a push input port (responds to pushed packets by enqueueing them) <strong>and</strong> a pull output<br />

port (responds to pull requests by dequeuing packets <strong>and</strong> returning them).<br />

Another type <strong>of</strong> element is the Click packet scheduler. This is an element with multiple<br />

pull inputs <strong>and</strong> one pull output. The element reacts to requests <strong>for</strong> packets by choosing<br />

one <strong>of</strong> its inputs, pulling a packet from it, <strong>and</strong> returning the packet. If the chosen input has<br />

no packets ready, the scheduler will usually try other inputs. Both Queues <strong>and</strong> scheduling<br />

elements have a single pull output, so to an element downstream, Queues <strong>and</strong> schedulers<br />

are indistinguishable. This leads to an ability to create virtual queues, which are compound<br />

elements that act like queues but implement more complex behavior than FIFO queuing.<br />

Click runtime system Click runs as a kernel thread inside the Linux 2.2 kernel. The<br />

kernel thread runs the Click router driver, which loops over the task queue <strong>and</strong> runs each<br />

task using stride scheduling [36]. A task is an element that would like special access to CPU<br />

time. An element should be on the task queue if it frequently initiates push or pull requests<br />

without receiving a corresponding request. Most elements are never placed on the task<br />

queue; they are implicitly scheduled when their push() or pull() methods are called.<br />

Since Click runs in a single thread, a call to push() or pull() must return to its caller<br />

be<strong>for</strong>e another task can begin. The router will continue to process each pushed packet,<br />

following it from element to element along a path in the router graph (a chain <strong>of</strong> push()<br />

calls, or a chain <strong>of</strong> pull() calls), until it is explicitly stored or dropped (<strong>and</strong> similarly<br />

<strong>for</strong> pull requests). Placement <strong>of</strong> Queues in the configuration graph determines how CPU<br />

scheduling may be per<strong>for</strong>med. For example, device-h<strong>and</strong>ling elements such as FromDevice<br />

<strong>and</strong> ToDevice place themselves on Click’s task queue. When activated, FromDevice polls<br />

the device’s receive DMA queue <strong>for</strong> newly arrived packets <strong>and</strong> pushes them through the<br />

configuration graph. ToDevice examines the device’s transmit DMA queue <strong>for</strong> empty slots<br />

48

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!