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 1C4A3A00C4; Mon, 14 Nov 2022 13:10:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 09FE742C29; Mon, 14 Nov 2022 13:10:54 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 59EFD4014F for ; Mon, 14 Nov 2022 13:10:52 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AE6h37U008514; Mon, 14 Nov 2022 04:08:26 -0800 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-transfer-encoding : content-type; s=pfpt0220; bh=fMM+6xRRJl8KFG3CmZMvaR0SIUGZxsv86SWPy+ztnlM=; b=Vey9zMjOPYMv77kyyZfqwGovpB/LiotS633Vw7uT76ChyLpzYo8iuCfByXSrjiDs1epP Bc9PGdOMfqv1i2HbFyL8bG6YhQTCsYiE7IaKj+7VbKqDuyGLiwpH12x0CrtYoCKMO5pw AV3W8sGXfhERsSFJU0gbNP7cu0NCKDuQGkZwNRnPi1qZtnse0h/H9+EI8LGg9NdjEhXT w3/K148EtgkWHHtWmtA/9grcui/BO6Z2sOPH+QY1TfPZNsfXlf9idRMhXRWhglecSGJW HNKe7zTNxzDl7zkOnW9PXpBsIqIA1t9/4up2lFKttzveFQmNN8Gor6sZnq4xmESShDkV iA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3kugnb0x49-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 14 Nov 2022 04:08:26 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 14 Nov 2022 04:08:24 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 14 Nov 2022 04:08:24 -0800 Received: from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14]) by maili.marvell.com (Postfix) with ESMTP id 5E1535C68E2; Mon, 14 Nov 2022 04:07:59 -0800 (PST) From: To: , Srikanth Yalavarthi CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Jerin Jacob Subject: [dpdk-dev] [PATCH v1 12/12] mldev: support to get debug info and test device Date: Mon, 14 Nov 2022 17:32:38 +0530 Message-ID: <20221114120238.2143832-13-jerinj@marvell.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114120238.2143832-1-jerinj@marvell.com> References: <20220803132839.2747858-2-jerinj@marvell.com> <20221114120238.2143832-1-jerinj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: IZgxTVJBupfAejTgp20t0Xi5J1UhADgk X-Proofpoint-GUID: IZgxTVJBupfAejTgp20t0Xi5J1UhADgk X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-14_10,2022-11-11_01,2022-06-22_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 From: Srikanth Yalavarthi Added library functions for ML device debug APIs. The APIs are used to dump ML device debug information and to run selftest. Signed-off-by: Srikanth Yalavarthi Signed-off-by: Jerin Jacob --- lib/mldev/rte_mldev.c | 39 ++++++++++++++++++++++++++++++++++++++ lib/mldev/rte_mldev_core.h | 37 ++++++++++++++++++++++++++++++++++++ lib/mldev/version.map | 2 ++ 3 files changed, 78 insertions(+) diff --git a/lib/mldev/rte_mldev.c b/lib/mldev/rte_mldev.c index 7497a1316d..71aa98ee96 100644 --- a/lib/mldev/rte_mldev.c +++ b/lib/mldev/rte_mldev.c @@ -483,6 +483,45 @@ rte_ml_dev_xstats_reset(int16_t dev_id, const uint16_t *stat_ids, uint16_t nb_id return (*dev->dev_ops->dev_xstats_reset)(dev, stat_ids, nb_ids); } +int +rte_ml_dev_dump(int16_t dev_id, FILE *fd) +{ + struct rte_ml_dev *dev; + + if (!rte_ml_dev_is_valid_dev(dev_id)) { + ML_DEV_LOG(ERR, "Invalid dev_id = %d\n", dev_id); + return -EINVAL; + } + + dev = rte_ml_dev_pmd_get_dev(dev_id); + if (*dev->dev_ops->dev_dump == NULL) + return -ENOTSUP; + + if (fd == NULL) { + ML_DEV_LOG(ERR, "Dev %d, file descriptor cannot be NULL\n", dev_id); + return -EINVAL; + } + + return (*dev->dev_ops->dev_dump)(dev, fd); +} + +int +rte_ml_dev_selftest(int16_t dev_id) +{ + struct rte_ml_dev *dev; + + if (!rte_ml_dev_is_valid_dev(dev_id)) { + ML_DEV_LOG(ERR, "Invalid dev_id = %d\n", dev_id); + return -EINVAL; + } + + dev = rte_ml_dev_pmd_get_dev(dev_id); + if (*dev->dev_ops->dev_selftest == NULL) + return -ENOTSUP; + + return (*dev->dev_ops->dev_selftest)(dev); +} + int rte_ml_model_load(int16_t dev_id, struct rte_ml_model_params *params, int16_t *model_id) { diff --git a/lib/mldev/rte_mldev_core.h b/lib/mldev/rte_mldev_core.h index 9e3873dd3a..b1426806a3 100644 --- a/lib/mldev/rte_mldev_core.h +++ b/lib/mldev/rte_mldev_core.h @@ -321,6 +321,37 @@ typedef int (*mldev_xstats_get_t)(struct rte_ml_dev *dev, const uint16_t *stat_i typedef int (*mldev_xstats_reset_t)(struct rte_ml_dev *dev, const uint16_t *stat_ids, uint16_t nb_ids); +/** + * @internal + * + * Function used to dump ML device debug info. + * + * @param dev + * ML device pointer. + * @param fd + * File descriptor to dump the debug info. + * + * @return + * - 0 on success. + * - < 0, error code on failure. + */ + +typedef int (*mldev_dump_t)(struct rte_ml_dev *dev, FILE *fd); + +/** + * @internal + * + * Function used for selftest of ML device. + * + * @param dev + * ML device pointer. + * + * @return + * - 0 on success. + * - < 0, error on failure. + */ +typedef int (*mldev_selftest_t)(struct rte_ml_dev *dev); + /** * @internal * @@ -564,6 +595,12 @@ struct rte_ml_dev_ops { /** Reset extended stats of the device. */ mldev_xstats_reset_t dev_xstats_reset; + /** Dump ML device debug info. */ + mldev_dump_t dev_dump; + + /** Dump ML device debug info. */ + mldev_selftest_t dev_selftest; + /** Load an ML model. */ mldev_model_load_t model_load; diff --git a/lib/mldev/version.map b/lib/mldev/version.map index 86ab2129ce..61955ab701 100644 --- a/lib/mldev/version.map +++ b/lib/mldev/version.map @@ -5,9 +5,11 @@ EXPERIMENTAL { rte_ml_dev_close; rte_ml_dev_configure; rte_ml_dev_count; + rte_ml_dev_dump; rte_ml_dev_info_get; rte_ml_dev_is_valid_dev; rte_ml_dev_queue_pair_setup; + rte_ml_dev_selftest; rte_ml_dev_socket_id; rte_ml_dev_start; rte_ml_dev_stats_get; -- 2.38.1