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 A3A6D423B0; Wed, 11 Jan 2023 14:58:46 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8A9B140E25; Wed, 11 Jan 2023 14:58:46 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 0534340A7D for ; Wed, 11 Jan 2023 14:58:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673445525; x=1704981525; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=4m0O2vWJcK7eIZiXJg7fqtQp2TTiAQiMb4M+1bFn82Q=; b=TxktxvitO2rFciQLXV/PnrWGEWBWfH8eS9ZG1NqBNgSZ8eJHhV86wsfb S9N8UJsfI50w+zdD8cMnAwQ2kX28Z+dDSbJsxI5OXKVmdQU7pkVJ6NVVC VC3KS9DzOiYXR+cdpeRkMCS57QJfwaHk6WEHNH8hTyI0L6jgQ/kk9IVyd 0Icdhma9eaIAgTqWyHCZCW6jqgnicBIimYJTNO4PHzABovJCqH9Mp1Dpx 4/LX07RpizQC4zY14DQFW1lKxWE+W2QHg/OmiKNNDmXFILWJorGGPFOKv 5XntXliePDyuufij5iEtZAew6aevveaXD8OMGGr2/wlld7Dm53ewTjztf A==; X-IronPort-AV: E=McAfee;i="6500,9779,10586"; a="303787091" X-IronPort-AV: E=Sophos;i="5.96,317,1665471600"; d="scan'208";a="303787091" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jan 2023 05:58:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10586"; a="650756347" X-IronPort-AV: E=Sophos;i="5.96,317,1665471600"; d="scan'208";a="650756347" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga007.jf.intel.com with ESMTP; 11 Jan 2023 05:58:43 -0800 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) 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; Wed, 11 Jan 2023 05:58:43 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx611.amr.corp.intel.com (10.18.126.91) 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 05:58:42 -0800 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) 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 05:58:42 -0800 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.108) by edgegateway.intel.com (192.55.55.68) 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 05:58:39 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JJZcUFaTuZGYjEn29ISo037hAwPkO8s4AlcT8bqq1WQk4Ib+M4gcA4nlIZv5/KXZ4tCcCauFeZKwx2r7gqFgjGTxukt71ZSFxRMACubPyGdH5/Upneg8Q5c3gaitCDnJFPnhfOVRtITx+K5u0TtlAKeqDMJ8bw9fD/IQoJdxu6juYlZ/OGe6+OC+jTGi8+pShiLkHTyCYQgiJnO5TXt426yiUW8TIPbAN3e+DhgPToOTjZyoWXNBCR/WWjIS9A8sqcWjAoXugN5ANbX6iv4DlDCCl/GyWUUO+WqbfY1RX8wlKXxKc2a+7riXmLB+9qgRNE6G340Swx85VTUF6pxEeA== 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=epC+qcf7H9E/YjyC2pKaNz+pPaPNG+EtkyDj4mJWo3M=; b=H+qM2o1vuSqE+cn1i1w9vKt5Re/138NzeV3Gy+FIie2CYNfZck4IGzgx8FdbAFnizZIaE/q1cr/cWPj7asRriooiu3GZPh/G9He8o6WxICmhbeNZQ2kqNlU1rD+D0JTWqQhcWq/qtKQbtP+kYX31NxTUjUePRMxjooJ2lcYD0+NG2P7j0Ev89Pz5kvWhMy+aDnxRVeCbfbtli0bwaoc4I9WJM1TG9thN8GLQrFJYH//LAf1TsZO1DW+lG7KxEqvQ2qTmekX4JALFVilE/0A9xWZur4NBk/b/m5sdRD4oDkqQMgYYak1wNh5UR5BZ4woNy6Gx0JDOcnBQE3cskK02Ng== 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 PH7PR11MB7641.namprd11.prod.outlook.com (2603:10b6:510:27b::19) 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 13:58:38 +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 13:58:38 +0000 Date: Wed, 11 Jan 2023 13:58:30 +0000 From: Bruce Richardson To: Chengwen Feng CC: , , , , , Subject: Re: [PATCH v2 1/5] dmadev: support stats reset telemetry command Message-ID: References: <20221219090723.29356-1-fengchengwen@huawei.com> <20230111120630.31172-1-fengchengwen@huawei.com> <20230111120630.31172-2-fengchengwen@huawei.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20230111120630.31172-2-fengchengwen@huawei.com> X-ClientProxiedBy: LO4P123CA0468.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1aa::23) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|PH7PR11MB7641:EE_ X-MS-Office365-Filtering-Correlation-Id: fd59eb28-ab33-48e5-dcac-08daf3dbf010 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rVADlntJQXyN42zmZWsMYOO9hQNwcVPZfBjFXYIokn0WsxXfA3YS51E5tb/C7rMLbleSrJIHObDOw9i3Ya7et9mURhxvDgyBw/ni8ZEvt6uMGh2jkWxpbr25jfuylo5ZAvEB40tuY2ig7BgINzKGLjodQ+dl7c8F/5l4HnzeHp7Hw025ZY2pLwx57eDfG8+YIZxhAIYBM/nnRp/p7uG/z+RTqCTUSgFXxil4uFADVxJBxPS8y5A9QD/H58rHVegu1T8iCYVGcUYEYrAjvShPqDIRKfXyopOFdzNygLEJf+C5E+2cvisuuaiOOmtCgvXpWMRDlxp3T/0h3wWFolN0KsW2C26sYq8vRIA+YTZaCYZ9JJtznIZ3YhlQcER78P6NH5ouKZzr8Nsf+NRY0cF0H9IJFki1jJRM6vl7LEBIR2fs2BtOHG4sI3R3xMIEejYOO0xoKkFUyJCu3uXGRnb3vLw/s78hPUBxiuOa72Wo0Cmn5Ya0jLe07fYmbTg/2nTpkrleCQdnwV/qyYT1bgCl1sdffM6DSrlFsIfitRJynUyCa202fmbpuhbAO8cCi8wSv2eDprnZeMw7aSP+rxfCMTSgHW+vrghWQF8tbdTX6bWgQnqV7MB32gv8alz6MRu+YP0DGRtEOOyZv6PxgBmmty6yNhP66NO5s47S3ims46TLuel5d53v8apkYzaKZRhu 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)(366004)(136003)(376002)(346002)(39860400002)(396003)(451199015)(316002)(5660300002)(186003)(26005)(44832011)(6512007)(6486002)(478600001)(41300700001)(66556008)(66946007)(66476007)(4326008)(6916009)(8676002)(8936002)(83380400001)(86362001)(6666004)(107886003)(6506007)(82960400001)(38100700002)(2906002)(67856001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?t6EuIw9smyUoUjRFgHf26Coy8Ds6lZSS7UO9EPay/XFzLTVY5QVDuyTbeAvu?= =?us-ascii?Q?RIWycFphrdfQPrVIAWnL5wwudpfZHbMecmOHVtyJ5dHCoxr0AC8EiBdKPvSW?= =?us-ascii?Q?WiRVDpzxlDpw0TJ4oTNb38GmBKL03SIK/DFdcQtGbOtV4z75+oo1vH8xlauO?= =?us-ascii?Q?nL0pvnAAsvgV5Xjzsy9WNTdfr3eZSnV2/tGO+4NClnCng+DstEOcnSJLtyPw?= =?us-ascii?Q?b34bU9JAraA4QVJevMzMaw+lCPgkbTjzGdNB+aJtFsfHB1zP48RwFsGtnCLV?= =?us-ascii?Q?+15m1JVA6ahZJ73QCq8opiR5/YlpgURrdIAUk9tq2YO+YZYbLUM+VB4bQB2P?= =?us-ascii?Q?EMIz/tIpWAPAn7R0jrd7Nqj+B0KkVv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VrXtrFsp7MAe1pp/8tipo3P3E1r8gWZoVGDIXQa9BVTbQytkhe0s2?= =?us-ascii?Q?GmKw9WEQNFEUeejTbdVBzU+EKpAQHAu1EROnRYUDd5igAmcQ2kxViiq/u0SW?= =?us-ascii?Q?OLLib70wKZEGpzcL5ghcKWiAFnJjLo34m+ys3EXAO5LL0vGnLeJFaw9FrHj8?= =?us-ascii?Q?4Kwewy7OnTN8PfoVkra/x51O2FtzarycrWX0UsDEJCPs55JVjl4TaVO0hAaZ?= =?us-ascii?Q?JRFLbdm6IFaVqenVVcS6/WnriFa8WtIilKlpyT6RHpgoJdUa7GyYSu+E6aNJ?= =?us-ascii?Q?J+0ekPWQpPrYkLmTYQiJOUlEXbYbydLP/ZyuHrOdPqqU52I78l/VlZzcM2LO?= =?us-ascii?Q?Rg=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: fd59eb28-ab33-48e5-dcac-08daf3dbf010 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2023 13:58:37.9883 (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: 4BMCVjIs6QguYYARyLEneuLQ6ZD7OLwdDwWTMqYaRJU/Aovxo6a1UEOVaZ5idwFpK529cMyKOuFxxHZmD+E94AG9Ekctfol4UXLUHranbMk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB7641 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:26PM +0000, Chengwen Feng wrote: > The stats reset is useful for debugging, so add it to the dmadev > telemetry command lists. > > Signed-off-by: Chengwen Feng Looks ok to me, just one small comment inline. With that fixed: Reviewed-by: Bruce Richardson > --- > lib/dmadev/rte_dmadev.c | 46 +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 46 insertions(+) > > diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c > index 4da653eec7..79593cdbe2 100644 > --- a/lib/dmadev/rte_dmadev.c > +++ b/lib/dmadev/rte_dmadev.c > @@ -994,6 +994,50 @@ dmadev_handle_dev_stats(const char *cmd __rte_unused, > return 0; > } > > +static int > +dmadev_handle_dev_stats_reset(const char *cmd __rte_unused, > + const char *params, > + struct rte_tel_data *d) > +{ > + struct rte_dma_info dma_info; > + int dev_id, ret, vchan_id; > + const char *vchan_param; > + char *end_param; > + > + if (params == NULL || strlen(params) == 0 || !isdigit(*params)) > + return -EINVAL; > + > + dev_id = strtoul(params, &end_param, 0); > + > + /* Function info_get validates dev_id so we don't need to. */ > + ret = rte_dma_info_get(dev_id, &dma_info); > + if (ret < 0) > + return -EINVAL; > + > + /* If the device has one vchan the user does not need to supply the > + * vchan id and only the device id is needed, no extra parameters. > + */ > + if (dma_info.nb_vchans == 1 && *end_param == '\0') > + vchan_id = 0; > + else { > + vchan_param = strtok(end_param, ","); > + if (!vchan_param || strlen(vchan_param) == 0 || !isdigit(*vchan_param)) > + return -EINVAL; > + > + vchan_id = strtoul(vchan_param, &end_param, 0); > + } > + if (*end_param != '\0') > + RTE_DMA_LOG(WARNING, "Extra parameters passed to dmadev telemetry command, ignoring"); > + > + ret = rte_dma_stats_reset(dev_id, vchan_id); > + if (ret == 0) { > + rte_tel_data_start_dict(d); This line is unnecessary. "rte_tel_data_string" below sets the overall datatype as "string", replacing the "dict" type set here. To set the string inside the dict you have just created use "rte_tel_data_add_dict_string". [Note: the data returned from a command is always put in a json dict automatically - that is separate from any dict initialized here.] > + rte_tel_data_string(d, "success"); > + } > + > + return ret; > +} > + > #ifndef RTE_EXEC_ENV_WINDOWS > static int > dmadev_handle_dev_dump(const char *cmd __rte_unused, > @@ -1041,6 +1085,8 @@ RTE_INIT(dmadev_init_telemetry) > "Returns information for a dmadev. Parameters: int dev_id"); > rte_telemetry_register_cmd("/dmadev/stats", dmadev_handle_dev_stats, > "Returns the stats for a dmadev vchannel. Parameters: int dev_id, vchan_id (Optional if only one vchannel)"); > + rte_telemetry_register_cmd("/dmadev/stats_reset", dmadev_handle_dev_stats_reset, > + "Reset the stats for a dmadev vchannel. Parameters: int dev_id, vchan_id (Optional if only one vchannel)"); > #ifndef RTE_EXEC_ENV_WINDOWS > rte_telemetry_register_cmd("/dmadev/dump", dmadev_handle_dev_dump, > "Returns dump information for a dmadev. Parameters: int dev_id"); > -- > 2.17.1 >