Skip to content

Commit c76c695

Browse files
Paolo Abenidavem330
authored andcommitted
mptcp: call tcp_cleanup_rbuf on subflows
That is needed to let the subflows announce promptly when new space is available in the receive buffer. tcp_cleanup_rbuf() is currently a static function, drop the scope modifier and add a declaration in the TCP header. Reviewed-by: Mat Martineau <[email protected]> Signed-off-by: Paolo Abeni <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d5f4919 commit c76c695

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

include/net/tcp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,6 +1414,8 @@ static inline int tcp_full_space(const struct sock *sk)
14141414
return tcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf));
14151415
}
14161416

1417+
void tcp_cleanup_rbuf(struct sock *sk, int copied);
1418+
14171419
/* We provision sk_rcvbuf around 200% of sk_rcvlowat.
14181420
* If 87.5 % (7/8) of the space has been consumed, we want to override
14191421
* SO_RCVLOWAT constraint, since we are receiving skbs with too small

net/ipv4/tcp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1527,7 +1527,7 @@ static int tcp_peek_sndq(struct sock *sk, struct msghdr *msg, int len)
15271527
* calculation of whether or not we must ACK for the sake of
15281528
* a window update.
15291529
*/
1530-
static void tcp_cleanup_rbuf(struct sock *sk, int copied)
1530+
void tcp_cleanup_rbuf(struct sock *sk, int copied)
15311531
{
15321532
struct tcp_sock *tp = tcp_sk(sk);
15331533
bool time_to_ack = false;

net/mptcp/protocol.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,8 @@ static bool __mptcp_move_skbs_from_subflow(struct mptcp_sock *msk,
515515
} while (more_data_avail);
516516

517517
*bytes += moved;
518+
if (moved)
519+
tcp_cleanup_rbuf(ssk, moved);
518520

519521
return done;
520522
}
@@ -1424,10 +1426,14 @@ static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied)
14241426
*/
14251427
mptcp_for_each_subflow(msk, subflow) {
14261428
struct sock *ssk;
1429+
bool slow;
14271430

14281431
ssk = mptcp_subflow_tcp_sock(subflow);
1432+
slow = lock_sock_fast(ssk);
14291433
WRITE_ONCE(ssk->sk_rcvbuf, rcvbuf);
14301434
tcp_sk(ssk)->window_clamp = window_clamp;
1435+
tcp_cleanup_rbuf(ssk, 1);
1436+
unlock_sock_fast(ssk, slow);
14311437
}
14321438
}
14331439
}

net/mptcp/subflow.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,8 @@ static void mptcp_subflow_discard_data(struct sock *ssk, struct sk_buff *skb,
823823
sk_eat_skb(ssk, skb);
824824
if (mptcp_subflow_get_map_offset(subflow) >= subflow->map_data_len)
825825
subflow->map_valid = 0;
826+
if (incr)
827+
tcp_cleanup_rbuf(ssk, incr);
826828
}
827829

828830
static bool subflow_check_data_avail(struct sock *ssk)

0 commit comments

Comments
 (0)