From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0041.outbound.protection.outlook.com [104.47.33.41]) by dpdk.org (Postfix) with ESMTP id 2173B37B0 for ; Fri, 3 Mar 2017 08:13:44 +0100 (CET) Received: from BN6PR03CA0042.namprd03.prod.outlook.com (10.175.124.28) by DM5PR03MB2954.namprd03.prod.outlook.com (10.175.106.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12; Fri, 3 Mar 2017 07:13:40 +0000 Received: from BN1AFFO11FD031.protection.gbl (2a01:111:f400:7c10::126) by BN6PR03CA0042.outlook.office365.com (2603:10b6:404:10c::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12 via Frontend Transport; Fri, 3 Mar 2017 07:13:40 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; caviumnetworks.com; dkim=none (message not signed) header.d=none; caviumnetworks.com; dmarc=fail action=none header.from=nxp.com; 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 BN1AFFO11FD031.mail.protection.outlook.com (10.58.52.185) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.933.11 via Frontend Transport; Fri, 3 Mar 2017 07:13:40 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v237D50D005035; Fri, 3 Mar 2017 00:13:37 -0700 From: Hemant Agrawal To: CC: , , , , , Date: Fri, 3 Mar 2017 18:16:27 +0530 Message-ID: <1488545223-25739-11-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1488545223-25739-1-git-send-email-hemant.agrawal@nxp.com> References: <1487205586-6785-1-git-send-email-hemant.agrawal@nxp.com> <1488545223-25739-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131329988207043545; (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)(39400400002)(39450400003)(39860400002)(39410400002)(39840400002)(39380400002)(39850400002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(9170700003)(76176999)(305945005)(53936002)(38730400002)(47776003)(92566002)(48376002)(50986999)(110136004)(8676002)(50466002)(36756003)(81166006)(50226002)(105606002)(8936002)(2906002)(2351001)(106466001)(33646002)(626004)(86362001)(356003)(189998001)(2950100002)(54906002)(6916009)(6666003)(77096006)(104016004)(85426001)(5003940100001)(4326008)(8656002)(5660300001)(575784001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB2954; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; A:1; MX:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD031; 1:qQhMIYdRF0qaY3lydimDUfc/06AjT8VXPBTKIARbLKiIJ/5wlq7H+Dw+famwKZMxz9EsVrZAD0Qxd7DRWobh1ftnpnzJB7lj6lz2jxOx8m+1YtBIfMa9ATJa1dnacgzEJyZFDxkqIoGtWEBp8A0zTGjT6wJLLaco0pnXrJoUFTvp9mEdB875RU8QhedYVBfUYOl5QC8xGA4ZWFcXsYe12bbGAsecMhEAMhdK/374zsKTlf7RVkqAGuFA0iv61DjHHeu/eL0Pppq3LtqtfsuJwO5L9Lw+ibkp564EN+EUlhBtWYqnK4syiIa5ZGqfzgPbX8WFGEWAVibfO4n06v7YCWYYLE66blfwPvxDg4wQB5bwwQX49mxW/TGWP2SRsDVDen5M2NldJEJ66ksC890ympppBLi6nq8TDEOI8IFxbO34osUPW8AP9UNRJAtb1eFGITl98xa7XJlBqbct2S/VuDsVuRGxBfgYo/X73DRpNO+g7iNNu5/yHM6ixhOKFpeiyg/O9zPHeL329YaTRyKzHDMws4qlvRZtv84HOQuxenPs+sQXPZm2rn/s6uHEGMKCp+mFrVw0HXMuwix4ydAtR4+7QBzitaW+mpDx4QzKFLSJbCuBvUXA20Jr4SavS7B60EF6AaJPGHpo6DggBdDFYw== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: e83190dc-2649-4aa8-e3d9-08d46204d1e6 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:DM5PR03MB2954; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2954; 3:yUeMZmP9ZeNsvfBkrMRUQk8/THgSHSrnZHzOo7GFsNdfGQ+aALjR9AfEI6lv+/b2XkudcggtuSGaUmAIwJ+8cfmO/sWl3f3C9dS01zfXvy/scy2EgDMiaWm7o6LwdLNJFO48i+O8z5cBihhjRnnNpGwIwTbGRVzlGqumHKMo4PkouANwyIdhVkQgbS1fz0wyD7D8GRsV1uhidK6wyG5aOBFCfKZZv+pa9tyOIY5IFk1bMOPvY/gYnH8Wii7DsiieRrxKDlyIPUBq6rZAbAmv18Rn2w4LQVjLN8zgtexRmFOfwywVV0JhHHgIJ9ECkLK7KnclJAj/Cm4tNi9f/NJNb35VfI0lLLP9m2XQQ0D6rMBowpt6LtS8a80qlCLS0flJ; 25:5vhg5IGAY/n/R3X3+jtI07NYKmoTpHvJLXPBvGai3t0kXRRGN/UIlEUlF/xReFoeVWWMQI61e2fb+YXmKjR3JLbVSJxzMyym/O9ghB6H2Sta5E6qinRE07rrdpeC4+yeV6OGFQAIPdluZGiI0Oe7sudFdKf6+AsHD4DXb3CRVkwoTtdmBLDaTqR008BT9kAsOmF9bgLEpSXVbLRqjHDx995IZEirEEUqB6fSS8ssxo/w6caZgxiDvezGv6hUFiw3ruWSg9l5W9xFvZeJDWe3J8h8qhcsbxOI5JNQGncpeVmVGmF0pfqBzwveWWlPOFw6ti0j3YQUBlrKaemabyouun6incddRlu2/rxMeh5Fu3G0/HjAxHVW9LBB7OpSAx4GS/mQI6koYSxWk1Tlxdl/ShobV92MHn/+SLjJo0lNIBxjLcTnDAtZNlxvrtRWyMs/ X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2954; 31:yRQaICXcqsSY48Z+QmVu0nsw/YuA7LXTGbhipu6lRM/s4Usi5ngMc1ZIl+UmJW5G5yZL8GggJvkk8X6wAzhHKCow/etGHN6Lr9HRQ8h3PFtrke95NCgxP/Jur98AWYDMVNzLJf3t8DWeBGRXQy75VCSno1Ko4uYC2RVE8UWm1HsYudISGJ8BtgxY1rE+kw43OKmv3Sy0g4uwHH+SEZFRm4hMv8S04dYvBz6de5+miX0+EcCt1oaiQNzZ8L1kVZNg 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)(5005006)(8121501046)(13018025)(13015025)(13017025)(13023025)(13024025)(10201501046)(3002001)(6055026)(6096035)(20161123559025)(20161123565025)(20161123556025)(20161123563025)(20161123561025); SRVR:DM5PR03MB2954; BCL:0; PCL:0; RULEID:(400006); SRVR:DM5PR03MB2954; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2954; 4:haHg4PGtyywaRF78OAMRKLPN3WkAuvw5OVaiozUDYvv5jQgzB/DW2Q1gHXoiervrtXAfMMluwIdHVICen5KXqXBP4Wb7JyVdGuoWq5bGZIKWYvNYXFTc2uZEdXifbf2vOQiSdozn8yV6EBEwa5C76Y0v9QOFLXWbWWorqNK68MGKAg6P/7bIZV9fjxo6TIfCZRrPKg//45lKp6yrQ7JOs4eRZ4ApzeztAyqRs/TSEgcEg4i//yNyfcjTESQlet7+t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= =?us-ascii?B?Zz09?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2954; 6:baUk6yIVCEAa4TtSY2EdBoJSs9FgsJLukL2f49k+ObVBZKbkcFrU+Tx+WZwMl0NHXi3NK4Pi1jM90APJlQpYdVrH4oczb5lDwNTfz9PIN+o7HLwDcyA4eMZRVA9CURghdB0IgKj43q8SkDq8+0EOBH2Jnmk+BcRIg+JqNdyBNu3Eg+TaiM8Q0jlqxgpSF4K809v0IashuBvQkQ5VVtISl3Ns5qxMklj0Q5WGeqIgvD6Fn4C3koET6BNK4av1VpktBwW1ceG4YmJWhdgIURbfsDHp4ra1u5MewRRLlVYd4yOPyQ5QFvLNEwigrCZiJ8epatsa05k3vkw0STY5TUCF9I57AlSeSMDLIOUY5M/ace0CyeXxgsE/UG0RCiy7DbiMJQepr+AXj2/3kHaiwC2urxH1h56rdUR9es7Y5E9oT0s=; 5:GQRaok8hFYLjVtbn1EJjbwRkrKfI4tZ2WjBUftDH67ayZgjCiOc2icUIwFR8tWAIywyE7KfuNAPBzoTfJBKSwt7gOshttmU7jvVR36rgIRgVybBzOEl//wTHWpPInTx0A16H6mzEHBKj/P6wGtq7mFFT0TFnJ6kAgMqDO6Ys7imOoyFhO83mx+Si2Mi48PAP; 24:AtxrRjoxd9h3P32+E+F4gKzoP8j0UXd8CUOXCyh7ljVAkrGGqP+mPoVZYpmn2tdLrO8aUNnMJUoZj6f4dJEdWyc6AJ8RZgQRzGUg+rF1EmE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2954; 7:9+pMF060xQQ/pd5TnxsZbioq1eeidNcudznZmmmxBEHm9aPOAY4CU9SeZcmw161venLeli6H8q3TWEAf9I9666oOnzDCA+kUOpUs4aNOXm48JseALGwwz/PLZbc1zyPId3Qe91GeyottLz0nFmrM2/zYhQWRT+ufcGFnwCV7wnk7OrD65QJaUHoW9o4UHXk32QNkm3b/qZzEXQZZgExbbvYAh/mgQU8KOwlySNM/4rt14qw5toMXXwo7C1hRsUY6QpUiohgWeArE1jofahHbiga08tKEIdHwlhut832VL2PNsbHJb1RSlJ92h2AA+VVdHmsMSJH7eqHi6Y4oBO96oA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2017 07:13:40.5171 (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: DM5PR03MB2954 Subject: [dpdk-dev] [PATCHv8 10/46] bus/fslmc: scan for net and sec device 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: Fri, 03 Mar 2017 07:13:44 -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