From patchwork Thu Jul 20 13:21:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil Goyal X-Patchwork-Id: 129670 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 403A842ECA; Thu, 20 Jul 2023 15:21:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C90E640DF5; Thu, 20 Jul 2023 15:21:31 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 7DC9440685 for ; Thu, 20 Jul 2023 15:21:30 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36K80elv007882; Thu, 20 Jul 2023 06:21:29 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=8ga9MtG6jBulrvySJ0CbHpkMGcBk7J5rwCh5dXaFY1M=; b=cSIuxGz4BUfjezOrl6b1ahox/w9i+qwmGvugqSOaB08nwaUVRSAPLH0nRdw+qFnmbUDz HSE9jweoVo7Efst6LHESDYfPD9S1IEi+MnDp8ly72JqVd4nnSp9nfBAjRxDqCV0kmG6l CDgBt6loXF8jetPBBE83uPhQBNGuis6rS9AFXKV2cMbZdnlQ0Ovh5E1SV0VFckPe4LjE dVkhbwzd+6PqYSIGD4/fROZy7NI4L9cQKDu/hnEXr+pdBbTP0xfDCS8vYEmjlMygYdKb WV3QImHFrPOHunoygeuVVYxET3HtT850UZjV6d92Rov2mO6d2ngb6T2zPNaB4XhnOzha tQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3ry11ps2fc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 20 Jul 2023 06:21:29 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Thu, 20 Jul 2023 06:21:27 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Thu, 20 Jul 2023 06:21:27 -0700 Received: from localhost.localdomain (unknown [10.28.36.102]) by maili.marvell.com (Postfix) with ESMTP id 04F323F70A3; Thu, 20 Jul 2023 06:21:25 -0700 (PDT) From: Akhil Goyal To: CC: , , , Akhil Goyal Subject: [PATCH] examples/ipsec-secgw: add security capabilities mapping Date: Thu, 20 Jul 2023 18:51:23 +0530 Message-ID: <20230720132123.3084969-1-gakhil@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Proofpoint-GUID: 31YVMpx3B4sR0sG0RdrBBvJoj-lamXCt X-Proofpoint-ORIG-GUID: 31YVMpx3B4sR0sG0RdrBBvJoj-lamXCt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-20_06,2023-07-20_01,2023-05-22_02 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 Currently the cryptodev queue pair mapping was done only on lookaside crypto capabilities. But device capabilities for lookaside crypto and lookaside proto may be different. Hence, mappings are also added for rte_security_capabilities of cryptodev. Signed-off-by: Akhil Goyal --- examples/ipsec-secgw/ipsec-secgw.c | 41 ++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index 72b3bfba9e..3ab7995fd5 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -1555,6 +1555,8 @@ add_cdev_mapping(const struct rte_cryptodev_info *dev_info, uint16_t cdev_id, struct lcore_conf *qconf; struct ipsec_ctx *ipsec_ctx; const char *str; + void *sec_ctx; + const struct rte_security_capability *sec_cap; qconf = &lcore_conf[params->lcore_id]; @@ -1569,8 +1571,8 @@ add_cdev_mapping(const struct rte_cryptodev_info *dev_info, uint16_t cdev_id, } /* Required cryptodevs with operation chaining */ - if (!(dev_info->feature_flags & - RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING)) + if (!(dev_info->feature_flags & RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING) && + !(dev_info->feature_flags & RTE_CRYPTODEV_FF_SECURITY)) return ret; for (i = dev_info->capabilities; @@ -1600,6 +1602,41 @@ add_cdev_mapping(const struct rte_cryptodev_info *dev_info, uint16_t cdev_id, } } + sec_ctx = rte_cryptodev_get_sec_ctx(cdev_id); + if (sec_ctx == NULL) + return ret; + + sec_cap = rte_security_capabilities_get(sec_ctx); + if (sec_cap == NULL) + return ret; + + for (i = sec_cap->crypto_capabilities; + i->op != RTE_CRYPTO_OP_TYPE_UNDEFINED; i++) { + if (i->op != RTE_CRYPTO_OP_TYPE_SYMMETRIC) + continue; + + if (i->sym.xform_type == RTE_CRYPTO_SYM_XFORM_AEAD) { + ret |= add_mapping(str, cdev_id, qp, params, + ipsec_ctx, NULL, NULL, i); + continue; + } + + if (i->sym.xform_type != RTE_CRYPTO_SYM_XFORM_CIPHER) + continue; + + for (j = sec_cap->crypto_capabilities; + j->op != RTE_CRYPTO_OP_TYPE_UNDEFINED; j++) { + if (j->op != RTE_CRYPTO_OP_TYPE_SYMMETRIC) + continue; + + if (j->sym.xform_type != RTE_CRYPTO_SYM_XFORM_AUTH) + continue; + + ret |= add_mapping(str, cdev_id, qp, params, + ipsec_ctx, i, j, NULL); + } + } + return ret; }