From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from g2t2354.austin.hpe.com (g2t2354.austin.hpe.com [15.233.44.27]) by dpdk.org (Postfix) with ESMTP id 8605D1B6B7; Fri, 3 Nov 2017 20:42:49 +0100 (CET) Received: from G9W8455.americas.hpqcorp.net (g9w8455.houston.hp.com [16.216.161.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g2t2354.austin.hpe.com (Postfix) with ESMTPS id 41ECD83; Fri, 3 Nov 2017 19:42:48 +0000 (UTC) Received: from G9W8453.americas.hpqcorp.net (2002:10d8:a0d3::10d8:a0d3) by G9W8455.americas.hpqcorp.net (2002:10d8:a15e::10d8:a15e) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Fri, 3 Nov 2017 19:42:48 +0000 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (15.241.52.10) by G9W8453.americas.hpqcorp.net (16.216.160.211) with Microsoft SMTP Server (TLS) id 15.0.1178.4 via Frontend Transport; Fri, 3 Nov 2017 19:42:48 +0000 Received: from TU4PR8401MB0687.NAMPRD84.PROD.OUTLOOK.COM (10.169.45.12) by TU4PR8401MB0687.NAMPRD84.PROD.OUTLOOK.COM (10.169.45.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.197.13; Fri, 3 Nov 2017 19:42:46 +0000 Received: from TU4PR8401MB0687.NAMPRD84.PROD.OUTLOOK.COM ([fe80::7942:315e:3e4a:d4e8]) by TU4PR8401MB0687.NAMPRD84.PROD.OUTLOOK.COM ([fe80::7942:315e:3e4a:d4e8%13]) with mapi id 15.20.0197.017; Fri, 3 Nov 2017 19:42:46 +0000 From: "Roberts, Lee A." To: "Tan, Jianfeng" , Ferruh Yigit , Thomas Monjalon CC: "dev@dpdk.org" , "stable@dpdk.org" , Jingjing Wu , Shijith Thotton , Gregory Etelson , Harish Patil , George Prekas , Sergio Gonzalez Monroy , Rasesh Mody Thread-Topic: [dpdk-dev] [PATCH v2] igb_uio: add config option to control reset Thread-Index: AQHTVE+D/91aOMvv1U6frovcDksqeqMDCTFw Date: Fri, 3 Nov 2017 19:42:45 +0000 Message-ID: References: <20171103003005.44339-1-ferruh.yigit@intel.com> <20171103005100.44633-1-ferruh.yigit@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=lee.roberts@hpe.com; x-originating-ip: [15.203.227.13] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; TU4PR8401MB0687; 6:fgpj1Ra9T5btSXaCM6hS/gI/6OLz16M1rmCa5FKvQOY9QHGOpL3al6nvpiNw/EiQPeSCwhbE6+79jBaMj+H4Dx2yTLg3IHUJYhUOSiVxoT0z4lVi3uBLk4uPCGgd2tDfa4oSuLV9FQZhSmEqQ4m9lvDf2O/szbJB6Yq3+x5cAhSPWDnp1v+16cFXWIVJN1D+2OJ0eMU/et3KKAHXlC2x8Obs9fvbpveHRQ8kr1lw9+gn7fZmONRGq9wM4LOJpb/trbYkQGtaKaYV0Cd/C5gvbyCvz++kCrm37l+XnhdTsWgI9xUkO1qCYWZBlGSS7UIK1d8rplYZVZKXkL663GY0cs81EQQ5otgJUGDePqVTz9s=; 5:aAtWZEl7PBC9EkF+xrECr6vH1eZ9L7fCEgk5/4iAsSqLIsceLDewrdaa8h/o3s7TcoIy6gPwsUgzoPQQPgsMax5rgkoOwXCS3+jywCKQQMLfZWJVAMZMmyYQWyMFv2/y7s9/pHz3DjDcwX0r4BB7kcuB/HwQFcjKNCQIVRrw5LY=; 24:4hrDTfyXQhF/G0rj9Xqsqznw7EN1rxtFsm7ouEHuOUJBuXy25m6Ae4GVv2FHSleetsS3AG/26+szPSbjGZOX+ZaQBxJYa18u7U6QU6O7ZeM=; 7:vsH1oWOVd+n4c+zkl4os6EVbJ//+epnlgB7bj6NbMuVgDUsSI1FnqoOe2NPGq/RfBwH+4su0fgAICQrOl75LcJTwsAHfoKcncnUck906DR2VueKg5ejcg8Gj8PG8Jr63Y76gjTbYFcA75SNj8UPh1Htk3C+U3JqHdtXMnwM2ddcoCLKSd6xEzQrsbDhTh7fcF7NwbiEhR47BKGZ6IrVPdvxa6m6VvAlioJGOKdnquNycdyKfeecfVRuVK7tVQUSb x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: d3ac67ad-b222-4be9-2206-08d522f30e9f x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(2017052603199); SRVR:TU4PR8401MB0687; x-ms-traffictypediagnostic: TU4PR8401MB0687: x-exchange-antispam-report-test: UriScan:(58145275503218)(228905959029699); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(93006095)(93001095)(100000703101)(100105400095)(3002001)(3231021)(10201501046)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123562025)(20161123564025)(20161123555025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:TU4PR8401MB0687; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:TU4PR8401MB0687; x-forefront-prvs: 0480A51D4A x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(376002)(346002)(39860400002)(13464003)(199003)(189002)(24454002)(81166006)(54906003)(81156014)(25786009)(3280700002)(110136005)(8936002)(86362001)(68736007)(2900100001)(3660700001)(66066001)(53376002)(5250100002)(99286004)(6436002)(229853002)(6506006)(2906002)(97736004)(4326008)(53936002)(6246003)(305945005)(50986999)(55016002)(101416001)(966005)(33656002)(478600001)(316002)(54356999)(7736002)(74316002)(189998001)(14454004)(7416002)(5660300001)(2950100002)(6116002)(106356001)(9686003)(102836003)(6306002)(76176999)(53546010)(3846002)(105586002)(7696004); DIR:OUT; SFP:1102; SCL:1; SRVR:TU4PR8401MB0687; H:TU4PR8401MB0687.NAMPRD84.PROD.OUTLOOK.COM; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: hpe.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: d3ac67ad-b222-4be9-2206-08d522f30e9f X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Nov 2017 19:42:45.9406 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: TU4PR8401MB0687 X-OriginatorOrg: hpe.com Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH v2] igb_uio: add config option to control reset X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Nov 2017 19:42:49 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Tan, Jianfeng > Sent: Thursday, November 02, 2017 8:57 PM > To: Ferruh Yigit ; Thomas Monjalon > Cc: dev@dpdk.org; stable@dpdk.org; Jingjing Wu ; S= hijith Thotton > ; Gregory Etelson ; = Harish Patil > ; George Prekas ; Sergio = Gonzalez Monroy > ; Rasesh Mody > Subject: Re: [dpdk-dev] [PATCH v2] igb_uio: add config option to control = reset >=20 >=20 >=20 > On 11/3/2017 8:51 AM, Ferruh Yigit wrote: > > Adding a compile time configuration option to control device reset done > > during DPDK application exit. > > > > Config option is CONFIG_RTE_EAL_IGB_UIO_RESET and enabled by default, > > so by default reset will happen. Having this reset is safer to be sure > > device left in a proper case. > > > > But for special cases [1] it is possible to disable the config option > > to prevent the device reset. > > > > [1] > > http://dpdk.org/ml/archives/dev/2017-November/080927.html > > > > Fixes: b58eedfc7dd5 ("igb_uio: issue FLR during open and release of dev= ice file") > > Cc: stable@dpdk.org > > > > Signed-off-by: Ferruh Yigit >=20 > Realize that we do have a pci_clear_master() in the release() to disable > the DMA from device until the next open() will enable the DMA again . > Here is my: >=20 > Reviewed-by: Jianfeng Tan >=20 > Thanks, > Jianfeng >=20 > > --- > > Cc: Jianfeng Tan > > Cc: Jingjing Wu > > Cc: Shijith Thotton > > Cc: Gregory Etelson > > Cc: Harish Patil > > Cc: George Prekas > > Cc: Sergio Gonzalez Monroy > > Cc: Rasesh Mody > > > > v2: > > * fix typo in commit log > > --- > > config/common_base | 1 + > > config/common_linuxapp | 1 + > > lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 2 ++ > > 3 files changed, 4 insertions(+) > > > > diff --git a/config/common_base b/config/common_base > > index 82ee75456..2a9947420 100644 > > --- a/config/common_base > > +++ b/config/common_base > > @@ -102,6 +102,7 @@ CONFIG_RTE_LIBEAL_USE_HPET=3Dn > > CONFIG_RTE_EAL_ALLOW_INV_SOCKET_ID=3Dn > > CONFIG_RTE_EAL_ALWAYS_PANIC_ON_ERROR=3Dn > > CONFIG_RTE_EAL_IGB_UIO=3Dn > > +CONFIG_RTE_EAL_IGB_UIO_RESET=3Dn > > CONFIG_RTE_EAL_VFIO=3Dn > > CONFIG_RTE_MALLOC_DEBUG=3Dn > > CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=3Dn > > diff --git a/config/common_linuxapp b/config/common_linuxapp > > index 74c7d64ec..b3a602909 100644 > > --- a/config/common_linuxapp > > +++ b/config/common_linuxapp > > @@ -37,6 +37,7 @@ CONFIG_RTE_EXEC_ENV_LINUXAPP=3Dy > > > > CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=3Dy > > CONFIG_RTE_EAL_IGB_UIO=3Dy > > +CONFIG_RTE_EAL_IGB_UIO_RESET=3Dy > > CONFIG_RTE_EAL_VFIO=3Dy > > CONFIG_RTE_KNI_KMOD=3Dy > > CONFIG_RTE_LIBRTE_KNI=3Dy > > diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c b/lib/librte_eal= /linuxapp/igb_uio/igb_uio.c > > index fd320d87d..0325722c0 100644 > > --- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c > > +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c > > @@ -360,7 +360,9 @@ igbuio_pci_release(struct uio_info *info, struct in= ode *inode) > > /* stop the device from further DMA */ > > pci_clear_master(dev); > > > > +#ifdef RTE_EAL_IGB_UIO_RESET > > pci_reset_function(dev); > > +#endif > > > > return 0; > > } A compile time configuration option makes life very difficult for applicati= on providers. Consider the case where an application such as Open vSwitch with DPDK suppo= rt is being provided with a Linux distribution. One would want the Open vSwitch binary to suppo= rt as many vendor NICs as possible---without the need to recompile. With a change such as this, o= ne would need to have different versions of the kernel igb_uio module to support different NICs. The Linux kernel is already aware of, and provides work-arounds for, variou= s PCI quirks. For example, see linux/drivers/pci/quirks.c (http://elixir.free-electrons.c= om/linux/latest/source/drivers/pci/quirks.c). At this point in igb_uio.c, one is aware of the struct pci_dev "dev" for th= e device in question. Access to the vendor and device information should be simple: struct pci_dev { struct list_head bus_list; /* node in per-bus list */ struct pci_bus *bus; /* bus this device is on */ struct pci_bus *subordinate; /* bus this device bridges to */ void *sysdata; /* hook for sys-specific extension */ struct proc_dir_entry *procent; /* device entry in /proc/bus/pci */ struct pci_slot *slot; /* Physical slot this device is in */ unsigned int devfn; /* encoded device & function index */ unsigned short vendor; unsigned short device; unsigned short subsystem_vendor; unsigned short subsystem_device; ... One could imagine using logic to implement corresponding PCI quirks that ca= n be evaluated at runtime. For example (in pseudocode), if not (vendor =3D "Cavium" and device =3D "bnx2x") then pci_reset_function(dev); There are other possible implementations. If there are enough quirks, one = might have action functions defined---and a table of function pointers associated with each P= MD to select the proper action. - Lee Roberts =20