Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/102209/?format=api
http://patches.dpdk.org/api/patches/102209/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20211019112540.1825132-15-kevin.laatz@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": "<20211019112540.1825132-15-kevin.laatz@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20211019112540.1825132-15-kevin.laatz@intel.com", "date": "2021-10-19T11:25:38", "name": "[v9,14/16] dma/idxd: move dpdk_idxd_cfg.py from raw to dma", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "c543d65cd34652e8c0145fe6de6fafdd17083c40", "submitter": { "id": 921, "url": "http://patches.dpdk.org/api/people/921/?format=api", "name": "Kevin Laatz", "email": "kevin.laatz@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/20211019112540.1825132-15-kevin.laatz@intel.com/mbox/", "series": [ { "id": 19786, "url": "http://patches.dpdk.org/api/series/19786/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=19786", "date": "2021-10-19T11:25:24", "name": "add dmadev driver for idxd devices", "version": 9, "mbox": "http://patches.dpdk.org/series/19786/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/102209/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/102209/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 693F9A0C43;\n\tTue, 19 Oct 2021 13:27:19 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id A6A03411A1;\n\tTue, 19 Oct 2021 13:26:15 +0200 (CEST)", "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n by mails.dpdk.org (Postfix) with ESMTP id 043BB41195\n for <dev@dpdk.org>; Tue, 19 Oct 2021 13:26:08 +0200 (CEST)", "from fmsmga007.fm.intel.com ([10.253.24.52])\n by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 19 Oct 2021 04:26:08 -0700", "from silpixa00401122.ir.intel.com ([10.55.128.10])\n by fmsmga007.fm.intel.com with ESMTP; 19 Oct 2021 04:26:06 -0700" ], "X-IronPort-AV": [ "E=McAfee;i=\"6200,9189,10141\"; a=\"228433243\"", "E=Sophos;i=\"5.85,384,1624345200\"; d=\"scan'208\";a=\"228433243\"", "E=Sophos;i=\"5.85,384,1624345200\"; d=\"scan'208\";a=\"490246519\"" ], "X-ExtLoop1": "1", "From": "Kevin Laatz <kevin.laatz@intel.com>", "To": "dev@dpdk.org", "Cc": "thomas@monjalon.net, bruce.richardson@intel.com, fengchengwen@huawei.com,\n jerinj@marvell.com, conor.walsh@intel.com,\n Kevin Laatz <kevin.laatz@intel.com>", "Date": "Tue, 19 Oct 2021 11:25:38 +0000", "Message-Id": "<20211019112540.1825132-15-kevin.laatz@intel.com>", "X-Mailer": "git-send-email 2.30.2", "In-Reply-To": "<20211019112540.1825132-1-kevin.laatz@intel.com>", "References": "<20210827172048.558704-1-kevin.laatz@intel.com>\n <20211019112540.1825132-1-kevin.laatz@intel.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH v9 14/16] dma/idxd: move dpdk_idxd_cfg.py from\n raw to dma", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "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: Conor Walsh <conor.walsh@intel.com>\n\nMove the example script for configuring IDXD devices bound to the IDXD\nkernel driver from raw to dma, and create a symlink to still allow use from\nraw.\n\nSigned-off-by: Conor Walsh <conor.walsh@intel.com>\nSigned-off-by: Kevin Laatz <kevin.laatz@intel.com>\nAcked-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n drivers/dma/idxd/dpdk_idxd_cfg.py | 117 +++++++++++++++++++++++++++++\n drivers/raw/ioat/dpdk_idxd_cfg.py | 118 +-----------------------------\n 2 files changed, 118 insertions(+), 117 deletions(-)\n create mode 100755 drivers/dma/idxd/dpdk_idxd_cfg.py\n mode change 100755 => 120000 drivers/raw/ioat/dpdk_idxd_cfg.py", "diff": "diff --git a/drivers/dma/idxd/dpdk_idxd_cfg.py b/drivers/dma/idxd/dpdk_idxd_cfg.py\nnew file mode 100755\nindex 0000000000..fcc27822ef\n--- /dev/null\n+++ b/drivers/dma/idxd/dpdk_idxd_cfg.py\n@@ -0,0 +1,117 @@\n+#!/usr/bin/env python3\n+# SPDX-License-Identifier: BSD-3-Clause\n+# Copyright(c) 2020 Intel Corporation\n+\n+\"\"\"\n+Configure an entire Intel DSA instance, using idxd kernel driver, for DPDK use\n+\"\"\"\n+\n+import sys\n+import argparse\n+import os\n+import os.path\n+\n+\n+class SysfsDir:\n+ \"Used to read/write paths in a sysfs directory\"\n+ def __init__(self, path):\n+ self.path = path\n+\n+ def read_int(self, filename):\n+ \"Return a value from sysfs file\"\n+ with open(os.path.join(self.path, filename)) as f:\n+ return int(f.readline())\n+\n+ def write_values(self, values):\n+ \"write dictionary, where key is filename and value is value to write\"\n+ for filename, contents in values.items():\n+ with open(os.path.join(self.path, filename), \"w\") as f:\n+ f.write(str(contents))\n+\n+\n+def reset_device(dsa_id):\n+ \"Reset the DSA device and all its queues\"\n+ drv_dir = SysfsDir(\"/sys/bus/dsa/drivers/dsa\")\n+ drv_dir.write_values({\"unbind\": f\"dsa{dsa_id}\"})\n+\n+\n+def get_pci_dir(pci):\n+ \"Search for the sysfs directory of the PCI device\"\n+ base_dir = '/sys/bus/pci/devices/'\n+ for path, dirs, files in os.walk(base_dir):\n+ for dir in dirs:\n+ if pci in dir:\n+ return os.path.join(base_dir, dir)\n+ sys.exit(f\"Could not find sysfs directory for device {pci}\")\n+\n+\n+def get_dsa_id(pci):\n+ \"Get the DSA instance ID using the PCI address of the device\"\n+ pci_dir = get_pci_dir(pci)\n+ for path, dirs, files in os.walk(pci_dir):\n+ for dir in dirs:\n+ if dir.startswith('dsa') and 'wq' not in dir:\n+ return int(dir[3:])\n+ sys.exit(f\"Could not get device ID for device {pci}\")\n+\n+\n+def configure_dsa(dsa_id, queues, prefix):\n+ \"Configure the DSA instance with appropriate number of queues\"\n+ dsa_dir = SysfsDir(f\"/sys/bus/dsa/devices/dsa{dsa_id}\")\n+ drv_dir = SysfsDir(\"/sys/bus/dsa/drivers/dsa\")\n+\n+ max_groups = dsa_dir.read_int(\"max_groups\")\n+ max_engines = dsa_dir.read_int(\"max_engines\")\n+ max_queues = dsa_dir.read_int(\"max_work_queues\")\n+ max_work_queues_size = dsa_dir.read_int(\"max_work_queues_size\")\n+\n+ nb_queues = min(queues, max_queues)\n+ if queues > nb_queues:\n+ print(f\"Setting number of queues to max supported value: {max_queues}\")\n+\n+ # we want one engine per group, and no more engines than queues\n+ nb_groups = min(max_engines, max_groups, nb_queues)\n+ for grp in range(nb_groups):\n+ dsa_dir.write_values({f\"engine{dsa_id}.{grp}/group_id\": grp})\n+\n+ # configure each queue\n+ for q in range(nb_queues):\n+ wq_dir = SysfsDir(os.path.join(dsa_dir.path, f\"wq{dsa_id}.{q}\"))\n+ wq_dir.write_values({\"group_id\": q % nb_groups,\n+ \"type\": \"user\",\n+ \"mode\": \"dedicated\",\n+ \"name\": f\"{prefix}_wq{dsa_id}.{q}\",\n+ \"priority\": 1,\n+ \"size\": int(max_work_queues_size / nb_queues)})\n+\n+ # enable device and then queues\n+ drv_dir.write_values({\"bind\": f\"dsa{dsa_id}\"})\n+ for q in range(nb_queues):\n+ drv_dir.write_values({\"bind\": f\"wq{dsa_id}.{q}\"})\n+\n+\n+def main(args):\n+ \"Main function, does arg parsing and calls config function\"\n+ arg_p = argparse.ArgumentParser(\n+ description=\"Configure whole DSA device instance for DPDK use\")\n+ arg_p.add_argument('dsa_id',\n+ help=\"Specify DSA instance either via DSA instance number or PCI address\")\n+ arg_p.add_argument('-q', metavar='queues', type=int, default=255,\n+ help=\"Number of queues to set up\")\n+ arg_p.add_argument('--name-prefix', metavar='prefix', dest='prefix',\n+ default=\"dpdk\",\n+ help=\"Prefix for workqueue name to mark for DPDK use [default: 'dpdk']\")\n+ arg_p.add_argument('--reset', action='store_true',\n+ help=\"Reset DSA device and its queues\")\n+ parsed_args = arg_p.parse_args(args[1:])\n+\n+ dsa_id = parsed_args.dsa_id\n+ dsa_id = get_dsa_id(dsa_id) if ':' in dsa_id else dsa_id\n+ if parsed_args.reset:\n+ reset_device(dsa_id)\n+ else:\n+ configure_dsa(dsa_id, parsed_args.q, parsed_args.prefix)\n+\n+\n+if __name__ == \"__main__\":\n+ main(sys.argv)\ndiff --git a/drivers/raw/ioat/dpdk_idxd_cfg.py b/drivers/raw/ioat/dpdk_idxd_cfg.py\ndeleted file mode 100755\nindex fcc27822ef..0000000000\n--- a/drivers/raw/ioat/dpdk_idxd_cfg.py\n+++ /dev/null\n@@ -1,117 +0,0 @@\n-#!/usr/bin/env python3\n-# SPDX-License-Identifier: BSD-3-Clause\n-# Copyright(c) 2020 Intel Corporation\n-\n-\"\"\"\n-Configure an entire Intel DSA instance, using idxd kernel driver, for DPDK use\n-\"\"\"\n-\n-import sys\n-import argparse\n-import os\n-import os.path\n-\n-\n-class SysfsDir:\n- \"Used to read/write paths in a sysfs directory\"\n- def __init__(self, path):\n- self.path = path\n-\n- def read_int(self, filename):\n- \"Return a value from sysfs file\"\n- with open(os.path.join(self.path, filename)) as f:\n- return int(f.readline())\n-\n- def write_values(self, values):\n- \"write dictionary, where key is filename and value is value to write\"\n- for filename, contents in values.items():\n- with open(os.path.join(self.path, filename), \"w\") as f:\n- f.write(str(contents))\n-\n-\n-def reset_device(dsa_id):\n- \"Reset the DSA device and all its queues\"\n- drv_dir = SysfsDir(\"/sys/bus/dsa/drivers/dsa\")\n- drv_dir.write_values({\"unbind\": f\"dsa{dsa_id}\"})\n-\n-\n-def get_pci_dir(pci):\n- \"Search for the sysfs directory of the PCI device\"\n- base_dir = '/sys/bus/pci/devices/'\n- for path, dirs, files in os.walk(base_dir):\n- for dir in dirs:\n- if pci in dir:\n- return os.path.join(base_dir, dir)\n- sys.exit(f\"Could not find sysfs directory for device {pci}\")\n-\n-\n-def get_dsa_id(pci):\n- \"Get the DSA instance ID using the PCI address of the device\"\n- pci_dir = get_pci_dir(pci)\n- for path, dirs, files in os.walk(pci_dir):\n- for dir in dirs:\n- if dir.startswith('dsa') and 'wq' not in dir:\n- return int(dir[3:])\n- sys.exit(f\"Could not get device ID for device {pci}\")\n-\n-\n-def configure_dsa(dsa_id, queues, prefix):\n- \"Configure the DSA instance with appropriate number of queues\"\n- dsa_dir = SysfsDir(f\"/sys/bus/dsa/devices/dsa{dsa_id}\")\n- drv_dir = SysfsDir(\"/sys/bus/dsa/drivers/dsa\")\n-\n- max_groups = dsa_dir.read_int(\"max_groups\")\n- max_engines = dsa_dir.read_int(\"max_engines\")\n- max_queues = dsa_dir.read_int(\"max_work_queues\")\n- max_work_queues_size = dsa_dir.read_int(\"max_work_queues_size\")\n-\n- nb_queues = min(queues, max_queues)\n- if queues > nb_queues:\n- print(f\"Setting number of queues to max supported value: {max_queues}\")\n-\n- # we want one engine per group, and no more engines than queues\n- nb_groups = min(max_engines, max_groups, nb_queues)\n- for grp in range(nb_groups):\n- dsa_dir.write_values({f\"engine{dsa_id}.{grp}/group_id\": grp})\n-\n- # configure each queue\n- for q in range(nb_queues):\n- wq_dir = SysfsDir(os.path.join(dsa_dir.path, f\"wq{dsa_id}.{q}\"))\n- wq_dir.write_values({\"group_id\": q % nb_groups,\n- \"type\": \"user\",\n- \"mode\": \"dedicated\",\n- \"name\": f\"{prefix}_wq{dsa_id}.{q}\",\n- \"priority\": 1,\n- \"size\": int(max_work_queues_size / nb_queues)})\n-\n- # enable device and then queues\n- drv_dir.write_values({\"bind\": f\"dsa{dsa_id}\"})\n- for q in range(nb_queues):\n- drv_dir.write_values({\"bind\": f\"wq{dsa_id}.{q}\"})\n-\n-\n-def main(args):\n- \"Main function, does arg parsing and calls config function\"\n- arg_p = argparse.ArgumentParser(\n- description=\"Configure whole DSA device instance for DPDK use\")\n- arg_p.add_argument('dsa_id',\n- help=\"Specify DSA instance either via DSA instance number or PCI address\")\n- arg_p.add_argument('-q', metavar='queues', type=int, default=255,\n- help=\"Number of queues to set up\")\n- arg_p.add_argument('--name-prefix', metavar='prefix', dest='prefix',\n- default=\"dpdk\",\n- help=\"Prefix for workqueue name to mark for DPDK use [default: 'dpdk']\")\n- arg_p.add_argument('--reset', action='store_true',\n- help=\"Reset DSA device and its queues\")\n- parsed_args = arg_p.parse_args(args[1:])\n-\n- dsa_id = parsed_args.dsa_id\n- dsa_id = get_dsa_id(dsa_id) if ':' in dsa_id else dsa_id\n- if parsed_args.reset:\n- reset_device(dsa_id)\n- else:\n- configure_dsa(dsa_id, parsed_args.q, parsed_args.prefix)\n-\n-\n-if __name__ == \"__main__\":\n- main(sys.argv)\ndiff --git a/drivers/raw/ioat/dpdk_idxd_cfg.py b/drivers/raw/ioat/dpdk_idxd_cfg.py\nnew file mode 120000\nindex 0000000000..85545548d1\n--- /dev/null\n+++ b/drivers/raw/ioat/dpdk_idxd_cfg.py\n@@ -0,0 +1 @@\n+../../dma/idxd/dpdk_idxd_cfg.py\n\\ No newline at end of file\n", "prefixes": [ "v9", "14/16" ] }{ "id": 102209, "url": "