Commit Graph

243 Commits

Author SHA1 Message Date
Avi Kivity
5be3fa082d build: make configure.py more readable 2014-09-18 21:10:02 +03:00
Avi Kivity
f98c99b210 build: build everything by default
So people don't break the debug build randomly.
2014-09-18 20:57:07 +03:00
Avi Kivity
e56c54c55b build: switch to ninja
This makes it saner to integrate code generators, plus it's cool.
2014-09-18 17:22:58 +03:00
Avi Kivity
e7c470c5c7 readme: fix loop example
The termination condition must not chain the
tail call, or we go into an infinite loop.

Noted by Gleb.
2014-09-18 15:32:08 +03:00
Avi Kivity
bf59db0ef0 tcp: don't use pseudo headers for checksum
Calculate it directly instead.
2014-09-18 12:46:25 +03:00
Avi Kivity
d04ebe833a net: allow direct checksum of fields without a structure
This allows removing usage of "pseudo headers"
2014-09-18 12:45:45 +03:00
Avi Kivity
4826970d25 net: use __int128 for partial value storage in ip checksum
This makes carry handling simpler for the compiler (though it should have
been able to do this without help).
2014-09-18 12:05:31 +03:00
Avi Kivity
f6cb06a3cb net: implement ip_checksum in terms of checksummer class
Easier to maintain partial checksum this way, for later changes.
2014-09-18 11:31: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
f81760aba7 spit out temporary_buffer into its own file 2014-09-17 12:42:30 +03:00
Avi Kivity
2f103a8558 packet: reduce allocations for the fragment array
Instead of having an std::vector<> manage the fragment array,
allocate it at the end of the impl struct and manage it manually.

The result isn't pretty but it does remove an allocation.
2014-09-17 11:31:22 +03:00
Avi Kivity
804aec33fd packet: fix appending constructor
We did not actually append the fragment.
2014-09-17 09:49:39 +03:00
Avi Kivity
82922fb6ff README: cosmetics 2014-09-16 19:44:21 +03:00
Raphael S. Carvalho
efa0a124a1 Add building instructions section to README file
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2014-09-16 19:42:05 +03:00
Avi Kivity
32bfefa6b9 README: add section about exception handling 2014-09-16 19:26:53 +03:00
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