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 BFC77A0507; Thu, 31 Mar 2022 16:57:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 97067410FA; Thu, 31 Mar 2022 16:57:57 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 822DF4014F for ; Thu, 31 Mar 2022 16:57: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=1648738675; x=1680274675; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=B0SUFHpZk3cpQPl6OYNqVX5/2LpFOatavPKn4fX/zR0=; b=KyzCNrZFMILQeeHfLis9H8pT/9wPiO0X9NAjxDP0dsq7L+SrUv9ihXTL TDQZAyjbPVrdWE/S8Z+AQwdwgInJjT0jUVHWNCs3cGdtzfeMW5pJeos93 JIjDd3XOK46pKwm5W1+wq5k7DJfnDwPlYitEQvwj7CWMiuiZb8YB0SxID yKDOuOfRL6pOL3qTlEiLqS1zAStsJ9tdypfTn/m6Ej4XdEnCBAkeykDpv LTQEYSSJHupRvL3XwXdWthVDhNQD9bnIZSVrX7I+vvV/El5l7O37jLR9t 9RHDZvGT8/O6aBAGRdeH1qvYyIOqez6+f8JH2rdKpfiRE3YJobz3M92/S Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10302"; a="239782784" X-IronPort-AV: E=Sophos;i="5.90,225,1643702400"; d="scan'208";a="239782784" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2022 07:57:54 -0700 X-IronPort-AV: E=Sophos;i="5.90,225,1643702400"; d="scan'208";a="547366960" Received: from bricha3-mobl.ger.corp.intel.com ([10.55.133.67]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 31 Mar 2022 07:57:53 -0700 Date: Thu, 31 Mar 2022 15:57:50 +0100 From: Bruce Richardson To: Kevin Laatz Cc: dev@dpdk.org Subject: Re: [PATCH] dma/idxd: add generic option for queue config Message-ID: References: <20220330150700.435875-1-kevin.laatz@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220330150700.435875-1-kevin.laatz@intel.com> 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 On Wed, Mar 30, 2022 at 04:07:00PM +0100, Kevin Laatz wrote: > 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 | 29 ++++++++++++++++++++++++++--- > 1 file changed, 26 insertions(+), 3 deletions(-) > > diff --git a/drivers/dma/idxd/dpdk_idxd_cfg.py b/drivers/dma/idxd/dpdk_idxd_cfg.py > index 3f5d5ee752..9ac724e7a8 100755 > --- a/drivers/dma/idxd/dpdk_idxd_cfg.py > +++ b/drivers/dma/idxd/dpdk_idxd_cfg.py > @@ -62,9 +62,25 @@ def get_dsa_id(pci): > return int(dir[3:]) > sys.exit(f"Could not get device ID for device {pci}") > > - > -def configure_dsa(dsa_id, queues, prefix): > +def parse_wq_opts(dsa_id, q, wq_opts): > + "Parse the additional user-specified queue configuration" > + wq_dir = SysfsDir(f'/sys/bus/dsa/devices/dsa{dsa_id}/wq{dsa_id}.{q}') > + for wq_opt in wq_opts: > + try: > + opt, val = wq_opt.split("=") > + except ValueError: > + sys.exit("Invalid format, use format 'option=value'") > + if not os.path.exists(os.path.join(wq_dir.path, f'{opt}')): > + sys.exit(f"Invalid sysfs node '{opt}', path does not exist") > + wq_dir.write_values({opt: val}) > + > + > +def configure_dsa(dsa_id, args): > "Configure the DSA instance with appropriate number of queues" > + queues = args.q > + prefix = args.prefix > + wq_opts = args.wq_option > + > dsa_dir = SysfsDir(f"/sys/bus/dsa/devices/dsa{dsa_id}") > > max_groups = dsa_dir.read_int("max_groups") > @@ -92,6 +108,11 @@ def configure_dsa(dsa_id, queues, prefix): > "max_batch_size": 1024, > "size": int(max_work_queues_size / nb_queues)}) > > + # parse additional user-spcified queue configuration > + if wq_opts: > + for q in range(nb_queues): > + parse_wq_opts(dsa_id, q, wq_opts) > + I think this may be better to have the parse function only parse the options and split them. If that is done before the actual queue configuration function is called, then the additional options could be passed in there, and merged with the existing config settings. This avoids duplicating things and doing two sets of configs. /Bruce