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 4061F429BA; Sun, 23 Apr 2023 07:14:21 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 13CDB42C4D; Sun, 23 Apr 2023 07:14:13 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 1AF8A42B7E for ; Sun, 23 Apr 2023 07:14:10 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33N3tn83011255 for ; Sat, 22 Apr 2023 22:14:10 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=M1J78lWq7Ym0XAwonBj7hUQAK5SSZeahdwqlfuRkvcU=; b=LuTdUPswgFrTWQLmVxlf77K7rv4tyqdCTBtCED/ar6GuxEv0H8BqAOkV761+qCEKgt4o yyTNSx/WTYYwl5rvhmg8RTufNWPH0jG97+rBXxcXOtaNkLCPTo4zT4fAhgyYChwd+kfe atFZTDo1Sh20+i2vvbo03zFDf6L7Dpo1xxOyIJfHjU8TfdJ60+rW4CG4agcs0E5jYub9 v3mFGvMTZhMJ4+ayjAztXkjdLApYP89NvTUfhEYudsr0kRAjqu3eLkXrV4gpwzeBJbFU vFGGB5+Mg+1ikvnQjaFSuc6/692Qj40VA4vaJhH3z1Ckl2duNdRNVVwWQe0qRQ1BgM/l dA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3q4egjjvd1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Sat, 22 Apr 2023 22:14:10 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Sat, 22 Apr 2023 22:14:08 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Sat, 22 Apr 2023 22:14:08 -0700 Received: from ml-host-33.caveonetworks.com (unknown [10.110.143.233]) by maili.marvell.com (Postfix) with ESMTP id 2B73E3F706A; Sat, 22 Apr 2023 22:14:08 -0700 (PDT) From: Srikanth Yalavarthi To: Srikanth Yalavarthi CC: , , , Subject: [PATCH v1 2/5] mldev: introduce revised xstats Date: Sat, 22 Apr 2023 22:14:00 -0700 Message-ID: <20230423051403.31971-3-syalavarthi@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230423051403.31971-1-syalavarthi@marvell.com> References: <20230423051403.31971-1-syalavarthi@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-ORIG-GUID: B1dJrVQWWaO4zkQ2NKOHGG62-ymaVH6l X-Proofpoint-GUID: B1dJrVQWWaO4zkQ2NKOHGG62-ymaVH6l X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-23_02,2023-04-21_01,2023-02-09_01 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 Introduce revised xstats APIs to support reporting device and per-model xstats. Stat type is selected through mode parameter. Support modes include device and model. Signed-off-by: Srikanth Yalavarthi --- lib/mldev/rte_mldev.h | 113 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/lib/mldev/rte_mldev.h b/lib/mldev/rte_mldev.h index 1e967a7c2a..222ecbdbe1 100644 --- a/lib/mldev/rte_mldev.h +++ b/lib/mldev/rte_mldev.h @@ -593,6 +593,16 @@ __rte_experimental void rte_ml_dev_stats_reset(int16_t dev_id); +/** + * Selects the component of the mldev to retrieve statistics from. + */ +enum rte_ml_dev_xstats_mode { + RTE_ML_DEV_XSTATS_DEVICE, + /**< Device xstats */ + RTE_ML_DEV_XSTATS_MODEL, + /**< Model xstats */ +}; + /** * A name-key lookup element for extended statistics. * @@ -605,6 +615,109 @@ struct rte_ml_dev_xstats_map { /**< xstat name */ }; +/** + * Retrieve names of extended statistics of an ML device. + * + * @param dev_id + * The identifier of the device. + * @param mode + * Mode of statistics to retrieve. Choices include the device statistics and model statistics. + * @param model_id + * Used to specify the model number in model mode, and is ignored in device mode. + * @param[out] xstats_map + * Block of memory to insert names and ids into. Must be at least size in capacity. If set to + * NULL, function returns required capacity. The id values returned can be passed to + * *rte_ml_dev_xstats_get* to select statistics. + * @param size + * Capacity of xstats_names (number of xstats_map). + * @return + * - Positive value lower or equal to size: success. The return value is the number of entries + * filled in the stats table. + * - Positive value higher than size: error, the given statistics table is too small. The return + * value corresponds to the size that should be given to succeed. The entries in the table are not + * valid and shall not be used by the caller. + * - Negative value on error: + * -ENODEV for invalid *dev_id*. + * -EINVAL for invalid mode, model parameters. + * -ENOTSUP if the device doesn't support this function. + */ +__rte_experimental +int +rte_ml_dev_xstats_names_get(int16_t dev_id, enum rte_ml_dev_xstats_mode mode, int32_t model_id, + struct rte_ml_dev_xstats_map *xstats_map, uint32_t size); + +/** + * Retrieve the value of a single stat by requesting it by name. + * + * @param dev_id + * The identifier of the device. + * @param name + * Name of stat name to retrieve. + * @param[out] stat_id + * If non-NULL, the numerical id of the stat will be returned, so that further requests for the + * stat can be got using rte_ml_dev_xstats_get, which will be faster as it doesn't need to scan a + * list of names for the stat. If the stat cannot be found, the id returned will be (unsigned)-1. + * @param[out] value + * Value of the stat to be returned. + * @return + * - Zero: No error. + * - Negative value: -EINVAL if stat not found, -ENOTSUP if not supported. + */ +__rte_experimental +int +rte_ml_dev_xstats_by_name_get(int16_t dev_id, const char *name, uint16_t *stat_id, uint64_t *value); + +/** + * Retrieve extended statistics of an ML device. + * + * @param dev_id + * The identifier of the device. + * @param mode + * Mode of statistics to retrieve. Choices include the device statistics and model statistics. + * @param model_id + * Used to specify the model id in model mode, and is ignored in device mode. + * @param stat_ids + * ID numbers of the stats to get. The ids can be got from the stat position in the stat list from + * rte_ml_dev_xstats_names_get(), or by using rte_ml_dev_xstats_by_name_get(). + * @param[out] values + * Values for each stats request by ID. + * @param nb_ids + * Number of stats requested. + * @return + * - Positive value: number of stat entries filled into the values array + * - Negative value on error: + * -ENODEV for invalid *dev_id*. + * -EINVAL for invalid mode, model id or stat id parameters. + * -ENOTSUP if the device doesn't support this function. + */ +__rte_experimental +int +rte_ml_dev_xstats_get(int16_t dev_id, enum rte_ml_dev_xstats_mode mode, int32_t model_id, + const uint16_t stat_ids[], uint64_t values[], uint16_t nb_ids); + +/** + * Reset the values of the xstats of the selected component in the device. + * + * @param dev_id + * The identifier of the device. + * @param mode + * Mode of the statistics to reset. Choose from device or model. + * @param model_id + * Model stats to reset. 0 and positive values select models, while -1 indicates all models. + * @param stat_ids + * Selects specific statistics to be reset. When NULL, all statistics selected by *mode* will be + * reset. If non-NULL, must point to array of at least *nb_ids* size. + * @param nb_ids + * The number of ids available from the *ids* array. Ignored when ids is NULL. + * @return + * - Zero: successfully reset the statistics. + * - Negative value: -EINVAL invalid parameters, -ENOTSUP if not supported. + */ +__rte_experimental +int +rte_ml_dev_xstats_reset(int16_t dev_id, enum rte_ml_dev_xstats_mode mode, int32_t model_id, + const uint16_t stat_ids[], uint16_t nb_ids); + /** * Dump internal information about *dev_id* to the FILE* provided in *fd*. * -- 2.17.1