From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 77779423AE; Wed, 11 Jan 2023 15:09:08 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 198CF40E25; Wed, 11 Jan 2023 15:09:08 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id AF54E40A7D for ; Wed, 11 Jan 2023 15:09:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673446146; x=1704982146; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=CQqI0C2F4+onM7ChfOr9/LVblPxk8wHuuw4Kt7zvE/Y=; b=JbDY/5/xoG7CYkdGeUOsKgLJpIo9B+qzxfmeXRQg+ePTtWGgx3/AsqCn g2fSSaOcxMHAz2yLmuiz8ce4vqB7FxO7Ak7lXiQsgKNNnXZKcWNw+ZcnQ xRogJwdkvmQSpQcZEB5aO0cqEFmps9Miscztk/FRX+cIXXtSIKVXsFcjl juXedwTQ02mdE6cuQ+xsEaN5mWYXqCwugA0d5siNUU40sWgFL9A9kdUAy icnGFkAEvPtZcVkXz1Mts5dVmv6RztsIBckx8gFjh7aQl/NMncrqS2E5M L2JDoT7OmRbGbb8XDWnaJOlWqHUjFbyrBmJnFpXqaVgvzB4hzMIGdnoDT g==; X-IronPort-AV: E=McAfee;i="6500,9779,10586"; a="322118895" X-IronPort-AV: E=Sophos;i="5.96,317,1665471600"; d="scan'208";a="322118895" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jan 2023 06:09:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10586"; a="986173856" X-IronPort-AV: E=Sophos;i="5.96,317,1665471600"; d="scan'208";a="986173856" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga005.fm.intel.com with ESMTP; 11 Jan 2023 06:09:05 -0800 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Wed, 11 Jan 2023 06:09:05 -0800 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Wed, 11 Jan 2023 06:09:05 -0800 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.176) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Wed, 11 Jan 2023 06:09:04 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=de5W43L5sPudLUO1bhdJxloXV4AFi6t6zLkryJhfw6NIHZctRciXDep9juR9+nlyEVszDGchlWD+CuQYFU7B8A8jF8woWF9fapqp7gRAPaBneQ2ZPGyxhCDqHHjbtCFKRf2MrQoF23kGqsy5QWDgcyWYmiMlFHcP04vIa1/D/Bzz2tlULYss1oybMZp9fxlhAxsT9mbJzxBffVynTswU+mXswUqwg/q3lc5yeReQlGTgWK+5Z/bW0EbBgdDiX0w4zFo7QRksUDD2yv8s1+b1VJQcpS9epn9uRQeG8Wnb6K1cb4834RLlyw5f4AH4e9ksamNHO3OzQxe5fRwHEEvR1w== 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=t5TLHf/Q7xmTh25oBSTzSiXjnNQyV1H06isAVVOWjtU=; b=MjA3ljv/eHDJL2JAqFGKAnq0znXt0KgL6a38MmbPr12Ws6/h6ot7D46JOvzWVbyM4RktyRBIDRi/CvDAyVoBhh/dEnrpFxtMNLyeT9tRx7oymfoZY/w0wuHwx+O4+lE+v0QQIpNGDjXJfE4+izLE0ObxOsH64dk3oM37fgWtcdj8hExjACwFIGOvYEIWIM2ydegxHK4V1cwTr96v2AkVfZguxlO9r/cHEXmH6/ZNvY7R1viasFt8khlNyEZeJidlTRYTD8U8qcmkO+kwl2smR3B93exhd5yOfk+Vvk4HjhGipgIrej1cXueputohbJFo98RFe2/dVSnx1X376SgAdQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) by PH0PR11MB5190.namprd11.prod.outlook.com (2603:10b6:510:3c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Wed, 11 Jan 2023 14:09:03 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::4d9f:6867:2d53:9ee]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::4d9f:6867:2d53:9ee%8]) with mapi id 15.20.5986.018; Wed, 11 Jan 2023 14:09:02 +0000 Date: Wed, 11 Jan 2023 14:08:56 +0000 From: Bruce Richardson To: Chengwen Feng CC: , , , , , Subject: Re: [PATCH v2 5/5] ethdev: telemetry xstats support hide zero Message-ID: References: <20221219090723.29356-1-fengchengwen@huawei.com> <20230111120630.31172-1-fengchengwen@huawei.com> <20230111120630.31172-6-fengchengwen@huawei.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20230111120630.31172-6-fengchengwen@huawei.com> X-ClientProxiedBy: DB7PR03CA0102.eurprd03.prod.outlook.com (2603:10a6:10:72::43) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|PH0PR11MB5190:EE_ X-MS-Office365-Filtering-Correlation-Id: 2cc3398e-6645-4aef-9790-08daf3dd6441 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QQRPNesK3KOuTN/avmIbbnXSOl5F6DwwKhcVLjSOj5A9q3Og9OM8WRwA4IQl0FUsnEfcTsS2TDZBFmoVYf+P7Pn9w6jcyI6/QH9iBlhA/5TL+9i/plHWOMa0dVfrG//Hevv4N4xpfnV9wxg9eG0FZwOpPEhaGAwgi+geXAgQcO/Q7xIqboT22uuZlbxi20Tn+g7i41GJ/9d/uvj9st1SCezZ0dWEDHdbL/Ges70OLyjHvNX9CpYcqoxnLo7dsXPvKMCawbFQAyh8MMxc3m5WcMQWZxgqitPBlFyHWLgM/9XZZ+6vajhDj5I/O9FYgJrbMgv2szB0fxGNPJUr+XWnmAyY7oouSWg2j4x2mIiNV+BGhWUgCi0LuevJ7bXLB+l38SCeTgQQn3OfikJ5A8YkQJo40eTsRBl0B/gqKeOOEnWwBFZp4Ptph/M/zGTScUykDTCmdYWYlYwci5C9U69VbcS1z7Qpl7+araA3SlipJ9L0Y5ipXOPJUoN2/Fyj4j9kjoIjOyzaiBVesL3dYcJp6wpGJMhibsIiPOu1Mlr1fotB9PNaZdG2JlGbMr10H93u+Tt0fw6gFqduN/K6T5W9ZkFbuJRFf7ODipIucnb6//og/Tt+KTRgfLHaMOUNnMftZO8lLT2/A+MainHc5FpDw4mjKDDnQDE5uvwp0rhXcFwvNVM1fNldir9sOYZEUvgFZWh3kmNr0X5Gu7Ej/go0hRp8G0rYsdDZmpffYzkjaxo= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7309.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(346002)(396003)(366004)(39860400002)(136003)(451199015)(44832011)(2906002)(83380400001)(66556008)(66476007)(6916009)(66946007)(5660300002)(8936002)(107886003)(6666004)(186003)(26005)(6506007)(6512007)(6486002)(478600001)(82960400001)(38100700002)(41300700001)(8676002)(86362001)(316002)(4326008)(67856001)(309714004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?auCK9ZF+xYvO6sqjUlkk+xSyzbnDTlVz8QBvbCOUHKl9xvdbCGuK6fe5Vb1M?= =?us-ascii?Q?sD+xYYsFImv6/pvEqSMyiSdsTWVBWpNT3Zdr9eGOUmdTJsAxLYzUMtAufjFs?= =?us-ascii?Q?alKvNA4AHuHsghbW2f1/9LF1+CABypA6mt2U8EQEQnD43Cv2lNQs2PaECx4r?= =?us-ascii?Q?chwVpVlQrsVMSGjWglqxFgdzdZ8YrwxJjS8EegONqXmvFQ8u5vKJ4Mtgl+Is?= =?us-ascii?Q?jTAGYYB2HZOUoK8KrNeiTWZxb+NoJYLtWCnL6UfNk6PbAMjAuILD9FFnJSn6?= =?us-ascii?Q?uLEdHEHDsJ/Gb6RtGNkwYYpnPvnf7p4qxKUCIBSK6pfSotrWTBK8+uU+o89m?= =?us-ascii?Q?DjFv+XslFD19VDDS02XbuwC6jDn2s9SurKQQrbhIMmobcWnvcvgkyRFhWO/T?= =?us-ascii?Q?8fCe21WgDdBTuN+w4R40mIOxiUInBdfk239dj6wCzde2H2w0PsbP2Ujhlsw8?= =?us-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LZe7GFjuwVjGxIu8JKhE5H9Xem+g8/Otra?= =?us-ascii?Q?UIb7uFs6KcfEEBfNTPyQ2PAh1cmgvfXRKWtoe8TPPQk6/LsjHcSOplMlbpkm?= =?us-ascii?Q?rGr3qhSvuRgdyuSqzpU7ha76zmTTdn+V+MKFHaFMKjy139BDYM4gbVKvSCRx?= =?us-ascii?Q?8CJyjeUFvhBTHjYSHOtvqAXJLkk+/SiGoeI1zYK8kbs5kcu8szgT3R8oIBD3?= =?us-ascii?Q?JKqSWyfo8zzmISP2xbBJvP7RsNVbgzLMp8lKxqj1fosUK82hiF9DxmpqgwvJ?= =?us-ascii?Q?Cw=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 2cc3398e-6645-4aef-9790-08daf3dd6441 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2023 14:09:02.3095 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rwt5JhLfQgU1kNIliyUWyVo3cxA7PfY43eBeZ8jgYufIPwch9VWQBS7hu1JV9mCcImgO6123ZjZgP1hTxJvKwfRIEqdleXzsQMGnD/OQOcI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5190 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Wed, Jan 11, 2023 at 12:06:30PM +0000, Chengwen Feng wrote: > The number of xstats may be large, after the hide zero option is added, > only non-zero values can be displayed. > > Signed-off-by: Chengwen Feng > --- > lib/ethdev/rte_ethdev.c | 28 ++++++++++++++++++++++------ > 1 file changed, 22 insertions(+), 6 deletions(-) > > diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c > index 2fc593b865..77cacc0829 100644 > --- a/lib/ethdev/rte_ethdev.c > +++ b/lib/ethdev/rte_ethdev.c > @@ -5870,20 +5870,33 @@ eth_dev_handle_port_xstats(const char *cmd __rte_unused, > { > struct rte_eth_xstat *eth_xstats; > struct rte_eth_xstat_name *xstat_names; > + char *end_param, *hide_param; > int port_id, num_xstats; > + int hide_zero = 0; > int i, ret; > - char *end_param; > > if (params == NULL || strlen(params) == 0 || !isdigit(*params)) > return -1; > > port_id = strtoul(params, &end_param, 0); > - if (*end_param != '\0') > - RTE_ETHDEV_LOG(NOTICE, > - "Extra parameters passed to ethdev telemetry command, ignoring\n"); > if (!rte_eth_dev_is_valid_port(port_id)) > return -1; > > + if (*end_param != '\0') { > + hide_param = strtok(end_param, ","); > + if (!hide_param || strlen(hide_param) == 0 || !isdigit(*hide_param)) > + return -EINVAL; > + hide_zero = strtoul(hide_param, &end_param, 0); > + if (*end_param != '\0') > + RTE_ETHDEV_LOG(NOTICE, > + "Extra parameters passed to ethdev telemetry command, ignoring\n"); > + if (hide_zero != 0 && hide_zero != 1) { > + hide_zero = !!hide_zero; > + RTE_ETHDEV_LOG(NOTICE, > + "Hide zero parameter is non-boolean, cast to boolean\n"); > + } > + } > + I'm not sure about this adding of an extra flag as a 0/1 value. That would seem to make it confusing with a queue number or extra port number. For such an optional parameter, I think a string value would be clearer. A number of alternatives I'd suggest - in order of my preference (least preferred to most preferred): * have the extra parameter as a literal string "hide_zeros" which is matched against rather than looking for 0/1, or alternatively * add a new command /ethdev/xstats_nonzero which does this, the same callback can be reusued, just checking the command given, or finally, * if this is primarily for the benefit of users using the telemetry script to interactively view stats, then the functionality could be implemented in the script itself rather than in the backend. We could add some setting, or extra flag to the display code, to possibly filter out zeros in the display. Thoughts? /Bruce