Commit Graph

20 Commits

Author SHA1 Message Date
Asias He
0ffaa0cbdd net: Reorder net/stack.cc
Makes the file more readable. Now, The classes are defined in orders.
2014-10-13 11:33:47 +08:00
Gleb Natapov
cc9146403d Proxy net interface
Only one cpu can talk to virtio NIC directly (at least without
multiqueue), so other cpus receive packets from the one that drives
virtio and forward packets that need to be send back. This is done
by proxy net interface.
2014-10-07 11:04:03 +03:00
Tomasz Grabiec
ba49d24b01 net: add support for UDPv4 in native and posix stack 2014-10-06 18:34:40 +02:00
Asias He
cff8cb353a net: Add netmask option 2014-09-28 10:06:08 +03:00
Asias He
7ab735d3c7 net: Gateway support 2014-09-28 10:05:58 +03:00
Avi Kivity
e223f748ec core: great deleter rename
deleter::share() is causing massive amounts of allocation.  First,
since usually a packet's deleter is not a shared_deleter, we need to
allocate that shared_deleter.  Second, we need an external reference
count which requires yet another allocation.

Making reference counting part of the deleter class would solve both of
these problems, but we cannot easily do that, since users hold
std::unique_ptr<deleter> which is clearly not sharable.

We could do a massive s/unique_ptr/shared_ptr/ here, but that would have
the side effect of making sharing "too easy" - you simply copy the pointer.
We'd like to keep it explicit.

So to make the change easier, rename the existing unique_ptr<deleter> as
plain "deleter", whereas the old "deleter" becomes deleter::impl:

  old name              new name
  --------              --------
  deleter               deleter::impl
  unique_ptr<deleter>   deleter

with exactly the same semantics.  A later patch can then add explicit sharing.
2014-09-23 11:15:31 +03:00
Avi Kivity
c096787c8c net: specialize single-fragment data_sink::put() for native stack
Saves a vector allocation and some loops.
2014-09-23 10:37:56 +03:00
Avi Kivity
4738f3f05c net: switch device rx to stream<packet>
Still have that internal rx queue.
2014-09-22 11:27:47 +03:00
Asias He
4dc70e95c7 virtio: Add --event-index option
Virtio net options:
  --event-index arg (=on) Enable event_index feature (on / off)

By default, --event-index is enable. To disable, e.g.:

   $ ./httpd --network-stack native --event-index off
2014-09-22 11:22:59 +03:00
Avi Kivity
4e76590ed6 net: allow configuring the IP address 2014-09-17 17:52:02 +03:00
Avi Kivity
3168a2fc7c Allow providing options to configure network stacks 2014-09-17 17:44:58 +03:00
Avi Kivity
37c90fe54e net: make packet data members private
This will assist in future refactoring.
2014-09-16 11:24:13 +03:00
Avi Kivity
3def4bc7d7 tcp: queue connections being accepted
With the current listen() -> future<connection> interface, if a new connection
is established before the connection handler is able to re-register for the
port, we have to drop the connection.

Fix by adding a queue for accepted connections, and switching to the more
standard listen() -> accept() -> future<connection> model.
2014-09-14 16:05:48 +03:00
Asias He
647a0cacd3 net: Add ipv4_address(string) constructor
Set ipv4 address using dotted decimal form.

Signed-off-by: Asias He <asias@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
2014-09-13 07:20:31 +03:00
Avi Kivity
67fc9dfe9a net: fix eof reporting in native data_source adapter
An empty packet signals end-of-stream, which we ignored.

Note the empty packet and report it to the caller.
2014-09-11 11:39:10 +03:00
Avi Kivity
e0d7b5f1f6 s/networking/network/
Just because.
2014-09-10 15:45:23 +03:00
Avi Kivity
c0f87bbf40 net: fix byte order confusion in listen()
posix sockaddr_in gives the port in network byte order.
2014-09-10 15:42:24 +03:00
Avi Kivity
430acf7109 net: set up native network stack correctly
Start the interface and set up an IP address.
2014-09-10 15:41:51 +03:00
Avi Kivity
9c2a31bf0f core: add networking stack registry
The registry allows stacks to name themselves to the core, so that
a networking stack can be selected at startup.
2014-09-10 11:42:33 +03:00
Avi Kivity
5630f636cd net: add protcol stack adapter for native stack
This defines adapter classes for converting from the tcp<> class to the
abstractions that applications use.

Still very inefficient due to impedance mismatch between the data types used.
2014-09-10 10:42:21 +03:00