diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2023-01-06 11:43:22 +1100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2023-01-23 18:55:04 +0100 |
commit | 54502cca7f7a89eadce92bb7a2b6ab61b878a5c6 (patch) | |
tree | 3e09bece41fd747c2c29f987b20f256ebc509c76 /tap.c | |
parent | 2d553b587ada1f2d0d657e516f3d068efa4db074 (diff) | |
download | passt-54502cca7f7a89eadce92bb7a2b6ab61b878a5c6.tar passt-54502cca7f7a89eadce92bb7a2b6ab61b878a5c6.tar.gz passt-54502cca7f7a89eadce92bb7a2b6ab61b878a5c6.tar.bz2 passt-54502cca7f7a89eadce92bb7a2b6ab61b878a5c6.tar.lz passt-54502cca7f7a89eadce92bb7a2b6ab61b878a5c6.tar.xz passt-54502cca7f7a89eadce92bb7a2b6ab61b878a5c6.tar.zst passt-54502cca7f7a89eadce92bb7a2b6ab61b878a5c6.zip |
udp: Use tap_send_frames()
To send frames on the tap interface, the UDP uses a fairly complicated two
level batching. First multiple frames are gathered into a single "message"
for the qemu stream socket, then multiple messages are send with
sendmmsg(). We now have tap_send_frames() which already deals with sending
a number of frames, including batching and handling partial sends. Use
that to considerably simplify things.
This does make a couple of behavioural changes:
* We used to split messages to keep them under 32kiB (except when a
single frame was longer than that). The comments claim this is
needed to stop qemu from closing the connection, but we don't have any
equivalent logic for TCP. I wasn't able to reproduce the problem with
this series, although it was apparently easy to reproduce earlier.
My suspicion is that there was never an inherent need to keep messages
small, however with larger messages (and default kernel buffer sizes)
the chances of needing more than one resend for partial send()s is
greatly increased. We used not to correctly handle that case of
multiple resends, but now we do.
* Previously when we got a partial send on UDP, we would resend the
remainder of the entire "message", including multiple frames. The
common code now only resends the remainder of a single frame, simply
dropping any frames which weren't even partially sent. This is what
TCP always did and is probably a better idea for UDP too.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tap.c')
0 files changed, 0 insertions, 0 deletions