aboutgitcodebugslistschat
path: root/tap.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2023-09-22 23:35:08 +0200
committerStefano Brivio <sbrivio@redhat.com>2023-10-04 23:39:58 +0200
commita469fc393fa1dfadc7c51c2729550597ee171a8e (patch)
treeb8252a1d499ec87a2f20ffb187c53c7d17c77bcc /tap.c
parentd3192f67c492f6caa3d0779ae016c34e3d847b22 (diff)
downloadpasst-a469fc393fa1dfadc7c51c2729550597ee171a8e.tar
passt-a469fc393fa1dfadc7c51c2729550597ee171a8e.tar.gz
passt-a469fc393fa1dfadc7c51c2729550597ee171a8e.tar.bz2
passt-a469fc393fa1dfadc7c51c2729550597ee171a8e.tar.lz
passt-a469fc393fa1dfadc7c51c2729550597ee171a8e.tar.xz
passt-a469fc393fa1dfadc7c51c2729550597ee171a8e.tar.zst
passt-a469fc393fa1dfadc7c51c2729550597ee171a8e.zip
tcp, tap: Don't increase tap-side sequence counter for dropped frames
...so that we'll retry sending them, instead of more-or-less silently dropping them. This happens quite frequently if our sending buffer on the UNIX domain socket is heavily constrained (for instance, by the 208 KiB default memory limit). It might be argued that dropping frames is part of the expected TCP flow: we don't dequeue those from the socket anyway, so we'll eventually retransmit them. But we don't need the receiver to tell us (by the way of duplicate or missing ACKs) that we couldn't send them: we already know as sendmsg() reports that. This seems to considerably increase throughput stability and throughput itself for TCP connections with default wmem_max values. Unfortunately, the 16 bits left as padding in the frame descriptors we use internally aren't enough to uniquely identify for which connection we should update sequence numbers: create a parallel array of pointers to sequence numbers and L4 lengths, of TCP_FRAMES_MEM size, and go through it after calling sendmsg(). Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'tap.c')
-rw-r--r--tap.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/tap.c b/tap.c
index 93bb348..a7f6d8b 100644
--- a/tap.c
+++ b/tap.c
@@ -413,13 +413,15 @@ static size_t tap_send_frames_passt(const struct ctx *c,
* @c: Execution context
* @iov: Array of buffers, each containing one frame (with L2 headers)
* @n: Number of buffers/frames in @iov
+ *
+ * Return: number of frames actually sent
*/
-void tap_send_frames(const struct ctx *c, const struct iovec *iov, size_t n)
+size_t tap_send_frames(const struct ctx *c, const struct iovec *iov, size_t n)
{
size_t m;
if (!n)
- return;
+ return 0;
if (c->mode == MODE_PASST)
m = tap_send_frames_passt(c, iov, n);
@@ -427,9 +429,11 @@ void tap_send_frames(const struct ctx *c, const struct iovec *iov, size_t n)
m = tap_send_frames_pasta(c, iov, n);
if (m < n)
- debug("tap: dropped %lu frames of %lu due to short send", n - m, n);
+ debug("tap: failed to send %lu frames of %lu", n - m, n);
pcap_multiple(iov, m, c->mode == MODE_PASST ? sizeof(uint32_t) : 0);
+
+ return m;
}
/**