From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0069.outbound.protection.outlook.com [104.47.36.69]) by dpdk.org (Postfix) with ESMTP id 7221E5595 for ; Mon, 24 Oct 2016 14:00:06 +0200 (CEST) Received: from DM5PR03CA0016.namprd03.prod.outlook.com (10.175.104.26) by CO2PR03MB2376.namprd03.prod.outlook.com (10.166.93.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.12; Mon, 24 Oct 2016 12:00:04 +0000 Received: from BL2FFO11FD034.protection.gbl (2a01:111:f400:7c09::190) by DM5PR03CA0016.outlook.office365.com (2603:10b6:3:118::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.649.16 via Frontend Transport; Mon, 24 Oct 2016 12:00:04 +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 BL2FFO11FD034.mail.protection.outlook.com (10.173.161.130) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.669.7 via Frontend Transport; Mon, 24 Oct 2016 12:00:04 +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 u9OBwEMf008267; Mon, 24 Oct 2016 05:00:01 -0700 From: Shreyansh Jain To: CC: , , , Shreyansh Jain , Hemant Agrawal Date: Mon, 24 Oct 2016 17:29:40 +0530 Message-ID: <1477310380-17944-22-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477310380-17944-1-git-send-email-shreyansh.jain@nxp.com> References: <1476539108-13170-1-git-send-email-shreyansh.jain@nxp.com> <1477310380-17944-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131217840041990585; (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)(1110001)(1109001)(339900001)(199003)(189002)(68736007)(5660300001)(50986999)(5890100001)(5003940100001)(81166006)(47776003)(48376002)(2906002)(76176999)(106466001)(2351001)(97736004)(105606002)(11100500001)(229853001)(4326007)(50466002)(575784001)(86362001)(19580405001)(19580395003)(586003)(189998001)(77096005)(6666003)(92566002)(626004)(50226002)(8936002)(33646002)(305945005)(36756003)(104016004)(356003)(85426001)(110136003)(7846002)(8666005)(87936001)(2950100002)(6916009)(81156014)(8676002)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR03MB2376; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD034; 1:smTEcpM9QN+lKQ6c3j/qn5XESXPbtyzY/kqExLVWwIJ6ZYR+8j8bh3pVLFZTlVQUpbVsUWmwug/5hA4H6Fa+8aWzeSmAmvsqCkyGffP2oLZfcXCB9nctzsbAKunB4lYejKbpFACxfKBeOLGliRw4cmAv+S0oftE0narDj/FVfO8aJ3Fa1bsfwOy6ozjgj75KqD6JYhoO8TYpOGAw9hRnZonz/h6Y3rruSnt3dlj2NZaD03P//vp6mHB59+lA6Vg+WDNOpc9iinK8n9ytXIaOEhu41KnsEmcoc+dVE1DJXefQ4tcJ/s4c8BCwID+Y+cXNeYv1ASoDqrEjflrrRDjD/MVEkcmo8RBbkZrGI38/oWKMNoI/bLTfUa2OYwyjxS5tKqAt8CZPs5yMUhOqsokgBjIgN5UjmPrabz/5EI9PxvA9GgeOVXyUKVenQmHnv66QL2QOiPUWVYtb3VNE25C0LLfMB8H/CeXHUWQ8Irr2Xegqk62Tlyg2porhABgMBFOVMSVqKK0lktSG4lL81Xwm9fMTNiio7bG3uqIR9feMXms8Kg1aINLM0ol1DFhrILJ4UzSnfX5gPcGP3ClKlAaT0ovsh94VLJGEaey/X+5qLozcNdZKqN32KYZHhz77SPdyJk6woyFOy7xZx0o6f8KuTaReLdbV0EBxxHyEdWVioelJOoEXFohxgExcuo64HVv6W2Arb+sdocLOyenISlo8xEE3YFf/m52F0i0uUoQUxSI= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 30c91073-da2d-446a-3858-08d3fc054a5a X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2376; 2:ZMY+DDE+EfoMRRBq54afrr5Q8ELeUDhNz1p4gL7anP/bZjhA6U6IUbY5RW5oMuGN/LsMS7UhAaZGHnKtt/A9GlpsDE4LtthO2xgAk8B3rY9DHXN5UB2LqD9zbNQ6BMzvKy7b56Cjzq+gmwK59KjCUIojsLjvncgw29PgppE3/DhBatqWz8pVOw98MLVvyu4gLjxPZW7sz9Z7uvNeYa8ysw==; 3:MjPLFGbZ7dJgotTpA7lgFLhNa8xqsDYFeFQSkyt1MFXK4nfqUrZJzLimxNWEO7ECoAUtGMlvLFCF0JrvVkAw+K+Kg/NzbR+zw+7oMzydaxqgRe7wk3ee1C0nSRSjVtfsYQYvj3qozpUrJokANk5FI5N10hx+t2LDVPQuFjTF90unOaeW5u4LEl6PMg5iTBelYxnQIioHz3Hs9FPlTdvivyNu+kHc+DsH49pv0LM7RaRlDU8IZmJ71xVFjs9oKHd5 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CO2PR03MB2376; X-Microsoft-Exchange-Diagnostics: 1; CO2PR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lev70QDz9F+p/sFLxGPCTORSg6KPDe/ok3J+4knKlGPNzWdCGkLjaINZ8ZZa6TJBB1Q2SxtD7CIvt2yEm4RWeEpfowS0rBSWovt; 4:9G+YLbMaMkljxBEpISWY34EC4QO+Ii81JCdhuSxp1aZnSMpOQ/h1qxlxkI2d5eM9cOi9ilheYMAncuZLO48Wa8cMKhH5851RfxKp80h/bZwhfuT82BF5PKLlgr5oOPUqvq1McHugnSAV/IO8PVBVN2/Xac+xLbl9kMIpVkn0j/qC9abEN79z7/DJ+sGG8KKq/b1gZLwHiI297CKuj4lQMU1dNk2UeTHkNwzsiPxcp2ah1Ivhh1/AxzRPyfvlwEk6Zd+DB8qbvPv7e8mbE+ty4KCw6URAF3laHQeYb8cpCwzMGQsum5Wknxj0nzvwbXwn+bBdgY3JtxwDH6zbMdhVL/rtGlJ65Xg/IC4zhxBQlu/kTViKbo7h512LeNWC/OyctuG++b9247xJW7knB4eTx1Fw0Rp6cwREjSuOG1dSTHDjEy4fSKx7SEu4EbK/7B/RlUuofGI/dec60TqD57v+NT3yRa1XFjQ4mTLCvetpy87TkC4vtTQSnqlSfhq3bmpK7YdiPIP2BZowK6AliIVt/fbfpwGdn1q3AWh2HvgjwKJc5pUpH9TpOa2vRMdq4xDN 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)(13018025)(13024025)(13015025)(13017025)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:CO2PR03MB2376; BCL:0; PCL:0; RULEID:(400006); SRVR:CO2PR03MB2376; X-Forefront-PRVS: 0105DAA385 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CO2PR03MB2376; 23:7GDgsRPCTuDxEM5bMHunaeb21h5aRziTUQ0Ommvyv?= =?us-ascii?Q?N3m+4fsJt56NDscW9q04GL8js671TRgo0xu+RDlAzg9qySb6P8EdcHlK4f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ticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2376; 7:BJaW1s3KdGGcyQ+mceyZgPMMkYIGXBvg7xteBkdiJmvM11iogtzPwCHIglQ3J2n41fchWDYiTS14nqRIJjIYFCBy6fXeJBdwWRqsvR61LqQGWIwyePrtTz0y7vYTXgLdiEzBBwDFoSEaIJQhLt5Q0YMYoH7i71/y0G05eAcmx9MifwFjjZJSa2RIvnauqZ4da8nsBbs1hvTTaWnAZ0wA4wsZ6VDzqyamztk/411QRD1gVduWKDZGaJprHND2grb/qCIgWtmHaYrLPjaQm1Pl76ALlXZBmjWPrc3lqKbEtPpIejUcHqcxKRboTjvI0P0+1LK+JAXv0mVu5okFDZOWm4hLscyPSAb5yeLuZfGjfWU= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2016 12:00:04.0118 (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: CO2PR03MB2376 Subject: [dpdk-dev] [PATCH v5 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: Mon, 24 Oct 2016 12:00:07 -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 232f34a..b94188d 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