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 <kevin.laatz@intel.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
This commit is contained in:
parent
1e5aade752
commit
1383fb672a
@ -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__":
|
||||
|
Loading…
Reference in New Issue
Block a user