From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0068.outbound.protection.outlook.com [104.47.33.68]) by dpdk.org (Postfix) with ESMTP id 595975F17 for ; Fri, 5 Oct 2018 15:01:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mJ1xF8ND5CKmuRwWJuLVjpZR5usc48a90yd4vpArexk=; b=Jiv5nuyqNNLoqzk1Uq8bUAda0g+12IwMKqtvUtYw0doMFbS1GxnC1LWlGR38r/9bMP+P7qv5TnWUWSZxyG3XXbbd8jH8jq7an2Q25mdojA/bPYAGdVRd5p6JwGV52Wwf0N9EFUCKAQ29Ob2VK4Oqa5EVtueSuD2Y1PbFBuqy50A= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Anoob.Joseph@cavium.com; Received: from ajoseph83.caveonetworks.com.com (115.113.156.2) by SN6PR07MB4910.namprd07.prod.outlook.com (2603:10b6:805:39::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.21; Fri, 5 Oct 2018 13:01:25 +0000 From: Anoob Joseph To: Akhil Goyal , Pablo de Lara , Thomas Monjalon Cc: Nithin Dabilpuram , Jerin Jacob , Narayana Prasad , dev@dpdk.org, Ankur Dwivedi , Anoob Joseph , Murthy NSSR , Ragothaman Jayaraman , Srisivasubramanian S , Tejasree Kondoj Date: Fri, 5 Oct 2018 18:29:07 +0530 Message-Id: <1538744363-30340-17-git-send-email-anoob.joseph@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1538744363-30340-1-git-send-email-anoob.joseph@caviumnetworks.com> References: <1536033560-21541-1-git-send-email-ajoseph@caviumnetworks.com> <1538744363-30340-1-git-send-email-anoob.joseph@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [115.113.156.2] X-ClientProxiedBy: MA1PR0101CA0036.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::22) To SN6PR07MB4910.namprd07.prod.outlook.com (2603:10b6:805:39::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 68ba8965-8257-461a-6aad-08d62ac2aa8b X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:SN6PR07MB4910; X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4910; 3:Boagxe1FXV/LyTRckLsWRGZDgGTwTrM+YcIOmcqWe2Xs7oPgGXXD/zqBbaDuU/syJw5rlqns2Zck8IgGw2fHExd1UlVOP3Gf4a+ZsHRjpHIcXWIiSmRtJfX8zTVVnzbsv+Ik3riIy7hAngs8hjDbt4KyOwvRr758OcNLif1aMpDSBhiRbHxoW3aUxSTKB1oQTLKYKIeyBoBUOZ83Ui4NVug9WBbVQ92DUKyd4MJkXJ7xt2RINPP0UxDl9oO8VuW0; 25:8f0aASAo1LNqj0Exeo/LBWTJIgJP6bRAwMWB1RJcJqmztSCvCg/Xkw991HyEPRF0UEnAjtEA027Lty42hbHqmrW8X1Zuzugnl9ox42hNDdY6rkRm+LJdVc70x/LrLJ+U7XwoR6DAHv8aQib3x6ZBe4pfwI2ZBAWjh0X0SmO/9GU+cD/zQNyGf2lEXY8UyG01GvlmukFdp0Act01nThUAymKrv1SJXBd1HXKk6OSuchna+DDayUIkL8hpQO3a1LowLIVjDecTy82DqZO62emY01tIMOD+2Rz1JflUN/pspXuc1d+uaYmzgg9Q4SFUP5KS7VuAzhylU1J6yK3YNhRgxg==; 31:CsGa9XC8l9RHfZqYuOTNuEzV8iNO9lcW8930eZwxKDDK+J0SK7CdXjiSHIC/68rG6QXK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dx5eTIhD/ntbh7zyJWopNcGwoAKWa7cBJaduGyfcuK6u36Eu8fyyE+0uL8XEPA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; 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)(149066)(150057)(6041310)(20161123564045)(20161123558120)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051); SRVR:SN6PR07MB4910; BCL:0; PCL:0; RULEID:; SRVR:SN6PR07MB4910; X-Forefront-PRVS: 0816F1D86E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(39860400002)(346002)(136003)(396003)(366004)(199004)(189003)(51416003)(76176011)(11346002)(50226002)(25786009)(8936002)(48376002)(305945005)(186003)(16526019)(110136005)(6486002)(3846002)(446003)(52116002)(6116002)(81156014)(8676002)(97736004)(5660300001)(50466002)(4326008)(956004)(42882007)(2616005)(68736007)(478600001)(54906003)(7736002)(81166006)(6666003)(16586007)(107886003)(26005)(55236004)(66066001)(386003)(47776003)(6512007)(72206003)(44832011)(476003)(316002)(14444005)(36756003)(105586002)(106356001)(486006)(6506007)(2906002)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN6PR07MB4910; H:ajoseph83.caveonetworks.com.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN6PR07MB4910; 23:/nzbDSi3/5PbuPx91ktq6cbLQxkDR+j0nHKmppgZr?= =?us-ascii?Q?dbgoVSRAdrqSA7HmTAMmGO/C5uVXKXAqbjWuwTMOqxyOJQzWDkA1mwkmOqPA?= =?us-ascii?Q?XgpKwUBKut5YxK5BsFXBIrUlw0g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6TEXw7czYP+NpwFAeTv6O1jNsNvKCW6rCtyoqDKPNLPQMjE4gqBCPg1tmtbA18D8zbWwMYCkSJRCi1dohyUtyvL+r0KAzhjxghrtEIMk8zy4OYIpLR2uIOhhwYmMwsnKvioDBvNkDpt2lE38WSuApma0h7InAsWKipYKJCA/j0lx45ztLvvzJtTaD42IrX9c20kw==; 5:7YCbh79miHrHGT/N2hssymkHAxdXS4ZKCqVulJlbF6kcFlGqhgSzHGZHaKUGJwXUzhCaoSGTC6nVC/DaXrLZkbe72ofVXKfWDKBK6je1oRWTsHga7B4ZLyYel+tv6DAQni2Hdewwaa1Q+vwbaRJZmKmnaP4t4RY7wZ31kxcjOm0=; 7:xoKCBkLPyBwjfVZPvYIGQAcUcquof4YegH7g/rgiqxZuUirBRTX/aqFaT6HSIeYyb94ogW3Ym56cyRY8dYZ6PUgLXpBLOZ4Avscsc+H6dXCdmGAHxnaGpSRTap7tnjMbHtLycjY1o9XW3C0xsO4LmVNkgyOw9fOXGHVtMrYV7TEB3adwi0lWRBkX9SP4QyGS2Pll8zMbhiTYt6puVYMKEOphYc7V4D3OFRvPl/drePQ+LOye0gcLNcTWnO8//3aH SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Oct 2018 13:01:25.4341 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 68ba8965-8257-461a-6aad-08d62ac2aa8b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR07MB4910 Subject: [dpdk-dev] [PATCH v3 16/32] crypto/octeontx: add session management 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, 05 Oct 2018 13:01:30 -0000 From: Nithin Dabilpuram Adding routines for session configure, session clear and get session size ops. Signed-off-by: Ankur Dwivedi Signed-off-by: Anoob Joseph Signed-off-by: Murthy NSSR Signed-off-by: Nithin Dabilpuram Signed-off-by: Ragothaman Jayaraman Signed-off-by: Srisivasubramanian S Signed-off-by: Tejasree Kondoj --- drivers/crypto/octeontx/otx_cryptodev_ops.c | 84 +++++++++++++++++++++++++++-- 1 file changed, 81 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c index ed33334..653f372 100644 --- a/drivers/crypto/octeontx/otx_cryptodev_ops.c +++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c @@ -10,6 +10,8 @@ #include "cpt_pmd_logs.h" #include "cpt_pmd_ops_helper.h" +#include "cpt_ucode.h" +#include "cpt_request_mgr.h" #include "otx_cryptodev.h" #include "otx_cryptodev_capabilities.h" @@ -246,6 +248,82 @@ otx_cpt_que_pair_release(struct rte_cryptodev *dev, uint16_t que_pair_id) return 0; } +static unsigned int +otx_cpt_get_session_size(struct rte_cryptodev *dev __rte_unused) +{ + return cpt_get_session_size(); +} + +static void +otx_cpt_session_init(void *sym_sess, uint8_t driver_id) +{ + struct rte_cryptodev_sym_session *sess = sym_sess; + struct cpt_sess_misc *cpt_sess = + (struct cpt_sess_misc *) get_sym_session_private_data(sess, driver_id); + + CPT_PMD_INIT_FUNC_TRACE(); + cpt_sess->ctx_dma_addr = rte_mempool_virt2iova(cpt_sess) + + sizeof(struct cpt_sess_misc); +} + +static int +otx_cpt_session_cfg(struct rte_cryptodev *dev, + struct rte_crypto_sym_xform *xform, + struct rte_cryptodev_sym_session *sess, + struct rte_mempool *mempool) +{ + struct rte_crypto_sym_xform *chain; + void *sess_private_data = NULL; + + CPT_PMD_INIT_FUNC_TRACE(); + + if (cpt_is_algo_supported(xform)) + goto err; + + if (unlikely(sess == NULL)) { + CPT_LOG_ERR("invalid session struct"); + return -EINVAL; + } + + if (rte_mempool_get(mempool, &sess_private_data)) { + CPT_LOG_ERR("Could not allocate sess_private_data"); + return -ENOMEM; + } + + chain = xform; + while (chain) { + switch (chain->type) { + default: + CPT_LOG_ERR("Invalid crypto xform type"); + break; + } + chain = chain->next; + } + set_sym_session_private_data(sess, dev->driver_id, sess_private_data); + otx_cpt_session_init(sess, dev->driver_id); + return 0; + +err: + if (sess_private_data) + rte_mempool_put(mempool, sess_private_data); + return -EPERM; +} + +static void +otx_cpt_session_clear(struct rte_cryptodev *dev, + struct rte_cryptodev_sym_session *sess) +{ + void *sess_priv = get_sym_session_private_data(sess, dev->driver_id); + + CPT_PMD_INIT_FUNC_TRACE(); + if (sess_priv) { + memset(sess_priv, 0, otx_cpt_get_session_size(dev)); + struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv); + set_sym_session_private_data(sess, dev->driver_id, NULL); + rte_mempool_put(sess_mp, sess_priv); + } +} + static struct rte_cryptodev_ops cptvf_ops = { /* Device related operations */ .dev_configure = otx_cpt_dev_config, @@ -261,9 +339,9 @@ static struct rte_cryptodev_ops cptvf_ops = { .queue_pair_count = NULL, /* Crypto related operations */ - .sym_session_get_size = NULL, - .sym_session_configure = NULL, - .sym_session_clear = NULL + .sym_session_get_size = otx_cpt_get_session_size, + .sym_session_configure = otx_cpt_session_cfg, + .sym_session_clear = otx_cpt_session_clear }; static void -- 2.7.4