From nobody Tue Apr 30 04:29:25 2024 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 From nobody Tue Apr 30 04:29:25 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:ac4:a898:0:b0:4b1:af33:c52d with SMTP id z24csp151215pid; Fri, 15 Apr 2022 07:49:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjmA9wfFekklTDfzf2wyWM9bwkrk5lGuPHpji2lLjEnVV8qPfkZ6jnpC9LzuOe6xTHTmFo X-Received: by 2002:a17:90a:14f:b0:1cb:55d9:42d9 with SMTP id z15-20020a17090a014f00b001cb55d942d9mr4694322pje.196.1650034140556; Fri, 15 Apr 2022 07:49:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650034140; cv=none; d=google.com; s=arc-20160816; b=VOUNkYK+4uZ7fOWsubyeXUx5Qcxrd242zb9zmMaj3gC33sCCHolqBU4vxO+IspF/X3 3CJLF8LAhJIZGrHTkbHx531baQKZXZaRxlSWZ2NGFWjVyy7VzaUkjq+O0O/370st4g6t 5GDatMWdTkZzg4MAPe+6rDYztruRVWJSjhO16aWEoddPgJK0+snlZ+QRCY8myjwi8rRl MgOfaz/dKm6QZ5kEoYCVk8E1J/QRd2yeAYSR3544FotUshiHaki2VEKkoHFV+hd97B50 yqrcioiGW6PqvngtezugH1M51rMTS8Dra+WP5R07hniuEa3Vlja/ZPdvCnfntptw8cuW xphw== 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=eWu5ly4kU5PF88dNdCsNwtXZJ1Y6GTrAWoGRS7VtE0A=; b=IbpZJxbcr3vaYvcDr0xwc9ymGCXHUvBKnnm3St55MInCanI+MFKgx+IAg2bFUkXsU1 z6jLtq1eePj8jcS/6apsf3S5CYptEDIh4/ptgMQuQ6wkYoGhPolbJjnUW912BCgmI3H3 j9uCP8WvbIIQPsvlBKqvTzlY25y6swsbwD9Kp2ku+W5S+x0cE53HF57DUEQnZknkuh0j 2iror7roRgzYJfhe3F/pnzKxRJnEsD4o+HjsWhmT4gz52PPmjc6uhcdUaWUXBR5mEc3k Dxg+2LazqOw4OBNEBm55hEyjDf5W9eEaBYvy+ijMQHr5NyQQQerl4ehelRb+aUZ8SZQU L3PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JebrXb7L; spf=pass (google.com: domain of mptcp+bounces-4755-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) smtp.mailfrom="mptcp+bounces-4755-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 s18-20020a17090aad9200b001cba0cee373si4327166pjq.37.2022.04.15.07.49.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Apr 2022 07:49:00 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-4755-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=JebrXb7L; spf=pass (google.com: domain of mptcp+bounces-4755-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) smtp.mailfrom="mptcp+bounces-4755-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 B5D563E0FB0 for ; Fri, 15 Apr 2022 14:48:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C512F33C0; Fri, 15 Apr 2022 14:48:57 +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 2CC18323C 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=1650034135; 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=eWu5ly4kU5PF88dNdCsNwtXZJ1Y6GTrAWoGRS7VtE0A=; b=JebrXb7LVwxX74qOCGpJevsawUlnqkRrlclSrKz5Whhf/uhGsgFb+AMR92r2+yNSSSK2LB yVzOUGu4siRlVNW4BEHWH8k1H6NvxKdxOUdjwGLWGIfVCXcAq9rYZQt9tFKLX4YtCLLyjn Z84agNA/B6lwiZG+J2JotGowi8rxg74= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-588-ZuwW-WhEPtCFnoo-BnntnA-1; Fri, 15 Apr 2022 10:48:53 -0400 X-MC-Unique: ZuwW-WhEPtCFnoo-BnntnA-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 762EB811E90 for ; Fri, 15 Apr 2022 14:48:53 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.192.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0DE4C440AAA for ; Fri, 15 Apr 2022 14:48:52 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH net-next 2/5] mptcp: add mib for xmit window sharing Date: Fri, 15 Apr 2022 16:48:45 +0200 Message-Id: <097fc6a50e7914b3a96d7f14cd680d006f242217.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" Bump a counter for counter when snd_wnd is shared among subflow, for observability's sake. Signed-off-by: Paolo Abeni --- net/mptcp/mib.c | 1 + net/mptcp/mib.h | 1 + net/mptcp/protocol.c | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/net/mptcp/mib.c b/net/mptcp/mib.c index d93a8c9996fd..6a6f8151375a 100644 --- a/net/mptcp/mib.c +++ b/net/mptcp/mib.c @@ -56,6 +56,7 @@ static const struct snmp_mib mptcp_snmp_list[] =3D { SNMP_MIB_ITEM("RcvPruned", MPTCP_MIB_RCVPRUNED), SNMP_MIB_ITEM("SubflowStale", MPTCP_MIB_SUBFLOWSTALE), SNMP_MIB_ITEM("SubflowRecover", MPTCP_MIB_SUBFLOWRECOVER), + SNMP_MIB_ITEM("SndWndShared", MPTCP_MIB_SNDWNDSHARED), SNMP_MIB_SENTINEL }; =20 diff --git a/net/mptcp/mib.h b/net/mptcp/mib.h index 529d07af9e14..2411510bef66 100644 --- a/net/mptcp/mib.h +++ b/net/mptcp/mib.h @@ -49,6 +49,7 @@ enum linux_mptcp_mib_field { MPTCP_MIB_RCVPRUNED, /* Incoming packet dropped due to memory limit */ MPTCP_MIB_SUBFLOWSTALE, /* Subflows entered 'stale' status */ MPTCP_MIB_SUBFLOWRECOVER, /* Subflows returned to active status after bei= ng stale */ + MPTCP_MIB_SNDWNDSHARED, /* Subflow snd wnd is overridden by msk's one */ __MPTCP_MIB_MAX }; =20 diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 923fdb26214e..8f159d535fed 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1153,8 +1153,10 @@ static int mptcp_check_allowed_size(const struct mpt= cp_sock *msk, struct sock *s mptcp_snd_wnd =3D window_end - data_seq; avail_size =3D min_t(unsigned int, mptcp_snd_wnd, avail_size); =20 - if (unlikely(tcp_sk(ssk)->snd_wnd < mptcp_snd_wnd)) + if (unlikely(tcp_sk(ssk)->snd_wnd < mptcp_snd_wnd)) { tcp_sk(ssk)->snd_wnd =3D min_t(u64, U32_MAX, mptcp_snd_wnd); + MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_SNDWNDSHARED); + } =20 return avail_size; } --=20 2.35.1 From nobody Tue Apr 30 04:29:25 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:ac4:a898:0:b0:4b1:af33:c52d with SMTP id z24csp151219pid; Fri, 15 Apr 2022 07:49:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwucRh+AZQkw3OmLWco52TjXhU29uzrgc7EIhkeb0BqzeQ+tY2M+Uqm4G2ARNIPiaXi89MD X-Received: by 2002:a63:b40a:0:b0:35e:d274:5f54 with SMTP id s10-20020a63b40a000000b0035ed2745f54mr6516972pgf.200.1650034141008; Fri, 15 Apr 2022 07:49:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650034141; cv=none; d=google.com; s=arc-20160816; b=af0963x7DRSwWTXY+Cd7zXORREO+iDMWidsedre82wVw9mgs+C2y/gZBPWWeqVdt1W rXdL9NTKb0MJY3KDLQX7miIFYvYCiwtQo9yj+379DUNtxq7VyuKHMsXFo93Aq6baUlaU uyzt1IFrjBuAmj5PKf43x8CmNZ5XiuFls7cIS/TGU7MVeQv+xeC9Nd9FVi+xCwNyOx78 Egfbapm/ZfsUI2kERg3fZzqRYf2jZbJtEY8/bOacqcwysa1gQgH1EXEG12WMQ/4k1Zxh ChG0Q++gVZ6OG59vIqlLTkHgZlTVWkbaJXQqRu5D7mhfWmX6bF1lsKkuALCDxTtEPrYc VXSw== 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=j+tJVbvo+kkJMqE/ElhT4/4BOkbVVmBFUczPDhUEgN8=; b=btkD0+omzbRccGs/5PpUu1gglbx+eAlzQmyP3iosPiBWCaNADArkPsqIq0uYX9oLEb 02LwMzyq4R5yWAqJOS6th5bD2hDRwjxCG7zCfvHmEtrtmE88YEC+YYyqk6CJVC0P7WnG pvXnXs2HTXJldRjKwgGK/c6bSNdwzViflTjaBTeAAkrcOZpc35biRG6khYJMLC7TGaKH J6CtXklh3cNfoaioEj+WknsOx2ojkFjjuegu4kKmodgCWPVCo1Wf60mM6RFtq+Yt02KG t5W/KpCx9dwHqjonK2Pb/QyLLOUoIpsUs4HDxff/VbJU3r8clJBMjIAYzUT5cpB2wMxH tIbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Il3Vdcqa; spf=pass (google.com: domain of mptcp+bounces-4756-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) smtp.mailfrom="mptcp+bounces-4756-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. [147.75.69.165]) by mx.google.com with ESMTPS id 3-20020a17090a030300b001cb7b5c9770si4208710pje.47.2022.04.15.07.49.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Apr 2022 07:49:01 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-4756-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) client-ip=147.75.69.165; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Il3Vdcqa; spf=pass (google.com: domain of mptcp+bounces-4756-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) smtp.mailfrom="mptcp+bounces-4756-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 C36293E1065 for ; Fri, 15 Apr 2022 14:49:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0DDD033C1; Fri, 15 Apr 2022 14:48:58 +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 989E1323E for ; Fri, 15 Apr 2022 14:48:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650034135; 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=j+tJVbvo+kkJMqE/ElhT4/4BOkbVVmBFUczPDhUEgN8=; b=Il3VdcqaCQvAyT2DRlu3heb7EAAbweqjXCFctA9bQAtm/0pkbeirnrBYUkjsiLfCT9qccH gEtwoq/bfCubr3MK2kznlWs5mEB9vGFvueskfzrSnYUlC5rOaKlZIwOmnWrPHEz7YHU2YO NRJv4EoB9AmxfHjKv1KNKEsayA90cPw= 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-564-RwycG8seOh-wut7E2FSfmg-1; Fri, 15 Apr 2022 10:48:54 -0400 X-MC-Unique: RwycG8seOh-wut7E2FSfmg-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 328292A2AD40 for ; Fri, 15 Apr 2022 14:48:54 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.192.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id B9F55440AAA for ; Fri, 15 Apr 2022 14:48:53 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH net-next 3/5] tcp: allow MPTCP to update the announced window. Date: Fri, 15 Apr 2022 16:48:46 +0200 Message-Id: <89b12b9c11c6b35fc507f96d198719394caf6b08.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" The MPTCP RFC requires that the MPTCP-level receive window's right edge never moves backward. Currently the MPTCP code enforces such constraint while tracking the right edge, but it does not reflects it back on the wire, as lacks a suitable hook to update accordingly the TCP header. This change modifiy the existing mptcp_write_options() hook, providing the current packet's TCP header up to the MPTCP protocol level, so that the next patch could implement the above mentioned constraint. No functional changes intended. Signed-off-by: Paolo Abeni --- include/net/mptcp.h | 2 +- net/ipv4/tcp_output.c | 13 +++++++------ net/mptcp/options.c | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/include/net/mptcp.h b/include/net/mptcp.h index 877077b53200..6b07011c060d 100644 --- a/include/net/mptcp.h +++ b/include/net/mptcp.h @@ -125,7 +125,7 @@ bool mptcp_established_options(struct sock *sk, struct = sk_buff *skb, struct mptcp_out_options *opts); bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb); =20 -void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp, +void mptcp_write_options(struct tcphdr *th, __be32 *ptr, struct tcp_sock *= tp, struct mptcp_out_options *opts); =20 void mptcp_diag_fill_info(struct mptcp_sock *msk, struct mptcp_info *info); diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index c221f3bce975..27deec41a1f4 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -444,12 +444,13 @@ struct tcp_out_options { struct mptcp_out_options mptcp; }; =20 -static void mptcp_options_write(__be32 *ptr, const struct tcp_sock *tp, +static void mptcp_options_write(struct tcphdr *th, __be32 *ptr, + struct tcp_sock *tp, struct tcp_out_options *opts) { #if IS_ENABLED(CONFIG_MPTCP) if (unlikely(OPTION_MPTCP & opts->options)) - mptcp_write_options(ptr, tp, &opts->mptcp); + mptcp_write_options(th, ptr, tp, &opts->mptcp); #endif } =20 @@ -605,7 +606,7 @@ static void bpf_skops_write_hdr_opt(struct sock *sk, st= ruct sk_buff *skb, * At least SACK_PERM as the first option is known to lead to a disaster * (but it may well be that other scenarios fail similarly). */ -static void tcp_options_write(__be32 *ptr, struct tcp_sock *tp, +static void tcp_options_write(struct tcphdr *th, __be32 *ptr, struct tcp_s= ock *tp, struct tcp_out_options *opts) { u16 options =3D opts->options; /* mungable copy */ @@ -701,7 +702,7 @@ static void tcp_options_write(__be32 *ptr, struct tcp_s= ock *tp, =20 smc_options_write(ptr, &options); =20 - mptcp_options_write(ptr, tp, opts); + mptcp_options_write(th, ptr, tp, opts); } =20 static void smc_set_option(const struct tcp_sock *tp, @@ -1354,7 +1355,7 @@ static int __tcp_transmit_skb(struct sock *sk, struct= sk_buff *skb, th->window =3D htons(min(tp->rcv_wnd, 65535U)); } =20 - tcp_options_write((__be32 *)(th + 1), tp, &opts); + tcp_options_write(th, (__be32 *)(th + 1), tp, &opts); =20 #ifdef CONFIG_TCP_MD5SIG /* Calculate the MD5 hash, as we have all we need now */ @@ -3590,7 +3591,7 @@ struct sk_buff *tcp_make_synack(const struct sock *sk= , struct dst_entry *dst, =20 /* RFC1323: The window in SYN & SYN/ACK segments is never scaled. */ th->window =3D htons(min(req->rsk_rcv_wnd, 65535U)); - tcp_options_write((__be32 *)(th + 1), NULL, &opts); + tcp_options_write(th, (__be32 *)(th + 1), NULL, &opts); th->doff =3D (tcp_header_size >> 2); __TCP_INC_STATS(sock_net(sk), TCP_MIB_OUTSEGS); =20 diff --git a/net/mptcp/options.c b/net/mptcp/options.c index e05d9458a025..2570911735ab 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -1265,7 +1265,7 @@ static u16 mptcp_make_csum(const struct mptcp_ext *mp= ext) ~csum_unfold(mpext->csum)); } =20 -void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp, +void mptcp_write_options(struct tcphdr *th, __be32 *ptr, struct tcp_sock *= tp, struct mptcp_out_options *opts) { const struct sock *ssk =3D (const struct sock *)tp; --=20 2.35.1 From nobody Tue Apr 30 04:29:25 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:ac4:a898:0:b0:4b1:af33:c52d with SMTP id z24csp151225pid; Fri, 15 Apr 2022 07:49:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAOJbKyRtlh/kN2p6dGMQLVfp1pBVc8b4J5rhsbQvVVKwovbnuE/NH2ooCpKhSX+nBlFZv X-Received: by 2002:a17:902:f652:b0:156:701b:9a2a with SMTP id m18-20020a170902f65200b00156701b9a2amr52325324plg.14.1650034142499; Fri, 15 Apr 2022 07:49:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650034142; cv=none; d=google.com; s=arc-20160816; b=AJa3Np3ZeiC1S/XBcv+JpXv+gq+gfSQWFq2XdXTUJdgMSrkfaSzhfFk1BpgyU2thjI nFuoW51MKZxAuwvr7ukLH/rY9jJ2KcZQpKIx2edKbGPttbgrm8SqQYQyiYVCrHJCCQQQ TLi7Gsn04RzKSzFoeCJF4JQk91v3Zql0XkdLlkAft9djBiq+jbzc/VbqaXrcgfNgMXuh AcfqTw7Dqf8eqkKYpjQrNddFvD89vrPw5SAdvtGW+PwhwZUjcSAj2aqStozs4WccdZp+ bXMrJo5FbxKx6WEao5g6T9hFJoKR26vHlEwjYAUoV+pN5m92aSPs8A83njrUw5WRroME L+pQ== 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=4q6a8Ba/GBB79FFNp0RO7VsjOTxSqLP9r8njkXrQUSY=; b=BzEfIsnTlyGrG14S7yWIxrBtlvKlMCohXMPQG6Hpj4u5W+ZFytbOXCxfrTvBYHVfd2 CLq9HfCjrE0uWzNHIbD8TAaU3GVB76HRpDJmh7tWaj/V//oXynbRf3KbrlgqSbJZzDjj 1qdXscRbrMx/8I/9xPHVUX0sdqQ8d6LzYsbB9ZFUYHHanOBj8Vc6BztKCBH0ttmRFkrd J/Sj0ScuPxWVDwtEXvLXPOtLVit0UocW+BW4jHZJrnu+sNiMZBtBH+hIHh4qhUtTN/Ag pAyaf6sAXnKqd6o4z/A1dp/LjK+8T9e+5GK/NN1Zj0hWWBEuZMwOCEzQWKETA+3M9XGU JZ7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RgUbkklv; spf=pass (google.com: domain of mptcp+bounces-4757-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) smtp.mailfrom="mptcp+bounces-4757-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 b1-20020a056a00114100b004fa3a8e005dsi1667219pfm.276.2022.04.15.07.49.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Apr 2022 07:49:02 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-4757-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=RgUbkklv; spf=pass (google.com: domain of mptcp+bounces-4757-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) smtp.mailfrom="mptcp+bounces-4757-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 DEBAF3E108A for ; Fri, 15 Apr 2022 14:49:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F18A833C4; Fri, 15 Apr 2022 14:48:58 +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 813513219 for ; Fri, 15 Apr 2022 14:48:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650034136; 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=4q6a8Ba/GBB79FFNp0RO7VsjOTxSqLP9r8njkXrQUSY=; b=RgUbkklviqzJTUHOc5gkRK/SJXUYhkr6zYPOda8oHvjMYCZE7UJOri0iWTE/DviY/lsatL dKK1KkJNkRWDw91+j/LTfEqvD89zmxCFosfH64tM4ARn6TjjWROZscS+CECirU/gVsbKN8 FuI5GFkFAhp3oc35JbvdnzebdNK2ol0= 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-578-VNUdmJgWNXCVCN9lKPcG1g-1; Fri, 15 Apr 2022 10:48:55 -0400 X-MC-Unique: VNUdmJgWNXCVCN9lKPcG1g-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 E98951C05158 for ; Fri, 15 Apr 2022 14:48:54 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.192.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F3C5440AAA for ; Fri, 15 Apr 2022 14:48:54 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH net-next 4/5] mptcp: never shrink offered window Date: Fri, 15 Apr 2022 16:48:47 +0200 Message-Id: <1f9262fde4d50db2d9d5c46254b823fd3e451465.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, the offered MPTCP-level window should never shrink. While we currently track the right edge, we don't enforce the above constraint on the wire. Additionally, concurrent xmit on different subflows can end-up in erroneous right edge update. Address the above explicitly updating the announced window and protecting the update with an additional atomic operation (sic) Signed-off-by: Paolo Abeni --- RFC -> v1: - rebased on previous patch --- net/mptcp/options.c | 52 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index 2570911735ab..9c76a171af1e 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -1224,20 +1224,58 @@ bool mptcp_incoming_options(struct sock *sk, struct= sk_buff *skb) return true; } =20 -static void mptcp_set_rwin(const struct tcp_sock *tp) +static void mptcp_set_rwin(struct tcp_sock *tp, struct tcphdr *th) { const struct sock *ssk =3D (const struct sock *)tp; - const struct mptcp_subflow_context *subflow; + struct mptcp_subflow_context *subflow; + u64 ack_seq, rcv_wnd_old, rcv_wnd_new; struct mptcp_sock *msk; - u64 ack_seq; + u32 new_win; + u64 win; =20 subflow =3D mptcp_subflow_ctx(ssk); msk =3D mptcp_sk(subflow->conn); =20 - ack_seq =3D READ_ONCE(msk->ack_seq) + tp->rcv_wnd; + ack_seq =3D READ_ONCE(msk->ack_seq); + rcv_wnd_new =3D ack_seq + tp->rcv_wnd; + + rcv_wnd_old =3D READ_ONCE(msk->rcv_wnd_sent); + if (after64(rcv_wnd_new, rcv_wnd_old)) { + u64 rcv_wnd; + + for (;;) { + rcv_wnd =3D cmpxchg64(&msk->rcv_wnd_sent, rcv_wnd_old, rcv_wnd_new); + + if (rcv_wnd =3D=3D rcv_wnd_old) + break; + if (before64(rcv_wnd_new, rcv_wnd)) + goto raise_win; + rcv_wnd_old =3D rcv_wnd; + }; + return; + } + + if (rcv_wnd_new !=3D rcv_wnd_old) { +raise_win: + win =3D rcv_wnd_old - ack_seq; + tp->rcv_wnd =3D min_t(u64, win, U32_MAX); + new_win =3D tp->rcv_wnd; =20 - if (after64(ack_seq, READ_ONCE(msk->rcv_wnd_sent))) - WRITE_ONCE(msk->rcv_wnd_sent, ack_seq); + /* Make sure we do not exceed the maximum possible + * scaled window. + */ + if (unlikely(th->syn)) + new_win =3D min(new_win, 65535U) << tp->rx_opt.rcv_wscale; + if (!tp->rx_opt.rcv_wscale && + sock_net(ssk)->ipv4.sysctl_tcp_workaround_signed_windows) + new_win =3D min(new_win, MAX_TCP_WINDOW); + else + new_win =3D min(new_win, (65535U << tp->rx_opt.rcv_wscale)); + + /* RFC1323 scaling applied */ + new_win >>=3D tp->rx_opt.rcv_wscale; + th->window =3D htons(new_win); + } } =20 u16 __mptcp_make_csum(u64 data_seq, u32 subflow_seq, u16 data_len, __wsum = sum) @@ -1554,7 +1592,7 @@ void mptcp_write_options(struct tcphdr *th, __be32 *p= tr, struct tcp_sock *tp, } =20 if (tp) - mptcp_set_rwin(tp); + mptcp_set_rwin(tp, th); } =20 __be32 mptcp_get_reset_option(const struct sk_buff *skb) --=20 2.35.1 From nobody Tue Apr 30 04:29:25 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:ac4:a898:0:b0:4b1:af33:c52d with SMTP id z24csp151235pid; Fri, 15 Apr 2022 07:49:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzsA9ewIF8H26571v4wCscQYPwTarsQ1SvDKx2ov+Rz5JIvwX/0tAr6ZG8mTu6IjnTpML9 X-Received: by 2002:a05:622a:1f0c:b0:2ed:1211:364 with SMTP id ca12-20020a05622a1f0c00b002ed12110364mr5524485qtb.390.1650034143703; Fri, 15 Apr 2022 07:49:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650034143; cv=none; d=google.com; s=arc-20160816; b=i/XWbZBgUJH4L8+ufqIfpyTYKuCBErVccWEt3MYQA9/gC0Mt3MpdxskJOKx62yraQg c222isdAJaF2hDHBChTcBIIqq0CEHc43rOjxhepJTd4Pdyw6rHDEFNbSRbfKh3J9zmd6 bNv+mBFVwIonfcN6BsQRJ8tKn+MA5WzQ580dUtsS0vFUyOiFOX7LEkVvKvvo3RbV0db0 mGxw9VBeb45orKvFi1Xeb6Y2+oZqqmmX7J92VN/8ohSPCa4Y6EyqpN/bg7q8XK/4eqCy RHCahPvAYrlayYh0Iu+bYnrr4zjSnz+ES0hv7rJmgvdriIW5cdNZRWoj1B8evdVF9jP7 yx2g== 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=oErkHFvEncO7PQBlF7qExGGFgc38OhMtDhkX/b7xgEo=; b=DkqYWQAsNj/fUaDaJXLdonom9V/vo53RSCSbEEemi2RwdNIC4xSQJbILe53dV171ht as2yJJWpwU0SM4IIZJ4rZgS9XcNz/LTPJmArgL1vjHnKKuDLZ6bBIOhwBJH7ICIdyJdv K2f63uQCMmsGlSokree+tKsFRy0Hib1IevF8Ya58D595k7AB3OzvmtwRA/Kmb+8hhjxg AA6j5y4TLe22l8Ff7Te7iDHcTly1xkClHSznFzCYqS1a9ymI0QRCCYcmwJufZw4bHyno zkr/QKolCJSumkUUEDslyj6YiYMq3fL6zgBevAF70ueFo1hSHMU1ZsV8M04hJ7rGdGTw f8Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NKjrsqbK; spf=pass (google.com: domain of mptcp+bounces-4758-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) smtp.mailfrom="mptcp+bounces-4758-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ewr.edge.kernel.org (ewr.edge.kernel.org. [2604:1380:1:3600::1]) by mx.google.com with ESMTPS id gw12-20020a0562140f0c00b00444515042b7si595305qvb.309.2022.04.15.07.49.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Apr 2022 07:49:03 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-4758-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) client-ip=2604:1380:1:3600::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NKjrsqbK; spf=pass (google.com: domain of mptcp+bounces-4758-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) smtp.mailfrom="mptcp+bounces-4758-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 ewr.edge.kernel.org (Postfix) with ESMTPS id 62F971C0F2C for ; Fri, 15 Apr 2022 14:49:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6B5C033C5; Fri, 15 Apr 2022 14:48:59 +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 12E0C33C2 for ; Fri, 15 Apr 2022 14:48:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650034137; 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=oErkHFvEncO7PQBlF7qExGGFgc38OhMtDhkX/b7xgEo=; b=NKjrsqbK03BH/Tmih4axgPEOVgPKSizX650nHtOfwix5QvFn8XcFfeaIoSEUwPdrxzAWfJ eqaEYeW/Zkf1dy6HkMYCW4uZsG9JY/k1+un5c55kLv45SY+EXjkoqzQFhN0GBUCfmFDN4O /CEC3+EBl0KlJoBc+Npae+m17yT4Ke0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-590-oYUkKz0AM6uGdPZyFKP-vA-1; Fri, 15 Apr 2022 10:48:55 -0400 X-MC-Unique: oYUkKz0AM6uGdPZyFKP-vA-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 9F0D9802803 for ; Fri, 15 Apr 2022 14:48:55 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.192.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id 36B7B440AAA for ; Fri, 15 Apr 2022 14:48:55 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH net-next 5/5] mptcp: add more offered MIBs counter. Date: Fri, 15 Apr 2022 16:48:48 +0200 Message-Id: <43cbe1db36c118468bc6e88ced16079d05f30643.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" Track the exceptional handling of MPTCP-level offered window with a few more counters for observability. Signed-off-by: Paolo Abeni --- net/mptcp/mib.c | 3 +++ net/mptcp/mib.h | 5 +++++ net/mptcp/options.c | 6 +++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/net/mptcp/mib.c b/net/mptcp/mib.c index 6a6f8151375a..0dac2863c6e1 100644 --- a/net/mptcp/mib.c +++ b/net/mptcp/mib.c @@ -57,6 +57,9 @@ static const struct snmp_mib mptcp_snmp_list[] =3D { SNMP_MIB_ITEM("SubflowStale", MPTCP_MIB_SUBFLOWSTALE), SNMP_MIB_ITEM("SubflowRecover", MPTCP_MIB_SUBFLOWRECOVER), SNMP_MIB_ITEM("SndWndShared", MPTCP_MIB_SNDWNDSHARED), + SNMP_MIB_ITEM("RcvWndShared", MPTCP_MIB_RCVWNDSHARED), + SNMP_MIB_ITEM("RcvWndConflictUpdate", MPTCP_MIB_RCVWNDCONFLICTUPDATE), + SNMP_MIB_ITEM("RcvWndConflict", MPTCP_MIB_RCVWNDCONFLICT), SNMP_MIB_SENTINEL }; =20 diff --git a/net/mptcp/mib.h b/net/mptcp/mib.h index 2411510bef66..2be3596374f4 100644 --- a/net/mptcp/mib.h +++ b/net/mptcp/mib.h @@ -50,6 +50,11 @@ enum linux_mptcp_mib_field { MPTCP_MIB_SUBFLOWSTALE, /* Subflows entered 'stale' status */ MPTCP_MIB_SUBFLOWRECOVER, /* Subflows returned to active status after bei= ng stale */ MPTCP_MIB_SNDWNDSHARED, /* Subflow snd wnd is overridden by msk's one */ + MPTCP_MIB_RCVWNDSHARED, /* Subflow rcv wnd is overridden by msk's one */ + MPTCP_MIB_RCVWNDCONFLICTUPDATE, /* subflow rcv wnd is overridden by msk's= one due to + * conflict with another subflow while updating msk rcv wnd + */ + MPTCP_MIB_RCVWNDCONFLICT, /* Conflict with while updating msk rcv wnd */ __MPTCP_MIB_MAX }; =20 diff --git a/net/mptcp/options.c b/net/mptcp/options.c index 9c76a171af1e..559ff6ca6e66 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -1248,8 +1248,11 @@ static void mptcp_set_rwin(struct tcp_sock *tp, stru= ct tcphdr *th) =20 if (rcv_wnd =3D=3D rcv_wnd_old) break; - if (before64(rcv_wnd_new, rcv_wnd)) + if (before64(rcv_wnd_new, rcv_wnd)) { + MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_RCVWNDCONFLICTUPDATE); goto raise_win; + } + MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_RCVWNDCONFLICT); rcv_wnd_old =3D rcv_wnd; }; return; @@ -1275,6 +1278,7 @@ static void mptcp_set_rwin(struct tcp_sock *tp, struc= t tcphdr *th) /* RFC1323 scaling applied */ new_win >>=3D tp->rx_opt.rcv_wscale; th->window =3D htons(new_win); + MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_RCVWNDSHARED); } } =20 --=20 2.35.1