From nobody Mon Feb 9 00:26:33 2026 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:ac4:a898:0:b0:4b1:af33:c52d with SMTP id z24csp151205pid; Fri, 15 Apr 2022 07:48:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzoD3Gm6fg/BfQ7l7+eQf66jNH28L1y9YuT1QsEDjnrUe7Vr0YgKtX8L7Ca3vgt8Tx7cyUl X-Received: by 2002:a17:90b:804:b0:1cb:be2d:e28f with SMTP id bk4-20020a17090b080400b001cbbe2de28fmr4489938pjb.21.1650034138963; Fri, 15 Apr 2022 07:48:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650034138; cv=none; d=google.com; s=arc-20160816; b=k9Ok+4UKyDR0PxTlo7881tOeag/lAtdCPSvhrUgmj/OsXVxFLxLq/4rveYa9Lf3l7x UWXxSFZKhnsDc7Fp7nZ98PXQdLIkhG/H7o9Z9XYznYwZfnpo0cnz4+JQm1K7mt3E1aaZ yxfQiIyomFZS3mS8hWe3iNOYHKqpk5eGF1xJKEGUrim88FVFRU6jZGiPQZoIvBh1t7zw 8OqYtykR7yFQap2S3KRjmKprR6lNrgXLOPMnQ4Gj2X0KOtDSrVg6zHXkNkccW3PjddNR wEqy9K+rBxc6KgyIt0mG5qYYSgpU8s0NxFYA7rJ0XKdSYdC4JtmxDgTgw58P+1nUMNKr Qvnw== 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:to:from:dkim-signature; bh=m/C5vRfo1VsStdln5yeW2eFb/ydMicu19AcohD/e8BY=; b=ceigCdq8NHSvxAsvVX6SsVLYFPo0iJRq6zYZlzUbYUcwwZvttkZBbj9YkAvDE1k8R3 m1s5S73m+wk0rFizeK0rwQT2rNr6PFZSGDw3KINp2ILlhUlgWcQtau+GeY4BAqWLMa6E SeoPf+c9WM+/thw0M9CCN7h6ew8KfCZUXAAl4H9SA7Pc6kkqzK0kV9kDFoqrAEm2lUuq jujhPOnyVXyzTQyFqLbUQvOZR35qoZS4Xdf67vFddHvEGTncLQ9jzHCJiS9M966PHZOQ FFKEMVQACvoirySgBSybL7RYmLb48Tjch1iUet+t3P4xIfPb9N6Fxz8JUeAmXca34d45 0JyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=brqHhRd8; spf=pass (google.com: domain of mptcp+bounces-4754-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) smtp.mailfrom="mptcp+bounces-4754-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sjc.edge.kernel.org (sjc.edge.kernel.org. [2604:1380:1000:8100::1]) by mx.google.com with ESMTPS id d22-20020a056a00199600b004fa3a8dffc8si1731582pfl.127.2022.04.15.07.48.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Apr 2022 07:48:58 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-4754-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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=brqHhRd8; spf=pass (google.com: domain of mptcp+bounces-4754-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) smtp.mailfrom="mptcp+bounces-4754-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 8B6623E100D for ; Fri, 15 Apr 2022 14:48:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C0F65323F; Fri, 15 Apr 2022 14:48:56 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 474333219 for ; Fri, 15 Apr 2022 14:48:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650034134; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m/C5vRfo1VsStdln5yeW2eFb/ydMicu19AcohD/e8BY=; b=brqHhRd8fIOBA2VrsC98P80oK6uMzcyU+GVrhiRR1IPZ4x/TRm3vbSja44IshaTacAlBlM rVjKb00rpEJWs+mwZg6QHWyP0rRs+jZSSxGkW2aa4HdxYdudgmJsXs7xtOgR7ySB0UEGJl P7I0DJbkZrojYWLu3C1qBEZiy2pPVh4= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-556-J940wfZsO0aF_pvuoXGu4A-1; Fri, 15 Apr 2022 10:48:53 -0400 X-MC-Unique: J940wfZsO0aF_pvuoXGu4A-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C0BDB2A2AD40 for ; Fri, 15 Apr 2022 14:48:52 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.192.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5372C440AAA for ; Fri, 15 Apr 2022 14:48:52 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH net-next 1/5] mptcp: really share subflow snd_wnd Date: Fri, 15 Apr 2022 16:48:44 +0200 Message-Id: <9ff5db748641c59f3e6a7640824eddd03c1b3bdd.1650034062.git.pabeni@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pabeni@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8"; x-default="true" As per RFC, mptcp subflows use a "shared" snd_wnd: the effective window is the maximum among the current values received on all subflows. Without such feature a data transfer using multiple subflows could block. Window sharing is currently implemented in the RX side: __tcp_select_window uses the mptcp-level receive buffer to compute the announced window. That is not enough: the TCP stack will stick to the window size received on the given subflow; we need to propagate the msk window value on each subflow at xmit time. Change the packet scheduler to ignore the subflow level window and use instead the msk level one Signed-off-by: Paolo Abeni --- net/mptcp/protocol.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 093e084f3ac0..923fdb26214e 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1141,19 +1141,20 @@ struct mptcp_sendmsg_info { bool data_lock_held; }; =20 -static int mptcp_check_allowed_size(struct mptcp_sock *msk, u64 data_seq, - int avail_size) +static int mptcp_check_allowed_size(const struct mptcp_sock *msk, struct s= ock *ssk, + u64 data_seq, int avail_size) { u64 window_end =3D mptcp_wnd_end(msk); + u64 mptcp_snd_wnd; =20 if (__mptcp_check_fallback(msk)) return avail_size; =20 - if (!before64(data_seq + avail_size, window_end)) { - u64 allowed_size =3D window_end - data_seq; + mptcp_snd_wnd =3D window_end - data_seq; + avail_size =3D min_t(unsigned int, mptcp_snd_wnd, avail_size); =20 - return min_t(unsigned int, allowed_size, avail_size); - } + if (unlikely(tcp_sk(ssk)->snd_wnd < mptcp_snd_wnd)) + tcp_sk(ssk)->snd_wnd =3D min_t(u64, U32_MAX, mptcp_snd_wnd); =20 return avail_size; } @@ -1305,7 +1306,7 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct= sock *ssk, } =20 /* Zero window and all data acked? Probe. */ - copy =3D mptcp_check_allowed_size(msk, data_seq, copy); + copy =3D mptcp_check_allowed_size(msk, ssk, data_seq, copy); if (copy =3D=3D 0) { u64 snd_una =3D READ_ONCE(msk->snd_una); =20 @@ -1498,11 +1499,16 @@ static struct sock *mptcp_subflow_get_send(struct m= ptcp_sock *msk) * to check that subflow has a non empty cwin. */ ssk =3D send_info[SSK_MODE_ACTIVE].ssk; - if (!ssk || !sk_stream_memory_free(ssk) || !tcp_sk(ssk)->snd_wnd) + if (!ssk || !sk_stream_memory_free(ssk)) return NULL; =20 - burst =3D min_t(int, MPTCP_SEND_BURST_SIZE, tcp_sk(ssk)->snd_wnd); + burst =3D min_t(int, MPTCP_SEND_BURST_SIZE, mptcp_wnd_end(msk) - msk->snd= _nxt); wmem =3D READ_ONCE(ssk->sk_wmem_queued); + if (!burst) { + msk->last_snd =3D NULL; + return ssk; + } + subflow =3D mptcp_subflow_ctx(ssk); subflow->avg_pacing_rate =3D div_u64((u64)subflow->avg_pacing_rate * wmem= + READ_ONCE(ssk->sk_pacing_rate) * burst, --=20 2.35.1