Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/75831/?format=api
http://patches.dpdk.org/api/patches/75831/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200821162944.29840-7-bruce.richardson@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": "<20200821162944.29840-7-bruce.richardson@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20200821162944.29840-7-bruce.richardson@intel.com", "date": "2020-08-21T16:29:32", "name": "[v2,06/18] raw/ioat: add vdev probe for DSA/idxd devices", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "6b71d83c502352d9fe328a10f4fd0c11961dc239", "submitter": { "id": 20, "url": "http://patches.dpdk.org/api/people/20/?format=api", "name": "Bruce Richardson", "email": "bruce.richardson@intel.com" }, "delegate": { "id": 1, "url": "http://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200821162944.29840-7-bruce.richardson@intel.com/mbox/", "series": [ { "id": 11744, "url": "http://patches.dpdk.org/api/series/11744/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=11744", "date": "2020-08-21T16:29:26", "name": "raw/ioat: enhancements and new hardware support", "version": 2, "mbox": "http://patches.dpdk.org/series/11744/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/75831/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/75831/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 8B3EFA04AF;\n\tFri, 21 Aug 2020 18:30:59 +0200 (CEST)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id A19BD1C114;\n\tFri, 21 Aug 2020 18:30:09 +0200 (CEST)", "from mga18.intel.com (mga18.intel.com [134.134.136.126])\n by dpdk.org (Postfix) with ESMTP id 217231C112\n for <dev@dpdk.org>; Fri, 21 Aug 2020 18:30:07 +0200 (CEST)", "from orsmga006.jf.intel.com ([10.7.209.51])\n by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 21 Aug 2020 09:30:07 -0700", "from silpixa00399126.ir.intel.com ([10.237.222.56])\n by orsmga006.jf.intel.com with ESMTP; 21 Aug 2020 09:30:06 -0700" ], "IronPort-SDR": [ "\n 78B49STQcIaDcvXWg82hy9XcETc+CeVK9yYl+x7Vi9x/3MYQHnf+wwhCz8oaOqP3uT0LaCg6gk\n C9+nbkqCQ8eg==", "\n URbeMUSlechKnTs7DmOc2rWLbmKqG9mfpFbnoHaozq1BTaC44FHuuzf1+X/Qg+gdTbODaxB/nV\n Vdv4KEZjlMRw==" ], "X-IronPort-AV": [ "E=McAfee;i=\"6000,8403,9719\"; a=\"143209489\"", "E=Sophos;i=\"5.76,337,1592895600\"; d=\"scan'208\";a=\"143209489\"", "E=Sophos;i=\"5.76,337,1592895600\"; d=\"scan'208\";a=\"297992725\"" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "From": "Bruce Richardson <bruce.richardson@intel.com>", "To": "dev@dpdk.org", "Cc": "cheng1.jiang@intel.com, patrick.fu@intel.com, ping.yu@intel.com,\n kevin.laatz@intel.com, Bruce Richardson <bruce.richardson@intel.com>", "Date": "Fri, 21 Aug 2020 17:29:32 +0100", "Message-Id": "<20200821162944.29840-7-bruce.richardson@intel.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20200821162944.29840-1-bruce.richardson@intel.com>", "References": "<20200721095140.719297-1-bruce.richardson@intel.com>\n <20200821162944.29840-1-bruce.richardson@intel.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH v2 06/18] raw/ioat: add vdev probe for DSA/idxd\n\tdevices", "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 <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": "From: Kevin Laatz <kevin.laatz@intel.com>\n\nThe Intel DSA devices can be exposed to userspace via kernel driver, so can\nbe used without having to bind them to vfio/uio. Therefore we add support\nfor using those kernel-configured devices as vdevs, taking as parameter the\nindividual HW work queue to be used by the vdev.\n\nSigned-off-by: Kevin Laatz <kevin.laatz@intel.com>\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n doc/guides/rawdevs/ioat.rst | 68 +++++++++++++++++--\n drivers/raw/ioat/idxd_vdev.c | 123 +++++++++++++++++++++++++++++++++++\n drivers/raw/ioat/meson.build | 6 +-\n 3 files changed, 192 insertions(+), 5 deletions(-)\n create mode 100644 drivers/raw/ioat/idxd_vdev.c", "diff": "diff --git a/doc/guides/rawdevs/ioat.rst b/doc/guides/rawdevs/ioat.rst\nindex b83cf0f7db..43a69ec4c6 100644\n--- a/doc/guides/rawdevs/ioat.rst\n+++ b/doc/guides/rawdevs/ioat.rst\n@@ -37,9 +37,62 @@ No additional compilation steps are necessary.\n Device Setup\n -------------\n \n+Depending on support provided by the PMD, HW devices can either use the kernel configured driver\n+or be bound to a user-space IO driver for use.\n+For example, Intel\\ |reg| DSA devices can use the IDXD kernel driver or DPDK-supported drivers,\n+such as ``vfio-pci``.\n+\n+Intel\\ |reg| DSA devices using idxd kernel driver\n+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n+\n+To use a Intel\\ |reg| DSA device bound to the IDXD kernel driver, the device must first be configured.\n+The `accel-config <https://github.com/intel/idxd-config>`_ utility library can be used for configuration.\n+\n+.. note::\n+ The device configuration can also be done by directly interacting with the sysfs nodes.\n+\n+There are some mandatory configuration steps before being able to use a device with an application.\n+The internal engines, which do the copies or other operations,\n+and the work-queues, which are used by applications to assign work to the device,\n+need to be assigned to groups, and the various other configuration options,\n+such as priority or queue depth, need to be set for each queue.\n+\n+To assign an engine to a group::\n+\n+ $ accel-config config-engine dsa0/engine0.0 --group-id=0\n+ $ accel-config config-engine dsa0/engine0.1 --group-id=1\n+\n+To assign work queues to groups for passing descriptors to the engines a similar accel-config command can be used.\n+However, the work queues also need to be configured depending on the use-case.\n+Some configuration options include:\n+\n+* mode (Dedicated/Shared): Indicates whether a WQ may accept jobs from multiple queues simultaneously.\n+* priority: WQ priority between 1 and 15. Larger value means higher priority.\n+* wq-size: the size of the WQ. Sum of all WQ sizes must be less that the total-size defined by the device.\n+* type: WQ type (kernel/mdev/user). Determines how the device is presented.\n+* name: identifier given to the WQ.\n+\n+Example configuration for a work queue::\n+\n+ $ accel-config config-wq dsa0/wq0.0 --group-id=0 \\\n+ --mode=dedicated --priority=10 --wq-size=8 \\\n+ --type=user --name=app1\n+\n+Once the devices have been configured, they need to be enabled::\n+\n+ $ accel-config enable-device dsa0\n+ $ accel-config enable-wq dsa0/wq0.0\n+\n+Check the device configuration::\n+\n+ $ accel-config list\n+\n+Devices using VFIO/UIO drivers\n+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n+\n The HW devices to be used will need to be bound to a user-space IO driver for use.\n The ``dpdk-devbind.py`` script can be used to view the state of the devices\n-and to bind them to a suitable DPDK-supported kernel driver, such as ``vfio-pci``.\n+and to bind them to a suitable DPDK-supported driver, such as ``vfio-pci``.\n For example::\n \n \t$ dpdk-devbind.py -b vfio-pci 00:04.0 00:04.1\n@@ -47,9 +100,16 @@ For example::\n Device Probing and Initialization\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n \n-Once bound to a suitable kernel device driver, the HW devices will be found\n-as part of the PCI scan done at application initialization time. No vdev\n-parameters need to be passed to create or initialize the device.\n+For devices bound to a suitable DPDK-supported VFIO/UIO driver, the HW devices will\n+be found as part of the device scan done at application initialization time without\n+the need to pass parameters to the application.\n+\n+If the device is bound to the IDXD kernel driver (and previously configured with sysfs),\n+then a specific work queue needs to be passed to the application via a vdev parameter.\n+This vdev parameter take the driver name and work queue name as parameters.\n+For example, to use work queue 0 on Intel\\ |reg| DSA instance 0::\n+\n+ $ dpdk-test --no-pci --vdev=rawdev_idxd,wq=0.0\n \n Once probed successfully, the device will appear as a ``rawdev``, that is a\n \"raw device type\" inside DPDK, and can be accessed using APIs from the\ndiff --git a/drivers/raw/ioat/idxd_vdev.c b/drivers/raw/ioat/idxd_vdev.c\nnew file mode 100644\nindex 0000000000..0509fc0842\n--- /dev/null\n+++ b/drivers/raw/ioat/idxd_vdev.c\n@@ -0,0 +1,123 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2020 Intel Corporation\n+ */\n+\n+#include <rte_bus_vdev.h>\n+#include <rte_kvargs.h>\n+#include <rte_string_fns.h>\n+#include <rte_rawdev_pmd.h>\n+\n+#include \"ioat_private.h\"\n+\n+/** Name of the device driver */\n+#define IDXD_PMD_RAWDEV_NAME rawdev_idxd\n+/* takes a work queue(WQ) as parameter */\n+#define IDXD_ARG_WQ\t\t\"wq\"\n+\n+static const char * const valid_args[] = {\n+\tIDXD_ARG_WQ,\n+\tNULL\n+};\n+\n+struct idxd_vdev_args {\n+\tuint8_t device_id;\n+\tuint8_t wq_id;\n+};\n+\n+static int\n+idxd_rawdev_parse_wq(const char *key __rte_unused, const char *value,\n+\t\t\t void *extra_args)\n+{\n+\tstruct idxd_vdev_args *args = (struct idxd_vdev_args *)extra_args;\n+\tint dev, wq, bytes = -1;\n+\tint read = sscanf(value, \"%d.%d%n\", &dev, &wq, &bytes);\n+\n+\tif (read != 2 || bytes != (int)strlen(value)) {\n+\t\tIOAT_PMD_ERR(\"Error parsing work-queue id. Must be in <dev_id>.<queue_id> format\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (dev >= UINT8_MAX || wq >= UINT8_MAX) {\n+\t\tIOAT_PMD_ERR(\"Device or work queue id out of range\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\targs->device_id = dev;\n+\targs->wq_id = wq;\n+\n+\treturn 0;\n+}\n+\n+static int\n+idxd_vdev_parse_params(struct rte_kvargs *kvlist, struct idxd_vdev_args *args)\n+{\n+\tif (rte_kvargs_count(kvlist, IDXD_ARG_WQ) == 1) {\n+\t\tif (rte_kvargs_process(kvlist, IDXD_ARG_WQ,\n+\t\t\t\t&idxd_rawdev_parse_wq, args) < 0) {\n+\t\t\tIOAT_PMD_ERR(\"Error parsing %s\", IDXD_ARG_WQ);\n+\t\t\tgoto free;\n+\t\t}\n+\t} else {\n+\t\tIOAT_PMD_ERR(\"%s is a mandatory arg\", IDXD_ARG_WQ);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn 0;\n+\n+free:\n+\tif (kvlist)\n+\t\trte_kvargs_free(kvlist);\n+\treturn -EINVAL;\n+}\n+\n+static int\n+idxd_rawdev_probe_vdev(struct rte_vdev_device *vdev)\n+{\n+\tstruct rte_kvargs *kvlist;\n+\tstruct idxd_vdev_args vdev_args;\n+\tconst char *name;\n+\tint ret = 0;\n+\n+\tname = rte_vdev_device_name(vdev);\n+\tif (name == NULL)\n+\t\treturn -EINVAL;\n+\n+\tIOAT_PMD_INFO(\"Initializing pmd_idxd for %s\", name);\n+\n+\tkvlist = rte_kvargs_parse(rte_vdev_device_args(vdev), valid_args);\n+\tif (kvlist == NULL) {\n+\t\tIOAT_PMD_ERR(\"Invalid kvargs key\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tret = idxd_vdev_parse_params(kvlist, &vdev_args);\n+\tif (ret) {\n+\t\tIOAT_PMD_ERR(\"Failed to parse kvargs\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n+idxd_rawdev_remove_vdev(struct rte_vdev_device *vdev)\n+{\n+\tconst char *name;\n+\n+\tname = rte_vdev_device_name(vdev);\n+\tif (name == NULL)\n+\t\treturn -EINVAL;\n+\n+\tIOAT_PMD_INFO(\"Remove DSA vdev %p\", name);\n+\n+\treturn 0;\n+}\n+\n+struct rte_vdev_driver idxd_rawdev_drv_vdev = {\n+\t.probe = idxd_rawdev_probe_vdev,\n+\t.remove = idxd_rawdev_remove_vdev,\n+};\n+\n+RTE_PMD_REGISTER_VDEV(IDXD_PMD_RAWDEV_NAME, idxd_rawdev_drv_vdev);\n+RTE_PMD_REGISTER_PARAM_STRING(IDXD_PMD_RAWDEV_NAME,\n+\t\t\t \"wq=<string>\");\ndiff --git a/drivers/raw/ioat/meson.build b/drivers/raw/ioat/meson.build\nindex 3529635e9c..b343b7367b 100644\n--- a/drivers/raw/ioat/meson.build\n+++ b/drivers/raw/ioat/meson.build\n@@ -5,9 +5,13 @@ build = dpdk_conf.has('RTE_ARCH_X86')\n reason = 'only supported on x86'\n sources = files(\n \t'idxd_pci.c',\n+\t'idxd_vdev.c',\n \t'ioat_rawdev.c',\n \t'ioat_rawdev_test.c')\n-deps += ['rawdev', 'bus_pci', 'mbuf']\n+deps += ['bus_pci',\n+\t'bus_vdev',\n+\t'mbuf',\n+\t'rawdev']\n \n install_headers('rte_ioat_rawdev.h',\n \t\t'rte_ioat_rawdev_fns.h')\n", "prefixes": [ "v2", "06/18" ] }{ "id": 75831, "url": "