[PATCH v2 0/4] Some cleanups to tap and tcp
This is a handful of simple cleanups which I made while investigating https://bugs.passt.top/show_bug.cgi?id=41. Note that these don't themselves actually address that bug, they're just unrelated cleanups that happen to be in adjacent code. I've run basic tests on these, but not quite the complete test suite: I haven't yet had a chance to debug an unrelated problem with the IPv4 performance tests failing. Changes since v1: * Minor comment and style fixes David Gibson (4): tap: Don't pcap frames that didn't get sent tap: Eliminate goto from tap_handler() tcp: Remove 'recvmsg' goto from tcp_data_from_sock tcp: Remove 'zero_len' goto from tcp_data_from_sock tap.c | 49 +++++++++++++++++++++++++++---------------------- tcp.c | 37 +++++++++++++++++-------------------- 2 files changed, 44 insertions(+), 42 deletions(-) -- 2.39.1
In tap_send_frames() we send a number of frames to the tap device, then
also write them to the pcap capture file (if configured). However the tap
send can partially fail (short write()s or similar), meaning that some
of the requested frames weren't actually sent, but we still write those
frames to the capture file.
We do give a debug message in this case, but it's misleading to add frames
that we know weren't sent to the capture file. Rework to avoid this.
Signed-off-by: David Gibson
The goto here really doesn't improve clarity or brevity at all. Use a
clearer construct.
Signed-off-by: David Gibson
This goto can be handled just as simply and more clearly with a do while.
Signed-off-by: David Gibson
This goto exists purely to move this exception case out of line. Although
that does make the "normal" path a little clearer, it comes at the cost of
not knowing how where control will flow after jumping to the zero_len
label. The exceptional case isn't that long, so just put it inline.
Signed-off-by: David Gibson
On Thu, 16 Feb 2023 16:43:07 +1100
David Gibson
This is a handful of simple cleanups which I made while investigating https://bugs.passt.top/show_bug.cgi?id=41. Note that these don't themselves actually address that bug, they're just unrelated cleanups that happen to be in adjacent code.
I've run basic tests on these, but not quite the complete test suite: I haven't yet had a chance to debug an unrelated problem with the IPv4 performance tests failing.
Changes since v1: * Minor comment and style fixes
David Gibson (4): tap: Don't pcap frames that didn't get sent tap: Eliminate goto from tap_handler() tcp: Remove 'recvmsg' goto from tcp_data_from_sock tcp: Remove 'zero_len' goto from tcp_data_from_sock
Applied. -- Stefano
On Thu, Feb 16, 2023 at 11:22:07PM +0100, Stefano Brivio wrote:
On Thu, 16 Feb 2023 16:43:07 +1100 David Gibson
wrote: This is a handful of simple cleanups which I made while investigating https://bugs.passt.top/show_bug.cgi?id=41. Note that these don't themselves actually address that bug, they're just unrelated cleanups that happen to be in adjacent code.
I've run basic tests on these, but not quite the complete test suite: I haven't yet had a chance to debug an unrelated problem with the IPv4 performance tests failing.
Changes since v1: * Minor comment and style fixes
David Gibson (4): tap: Don't pcap frames that didn't get sent tap: Eliminate goto from tap_handler() tcp: Remove 'recvmsg' goto from tcp_data_from_sock tcp: Remove 'zero_len' goto from tcp_data_from_sock
Applied.
Hmm.. I'm not seeing them in the tree yet.. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
On Fri, 17 Feb 2023 09:55:59 +1100
David Gibson
On Thu, Feb 16, 2023 at 11:22:07PM +0100, Stefano Brivio wrote:
On Thu, 16 Feb 2023 16:43:07 +1100 David Gibson
wrote: This is a handful of simple cleanups which I made while investigating https://bugs.passt.top/show_bug.cgi?id=41. Note that these don't themselves actually address that bug, they're just unrelated cleanups that happen to be in adjacent code.
I've run basic tests on these, but not quite the complete test suite: I haven't yet had a chance to debug an unrelated problem with the IPv4 performance tests failing.
Changes since v1: * Minor comment and style fixes
David Gibson (4): tap: Don't pcap frames that didn't get sent tap: Eliminate goto from tap_handler() tcp: Remove 'recvmsg' goto from tcp_data_from_sock tcp: Remove 'zero_len' goto from tcp_data_from_sock
Applied.
Hmm.. I'm not seeing them in the tree yet..
Oops, yes, I actually pushed it a few minutes after you sent this email... -- Stefano
participants (2)
-
David Gibson
-
Stefano Brivio