Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/80016/?format=api
https://patches.dpdk.org/api/patches/80016/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20201008095133.123014-16-bruce.richardson@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": "<20201008095133.123014-16-bruce.richardson@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20201008095133.123014-16-bruce.richardson@intel.com", "date": "2020-10-08T09:51:23", "name": "[v6,15/25] raw/ioat: create rawdev instances for idxd vdevs", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "84eea1f31fa6c5c0c86a34f503beabbd954dea3b", "submitter": { "id": 20, "url": "https://patches.dpdk.org/api/people/20/?format=api", "name": "Bruce Richardson", "email": "bruce.richardson@intel.com" }, "delegate": { "id": 1, "url": "https://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20201008095133.123014-16-bruce.richardson@intel.com/mbox/", "series": [ { "id": 12773, "url": "https://patches.dpdk.org/api/series/12773/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=12773", "date": "2020-10-08T09:51:08", "name": "raw/ioat: enhancements and new hardware support", "version": 6, "mbox": "https://patches.dpdk.org/series/12773/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/80016/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/80016/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 1B2D0A04BC;\n\tThu, 8 Oct 2020 11:57:01 +0200 (CEST)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id A5C1F1BF46;\n\tThu, 8 Oct 2020 11:52:12 +0200 (CEST)", "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n by dpdk.org (Postfix) with ESMTP id 2DA4C1BF2C\n for <dev@dpdk.org>; Thu, 8 Oct 2020 11:52:10 +0200 (CEST)", "from orsmga008.jf.intel.com ([10.7.209.65])\n by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 08 Oct 2020 02:52:09 -0700", "from silpixa00399126.ir.intel.com ([10.237.222.4])\n by orsmga008.jf.intel.com with ESMTP; 08 Oct 2020 02:52:08 -0700" ], "IronPort-SDR": [ "\n BKHjG9wo5LazjBOTU0KSz/kXxfrmMPToTxXfGoYPmuql3c16fZ8xdb6JRERdZlDzRG/002MDAn\n TwGfFnU0TTCQ==", "\n 0FXNBbzKirmENOAVngQHdDbkuuJojjO3QOIgcdXZAfzKdhOifp8NgUpMlx6Uc2qmu3TjKlUHRF\n URPngMVDLYHg==" ], "X-IronPort-AV": [ "E=McAfee;i=\"6000,8403,9767\"; a=\"152226384\"", "E=Sophos;i=\"5.77,350,1596524400\"; d=\"scan'208\";a=\"152226384\"", "E=Sophos;i=\"5.77,350,1596524400\"; d=\"scan'208\";a=\"344686709\"" ], "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": "patrick.fu@intel.com, thomas@monjalon.net,\n Kevin Laatz <kevin.laatz@intel.com>,\n Bruce Richardson <bruce.richardson@intel.com>,\n Radu Nicolau <radu.nicolau@intel.com>", "Date": "Thu, 8 Oct 2020 10:51:23 +0100", "Message-Id": "<20201008095133.123014-16-bruce.richardson@intel.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20201008095133.123014-1-bruce.richardson@intel.com>", "References": "<20200721095140.719297-1-bruce.richardson@intel.com>\n <20201008095133.123014-1-bruce.richardson@intel.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH v6 15/25] raw/ioat: create rawdev instances for\n\tidxd vdevs", "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\nFor each vdev (DSA work queue) instance, create a rawdev instance.\n\nSigned-off-by: Kevin Laatz <kevin.laatz@intel.com>\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\nAcked-by: Radu Nicolau <radu.nicolau@intel.com>\n---\n drivers/raw/ioat/idxd_vdev.c | 106 +++++++++++++++++++++++++++++++-\n drivers/raw/ioat/ioat_private.h | 4 ++\n 2 files changed, 109 insertions(+), 1 deletion(-)", "diff": "diff --git a/drivers/raw/ioat/idxd_vdev.c b/drivers/raw/ioat/idxd_vdev.c\nindex 0509fc084..e61c26c1b 100644\n--- a/drivers/raw/ioat/idxd_vdev.c\n+++ b/drivers/raw/ioat/idxd_vdev.c\n@@ -2,6 +2,12 @@\n * Copyright(c) 2020 Intel Corporation\n */\n \n+#include <fcntl.h>\n+#include <unistd.h>\n+#include <limits.h>\n+#include <sys/mman.h>\n+\n+#include <rte_memzone.h>\n #include <rte_bus_vdev.h>\n #include <rte_kvargs.h>\n #include <rte_string_fns.h>\n@@ -24,6 +30,36 @@ struct idxd_vdev_args {\n \tuint8_t wq_id;\n };\n \n+static const struct rte_rawdev_ops idxd_vdev_ops = {\n+\t\t.dev_close = idxd_rawdev_close,\n+\t\t.dev_selftest = idxd_rawdev_test,\n+};\n+\n+static void *\n+idxd_vdev_mmap_wq(struct idxd_vdev_args *args)\n+{\n+\tvoid *addr;\n+\tchar path[PATH_MAX];\n+\tint fd;\n+\n+\tsnprintf(path, sizeof(path), \"/dev/dsa/wq%u.%u\",\n+\t\t\targs->device_id, args->wq_id);\n+\tfd = open(path, O_RDWR);\n+\tif (fd < 0) {\n+\t\tIOAT_PMD_ERR(\"Failed to open device path\");\n+\t\treturn NULL;\n+\t}\n+\n+\taddr = mmap(NULL, 0x1000, PROT_WRITE, MAP_SHARED, fd, 0);\n+\tclose(fd);\n+\tif (addr == MAP_FAILED) {\n+\t\tIOAT_PMD_ERR(\"Failed to mmap device\");\n+\t\treturn NULL;\n+\t}\n+\n+\treturn addr;\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@@ -70,10 +106,32 @@ idxd_vdev_parse_params(struct rte_kvargs *kvlist, struct idxd_vdev_args *args)\n \treturn -EINVAL;\n }\n \n+static int\n+idxd_vdev_get_max_batches(struct idxd_vdev_args *args)\n+{\n+\tchar sysfs_path[PATH_MAX];\n+\tFILE *f;\n+\tint ret;\n+\n+\tsnprintf(sysfs_path, sizeof(sysfs_path),\n+\t\t\t\"/sys/bus/dsa/devices/wq%u.%u/size\",\n+\t\t\targs->device_id, args->wq_id);\n+\tf = fopen(sysfs_path, \"r\");\n+\tif (f == NULL)\n+\t\treturn -1;\n+\n+\tif (fscanf(f, \"%d\", &ret) != 1)\n+\t\tret = -1;\n+\n+\tfclose(f);\n+\treturn ret;\n+}\n+\n static int\n idxd_rawdev_probe_vdev(struct rte_vdev_device *vdev)\n {\n \tstruct rte_kvargs *kvlist;\n+\tstruct idxd_rawdev idxd = {{0}}; /* double {} to avoid error on BSD12 */\n \tstruct idxd_vdev_args vdev_args;\n \tconst char *name;\n \tint ret = 0;\n@@ -96,13 +154,32 @@ idxd_rawdev_probe_vdev(struct rte_vdev_device *vdev)\n \t\treturn -EINVAL;\n \t}\n \n+\tidxd.qid = vdev_args.wq_id;\n+\tidxd.u.vdev.dsa_id = vdev_args.device_id;\n+\tidxd.max_batches = idxd_vdev_get_max_batches(&vdev_args);\n+\n+\tidxd.public.portal = idxd_vdev_mmap_wq(&vdev_args);\n+\tif (idxd.public.portal == NULL) {\n+\t\tIOAT_PMD_ERR(\"WQ mmap failed\");\n+\t\treturn -ENOENT;\n+\t}\n+\n+\tret = idxd_rawdev_create(name, &vdev->device, &idxd, &idxd_vdev_ops);\n+\tif (ret) {\n+\t\tIOAT_PMD_ERR(\"Failed to create rawdev %s\", name);\n+\t\treturn ret;\n+\t}\n+\n \treturn 0;\n }\n \n static int\n idxd_rawdev_remove_vdev(struct rte_vdev_device *vdev)\n {\n+\tstruct idxd_rawdev *idxd;\n \tconst char *name;\n+\tstruct rte_rawdev *rdev;\n+\tint ret = 0;\n \n \tname = rte_vdev_device_name(vdev);\n \tif (name == NULL)\n@@ -110,7 +187,34 @@ idxd_rawdev_remove_vdev(struct rte_vdev_device *vdev)\n \n \tIOAT_PMD_INFO(\"Remove DSA vdev %p\", name);\n \n-\treturn 0;\n+\trdev = rte_rawdev_pmd_get_named_dev(name);\n+\tif (!rdev) {\n+\t\tIOAT_PMD_ERR(\"Invalid device name (%s)\", name);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tidxd = rdev->dev_private;\n+\n+\t/* free context and memory */\n+\tif (rdev->dev_private != NULL) {\n+\t\tIOAT_PMD_DEBUG(\"Freeing device driver memory\");\n+\t\trdev->dev_private = NULL;\n+\n+\t\tif (munmap(idxd->public.portal, 0x1000) < 0) {\n+\t\t\tIOAT_PMD_ERR(\"Error unmapping portal\");\n+\t\t\tret = -errno;\n+\t\t}\n+\n+\t\trte_free(idxd->public.batch_ring);\n+\t\trte_free(idxd->public.hdl_ring);\n+\n+\t\trte_memzone_free(idxd->mz);\n+\t}\n+\n+\tif (rte_rawdev_pmd_release(rdev))\n+\t\tIOAT_PMD_ERR(\"Device cleanup failed\");\n+\n+\treturn ret;\n }\n \n struct rte_vdev_driver idxd_rawdev_drv_vdev = {\ndiff --git a/drivers/raw/ioat/ioat_private.h b/drivers/raw/ioat/ioat_private.h\nindex 53f00a9f3..6f7bdb499 100644\n--- a/drivers/raw/ioat/ioat_private.h\n+++ b/drivers/raw/ioat/ioat_private.h\n@@ -45,6 +45,10 @@ struct idxd_rawdev {\n \tuint16_t max_batches;\n \n \tunion {\n+\t\tstruct {\n+\t\t\tunsigned int dsa_id;\n+\t\t} vdev;\n+\n \t\tstruct idxd_pci_common *pci;\n \t} u;\n };\n", "prefixes": [ "v6", "15/25" ] }{ "id": 80016, "url": "