dma/idxd: fix paths to driver sysfs directory
Recent kernel changes[1][2] mean that we cannot guarantee that the paths
in sysfs used for creating/binding a DSA or workqueue instance will be
as given in the utility script, since they are now "compatibility-mode
only". Update script to support both new paths and compatibility ones.
[1] https://lore.kernel.org/all/162637445139.744545.6008938867943724701.stgit@djiang5-desk3.ch.intel.com/
[2] https://lore.kernel.org/all/162637468705.744545.4399080971745974435.stgit@djiang5-desk3.ch.intel.com/
Fixes: 01863b9d23
("raw/ioat: include example configuration script")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Kevin Laatz <kevin.laatz@intel.com>
This commit is contained in:
parent
a2b43447e9
commit
3277676319
@ -29,9 +29,17 @@ def write_values(self, values):
|
||||
f.write(str(contents))
|
||||
|
||||
|
||||
def get_drv_dir(dtype):
|
||||
"Get the sysfs path for the driver, either 'idxd' or 'user'"
|
||||
drv_dir = "/sys/bus/dsa/drivers/" + dtype
|
||||
if not os.path.exists(drv_dir):
|
||||
return "/sys/bus/dsa/drivers/dsa"
|
||||
return drv_dir
|
||||
|
||||
|
||||
def reset_device(dsa_id):
|
||||
"Reset the DSA device and all its queues"
|
||||
drv_dir = SysfsDir("/sys/bus/dsa/drivers/dsa")
|
||||
drv_dir = SysfsDir(get_drv_dir("idxd"))
|
||||
drv_dir.write_values({"unbind": f"dsa{dsa_id}"})
|
||||
|
||||
|
||||
@ -58,7 +66,6 @@ def get_dsa_id(pci):
|
||||
def configure_dsa(dsa_id, queues, prefix):
|
||||
"Configure the DSA instance with appropriate number of queues"
|
||||
dsa_dir = SysfsDir(f"/sys/bus/dsa/devices/dsa{dsa_id}")
|
||||
drv_dir = SysfsDir("/sys/bus/dsa/drivers/dsa")
|
||||
|
||||
max_groups = dsa_dir.read_int("max_groups")
|
||||
max_engines = dsa_dir.read_int("max_engines")
|
||||
@ -85,9 +92,12 @@ def configure_dsa(dsa_id, queues, prefix):
|
||||
"size": int(max_work_queues_size / nb_queues)})
|
||||
|
||||
# enable device and then queues
|
||||
drv_dir.write_values({"bind": f"dsa{dsa_id}"})
|
||||
idxd_dir = SysfsDir(get_drv_dir("idxd"))
|
||||
idxd_dir.write_values({"bind": f"dsa{dsa_id}"})
|
||||
|
||||
user_dir = SysfsDir(get_drv_dir("user"))
|
||||
for q in range(nb_queues):
|
||||
drv_dir.write_values({"bind": f"wq{dsa_id}.{q}"})
|
||||
user_dir.write_values({"bind": f"wq{dsa_id}.{q}"})
|
||||
|
||||
|
||||
def main(args):
|
||||
|
Loading…
Reference in New Issue
Block a user