From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0089.outbound.protection.outlook.com [104.47.32.89]) by dpdk.org (Postfix) with ESMTP id 2C9062BB8 for ; Thu, 8 Jun 2017 13:44:41 +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=SsZb7hQgm+cuAV74nIbmBfz+QB0MCGvG2uXUJlE6kKE=; b=jc2obVOrRW/VTF8UM/5ASa2nEPhsL0UbxOIR4dU7jCB+aIkUNnkN7yTpuvg0DBWsDu5VyM1AZIQ+ouTHLMAXold3WXKAYLyCqaxv0XUBzy0dFXaUalPAN6JBmgtwliO9U7QN7lvfUkftogw8f5EZ2lnqONGoGLKR6IdJBFLq2mI= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=caviumnetworks.com; Received: from jerin.domain.name (111.93.218.67) by BY1PR0701MB1721.namprd07.prod.outlook.com (10.162.111.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1143.10; Thu, 8 Jun 2017 11:44:36 +0000 From: Jerin Jacob To: dev@dpdk.org Cc: thomas@monjalon.net, ferruh.yigit@intel.com, Jerin Jacob Date: Thu, 8 Jun 2017 17:14:13 +0530 Message-Id: <20170608114414.8787-1-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20170601130530.11443-1-jerin.jacob@caviumnetworks.com> References: <20170601130530.11443-1-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MA1PR01CA0073.INDPRD01.PROD.OUTLOOK.COM (10.174.56.13) To BY1PR0701MB1721.namprd07.prod.outlook.com (10.162.111.140) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY1PR0701MB1721: X-MS-Office365-Filtering-Correlation-Id: c5fc1e50-86cd-4de3-1b96-08d4ae63be8b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:BY1PR0701MB1721; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1721; 3:rSDGmhkNh+yRu2ozSD3VtL5LmIFNInShkFqZMMCptDCZoXeQOkCSwo4QV7w3ZCdnYUOpLsGPrNuqqIzcrIQb2uCyfNmXSRuvWN4tlkbRUXzB59xVUGWtIcnT7vY7KdQAcFr6YlgLXqRX2EokN36JxJiqPfGSOpKekTcoh1oT5IYZuTiUnjpeQ+v7af8ZOKmMcX/KewrcA6H2u2jthnUXwuH71Q3WLWGAN4WxLBq1y1QYuaEbnGMeHiQQAKZSkiI/fWNw2prg50mfSQ2xA1okkzb4neMA5AlHj3FvgWEXVd2wOHgdPGg+eVR0Wkv576mZFbRfBQsim3IDRDVMfVTtxg==; 25:eKWihvbp5xQgRi6sBGvCxEJ1ypbr9Xhieh7wLuYVSrYHZ447ixYRse9SCPB+1NlazBPvl9et4xNnpvY9fRleYfO4w0GLM6MpmVITJGVccqZ4VcET160kjEb6Zq0hbsHtg/VwCnm1sNh8r9+GvoczifzskBva45vqLTGDDm7ibyAS2hviHI9k+ENG2dPuih2pHlnWrAVUijgBz+lM7BNMkgvmg5KNc8PL7bnVH4cQdJg6nygThFgyHigjW98mkMFgVm83X5btJkby60yyYJRKHUycxHx90HMh8IBiw8PVP1XqHjXGFPR6DYMNN6kRvWWPwo5Z8XTCwGDJoHApp4SpNJB76rmrC4gqVphHwgPEqhkyXrklwe4NghGlagDdU/aAGY5j6CCZyLXTkr0Jys+BHQ5Dkvt932WmkTLTdajcE2mfAVwYMU0Qd6YVZs1OS7u2iBF3FGrQdi1Y7A0ODyOtYqLMCucBW4W++mIK+ZX0xTs= X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1721; 31:/3iFlV8pT4vLVFdx8ONua+wEr/p1GzSv/0nzTH+Hl1/QMxJXzcbjiOX6ktxu4v6Arkz9tI02L9GGLsVSz8VTZ0KrrlZo1WhSI4f7OuyxZoRjeq3WxVQq0tHPhz/t1aHeL2xarWrJExm49AJRTJ/cA6P0muzwjVlbD/Q9OHBLoCKLwlR0qD8M3IwDOhhe5yrWwGL7gt1WAAGdUtO5R4AVa5HdwasfrMYn9yk5VB0a/0o=; 20:8g00H+Zb2HrsUQVDfQJxZQBDDW1HM4HutnW+W5iFZXGv92rs1HXSQUEGURIvxd8pDy1ffVxTVJ3rl/WzsPQoRWS2Pb86zSUE3NYfWMhpZfdESE6RS5c00KewdDaRt/3X0MCwEOew+X42x9KXUKir/Mq0PhBR8WqM9O/ZinVgtjFYvs+7Uk1Hg1wDq11Hiaj+wotoTgu7uB/f12nrHPnwNtyT/X3VHY+4pAYudqz0zNsVIbZsxbwFSs7vOTEnlb3/mhT3qjDjlcj4kqcsRnuFEd2ci3JsqjqPGNjQcxkJRoYM8aP5qYJ9lc976Vp2MW8SjQFGZjIgnhvDezeHDmyu+jd3RGSmYPv27PX6DuqzXwFKCQd6LlXhY3+q0tgTKZiyGqpfXe4FEeXVFvlSRRc8dpq/PkJj8uUlDfx5cPmrpwp853okAjPl7WgZve2GPB3k+r/YYgEKcJEwDD6qJYZYua0tBsZzSEUaFuuQzxbiorONruwi1wn0unR9fBL+wKGRpkxoCQIUYn+i2qllPrKLiShUny9UBFEuX86hgLcX0Et+tfSUIYYUd4FEC52QyD+ntXAx6nVohPZiAP2k2SQkO+E7D/npgRfXaDqYcu/7XiA= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(6041248)(20161123564025)(20161123560025)(20161123555025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY1PR0701MB1721; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY1PR0701MB1721; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR0701MB1721; 4:RwNfRhzU326r/koyRx2tD6LizFnM+WX8udoO4hra?= =?us-ascii?Q?+ZubKTh40qfUO9fw0FgfsM7pFivzLZECHcY4ByeZqsJct7J03g34zQTfhgqa?= =?us-ascii?Q?rOlrfNYAFCb+p9ouF8Mq33dcZ6KLsFdsdnFHgQ59vP3zltSeb9n1rlLOgMeJ?= =?us-ascii?Q?+l8wA96HDMi+IZ5ilQoc+zcrnS4+d1hACE0nBC3YdHsAs2XgeX6AMmNlX+1i?= =?us-ascii?Q?ypIV6jAuZshMz6lWWno3ZxKIyNAbd+F4IfrAfszoFpl3mRMyyn1ieeQTrIj0?= =?us-ascii?Q?tWUQqiSWldLfyPXdbcvu7g5TrqrtbuxzzcNLVZZmcr3YffBPJWnlVchRGs/a?= =?us-ascii?Q?bxnHkkkEJ1+qeWFP4p4QS7aRog/35reBQFXTDmQ3NHtKBi08ktZ+Sduph9OX?= =?us-ascii?Q?bwZvAq6yuSQLV+YAJ/BVDw2kQzGZLkjVMxLtPBJL3u585fA1HVVM/S3wk0hC?= =?us-ascii?Q?DJ7/gFACmkHiBUDIqzUq6IvjnztlrBsO9h4UFJvtu7LPMf6ACgi30mblok4f?= =?us-ascii?Q?kavsU7JpDvwdvzcm8hIC/t/q8P5F5ftrgtJQk/f4BJq9efqQMaFaXbXLHrlS?= =?us-ascii?Q?yyvZXcrgELPKUEfwVNP6E4+t8jPBhxUUarMa+LPhQQFcfpNHWl+zDe5pgXjx?= =?us-ascii?Q?pVHc/atssQ+hGRmz9Xq780lc/wVESWojiafjfz0haXCuaxd1T7eXBn1btajh?= =?us-ascii?Q?MwTVixlyx8LCqOHT3It95cGFhImLHBLVxxee1PbkFHshhq6x9drJvSL4WWoo?= =?us-ascii?Q?PiHd4bvM7AOfwCAtv8+fwleg1MtXJDwRVwRba0L1Jf14hGokWIIogmHXuSaN?= =?us-ascii?Q?+KE2wwXrHcjIZFgx2Y5os2nRjD5UKceC48NeDBM59LfWehxhrU8iBFj89BII?= =?us-ascii?Q?6w5xoZDfHABMqgaERz94d1024Ys6P+dxLag8AT3MtXSHypZtED8G6Ume2/Mu?= =?us-ascii?Q?OMPc32U0toiXxNqof5osDgpTTCp2D8AAj8dVp9h5QQlt1AYo3XoZ9uoA4MMJ?= =?us-ascii?Q?hwIWxX44YkHjQmS3o1qwyaTusx1TL4HwCSDjz3dcu1zSXTEHjUMkTmmswSwq?= =?us-ascii?Q?VNOEPivxFvctTgGNyOGeszITJFzs+gLy0118DNF4YjPyrPZW4afiNjAcZLww?= =?us-ascii?Q?zWxHNKw50+k=3D?= X-Forefront-PRVS: 0332AACBC3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39450400003)(39840400002)(39850400002)(39410400002)(39400400002)(72206003)(2906002)(5660300001)(5003940100001)(42186005)(53416004)(50226002)(8676002)(305945005)(2351001)(2361001)(81166006)(966005)(3846002)(7736002)(33646002)(25786009)(4326008)(2950100002)(6916009)(42882006)(189998001)(6666003)(1076002)(5009440100003)(66066001)(47776003)(478600001)(6512007)(110136004)(6306002)(53376002)(38730400002)(107886003)(36756003)(53936002)(76176999)(6506006)(48376002)(50986999)(6486002); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0701MB1721; H:jerin.domain.name; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR0701MB1721; 23:vkY06lCLSwx6WGKiOgQSTXd5IinIbnqWkY91TAJ?= =?us-ascii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dAgr2Ht3cr8gS3jGq43Yr6ythXkGMbS1bzSnR0q/Eh8NXL7sGLkDRu40iS6Egz0d5Fw6y2C+z/oYWeIiIo83efmf3SRK/6FUqICdHzvbJU4CwlcUIzAploMuRKvfsGwXHLwO0TWe2Dn53qakFoWMPXWR0xuc4KvPw8+5NaBw4MQYLokVRYWylYF5PBv0F89l4JP/vQR3mhh+eDd44znjrFbCQPC9Xng9ErvdwHIs5wrfrT8ut0hfPjl3w3WbSSplYU7joxlfk0aDj+qqNnSRbQOjhhCAlzB9A9Sogim1EmTiaBJXRuLUdWjP5mV1pE0jVg2N8toFwJ8pDGDvGTP0miRmwDGs8SoaYBI/Nfxce2jjRJbbNgpl5ZHP09WCP089ksKBxwA7pRyjB0I6VLqUj; 24:5TDMhAOyhE2uiPjoXP+RkbNOjJMUyN5Wxkvz8L8+oTLTBYKB32QFg0Vg5yCKmSeuZDI3blF/SB0Swrew7gt2+ChcdEVFDokIWYbrmMfxtQY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1721; 7:ovZTzmbsEvj9q3NjikjMRyHetuxu4hE3IAzjQ1KW2qaMj0BoPeRLT/xpEVPtPTV4tClMLwf8rzXnVVTC5b1VY7TlDiaPNUtr4Z7uh3QtObONXmV84PXCHCIOn3DHVwxEvcfxnwy5Btvwl7dvBzmxC/eJF6opc65A7Km5e0FMea+m4zQWQy3m6fo8K6fPkleZMzrejZSJWz9DRwadkDiBR0EtDHehcdwzvLFMGsTQK03qUjy2ItmgX7HMYxbEHbP2+OE8TXbNjZdMOrUqlLicgmlkCeDSvGBLz+8W5dswM3wzYCf6tN1QwYfa9eIKH6aiXXBDzE+Tamby2PdJ8aF/ow== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2017 11:44:36.9896 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1721 Subject: [dpdk-dev] [PATCH v2 1/2] eal/pci: introduce a PCI driver flag 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: Thu, 08 Jun 2017 11:44:41 -0000 Some ethdev devices like nicvf thunderx PMD need special treatment for Secondary queue set(SQS) PCIe VF devices, where, it expects to not unmap or free the memory without registering the ethdev subsystem. Introducing a new RTE_PCI_DRV_KEEP_MAPPED_RES PCI driver flag to request PCI subsystem to not unmap the mapped PCI resources(PCI BAR address) if unsupported device detected. Signed-off-by: Jerin Jacob --- v2: Introduced RTE_PCI_DRV_KEEP_MAPPED_RES flag scheme(Ferruh), Based on the discussion in the following thread. http://dpdk.org/ml/archives/dev/2017-June/067091.htmlRTE_PCI_DRV_KEEP_MAPPED_RES --- lib/librte_eal/common/eal_common_pci.c | 19 +++++++++++++++---- lib/librte_eal/common/include/rte_pci.h | 2 ++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c index 5ae520186..0d4e4a9f1 100644 --- a/lib/librte_eal/common/eal_common_pci.c +++ b/lib/librte_eal/common/eal_common_pci.c @@ -221,7 +221,12 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr, ret = dr->probe(dr, dev); if (ret) { dev->driver = NULL; - if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) + if ((dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) && + /* Don't unmap if device is unsupported and + * driver needs mapped resources. + */ + !(ret > 0 && + (dr->drv_flags & RTE_PCI_DRV_KEEP_MAPPED_RES))) rte_pci_unmap_device(dev); } @@ -235,6 +240,7 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr, static int rte_pci_detach_dev(struct rte_pci_device *dev) { + int ret = 0; struct rte_pci_addr *loc; struct rte_pci_driver *dr; @@ -251,13 +257,18 @@ rte_pci_detach_dev(struct rte_pci_device *dev) RTE_LOG(DEBUG, EAL, " remove driver: %x:%x %s\n", dev->id.vendor_id, dev->id.device_id, dr->driver.name); - if (dr->remove && (dr->remove(dev) < 0)) - return -1; /* negative value is an error */ + if (dr->remove) { + ret = dr->remove(dev); + if (ret < 0) + return -1; /* negative value is an error */ + } /* clear driver structure */ dev->driver = NULL; - if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) + if ((dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) && + /* Don't unmap if dev is unsupported and it needs mapped resources */ + !(ret > 0 && (dr->drv_flags & RTE_PCI_DRV_KEEP_MAPPED_RES))) /* unmap resources for devices that use igb_uio */ rte_pci_unmap_device(dev); diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h index b82ab9e79..0284a6208 100644 --- a/lib/librte_eal/common/include/rte_pci.h +++ b/lib/librte_eal/common/include/rte_pci.h @@ -212,6 +212,8 @@ struct rte_pci_bus { #define RTE_PCI_DRV_INTR_LSC 0x0008 /** Device driver supports device removal interrupt */ #define RTE_PCI_DRV_INTR_RMV 0x0010 +/** Device driver needs to keep mapped resources if unsupported dev detected */ +#define RTE_PCI_DRV_KEEP_MAPPED_RES 0x0020 /** * A structure describing a PCI mapping. -- 2.13.1