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 5969A41C25; Mon, 6 Feb 2023 21:26:26 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7118942C24; Mon, 6 Feb 2023 21:25:58 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 18D1442D7C for ; Mon, 6 Feb 2023 21:25:56 +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 316KGBVd010808; Mon, 6 Feb 2023 12:25:56 -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=duHXRq4NxeBojRwDB3R75MAMouTH47USbPijPYVx6rc=; b=h9E13mLjfESyMR0YKskydgd2STSzsCy4GIo8bBVPmyj37tiFaT8kVUQi3lbd2sOs8QpO jKY1aYSFP3cw0vLFUXrEKj/VnFNjqlwFxBeO7hECMhKQECyye1rEMuqRX0pAZrBhEyrI RY3/e2yWcdZJnA917Gg0xnAxgKS55lW7kRJvNs3OTaScE96aIFCyXq/n6HoMxdMtnEkx Ojeyfu3MO6ozyR9EH0Ek25BHqAk/EIZzy6EFRhumGHVRpLbFUo1q/Ed62K5EN+NRLlmP ul3HfZSz+46bWd+HKCpefnyn/MaXMMYjR8Iw9VCcjQOyNU4WAqqtCo57G6KkzpoIK71T wg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3nhnkv5amw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 06 Feb 2023 12:25:56 -0800 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.42; Mon, 6 Feb 2023 12:25:54 -0800 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.42 via Frontend Transport; Mon, 6 Feb 2023 12:25:54 -0800 Received: from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14]) by maili.marvell.com (Postfix) with ESMTP id BAB973F705B; Mon, 6 Feb 2023 12:25:51 -0800 (PST) From: To: , Srikanth Yalavarthi CC: , , , , , , Jerin Jacob Subject: [dpdk-dev] [PATCH v2 11/12] mldev: support to retrieve error information Date: Tue, 7 Feb 2023 01:54:52 +0530 Message-ID: <20230206202453.336280-12-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: QNz95DunbVg9Dt8LIOwH7BprOlbsfp1t X-Proofpoint-GUID: QNz95DunbVg9Dt8LIOwH7BprOlbsfp1t 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 to get error information for an ML op. This information can include both drive specific error message and error code. Signed-off-by: Srikanth Yalavarthi Signed-off-by: Jerin Jacob --- lib/mldev/rte_mldev.c | 31 +++++++++++++++++++++++++++++++ lib/mldev/rte_mldev_core.h | 22 ++++++++++++++++++++++ lib/mldev/version.map | 1 + 3 files changed, 54 insertions(+) diff --git a/lib/mldev/rte_mldev.c b/lib/mldev/rte_mldev.c index da4c272d57..1a8d8d4987 100644 --- a/lib/mldev/rte_mldev.c +++ b/lib/mldev/rte_mldev.c @@ -832,4 +832,35 @@ rte_ml_dequeue_burst(int16_t dev_id, uint16_t qp_id, struct rte_ml_op **ops, uin return (*dev->dequeue_burst)(dev, qp_id, ops, nb_ops); } +int +rte_ml_op_error_get(int16_t dev_id, struct rte_ml_op *op, struct rte_ml_op_error *error) +{ + struct rte_ml_dev *dev; + +#ifdef RTE_LIBRTE_ML_DEV_DEBUG + 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->op_error_get == NULL) + return -ENOTSUP; + + if (op == NULL) { + RTE_MLDEV_LOG(ERR, "Dev %d, op cannot be NULL\n", dev_id); + return -EINVAL; + } + + if (error == NULL) { + RTE_MLDEV_LOG(ERR, "Dev %d, error cannot be NULL\n", dev_id); + return -EINVAL; + } +#else + dev = rte_ml_dev_pmd_get_dev(dev_id); +#endif + + return (*dev->op_error_get)(dev, op, error); +} + RTE_LOG_REGISTER_DEFAULT(rte_ml_dev_logtype, INFO); diff --git a/lib/mldev/rte_mldev_core.h b/lib/mldev/rte_mldev_core.h index b2ddf8fb5e..29bec93c5f 100644 --- a/lib/mldev/rte_mldev_core.h +++ b/lib/mldev/rte_mldev_core.h @@ -73,6 +73,25 @@ typedef uint16_t (*mldev_enqueue_t)(struct rte_ml_dev *dev, uint16_t qp_id, stru typedef uint16_t (*mldev_dequeue_t)(struct rte_ml_dev *dev, uint16_t qp_id, struct rte_ml_op **ops, uint16_t nb_ops); +/** + * @internal + * + * Get error information for an Op. + * + * @param dev + * ML device pointer. + * @param op + * ML Op handle. + * @param error + * Pointer to error structure. + * + * @return + * - 0 on success. + * - <0, error on failure. + */ +typedef int (*mldev_op_error_get_t)(struct rte_ml_dev *dev, struct rte_ml_op *op, + struct rte_ml_op_error *error); + /** * Definitions of all functions exported by a driver through the generic structure of type * *ml_dev_ops* supplied in the *rte_ml_dev* structure associated with a device. @@ -622,6 +641,9 @@ struct rte_ml_dev { /** Pointer to PMD dequeue function. */ mldev_dequeue_t dequeue_burst; + /** Pointer to PMD Op error get function. */ + mldev_op_error_get_t op_error_get; + /** Pointer to device data. */ struct rte_ml_dev_data *data; diff --git a/lib/mldev/version.map b/lib/mldev/version.map index ddf340ef8e..ebe69765e6 100644 --- a/lib/mldev/version.map +++ b/lib/mldev/version.map @@ -29,6 +29,7 @@ EXPERIMENTAL { rte_ml_model_start; rte_ml_model_stop; rte_ml_model_unload; + rte_ml_op_error_get; rte_ml_op_pool_create; rte_ml_op_pool_free; -- 2.39.1