raw/ioat: make workqueue name configurable in script
authorBruce Richardson <bruce.richardson@intel.com>
Tue, 4 May 2021 13:14:52 +0000 (14:14 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Tue, 4 May 2021 15:13:55 +0000 (17:13 +0200)
Add a "--name-prefix" parameter to the quick configuration script for
DSA. This allows the queues configured on a DSA instance to be made
available to only one DPDK process in a setup with multiple DPDK process
instances.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
drivers/raw/ioat/dpdk_idxd_cfg.py

index 56e4406..ff06d9e 100755 (executable)
@@ -29,7 +29,7 @@ class SysfsDir:
                 f.write(str(contents))
 
 
-def configure_dsa(dsa_id, queues):
+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")
@@ -54,7 +54,7 @@ def configure_dsa(dsa_id, queues):
         wq_dir.write_values({"group_id": q % nb_groups,
                              "type": "user",
                              "mode": "dedicated",
-                             "name": f"dpdk_wq{dsa_id}.{q}",
+                             "name": f"{prefix}_wq{dsa_id}.{q}",
                              "priority": 1,
                              "size": int(max_tokens / nb_queues)})
 
@@ -71,8 +71,11 @@ def main(args):
     arg_p.add_argument('dsa_id', type=int, help="DSA instance number")
     arg_p.add_argument('-q', metavar='queues', type=int, default=255,
                        help="Number of queues to set up")
+    arg_p.add_argument('--name-prefix', metavar='prefix', dest='prefix',
+                       default="dpdk",
+                       help="Prefix for workqueue name to mark for DPDK use [default: 'dpdk']")
     parsed_args = arg_p.parse_args(args[1:])
-    configure_dsa(parsed_args.dsa_id, parsed_args.q)
+    configure_dsa(parsed_args.dsa_id, parsed_args.q, parsed_args.prefix)
 
 
 if __name__ == "__main__":