Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
mptcp: fix accounting on rmem
Browse files Browse the repository at this point in the history
Linked to previous commit: "mptcp: fix tcp-mem accounting"

rmem accounting is always done on the meta but tcp_mem (sk_rmem_schedule
call) is done on the individual subflows.

Properly split between meta and subflow in tcp_try_rmem_schedule.

Fixes: c50cf08 ("Fix: mptcp_try_rmem_schedule removed")
Signed-off-by: Nathan Atta <nathan.atta@tessares.net>
Signed-off-by: Tim Froidcoeur <tim.froidcoeur@tessares.net>
Acked-by: Christoph Paasch <cpaasch@apple.com>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
(cherry picked from commit 0bdffb3)
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
(cherry picked from commit 7424545)
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
  • Loading branch information
TimFroidcoeur authored and matttbe committed Jul 15, 2022
1 parent 0de8b06 commit fc18541
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions net/ipv4/tcp_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -4533,17 +4533,16 @@ static int tcp_prune_queue(struct sock *sk);
static int tcp_try_rmem_schedule(struct sock *sk, struct sk_buff *skb,
unsigned int size)
{
if (mptcp(tcp_sk(sk)))
sk = mptcp_meta_sk(sk);
struct sock *meta_sk = mptcp(tcp_sk(sk)) ? mptcp_meta_sk(sk) : sk;

if (atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf ||
if (atomic_read(&meta_sk->sk_rmem_alloc) > meta_sk->sk_rcvbuf ||
!sk_rmem_schedule(sk, skb, size)) {

if (tcp_prune_queue(sk) < 0)
if (tcp_prune_queue(meta_sk) < 0)
return -1;

while (!sk_rmem_schedule(sk, skb, size)) {
if (!tcp_prune_ofo_queue(sk))
if (!tcp_prune_ofo_queue(meta_sk))
return -1;
}
}
Expand Down

0 comments on commit fc18541

Please sign in to comment.