Skip to content

Commit

Permalink
dma/idxd: fix paths to driver sysfs directory
Browse files Browse the repository at this point in the history
[ upstream commit 3277676 ]

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: 01863b9 ("raw/ioat: include example configuration script")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Kevin Laatz <kevin.laatz@intel.com>
  • Loading branch information
bruce-richardson authored and bluca committed Feb 14, 2022
1 parent 4548934 commit 0602aa0
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions drivers/raw/ioat/dpdk_idxd_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +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 configure_dsa(dsa_id, queues):
"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")
Expand All @@ -59,9 +66,12 @@ def configure_dsa(dsa_id, queues):
"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):
Expand Down

0 comments on commit 0602aa0

Please sign in to comment.