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 23A8441C25; Mon, 6 Feb 2023 21:26:31 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9811642D2D; Mon, 6 Feb 2023 21:26:02 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 1E8B142D81 for ; Mon, 6 Feb 2023 21:26:00 +0100 (CET) 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 316KL9I6018351; Mon, 6 Feb 2023 12:26:00 -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=tVhcfdkjrWHRlawFmzfU94dQLTegTpvhI1NOS0mK6Qc=; b=CSPACgNyjyTFg4+W/Ztckr3o4EIPiLfrwNS+m+P7Se47iljmJ/tzQtJqxz1DaATwdlyX hQ8lq1iz2GQokWEeYtTfOIXCFn4dLqkNFxk7Ii8K9oGS2dSeXUc3qPZhJseFqwO4C1BY DlPx6b+ox+jyrPxlCmxpOL808XfbHqOUdZCd1qDrxGp+x/cVyCk5Wf4NAuu4q1MMQ7dJ cqwWTWQRgPDGiIXSFqipXIzXHGz0c/efeu6zQ6xUSS+POBW+2GZrhY9Icy3PsDwvZJ9Y Wm5DB9L2LmbkMXHJompmOgoln7az6FPsYu1QjHYmF270v8VjpW5uH4ru87cM0tN3GyZt Ug== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3nhnkv5an7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 06 Feb 2023 12:26:00 -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.42; Mon, 6 Feb 2023 12:25:58 -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.42 via Frontend Transport; Mon, 6 Feb 2023 12:25:58 -0800 Received: from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14]) by maili.marvell.com (Postfix) with ESMTP id BFEA43F705B; Mon, 6 Feb 2023 12:25:55 -0800 (PST) From: To: , Srikanth Yalavarthi CC: , , , , , , Jerin Jacob Subject: [dpdk-dev] [PATCH v2 12/12] mldev: support to get debug info and test device Date: Tue, 7 Feb 2023 01:54:53 +0530 Message-ID: <20230206202453.336280-13-jerinj@marvell.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230206202453.336280-1-jerinj@marvell.com> References: <20221114120238.2143832-1-jerinj@marvell.com> <20230206202453.336280-1-jerinj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: ZKLc3KXhINFNgI65fU1u5nfrqqLGzIfN X-Proofpoint-GUID: ZKLc3KXhINFNgI65fU1u5nfrqqLGzIfN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-02-06_07,2023-02-06_03,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 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 1a8d8d4987..f2d6158689 100644 --- a/lib/mldev/rte_mldev.c +++ b/lib/mldev/rte_mldev.c @@ -485,6 +485,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)) { + RTE_MLDEV_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) { + RTE_MLDEV_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)) { + RTE_MLDEV_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, uint16_t *model_id) { diff --git a/lib/mldev/rte_mldev_core.h b/lib/mldev/rte_mldev_core.h index 29bec93c5f..0bc181c680 100644 --- a/lib/mldev/rte_mldev_core.h +++ b/lib/mldev/rte_mldev_core.h @@ -317,6 +317,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 * @@ -560,6 +591,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 ebe69765e6..745cf2e1cc 100644 --- a/lib/mldev/version.map +++ b/lib/mldev/version.map @@ -5,10 +5,12 @@ 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_logtype; 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.39.1