From patchwork Wed Jun 24 14:26:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arkadiusz Kusztal X-Patchwork-Id: 72157 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2B855A0350; Wed, 24 Jun 2020 16:27:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DDF291D989; Wed, 24 Jun 2020 16:27:43 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id A7BD71D725 for ; Wed, 24 Jun 2020 16:27:41 +0200 (CEST) IronPort-SDR: 2Xy8ZJB49w7QZAGwdSUylyG4G/mx81YnsM+WbODrKTbTVRDt2AtKss08Va8hXI2qwF73iaAzE8 hPmbptUDHerw== X-IronPort-AV: E=McAfee;i="6000,8403,9662"; a="131912006" X-IronPort-AV: E=Sophos;i="5.75,275,1589266800"; d="scan'208";a="131912006" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jun 2020 07:27:39 -0700 IronPort-SDR: L1yfgHSxglYfdnUc9P4byoYwgebOkdw3+MyMk57Gxh7nzLcdKR2VCiuFZbRt9MQAIrxnc+p/kO QlPLgEyPbn2g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,275,1589266800"; d="scan'208";a="293555819" Received: from akusztax-mobl.ger.corp.intel.com ([10.104.121.106]) by orsmga002.jf.intel.com with ESMTP; 24 Jun 2020 07:27:37 -0700 From: Arek Kusztal To: dev@dpdk.org Cc: akhil.goyal@nxp.com, fiona.trahe@intel.com, arkadiuszx.kusztal@intel.com Date: Wed, 24 Jun 2020 16:26:53 +0200 Message-Id: <20200624142653.16488-1-arkadiuszx.kusztal@intel.com> X-Mailer: git-send-email 2.19.1.windows.1 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2] cryptodev: add function to check if qp was setup X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Fiona Trahe This patch adds function that can check if queue pair was already setup. This may be useful when dealing with multi process approach in cryptodev. Signed-off-by: Fiona Trahe Acked-by: Akhil Goyal --- v2: - changed return values - added function to map file lib/librte_cryptodev/rte_cryptodev.c | 29 ++++++++++++++++++++++++++ lib/librte_cryptodev/rte_cryptodev.h | 17 +++++++++++++++ lib/librte_cryptodev/rte_cryptodev_version.map | 3 +++ 3 files changed, 49 insertions(+) diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index e37b83a..6f556c3 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -1080,6 +1080,35 @@ rte_cryptodev_close(uint8_t dev_id) } int +rte_cryptodev_get_qp_status(uint8_t dev_id, uint16_t queue_pair_id) +{ + struct rte_cryptodev *dev; + + if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) { + CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id); + return -EINVAL; + } + + dev = &rte_crypto_devices[dev_id]; + if (queue_pair_id >= dev->data->nb_queue_pairs) { + CDEV_LOG_ERR("Invalid queue_pair_id=%d", queue_pair_id); + return -EINVAL; + } + void **qps = dev->data->queue_pairs; + + if (qps[queue_pair_id]) { + CDEV_LOG_DEBUG("qp %d on dev %d is initialised", + queue_pair_id, dev_id); + return 1; + } + + CDEV_LOG_DEBUG("qp %d on dev %d is not initialised", + queue_pair_id, dev_id); + + return 0; +} + +int rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id, const struct rte_cryptodev_qp_conf *qp_conf, int socket_id) diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h index 4aaee73..7b3ebc2 100644 --- a/lib/librte_cryptodev/rte_cryptodev.h +++ b/lib/librte_cryptodev/rte_cryptodev.h @@ -727,6 +727,23 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id, const struct rte_cryptodev_qp_conf *qp_conf, int socket_id); /** + * Get the status of queue pairs setup on a specific crypto device + * + * @param dev_id Crypto device identifier. + * @param queue_pair_id The index of the queue pairs to set up. The + * value must be in the range [0, nb_queue_pair + * - 1] previously supplied to + * rte_cryptodev_configure(). + * @return + * - 0: qp was not configured + * - 1: qp was configured + * - -EINVAL: device was not configured + */ +__rte_experimental +int +rte_cryptodev_get_qp_status(uint8_t dev_id, uint16_t queue_pair_id); + +/** * Get the number of queue pairs on a specific crypto device * * @param dev_id Crypto device identifier. diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map index 07a2d2f..a7a78dc 100644 --- a/lib/librte_cryptodev/rte_cryptodev_version.map +++ b/lib/librte_cryptodev/rte_cryptodev_version.map @@ -103,4 +103,7 @@ EXPERIMENTAL { __rte_cryptodev_trace_asym_session_clear; __rte_cryptodev_trace_dequeue_burst; __rte_cryptodev_trace_enqueue_burst; + + # added in 20.08 + rte_cryptodev_get_qp_status; };