From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B52ABA0507; Fri, 1 Apr 2022 12:34:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 54D0642911; Fri, 1 Apr 2022 12:34:57 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 374724067E for ; Fri, 1 Apr 2022 12:34:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648809295; x=1680345295; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XsgvgWnlgHPwosY2F9wODwTz8W8cco8PdIiDtUOGq/0=; b=M/VZcXOm6Jkb3Vv8Wn+Hk/eAoRi18BuUn+pddYbqICL95Xtapnz+ZJbE sYaV3VCPMMZvpJzxqYqw0eIs6R2J7CRoR6VnCvqmsV3fHhR8pq00nHqLS Bz+rKcC/34TInxTsWKpckiMSQSyetajGd6qeglI97XdmoS9WEwb6nBa0F BwWtIHhLYb/PgXgascgAzWbyzL3NdlSPe3JqzPOJiwSLzauFAxB6c6TeQ azvAYUvSl5xTA/y/0iwOqbRYl91ELOpnCTIwWBcOBrhJeogbELi44oTYX tinA5z1wMJ0h97zq9mOuoJVMsP8scXXp+MOMUlr9GmAlOx5Y9CkKM4m7r Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10303"; a="260088138" X-IronPort-AV: E=Sophos;i="5.90,227,1643702400"; d="scan'208";a="260088138" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Apr 2022 03:34:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,227,1643702400"; d="scan'208";a="504124319" Received: from silpixa00401122.ir.intel.com ([10.55.128.10]) by orsmga003.jf.intel.com with ESMTP; 01 Apr 2022 03:34:36 -0700 From: Kevin Laatz To: dev@dpdk.org Cc: bruce.richardson@intel.com, Kevin Laatz Subject: [PATCH v3] dma/idxd: add generic option for queue config Date: Fri, 1 Apr 2022 11:35:00 +0100 Message-Id: <20220401103500.697597-1-kevin.laatz@intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220331172112.575972-1-kevin.laatz@intel.com> References: <20220331172112.575972-1-kevin.laatz@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The device config script currently uses some defaults to configure devices in a generic way. With the addition of this option, users have more control over how queues are configured. Signed-off-by: Kevin Laatz --- drivers/dma/idxd/dpdk_idxd_cfg.py | 34 +++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/drivers/dma/idxd/dpdk_idxd_cfg.py b/drivers/dma/idxd/dpdk_idxd_cfg.py index 3f5d5ee752..77c473b240 100755 --- a/drivers/dma/idxd/dpdk_idxd_cfg.py +++ b/drivers/dma/idxd/dpdk_idxd_cfg.py @@ -63,7 +63,15 @@ def get_dsa_id(pci): sys.exit(f"Could not get device ID for device {pci}") -def configure_dsa(dsa_id, queues, prefix): +def parse_wq_opts(wq_opts): + "Parse user-specified queue configuration, creating a dict of options" + try: + return {o.split('=')[0]: o.split('=')[1] for o in wq_opts} + except ValueError: + sys.exit("Invalid --wq-option format, use format 'option=value'") + + +def configure_dsa(dsa_id, args): "Configure the DSA instance with appropriate number of queues" dsa_dir = SysfsDir(f"/sys/bus/dsa/devices/dsa{dsa_id}") @@ -72,8 +80,8 @@ def configure_dsa(dsa_id, queues, prefix): max_queues = dsa_dir.read_int("max_work_queues") max_work_queues_size = dsa_dir.read_int("max_work_queues_size") - nb_queues = min(queues, max_queues) - if queues > nb_queues: + nb_queues = min(args.q, max_queues) + if args.q > 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 @@ -83,14 +91,16 @@ def configure_dsa(dsa_id, queues, prefix): # configure each queue for q in range(nb_queues): + wqcfg = {"group_id": q % nb_groups, + "type": "user", + "mode": "dedicated", + "name": f"{args.prefix}_wq{dsa_id}.{q}", + "priority": 1, + "max_batch_size": 1024, + "size": int(max_work_queues_size / nb_queues)} + wqcfg.update(parse_wq_opts(args.wq_option)) wq_dir = SysfsDir(os.path.join(dsa_dir.path, f"wq{dsa_id}.{q}")) - wq_dir.write_values({"group_id": q % nb_groups, - "type": "user", - "mode": "dedicated", - "name": f"{prefix}_wq{dsa_id}.{q}", - "priority": 1, - "max_batch_size": 1024, - "size": int(max_work_queues_size / nb_queues)}) + wq_dir.write_values(wqcfg) # enable device and then queues idxd_dir = SysfsDir(get_drv_dir("idxd")) @@ -112,6 +122,8 @@ 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('--wq-option', action='append', + help="Provide additional config option for queues (format 'x=y')") arg_p.add_argument('--reset', action='store_true', help="Reset DSA device and its queues") parsed_args = arg_p.parse_args(args[1:]) @@ -121,7 +133,7 @@ def main(args): if parsed_args.reset: reset_device(dsa_id) else: - configure_dsa(dsa_id, parsed_args.q, parsed_args.prefix) + configure_dsa(dsa_id, parsed_args) if __name__ == "__main__": -- 2.31.1