Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/78821/?format=api
http://patchwork.dpdk.org/api/patches/78821/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20200925110910.284098-16-bruce.richardson@intel.com/", "project": { "id": 1, "url": "http://patchwork.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": "<20200925110910.284098-16-bruce.richardson@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20200925110910.284098-16-bruce.richardson@intel.com", "date": "2020-09-25T11:09:00", "name": "[v3,15/25] raw/ioat: create rawdev instances for idxd vdevs", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "a9ff0fff4d4f0ea80ad1931b11d3069e8773af15", "submitter": { "id": 20, "url": "http://patchwork.dpdk.org/api/people/20/?format=api", "name": "Bruce Richardson", "email": "bruce.richardson@intel.com" }, "delegate": { "id": 1, "url": "http://patchwork.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20200925110910.284098-16-bruce.richardson@intel.com/mbox/", "series": [ { "id": 12509, "url": "http://patchwork.dpdk.org/api/series/12509/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=12509", "date": "2020-09-25T11:08:45", "name": "raw/ioat: enhancements and new hardware support", "version": 3, "mbox": "http://patchwork.dpdk.org/series/12509/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/78821/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/78821/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 2CE70A04C0;\n\tFri, 25 Sep 2020 13:12:25 +0200 (CEST)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id D3B5D1E951;\n\tFri, 25 Sep 2020 13:10:22 +0200 (CEST)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n by dpdk.org (Postfix) with ESMTP id 1E4071E8C3\n for <dev@dpdk.org>; Fri, 25 Sep 2020 13:10:18 +0200 (CEST)", "from orsmga004.jf.intel.com ([10.7.209.38])\n by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 25 Sep 2020 04:10:18 -0700", "from unknown (HELO silpixa00399126.ir.intel.com) ([10.237.222.4])\n by orsmga004.jf.intel.com with ESMTP; 25 Sep 2020 04:10:17 -0700" ], "IronPort-SDR": [ "\n A1qge9BvneUQ4ZNf20zbPNHY/f4IXEwydIS7BiXWnQOFw6+w04kkDXqBc4tngDcSVe0poKYLKq\n PKkYOUGXvtuw==", "\n /jD4Ta2zeg09x3H+y4guKQeipQWIeXsZ7y8C21BewIw+60VD03dv+EbLhROrufhUXSOhnq6TFB\n BO449TokO4zw==" ], "X-IronPort-AV": [ "E=McAfee;i=\"6000,8403,9754\"; a=\"160760147\"", "E=Sophos;i=\"5.77,301,1596524400\"; d=\"scan'208\";a=\"160760147\"", "E=Sophos;i=\"5.77,301,1596524400\"; d=\"scan'208\";a=\"455788013\"" ], "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, Kevin Laatz <kevin.laatz@intel.com>,\n Bruce Richardson <bruce.richardson@intel.com>", "Date": "Fri, 25 Sep 2020 12:09:00 +0100", "Message-Id": "<20200925110910.284098-16-bruce.richardson@intel.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20200925110910.284098-1-bruce.richardson@intel.com>", "References": "<20200721095140.719297-1-bruce.richardson@intel.com>\n <20200925110910.284098-1-bruce.richardson@intel.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH v3 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>\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..d2d588916 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 | MAP_POPULATE, 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};\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": [ "v3", "15/25" ] }{ "id": 78821, "url": "