From patchwork Tue Nov 28 14:14:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471226 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2040.outbound.protection.outlook.com [40.107.21.40]) (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 A2B0935888 for ; Tue, 28 Nov 2023 14:13:54 +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="Q0rd5J8r" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jJiShoKnKSuqS3cxQAXjJ82uPrsL86YvWWkSsC2023S5c4cUaLSV4JPn3xLE7IS6bshHys/ZHufpH+NK+KUtKk95L2NEunpdS5583UCtvdfq43hymS/Ba8L0V0LNxTFTTq4dMfSB43zsu6uXQPxqKD6qL84mKjD9XGPYmuNThhxrTNrVOyDSZLgfmO7IIIGzdEHFBEjUw3A6bJjpPN21lO5tAQU4jpgO9O5ibviaO7JQrOvdOn8gEqE/cnQEjpUvsytLkVpr/ZiT5jmZWDtQU4Ve2qeQ9T8MUqvLAEVJal6mJMnLHgwi4pEd+hiQ4WKCR9TwQmiAEuVuEWec3k44MQ== 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=LFIgL8di5ASHHO4i8NB2T8KdqShuEbwERCSwUpaTprn5X7IrFf5+HxCI30IdyWzyXabExXSYjp/6dDC9xqJ9OxqwvqT+/2ENMwm7f/3EhVl/5P5KfFGO5O6HGZ5WWDOgdKT52Z2p/Uu31c8d8R0+6Vgo4zhUwYoIesH02mpN+ypQ2OwDfmgqzc2j+6rkExsdzosWdZbgCa2WAlUWPD/SF1dql2yBLuH07r3KzbFpw6Mtq9xupP55xTYT+FcUbsalXOAO/zbXUbSfuYwwA6KiTs2C6IiiyeCxvGqTLC5aaYA5IVhzLqn/eeQNr0Y6aQnQAqOqGctRli1Ew5tglsv8pQ== 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=Q0rd5J8rykMHOrjE7IH6uA9MTfIiEylXofhRLUrNbjoq/5X/AF2SQDrLO4kmWYKNoKO9XAIi4fQSNobiHCwge9KglG0yFnSg3aNsO3u53hXIEuX1GL/UKBQfKH2s7iNVaiaCpbnheTuLtQWP9OTbc2XURDNZ/bQB1JGUtr3unmemOw+1kUcHDYqJJ7KkoCHoS8m4X9wyhPBZy9b4g45mc9xDZ32vpFii0y7prqqDg+BDc6hHVL3OEPRHEBqQ/qh+yBwYUPz+aCQVd1Fegnrn0ENi/p21Kocw93HAJoleCYeCGo/Gx/+l4KTAk3oB6icyIPlEV0Tq7GRp02+r2YYYqw== 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 GVXPR04MB9952.eurprd04.prod.outlook.com (2603:10a6:150:117::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Tue, 28 Nov 2023 14:13:53 +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; Tue, 28 Nov 2023 14:13:53 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next 1/4] mptcp: add mib counter dec helper Date: Tue, 28 Nov 2023 22:14:03 +0800 Message-Id: <2ff0f06295f79c55aef4bca0ca67d112a09f60e0.1701180777.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0015.apcprd02.prod.outlook.com (2603:1096:4:1f7::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_|GVXPR04MB9952:EE_ X-MS-Office365-Filtering-Correlation-Id: 923fca3b-dc9a-40fe-f251-08dbf01c4074 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2APSFEoKwnzi2GYX/3/io7F30vQfJKikwxvpkmMHHC2NY5y8ZxyyFyl2uXLAUKH+hhuisY8qOrYY/dbHiDdafyDnfhg1MEoNR5VYAwL9XvO6octts1FvBiyLeLt8625KHfvUkOQMLCmhy+CEPhkHN4EtpiA07M+I/aVxTNSZq+aHxT2u8j52QqafGeF9y+T9VWdbmFZ0MxJ0PC5RAqG10wwJemuplkox45Nk8ft/J+B8SRD6U7mt4ZOgl2MV6HZyybAUcmhHyGsivC1oppa8uJsZ/e7xc9niPiTuIpWjSKzcl/3T8Cg9Q1t+NjXneDkdkBkjgdTEupdykF0xSaGCGIyQK21Q7H2TwX7RQ50H7jqa80P7DPzirj1HzFeIlmhh1D0y8SN0Xtf0q9I2SmIyk/BvQ/L6Cp3GCZDFTRPBc0x/Gu7zYH2VDdYrzozbDPqp4Dbb5xDY55qRifoIakPV8WPTgz36agd9F4sCAHDqvpkBoO8RTTwZmSxRQamllyELr9O10LuMLQG74KWsG4UB+hpZy/busHSBDOhifvAM7INDT2f3z6ryFG2sJYqnoD5f 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)(396003)(136003)(346002)(366004)(39860400002)(376002)(230922051799003)(64100799003)(451199024)(186009)(1800799012)(6486002)(38100700002)(478600001)(41300700001)(4326008)(8936002)(36756003)(8676002)(86362001)(6916009)(66556008)(66476007)(66946007)(107886003)(26005)(316002)(2616005)(6506007)(6666004)(6512007)(44832011)(4744005)(2906002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7XjcQ0miSBtGNeKRFl5VmIV6cPeoGyejDDH6wTfmXVaNi3UbMFTnrdBx3w1/QG+ZTcTPFsI8RhkCnROUtHSDTBUETsCRe0XmmrMtha8q0TmTV7ickcwq7Gep2R5itJmA9x7hpIMP4VwL5dp86dcJhpW2JccqvKOVvjyeVu/yfbLHYy6qm+IKdHOG2sJFfF3NbBbvsMmytLxIePadvurMEkjLKfjlSdTGYhjK8UdXP8ihNEvtGteR0jsubviPJy7nMqP/YHRQkOSH7YNKHVvCMcmRTmYw7JcUfH6lu685+upUSZ7GXB7fyvU1Ban5gG5eFXQUFiRZ/jXE6WQNKB0fdhflKeCLmwiES55d5oa4QSRhvkkf4mVVWAWZ86+z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i7d6t2a8fQlXfTkfnqHImUTliHqQvv1dw+JIWcDFpdEbDKRz1viWetlJqpkGeRnbzaclno0gGAfy16saonu9TZqPR+bLrwx+d2AUjfWj57U/dYaQ7GAbifvAig6eXcGXg0SeJ9jlpoiQj2fwktI X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 923fca3b-dc9a-40fe-f251-08dbf01c4074 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:13:53.5641 (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: urrGKw9NWNGDj6K1se3Td1oDV4f2+cFXXxAR7Wz97ORR1HS7wXDsAppBKtZ5S9sbBWVO7fXe3pn0L/6tvbPjKg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB9952 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 Tue Nov 28 14:14:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471227 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2050.outbound.protection.outlook.com [40.107.21.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 2FBBD35888 for ; Tue, 28 Nov 2023 14:14:01 +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="UplUO7gP" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cRFxGGLHL35GH438vWaSXDgzCKRFtI185/TNRElmmUNNk5tYAuhrH2jcIq6fMOoFFWqNZVM6zit4GgAqDJ90+fzbMASxanljZ2LZBxxNOTE4kVYTDtLoEsud10IcXgBa80F+UOuA6iBXXkclLBKyiTCCyFSvFSFqXPBvcqf1vTzHNV2Ybb3D1jewofmaYiCcHCvkUm6DLu5WgkxedgTiUSOwsiLC3btM0njdIbptZWV4UMzCjc2t1ro516JBEhLz8KRHH4TqB+Vob1lgz5jnwWSK74j0dEimvolxG+p0kFDDj8vjIje9gPXv8NXsVY+Yo6dL1fPQS2YvBqG9jXdlWQ== 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=U3AiVRn7SxxNJMan1ugZ0140YSsBxLwy8P4tRfhjwudS4XywCIMfdmp2rDdnB//iWEKdhRm8ROEHsRD3gk6+3oyp3TblO0RjZoC5Pp9goxPyM3EE5OxQJHDzF0P9owR6yrBhadaC6dDv9aHyl/T7on6x+SgozvOmNXXTArgI7L2PtRfuRv1HXW3erfG5gnBr8iMLZHN5F3VYdmHAfJrvzjKM2Dl3dXrdTVWSHy2+Jv1Lp1mN8FSaCrbuS/Hgi+vtt5v6s/1W3c0uF0bU8S+9AbkIDi0Nv4SVZ87jM7dExIOFSvTAtSG0u/bQr48xwk6qsa5BADybrPypZyQZFMLLBA== 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=UplUO7gPf/dGr0ZE4W1djb/8KcyK8jrwX7PDTJM46qqd4yes3fkqqWfQ947/XONjrtJStSDa0kYBZc84ty2Ir2V888kNwvgOebVs9x33Ul2tB6FkJlKb8YA9t/k8XTBrkJuIFV/aJPuOVj4DnvQRBwr+i+4Pq4wjKoP26eRP6pnGdnAsOY8P6Uk3UjjzgQLjnPfzv7hVoH0nYFy3dF0kmGRIcfi0PFfLnuHs3evT0IDMbIAO3KtgAg5ySoOC94vlSA0B9eq1XGHFtKg+xyN0wD8/HeLRCHWpg/k5654Zr6n3o81x5LkmkyOEB5tJqgBCkMkViSaeba7jPk23U1DtsA== 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 GVXPR04MB9952.eurprd04.prod.outlook.com (2603:10a6:150:117::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Tue, 28 Nov 2023 14:13:59 +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; Tue, 28 Nov 2023 14:13:59 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next 2/4] mptcp: add a current established counter Date: Tue, 28 Nov 2023 22:14:04 +0800 Message-Id: <054116a36337d50a847cdefec4696bf758f103fc.1701180777.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0006.apcprd02.prod.outlook.com (2603:1096:4:1f7::11) 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_|GVXPR04MB9952:EE_ X-MS-Office365-Filtering-Correlation-Id: f4d54b13-1e8c-4cf8-bb03-08dbf01c4407 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6hp16USHmXountSJv5JdfVQ/Ywy/+S8Brfa0vB3NZiN8ahENYPx14E8nXXSEiLoQT8pRPKfBpNiRdev6qT15JLEiK0cNF97G8mGyds889PBL/2rjkXqT0xVlyDCKHNDpzCabSRt5GNcmEnwThPUgDSPZ7t4gIpRo4eSWGHhSxVwB7K9Gx9zxFZ8elWqj2B+UkVsxoQu51ONfe3YCo8lyTtssezaBxrX7tfv3vXhT2McaTpvnFUYBpM+tqQBWzEiFsDTvrCKtIb4vpzZrO/ZA+D/ebGwEsNA39Ys82zq0Fv/ZWkvh3OnCIy7UNmqZqUTYEviGUF0TgkqKEaBSLO350t1jp2t9O2PsZuWNPCkJ0DbuJY0ShpvS2UAlpeOBnYK0Nn2D9+AA5w7UzRyGA8cZHkOKTZzc4Ugn4A5ev3ZEB7pWwuzMk4rOw8AaCcvP6mggxrV7Sy6yUgbXRwRu4nmGFgemoKrD0DGFA/CU679lu4tyFUpYldhP+HQ1QcLCDWcrQ+PhU4kDg1+P2s/ZX026KbSH979dneBrdX83B5EIS9fQOSuCX7A8U4CXlLvDLz14 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)(396003)(136003)(346002)(366004)(39860400002)(376002)(230922051799003)(64100799003)(451199024)(186009)(1800799012)(6486002)(38100700002)(478600001)(41300700001)(4326008)(8936002)(36756003)(8676002)(86362001)(6916009)(66556008)(66476007)(66946007)(107886003)(26005)(316002)(2616005)(83380400001)(6506007)(6666004)(6512007)(44832011)(2906002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dt6Ax5EzCz9HbBFI0cqDaaVjeJBxgY01LAV6chrs+OVbv+0bDq0cWw1Vf6iFdttcYo5avQtUWDjbaRQD3lDpyVApA1p/NrPezPrig38FXe651+RgEBpUaYrVO2NeYwVLB4kZzzHTUJrSAjP2yvIDJpK7bVn2JiYf3P2p9jLOyv3g2/ZwwY6Km5rCpPTWuRRgLxuCA4tvIr6EuRY7D5myLjiWmbQrXTo92r80KuJTDWL2KJG3RGJ32jVWyqcwy8uYunS9bF+s1iAiyOrrtO87fUQWkZWdzM7D4AYrfapg6xyat7fSGQ7vOpfFMgV6EAnfYgXCp6QIJlH8K9o2I7GTLDwYvnk9jvlpGB15+nful4r9wRpnOK2TZdw8ECdc8lbv/qIZxWOXDkB/A8qhFsxKxKqo7MWZcnKKaE35a/rNYlzMF/YRPn4T2OidvXaOlTZfHE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0Gxl77/S8PvQ01tLZyqMa2FYIIrGWyDSni7CbnRdra49nKIAPu2Ha/OzzI2WoEv0SI/I1FLB9GDQKcIZspTHvTD5 X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: f4d54b13-1e8c-4cf8-bb03-08dbf01c4407 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:13:59.5083 (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: EKGr+wNaw/5fRIkFiYhU0eFOZ0ewH3D4BEY3yRX09+OUBrp7WguGXp6Eb5Sq/iJtJzf4MC+gd5LeWMcTgGn48A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB9952 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 Tue Nov 28 14:14:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471228 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2050.outbound.protection.outlook.com [40.107.21.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 1A13835888 for ; Tue, 28 Nov 2023 14:14:11 +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="kaht1TyF" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O79hueA1ENQDwWB2+2G7LJpAUHm2u0PcEnSAdHC2qfCVcB8BZRapxFSJmcRGTDcyUZ7SSxQcSwdEztEp+GCVyD+pe4n0iLc8yTw8PxBqkFlnN9gJMeW/UX22JqWty1/HwaBunmhb4aJvVHZDjQB8pz2QA1n3MJhW/sHsZCFbRbDXYt50twm5P3wXvr2Zw/h/TGXru60LjSefYQY1+2/NnGA7INhRnayBW8jPpakJM6LwExBgNVMApOzWOtrjUWGx6kZMBdzw2BivXiCwiPt+A6QdpoOB5GpsS517iFIh60LzIDCbEwB5WCnyP2/sWHZb3WSCdWBRHIDGVRzUbNQnkw== 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=lF47YPjOh9vdRG/qjb68HzZW3mWc89WqtwLMGhIC7xQ=; b=cDVnRsNFFqwKQxrBT9P6z+H0W28oXCUB4XEg3xI8R6i+XJYRD57MsOlrwyrKv2V6LbiSQEOXptc7WBpt8Pn/FfUcx6wzCOG6pB4OylA6n1RzILB5x7gaKfl5NVrZ9gStVl0PQ8rKEWF2/7ch9ro0ATFuf3r+6btkDfuQsCJpXR8Vkk1mwr453RsIKKrODQL6657ysubwk40ve7SQqPv5NZnVbFEb0m5z14aGs400bsuYnqhjXFQRN/FTtl5e3m0hSriUiPe9H2wh9nvlWQH8Y6lxmOLhowuluYocQIfo/petQSo9ci4nT6ImtlmdS8HwQYSF0FAdPcx8Rnvj5U5fqA== 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=lF47YPjOh9vdRG/qjb68HzZW3mWc89WqtwLMGhIC7xQ=; b=kaht1TyFNWaoG/FGqgqGh5HhgvMOh/OH7v3U/ElKUuWZxkkxj6YNrppDbR8RjNO407ke9Jj++5A4QlWFQvV3WebSL/tgTfvG7cPKgSMlBLHZU9zXww/hkwynjooHmaR65iM0ajIZ2Azhb1w1UuRV3tree1HaTk9Rnq7pZZkNNiS0GPxk/Ps/+JHXnGDUCbA0A3AWwkvKhgeFTHWNJmsjLhOy4ow/CgAKjuCqtTkfuk5mKGV/QO02n6zlvNkPhZLjWQdKN9YrSmDKS9MKYJacbCIShRL5MP/uKaz4OQFruO/SCRGR6neaczZ2R9G9ftjZq9p53R5FW5E6SsD+EiLpPQ== 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 GVXPR04MB9952.eurprd04.prod.outlook.com (2603:10a6:150:117::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Tue, 28 Nov 2023 14:14:08 +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; Tue, 28 Nov 2023 14:14:08 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next 3/4] mptcp: add ftrace callback of tcp_set_state Date: Tue, 28 Nov 2023 22:14:05 +0800 Message-Id: <6f4baef54a7631cdc1460138bc7e52f2c432c69b.1701180777.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: TYAPR01CA0063.jpnprd01.prod.outlook.com (2603:1096:404:2b::27) 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_|GVXPR04MB9952:EE_ X-MS-Office365-Filtering-Correlation-Id: 32f4d8b0-6a4e-408b-e77c-08dbf01c4965 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KFN9yUGogpoIMMAkG16pTFftfmu9KIGvNhZorkecXk6HDxQkFzJh3CM6nUxGY6wIiwKZMtBveEyIelWfXxOkzzPLvUGWIv83bibbTH+Kt6H27bb2ZTLJrzSMxRGLCQgIF0FCSN5+Xn5ULP64sqYdi8GeSlCsy5WylN2D+1SNJjWF9RmfhYrj/DfQT4FlhLuJLi1vRVxfDp/H96ZADdke/LHWfTZVNCzTKI9kmvDVrvsMPw6nsKozeIW0GsdoTgSFPev3UJKeYpjDCVOr+B8QcCORgbE5ctqWy1bEiTIsy6+bmQOSAKUNwY8T66468EoOkrMPlMO103Jpwe8LW4zQcTHwdX58EsqUdN8EfLIFUZEKBj6S+Q7hyHmqd49OknHGQuavc+UpQMLdEYFLArtGvoDJIE9bGN0qxrXcqCL07AQS5r1Xp1fRzmgIJ2s0beV5+Mt1lbrZ+o0VoZ/mhEY2RZeJdzUpSgjknR83g4qDLnfFU6D2qluW8QSUf9sDOmwERUm3b+OP0GzrAJyQy+QHdtzFd0IQ5A1ukols4JTR3q0= 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)(396003)(136003)(346002)(366004)(39860400002)(376002)(230922051799003)(64100799003)(451199024)(186009)(1800799012)(966005)(6486002)(38100700002)(478600001)(41300700001)(4326008)(8936002)(36756003)(8676002)(86362001)(6916009)(66556008)(66476007)(66946007)(107886003)(26005)(316002)(2616005)(83380400001)(6506007)(6666004)(6512007)(44832011)(2906002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZLl7yez9Cq4KDNdALvMd87AX92Eye4BiAQx5eBxStbMnQTwYxqQulIOeXV0TzDjlPNy8AOPrJWx5SqCP0U9DuIvRQVhl2mON09Z6kds/oHXw+eX+PeD8i4bl2OmhL/K4rpQqelgev9tAwDBpt8NDqk2rxYeAKjyRCUIR5QlpcfD7WoagnP/Kuh6+RO5e3eLA2uzjBvJncoWxncHSt4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Lx4q5e2MsE78GWe8f2UlrgnX362vtzGX4pecSjIcoJ9frI7OfRdXHc6YCsqwGgIOUyYGbJsaQkx5Oqo1Vlpw6QXTKdvEgDFOcte1G8juKKOXsr/UqenSbQG5poQAJi2urZWPxGv7mgUCzP6yYuygR5f1ZVT7Vocs17xUxOPI/jreSw6JGUfKxkP0HC9zGbUxNP3HWscykYbV/LoEse+W2rEo/J4pEy0Oyj50+AUp+ewIQPD/kzldB/mOoCqybOll1mG9E81hIySBHhfiChFcz X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 32f4d8b0-6a4e-408b-e77c-08dbf01c4965 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:14:08.7763 (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: G1Oaxp4Nlda6yU6obCpOImZugzSBBrGTUAiSs/QxmpjT+qWGakidTMfVg+eUM44j8otjXwYrpSPp51BzcbgwoA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB9952 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 | 68 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 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..a930e1b50d56 --- /dev/null +++ b/net/mptcp/trace.c @@ -0,0 +1,68 @@ +// 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 notrace mptcp_state_callback(unsigned long ip, + unsigned long parent_ip, + struct ftrace_ops *op, + struct ftrace_regs *fregs) +{ + struct pt_regs *regs; + int oldstate, state; + struct sock *sk; + + regs = ftrace_get_regs(fregs); + if (!regs) + return; + + sk = (struct sock *)regs_get_kernel_argument(regs, 0); + if (!sk) + return; + + oldstate = sk->sk_state; + state = regs_get_kernel_argument(regs, 1); + + if (sk_is_mptcp(sk)) + mptcp_check_state(sk, oldstate, state); +} + +static struct ftrace_ops mptcp_state_ops __read_mostly = { + .func = mptcp_state_callback, + .flags = FTRACE_OPS_FL_SAVE_REGS, +}; + +static __init int mptcp_ftrace_init(void) +{ + int ret; + + ret = ftrace_set_filter(&mptcp_state_ops, "tcp_set_state", + strlen("tcp_set_state"), 0); + return ret ?: register_ftrace_function(&mptcp_state_ops); +} +late_initcall(mptcp_ftrace_init); From patchwork Tue Nov 28 14:14:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471229 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2061.outbound.protection.outlook.com [40.107.21.61]) (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 7548C35888 for ; Tue, 28 Nov 2023 14:14:20 +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="uvI1i5HO" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aLrJubnR3LKR2252wTA43df8/kKCy7iH0KPnVGsF+eiM55B12JoXqYyQpMtrDgdriiFwbdmWjUWOfSRg8BdOuZ1u50TXv/IjcPJFIPbPJPW7X/qFJGzbveIVHF4S3gEpiC5qnt9mL31pGdECfJk9HBFTumAKX095Sr0tomiBcMiJXOE8kPnTlJzGYvknlJ9C5h2k/kh1JnO0JqQTWj0awaThNWW5EF2sG0Fy31CLLEq6Biuno+Tln1/zpipaiKYUQ/qqfWhaTe8ocwgLbGzrzaN5Oua3t0Wc3MmFm7w6l9xvhiDIg8h5+v78ovsr0ilTdQ5pbcsE+1P0HEGgPjgvAg== 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=IijtOLKGKGDy0WN1gPP6T05HZT4cd7RaI7v8dZRk410=; b=UL4fsHV+Y+xtaKEhws9pItpouT0nAX17qXQPeRKaCzhTmGj4RXuVKUIro4T6aPX+ryAdv1uo2Nm7fS12MWKcXnvOVhXRJhCwfeQU0zoNetu1BWDDAPY18QfToMpY3S0V3KRrQ50W79HmF5Ds/9jrYfxPV/LSU88xvHVYX5IjbC19915Msw9b55CKQ+91o7KpcVaRftNgbhmPqDtwlG9kDiwgwC6rUd+gbDdPgIyd3/hExUF2L0ajrEol5UmwtVSgDJcvQ9SzOebw43cdOh/p757MuDIiG3cIK1WXMzK2S8w22bPjRJxjkhPNBsORF35mDcKjztdUh6l6gZhXu2JxuQ== 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=IijtOLKGKGDy0WN1gPP6T05HZT4cd7RaI7v8dZRk410=; b=uvI1i5HO6KuLSTIgRYV7b4tfqEizV0Nx7BAO9iJ6/9/EziGu7dy5RRHhRaCihjxWnzUO0Au90CuC8G7cy+pbDX5xShbZm4NucVX9arCTQ9um7r3+uSISih27/vE9PHb9rHV8OWv6FtwY85F70O8llJ3Xw+68qYG7DejeWgfazL2Nfne7jUlW/lhzlfCRBqsDYgzm/a6nwBpl0KK7bmo7qiA8MMlEt+bxrlKgJcL0tzylNZ8z84XgcW8hLAyfgHnc3Dom3ycwS62+zkdUBSdonwzgS/tSq4cE3m2Qc6bD7x6UV0Qt7tihwCGhRGCjcYUQAZNOvwXGewjtFLJ0ByHO0Q== 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 GVXPR04MB9952.eurprd04.prod.outlook.com (2603:10a6:150:117::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Tue, 28 Nov 2023 14:14:17 +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; Tue, 28 Nov 2023 14:14:17 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next 4/4] selftests: mptcp: join: check CURRESTAB counters Date: Tue, 28 Nov 2023 22:14:06 +0800 Message-Id: <0b59f639265bcd844b1d51597ffd5e172127732a.1701180777.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: TYAPR01CA0051.jpnprd01.prod.outlook.com (2603:1096:404:2b::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_|GVXPR04MB9952:EE_ X-MS-Office365-Filtering-Correlation-Id: 23f5ea20-6dce-4e2c-74fd-08dbf01c4e76 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kTwQryDBfx08CCUh+y2HBhCkaE2XjMki/c1TQenplwbCki9bRApkVAYPzw4Ja6Dkr9+B+w2f/vM/8x7z8Fv6ZK1GUbNy+mxEeXPgrv4Prg/I6z5UycHhE1CiYqaSAYrumb9/K/pyG459gN8dPR74M/ijxRqmzT/EmbqlJ+6Hsj8devjV1725xINsK3Z/gs2RPT3gLTgHRXW6Ytv23DcWxpcgq/igNoqkG0t6Uw9yGiOmfIMpVziDmNLK615df2CXl0eYKpFy1DjSY/LUiuoAsFAMQBIsIfgRwR4AlZ5/RdAiot+P/epOctRZpGZfTiZjFBVu8KZzdZXqITI8hJpqsYi2IAFnP06NmAN/KgiblRcOhmbl9ZF49mHgRA0hG/tKSjDgMdv2TCpduJiUDftd2DRkxtgU4HF8VGiySphcz9+FcKhFf+px8ah7bi0p66P9yJmVJ6a/uWdEWlJ4PBKug+jJGfU9xOnwGQuykQ9Ka3XkjxJDfxyBNGvgUnznjNENn0IwHpzmysl5Tb/GJl9U2nL7eiW4cIdM1ESiEgoZ4Kvta1fKlYWldTds1n3+92Ra 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)(396003)(136003)(346002)(366004)(39860400002)(376002)(230922051799003)(64100799003)(451199024)(186009)(1800799012)(6486002)(38100700002)(478600001)(41300700001)(4326008)(8936002)(36756003)(8676002)(86362001)(6916009)(66556008)(66476007)(66946007)(107886003)(26005)(316002)(2616005)(83380400001)(6506007)(6666004)(6512007)(44832011)(2906002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HUHPFoLDfcaQVSdCjljqFseVYThgYvqEm/8uwozcqsjtFDqDqVxqFxY8IEKb/o+QBkstgsPD0SXbEFXJfP+NSyXaYbh3EkKCK559Qdh7UbDlYbh5dTxlSVDfyn2wykd+Gpygm572wXz4eiVFTIRV4y9rRJX/C89hBHX8ECt7NAFC+YeJnqFfhG7hTcr7ww2G1CMdK4V9SsUtaOuwzQU1s94AgMoFwmBS+4dRegnNg+zY/Wka3iY74tEnHuDOqHvkmeY3nZxeK2yrRWfKIU2zbIh0EPTUHAOX1WPN9mEfBvgCzELgkDWCQXPkqxSNeBYv7OwjeNHsJkfk+ofcxx0tS7QUMrTp9gk+9TDlMwdJLS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TTp5dP2s9/bwDhd5UE0/qX4O76KwLwnEcI6qXJs5Ph0CIyTmqgYBKGnH2geytEdRvH1lCvr3aO9tpQIjJUzX8/RZwq31c6EpO2sXJW6A8RbslGNybtSlzpmerjt7YWX5bwn2R1E8pF032rWAqgu/r8lzP X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 23f5ea20-6dce-4e2c-74fd-08dbf01c4e76 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:14:17.2884 (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: 2V0Z3+h0X7zDEG2N+xeEZtGwIItkMGdH1hdTMjceJIuratD/8fALGrH1EYuVuVw2O91QYwc9539zO4LHP33JNg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB9952 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 947b60cc2512..10beaa6ec626 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -36,6 +36,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 @@ -905,6 +907,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" @@ -1018,6 +1060,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=$? @@ -2406,47 +2449,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 }