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 D69E9A0546; Thu, 27 May 2021 16:46:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8ED7940150; Thu, 27 May 2021 16:46:29 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id A81BF40143 for ; Thu, 27 May 2021 16:46:27 +0200 (CEST) IronPort-SDR: 69JsJNxGZNJdvUmPkid76s2XdsUR2AoJIA8J8jAI7Myu4XkcFZEYBkoQhChR8f4b7fPgxxN7xK E/6HH11LIY8g== X-IronPort-AV: E=McAfee;i="6200,9189,9996"; a="182406611" X-IronPort-AV: E=Sophos;i="5.82,334,1613462400"; d="scan'208";a="182406611" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2021 07:46:26 -0700 IronPort-SDR: AHXejQyFFW21/NL+eGQHeV2HpOE/oUemigagl0Jwpl5T6NYtDa8QvvhyoyqtMyJ3dzdshutzGz TXi+6l6YNKHw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,334,1613462400"; d="scan'208";a="465407192" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by fmsmga004.fm.intel.com with ESMTP; 27 May 2021 07:46:26 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Thu, 27 May 2021 07:46:26 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4 via Frontend Transport; Thu, 27 May 2021 07:46:26 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.172) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.4; Thu, 27 May 2021 07:46:23 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ikGm6QVCEGGPNM5ZZUkbY84zAwFhP+nptX8FlhlH/mXVLiWoIH9/zDapabhxfee8n6ruZHd8FX+g8k7jx6hHglCJg3abTWCvWFQcbrCR1nbPouPKylnJtxtF1rNiehoz/97fDjNuXdBETdgkN+nUbYzXmEEp4/a2v3RpkfX7V0ZP25Vc10XYwwkfPZ6ODE8FHHO7jocSPZazV8POuJGRGxFOXTZHZTJnlvRGosxAcRpcFlm0feyigV0f6McxzS/7Ypgrg4/CUAaaeYkqn766TaUxgztIfiemf3fRYAqXuLnVueChKjR+kZ0Mn2ELWKH+d4bHPmDZFyIMX+yh3bX04A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/LCHsomYCGJQ9pHOln2hGim1OlojpbVF2vypSb89KBk=; b=TQnOlxCozaIGxvDANL34lp4NHKNkYX8zG3PDucL6SXiiIqc/8aBoVIgAdsoHYTJamwmwbv7EFI0rUYQ8A20hpYEVe6TMrsxnVNY+gY0OwMl/mojdo5su+ws0zpq18ZvDMZmam1+qIUzIE/DuhDPHrKZ3wHYjBbZt58gTKHnBNmLW/n14px7bK0haa5zfJEC8FH9Q5e/vT5CUqbO21CWunHl/rQLl0XYL9T0LZmPRbGJa2AUlE2tiSK+CzXh5X4vpPsJ6SCs0r8ilLI6V7ZRG2gvbBh85TlhUfE7ZL2X3nCiUPgQ3oHxh9q//vr5lToZxU6D++TmVsG9z8XcvvFPsUw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/LCHsomYCGJQ9pHOln2hGim1OlojpbVF2vypSb89KBk=; b=Qj+nKaXB71901YUpup1NbThWy+Q9vZW7adzYYOIbkKR+vvntYtDuQy7dRBEgfPHPSOFjVgY4XWDyQb4E3wKuXglCHI0/fvmIcULFLKQMO6Dhwtk6QFuq12ag7X+IKl5MsfBDSnZOTrYLSsEcfi8Q0QE0llMzOJmhaFISCxq4nzY= Received: from SJ0PR11MB5055.namprd11.prod.outlook.com (2603:10b6:a03:2d9::10) by BYAPR11MB3541.namprd11.prod.outlook.com (2603:10b6:a03:f5::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.27; Thu, 27 May 2021 14:46:19 +0000 Received: from SJ0PR11MB5055.namprd11.prod.outlook.com ([fe80::d4c0:1747:b7ba:6ffb]) by SJ0PR11MB5055.namprd11.prod.outlook.com ([fe80::d4c0:1747:b7ba:6ffb%5]) with mapi id 15.20.4173.022; Thu, 27 May 2021 14:46:19 +0000 From: "Laatz, Kevin" To: "Richardson, Bruce" CC: "dev@dpdk.org" Thread-Topic: [PATCH] raw/ioat: extend python script functionality Thread-Index: AQHXUv1GriDaRkP4UEO+UIiTjCjb5ar3Ys4AgAAEpSA= Date: Thu, 27 May 2021 14:46:18 +0000 Message-ID: References: <20210527132646.3565721-1-kevin.laatz@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.5.1.3 dlp-reaction: no-action dlp-product: dlpe-windows authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [51.37.57.124] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 702f5ac5-8780-4a35-87c9-08d9211e3034 x-ms-traffictypediagnostic: BYAPR11MB3541: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 3sXY46OszCo3gm04P4NoV5KDhHTjnV4wqjWQgawmH+D9MCsu62TfAFp0TG4uWZbGUPk5YXMYIHh9Sn2QjiRgPrGja22PCBqIRleDfFsnjdVtDxuta3ckKtxryX6MPQQiEUy0Tj5hqBtNgLbjERyl8rvLJTs0mwKqq2jeaxsN6o5LYeb1uyzQmQ++trPvlv+qTADCV3ztdHJKLwH2lj3VQjIrkH3Q/0yOH+1C0CKpfqSYny2pVhh6ASANX2z4QDDoh6VbpOVQQqbJZMlbuTQKq0jTILNOtdJRcGecadiKgK1JAN/pFA6/WK5NsyyVKRfpVba9HGlFZb+RU/BqfoC10K1Mhb7dQMXxYSYfx60sWWHssQQg0mdrLAVlqne5DYioVDid+f1iOyG3gZebQTxxkPKPsRrJav1R8DZc5/JtFqU0tDtISW8WtOidgYFkrFAGrQ3JPbNejSSOzbMsZNBuMCS/QvKVRrBIu7JCtAYt91ToyYmLGXAm4UGUTj9mnHNMQ59EDViRL2kLbSLBQLPjRPlXTodZ7+CI/HcPIRV8EktLbyz92idCIZRPRy3F0gYm2G150BGlpatQ23aqVb1I+OYfxzK+VLylPAEorFqg564= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR11MB5055.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(39860400002)(366004)(346002)(136003)(396003)(376002)(66946007)(66556008)(66476007)(66446008)(64756008)(186003)(8676002)(4326008)(38100700002)(9686003)(33656002)(76116006)(6862004)(6636002)(8936002)(71200400001)(52536014)(83380400001)(26005)(6506007)(7696005)(5660300002)(55016002)(478600001)(86362001)(2906002)(122000001)(316002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?lgnfekFrFcUwpbyvKXK+bVB4Ku1+G5VG12nigO1PBISdPYi4otSjlGNhZtNB?= =?us-ascii?Q?q89fy6/8joGE6IFmOGy9mQaI7pm8F1ENAUB93QajNlkr5U1EN16otTdy52u/?= =?us-ascii?Q?D2jq7zFwBfICmOqrjqISmlVlb83T71RoDoyPTWiRW+M6QRLdcyNMVnpA85pJ?= =?us-ascii?Q?NNRpkC08CbLbVGe7NecjvkoMraEQ4mXg55HRuFFhsScALHTJ7drFkH93OJO3?= =?us-ascii?Q?G4I0F8Q/txi3CtV9EcYf+Lqh2wIF1I2QSbg3ZqzmCOO9vAvuddi6F9GeWVWU?= =?us-ascii?Q?O2/Z129tg3buDUABXSrb6N8yQQ0/d1YzubU//XC928QF1o59faLaehwXpTp4?= =?us-ascii?Q?rraSJEGrLiaPw2QM6SWqEUaAreUIFCAS0eoy0Pp8NIEWTOd2uADCp+wfAz3C?= =?us-ascii?Q?h5ELfRnTrrqoGvk1AZTl1TYGOeHGUcQeO1r7wwTK954BlAqwoOt7ZlD8asDC?= =?us-ascii?Q?OAkGjxE9sKR1KKwiwTPQMnYB7Q75MT33kviKtJqMlHcT/eyVn4mD/yaxpd5I?= =?us-ascii?Q?wlVaa2Ts4WjXGtYIHpB0iyI13zYecU0nwRiCztvbQgmPg1JeJBSkFhvIfzAy?= =?us-ascii?Q?KLLNUyP0a3oVFe6l7Xk1kgDVCEr8GgRrTGTbFPMk0/w23X3GLvcsuC8beG5F?= =?us-ascii?Q?mSeG+3rJXow1AeKmm4B8HgCYNfjyGr0E9ZFPMwznil4NIGc6N/33nXdYNwvv?= =?us-ascii?Q?yP1ZD7BYXvy5hZYyHtN568qXISEadYDZrLoebT6HlvVYVJ+d/nDbfnIDgIDn?= =?us-ascii?Q?3LZe9X9qYS9LoN8CEh4eYoay/8olvmripsPMsstHLxZVrnG4XDwRp6V2gBZu?= =?us-ascii?Q?C6BqitCLKM3hSfmpF5MMkefMLlK0IQEsINi5Te1ASNz1SXR9DAWO//AeZsaW?= =?us-ascii?Q?wXSgGI/nlskFgapKFnfOLDmWTg+VJ9V3M1zZtF62lgWexZHC6O3ZJeGJE1PR?= =?us-ascii?Q?wxPF5gVriQTw+Np9GSeqNw1woz65AwetivaH7UvCfr0GgDddgwaDGQjkgkg9?= =?us-ascii?Q?MqpgH4SiF/ofOEyL9sf2TqBjNca1v/EF/fTRaUDy/UIYo51/US+UN9//C3Dr?= =?us-ascii?Q?e7pJM6NCtOpMyMpGaiowZqyZUtWGbObkAEt5YUccNcmXtkdPMHAVJoX6QvPd?= =?us-ascii?Q?XYziwJY2trZ1H8Q9FZBzDxSyZ7KkT+YOAMNBzqREKqqxKbKbzhmoWaqmZ205?= =?us-ascii?Q?ctz3GY0MI2WdGFYQJVDAVuWwmW0aZIz1kKVCMvxpTX9dEPYMiNMVz50guH0r?= =?us-ascii?Q?pZI3IFXP07kHcLexP9C8oBGZ8EkcT5DyZbbuhioWXVRNGS7HhaJzLNYOfIjp?= =?us-ascii?Q?rIuVjv1IpaK94YVaqW8qU57R?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB5055.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 702f5ac5-8780-4a35-87c9-08d9211e3034 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 May 2021 14:46:18.7814 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: d0kKWukpFHcQ3vjNFWxe248miestx8dGMAg8xDD/St5JA4R1pr1lFnHaIe4KgyNve6kkd7Mlms+y+0VzYh4G+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3541 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH] raw/ioat: extend python script functionality 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 Sender: "dev" <...> > Hi Kevin, >=20 > since you list out two changes here, it's a good indication that this mig= ht > be better as two separate patches. Can you please split it, thanks. >=20 > Couple of minor comments inline below too. >=20 > Regards, > /Bruce > Thanks for the feedback, Bruce. I'll split the changes as suggested and wil= l address the comments below for v2. -Kevin =20 > > diff --git a/drivers/raw/ioat/dpdk_idxd_cfg.py > b/drivers/raw/ioat/dpdk_idxd_cfg.py > > index ff06d9e240..7bc33b6ddb 100755 > > --- a/drivers/raw/ioat/dpdk_idxd_cfg.py > > +++ b/drivers/raw/ioat/dpdk_idxd_cfg.py > > @@ -29,6 +29,29 @@ def write_values(self, values): > > f.write(str(contents)) > > > > > > +def reset_device(dsa_id): > > + "Reset the DSA device and all its queues" > > + drv_dir =3D SysfsDir("/sys/bus/dsa/drivers/dsa") > > + drv_dir.write_values({"unbind": f"dsa{dsa_id}"}) > > + > > + > > +def get_pci_dir(pci): > > + "Search for the sysfs directory of the PCI device" > > + full_pci =3D pci if pci.startswith("0000:") else f"0000:{pci}" >=20 > This will limit the script to only working on domains starting with 0000. > While I'm not aware of any specific cases where this won't work, for > generality sake, can we detect the presence/absense of the 0000: in some > other way, e.g. length, or count of ":" characters? >=20 > > + if os.path.exists(f'/sys/bus/pci/devices/{full_pci}'): > > + return f'/sys/bus/pci/devices/{full_pci}' > > + return None > > + > > + > > +def get_dsa_id(pci): > > + "Get the DSA instance ID using the PCI address of the device" > > + pci_dir =3D get_pci_dir(pci) > > + for path, dirs, files in os.walk(pci_dir): >=20 > What happens if pci_dir is None? >=20 > > + for dir in dirs: > > + if dir.startswith('dsa') and 'wq' not in dir: > > + return int(dir[3:]) > > + > > + > > def configure_dsa(dsa_id, queues, prefix): > > "Configure the DSA instance with appropriate number of queues" > > dsa_dir =3D SysfsDir(f"/sys/bus/dsa/devices/dsa{dsa_id}") > > @@ -68,14 +91,25 @@ def main(args): > > "Main function, does arg parsing and calls config function" > > arg_p =3D argparse.ArgumentParser( > > description=3D"Configure whole DSA device instance for DPDK us= e") > > - arg_p.add_argument('dsa_id', type=3Dint, help=3D"DSA instance numb= er") > > + arg_p.add_argument('dsa_id', > > + help=3D"Specify DSA instance either via DSA ins= tance number or > PCI address") > > arg_p.add_argument('-q', metavar=3D'queues', type=3Dint, default= =3D255, > > help=3D"Number of queues to set up") > > arg_p.add_argument('--name-prefix', metavar=3D'prefix', dest=3D'pr= efix', > > default=3D"dpdk", > > help=3D"Prefix for workqueue name to mark for D= PDK use > [default: 'dpdk']") > > + arg_p.add_argument('--reset', action=3D'store_true', > > + help=3D"Reset DSA device and its queues") > > parsed_args =3D arg_p.parse_args(args[1:]) > > - configure_dsa(parsed_args.dsa_id, parsed_args.q, parsed_args.prefi= x) > > + > > + dsa_id =3D parsed_args.dsa_id > > + dsa_id =3D get_dsa_id(dsa_id) if ':' in dsa_id else dsa_id > > + if parsed_args.reset: > > + print(f"Resetting DSA instance {dsa_id}") > > + reset_device(dsa_id) > > + else: > > + print(f"Configuring DSA instance {dsa_id}") > > + configure_dsa(dsa_id, parsed_args.q, parsed_args.prefix) > > > > > > if __name__ =3D=3D "__main__": > > -- > > 2.30.2 > >