Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/45577/?format=api
http://patches.dpdk.org/api/patches/45577/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180928122615.48390-3-roy.fan.zhang@intel.com/", "project": { "id": 1, "url": "http://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": "<20180928122615.48390-3-roy.fan.zhang@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20180928122615.48390-3-roy.fan.zhang@intel.com", "date": "2018-09-28T12:26:10", "name": "[v2,2/7] examples/ip_pipeline: add cryptodev", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "882d925ad370ebab382e4ac3f24ab5da28b5b7de", "submitter": { "id": 304, "url": "http://patches.dpdk.org/api/people/304/?format=api", "name": "Fan Zhang", "email": "roy.fan.zhang@intel.com" }, "delegate": { "id": 10018, "url": "http://patches.dpdk.org/api/users/10018/?format=api", "username": "cristian_dumitrescu", "first_name": "Cristian", "last_name": "Dumitrescu", "email": "cristian.dumitrescu@intel.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20180928122615.48390-3-roy.fan.zhang@intel.com/mbox/", "series": [ { "id": 1572, "url": "http://patches.dpdk.org/api/series/1572/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=1572", "date": "2018-09-28T12:26:08", "name": "pipeline: add symmetric crypto to action", "version": 2, "mbox": "http://patches.dpdk.org/series/1572/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/45577/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/45577/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 35B141B455;\n\tFri, 28 Sep 2018 14:41:41 +0200 (CEST)", "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n\tby dpdk.org (Postfix) with ESMTP id E5E591B446\n\tfor <dev@dpdk.org>; Fri, 28 Sep 2018 14:41:34 +0200 (CEST)", "from orsmga007.jf.intel.com ([10.7.209.58])\n\tby fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t28 Sep 2018 05:41:33 -0700", "from silpixa00398673.ir.intel.com (HELO\n\tsilpixa00398673.ger.corp.intel.com) ([10.237.223.54])\n\tby orsmga007.jf.intel.com with ESMTP; 28 Sep 2018 05:41:20 -0700" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.54,314,1534834800\"; d=\"scan'208\";a=\"76853806\"", "From": "Fan Zhang <roy.fan.zhang@intel.com>", "To": "dev@dpdk.org", "Cc": "cristian.dumitrescu@intel.com,\n\t\"Zhang, Roy Fan\" <roy.fan.zhang@intel.com>, Zhang@dpdk.org", "Date": "Fri, 28 Sep 2018 13:26:10 +0100", "Message-Id": "<20180928122615.48390-3-roy.fan.zhang@intel.com>", "X-Mailer": "git-send-email 2.13.6", "In-Reply-To": "<20180928122615.48390-1-roy.fan.zhang@intel.com>", "References": "<20180828081929.34085-1-roy.fan.zhang@intel.com>\n\t<20180928122615.48390-1-roy.fan.zhang@intel.com>", "Subject": "[dpdk-dev] [PATCH v2 2/7] examples/ip_pipeline: add cryptodev", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "From: \"Zhang, Roy Fan\" <roy.fan.zhang@intel.com>\n\nThis patch adds symmetric crypto device abstraction to ip_pipeline\nsameple application.\n\nSigned-off-by: Zhang, Roy Fan <roy.fan.zhang@intel.com>\nAcked-by: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>\n---\n examples/ip_pipeline/Makefile | 1 +\n examples/ip_pipeline/cryptodev.c | 117 +++++++++++++++++++++++++++++++++++++++\n examples/ip_pipeline/cryptodev.h | 43 ++++++++++++++\n examples/ip_pipeline/main.c | 9 +++\n examples/ip_pipeline/meson.build | 3 +-\n 5 files changed, 172 insertions(+), 1 deletion(-)\n create mode 100644 examples/ip_pipeline/cryptodev.c\n create mode 100644 examples/ip_pipeline/cryptodev.h", "diff": "diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile\nindex 3fb98ce3e..41ba7df2c 100644\n--- a/examples/ip_pipeline/Makefile\n+++ b/examples/ip_pipeline/Makefile\n@@ -18,6 +18,7 @@ SRCS-y += swq.c\n SRCS-y += tap.c\n SRCS-y += thread.c\n SRCS-y += tmgr.c\n+SRCS-y += cryptodev.c\n \n # Build using pkg-config variables if possible\n $(shell pkg-config --exists libdpdk)\ndiff --git a/examples/ip_pipeline/cryptodev.c b/examples/ip_pipeline/cryptodev.c\nnew file mode 100644\nindex 000000000..c4ba72bec\n--- /dev/null\n+++ b/examples/ip_pipeline/cryptodev.c\n@@ -0,0 +1,117 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2018 Intel Corporation\n+ */\n+\n+#include <stdlib.h>\n+#include <stdio.h>\n+\n+#include <rte_cryptodev.h>\n+#include <rte_cryptodev_pmd.h>\n+#include <rte_string_fns.h>\n+\n+#include \"cryptodev.h\"\n+\n+static struct cryptodev_list cryptodev_list;\n+\n+int\n+cryptodev_init(void)\n+{\n+\tTAILQ_INIT(&cryptodev_list);\n+\n+\treturn 0;\n+}\n+\n+struct cryptodev *\n+cryptodev_find(const char *name)\n+{\n+\tstruct cryptodev *cryptodev;\n+\n+\tif (name == NULL)\n+\t\treturn NULL;\n+\n+\tTAILQ_FOREACH(cryptodev, &cryptodev_list, node)\n+\t\tif (strcmp(cryptodev->name, name) == 0)\n+\t\t\treturn cryptodev;\n+\n+\treturn NULL;\n+}\n+\n+struct cryptodev *\n+cryptodev_next(struct cryptodev *cryptodev)\n+{\n+\treturn (cryptodev == NULL) ?\n+\t\t\tTAILQ_FIRST(&cryptodev_list) :\n+\t\t\tTAILQ_NEXT(cryptodev, node);\n+}\n+\n+struct cryptodev *\n+cryptodev_create(const char *name, struct cryptodev_params *params)\n+{\n+\tstruct rte_cryptodev_info dev_info;\n+\tstruct rte_cryptodev_config dev_conf;\n+\tstruct rte_cryptodev_qp_conf queue_conf;\n+\tstruct cryptodev *cryptodev;\n+\tuint32_t dev_id, i;\n+\tuint32_t socket_id;\n+\tint status;\n+\n+\t/* Check input params */\n+\tif ((name == NULL) ||\n+\t\tcryptodev_find(name) ||\n+\t\t(params->n_queues == 0) ||\n+\t\t(params->queue_size == 0))\n+\t\treturn NULL;\n+\n+\tif (params->dev_name) {\n+\t\tstatus = rte_cryptodev_get_dev_id(params->dev_name);\n+\t\tif (status == -1)\n+\t\t\treturn NULL;\n+\n+\t\tdev_id = (uint32_t)status;\n+\t} else {\n+\t\tif (rte_cryptodev_pmd_is_valid_dev(params->dev_id) == 0)\n+\t\t\treturn NULL;\n+\n+\t\tdev_id = params->dev_id;\n+\t}\n+\n+\tsocket_id = rte_cryptodev_socket_id(dev_id);\n+\trte_cryptodev_info_get(dev_id, &dev_info);\n+\n+\tif (dev_info.max_nb_queue_pairs < params->n_queues)\n+\t\treturn NULL;\n+\tif (dev_info.feature_flags & RTE_CRYPTODEV_FF_HW_ACCELERATED)\n+\t\treturn NULL;\n+\n+\tdev_conf.socket_id = socket_id;\n+\tdev_conf.nb_queue_pairs = params->n_queues;\n+\n+\tstatus = rte_cryptodev_configure(dev_id, &dev_conf);\n+\tif (status < 0)\n+\t\treturn NULL;\n+\n+\tqueue_conf.nb_descriptors = params->queue_size;\n+\tfor (i = 0; i < params->n_queues; i++) {\n+\t\tstatus = rte_cryptodev_queue_pair_setup(dev_id, i,\n+\t\t\t\t&queue_conf, socket_id, NULL);\n+\t\tif (status < 0)\n+\t\t\treturn NULL;\n+\t}\n+\n+\tif (rte_cryptodev_start(dev_id) < 0)\n+\t\treturn NULL;\n+\n+\tcryptodev = calloc(1, sizeof(struct cryptodev));\n+\tif (cryptodev == NULL) {\n+\t\trte_cryptodev_stop(dev_id);\n+\t\treturn NULL;\n+\t}\n+\n+\tstrlcpy(cryptodev->name, name, sizeof(cryptodev->name));\n+\tcryptodev->dev_id = dev_id;\n+\tcryptodev->n_queues = params->n_queues;\n+\n+\tTAILQ_INSERT_TAIL(&cryptodev_list, cryptodev, node);\n+\n+\treturn cryptodev;\n+}\ndiff --git a/examples/ip_pipeline/cryptodev.h b/examples/ip_pipeline/cryptodev.h\nnew file mode 100644\nindex 000000000..d06b3f2f1\n--- /dev/null\n+++ b/examples/ip_pipeline/cryptodev.h\n@@ -0,0 +1,43 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2018 Intel Corporation\n+ */\n+\n+#ifndef _INCLUDE_SYM_C_H_\n+#define _INCLUDE_SYM_C_H_\n+\n+#include <stdint.h>\n+#include <sys/queue.h>\n+\n+#include <rte_cryptodev.h>\n+\n+#include \"common.h\"\n+\n+struct cryptodev {\n+\tTAILQ_ENTRY(cryptodev) node;\n+\tchar name[NAME_SIZE];\n+\tuint16_t dev_id;\n+\tuint32_t n_queues;\n+};\n+\n+TAILQ_HEAD(cryptodev_list, cryptodev);\n+\n+int\n+cryptodev_init(void);\n+\n+struct cryptodev *\n+cryptodev_find(const char *name);\n+\n+struct cryptodev *\n+cryptodev_next(struct cryptodev *cryptodev);\n+\n+struct cryptodev_params {\n+\tconst char *dev_name;\n+\tuint32_t dev_id; /**< Valid only when *dev_name* is NULL. */\n+\tuint32_t n_queues;\n+\tuint32_t queue_size;\n+};\n+\n+struct cryptodev *\n+cryptodev_create(const char *name, struct cryptodev_params *params);\n+\n+#endif\ndiff --git a/examples/ip_pipeline/main.c b/examples/ip_pipeline/main.c\nindex a69faceef..97d1e91c2 100644\n--- a/examples/ip_pipeline/main.c\n+++ b/examples/ip_pipeline/main.c\n@@ -14,6 +14,7 @@\n #include \"cli.h\"\n #include \"conn.h\"\n #include \"kni.h\"\n+#include \"cryptodev.h\"\n #include \"link.h\"\n #include \"mempool.h\"\n #include \"pipeline.h\"\n@@ -210,6 +211,14 @@ main(int argc, char **argv)\n \t\treturn status;\n \t}\n \n+\t/* Sym Crypto */\n+\tstatus = cryptodev_init();\n+\tif (status) {\n+\t\tprintf(\"Error: Cryptodev initialization failed (%d)\\n\",\n+\t\t\t\tstatus);\n+\t\treturn status;\n+\t}\n+\n \t/* Action */\n \tstatus = port_in_action_profile_init();\n \tif (status) {\ndiff --git a/examples/ip_pipeline/meson.build b/examples/ip_pipeline/meson.build\nindex a9f2ea447..5e5fe6479 100644\n--- a/examples/ip_pipeline/meson.build\n+++ b/examples/ip_pipeline/meson.build\n@@ -21,5 +21,6 @@ sources = files(\n \t'swq.c',\n \t'tap.c',\n \t'thread.c',\n-\t'tmgr.c'\n+\t'tmgr.c',\n+\t'cryptodev.c'\n )\n", "prefixes": [ "v2", "2/7" ] }{ "id": 45577, "url": "