From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0071.outbound.protection.outlook.com [104.47.32.71]) by dpdk.org (Postfix) with ESMTP id 250966936 for ; Thu, 27 Oct 2016 17:18:19 +0200 (CEST) Received: from BN6PR03CA0013.namprd03.prod.outlook.com (10.168.230.151) by SN1PR0301MB1629.namprd03.prod.outlook.com (10.162.130.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.12; Thu, 27 Oct 2016 15:18:17 +0000 Received: from BL2FFO11FD058.protection.gbl (2a01:111:f400:7c09::114) by BN6PR03CA0013.outlook.office365.com (2603:10b6:404:23::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.16 via Frontend Transport; Thu, 27 Oct 2016 15:18:17 +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 BL2FFO11FD058.mail.protection.outlook.com (10.173.161.126) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.679.5 via Frontend Transport; Thu, 27 Oct 2016 15:18:17 +0000 Received: from Tophie.ap.freescale.net ([10.232.14.87]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u9RFGIfp027183; Thu, 27 Oct 2016 08:18:14 -0700 From: Shreyansh Jain To: Date: Thu, 27 Oct 2016 20:47:47 +0530 Message-ID: <1477581467-12588-22-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477581467-12588-1-git-send-email-shreyansh.jain@nxp.com> References: <1477310380-17944-1-git-send-email-shreyansh.jain@nxp.com> <1477581467-12588-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131220550977948941; (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)(7916002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(50986999)(50466002)(19580405001)(48376002)(87936001)(19580395003)(2906002)(47776003)(106466001)(8676002)(2950100002)(6916009)(92566002)(85426001)(77096005)(2351001)(105606002)(229853001)(5890100001)(626004)(5660300001)(36756003)(6666003)(110136003)(33646002)(68736007)(11100500001)(81156014)(97736004)(86362001)(575784001)(104016004)(305945005)(356003)(8936002)(81166006)(8666005)(4326007)(50226002)(7846002)(76176999)(189998001)(586003)(5003940100001)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR0301MB1629; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD058; 1:wi5yS4JdYiK/GUrzzZqjcWyb9MgwJ51cccFm1FIohV9hj5HhLYMWBpBvSEVflRwalxWRYYr5BAyNJE78u04HL5DduxNqpqOoGBK2oxMSbrQXlo2orqqegYY8koyLbTt5kqYjJarTF8Za8P2FPPp1w8rK4g5w2L+8Y4TKDqKCeimqxDYelA0xiyPTf0vBxikMLgJYR+3zHy3PRd7GDun3do0ynQQU/gElXKv36HrXMsTNhc3Uk/EKFcd4gLmySWnUxfRLAkDTQLj+Rlc3RZv9yjEu4GZf0g1yv8Ms8vm1+OV6ceI17Bza8ZWtC9IFeddD+hghhRWQ7OvOcxrtLHPe5A9TquhF6Io+nVE6Vlq3aonIOMCMi1wuwzJJM1Hznmm5b7wNClwlyHUZTsCGkDUzUBjsIYbq26I6grav2Y32X3oCNKha6uOCkOxQQBzRGkxx8w5+XgClqZ6PwgMp8xcp2nhDI7xKVBfLJTGszg3iWPybXYoggDqutB9x8tIfMeJ7RTRathzxdq/vkvqP+Pqy49h/jitG8ZenD3E9AwIBo30SdT0RmXICSIzAiEVAj/kRZR38IBV0Xt2A3GpFgd26Xe8vTqyKVqnuGRByx2g/vKigMckDSaZ8zcv/rLhIaf9Ke14yfJgqfS0KkTMvOZDGmYb44NB37YQZYKoemIdzKX97ACdab1njnsLY/AGUN2lIYXUh1wn2aw4CYoc6SlhZhEupfoBapTkz27ApD/AA2KI= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: dccf6bc8-2443-4967-2bac-08d3fe7c7aba X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB1629; 2:VWHE0s2gOZTjQVFZlFx/1NdH81b1CTPGgighNtgJfQTzjsvU3fPF3stzN5lYZ/0f8QufLb8I2BDXVoaVbGOskchIDMaLcnuykxmdC84CU+kcMU/GfJI9ohcvRH96R982DcNTiKHhatVjO6sSDNzYzX3KsoGQ0XIOVFDLLl/WdH2cMdXV6Wf66dLfz79b4hLgLD8Kbv06ijuMjbcvXlEdkA==; 3:WcZ/eU9iCR7jhIb1LOFZ5pUyiCUcYaNi4ekjkwcMOBNPUnC4LXUEN6vPka+1EbJtsSZiYCxKsGw/aNrlGIBEb5Ny1X03XpHB4ImKKpHF/UYtyAo+lh9dkgw/pzkJ1moxUQx3cP7/xtQnjneyg5U+bZMNTG6lmEbQKekbeOBOFrbI3Z95amM3j1oaB8C3tgJeIF+Ue8UQ/nGE+l69jywzo7iEMEF5p/OoWUAKh0vPdRB20RRE498ZjJQyVBAg+ZjD X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR0301MB1629; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB1629; 25:tKSWy9pB0j7J6sEBKGMe0+cSu8tYszWXgTkZ5+fUwsTVo41P+JdEYrK0nbSF+dp367wQKxGb+c0vrxSgzj/Y6r13KgJuqSnMpP2jdvvyGwQMMm/zsOs6bDvrpaxGkq5Y94uR4oqgVpUoqYp2z0H5OUjabXwMS6DCBPfk3JRlWwsi2TjFb509EKeRvuv9U9OdtpIQfVxmFN8XgbulTN1E7s1Vjdr2kOT5BGc6bcVXYKdTBG1ajM6RCtwMel54YbjS5NUmFBh+GlY2p9ixqkeCd9ceF8bH1S97Rt7YzwTJcx6FjQtLhS+xjKjTG7lMiP58Iq/zvf5tHZLXDpyW+uHr2go2yGQpqA3k2398Pyaxhnz6W5hq8jyV0OHItAae8trRNjHmSXGCeSxkNMjLKL9IJp4WWCzepnWw6icGdgJ+8pYqKYZxW8DdW1mOlWR/m32q2UnU0t1mgA1DNXPjp0E0BWzevqdOmCdghWVKdHf00KX4mPpZ8QEjoLqR6YDgT2jThVwN114qZAWo7SMxdrrHVXtDxaS9OYoSYieyixDDTmBgrHq7n+c1iF3mNF1lu/baQlGdlmLkh+DjeD73NuDUdhAL9TE2ETkeqdbD4oYYlWm0RXEVZW5QzYsBlIcprdWg5nII+seh/Am+qb5wNC5mGXA3DJg209bexAkuy2V9qfIAQ7qBRn7RdDSnuvtk0Y9yCUm76y2hFPmXouvvHtnDlD2M3Pl+c/ElSrltDv/yY03IDmlBqTvflcCZzus29sbzwh++YNlM2enfJyVv0KwW7F4z/rEiG3AnGCHFe1vzHnk= X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB1629; 31:NySbuBhLbmdZVqGlYAlxy1WcBZP89AFx+nOYlQiVeyVL/J7+VYNnvkyCKiKwwZGO/ZRkF4D22WvXojVZzna7hNWyRrF65qeLmDkQsGQrsqlnh3mtekF9/BLbCCyj4PuIFoJef1lAv+PIctTTfzs2o7vbKhLJZdMHG7/3FrATk4ZvzFcaJp1vkgd+vLQYf59WL+Cjgw8lL4+4+BI3uSJi84FUe2qV0klpdoO6zVris9Jw44mo5pXOKTIQWqVr3Fw8q0TsYYWvA3D9UXBHLNTjNmYcfemO2yTo9HA6qMW65Wg=; 4:Pwk4ai/Ohys3YqYoCh2QNmw0DjzmXBO53kilQnjNQEE3nJB/0GejWdjrtM3tXliQHTuDBDe5DCB8lIWarMLBzFNA5EzL/84B4FWnnveytt8fm0S8jl0jdXcWE1tdQ8BX7kFJPstxb4EmbhQr7f8wprNQe55GvqfDe/meZ4Od+uRATjYsF0Z9t/3h7Tfjm5qVT7mY0s+x3j4z2LGkqnSV7UJd7UIDGtGnS+k7e7qMkW15/h2N6R9pzzuYDZd0g5UxKd2IRyV/WwxfcaCYTVWhCn7N0Lmmect74t1AV83C0zWE8mw6PD9h8TA2oQSgS8ODsLeOTCPsr5UGi0NCsQz0LYaERdVTYbtXjPvbYEWO2xvhAliR4gswJxU0No5hhqgOBrsmav/0t2H+kaCfW99gn8BZdGx2SQmeekug0djJGHAHrmfPadJ2vvCqDgWL1plWe8PNUVuMl53UUJn5iaL66DoJ+A+ynlBvxfE2JeXAZ2025uH4iCoOWiop72Bt8WNBl3oPgq/KRXxN2K4DZ357AUIpoxrzAi87fG4MDLQvK0SqGzwJDWqRFhbZGfTmLMxl X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(13023025)(13024025)(13015025)(13017025)(13018025)(8121501046)(5005006)(3002001)(10201501046)(6055026); SRVR:SN1PR0301MB1629; BCL:0; PCL:0; RULEID:(400006); SRVR:SN1PR0301MB1629; X-Forefront-PRVS: 0108A997B2 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR0301MB1629; 23:SNjKY1tNQOq3VVVMTOv905oiQqOKBgcLAHVmAgj?= =?us-ascii?Q?WdBXU9WJn4VaEY1Mb23sF+i4502khqjcYKa18cHHuibTKZSwbtos+OtaJkBz?= =?us-ascii?Q?k+h+bNQfnWH/UikeCa6FucqEUYBs2oEZHrFYkyo2HYHQN0OSd2dsx7yxbORu?= =?us-ascii?Q?pkAR2g9sphzYODx2u047dCfGwepCI1HRFct9YY2KDO9ORt7ZrypM/X1IXMjo?= =?us-ascii?Q?s3oR+2a0oH0QdFw74LeYosoFSsRAs/axaQVAsdAZY96NHJwRRWzc/CbdpGpr?= =?us-ascii?Q?Au4I5pOMKLghKHGux96UnQYaIE6b1L9q5muQzX7G+eP/UMCYIXIKo72WzHDM?= =?us-ascii?Q?c5vetFAYhTTB98qQraGGIWL8ZP6aAe6gBjjcxg8yLet+bWvUDtQUYE/WRx7E?= =?us-ascii?Q?SDJXse7SZEODWWjCZxNDfVdPt/81OY5XKtJNXWF0ht73a956tRjbIU2ob0SZ?= =?us-ascii?Q?D0Clmv4NlXX+6JtAIrh8Yd1roZdaa6GAQK7mnVSwYQDbof6oueoiRgEaLKpt?= =?us-ascii?Q?0400HiHAIY66EwezbfRYjfrukzKhW2PflUTEWCVmd9aCbc0eOCNywrNM1eSV?= =?us-ascii?Q?vIS+dpziHJWoTM845x9X3vFfkTsr6IBcY7ogt+DADmfTFlAG11mM4ftyQgVM?= =?us-ascii?Q?kgPJwLnpWdj/9VBBWmD3pAl8ekdWK0CTXvJU2HERJYsTYLp9jb8UpPM9Psmv?= =?us-ascii?Q?UZgH9hM/tBxO55+kpusTYy+ZYZOQblTXX5hDx1+kyLCW25E/gubKArB1YFdA?= =?us-ascii?Q?AAk6lgmjSZFuouHkExghDdxMx029JFeVGCr+MqBFXtyo1M1DwFIN2jLvka6c?= =?us-ascii?Q?1tT6aTRXqDOf6ZVA3gcbly0Jbr05Dn16H/kyOmm799OeCJnwYhXL5APaztO2?= =?us-ascii?Q?Q2uwicXjFdbowq5yVsThQvelRnzOZU062UVptWWabAkiCt0m7NkNuTFha1Ov?= =?us-ascii?Q?/9oDo134kbsmXPsbNvfjTqzQrFPSFUzIFmFvDFHhdgJcI9peWno52UPXNjrF?= =?us-ascii?Q?KCXteU2Rm0mhC0/m3jnxhZDi6lyvZ7W7EnuzySMZocqMsGNqaeLWHfrEd28d?= =?us-ascii?Q?oKtILokf/9dyzwu5/AN5EYZvrDQjB6foGDW8WKMnp4s+594yHInT4wNuezTD?= =?us-ascii?Q?KaFK9zz1MMCuviX3cSgyLUCDWwDNWEuvNzjTyVoKdhYo7ORIN2OQYa5L+t/G?= =?us-ascii?Q?WC3g3bkVfH0AwkmQA6kiD/7464DN9GcKVZsNJoHH47Va8csTGwl8EJ5balXE?= =?us-ascii?Q?852sM+ClonIbjfHfUPX+c1vDSFsHN2aIH86Abj60V?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB1629; 6:Y3qk0D5U7LJ1/Xb3zFX6oZ0MeVOqx8DpJkgKNrZ2p8C6LmcO7W3AdceYhOwId+GFfIcleLI078cbWK+Duk682GHNTIvsQB9xvHjJ2JTtNw7hl2W4itE3L7npNKF0nOUaiq+AER58vgTUAW2h+voST7O7JKPfwtIr+gLafk7o905aCakneVFv2DGg1Xp3169stIAMxMVzMe5ixWcrVCMRZdgydi4X3xhJ3cfzPpvztFTJ22FGOsxXkYJHhJWe/ffSxBoRXv2gmWMU4t6zrEtqJo8mYfj40s+X/KXC/wINRCh/n1MiDm8+1sbR6ALq2Gy7; 5:V6Dob48LRLGtuMNn9Psry3QzkQAsrEqwyvBy8S3BjGBjKtZQufbovn8BvtJ3JxdY3Eu+9irgXcQDns2Twy1Ym7sKRFE6UMdssiEevHMCmkdRQt343SPXXZBCQ4i+ix3S+Eem6hQyEYh3c4gPhE+8ilchrrchtyhLX3Vy6gfkxy80J/ayocptLO/CNth7NJiB; 24:bQ4uRKgg8uQNM55E4qcbwNIhVyucaVsgJQkLl/ljShlo1C0oDI5LCzU09LTjPN7rVZqMHkntNKb7Z02N83JUBvluNtouVESek78vAW7vkLo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB1629; 7:gjWG4x693TM/ORE070mxtn6gUmPL6cVEDf4kA2oTE3OB5LcrKiqIni+LnI0SFzThgJrC31gXiIs3jXwioK4kLCiwhqwvdScZVM6j5VvqkCBB/3eBj3O4+Vd3AggCY5kHDWvP0Gq0ix6bL/xqu65OYWS7KOj0G5ZOkcR0tAhtQ4F7O8CTHCSdYY3ccmMaraMeDmdcAx5AtUHmO/OmBS96v0tewTGt0mVD8NgRwf0RWX8NN8BOxgwTe+v8/1xywE8SfTktKN/JAmBUJyvPxMxmp+cIIDiDbMdnzLAgjKIbgZNt7ymv8FC/ZNG/gHJWw+cZ0x9yM8peYV1UEvAY0znbjyl3K0WYdjuQ9w9O4+9SYug= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2016 15:18:17.6076 (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: SN1PR0301MB1629 Cc: Shreyansh Jain , thomas.monjalon@6wind.com, viktorin@rehivetech.com Subject: [dpdk-dev] [PATCH v6 21/21] eal/crypto: Support rte_soc_driver/device for cryptodev X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Oct 2016 15:18:19 -0000 - rte_cryptodev_driver/rte_cryptodev_dev embeds rte_soc_driver/device for linking SoC PMDs to crypto devices. - Add probe and remove functions linked Signed-off-by: Hemant Agrawal Signed-off-by: Shreyansh Jain --- lib/librte_cryptodev/rte_cryptodev.c | 122 ++++++++++++++++++++++++- lib/librte_cryptodev/rte_cryptodev.h | 3 + lib/librte_cryptodev/rte_cryptodev_pmd.h | 18 +++- lib/librte_cryptodev/rte_cryptodev_version.map | 2 + 4 files changed, 140 insertions(+), 5 deletions(-) diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index 127e8d0..77ec9fe 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -422,7 +422,8 @@ rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv, int retval; - cryptodrv = (struct rte_cryptodev_driver *)pci_drv; + cryptodrv = container_of(pci_drv, struct rte_cryptodev_driver, + pci_drv); if (cryptodrv == NULL) return -ENODEV; @@ -489,7 +490,8 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev) if (cryptodev == NULL) return -ENODEV; - cryptodrv = (const struct rte_cryptodev_driver *)pci_dev->driver; + cryptodrv = container_of(pci_dev->driver, struct rte_cryptodev_driver, + pci_drv); if (cryptodrv == NULL) return -ENODEV; @@ -513,6 +515,111 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev) return 0; } + +int +rte_cryptodev_soc_probe(struct rte_soc_driver *soc_drv, + struct rte_soc_device *soc_dev) +{ + struct rte_cryptodev_driver *cryptodrv; + struct rte_cryptodev *cryptodev; + + char cryptodev_name[RTE_CRYPTODEV_NAME_MAX_LEN]; + + int retval; + + cryptodrv = container_of(soc_drv, struct rte_cryptodev_driver, + soc_drv); + + rte_eal_soc_device_name(&soc_dev->addr, cryptodev_name, + sizeof(cryptodev_name)); + + cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, + rte_socket_id()); + if (cryptodev == NULL) + return -ENOMEM; + + + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { + cryptodev->data->dev_private = + rte_zmalloc_socket( + "cryptodev private structure", + cryptodrv->dev_private_size, + RTE_CACHE_LINE_SIZE, + rte_socket_id()); + + if (cryptodev->data->dev_private == NULL) + rte_panic("Cannot allocate memzone for private " + "device data"); + } + + cryptodev->soc_dev = soc_dev; + cryptodev->driver = cryptodrv; + + /* init user callbacks */ + TAILQ_INIT(&(cryptodev->link_intr_cbs)); + + /* Invoke PMD device initialization function */ + retval = (*cryptodrv->cryptodev_init)(cryptodrv, cryptodev); + if (retval == 0) + return 0; + + CDEV_LOG_ERR("driver %s: cryptodev_init(%s) failed\n", + soc_drv->driver.name, + soc_dev->addr.name); + + if (rte_eal_process_type() == RTE_PROC_PRIMARY) + rte_free(cryptodev->data->dev_private); + + cryptodev->attached = RTE_CRYPTODEV_DETACHED; + cryptodev_globals.nb_devs--; + + return -ENXIO; +} + +int +rte_cryptodev_soc_remove(struct rte_soc_device *soc_dev) +{ + const struct rte_cryptodev_driver *cryptodrv; + struct rte_cryptodev *cryptodev; + char cryptodev_name[RTE_CRYPTODEV_NAME_MAX_LEN]; + int ret; + + if (soc_dev == NULL) + return -EINVAL; + + rte_eal_soc_device_name(&soc_dev->addr, cryptodev_name, + sizeof(cryptodev_name)); + + cryptodev = rte_cryptodev_pmd_get_named_dev(cryptodev_name); + if (cryptodev == NULL) + return -ENODEV; + + cryptodrv = container_of(soc_dev->driver, + struct rte_cryptodev_driver, soc_drv); + if (cryptodrv == NULL) + return -ENODEV; + + /* Invoke PMD device uninit function */ + if (*cryptodrv->cryptodev_uninit) { + ret = (*cryptodrv->cryptodev_uninit)(cryptodrv, cryptodev); + if (ret) + return ret; + } + + /* free crypto device */ + rte_cryptodev_pmd_release_device(cryptodev); + + if (rte_eal_process_type() == RTE_PROC_PRIMARY) + rte_free(cryptodev->data->dev_private); + + cryptodev->pci_dev = NULL; + cryptodev->soc_dev = NULL; + cryptodev->driver = NULL; + cryptodev->data = NULL; + + return 0; +} + uint16_t rte_cryptodev_queue_pair_count(uint8_t dev_id) { @@ -868,8 +975,15 @@ rte_cryptodev_info_get(uint8_t dev_id, struct rte_cryptodev_info *dev_info) (*dev->dev_ops->dev_infos_get)(dev, dev_info); dev_info->pci_dev = dev->pci_dev; - if (dev->driver) - dev_info->driver_name = dev->driver->pci_drv.driver.name; + dev_info->soc_dev = dev->soc_dev; + if (dev->driver) { + if (dev->soc_dev) + dev_info->driver_name + = dev->driver->soc_drv.driver.name; + else + dev_info->driver_name + = dev->driver->pci_drv.driver.name; + } } diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h index 8f63e8f..85ce5cb 100644 --- a/lib/librte_cryptodev/rte_cryptodev.h +++ b/lib/librte_cryptodev/rte_cryptodev.h @@ -244,6 +244,7 @@ struct rte_cryptodev_info { const char *driver_name; /**< Driver name. */ enum rte_cryptodev_type dev_type; /**< Device type */ struct rte_pci_device *pci_dev; /**< PCI information. */ + struct rte_soc_device *soc_dev; /**< SoC information. */ uint64_t feature_flags; /**< Feature flags */ @@ -623,6 +624,8 @@ struct rte_cryptodev { /**< Supported features */ struct rte_pci_device *pci_dev; /**< PCI info. supplied by probing */ + struct rte_soc_device *soc_dev; + /**< SoC info. supplied by probing/Scanning */ enum rte_cryptodev_type dev_type; /**< Crypto device type */ diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h index abfe2dc..a8af2ce 100644 --- a/lib/librte_cryptodev/rte_cryptodev_pmd.h +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h @@ -48,6 +48,7 @@ extern "C" { #include #include +#include #include #include #include @@ -131,7 +132,8 @@ typedef int (*cryptodev_uninit_t)(const struct rte_cryptodev_driver *drv, * - The size of the private data to allocate for each matching device. */ struct rte_cryptodev_driver { - struct rte_pci_driver pci_drv; /**< The PMD is also a PCI driver. */ + struct rte_pci_driver pci_drv; /**< The PMD is PCI type driver. */ + struct rte_soc_driver soc_drv; /**< The PMD is SoC type driver. */ unsigned dev_private_size; /**< Size of device private data. */ cryptodev_init_t cryptodev_init; /**< Device init function. */ @@ -519,6 +521,20 @@ int rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv, */ int rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev); +/** + * Wrapper for use by SoC drivers as a .devinit function to attach to a + * cryptodev interface. + */ +int rte_cryptodev_soc_probe(struct rte_soc_driver *soc_drv, + struct rte_soc_device *soc_dev); + +/** + * Wrapper for use by SoC drivers as a .devuninit function to detach a + * cryptodev interface. + */ +int rte_cryptodev_soc_remove(struct rte_soc_device *soc_dev); + + #ifdef __cplusplus } #endif diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map index 9dde0e7..d81073e 100644 --- a/lib/librte_cryptodev/rte_cryptodev_version.map +++ b/lib/librte_cryptodev/rte_cryptodev_version.map @@ -44,5 +44,7 @@ DPDK_16.11 { rte_cryptodev_pci_probe; rte_cryptodev_pci_remove; + rte_cryptodev_soc_probe; + rte_cryptodev_soc_remove; } DPDK_16.07; -- 2.7.4