From 1383fb672a7b4a4c0b4c30a7b42b8d0f648d456d Mon Sep 17 00:00:00 2001 From: Kevin Laatz Date: Fri, 28 May 2021 14:55:59 +0100 Subject: [PATCH] raw/ioat: add device reset to configuration script 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 Acked-by: Bruce Richardson --- 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 @@ class SysfsDir: 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.20.1