From patchwork Fri Aug 11 08:58:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 130145 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 2C7CB43032; Fri, 11 Aug 2023 11:01:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 61117432B7; Fri, 11 Aug 2023 10:59:48 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 58675432C1 for ; Fri, 11 Aug 2023 10:59:46 +0200 (CEST) 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 37AMjx5m001610 for ; Fri, 11 Aug 2023 01:59:45 -0700 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=d86/S0LfLPzGWVOnHmErn2YHzyxWVkUsweLOfFW1CjA=; b=fu6DSfskCvMNA+C5APwyrmikz5DzuB9qzTNhX91tSse2cZs3+UNtDwpKH30LckpMttRO +x69A94XJxI+wdJU9p0ng5CjhIz58/uw+NJ2G9IiPJY19HErSvtdeLUvg/3m9Fan7m3Z FeXj2YFcPXqxKPAns3nbXh3AD1qbJ+5fEhUGXVWZywE3SiKHwXkrXxo1NDa9dJcVEVM7 ginFNjSRatQvOePB4JGrRD5oiV1sKd9hkcdLH007Oj4KdUhch5a9jaRUebpKkQCElrKQ LvXUFpPAaerWSPw7B9/HaTmI3T6XCpp8AILyHcwxcsEQg/FqsFnRQ8czs4PkpQwoRjnH JQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3sd8yp9red-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 11 Aug 2023 01:59:45 -0700 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.48; Fri, 11 Aug 2023 01:59:43 -0700 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.48 via Frontend Transport; Fri, 11 Aug 2023 01:59:43 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 522903F706B; Fri, 11 Aug 2023 01:59:41 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Rahul Bhansali Subject: [PATCH 31/31] net/cnxk: fixes for IPv6 header in reassembly Date: Fri, 11 Aug 2023 14:28:05 +0530 Message-ID: <20230811085805.441256-31-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230811085805.441256-1-ndabilpuram@marvell.com> References: <20230811085805.441256-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: Ojjcr1NNWNSfjjWoO3BJmsD6xA1TayDU X-Proofpoint-GUID: Ojjcr1NNWNSfjjWoO3BJmsD6xA1TayDU X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-10_20,2023-08-10_01,2023-05-22_02 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: Rahul Bhansali In reassembly path, next header field in IPv6 header is not updated correctly, hence reassembled packet is corrupted. This fix will consider IPv6 fragment header presence at start/mid/end in extension list and update the next header field accordingly. Fixes: ec28231ed260 ("net/cnxk: support reassembly of multi-segment packets") Signed-off-by: Rahul Bhansali --- drivers/net/cnxk/cn10k_rx.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/net/cnxk/cn10k_rx.h b/drivers/net/cnxk/cn10k_rx.h index 982fd26045..41d11349fd 100644 --- a/drivers/net/cnxk/cn10k_rx.h +++ b/drivers/net/cnxk/cn10k_rx.h @@ -205,26 +205,36 @@ nix_sec_reass_first_frag_update(struct rte_mbuf *head, const uint8_t *m_ipptr, struct rte_ipv6_hdr *hdr = (struct rte_ipv6_hdr *)ipptr; size_t ext_len = sizeof(struct rte_ipv6_hdr); uint8_t *nxt_hdr = (uint8_t *)hdr; + uint8_t *nxt_proto = &hdr->proto; int nh = hdr->proto; *ihl = 0; + tot_len = 0; while (nh != -EINVAL) { nxt_hdr += ext_len; *ihl += ext_len; + if (nh == IPPROTO_FRAGMENT) { + *nxt_proto = *nxt_hdr; + tot_len = *ihl; + } nh = rte_ipv6_get_next_ext(nxt_hdr, nh, &ext_len); + nxt_proto = nxt_hdr; } /* Remove the frag header by moving header 8 bytes forward */ hdr->payload_len = rte_cpu_to_be_16(fragx_sum + *ihl - 8 - sizeof(struct rte_ipv6_hdr)); + /* tot_len is sum of all IP header's length before fragment header */ rte_memcpy(rte_pktmbuf_mtod_offset(head, void *, 8), rte_pktmbuf_mtod(head, void *), - lcptr + sizeof(struct rte_ipv6_hdr)); + lcptr + tot_len); head->data_len -= 8; head->data_off += 8; head->pkt_len = lcptr + *ihl - 8 + fragx_sum; + /* ihl l3hdr size value should be up to fragment header for next frags */ + *ihl = tot_len + 8; } }