Linux looks at the gso hdr_len field even if gso is not used, and refuses
to send the packet if it isn't reasonable. mode=debug poisons memory,
causing the value to be unreasonable.
Fix by clearing the entire header.
Per-L3 support is provided as a template, with the L3 protocol as a parameter,
so the address type for each protocol is a concrete type without requiring
dynamic allocation or virtual functions for hashing and comparing addresses.
Rather than hacking around the inability to bind references to unaligned
scalars, wrap them in a struct (which can then be marked as unaligned),
and use the wrapped values everywhere. This ensures the code works on
platforms that need special instructions for unaligned access.
Adjust the forwarding functions to require references; passing by value
accidentally can lose the conversion.
Instead of assuming there is room for a header in front of the packet, use
the packet prepending constructor to check for it and allocate it if missing.
This requires splitting the waiting into two parts: first acquiring the
packet, and only then, when we know how many fragments it has, waiting
for virtio dscriptors. It also requires that we prepare a full buffer_chain
rather than one with exactly one fragment.
1. Replace the completion promise<> with a custom deleter class; this
is lighter weight, and we don't really need the destructor to be
executed by the scheduler.
2. Add lots of consuctors for composing packets from existing packet,
by appending or prepending packets
3. Over-allocate in some cases to accomodate for the common practice of
prepending protocol headers.
The build fails for me like this:
/tmp/ccOUUuiH.ltrans0.ltrans.o: In function `reactor::reactor()':
/home/tgrabiec/src/seastar/build/release/../../reactor.cc:41: undefined reference to `io_setup'
/tmp/ccOUUuiH.ltrans1.ltrans.o: In function `reactor::process_io()':
/home/tgrabiec/src/seastar/build/release/../../reactor.cc:133: undefined reference to `io_getevents'
collect2: error: ld returned 1 exit status
../../build.mk:27: recipe for target 'seastar' failed
The workaround was taken from
https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1228201
Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
[avi: move to separate line with comment to justify the ugliness]
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Supported:
- basic virtio ring pump
- basic virtio-net driver (most features missing)
- vhost interface (running as a privileged user process, not guest)