From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0080.outbound.protection.outlook.com [104.47.34.80]) by dpdk.org (Postfix) with ESMTP id B0DBB28EE for ; Wed, 31 May 2017 13:11:00 +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=qPRc2BTm8mCZZ5ExuWyZBpRnR3APWmpjIJB34U+8uqU=; b=lbeRAeyUKXbObdm07z3ekjMgALxyM4bgkt0cJ4LhNLOoIzs5gWW+m7RfYmxFDN4rpNtFa3n9o7Gj5z4A5eEFIGGmQkINAExtMJ3Fpm4geggsb6z4clGJrDV87A7XBM7n97MqPgD40D7QfRIqEo9a2gH+h14SBuVwEF/eD9WSTU4= Authentication-Results: weka.io; dkim=none (message not signed) header.d=none; weka.io; dmarc=none action=none header.from=caviumnetworks.com; Received: from lio357.in.caveonetworks.com (14.140.2.178) by MWHPR07MB3070.namprd07.prod.outlook.com (10.172.97.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1124.9; Wed, 31 May 2017 11:10:56 +0000 From: Shijith Thotton To: Gregory Etelson Cc: Stephen Hemminger , dev@dpdk.org, Ferruh Yigit , Qi Zhang , Wenzhuo Lu , Thomas Monjalon Date: Wed, 31 May 2017 16:39:26 +0530 Message-Id: <1496228966-18573-1-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1748341.rbpcFmWp0q@polaris> References: <1748341.rbpcFmWp0q@polaris> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: MA1PR01CA0086.INDPRD01.PROD.OUTLOOK.COM (10.174.56.26) To MWHPR07MB3070.namprd07.prod.outlook.com (10.172.97.12) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR07MB3070: X-MS-Office365-Filtering-Correlation-Id: 942e53d8-f981-4fec-9447-08d4a815b6fb X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:MWHPR07MB3070; X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3070; 3:gtbX+Ipy74xkE6rqpAH2ZMA1XTCHmf/5qq4D8zAZiRtchFTKQbqFVqnFLT5MLDO4peKtanYgauMimOj06xJFph6he42VRbc22YFH0B+dSm/ZwCOLTtq/aGyDicX5dceTChJwesHvMVrs1UwwuX3igTC755dor/URF7xGYsTI3TNWj9RbZOpdb7KPx4YeVwv5aecjQHKptFKINiC+s0qo3W61LrbJZnjDXRvZtFg2FgaGo5qglzsl7pSe5LNiGoO5tRr108hYkq8qG0aw7ZZEUmcNtaiaRd2egLKgumYvVf6HhhXgE6OWIAvJ6yiMKdZH5JaXy+514ta53bqdm/uaVg==; 25:M31C2TtBftoLuT6DOPNGsgoO7YjT0HyXIvqvAtCPh3lYnHb37K9N+PQdcpt8ccoToidrTz/381FMewF2lKRNMI0vnoYc++GQxMhJxGVniJHkhU8nXgUm0gPGLbfQJfIutRfedMcqbchsbufsr9i/zR7ma2oU8ITQkGKTyA0mE8vB6pLi7UFeuVOgZrq3LUpgsVj89a4bifBxTJxJWExY5/ETIolm7uRaxChKDNKBqo2O1J2dmkyXQz/Kozx2f3r7lesvxphXntp7GPL/duTo0f+/HmAGc6C2fopxb8IqWTUtooGMgq1AHqK70WAqTe8OUHyknj9Bx5gQ6+xdXOQMRmTVKLuAVvSevDs7Sr4q+iqA5kanyjSMilNi2koo4c2zBNNrYu0iu2d9e9uqrtFnBnW7/Uz6l16fRbJM1ycGR06UAJcURPwqme7YjPjT86IzM1xTECca78rwLd4lhD3wjjKKB6pLmqFItJejU/Seig0= X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3070; 31:S+iw9gQkxJqzji7j6S1adG9CepQmaoOEyNF2LWaWY6DCYHcdGOIqyWJn4XUajTT9Pvg6xLssBf6eN35kOvDQqM1IDRM0v1OECClmLMesmNzTyteEznfRzg3Aqw70YXXwKXzaOiufNuZgGDt8q1sBMG+Q7cWK0Pd6MOwZQAkWNNAHCspnICgf6bnJJioPnWyxxLlbXMGvwe7W7grRR4EmlD5lu8/2TUVwUPP7s22srSkP/zvHovwm3b6pVixFOWiQhHdAwr5LOdZgQkyUnERFpQ==; 20:jJqmY3qkBcBb0mCquLpA9J3qtJZ7uxbRlUtGqdPBVu8O1gWNS3KNQIxysUixlHqy3GkjnqZh6v/40KJD1z24KrsLYAnLrIyZ+qjJo1sVnidTBT13B9OGbxf+ziEZUxwlvulHeLijjn3wZHWG9HE4A8QbJvMk2ZPoJDwmdM6jelWv2A0XXxz7zX5EoozuIbLHffwhvk0zrZuQMJn8OmDzDZoNYQWhtdjRNaWW5oBC0MHW9vUsT/jyuRVg2WxSL4q8QiSymyTH4It71IohB1rlAKaODgpm6IDFVofPNTurBC4Rg18mg4hMbvEQYwn0mwhT4XG+BvryIdAp8wKw0Xr9e20W/JXBPweBpUd6pBpoMqiBSHGGYBgCIxG1fe9f4PgsYvdJLIah7nPC4qvAsih/bKxqm26q9yd1QEmgiuShrooTgYL/MGOwDU6qPCDqJfF4EzipMrAsyWibf9HpxgN0ThTPrTXOIO6x471BwXu1LBvrLxU2ACGAA0Ehhv+oNnU2bZt0s+sFA5F+Efev257GzYr81QvQ3m5udgGtWwPb3Tf3wWDVcKN0w/jrfAq+H09ZTDxT1mBriglU0SomhDqmDrs5BJ11+yAyD24ZE0m26xI= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(17755550239193); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(93006095)(10201501046)(6041248)(20161123562025)(20161123564025)(20161123555025)(20161123560025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148); SRVR:MWHPR07MB3070; BCL:0; PCL:0; RULEID:; SRVR:MWHPR07MB3070; X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3070; 4:nSUwAith+yDRh4MOby5FVuLrSLYqXu6uSam+BFBX9jA8Z4t0vzW2YhoCdC7dj2vmhGdwlov5l6R3yc7RBI3SdHCWWp9jqUOZPXkm2/hhij07IM56aP3u2nm/FDau0jQAlvjPoI5swAbeqpXKr2LAliI2cKlxfinged697JVsG8dCyNtACW9JLAJY8AQKUXHA6LkWDHrHA0TP5L9pcDIEG4DjjVxIk1OrIX5CEF6cFsAGb1DnIq9tXj9N49ryGDgL0eY7FkckhjVeVOGgvHXw+LhGl6v8tONTlEboa2hzlQYpNe42tRRjnIzhHEKdpgqZDRikcsE/jVsgDRzd1O+CBuESdcjLzjiNjH7RkTkK5/vPUKlse9ZCfH6Sb7ohboJ4nWWTf+SkJ+54+JaM8n0yipYQh/FyLUrfd0oLs9bK2kx6RJ1RJBWpmv32gZ9mngqpuyUo6TLYSf0PCwFD7ggcnmfGJKUiYajpYfJYp2eMTfR7qmes2wMjfw8EVls6XcYJ58qdk3YtJTbm+U3gKQYH7uD2L16SoOTVfOlRzZ+4YxA5CtCAXcFnEWvE9ZwjaCl+TI4g1q0gbzJ033jnJ2P/YDa9Hp3lr1jBQwRRdNI/yvBLc1lb702LjxUCjvW9sqYwVypqgI/nLWHDDJuqD3HG7ht5Tah0YXUYkbUcWo1q+izv3mLXD8JoMG11RUJ8nB2Y9sBD93E5jNz6NXBP4hDIeW4wCcOnZicOce6o5LP9MrLbkaTNlLF651G9k4FnRjBSpRbt/6Y+1UKUwrfhzYmWxBIfY5/Xk+e872seQaG84rktbIZ+b6i6KElg9jfS1tob X-Forefront-PRVS: 0324C2C0E2 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39450400003)(39850400002)(39410400002)(39840400002)(39400400002)(2906002)(33646002)(110136004)(189998001)(478600001)(5009440100003)(50226002)(38730400002)(66066001)(6116002)(42882006)(47776003)(6916009)(2950100002)(53936002)(3846002)(54906002)(6512007)(48376002)(72206003)(6506006)(6486002)(7736002)(5660300001)(4720700003)(50466002)(81166006)(6666003)(36756003)(8676002)(305945005)(50986999)(76176999)(25786009)(5003940100001)(42186005)(4326008)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR07MB3070; H:lio357.in.caveonetworks.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR07MB3070; 23:lGx8F+Z0S+grslZ7ARnKLIwKnwWYVYGRp5bl9+nJJ?= =?us-ascii?Q?HpWsTtLBJi5Kxo3hhv7rCJRF2sUzzegMC2stB+BKSWCbm7cFM5QKBqgVMBaj?= =?us-ascii?Q?xFBal6G2l79voYwxw4cLmDYs07t9sVs78gSsBx/DtOwgy19e4pc21BsA+pgT?= =?us-ascii?Q?1epscZtr5yO6SUhRRa1dJPS+mJzmKq2e0iputrP7WlDpdFMjxCPWc8ebDKbK?= =?us-ascii?Q?XsKhyx8tuBVjfYo+Unyq7dUwl0sdVxOTlZLKRTAAFaJZCYuM3sivag0eHtTE?= =?us-ascii?Q?AJ88TGQ4jOgATlvr9NahmTsKSPklyqod0OgXgdreR1CjpoODUSiiToSCMR7o?= =?us-ascii?Q?Z/aAfEcK6icGFvi8UtOvJe6hA09ZI5Ys58s0WpNUyy7tcBlwp/fRhUY4kG6G?= =?us-ascii?Q?h0GPQYeJIbJkLbBczdYq38g6CttFYi/VmAFKD8Tdd3n8TZKPj9FFwPDKwjkD?= =?us-ascii?Q?E76IJ8xceI4GluzkYCqsEFzEE/49KUJiC+8mMVR1tjNRAAMileVVHcpLA1Wi?= =?us-ascii?Q?wZIlaG0ApgxtfeBDFtGrQkABwOWbwjcCTHQSc72v8Z9bvYLgFpuvJucJNALw?= =?us-ascii?Q?I3fpocHoHJ++iktwzESgVDBnJQwAybGb1tmy4uYMBJ/R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cPOqV1ysGpT1Ty3VAwZZHBzAuwmr4B7sbqjGX3uQCkSjjjv3QkOMJXOAK29bGJZz7yz6DEF/xKuM9KD74FlUiMQGjy+ysIbBT4FoBrtRzTg7DI4/D3fT+jKz25/8HeBDjqAr+Gn8SrW7z8gefGXw==; 5:GhdDK3RltBdkMKJcUYpP8XhklcR9uTy5DZgUW8K7th4BmhK0Iko8ZVFXHdJPMOXD0CuWbyG0J4XcRJEFo5Gd90fpg64lOcgIrj3mNevei9OuutJvM2U/9YyVsoJjQbLOwUUebxRttY4ZMWEmysh0Ig==; 24:X2RalOCP6MycvE6zil0jsvnoXyVcKqErJCKH/yFlJGqMwWzlA/cgg43tTQwUCffn8po9sPpgXRGoipICm0KCpHYpYYYYGjaJAF2wWXplCmM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3070; 7:lbWT87e/b88NFqtkzI8Zb001ni0yuSeyBntRK36UW1wzcbYNYfz9iVqy04e0v0AdGKyWIHhjcFKJQwnZONApTLiX/MO5kjZlaj7pGdv1xzg1xa/98MFbDSaWG3P2pmebBHHB3fnR1PiXjr8V7p59lvFHmNZ63h0HvxVK+NxehAu10wXVXt31TqughgtnuhGwo/HwrSlGPcoXF0JD/sVYw/m3507tNgWjtY+SfvRvD89WrdZu9DvlIn+K2Oa5SaTAUbVGSwB4iN35Dk9v7vKU7YE4yvUYqFVzZTOvdvFZhlGDQdN0+Kh5cf0EeQEGPUuMIbgs21/AoQ0fggo7jSI0Tw== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 May 2017 11:10:56.2164 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB3070 Subject: [dpdk-dev] [RFC 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: Wed, 31 May 2017 11:11:01 -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 change, it is not mandatory to issue FLR by PMD's during init and close. Signed-off-by: Shijith Thotton --- lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 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..5bc58d2 100644 --- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c @@ -170,6 +170,34 @@ struct rte_uio_pci_dev { return IRQ_HANDLED; } +/** + * This gets called while opening uio device file. It clears any previous state + * associated with the pci device. + */ +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; + + /* reset the pci device */ + pci_reset_function(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; + + /* try to reset the pci device */ + 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 +400,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