virtio net device: get_transmit_buffers_from_vm()

Freelist implements LIFO queue. This means that when the buffers are added
from the vm, they'll be used in reverse order (remove pops the last one).

This patch uses a different algorithm to add buffers so they can be popped
in the ascending order. This is done for both Rx and Tx.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
virtio netdevice: optimize map_from_guest

Optimize map_from_guest to store the last found element on the
0-th position for faster finding later.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
memory: optimize virtual_to_physical

A further optimization to virtual_to_physical.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
virtio net device: reconnection

In order to reconnect we need to restore txavail and rxavail.
We restore them from the used.idx of each vring.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Merge pull request #187 from virtualopensystems/reconnect

vhost-user reconnect support (limited)
Add myself to authorized_keys .
Merge pull request #192 from eugeneia/patch-1

Add myself to authorized_keys .
bench: fix scripts

Remove bashism - execute on /bin/sh.

Rename SNAB to SNABB variables. Rename snab to snabb in file names.
Update README with QEMU instructions and small details.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
bench: add trap handler

Add a generic trap handler to ensure proper cleanup upon exit.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
bench: override SNABB on the command line

If the scripts are run with SNABB env set, then it will override the global
and user settings.
NFV and LOADGEN are computed from teh relative path to SNABB executable and
can't be set by hand.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
app: main can take an external 'done' function
    
Will assert if both duration and done are passed as arguments.


Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
nfv: run upto a number of a packets

The nfv design will be able to get an optional argument which tells it
what number of packets the VM shal receive before exiting.
It will start measuring time once the packets get actually received.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
bench: loadgen run NFV upto a number of packets

Qemu will run in the background and will receive "powerdown" at the end of the execution.
Add the new NFV_PACKETS variable.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
bench: use flock to ensure resource exclusivity


Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
bench: update example conf and README

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Merge pull request #195 from virtualopensystems/bench

Improved benchmark environment based on loadgen for chur.
Merge pull request #193 from virtualopensystems/performance-v2

Performance optimizations targeting vhost-user
bench: bind snabbswitch to NUMA node 0

Binding to differen CPU and memory node is a bad idea!
Immediate performance improvement once this is fixed.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
bench: Ensure all files are removed

The rm_file function is not working properly, fix it.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Merge pull request #196 from virtualopensystems/bench-fixes

Bench fixes