From patchwork Wed Oct 20 11:27:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil Goyal X-Patchwork-Id: 102427 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 87612A0C43; Wed, 20 Oct 2021 13:29:04 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 933F641196; Wed, 20 Oct 2021 13:29:03 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 0062641196 for ; Wed, 20 Oct 2021 13:29:01 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19K8Is3Y021017; Wed, 20 Oct 2021 04:28:56 -0700 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=6rgK3OKHN4x8oJSLNbp6QUsAtojPf63rYAdTFaEhwl0=; b=XpT1dcdlQolc82Hz9bGlfY/hXvgQNF5Gpa8PAHT0U1G+lL3TvnXjwJDVwEuL+Yc6AhxV JtNeUGKeQDxq1VSy+RWWtrkSbpl6vTJ0R9rYQK0jT2YjkPdD2YrCM5zfqCGFAsxOrRTd KNBnZWrLAlORJhTyIm2bZ78wV2fuSbc3nlq4ClcsL/j+9kMqBnpo3Usjr88UwmP5MQQC a5yW8BAjyjsMf10M71A9LRzH2PHiAcqUzOu8ouy/cw1GtCy5b/sEKQn4T1z5xIg6nEqm p7bEpGT3rcEZGgOCJvCSlq+CwLrMIGjz0Jz/8MBOEj2UEXV4uvZa/xie3H9SDcaZOKMb 8Q== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com with ESMTP id 3bt05g4q02-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 20 Oct 2021 04:28:56 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 20 Oct 2021 04:28:54 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Wed, 20 Oct 2021 04:28:54 -0700 Received: from localhost.localdomain (unknown [10.28.36.185]) by maili.marvell.com (Postfix) with ESMTP id 57F2F3F707F; Wed, 20 Oct 2021 04:28:48 -0700 (PDT) From: Akhil Goyal To: CC: , , , , , , , , , , , , , , , , , , , Akhil Goyal Date: Wed, 20 Oct 2021 16:57:53 +0530 Message-ID: <20211020112754.1270163-8-gakhil@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211020112754.1270163-1-gakhil@marvell.com> References: <20211018144201.2028022-1-gakhil@marvell.com> <20211020112754.1270163-1-gakhil@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: H5QZl_OJW0Bin-HZjuNoY-0er9Hx0v4Q X-Proofpoint-ORIG-GUID: H5QZl_OJW0Bin-HZjuNoY-0er9Hx0v4Q X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-20_04,2021-10-20_02,2020-04-07_01 Subject: [dpdk-dev] [PATCH v4 7/8] cryptodev: update fast path APIs to use new flat array 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 Sender: "dev" Rework fast-path cryptodev functions to use rte_crypto_fp_ops[]. While it is an API/ABI breakage, this change is intended to be transparent for both users (no changes in user app is required) and PMD developers (no changes in PMD is required). Signed-off-by: Akhil Goyal Acked-by: Fan Zhang Acked-by: Konstantin Ananyev --- lib/cryptodev/rte_cryptodev.h | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/lib/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.h index ce0dca72be..56e3868ada 100644 --- a/lib/cryptodev/rte_cryptodev.h +++ b/lib/cryptodev/rte_cryptodev.h @@ -1832,13 +1832,18 @@ static inline uint16_t rte_cryptodev_dequeue_burst(uint8_t dev_id, uint16_t qp_id, struct rte_crypto_op **ops, uint16_t nb_ops) { - struct rte_cryptodev *dev = &rte_cryptodevs[dev_id]; + const struct rte_crypto_fp_ops *fp_ops; + void *qp; rte_cryptodev_trace_dequeue_burst(dev_id, qp_id, (void **)ops, nb_ops); - nb_ops = (*dev->dequeue_burst) - (dev->data->queue_pairs[qp_id], ops, nb_ops); + + fp_ops = &rte_crypto_fp_ops[dev_id]; + qp = fp_ops->qp.data[qp_id]; + + nb_ops = fp_ops->dequeue_burst(qp, ops, nb_ops); + #ifdef RTE_CRYPTO_CALLBACKS - if (unlikely(dev->deq_cbs != NULL)) { + if (unlikely(fp_ops->qp.deq_cb != NULL)) { struct rte_cryptodev_cb_rcu *list; struct rte_cryptodev_cb *cb; @@ -1848,7 +1853,7 @@ rte_cryptodev_dequeue_burst(uint8_t dev_id, uint16_t qp_id, * cb and cb->fn/cb->next, __ATOMIC_ACQUIRE memory order is * not required. */ - list = &dev->deq_cbs[qp_id]; + list = &fp_ops->qp.deq_cb[qp_id]; rte_rcu_qsbr_thread_online(list->qsbr, 0); cb = __atomic_load_n(&list->next, __ATOMIC_RELAXED); @@ -1899,10 +1904,13 @@ static inline uint16_t rte_cryptodev_enqueue_burst(uint8_t dev_id, uint16_t qp_id, struct rte_crypto_op **ops, uint16_t nb_ops) { - struct rte_cryptodev *dev = &rte_cryptodevs[dev_id]; + const struct rte_crypto_fp_ops *fp_ops; + void *qp; + fp_ops = &rte_crypto_fp_ops[dev_id]; + qp = fp_ops->qp.data[qp_id]; #ifdef RTE_CRYPTO_CALLBACKS - if (unlikely(dev->enq_cbs != NULL)) { + if (unlikely(fp_ops->qp.enq_cb != NULL)) { struct rte_cryptodev_cb_rcu *list; struct rte_cryptodev_cb *cb; @@ -1912,7 +1920,7 @@ rte_cryptodev_enqueue_burst(uint8_t dev_id, uint16_t qp_id, * cb and cb->fn/cb->next, __ATOMIC_ACQUIRE memory order is * not required. */ - list = &dev->enq_cbs[qp_id]; + list = &fp_ops->qp.enq_cb[qp_id]; rte_rcu_qsbr_thread_online(list->qsbr, 0); cb = __atomic_load_n(&list->next, __ATOMIC_RELAXED); @@ -1927,8 +1935,7 @@ rte_cryptodev_enqueue_burst(uint8_t dev_id, uint16_t qp_id, #endif rte_cryptodev_trace_enqueue_burst(dev_id, qp_id, (void **)ops, nb_ops); - return (*dev->enqueue_burst)( - dev->data->queue_pairs[qp_id], ops, nb_ops); + return fp_ops->enqueue_burst(qp, ops, nb_ops); }