From patchwork Mon Mar 27 10:22:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 75338 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1407713vqo; Mon, 27 Mar 2023 03:37:30 -0700 (PDT) X-Google-Smtp-Source: AKy350ZBkF8r99RhCFPBHzI8PH943F27uZN3/jiyVHwmOpLgkFVI08FwnpxVZ4SdBtP5F0wSkBym X-Received: by 2002:a17:90a:6fe2:b0:237:161e:33bc with SMTP id e89-20020a17090a6fe200b00237161e33bcmr11910725pjk.16.1679913450086; Mon, 27 Mar 2023 03:37:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679913450; cv=none; d=google.com; s=arc-20160816; b=nHWZ1kicpcXOlrNzQrN4pQ7eqpZFK1e/dFWZILC3Ar9LJxvjRNJqQqlP4LH8rUOfwO SUSQduP5Ab4C+yPCoVuLCZ1s3FXDMQlnVhFac5lMNXnOSVRLgd3xnIQuRft8PQ5+5ejT IJakkVZSgNSJJaTle0XoleQK4atLVVh1SSfUF5iB12nH0TegUgzlheBGk53CztpyVTLL Ded60Ll6f+jT9HpLXbY5QcbRzNH410Iyse9T+3S1cYQkdmd67djJTzpIOG4utZgvevkS td8cRlZHkjbS8zZhB00pnmCSTmhRmMVvsGGj11ElfdCbwpbSCK2/mgcEIOwgcjvMZfip CSWQ== 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=GAQbMKoGYwncqj1GUAzI7adoTBSgeNtvwCHOBMSZ0llT4RPq3Bjrw5U+UnO2+7r/Vx aa0n7gL8fjLsGcCyEOSI9LLXyp+r8b6o620uGfGnhWZcBMxdiOdngaVSA+JMf0UB3dpZ g+GOGRGkdPMCxhxbXbbgmMyRUEjZZdOpS2nz9q+8JmVugt5C+1aX3r1TbuCwi1uZsw6D lahlHxNe9IRj90rEdte4M0KmxJDqfLc1amvIsKwWg0qLja9NvAjEP3AQc+sIM2dEhNg7 WE5n/hplPn7PXNmZA8Zj8cZ6qEDCH2ewZzpMvcrP1sp4pvD0kaMPwfVfUAiKuzPFqDuH bj3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=PNV21uBR; 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 r13-20020a17090a4dcd00b0023f7d84cb10si10024740pjl.127.2023.03.27.03.37.18; Mon, 27 Mar 2023 03:37:30 -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=PNV21uBR; 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 S233376AbjC0KYd (ORCPT + 99 others); Mon, 27 Mar 2023 06:24:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233608AbjC0KYW (ORCPT ); Mon, 27 Mar 2023 06:24:22 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC9B75FEB for ; Mon, 27 Mar 2023 03:24:16 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id j18-20020a05600c1c1200b003ee5157346cso6993543wms.1 for ; Mon, 27 Mar 2023 03:24:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; t=1679912655; 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=PNV21uBRDJfTwQH7Vwf0vcXBpBoxXBTJH+0rwfYzLf2DVyhsztwqlQMKUzYCVTPzt0 GwrfIyClcqqJu6toj58ZI6DKgtk/jlIwjLkW8Et8J7XSmoIfG6EPsDuirfsuqpXHZRZZ nLUtvroz9DgsidvAji4iULOjN38T8wqZl15SZHCF6tllb3UmfNUsCg9k7AnAuGeH/Dsu ChWVPplrQZhhc0ChJCVn16n9lbRyFhWWJWExC1kN9ranLc+uLhdiEdsIi5Y8UtjBpNMv aSrzUE2IQ7BlqzXf2qntbF7EA4UGScCdAYk0moIv0IEku7J+6PaWKPpeAgLbdcycOox3 2/cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679912655; 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=ldt7X/rWuZqWIRmtgQrzKMpuNDcaVsozyhH5ZBdTQHqV0vLFOPJ7Ao4j7Cf9UzHke0 uQXlB57KIOk5XRvvLZ8dMQwxo8O0o/6+4oVUwwv3Xe/3t1c5hxcysiD21VlSjrpZNXem SwsZZww26Sis2RNmeQ/C3O/pBui3XRcqV0Oi6jtfwhWrZ0ys0tUl7UXN/4oveO5XH8mn J8y4Iffjwj0sOXrzKU9IZbYCUv4c/trYukzWD7lPOhtEgHDVc6XkdonTv/3icI0G6FSq J8RQcYpQ2HzvPN6LgwHR3RcackfbAGU4vrjdX2GhnHqtrOjt/06Ka9lrYO8qBAkDKSjD lWJQ== X-Gm-Message-State: AO0yUKVlh2ZoBr2y1Pvuoe+AI6zwZ85tToCv6Ow4fPXXjUuFdjFGZYVw hG5vUvlzw8sVnXDCMhpmG65X2w== X-Received: by 2002:a1c:790b:0:b0:3ed:9ed7:d676 with SMTP id l11-20020a1c790b000000b003ed9ed7d676mr8956528wme.13.1679912655025; Mon, 27 Mar 2023 03:24:15 -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 p5-20020a05600c358500b003ef6f87118dsm2220615wmq.42.2023.03.27.03.24.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 03:24:14 -0700 (PDT) From: Matthieu Baerts Date: Mon, 27 Mar 2023 12:22:21 +0200 Subject: [PATCH net-next v2 1/4] mptcp: avoid unneeded address copy MIME-Version: 1.0 Message-Id: <20230324-upstream-net-next-20230324-misc-features-v2-1-fca1471efbaa@tessares.net> References: <20230324-upstream-net-next-20230324-misc-features-v2-0-fca1471efbaa@tessares.net> In-Reply-To: <20230324-upstream-net-next-20230324-misc-features-v2-0-fca1471efbaa@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/ZANAwAIAfa3gk9CaaBzAcsmYgBkIW7Nftig6dQW8wQPUwWwTL4dEEUFiMDCFXMmM AYxC3OduUOJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZCFuzQAKCRD2t4JPQmmg cyYLEACsMh05r743SrrQahmb/dASG/nnePWzNUsHtLK0EDrydcG1E9pyIvThKLhuxmJBFkdfA8o uRgJaFQhLi/mgf9J1kurqnKVo1cT76lY3cQRHufXp3+k9+DY9q0MOn4O2P93f6z/JW4beuRsguf FTWSpUW1iOJdfL21R0zDeMO7Hi7g1bqH5TRyGtrM8/k7bS962G4mcpvxDwLXSxzDITvRagbU41N czNiY+0DpnyQrFOqTnMDoKXmBKar3V9IfCgggGf0BYNMTLSs2qv+lg+EP7FS7w9VoadoZZRlt8l f664x47KJL3kLfoi3QF+V/LaezEht3+crr6CqpBmDiPrrWgFvI2IKf9WPW75kgJvDnoxZ90/a3D 0pkBBkQlcKraE6LG0tmkA+NajAVmNcaUaPM+nPyRdiR3o3WiJeKZrGwnjC1xU83CEYOKPyH+5S+ n7Mcnq4QA398Eoo0gBjfn8tn1rErk2kG//CN/U3My/TDHZdk9zUv9lCbtHWSc/nJPpvonQAPhjR xd84HucX3XqHgGcUDCiut0aX1wyzS7TElWQg/Igxh/IsXQtGzEjJjQ8mejCycN3sKJ7yLCE5gc5 24YWYVX0fqkNI0Qiu1gbMC/H98YQw3JDPiH9zz15+oK93+ygI07nhcoyOCCuOJtqzIjdSlXRMR/ SUpG0vr0HCja/ZA== 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?1761516925860917546?= X-GMAIL-MSGID: =?utf-8?q?1761516925860917546?= 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 Mon Mar 27 10:22:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 75340 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1410307vqo; Mon, 27 Mar 2023 03:43:51 -0700 (PDT) X-Google-Smtp-Source: AKy350bkbOnk/+t24pfsd6b2bNnx9tQziLXLoLJipcW/2HV8bYKsLToJ6ftvZmTPfgUpD5ueg4Pf X-Received: by 2002:a05:6402:e:b0:4fa:d75c:16cd with SMTP id d14-20020a056402000e00b004fad75c16cdmr10053150edu.34.1679913831351; Mon, 27 Mar 2023 03:43:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679913831; cv=none; d=google.com; s=arc-20160816; b=Z+fycJLfrzRN5TU2jokXR1kFVlcBaNxdLac1jBEaLrxk9DuQuVnwRKOerDInO6LJsD Diy98mjgpO4P+P+7Ep2Wti01Mvyt/5BdKEy9rB+Kuz/6WpbdC7pPiGqGHtXXSucwGor8 EXIV0QtE3Y8aiJIryl8X2D0tWwc4SYEGblMUhAcZK1+dDdmla3Zj1vF7g1q9uL/vlCBU qw18+O6E2FczNuObw3S0qFLJhLHRNklr+7xYHUu7YjFPXHDAwhd10yOXPaiAUpGh08Pz F2AYUjzZ3JFxLnQ99HhlmTZPB2XCJPWZ4bM6gBavXZMlF2KLIiFAKCxuiy5k4YGi1UW5 cKxA== 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=ghZZwqhoKsRl4clzZdl+QFE3jjM6WbwlrGUtJW+He+s/h8kK7AmoR5WReAluvqCOfF lNL4uZo6LAauaO/2yUzp69HpSHnwXfsH5XWhSlfJoLDKKJ8RirK7o5iwmdtHnFikr3QL 7A65QsFxT7vOTyWP7W5IbueNWVv+Z1fWakfM/LhNb9UwK/bKjX1jW+iJ0q00xMDkLMVK 7HocdkvcenxRM2t2RAqmAjrthrE8qJfp+e+0k8yZNYqVSc3nOx76+qV/ikH5g3cvQNny NZxb0vm5JKcqSXNtJE3BmziNitU06UuGFicdq2qXAYBrizV0/KXuq7q81x0E+djV0az0 q/aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b="qbm/CSXn"; 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 q24-20020a056402033800b004fd298e4a44si29826692edw.553.2023.03.27.03.43.27; Mon, 27 Mar 2023 03:43:51 -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="qbm/CSXn"; 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 S233554AbjC0KYj (ORCPT + 99 others); Mon, 27 Mar 2023 06:24:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233618AbjC0KYW (ORCPT ); Mon, 27 Mar 2023 06:24:22 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 700265FD6 for ; Mon, 27 Mar 2023 03:24:17 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id q7-20020a05600c46c700b003ef6e809574so1588330wmo.4 for ; Mon, 27 Mar 2023 03:24:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; t=1679912656; 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=qbm/CSXnVXbWDqbgODWpPaBsxqFt3z34w/7tLjhROyOiubX4ezUpsucQfRdacUsjUS kr71dcencw7qgtZl+hupvEv36vCSfxIEfmWORFs2c/UGElooMwfrWSnKYzBLV2FzZ5m6 oMwKC9Dwt95HbVSxJVEBP9wBjdlH1qXXmPTYZgLhYOoLNxryK24KKOGAYx8A/Qci7oEj 6DGQpqMIPINiQxp26q4L7bj3PK7BI9enu7MZtF3ojiNbLgZGPm8937ZnZeuo6eXV7jAU SPCiZFiVwOab3SUd2bjQP+zsd1WLCFQO0qRp2ev2Fb7KyktXQiPrRDF7cGQDL75tZAyX t9SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679912656; 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=P4POb8XBl961+yu+40T+SxisTUv9XHFnG6onkI2pQVHW94tdU3vttYLHsV3jZNwi+K Q/cJkbpnm5bbcrx5iZOx0s4z95iArP5RSzcD8tn94dUhogj/xWjgs117RIugLgiKRAQZ Uz/+fGrC4IWMUtOgy5v3s+5mkAn9/+nK+/F2CQxInvttgLtfG533lWv37rnWIcxgX3Jw VJOS2qgBqSepFc9Goqc6xsuCL7CEURG60Kdtm7X+wVzSZ1rqGkYj7eX1wkSVV/WilOLL lXB1C2VseLuMglR4ggStojTMQB8iJbkmli9ncbZH8ndvm4hES8duXjsAZmwSWDuBfHW/ jGaw== X-Gm-Message-State: AO0yUKVjq5ot7TICw9Iti4lqFdCR6R6VyyO2Kyx+iaquRDkDTIfGb6mv eWeKZNDNNqeuNnchRbPqXWMaFQ== X-Received: by 2002:a7b:ca58:0:b0:3ed:93de:49ff with SMTP id m24-20020a7bca58000000b003ed93de49ffmr8564400wml.0.1679912655781; Mon, 27 Mar 2023 03:24:15 -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 p5-20020a05600c358500b003ef6f87118dsm2220615wmq.42.2023.03.27.03.24.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 03:24:15 -0700 (PDT) From: Matthieu Baerts Date: Mon, 27 Mar 2023 12:22:22 +0200 Subject: [PATCH net-next v2 2/4] mptcp: simplify subflow_syn_recv_sock() MIME-Version: 1.0 Message-Id: <20230324-upstream-net-next-20230324-misc-features-v2-2-fca1471efbaa@tessares.net> References: <20230324-upstream-net-next-20230324-misc-features-v2-0-fca1471efbaa@tessares.net> In-Reply-To: <20230324-upstream-net-next-20230324-misc-features-v2-0-fca1471efbaa@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/ZANAwAIAfa3gk9CaaBzAcsmYgBkIW7NUpTMbB/3pGtBJC452VKUDrNAqwyYxaBgK s232IPVO7CJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZCFuzQAKCRD2t4JPQmmg c6GJD/sGbRZlwUczkfNaaBiyIjErGLVMA2faVXaO+YpC+bwsiZyhC5/RzFWfk1LnL3Zm0qEEAgu KI1o4dTCft1F/g/+C1ktD42gg/14glZpuF00s6LlaR1kRJLoCrM7UU1HkJi2kShFiEmXOX9WX7a wjCASMQMtucVE7XuYJthSNJ/E6DOFMhSoXvgWVPKldoB7uw/hoyq0GU+h0rGTsHzG9m7DtYd9ue BrxOHictK9/EGWt0u+LUu88PIqaSXzHsZt+TVBS9tQ67RHBohL/lJoV0WHfRtrKTBBQHk2+PyTi 4FGc20VxbsK5q5TP1cqTl0pP0Vm7BmTMOhgNgePUn8QgCfrK1VvkVGZ95K94irclqs9mOo09pFb 4P0KmvSqK0X2fti4Tq3pHvIf4kLNdJqoLRfj0S6DNLmKIExjQUaPrvNevMKaA5ZLR4rrvKvXlqS 0hIlAZKnEu+dKH3G+5wBr8bpuSdybhQxOapTVRmKCIC3qaaj4pcuZpJ17uxwp5Z04WzCHIQ1CD3 Kuqttw0ITNnNwJNPaFbqUeO746eefWUzo/F7AYQnGBh0ufcWih6NWmaKXYhWE0gpUYdisZKoCxc N+uvrFvSq3OHcsY1jjfxBzk+eh1qiVXffi52YNRNRS7eNUU6T2nwoCFpcT7yHzi486Lqg3HUIjH H+xjoZW/oCB/HXA== 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?1761517325349332151?= X-GMAIL-MSGID: =?utf-8?q?1761517325349332151?= 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 Mon Mar 27 10:22:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 75341 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1420597vqo; Mon, 27 Mar 2023 04:04:41 -0700 (PDT) X-Google-Smtp-Source: AKy350aPKSpV0amuzf0RuE5mVZ6t/7p7TgTefsJVrw+Qc9pIbOEfoualr/rJC5K3keSkfp1KTkcb X-Received: by 2002:a05:6402:517b:b0:501:d4f9:3141 with SMTP id d27-20020a056402517b00b00501d4f93141mr11622342ede.32.1679915080907; Mon, 27 Mar 2023 04:04:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679915080; cv=none; d=google.com; s=arc-20160816; b=XBkFJt+No0rFHnFv4IMyiqvwdfgIZN+qUC2zZtgubM4q/lgAOrGrOcv8Yk699vZ5U4 ozhSLe0n0q18RqwBY+16871JfRTgnVaP91WSbKsAmg0k86svM7OGcjJEYo11XPM5B3aS +/Jhlj+GEhp4ZgIT1uogjs1PRPdCJ2M9mYjEtp5R9RNQd2uFXQdMLpBaNKZrrm6k2sAt wdAs5ekM8fCLOw9U94xG3p2CgY4i1/rj6YGzHQ79XqXbD2iWcC01NJf1RWjxnIDZGrWC YT3xHr8Ye7MnvDdHffqLN6otNLmuj64BXvwEmaDwwFy99f9u08cSM6c9S9r9363OyTmS se3A== 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=Y2s1w7wyWLGSvVLo9qSwfebzvJxleDF9wqQ5C6Mg9+0=; b=nL8WfcoGwVToHccQg3vDSDO9uEbP+Avbo0CWu40vZj5kfRzomQnapLPBPeFkfbIxBl 1MQsnzOaP/UdqEQ3kj/CfYM+/QJfQsfewfzGQx9xQqYkkkQK/4UUF8xHRsk/QmPH2Pow 04EjjC5pBzbbg2WSTsvumFGlctPSKBnHbIl7gQkUROJizD3QKDGZ4elPXDidh7HmUkyq zOOmgePG3TNGHehhqxGtI6yWzbkcZfxtHYnj0A9EXBVkLmJLnv6+IwvxWj0hqc0eucG0 DFyecg5xf7uNITV9nkGss64Wc7rQOzXWh5pTC6p9YeJfiE8nhvhXjFQ6jL0b5j4pd6Qy f1zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=LAF+KhOb; 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 u16-20020aa7db90000000b004ab4c6f9996si26642052edt.516.2023.03.27.04.04.12; Mon, 27 Mar 2023 04:04:40 -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=LAF+KhOb; 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 S233365AbjC0KYn (ORCPT + 99 others); Mon, 27 Mar 2023 06:24:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233014AbjC0KYY (ORCPT ); Mon, 27 Mar 2023 06:24:24 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EBB25FFB for ; Mon, 27 Mar 2023 03:24:18 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id o32so4731897wms.1 for ; Mon, 27 Mar 2023 03:24:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; t=1679912656; 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=Y2s1w7wyWLGSvVLo9qSwfebzvJxleDF9wqQ5C6Mg9+0=; b=LAF+KhObcnPSGk1LwRdXy8N4PC2vgDedgGiRBOR1hBBUl7DIpXAI7fho5KPs1QwKTU wJn6mksjiFARUA01QQ+ENDAJZRTf9++WX7OH1F7mboN24oOKW0PFPTatS1iqVaefGfF5 dOUfxHfazQUSllOvq/XUUnGzVr9QkEIU0E5XxRXLZF+OO+QX1BhOST50dToAhZHEW5u4 2l8Z4WpsNcb4+h1lwKqgW75CYpm0L2hGH7wRYXlGI9X36yp6vKJFr/kRkdrAi2MBwa5K UWKvsn3tLprXOCpkVghL7N0v96SqaS+J9D/axf2c0JJ9VB0DXePop4HvMGZdxmJGImUb Geww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679912656; 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=Y2s1w7wyWLGSvVLo9qSwfebzvJxleDF9wqQ5C6Mg9+0=; b=ryw0PK0izQnex1PZd3dVTeFsNOLKOlIPGukl9oeHIT73HdPizYtOZ78mt3G6w2V8ly 8t3jA9XeTf+yrPNYxwtYtWxQzJ1dNAgk6xGY+5L4oOSL7eMeRTkEpMxQBVvFzh9lhBeO tTNNdywSXFaI9thSAHrsb3FBUI22E25Aj/zldvm4QwYVV4Vsk7TfKBdGvcFxbJGzbAWZ woruyvUl3xnkAaOubG+iOVpHYwrV2nJDHw4htvPHh0G3bCYHiV5FIZP3c3pw4rYLAL6P o0EwkIYuI9wesfbKtYLcNrXNl+y5YT3CQGMV5+3VqVt0RTMFeyYfJOgGYC9dDE8BWBNT IsUg== X-Gm-Message-State: AO0yUKV23DA+JNuMNaahqdij9tchMqd6hzeOqMIrJ06+0Xqh6RFtqkiO x4S/OmBTX6CjjctWEegzjxuP3w== X-Received: by 2002:a05:600c:3150:b0:3ed:1fa1:73c5 with SMTP id h16-20020a05600c315000b003ed1fa173c5mr8822288wmo.27.1679912656567; Mon, 27 Mar 2023 03:24:16 -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 p5-20020a05600c358500b003ef6f87118dsm2220615wmq.42.2023.03.27.03.24.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 03:24:16 -0700 (PDT) From: Matthieu Baerts Date: Mon, 27 Mar 2023 12:22:23 +0200 Subject: [PATCH net-next v2 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-v2-3-fca1471efbaa@tessares.net> References: <20230324-upstream-net-next-20230324-misc-features-v2-0-fca1471efbaa@tessares.net> In-Reply-To: <20230324-upstream-net-next-20230324-misc-features-v2-0-fca1471efbaa@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=JfdjdMtHAEFzYfeXcaHNW3DRPcyI4L+/oekuAAfyZL0=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBkIW7NFRcWNN10fSzOtOUO6cbgTxR7MiXA2aLpw +TRtDG05AiJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZCFuzQAKCRD2t4JPQmmg c6SwD/0QIS76wpqDMw+3rNY9G3+AO/b97AfQHuKrlEb7y+m0XRbjzohdgP4amTudpmWvVEmE9Nf mapCXfegDllIN0RkSstCzizM3A15MRBXvouG7hkQXUWAFDczkvhQpfmGEJphl9YbYP8Tv7YNSr3 pq5eBCmPNVfnIOf+507u6JyQZsvLuPdhQHc0RqdT9J+VkV9G6pe1HmT6+hwS2nO76Z+DWuKunwR CpS8QyLd3pdumT4npIreYdluWywbkzLmR2i4bGLeQvvZV1Of9143C0TY3QRrUjXjbqgZO6bs9Cn Nx8PSDzFiEmDWMushaPYBAVCElo5uM81kuCXVWr/PxVKluKI/io2c8HQqPBIFDfzDezQfqY25zc cRKoz7oh4MiSIbAHGbLy7M0kiyWq+w8wnUbIkYXT15W0qID59Swh1b9v/46FPn4eIBmUr4P5L9e ZggGFSCeDF4+JOb/UjJvYQAEOGKdJj0xCpfV9qnRK4wS9S2s+I/qZFsS7BuyHL8HRGdqYb6lDMq Jg9M+2q3mTAM5mNfdZcGHdyziulxkDFwtWKlZ2jI/IIj1jNefeun8zsKB/zR25XtCWBBJUaQP6x 5c+Zb20KD4VKxeGw9fpnNfpc95V2D5xriwoPKGKR5Emull30BokxcJr+iDTCt9U7Jwyzij3FtLk poCWPPfH8Sx+EGA== 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?1761518636162081561?= X-GMAIL-MSGID: =?utf-8?q?1761518636162081561?= 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 4d25247d3ae4 ("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 Mon Mar 27 10:22:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 75337 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1403559vqo; Mon, 27 Mar 2023 03:28:47 -0700 (PDT) X-Google-Smtp-Source: AKy350aV+dU4DFwGMOMfWYTMkpEc5QdHlI3G2ho9V+j9SmrR9K7d8peJDh44glbPxanna4P74UvK X-Received: by 2002:a17:90a:e7cf:b0:23e:f855:79ed with SMTP id kb15-20020a17090ae7cf00b0023ef85579edmr11907316pjb.28.1679912927425; Mon, 27 Mar 2023 03:28:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679912927; cv=none; d=google.com; s=arc-20160816; b=Q3h4U5gmUlDPE/gVZiTZJ4Y4lmsCguAaiK4eHzaHRUw8aYelkhDsSsxEL0MZedmzKI yJj8ZUPxnk7VBrgFmFrLTJKcCCf3SiNZzz5YlHJRitkaDR3vSNXw5pJqXjb+xr6D67M+ cHjqXhMUHxH3dx3PeH2uXFG7Gv0l/ixURYpQd2+J9L3NLdwmheqhYLidTHraW65IOqif pVWZ3A23CYe52jKnOqyrAx376xrTS4xghh7xOQg8vOmy+3NZySEw1/1+ROzTNc6AjYUs NeOFi0anH9bToFrlZwJAfm4/zdF19WOwsPre6tc31lEf0izdNyQ4lSH1jpv1XGcwOLAw HXHQ== 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=Ay2vCNnTP4Qb5OEzh3s+tDDICXuornXYqSaVadHOyHyb84P5EPmSt88sprufD/iNuP QRHppfOuEi7J/sGAaw0oypkjOJAyvRtu6m9GiYEEqMrHruRqwcScIFbC63kklXxtNxzv 3N+aZqbwv8WvYwdjuk9KyXLA54lGPwfQxBtu7pzARSMuIswx7H50e5eSIkR6YpAekvop npqvpOqUpMOGGhVtBeC1pSuU05sMg280gCN2zdCPYziCafZ9U81iXajEn/0dZ/8lkRjG lhNHiaJ0RCXJc6PORTMrLNJo5frgmnxorP3kzWl0+Q+5Gt9IKJdKrEwbkdTLzN0QTvA9 k8fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=MHjCaeve; 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 c12-20020a17090a8d0c00b00233ebd4c537si10456651pjo.22.2023.03.27.03.28.34; Mon, 27 Mar 2023 03:28:47 -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=MHjCaeve; 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 S233693AbjC0KYq (ORCPT + 99 others); Mon, 27 Mar 2023 06:24:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233527AbjC0KYY (ORCPT ); Mon, 27 Mar 2023 06:24:24 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 156C4618D for ; Mon, 27 Mar 2023 03:24:18 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id m2so8169449wrh.6 for ; Mon, 27 Mar 2023 03:24:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; t=1679912657; 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=MHjCaeveR0nLvCez0W14hOk+lY88zGiY+MtGz7b37omDe49MRW//+Jh3ZX+LhPr0xf s38b+FeFevyydUSnJvBS9fnLrUofHcA8omadWCa31JPR4lCjzeWL3pNqmKUsXy9FpY7f PGBtJm4HVfSgIIp434awf4kpHGCJqZBQY9EvwL/CwRAx8eG3EuiXslx/hutQmuJXwveP /tzIs6Neyad/ysb/ObQKKswcmV5A3bzkqXKVmGuAlUopwt258xASbe5muXa9NQTtarM8 LUyTmSjnRR645SKYQIIZC4garvFLy4rbiZYzDpVHd+/SeCbHXuN9YSRz5oJT8rpG7UfO nxyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679912657; 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=eJ7R8Yd1uYr3yiBnME8HkyDDtJK7EjR3093CNN8gnJaOAuL0lpU09X+F3F7rJsKH/g KSS9AAjyTEwfMrlzJK0FM71pn2ju4L7j0T5cVg2S0n9VdC1dVMgXawO0rSIBb06dM/7K 2SqySdcQHw5Ked2iV1Hq4UcUOqSetxUqpkQ1Y507BzSbePG17ooV21VNIcDfqtm4IwUR dEEnSP3sHzeFNhsQ5VesC7hx89xrIrkQV0xkJZ/Bw/UOwXDQbckmJiQIC+kq4Rr4wkOj iSXw0dxO3N0RRwkEt1P7aTWZiKDlXm3e3WcYzUtY7DfwBk/1Q37mySyRmsbKXTo5bbL9 5/qQ== X-Gm-Message-State: AAQBX9dpohaIcDVoRJk/bhT3SITjK9KiwzV24U0LQHxQpZeWjm7W685N heZPwGjDeHiL+F5QDmcKJltHEw== X-Received: by 2002:a5d:420d:0:b0:2cf:d25a:635b with SMTP id n13-20020a5d420d000000b002cfd25a635bmr8804536wrq.62.1679912657412; Mon, 27 Mar 2023 03:24:17 -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 p5-20020a05600c358500b003ef6f87118dsm2220615wmq.42.2023.03.27.03.24.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 03:24:17 -0700 (PDT) From: Matthieu Baerts Date: Mon, 27 Mar 2023 12:22:24 +0200 Subject: [PATCH net-next v2 4/4] selftests: mptcp: add mptcp_info tests MIME-Version: 1.0 Message-Id: <20230324-upstream-net-next-20230324-misc-features-v2-4-fca1471efbaa@tessares.net> References: <20230324-upstream-net-next-20230324-misc-features-v2-0-fca1471efbaa@tessares.net> In-Reply-To: <20230324-upstream-net-next-20230324-misc-features-v2-0-fca1471efbaa@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/ZANAwAIAfa3gk9CaaBzAcsmYgBkIW7NXKdb4dxMlhzSbDAHfngN3I6Tno49jBB1w 9wkpMWGEhGJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZCFuzQAKCRD2t4JPQmmg c92dD/4zNxMiqdjA6KqIPL1tAFlRl6VCTI2idiN6Z8PkYq3y0q07BFbQ3otEDtfcVqcWc3C5r8V BOn2ssLS34vGjWxMofBz3E4L7CmUpgVBPuaLKHq0S8w/cM0nBuvCsqoyDM8XaHvGqlyYEIdkhcq FkjwM4Ut40WYZbZfeeMPtR9AzYSVwHrTIj0a9U++UV3Bw51bOVI3T3KqctrGf+YNEL//byka15o h+eSU4pZ5dZcWj/ohiSaBKZ7bmKaGBoE2ttG/Dp5NQftUakEdWEVy4jNumKOSIVjBx+TWbGeicU ObkYtZF+OxWdfCuPjc5vNJIkzBh5vmziu89eiEclc7l17/2bacpfVX0he1F7l7jfx8heml1bMbJ KcFhuB2CbjK4btrsgRaWWD1gCcof6AvTBSoE5cIMIrH2RWo9aNZJ2XL+KAg+5XCOopi0CNniWdG 1bjehBk62nXEKfp5jMsK6qH777uJPKRQs6M575gSI1Fd9ZBV6VC+UWGaZ99b5dztnzIHZd+YS3t 5mtb/xFZ/mm0LA7hLqpHCNiyFUIf0A9NvspXvQ3jEpCYG1vSkcb3mKA6YbFi3bXxjUJVeOW5ZJD t9Fp+30MyxxZeJ+AaVHnhWfrFJhRTATxYf7ZDPxB+oPBVluRzNl40Bbs+ajQ4A95dszExXBfj5J /5v6Gn9hz8U7XFQ== 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?1761516378104417921?= X-GMAIL-MSGID: =?utf-8?q?1761516378104417921?= 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 }