Commit Graph

43077 Commits

Author SHA1 Message Date
Tomasz Grabiec
bafc6cb18e ip: add method to check if IP address is a wildcard 2014-09-16 18:48:16 +03:00
Tomasz Grabiec
53ce24c850 ip: add method to register L4 protocol handlers 2014-09-16 18:48:14 +03:00
Tomasz Grabiec
4311f5dafa array_map: introduce at() 2014-09-16 18:48:14 +03:00
Tomasz Grabiec
791797669f net: make offset == 0 by default in packet::get_header() to simplify call sites 2014-09-16 18:48:13 +03:00
Avi Kivity
48ba89f060 packet: optimize move()ing packets around
Move all data fields into an 'impl' struct (pimpl idiom) so that move()ing
a packet becomes very cheap.  The downside is that we need an extra
allocation, but we can later recover that by placing the fragment array
in the same structure.

Even with the extra allocation, performance is up ~10%.
2014-09-16 15:50:35 +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
5e2f1f0bc6 net: spit out ip checksum routines into their own file 2014-09-16 10:26:44 +03:00
Avi Kivity
812ac77d2f net: spit out packet class into its own files 2014-09-16 10:13:09 +03:00
Tomasz Grabiec
52ab797536 rename engine::start() to engine::when_started()
The imperative form suggests that in addition to returning a future it
performs some action and thus is needed regardless of whether we want
to add a callback or not. But in fact it does not do anything, just
gives away a future.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
2014-09-16 09:59:13 +03:00
Tomasz Grabiec
26a02f30c8 make: fix the build on Ubuntu
"-Wl,--no-as-needed" needs to be included before the libraries,
otherwise it has no effect.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
2014-09-15 21:00:43 +03:00
Avi Kivity
8b86f9d93c net: increase queue length to 1000 2014-09-15 19:27:10 +03:00
Avi Kivity
89827a3d92 tcp: implement delayed acks
Start a timer processing loop, and control it in tcp::input()/output():
input() toggles the arming state of the timer, while output() clears it
unconditionally.

This is worth 25-30% on the http benchmark, since we no longer ACK the
HTTP GET request, instead coalescing it with the response.
2014-09-15 19:24:52 +03:00
Avi Kivity
22e29a7001 timer: add accessor for arming state 2014-09-15 19:23:41 +03:00
Avi Kivity
8ca94a8ea8 timer: disarm the timer after expiring it 2014-09-15 19:23:18 +03:00
Avi Kivity
f7a0a3cdc6 future: reduce allocations
Instead of keeping the future state in heap storage, referenced from
the promise/future/task, keep the state in the promise or future and only
allocate it on the heap as a last resort (for a stack).

Improves httpd throughtput by ~20%.
2014-09-15 14:31:58 +03:00
Avi Kivity
e0c111563f httpd: simplify exception handler
No need to rename 'this' (still strange that it has to be used as
this->maybe_done()).
2014-09-15 09:50:13 +03:00
Avi Kivity
b81869e541 httpd: use modern future chaining style
There's no need to create a temporary promise and pass it around; instead
use future chaining to accomplish the same result.
2014-09-15 09:43:15 +03:00
Avi Kivity
fd8034ac94 README: explain what happens under the hood 2014-09-14 20:03:27 +03:00
Avi Kivity
89ec8f2ae7 net: fix IP checksum overflow during reduction
When reducing the checksum from a 32-bit or 64-bit intermediate,
we can get an overflow after the first overflow handling step:

0000_8000_8000_ffff
-> 10_ffff
->  1_000f
->    0010

Since we lacked the second step, we got an off-by-one in the checksum.
2014-09-14 16:58:27 +03:00
Avi Kivity
752b12738c tcp: tighten initial ack handling
The initial ack cannot contain any data, so it must match the initial
sequence number.

Respond with RST for anything else.
2014-09-14 16:42:12 +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
Avi Kivity
4d28e910db net: queue packets at the L3 protocol level
If an L3 packet receiver is not able to register itself as a packet receiver
after processing a packet, or if it is simply not dispatched quickly enough,
then we will drop packets.

