From patchwork Mon Oct 22 14:57:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 47179 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D21021B3BC; Mon, 22 Oct 2018 16:57:41 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20077.outbound.protection.outlook.com [40.107.2.77]) by dpdk.org (Postfix) with ESMTP id 658B31B3AF for ; Mon, 22 Oct 2018 16:57:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=04dAFPdA+rcRRTpfxAzAew/Dr0VzySgIXyzlwOwYHFk=; b=XiSzFKR0Bqw8Xtn6GOZvxJKL6U8Zf+hSSjuV7ASsZpzAlUePOZmhUeFTx41gi4HMHLocm3k33Qkh+NFdEjTtqkuGP6Jc/EUp1kLp08fYEIGrWh7odLYzdQU83OoletanLaz/TKlWP+YH8sajBSZEZIG4yGQn99nahgG2m7sSGrE= Received: from HE1PR04MB1530.eurprd04.prod.outlook.com (10.164.48.20) by HE1PR04MB1305.eurprd04.prod.outlook.com (10.162.249.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1250.30; Mon, 22 Oct 2018 14:57:35 +0000 Received: from HE1PR04MB1530.eurprd04.prod.outlook.com ([fe80::95cd:198:d5c5:59a4]) by HE1PR04MB1530.eurprd04.prod.outlook.com ([fe80::95cd:198:d5c5:59a4%5]) with mapi id 15.20.1250.028; Mon, 22 Oct 2018 14:57:35 +0000 From: Gagandeep Singh To: "dev@dpdk.org" , Akhil Goyal CC: Gagandeep Singh , Hemant Agrawal Thread-Topic: [PATCH v5 06/15] crypto/caam_jr: add device basic ops Thread-Index: AQHUaheQIW3sphDiTU2VtQXLwNsDdw== Date: Mon, 22 Oct 2018 14:57:34 +0000 Message-ID: <20181022145644.29277-7-g.singh@nxp.com> References: <20181022141657.4727-1-g.singh@nxp.com> <20181022145644.29277-1-g.singh@nxp.com> In-Reply-To: <20181022145644.29277-1-g.singh@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BM1PR0101CA0067.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:19::29) To HE1PR04MB1530.eurprd04.prod.outlook.com (2a01:111:e400:59a8::20) authentication-results: spf=none (sender IP is ) smtp.mailfrom=G.Singh@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [14.142.187.166] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HE1PR04MB1305; 6:REH5c8WEJhoVgv66aSPG6ZgelDZzDq6tf7Zo+Umae8Kx6En/xwCDR+cKOL5rSlUtVtCTw4JeQ9t0mY+qm03JmvfV6g/gvT5LPkjFp6Wd1X5q4dYw8SkxbFZr+b+Ej5JcvQae4N9VfaftPUCfzep9rr2o/Iy17+6+ZauLoStN5i32n+zMHIBEVPJeD5iz+WxtnsrUXQ62OdZ8cybeewYCf1ubI9zZDU7vdOkkPLlwShA4+RChmCC6qrMI+c+4jjc6WPfsklQl/fHBWGBTvNAEa4qmKu5L8xl3rHCxxgKQXvQeX27jQSO5tJ2HLytBW6uYjVHipRa5qSoVTQzp65UYNYxii5kx023dPvFs4pcnYtWgDc6GDQ+qDVp2aB0eaLsqrAc2+3jt+Nk5Rvt5AmWUNMrup35sqZdkiIr1R0nbaeRzmKii5EppHaMOV/iR8sr7JFAqm/yYPJg50GWmsiNsgg==; 5:9zsGAPR95nr1agPZUQpuKCD85Her63JVp5geydUjWNrT2KzJKHTy1oUFs21ZINs5ixVW0FCJz2oZloBAATrH7yNTucQrAoy3sVSaHu8b7wFnhjDLeim9RCiGI/FO7JVk7NUw3Yo2pEPXe+hWxIc0nW92Q43CVZLsOPNg445mtNo=; 7:rfSNCQBYL100SCcgVDxNbXURAL1a5wgGbZessr8Kw37KNQacTpBhw1Z1S0hLU39kr5SM07TVeOZ99XWy+hmRJCuyfgIwvywBVei4pxl42Y/tyXk5zeYq5gebHgKgLcllepO2RSOVZn+dWuZmQGSTJOaauC7bTvh1YDLdHIPrztqCakCpRdP0EJKiNnEidNv2oLf0nfEGN+R6FDsY1wqEfSx5iAnpqPa9s+bj/81AxJr7d62Voqkp3wbqwBO6lCs4 x-ms-office365-filtering-correlation-id: fb4a5d98-a898-4491-f080-08d6382eb2f7 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:HE1PR04MB1305; x-ms-traffictypediagnostic: HE1PR04MB1305: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(185117386973197); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231355)(944501410)(52105095)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:HE1PR04MB1305; BCL:0; PCL:0; RULEID:; SRVR:HE1PR04MB1305; x-forefront-prvs: 08331F819E x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(39860400002)(396003)(136003)(366004)(346002)(199004)(189003)(8676002)(256004)(81156014)(81166006)(11346002)(476003)(99286004)(446003)(316002)(52116002)(2616005)(486006)(106356001)(8936002)(105586002)(186003)(71200400001)(5250100002)(78486010)(3846002)(2501003)(71190400001)(25786009)(2900100001)(305945005)(7736002)(97736004)(478600001)(4326008)(2906002)(72206003)(6636002)(53936002)(14454004)(66066001)(6512007)(5660300001)(6116002)(1076002)(6436002)(6486002)(36756003)(14444005)(54906003)(6506007)(76176011)(55236004)(386003)(68736007)(26005)(86362001)(102836004)(110136005); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR04MB1305; H:HE1PR04MB1530.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: BWzOG8A4udrJq8GSfPOLxnHpG+GFbSbPJApzti3Hx189xTADMCZ9Rhnw/VOxjmETrYGnqNqynLrm9yb1x34PZ2Z2o/fRuFG9ouoDqni7FwJRRo5Jvga5CwFUZBVPd9cy/viwX3pA1olUBJugJ1wURD0wREolbwRbKWurYzar3sSxz2Yt30DidRPOTZGcgLL3Jwa5AxPMleNyVT1maSAfKXjIPsivxTSCS6WANMjppHIMSX1Jp23kPsdSfXXkXRNAJeeeAOG2f2yL1ejNKv1M+EPG54pluP47cNB2u+qVCndsLG8hCg1wuaZxgevI3FgM1MXCkKvlWBy2XMTctyMC3DgVd0TtDZiuM7S6wwZMuaE= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fb4a5d98-a898-4491-f080-08d6382eb2f7 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Oct 2018 14:57:35.0135 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR04MB1305 Subject: [dpdk-dev] [PATCH v5 06/15] crypto/caam_jr: add device basic ops 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch adds following device operations - dev_configure - dev_start - dev_stop - dev_close - dev_infos_get Signed-off-by: Gagandeep Singh Signed-off-by: Hemant Agrawal Acked-by: Akhil Goyal --- drivers/crypto/caam_jr/caam_jr.c | 98 +++++++++++++++++++++++++++++++- 1 file changed, 97 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c index 1a04a3ce6..b03b9625b 100644 --- a/drivers/crypto/caam_jr/caam_jr.c +++ b/drivers/crypto/caam_jr/caam_jr.c @@ -97,6 +97,89 @@ hw_flush_job_ring(struct sec_job_ring_t *job_ring, } +static int +caam_jr_dev_configure(struct rte_cryptodev *dev, + struct rte_cryptodev_config *config __rte_unused) +{ + char str[20]; + struct sec_job_ring_t *internals; + + PMD_INIT_FUNC_TRACE(); + + internals = dev->data->dev_private; + sprintf(str, "ctx_pool_%d", dev->data->dev_id); + if (!internals->ctx_pool) { + internals->ctx_pool = rte_mempool_create((const char *)str, + CTX_POOL_NUM_BUFS, + sizeof(struct caam_jr_op_ctx), + CTX_POOL_CACHE_SIZE, 0, + NULL, NULL, NULL, NULL, + SOCKET_ID_ANY, 0); + if (!internals->ctx_pool) { + CAAM_JR_ERR("%s create failed\n", str); + return -ENOMEM; + } + } else + CAAM_JR_INFO("mempool already created for dev_id : %d", + dev->data->dev_id); + + return 0; +} + +static int +caam_jr_dev_start(struct rte_cryptodev *dev __rte_unused) +{ + PMD_INIT_FUNC_TRACE(); + return 0; +} + +static void +caam_jr_dev_stop(struct rte_cryptodev *dev __rte_unused) +{ + PMD_INIT_FUNC_TRACE(); +} + +static int +caam_jr_dev_close(struct rte_cryptodev *dev) +{ + struct sec_job_ring_t *internals; + + PMD_INIT_FUNC_TRACE(); + + if (dev == NULL) + return -ENOMEM; + + internals = dev->data->dev_private; + rte_mempool_free(internals->ctx_pool); + internals->ctx_pool = NULL; + + return 0; +} + +static void +caam_jr_dev_infos_get(struct rte_cryptodev *dev, + struct rte_cryptodev_info *info) +{ + struct sec_job_ring_t *internals = dev->data->dev_private; + + PMD_INIT_FUNC_TRACE(); + if (info != NULL) { + info->max_nb_queue_pairs = internals->max_nb_queue_pairs; + info->feature_flags = dev->feature_flags; + info->sym.max_nb_sessions = internals->max_nb_sessions; + info->driver_id = cryptodev_driver_id; + } +} + +static struct rte_cryptodev_ops caam_jr_ops = { + .dev_configure = caam_jr_dev_configure, + .dev_start = caam_jr_dev_start, + .dev_stop = caam_jr_dev_stop, + .dev_close = caam_jr_dev_close, + .dev_infos_get = caam_jr_dev_infos_get, +}; + + /* @brief Flush job rings of any processed descs. * The processed descs are silently dropped, * WITHOUT being notified to UA. @@ -360,7 +443,20 @@ caam_jr_dev_init(const char *name, } dev->driver_id = cryptodev_driver_id; - dev->dev_ops = NULL; + dev->dev_ops = &caam_jr_ops; + + /* register rx/tx burst functions for data path */ + dev->dequeue_burst = NULL; + dev->enqueue_burst = NULL; + dev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO | + RTE_CRYPTODEV_FF_HW_ACCELERATED | + RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING | + RTE_CRYPTODEV_FF_SECURITY | + RTE_CRYPTODEV_FF_IN_PLACE_SGL | + RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT | + RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT | + RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT | + RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT; /* For secondary processes, we don't initialise any further as primary * has already done this work. Only check we don't need a different