All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Laatz <kevin.laatz@intel.com>
To: dev@dpdk.org
Cc: bruce.richardson@intel.com, Kevin Laatz <kevin.laatz@intel.com>
Subject: [dpdk-dev] [PATCH v3 2/2] raw/ioat: add device reset to python script
Date: Fri, 28 May 2021 14:55:59 +0100	[thread overview]
Message-ID: <20210528135559.344815-3-kevin.laatz@intel.com> (raw)
In-Reply-To: <20210528135559.344815-1-kevin.laatz@intel.com>

Currently once a device is configured, the user does not have the ability
to reset the device via the script.

This patch adds a device reset option to the script. For example
"$dpdk_idxd_cfg.py 0 --reset" would reset device 0.

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

---
v3: remove printing if the script running config or reset
---
 drivers/raw/ioat/dpdk_idxd_cfg.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/raw/ioat/dpdk_idxd_cfg.py b/drivers/raw/ioat/dpdk_idxd_cfg.py
index ad8393a645..83ef4817db 100755
--- a/drivers/raw/ioat/dpdk_idxd_cfg.py
+++ b/drivers/raw/ioat/dpdk_idxd_cfg.py
@@ -29,6 +29,12 @@ def write_values(self, values):
                 f.write(str(contents))
 
 
+def reset_device(dsa_id):
+    "Reset the DSA device and all its queues"
+    drv_dir = SysfsDir("/sys/bus/dsa/drivers/dsa")
+    drv_dir.write_values({"unbind": f"dsa{dsa_id}"})
+
+
 def get_pci_dir(pci):
     "Search for the sysfs directory of the PCI device"
     base_dir = '/sys/bus/pci/devices/'
@@ -95,11 +101,16 @@ def main(args):
     arg_p.add_argument('--name-prefix', metavar='prefix', dest='prefix',
                        default="dpdk",
                        help="Prefix for workqueue name to mark for DPDK use [default: 'dpdk']")
+    arg_p.add_argument('--reset', action='store_true',
+                       help="Reset DSA device and its queues")
     parsed_args = arg_p.parse_args(args[1:])
 
     dsa_id = parsed_args.dsa_id
     dsa_id = get_dsa_id(dsa_id) if ':' in dsa_id else dsa_id
-    configure_dsa(dsa_id, parsed_args.q, parsed_args.prefix)
+    if parsed_args.reset:
+        reset_device(dsa_id)
+    else:
+        configure_dsa(dsa_id, parsed_args.q, parsed_args.prefix)
 
 
 if __name__ == "__main__":
-- 
2.30.2


  parent reply	other threads:[~2021-05-28 13:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-27 13:26 [dpdk-dev] [PATCH] raw/ioat: extend python script functionality Kevin Laatz
2021-05-27 14:27 ` Bruce Richardson
2021-05-27 14:46   ` Laatz, Kevin
2021-05-28 13:19 ` [dpdk-dev] [PATCH v2 0/2] extend idxd config " Kevin Laatz
2021-05-28 13:19   ` [dpdk-dev] [PATCH v2 1/2] raw/ioat: add pci address handling to python script Kevin Laatz
2021-05-28 13:34     ` Bruce Richardson
2021-05-28 13:19   ` [dpdk-dev] [PATCH v2 2/2] raw/ioat: add device reset " Kevin Laatz
2021-05-28 13:37     ` Bruce Richardson
2021-05-28 13:55   ` [dpdk-dev] [PATCH v3 0/2] extend idxd config script functionality Kevin Laatz
2021-05-28 13:55     ` [dpdk-dev] [PATCH v3 1/2] raw/ioat: add pci address handling to python script Kevin Laatz
2021-05-28 13:55     ` Kevin Laatz [this message]
2021-06-17  7:32     ` [dpdk-dev] [PATCH v3 0/2] extend idxd config script functionality Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210528135559.344815-3-kevin.laatz@intel.com \
    --to=kevin.laatz@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.