Deque: Formatting nits.
Add cache line macros.
RouterThread internals: Rearrange contents.

The purpose is to improve cache behavior. Items that (we think) are
modified frequently by the thread itself, are on the first line; items that
are occasionally modified from outside, are on the second; and
shared/rarely-modified items are on the third.

Signed-off-by: Eddie Kohler <ekohler@gmail.com>
Remove RouterThread::driver_once().

This function is not called anywhere that I know of, and it's a bad idea
(since it only does tasks).
Improve schedule debugging: Better "notifier_state" output for queues.
Notifier: Uninitialized signals are contagious.
glob_match: Avoid exponential behavior by not pushing duplicate states.

Cliff Frey report.
Configury to autoconf-2.59.
Fix 5a23cb3788fcade92506f930a9ef41405465e387 for --disable-stride.
Add click_relax_fence(): fence that relaxes the processor.

And move fences into a new header file, <click/machine.hh>, which should
grow over time.
Internal: Use a union and explicit fences to manage the pending list.

This is a clarity commit.
Notifier: Correct multithreading bug.

This configuration exposed the bug:

i0 :: InfiniteSource(LIMIT 1000000, STOP true, TIMESTAMP false, ACTIVE false)
  -> q0 :: Queue
  -> d0 :: Discard;
i1 :: InfiniteSource(LIMIT 1000000, STOP true, TIMESTAMP false, ACTIVE false)
  -> q1 :: Queue
  -> d1 :: Discard;
i2 :: InfiniteSource(LIMIT 1000000, STOP true, TIMESTAMP false, ACTIVE false)
  -> q2 :: Queue
  -> d2 :: Discard;
i3 :: InfiniteSource(LIMIT 1000000, STOP true, TIMESTAMP false, ACTIVE false)
  -> q3 :: Queue
  -> d3 :: Discard;

DriverManager(set a $(now),
  write i0.active true, write i1.active true, write i2.active true, write i3.active true,
  wait, wait, wait, wait,
  set b $(now), print $(div $(add $(i0.limit) $(i1.limit) $(i2.limit) $(i3.limit)) $(sub $b $a)))

StaticThreadSched(i0 0, d0 1, i1 1, d1 0, i2 2, d2 3, i3 3, d3 2)
RawSocket: Reduce warnings.
Script: add more handlers and a test.

With Eddie Kohler.

Signed-off-by: Cliff Frey <cliff@meraki.com>
Fix Bypass::Visitor declared as struct, friended as class
User-level driver: SIGINT gets default handling after router stops.

Before this commit, there was a race condition where SIGINT could
access a deleted router (bad).

Signed-off-by: Eddie Kohler <ekohler@gmail.com>
Array memory: Add cast() function to avoid warnings from old compilers.

g++ 4.1.2 was a problem.
Internal: Make click_fence() work on Mac llvm-gcc 4.2.1.

What a disaster! What a long time this took to find!

Signed-off-by: Eddie Kohler <ekohler@gmail.com>
On some ABIs, "struct { char[N] }" has a size != N; so pack.

We must have "sizeof(char_array<S>) == S"! Cliff Frey, Raluca
Musaloiu-E., and others found this problem.
fromhost: Remove acquisition of dev_base_lock

FromHost() was acquiring dev_base_lock, but this is not necessary
when calling alloc_netdev(), and indeed its an error as alloc_netdev()
can sleep when allocing memory.

The low level routines handle their own synchronization so acquiring
dev_base_lock is rarely necessary.

Verified by looking at the v2.6.0 kernel sources: the difference between
dev_alloc() and alloc_netdev() is the need for locking, so place
the lock inside the dev_alloc() pre-2.6 case.

Signed-off-by: Eddie Kohler <ekohler@gmail.com>