Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/24543/?format=api
https://patches.dpdk.org/api/patches/24543/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1495639634-74846-9-git-send-email-pablo.de.lara.guarch@intel.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": "<1495639634-74846-9-git-send-email-pablo.de.lara.guarch@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1495639634-74846-9-git-send-email-pablo.de.lara.guarch@intel.com", "date": "2017-05-24T15:27:10", "name": "[dpdk-dev,08/12] cryptodev: add PCI driver helpers", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "1fb7fa7a43f347361bfbff91694d92fb07a64239", "submitter": { "id": 9, "url": "https://patches.dpdk.org/api/people/9/?format=api", "name": "De Lara Guarch, Pablo", "email": "pablo.de.lara.guarch@intel.com" }, "delegate": { "id": 22, "url": "https://patches.dpdk.org/api/users/22/?format=api", "username": "pdelarag", "first_name": "Pablo", "last_name": "de Lara Guarch", "email": "pablo.de.lara.guarch@intel.com" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/1495639634-74846-9-git-send-email-pablo.de.lara.guarch@intel.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/24543/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/24543/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 [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 76ECC9952;\n\tWed, 24 May 2017 17:27:28 +0200 (CEST)", "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id DBEF57D02\n\tfor <dev@dpdk.org>; Wed, 24 May 2017 17:27:07 +0200 (CEST)", "from fmsmga004.fm.intel.com ([10.253.24.48])\n\tby orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t24 May 2017 08:27:07 -0700", "from silpixa00381631.ir.intel.com (HELO\n\tsilpixa00381631.ger.corp.intel.com) ([10.237.222.122])\n\tby fmsmga004.fm.intel.com with ESMTP; 24 May 2017 08:27:06 -0700" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.38,386,1491289200\"; d=\"scan'208\";a=\"265893731\"", "From": "Pablo de Lara <pablo.de.lara.guarch@intel.com>", "To": "declan.doherty@intel.com,\n\tthomas@monjalon.net", "Cc": "dev@dpdk.org,\n\tPablo de Lara <pablo.de.lara.guarch@intel.com>", "Date": "Wed, 24 May 2017 16:27:10 +0100", "Message-Id": "<1495639634-74846-9-git-send-email-pablo.de.lara.guarch@intel.com>", "X-Mailer": "git-send-email 2.7.4", "In-Reply-To": "<1495639634-74846-1-git-send-email-pablo.de.lara.guarch@intel.com>", "References": "<1495639634-74846-1-git-send-email-pablo.de.lara.guarch@intel.com>", "Subject": "[dpdk-dev] [PATCH 08/12] cryptodev: add PCI driver helpers", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Add PCI probe/remove/init/uninit functions in a separate\nfile rte_cryptodev_pci.h, which do not use cryptodev driver,\nin order to be removed in next commits.\n\nSigned-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>\n---\n lib/librte_cryptodev/Makefile | 1 +\n lib/librte_cryptodev/rte_cryptodev_pci.h | 177 +++++++++++++++++++++++++++++++\n 2 files changed, 178 insertions(+)\n create mode 100644 lib/librte_cryptodev/rte_cryptodev_pci.h", "diff": "diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile\nindex 4d37acf..2a31be3 100644\n--- a/lib/librte_cryptodev/Makefile\n+++ b/lib/librte_cryptodev/Makefile\n@@ -49,6 +49,7 @@ SYMLINK-y-include += rte_crypto_sym.h\n SYMLINK-y-include += rte_cryptodev.h\n SYMLINK-y-include += rte_cryptodev_pmd.h\n SYMLINK-y-include += rte_cryptodev_vdev.h\n+SYMLINK-y-include += rte_cryptodev_pci.h\n \n # versioning export map\n EXPORT_MAP := rte_cryptodev_version.map\ndiff --git a/lib/librte_cryptodev/rte_cryptodev_pci.h b/lib/librte_cryptodev/rte_cryptodev_pci.h\nnew file mode 100644\nindex 0000000..ea9a750\n--- /dev/null\n+++ b/lib/librte_cryptodev/rte_cryptodev_pci.h\n@@ -0,0 +1,177 @@\n+/*-\n+ * BSD LICENSE\n+ *\n+ * Copyright(c) 2017 Intel Corporation. All rights reserved.\n+ *\n+ * Redistribution and use in source and binary forms, with or without\n+ * modification, are permitted provided that the following conditions\n+ * are met:\n+ *\n+ * * Redistributions of source code must retain the above copyright\n+ * notice, this list of conditions and the following disclaimer.\n+ * * Redistributions in binary form must reproduce the above copyright\n+ * notice, this list of conditions and the following disclaimer in\n+ * the documentation and/or other materials provided with the\n+ * distribution.\n+ * * Neither the name of the copyright holder nor the names of its\n+ * contributors may be used to endorse or promote products derived\n+ * from this software without specific prior written permission.\n+ *\n+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#ifndef _RTE_CRYPTODEV_PCI_H_\n+#define _RTE_CRYPTODEV_PCI_H_\n+\n+#include <rte_pci.h>\n+#include <rte_cryptodev.h>\n+#include <rte_cryptodev_pmd.h>\n+\n+/**\n+ * Initialisation function of a crypto driver invoked for each matching\n+ * crypto PCI device detected during the PCI probing phase.\n+ *\n+ * @param\tdev\tThe dev pointer is the address of the *rte_cryptodev*\n+ *\t\t\tstructure associated with the matching device and which\n+ *\t\t\thas been [automatically] allocated in the\n+ *\t\t\t*rte_crypto_devices* array.\n+ *\n+ * @return\n+ * - 0: Success, the device is properly initialised by the driver.\n+ * In particular, the driver MUST have set up the *dev_ops* pointer\n+ * of the *dev* structure.\n+ * - <0: Error code of the device initialisation failure.\n+ */\n+typedef int (*cryptodev_pci_init_t)(struct rte_cryptodev *dev);\n+\n+/**\n+ * Finalisation function of a driver invoked for each matching\n+ * PCI device detected during the PCI closing phase.\n+ *\n+ * @param\tdev\tThe dev pointer is the address of the *rte_cryptodev*\n+ *\t\t\tstructure associated with the matching device and which\n+ *\t\t\thas been [automatically] allocated in the\n+ *\t\t\t*rte_crypto_devices* array.\n+ *\n+ * * @return\n+ * - 0: Success, the device is properly finalised by the driver.\n+ * In particular, the driver MUST free the *dev_ops* pointer\n+ * of the *dev* structure.\n+ * - <0: Error code of the device initialisation failure.\n+ */\n+typedef int (*cryptodev_pci_uninit_t)(struct rte_cryptodev *dev);\n+\n+/**\n+ * @internal\n+ * Wrapper for use by pci drivers as a .probe function to attach to a crypto\n+ * interface.\n+ */\n+static inline int\n+rte_cryptodev_pci_generic_probe(struct rte_pci_device *pci_dev,\n+\t\t\tsize_t private_data_size,\n+\t\t\tcryptodev_pci_init_t dev_init)\n+{\n+\tstruct rte_cryptodev *cryptodev;\n+\n+\tchar cryptodev_name[RTE_CRYPTODEV_NAME_MAX_LEN];\n+\n+\tint retval;\n+\n+\trte_pci_device_name(&pci_dev->addr, cryptodev_name,\n+\t\t\tsizeof(cryptodev_name));\n+\n+\tcryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());\n+\tif (cryptodev == NULL)\n+\t\treturn -ENOMEM;\n+\n+\tif (rte_eal_process_type() == RTE_PROC_PRIMARY) {\n+\t\tcryptodev->data->dev_private =\n+\t\t\t\trte_zmalloc_socket(\n+\t\t\t\t\t\t\"cryptodev private structure\",\n+\t\t\t\t\t\tprivate_data_size,\n+\t\t\t\t\t\tRTE_CACHE_LINE_SIZE,\n+\t\t\t\t\t\trte_socket_id());\n+\n+\t\tif (cryptodev->data->dev_private == NULL)\n+\t\t\trte_panic(\"Cannot allocate memzone for private \"\n+\t\t\t\t\t\"device data\");\n+\t}\n+\n+\tcryptodev->device = &pci_dev->device;\n+\n+\t/* init user callbacks */\n+\tTAILQ_INIT(&(cryptodev->link_intr_cbs));\n+\n+\t/* Invoke PMD device initialization function */\n+\tRTE_FUNC_PTR_OR_ERR_RET(*dev_init, -EINVAL);\n+\tretval = dev_init(cryptodev);\n+\tif (retval == 0)\n+\t\treturn 0;\n+\n+\tCDEV_LOG_ERR(\"driver %s: crypto_dev_init(vendor_id=0x%x device_id=0x%x)\"\n+\t\t\t\" failed\", pci_dev->device.driver->name,\n+\t\t\t(unsigned int) pci_dev->id.vendor_id,\n+\t\t\t(unsigned int) pci_dev->id.device_id);\n+\n+\tif (rte_eal_process_type() == RTE_PROC_PRIMARY)\n+\t\trte_free(cryptodev->data->dev_private);\n+\n+\t/* free crypto device */\n+\trte_cryptodev_pmd_release_device(cryptodev);\n+\n+\treturn -ENXIO;\n+}\n+\n+/**\n+ * @internal\n+ * Wrapper for use by pci drivers as a .remove function to detach a crypto\n+ * interface.\n+ */\n+static inline int\n+rte_cryptodev_pci_generic_remove(struct rte_pci_device *pci_dev,\n+\t\tcryptodev_pci_uninit_t dev_uninit)\n+{\n+\tstruct rte_cryptodev *cryptodev;\n+\tchar cryptodev_name[RTE_CRYPTODEV_NAME_MAX_LEN];\n+\tint ret;\n+\n+\tif (pci_dev == NULL)\n+\t\treturn -EINVAL;\n+\n+\trte_pci_device_name(&pci_dev->addr, cryptodev_name,\n+\t\t\tsizeof(cryptodev_name));\n+\n+\tcryptodev = rte_cryptodev_pmd_get_named_dev(cryptodev_name);\n+\tif (cryptodev == NULL)\n+\t\treturn -ENODEV;\n+\n+\t/* Invoke PMD device uninit function */\n+\tif (dev_uninit) {\n+\t\tret = dev_uninit(cryptodev);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t}\n+\n+\t/* free crypto device */\n+\trte_cryptodev_pmd_release_device(cryptodev);\n+\n+\tif (rte_eal_process_type() == RTE_PROC_PRIMARY)\n+\t\trte_free(cryptodev->data->dev_private);\n+\n+\tcryptodev->device = NULL;\n+\tcryptodev->data = NULL;\n+\n+\treturn 0;\n+}\n+\n+#endif /* _RTE_CRYPTODEV_PCI_H_ */\n", "prefixes": [ "dpdk-dev", "08/12" ] }{ "id": 24543, "url": "