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>
This commit is contained in:
parent
621c589d36
commit
a616357c86
1 changed files with 15 additions and 6 deletions
15
tcp.c
15
tcp.c
|
@ -1200,8 +1200,9 @@ static int tcp_send_to_tap(struct ctx *c, struct tcp_tap_conn *conn,
|
||||||
|
|
||||||
if (flags & SYN) {
|
if (flags & SYN) {
|
||||||
ack_pending = 0;
|
ack_pending = 0;
|
||||||
} else if (conn->no_snd_wnd) {
|
} else if (conn->state == ESTABLISHED || conn->no_snd_wnd) {
|
||||||
ack_pending = (conn->seq_from_tap - conn->seq_ack_to_tap) <
|
ack_pending = conn->seq_from_tap != conn->seq_ack_to_tap &&
|
||||||
|
(conn->seq_from_tap - conn->seq_ack_to_tap) <
|
||||||
MAX_WINDOW;
|
MAX_WINDOW;
|
||||||
} else {
|
} else {
|
||||||
ack_pending = info.tcpi_bytes_acked > conn->tcpi_acked_last;
|
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) {
|
if (conn->no_snd_wnd) {
|
||||||
conn->seq_ack_to_tap = conn->seq_from_tap;
|
conn->seq_ack_to_tap = conn->seq_from_tap;
|
||||||
} else {
|
} else {
|
||||||
|
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_ack_to_tap = info.tcpi_bytes_acked +
|
||||||
conn->seq_init_from_tap;
|
conn->seq_init_from_tap;
|
||||||
|
|
||||||
conn->tcpi_acked_last = info.tcpi_bytes_acked;
|
conn->tcpi_acked_last = info.tcpi_bytes_acked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1770,9 +1775,13 @@ recvmmsg:
|
||||||
* 90);
|
* 90);
|
||||||
}
|
}
|
||||||
|
|
||||||
conn->tcpi_acked_last = info.tcpi_bytes_acked;
|
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_ack_to_tap = info.tcpi_bytes_acked +
|
||||||
conn->seq_init_from_tap;
|
conn->seq_init_from_tap;
|
||||||
|
|
||||||
|
conn->tcpi_acked_last = info.tcpi_bytes_acked;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
info.tcpi_snd_wscale = conn->ws;
|
info.tcpi_snd_wscale = conn->ws;
|
||||||
|
|
Loading…
Reference in a new issue