From patchwork Mon Nov 28 09:54:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 120202 X-Patchwork-Delegate: jerinj@marvell.com 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 17AF9A00C3; Mon, 28 Nov 2022 10:55:29 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9DA4542D2F; Mon, 28 Nov 2022 10:55:09 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 245BE42D1F for ; Mon, 28 Nov 2022 10:55:07 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AS5ihPN025017 for ; Mon, 28 Nov 2022 01:55:07 -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=cbTjwJuiFGPFAsv8/krMW0nnEYlpbqc5XFzdGkXc/rE=; b=EnXw1YfxcaFbkbUM/7VIzXzW7QW+Tpf0mYtOTs4jdHIsPFQAONnyGRLJHRqb32VBCHpZ lYvaGfCaSl5dcFpnMVoPr99AR9mwL6Q2Q3olp7/J6DmxpCNF5FE/MksAba3rUeB2ypLV 3Jft8RF4hPPr6S8Pm7Jl4Y/scyIKCAMd1wgoVjR2Eoi7Rdx9NmYteU8uB2mIsssLw4pQ egKIDK6UIRMXayy6J/SDjvmBYpQBN4bTGt/bxix4FaB1rqTwCFXTj1pEA/hwhehXmQor HUU7Ss5hryGJZdUfYDKqAJJ8IxY/47LBODPIz5KpWbu9WeGQvhAyJ8oTE0e4HW2sHlXg 8A== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3m4q3srsfc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 28 Nov 2022 01:55:07 -0800 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.18; Mon, 28 Nov 2022 01:55:05 -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; Mon, 28 Nov 2022 01:55:05 -0800 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 7B5B53F707C; Mon, 28 Nov 2022 01:55:03 -0800 (PST) From: Nithin Dabilpuram To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Subject: [PATCH 06/11] net/cnxk: fix packet type for IPv6 packets post decryption Date: Mon, 28 Nov 2022 15:24:37 +0530 Message-ID: <20221128095442.3185112-6-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221128095442.3185112-1-ndabilpuram@marvell.com> References: <20221128095442.3185112-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: xvHwT_FpMIkog3ubXCKyF8XHRCSTbH6T X-Proofpoint-GUID: xvHwT_FpMIkog3ubXCKyF8XHRCSTbH6T X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-28_07,2022-11-25_01,2022-06-22_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 Update ptype properly for IPv6 packets post inline decryption. Fixes: 4440eb88ddfc ("net/cnxk: use full context IPsec structures") Signed-off-by: Nithin Dabilpuram --- drivers/net/cnxk/cn9k_rx.h | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/net/cnxk/cn9k_rx.h b/drivers/net/cnxk/cn9k_rx.h index 1a9f920b41..0e23609df5 100644 --- a/drivers/net/cnxk/cn9k_rx.h +++ b/drivers/net/cnxk/cn9k_rx.h @@ -260,8 +260,8 @@ nix_rx_sec_mbuf_err_update(const union nix_rx_parse_u *rx, uint16_t res, } static __rte_always_inline uint64_t -nix_rx_sec_mbuf_update(const struct nix_cqe_hdr_s *cq, struct rte_mbuf *m, - uintptr_t sa_base, uint64_t *rearm_val, uint16_t *len) +nix_rx_sec_mbuf_update(const struct nix_cqe_hdr_s *cq, struct rte_mbuf *m, uintptr_t sa_base, + uint64_t *rearm_val, uint16_t *len, uint32_t packet_type) { uintptr_t res_sg0 = ((uintptr_t)cq + ROC_ONF_IPSEC_INB_RES_OFF - 8); const union nix_rx_parse_u *rx = @@ -315,15 +315,18 @@ nix_rx_sec_mbuf_update(const struct nix_cqe_hdr_s *cq, struct rte_mbuf *m, ip = (struct rte_ipv4_hdr *)(data + ROC_ONF_IPSEC_INB_SPI_SEQ_SZ + ROC_ONF_IPSEC_INB_MAX_L2_SZ); + packet_type = (packet_type & ~(RTE_PTYPE_L3_MASK | RTE_PTYPE_TUNNEL_MASK)); if (((ip->version_ihl & 0xf0) >> RTE_IPV4_IHL_MULTIPLIER) == IPVERSION) { *len = rte_be_to_cpu_16(ip->total_length) + lcptr; + packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; } else { PLT_ASSERT(((ip->version_ihl & 0xf0) >> RTE_IPV4_IHL_MULTIPLIER) == 6); ip6 = (struct rte_ipv6_hdr *)ip; *len = rte_be_to_cpu_16(ip6->payload_len) + sizeof(struct rte_ipv6_hdr) + lcptr; + packet_type |= RTE_PTYPE_L3_IPV6_EXT_UNKNOWN; } /* Update data offset */ @@ -332,6 +335,7 @@ nix_rx_sec_mbuf_update(const struct nix_cqe_hdr_s *cq, struct rte_mbuf *m, *rearm_val = *rearm_val & ~(BIT_ULL(16) - 1); *rearm_val |= data_off; + m->packet_type = packet_type; return RTE_MBUF_F_RX_SEC_OFFLOAD; } @@ -363,14 +367,7 @@ cn9k_nix_cqe_to_mbuf(const struct nix_cqe_hdr_s *cq, const uint32_t tag, /* Get SA Base from lookup mem */ sa_base = cnxk_nix_sa_base_get(port, lookup_mem); - ol_flags |= nix_rx_sec_mbuf_update(cq, mbuf, sa_base, &val, - &len); - - /* Only Tunnel inner IPv4 is supported */ - packet_type = (packet_type & - ~(RTE_PTYPE_L3_MASK | RTE_PTYPE_TUNNEL_MASK)); - packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; - mbuf->packet_type = packet_type; + ol_flags |= nix_rx_sec_mbuf_update(cq, mbuf, sa_base, &val, &len, packet_type); goto skip_parse; }