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/'
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__":