Compile LuaJIT with LUAJIT_USE_PERFTOOLS and LUAJIT_USE_GDBJIT.

These are valuable debugging tools and they have no immediately
obvious performance impact.

Particularly useful is LUAJIT_USE_PERFTOOLS so that Linux 'perf top'
will show individual traces.
Only run as root.

Give a clear error message and exit otherwise.
Make 'Source' use external rx_buffer_freelist

Packet size can be passed as :new argument - defaults to 60.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Use the "zone" feature for LuaJIT profiling.

Snabb Switch now tells the profiler what "zone" of computation is
executing at any given time. The profiler is then able to report on
each zone separately, when given the -jp=z flag.

The zone name for an app can be given explicitly as the "zone" field
of the app (or its class). If no name is given then one is guessed
based on the module name of the app's code.

Example output:

    # ./snabbswitch -jp=2zF -t apps.intel.intel_app
    75%  apps.intel.intel_app
      -- 18%  intel10g.lua:transmit < intel_app.lua:push
      -- 17%  intel10g.lua:receive < intel_app.lua:pull
      -- 11%  buffer.lua:free < packet.lua:free
      --  7%  intel10g.lua:sync_transmit < intel_app.lua:push
      --  5%  intel10g.lua:can_add_receive_buffer < intel_app.lua:add_receive_buffers
      --  4%  register.lua:RDH < intel10g.lua:sync_receive
      --  3%  freelist.lua:add < buffer.lua:free
      --  3%  intel10g.lua:add_receive_buffer < intel_app.lua:add_receive_buffers
      --  3%  link.lua:receive < intel_app.lua:push
      --  3%  link.lua:transmit < intel_app.lua:pull
      --  3%  freelist.lua:remove < packet.lua:allocate
    11%  Sink
      -- 48%  buffer.lua:free < packet.lua:free
      -- 13%  freelist.lua:add < packet.lua:free
      -- 11%  link.lua:receive < basic_apps.lua:push
      --  9%  freelist.lua:add < buffer.lua:free
      --  7%  packet.lua:free < packet.lua:deref
      --  7%  packet.lua:deref < basic_apps.lua:push
    10%  Source
      -- 45%  packet.lua:add_iovec < basic_apps.lua:pull
      -- 15%  link.lua:transmit < basic_apps.lua:pull
      -- 15%  freelist.lua:remove < buffer.lua:allocate
      -- 11%  link.lua:full < link.lua:transmit
      --  8%  freelist.lua:remove < packet.lua:allocate
      --  6%  basic_apps.lua:pull < app.lua:breathe
     4%  selftest
      -- 27%  lib.lua:waitfor < register.lua:wait
      -- 27%  memory.lua:allocate_RAM < memory.lua:allocate_next_chunk
      -- 23%  app.lua:breathe < app.lua:main
      -- 14%  zone.lua:zone < app.lua:breathe
      --  5%  lib.lua:firstline < pci.lua:device_info
      --  5%  lib.lua:done < app.lua:main
README.md: Added Travis-CI build status link
Merge pull request #145 from lukego/rootcheck

Only run as root.
Merge pull request #140 from lukego/debug

Debug: Enable more LuaJIT features for debugging
packet - add packet_size

This saves some processing at runtime.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Added designs.nfv.nfv.

This is currently a simple application that connects one vhost_user
interface with one intel10g interface.

Fixes in the original version - pci, rx/tx naming, update to latest
intel args passing.

Signed-off-by: Luke Gorrie <luke@snabb.co>
Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Align to latest vhost-user-v9

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Decouple form intel10g

For the selftest we'll use a non-HW dependent setup:

vhost -> tee -> sink

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Fix process_qemu_requests when QEMU goes down

vhost_user_receive will return 0 when the other end closed
the socket. In such case shut vhost_user operation.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Lower the rate of qemu process polling

Once vhost_user is UP it will have almos no communication so no
need to process it that often. Add a counter and use it to lower
the syscalls.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
vhost_user add link_down_proc

Add a callback to execute when the other end shuts.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
vhost_user set_vring_addr

used and avail will be pointers

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Enhance virtio.h with more feature bits

These are not used now - but may be usefull in the future. Enumerate them
now for completeness.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Extract the virtio-net device code into a separate module

No features are supported in this implementation
This will result in having the following descriptor layout for both RX/TX:

 - virtio_header
 - data buffer

The buffer origin struct is extended to include the information needed
to access the virtio header.

no-IOMMU - translate all virtual addesses to physical

NOTE: This is slow! Using pread for each packet ...

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[virtio] Enable CSUM feature and handle multibuffers

The VIRTIO_NET_F_CSUM feature enables also scatter gather I/O
in the current Linux virtio-net driver TX path.

Here we enable this feature and hanle the RX multibuffer packets.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Make API modules global.

Renamed 'app' to 'engine' in the global table.
Rename 'snabbswitch' command to 'snabb'.

Short and sweet!

Adds a 'make install' target to install as /usr/local/bin/snabb.

snabbswitch/src/snabbswitch is created as a symlink for compatibility.