httpserver: python3 support for json2code.py

Signed-off-by: Zifei Tong <zifeitong@gmail.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
scripts: add python3 support to test framework

Changes:
  - use python3 style print function.
  - use absolute imports which is enabled by default in python3.
  - add encode/decode between string and bytearray.
  - use python2 explicitly in 'scripts/trace.py', since it uses 'dpkt' library
    which is python2-only.

Tested with Python 3.4.1 and 2.7.8

Signed-off-by: Zifei Tong <zifeitong@gmail.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
scripts: add gcc 4.9 support to loader.py

Since the ABI of unordered_map changed in gcc 4.9.

Also removes tailing spaces.

Signed-off-by: Zifei Tong <zifeitong@gmail.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
build: use system gcc headers when build_env=host

Fixes the following error running 'tst-async.so' and 'tst-promise.so' due
to the ABI changes in gcc 4.9:

  Failed looking up symbol _ZTVNSt13__future_base11_State_baseE (vtable for std::__future_base::_State_base)

Signed-off-by: Zifei Tong <zifeitong@gmail.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
build.mk pass arch to the module compilation

The module compilation needs to the arch currently been compiled, this
adds the ARC as a parameter to the make file of the modules.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Adding libtools.so library

The libtools will hold code that is not part of the kernel but is
required by both tools and the API.

As a first step it holds the logic for lsroute and remove it from
kernel.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Route Cache patch #1

The first patch replaces the calls to the BSD functions in three places
by calls to a new function route_cache::lookup(). lookup() is a new
function which still does the slow lock-full lookup, but the point of
this patch is twofold: 1. To verify that indeed, these three places are
all the lookups done in the fast-path of the UDP memcached and tomcat
benchmarks (other benchmarks may involve more code paths, can be fixed
later).
2. Now lookup() takes care of the locking, and there is no need to
unlock a route after calling it - and the first patch verifies this
movement of the unlock code indeed works as a expected.

Note that this patch defines an invalidate() function but nothing
ever defines it, nor uses it. Once we're confident about the direction
of these two patches, I think it should be pretty straighforward to
implement and call invalidate() on route changes.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Route Cache patch #2

The second patch is starting to rewrite lookup() to have an RCU cache
so the route is first looked up in the cache, and only if it's not there,
look it up in the old slow way (as in the first patch) and add it to the
cache. Instead of using sophisticated radix tree (possibly even BSD's
super-convoluted implementation) for this cache, this patch uses a linear
search of netmasks. If we have a handful of routes (usually we'll just
have two or three), the linear search is fast enough.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
net: kill lltable_drain

It has been #if 0'd in freebsd too. It is dead code. Remove it.

Signed-off-by: Asias He <asias@cloudius-systems.com>
net: kill arp_ifinit2

It is used in sys/netinet/ip_carp.c by CARP[1][2] protocol which we do not
support it now and have very little chance to support it in the future.

[1] http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/carp.html
[2] http://www.freebsd.org/cgi/man.cgi?query=carp&sektion=4&n=1

Signed-off-by: Asias He <asias@cloudius-systems.com>
net: Add trace_in_lltable_lookup

Signed-off-by: Asias He <asias@cloudius-systems.com>
net: Add trace_arpresolve

Signed-off-by: Asias He <asias@cloudius-systems.com>
net: Introduce lla_lookup_fast

Signed-off-by: Asias He <asias@cloudius-systems.com>
ci