From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3FA9BA00C3; Sat, 16 May 2020 11:27:58 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D6B151D99E; Sat, 16 May 2020 11:27:38 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 760E71D99E for ; Sat, 16 May 2020 11:27:37 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 04G9QBsu020926; Sat, 16 May 2020 02:27:36 -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=to3A/0gLekc6wyl9bHF7uTF+QxVL3MddDPRz9HJWNPI=; b=irJP/zZKE760K81JdVKS+6CihzpGHYkKE4W7JDls9zr/8NevHNz44dXwAAnNUFImOrwJ 9q3hn+ujKpL/C67Hk8zthmKlJ/g9urSuXDQ/cY6m1U0xO8v+iDiGnGXCg0fVS2yGWMDF 8vZ8utnirwlaf80dPMneOl6CCFWK0xzMfPZVu3oCEr15UWT3yHIe4waMD1sBLaKOnAlZ BcYUFNlo1n7RcV2mkuOMu4aC40aFuQvBcWPaTMSDE6mJNK/Wy76fW44f4AXDwDn82ili HW3DnMBywS1lwUsjFeWUHEPrJDM6B3Hfqgy0RTCANJkNfDnkYt+59EIaXuxWPLuQ+8mq 8A== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 3100xkbrfc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sat, 16 May 2020 02:27:36 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 16 May 2020 02:27:34 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 16 May 2020 02:27:34 -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.2 via Frontend Transport; Sat, 16 May 2020 02:27:33 -0700 Received: from ajoseph83.caveonetworks.com (ajoseph83.caveonetworks.com [10.29.45.60]) by maili.marvell.com (Postfix) with ESMTP id 638443F703F; Sat, 16 May 2020 02:27:31 -0700 (PDT) From: Anoob Joseph To: Akhil Goyal CC: Anoob Joseph , Thomas Monjalon , Jerin Jacob , Narayana Prasad , Ankur Dwivedi , Tejasree Kondoj , Date: Sat, 16 May 2020 14:56:56 +0530 Message-ID: <1589621218-25339-5-git-send-email-anoobj@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1589621218-25339-1-git-send-email-anoobj@marvell.com> References: <1589621218-25339-1-git-send-email-anoobj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.676 definitions=2020-05-16_05:2020-05-15, 2020-05-16 signatures=0 Subject: [dpdk-dev] [PATCH 4/6] crypto/octeontx2: improve error handling in session configure 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" Session configure should return -ENOTSUP in case of unsupported xform requests. Moving the validation of combinations out of cpt, as the feature support will not be same across OCTEON TX and OCTEON TX2. Signed-off-by: Ankur Dwivedi Signed-off-by: Anoob Joseph --- drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 43 +++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c index 0ae04c5..ad292a0 100644 --- a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c +++ b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c @@ -312,6 +312,41 @@ otx2_cpt_qp_destroy(const struct rte_cryptodev *dev, struct otx2_cpt_qp *qp) } static int +sym_xform_verify(struct rte_crypto_sym_xform *xform) +{ + if (xform->next) { + if (xform->type == RTE_CRYPTO_SYM_XFORM_AUTH && + xform->next->type == RTE_CRYPTO_SYM_XFORM_CIPHER && + xform->next->cipher.op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) + return -ENOTSUP; + + if (xform->type == RTE_CRYPTO_SYM_XFORM_CIPHER && + xform->cipher.op == RTE_CRYPTO_CIPHER_OP_DECRYPT && + xform->next->type == RTE_CRYPTO_SYM_XFORM_AUTH) + return -ENOTSUP; + + if (xform->type == RTE_CRYPTO_SYM_XFORM_CIPHER && + xform->cipher.algo == RTE_CRYPTO_CIPHER_3DES_CBC && + xform->next->type == RTE_CRYPTO_SYM_XFORM_AUTH && + xform->next->auth.algo == RTE_CRYPTO_AUTH_SHA1) + return -ENOTSUP; + + if (xform->type == RTE_CRYPTO_SYM_XFORM_AUTH && + xform->auth.algo == RTE_CRYPTO_AUTH_SHA1 && + xform->next->type == RTE_CRYPTO_SYM_XFORM_CIPHER && + xform->next->cipher.algo == RTE_CRYPTO_CIPHER_3DES_CBC) + return -ENOTSUP; + + } else { + if (xform->type == RTE_CRYPTO_SYM_XFORM_AUTH && + xform->auth.algo == RTE_CRYPTO_AUTH_NULL && + xform->auth.op == RTE_CRYPTO_AUTH_OP_VERIFY) + return -ENOTSUP; + } + return 0; +} + +static int sym_session_configure(int driver_id, struct rte_crypto_sym_xform *xform, struct rte_cryptodev_sym_session *sess, struct rte_mempool *pool) @@ -320,10 +355,9 @@ sym_session_configure(int driver_id, struct rte_crypto_sym_xform *xform, void *priv; int ret; - if (unlikely(cpt_is_algo_supported(xform))) { - CPT_LOG_ERR("Crypto xform not supported"); - return -ENOTSUP; - } + ret = sym_xform_verify(xform); + if (unlikely(ret)) + return ret; if (unlikely(rte_mempool_get(pool, &priv))) { CPT_LOG_ERR("Could not allocate session private data"); @@ -373,7 +407,6 @@ sym_session_configure(int driver_id, struct rte_crypto_sym_xform *xform, priv_put: rte_mempool_put(pool, priv); - CPT_LOG_ERR("Crypto xform not supported"); return -ENOTSUP; } -- 2.7.4