raw/ioat: fix script for configuring small number of queues

The dpdk_idxd_cfg.py script included with the driver for convenience did
not work properly where the number of queues to be configured was
less than the number of groups or engines. This was because there would
be configured groups/engines not assigned to queues. Fix this by
limiting the engine and group counts to be no bigger than the number of
queues.

Fixes: 01863b9d2354 ("raw/ioat: include example configuration script")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
This commit is contained in:
Bruce Richardson 2021-05-04 14:14:51 +01:00 committed by Thomas Monjalon
parent a2bc5d7bcc
commit cfb286ab2b

View File

@ -39,15 +39,15 @@ def configure_dsa(dsa_id, queues):
max_queues = dsa_dir.read_int("max_work_queues")
max_tokens = dsa_dir.read_int("max_tokens")
# we want one engine per group
nb_groups = min(max_engines, max_groups)
for grp in range(nb_groups):
dsa_dir.write_values({f"engine{dsa_id}.{grp}/group_id": grp})
nb_queues = min(queues, max_queues)
if queues > nb_queues:
print(f"Setting number of queues to max supported value: {max_queues}")
# we want one engine per group, and no more engines than queues
nb_groups = min(max_engines, max_groups, nb_queues)
for grp in range(nb_groups):
dsa_dir.write_values({f"engine{dsa_id}.{grp}/group_id": grp})
# configure each queue
for q in range(nb_queues):
wq_dir = SysfsDir(os.path.join(dsa_dir.path, f"wq{dsa_id}.{q}"))