From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0087.outbound.protection.outlook.com [104.47.42.87]) by dpdk.org (Postfix) with ESMTP id 5F9C0BB8E for ; Fri, 28 Oct 2016 14:31:23 +0200 (CEST) Received: from BY2PR03CA074.namprd03.prod.outlook.com (10.141.249.47) by SN2PR03MB2381.namprd03.prod.outlook.com (10.166.210.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.12; Fri, 28 Oct 2016 12:31:21 +0000 Received: from BL2FFO11FD031.protection.gbl (2a01:111:f400:7c09::163) by BY2PR03CA074.outlook.office365.com (2a01:111:e400:2c5d::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.12 via Frontend Transport; Fri, 28 Oct 2016 12:31:21 +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 BL2FFO11FD031.mail.protection.outlook.com (10.173.160.71) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.679.5 via Frontend Transport; Fri, 28 Oct 2016 12:31:21 +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 u9SCPEMX019399; Fri, 28 Oct 2016 05:31:18 -0700 From: Shreyansh Jain To: Date: Fri, 28 Oct 2016 17:56:38 +0530 Message-ID: <1477657598-826-22-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477657598-826-1-git-send-email-shreyansh.jain@nxp.com> References: <1477581467-12588-1-git-send-email-shreyansh.jain@nxp.com> <1477657598-826-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131221314813302780; (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)(189002)(199003)(105606002)(104016004)(36756003)(106466001)(586003)(50986999)(76176999)(92566002)(229853001)(2351001)(81156014)(81166006)(48376002)(50466002)(68736007)(97736004)(8936002)(50226002)(7846002)(47776003)(6666003)(305945005)(11100500001)(356003)(8666005)(4326007)(2906002)(5003940100001)(33646002)(19580405001)(19580395003)(77096005)(189998001)(86362001)(575784001)(8676002)(5660300001)(87936001)(2950100002)(6916009)(85426001)(626004)(5890100001)(110136003)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR03MB2381; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD031; 1:nN4mc8hyjgiUh+uN1ijGndkyIf/00opbwLtd0y96BlE8Z9zqscEDHYnIR2kyYf9XsVEvWq+tgO9onciwaal/AkmjcBTzgdFD3qzIJKiLaf5mGgp3Zrl33weF9HtMYf9aUNT69PwAVW5rWYLJfmrbJiG8pP2lSRDpucWCPmJOvWizA3LxjJAlnFEoUceo/sYcY+B/GMnIJZ88d3Okcjaf5g6rE9x6S/sBPOgIWN7/VVv570dYM8FpHQGa3R0RRvnGZAie4TS/oKfp0zQvW+9n4D5j84wc3uQzH2/IaOQjWrb1DIomkfuNOcRjdordNm7dALIrW1PNeCCC5DZ4WtMq42ReOW6SzFfbCfABhle1Dh3xKIb/oPbmFoRNZpgjmsaM0F3236gPO1cFpyJ85lM2/LddYEn5jGDoLip5Faqh3pPnx5+2SmcwIAQ5+Wh+0az/0LuJwr9bELyXV2onXeMkzvFobeT8N1oZabGfvY3MW4BvOND2BvtCsEMHu19ji9LvovPauxjpXhwG9aC8vRd0jAIFfsvywSCfux/9dzfZRRmOinPGS9/cwCwCqs6lZo7Egp5s0ZShdjjn7RywH9SIBLDhN1ZbN6iSgRoxoVUGfB2N2QF7nsLRj6Kni9BOXS9+vQvvMrCaXPqHsnJivUVdsTrSEtI8dIOSH+jt74rzI+9gMjrdAmaB9yATsp/r0I/e0UH33ZtDyIYG7avefajGQvmViiuu2P/J4F0FGlUxO7s= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: f8b39a81-9e5c-4fc2-b69b-08d3ff2e52dc X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2381; 2:8V3+QHi8ePwuRBPAvw5hPbWwO6hT0y+xSvt2soDebyQqtaMmcFHQpcSfn4K6rEvMa0mX0vEgv2gOfMwjTg1CeHhQv+u4YmYGQ5T5xCCa20CJPFDFgvs95QTEFRMOk53VNzGGNunzI+mZjNlHaUjW3MiYZF/59uz5UKIEC+cSds0xn6/TSrOteGjv+gGkBGMMigOQJnfRYe1rEurJxQzMPg==; 3:Lxj91GHRLrKSQOH7UjBZeI56QpRzsEJChCtnTkKPuxRqLwhz+t7WTw8gXbdOK68prhO01mT9npJzxzIWV3KMNXViRNnegwV/E3gUFfxJ+UPM0/OBFm3I13YODRd10qpQ6tQ5tthYDYXW+3U90kTUVCGRTN1ECZqnYtnIT9BJAmNet0JNKQIJHrzk7ksrXfKpQ7kJTCE20Ru49X0Oi13K9RZuPrODt6dWZicAlg5VQ3Pc5MzXyFUuE8Zyh5KfOzqa X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN2PR03MB2381; X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2381; 25:wlnul2A9H+62iR5VoiO+UnC5/VoLSfNg23hZhysZBefvSHSoYw/OXyiFhmE+K8+zPbiIUsOdlNo6at11+ITCvYa+kcd+ZWLAbucQYur6lUaGQobnYYEaK6tE7dKyrTPk7I8OMpfOHysl4G7C1yj0Ib8nfFwmPqAMjLzQTRmdlQQVmU6v4jwwVkheuwnbZPL4PDXmNVLa1u14Wxk06TrwvnwBw27ggZ5WYTrEkE4Pz2j5VYCDBviJUNbyfLUIlzXj2Dh9nbdXEhf7t7lTi3RiW/mJcRQ78mE3jdu/IyhLyEJRt1/4HgDC/UkkXqEIQnNe/DsA+ahE5EEgCNDk0zC9M0fSWwVPtwFQUWbX0cnCRtCbpgc2Uh4lnvF9sIs3vwsne7uzX9uPvp6+XQR4JZPEBUTJuWgaz2Qk3uFsnOdAMUh5HpO33RdRMoV2aOd9M8z8jI8RfzD9UK2LXv4o5hryfuS5PZ5IQkWYcJiSgfdY10R8wfm/R2doouPjeL4yrs32JJ06fepQrQCqlTp6i/TpPMKsLSjkMfnUh7H8qLXEAGmNyuCYIuZqYyltuMVp5hKAQYr7YbPF2vKGArGP4R+0DsLuie3yrdxxukJHjrxzUw4e5n8P/eIbpz2JBIkfU37gwa8OEdkdUMp5okYDLVTKvyGl9Ytq8O/ehlwfO/75LvpSj1fPXENShoWzWPhB5g3TSNdxbOaOyb1skUaehc/uBpzSQjzUZvh4l3xz/EpvEl0Ri6O0eKmiWzo8QuOce2YcKSLSifkD4uTTZ1gbW9uQ+BtDrjy9aKBj4a4CodHBQrU= X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2381; 31:P/b5H3dZ+5BLBwpaIjr5I2tKpv1FTX3BC5Y5sVpEUnZlmZhlwhEZff6e6yBM46mhGUxtZ720UXBdRfAWMczCCACADvCZ1ESDlvD2GOZrHcKGvjnevSzddujgxMBuQ9QC7qicairxjCBXh+dDSH8YcdXj6JPR6nx/KPfR51PuCLZEDpNn0L455y030Q9QzPfYh8F5OsNmwn/rGepANRb2Bj/LzurS1ZFBaMuZKDnh07VuZeeOfFI4mtmnUN5SlRulqWsapTOv9Vhi+b4WgLUKR4F2MjVT0HkcI/7CtQAxRJs=; 4:G5fCekS7ahsNOz0wprbt0pZJVfr63bkpe6eeS/jP00Rygt9AGSVwClAQ5WYMe3J6+cqo9rBx6pvRO1GQXDpEGMb+3Pt23reSq3QyMmerXEBE+0bN1ni3UCkVTvxTAOiAn0v7CUnKVZOJFGKLa6nqMRHoYX3Rnd//+ecuUVksiedL5OMPOtEjz20k7JN1HYsSFPv4kweWFxIDwAj0Yu+dqk+Scn7/iXSeVHuexW4JKVN5tO9E+rNjp4xXHlG61CmsMu7fSfcSHfACi2OdfH1qKyiB3FdkSDPIh0Dvm/1lTV+Dumfnpk3l2eh0wFiU7bxb1YN9RVP/4EEaAPiIPSvrHZZ/KBpIxf3gwwaOjUWdawrZ740LKFBk+a+jRNOuHunDX2sEUAqq/4cbJnB18D0xLbvV8ZYzSeCUq6Zs0KdvuGCOJB13Q8n/eZ59NNbpdGvzky7SnSuCjBlgRZV2YOcOcn9qNzWM96VIhM9VgIP6lNBHYVlSygnDpO3gJpuYGH3grRtZLYp5viL247dHOSgVCRDdPCFXPdEW2hEnIkFhPeSvfC//IJ4EqkTTd7dE+YFz 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)(13017025)(13015025)(13018025)(13024025)(5005006)(8121501046)(13023025)(3002001)(10201501046)(6055026); SRVR:SN2PR03MB2381; BCL:0; PCL:0; RULEID:(400006); SRVR:SN2PR03MB2381; X-Forefront-PRVS: 0109D382B0 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR03MB2381; 23:SHGIqV+hk04kNAsdV1hHozi4xqeDVme6dxkF2LB78?= =?us-ascii?Q?iku+uhOjbnB+DqrKYLle9hS9gnOhp2vOvz3iAhvf+aN5g2O3HstqBXyncLYc?= =?us-ascii?Q?7/flG70N2sRE7xs/c7oWYG62R2oeQsed9zICFRXRCZphxUkvakpheA5DHzl5?= =?us-ascii?Q?rojbLh3p2dDn5rP8qMt37NthWvT/4IaUqn1l0z/5/oyR3IiCJFIMcnEstoVW?= =?us-ascii?Q?Kyo6HLvEkWd8Ruq1c41/D8ruCgUxIfkRfufpaRex5mQGDZJ2dfKar7xwJIL3?= =?us-ascii?Q?AY+3ypExX/mlhHjRBcle/j/aHrC7cFYwCcU3I+1AB2kx/svoyCZavPFId36J?= =?us-ascii?Q?+OARV7JwJWbZcW6p5/nUBIrgLsFo7D98MyqXgavfjk/oSdMpSarf5N+Rxay0?= =?us-ascii?Q?j9YX36yFoB4tMOerpDrI35qWW7uoySekcj9v2ihxzl/QmvlCRMseEiXjUmmh?= =?us-ascii?Q?plvHSeXEKIIsxs9CvihErUk/X3Fd7f1PQi+w5NI4Dwzpu9Dl3gg+PYtBri+Q?= =?us-ascii?Q?HKtKpNncIe5OV1xJn20yJ+CDwZvnXB2whNAzq2v1y4Y8wQBmScZeGC3oea4x?= =?us-ascii?Q?viqeKK7cJPc4Yn4t7IBk4keUt1CwPEg1KO2/afug4eJoHGlYkI6nWjko2chh?= =?us-ascii?Q?Lvp1HIyt81v2iRQonz4wY+4HyHtd76oh6rSSSUg2/6XRgpN7cfnDQSjm03CA?= =?us-ascii?Q?PP6g1XyfWK9Ylj9c5tizMz8tSlWSrgpvJVjy8gqJs+UBpx1NocZ7oXOnUMSk?= =?us-ascii?Q?WVA5yDB69r+yiYPqASaeUGB7I2/VJtryJet57PZinBgnqz2g7ORbjkHkD4w9?= =?us-ascii?Q?zd0YOxzfqnNoG5F+ISGMZEWXJKxBFFRAdNoABQ23A2rE+YMkSC65qMwLNed+?= =?us-ascii?Q?jNBpCdvH4I50TFAXy1raH59+u/BXfmueJXPapADnU5n+yYNENBxlaAif1lDR?= =?us-ascii?Q?V76NTET+17tW2rz3qybrXiNpGDdekTNSxDKl+4W63AgnfAMMM9vdTV8BE9o8?= =?us-ascii?Q?6AIpBIyHP1avNBK9tZy682+QmuGZ6zrYQ80+FSMK/6uiLvbaEQFcXmRCua6I?= =?us-ascii?Q?vjLApFWMjWyoetRI2kuR3kjbXGT/+Vyl76qdIfaFS/NWXmslVhSoSQp0leit?= =?us-ascii?Q?oaoP6KJx0rx3T7iXRYSNlV3QVFTyVZgnrP8mbhMW5BZYB+gOO5pgdVCLLFdM?= =?us-ascii?Q?J4FN+mm9AZY8CnH2sX878zppQ0e2GBIIrX34KugvGH6/JZDNv7mjMXa7CTDC?= =?us-ascii?Q?6E3FFxwL/rbVU4UHFRXCstf5vGCrOZWOO7LXb5S?= X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2381; 6:F3k620W11KuNYGJkIsEe7SbgWd0J8GCcJJuOBsCdY7o+MNZ6xoFtueT2z4vfTqELuT8iZRBUN4l7rlTalNDukd473/WY/cHdLC3zFp4rdGJOAVFAoHOAGs1WPdHuqvbxort9UtNh1YO+sPI5gtT60Zku4xji5WolbQjJJQ+JlTcoolO6QcM6QrgBqHJAvAYz2R0yG0Pv6DzhQyHnQxeYX0jA3Jbmihd9S67fG4gorVqtqKhh7vk9hsawdGRzlxBri383w4zseQTo7C6rLEkmaY7iN9UELZQzdNCo0cYNFPPchUZmPZS6CXnzw947ImLp; 5:criEiv8bTJxor00DB4b+ARv5tMzYiPm1nZkefdp3+WZTjAM5qi0hdh7iMsXxzcwOGplD8rE2nU8GDAznNq1ii1iNjBs3w8HhUbzhN5K02EdTVxOhanYpEXY5kPWCuYjoRHkoYlMYa0EAUyNxT3gQLk633FTGU2KvcbGCDYmRpvEpNiyErqOxVjVcCzPyl0FL; 24:ymUGLTNdOEkqDAgLMmn0VNJI/7CDgg1twJD+R9IPs1Pcs7k4snCDTn/CqkUfus7tv0C2GVaSlDJBJmnT4vNUQXRTSrXQ2RisyRAV+UhUZEU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2381; 7:DKs7PtUE2hzZgQ2+AvP+MaJ3FQuMzIv7RY/1J5dpxcXnuJGqrpNufMxosMVhQ7PHSKkxhOBPiZJj9BFWLu7ehifiW9l74tuo8naTx2r44Y97C18WGFRFi6XO/HHfyXiGL83hCUH+ljecYT+gXTMuLD+WI0j0xuU9KqUHkIwGMoTT3upEiysP4OtAWrSda+c/9/tRMWd8mrj1LFDYQCnUJPiVvepohOEwKmeI9HKEKo1mF53q2IzQz6kJ7okBtAiBs07KD8JQQHQDsCLLxm5gU4stEQT3xDJ9zhwM7cxaSvgfn1ghN11as3JxsRJO0HPmI/YcZVwlzbS5dWz74vLvyjvIFi8lLOXF25VZIgSkkJk= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2016 12:31:21.1430 (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: SN2PR03MB2381 Cc: Shreyansh Jain , thomas.monjalon@6wind.com, viktorin@rehivetech.com Subject: [dpdk-dev] [PATCH v7 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: Fri, 28 Oct 2016 12:31:24 -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