From patchwork Mon Sep 9 13:28:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anoob Joseph X-Patchwork-Id: 59018 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 84FA91EBAA; Mon, 9 Sep 2019 15:29:07 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 9482A1EB86 for ; Mon, 9 Sep 2019 15:29:05 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x89DQcFI018461; Mon, 9 Sep 2019 06:29:04 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=ucxsJ/pHUFJktZvSH3hlQJfzVdpau0f+yvv8/RrouKw=; b=rhNtiStSbx4D+Va7cQaKn+7fklZL5Ok74JaQzG+JAMVMQU+oxBvWOrgARhm4iX8akvJ1 tKUfDqDvk1iHqvJJjwMEff9nW+IizZg4TJd2hhnoHOCV8byfxOW1aDiRhciywJvDTNpw VkWfqeMhnJyuYxsQArfn62OhdwU00uIueo/P/QT3IyXOH6+9tlBbReF0nZ/fNbnXtYmI eXVTk+C8d9R5WMfk5b1XdAYAetNMwq97wmhWz0QpX5nEC/pPqKM0lsbMfSXmqfLh4ykW vx7k4KiqdgexeZFcfEnLjpN/xInYxG1ezEuT+o64tinFllVvmP+2heFPLPs7bznS/3Bw pw== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2uv9wpqrh8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 09 Sep 2019 06:29:04 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 9 Sep 2019 06:29:03 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Mon, 9 Sep 2019 06:29:03 -0700 Received: from ajoseph83.caveonetworks.com.com (unknown [10.29.45.56]) by maili.marvell.com (Postfix) with ESMTP id 417333F703F; Mon, 9 Sep 2019 06:29:00 -0700 (PDT) From: Anoob Joseph To: Akhil Goyal , Pablo de Lara CC: Kanaka Durga Kotamarthy , Jerin Jacob , Narayana Prasad , Anoob Joseph , Fiona Trahe , Shally Verma , Sunila Sahu , Date: Mon, 9 Sep 2019 18:58:01 +0530 Message-ID: <1568035687-25492-3-git-send-email-anoobj@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1568035687-25492-1-git-send-email-anoobj@marvell.com> References: <1568035687-25492-1-git-send-email-anoobj@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-09_06:2019-09-09,2019-09-09 signatures=0 Subject: [dpdk-dev] [PATCH 2/8] crypto/octeontx: add RSA and modexp asym capabilities 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Kanaka Durga Kotamarthy Add RSA and modexp capabilities supported by octeontx crypto PMD Signed-off-by: Anoob Joseph Signed-off-by: Kanaka Durga Kotamarthy Signed-off-by: Sunila Sahu --- .../crypto/octeontx/otx_cryptodev_capabilities.c | 47 ++++++++++++++++++++-- .../crypto/octeontx/otx_cryptodev_capabilities.h | 5 +-- drivers/crypto/octeontx/otx_cryptodev_ops.c | 5 ++- 3 files changed, 49 insertions(+), 8 deletions(-) diff --git a/drivers/crypto/octeontx/otx_cryptodev_capabilities.c b/drivers/crypto/octeontx/otx_cryptodev_capabilities.c index c6d94c9..8c0358f 100644 --- a/drivers/crypto/octeontx/otx_cryptodev_capabilities.c +++ b/drivers/crypto/octeontx/otx_cryptodev_capabilities.c @@ -6,7 +6,7 @@ #include "otx_cryptodev_capabilities.h" -static const struct rte_cryptodev_capabilities otx_capabilities[] = { +static const struct rte_cryptodev_capabilities otx_sym_capabilities[] = { /* Symmetric capabilities */ { /* NULL (AUTH) */ .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, @@ -597,8 +597,49 @@ static const struct rte_cryptodev_capabilities otx_capabilities[] = { RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() }; +static const struct rte_cryptodev_capabilities otx_asym_capabilities[] = { + /* Asymmetric capabilities */ + { /* RSA */ + .op = RTE_CRYPTO_OP_TYPE_ASYMMETRIC, + {.asym = { + .xform_capa = { + .xform_type = RTE_CRYPTO_ASYM_XFORM_RSA, + .op_types = ((1 << RTE_CRYPTO_ASYM_OP_SIGN) | + (1 << RTE_CRYPTO_ASYM_OP_VERIFY) | + (1 << RTE_CRYPTO_ASYM_OP_ENCRYPT) | + (1 << RTE_CRYPTO_ASYM_OP_DECRYPT)), + {.modlen = { + .min = 17, + .max = 1024, + .increment = 1 + }, } + } + }, } + }, + { /* MOD_EXP */ + .op = RTE_CRYPTO_OP_TYPE_ASYMMETRIC, + {.asym = { + .xform_capa = { + .xform_type = RTE_CRYPTO_ASYM_XFORM_MODEX, + .op_types = 0, + {.modlen = { + .min = 17, + .max = 1024, + .increment = 1 + }, } + } + }, } + }, + /* End of asymmetric capabilities */ + RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() +}; + const struct rte_cryptodev_capabilities * -otx_get_capabilities(void) +otx_get_capabilities(uint64_t flags) { - return otx_capabilities; + if (flags & RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO) + return otx_asym_capabilities; + else + return otx_sym_capabilities; + } diff --git a/drivers/crypto/octeontx/otx_cryptodev_capabilities.h b/drivers/crypto/octeontx/otx_cryptodev_capabilities.h index fc62821..439b50e 100644 --- a/drivers/crypto/octeontx/otx_cryptodev_capabilities.h +++ b/drivers/crypto/octeontx/otx_cryptodev_capabilities.h @@ -8,10 +8,9 @@ #include /* - * Get capabilities list for the device - * + * Get capabilities list for the device, based on device type */ const struct rte_cryptodev_capabilities * -otx_get_capabilities(void); +otx_get_capabilities(uint64_t flags); #endif /* _OTX_CRYPTODEV_CAPABILITIES_H_ */ diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c index 88efed3..b59a001 100644 --- a/drivers/crypto/octeontx/otx_cryptodev_ops.c +++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c @@ -105,7 +105,7 @@ otx_cpt_dev_info_get(struct rte_cryptodev *dev, struct rte_cryptodev_info *info) if (info != NULL) { info->max_nb_queue_pairs = CPT_NUM_QS_PER_VF; info->feature_flags = dev->feature_flags; - info->capabilities = otx_get_capabilities(); + info->capabilities = otx_get_capabilities(info->feature_flags); info->sym.max_nb_sessions = 0; info->driver_id = otx_cryptodev_driver_id; info->min_mbuf_headroom_req = OTX_CPT_MIN_HEADROOM_REQ; @@ -635,7 +635,8 @@ otx_cpt_dev_create(struct rte_cryptodev *c_dev) case OTX_CPT_VF_TYPE_AE: /* Set asymmetric cpt feature flags */ c_dev->feature_flags = RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO | - RTE_CRYPTODEV_FF_HW_ACCELERATED; + RTE_CRYPTODEV_FF_HW_ACCELERATED | + RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT; break; case OTX_CPT_VF_TYPE_SE: /* Set symmetric cpt feature flags */