From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EA406A0032; Thu, 16 Dec 2021 18:54:12 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7ACAE41104; Thu, 16 Dec 2021 18:54:01 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id EBE9340143 for ; Thu, 16 Dec 2021 18:53:59 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 1BGENSPE008296 for ; Thu, 16 Dec 2021 09:53:59 -0800 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=pfpt0220; bh=z4m2yx7I7eBZZlFPTA6f8ww8uWdy2a/Z+klnUDxRGcA=; b=dGDuiVK2LQ3KBW3By3TprVbDTYouVVrcKEgopmIr46AAt0e+HT0h8sHeV0TPapA4Ub0a x2891qwY0MNcN6iAULL3vlJJL6LPXxzKrEuLz//cUIa8d54khte+K0QFf4KrGIy1dOMo UN3zyLN3y8DTH3gYP2P5aATTaGjKu+5x6bYFQe4bq0rGEEGzZIG7+QaxiE+PQCWMX7Fl suO8GhOAejGjn298BdHg6XMTWTfWTGGElaDz7HmFD7yBAkDpkJkyTcByT91TeUEcgXjv p8P1KZCqiDyRaVE169ojpa2OTFqB1a+BW5OBxdlgF/r/P7KQirn1UsIN4aDRqw+4flB9 lA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3d02p0aexf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 16 Dec 2021 09:53:59 -0800 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.2; Thu, 16 Dec 2021 09:53:57 -0800 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; Thu, 16 Dec 2021 09:53:57 -0800 Received: from HY-LT1002.marvell.com (HY-LT1002.marvell.com [10.28.176.218]) by maili.marvell.com (Postfix) with ESMTP id 2B2163F7048; Thu, 16 Dec 2021 09:53:54 -0800 (PST) From: Anoob Joseph To: Akhil Goyal , Jerin Jacob CC: Anoob Joseph , Archana Muniganti , Tejasree Kondoj , Subject: [PATCH v2 16/29] crypto/cnxk: add skip for unsupported cases Date: Thu, 16 Dec 2021 23:19:22 +0530 Message-ID: <1639676975-1316-17-git-send-email-anoobj@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1639676975-1316-1-git-send-email-anoobj@marvell.com> References: <1638859858-734-1-git-send-email-anoobj@marvell.com> <1639676975-1316-1-git-send-email-anoobj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: MD5EEyj0l-jpDjbj3dIpJHq5NBzmaLhK X-Proofpoint-ORIG-GUID: MD5EEyj0l-jpDjbj3dIpJHq5NBzmaLhK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2021-12-16_06,2021-12-16_01,2021-12-02_01 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 Add skip for transport mode tests that are not supported. Also, updated the transport mode path to configure IP version as v4. Signed-off-by: Anoob Joseph --- drivers/crypto/cnxk/cn9k_ipsec.c | 53 +++++++++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 6 deletions(-) diff --git a/drivers/crypto/cnxk/cn9k_ipsec.c b/drivers/crypto/cnxk/cn9k_ipsec.c index 395b0d5..c27845c 100644 --- a/drivers/crypto/cnxk/cn9k_ipsec.c +++ b/drivers/crypto/cnxk/cn9k_ipsec.c @@ -141,11 +141,10 @@ ipsec_sa_ctl_set(struct rte_security_ipsec_xform *ipsec, return -EINVAL; } - ctl->inner_ip_ver = ctl->outer_ip_ver; - - if (ipsec->mode == RTE_SECURITY_IPSEC_SA_MODE_TRANSPORT) + if (ipsec->mode == RTE_SECURITY_IPSEC_SA_MODE_TRANSPORT) { ctl->ipsec_mode = ROC_IE_SA_MODE_TRANSPORT; - else if (ipsec->mode == RTE_SECURITY_IPSEC_SA_MODE_TUNNEL) + ctl->outer_ip_ver = ROC_IE_SA_IP_VERSION_4; + } else if (ipsec->mode == RTE_SECURITY_IPSEC_SA_MODE_TUNNEL) ctl->ipsec_mode = ROC_IE_SA_MODE_TUNNEL; else return -EINVAL; @@ -548,7 +547,8 @@ cn9k_ipsec_inb_sa_create(struct cnxk_cpt_qp *qp, } static inline int -cn9k_ipsec_xform_verify(struct rte_security_ipsec_xform *ipsec) +cn9k_ipsec_xform_verify(struct rte_security_ipsec_xform *ipsec, + struct rte_crypto_sym_xform *crypto) { if (ipsec->life.bytes_hard_limit != 0 || ipsec->life.bytes_soft_limit != 0 || @@ -556,6 +556,47 @@ cn9k_ipsec_xform_verify(struct rte_security_ipsec_xform *ipsec) ipsec->life.packets_soft_limit != 0) return -ENOTSUP; + if (ipsec->mode == RTE_SECURITY_IPSEC_SA_MODE_TRANSPORT) { + enum rte_crypto_sym_xform_type type = crypto->type; + + if (type == RTE_CRYPTO_SYM_XFORM_AEAD) { + if ((crypto->aead.algo == RTE_CRYPTO_AEAD_AES_GCM) && + (crypto->aead.key.length == 32)) { + plt_err("Transport mode AES-256-GCM is not supported"); + return -ENOTSUP; + } + } else { + struct rte_crypto_cipher_xform *cipher; + struct rte_crypto_auth_xform *auth; + + if (crypto->type == RTE_CRYPTO_SYM_XFORM_CIPHER) { + cipher = &crypto->cipher; + auth = &crypto->next->auth; + } else { + cipher = &crypto->next->cipher; + auth = &crypto->auth; + } + + if ((cipher->algo == RTE_CRYPTO_CIPHER_AES_CBC) && + (auth->algo == RTE_CRYPTO_AUTH_SHA256_HMAC)) { + plt_err("Transport mode AES-CBC SHA2 HMAC 256 is not supported"); + return -ENOTSUP; + } + + if ((cipher->algo == RTE_CRYPTO_CIPHER_AES_CBC) && + (auth->algo == RTE_CRYPTO_AUTH_SHA384_HMAC)) { + plt_err("Transport mode AES-CBC SHA2 HMAC 384 is not supported"); + return -ENOTSUP; + } + + if ((cipher->algo == RTE_CRYPTO_CIPHER_AES_CBC) && + (auth->algo == RTE_CRYPTO_AUTH_SHA512_HMAC)) { + plt_err("Transport mode AES-CBC SHA2 HMAC 512 is not supported"); + return -ENOTSUP; + } + } + } + return 0; } @@ -580,7 +621,7 @@ cn9k_ipsec_session_create(void *dev, if (ret) return ret; - ret = cn9k_ipsec_xform_verify(ipsec_xform); + ret = cn9k_ipsec_xform_verify(ipsec_xform, crypto_xform); if (ret) return ret; -- 2.7.4