Http Server: code generation improve error handling

This series changes the somehow cryptic code generation error messages
to more meaningful ones.

It catches all exception and print an error message with the current
file being parsed.

It also tries to identify if a missing attribute causes an error and
report the missing attribute with its whereabout.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Revert "Adding libtools.so library"

This reverts commit 049b1a9bb60e8a9d179c11afd0b74601e81b29f3.

It breaks aarch64 build.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Http Server: Implicitly call json formatting for json handlers

Most of the API method return json type object. This patch remove the
need to explicitly call the json formatter when returning the result.

To do so a wrapper for the return type was added, it uses autoboxing to
translate return types to their json formatted representation.

The set_handler method with default return type, is set to return json
and to accept lambda expression that return the wrapper.

After the change it is possible to call:
getOSversion.set_handler([](const_req req)
    {
        return osv::version();
    });

The return string will be translated to json string.
No need to call the formatter anymore and no need to set the return type
to json.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
build: fix build/release link generation

Since there's no rule for the link, it needs to be forced every build.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
net: kill inpgroups

"inpgroups" are some bsd mechanism used to group together connections
sharing some affinity to a thread/cpu.  We don't enable it however, so
it's dead code and hampers further development of the network stack.

Remove it.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
tcp: Remove the function tcp_twrecycleable

This is a backport from freebsd:

   commit 278abd32202c5e621d3d868824000d2f296645f4
   Author: silby <silby@FreeBSD.org>
   Date:   Fri May 16 01:38:38 2014 +0000

       Remove the function tcp_twrecycleable; it has been #if 0'd for
       eight years.  The original concept was to improve the
       corner case where you run out of ephemeral ports, but it
       was causing performance problems and the mechanism
       of limiting the number of time_wait sockets serves
       the same purpose in the end.

Signed-off-by: Asias He <asias@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
tcp_output(): maximize LSO frames size

Maximizing the LSO packet size we reduce the CPU usage both in
the Guest, and in HV.

This improves the netperf TCP_STREAM test performance when it's executed vs
the netserver on the same host where we run an OSv Guest (8GB RAM, 1 vCPU)
by the following margins:

message size    compared to origin
64              33.92%
128             36.08%
256             57.10%
512             111.92%
1024            186.63%
2048            260.38%
4096            214.22%
8192            93.80%
16384           43.14%
32768           13.44%
65536           4.76%

This patch introduces the following algorithm previously missing in the FreeBSD code
we are based on:
   - Aggregate as many bytes as possible before sending unless one of the below
     conditions:
      - There is a full Tx window of data when Tx window is greater than MSS.
      - There is a maximum TSO aggregation size of data pending (64K).
      - 2 clock ticks has passed since we've started the current TSO aggregation.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
scripts/test.py: Fix output alignment

Bump up alignment to 35 characters to accommodate long test names that
don't fit into 25 characters.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
net: Decrease lock contention within the TCP accept case

This is a backport of from freebsd:

   commit 5c066f64123bc86c10537ae180565c8766e3cc2c
   Author: gnn <gnn@FreeBSD.org>
   Date:   Tue Jan 28 20:28:32 2014 +0000

       Decrease lock contention within the TCP accept case by removing
       the INP_INFO lock from tcp_usr_accept.  As the PR/patch states
       this was following the advice already in the code.
       See the PR below for a full disucssion of this change and its
       measured effects.

       PR:         183659
       Submitted by:       Julian Charbo

   Related URL:
   https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=183659
   http://svnweb.freebsd.org/base?view=revision&revision=175612

A modification is made compared to original patch. In OSv, we call
SOCK_LOCK() before soisconnected(). This is becasue in 79005e32 (net:
remove socket lock, use protocol layer connection lock instead) an
extra SOCK_UNLOCK() was added to soisconnected().

I do not see tomcat bechmark gain, but it helps removing the
INP_INFO lock.

Signed-off-by: Asias He <asias@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@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>
debug