From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 ; 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 To: dev@dpdk.org Cc: Stephen Hemminger , Ferruh Yigit , Qi Zhang , Wenzhuo Lu , Thomas Monjalon , Jianfeng Tan , Gregory Etelson 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+2r8J4Q54w6pWtUvOwHQK75RRDmyQebz2wM0OkRiyzIktCo4uAfFsVqhBIecPcichpMoXY3ThJHYnZy8Szf6vwMXRQj1cAyUbR3ZGT4IZrAgYfQ7ks+a2qvTPlEAAnQiuQSTUJHpAWK2VqPylvsjTxN/T70eaB+WBVt9eD0NbPue1Ok6n7Iu8AizlOsXBuoVKcb2YblAHwYh3Cyu9tCjoZSOe/M4hR5/7fivweALHSUVzYfUXU7/UG6DJoDrabr3vB8H/rb6tboWOCBXRGMcYE30Six4IZpHGJZD8d2LSNq/9w8ILI2UIloOmS4j/mZoO7bOdmqZgKXt2uJf2ZIKPJSQn6tmYBSTkCGAZcH3ciCRwaclhR4VMr2ATnvSUj0TJsHKo7T7Ug0zBlBVe9tuuIGhSpB7le+Tio7MFR3T43sQZY7pFrmWSl62Mlms= X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3062; 31:sMsdhbOHu6gro4Odj9PGmGN7bQtjr2W/epwJZVEKffKfYdH6CRLVbD7N+qALczANgwsy1RHscC6MHvtgt+kbTEIpXawmXWv74YEfx5BIOaLOfTC7w9/TU8+kA+glBiX63l4KUlJLYQho/fmbi8RuEShgduN73y+R2VwHndzUuYtbJcmNnK617+PM2LCdUxUg5uUNuNzNEWjakmO+wJ00hxMyjTl8KzQNoZJcR3SpKxyrBagp30GSpfqq9uKM/eW4SyGsM+gBCsf2HlCz5rKAVQ==; 20:5KHiXujRRbRoOxT1qzY/YNgvhmNRMDM65lMSNjEAh8CEYl1AB3EX0c+UhqGG7xUcj/S0rt3X8eO4yvXZuf5ocBVu1uGN7IyECarTsnJzZAq1Yypu8P/gnoWiKC4y32TYvfw/DjZRl/BAAtUqXjH/QZopgCcwqB97Dw21MaysORUo3TcgEjUMLaJFQM+f5d2bPbHgKyd+qVXVqgWbPTqOLS+B/p3PkXDBJLeOQI3lbV+Y5rWclNh+F/DRwqcfKr2vCbRyBedOmyZ+GkTSfLq4XyWS/5kGV84vs8XSrfrOEBWbaCbCuXd2mTuc0fzyb66V0M8hpOnwrvbLaT15i7MSqV5F9+rAVdk+7CWzOlkOaIqYFXHzh632j1yEQHq2ybg8pcbkORhuYHX0Y7h2JM5rTwGXTc7XUeXiuNP1yhXTOwFZ0ayfX8pHmPwPoBVHGZj7ohCT4G678pkKLWr/toAZV6zLB+3SGcaeHDzFcppmmsEumz+9AlihBakfSA8JKVW7Z9stZMfx//59z3u2BueoIwvdbY+dXme3dibfCBgw6YY419mZSLr3w4uMKT79+aygjgf+y5c4sbMlVEXPffCoCA6BduEqMnfIh6ZEKpm2ea0= X-Microsoft-Antispam-PRVS: 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?= =?us-ascii?Q?L9WTialQiZno9qSQv9ra0JDImU00N8Ua1K5OpTZTRiVhTyIOHZg5nX7/wWhz?= =?us-ascii?Q?IHcq/rMX/k7hSj5hAw0jPuLY8gfbmFJPTLs1PHQzCvasTwGTF1nuK0h4ZKY7?= =?us-ascii?Q?jmnS8uxaVPDmhf141PBTXilzVx6Da1EFY2RSb4PMAP8kAJVL7JuyZ+HSqiBh?= =?us-ascii?Q?BQHNlPcSsHIHYzpWTXFpYxhRYNB4WMdxM3xOzeh0uMcT5cgzWw0psnCO96rF?= =?us-ascii?Q?dkU10V0DhGKUs17sFc3IceguRSIa9WPlckxhAHhVEGP7jI5W6MD49+3Of8CT?= =?us-ascii?Q?ZMGOTMowTuQmbDWck15e1Y5K6s7xdA/yIUh5ZGZtDO7XATQVCSWul8bgvbl5?= =?us-ascii?Q?T+bMJQ5/kqKrEGP/ELGh7NL/JZdMsCIzNhic7UUFl1jCPZ4YCB7J02Ps5FbD?= =?us-ascii?Q?B+7qk90UaPSZ/tMsgzL2aISLaxQi2dTuK7LxNGtdDHXpUMIXWhChZXFjl/FS?= =?us-ascii?Q?yY9dokb28Ydm1va0xS/N+ea6ieJ3Et12m0+3pxiAxAgcxoBSVLZOjtk5KxCw?= =?us-ascii?Q?ZluFnnfYdiTFLBGGZIdwq7FZ3BoG079F0wZUpLdV9TA/6YW9JyIlphaix62M?= =?us-ascii?Q?16rZBY7damlYGc4u6qpzGe/fVKpPW0MKlKJtQbl4skcBAWTmPq2on4cIOq45?= =?us-ascii?Q?J7kqmGUOpogy4+7XJiuhglfJUCWo7PjXn/9bJIe+bSHAVnwWOUclpkHInluP?= =?us-ascii?Q?hincp5bKZeu++fo2Lst/92L07gFNxCtvOW2pI8FhzAmg16NhCzN9UYM2AcJc?= =?us-ascii?Q?OGiDjZhIaCGlz93e1oCk0EG4pGP3vFzci3X9+tup80Lgy4zvmdo07Hhjc1tB?= =?us-ascii?Q?i7tW3SVYAwgV2yzD96y7NcQaVVTMBse1cRBSBa5g8TtRG0sHy8TdglC1QXum?= =?us-ascii?Q?mTWpZPrqfWuaBb0g6SPVV1avdZd+v84pY8JHY9rcgMsipkwqRKv8axCChI0Z?= =?us-ascii?Q?1b2he8WEakkGqhzDK+MR0DWODluBu4PYp0KbJuHgbqJAabomUCbcPw9q9JZR?= =?us-ascii?Q?Q9KEfULchcT3TLoY1yyAw14g7yr++Dkj5ihZUOQyH8dLRkuolsJDoOSOxlEi?= =?us-ascii?Q?V7Wszdzw3GDLHqt8AaMZDr0YaVj2YgCDVvMWpVGB64cBrZdXJoLw=3D=3D?= 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?= =?us-ascii?Q?o53uyUbq7ni0P5D+bueMDHRQzOP4jmqVlUnyJM7LOsfxaHwJJWn9D0Q313Ch?= =?us-ascii?Q?+Qakfxtds61B1yU3PL3PgqVanWFRTf86PyslJWozKTXFXw3J/ByXYal7QzZt?= =?us-ascii?Q?SjdK7ENrVkmDrKozPqXHIOfGBZsIHPbUIYAv2aakl8YRPBhynpUATxBgbJq2?= =?us-ascii?Q?j2IAvu5Jac75ZF3ivdpLk7xFGwmm0krdyvFEfBUPIGPaICyEomeo3nli88ES?= =?us-ascii?Q?l7mL4aJPa1iV/M+WrnXbtxTBZTmgwZWXJo7m1i8NgX1UAicspZ/r9CCJHFVe?= =?us-ascii?Q?qbd5yJ7vR9RbdPRTS/PSOmlzbgdTS0JmPE/sOl92MKbUaYNQbpW7LXYlUi6P?= =?us-ascii?Q?HJkYE/ZwXCS1GmXliyRKivNatIZp8kVp1TO9C1mXzUGzlKonZlkjbB58M0Uy?= =?us-ascii?Q?1wQIT5LcNmhgh4J2FrNRaEPYsjAiYIkPnO4XzX42DZyPuVw5oWoz69vDUn/J?= =?us-ascii?Q?/LyOWL/y3MOqGHEQJg8fcZX6QntUE0tToDvEtC55rAu35GdKU5MwIoSqXw9b?= =?us-ascii?Q?ItsLSTFPsCXnYRH1NjpvUdviqvqI3htY0TbW6ogXQWLdXXiBLQVdfgT9mx8l?= =?us-ascii?Q?VCUtxz2w/SyYW7DTvdH7QoAJ11I5SsAwjDKPzevGlbE8IlC1rmaHhggWY/a0?= =?us-ascii?Q?Yqz8CgTBPXgLb0x9QW9t3DNNZ2sbbegIkzpOvxwwF/MQMNz2ILfn3FbjUY1g?= =?us-ascii?Q?hY+E1AEmIBN3r9Hsr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sNXcCyVVZzYRvnDLhHvIey7lR9II615FAIxqv1F+R2NanPGtazEI2DFZ4glPz/2IK6P7Y5v708+9rsozWpg9XmGn619ePxjtGb9Ijtd3erNw== X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3062; 5:SBJvlTpIO6bvSiN7YbZItjAhYX2vIjs5EBE984kExMxxEIo1SRoiNFbzDnXoCZBGIFOaSL6qdTeMtDpa3QxH0XbclQFt58Bk6kfriZKzgn5pVkyKTzW1QrXFfkT1vba04LTUXzS8VyQUrIH2E9ryM60/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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jun 2017 09:39:50 -0000 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 --- 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(+) 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()) -- 1.8.3.1