From patchwork Wed Dec 21 13:21:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srujana Challa X-Patchwork-Id: 121236 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 14EB4A034C; Wed, 21 Dec 2022 14:22:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C183642D14; Wed, 21 Dec 2022 14:21: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 0021B42D10 for ; Wed, 21 Dec 2022 14:21: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 2BLA90Bt017590; Wed, 21 Dec 2022 05:21: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=2cH0YKxtd4VSZCu60fQUiQOG7B2dZOkvD16oFse1EsA=; b=M/Nle4NbWMNq0BAasxpbhwJ9jJFdeY39tmZBWpszwwN0X7ryqp0A+pib3KZ6JbYxanqo eRxFez0IYjqeKHuF50UiVo91zi5wgCzPeulH39jWkDG/rwhbyRmyqhWKD6eNRFSLEv4V /9yp82eBv91zMdwb/x/zN++I/DGDje1A7l+cCIrecdaFXgswG0v8eGnSeol673iHaYYV UuhVePU0Z7/Jp1S/DfVMeJZh8BtxQg7bW3GIqxpLtxVQhBK/JIC92SyJAtFGIRvgYO3S chT43p9sIgRFZrELxOWG1apwzC8EK5Y3Ap3dP66slOcOg22XKg/Vq752n3lfqf/M0H1U uA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3mksuxadsj-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 21 Dec 2022 05:21: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; Wed, 21 Dec 2022 05:21:53 -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; Wed, 21 Dec 2022 05:21:53 -0800 Received: from localhost.localdomain (unknown [10.28.36.175]) by maili.marvell.com (Postfix) with ESMTP id 83E683F7070; Wed, 21 Dec 2022 05:21:51 -0800 (PST) From: Srujana Challa To: , CC: , , , , , Subject: [PATCH 3/4] cryptodev: introduce query API for error interrupt event Date: Wed, 21 Dec 2022 18:51:41 +0530 Message-ID: <20221221132142.2732040-3-schalla@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221221132142.2732040-1-schalla@marvell.com> References: <20221221132142.2732040-1-schalla@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: yVmNWJcn-D6ctXP5wU_mwbBTbfmyLv1r X-Proofpoint-ORIG-GUID: yVmNWJcn-D6ctXP5wU_mwbBTbfmyLv1r X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-21_07,2022-12-21_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 An event RTE_CRYPTODEV_EVENT_ERROR gets fired when crypto PMD receives an error interrupt. This patch adds query function for the application, to get more info about the event. Signed-off-by: Srujana Challa Acked-by: Akhil Goyal --- lib/cryptodev/cryptodev_pmd.h | 9 +++++++++ lib/cryptodev/rte_cryptodev.c | 19 +++++++++++++++++++ lib/cryptodev/rte_cryptodev.h | 19 +++++++++++++++++++ lib/cryptodev/version.map | 3 +++ 4 files changed, 50 insertions(+) diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h index 0020102eb7..0dfad9e24f 100644 --- a/lib/cryptodev/cryptodev_pmd.h +++ b/lib/cryptodev/cryptodev_pmd.h @@ -451,6 +451,13 @@ typedef int (*cryptodev_session_event_mdata_set_t)( enum rte_crypto_op_sess_type sess_type, void *ev_mdata); +/** + * @internal Query queue pair error interrupt event. + * @see rte_cryptodev_queue_pair_event_error_query() + */ +typedef int (*cryptodev_queue_pair_event_error_query_t)(struct rte_cryptodev *dev, + uint16_t qp_id); + /** Crypto device operations function pointer table */ struct rte_cryptodev_ops { cryptodev_configure_t dev_configure; /**< Configure device. */ @@ -497,6 +504,8 @@ struct rte_cryptodev_ops { }; cryptodev_session_event_mdata_set_t session_ev_mdata_set; /**< Set a Crypto or Security session even meta data. */ + cryptodev_queue_pair_event_error_query_t queue_pair_event_error_query; + /**< Query queue error interrupt event */ }; diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c index 2165a0688c..89ff66d2ba 100644 --- a/lib/cryptodev/rte_cryptodev.c +++ b/lib/cryptodev/rte_cryptodev.c @@ -1863,6 +1863,25 @@ rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev, rte_spinlock_unlock(&rte_cryptodev_cb_lock); } +int +rte_cryptodev_queue_pair_event_error_query(uint8_t dev_id, uint16_t qp_id) +{ + struct rte_cryptodev *dev; + + if (!rte_cryptodev_is_valid_dev(dev_id)) { + CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id); + return -EINVAL; + } + dev = &rte_crypto_devices[dev_id]; + + if (qp_id >= dev->data->nb_queue_pairs) + return -EINVAL; + if (*dev->dev_ops->queue_pair_event_error_query == NULL) + return -ENOTSUP; + + return dev->dev_ops->queue_pair_event_error_query(dev, qp_id); +} + struct rte_mempool * rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts, uint32_t elt_size, uint32_t cache_size, uint16_t user_data_size, diff --git a/lib/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.h index 86d792e2e7..5f11a538fb 100644 --- a/lib/cryptodev/rte_cryptodev.h +++ b/lib/cryptodev/rte_cryptodev.h @@ -871,6 +871,25 @@ rte_cryptodev_callback_unregister(uint8_t dev_id, enum rte_cryptodev_event_type event, rte_cryptodev_cb_fn cb_fn, void *cb_arg); +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Query a cryptodev queue pair if there are pending RTE_CRYPTODEV_EVENT_ERROR + * events. + * + * @param dev_id The device identifier. + * @param qp_id Queue pair index to be queried. + * + * @return + * - 1 if requested queue has a pending event. + * - 0 if no pending event is found. + * - a negative value on failure + */ +__rte_experimental +int +rte_cryptodev_queue_pair_event_error_query(uint8_t dev_id, uint16_t qp_id); + struct rte_cryptodev_callback; /** Structure to keep track of registered callbacks */ diff --git a/lib/cryptodev/version.map b/lib/cryptodev/version.map index 00c99fb45c..214c91a06f 100644 --- a/lib/cryptodev/version.map +++ b/lib/cryptodev/version.map @@ -150,6 +150,9 @@ EXPERIMENTAL { __rte_cryptodev_trace_sym_session_get_user_data; __rte_cryptodev_trace_sym_session_set_user_data; __rte_cryptodev_trace_count; + + # added in 23.03 + rte_cryptodev_queue_pair_event_error_query; }; INTERNAL {