Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/102423/?format=api
https://patches.dpdk.org/api/patches/102423/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20211020112754.1270163-4-gakhil@marvell.com/", "project": { "id": 1, "url": "https://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20211020112754.1270163-4-gakhil@marvell.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20211020112754.1270163-4-gakhil@marvell.com", "date": "2021-10-20T11:27:49", "name": "[v4,3/8] cryptodev: move inline APIs into separate structure", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "4fb2a9a3a9ed6510628060feb77a37f0a6801933", "submitter": { "id": 2094, "url": "https://patches.dpdk.org/api/people/2094/?format=api", "name": "Akhil Goyal", "email": "gakhil@marvell.com" }, "delegate": { "id": 6690, "url": "https://patches.dpdk.org/api/users/6690/?format=api", "username": "akhil", "first_name": "akhil", "last_name": "goyal", "email": "gakhil@marvell.com" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20211020112754.1270163-4-gakhil@marvell.com/mbox/", "series": [ { "id": 19839, "url": "https://patches.dpdk.org/api/series/19839/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=19839", "date": "2021-10-20T11:27:46", "name": "cryptodev: hide internal structures", "version": 4, "mbox": "https://patches.dpdk.org/series/19839/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/102423/comments/", "check": "warning", "checks": "https://patches.dpdk.org/api/patches/102423/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "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])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 7DD85A0C43;\n\tWed, 20 Oct 2021 13:28:38 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 0F778411FA;\n\tWed, 20 Oct 2021 13:28:38 +0200 (CEST)", "from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com\n [67.231.156.173])\n by mails.dpdk.org (Postfix) with ESMTP id 62F3240142\n for <dev@dpdk.org>; Wed, 20 Oct 2021 13:28:35 +0200 (CEST)", "from pps.filterd (m0045851.ppops.net [127.0.0.1])\n by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id\n 19K8K7tE021014;\n Wed, 20 Oct 2021 04:28:30 -0700", "from dc5-exch02.marvell.com ([199.233.59.182])\n by mx0b-0016f401.pphosted.com with ESMTP id 3bt05g4pwg-2\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Wed, 20 Oct 2021 04:28:29 -0700", "from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18;\n Wed, 20 Oct 2021 04:28:28 -0700", "from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.18 via Frontend\n Transport; Wed, 20 Oct 2021 04:28:28 -0700", "from localhost.localdomain (unknown [10.28.36.185])\n by maili.marvell.com (Postfix) with ESMTP id A2A773F707F;\n Wed, 20 Oct 2021 04:28:21 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n h=from : to : cc :\n subject : date : message-id : in-reply-to : references : mime-version :\n content-transfer-encoding : content-type; s=pfpt0220;\n bh=gxmrBeKVkyjnE3mcKazp1VxeCORA3pkxjPBBTRJTnB8=;\n b=kMSOy6KwfPRXtuwLVJiUWGN/2FGNkOZPpkEwHzNj/tbiZ+KLBP0TpBh9xMcWlexHYaEA\n SZdHQhZQ9dOcFk1HvPpGKTZ+5TyUlx95OGyyKxCMy2CnckTpzyS5x04cAsE8cARkzDXN\n AvpqwIIHOo4pust3DzhNJ3gza7V0gxEWbnQvmFpJCIcwaFr0JY7vgfx73ZLUY0mTAYEt\n ssWKnBSYe3JaPZjj+QWa8Y36YFazgiIWD5ArlZ+T7ttrmBJra+HqdW34fMavct0IY/6L\n UYFQxDHNlFPBFmG0NsriDkUNXqhWLuvxeKx7y/ExSbJjCISgKUxvE7m0DxV1jB70286B KQ==", "From": "Akhil Goyal <gakhil@marvell.com>", "To": "<dev@dpdk.org>", "CC": "<thomas@monjalon.net>, <david.marchand@redhat.com>,\n <hemant.agrawal@nxp.com>, <anoobj@marvell.com>,\n <pablo.de.lara.guarch@intel.com>, <fiona.trahe@intel.com>,\n <declan.doherty@intel.com>, <matan@nvidia.com>, <g.singh@nxp.com>,\n <roy.fan.zhang@intel.com>, <jianjay.zhou@huawei.com>,\n <asomalap@amd.com>, <ruifeng.wang@arm.com>,\n <konstantin.ananyev@intel.com>, <radu.nicolau@intel.com>,\n <ajit.khaparde@broadcom.com>, <rnagadheeraj@marvell.com>,\n <adwivedi@marvell.com>, <ciara.power@intel.com>,\n Akhil Goyal <gakhil@marvell.com>, Rebecca Troy <rebecca.troy@intel.com>", "Date": "Wed, 20 Oct 2021 16:57:49 +0530", "Message-ID": "<20211020112754.1270163-4-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>\n <20211020112754.1270163-1-gakhil@marvell.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain", "X-Proofpoint-GUID": "wrsxH6RTvXH_vFzXWJtvEjLDJXs5orst", "X-Proofpoint-ORIG-GUID": "wrsxH6RTvXH_vFzXWJtvEjLDJXs5orst", "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475\n definitions=2021-10-20_04,2021-10-20_02,2020-04-07_01", "Subject": "[dpdk-dev] [PATCH v4 3/8] cryptodev: move inline APIs into separate\n structure", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Move fastpath inline function pointers from rte_cryptodev into a\nseparate structure accessed via a flat array.\nThe intension is to make rte_cryptodev and related structures private\nto avoid future API/ABI breakages.\n\nSigned-off-by: Akhil Goyal <gakhil@marvell.com>\nTested-by: Rebecca Troy <rebecca.troy@intel.com>\nAcked-by: Fan Zhang <roy.fan.zhang@intel.com>\nAcked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>\n---\n lib/cryptodev/cryptodev_pmd.c | 53 +++++++++++++++++++++++++++++-\n lib/cryptodev/cryptodev_pmd.h | 11 +++++++\n lib/cryptodev/rte_cryptodev.c | 19 +++++++++++\n lib/cryptodev/rte_cryptodev_core.h | 29 ++++++++++++++++\n lib/cryptodev/version.map | 5 +++\n 5 files changed, 116 insertions(+), 1 deletion(-)", "diff": "diff --git a/lib/cryptodev/cryptodev_pmd.c b/lib/cryptodev/cryptodev_pmd.c\nindex 44a70ecb35..fd74543682 100644\n--- a/lib/cryptodev/cryptodev_pmd.c\n+++ b/lib/cryptodev/cryptodev_pmd.c\n@@ -3,7 +3,7 @@\n */\n \n #include <sys/queue.h>\n-\n+#include <rte_errno.h>\n #include <rte_string_fns.h>\n #include <rte_malloc.h>\n \n@@ -160,3 +160,54 @@ rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryptodev)\n \n \treturn 0;\n }\n+\n+static uint16_t\n+dummy_crypto_enqueue_burst(__rte_unused void *qp,\n+\t\t\t __rte_unused struct rte_crypto_op **ops,\n+\t\t\t __rte_unused uint16_t nb_ops)\n+{\n+\tCDEV_LOG_ERR(\n+\t\t\"crypto enqueue burst requested for unconfigured device\");\n+\trte_errno = ENOTSUP;\n+\treturn 0;\n+}\n+\n+static uint16_t\n+dummy_crypto_dequeue_burst(__rte_unused void *qp,\n+\t\t\t __rte_unused struct rte_crypto_op **ops,\n+\t\t\t __rte_unused uint16_t nb_ops)\n+{\n+\tCDEV_LOG_ERR(\n+\t\t\"crypto dequeue burst requested for unconfigured device\");\n+\trte_errno = ENOTSUP;\n+\treturn 0;\n+}\n+\n+void\n+cryptodev_fp_ops_reset(struct rte_crypto_fp_ops *fp_ops)\n+{\n+\tstatic struct rte_cryptodev_cb_rcu dummy_cb[RTE_MAX_QUEUES_PER_PORT];\n+\tstatic void *dummy_data[RTE_MAX_QUEUES_PER_PORT];\n+\tstatic const struct rte_crypto_fp_ops dummy = {\n+\t\t.enqueue_burst = dummy_crypto_enqueue_burst,\n+\t\t.dequeue_burst = dummy_crypto_dequeue_burst,\n+\t\t.qp = {\n+\t\t\t.data = dummy_data,\n+\t\t\t.enq_cb = dummy_cb,\n+\t\t\t.deq_cb = dummy_cb,\n+\t\t},\n+\t};\n+\n+\t*fp_ops = dummy;\n+}\n+\n+void\n+cryptodev_fp_ops_set(struct rte_crypto_fp_ops *fp_ops,\n+\t\t const struct rte_cryptodev *dev)\n+{\n+\tfp_ops->enqueue_burst = dev->enqueue_burst;\n+\tfp_ops->dequeue_burst = dev->dequeue_burst;\n+\tfp_ops->qp.data = dev->data->queue_pairs;\n+\tfp_ops->qp.enq_cb = dev->enq_cbs;\n+\tfp_ops->qp.deq_cb = dev->deq_cbs;\n+}\ndiff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h\nindex 36606dd10b..a71edbb991 100644\n--- a/lib/cryptodev/cryptodev_pmd.h\n+++ b/lib/cryptodev/cryptodev_pmd.h\n@@ -516,6 +516,17 @@ RTE_INIT(init_ ##driver_id)\\\n \tdriver_id = rte_cryptodev_allocate_driver(&crypto_drv, &(drv));\\\n }\n \n+/* Reset crypto device fastpath APIs to dummy values. */\n+__rte_internal\n+void\n+cryptodev_fp_ops_reset(struct rte_crypto_fp_ops *fp_ops);\n+\n+/* Setup crypto device fastpath APIs. */\n+__rte_internal\n+void\n+cryptodev_fp_ops_set(struct rte_crypto_fp_ops *fp_ops,\n+\t\t const struct rte_cryptodev *dev);\n+\n static inline void *\n get_sym_session_private_data(const struct rte_cryptodev_sym_session *sess,\n \t\tuint8_t driver_id) {\ndiff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c\nindex eb86e629aa..305e013ebb 100644\n--- a/lib/cryptodev/rte_cryptodev.c\n+++ b/lib/cryptodev/rte_cryptodev.c\n@@ -53,6 +53,9 @@ static struct rte_cryptodev_global cryptodev_globals = {\n \t\t.nb_devs\t\t= 0\n };\n \n+/* Public fastpath APIs. */\n+struct rte_crypto_fp_ops rte_crypto_fp_ops[RTE_CRYPTO_MAX_DEVS];\n+\n /* spinlock for crypto device callbacks */\n static rte_spinlock_t rte_cryptodev_cb_lock = RTE_SPINLOCK_INITIALIZER;\n \n@@ -917,6 +920,8 @@ rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev)\n \n \tdev_id = cryptodev->data->dev_id;\n \n+\tcryptodev_fp_ops_reset(rte_crypto_fp_ops + dev_id);\n+\n \t/* Close device only if device operations have been set */\n \tif (cryptodev->dev_ops) {\n \t\tret = rte_cryptodev_close(dev_id);\n@@ -1080,6 +1085,9 @@ rte_cryptodev_start(uint8_t dev_id)\n \t}\n \n \tdiag = (*dev->dev_ops->dev_start)(dev);\n+\t/* expose selection of PMD fast-path functions */\n+\tcryptodev_fp_ops_set(rte_crypto_fp_ops + dev_id, dev);\n+\n \trte_cryptodev_trace_start(dev_id, diag);\n \tif (diag == 0)\n \t\tdev->data->dev_started = 1;\n@@ -1109,6 +1117,9 @@ rte_cryptodev_stop(uint8_t dev_id)\n \t\treturn;\n \t}\n \n+\t/* point fast-path functions to dummy ones */\n+\tcryptodev_fp_ops_reset(rte_crypto_fp_ops + dev_id);\n+\n \t(*dev->dev_ops->dev_stop)(dev);\n \trte_cryptodev_trace_stop(dev_id);\n \tdev->data->dev_started = 0;\n@@ -2411,3 +2422,11 @@ rte_cryptodev_allocate_driver(struct cryptodev_driver *crypto_drv,\n \n \treturn nb_drivers++;\n }\n+\n+RTE_INIT(cryptodev_init_fp_ops)\n+{\n+\tuint32_t i;\n+\n+\tfor (i = 0; i != RTE_DIM(rte_crypto_fp_ops); i++)\n+\t\tcryptodev_fp_ops_reset(rte_crypto_fp_ops + i);\n+}\ndiff --git a/lib/cryptodev/rte_cryptodev_core.h b/lib/cryptodev/rte_cryptodev_core.h\nindex 1633e55889..2bb9a228c1 100644\n--- a/lib/cryptodev/rte_cryptodev_core.h\n+++ b/lib/cryptodev/rte_cryptodev_core.h\n@@ -25,6 +25,35 @@ typedef uint16_t (*enqueue_pkt_burst_t)(void *qp,\n \t\tstruct rte_crypto_op **ops,\tuint16_t nb_ops);\n /**< Enqueue packets for processing on queue pair of a device. */\n \n+/**\n+ * @internal\n+ * Structure used to hold opaque pointers to internal ethdev Rx/Tx\n+ * queues data.\n+ * The main purpose to expose these pointers at all - allow compiler\n+ * to fetch this data for fast-path cryptodev inline functions in advance.\n+ */\n+struct rte_cryptodev_qpdata {\n+\t/** points to array of internal queue pair data pointers. */\n+\tvoid **data;\n+\t/** points to array of enqueue callback data pointers */\n+\tstruct rte_cryptodev_cb_rcu *enq_cb;\n+\t/** points to array of dequeue callback data pointers */\n+\tstruct rte_cryptodev_cb_rcu *deq_cb;\n+};\n+\n+struct rte_crypto_fp_ops {\n+\t/** PMD enqueue burst function. */\n+\tenqueue_pkt_burst_t enqueue_burst;\n+\t/** PMD dequeue burst function. */\n+\tdequeue_pkt_burst_t dequeue_burst;\n+\t/** Internal queue pair data pointers. */\n+\tstruct rte_cryptodev_qpdata qp;\n+\t/** Reserved for future ops. */\n+\tuintptr_t reserved[3];\n+} __rte_cache_aligned;\n+\n+extern struct rte_crypto_fp_ops rte_crypto_fp_ops[RTE_CRYPTO_MAX_DEVS];\n+\n /**\n * @internal\n * The data part, with no function pointers, associated with each device.\ndiff --git a/lib/cryptodev/version.map b/lib/cryptodev/version.map\nindex 43cf937e40..ed62ced221 100644\n--- a/lib/cryptodev/version.map\n+++ b/lib/cryptodev/version.map\n@@ -45,6 +45,9 @@ DPDK_22 {\n \trte_cryptodev_sym_session_init;\n \trte_cryptodevs;\n \n+\t#added in 21.11\n+\trte_crypto_fp_ops;\n+\n \tlocal: *;\n };\n \n@@ -109,6 +112,8 @@ EXPERIMENTAL {\n INTERNAL {\n \tglobal:\n \n+\tcryptodev_fp_ops_reset;\n+\tcryptodev_fp_ops_set;\n \trte_cryptodev_allocate_driver;\n \trte_cryptodev_pmd_allocate;\n \trte_cryptodev_pmd_callback_process;\n", "prefixes": [ "v4", "3/8" ] }{ "id": 102423, "url": "