From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50067.outbound.protection.outlook.com [40.107.5.67]) by dpdk.org (Postfix) with ESMTP id 998671B944 for ; Fri, 12 Oct 2018 16:41:46 +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=HQ3RSxFsiQ/6AQIm8pUKo27euxPdwq4M5g2WHAWN2M8=; b=FHaq2C+qRueZhiPe1HHti3ZSnrwCcrqbE4kqQ3qjgAQlANISqIBjGmd7cBAk20pUG4fWJ7D5EYMCTOPqAjKLeQC2TqYvAD8F95cUgw9yCN5DPzGM/gnWj9aeDEDvpTWO25vJnL2QiiP33MBeJ1L5ek6F8hWtyp+pq1XfIrmxVJc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=G.Singh@nxp.com; Received: from Tophie.ap.freescale.net (14.142.187.166) by HE1PR04MB1530.eurprd04.prod.outlook.com (2a01:111:e400:59a8::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.23; Fri, 12 Oct 2018 14:41:43 +0000 From: Gagandeep Singh To: dev@dpdk.org, akhil.goyal@nxp.com Cc: Gagandeep Singh , Hemant Agrawal Date: Fri, 12 Oct 2018 20:10:47 +0530 Message-Id: <20181012144055.9461-7-g.singh@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181012144055.9461-1-g.singh@nxp.com> References: <20180913060846.29930-1-g.singh@nxp.com> <20181012144055.9461-1-g.singh@nxp.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: PN1PR0101CA0039.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:c::25) To HE1PR04MB1530.eurprd04.prod.outlook.com (2a01:111:e400:59a8::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bc7f4738-eddc-442e-898e-08d63050d4fc X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:HE1PR04MB1530; X-Microsoft-Exchange-Diagnostics: 1; HE1PR04MB1530; 3:qoG65ZfpUJomQcSzawiHnAkqDukr8rnw6Wu7pCotlFkmkB5wRVU3cHv1rTKH1fQRYsTzzTIvuwWnsDf8jpfRDcx5xrKJUnJ7rwj7IQtwnjbIK80SU+XM2mAriEyZyiXke0QOh3OY3yBj+5vMkoWvjvNTVutMXNz0hOxHpVx053fw65zZnmJ6pzseNTjF7Vynz1BY9NV43mki6vlM+AYJAFegUYiCq49XPmklGjLMlrHliJmihZn7jqkPZiiOuNld; 25:XWKIAA28fB3FG3IEZq1LBnCzRRwvThYOFM2w5oqpZi+PJrTcjvcl9Xdi8di5+5ulic5jkOCbYS6z7712/Ykfxjmz5drsC3d1zrYwu2raQX5mw/66jogT0Z+jCk+31ABnIx2pADYg2OQB/uqPFcC0xS4SUsH2cveLLS/aaDzH5S7OxVjaS72W3FAqIIE4E5uLSUk5TKjz2DE1HC6kAQvS0gRtTKOeepldI6uMN+f9KKUeQHGquNcCb3tV0bBqoi39SxkMZ91Z9H9mf72+SdAgmtZLtnQTjyrV4L5IgB4wQG9KPrT4AmM4iJNghoU6XGug5gpMATsrfO3aoxus8Rbtig==; 31:yjEDQcBqYvoXYhDqH6tIGmh8a1MbG6eDW211p1xqaMmUybrcLH4VN4CTPjwS6AohQgqL3N4a6ik8TpqUYkFPdmXd2WNtTJvXU56e9eoPo2PZVMZN+p2zii/zJko55YTPD5PhBrc8FbP0sqTDRDJrr19kStQq/vPznPQ4MJiUDa2LBeb7hJKaIgtXt8YVYVKhpqLBaFmluw37s2qNMGjtX9yypWNT9fbolPJXE3o81GA= X-MS-TrafficTypeDiagnostic: HE1PR04MB1530: X-Microsoft-Exchange-Diagnostics: 1; HE1PR04MB1530; 20:oRJis645Z4aiHyDU/87qKAdzCiC27rvI15xJ0GKU1G4hgWFemd7/1xrK/bmiHVFJitrdZc0HsOWC0lf1g4EkgUAbwZL6ZvFR4K4yThDSc17QdaqAVZN82reDzjva6p0V09EbSCVlzd8qzJ5PSRjpJSiuhmxPP2vzl4/tyX74ZZrbNfooBg8r+XPli3xXJjO0Cee12QKVZ6QyHspE+ujVfO2kL/mTOm7iuHR2EqwUCyqaoRalVlqr1F06QulryNsnr5bwJa4IVSPZtawn4tIBtcefWnpNpOlgq+SImbGXyCH0+0va7iZaok1A1O7LOga5pb0GdJjJmt2pa/EiwWW6w3Y/OpqSuRb70CecZ9uUSGIyB75Eq4kwiFfbTek5MiuyNq2IFnZFZ/9vf+M9hB2+enii0Z06tF6nv2Re82M7nlgghoTqi9D7NR0dGsON6O5Vz0H1MFed+9nedUBYjftY3I7FhUNhvRTh1gzbUGL6qN2FXeVpN/h2YDTiAhewoF4n; 4:66BvHKzDPtHSMMvPFy/Qa5gliZmPKuknfW0g+Q0dtIe+Fa2JBJ8JTDMVQKLD3SvlcRwH0Gg+pliccr6q8dsmDbVHPC16VCRqqZHb0xKvuUO/nD9cqTipR52ImxfTr4KY7lV73SI0/ZjV6gmAv9M7HPR02Uly6NBOMf+xJdyWPsLp+Qt5D51vFE9ee5g1huQU2BsQw7jwI0LJyID8gT6Qt6/jMuRY8hbEF39Y14Y0ZZ0P6EOJrMnpT3F2sMyAzh2ZjwOFmBxGTzrZO58jQb+SlMMVY5DZGNBMoC5CcC9mxD73ztxAUl9q9F5SxV5mCIDu 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)(8121501046)(5005006)(3002001)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(6055026)(149066)(150057)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123562045)(201708071742011)(7699051); SRVR:HE1PR04MB1530; BCL:0; PCL:0; RULEID:; SRVR:HE1PR04MB1530; X-Forefront-PRVS: 0823A5777B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(376002)(366004)(396003)(136003)(39860400002)(189003)(199004)(316002)(305945005)(8936002)(386003)(55236004)(6636002)(6506007)(106356001)(25786009)(36756003)(16586007)(5660300001)(72206003)(52116002)(53936002)(26005)(6512007)(478600001)(54906003)(68736007)(186003)(16526019)(50226002)(7736002)(105586002)(51416003)(97736004)(76176011)(78486009)(3846002)(2906002)(66066001)(1076002)(4326008)(956004)(446003)(2616005)(47776003)(11346002)(1006002)(6116002)(486006)(14444005)(476003)(8676002)(50466002)(48376002)(81156014)(86362001)(81166006)(6486002)(110426005); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR04MB1530; H:Tophie.ap.freescale.net; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR04MB1530; 23:Aj/7Ry32gq6MaVGsoDTVYKl0JHhFRAUdmhcfuPgIx?= =?us-ascii?Q?R6uZR2xMuUJ6anSbMeuNeqY7cl/+OapnunI8t5xFnkc0B9fTDRdJ7fLj9Kb/?= =?us-ascii?Q?1rwuCgysvX/jI7ZizGkiZoEBBu6GFFe6rfePdd+FHE0iy9datk1lfZ0s7MsG?= =?us-ascii?Q?TnHWDHZ5j99JqcIFCgHdQ1RpPZ8U4Evok56yEoNrQukhu/ZwZV20D7f8bqT0?= =?us-ascii?Q?VRuJbHDKsN0/yH63HKOupfFSi0kH+9iaRji5fopwL6ZkzaSJFEwn7kmSLhZT?= =?us-ascii?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Mo8YsMnZ2vKuwYpF5h//ygFRUg==; 5:AIinM2x4Ee9RrQqBQ0Df759ff2deldYNAtyG0TwSZUbfHV1EsCNge64Fa36hC96EzaxqZbqwAA9hj2oGi0apVSnT69dgyCcmBIi1m/Ud3vE39DoDbSzyP08X9s/8wcdEBITY2USPsi1PYCu9NKm4U54qArrs0YrcFpFz2LGnlV0=; 7:KIK6Ph1QEGZaIc7hael8mogsOhB0w1iKPZNJ1OrAvUwerEAeUXO9SIpalyoUx2a433eK9jU0VG+FS5g7+3pMsrFTpiKG6go1cPLAw8KlESZdFMyMbDaS74XnhC7HkCIeD3aVeNBKzahoF7k30hCl3LDvgarRp9jAKeVKnrDuAFrvadthGZMU2nuP8KLvYaeuMuQakxKPZqfx63Il6iYm/5u4qh8ZQhoXaUYpxmLxdjkFWyxAlfD1h6Kc07k8eq33 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2018 14:41:43.6309 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bc7f4738-eddc-442e-898e-08d63050d4fc X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR04MB1530 Subject: [dpdk-dev] [PATCH v2 06/14] 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: , X-List-Received-Date: Fri, 12 Oct 2018 14:41:47 -0000 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 --- 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 cb024a979..cdae2a4fc 100644 --- a/drivers/crypto/caam_jr/caam_jr.c +++ b/drivers/crypto/caam_jr/caam_jr.c @@ -98,6 +98,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. @@ -361,7 +444,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 -- 2.17.1