Message ID | 1497260285-27536-1-git-send-email-shijith.thotton@caviumnetworks.com (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Thomas Monjalon |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id D81C72A58; Mon, 12 Jun 2017 11:39:51 +0200 (CEST) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0074.outbound.protection.outlook.com [104.47.36.74]) by dpdk.org (Postfix) with ESMTP id 22DCA9E3 for <dev@dpdk.org>; Mon, 12 Jun 2017 11:39:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=o5YwwHD7yfF0QgDycb5WNeYoZfaiC3XtFEhWC5LLoKw=; b=g9WFd6kMURHq7O3p+hd/lg8sdFv7Zn8UlOedm/b2vJW2nY0GOYv6fe628ocGs0JLft3csG1UE6xQGDLQLoFJ/uBcgt7MsZufvL5IueIlX+jRrErVarDD6qgtd6aFXldvF3cMN9ulWDt0vAj3AYGk7l9WbOHwFX2hrekLZjoRtpo= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=caviumnetworks.com; Received: from lio357.in.caveonetworks.com (14.140.2.178) by CY4PR07MB3062.namprd07.prod.outlook.com (10.172.116.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1157.12; Mon, 12 Jun 2017 09:39:43 +0000 From: Shijith Thotton <shijith.thotton@caviumnetworks.com> To: dev@dpdk.org Cc: Stephen Hemminger <stephen@networkplumber.org>, Ferruh Yigit <ferruh.yigit@intel.com>, Qi Zhang <qi.z.zhang@intel.com>, Wenzhuo Lu <wenzhuo.lu@intel.com>, Thomas Monjalon <thomas@monjalon.net>, Jianfeng Tan <jianfeng.tan@intel.com>, Gregory Etelson <gregory@weka.io> Date: Mon, 12 Jun 2017 15:08:05 +0530 Message-Id: <1497260285-27536-1-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1496228966-18573-1-git-send-email-shijith.thotton@caviumnetworks.com> References: <1496228966-18573-1-git-send-email-shijith.thotton@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: BMXPR01CA0006.INDPRD01.PROD.OUTLOOK.COM (10.174.214.144) To CY4PR07MB3062.namprd07.prod.outlook.com (10.172.116.143) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PR07MB3062: X-MS-Office365-Filtering-Correlation-Id: 90dce253-3e0d-4869-951a-08d4b176f76e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:CY4PR07MB3062; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3062; 3:qVwrUUE280h1QouWZDjIJPohGU0qjF+a50uP1wtvZHcbg9Znfn7QyIXoaJiadHkOnKUcIZG4nsFGogdseHl4JYEO7Aw1gFLSFk7+WGOy/T6kRU704qDR65zFe5H1PAasjMtIDebtE4laUqLFz9PaGz92z+ZzeNhuLA1gWUBXegHr9ANnNNqmH7HWi2dNJGyp5qgz4r7mul8vxGgg1xG7y7RA1qsZhAvCby0Cgi0eWTTr82uWeb4w2OCIwBUfUR0bCwFLyGDpN4WSsenUV9UPbupEI6ctcRhD1jT8FD4MMpjAuaTbmspBDptHReIa/eyCFM8DDTRWMC95K09TsjqdFQ==; 25:nc0TsF6OpW6icRxYKVw+2qVa8EuuuhPob4aNzm+uWit4096+2r8J4Q54w6pWtUvOwHQK75RRDmyQebz2wM0OkRiyzIktCo4uAfFsVqhBIecPcichpMoXY3ThJHYnZy8Szf6vwMXR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HX0Y7h2JM5rTwGXTc7XUeXiuNP1yhXTOwFZ0ayfX8pHmPwPoBVHGZj7ohCT4G678pkKLWr/toAZV6zLB+3SGcaeHDzFcppmmsEumz+9AlihBakfSA8JKVW7Z9stZMfx//59z3u2BueoIwvdbY+dXme3dibfCBgw6YY419mZSLr3w4uMKT79+aygjgf+y5c4sbMlVEXPffCoCA6BduEqMnfIh6ZEKpm2ea0= X-Microsoft-Antispam-PRVS: <CY4PR07MB30625B141F8D8AD981D1FAA781CD0@CY4PR07MB3062.namprd07.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(17755550239193); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(3002001)(100000703101)(100105400095)(10201501046)(6041248)(20161123555025)(20161123564025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123562025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY4PR07MB3062; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY4PR07MB3062; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR07MB3062; 4:dRycWwbOOcGAcc58+PnHyKNSK8SuPuBIrGqAy77p0g?= L9WTialQiZno9qSQv9ra0JDImU00N8Ua1K5OpTZTRiVhTyIOHZg5nX7/wWhzIHcq/rMX/k7hSj5hAw0jPuLY8gfbmFJPTLs1PHQzCvasTwGTF1nuK0h4ZKY7jmnS8uxaVPDmhf141PBTXilzVx6Da1EFY2RSb4PMAP8kAJVL7JuyZ+HSqiBhBQHNlPcSsHIHYzpWTXFpYxhRYNB4WMdxM3xOzeh0uMcT5cgzWw0psnCO96rFdkU10V0DhGKUs17sFc3IceguRSIa9WPlckxhAHhVEGP7jI5W6MD49+3Of8CTZMGOTMowTuQmbDWck15e1Y5K6s7xdA/yIUh5ZGZtDO7XATQVCSWul8bgvbl5T+bMJQ5/kqKrEGP/ELGh7NL/JZdMsCIzNhic7UUFl1jCPZ4YCB7J02Ps5FbDB+7qk90UaPSZ/tMsgzL2aISLaxQi2dTuK7LxNGtdDHXpUMIXWhChZXFjl/FSyY9dokb28Ydm1va0xS/N+ea6ieJ3Et12m0+3pxiAxAgcxoBSVLZOjtk5KxCwZluFnnfYdiTFLBGGZIdwq7FZ3BoG079F0wZUpLdV9TA/6YW9JyIlphaix62M16rZBY7damlYGc4u6qpzGe/fVKpPW0MKlKJtQbl4skcBAWTmPq2on4cIOq45J7kqmGUOpogy4+7XJiuhglfJUCWo7PjXn/9bJIe+bSHAVnwWOUclpkHInluPhincp5bKZeu++fo2Lst/92L07gFNxCtvOW2pI8FhzAmg16NhCzN9UYM2AcJcOGiDjZhIaCGlz93e1oCk0EG4pGP3vFzci3X9+tup80Lgy4zvmdo07Hhjc1tBi7tW3SVYAwgV2yzD96y7NcQaVVTMBse1cRBSBa5g8TtRG0sHy8TdglC1QXummTWpZPrqfWuaBb0g6SPVV1avdZd+v84pY8JHY9rcgMsipkwqRKv8axCChI0Z1b2he8WEakkGqhzDK+MR0DWODluBu4PYp0KbJuHgbqJAabomUCbcPw9q9JZRQ9KEfULchcT3TLoY1yyAw14g7yr++Dkj5ihZUOQyH8dLRkuolsJDoOSOxlEiV7Wszdzw3GDLHqt8AaMZDr0YaVj2YgCDVvMWpVGB64cBrZdXJoLw== X-Forefront-PRVS: 03361FCC43 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39450400003)(39850400002)(39840400002)(39410400002)(39400400002)(43544003)(8676002)(6306002)(81166006)(5003940100001)(50986999)(50226002)(478600001)(54906002)(53376002)(110136004)(38730400002)(6512007)(53936002)(6506006)(76176999)(966005)(6486002)(72206003)(50466002)(48376002)(36756003)(189998001)(5660300001)(42186005)(2950100002)(6916009)(4720700003)(33646002)(42882006)(305945005)(2351001)(7736002)(2361001)(6666003)(66066001)(3846002)(47776003)(6116002)(2906002)(5009440100003)(4326008)(25786009)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR07MB3062; H:lio357.in.caveonetworks.com; FPR:; SPF:None; MLV:nov; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR07MB3062; 23:pXYGyKOwKBLdJEvOrZdGFxwGQ63CvDwu5eWwWSOyB?= o53uyUbq7ni0P5D+bueMDHRQzOP4jmqVlUnyJM7LOsfxaHwJJWn9D0Q313Ch+Qakfxtds61B1yU3PL3PgqVanWFRTf86PyslJWozKTXFXw3J/ByXYal7QzZtSjdK7ENrVkmDrKozPqXHIOfGBZsIHPbUIYAv2aakl8YRPBhynpUATxBgbJq2j2IAvu5Jac75ZF3ivdpLk7xFGwmm0krdyvFEfBUPIGPaICyEomeo3nli88ESl7mL4aJPa1iV/M+WrnXbtxTBZTmgwZWXJo7m1i8NgX1UAicspZ/r9CCJHFVeqbd5yJ7vR9RbdPRTS/PSOmlzbgdTS0JmPE/sOl92MKbUaYNQbpW7LXYlUi6PHJkYE/ZwXCS1GmXliyRKivNatIZp8kVp1TO9C1mXzUGzlKonZlkjbB58M0Uy1wQIT5LcNmhgh4J2FrNRaEPYsjAiYIkPnO4XzX42DZyPuVw5oWoz69vDUn/J/LyOWL/y3MOqGHEQJg8fcZX6QntUE0tToDvEtC55rAu35GdKU5MwIoSqXw9bItsLSTFPsCXnYRH1NjpvUdviqvqI3htY0TbW6ogXQWLdXXiBLQVdfgT9mx8lVCUtxz2w/SyYW7DTvdH7QoAJ11I5SsAwjDKPzevGlbE8IlC1rmaHhggWY/a0Yqz8CgTBPXgLb0x9QW9t3DNNZ2sbbegIkzpOvxwwF/MQMNz2ILfn3FbjUY1ghY+E1AEmIBN3r9HsrU9ZN7FKkjDx6DtAVsmoGVgtOzoqSFVp0MkJ4q24pXSZYMoj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ItjAhYX2vIjs5EBE984kExMxxEIo1SRoiNFbzDnXoCZBGIFOaSL6qdTeMtDpa3QxH0XbclQFt58Bk6kfriZKzgn5pVkyKTzW1QrXFfkT1vba04LTUXzS8VyQUrIH2E9ryM60/rW9wsdyz4VszCvBg3h0s1yNLRSDCIUYnWiXlg97YZvDsNo78hdeB2EaeKMLuf1K31A5iAdLKAgtWgVghREfpheWK3iySjej3M6bUXPmm7jUJ8zMDLYVEosk8yOqKg9HT2Wb4i0CE5ZPAWEUHfn4JuFrGbrY3sExcM7p2WA7XfZ+ddAj/ifmZEpiZTPKPVAAAlq0zGOyjIdi16t/2JVlxPuY6SQP8NPhObp47rzbOYDpyPyCNFx/0GhBOSVp3swvrHQjRUPOQ3nAC1YvXNLkpMdBPCogX1Mk2JMHiK6IZouP9HZ20rnEQL0IE0bp3xnIKLPXH+gcTHRUoTszbWG6PHdNpjh/KULCCGNbZ99kx; 24:mkspX4BcBFtzDxQnKaInS+zyWeppok6lW8MhTZ+G6utJT5NO7yv/77zAZ7uRaJfak57l2cXmkwPkFwA8i8Fu85+lDrwwsjSG1QaZmy7Mv84= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3062; 7:CiCq7xfpHHHMMGjuvCeP/36Kk5stBCiKqbkpLDe9HulVGdSHpVtld3zh8Lf2kQOEzSyuBeZ7x7il4A8YLF+qaxgxk48Zib6ewNgK4rbYyCMWi5X3oqTsD+/yQX+G3TrVq/1prgzluz5g1NW761jOFxt6uZ8BBsvHTe2yAcLzKdqUF9uUrkK3OD0lnYNGtqNR28VUORFcR+f3O6tCzxp+7syGUXxo3EwVZSS8rrQ1bxjyIWZKGGqSPYPtWsrE+65HDlSZLRMX2kLjjdYuJ+GjsvyvPjO8l+bnOPZPjNHtPAsdSRKXlI9sUbjrQawNOr/AZAiE+NqhiwjDBkZXCud67Q== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2017 09:39:43.9839 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB3062 Subject: [dpdk-dev] [PATCH] igb_uio: issue FLR during open and release of device file X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions <dev.dpdk.org> List-Unsubscribe: <http://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Checks
Context | Check | Description |
---|---|---|
ci/checkpatch | success | coding style OK |
ci/Intel-compilation | success | Compilation OK |
Commit Message
Shijith Thotton
June 12, 2017, 9:38 a.m. UTC
Set UIO info device file operations open and release. Call pci reset
function inside open and release to clear device state at start and end.
Copied this behaviour from vfio_pci kernel module code. With this patch,
it is not mandatory to issue FLR by PMD's during init and close.
Bus master enable and disable are added in open and release respectively
to take care of device DMA.
Signed-off-by: Shijith Thotton <shijith.thotton@caviumnetworks.com>
---
v1 changes:
- Added pci set master inside open and clear master inside release.
- Remove obvious comments.
RFC: http://dpdk.org/ml/archives/dev/2017-May/066917.html
lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 33 +++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
Comments
Any comment, please? 12/06/2017 11:38, Shijith Thotton: > Set UIO info device file operations open and release. Call pci reset > function inside open and release to clear device state at start and end. > Copied this behaviour from vfio_pci kernel module code. With this patch, > it is not mandatory to issue FLR by PMD's during init and close. > > Bus master enable and disable are added in open and release respectively > to take care of device DMA. > > Signed-off-by: Shijith Thotton <shijith.thotton@caviumnetworks.com> > --- > v1 changes: > - Added pci set master inside open and clear master inside release. > - Remove obvious comments. > > RFC: http://dpdk.org/ml/archives/dev/2017-May/066917.html
On 6/12/2017 10:38 AM, Shijith Thotton wrote: > Set UIO info device file operations open and release. Call pci reset > function inside open and release to clear device state at start and end. > Copied this behaviour from vfio_pci kernel module code. With this patch, > it is not mandatory to issue FLR by PMD's during init and close. > > Bus master enable and disable are added in open and release respectively > to take care of device DMA. > > Signed-off-by: Shijith Thotton <shijith.thotton@caviumnetworks.com> This patch, and Gregory's patch [1] are very similar and main target is to leave device in a more proper state when DPDK application quits unexpectedly. Difference between two are, this one implements both .open and .release ops, and sets / clears bus master accordingly. Although main concern is .reset, I am OK to follow vfio_pci approach here, and clearing bus master on .reset can prevent unwanted DMA access. So, I am for this patch and I am testing it for a few days without a problem. But Gregory reported a crash with older version of this patch, without more detail, we should clear that first. With Gregory's Tested-by, I am OK with this patch. Gregory, Are you using your version, what are the results? And would you mind testing this patch? Thanks, ferruh [1] http://dpdk.org/dev/patchwork/patch/25061/
I could not reproduce server crash with http://dpdk.org/dev/patchwork/patch/25267/ [1] However, pci_try_reset_function() API used in that patch is not defined in RedHat-6.x Linux-2.6.32 kernels Therefore I work with http://dpdk.org/dev/patchwork/patch/25061/ patch [2]. [2] was successfully tested with IXGBE & I40e VFs on RH 6.x, RH 7.x Ubuntu 14.04 and SLES-11.4 Regards, Gregory On Thursday, 6 July 2017 19:41:40 IDT Ferruh Yigit wrote: > On 6/12/2017 10:38 AM, Shijith Thotton wrote: > > Set UIO info device file operations open and release. Call pci reset > > function inside open and release to clear device state at start and end. > > Copied this behaviour from vfio_pci kernel module code. With this patch, > > it is not mandatory to issue FLR by PMD's during init and close. > > > > Bus master enable and disable are added in open and release respectively > > to take care of device DMA. > > > > Signed-off-by: Shijith Thotton <shijith.thotton@caviumnetworks.com> > > This patch, and Gregory's patch [1] are very similar and main target is > to leave device in a more proper state when DPDK application quits > unexpectedly. > > Difference between two are, this one implements both .open and .release > ops, and sets / clears bus master accordingly. > > Although main concern is .reset, I am OK to follow vfio_pci approach > here, and clearing bus master on .reset can prevent unwanted DMA access. > > So, I am for this patch and I am testing it for a few days without a > problem. > > But Gregory reported a crash with older version of this patch, without > more detail, we should clear that first. With Gregory's Tested-by, I am > OK with this patch. > > > Gregory, > > Are you using your version, what are the results? And would you mind > testing this patch? > > Thanks, > ferruh > > > [1] > http://dpdk.org/dev/patchwork/patch/25061/ > >
On Thu, Jul 06, 2017 at 08:27:17PM +0300, Gregory Etelson wrote: > I could not reproduce server crash with http://dpdk.org/dev/patchwork/patch/25267/ [1] > However, pci_try_reset_function() API used in that patch is not defined in RedHat-6.x Linux-2.6.32 kernels > Therefore I work with http://dpdk.org/dev/patchwork/patch/25061/ patch [2]. > [2] was successfully tested with IXGBE & I40e VFs on RH 6.x, RH 7.x Ubuntu 14.04 and SLES-11.4 > > Regards, > Gregory > > On Thursday, 6 July 2017 19:41:40 IDT Ferruh Yigit wrote: > > On 6/12/2017 10:38 AM, Shijith Thotton wrote: > > > Set UIO info device file operations open and release. Call pci reset > > > function inside open and release to clear device state at start and end. > > > Copied this behaviour from vfio_pci kernel module code. With this patch, > > > it is not mandatory to issue FLR by PMD's during init and close. > > > > > > Bus master enable and disable are added in open and release respectively > > > to take care of device DMA. > > > > > > Signed-off-by: Shijith Thotton <shijith.thotton@caviumnetworks.com> > > > > This patch, and Gregory's patch [1] are very similar and main target is > > to leave device in a more proper state when DPDK application quits > > unexpectedly. > > > > Difference between two are, this one implements both .open and .release > > ops, and sets / clears bus master accordingly. > > > > Although main concern is .reset, I am OK to follow vfio_pci approach > > here, and clearing bus master on .reset can prevent unwanted DMA access. > > > > So, I am for this patch and I am testing it for a few days without a > > problem. > > > > But Gregory reported a crash with older version of this patch, without > > more detail, we should clear that first. With Gregory's Tested-by, I am > > OK with this patch. > > > > > > Gregory, > > > > Are you using your version, what are the results? And would you mind > > testing this patch? > > > > Thanks, > > ferruh > > > > > > [1] > > http://dpdk.org/dev/patchwork/patch/25061/ > > > > Hi Gregory, Please try the following change: s/pci_try_reset_function/pci_reset_function/ pci_try_reset_function is same as pci_reset_function, except it returns -EAGAIN if unable to lock the device[1]. If everyone agrees, I can submit v2 with this change. 1. http://elixir.free-electrons.com/linux/latest/source/drivers/pci/pci.c#L4293 Thanks, Shijith
On 7/7/2017 11:03 AM, Shijith Thotton wrote: > On Thu, Jul 06, 2017 at 08:27:17PM +0300, Gregory Etelson wrote: >> I could not reproduce server crash with http://dpdk.org/dev/patchwork/patch/25267/ [1] >> However, pci_try_reset_function() API used in that patch is not defined in RedHat-6.x Linux-2.6.32 kernels >> Therefore I work with http://dpdk.org/dev/patchwork/patch/25061/ patch [2]. >> [2] was successfully tested with IXGBE & I40e VFs on RH 6.x, RH 7.x Ubuntu 14.04 and SLES-11.4 >> >> Regards, >> Gregory >> >> On Thursday, 6 July 2017 19:41:40 IDT Ferruh Yigit wrote: >>> On 6/12/2017 10:38 AM, Shijith Thotton wrote: >>>> Set UIO info device file operations open and release. Call pci reset >>>> function inside open and release to clear device state at start and end. >>>> Copied this behaviour from vfio_pci kernel module code. With this patch, >>>> it is not mandatory to issue FLR by PMD's during init and close. >>>> >>>> Bus master enable and disable are added in open and release respectively >>>> to take care of device DMA. >>>> >>>> Signed-off-by: Shijith Thotton <shijith.thotton@caviumnetworks.com> >>> >>> This patch, and Gregory's patch [1] are very similar and main target is >>> to leave device in a more proper state when DPDK application quits >>> unexpectedly. >>> >>> Difference between two are, this one implements both .open and .release >>> ops, and sets / clears bus master accordingly. >>> >>> Although main concern is .reset, I am OK to follow vfio_pci approach >>> here, and clearing bus master on .reset can prevent unwanted DMA access. >>> >>> So, I am for this patch and I am testing it for a few days without a >>> problem. >>> >>> But Gregory reported a crash with older version of this patch, without >>> more detail, we should clear that first. With Gregory's Tested-by, I am >>> OK with this patch. >>> >>> >>> Gregory, >>> >>> Are you using your version, what are the results? And would you mind >>> testing this patch? >>> >>> Thanks, >>> ferruh >>> >>> >>> [1] >>> http://dpdk.org/dev/patchwork/patch/25061/ >>> >>> > > Hi Gregory, > > Please try the following change: > s/pci_try_reset_function/pci_reset_function/ > > pci_try_reset_function is same as pci_reset_function, except it returns -EAGAIN > if unable to lock the device[1]. > > If everyone agrees, I can submit v2 with this change. pci_try_reset_function() not being available in older kernel versions seems a problem and blocking Gregory. To move forward, I would suggest sending the v2, and we can continue discussion based on it. Thanks, ferruh > > 1. http://elixir.free-electrons.com/linux/latest/source/drivers/pci/pci.c#L4293 > > Thanks, > Shijith >
diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c index b9d427c..7c04bb9 100644 --- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c @@ -170,6 +170,37 @@ struct rte_uio_pci_dev { return IRQ_HANDLED; } +/** + * This gets called while opening uio device file. + */ +static int +igbuio_pci_open(struct uio_info *info, struct inode *inode) +{ + struct rte_uio_pci_dev *udev = info->priv; + struct pci_dev *dev = udev->pdev; + + pci_reset_function(dev); + + /* set bus master, which was cleared by the reset function */ + pci_set_master(dev); + + return 0; +} + +static int +igbuio_pci_release(struct uio_info *info, struct inode *inode) +{ + struct rte_uio_pci_dev *udev = info->priv; + struct pci_dev *dev = udev->pdev; + + /* stop the device from further DMA */ + pci_clear_master(dev); + + pci_try_reset_function(dev); + + return 0; +} + #ifdef CONFIG_XEN_DOM0 static int igbuio_dom0_mmap_phys(struct uio_info *info, struct vm_area_struct *vma) @@ -372,6 +403,8 @@ struct rte_uio_pci_dev { udev->info.version = "0.1"; udev->info.handler = igbuio_pci_irqhandler; udev->info.irqcontrol = igbuio_pci_irqcontrol; + udev->info.open = igbuio_pci_open; + udev->info.release = igbuio_pci_release; #ifdef CONFIG_XEN_DOM0 /* check if the driver run on Xen Dom0 */ if (xen_initial_domain())