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 01D62A00C4; Mon, 14 Nov 2022 13:10:37 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E5CCD40150; Mon, 14 Nov 2022 13:10:36 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 41B164014F for ; Mon, 14 Nov 2022 13:10:35 +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 2AE7vH2Y024571; Mon, 14 Nov 2022 04:08:01 -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=eBuLX8VlXXR9dL1Sfj08h468fJydnpfSa1stRE2oosE=; b=JSnP1LHxN+bPhVKTQQQJYNIA8yj6Bn8oTx4/GAp6CrsqhJz+NBLuDUOBl9zskCpTnpy2 F3HFZdl+J47Z68iW6WbU/NXzgwwJ3YHAmc0Agt7rYXQRws7ITZdiNtvEvq0ys6j7Hp/K M+HrU/zNpaCCJjZNJ9s2UWkKhnLGTgVfF5Q/5jj5pppDBQjIxMYKUxRVL7tJTUYvEsiZ 2uag82ba8fArNW9l3tZSFwFcvVAZwp2lFYnMB/s0aIrXVuuU1wI37DAqhhWRzquv7Ox9 IAHBzI7IuU8eJUaOs7Cf1gvbvVtovysVwiBxv1o5C4ez058imgVJiweTdGayzoZTNdNA pA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3kuhr3gnf8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 14 Nov 2022 04:08:00 -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.18; Mon, 14 Nov 2022 04:07:59 -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.18 via Frontend Transport; Mon, 14 Nov 2022 04:07:59 -0800 Received: from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14]) by maili.marvell.com (Postfix) with ESMTP id E82F85C68EC; Mon, 14 Nov 2022 04:07:33 -0800 (PST) From: To: , Srikanth Yalavarthi CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Jerin Jacob Subject: [dpdk-dev] [PATCH v1 11/12] mldev: support to retrieve error information Date: Mon, 14 Nov 2022 17:32:37 +0530 Message-ID: <20221114120238.2143832-12-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-GUID: OAfqq-HhPPmoQb2vXJzku-rv0LWfojfN X-Proofpoint-ORIG-GUID: OAfqq-HhPPmoQb2vXJzku-rv0LWfojfN 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 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 cdd68e933c..7497a1316d 100644 --- a/lib/mldev/rte_mldev.c +++ b/lib/mldev/rte_mldev.c @@ -829,3 +829,34 @@ 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)) { + ML_DEV_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) { + ML_DEV_LOG(ERR, "Dev %d, op cannot be NULL\n", dev_id); + return -EINVAL; + } + + if (error == NULL) { + ML_DEV_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); +} diff --git a/lib/mldev/rte_mldev_core.h b/lib/mldev/rte_mldev_core.h index 82e8ed0422..9e3873dd3a 100644 --- a/lib/mldev/rte_mldev_core.h +++ b/lib/mldev/rte_mldev_core.h @@ -77,6 +77,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. @@ -626,6 +645,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 02d2eab100..86ab2129ce 100644 --- a/lib/mldev/version.map +++ b/lib/mldev/version.map @@ -28,6 +28,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.38.1