From patchwork Wed Nov 29 04:08:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13472180 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2080.outbound.protection.outlook.com [40.107.13.80]) (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 DFE8B566F for ; Wed, 29 Nov 2023 04:08:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="OioAOSFP" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RZIAcfWTeKWrua9A+d+vDjKTNDhTKx4510yU6xallhVH8FF8cO36HUmYruo2yKjpGsGpm/rXb8vqdDY3ZaKOTq7yquxp1S/HZEP4k9suf0v9cN0n6xuIKHAG50XeEsrlsILgL662hoE9Yl/F32PTAmVSVX7L7Np6jQBU+EgYIjZfmv+sCapC2uAhjD1XYxSecsJiV8BDgypHy2C8zOtSf40QHTELMrCNG2p7kr1py1Wb31uXbv9yGeHHeuYTrmlb6Qt4BWJdfso3qV+Bzj1pWV6YsVYtFP88Y53wWzf7opvnla3xL8viJzkstCGG1fyGX8mRL9pSqeFkAK2OHPCFAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dSjB0p8eF+L9rLQzSCrjmuOvxEFcgy8tIgNP4m0pVvc=; b=UtAayFu4eM43r3YuWhOK1vPejAAe8aaUNsygjLu8xiNnA2haCWZoAZ8Uwju9aQxOxPNRiw9gHlo5XwuJJJ1kT1Z5lVLuuGvMUZ7+PCti0JPc38KYMJz0oPBdPuWrkJOpRzCfCx0FU4gClAHbXHYQKIkxbsDrn9t1TBB+rnx7WRdsny+1xBuPJ5Cj01mp8p18vEpznKvSuwiAweiDm2CmlDBoxliLOHJZFCVZdLPooN0X14LTOCIss+EJgIUqlPIOeLyY1CVr0v9v9zmfVfxZGgcrVFqK3Helg+o+CVuE8Pa2kdwOnNBQqIt7T5Q9Hat1h8uIz1cf95oQCD3SmrxpSw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dSjB0p8eF+L9rLQzSCrjmuOvxEFcgy8tIgNP4m0pVvc=; b=OioAOSFPX/0G+rB7TnUhYh2gYWcIs9v48KOZS7jTvmHrm5w7xEa2qAh1aVnpWxjiljij9QpRJPTJqfcVPNG5KWBxNlistOJSDhyJYVA4zeU4C7nP8VDTAW89LT/vTT+V6phUsjpiX1x0dw9/o9JkRE44i3rJVWlTAn+qC4A+mBoMrTLSI5muNzi+FiI5BlvRQa6aRFKERUwx1KLVJh4QTxwQU+dobgRg+wgQeR9c4KveFlJQhnvk9IyC0D8OBxZkD2VIfZ0J1IQ6D3xdZCxoW2abUOAaGRuPvobdq/b5p/KLDburb8DFCmOBR2O+h9QKVc7oIdtZ2LGHhZI13OkvQg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by GV1PR04MB9118.eurprd04.prod.outlook.com (2603:10a6:150:25::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.22; Wed, 29 Nov 2023 04:08:37 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Wed, 29 Nov 2023 04:08:37 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v2 1/4] mptcp: add mib counter dec helper Date: Wed, 29 Nov 2023 12:08:51 +0800 Message-Id: <8308ca9192aa478bdfc274757dd31bc4e47bdc7b.1701230012.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0046.apcprd02.prod.outlook.com (2603:1096:4:196::15) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|GV1PR04MB9118:EE_ X-MS-Office365-Filtering-Correlation-Id: 5faecb75-0e22-4008-4a26-08dbf090dc76 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8cQcG2CPp6bJhy3q0r/LO3d45zatZB6XDQEb36p9WR/Jq2SfNs9YZypTN/VJ/y8P5vig4a5uEbmTkBr7zLq64qbMSA/nHw71pzb3ut3CtDWGaTw2k/EUiKQVZ2DhTpqo1kmJPfGBzaduypWL2fpkl8yqouAfBioJyqNYongSAgL16PrMAxTtjjb+/Y37uVk2C5eKImLxQoTEK/L6uo6LAQUQUWCfgSd5OZtpp4knibvPEC3cFg4Fu423K1v1MgjM6G7dSK+Ei85lTOBJZF6AH1orr/bt+ut//KVxVu2XdzoYLzoP8pEpZgevhzG4eZI6G4daz+Y+Va/pq0HzLCqEemoYxjoSs+LkewFB1V5n8aF1W6oLqhOa7qzukJlcwoj6hgteGG+mg2ceRoBjXga6QHot6B/XrLMSKAwV3gMD9N1XSgh+NDFtmNiaJMRanP/NS3zHbIPkGMWMVKcFViFni+q89jqdiI0ufZkHpTNkA99GqGxc8Ie7ulB0PwfMd1MkzSfFmOAe1CV6KGRQOobf0HgXBug2cZrL8BKGCSLq9HWlPnq+ukUNRjqxXz7Ox0+0mGzP7ut+hlUMhiUBuuW3nqupildw1ezYvpnhTI8xsrM= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(136003)(346002)(396003)(39860400002)(376002)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(2616005)(107886003)(26005)(6512007)(41300700001)(44832011)(36756003)(6916009)(316002)(66946007)(66556008)(66476007)(6486002)(5660300002)(4326008)(8676002)(8936002)(86362001)(6666004)(38100700002)(6506007)(4744005)(2906002)(478600001)(13296009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0ubpumAUAqwjYenCGOwjU1LE8/zxCDo6k+3Oao7fFS6qpWOWhNdB05us8pS3wFuAsofFCAXGtSdyaOPjhWkOBQGBR4VCeqDiMyWK2W+/K4ixaFVL2xSfgq9+VumiTU6FZGl+tlgHENDvzt6mLzvBe/1wbKqRAyRso+qVdlLbF2IuP8a5g74gBBgpPt50LAobdZFD4EIiDVwpfGi2s3G1h9tjF9ZgGFjI6uM9OcCGQlUHyLISU/bAxM/WL/gXbDIV+wiMCaSLE4JRwUnCePVNHQtsI9T2mD5deDsqTEyc8F6GvFKoMZ7icaaHY2ggujH/9Omb91JeQLfTbdxb/R67Egf3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kBGWmEVnCJvkaPja1SxHnO3gWh3kvWMVKerrHBBHHkwF3UtCNpD+JtkYfFGZWanXQ/Y75xfhdHtV94IceUTNj2zdu8Q89xTYO/Z1vEiOxSjzQyASpUcDnyaUcfT0xVUa/gUxlyGMVbBvKbOv4yZDLmazS4JjYRgGui6GJ68jA/uIhMl5uj3A== X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5faecb75-0e22-4008-4a26-08dbf090dc76 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2023 04:08:36.9821 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: FMw4dGuTcAjlLnzu1jqn1EsbX3f5SuqQCZ/TwXrkin8X8da7hVPZvRbwuoCTr77rBnohUfYAEyOlWEaGLwWPrQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB9118 Similar to MPTCP_INC_STATS() helper, this patch adds a new helper named MPTCP_DEC_STATS() to decrement a MIB counter. Signed-off-by: Geliang Tang --- net/mptcp/mib.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/net/mptcp/mib.h b/net/mptcp/mib.h index cae71d947252..9b7c366675ec 100644 --- a/net/mptcp/mib.h +++ b/net/mptcp/mib.h @@ -95,4 +95,11 @@ static inline void __MPTCP_INC_STATS(struct net *net, __SNMP_INC_STATS(net->mib.mptcp_statistics, field); } +static inline void MPTCP_DEC_STATS(struct net *net, + enum linux_mptcp_mib_field field) +{ + if (likely(net->mib.mptcp_statistics)) + SNMP_DEC_STATS(net->mib.mptcp_statistics, field); +} + bool mptcp_mib_alloc(struct net *net); From patchwork Wed Nov 29 04:08:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13472181 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2050.outbound.protection.outlook.com [40.107.13.50]) (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 364CB63BA for ; Wed, 29 Nov 2023 04:08:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="VSBsqeQk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZvQJT6jQGAfm3WCrIz7CZUdjZy4DncQmNU9vsk1SXqh2DUBEdrM0JYK2IxEFjcHsMiawI3xcOyJ5jwvpivJl5Wl6bLvd4L39gTNEhRoVUDZ9sTI2Inp09v4pX+/SQRijBZSw5fVFxd4h3eaz8Uk/YY1wTQTzmFQZOWZb6U2kygVV3es071KQb+DZwJOMLa8L796YELSp667/XvABnj9HKrg2H8q8Rq46y7Mex6JKIiJAAAVOLLmvroLQSH2fKBRBgOHy9UT4sguTcuWfKFLAoe4MZ9n5bv+MkCtuX9idWZYqKkKqGYU86iXuNQtELyG/gJCoyNycJDjhtjL3zfQOJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iJAk8dg6gU0u9mClrfebSdE1UMczyeSf8LWMrUrVkho=; b=UB5hKey/vuUVvG1rKSCXoByyscEhPQUuJdAjmCvf+44m2PEoYur+HIxl9ssgm8NaYPsAknNpuoykutsh4+OmYz1b13QqkNDwRIFwbwoVMCsF2eaM5TSDVDktDtqrTNCRvrAayegVm+XzKN85blwQT50rn+8kRxWOVikqwidQwWqhpDGlZFHEUuo2WN6+vIuEe8YR0ZqaAdhNjTXlNFkslv2779jY+7qczsgFb3gIKG8hT5KDK1fzlWENjR5/oGZxilUBX1rgazH4zH42xffXqtg4hn1ZKXohhCiG6Xf/EZn8Meh8TRpWnJJhZCANK7qy+iX67OmKqiwdRCLMxCsGJg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iJAk8dg6gU0u9mClrfebSdE1UMczyeSf8LWMrUrVkho=; b=VSBsqeQkVAhCZ5Hc0D9x/WoIQWfHiNsYmYehUIxfvM4JqDDvpeImdZ/2g96N7KJm+j0Ut39BEyFLKTLMHov9IYxdAdlojh4RDeG2Sw8+iovPjBvvDuo1Efh+RxQOCx/V6Xf2uRnI9M8BqdGoO0PXwPif4r1YV/gDN+NnalA5116bMfIgKcsJIkYyKFqJYjJvamTcG3j2dlBXpVCMEA5iXkgST64BLcNKhDHfEYhyajYEmjk8zZVlXpRpovMMsN3up4eQkCQU52b93xBWmVWWgOuEs0Tl0CEz83JqAvvBu9D9w8YTh1eIZFxkZmz7q+Jlwk5IkDUqjsvTZ4b5nwCenQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by GV1PR04MB9118.eurprd04.prod.outlook.com (2603:10a6:150:25::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.22; Wed, 29 Nov 2023 04:08:43 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Wed, 29 Nov 2023 04:08:43 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v2 2/4] mptcp: add a current established counter Date: Wed, 29 Nov 2023 12:08:52 +0800 Message-Id: <08a899096030f74978b31add1a822f439f7127ba.1701230012.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|GV1PR04MB9118:EE_ X-MS-Office365-Filtering-Correlation-Id: 63021c35-5155-45f6-7237-08dbf090e008 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EFrEAeQ38GJrrC2e5RZlys6UOr40+j+3/R86yJ8iAIAxEs9yW2XMBh4kbBnGFQJihKuhN7pvmLCeQpG2Vr2WRXcv5M+5p/J/is0xIwRvIzWj+6EROxnJNtwSrJIyfp1zqbEBnyQPQd6f0stEQWOwfUHwHIfLO+yw8QdK96YUf/OFlBDyy9ib/HYSfkK0l86soXU0kK5LH766rjqXk7Dnb9LTnTTgXqywE8CBW4j6gAio/H8ntetOxJ40haLcBp1F7mTo8ejxtd8UywaED8WnlksmeVvOGVR09owDykXzL7Q/RBnHam3yyQp9KR0WIDkQWcvHJbXHnaDptJNk+9T4JYD4Y0EVQjsIVVjJFIWp4ym1mUze7bKhdb1CIHIGxx9QBU3l8X0QDcirFNV2J09cXHGwo5zbIx+iuW1Gn3Cs4RSDV1qWZNDr/z9xS0O9bivFZD/9lXBC3a+v01hiuIjaZXWU1yK7UHIedM/L6V6Zb8SVaQsheB+bTlL7m/xBh019VCAcV0/b+vPAkPEc6qLWPPshkkj5j/qJFN3fptMNM89KRpu3hGLLspbml6oV4vnflhblb6iy37ImwFT/DyT9BEibRwVrWSkE205haGGYMjA= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(136003)(346002)(396003)(39860400002)(376002)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(2616005)(107886003)(26005)(6512007)(41300700001)(83380400001)(44832011)(36756003)(6916009)(316002)(66946007)(66556008)(66476007)(6486002)(5660300002)(4326008)(8676002)(8936002)(86362001)(6666004)(38100700002)(6506007)(2906002)(478600001)(13296009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JaCU40BPe0nZ3T4kik2fnumwAOw69EynN5BkW0HmsXdkYHi2rnF8y4E78Iv8RnIOWSQowaemtKHBbdKntlQsaiWCTMAg9j03JosIbUHf+zfxYgKML/IM4tHKu8q33zA36i8vei7AESe9IOswK4wMhWEkVz3zdC9Cj14v/p+kphrcGKsUJgNC9Tf5w66PnKQXJZhe6EEUxchP0B9wSgOqnSkZqky73EgPBSOoc/pkv0SM/o+G+cL6tXZdzVLqkzL3GhH6wrnyNps/ZwPxftfUBmDPZ/ioyUS+xEqLo/LztxGT+1zbBlo6+WQ+/VtjV19gWSzI43sJmvojT+fxY+nuEabAdi5eAeGWuViaDDRSvN6zKWN0aiYJ3PK6woQEbzuykxXQTlyqaLZ1GULNW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XCfXNkKkgnjd+lJA5jj1rR4VDVa33cpGcMIUGjjqd3qb/5W/Ua0hV50rAcls63MrIW2eenpRFbOhTkcAouDZcg1CieTymgF+mZpb2bYQuJeRmU4i7fD2hsHqGu9ZtHWjVcdZMwaNs0w== X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 63021c35-5155-45f6-7237-08dbf090e008 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2023 04:08:43.0761 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7XOmHjjKQhPzWG0LsxK+bVeEI2lfuFSquEQeJXBaT9ixI/askyyy57anOVb+XDG3iWLZ32q3vGjD3CxkbVoUdA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB9118 This patch adds a new MIB counter named MPTCP_MIB_CURRESTAB to count current established MPTCP connections. Signed-off-by: Geliang Tang --- net/mptcp/mib.c | 1 + net/mptcp/mib.h | 1 + 2 files changed, 2 insertions(+) diff --git a/net/mptcp/mib.c b/net/mptcp/mib.c index a0990c365a2e..c30405e76833 100644 --- a/net/mptcp/mib.c +++ b/net/mptcp/mib.c @@ -66,6 +66,7 @@ static const struct snmp_mib mptcp_snmp_list[] = { SNMP_MIB_ITEM("RcvWndShared", MPTCP_MIB_RCVWNDSHARED), SNMP_MIB_ITEM("RcvWndConflictUpdate", MPTCP_MIB_RCVWNDCONFLICTUPDATE), SNMP_MIB_ITEM("RcvWndConflict", MPTCP_MIB_RCVWNDCONFLICT), + SNMP_MIB_ITEM("MPCurrEstab", MPTCP_MIB_CURRESTAB), SNMP_MIB_SENTINEL }; diff --git a/net/mptcp/mib.h b/net/mptcp/mib.h index 9b7c366675ec..dd7fd1f246b5 100644 --- a/net/mptcp/mib.h +++ b/net/mptcp/mib.h @@ -65,6 +65,7 @@ enum linux_mptcp_mib_field { * conflict with another subflow while updating msk rcv wnd */ MPTCP_MIB_RCVWNDCONFLICT, /* Conflict with while updating msk rcv wnd */ + MPTCP_MIB_CURRESTAB, /* Current established MPTCP connections */ __MPTCP_MIB_MAX }; From patchwork Wed Nov 29 04:08:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13472182 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2075.outbound.protection.outlook.com [40.107.13.75]) (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 50A5463B6 for ; Wed, 29 Nov 2023 04:08:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="dV04G906" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NA8QT9SAcZtZfj5xpVa2OcvWUAbG3qvHkfjGOxfyPOO2AQANUs3zOmP4nq6c07KW6iyqISVZ4y3CNThmGJfKJC1kjb1F9DXtlltxGzNT7QQMRwXnFjsCRk7u2B2or/+Z4/U4/fKuvVc5Ks8gaqyDWbtVxmf2AzKaw/ifoRM4RKlSKqV6EtNd4TtOLkSwJfqyBbVT1t5uLcRXmDRfb76y4uVo59hF6eqMoSPbi0Z5QOczEDiBG1FsG+bUC7H3VZ4dLNv5pfhlbqiNGn9BlP9XcDBU+PJRPX3bIB/S740OzSOWPFZyRwPaqaJ8u3e+OsAJrSRIZpAlmOPbqc416cpH9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=a/FxsarSo9k6d1N9RVgvgH/s8I379rJpWlV0VVud1n4=; b=BpmMFuC4Fhqh9dtlHbXl+q//D1ihSRmIKjDqYvBOBERiVCTsC5pc7sMxEmcY53lNNpMTM/QSUfka84RXyeXrau/EuPFxc3qWa+Le3mnJoUp6y54/vbPpnVSYZmmT6V7C7+uccmpOMKoCp4OoU5T/vn9dYEQWgjX8ILZmfVNvXFZnkMfRChNzBRTVQR5FtcQGNnX2S9O5HnXpoP6y4wF/spM7sv0FkYBaSIlTjTiMHq2D0qBxcbB/4Ckt+LvDRwmOjDhLKRzaUaGj7lpJTCigs8waCRp562HoQJNWSw2bCMvudcKBLnlu14Po83yVV2XhRwu1EL0NFpjXhyH11m3AXA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=a/FxsarSo9k6d1N9RVgvgH/s8I379rJpWlV0VVud1n4=; b=dV04G906DMPOWPuDG8BtA+ZrUONzb9+NICQgcTaHvPmS/lp1TjO4PW+7DVpdTJydicwYE79Dftq26sM51yNmA77ruQ/9oiX0xW3XRhtK57PRGHNlvUHh7qJcvqSGWIYUNQswiY0cy/whDrlTgJcLdMxML40XmkiY577dAH9HDG/CdWTxBonTOp+pMcgfDZtnAHVST06bUxPWLAWZ3m/JPO/rjW62iwbOBos7TLzGlgZZEXfJL/c9YM0yyJAmQJWyUkw5+rEcS1lM6H+tTQa0IlBMimM3LMhhqwyhr0gYANuRA3OXbE1hGXWc1nK6ngecYATHA1alMWjzuNmX5SsIRA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by GV1PR04MB9118.eurprd04.prod.outlook.com (2603:10a6:150:25::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.22; Wed, 29 Nov 2023 04:08:48 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Wed, 29 Nov 2023 04:08:48 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v2 3/4] mptcp: add a ftrace callback for tcp_set_state Date: Wed, 29 Nov 2023 12:08:53 +0800 Message-Id: <4323a04943500dce8c072c49ce50b21591357876.1701230012.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SG2P153CA0053.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c6::22) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|GV1PR04MB9118:EE_ X-MS-Office365-Filtering-Correlation-Id: 4992366e-c176-44ba-e6be-08dbf090e2fd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2ntIm0fHIQt1knVxm/XCrThQzkfFepDCp22Q91LTrpzK/8ZUMbKRPLxkff3oHXfOZD1ba/djX/L51afAcfmiQOXB/QRgfFNLKVrNmq5ffhoWqRC6ligAJnSj/7MldcApgFdRX+qLRwWSMkz8GY+BVpVXmM6AUoaMeh+X2CpkZm2CszA8zy9ge/gei/xaNJcJ9BWltLabyWuZNlsuIAU7m69HdHDI8RmWucKifAaUH3+Su9lFc/Ln/zfUF5DyHM1IS/dtNM8Nqv8D+0nybO+kU7QYMGMLDoh4g+EXWx46umhN5Li7EuAWCKpR7DaRJSwxrUKx7KiXJ//1lDGg7JNEqK6BNX3GqCeWCT2WOcp9JDlIcuGLF7NQOs6hoOjepwXXuxZoJ+NDFHj8wJGpPiF//lVHGtdphskAfwhCxE84LL6iKfPGBZmgJfIwnQ6p+xnvUcJUfB7vmNbsdyvkbC7N9vSJ6OKcMfIqKyXapqOa+fEjmiP9KPWpsgNPuE0vhyA73YIQ4X3isX8abKoSAdSYS7gWOA1DXqTzfhseAV0cbb9wD8/ldlCq+oL7GIUDUZLqxisBZeuxbw85BQ9JHI4cVu1ZKt27f0mMun8F0Mv83JM= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(136003)(346002)(396003)(39860400002)(376002)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(2616005)(107886003)(26005)(6512007)(41300700001)(83380400001)(44832011)(36756003)(6916009)(316002)(66946007)(66556008)(66476007)(966005)(6486002)(5660300002)(4326008)(8676002)(8936002)(86362001)(6666004)(38100700002)(6506007)(2906002)(478600001)(13296009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qIWelLUclWa+Ml2ameVwwZNHaIRE/QRy9HnQtNyZglOwBpGIs+g6ZQHLdU4lMPLLrVRTTI5nmgUl/WX693+7N1vWwqquaTHec1yk4J+CJdk/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2Uqp900jgu+MOfr/BLSYj1tvKWVDNsTde8LiCf6wf+u/bxOqPtAi5UQZ1HMc9ox78P/AgDWwv+eP9hobwBTGppLbXc8zr5olDDEeEPMDJCLa+yXTzZfBuv0/gjGyIOnDR4N5JMf3tDosDaH6RIwX6UG5T9P1z+m+Qf+mmx2dK/K/optpPz0DnD6SCa84WSzqHIloKgRwCRUh+GaxRgVHusHv+tSzQuFepsWb5QQukscKB5ZE4etmYNei4bOrpzNU1aTE+k2/l1zk6pCCtiPD4wQE09uBcood2hNn+efDxRM68m7UAh3eL3pePaBypOwcPI+DsEzwxRO9rGFAg/WXXdnhtojT4Wc3FMg9n8sPcsaSdw8X1Nazh17zPSSa/R0o8ts5Nd5iqAaaEUA9i1qNW+VZokbkqWT5rOUFeuNsMPNvO8ZVA== X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4992366e-c176-44ba-e6be-08dbf090e2fd X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2023 04:08:48.2220 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LOc4RDwTNxbePS/dgxyM6djlVsjMvN1b0aQXHjsDKpi6B6l8pQ581vEd0skLF3gHT0FBM3dbR++v1Yb+j003uQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB9118 This patch adds a new function mptcp_check_state(), in it if switch from or to ESTABLISH state, increment or decrement the newly added counter MPTCP_MIB_CURRESTAB. Instead of invoking mptcp_check_state() in tcp_set_state() directly, here add a new file trace.c, in it use ftrace to hook a callback function to tcp_set_state(), named mptcp_state_callback(). mptcp_check_state() is invoked in the callback function. Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/460 Signed-off-by: Geliang Tang --- net/mptcp/Makefile | 1 + net/mptcp/trace.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 net/mptcp/trace.c diff --git a/net/mptcp/Makefile b/net/mptcp/Makefile index 67cd565bb321..bf88bdb222b3 100644 --- a/net/mptcp/Makefile +++ b/net/mptcp/Makefile @@ -14,3 +14,4 @@ mptcp_token_test-objs := token_test.o obj-$(CONFIG_MPTCP_KUNIT_TEST) += mptcp_crypto_test.o mptcp_token_test.o obj-$(CONFIG_BPF_SYSCALL) += bpf.o +obj-$(CONFIG_FUNCTION_TRACER) += trace.o diff --git a/net/mptcp/trace.c b/net/mptcp/trace.c new file mode 100644 index 000000000000..7dc33ff88813 --- /dev/null +++ b/net/mptcp/trace.c @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Multipath TCP + * + * Copyright (c) 2023, SUSE. + */ + +#define pr_fmt(fmt) "MPTCP: " fmt + +#include +#include +#include +#include +#include +#include "protocol.h" +#include "mib.h" + +static void mptcp_check_state(struct sock *sk, int oldstate, int state) +{ + switch (state) { + case TCP_ESTABLISHED: + if (oldstate != TCP_ESTABLISHED) + MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_CURRESTAB); + break; + + default: + if (oldstate == TCP_ESTABLISHED) + MPTCP_DEC_STATS(sock_net(sk), MPTCP_MIB_CURRESTAB); + } +} + +static void mptcp_state_callback(unsigned long ip, + unsigned long parent_ip, + struct ftrace_ops *op, + struct ftrace_regs *fregs) +{ + int oldstate, state; + struct sock *sk; + + sk = (struct sock *)ftrace_regs_get_argument(fregs, 0); + if (!sk) + return; + + oldstate = sk->sk_state; + state = (int)ftrace_regs_get_argument(fregs, 1); + + if (sk_is_mptcp(sk)) + mptcp_check_state(sk, oldstate, state); +} + +static struct ftrace_ops mptcp_state_ops = { + .func = mptcp_state_callback, + .flags = FTRACE_OPS_FL_SAVE_REGS, +}; + +static __init int mptcp_ftrace_init(void) +{ + char *func_name = "tcp_set_state"; + int ret; + + ret = ftrace_set_filter(&mptcp_state_ops, func_name, + strlen(func_name), 0); + return ret ?: register_ftrace_function(&mptcp_state_ops); +} +late_initcall(mptcp_ftrace_init); From patchwork Wed Nov 29 04:08:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13472183 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2082.outbound.protection.outlook.com [40.107.13.82]) (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 D130563B1 for ; Wed, 29 Nov 2023 04:08:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="AZ82rZ+x" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iHSByWVEBrR5pj3MiqGD0yY2BXJqsj2SzbjwQ9cwnFEuIoe+jLbsszt/vhAhZsc8pCQj5cfBAnk2QfGDd16ZJkIyZ31LI/kT8TUTZ+ObCmAnQZCspvFy5X3KRatuykFweC8u/KxCRfIs6fM69uEVCXxsrOP5sB9YEwMXhRp7BoH3gIWTfRnmwI8OC8eY0bnV40ADd9GojRVeqEuPJwMmnyRL6ZXVnXUTcI0iQSReiCPZsksE3cKSiR1HFwcFC5zeO3tA7MttFwUhqTEjr9HkN2AHigcFAurOBa+BPtLqSSLqOY6t+0bWy6XC2QE6HLAexiLCgafFYxaD4wAMccL7Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FnQTYz0XFDj+U/VmzjWysB9o+mCrYBT8oV31tR0XNkA=; b=CTUEvcwV0LtihD/3ggkVebZu/02rOA8+AgLmHUzDXYz0luLQ1ldo9DkPNdWsEmcOuX/emqd/dokGb3q3h72fs0982ROWYSVjjTNmBXL9+PzFgL/Fyt+c53As9htcx3pjVjgoKt+V6W9JzN/EQDl8Uq4Fm2WWQbWGBvbyaWr49neIgeupu5Ir+n10YjHfICNUWYG5SKWfeUD5GsAGFrEd49293JEQ5rU48ixMEyqDmCu4kAOYk3dgcmGk1LeQ4B6tQqGpYdx/4GXqz4TUub8DSkcl909uD+vCmDOhBMWXMD79UB4wiAgzmWuhOMV2ARKr5ZiwcU2/9+26I7He/7gcmg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FnQTYz0XFDj+U/VmzjWysB9o+mCrYBT8oV31tR0XNkA=; b=AZ82rZ+xe2trFDfK4ldIHoNNIgqIBjpSAvRU0wyrKwQ+QGk902an/KOfXRlfCOvaO+0QfLEG7jHR+yir0i21QLltqUvsHvXWHB/xAnvbKypTTlFTWf53SWXyOmtotdui0KOFH2NsxGKWKVWlOhBZTtjvsu6n5huqF4xKswhuoEapAW92EGilc5uUtNZnqEXlcLDZSuU1YW3AoqZAd5E4c8V2xrNgHjcaaZRMdbq8X7dhwCXDvvWvLBdkyxgdBL7oaACEZiQidu00UTitZOLWv6thZXUkN0+AgaKlezrox0s/GsJlMNXxtFxhOx9nPCeJiP+IcGuqLpEyReZ16wBb0g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by GV1PR04MB9118.eurprd04.prod.outlook.com (2603:10a6:150:25::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.22; Wed, 29 Nov 2023 04:08:55 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Wed, 29 Nov 2023 04:08:55 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v2 4/4] selftests: mptcp: join: check CURRESTAB counters Date: Wed, 29 Nov 2023 12:08:54 +0800 Message-Id: X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SG2P153CA0049.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c6::18) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|GV1PR04MB9118:EE_ X-MS-Office365-Filtering-Correlation-Id: 6bb8d286-91d5-4fec-8b21-08dbf090e716 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DTgeGz5xpXf0tWyiUIBXZRJ6EHuLIk3hjqKW3Plpc08qjKsu7uxncwsawuCL1JV+7gBTIl1TolbbGlaw5nHPN2Kbk4EFUlndEglLj25wjQMY53eJI6B95J26BgxO7QiLzGh9EOP+jnPvYoFughgTc2zjvEm9AI4Clv/XMD/vbXgIPMzmQLuItP2Xdsb3m6cr6ueqln2zV+cgt/4XZ1ymuAM+gI441IKoz5A8mpX6Lv8bNZrFNij9YEcARw0Kivkz9Rw3HhnjzoPXx5G2ZhJPgxbJe/KmVy6JaPhIA3frKCFsVKtVu2KKl3/WTVm6Y3LrYv/DGyhL+JDJa9kyGs3mcgoiL+LPqclX39Ngc8f/2rzk9dNs6truXx11ZhZdKmBmAVNjvrCDjLCff1xSgbQkKJU0avti0v7X6Mccjv4F0bBIgfdw0SHsM2sAWNEK0bGgjiwkhocILHWiyHIcAFiGLnhTCN6HGK+xer6QaxDa8oV+GnqCDGd7ifH2TdYd6Ax/9sLtVDw2hcHh1+YiOV9bvTmJO6vr97NFFqUtzD7z1h2qFKdJmM4pFrYHg48Rc0rAH1txqYqNfNrijZ3RWNA8xVzr006pk8x/WDERkkcRqJ8= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(136003)(346002)(396003)(39860400002)(376002)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(2616005)(107886003)(26005)(6512007)(41300700001)(83380400001)(44832011)(36756003)(6916009)(316002)(66946007)(66556008)(66476007)(6486002)(5660300002)(4326008)(8676002)(8936002)(86362001)(38100700002)(6506007)(2906002)(478600001)(13296009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rX2hiz/gh7EB/8DuFGu1VTR7nHvqVDoo7wS+qPrHrVg/wQJLYTQE0beN/e+AakiNTuABR8DkoS+DgGTaq/9swZgNIBsSmzlF+MlCJFNHiMl48lBP9KK3q/LsKZZSUJ5MfHV5gc96YmRrTVdmAvW/9FE7hlg/ZRudOGKRTbNxNtQ7goP5nR+wn+9n1zxqzvmtuiW71wlSkmk2akg/u0WbaIUFccPirZfD95Ys54kSeaLEZZ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xaHcJPfaz0oimBic8KuxA4xkkwWJCEwNK/3Y3dta9Pk+WsoxxK9Oa7o8wFoScO+xWD7hYpJbv99sOs5nzen9H8z2tfjfUpg5A3u7mXhvZieD1FzOIuK7ByuiGzmpZ3clqXw334hwMju95nmNwlYgZvQeXms2litwbdrlOce0MK5+/qDV5uXHYgXPW//0MbYhqKSq2wZPjq6u/awYz1T5VabpwkumMpie2CgI8fk4X8fpJ3rqZ4cZozlXE9EHsd0ZVKJqnOTz2WG5VJyL4GqEnarpy3A7X1TUHlUP5/kmYQuWQ== X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6bb8d286-91d5-4fec-8b21-08dbf090e716 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2023 04:08:54.9805 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: hkVz0wiOD8an2pZviUeWgXy+cUwVKxY/7MECPG2ZNF8Jibb+ziJJICZFIsnpWqQtWtDExaNWE93cr8fEhjWgXQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB9118 This patch adds a new helper chk_cestab_nr() to check the current established connections counter MIB_CURRESTAB. Set the newly added variables cestab_ns1 and cestab_ns2 to indicate how many connections are expected in ns1 or ns2. These checks are embedded in add_tests(). Signed-off-by: Geliang Tang --- .../testing/selftests/net/mptcp/mptcp_join.sh | 58 +++++++++++++++++-- 1 file changed, 53 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 87590a43b50d..826c2af6ab27 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -56,6 +56,8 @@ unset FAILING_LINKS unset test_linkfail unset addr_nr_ns1 unset addr_nr_ns2 +unset cestab_ns1 +unset cestab_ns2 unset sflags unset fastclose unset fullmesh @@ -976,6 +978,46 @@ pm_nl_set_endpoint() fi } +chk_cestab_nr() +{ + local ns=$1 + local cestab=$2 + local count + + print_check "current establish" + count=$(mptcp_lib_get_counter ${ns} "MPTcpExtMPCurrEstab") + if [ -z "$count" ]; then + print_skip + elif [ "$count" != "$cestab" ]; then + fail_test "got $count current establish[s] expected $cestab" + else + print_ok + fi +} + +check_cestab() +{ + local cestab_ns1=${cestab_ns1:-0} + local cestab_ns2=${cestab_ns2:-0} + + if ! mptcp_lib_kallsyms_has "register_ftrace_function"; then + return + fi + + if [ $cestab_ns1 -gt 0 ]; then + if mptcp_lib_is_v6 $3; then + sleep 2 + fi + chk_cestab_nr $1 $cestab_ns1 + fi + if [ $cestab_ns2 -gt 0 ]; then + if mptcp_lib_is_v6 $3; then + sleep 2 + fi + chk_cestab_nr $2 $cestab_ns2 + fi +} + do_transfer() { local listener_ns="$1" @@ -1089,6 +1131,7 @@ do_transfer() local cpid=$! pm_nl_set_endpoint $listener_ns $connector_ns $connect_addr + check_cestab $listener_ns $connector_ns $connect_addr wait $cpid local retc=$? @@ -2477,47 +2520,52 @@ add_tests() if reset "add single subflow"; then pm_nl_set_limits $ns1 0 1 pm_nl_set_limits $ns2 0 1 - addr_nr_ns2=1 speed=slow \ + addr_nr_ns2=1 speed=slow cestab_ns2=2 \ run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 1 1 1 + chk_cestab_nr $ns2 0 fi # add signal address if reset "add signal address"; then pm_nl_set_limits $ns1 0 1 pm_nl_set_limits $ns2 1 1 - addr_nr_ns1=1 speed=slow \ + addr_nr_ns1=1 speed=slow cestab_ns1=2 \ run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 1 1 1 chk_add_nr 1 1 + chk_cestab_nr $ns1 0 fi # add multiple subflows if reset "add multiple subflows"; then pm_nl_set_limits $ns1 0 2 pm_nl_set_limits $ns2 0 2 - addr_nr_ns2=2 speed=slow \ + addr_nr_ns2=2 speed=slow cestab_ns2=3 \ run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 2 2 2 + chk_cestab_nr $ns2 0 fi # add multiple subflows IPv6 if reset "add multiple subflows IPv6"; then pm_nl_set_limits $ns1 0 2 pm_nl_set_limits $ns2 0 2 - addr_nr_ns2=2 speed=slow \ + addr_nr_ns2=2 speed=slow cestab_ns2=3 \ run_tests $ns1 $ns2 dead:beef:1::1 chk_join_nr 2 2 2 + chk_cestab_nr $ns2 0 fi # add multiple addresses IPv6 if reset "add multiple addresses IPv6"; then pm_nl_set_limits $ns1 0 2 pm_nl_set_limits $ns2 2 2 - addr_nr_ns1=2 speed=slow \ + addr_nr_ns1=2 speed=slow cestab_ns1=3 \ run_tests $ns1 $ns2 dead:beef:1::1 chk_join_nr 2 2 2 chk_add_nr 2 2 + chk_cestab_nr $ns1 0 fi }