From patchwork Wed Nov 29 11:10:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13472614 X-Patchwork-Delegate: pabeni@redhat.com Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2083.outbound.protection.outlook.com [40.107.20.83]) (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 ECAE11B277 for ; Wed, 29 Nov 2023 11:10:43 +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="1uZ8Z2kk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MhF+zv+CVpkUyY22BsG0xcOQfIxSEGt1O6aYgIy0RmFijr6Hoj107y0Upu4BIC7Xl8nH7o3RFWSbJPxvXYwmsNwlSZFv9RsBCUzDR1gx5UpC5lViZUUryW6O+gLi5cHLdPgYWIHj4fsC7LixSddBQbhrUFn4RKI25OnVoMVErunnxaEAjvCshkZHgPdoM2UzfKKq+xbwrANeqzqvPCayNZ/NH+i11C2sgmxmTHM6b6vzVR01yowkon5iLsZRn9KOrwix3TD4K+u+aaSEqN5SWmThAPVAc2VM393uSAce/61ZieNT+LBkN9hDU6CtxBhsjQpwd1Tc1lr4DzjgbJLG4w== 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=P7xIKRrRLBoQKIy+NVwB/ANUFbzVTFBJBAMW0Jpff54ctmlbbB0Za1pbytwwU9uokumL9ka2gSzoxkzK6ghSUogFvRJxA1JtjfWJPYcbVCe9DYkepmMk3eJzuSxUWxK380ZD0c/M4Z+kT5z57ntfU0226M6gx5AFGyLDsZUlvfI94LPTql8As3qvkKLauyW7e4mSALshxPo+4nkjtMc0wZkjeQHpyV0KxUly2EXzI0qX+a78iJLNIJBCVrYfN+4DgA9AhU4ieU/rMsPIMJFw4Hkp4oYCOhz8QJOZ1QQcR2ocuYnn5vopqOB6/OPOMJOyfKCW7yo1++yQlD7vSRLlAg== 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=1uZ8Z2kk6Xhe7YrSkGjQne/1jBwaRj5n9BFlAascCHCSAm4yXfaUS9ahPwWHH/BoAaf6v63emRxP1tvVd1zZwaWmw6FOzMiqAzfSbunsqeYmOMeLKrFwyOrCJzfMl8HJjv4FhrI2B434EwNl5IQQWcehVphf7Rqo3GmfiGThX6bTDYwz6QLtDZwEOPN8yHxWyI6N7BBRzUba8INOQCWt0KFKXf3JNC3+yWHQzL3B0hHG3V8svpcTRgo3QfTJ3+hTg9C+KdgWjfmzgkDnUVk9+uxwK1i9iW9O4re5BdBGkZ4UfFE467AXQvx/AQ+OROgLS23o5uvAVsN6a8g17Zr6mw== 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 AS1PR04MB9333.eurprd04.prod.outlook.com (2603:10a6:20b:4df::7) 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 11:10:41 +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 11:10:41 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v3 1/5] mptcp: add mib counter dec helper Date: Wed, 29 Nov 2023 19:10:48 +0800 Message-Id: <8308ca9192aa478bdfc274757dd31bc4e47bdc7b.1701256112.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: TYAPR01CA0068.jpnprd01.prod.outlook.com (2603:1096:404:2b::32) 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_|AS1PR04MB9333:EE_ X-MS-Office365-Filtering-Correlation-Id: 0d29c15d-0092-411e-350d-08dbf0cbd2d2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KVsrmFaMlnzEfETq0t1FCvBr3R1n7sHvU3HoL6f4cGrFrfhu2GC6JhpDijYlxMZXmB9HB871XSxdfhMcYKyCZkELoAPN1+o7AMzpV/pfmYowG54NU5bqew0Py38jdFJO3od4i+r4bLc3esaClU+olVcQN9agNs0yyRnrldzx5R95E1unu0FBIBiD8ks2gRTiUTIFVXQBq45k1tXX9hzVI/v3L+pC7EZSwSBXg0dNeJ/YmzDNO9v6GdwNHumLrFKpJiju5POciZgEYc6pV7lP1iRIcoqUQbGhNnUo4hKoFmAoZhoQhBjBOieaIcmzZT4tWvt+H7GNfjMPrfXq6vhg47XB44WOcpC1ZVJktW+V5v9Xh55p6V9L/Rc3gJOpLyg6OG8xKa9BK7tIEJaylnS5mzOsYW837mBgFtmaVFR0zRjld2s7L2ZyMsrdujCBsGFsAbU0cUeTnD8JCTa7qemTc6gs42jjnOfbKNSqcFhXE/BaO+HmcOxZJFfZa8rZhZj24Nz2C8ldKQEpxQwqfO9uGMTtvuz438LlplNliF2FBlAGi9qXJE+U4EXh3AcxHPeVdRtY3aGIxlMszAt/cSW6Viv8MUbU+0ysINUndgRrjuk= 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)(396003)(376002)(346002)(136003)(39860400002)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(107886003)(6512007)(2616005)(26005)(6506007)(478600001)(2906002)(4744005)(5660300002)(41300700001)(6486002)(66946007)(44832011)(8676002)(8936002)(6916009)(66556008)(316002)(66476007)(4326008)(38100700002)(86362001)(36756003)(13296009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nMXmBc+clzUBL7trxyjg/Pd2/vqQEXvYCsAowHIp+Z1vFPqNuO5wmGkAaAT6Gw6JPBU1FUz4eu2IxgHbFRSWoMMUlqj/A2BxsFg6XizWCt6Jl3gUIANuf4a/XfNYxKzDtSWXIXVUiIRUz4jggDjgMphlp6fny75xp9uQUZ4Qoglc8T+CXEE88nfFW2GPCq9uNS5u15xbcEo/xWmlJJvRpx1o1Ex42fOSo5fdPHJH5o2qbG4zYyCZ1ln6JdkfmftrlEs8nNyEX6+agESUXRTpHm5XhjqcVUJPtkh7lhU4fed5d3Z8TmSBEHRDmXs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wXlJJpP6ZvcYOkIkpWUtve02/NvkzMcF8gwviVlGv6FVeZyDkooiKRZLcpLqhl/rrU1GEqPSbXWJ56I9e0lGyWk+N8AbBQ8u8s2sGJ/r86edCrXwDwt/YqayyfFrDCHLFvqyH5oUxCKx26HFpylPMjrQK4iw8ssaODjnMmgo+6CCz/yLU8xf/Ej6BI7IPxp6oNf32SbQjZdgBw+vAf44vLT8O84w== X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0d29c15d-0092-411e-350d-08dbf0cbd2d2 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2023 11:10:41.0570 (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: 4NPmrH41oOo4cxu4UagfqrzU/t/0/VwTgEi93GrNebEnbfr662pQ/HZWbWP3FVnZwTCP2s2fnJ9NK5/BbYdYZw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9333 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 11:10:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13472615 X-Patchwork-Delegate: pabeni@redhat.com Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2086.outbound.protection.outlook.com [40.107.20.86]) (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 E046D1C2AE for ; Wed, 29 Nov 2023 11:10:53 +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="IjyXvYDg" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LVwVU1ZcoKy6vjDZ1BH/xNawFyWN+rcEaIZpHzZ2DdosA7IovKE42X4lJMPOax/9Ft3bvm+8Bqxlk3Weh7k7Jw4tzw6ePjANrUVPe/laKGZagDyHF23Y0cpY8Z3ueQmUYzs4Xetp2QlGrFnhE23Q5HGu2WsfLb7wGJCTPppjT3oBSOahV/pgn8C9kuuksWvmIPmdMjJxgAjJVuLth90lBABEn+T1UFomRWd2y/xwb2p6a5/ytJ/RsEUyltOdsU7htsSuh954yhgeE7Hd2/R5XuTvqoKW+D7t3OrDfjT40v6Agnyq6VmoZyKTWo/iC7IaK/HRBUWpiA/p/qyaf7238w== 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=UiTZx2S139jM16lKYbmbayh9s2pWbE8Fs0IrQJ4dSz3tk02NjRFBGBap9P9ik1sxcZHqA1dOOJqhIBSIk9cTS3YFzMHe7fy5AH0NCgfXi8nkxvlTWrxFVgA3oCclVKsGpyjm+nM8ZXClBeL/CwicOQCvuEZ4XSCHXH7UpSVfM8BpIdKpSpd39n9ffuq02DrwY8dEZ2fuiuxOVwYluxnMrVU+b663d15zIl2GbsTTeYKlpQmVMu+MqYp7jvz8OvGCoSVKrXPD+H+wObh50QGXGZeY50ai4yBD/rRIZ14biHR1oGuPSeCjBvBIkETJY69SaxoE0dt/MUy6xGNqPQCz5w== 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=IjyXvYDg/VnsqDjWCKwVgWxQnqvo5J8U6dmepaB+SVI6Mw6FLWFb4UzuCvBaMmJHFtjBVQxH3B9ifcpVj5ZuGGVpwDiFJq22LkfnIr7jbprL8okC/eIKlojfftULdcgHTfvYNOuMl573bavcmdGnLrVvMCBpb+aKCFF8wK/r6o5VLqKMHV+DiC/ZjcavWsDRG9B8HrW/RU+4hxU243bOXeOhSQRRzAZ/qh7WgGNfMQZApjEsROqdQNylAQ3as4XPqd2m2+u6wOjj81Ugg/4JAxKZr2ZlpeezyF+7L3R1/KvDV+ZsGCJ/QQxGMZoVh7CE0rPYhs5i2Y7Ld5C3Ag7dCw== 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 AS1PR04MB9333.eurprd04.prod.outlook.com (2603:10a6:20b:4df::7) 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 11:10:51 +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 11:10:50 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v3 2/5] mptcp: add a current established counter Date: Wed, 29 Nov 2023 19:10:49 +0800 Message-Id: <08a899096030f74978b31add1a822f439f7127ba.1701256112.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: TYAPR01CA0070.jpnprd01.prod.outlook.com (2603:1096:404:2b::34) 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_|AS1PR04MB9333:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b6dd968-5cad-4cee-292a-08dbf0cbd871 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BSpREDW8mvS6KO9YqZ13lmOX4Fwx1DdDdkA7qWe64eRP0rq1N4at379yBWq3cbR5wfvE3h6S9/jUcZVWS5pBN30ESRzMbIEuDJBK1/Mfz+B73e0u4YWp/ziyO3gnyKdtimnhKp7uRK0jFQObAfQMFqIhhiUSauNQJipslWms7m8/vGsb+PUC1+wGIRxL4Q00WpmauOGz8k29clOQ0KwgFdY0NpAsWbigRYGjZ0b15XX+wIoy4s7QyMxrVlJmepdV6+kDIJJ/YfRlEsazk7R/D+QtJjXLEwTZLzavL5IuHVVxdNZVsDMHdOls2j6eUY9lF+EpdHhAnL6bEhlYYjui6+pjZrrfiyFK56/xZIuIhLXb4CV/yIqH0OeuO3nfUOZET+HzlafxSkxlUciG84D0zeLp2J7Uy5cnkf32AsaHLOindAxIkvGXQ1S8VT71S2WJsFlIMXqMEug5MLSBpIgFjQS0ACRe3Lldg5bMuw/GTuC6Eosr/oxaDcMnCL4CGBPNHdqFLUwr3Gh4rHh0oOac6kKko1iOTMsYBOCplSY42sMxBDfKAp9/UribyxH+sVC2r1EJyPOVBrE4aUWnu0UrZMTy/Xy/QdLJ29sTW8BozU8= 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)(396003)(376002)(346002)(136003)(39860400002)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(107886003)(6512007)(2616005)(26005)(6506007)(478600001)(83380400001)(2906002)(5660300002)(41300700001)(6486002)(66946007)(44832011)(8676002)(8936002)(6916009)(66556008)(316002)(66476007)(4326008)(38100700002)(86362001)(36756003)(13296009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QxaNFgWZawAUUo59RzQSGPo/BAxEnphgsR8TfA1HiU8u9idE6qT3f2qBaRICFUSqz7Y/KCupLTUOHEvbhAXa/8eaJACRIhca96sEMO+cw5sTPIdVzglTtlDu1DqPRutKrh/XE31EAY3e1m8/cHubrEPGinvXoC2rL8o84MaZm/FZWXBS1VWOna3yG1IWromiumMUZywL20fHY5hlH3enrVknVHjesrhXwqqsTwtbSXkH5aWcMXnRV1BS7ncDCYv1/5AFKRseLuTaw+c9L4WiPDro4DUCE3/NnG48sHW7hCXJFNvAG9pcBt/fEf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vSqgk5rV4WaPko4yjViYF2Yxfe+goFMNhvundc0AuYk7dcLWo2Td7ysn06WmV4RTMwIT5Zxj8eX6nfAB73n4dcyCqwQ94mSbx3JyNWEH+fwYsUBmjb2X9sKNQ1vzms7uzm5n523oPpipuU51sh0ggUiug4G1IWuFKfRLkIP6HtD5Pu9tytRj9ScmkLQw00IezTT0jjjr1qih2zGu6fORZRpZyCOtWpQ== X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9b6dd968-5cad-4cee-292a-08dbf0cbd871 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2023 11:10:50.6470 (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: ksGRgY29q7I0kn5uCswQk89Medt2ynEb3MrSkJcsSmO7sXWnYYJ5u7ACTs9VLUS2KdtC1ul9Q+BNCkitAWoqCw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9333 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 11:10:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13472616 X-Patchwork-Delegate: pabeni@redhat.com Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2057.outbound.protection.outlook.com [40.107.105.57]) (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 86BF612B72 for ; Wed, 29 Nov 2023 11:11:02 +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="a8AHIwAu" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ocnj0niEl0ywaKV01D5cb1YTVDIMFJzWl5TN1Co4fqPh8yaEgJyvLezgW7/N4XChLbWu/xyxwunPk/dSJcnWxJjIWHZwaheD3aY8oReVjr0Gbs8V5PhH9OMToQYmxQri312gqhrP7UD/s6VnuKQdelkYHar6jwPMq3VZHhKVPVWJlbTYLzH91MGPiuMoBK2+a2s6H6UIgnihIEk2jw+WY8fj6DYVcKky0edbMs+oHPNE9aKnTVHjfxts39QemNS2Ba4BudR6uwX25JLThFlAH3pIyDpCH1E9bKo9vvu6acjIW/YRvaRoVlXieCnsBca74gpj/abep/llUYM7FeT7Fg== 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=Gk+qvxGruMlhEM5135brL3AmZ2SRDXolpxyH9Vkywng=; b=KvBKAK8uYnYsQpBaObtNrzHK6Wemg9zotHE9hsTIcQxw1EiKZ3xOGQccFAtbr5Sy/BSu4KLvBWHOf6bzhCWv7rYZOB8r91ihM9+LHoXI/UNOpqv8AzRq5fI3b1B98E0ZMDrqcvNIIZZ7vtzQbas6MkgR8CjF/iwFpQbIJy2ETNZyyjXrUs32PC58JbSQGc0Hqfdvu0bEx/b3EAfsmQ7s/ibyc5zkXvrq/6rtuLr05Z6Kaef23um/K9/LwwGNmSUH6Hrd6sWyigynmz7ZtSTEUU4KA1rYCJZvWgrbM6AHHfgVLBBJmyaZ58KIEjMNlx16v2LV8t1zMtezWY+6dVD9ag== 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=Gk+qvxGruMlhEM5135brL3AmZ2SRDXolpxyH9Vkywng=; b=a8AHIwAuVS/PkDhOySQFa0u2Pr1VH1RAcIyiDVDIi2xHPZbFXbLghfCA0MFPAFkM1Qdgx1ZHgM0eQvrY2EbbmamRWePQBjyqWL5hFdPNJFLrHuLpcP7BdNIxXB89ULD0UEOodKPBuQrBWs8jF9bnoctXuuQ3ACvrIjzL1GJVExQpB5wETHaFpiOAhEdImHkZCWCu9WzqtH4/R9Ont/bFolwaVNdKNqCTTuQE2bw161R5Ybf3x+/kiGrEQhj9r+MSHRckfDpRfygBVtQJla1QZm1Ce3lGE2YcFy6/U5AHNudxKbIjJnSblCmbfTUBUYE1wYb5SVBmJf9ytHA9kunbKA== 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 AS1PR04MB9333.eurprd04.prod.outlook.com (2603:10a6:20b:4df::7) 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 11:10: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; Wed, 29 Nov 2023 11:10:59 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v3 3/5] mptcp: add mptcp_set_state helper Date: Wed, 29 Nov 2023 19:10:50 +0800 Message-Id: X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: TYAPR01CA0056.jpnprd01.prod.outlook.com (2603:1096:404:2b::20) 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_|AS1PR04MB9333:EE_ X-MS-Office365-Filtering-Correlation-Id: 72383118-109b-4c6e-e5e9-08dbf0cbddb7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: E/1/DzsOZv3SYxlhEjZdHTHVJngqbuxZaMui/7nDrkSGHBwVADl0rbA1EbZ86+DQDBs2aGsrlkFCs9935cWBbRSv1c16osEnIlD7rc+nZJ7xmdHIUv7S+GRiF8H3+/BCV6kfu3UuZVo0y8DLPalw24EBV7SVGYgFdRpvmbH58J2CRaPoEbMtBIYel9TsqQgQ9k3xXgvqowbpik8P+um5lHL5gxJpFg2XLSF5IpSYU3l42aXaFiMkhuLixYa5O6JWZFwj0XMKuvKlESrgRnEhTaYeCLqUw+CsBdZTMvbkdidNyi441UCpvccva4GLtSVBZ2Y0ZwWfTRJpLrwQGDoLUPldvD9bFXL+pu8mym144e1Rp1ZW4lGrHTgDFbzU6Ghg5prVZt8kPt2PoUMtIsC41unhv0MoMHW6/mCPUmipzm5Y9279YFzd5HIONCkUn6FERZL1j+MPJYrfujA3IlVzwIYhEO5AGwHkqT648RwsxzvsAW+/z+tQr1/AR7uEl2i0Lqn0cVKcphVAt15yyMTOrKJ19oXZA+lUWGQnKFpobUq9w6HMTwn/gI2IoekVQPIVajJ+bP9P9q2FPD5rB3Wgm8Pz/kqhEXp/Ic7HZY3WG+s= 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)(396003)(376002)(346002)(136003)(39860400002)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(107886003)(6512007)(2616005)(26005)(6506007)(6666004)(478600001)(83380400001)(2906002)(5660300002)(41300700001)(6486002)(966005)(66946007)(44832011)(8676002)(8936002)(6916009)(66556008)(316002)(66476007)(4326008)(38100700002)(86362001)(36756003)(13296009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DGwsePsaW5o7QXsd0dZWmH9UPf/BP0zET/J2pHptVP5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iobAxW0nfvx//fNqJvAJ+l7yEOrEfk+Iap4uNjkGoQRSkVqdzD9QNin+DdYVGpgqfCCEcq4gt9UdUERTaG48VVkpOQrLwxo9Yd3c1E/Y7XVLJaWcoSEM/hGEDPy1k1n1AzAS9XiHf2lQ95Wy1q0tHRQRIbIs61z48+tbcppRXybZNpBc2kMJuoW7n+EtOgucq3yO5E3pJdDSGVAbBsUuulC61l5qtihVaQ6NawMrrFzPqEEIlg7YdlAuBIZse2vdMXdqj3QvLnArfaHmd0WnSp6r46i1Hpqp22X89bvWuHBRSb5H7N2s3gzT7Mu7RbvgxOC4yOAlA9QqvAvOUB9oGXDmL7gtNnNuEoIf+Szv5DhiyRTMxfEbPqChVerq6UC/2NgsiGfjsd7iAI5WCBbzxC/RuGD/WOhIAD9dNCb8081INC6LTm1kh4TRxA01MpBwA4+yBVYqufBmGwIziASbfz4kmr5NPWkFZWntaXRDHIHAtk9g== X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 72383118-109b-4c6e-e5e9-08dbf0cbddb7 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2023 11:10:59.2737 (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: yn0x5OTmJhYujLOSIjWgg6L9FVltekIwP0WnhBLvmPk2bAtfaGzuCnTmgfCJZjWXZUd1HdUGYAzcjgI8Vu6AXQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9333 This patch adds a new function mptcp_set_state(), in it if switch from or to ESTABLISH state, increment or decrement the newly added counter MPTCP_MIB_CURRESTAB. Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/460 Signed-off-by: Geliang Tang --- net/mptcp/protocol.c | 19 +++++++++++++++++++ net/mptcp/protocol.h | 1 + 2 files changed, 20 insertions(+) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 6956fde61c68..cd0d54d85080 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -2885,6 +2885,25 @@ void mptcp_subflow_shutdown(struct sock *sk, struct sock *ssk, int how) release_sock(ssk); } +void mptcp_set_state(struct sock *sk, int state) +{ + int oldstate = sk->sk_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); + } + + inet_sk_state_store(sk, state); +} +EXPORT_SYMBOL_GPL(mptcp_set_state); + static const unsigned char new_state[16] = { /* current state: new state: action: */ [0 /* (Invalid) */] = TCP_CLOSE, diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 8529b3ae55e9..a8e558bdc54b 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -643,6 +643,7 @@ bool __mptcp_close(struct sock *sk, long timeout); void mptcp_cancel_work(struct sock *sk); void __mptcp_unaccepted_force_close(struct sock *sk); void mptcp_set_owner_r(struct sk_buff *skb, struct sock *sk); +void mptcp_set_state(struct sock *sk, int state); bool mptcp_addresses_equal(const struct mptcp_addr_info *a, const struct mptcp_addr_info *b, bool use_port); From patchwork Wed Nov 29 11:10: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: 13472617 X-Patchwork-Delegate: pabeni@redhat.com Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2071.outbound.protection.outlook.com [40.107.20.71]) (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 6BE2444385 for ; Wed, 29 Nov 2023 11:11:12 +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="40GBzwqb" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UW3iYb6rihrBgzH+sBQHcw7EzwfoMkmqevmWw71cDsvYH4y6F5XroY++ds7/ikghTRkk1rV5EKTORqbf7ZxZe8PPB8/Z91n9Dw3wz2+BOUsvkQR335QJF0tOECLDevk1kRqUpaokI5RpSZiOhEAXSWTL7V8nlQp7bv77Tb0GWH2f/nCxUsmOFuwhyKH4H0rIl/NeRvWDT3cjPszrOSJSi68kYfywvBARTl42k1ZRdAr5foEpSsrXSc2+8x8jbIVW6Ts3YnxYxLzfISTKZlOpLTCTEqKidAkDeN3QlnOjsUASaXufth+2Uud6flljnqVP0SPOfuH+bHhGzF3EIH5OCg== 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=jLqiuDNfS3mT51/7msWDxjiXaUQV1Ypb5avgAFUWd4s=; b=RFnPbLA1kJXGaWiBT0jmvou5pMXr2cGeXIgAZQ9eg/yxyrRv6Ae1009yVPUr2B8iRujaMw19t0Rz6v+UEpac4EMezK2Yr8bYdA8yDDsbHhhWKFLwrMQ2erC+Z7QmODEmsG/Av3iOJx1+s8JBi3axwSIkVuwOG/TKgxaKZHIj6kldg3eFTuLkoDQhK1nzdcrB97D60xLbXQxQ0Ae+WQpPJgSdkU82mRD2l6oFsV1gH3JSA5H7c4iCONLEOFdsanD6400y+zkmYJ0hFP66YZEQe3IRHXbLmR3OgtPliHw6sdO4N1bFSA5LZRYlxmfnnrjRS5qP0EujLyZEvjuf0/8+pg== 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=jLqiuDNfS3mT51/7msWDxjiXaUQV1Ypb5avgAFUWd4s=; b=40GBzwqbNpc2IxIobDFynENmkU1hQ/xZBPjkZvKW3m3Cg0zMFQFbD7srgTqYcyOihUBKelSUjM5Xi7/iiDhUgv+t7Iwi+plLBjIHL7RemEIXEBUMG9TjxfLtjzDz8Cuax9+r4LFn/wSB1qoMxkVhljxtK8ppWv7NUOnf9rTXfJxxRX52PqOBqsNl8jZ/Ifu/d3XqNMu9kmNCL4ivk3OP25raSKALUU/FgQNhwCGMFWzfSqZSAvAB3ytB58LBxpG6XfkGUnB1SGo/DxI81Zg8UH9f/cnzApbWTHimbdWH/U98FdY7DfxBpYMGLC7yYg1k6XV4BsnWjkwN47rQzbhEtg== 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 AS1PR04MB9333.eurprd04.prod.outlook.com (2603:10a6:20b:4df::7) 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 11:11:09 +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 11:11:09 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v3 4/5] mptcp: use mptcp_set_state Date: Wed, 29 Nov 2023 19:10:51 +0800 Message-Id: X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: TYAPR01CA0054.jpnprd01.prod.outlook.com (2603:1096:404:2b::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_|AS1PR04MB9333:EE_ X-MS-Office365-Filtering-Correlation-Id: fcd09a24-f884-4c10-02d9-08dbf0cbe2c1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /PE3+NN5R3F+hQ9Z6jv1MubguUbTYOuZ6F1LS1fbmIoZxrHzoLPIrPKV3lEaEkWbGcKUNewOFiB+VOB3LapPqCFw5gJae9q3nYW7/D/272mSm/irSjOqtwzFLT+6mVzyLx7H/WOljBjqRTjTOoAM2VPuJxQEyOFexsDCdbsXmaINpHcoyeuzIOdWQi7yfjDmqZ6BBVk0kv9pZe1nwmrtq4nlMP7Nc/KIknxgXoXvgaE3RmrLrlbMXU3mxGx2oOPy4OGloEH5AbFBaQVc/G7CmG6uVfnKGcud0pijPNs/NtjyY7p4lMxF2Hi3lw7GJ0FRLr+W+FvbCPqCEcxFLmULuJBiGYsmagYkyQ0b1gOfpNo2ZJx8krsT7LcCkLUOGZlepY3Md6RA+jl+E0SISO09xwHyHYDX5uKI7AkkUFVhxVw70GZ3gn5NSIhMImgFrEphkn8+odXHChX2Dc3ALc2R9au2fZHOwHmutSYhOz3z+Xg5ZNswNup8UHEJIlABYgpVIYewv/CUh2JMjCoL3cCSpEbj/AI3Qynnw11emQWwxN4FefWEWFUJc3V/Y3wadvp89tMOmvRwAaL2xEA3gxSOU9/DUdNogyvJUR4pAcNjG8U= 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)(396003)(376002)(346002)(136003)(39860400002)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(107886003)(6512007)(2616005)(26005)(6506007)(6666004)(478600001)(83380400001)(2906002)(5660300002)(41300700001)(6486002)(66946007)(44832011)(8676002)(8936002)(6916009)(66556008)(316002)(66476007)(4326008)(38100700002)(86362001)(36756003)(13296009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fJbu1DUVs9ncH27bzIUI28eQ50b5CXi/w8XN9JNqtvwdH0WLdfqmkhM+UJuv3SN2UnYYmysUjYxR8eGiUR4JyYCgV1521PkMbcKj/enuhp1ReJyYdzmq1LljFDf70H4unD1Orhi95L8BhU16a44ySMocPaFeQ6tmLyhwT9p2PXoaBdxqb8y2/Me3QSDIiJse4Ht5mXctFBDxlpuql506P9vM4Z2pmjv/78tzhHQww5jOLVI492o7FnUgbFfotJo3MDGECYBl3b6BCmy9Tzd0IbaDzuAaiOcFYDpmISCLccrE7THq2hsEujgD0mqwtSVJTg7EPXtK9dFGVQ9A8DSGygmrPI57Eb31O0j+B5vhENsT2zRSbAn73aA7kyQ0PAVnnRCaiGoG/KtHc2QxUiXrklkdgjunzMJ1is+xDLCLNxzDVSo2nmipOjHVxla6kFC9H7xUlhja1Su8tZH8s/iEVl6P8wRW643rXDjbRcDTC0JgGDYD9jYKbCzNWltwBrVqSXnl38+RkV0Ut1QiCXKgyR5FVdHAWtNXgHjyTqmNv1r1NOX46rH4SDamQ+u683JxNzC6sn6eINSH4FepJRW22o0F3oue4nxDIgxPSFDjf9dkZFW35JBOTpekQYToXOq+Ql/bRsEOBwjwfawAll9CxdhDpmJdUgL1qPe9Vi/fTZbH9gDbxTOhIUgW1gBD6ffvSNMjdNkChj7UrmYNhpfPvDkD2uzuK0nxTEeRiYLxGAA0WNxW77X9HUBUGKbIfDBFLmhGv3H93gGTdw5HlIcG9Nr5f2a0xQFUzvGMA4yro1V1+KuW5T9e+R0mdXtIXFEd5kutQaXiLk319q743bxJz4yGR7A2bleWTtoNl4JkPOLTtpBPe1paYRA6E0ddGX3we4exGxqO8QhYGG/qSjJSr8nrQmVk9K3DMiZN5TVbXb8k5XzNeLU9UeNV5gSnTf9Tt64IDdnGhrUJlvHcVUMJX7RDRwuhHSQtn/CwUj/EuwmtwNyopyJALgRK191UrgCT/FDk1QHQksGXuMkT0Wd17LlOA0e09Jairj6ESBzUUryrVbPDVRI3bnzHe3jID772a9KfENRemUQT528FRv2BTlg05B/SAoJdNeP5uvsqY8xX9IQF8U8diPIwJYM3JeQSe2k6Dm9HxFTeCPdlSuN4c6dUrYLLm0reb73EzrA6f0JQCArxMbPIvvbeMbagmBNXnWWM5NnEA7cZmvjztfL3abI0EMjtSgYbol/V1NV+SirkRcPUgvibuS5Mm6AcsshX9Ds4b+kOTTaLdm/gnhee839Pr095o4bCtALaOZbIEqTE6Qg6Xz506YLP4XXUXMABqsWuCDP1jnRhbe7VDMb35lHn0AoKd2fmA9/OTjrx5st6bnIBnE6u7zxEtUto1mbWNKVkNEwXH0OtzBM7/djkVgzzPsatJSEPRk6jK+BDxC7F6/ION1FwrrzvpKkXJbRf5DCP3QoTSKkUfFfLvtj6EI4/kbHWAYQisWbyFJOUeeRrucQINbVNdRBwgzm891UbATDNgi94dya88RvnSGn0oA61opKPtbzphasrG7XQhrtikZGuOfu/5Qgp1gCgGPjHdrD/BClw0D9F+c3hq+zueg== X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: fcd09a24-f884-4c10-02d9-08dbf0cbe2c1 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2023 11:11:09.2854 (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: ng9PVZSVcUdJCDl5Nf1qcf9A2p3BYOV+Ff3ul5vzGAAdHy4AQLMJp+fwq0Eu9XDpSHPrUPj3uxMfGGedTYD3Sg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9333 This patch replaces all the 'inet_sk_state_store()' calls under net/mptcp with the new helper mptcp_set_state(). Signed-off-by: Geliang Tang --- net/mptcp/pm_netlink.c | 3 +++ net/mptcp/protocol.c | 38 +++++++++++++++++++------------------- net/mptcp/subflow.c | 2 +- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index bf4d96f6f99a..b93683b5e618 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1048,6 +1048,9 @@ static int mptcp_pm_nl_create_listen_socket(struct sock *sk, if (err) return err; + /* avoid replacing inet_sk_state_store with mptcp_set_state here, as the + * old status is known to be TCP_CLOSE, hence will not affect the count. + */ inet_sk_state_store(newsk, TCP_LISTEN); lock_sock(ssk); err = __inet_listen_sk(ssk, backlog); diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index cd0d54d85080..c7c3ee453479 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -443,11 +443,11 @@ static void mptcp_check_data_fin_ack(struct sock *sk) switch (sk->sk_state) { case TCP_FIN_WAIT1: - inet_sk_state_store(sk, TCP_FIN_WAIT2); + mptcp_set_state(sk, TCP_FIN_WAIT2); break; case TCP_CLOSING: case TCP_LAST_ACK: - inet_sk_state_store(sk, TCP_CLOSE); + mptcp_set_state(sk, TCP_CLOSE); break; } @@ -608,13 +608,13 @@ static bool mptcp_check_data_fin(struct sock *sk) switch (sk->sk_state) { case TCP_ESTABLISHED: - inet_sk_state_store(sk, TCP_CLOSE_WAIT); + mptcp_set_state(sk, TCP_CLOSE_WAIT); break; case TCP_FIN_WAIT1: - inet_sk_state_store(sk, TCP_CLOSING); + mptcp_set_state(sk, TCP_CLOSING); break; case TCP_FIN_WAIT2: - inet_sk_state_store(sk, TCP_CLOSE); + mptcp_set_state(sk, TCP_CLOSE); break; default: /* Other states not expected */ @@ -789,7 +789,7 @@ static bool __mptcp_subflow_error_report(struct sock *sk, struct sock *ssk) */ ssk_state = inet_sk_state_load(ssk); if (ssk_state == TCP_CLOSE && !sock_flag(sk, SOCK_DEAD)) - inet_sk_state_store(sk, ssk_state); + mptcp_set_state(sk, ssk_state); WRITE_ONCE(sk->sk_err, -err); /* This barrier is coupled with smp_rmb() in mptcp_poll() */ @@ -2477,7 +2477,7 @@ static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk, inet_sk_state_load(msk->first) == TCP_CLOSE) { if (sk->sk_state != TCP_ESTABLISHED || msk->in_accept_queue || sock_flag(sk, SOCK_DEAD)) { - inet_sk_state_store(sk, TCP_CLOSE); + mptcp_set_state(sk, TCP_CLOSE); mptcp_close_wake_up(sk); } else { mptcp_start_tout_timer(sk); @@ -2572,7 +2572,7 @@ static void mptcp_check_fastclose(struct mptcp_sock *msk) WRITE_ONCE(sk->sk_err, ECONNRESET); } - inet_sk_state_store(sk, TCP_CLOSE); + mptcp_set_state(sk, TCP_CLOSE); WRITE_ONCE(sk->sk_shutdown, SHUTDOWN_MASK); smp_mb__before_atomic(); /* SHUTDOWN must be visible first */ set_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags); @@ -2707,7 +2707,7 @@ static void mptcp_do_fastclose(struct sock *sk) struct mptcp_subflow_context *subflow, *tmp; struct mptcp_sock *msk = mptcp_sk(sk); - inet_sk_state_store(sk, TCP_CLOSE); + mptcp_set_state(sk, TCP_CLOSE); mptcp_for_each_subflow_safe(msk, subflow, tmp) __mptcp_close_ssk(sk, mptcp_subflow_tcp_sock(subflow), subflow, MPTCP_CF_FASTCLOSE); @@ -2926,7 +2926,7 @@ static int mptcp_close_state(struct sock *sk) int next = (int)new_state[sk->sk_state]; int ns = next & TCP_STATE_MASK; - inet_sk_state_store(sk, ns); + mptcp_set_state(sk, ns); return next & TCP_ACTION_FIN; } @@ -3037,7 +3037,7 @@ bool __mptcp_close(struct sock *sk, long timeout) if ((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_CLOSE)) { mptcp_check_listen_stop(sk); - inet_sk_state_store(sk, TCP_CLOSE); + mptcp_set_state(sk, TCP_CLOSE); goto cleanup; } @@ -3080,7 +3080,7 @@ bool __mptcp_close(struct sock *sk, long timeout) * state, let's not keep resources busy for no reasons */ if (subflows_alive == 0) - inet_sk_state_store(sk, TCP_CLOSE); + mptcp_set_state(sk, TCP_CLOSE); sock_hold(sk); pr_debug("msk=%p state=%d", sk, sk->sk_state); @@ -3146,7 +3146,7 @@ static int mptcp_disconnect(struct sock *sk, int flags) return -EBUSY; mptcp_check_listen_stop(sk); - inet_sk_state_store(sk, TCP_CLOSE); + mptcp_set_state(sk, TCP_CLOSE); mptcp_stop_rtx_timer(sk); mptcp_stop_tout_timer(sk); @@ -3234,7 +3234,7 @@ struct sock *mptcp_sk_clone_init(const struct sock *sk, /* this can't race with mptcp_close(), as the msk is * not yet exposted to user-space */ - inet_sk_state_store(nsk, TCP_ESTABLISHED); + mptcp_set_state(nsk, TCP_ESTABLISHED); /* The msk maintain a ref to each subflow in the connections list */ WRITE_ONCE(msk->first, ssk); @@ -3693,7 +3693,7 @@ static int mptcp_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) if (IS_ERR(ssk)) return PTR_ERR(ssk); - inet_sk_state_store(sk, TCP_SYN_SENT); + mptcp_set_state(sk, TCP_SYN_SENT); subflow = mptcp_subflow_ctx(ssk); #ifdef CONFIG_TCP_MD5SIG /* no MPTCP if MD5SIG is enabled on this socket or we may run out of @@ -3743,7 +3743,7 @@ static int mptcp_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) if (unlikely(err)) { /* avoid leaving a dangling token in an unconnected socket */ mptcp_token_destroy(msk); - inet_sk_state_store(sk, TCP_CLOSE); + mptcp_set_state(sk, TCP_CLOSE); return err; } @@ -3833,13 +3833,13 @@ static int mptcp_listen(struct socket *sock, int backlog) goto unlock; } - inet_sk_state_store(sk, TCP_LISTEN); + mptcp_set_state(sk, TCP_LISTEN); sock_set_flag(sk, SOCK_RCU_FREE); lock_sock(ssk); err = __inet_listen_sk(ssk, backlog); release_sock(ssk); - inet_sk_state_store(sk, inet_sk_state_load(ssk)); + mptcp_set_state(sk, inet_sk_state_load(ssk)); if (!err) { sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); @@ -3899,7 +3899,7 @@ static int mptcp_stream_accept(struct socket *sock, struct socket *newsock, __mptcp_close_ssk(newsk, msk->first, mptcp_subflow_ctx(msk->first), 0); if (unlikely(list_is_singular(&msk->conn_list))) - inet_sk_state_store(newsk, TCP_CLOSE); + mptcp_set_state(newsk, TCP_CLOSE); } } release_sock(newsk); diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index a4f3c27f0309..ef1e22da5837 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -423,7 +423,7 @@ void __mptcp_set_connected(struct sock *sk) { __mptcp_propagate_sndbuf(sk, mptcp_sk(sk)->first); if (sk->sk_state == TCP_SYN_SENT) { - inet_sk_state_store(sk, TCP_ESTABLISHED); + mptcp_set_state(sk, TCP_ESTABLISHED); sk->sk_state_change(sk); } } From patchwork Wed Nov 29 11:10: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: 13472618 X-Patchwork-Delegate: pabeni@redhat.com Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2066.outbound.protection.outlook.com [40.107.20.66]) (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 82DB544385 for ; Wed, 29 Nov 2023 11:11:21 +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="Ucu4yACi" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C1KYxYXY3pRgoAxfvOdlQMbgKbpWj0cjSZiXyfYpSqIRfCYx266PtA6mYJ3Icm6qTpDzBQ5/AYAhH3va4IoleZveuzxCXguSRoCmuyp645D/IMEe+RbqA9d5gSipNPHj+W9Xf648vTIXlLuUC6DH0GpKI2f1NE6JDuj3OGe2hTOiV/MzuA7NRsyr+0eob99JaGCike3dzFg0Yp8BYfP1IojBZVmaP4zkhpp5ThdakUea96hqfclEnIiBVeFgwbPhhciCfbCY50L00+uTk60vvatnT1rucnk7c7cYWtKgevy+dqjoUxlPvXwdIidD3VYvb66Ggd8VQKQbzWOwd7bHcw== 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=c77BzoCI5dutj8uJeqPUIQddjCTKEEC98Zzl1sjWao4=; b=G5D8d7FJ8O/Piw2Mx3/0AYXTGE1wzzRAGAloSp1/A3pzEPLjKqpztXTRlGBcWvy6xIeRl4UzOc8UHXGhNnqyiPKcVhqqXsaThj4yvq6Nx+39ksDe08rxZNZeA2azUFM1L1DsngLRKEwYA0wZQ2Z2PpCXGryy8pZHc/X9Ulez8EmAISsmSQjTEAy1z1S/fQbfWorYHr9kLod3TrnyE56jlaQSrY9TpHjz1jCcyJiPjtUTnUrnEOGtDcn3WHyLDYUqeVIQQbSRpwSxpK3pV+s43ABAzK2ZBcKzRg+XTP1QmA7D0ZpkQXPQIFjT5R86PV1bokfuVDGlctgiewpQDJ/JlA== 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=c77BzoCI5dutj8uJeqPUIQddjCTKEEC98Zzl1sjWao4=; b=Ucu4yACiG9iJiDSp9zuOV5glPhEYwOzqz7WXMRX9ZHZUEh56YkVJuzCgajNL5yJseugvH63SeC98nq+8zX3WogERgTqdfrGelV80XYTt+S6x1eJ4ntMeVtxtp1emO2X1IJ0yCwI8lPrugzhkrxC/dPS2J8b50RKEfJqzpi1eF/aw2n7SOwvFI2u7dt2GvzxNo3LHSDC+lNb2oAt8+yw+He00yT5EKPz5rT2OLrPxUjQaDNMjDZcBwezVnTmDA5FwkkKU1Z9W+TASuzmxMP2ePzAiIAivMBfb4w07Zkx+bx1RE2jYqwSuWAlRfELymRddQjaC3fZG6+QlsKE4y6iJqA== 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 AS1PR04MB9333.eurprd04.prod.outlook.com (2603:10a6:20b:4df::7) 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 11:11:18 +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 11:11:18 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v3 5/5] selftests: mptcp: join: check CURRESTAB counters Date: Wed, 29 Nov 2023 19:10:52 +0800 Message-Id: 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_|AS1PR04MB9333:EE_ X-MS-Office365-Filtering-Correlation-Id: 23062a89-cd7d-4fa1-e8bf-08dbf0cbe8f8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z7gLb++GtS0fKt8DTEAxQdxU2Dx25TWmISOAouASYHfJP2+Q9NUTtBckJ1uL1Yaofs1r0NaWcabHHXEOAjJNOsUc0ZUJOA4ExHmu51+fEsFgQ37Aaygj9hT/sFLUUstk16tHb0YLqHiWPij12ND2mGP79xMqRXlJ87xUihpriN0A9DozK1ax0rCTEsfztCr5UZJgpO1FBES1UaD4CfbbUyFx7eRwOTLyOoTzCduuLLAIGG6FZJZWCvfbGMKT6Isi0dcT7y66Ow28tts2jCV4D7roAoPA1Ls7UkEj9G+dnfhZ97xGehXLpZEjIoEhtBq27irSlEKLGpEawPYejcqRu4Nw7KtWKvbNIVcKdIPmM/GzZ5wCEX8dW9N7ERY76Wf8yPg64xCah7GKq7b+58ig063JjybGzYCYnxfefTZhrTDjUzsfhDDf9LiGWmJArV/VNDVh8z3mNPwwvvT/2SmiBm4QeEZ/mf9eY2ykT9RPyK99Y4O0O3293HHQh8bvSGHc5ycrJDjU6mpvr6VLOOSHc3wGMYkGbqikCgtemVB5080IQ2rXNmCuEEj5JF1n7po+jxvYIgezubltosp/IV/wlS/bIMYAGp/bKdL0GzHLfoo= 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)(396003)(376002)(346002)(136003)(39860400002)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(107886003)(6512007)(2616005)(26005)(6506007)(6666004)(478600001)(83380400001)(2906002)(5660300002)(41300700001)(6486002)(66946007)(44832011)(8676002)(8936002)(6916009)(66556008)(316002)(66476007)(4326008)(38100700002)(86362001)(36756003)(13296009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1VWAUQGDQaKo/KS+KTCQ+mUSRQ52J7L8vDm+HidwwXvC899QJjy0d7Ewc2tr8ylsa2ARtBy2cOP9e502EMQYwOG95uYYcw5FM6nGouaHgq/4mhIYfHrctyP22HEFR7nmgd6Ffg7c+C7Y3MyFZ+f8jqbpjHC0AdSkCWlRu2UUgp4Qe8a3p2++uV9Cp0eWbXifAIrWRvNaTwqwQvxAP0Ry6MKpdoOvQnZ/TQQSo2H+MlmBfDz92N72SiiTOuwPSNMo3UZkX7jvqdTaoeA4FWfnCIc1FHIu8t0fc7OoVelZ9ApctfYvkSLfue601dr/tr0jn2a1ZjkmxS0PZxIUqqg13YWVl07lhTKse+WtsbJ6nV7Uies8Rhf6hkYwOtJ+sBhpdtjFHR08fms9f9Rg/MEVnPpuAo6Tttjpt/xCDBOP4yVholqX/OhGeQyxtNDDfmR/dsOQrftNWe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n9Rb5um84uV4oYKq0bUWWUEOdyIhPwfUJY7qNGwYcVLcF8UA4KZHZiwcyLyXBeE/VykAMrVZtttV3V1814SGZwuCA== X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 23062a89-cd7d-4fa1-e8bf-08dbf0cbe8f8 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2023 11:11:18.4398 (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: 7SzGQoGsD7wUc4wB0RWYmpQjZRR85R3dg8971Mz/GkVsFctnyhUZAdKdyTVKQxNkRNZ7TYPdHPbldXIw221WFA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9333 This patch adds a new helper chk_cestab_nr() to check the current established connections counter MIB_CURRESTAB. In do_transfer(), invoke chk_cestab_nr() to check during the connection and when the connectin closed. Signed-off-by: Geliang Tang --- .../testing/selftests/net/mptcp/mptcp_join.sh | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 87590a43b50d..36d855a37933 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -976,6 +976,23 @@ pm_nl_set_endpoint() fi } +chk_cestab_nr() +{ + local ns=$1 + local cestab=$2 + local count + + print_check "cestab" + 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 +} + do_transfer() { local listener_ns="$1" @@ -990,6 +1007,9 @@ do_transfer() local fastclose=${fastclose:-""} local speed=${speed:-"fast"} + local addr_nr_ns1=${addr_nr_ns1:-0} + local addr_nr_ns2=${addr_nr_ns2:-0} + :> "$cout" :> "$sout" :> "$capout" @@ -1090,6 +1110,13 @@ do_transfer() pm_nl_set_endpoint $listener_ns $connector_ns $connect_addr + if [ $addr_nr_ns1 != "0" ]; then + chk_cestab_nr $ns1 1 + fi + if [ $addr_nr_ns2 != "0" ]; then + chk_cestab_nr $ns2 1 + fi + wait $cpid local retc=$? wait $spid @@ -1100,6 +1127,13 @@ do_transfer() kill $cappid fi + if [ $addr_nr_ns1 != "0" ]; then + chk_cestab_nr $ns1 0 + fi + if [ $addr_nr_ns2 != "0" ]; then + chk_cestab_nr $ns2 0 + fi + NSTAT_HISTORY=/tmp/${listener_ns}.nstat ip netns exec ${listener_ns} \ nstat | grep Tcp > /tmp/${listener_ns}.out NSTAT_HISTORY=/tmp/${connector_ns}.nstat ip netns exec ${connector_ns} \