From patchwork Wed Dec 21 10:50:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srujana Challa X-Patchwork-Id: 121232 X-Patchwork-Delegate: thomas@monjalon.net 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 C42F0A034C; Wed, 21 Dec 2022 11:50:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EA5D142D1F; Wed, 21 Dec 2022 11:50:40 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id A13FF42D1A for ; Wed, 21 Dec 2022 11:50:37 +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 2BLA3bPc017580; Wed, 21 Dec 2022 02:50:36 -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=JRz8oxWz6QuaCtrSZjxVIBMJhgSl8f71WsSh52YGE4M3ilkVVzICtJSzeR8eET/9NKxk XNh5lxTEuzqtpKWRWAQmEmtL+aKYOz34cO2IgQHDRAPypdCYOSfl3yJRhjrGwpjUUW4g 1DeQkHQgGD/+WhQjEil8pzPHxvDfkKzB2mIVTG2X27SY7OQ2EgNN548etMyIYn6Fenpp 0FzKrNLhSyZHk1iwTnUiQWORd9sGJubDGyPJlnLy01LoKD5GDQCTqxz3dmFh559uPzvJ AC8YE1NBIW3+chsK2GjJA0AieHPGh03JrOAfFy3CctPlOH+PFsuZlztogGUlypeAvhuj Xw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3mksux9wdw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 21 Dec 2022 02:50:36 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Wed, 21 Dec 2022 02:50:19 -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 02:50:19 -0800 Received: from localhost.localdomain (unknown [10.28.36.175]) by maili.marvell.com (Postfix) with ESMTP id 4336B3F70A4; Wed, 21 Dec 2022 02:50:15 -0800 (PST) From: Srujana Challa To: , CC: , , , , , Subject: [PATCH 3/4] cryptodev: introduce query API for error interrupt event Date: Wed, 21 Dec 2022 16:20:06 +0530 Message-ID: <20221221105007.2667292-3-schalla@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221221105007.2667292-1-schalla@marvell.com> References: <20221221105007.2667292-1-schalla@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: kHworc23uhN6dOrepvQTwPYFhcsv95Pn X-Proofpoint-ORIG-GUID: kHworc23uhN6dOrepvQTwPYFhcsv95Pn 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_05,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 --- 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 {