aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-09-14 16:54:06 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-09-14 16:57:50 +0200
commita616357c864539d366f40ca37b687757c109144f (patch)
treed7c7bb46e1a726fe83a3692fba2664fb7df9e166
parent621c589d3695b8a4a781beaab255bbd1ab68c154 (diff)
downloadpasst-a616357c864539d366f40ca37b687757c109144f.tar
passt-a616357c864539d366f40ca37b687757c109144f.tar.gz
passt-a616357c864539d366f40ca37b687757c109144f.tar.bz2
passt-a616357c864539d366f40ca37b687757c109144f.tar.lz
passt-a616357c864539d366f40ca37b687757c109144f.tar.xz
passt-a616357c864539d366f40ca37b687757c109144f.tar.zst
passt-a616357c864539d366f40ca37b687757c109144f.zip
tcp: In ESTABLISHED state, acknowledge segments as they're sent to the socket
...instead of waiting for the remote peer to do that -- it's especially important in case we request retransmissions from the guest, but it also helps speeding up slow start. This should probably be a configurable behaviour in the future. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--tcp.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/tcp.c b/tcp.c
index 4c6bfd0..e58658e 100644
--- a/tcp.c
+++ b/tcp.c
@@ -1200,8 +1200,9 @@ static int tcp_send_to_tap(struct ctx *c, struct tcp_tap_conn *conn,
if (flags & SYN) {
ack_pending = 0;
- } else if (conn->no_snd_wnd) {
- ack_pending = (conn->seq_from_tap - conn->seq_ack_to_tap) <
+ } else if (conn->state == ESTABLISHED || conn->no_snd_wnd) {
+ ack_pending = conn->seq_from_tap != conn->seq_ack_to_tap &&
+ (conn->seq_from_tap - conn->seq_ack_to_tap) <
MAX_WINDOW;
} else {
ack_pending = info.tcpi_bytes_acked > conn->tcpi_acked_last;
@@ -1213,8 +1214,12 @@ static int tcp_send_to_tap(struct ctx *c, struct tcp_tap_conn *conn,
if (conn->no_snd_wnd) {
conn->seq_ack_to_tap = conn->seq_from_tap;
} else {
- conn->seq_ack_to_tap = info.tcpi_bytes_acked +
- conn->seq_init_from_tap;
+ if (conn->state == ESTABLISHED)
+ conn->seq_ack_to_tap = conn->seq_from_tap;
+ else
+ conn->seq_ack_to_tap = info.tcpi_bytes_acked +
+ conn->seq_init_from_tap;
+
conn->tcpi_acked_last = info.tcpi_bytes_acked;
}
@@ -1770,9 +1775,13 @@ recvmmsg:
* 90);
}
+ if (conn->state == ESTABLISHED)
+ conn->seq_ack_to_tap = conn->seq_from_tap;
+ else
+ conn->seq_ack_to_tap = info.tcpi_bytes_acked +
+ conn->seq_init_from_tap;
+
conn->tcpi_acked_last = info.tcpi_bytes_acked;
- conn->seq_ack_to_tap = info.tcpi_bytes_acked +
- conn->seq_init_from_tap;
}
} else {
info.tcpi_snd_wscale = conn->ws;