diff mbox series

[v3,2/2] raw/ioat: add device reset to python script

Message ID 20210528135559.344815-3-kevin.laatz@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers show
Series extend idxd config script functionality | expand


Context Check Description
ci/intel-Testing success Testing PASS
ci/iol-testing fail Testing issues
ci/iol-abi-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/github-robot success github build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional fail Functional Testing issues
ci/checkpatch success coding style OK

Commit Message

Kevin Laatz May 28, 2021, 1:55 p.m. UTC
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 mbox series


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):
+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',
                        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__":