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>
This commit is contained in:
10
tap.c
10
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user