Add a queue at the protocol layer to buffer those packets.
2014-09-14 16:00:07 +03:00
Avi Kivity
46c1683ceb tcp: don't abort on connection refused 2014-09-14 15:59:09 +03:00
Avi Kivity
acd317157b Add a future-friendly queue template
More or less a standard queue, but allows obtaining a future<> for
queue-empty conditions (for consumers) or queue-not-full conditions
(for producers)
2014-09-14 15:57:39 +03:00
Asias He
9b294f2829 httpd: Print port info on startup
Signed-off-by: Asias He <asias@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
2014-09-13 07:23:40 +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
Asias He
92b9d5198c build: Add cscope target
Signed-off-by: Asias He <asias@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
2014-09-13 07:19:47 +03:00
Avi Kivity
9553ef779f README: fix typo 2014-09-12 23:18:34 +03:00
Avi Kivity
fbf043bf07 More markdown fixes, yuch 2014-09-11 20:25:02 +03:00
Avi Kivity
e43299463f Fix github-flavored markdown 2014-09-11 20:20:27 +03:00
Avi Kivity
2310354c24 Convert to github-flavored markdown 2014-09-11 20:19:06 +03:00
Avi Kivity
178aa39d32 Add README 2014-09-11 20:12:27 +03:00
Avi Kivity
cbcfbf86ca tcp: don't respond to RST packets 2014-09-11 17:37:34 +03:00
Avi Kivity
b68aa3080e tcp: send RST packets in network byte order 2014-09-11 17:35:59 +03:00
Avi Kivity
42843b0286 tcp: RST packets not received by any connection 2014-09-11 17:35:24 +03:00
Avi Kivity
663ba971ba tcp: drop acknowledged packets from send queue
Or we keep resending them again and again.  That's find for an http server
that keep resending the same reply, but not much else.
2014-09-11 14:46:56 +03:00
Avi Kivity
7c7eebbab4 virtio: fix overzealous vring completion
The complete() function loops around, waiting for notifications and
cleaning up the ring when they happen.  However, we also call it
opportunistically from produce(), and each time this happens, it starts
another loop in the background, leaking memory.

Fix by splitting complete() into do_complete(), which doesn't loop, and
complete(), which does, and only call do_complete() from the produce() loop.
2014-09-11 13:03:59 +03:00
Avi Kivity
b39ab60a4f core: allow ignoring SIGINT
The debugger doesn't work if we handle SIGINT, so provide a way of not
handling it.
2014-09-11 12:41:35 +03:00
Avi Kivity
8121741973 core: move startup code from reactor constructor to run() method
This lets us change things with parameters provided from configure().
2014-09-11 12:23:25 +03:00
Avi Kivity
28e457db92 build: only use tcmalloc in release mode 2014-09-11 12:08:04 +03:00
Avi Kivity
ef0c3dcc7d arp: reduce console chatter 2014-09-11 11:51:16 +03:00
Avi Kivity
5af55ac975 virtio: fix descriptor leak
We only free the first descriptor in a descriptor chain, causing starvation.

Fix by freeing the entire chain.
2014-09-11 11:39:10 +03:00
Avi Kivity
d3fa5996f3 tcp: support local close
Queue a FIN and send it if possible.
2014-09-11 11:39:10 +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
1623d928da tcp: report foreign FINs to the upper layer
This lets the caller know there is no more data.
2014-09-11 11:39:10 +03:00
Avi Kivity
16731cbd39 tcp: fix data segment already fully acknowledged
In that case, we trim()med the packet by more than its length, which is bad.
2014-09-10 18:33:59 +03:00
Avi Kivity
8fe20173c2 tcp: improve FIN processing
- only accept FINs within the receive window (otherwise RST)
- only process in-order FINs (otherwise drop)
2014-09-10 18:15:54 +03:00
Avi Kivity
e28f87ec8a tcp: add RST responses 2014-09-10 17:58:09 +03:00
Avi Kivity
b6d85fc6a6 s/the_reactor/engine/g
Things named "engine" are 20% faster.
2014-09-10 15:46:33 +03:00
Avi Kivity
e0d7b5f1f6 s/networking/network/
Just because.
2014-09-10 15:45:23 +03:00