From patchwork Wed Sep 22 09:30:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Zhang X-Patchwork-Id: 12509885 X-Patchwork-Delegate: dsahern@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEE39C433F5 for ; Wed, 22 Sep 2021 09:31:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AF85B61268 for ; Wed, 22 Sep 2021 09:31:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234410AbhIVJcz (ORCPT ); Wed, 22 Sep 2021 05:32:55 -0400 Received: from mail-bn8nam12on2072.outbound.protection.outlook.com ([40.107.237.72]:49952 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234107AbhIVJcm (ORCPT ); Wed, 22 Sep 2021 05:32:42 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rpe6qfwrB30nbWSO2mO1/aFIFmrGB4vNJR7bcRd2Vf/ssBUdTnkiL2L2IyfjjcmQED71/YUcdVHQFQsCZASe4b5Fr0b/W0X1dodtx7xUEqrLhs4viH6+0BdzBPypBQxHjMMACuAGwNNVqKOLSrC5zp9y4ZqMOrfZz6BbGq4PhiUItbDW4KPpbLzoyZ5rMFa01oPZrrPMsqv92PobD+Ixmt4HS1vmI76TNj0kOH6D91+PnD9m84umfh97Fc9TAyijKNrRic5m4CH2DOR5ebsvUQncXwSKUiujG4dEpRPbl/ZlL8+sPlQzg+XxER8RFrsfnCrp8HrznHQ3Kv7D8QsxKg== 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; bh=TyH6dVba1CT3KazWgMyIHtm/na+nMwaAiIte1JFHKXA=; b=glW6kIrmR4VTHekuHZT7luJMZcLtguXIInvkkvLucHORruCFKSRHtHhoJLr9IRMvc8ZIKPoaTewmCh2wGqcyJyiETLEQIIk0u4/UIl0CTVX2Z+zARf/6+nr6lbhfRBTIjR/moSZkSfnEJeh/Cby1erT0X9Q7WWlcXZ68Je7Axlo5CvvxD8o49upayvXCIMeppZCJCNHYKC9dN06xXktB364bKZuibeTFceZZp3Tkr1fudm3F6CSPrzuRiNNj10Qdz3fc+rUEqAT2hz4LzcPFMZlfJPN+DWaSgBhgsP2zl2R/1P0P0/jjl0IMcOv/pwq4kBBsQaG5XkPILGX3wOYW8A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.32) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TyH6dVba1CT3KazWgMyIHtm/na+nMwaAiIte1JFHKXA=; b=Gky45yvxH0u7T08Vm5aSw7bPXt/q31WdBAMNG7/aoyGI6JrJzEXyD6WO3CMpvQXRGR/UB7N53qAJ3xwY2vAfifirYV7vJ2JDeIi2AVGYgx+C5NIkdPWg5HultXlfcQysne2sH85wPCzRJb5IipykV8cDP1JRkFt2kpOGtiKzgKniKSOYz02cgm5h9xPNtu7pVy8wzKq8bd4AIi/xduuU0xpfXAAXMVoKS6EsLDG8i1EG8iCJR9bTckbUYfsR0UDpaxJHTntv3hx2/ndNvrcKKmbD+efUmWDh2HN6OQc5UCTTPqcq0S7cznz5ktRIPBYbKUPWy+7hUVj43uCBs0QQ2Q== Received: from DM5PR13CA0026.namprd13.prod.outlook.com (2603:10b6:3:7b::12) by CO6PR12MB5475.namprd12.prod.outlook.com (2603:10b6:5:354::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Wed, 22 Sep 2021 09:31:11 +0000 Received: from DM6NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:3:7b:cafe::4f) by DM5PR13CA0026.outlook.office365.com (2603:10b6:3:7b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.6 via Frontend Transport; Wed, 22 Sep 2021 09:31:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.32) smtp.mailfrom=nvidia.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.32 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.32; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.32) by DM6NAM11FT064.mail.protection.outlook.com (10.13.172.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4544.13 via Frontend Transport; Wed, 22 Sep 2021 09:31:11 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 22 Sep 2021 02:31:10 -0700 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 22 Sep 2021 09:31:10 +0000 Received: from vdi.nvidia.com (172.20.187.6) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Wed, 22 Sep 2021 09:31:07 +0000 From: Mark Zhang To: , , CC: , , , , , Mark Zhang Subject: [PATCH RESEND iproute2-next 1/3] rdma: Update uapi headers Date: Wed, 22 Sep 2021 12:30:36 +0300 Message-ID: <20210922093038.141905-2-markzhang@nvidia.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20210922093038.141905-1-markzhang@nvidia.com> References: <20210922093038.141905-1-markzhang@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 99b45c60-2a97-4ea7-6013-08d97dabb708 X-MS-TrafficTypeDiagnostic: CO6PR12MB5475: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:110; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MHqzxNuTDwbxvsBA6T8adALxaeNrz84iBcLjooYRm6YZ1hBRCrQiYF4zFi77awDuK5cVA03VnkdidieGSmroIHW/yEyvJSiktkeW47Z+NlH/XOQ4PQg8XBVjdiSH3zmrdssUGD5YG1T+NCiFcYPdme+1duPGsotN47XZQHw1wTYat5urO2R600CTkx17ocbPZv8WeEpnNb+z3TZh79CrEjVSn+tTVF0VgyQaGs31csfvzCbWF5p0gcGPdNPzFICdHYUglsWjlbOHjF+6vT2N5v4xSSzd4Mr5FZTMT9dQCoHu+bprIID5EmR0SwzjV6eJZiZEExlBq+GFbiIvV5wnQbYq0mFoMpDLsd8nqTufCB2rWvly+XNirMPXSMY1+/rvgkBSSp72RhhXWcaCn/TzNlwFkgrmf6qQl6TFQbAjZAeMd4lJE+mt91Z2uDdq+o0YvWGaKrtPMFjJb9OLALfxZ7iMWu786i/ZWiImH6n0jmstWgkGNBFNSCoyuZLzPKvWEcvsgVvPlW1W2p7ioP3mjbdSDY54TqQJRITfDmllklGhaC4KmsuBKuqPk99UX9/EinX4INCFFvnI8FFb65ZLzNIpUibkvC7masCRrwozx1w4AF32e4WOEHNW0+EVmVK/cT0UU3BW2OpSOR3eYs+LTQFN/VMjPxOqSILjTEqbWeA/Qx9sIbNMbKL7IAwBn4sHkHNa98m/yZDWtgxUxEHeSw== X-Forefront-Antispam-Report: CIP:216.228.112.32;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:schybrid01.nvidia.com;CAT:NONE;SFS:(4636009)(36840700001)(46966006)(2906002)(4744005)(7696005)(82310400003)(110136005)(7636003)(70206006)(426003)(316002)(8936002)(5660300002)(336012)(70586007)(36756003)(2616005)(356005)(15650500001)(54906003)(6666004)(186003)(36860700001)(8676002)(107886003)(47076005)(83380400001)(4326008)(508600001)(26005)(86362001)(1076003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2021 09:31:11.2135 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 99b45c60-2a97-4ea7-6013-08d97dabb708 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.112.32];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR12MB5475 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com From: Neta Ostrovsky Update rdma_netlink.h file upto kernel commit Signed-off-by: Neta Ostrovsky Signed-off-by: Mark Zhang --- rdma/include/uapi/rdma/rdma_netlink.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rdma/include/uapi/rdma/rdma_netlink.h b/rdma/include/uapi/rdma/rdma_netlink.h index 37f583ee..fd347bc7 100644 --- a/rdma/include/uapi/rdma/rdma_netlink.h +++ b/rdma/include/uapi/rdma/rdma_netlink.h @@ -549,6 +549,9 @@ enum rdma_nldev_attr { RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK, /* u8 */ + RDMA_NLDEV_ATTR_STAT_HWCOUNTER_INDEX, /* u32 */ + RDMA_NLDEV_ATTR_STAT_HWCOUNTER_DYNAMIC, /* u8 0 - disabled, 1 - enabled */ + /* * Always the end */ From patchwork Wed Sep 22 09:30:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Zhang X-Patchwork-Id: 12509887 X-Patchwork-Delegate: dsahern@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87B7EC433EF for ; Wed, 22 Sep 2021 09:31:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6E4F460F4C for ; Wed, 22 Sep 2021 09:31:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234406AbhIVJdD (ORCPT ); Wed, 22 Sep 2021 05:33:03 -0400 Received: from mail-mw2nam10on2073.outbound.protection.outlook.com ([40.107.94.73]:2048 "EHLO NAM10-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234405AbhIVJcq (ORCPT ); Wed, 22 Sep 2021 05:32:46 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YW40VzUFq+N25RxI/xmc/OK8SwsA5a8GomZlpTSVzm9hBotUFuF2zZFMzhdEg6GCBs4YLcbZ9Va5pPt71VNEhkSIFyvb3eBqRxHdYvnuLckhcxECX6qFjN0om0z7+cf26NhduRZH7LmGbbtXxq2NyBSictB3tg4o9ypSu6jsrHVcr72mOIc5MxMJfNbZSvD14UXJTKeD0VAe5K0DYazNjDUgd7rpvELAR7sPDwnC6N4gtz5jOAa+VXj9SkXooV/Pfx3P5cHTRk/ytDBEbtGSrDqZMCF9S2kO73AO+PVEo37EvkwbPR62PM4QcPUlyTd892/roFvW5HUHQU9K9NOggw== 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; bh=ak015dCLhFT9HUZ+614RoSyGTvLmgkWSQVqt3U7rULo=; b=PNHr2/lyCNxSV/whyeSfy/BcCy7K60db6uYcFixv75HvE94wtM/JarAtsIvhUqgrvIllaI64BujYqEs1u43Co3pJ5cCuIBrIRsVjFcAM8WmzUCrVNDFKCIHDD+uY+I7w9XTUFrIKOe03Z8JI9EF4k1zl2fjtRqQAifzPirJY9PZbpExJNN6xJUrwqcj5E+5vGsL3WTKpDx2dwRd1LZ5GruWLd2AzDxQ25PTLhFFkePvqaPZsumHpJHZlK80bX7YfAXF39OXXkk+8vOmz/9V7FZwzLyUYlOrWElFu3Q5vIyJo8SNRnILClTqbs9dMY8cXF5k2K/0fy3uMh4UsmmoCHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ak015dCLhFT9HUZ+614RoSyGTvLmgkWSQVqt3U7rULo=; b=a5S/KE+/nULbVChPOexd8qeyTXdXpelUsprkc+lZDuf2tpAHk9RtK/YkkCiMN/sMhTtsdzAzcVYWPUYqJ9TDSYlHKFYGmCkYxJ8hqJZwUBEw563X/v1MaBpp69TBSMSl0RSyvlRb2CAU+g9vreg2AlklkERj2D/8pr97RfZ9gT4//3PBLIs8lQV6zGAY5uJKo8sskUhupAOJlG9dyIxm6VViAYsWV10emzFRZzpysuOCtU6pu/LXCaq8xsI6MkSNmKQYr6Y6UdO+rgwJpzxEraVJay7a/vfiZhKAudT6TlhtO6NviZTFhMkoCEJMV+dA1VSAz2QF5QEf/CVE1HSdrg== Received: from BN6PR13CA0065.namprd13.prod.outlook.com (2603:10b6:404:11::27) by SN1PR12MB2414.namprd12.prod.outlook.com (2603:10b6:802:2e::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.18; Wed, 22 Sep 2021 09:31:15 +0000 Received: from BN8NAM11FT020.eop-nam11.prod.protection.outlook.com (2603:10b6:404:11:cafe::c5) by BN6PR13CA0065.outlook.office365.com (2603:10b6:404:11::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.7 via Frontend Transport; Wed, 22 Sep 2021 09:31:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT020.mail.protection.outlook.com (10.13.176.223) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4544.13 via Frontend Transport; Wed, 22 Sep 2021 09:31:14 +0000 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 22 Sep 2021 09:31:14 +0000 Received: from vdi.nvidia.com (172.20.187.6) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Wed, 22 Sep 2021 09:31:10 +0000 From: Mark Zhang To: , , CC: , , , , , Mark Zhang Subject: [PATCH RESEND iproute2-next 2/3] rdma: Add stat "mode" support Date: Wed, 22 Sep 2021 12:30:37 +0300 Message-ID: <20210922093038.141905-3-markzhang@nvidia.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20210922093038.141905-1-markzhang@nvidia.com> References: <20210922093038.141905-1-markzhang@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0a27c589-6581-406c-a638-08d97dabb92b X-MS-TrafficTypeDiagnostic: SN1PR12MB2414: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:94; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GBUNI97uI67I0j5+BHlJ9wkBUuJcBYBp2xle5S5jd3KhoMY4ZmBTTGWg3TkK8L7gBtFjpWF2HuBRXNPzePcrkGRoSW36W0A7VKCxCkdanAHqKPopvc03a76mRFhTV5Z2lXWqcAvWzTJHfj2CN1e4qWCcfVdx5ck4YkL3y89INgmx7wWFz4z9EUniCQq3esx19OwHQh1qyDf1yJjDwPLP8GiYIRN472TtqUDwemF7KL+ztcFDs0RWsnOfXIK9PRBxLVD96/5o6iecXcSQN35v4ICqj0Ml5qHmUhcxr1nYb7QsuIuJLv6ssXz1xMo+N7bkT0cMo6qB6pM2/3oK70WXXJdyYHC1Jpm9PezX869ZWm7QHde1TqyUgsCQ+rAzWN/0LCpZATkcjp/bO0/e+JsxpY0FTu23G8T060yORvQSxmYP3xC6RSPsqiDGBBeWrEGOHRp4jMQB1adHpHPA639lP5kGUwMPrFaXd9q/5FytxTR7Ghot9MD1VbRiG2/5KnyQUBcJSshGh6E2Dl5tXt75uZiRjmU/cf4oSG/BMdwwC9P5QIu9XNC5z7G0OD3coxnQP2XDSfw7IM2eQUBRGpby9XU8B2rBf6YZ5cMDS3Gvq6VF7qwpQJD9lFTJaTqAX1jcr2XG5hklXExm3KJx/1F2vgTdcSsSAw6J9bmAxM90WKbN/EIGaoYTpTmdrWRVMMxN13G7aZtZQqntze1xPNn+gQ== X-Forefront-Antispam-Report: CIP:216.228.112.34;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:schybrid03.nvidia.com;CAT:NONE;SFS:(4636009)(36840700001)(46966006)(356005)(7696005)(110136005)(508600001)(54906003)(2616005)(336012)(1076003)(83380400001)(26005)(8676002)(36860700001)(7636003)(70206006)(70586007)(107886003)(6666004)(316002)(5660300002)(36756003)(426003)(36906005)(8936002)(2906002)(86362001)(47076005)(82310400003)(186003)(4326008);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2021 09:31:14.7441 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0a27c589-6581-406c-a638-08d97dabb92b X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.112.34];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT020.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2414 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com From: Neta Ostrovsky This patch introduces the "mode" command, which presents the enabled or supported (when the "supported" argument is available) optional counters. An optional counter is a vendor-specific counter that may be dynamically enabled/disabled. This enhancement of hwcounters allows exposing of counters which are for example mutual exclusive and cannot be enabled at the same time, counters that might degrades performance, optional debug counters, etc. Examples: To present currently enabled optional counters on link rocep8s0f0/1: $ rdma statistic mode link rocep8s0f0/1 link rocep8s0f0/1 optional-counters cc_rx_ce_pkts To present supported optional counters on link rocep8s0f0/1: $ rdma statistic mode supported link rocep8s0f0/1 link rocep8s0f0/1 supported optional-counters cc_rx_ce_pkts,cc_rx_cnp_pkts,cc_tx_cnp_pkts Signed-off-by: Neta Ostrovsky Signed-off-by: Mark Zhang --- man/man8/rdma-statistic.8 | 23 ++++++ rdma/stat.c | 164 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 187 insertions(+) diff --git a/man/man8/rdma-statistic.8 b/man/man8/rdma-statistic.8 index 7160bcdf..885769bc 100644 --- a/man/man8/rdma-statistic.8 +++ b/man/man8/rdma-statistic.8 @@ -58,6 +58,13 @@ rdma-statistic \- RDMA statistic counter configuration .RI "[ " COUNTER-ID " ]" .RI "[ " OBJECT-ID " ]" +.ti -8 +.B rdma statistic +.B mode +.B "[" supported "]" +.B link +.RI "[ " DEV/PORT_INDEX " ]" + .ti -8 .IR COUNTER_SCOPE " := " .RB "{ " link " | " dev " }" @@ -100,6 +107,10 @@ When unbound the statistics of this object are no longer available in this count - specifies the id of the counter to be bound. If this argument is omitted then a new counter will be allocated. +.SS rdma statistic mode - Display the enabled optional counters for each link. + +.SS rdma statistic mode supported - Display the supported optional counters for each link. + .SH "EXAMPLES" .PP rdma statistic show @@ -186,6 +197,16 @@ rdma statistic show mr mrn 6 .RS 4 Dump a specific MR statistics with mrn 6. Dumps nothing if does not exists. .RE +.PP +rdma statistic mode link mlx5_2/1 +.RS 4 +Display the optional counters that was enabled on mlx5_2/1. +.RE +.PP +rdma statistic mode supported link mlx5_2/1 +.RS 4 +Display the optional counters that mlx5_2/1 supports. +.RE .SH SEE ALSO .BR rdma (8), @@ -198,3 +219,5 @@ Dump a specific MR statistics with mrn 6. Dumps nothing if does not exists. Mark Zhang .br Erez Alfasi +.br +Neta Ostrovsky diff --git a/rdma/stat.c b/rdma/stat.c index 8edf7bf1..157b23bf 100644 --- a/rdma/stat.c +++ b/rdma/stat.c @@ -20,6 +20,8 @@ static int stat_help(struct rd *rd) pr_out(" %s statistic OBJECT unbind COUNTER_SCOPE [DEV/PORT_INDEX] [COUNTER-ID]\n", rd->filename); pr_out(" %s statistic show\n", rd->filename); pr_out(" %s statistic show link [ DEV/PORT_INDEX ]\n", rd->filename); + pr_out(" %s statistic mode [ supported ]\n", rd->filename); + pr_out(" %s statistic mode [ supported ] link [ DEV/PORT_INDEX ]\n", rd->filename); pr_out("where OBJECT: = { qp }\n"); pr_out(" CRITERIA : = { type }\n"); pr_out(" COUNTER_SCOPE: = { link | dev }\n"); @@ -37,6 +39,10 @@ static int stat_help(struct rd *rd) pr_out(" %s statistic qp unbind link mlx5_2/1 cntn 4 lqpn 178\n", rd->filename); pr_out(" %s statistic show\n", rd->filename); pr_out(" %s statistic show link mlx5_2/1\n", rd->filename); + pr_out(" %s statistic mode\n", rd->filename); + pr_out(" %s statistic mode link mlx5_2/1\n", rd->filename); + pr_out(" %s statistic mode supported\n", rd->filename); + pr_out(" %s statistic mode supported link mlx5_2/1\n", rd->filename); return 0; } @@ -715,6 +721,163 @@ static int stat_qp(struct rd *rd) return rd_exec_cmd(rd, cmds, "parameter"); } +static int do_stat_mode_parse_cb(const struct nlmsghdr *nlh, void *data, + bool supported) +{ + struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {}; + struct nlattr *nla_entry; + const char *dev, *name; + struct rd *rd = data; + int enabled, err = 0; + bool isfirst = true; + uint32_t port; + + mnl_attr_parse(nlh, 0, rd_attr_cb, tb); + if (!tb[RDMA_NLDEV_ATTR_DEV_INDEX] || !tb[RDMA_NLDEV_ATTR_DEV_NAME] || + !tb[RDMA_NLDEV_ATTR_PORT_INDEX] || + !tb[RDMA_NLDEV_ATTR_STAT_HWCOUNTERS]) + return MNL_CB_ERROR; + + dev = mnl_attr_get_str(tb[RDMA_NLDEV_ATTR_DEV_NAME]); + port = mnl_attr_get_u32(tb[RDMA_NLDEV_ATTR_PORT_INDEX]); + + mnl_attr_for_each_nested(nla_entry, + tb[RDMA_NLDEV_ATTR_STAT_HWCOUNTERS]) { + struct nlattr *cnt[RDMA_NLDEV_ATTR_MAX] = {}; + + err = mnl_attr_parse_nested(nla_entry, rd_attr_cb, cnt); + if ((err != MNL_CB_OK) || + (!cnt[RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY_NAME])) + return -EINVAL; + + if (!cnt[RDMA_NLDEV_ATTR_STAT_HWCOUNTER_DYNAMIC]) + continue; + + enabled = mnl_attr_get_u8(cnt[RDMA_NLDEV_ATTR_STAT_HWCOUNTER_DYNAMIC]); + name = mnl_attr_get_str(cnt[RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY_NAME]); + if (supported || enabled) { + if (isfirst) { + open_json_object(NULL); + print_color_string(PRINT_ANY, COLOR_NONE, + "ifname", "link %s/", dev); + print_color_uint(PRINT_ANY, COLOR_NONE, "port", + "%u ", port); + if (supported) + open_json_array(PRINT_ANY, + "supported optional-counters"); + else + open_json_array(PRINT_ANY, + "optional-counters"); + print_color_string(PRINT_FP, COLOR_NONE, NULL, + " ", NULL); + isfirst = false; + } else { + print_color_string(PRINT_FP, COLOR_NONE, NULL, + ",", NULL); + } + if (rd->pretty_output && !rd->json_output) + newline_indent(rd); + + print_color_string(PRINT_ANY, COLOR_NONE, NULL, "%s", + name); + } + } + + if (!isfirst) { + close_json_array(PRINT_JSON, NULL); + newline(rd); + } + + return 0; +} + +static int stat_mode_parse_cb(const struct nlmsghdr *nlh, void *data) +{ + return do_stat_mode_parse_cb(nlh, data, false); +} + +static int stat_mode_parse_cb_supported(const struct nlmsghdr *nlh, void *data) +{ + return do_stat_mode_parse_cb(nlh, data, true); +} + +static int stat_one_link_get_status_req(struct rd *rd, uint32_t *seq) +{ + int flags = NLM_F_REQUEST | NLM_F_ACK; + + rd_prepare_msg(rd, RDMA_NLDEV_CMD_STAT_GET, seq, flags); + mnl_attr_put_u32(rd->nlh, RDMA_NLDEV_ATTR_DEV_INDEX, rd->dev_idx); + mnl_attr_put_u32(rd->nlh, RDMA_NLDEV_ATTR_PORT_INDEX, rd->port_idx); + mnl_attr_put_u8(rd->nlh, RDMA_NLDEV_ATTR_STAT_HWCOUNTER_DYNAMIC, 1); + + return rd_send_msg(rd); +} + +static int stat_one_link_get_mode(struct rd *rd) +{ + uint32_t seq; + int err; + + if (!rd->port_idx) + return 0; + + err = stat_one_link_get_status_req(rd, &seq); + if (err) + return err; + + return rd_recv_msg(rd, stat_mode_parse_cb, rd, seq); +} + +static int stat_one_link_get_mode_supported(struct rd *rd) +{ + uint32_t seq; + int err; + + if (!rd->port_idx) + return 0; + + err = stat_one_link_get_status_req(rd, &seq); + if (err) + return err; + + return rd_recv_msg(rd, stat_mode_parse_cb_supported, rd, seq); +} + +static int stat_link_get_mode(struct rd *rd) +{ + return rd_exec_link(rd, stat_one_link_get_mode, false); +} + +static int stat_link_get_mode_supported(struct rd *rd) +{ + return rd_exec_link(rd, stat_one_link_get_mode_supported, false); +} + +static int stat_mode_supported(struct rd *rd) +{ + const struct rd_cmd cmds[] = { + { NULL, stat_link_get_mode_supported }, + { "link", stat_link_get_mode_supported }, + { "help", stat_help }, + { 0 }, + }; + return rd_exec_cmd(rd, cmds, "parameter"); +} + +static int stat_mode(struct rd *rd) +{ + const struct rd_cmd cmds[] = { + { NULL, stat_link_get_mode }, + { "link", stat_link_get_mode }, + { "show", stat_link_get_mode }, + { "supported", stat_mode_supported }, + { "help", stat_help }, + { 0 }, + }; + + return rd_exec_cmd(rd, cmds, "parameter"); +} + static int stat_show_parse_cb(const struct nlmsghdr *nlh, void *data) { struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {}; @@ -786,6 +949,7 @@ int cmd_stat(struct rd *rd) { "help", stat_help }, { "qp", stat_qp }, { "mr", stat_mr }, + { "mode", stat_mode }, { 0 } }; From patchwork Wed Sep 22 09:30:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Zhang X-Patchwork-Id: 12509889 X-Patchwork-Delegate: dsahern@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD2C5C433EF for ; Wed, 22 Sep 2021 09:31:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B76FE60F56 for ; Wed, 22 Sep 2021 09:31:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234346AbhIVJdF (ORCPT ); Wed, 22 Sep 2021 05:33:05 -0400 Received: from mail-bn8nam11on2081.outbound.protection.outlook.com ([40.107.236.81]:37345 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234294AbhIVJct (ORCPT ); Wed, 22 Sep 2021 05:32:49 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X2cuRhaxoVAVyfXvgcBLzMG92VT0usVlNJd6KnNpTQs5XEW7r8spxCF/VWLBrcLGsnScLPAFX1fSk2b0cEJ23KGuhvM3JpOQ+Cf33/tFUBCGDiSfdCoVDQnFTjFgsFLkKlld1KKpZQa52/R5o9gr6L2dtrHduXngcLtOa5eaejRKKb5VCnqJsjzQVEuulw+JA0Ao4xR8KzYLaD+MCXWm5vsZSgO/AcQZA7nEn+l6zxTC0GTwi1HljWfOZoLnFjNFDZ1XLljPCdCcqWdB8Cv2qtXyoBxkJUa0uysMdvtCKnVI+K+n/8PaR+LSf6alPi6s7pfmPLINujwA4ohqnE3ajA== 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; bh=VC6Xu5n0iWfU8LdbDGv4y1XSKT2SPG4vutWU7vKEXbg=; b=SmW0ndd9WrAJfYPNE1HviGMBx5plqdJaxIctidzRN1SOK58/i+s/WMH7VlUsD3RWL0Nwhqk++brPgEgckKCwf4y5zQX1Sist2clPwx8iR8JLxosjVrygiK+f+VVK8VwtnpNPGCZl7P5OXB6bvUOCOecRuRp64bTMHOc02ZAf/UgDupBly+HQXe536ZZ1xxLoR1nuIl6LlofElRfdBdCk9K8sXMtb4/YzbrumlFr7fjIzpaLeWIE5umaqRRBIdeEXNsayNCah7SPcH8ViZ4bYKeL0+pdX8+lXbnZcISVw1VRdpHDSsGFqR2y1JZPbuamF5y+sfHadjXzQv2i6W4bAdA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.32) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VC6Xu5n0iWfU8LdbDGv4y1XSKT2SPG4vutWU7vKEXbg=; b=N0iFrazyAv7G98mxhG55SExxdjcottDc3iGSSLsbspiuMQASIia0aJW4Y0h3hXujtP4Yykz0ACrIn4dFwgyFUK0gLSbHlKZcaN5qS9RhdYCLurdo1Oj+C7Xok7B9u7DNeLs6HtCWyLjT8Ypb8+uoRHsy9R67gdxtA5daL6g9lED1HMmNJC+b7vjlz1AQppxu4/Gti8OFaHKP5q79sAd4RK3/CHp6gkojVZBi4JJvocUhb089sgdraWCeckm15LmojyTiy2wRxUDRRgDb1eBrsUhd02E2avVABS3xw/enZXhx45rfRNRscVFr9yMJVh3JT3amICTJQsMxqxQb+N1Tkw== Received: from DM6PR01CA0010.prod.exchangelabs.com (2603:10b6:5:296::15) by MN2PR12MB3872.namprd12.prod.outlook.com (2603:10b6:208:168::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13; Wed, 22 Sep 2021 09:31:18 +0000 Received: from DM6NAM11FT013.eop-nam11.prod.protection.outlook.com (2603:10b6:5:296:cafe::58) by DM6PR01CA0010.outlook.office365.com (2603:10b6:5:296::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Wed, 22 Sep 2021 09:31:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.32) smtp.mailfrom=nvidia.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.32 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.32; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.32) by DM6NAM11FT013.mail.protection.outlook.com (10.13.173.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4544.13 via Frontend Transport; Wed, 22 Sep 2021 09:31:18 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 22 Sep 2021 02:31:17 -0700 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 22 Sep 2021 09:31:17 +0000 Received: from vdi.nvidia.com (172.20.187.6) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Wed, 22 Sep 2021 09:31:14 +0000 From: Mark Zhang To: , , CC: , , , , , Mark Zhang Subject: [PATCH RESEND iproute2-next 3/3] rdma: Add optional-counters set/unset support Date: Wed, 22 Sep 2021 12:30:38 +0300 Message-ID: <20210922093038.141905-4-markzhang@nvidia.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20210922093038.141905-1-markzhang@nvidia.com> References: <20210922093038.141905-1-markzhang@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1ac971c6-2ab4-459e-701b-08d97dabbb5a X-MS-TrafficTypeDiagnostic: MN2PR12MB3872: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1303; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LzvaPiPbvTm0nj/Y4sarCwNz4NbwpRlUiBtDveVl8kiw/1qyfolfe6g6nBQyj6ehCoFSaucsaKRxOhrA/iLbe+1dbzpOnyQtymL6PcMTUaz/JY3w2jOxSNpto4qnQt9LuedNHmzZrbRwnBEZa5iKJj1/bCIIprKxAXi0ETjMoFhZ11b+nQSkhwJbyZwzjT1xu7rNWYVphGr0XH13dDCV3/uLzzZE1PguCS8veiffWNMgAMVSNNVnpLaEmIbyHwKQtROzghfTWb1GHG5X9EjI66PFZgKJ4tK7JyDyEJ6V6tGUmUL2ZMqMP1O/eLUItajte3zcygj3dIBUpjR52uJyhQMnzwMnmxmYOleJ5jwd0+U7dfPhRhQbv0c8B/r8d3OZsLt9x9YaZ7c8VZJjNglGeJgx8JfvuK6QRpY8S6iJ0i9MLd+24/ZD/93WqvTBLS5KAVjMFI0fE5rk0BmSanURuPWlHv3XSbWHX7ZzL8HZWp2cfi2Il444rLGYq9fnyvoM9r4u9gHGJb/9LkH7yKBDNJ2yHvcAgxqBG91sju44s5TaWEqtOGKEchmSTd2FUBmOZpsZLz4ICxw71ZTle6i8qGfo0VSpIc6mzi+Mdpnqiuwj+wsJwg0rswV+ft3ltIH+Uj3/OstJpruQxFRoRwiJfG03rUor3f6JdMFj0F7UNVUHClhdeIRoob7yQ76ydWKcbyM2IZmdQgL9ruNzoqjX+A== X-Forefront-Antispam-Report: CIP:216.228.112.32;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:schybrid01.nvidia.com;CAT:NONE;SFS:(4636009)(36840700001)(46966006)(186003)(8676002)(26005)(336012)(2616005)(8936002)(426003)(5660300002)(47076005)(7696005)(86362001)(36860700001)(1076003)(316002)(82310400003)(110136005)(83380400001)(54906003)(7636003)(36756003)(70586007)(4326008)(2906002)(70206006)(107886003)(508600001)(6666004)(356005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2021 09:31:18.3622 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1ac971c6-2ab4-459e-701b-08d97dabbb5a X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.112.32];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT013.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3872 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com From: Neta Ostrovsky This patch provides an extension to the rdma statistics tool that allows to set/unset optional counters set dynamically, using new netlink commands. Note that the optional counter statistic implementation is driver-specific and may impact the performance. Examples: To enable a set of optional counters on link rocep8s0f0/1: $ sudo rdma statistic set link rocep8s0f0/1 optional-counters cc_rx_ce_pkts,cc_rx_cnp_pkts To disable all optional counters on link rocep8s0f0/1: $ sudo rdma statistic unset link rocep8s0f0/1 optional-counters Signed-off-by: Neta Ostrovsky Signed-off-by: Mark Zhang --- man/man8/rdma-statistic.8 | 32 ++++++++ rdma/stat.c | 163 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 195 insertions(+) diff --git a/man/man8/rdma-statistic.8 b/man/man8/rdma-statistic.8 index 885769bc..198ce0bf 100644 --- a/man/man8/rdma-statistic.8 +++ b/man/man8/rdma-statistic.8 @@ -65,6 +65,21 @@ rdma-statistic \- RDMA statistic counter configuration .B link .RI "[ " DEV/PORT_INDEX " ]" +.ti -8 +.B rdma statistic +.B set +.B link +.RI "[ " DEV/PORT_INDEX " ]" +.B optional-counters +.RI "[ " OPTIONAL-COUNTERS " ]" + +.ti -8 +.B rdma statistic +.B unset +.B link +.RI "[ " DEV/PORT_INDEX " ]" +.B optional-counters + .ti -8 .IR COUNTER_SCOPE " := " .RB "{ " link " | " dev " }" @@ -111,6 +126,13 @@ If this argument is omitted then a new counter will be allocated. .SS rdma statistic mode supported - Display the supported optional counters for each link. +.SS rdma statistic set - Enable a set of optional counters for a specific device/port. + +.I "OPTIONAL-COUNTERS" +- specifies the name of the optional counters to enable. Optional counters that are not specified will be disabled. Note that optional counters are driver-specific. + +.SS rdma statistic unset - Disable all optional counters for a specific device/port. + .SH "EXAMPLES" .PP rdma statistic show @@ -207,6 +229,16 @@ rdma statistic mode supported link mlx5_2/1 .RS 4 Display the optional counters that mlx5_2/1 supports. .RE +.PP +rdma statistic set link mlx5_2/1 optional-counters cc-rx-ce-pkts,cc_rx_cnp_pkts +.RS 4 +Enable the cc-rx-ce-pkts,cc_rx_cnp_pkts counters on device mlx5_2 port 1. +.RE +.PP +rdma statistic unset link mlx5_2/1 optional-counters +.RS 4 +Disable all the optional counters on device mlx5_2 port 1. +.RE .SH SEE ALSO .BR rdma (8), diff --git a/rdma/stat.c b/rdma/stat.c index 157b23bf..b5d1a59f 100644 --- a/rdma/stat.c +++ b/rdma/stat.c @@ -22,6 +22,8 @@ static int stat_help(struct rd *rd) pr_out(" %s statistic show link [ DEV/PORT_INDEX ]\n", rd->filename); pr_out(" %s statistic mode [ supported ]\n", rd->filename); pr_out(" %s statistic mode [ supported ] link [ DEV/PORT_INDEX ]\n", rd->filename); + pr_out(" %s statistic set link [ DEV/PORT_INDEX ] optional-counters [ OPTIONAL-COUNTERS ]\n", rd->filename); + pr_out(" %s statistic unset link [ DEV/PORT_INDEX ] optional-counters\n", rd->filename); pr_out("where OBJECT: = { qp }\n"); pr_out(" CRITERIA : = { type }\n"); pr_out(" COUNTER_SCOPE: = { link | dev }\n"); @@ -43,6 +45,8 @@ static int stat_help(struct rd *rd) pr_out(" %s statistic mode link mlx5_2/1\n", rd->filename); pr_out(" %s statistic mode supported\n", rd->filename); pr_out(" %s statistic mode supported link mlx5_2/1\n", rd->filename); + pr_out(" %s statistic set link mlx5_2/1 optional-counters cc-rx-ce-pkts,cc_rx_cnp_pkts\n", rd->filename); + pr_out(" %s statistic unset link mlx5_2/1 optional-counters\n", rd->filename); return 0; } @@ -878,6 +882,163 @@ static int stat_mode(struct rd *rd) return rd_exec_cmd(rd, cmds, "parameter"); } +static int stat_one_set_link_opcounters(const struct nlmsghdr *nlh, void *data) +{ + struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {}; + struct nlattr *nla_entry, *tb_set; + int flags = NLM_F_REQUEST | NLM_F_ACK; + struct rd *rd = data; + uint32_t seq; + char *opcnt; + bool found; + + mnl_attr_parse(nlh, 0, rd_attr_cb, tb); + if (!tb[RDMA_NLDEV_ATTR_STAT_HWCOUNTERS]) + return MNL_CB_ERROR; + + if (rd_no_arg(rd)) { + stat_help(rd); + return -EINVAL; + } + + if (strcmpx(rd_argv(rd), "optional-counters") != 0) { + pr_err("Unknown parameter '%s'.\n", rd_argv(rd)); + return -EINVAL; + } + + rd_arg_inc(rd); + if (rd_no_arg(rd)) { + stat_help(rd); + return -EINVAL; + } + + rd_prepare_msg(rd, RDMA_NLDEV_CMD_STAT_SET, &seq, flags); + mnl_attr_put_u32(rd->nlh, RDMA_NLDEV_ATTR_DEV_INDEX, + rd->dev_idx); + mnl_attr_put_u32(rd->nlh, RDMA_NLDEV_ATTR_PORT_INDEX, + rd->port_idx); + mnl_attr_put_u8(rd->nlh, RDMA_NLDEV_ATTR_STAT_HWCOUNTER_DYNAMIC, 1); + + tb_set = mnl_attr_nest_start(rd->nlh, RDMA_NLDEV_ATTR_STAT_HWCOUNTERS); + + opcnt = strtok(rd_argv(rd), ","); + while (opcnt) { + found = false; + mnl_attr_for_each_nested(nla_entry, + tb[RDMA_NLDEV_ATTR_STAT_HWCOUNTERS]) { + struct nlattr *cnt[RDMA_NLDEV_ATTR_MAX] = {}, *nm, *id; + + if (mnl_attr_parse_nested(nla_entry, rd_attr_cb, + cnt) != MNL_CB_OK) + return -EINVAL; + + nm = cnt[RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY_NAME]; + id = cnt[RDMA_NLDEV_ATTR_STAT_HWCOUNTER_INDEX]; + if (!nm || ! id) + return -EINVAL; + + if (!cnt[RDMA_NLDEV_ATTR_STAT_HWCOUNTER_DYNAMIC]) + continue; + + if (strcmp(opcnt, mnl_attr_get_str(nm)) == 0) { + mnl_attr_put_u32(rd->nlh, + RDMA_NLDEV_ATTR_STAT_HWCOUNTER_INDEX, + mnl_attr_get_u32(id)); + found = true; + } + } + + if (!found) + return -EINVAL; + + opcnt = strtok(NULL, ","); + } + mnl_attr_nest_end(rd->nlh, tb_set); + + return rd_sendrecv_msg(rd, seq); +} + +static int stat_one_set_link(struct rd *rd) +{ + uint32_t seq; + int err; + + if (!rd->port_idx) + return 0; + + err = stat_one_link_get_status_req(rd, &seq); + if (err) + return err; + + return rd_recv_msg(rd, stat_one_set_link_opcounters, rd, seq); +} + +static int stat_set_link(struct rd *rd) +{ + return rd_exec_link(rd, stat_one_set_link, true); +} + +static int stat_set(struct rd *rd) +{ + const struct rd_cmd cmds[] = { + { NULL, stat_help }, + { "link", stat_set_link }, + { "help", stat_help }, + { 0 }, + }; + return rd_exec_cmd(rd, cmds, "parameter"); +} + +static int stat_one_unset_link_opcounters(struct rd *rd) +{ + int flags = NLM_F_REQUEST | NLM_F_ACK; + struct nlattr *tbl; + uint32_t seq; + + if (rd_no_arg(rd)) { + stat_help(rd); + return -EINVAL; + } + + if (strcmpx(rd_argv(rd), "optional-counters") != 0) { + pr_err("Unknown parameter '%s'.\n", rd_argv(rd)); + return -EINVAL; + } + + rd_prepare_msg(rd, RDMA_NLDEV_CMD_STAT_SET, &seq, flags); + mnl_attr_put_u32(rd->nlh, RDMA_NLDEV_ATTR_DEV_INDEX, + rd->dev_idx); + mnl_attr_put_u32(rd->nlh, RDMA_NLDEV_ATTR_PORT_INDEX, + rd->port_idx); + mnl_attr_put_u8(rd->nlh, RDMA_NLDEV_ATTR_STAT_HWCOUNTER_DYNAMIC, 1); + + tbl = mnl_attr_nest_start(rd->nlh, RDMA_NLDEV_ATTR_STAT_HWCOUNTERS); + mnl_attr_nest_end(rd->nlh, tbl); + + return rd_sendrecv_msg(rd, seq); +} + +static int stat_one_unset_link(struct rd *rd) +{ + return stat_one_unset_link_opcounters(rd); +} + +static int stat_unset_link(struct rd *rd) +{ + return rd_exec_link(rd, stat_one_unset_link, true); +} + +static int stat_unset(struct rd *rd) +{ + const struct rd_cmd cmds[] = { + { NULL, stat_help }, + { "link", stat_unset_link }, + { "help", stat_help }, + { 0 }, + }; + return rd_exec_cmd(rd, cmds, "parameter"); +} + static int stat_show_parse_cb(const struct nlmsghdr *nlh, void *data) { struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {}; @@ -950,6 +1111,8 @@ int cmd_stat(struct rd *rd) { "qp", stat_qp }, { "mr", stat_mr }, { "mode", stat_mode }, + { "set", stat_set }, + { "unset", stat_unset }, { 0 } };