From patchwork Fri Mar 24 17:11:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 74643 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp791952vqo; Fri, 24 Mar 2023 10:24:52 -0700 (PDT) X-Google-Smtp-Source: AKy350ZHXPMhXtwUvQhdgM36n2PQJotK3IF4WSQ6ZlhPZXAJh2/m9yLscMlcGQqYvoQcqgvtqAj7 X-Received: by 2002:a17:90b:1b46:b0:237:5834:294b with SMTP id nv6-20020a17090b1b4600b002375834294bmr3477356pjb.41.1679678692706; Fri, 24 Mar 2023 10:24:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679678692; cv=none; d=google.com; s=arc-20160816; b=XEYplUSJZBob7+O1eJxum/hCjLIaQQehLw6RzQhyzb84Ma4o6WZkilA1nq9MJ68zvP i++ez1PEbclOfxFs8HV2IwBIy8IT8NZjFhGndEVbhkM88aWX28XxCpxoRX5/f2NejX2K NqWszoJ2DiWAglO3yF6ojdRtZcXngQwcXtGuZEgCXAhbfATzrTPp58CSEtaFs3z0ukPl +4mvLeIBysWsCqdIfGTdRkZ+D693GVk7C7kkY8VNKWU/GjM9VFSOCMVaLKR76WB1rmZm BAbrnf0U9Vlf85i35KK43l8klo28pT+PAMaKC/OWh7tVTHcOiTirYcT4vzc65KmhuUd3 hNeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=SWubI3gP1geg1ucxdfNQCa8sYMENfAIXdm+9lJqXCzI=; b=aRuorZfe8HQFInj93b3liL3O8MFWPIwSMVRx4xHDWa9+VkmuQAeMXyjEsOpMt+uFXU eLNHB8no3gijTnesqLFmfgZIVIU8txm5jN5z2hFmzYyAzI+8bxQw1tpYgLXUNbAbb6Ie TPnLKivKeW4SOy5TazYszd/TjazM3pedkmSIjEyeNGLLzizdH2gFtIwTt8TKwj7nFKUS E/de+k5lU4St37GJjsTj1qxWHvKewLCCvbnn0xhLLm7u0GOxP5G3h0GEAGdCxMLAuqPW 15JuWlAXA27WlYAYI3AG5hKL9IndJ4hnsqyktOmNofAwiTGX/tKUnFUAJaA8k9dLtZjg cRww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=1LYEdnpy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=tessares.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d15-20020a17090ab30f00b00234b0c3e853si242677pjr.93.2023.03.24.10.24.39; Fri, 24 Mar 2023 10:24:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=1LYEdnpy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=tessares.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232087AbjCXRML (ORCPT + 99 others); Fri, 24 Mar 2023 13:12:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231721AbjCXRMG (ORCPT ); Fri, 24 Mar 2023 13:12:06 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B95412194E for ; Fri, 24 Mar 2023 10:12:04 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id v20-20020a05600c471400b003ed8826253aso3205154wmo.0 for ; Fri, 24 Mar 2023 10:12:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; t=1679677923; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=SWubI3gP1geg1ucxdfNQCa8sYMENfAIXdm+9lJqXCzI=; b=1LYEdnpyKt13LPHR0Js0qUP5t+OnGaFyqRaMxeViU3Kq5CTMOkpOK/00hnCs8YmT4L AqDhULy4Eu8SUxOl9PGB8dHuSHy3sZl8IFh2AHX6H2kBU11CfgLChoJEIxEkWirBMu5D wbPa374Qaw8AFfWmcA42AGfJqsziQsQVyJvVAMqrlY7wS+f7w6l+3KM4pogNgrydT62o u3CIt1jUwD9M06OqsrGHJVFN2mM3sFSPmfGteXD/86O/YSYYyRuvM8RoyK/W3y22eMKZ 7RYGHzrF0poDr8u7gSXl3mvWxMzgY6xPkXRNQsgqSq2+2u/lYVrNsM7xREPzUuHfR9J9 XzSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679677923; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SWubI3gP1geg1ucxdfNQCa8sYMENfAIXdm+9lJqXCzI=; b=xu+ayljd9BZ58WroHVHlh0Lact7+mlzF3jG9AkIVse/yzgvZEpwgYn9cm0yli+yRzi 0hGUkO5E/YqE3w7YmNES7wCB5zh2KIft0xelZt2QsC9ma75ygVc/P567u6FBeroZ70hy AWo4bVNbGcYsJySRg1SjxtS0TrApHv8/qrU9qFAefhGmeTpN1z8OOCU0KeKDGATfuqPp P6XBZeBzq8ysJ3MaYATZYi+XTgMlzf18wdfQLLG4q2eTnFFSargVg1+mMfhbN9bBrsm/ SE/NXZstH4HImvUK/5bk5uzISp7CBPLLSGHA0fkVWXfCXOBpxlYRRSJ0jnvwuQCFc5x/ v0oA== X-Gm-Message-State: AO0yUKWCry5BkrPQgqB7T+HIaEXpcePrZSzHdkWvskxo9OuW93HhQQCh eNwZTfgDJhcTRNv/w1keJoI7ww== X-Received: by 2002:a05:600c:d9:b0:3ed:46e2:85fb with SMTP id u25-20020a05600c00d900b003ed46e285fbmr2915358wmm.33.1679677923137; Fri, 24 Mar 2023 10:12:03 -0700 (PDT) Received: from vdi08.nix.tessares.net (static.219.156.76.144.clients.your-server.de. [144.76.156.219]) by smtp.gmail.com with ESMTPSA id n17-20020a1c7211000000b003edf2dc7ca3sm5336285wmc.34.2023.03.24.10.12.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Mar 2023 10:12:02 -0700 (PDT) From: Matthieu Baerts Date: Fri, 24 Mar 2023 18:11:30 +0100 Subject: [PATCH net-next 1/4] mptcp: avoid unneeded address copy MIME-Version: 1.0 Message-Id: <20230324-upstream-net-next-20230324-misc-features-v1-1-5a29154592bd@tessares.net> References: <20230324-upstream-net-next-20230324-misc-features-v1-0-5a29154592bd@tessares.net> In-Reply-To: <20230324-upstream-net-next-20230324-misc-features-v1-0-5a29154592bd@tessares.net> To: mptcp@lists.linux.dev, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Matthieu Baerts X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=740; i=matthieu.baerts@tessares.net; h=from:subject:message-id; bh=So4mzRtrXIJRD2ZN6IwFIBWGw9rUyByeoDq6UPFlPB8=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBkHdnhUE6bujCgMc7JoONVNk9QEbRSg69X5Zw2U MLvfYdnBWOJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZB3Z4QAKCRD2t4JPQmmg c4AgD/sHGKIbvtwQeGEX+uDffWu8d2299L7UjnsA2GofJy3mNHrGy6qTZv7SyNMvUxgne6rLjuV VQ+ErPrh7GxNKGZrcDZupDgsWG37g00b8d9LNJ7Ah+mbv6Q9jhK+6adtPfTsyLcXYmhcASzSTUq G6+LbH97tCsRgnnDm5XU8YpU0LwBkkO6wqVmGC2nIeQ08BrqZdFz2rV1TNCAm5vydQJp8vUQc31 /a+EIpIyJNs2o15vrLkY86IU5y8Cc6uUnSBLMJeBv4sxO5s6pK5EX1agdMtKHVI2UgjdspQolxu utE6+WSenn2cMCFU2rDsMPIQPKbomy22hLWYqXLJsecwgFrJ32rYDFeVb0DQ8WYnVP2pvhOxWA3 xpuMf60+Uerl4Y3eZtqGja5C7SPYJBBX/UPKHJzmF+UGLDSUzQWcKrqININyfltivPl9x55VpLd jKnx4XF1YFr8qRHwyn+Gl0Js1SL+EQVJ+hMXgWKgWN1qm5ZIXgdYpVsv24Q/gTRqB5BYlR2+Pyd zC0wjSQaL3qiTAy4EahAlbXgvF4S+GzxHP+7vrF6SSsS6EYuaQ7BMUA0dKA7Y0/FjIWz3tq7Zfj J0zyVdVdFv+hOSmi3UaX7+h4lzzJb/8v4Df/qjf0Yb2ZU1JUNhlYTn4rTfPvThbwBpXe2vx1xrt V9wRVwhZL4Rtamg== X-Developer-Key: i=matthieu.baerts@tessares.net; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761270764692116259?= X-GMAIL-MSGID: =?utf-8?q?1761270764692116259?= From: Paolo Abeni In the syn_recv fallback path, the msk is unused. We can skip setting the socket address. Signed-off-by: Paolo Abeni Reviewed-by: Matthieu Baerts Signed-off-by: Matthieu Baerts --- net/mptcp/subflow.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index dadaf85db720..a11f4c525e01 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -821,8 +821,6 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk, goto dispose_child; } - if (new_msk) - mptcp_copy_inaddrs(new_msk, child); mptcp_subflow_drop_ctx(child); goto out; } From patchwork Fri Mar 24 17:11:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 74654 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp795520vqo; Fri, 24 Mar 2023 10:30:20 -0700 (PDT) X-Google-Smtp-Source: AKy350b4nq/g19B4yKvdkolxZnleFZDs9Bs0TpG5b+xrgBvgLmgInNHZpvzXrO9jdWyzzSif7csp X-Received: by 2002:a17:902:f203:b0:1a0:67fb:445c with SMTP id m3-20020a170902f20300b001a067fb445cmr2499978plc.28.1679679020092; Fri, 24 Mar 2023 10:30:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679679020; cv=none; d=google.com; s=arc-20160816; b=dGMYLjlUzfY5oJQleEsfrbmEDzpLkuXZw//pGDSXVjsChYkuqp5VIq6StsddXYtZUc BaNmH7+FB21U3iE6t7FsiGqg2Li4uktSrVI/D3oQpsri7ATVSfz2qwiUacYYcPzYvgtc 7DO5DMhSulumc1Ao5t+aRcQroEJDKZX52mOZ64cobdH5izi63yVuSD+cMtGR0qL4Y4ou k+jt8xNbVuJiFKDXGhrIpQIhqyc+YFD5vXU8oVh2cLHJe50zYlzaOfQDrpuZ+DmYiFfv wCJngh7RGRW7JVuzxT5FczWzm44pLwXwovsNyMcYUsHX4HT/lSoUJO7+a+rmmp113t50 N6nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=DfQGO7HiqyLcIeH5zAb3xpz7XHJxCFOLCtkr4OjpBrA=; b=DRGO8IiJ8AyfWTfivvQDR7pWpve32oMY7XtiNhPUMucekDfrowWyuSCuT60I4elzkE BIQrrKgfQXDpxVVft6fhYwiB+WCQzvGV31aaniEEMqSq+J3/RFxXqjVbRqy2J3O6Snhj PZ6DSkasZ8E3ujrZNqkRGT4IVtvXpjn2LWBaLOwmsut8MvutUdkmEAw09mzJHthU4HWO jyQBthyrOfMJK0GFhPX8C/s6u+kq4+/RxJg3mP/dDMDRkXvYt15fN9gEBZvPDBYRhEmJ ijugI+G47QnRrO+5yLnpMHLwVHuyfW1gq0HL3MN53QDn/RUFSo4cCQkqVTk6vsIHVcS1 DhIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=kKcSWMFo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=tessares.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g21-20020a170902d1d500b0019aa6450ff3si20017515plb.585.2023.03.24.10.30.07; Fri, 24 Mar 2023 10:30:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=kKcSWMFo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=tessares.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231838AbjCXRMO (ORCPT + 99 others); Fri, 24 Mar 2023 13:12:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232025AbjCXRMH (ORCPT ); Fri, 24 Mar 2023 13:12:07 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87F0921942 for ; Fri, 24 Mar 2023 10:12:05 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id n19so1577374wms.0 for ; Fri, 24 Mar 2023 10:12:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; t=1679677924; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=DfQGO7HiqyLcIeH5zAb3xpz7XHJxCFOLCtkr4OjpBrA=; b=kKcSWMFoxwby6OrPI6KELDITY73iVQMqwa0lfgDhsmjI/9A+9FwCjhlhdlOXJMpJnC aMGepOrv+MaYS5YrJ/g6i+kkoNY13J18hVzRUgnoZJkVM5LQLGfwHSalEK5fWveEmfBH tkpxU2ymfum5OzOxXNZ3O/auWacVlFPHHXzgWwBdb+1hzJ9sBdvdNtIpRmBKCSu4XDYU O5dcVkMMCoRKEyDj3T658tQajxqzcp6IXdLsQWgWPjR/QIxjZ2o4HTkOGBh/GMY+QlpB siZzOl8PatNHYscJmNXNjGH1Y393we6Z4jx/agYGWE+UZXD5lnowVUoDkuX4PHClzM44 feOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679677924; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DfQGO7HiqyLcIeH5zAb3xpz7XHJxCFOLCtkr4OjpBrA=; b=i6Nfi9HRClEvjPXjK2PGw/9bF1R4m5vhGP5xwPUtFk2u+wV2Qv1cHR6AEL0/BwC8vr FJKBNLljDtI4SZlFQoRri8QV91Mz46hn8MNgg+f9ZUaJ8AHhSnEdMRSXIsacbvoG4UWf 8lLAu/KZ1UcxjLLQLTAQYGdUe33KUaZTTgeG7gcG7fBHs/tdIru/fr8M7jktxFcusNqc +yz+7AzvwxSYdNal+pgRU2PqNC6n8VFx2xkHK8KZI079iZmsHIhJBLyzkMkoOg5wdv0+ hDCvudjUrKqw8b8VssPsv+yNk6rGlfbimWK+YsD2qarhDVjGmWUPpF9TsO+Q0nFvi1hD uCIA== X-Gm-Message-State: AO0yUKUQMNVkvhaepw8GgB62GQUdWOo07m7I0YUgLPfT3jjgLZT7JL+C ZP1MV4Q8cAQwQa5YgPBw27Qm2g== X-Received: by 2002:a7b:c84e:0:b0:3db:8de:6993 with SMTP id c14-20020a7bc84e000000b003db08de6993mr2608646wml.4.1679677923996; Fri, 24 Mar 2023 10:12:03 -0700 (PDT) Received: from vdi08.nix.tessares.net (static.219.156.76.144.clients.your-server.de. [144.76.156.219]) by smtp.gmail.com with ESMTPSA id n17-20020a1c7211000000b003edf2dc7ca3sm5336285wmc.34.2023.03.24.10.12.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Mar 2023 10:12:03 -0700 (PDT) From: Matthieu Baerts Date: Fri, 24 Mar 2023 18:11:31 +0100 Subject: [PATCH net-next 2/4] mptcp: simplify subflow_syn_recv_sock() MIME-Version: 1.0 Message-Id: <20230324-upstream-net-next-20230324-misc-features-v1-2-5a29154592bd@tessares.net> References: <20230324-upstream-net-next-20230324-misc-features-v1-0-5a29154592bd@tessares.net> In-Reply-To: <20230324-upstream-net-next-20230324-misc-features-v1-0-5a29154592bd@tessares.net> To: mptcp@lists.linux.dev, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Matthieu Baerts X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4024; i=matthieu.baerts@tessares.net; h=from:subject:message-id; bh=7uLks6etvBHmX3D/9NEd2CCNOkTvJiV0jtPxB4Im3Xk=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBkHdnhEi6SS1AGw2zqAuFABFUg/oBXMs9PA7F9/ JFx/ONUwrGJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZB3Z4QAKCRD2t4JPQmmg cxWPEADZvswakigKFQDqyOHzImBZyfmfPeNF72nKbAVFj8xtOMPMWPs9tgzW4go+Ynl3EhZaM5c GG9L9s0UhVQGGqop3CtKZEv8I+Q/LSaEvZ5dpKGPDkmOZB2Q+CnV532P26nzdpCjvPmxpjVimkD oNOyf2aXQt4/+x47Y3IbiGgnJ0BkfnqrnDJJbIAHyMJpuh72vl+qVAB9HwPzKIdKKlMVgVI+C+j J4V2od8jADQb64qjVd15EZPDBCU0qXWk6CvKGd5kwEGI8jNnKIC4cQRaBwp2/oxjbU8u6/3vjJr G9hqwSL4lk/npUaNSOwlN1TN1/7Xz7lxI1slzKQzrmdYhRvjRxKFHbhXGimGsUzRPHuB0HT+0ZF I1NG0NPOpDFOochYF5tmzcu3PUXx10JPGg/dBVJ8CF7dAKyIS389vslZL2ymSA+L2LuT92xjwJg pt20egKoWqc7G/n1Y0bBGYJGCYAP9n4FyWHZoUPuF3jmhe55xFbvinvrDMFEk1it4p46NpBywiA vKJe7OPtCERT8UEPltGYf3GrsKSG//JVHRxFxf2/3qFI1floGTpoSOthXA3BOT6Skfr/JozxexJ dFoUC9nbrZTfm2j4ycG2ifrQQ4R+I6zqC8vPbktlGMWFOwpG0UNlrIjZGr/9pberY2fH+RgXZVd HeGrEZ44Mxu69fQ== X-Developer-Key: i=matthieu.baerts@tessares.net; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761271108213648585?= X-GMAIL-MSGID: =?utf-8?q?1761271108213648585?= From: Paolo Abeni Postpone the msk cloning to the child process creation so that we can avoid a bunch of conditionals. Link: https://github.com/multipath-tcp/mptcp_net-next/issues/61 Signed-off-by: Paolo Abeni Reviewed-by: Matthieu Baerts Signed-off-by: Matthieu Baerts --- net/mptcp/subflow.c | 41 +++++++++++++---------------------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index a11f4c525e01..33dd27765116 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -696,14 +696,6 @@ static bool subflow_hmac_valid(const struct request_sock *req, return !crypto_memneq(hmac, mp_opt->hmac, MPTCPOPT_HMAC_LEN); } -static void mptcp_force_close(struct sock *sk) -{ - /* the msk is not yet exposed to user-space, and refcount is 2 */ - inet_sk_state_store(sk, TCP_CLOSE); - sk_common_release(sk); - sock_put(sk); -} - static void subflow_ulp_fallback(struct sock *sk, struct mptcp_subflow_context *old_ctx) { @@ -755,7 +747,6 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk, struct mptcp_subflow_request_sock *subflow_req; struct mptcp_options_received mp_opt; bool fallback, fallback_is_fatal; - struct sock *new_msk = NULL; struct mptcp_sock *owner; struct sock *child; @@ -784,14 +775,9 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk, * options. */ mptcp_get_options(skb, &mp_opt); - if (!(mp_opt.suboptions & OPTIONS_MPTCP_MPC)) { + if (!(mp_opt.suboptions & OPTIONS_MPTCP_MPC)) fallback = true; - goto create_child; - } - new_msk = mptcp_sk_clone(listener->conn, &mp_opt, req); - if (!new_msk) - fallback = true; } else if (subflow_req->mp_join) { mptcp_get_options(skb, &mp_opt); if (!(mp_opt.suboptions & OPTIONS_MPTCP_MPJ) || @@ -820,21 +806,23 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk, subflow_add_reset_reason(skb, MPTCP_RST_EMPTCP); goto dispose_child; } - - mptcp_subflow_drop_ctx(child); - goto out; + goto fallback; } /* ssk inherits options of listener sk */ ctx->setsockopt_seq = listener->setsockopt_seq; if (ctx->mp_capable) { - owner = mptcp_sk(new_msk); + ctx->conn = mptcp_sk_clone(listener->conn, &mp_opt, req); + if (!ctx->conn) + goto fallback; + + owner = mptcp_sk(ctx->conn); /* this can't race with mptcp_close(), as the msk is * not yet exposted to user-space */ - inet_sk_state_store((void *)new_msk, TCP_ESTABLISHED); + inet_sk_state_store(ctx->conn, TCP_ESTABLISHED); /* record the newly created socket as the first msk * subflow, but don't link it yet into conn_list @@ -844,11 +832,9 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk, /* new mpc subflow takes ownership of the newly * created mptcp socket */ - mptcp_sk(new_msk)->setsockopt_seq = ctx->setsockopt_seq; + owner->setsockopt_seq = ctx->setsockopt_seq; mptcp_pm_new_connection(owner, child, 1); mptcp_token_accept(subflow_req, owner); - ctx->conn = new_msk; - new_msk = NULL; /* set msk addresses early to ensure mptcp_pm_get_local_id() * uses the correct data @@ -898,11 +884,6 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk, } } -out: - /* dispose of the left over mptcp master, if any */ - if (unlikely(new_msk)) - mptcp_force_close(new_msk); - /* check for expected invariant - should never trigger, just help * catching eariler subtle bugs */ @@ -920,6 +901,10 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk, /* The last child reference will be released by the caller */ return child; + +fallback: + mptcp_subflow_drop_ctx(child); + return child; } static struct inet_connection_sock_af_ops subflow_specific __ro_after_init; From patchwork Fri Mar 24 17:11:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 74647 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp792448vqo; Fri, 24 Mar 2023 10:25:37 -0700 (PDT) X-Google-Smtp-Source: AKy350YOgqfMqxE4cO5d2Xpyn+/TS8gQbXpYFvgnhZN+oBCu6RZZBC3aiLxgIaERY8hD1d3k85UN X-Received: by 2002:aa7:8f14:0:b0:626:29ed:941f with SMTP id x20-20020aa78f14000000b0062629ed941fmr3849186pfr.5.1679678737626; Fri, 24 Mar 2023 10:25:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679678737; cv=none; d=google.com; s=arc-20160816; b=mijqiDWDPc5IcaM9s/wygoZpGDuTaF6m7AyhmrgeByWMUswDc6BZA3rZdw5ah4wPIE SBKoGEstj9Pm/AzdSvFS3zu9BxFPbNvMn+hPoicJtThWYbMS/EYevM6ofy3SA7hY81cf m/Wf9cVS5ME1bWa33t7PvRjUJtWLSywViweEmR7S/sQyQg4dxjN/Dj/Z67b8qnuujv+I Sgs+ijhJO2jzp3+Sk99KOJek7KHrjT8Jkg3TVWEuyVXO1j9q4WdkTwIvVMjkpcal7h9P /iUFxzU24gvqa/b6cNyrGy15bHK3kNAJkWrwlSFQ+2hD5N06FAIqXVKsY56fUD8SBxSN NkBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=2IaWlH7abh0r241+EHHXm0ebngTGfgUKffPXQtB3krM=; b=Mp80B/8HD2L4TUWoSr+bA/8V+y29mjnRd7bT7hN6Mtk7aeXqkzfZnhtbRVmxlP753d PoJ6BfFGdQRAkTtndEnz/3KQjZdN9JwUQwCWAUNEM7g+4qFSPF22VZDk75IarLee9QW+ rT+GjZtF3LuePoQpq1oo48uB2NgKYNwXtfTLB6h6HwuTxeyVp6vuDGglRmNxoXaBc4Mt nIq4rKNfDgvlSeHIlCB4sLmWbflkTyaCpU/znE989bCiddtWcbzARxwb4Lf09O2LlUWC xOr6uX3XKbwtJ3j3euixQ8OwxO1gzm8gz3WeovRx+T7LwlfNUCidhBa+Rfdt5KSjRJ9R DT3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=3DHgAd2w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=tessares.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r20-20020a6560d4000000b005072b149efesi20991296pgv.866.2023.03.24.10.25.25; Fri, 24 Mar 2023 10:25:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=3DHgAd2w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=tessares.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231721AbjCXRMR (ORCPT + 99 others); Fri, 24 Mar 2023 13:12:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232027AbjCXRMI (ORCPT ); Fri, 24 Mar 2023 13:12:08 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD70C2194D for ; Fri, 24 Mar 2023 10:12:06 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id s13so1552214wmr.4 for ; Fri, 24 Mar 2023 10:12:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; t=1679677925; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=2IaWlH7abh0r241+EHHXm0ebngTGfgUKffPXQtB3krM=; b=3DHgAd2wuhgjtclX+s1OIw9Yh9iKokUZ/ZAHOwXw1Wb3VWqsHW5eObAlUI8ikdimRv M1byi5NmGB7mlC21cWzoz7L+ut246zxHz1g1itan6UFznrFffkl+K2LtpsIWsusk7R/q kOWMzSMmb5cpmYGkVt9vxemQdrQ6/zY4hSUzOioxsqmqNSV/X+e/u+52QWx9jGqVnMsB WtgpSiuCd4A03eF0Fz7aEBV/2KUryOWt045uqt/uI8rQCO6YPeevdBxXHmIDH5T4mca1 56uMWE1oqX6WvtUvKJwhnMGO3MH2kupzY3KuNgaHkKCzKMl0g7Fe2xvUi4NOtivBs52e PKwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679677925; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2IaWlH7abh0r241+EHHXm0ebngTGfgUKffPXQtB3krM=; b=f+dCYLvT76hZXcv392XFB9W8ngDJw941Igtek52JPSf+vMTViZKVTHIq74t/BZQwjP 5J8s2fhtTCMOGTN4LYk3jjoIWM4w25F/aTtHj2e7+zjJ4W+B0XIOgQrbEnNT0SK14Ylf FaZKw+wlaKGIQCTvHEJyiT6HhIi9LLd2WlRs/4kayJlM1CrqeIJ9c0T/TLPozY1SxIFY tjd8ufRBDvMOF73OJ91lAzLeh1yHddsehBIxpa37ZY+OB9IQ9vqS02hBuQ+n7mvLVwXq RTYUgAORJrxYO0qqci88NxX9xyO8TkuyvuU3vb+1zU41V/OCCjXR69uclxsl4ioJl0Ny FJXw== X-Gm-Message-State: AO0yUKWUUXFFGXWJOanV4BxZml8/3bz4H8YCTgLeDB+3Ixt75o12gvSb cp3hKoQrv+RrOlXB+ss9cGeym96Kr1zsIeebC7CPlg== X-Received: by 2002:a05:600c:22d2:b0:3ee:392:39e3 with SMTP id 18-20020a05600c22d200b003ee039239e3mr2900091wmg.30.1679677924813; Fri, 24 Mar 2023 10:12:04 -0700 (PDT) Received: from vdi08.nix.tessares.net (static.219.156.76.144.clients.your-server.de. [144.76.156.219]) by smtp.gmail.com with ESMTPSA id n17-20020a1c7211000000b003edf2dc7ca3sm5336285wmc.34.2023.03.24.10.12.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Mar 2023 10:12:04 -0700 (PDT) From: Matthieu Baerts Date: Fri, 24 Mar 2023 18:11:32 +0100 Subject: [PATCH net-next 3/4] mptcp: do not fill info not used by the PM in used MIME-Version: 1.0 Message-Id: <20230324-upstream-net-next-20230324-misc-features-v1-3-5a29154592bd@tessares.net> References: <20230324-upstream-net-next-20230324-misc-features-v1-0-5a29154592bd@tessares.net> In-Reply-To: <20230324-upstream-net-next-20230324-misc-features-v1-0-5a29154592bd@tessares.net> To: mptcp@lists.linux.dev, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Matthieu Baerts X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2359; i=matthieu.baerts@tessares.net; h=from:subject:message-id; bh=tfrD6RVlmEwTdSM2FDq/8Wzw0KDut8T4BXZaYVMDJvg=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBkHdnhO0H6C9F7gXGnhIa6irzV9sedrlpMm9M8Q RS7lv71+iSJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZB3Z4QAKCRD2t4JPQmmg c3ddEACCRWs4NatTqqTHhXzvSKo6oGFaqE0aL05ckSdgYCpNmpTv21ghoVC0u6JZLWL0aduCl7C gn7J/0M34+pj0JLEn9mFlltBbnoAyL34voCCnEdSEnt7E/9RyGRbGOfJUBSwXFuXwNYK2U1jKvT zcR1pLSmWDLFvIkSe9cvq+SMK9QPem5/oC+RRrx3gDVumOsYM1LNAcwAdf8wLI4tzM9dVmKpycs Wd4309UmaUv/eLKbeCav3vaRHMh9Jzq32k2sEuTupAyUxa/KC1KVmjEf46fVeqcisaphRlDtp9K 5oWxUIQjg4qKH5usA3ibWNU+4zjpl/S1bJ/Ma+5sSrQf3+N643AsQQsA/KHFQT31C6f4SLx3222 jalQQZxSMl+fPDMgmMGOTuzlywrPwpmgKR052FqBjHTI2myNywNZte7WcwH5NcnN/F02kVIrqOx emAR2FvAXUlcWp7RLfBPbjVYQqaeozGYgj3WtCeAsnOTdbvhzS8l4LTxduqF+hmcfw6r6rKC7fp RKSucYRIOSzSiaOai/fjQtV+bvoQZBvcURM8aBOx5cBMGZqv4HlTm63Iup3GhWvKfVRb0qXpw6C I6bAmGZcxCCG7htXAQ+f7dNwIrJa9J3HCcLi6tmjcvyhqCXPo95h1Bjx7/QaD32BDd5Qhw9uGnh q8/kK4ADpg2CrWg== X-Developer-Key: i=matthieu.baerts@tessares.net; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761270811901436472?= X-GMAIL-MSGID: =?utf-8?q?1761270811901436472?= Only the in-kernel PM uses the number of address and subflow limits allowed per connection. It then makes more sense not to display such info when other PMs are used not to confuse the userspace by showing limits not being used. While at it, we can get rid of the "val" variable and add indentations instead. It would have been good to have done this modification directly in commit 3fd4c2a2d672 ("mptcp: bypass in-kernel PM restrictions for non-kernel PMs") but as we change a bit the behaviour, it is fine not to backport it to stable. Acked-by: Paolo Abeni Signed-off-by: Matthieu Baerts --- net/mptcp/sockopt.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c index 5cef4d3d21ac..b655cebda0f3 100644 --- a/net/mptcp/sockopt.c +++ b/net/mptcp/sockopt.c @@ -885,7 +885,6 @@ static int mptcp_getsockopt_first_sf_only(struct mptcp_sock *msk, int level, int void mptcp_diag_fill_info(struct mptcp_sock *msk, struct mptcp_info *info) { u32 flags = 0; - u8 val; memset(info, 0, sizeof(*info)); @@ -893,12 +892,19 @@ void mptcp_diag_fill_info(struct mptcp_sock *msk, struct mptcp_info *info) info->mptcpi_add_addr_signal = READ_ONCE(msk->pm.add_addr_signaled); info->mptcpi_add_addr_accepted = READ_ONCE(msk->pm.add_addr_accepted); info->mptcpi_local_addr_used = READ_ONCE(msk->pm.local_addr_used); - info->mptcpi_subflows_max = mptcp_pm_get_subflows_max(msk); - val = mptcp_pm_get_add_addr_signal_max(msk); - info->mptcpi_add_addr_signal_max = val; - val = mptcp_pm_get_add_addr_accept_max(msk); - info->mptcpi_add_addr_accepted_max = val; - info->mptcpi_local_addr_max = mptcp_pm_get_local_addr_max(msk); + + /* The following limits only make sense for the in-kernel PM */ + if (mptcp_pm_is_kernel(msk)) { + info->mptcpi_subflows_max = + mptcp_pm_get_subflows_max(msk); + info->mptcpi_add_addr_signal_max = + mptcp_pm_get_add_addr_signal_max(msk); + info->mptcpi_add_addr_accepted_max = + mptcp_pm_get_add_addr_accept_max(msk); + info->mptcpi_local_addr_max = + mptcp_pm_get_local_addr_max(msk); + } + if (test_bit(MPTCP_FALLBACK_DONE, &msk->flags)) flags |= MPTCP_INFO_FLAG_FALLBACK; if (READ_ONCE(msk->can_ack)) From patchwork Fri Mar 24 17:11:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 74653 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp795050vqo; Fri, 24 Mar 2023 10:29:36 -0700 (PDT) X-Google-Smtp-Source: AKy350ZNuuMXCwE8wSEcVQCK6DW2H2d6a5SUhViIk7rvyUpSPaTaEE0gCGCI9PyapMUd1Fb2j3ag X-Received: by 2002:a62:3807:0:b0:626:2426:e1eb with SMTP id f7-20020a623807000000b006262426e1ebmr3345286pfa.14.1679678976425; Fri, 24 Mar 2023 10:29:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679678976; cv=none; d=google.com; s=arc-20160816; b=lBWc3HwqxmqOYoAYlRwbtzSqsaIIWB/eR0mMsFudzPThbmwFuTBUVKzunHdZqvo58g fhNGgLw5uxQqbrHEKzrfM1Jl3iHR9Z2Bt6O0vvtuPQhwSE1e5VkDs6pSM30QK5UzxL0+ xJptuJD9BhBVxVVoDUZaRRi4p/s4Ejlr/Q97fDn3xRYZWHAGZ0HWC1kwa28I0ymb6Pc8 /9X5hPa9aUyz4q8lmtDU43jA7RPiYk5u0rAQ+HLP4hkG9l2sfqn90RozCmtWKvKGvBlp xX5l31v3UZMMdmqxg0g+Vh0uas1GKhHScoTWgIyFd+olwsRwndeT101QM2G1VAAht0s0 mUvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=VW3IChK5d/LMd19IisgoH//5UFlp1VHM94HpnaBU+Yc=; b=iEVjsFLjYN6mBDUAqA1bWNpC3tlSDJ1Zd0RnfEnqQb1N8jOwv5qt6OASySC2mKnqCq EUCoayOHyXVd9GVIonst9jgoKpg/O32KjMxQt49CMRDu3/Zzh/SMxpN9lWIY27The7/a G0rvRGjMN3CI3ubDKBaNigy/ae5xCYvsX3JmUC1jLkrhLx8wEIK9gPxw+XUmI3BJemmz BHrm/KIOWHHjcGficpocSSRZUKBM+BLLE60H9JdxHs9MESuS6hLOkW41GvOm6l7F03Tm 7BwKNuVUWHiNQ0gZWVpml70SF6bs0DjO5Xr1d6SkuvaiSA1COlNWYlX0+sHz3PFHaZyZ istA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b="o/wu2Jp3"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=tessares.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r17-20020a056a00217100b0060102d22785si20120113pff.283.2023.03.24.10.29.24; Fri, 24 Mar 2023 10:29:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b="o/wu2Jp3"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=tessares.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232126AbjCXRMV (ORCPT + 99 others); Fri, 24 Mar 2023 13:12:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232048AbjCXRMJ (ORCPT ); Fri, 24 Mar 2023 13:12:09 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CAD021950 for ; Fri, 24 Mar 2023 10:12:07 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id bg16-20020a05600c3c9000b003eb34e21bdfso3632088wmb.0 for ; Fri, 24 Mar 2023 10:12:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; t=1679677925; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=VW3IChK5d/LMd19IisgoH//5UFlp1VHM94HpnaBU+Yc=; b=o/wu2Jp3AliRkeMPA3jrM6zYirVq78icMef0YJjAEAOIjono/Q1XQsI5GyyrPoG4Mn /zplq16SxtbGB00v1S0EpbjE6TuahnUvhbFvBEzK7EOEtFxWBCiB0ZM/SjFdOLZb7+L0 fGXj2wQ3OoheKWQEOdTU3hWsrjGx3ffbfyJyRQk2b1QoJHXgACaWbJmzE+Um0J6PVQec m+XE4Urk/DSEjihv4hwjNOrwe5HYdSicRPPGqjP5fEiG8+dFtJfuST6Ju64clJeaPDj6 1cAOw6vCNCxNd6KrMhGwSUGW04FVB6FsUkx0rk8h5F1fMJSjiTvNIl9WKAXRrzzBpFS0 x9Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679677925; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VW3IChK5d/LMd19IisgoH//5UFlp1VHM94HpnaBU+Yc=; b=j08CVShsMeavMweG5Vt9/JBZ9lRcOMcIEkaf7jziBHHh0O4xYseHyWSrFLXE1lgl3r 3BqiaVWxrlGp3a/5BVLnIRlx240I4zBK5IVHiDQOyhFH+kgPGMwBIaLT/BR2Seqxwd6p mbt/tpYM6s5bcKjybXMELHQYjKlLa4cpgigP/su98x+dtOUyPL7FeyZO8qOytez1N/AY NzUKM23XBvYE/thRQgfiyjgSQi3B6PL897Fuo6TKvq8Q1zF6yhg+JXbCFLDSRIMDO8X2 EC0oSz74ewdqxInVtFT6IGIFMgluTvpOrdQPgnw+7MD6guX6IXOHzGZYiq9Jv5VX6hlq 5TAA== X-Gm-Message-State: AO0yUKVNM4mUmA5nXbJwINCvDs5N3LfSLyEUagLvxGfTy+OzrE9Vpv2G 8jQEBlULxd1SUKOQdOAF1EcDeQ== X-Received: by 2002:a7b:cb92:0:b0:3ed:88f5:160a with SMTP id m18-20020a7bcb92000000b003ed88f5160amr2989596wmi.11.1679677925645; Fri, 24 Mar 2023 10:12:05 -0700 (PDT) Received: from vdi08.nix.tessares.net (static.219.156.76.144.clients.your-server.de. [144.76.156.219]) by smtp.gmail.com with ESMTPSA id n17-20020a1c7211000000b003edf2dc7ca3sm5336285wmc.34.2023.03.24.10.12.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Mar 2023 10:12:05 -0700 (PDT) From: Matthieu Baerts Date: Fri, 24 Mar 2023 18:11:33 +0100 Subject: [PATCH net-next 4/4] selftests: mptcp: add mptcp_info tests MIME-Version: 1.0 Message-Id: <20230324-upstream-net-next-20230324-misc-features-v1-4-5a29154592bd@tessares.net> References: <20230324-upstream-net-next-20230324-misc-features-v1-0-5a29154592bd@tessares.net> In-Reply-To: <20230324-upstream-net-next-20230324-misc-features-v1-0-5a29154592bd@tessares.net> To: mptcp@lists.linux.dev, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Matthieu Baerts , Geliang Tang X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2389; i=matthieu.baerts@tessares.net; h=from:subject:message-id; bh=QeiNRTK3EtggzUHbWnfSGf4g3uU4Ocezndf67d7El5Q=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBkHdnhcKy+LEHHWVyW1OaYzW6ZE+zvu5rKivgtO i0d5UuW2PuJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZB3Z4QAKCRD2t4JPQmmg cyO4D/0RGtWOVhnnPQw0U6tE5JDXBeBt38aOFdVXXGVKAaMChT/ipA+MJbbPLyLu55o1ZdX2YKm rLWSbnRvM8yU7ghzyEpHXk2tbX8LQYKw1p7ouIavViGk3Ocf0Y27jHIiHL9T+N5QHglV0nEfof/ gR4yEYzo1Mp+V+Ci6ZVERiNRcPHfQ5sLf20NmRFuE5C20uI7RjoJQXE0oudnQHsLfeiSOhum0mr vbYcyou76rwW9PBaxETfRp7Mkm5rYJDG+v47PTNqM0u4YLgQZ6IiZmsjxEeKmosXYZHoTSsVTgF 9AEX7ELhm1ZkwSrQNAhkuF60MQunJji7lTNqgqPPE9Zp597vtRJu+imWBIJ9ufTodR/tz99OeOx 1AfHatFbnhs+/6kWxJZbCq8wqsnDWX+0Pn0ek13120mQi3xxzBViF7jpFNpgHMteasE2Mk43kr2 AciC8ehADjSHMKYCYgXPbxshPleFBHhGaD3L0lL2Laavb1P9hKlga1HjVW2GcKreG/EvNF9m3WB R94iWn3cOSnIhguBkrICbDQbiNzjfYBuOK3ub/dHr8ZKlz6ak31vrkRiYXRiAA5Uc53gybtFuJl GcTOKQR2d4Kh4OpVsFDd2G7Hn1B9uGwsUuY4JKXAJ4w0lbshwNSd//jnoM2K1quptCELI4w8KhV Fm+mtOuhlL84RMw== X-Developer-Key: i=matthieu.baerts@tessares.net; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761271062362328617?= X-GMAIL-MSGID: =?utf-8?q?1761271062362328617?= From: Geliang Tang This patch adds the mptcp_info fields tests in endpoint_tests(). Add a new function chk_mptcp_info() to check the given number of the given mptcp_info field. Link: https://github.com/multipath-tcp/mptcp_net-next/issues/330 Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts Signed-off-by: Matthieu Baerts --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 47 ++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 42e3bd1a05f5..fafd19ec7e1f 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -1719,6 +1719,46 @@ chk_subflow_nr() fi } +chk_mptcp_info() +{ + local nr_info=$1 + local info + local cnt1 + local cnt2 + local dump_stats + + if [[ $nr_info = "subflows_"* ]]; then + info="subflows" + nr_info=${nr_info:9} + else + echo "[fail] unsupported argument: $nr_info" + fail_test + return 1 + fi + + printf "%-${nr_blank}s %-30s" " " "mptcp_info $info=$nr_info" + + cnt1=$(ss -N $ns1 -inmHM | grep "$info:" | + sed -n 's/.*\('"$info"':\)\([[:digit:]]*\).*$/\2/p;q') + [ -z "$cnt1" ] && cnt1=0 + cnt2=$(ss -N $ns2 -inmHM | grep "$info:" | + sed -n 's/.*\('"$info"':\)\([[:digit:]]*\).*$/\2/p;q') + [ -z "$cnt2" ] && cnt2=0 + if [ "$cnt1" != "$nr_info" ] || [ "$cnt2" != "$nr_info" ]; then + echo "[fail] got $cnt1:$cnt2 $info expected $nr_info" + fail_test + dump_stats=1 + else + echo "[ ok ]" + fi + + if [ "$dump_stats" = 1 ]; then + ss -N $ns1 -inmHM + ss -N $ns2 -inmHM + dump_stats + fi +} + chk_link_usage() { local ns=$1 @@ -3118,13 +3158,18 @@ endpoint_tests() run_tests $ns1 $ns2 10.0.1.1 4 0 0 speed_20 2>/dev/null & wait_mpj $ns2 + chk_subflow_nr needtitle "before delete" 2 + chk_mptcp_info subflows_1 + pm_nl_del_endpoint $ns2 2 10.0.2.2 sleep 0.5 - chk_subflow_nr needtitle "after delete" 1 + chk_subflow_nr "" "after delete" 1 + chk_mptcp_info subflows_0 pm_nl_add_endpoint $ns2 10.0.2.2 dev ns2eth2 flags subflow wait_mpj $ns2 chk_subflow_nr "" "after re-add" 2 + chk_mptcp_info subflows_1 kill_tests_wait fi }