From nobody Sat Apr 20 10:34:01 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a02:1d48:0:0:0:0:0 with SMTP id 69csp2164032jaj; Sun, 5 Sep 2021 23:06:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAdVLLArbJYc/fhh2clzHyIn28mBGEyQF2q6rDBheE57JiAhtS+Y+K9Ih8gb1540Hc2/t6 X-Received: by 2002:a17:90a:9291:: with SMTP id n17mr12476458pjo.243.1630908402193; Sun, 05 Sep 2021 23:06:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630908402; cv=none; d=google.com; s=arc-20160816; b=kL53COdjL9kQIpDCCWew6272G4lb5BWnlBN1IWLKEwNjQkLwQXFw+V0XcEsem14vzM L+s/dY+R2C9n3a1PLNFaCA6tRdr+OsFsQ9Jou1nfoKppbiRB23zCzLBR5iAmV1jv+vO4 T1s13ErAXjDn4JpM8P63vUQQzFAk+sLUD+Q2to3rIeqFFGo8/O/dFthF/xZCQn7uKndc zttcHy98fYQYvIJ89kamZ+s6mubZoUzGTz52a1Je6lnylC3NfKJcdI4GKzAYkOvto66/ a+GWCvbFtz2zYUb09PBn6IEX8dWK68R7+qFtvH1SaWZnh/scKzjCa19/63Xy3Mu7n1fi S8lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=och8QnMWflF/aYb/whNHpFRfRoTK7b/IJXPOOjiLEM0=; b=R3N5zO4PqG0QhF3ISzJrC7mdgTZPYqUFJkW+wVPHYSrbiIUy1qLv4fcS7mH5B6Rfu4 4BgpG9E4uIdw9H4KpE+ja5OjIEU+4qDQ+/xhLx0wLVghKGk+SbVUKVuMl1uxIHT1s5Vn VRGGZVCQgd6pmi4suHNEMecmGsZ3/A65oFNWFoHcqidEyzk4b8rSXAGDTYGQiuh/gk5c 2rRzfE12RMsi6CWMDUZiQTWTwywmrxn8PxLjT+GXzzLLU2G925PieQu9YiAz2AD3oYop J6PG8pTKXDxRaFkO3eIePLcYfHykK3av14sd3ap0g5eeiv72o/sEKxNyvz+vk1i6dt7W ARqA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of mptcp+bounces-1849-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) smtp.mailfrom="mptcp+bounces-1849-wpasupplicant.patchew=gmail.com@lists.linux.dev" Return-Path: Received: from sjc.edge.kernel.org (sjc.edge.kernel.org. [2604:1380:1000:8100::1]) by mx.google.com with ESMTPS id d18si8560646pgo.441.2021.09.05.23.06.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Sep 2021 23:06:42 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-1849-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) client-ip=2604:1380:1000:8100::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of mptcp+bounces-1849-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) smtp.mailfrom="mptcp+bounces-1849-wpasupplicant.patchew=gmail.com@lists.linux.dev" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sjc.edge.kernel.org (Postfix) with ESMTPS id 7D9953E1063 for ; Mon, 6 Sep 2021 06:06:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 92B153FCC; Mon, 6 Sep 2021 06:06:40 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [193.142.43.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9FDAF72 for ; Mon, 6 Sep 2021 06:06:39 +0000 (UTC) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1mN7m4-0008Qs-4F; Mon, 06 Sep 2021 08:06:32 +0200 From: Florian Westphal To: Cc: Florian Westphal Subject: [mptcp-next 1/2] mptcp: remove tx_pending_data Date: Mon, 6 Sep 2021 08:06:13 +0200 Message-Id: <20210906060614.25217-2-fw@strlen.de> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210906060614.25217-1-fw@strlen.de> References: <20210906060614.25217-1-fw@strlen.de> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The update on recovery is not correct. msk->tx_pending_data +=3D msk->snd_nxt - rtx_head->data_seq; will update tx_pending_data multiple times when a subflow is declared stale while earlier recovery is still in progress. This means that tx_pending_data will still be positive even after all data as has been transmitted. Rather than fix it, remove this field: there are no consumers. The outstanding data byte count can be computed either via "msk->write_seq - rtx_head->data_seq" or "msk->write_seq - msk->snd_una". The latter is more recent/accurate estimate as rtx_head adjustment is deferred until mptcp lock can be acquired. Signed-off-by: Florian Westphal Acked-by: Paolo Abeni --- net/mptcp/protocol.c | 4 ---- net/mptcp/protocol.h | 1 - 2 files changed, 5 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 2a525c7ae920..c0e0ee4cb24f 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1531,7 +1531,6 @@ static void mptcp_update_post_push(struct mptcp_sock = *msk, dfrag->already_sent +=3D sent; =20 msk->snd_burst -=3D sent; - msk->tx_pending_data -=3D sent; =20 snd_nxt_new +=3D dfrag->already_sent; =20 @@ -1761,7 +1760,6 @@ static int mptcp_sendmsg(struct sock *sk, struct msgh= dr *msg, size_t len) frag_truesize +=3D psize; pfrag->offset +=3D frag_truesize; WRITE_ONCE(msk->write_seq, msk->write_seq + psize); - msk->tx_pending_data +=3D psize; =20 /* charge data on mptcp pending queue to the msk socket * Note: we charge such data both to sk and ssk @@ -2254,7 +2252,6 @@ bool __mptcp_retransmit_pending_data(struct sock *sk) mptcp_data_unlock(sk); =20 msk->first_pending =3D rtx_head; - msk->tx_pending_data +=3D msk->snd_nxt - rtx_head->data_seq; msk->snd_burst =3D 0; =20 /* be sure to clear the "sent status" on all re-injected fragments */ @@ -2525,7 +2522,6 @@ static int __mptcp_init_sock(struct sock *sk) msk->first_pending =3D NULL; msk->wmem_reserved =3D 0; WRITE_ONCE(msk->rmem_released, 0); - msk->tx_pending_data =3D 0; msk->timer_ival =3D TCP_RTO_MIN; =20 msk->first =3D NULL; diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 99a23fff7b03..8416810afa8e 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -254,7 +254,6 @@ struct mptcp_sock { struct sk_buff *ooo_last_skb; struct rb_root out_of_order_queue; struct sk_buff_head receive_queue; - int tx_pending_data; struct list_head conn_list; struct list_head rtx_queue; struct mptcp_data_frag *first_pending; --=20 2.32.0 From nobody Sat Apr 20 10:34:01 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a02:1d48:0:0:0:0:0 with SMTP id 69csp2164037jaj; Sun, 5 Sep 2021 23:06:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKE8YkphV8/RwPIZY6hmORsiL41UjwpycNgxPo5A0oEV8OfK/CKZCLwJIpX5Yj7lWwnZqp X-Received: by 2002:a9d:730a:: with SMTP id e10mr9887765otk.120.1630908402699; Sun, 05 Sep 2021 23:06:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630908402; cv=none; d=google.com; s=arc-20160816; b=mfRjRFtvbk+JDSv3tcY3GaNQHa2L7JSTPYGhmVfYJLHuapTASD9f/vlYZ8bR6nqg4E 2k9Ha9r5ueUBYlCmxYr9H11jJ4ABc7fIjtzJY/6dtaBCNhoM5CPefA1Br+sx6t7eHF5r uO7GT2cSiCiqLVhvcwUfSQ8SQhUDS02Egf2HJqleGK9QiVuLhdanhqZsoSPejB1vHtVH JegUGXGSqzdtX1aDvCXXnbYoKq4thaTcWd4oAhMkR8BhKM0G26PU5YuQvWzlt4eDbXme NboZ9hBpLoKtRLEKDqjQySbmQhqgPUzC0t6jla5IOmjKIlei01jdaUxZjcXBZyscME7B Dgwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=dYHaxpDJcrkRE1cvz2WakwOZr0n/69JGJ7smE8AoG0c=; b=EW4aP6ZU/yahTheTRkf7JuGV/S3o8ukFr9LU1wNERnenyJ2rqCYpSPN3eT8wEB5NtO ar3XsGharqQmcCmSNH9t3RVMwqhwO1VVZ9SXXsunrpMpmIJywlM5bl2sjVNifNDSy3yi GU2/vb0wTfd4B4S+5B4HXiu4vovgSDpQV6hzcxBPdCXS7p1hSoUT2uLORfBNp52ppSzD SxI+9UjhXtIGfebPfpi+K/XDYeQW9v9TEpkZW2bVf4wMi75QiM9iKmLoXcsTmMIAwhck wnXhB0WtFkedcIFlkfdRPiWlo/cv3/TeJ251k1LkvBqws1rc047LXKFiUtRG5fJcbMp5 CEUw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of mptcp+bounces-1848-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.197.195 as permitted sender) smtp.mailfrom="mptcp+bounces-1848-wpasupplicant.patchew=gmail.com@lists.linux.dev" Return-Path: Received: from ewr.edge.kernel.org (ewr.edge.kernel.org. [147.75.197.195]) by mx.google.com with ESMTPS id c96si5165934otb.36.2021.09.05.23.06.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Sep 2021 23:06:42 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-1848-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.197.195 as permitted sender) client-ip=147.75.197.195; Authentication-Results: mx.google.com; spf=pass (google.com: domain of mptcp+bounces-1848-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.197.195 as permitted sender) smtp.mailfrom="mptcp+bounces-1848-wpasupplicant.patchew=gmail.com@lists.linux.dev" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ewr.edge.kernel.org (Postfix) with ESMTPS id BC4F21C0F2D for ; Mon, 6 Sep 2021 06:06:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 61AC82F80; Mon, 6 Sep 2021 06:06:39 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [193.142.43.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 407BD72 for ; Mon, 6 Sep 2021 06:06:38 +0000 (UTC) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1mN7m8-0008R7-Js; Mon, 06 Sep 2021 08:06:36 +0200 From: Florian Westphal To: Cc: Florian Westphal Subject: [mptcp-next 2/2] mptcp: re-set push-pending bit on retransmit failure Date: Mon, 6 Sep 2021 08:06:14 +0200 Message-Id: <20210906060614.25217-3-fw@strlen.de> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210906060614.25217-1-fw@strlen.de> References: <20210906060614.25217-1-fw@strlen.de> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The retransmit head will be NULL in case there is no in-flight data (meaning all data injected into network has been acked). In that case the retransmit timer is stopped. This is only correct if there is no more pending, not-yet-sent data. If there is, the retransmit timer needs to set the PENDING bit again so that mptcp tries to send the remaining (new) data once a subflow can accept more data. Also, mptcp_subflow_get_retrans() has to be called unconditionally. This function checks for subflows that have become unresponsive and marks them as stale, so in the case where the rtx queue is empty, subflows will never be marked stale which prevents available backup subflows from becoming eligible for transmit. Signed-off-by: Florian Westphal --- net/mptcp/protocol.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index c0e0ee4cb24f..b88a9b61025b 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1105,7 +1105,8 @@ static void __mptcp_clean_una(struct sock *sk) if (cleaned && tcp_under_memory_pressure(sk)) __mptcp_mem_reclaim_partial(sk); =20 - if (snd_una =3D=3D READ_ONCE(msk->snd_nxt) && !msk->recovery) { + if (snd_una =3D=3D READ_ONCE(msk->snd_nxt) && + snd_una =3D=3D READ_ONCE(msk->write_seq)) { if (mptcp_timer_pending(sk) && !mptcp_data_fin_enabled(msk)) mptcp_stop_timer(sk); } else { @@ -1547,6 +1548,13 @@ static void mptcp_update_post_push(struct mptcp_sock= *msk, msk->snd_nxt =3D snd_nxt_new; } =20 +static void mptcp_check_and_set_pending(struct sock *sk) +{ + if (mptcp_send_head(sk) && + !test_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->flags)) + set_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->flags); +} + void __mptcp_push_pending(struct sock *sk, unsigned int flags) { struct sock *prev_ssk =3D NULL, *ssk =3D NULL; @@ -1603,6 +1611,13 @@ void __mptcp_push_pending(struct sock *sk, unsigned = int flags) mptcp_push_release(sk, ssk, &info); =20 out: + /* Set PENDING again in case we found an ssk + * that could not accept more data + */ + if (unlikely(copied =3D=3D 0) && + READ_ONCE(msk->snd_una) =3D=3D msk->snd_nxt && ssk) + mptcp_check_and_set_pending(sk); + /* ensure the rtx timer is running */ if (!mptcp_timer_pending(sk)) mptcp_reset_timer(sk); @@ -2414,6 +2429,9 @@ static void __mptcp_retrans(struct sock *sk) int ret; =20 mptcp_clean_una_wakeup(sk); + + /* first check ssk: need to kick "stale" logic */ + ssk =3D mptcp_subflow_get_retrans(msk); dfrag =3D mptcp_rtx_head(sk); if (!dfrag) { if (mptcp_data_fin_enabled(msk)) { @@ -2426,10 +2444,12 @@ static void __mptcp_retrans(struct sock *sk) goto reset_timer; } =20 - return; + if (!mptcp_send_head(sk)) + return; + + goto reset_timer; } =20 - ssk =3D mptcp_subflow_get_retrans(msk); if (!ssk) goto reset_timer; =20 @@ -2456,6 +2476,8 @@ static void __mptcp_retrans(struct sock *sk) release_sock(ssk); =20 reset_timer: + mptcp_check_and_set_pending(sk); + if (!mptcp_timer_pending(sk)) mptcp_reset_timer(sk); } --=20 2.32.0