Skip to content

Commit 796f82e

Browse files
edumazetdavem330
authored andcommitted
tcp: fix delayed acks behavior for SO_RCVLOWAT
We should not delay acks if there are not enough bytes in receive queue to satisfy SO_RCVLOWAT. Since [E]POLLIN event is not going to be generated, there is little hope for a delayed ack to be useful. In fact, delaying ACK prevents sender from completing the transfer. Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d136184 commit 796f82e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

net/ipv4/tcp_input.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5026,9 +5026,12 @@ static void __tcp_ack_snd_check(struct sock *sk, int ofo_possible)
50265026
/* More than one full frame received... */
50275027
if (((tp->rcv_nxt - tp->rcv_wup) > inet_csk(sk)->icsk_ack.rcv_mss &&
50285028
/* ... and right edge of window advances far enough.
5029-
* (tcp_recvmsg() will send ACK otherwise). Or...
5029+
* (tcp_recvmsg() will send ACK otherwise).
5030+
* If application uses SO_RCVLOWAT, we want send ack now if
5031+
* we have not received enough bytes to satisfy the condition.
50305032
*/
5031-
__tcp_select_window(sk) >= tp->rcv_wnd) ||
5033+
(tp->rcv_nxt - tp->copied_seq < sk->sk_rcvlowat ||
5034+
__tcp_select_window(sk) >= tp->rcv_wnd)) ||
50325035
/* We ACK each frame or... */
50335036
tcp_in_quickack_mode(sk) ||
50345037
/* We have out of order data. */

0 commit comments

Comments
 (0)