From patchwork Tue Apr 30 20:21:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 139755 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5951143F56; Tue, 30 Apr 2024 22:23:09 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 649704069D; Tue, 30 Apr 2024 22:22:24 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2088.outbound.protection.outlook.com [40.107.93.88]) by mails.dpdk.org (Postfix) with ESMTP id B9F3D4067E for ; Tue, 30 Apr 2024 22:22:21 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JGPKF/3Z6E1KayqkYyZUa/VbVycOEKLwxNs111JKseFtH40RGxsynz+ItDoP8EzaoIJTyMjYrR4RKmk0OylExllwH5/6e34XJiLS/tICrLK1F6flL5g2olbcX+aAO9P1SER64z7EzrkPxPad4Gokg81DB0ZgMdMmpaMCkO5vjODFV5eNyqz2l1u09ifeEfIZZgkg96HMc7BS6jlVIxSJoLeZmpV3+CisyaqVbYAvQlW4+Yl0lCyDN2BEj96MFOzALwD6yPBu9x8Z0tL7H2bzDmlRkY9Dl+Z2iCvPEzWusvh333d0Kq8AUgGhU+A8oYKyeRjmlvb8pHHlMSPmb2R2dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=t5cpLtLHMeHbY079X6IgFZ4ZWtb60Xrsn0OXMagwA8U=; b=CF5wA9rWMRxjJjLaw1Hb/L1Kzd1H/Xgcwu5atq5o4Il8pU15wP/athNjel9ads2hRkJqZ6wATuoj8yoorkZEphgSCKKb0Yt3ESl6pjVTpwQVF7qhUp8Ha2Dm/Hke750r8hzbdJ0jdr9yGbAuMiYsRiYmaKxJ1YOBqlhonH2r+Ce7e90Ls8Ya5Fxx0iauHdBZ0yHlODWXuGL+AU6GI/aZCW1YI5EFWWYA79eRcSsAarfuLA0OGJt0g4Cur2Qor1of+HUFxlL6MScgxleNzHwHaPKOUcAva5QRg6V8CmZLlaCauPCc1wWzVjwzYqVvHxfN9kW7JSKs6HVhaeezcHD+dg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=dpdk.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=t5cpLtLHMeHbY079X6IgFZ4ZWtb60Xrsn0OXMagwA8U=; b=j3SmgVxKcoy09X6G4xa/EFa3XOl2DGURNc+04jNj3MC6AtsDXgC/9Gt5+eDkIJFN81YjcsoO1KU/0ghun5KW6nahbVyGxX19tlnxiub5xhUD7EOuCQ15i1aH3Dju5gUMoCE09yHDvKOA00jutWDfw17un436/kIB+HhaTdroaKw= Received: from SN7PR04CA0003.namprd04.prod.outlook.com (2603:10b6:806:f2::8) by CH3PR12MB7665.namprd12.prod.outlook.com (2603:10b6:610:14a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.34; Tue, 30 Apr 2024 20:22:11 +0000 Received: from SN1PEPF00026369.namprd02.prod.outlook.com (2603:10b6:806:f2:cafe::aa) by SN7PR04CA0003.outlook.office365.com (2603:10b6:806:f2::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.24 via Frontend Transport; Tue, 30 Apr 2024 20:22:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SN1PEPF00026369.mail.protection.outlook.com (10.167.241.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7544.18 via Frontend Transport; Tue, 30 Apr 2024 20:22:10 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 30 Apr 2024 15:22:09 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v2 6/9] crypto/ionic: add session support Date: Tue, 30 Apr 2024 13:21:41 -0700 Message-ID: <20240430202144.49899-7-andrew.boyer@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240430202144.49899-1-andrew.boyer@amd.com> References: <20240419195310.21432-1-andrew.boyer@amd.com> <20240430202144.49899-1-andrew.boyer@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF00026369:EE_|CH3PR12MB7665:EE_ X-MS-Office365-Filtering-Correlation-Id: 3dbbcb2a-59ea-4329-5f9a-08dc695336f2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|1800799015|82310400014|376005|36860700004; X-Microsoft-Antispam-Message-Info: xgOKcTqyGQTjhXWsm/rsUH53P665a5feviy3jvMZSzpSnGjCfNZujJFL/2x43/L8RNudxsbiBOqI7KgubfOwMMIu6m29X2H20D3EN7V7mVjFiuM9iiO7J4sFzIRKZxsrqASh27K98++zQxAUwVMgJ/D2TrmXoriYMId/NHMrqkhRFeW7yVEpXbn+lyP7wksiE2Ktlt5nPV6x4TBx9O3nj/Z8YyzckCbYKndym27JgWTgUFN45DzU9+jHv+e8JdSALFQHJ+K7CyDygdJWcSj4bLJ6ol/VpDpDLQM83Vpfxpnlxq0o5YVgNt2ldn2G0s/hu4oTQjIZtqvJwYERXWFKBdWWZPhUVJmINOxQjbHecUpoPPt87jaPdXLRgQMFeGSlfKQaGFnWff1c6qxx4HL5u/UKQI0297XinMp+XPHlcwyfJdAuUW/T5d8ioz3uFUWxiFlLV8wXCz9EclTuqCCIwPA6ZM+l0LzrSRdGcgthOY8byhrjSj3xqvG5qXdDbiW1qpVg/x0OtzmZ8j1CboKEfTsN0cZGuAHB4Qy3ZLGm8TgzLmWw8+COVN5xi1RuO6q8BQIl8QKhfOJ/4BxFwg9WYZQZ0fPDvnqs1Wji/KGq9VAic8JCa19MshP6SaCixvyBxfUvmGOynxgv5DvDORm/QzLHjevi2RT8XsbNfz2HJUThXSQ8UtXlSH7XWxjrximMuRJMm/+a47p5/59T3EaL5bz/LX4Q4n1wkfZv1Si5cqjilhtGYti6zI5hnEpiQ2WcKDRi2IocM2cvYwoA7Ymxq08aLcZ6Ly5QYaUTKmZ/Qox5rcQaNB8cTlRg5jKca6A1vDUmRccIw90HbvexIhAqLShSyI5IMazERkY0rAkYYTl7H+bK2bO0axu8StHKYD0i0zV4whkpHnILpg02kii1gg46xiQCbDUjGzablUR7T8vGr0AslVjKO0oNHLYJpYIucPxEM+Vi7YsNWhLUp+TS1UIc/tlJ+ydTzoIydWeMddg+WyT/Mn2MMIzJGx7hmBq/wHwnwP/nFzKtETrXQjdUJwQv3JocTGWt/hOZ80Go0tmWqHX+qR0raIMWJ94gyN6gXyMCSfCpWy4m0EYY9aKtOOrY/Bswh9d5ukPvT25J8A0WsYC3WCBvb+7POk+r0SV0uBlI572JtGV58M+lDe01rts4iDw64Fgsarp8RAatJEfeZnAJLDV2pS9VAMxtme/+XG+hJicJ2b9FH0rutA3QnThniDG+SYUMT6FQyh0MR1A1XLYMCfzmhnGQj3bpFCSp9/AMn3gYGzwu9XeEer0AXUO9Ty5RxY01zxoLNa7XvJd6HhAXg/MwJvj4RqlzmI32Fw4/gCyEagvqQdUNNGbJN7+bn1wKBEiKm4hQ2yBCOiFFAJNSEErpbZOcLoU93sV6 X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(1800799015)(82310400014)(376005)(36860700004); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2024 20:22:10.4198 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3dbbcb2a-59ea-4329-5f9a-08dc695336f2 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF00026369.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7665 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This defines the session object and related commands. Signed-off-by: Andrew Boyer --- drivers/crypto/ionic/ionic_crypto.h | 33 ++++++ drivers/crypto/ionic/ionic_crypto_main.c | 143 +++++++++++++++++++++++ drivers/crypto/ionic/ionic_crypto_ops.c | 123 +++++++++++++++++++ 3 files changed, 299 insertions(+) diff --git a/drivers/crypto/ionic/ionic_crypto.h b/drivers/crypto/ionic/ionic_crypto.h index f487768c10..f50c4b4291 100644 --- a/drivers/crypto/ionic/ionic_crypto.h +++ b/drivers/crypto/ionic/ionic_crypto.h @@ -14,6 +14,7 @@ #include #include #include +#include #include "ionic_common.h" #include "ionic_crypto_if.h" @@ -154,6 +155,32 @@ struct iocpt_admin_q { uint16_t flags; }; +#define IOCPT_S_F_INITED BIT(0) + +struct iocpt_session_priv { + struct iocpt_dev *dev; + + uint32_t index; + + uint16_t iv_offset; + uint16_t iv_length; + uint16_t digest_length; + uint16_t aad_length; + + uint8_t flags; + uint8_t op; + uint8_t type; + + uint16_t key_len; + uint8_t key[IOCPT_SESS_KEY_LEN_MAX_SYMM]; +}; + +static inline uint32_t +iocpt_session_size(void) +{ + return sizeof(struct iocpt_session_priv); +} + #define IOCPT_DEV_F_INITED BIT(0) #define IOCPT_DEV_F_UP BIT(1) #define IOCPT_DEV_F_FW_RESET BIT(2) @@ -186,6 +213,8 @@ struct iocpt_dev { struct iocpt_admin_q *adminq; + struct rte_bitmap *sess_bm; /* SET bit indicates index is free */ + uint64_t features; uint32_t hw_features; @@ -239,6 +268,10 @@ void iocpt_dev_reset(struct iocpt_dev *dev); int iocpt_adminq_post_wait(struct iocpt_dev *dev, struct iocpt_admin_ctx *ctx); +int iocpt_session_init(struct iocpt_session_priv *priv); +int iocpt_session_update(struct iocpt_session_priv *priv); +void iocpt_session_deinit(struct iocpt_session_priv *priv); + struct ionic_doorbell __iomem *iocpt_db_map(struct iocpt_dev *dev, struct iocpt_queue *q); diff --git a/drivers/crypto/ionic/ionic_crypto_main.c b/drivers/crypto/ionic/ionic_crypto_main.c index 3ff2d51950..cc893ad8e9 100644 --- a/drivers/crypto/ionic/ionic_crypto_main.c +++ b/drivers/crypto/ionic/ionic_crypto_main.c @@ -112,6 +112,116 @@ iocpt_q_free(struct iocpt_queue *q) } } +static int +iocpt_session_write(struct iocpt_session_priv *priv, + enum iocpt_sess_control_oper oper) +{ + struct iocpt_dev *dev = priv->dev; + struct iocpt_admin_ctx ctx = { + .pending_work = true, + .cmd.sess_control = { + .opcode = IOCPT_CMD_SESS_CONTROL, + .type = priv->type, + .oper = oper, + .index = rte_cpu_to_le_32(priv->index), + .key_len = rte_cpu_to_le_16(priv->key_len), + .key_seg_len = (uint8_t)RTE_MIN(priv->key_len, + IOCPT_SESS_KEY_SEG_LEN), + }, + }; + struct iocpt_sess_control_cmd *cmd = &ctx.cmd.sess_control; + uint16_t key_offset; + uint8_t key_segs, seg; + int err; + + key_segs = ((priv->key_len - 1) >> IOCPT_SESS_KEY_SEG_SHFT) + 1; + + for (seg = 0; seg < key_segs; seg++) { + ctx.pending_work = true; + + key_offset = seg * cmd->key_seg_len; + memcpy(cmd->key, &priv->key[key_offset], + IOCPT_SESS_KEY_SEG_LEN); + cmd->key_seg_idx = seg; + + /* Mark final segment */ + if (seg + 1 == key_segs) + cmd->flags |= rte_cpu_to_le_16(IOCPT_SCTL_F_END); + + err = iocpt_adminq_post_wait(dev, &ctx); + if (err != 0) + return err; + } + + return 0; +} + +int +iocpt_session_init(struct iocpt_session_priv *priv) +{ + struct iocpt_dev *dev = priv->dev; + uint64_t bm_slab = 0; + uint32_t bm_pos = 0; + int err = 0; + + rte_spinlock_lock(&dev->adminq_lock); + + if (rte_bitmap_scan(dev->sess_bm, &bm_pos, &bm_slab) > 0) { + priv->index = bm_pos + rte_ctz64(bm_slab); + rte_bitmap_clear(dev->sess_bm, priv->index); + } else + err = -ENOSPC; + + rte_spinlock_unlock(&dev->adminq_lock); + + if (err != 0) { + IOCPT_PRINT(ERR, "session index space exhausted"); + return err; + } + + err = iocpt_session_write(priv, IOCPT_SESS_INIT); + if (err != 0) { + rte_spinlock_lock(&dev->adminq_lock); + rte_bitmap_set(dev->sess_bm, priv->index); + rte_spinlock_unlock(&dev->adminq_lock); + return err; + } + + priv->flags |= IOCPT_S_F_INITED; + + return 0; +} + +int +iocpt_session_update(struct iocpt_session_priv *priv) +{ + return iocpt_session_write(priv, IOCPT_SESS_UPDATE_KEY); +} + +void +iocpt_session_deinit(struct iocpt_session_priv *priv) +{ + struct iocpt_dev *dev = priv->dev; + struct iocpt_admin_ctx ctx = { + .pending_work = true, + .cmd.sess_control = { + .opcode = IOCPT_CMD_SESS_CONTROL, + .type = priv->type, + .oper = IOCPT_SESS_DISABLE, + .index = rte_cpu_to_le_32(priv->index), + .key_len = rte_cpu_to_le_16(priv->key_len), + }, + }; + + (void)iocpt_adminq_post_wait(dev, &ctx); + + rte_spinlock_lock(&dev->adminq_lock); + rte_bitmap_set(dev->sess_bm, priv->index); + rte_spinlock_unlock(&dev->adminq_lock); + + priv->flags &= ~IOCPT_S_F_INITED; +} + static const struct rte_memzone * iocpt_dma_zone_reserve(const char *type_name, uint16_t qid, size_t size, unsigned int align, int socket_id) @@ -305,6 +415,8 @@ iocpt_adminq_free(struct iocpt_admin_q *aq) static int iocpt_alloc_objs(struct iocpt_dev *dev) { + uint32_t bmsize, i; + uint8_t *bm; int err; IOCPT_PRINT(DEBUG, "Crypto: %s", dev->name); @@ -331,8 +443,33 @@ iocpt_alloc_objs(struct iocpt_dev *dev) dev->info = dev->info_z->addr; dev->info_pa = dev->info_z->iova; + bmsize = rte_bitmap_get_memory_footprint(dev->max_sessions); + bm = rte_malloc_socket("iocpt", bmsize, + RTE_CACHE_LINE_SIZE, dev->socket_id); + if (bm == NULL) { + IOCPT_PRINT(ERR, "Cannot allocate %uB bitmap memory", bmsize); + err = -ENOMEM; + goto err_free_dmazone; + } + + dev->sess_bm = rte_bitmap_init(dev->max_sessions, bm, bmsize); + if (dev->sess_bm == NULL) { + IOCPT_PRINT(ERR, "Cannot initialize bitmap"); + err = -EFAULT; + goto err_free_bm; + } + for (i = 0; i < dev->max_sessions; i++) + rte_bitmap_set(dev->sess_bm, i); + return 0; +err_free_bm: + rte_free(bm); +err_free_dmazone: + rte_memzone_free(dev->info_z); + dev->info_z = NULL; + dev->info = NULL; + dev->info_pa = 0; err_free_adminq: iocpt_adminq_free(dev->adminq); dev->adminq = NULL; @@ -383,6 +520,12 @@ iocpt_free_objs(struct iocpt_dev *dev) { IOCPT_PRINT_CALL(); + if (dev->sess_bm != NULL) { + rte_bitmap_free(dev->sess_bm); + rte_free(dev->sess_bm); + dev->sess_bm = NULL; + } + if (dev->adminq != NULL) { iocpt_adminq_free(dev->adminq); dev->adminq = NULL; diff --git a/drivers/crypto/ionic/ionic_crypto_ops.c b/drivers/crypto/ionic/ionic_crypto_ops.c index 74a6ce56ea..e6b3402b63 100644 --- a/drivers/crypto/ionic/ionic_crypto_ops.c +++ b/drivers/crypto/ionic/ionic_crypto_ops.c @@ -48,10 +48,133 @@ iocpt_op_info_get(struct rte_cryptodev *cdev, struct rte_cryptodev_info *info) info->min_mbuf_tailroom_req = 0; } +static unsigned int +iocpt_op_get_session_size(struct rte_cryptodev *cdev __rte_unused) +{ + return iocpt_session_size(); +} + +static inline int +iocpt_is_algo_supported(struct rte_crypto_sym_xform *xform) +{ + if (xform->next != NULL) { + IOCPT_PRINT(ERR, "chaining not supported"); + return -ENOTSUP; + } + + if (xform->type != RTE_CRYPTO_SYM_XFORM_AEAD) { + IOCPT_PRINT(ERR, "xform->type %d not supported", xform->type); + return -ENOTSUP; + } + + return 0; +} + +static __rte_always_inline int +iocpt_fill_sess_aead(struct rte_crypto_sym_xform *xform, + struct iocpt_session_priv *priv) +{ + struct rte_crypto_aead_xform *aead_form = &xform->aead; + + if (aead_form->algo != RTE_CRYPTO_AEAD_AES_GCM) { + IOCPT_PRINT(ERR, "Unknown algo"); + return -EINVAL; + } + if (aead_form->op == RTE_CRYPTO_AEAD_OP_ENCRYPT) { + priv->op = IOCPT_DESC_OPCODE_GCM_AEAD_ENCRYPT; + } else if (aead_form->op == RTE_CRYPTO_AEAD_OP_DECRYPT) { + priv->op = IOCPT_DESC_OPCODE_GCM_AEAD_DECRYPT; + } else { + IOCPT_PRINT(ERR, "Unknown cipher operations"); + return -1; + } + + if (aead_form->key.length < IOCPT_SESS_KEY_LEN_MIN || + aead_form->key.length > IOCPT_SESS_KEY_LEN_MAX_SYMM) { + IOCPT_PRINT(ERR, "Invalid cipher keylen %u", + aead_form->key.length); + return -1; + } + priv->key_len = aead_form->key.length; + memcpy(priv->key, aead_form->key.data, priv->key_len); + + priv->type = IOCPT_SESS_AEAD_AES_GCM; + priv->iv_offset = aead_form->iv.offset; + priv->iv_length = aead_form->iv.length; + priv->digest_length = aead_form->digest_length; + priv->aad_length = aead_form->aad_length; + + return 0; +} + +static int +iocpt_session_cfg(struct iocpt_dev *dev, + struct rte_crypto_sym_xform *xform, + struct rte_cryptodev_sym_session *sess) +{ + struct rte_crypto_sym_xform *chain; + struct iocpt_session_priv *priv = NULL; + + if (iocpt_is_algo_supported(xform) < 0) + return -ENOTSUP; + + if (unlikely(sess == NULL)) { + IOCPT_PRINT(ERR, "invalid session"); + return -EINVAL; + } + + priv = CRYPTODEV_GET_SYM_SESS_PRIV(sess); + priv->dev = dev; + + chain = xform; + while (chain) { + switch (chain->type) { + case RTE_CRYPTO_SYM_XFORM_AEAD: + if (iocpt_fill_sess_aead(chain, priv)) + return -EIO; + break; + default: + IOCPT_PRINT(ERR, "invalid crypto xform type %d", + chain->type); + return -ENOTSUP; + } + chain = chain->next; + } + + return iocpt_session_init(priv); +} + +static int +iocpt_op_session_cfg(struct rte_cryptodev *cdev, + struct rte_crypto_sym_xform *xform, + struct rte_cryptodev_sym_session *sess) +{ + struct iocpt_dev *dev = cdev->data->dev_private; + + return iocpt_session_cfg(dev, xform, sess); +} + +static void +iocpt_session_clear(struct rte_cryptodev_sym_session *sess) +{ + iocpt_session_deinit(CRYPTODEV_GET_SYM_SESS_PRIV(sess)); +} + +static void +iocpt_op_session_clear(struct rte_cryptodev *cdev __rte_unused, + struct rte_cryptodev_sym_session *sess) +{ + iocpt_session_clear(sess); +} + static struct rte_cryptodev_ops iocpt_ops = { .dev_configure = iocpt_op_config, .dev_close = iocpt_op_close, .dev_infos_get = iocpt_op_info_get, + + .sym_session_get_size = iocpt_op_get_session_size, + .sym_session_configure = iocpt_op_session_cfg, + .sym_session_clear = iocpt_op_session_clear, }; int