[v2,03/11] crypto/cnxk: use version field directly
Checks
Commit Message
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(-)
@@ -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);
}
@@ -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;