From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0050.outbound.protection.outlook.com [104.47.36.50]) by dpdk.org (Postfix) with ESMTP id 2BAFB8DA5 for ; Sat, 15 Oct 2016 15:45:04 +0200 (CEST) Received: from BN3PR0301CA0042.namprd03.prod.outlook.com (10.160.180.180) by BL2PR03MB323.namprd03.prod.outlook.com (10.141.68.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.649.16; Sat, 15 Oct 2016 13:45:02 +0000 Received: from BN1BFFO11FD002.protection.gbl (2a01:111:f400:7c10::1:137) by BN3PR0301CA0042.outlook.office365.com (2a01:111:e400:4000::52) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.659.11 via Frontend Transport; Sat, 15 Oct 2016 13:45:03 +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 BN1BFFO11FD002.mail.protection.outlook.com (10.58.144.65) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.669.7 via Frontend Transport; Sat, 15 Oct 2016 13:45:02 +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 u9FDhhgX021870; Sat, 15 Oct 2016 06:44:59 -0700 From: Shreyansh Jain To: CC: , , , Shreyansh Jain , Hemant Agrawal Date: Sat, 15 Oct 2016 19:15:08 +0530 Message-ID: <1476539108-13170-18-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1476539108-13170-1-git-send-email-shreyansh.jain@nxp.com> References: <1473410639-10367-1-git-send-email-shreyansh.jain@nxp.com> <1476539108-13170-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131210127026948490; (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)(199003)(189002)(8676002)(50226002)(5890100001)(87936001)(106466001)(19580395003)(92566002)(36756003)(81166006)(19580405001)(105606002)(305945005)(2906002)(110136003)(8666005)(356003)(97736004)(81156014)(47776003)(76176999)(626004)(68736007)(189998001)(2351001)(6916009)(7846002)(2950100002)(575784001)(104016004)(50986999)(586003)(5003940100001)(5660300001)(86362001)(77096005)(33646002)(229853001)(4326007)(48376002)(50466002)(85426001)(6666003)(8936002)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:BL2PR03MB323; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD002; 1:iACQ6y/nmWvF20Bjy3p0KDLBjduVNGdv9qDg95NsDjf2khJe8OZ0/lcfxrHk78fGN1MB36eCRysYFrvF9yxan6NhM6VSBELKcpvv/9iM8bee+SdI9VI2H0i5r1scbMxc0Kd67h28dGdqU0kli+SZmZdb9K+9/wP7ESk07WpOwA3QF4y/56+3RlI4EoRy5pFqVGzRdl1/g9a4Dd8Y+7rR6fzJ7WOMGuq1a9528x/x5GBfrjriMkaJB7oZ5PhuyzvQ0eKaYpY/HhMKFtOOIFUFZVSbc9PqiIbuHNutsOw1BXIaIxUgTmubIHQRG5XFCAtGU2JFnyHSuBbyYhB8/6Gyvlv+D+t+4uvBlg6wUbf2riqtqy+TX9x474lbZrqNNoEZy/wS4UEyFhR4wjJBy2/HN+40LcwMvGg8128xz6tNwuwb0ek25OF5D34fjyearnBb4GnVJwRDzws7eyRdCXqHmS2ZPrwvEV53Ijbv7wtP5t8unTfMS3K9GOWVwQwbm4eOceLyW4yN4vGzwza4PDhq0vl4w+ExVDJXtwgzW8FNozShIutulMr4Ng08PTGGrEaTy7ezrL0Hf9gOpEC9n9l2nrW+hErAz5EVxLpgKdsYi5aKDKlsPe8QJZSCRV+AuK/7gM/OFasIlcxVFQzqH3LnjW5g9ulFvNKKC9vrcTIehtK8kr5BcVrqUcoh9WO2YIDm2YVFaqBbsLhbVxOV3aktpF6ofvGXbDouHgwwTna7Sxw= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 83176d9d-13a5-4750-a829-08d3f50176d4 X-Microsoft-Exchange-Diagnostics: 1; BL2PR03MB323; 2:A3+jDVhTEgfPmvNgb+l/I2vS0MFUZg2EP3h75AohR/u5rScseW7NBuN+mw+UKNw70htB0bjCy+tnDJ7Jf6AbMm5HjFlz5ZwsLHtpTGOBEuWeDdrUoVtP+5t+ZMXIdPDOA80khsS8JJXYCxW5e6GwD+Zhgb3+w2lSkLVF1FV/dQR+BDE+HbEtF5x6++KhePpNBVgbgMqCaw1CLi5XjaYaDg==; 3:Py9/7eA0/8OEnaKEy3X4Asl1UI+S/DMw34Yc5lbRXx9LrW/ESdUsQV6VC94mEQvjkBv/ncn3VbA2JeYWpKvVYOFkFoegqgn67fsJ0cbbBISLhELcSAxFHVneWmBK3r152XAqVC85bSK7nxxfyI++IleRjphmXePM+QlLQmkpsa6NMYPO9YQVneLWj+C/dYEVozxYlUGTTkYt78t1fK+3uX58FgET3kk1vSYGIHYMt3A/0pxVuzXRXiQD20L1h5iq; 25:DvIbYS6JEls+vTzsPCbxAHrpUHH9s85h379jtKBkhVMqEn3rIjejG9sxXbekPCpanObRku2MGYicDbUyql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UmetIWq2oIpZPUdTKwhe2Ux/lfYXkZwpc9gRZsXTiAH5rz+w53+ceNCWbA+d9Kl5hA0/7a82shuTFyuUJEDa1gV1CeCaAoeKLLPvSWc6sMlFpwVIA0yH3R13p6XHt4Com9p0GeRS2DNr2yxFHr2T/v9S08MQyh64fr0BQkOCGE3B5bpz6d/S1EsFO5WFnWug7hoi4KQRnsYCKm8qfg5cDSZqRrS2GXsgLtII9DGEeeZIb1SCws+ZXBZozzW4ec+qchxqvwcX2z+K9k44154zUrMMC7rTvfftmAybIahyZbwcuuwUjsYIUMmeZEzJIH5KW7Ia 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)(8121501046)(13017025)(13024025)(13023025)(13018025)(13015025)(5005006)(10201501046)(3002001)(6055026); SRVR:BL2PR03MB323; BCL:0; PCL:0; RULEID:(400006); SRVR:BL2PR03MB323; X-Forefront-PRVS: 00963989E5 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BL2PR03MB323; 23:+M3LeoVZsQXmqe3BL87KiD96cXj+3y+Uyyc7MNEjgw?= =?us-ascii?Q?sumDNEJgkqj360obmpql/4ckdlH7MHB/V80DiFwsj/fY3wd9bu+C0iqV5rV6?= =?us-ascii?Q?gRQF+HECVfFjrmVV2RQgAZKozFyGi2/x2rNhHoQMeosRZN4h6/46QbgRZb8R?= =?us-ascii?Q?EkqPJz1ZxsTT24vBrKF/W3Xw8vmfxHZQ4P+wCRwvmrVo7kV5/jjV2uA81rMQ?= =?us-ascii?Q?+5uVDQynQoWn8TMg3rWVTlXKMNysEEhZXwOZhE0f3WHpZHsW4ijgdSOQoZJJ?= =?us-ascii?Q?SrvMB6sBsDP0wfQ/Znlt4HskFhBzz2obrbUBFuidscjQczgmQoI+De5NdiDB?= =?us-ascii?Q?RHb5ofC7YGdyxVAd08Oi13lev+/XnIjUYPWzQjJovdLU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fQk/MR8mfzgu2N5Psl6Lw= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2016 13:45:02.5076 (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: BL2PR03MB323 Subject: [dpdk-dev] [PATCH v4 17/17] 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: Sat, 15 Oct 2016 13:45:06 -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