From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0082.outbound.protection.outlook.com [104.47.32.82]) by dpdk.org (Postfix) with ESMTP id C0DE63256 for ; Tue, 4 Sep 2018 06:03:09 +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=6+NDwqfJ5NWNXVy/gpBidbpSAGom3k1IWC0WQqdeI04=; b=LtjqiJ+yPB7V1smfrAxbSEFE+YZU5IHcy5JCCEFcAIdtYBQvBT9C3MTYTmidN7EfTqII51BKazTruoEjyDwDmvjiMQ5uVZc+Z1JKcfZ1ERoUUgS1ApjxRyUte7eX6zetOuJdWc8VH5lQR1d+SGz7NmIcAgB4+rBasc8Cl5OQK/w= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Anoob.Joseph@cavium.com; Received: from ajoseph83.caveonetworks.com.com (115.113.156.2) by BYAPR07MB4902.namprd07.prod.outlook.com (2603:10b6:a02:ef::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1101.15; Tue, 4 Sep 2018 04:02:57 +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: Tue, 4 Sep 2018 09:29:04 +0530 Message-Id: <1536033560-21541-18-git-send-email-ajoseph@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536033560-21541-1-git-send-email-ajoseph@caviumnetworks.com> References: <1528476325-15585-1-git-send-email-anoob.joseph@caviumnetworks.com> <1536033560-21541-1-git-send-email-ajoseph@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [115.113.156.2] X-ClientProxiedBy: BMXPR01CA0023.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:d::33) To BYAPR07MB4902.namprd07.prod.outlook.com (2603:10b6:a02:ef::25) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 62daed6e-99b2-461a-8030-08d6121b4ef4 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BYAPR07MB4902; X-Microsoft-Exchange-Diagnostics: 1; BYAPR07MB4902; 3:vGEE0UaDGkrrYz5WIMND0jaoVzQY8Qy7iJrRJc4tDv2fQkjDSojraXC4H8oyO4237wjJWGL6jyGVdxvXqSo07uDd+6TYnz1D5ycBf2bE+sKdODKHuAeHuq6eyBu7233GSEjNNztpITJFiUexc9HBDQLk6DAn2JdAC1z6LpR19WT1FbHvExpS7zT9ZmnPmDnsF3m3IJn9AfkellzbykKOL3jxnwEiZlt2GQoNPWGPqS97NIHLC3Gz0ZGz6mJf/ybb; 25:dB+Kw4WJxlcPfLiYnfyrZ1dVGsp6QiN9h3O0/VY3houAAz6GkYSBWvVHdNIKyE5mCbUUIFfLQLddGVWrBvC3upNWvAnWu4uxDMUR1m0khBDK71024j0SU4nCMXZzkYKooz1gCu4KQULAkcSRCSMlYDVpHsaafR9xRhutK6wEfsL+i0Ph457+hwcQb3wqtVVw3XGE7FiMLxGycF/cnRQQxzmJUuhKUfxxL/OAXZbO2mwtTCa4SVFjseNt/aaJbYtGNJOr74/xthTPUou8zDdaCc6grk+GqS3u/E+/di+j0Sr+keh9t8q+LxagKONce0doGSEYMYZlt2zQPTXdXMYALQ==; 31:0e3hN6MLaQ3Xr8T3k2VC9BYq/tkwvA6TGbMJLhNiHDLhHZSKIhX2TG6kdSZykSSgHzETTQH9vrgkk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YkHOaknSgrdv/VksJd8sF6rS4eei0G71VCKhHzByCqA7ggGZN5Sy7Ii/amcVbrUlSM5Q== 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)(10201501046)(93006095)(3231311)(944501410)(52105095)(3002001)(149027)(150027)(6041310)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(201708071742011)(7699016); SRVR:BYAPR07MB4902; BCL:0; PCL:0; RULEID:; SRVR:BYAPR07MB4902; X-Forefront-PRVS: 0785459C39 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(396003)(136003)(346002)(376002)(39860400002)(199004)(189003)(26005)(51416003)(52116002)(76176011)(81166006)(305945005)(81156014)(7736002)(105586002)(316002)(6506007)(106356001)(6512007)(8936002)(446003)(54906003)(25786009)(6666003)(68736007)(50226002)(110136005)(53936002)(16586007)(42882007)(386003)(5660300001)(2906002)(72206003)(50466002)(6486002)(36756003)(6116002)(107886003)(2616005)(14444005)(186003)(3846002)(478600001)(66066001)(476003)(8676002)(47776003)(486006)(956004)(48376002)(11346002)(4326008)(97736004)(16526019); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR07MB4902; 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; BYAPR07MB4902; 23:WL1jFvzIdJx1UtPL/y1h/xskYya/uNZrSLX+WKQ69?= =?us-ascii?Q?8dyu8ZB05VEE9h5oeGGll93TSgLEY4kDKBtD/Bpvxwanc7o9GJ+5f3jbnkHR?= =?us-ascii?Q?B8TpqXXjEQNcQzxVNX8g55e2aHf1AtVpW6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B/FJzb6lKGBPdQ34CNHgwF/6kP4PiSmiWPBS4UyjXILwMvm5Gew0+WvXQAKIJAxFMX92dbz8qLtBl9VAgRwX86P1p3iRXqtRhFLzowSHGnagKVsoMn3HzU/A00aHFvp+pOvKnjQOIew==; 5:1rc6Cl+uTtXFKREGzvwM7i15uCadNaXR0j6IPJmorfHHze8n6XUL5CqyLhIN0Vwa5sX+VAMq2/rm3sP9bL+J5apkFjVB/6wkIJY67cYNgy5YAEA9kU6bRdGgpobe7qBia9FTjt7ehdStoHErAt65p2Jj6awPE4xYPw2+k5JbAbI=; 7:Vf525KMtYcP+qW36PCyl+SrSCJTU+3SPnwam0fadP1snVuwi7e0iuwqBVcn8zB40seSIb9NX3erbH0BKwdAD57ZyphTz3EE+kQ8r5x8Y0tZe4vXi4urCOFlaBxI1EwRRZAzUXYWkxdVstFCTKPWlKM4UW8RSuwE0IZic/0TAcnLqxti3p/KIl4TZy6sdpE4LTV8ddaHTEwUmMk3xhQjZ6M5ErDOEFnH2JQzaBfetR0EPaIKBikeotRxQVqz/q9uR SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2018 04:02:57.8504 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 62daed6e-99b2-461a-8030-08d6121b4ef4 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB4902 Subject: [dpdk-dev] [PATCH v2 17/33] 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: Tue, 04 Sep 2018 04:03:10 -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 | 83 +++++++++++++++++++++++++++-- 1 file changed, 80 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c index e6b2ed9..51f374d 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" @@ -251,6 +253,81 @@ 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; + + 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: + 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, @@ -266,9 +343,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