DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tejasree Kondoj <ktejasree@marvell.com>
To: Akhil Goyal <gakhil@marvell.com>
Cc: Anoob Joseph <anoobj@marvell.com>,
	Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>,
	<dev@dpdk.org>
Subject: [PATCH 03/11] crypto/cnxk: use version field directly
Date: Fri, 24 Feb 2023 11:18:05 +0530	[thread overview]
Message-ID: <20230224054813.2855914-4-ktejasree@marvell.com> (raw)
In-Reply-To: <20230224054813.2855914-1-ktejasree@marvell.com>

From: Anoob Joseph <anoobj@marvell.com>

As version field is available in rte_ip_hdr, use it directly instead of
masking version_ihl.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
---
 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;
-- 
2.25.1


  parent reply	other threads:[~2023-02-24  5:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24  5:48 [PATCH 00/11] fixes and improvements to cnxk crypto PMD Tejasree Kondoj
2023-02-24  5:48 ` [PATCH 01/11] common/cnxk: fix incorrect auth key length Tejasree Kondoj
2023-02-24  5:48 ` [PATCH 02/11] crypto/cnxk: make sg version check const Tejasree Kondoj
2023-02-24  5:48 ` Tejasree Kondoj [this message]
2023-02-24  5:48 ` [PATCH 04/11] crypto/cnxk: use direct mode for zero aad length Tejasree Kondoj
2023-02-24  5:48 ` [PATCH 05/11] crypto/cnxk: set ctx for AE Tejasree Kondoj
2023-02-27 17:38   ` Akhil Goyal
2023-02-24  5:48 ` [PATCH 06/11] common/cnxk: ensure flush inval completion with CSR read Tejasree Kondoj
2023-02-24  5:48 ` [PATCH 07/11] common/cnxk: add errata function for CPT set ctx Tejasree Kondoj
2023-02-24  5:48 ` [PATCH 08/11] common/cnxk: replace CPT revision check with caps Tejasree Kondoj
2023-02-24  5:48 ` [PATCH 09/11] crypto/cnxk: support cn10k IPsec SG mode Tejasree Kondoj
2023-02-24  5:48 ` [PATCH 10/11] crypto/cnxk: fix order of ECFPM params Tejasree Kondoj
2023-02-24  5:48 ` [PATCH 11/11] crypto/cnxk: add model check for pdcp chain Tejasree Kondoj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230224054813.2855914-4-ktejasree@marvell.com \
    --to=ktejasree@marvell.com \
    --cc=anoobj@marvell.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=gmuthukrishn@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).