From patchwork Fri Feb 24 05:48:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejasree Kondoj X-Patchwork-Id: 124480 X-Patchwork-Delegate: thomas@monjalon.net 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 9937A41D5B; Fri, 24 Feb 2023 06:48:37 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DAC534113D; Fri, 24 Feb 2023 06:48:26 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 143B74111C for ; Fri, 24 Feb 2023 06:48:24 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 31O3Mv9S009246 for ; Thu, 23 Feb 2023 21:48:24 -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=rDhkIMBgh+V8et+aFhW7QU9HwGUk0tE3KZpS1JC43OI=; b=O4SfX5EV8ncw6ra5VQ1CfMyPYc9nX4+lr1wu/wFIS2lVeR9/u0yg8136dgOmPQQXN/48 1/90uSM5lL7DlSObc+pmnSj2jh0vlr0IvNZDV8S+HKbHLuDszsJKiXTHTyK/7527yFl1 I30p+tcEhSqOGCwYzwcSszMa0XMBKWKDy5bdTqbox5LTeuFUm8wVv0DPSNMC9axt0iDA Kv4vYcJHrEUcjQ9kPs88ssuzH/agTL7QWWLkN82eKP+dN4+iemVcVLwPiy+YocTOvAbE fhyoZ9KYVX2ZnjmBekW6ZzUBrjuxz/Qa1MnAc/qzq5qpwJR4u2k30g+c1PotTqWJCLGB Nw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3nxfkwa3ax-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 23 Feb 2023 21:48:24 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 23 Feb 2023 21:48:22 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.42 via Frontend Transport; Thu, 23 Feb 2023 21:48:22 -0800 Received: from hyd1554.marvell.com (unknown [10.29.57.11]) by maili.marvell.com (Postfix) with ESMTP id 99E343F706F; Thu, 23 Feb 2023 21:48:20 -0800 (PST) From: Tejasree Kondoj To: Akhil Goyal CC: Anoob Joseph , Gowrishankar Muthukrishnan , Subject: [PATCH 03/11] crypto/cnxk: use version field directly Date: Fri, 24 Feb 2023 11:18:05 +0530 Message-ID: <20230224054813.2855914-4-ktejasree@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230224054813.2855914-1-ktejasree@marvell.com> References: <20230224054813.2855914-1-ktejasree@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: ahnW3559H7m5uT3Qk4xIiXRz7bkrS4WP X-Proofpoint-ORIG-GUID: ahnW3559H7m5uT3Qk4xIiXRz7bkrS4WP X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.170.22 definitions=2023-02-24_02,2023-02-23_01,2023-02-09_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 From: Anoob Joseph As version field is available in rte_ip_hdr, use it directly instead of masking version_ihl. Signed-off-by: Anoob Joseph --- drivers/crypto/cnxk/cn9k_cryptodev_ops.c | 4 ++-- drivers/crypto/cnxk/cn9k_ipsec_la_ops.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c index 3a07842e4b..11541b6ab9 100644 --- a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c +++ b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c @@ -546,10 +546,10 @@ cn9k_cpt_sec_post_process(struct rte_crypto_op *cop, } } - if (((ip->version_ihl & 0xf0) >> RTE_IPV4_IHL_MULTIPLIER) == IPVERSION) { + if (ip->version == IPVERSION) { m_len = rte_be_to_cpu_16(ip->total_length); } else { - PLT_ASSERT(((ip->version_ihl & 0xf0) >> RTE_IPV4_IHL_MULTIPLIER) == 6); + PLT_ASSERT((ip->version == 6)); ip6 = (struct rte_ipv6_hdr *)ip; m_len = rte_be_to_cpu_16(ip6->payload_len) + sizeof(struct rte_ipv6_hdr); } diff --git a/drivers/crypto/cnxk/cn9k_ipsec_la_ops.h b/drivers/crypto/cnxk/cn9k_ipsec_la_ops.h index 9df41bf65d..85aacb803f 100644 --- a/drivers/crypto/cnxk/cn9k_ipsec_la_ops.h +++ b/drivers/crypto/cnxk/cn9k_ipsec_la_ops.h @@ -28,13 +28,13 @@ ipsec_po_out_rlen_get(struct cn9k_sec_session *sess, uint32_t plen, struct rte_m uintptr_t data = (uintptr_t)m_src->buf_addr + m_src->data_off; struct rte_ipv4_hdr *ip = (struct rte_ipv4_hdr *)data; - if (unlikely(((ip->version_ihl & 0xf0) >> RTE_IPV4_IHL_MULTIPLIER) != IPVERSION)) { + if (unlikely(ip->version != IPVERSION)) { struct rte_ipv6_hdr *ip6 = (struct rte_ipv6_hdr *)ip; uint8_t *nxt_hdr = (uint8_t *)ip6; uint8_t dest_op_cnt = 0; int nh = ip6->proto; - PLT_ASSERT(((ip->version_ihl & 0xf0) >> RTE_IPV4_IHL_MULTIPLIER) == 6); + PLT_ASSERT(ip->version == 6); adj_len = ROC_CPT_TUNNEL_IPV6_HDR_LEN; nxt_hdr += ROC_CPT_TUNNEL_IPV6_HDR_LEN;