From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0056.outbound.protection.outlook.com [104.47.41.56]) by dpdk.org (Postfix) with ESMTP id A249F567F for ; Mon, 23 Jan 2017 13:00:51 +0100 (CET) Received: from BN3PR0301CA0063.namprd03.prod.outlook.com (10.160.152.159) by DM5PR03MB2473.namprd03.prod.outlook.com (10.168.233.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.860.13; Mon, 23 Jan 2017 12:00:50 +0000 Received: from BN1BFFO11FD041.protection.gbl (2a01:111:f400:7c10::1:191) by BN3PR0301CA0063.outlook.office365.com (2a01:111:e400:401e::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.860.13 via Frontend Transport; Mon, 23 Jan 2017 12:00:50 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com;nxp.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD041.mail.protection.outlook.com (10.58.144.104) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.803.8 via Frontend Transport; Mon, 23 Jan 2017 12:00:49 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v0NC07eZ019311; Mon, 23 Jan 2017 05:00:46 -0700 From: Hemant Agrawal To: CC: , , , , , , Hemant Agrawal Date: Mon, 23 Jan 2017 17:29:41 +0530 Message-ID: <1485172803-17288-12-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1485172803-17288-1-git-send-email-hemant.agrawal@nxp.com> References: <1484832240-2048-1-git-send-email-hemant.agrawal@nxp.com> <1485172803-17288-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131296464500110690; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(7916002)(39410400002)(39400400002)(39850400002)(39840400002)(39860400002)(39380400002)(39450400003)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(6916009)(2950100002)(50986999)(110136003)(76176999)(33646002)(4326007)(47776003)(575784001)(2906002)(86362001)(6666003)(38730400001)(77096006)(92566002)(189998001)(356003)(104016004)(5003940100001)(8656002)(54906002)(68736007)(50466002)(48376002)(626004)(5660300001)(36756003)(8676002)(81166006)(81156014)(8936002)(50226002)(97736004)(305945005)(53936002)(2351001)(106466001)(105606002)(85426001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB2473; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD041; 1:wjzKRV87BhixH0fEI+h1pPMvGQJuRKU7fOaY1zGHCisuReMsiI2FxUQFCgQ7ajKTsC6Ocu8sBf7EGSmt24x0oN0/rZz6qOk0Z3XBlHOI+Ja5pGMbQkUpO9PpF9syCu6OtVhD85uoODrH0nIak314/MvNukGrSrPlV6gzmaZn6mA8YI5O+5JpQ2dH8DVe4EIFrrpSeBLMH3yluLOcyc8hCptllkZ6jwCc2Aa8whHWKuz3gbvljFsM3vfmsJFpd8Vc6RSlUt+a5UzVKwlq/8QOgnfdd3plqVXR7S+Nh0dxcegUPFwjBEXBwQR4Y6P54xRzfdNz/cedcXK2Ww1zar2x3jLZZ04NyddOazgSZz1qYiHx+fqI0MSb2n5sKDOTDV6zHsHo83S1sVddAvMjKRzZnq/BoIkyCXqF5JsBkezpwGTl0IvrzCoCb89GXTiWUI7DOiJczCGz47hSApta9KlojH2s8CxISXtaIYrrN09Ko4SSn/MX2uYDU9LGKYzkSQB4hDQZRW9aaR3WQEH+zS1UcXZJgAn7vXAKVkFcbJMk49CjWWJE3fKBEkDj/ha6R5ZKborqwo8xHPFpCL/mnWtGREENFqCp9FDPHWBnsW6O8i8Xa0QsPHTe6235u9Tk2cnl0L/uhgKCqWnXYijl97y6zGdgOkzlUcgugNegpOngkXYJ6rNNJMhEI+N+sQb95tpbsU90uZo7c4AmxGYC+6N1Ufn92kOrQj/XpJeD6hiiGCWfnQNha7idvFeswNOGQo8r MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: bfc9bab2-aec1-4433-43a9-08d443877923 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:DM5PR03MB2473; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2473; 3:+JqMUPoOcFs6qYzDx3T5mHqHdbZBHs01QI7/Ji8Ml/d5xUtm0uzbTDKipNzN/zwDTQWDh1QIzogofL3zse5F/SI6FZVoGrw/mM9lL1jAE+LVb8VFDXg4hiV3vuRHx0U61XbuRX27y+fMpsdBXmRug5zwthEDjrWO5K0F+rKSLvItITv28G12sEYbYybt9yhN6UyenAPOLz1hmkSh5FA15N4/y/aGH4wx6/Pq0tLPosY8TM7ycX1bYJ4R67JQX/ppKS69xVkSTV7Hc7Zz4+skfvCFYabLnClqHF3hxOAnfm58DnlrG/pMfTLORZRNPtUYThl3LxzH6PQsmI+IvRZMgBSEzxQWnIzuGRv4rwDRTcsi/CVvKplEg4p1q65r9SkE; 25:xBKW3mMIYOsUMGn1N84ozYLDu37OYsnWW0A3W3iaqtEDlw0ArU6hRXb060qyk59il4Ny8IUMwF8M1rb3Hb1SavZWUxywGxJQB/V5CObJI0xiDlI14fGmfsj4VqlceMBg8hWdu+euki9rnDlXFqi4lroiS4u9BiI64WdJG8BSCfnofm4bfDP5c61qVv8kK7Y4wgTZuB5nAVv5FIq1I0rDb2EI6xadkyvkZJPyjzn8qTk4CLWyQmiTK8+UVtAdwFZgKP7IwS0uqxCosWyyGX4jYeR6xTThO7BUYTxmwBh+7M2MAPWJ+Nfl7LrkQZj/LvNKQ7PePkOyeUrvmjweoQR/SyQ1swKE8r33xh1Tu7xGqLkgUjHunL4t/zPqS6uXCHyfN5quXQZ63TAwLe/ddDxs6tzinMVsvajKs38SbFSO9g2G/VlYRPMjBhCjZnp7CZNliUqe/2iZfePTCdDRx9or7Q== X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2473; 31:8EYsOozLGnLCVyU82IZSWKytjkhMC5OLE7/MsZv5v1jBsdvXdM+4SOT7jEDIG5FLOO+JdgrnvyQ8CjVVMZKrltqf/CdV/f1HTKlQcNsEJOVBE9Weh7tnACbHuAQjwUwzG9eVGTocVtgu7ASQJdgf7LZ5OwJnwrzI31t8xy4TCLpyczEgnuIacw/qtvSHePhJACHDbvPKSElTTokRdp6Z6YifDWCWhJaQM5pludHYdHwZfmZ2px5Io0e2BMZI65Fbrgn2r6DeR/jXsoNITA02dA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13023025)(13017025)(13015025)(13024025)(13018025)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6096035)(20161123561025)(20161123559025)(20161123556025)(20161123563025)(20161123565025); SRVR:DM5PR03MB2473; BCL:0; PCL:0; RULEID:(400006); SRVR:DM5PR03MB2473; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2473; 4:G77k3euQuRXOO2ZWmnXCzcqPyLVlAeWKrVjZhSLZ4ZkR5ihiQ3b5tq3/uynKupT8pEkDUPIT6bZ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ata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2473; 7:7MpqRze9mGL01jK6s7weVqswrHtTh3U0E+tICOsjIxMnOtwdN15/oIdzo0UD/blqWnvMXNoz2/nTToLGIsN1WP7gxYxRfvk64zAwZE5feGhy5VZJDQbyuadIT3+7QeCktfLUwvtHCD1QsqKVjlO3b6fCcW4rvOySADRk/uhlbKw703kyqTa/9C/8O0mqhzG4ZNWz4E9OCwV005Ua8oGpDUvGRNPKJmKmVWvnhkVOspwg3/qmGdyzjHJhUGsproCbVrJs1iRshsiaCC4mqrT/ExyTrqWoc420T3LhYs/l09ZJ/KMsqm1Q3bemr1fhOyvlDQTxIvfXM7SpdoTpoPWkLh1GMO509fxrvqDhNHU+E9pZlgWWWIdl/4ykYOJL+11Gr5n3M6MZ1OK4ZbwLj+1d+RQY6O0FWfAovTvZ94N5tMWQ5iGwVzpQuqh6D53NZsmHSGSTpDUppIqYBI/RBCTXZQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2017 12:00:49.6210 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR03MB2473 Subject: [dpdk-dev] [PATCHv6 11/33] bus/fslmc: scan for net and sec devices 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, 23 Jan 2017 12:00:52 -0000 This patch will add support in fslmc vfio process to scan and parse the dpni and dpseci object for net and crypto devices. It will add the scanned devices to the fslmc bus. Signed-off-by: Hemant Agrawal --- drivers/bus/fslmc/fslmc_vfio.c | 63 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c index 73db595..0d4c0a2 100644 --- a/drivers/bus/fslmc/fslmc_vfio.c +++ b/drivers/bus/fslmc/fslmc_vfio.c @@ -210,6 +210,48 @@ static int64_t vfio_map_mcp_obj(struct fslmc_vfio_group *group, char *mcp_obj) return v_addr; } +static inline int +dpaa2_compare_dpaa2_dev(const struct rte_dpaa2_device *dev, + const struct rte_dpaa2_device *dev2) +{ + /*not the same family device */ + if (dev->dev_type != DPAA2_MC_DPNI_DEVID || + dev->dev_type != DPAA2_MC_DPSECI_DEVID) + return -1; + + if (dev->object_id == dev2->object_id) + return 0; + else + return 1; +} + +static void +fslmc_bus_add_device(struct rte_dpaa2_device *dev) +{ + struct rte_fslmc_device_list *dev_l; + + dev_l = &rte_fslmc_bus.device_list; + + /* device is valid, add in list (sorted) */ + if (TAILQ_EMPTY(dev_l)) { + TAILQ_INSERT_TAIL(dev_l, dev, next); + } else { + struct rte_dpaa2_device *dev2; + int ret; + + TAILQ_FOREACH(dev2, dev_l, next) { + ret = dpaa2_compare_dpaa2_dev(dev, dev2); + if (ret <= 0) + continue; + + TAILQ_INSERT_BEFORE(dev2, dev, next); + return; + } + + TAILQ_INSERT_TAIL(dev_l, dev, next); + } +} + /* Following function shall fetch total available list of MC devices * from VFIO container & populate private list of devices and other * data structures @@ -218,7 +260,7 @@ int fslmc_vfio_process_group(void) { struct fslmc_vfio_device *vdev; struct vfio_device_info device_info = { .argsz = sizeof(device_info) }; - char *temp_obj, *object_type __rte_unused, *mcp_obj, *dev_name; + char *temp_obj, *object_type, *mcp_obj, *dev_name; int32_t object_id, i, dev_fd; DIR *d; struct dirent *dir; @@ -348,6 +390,25 @@ int fslmc_vfio_process_group(void) FSLMC_VFIO_LOG(ERR, "DPAA2 VFIO_DEVICE_GET_INFO fail"); goto FAILURE; } + if (!strcmp(object_type, "dpni") || + !strcmp(object_type, "dpseci")) { + struct rte_dpaa2_device *dev; + + dev = malloc(sizeof(struct rte_dpaa2_device)); + if (dev == NULL) + return -1; + + memset(dev, 0, sizeof(*dev)); + /* store hw_id of dpni/dpseci device */ + dev->object_id = object_id; + dev->dev_type = (strcmp(object_type, "dpseci")) ? + DPAA2_MC_DPNI_DEVID : DPAA2_MC_DPSECI_DEVID; + + FSLMC_VFIO_LOG(DEBUG, "DPAA2: Added [%s-%d]\n", + object_type, object_id); + + fslmc_bus_add_device(dev); + } } closedir(d); -- 1.9.1