From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3B844429EA; Tue, 25 Apr 2023 12:41:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BD91040ED6; Tue, 25 Apr 2023 12:41:10 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 8BC8A40395 for ; Tue, 25 Apr 2023 12:41:09 +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 33P9Emib013086 for ; Tue, 25 Apr 2023 03:41:08 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=Bvei2DhDERrmSI9tLKGTQ8ZoMt8bvM1nk6fIkk5/+O0=; b=K8Pm4SGeBm7EJbp8gqKpY6biuEd3g7eDK2v7KSWTKS0S0DSNB1WJ13sqStuzNOhp1SIj bBAB1W2OSO/wfdEw+B1wtD6+OytfO3UKUABCLqhVOQI+V1DLbit+DxKhlmke9ejA6XjR hmPktCvHIlrBr0T7OBbktbwsiWsQ9XJtQ7i01CgxDMRDb7yplKRMlh+wG4ecc1Nd1dk5 JUbNVXco/2XK63Q+dIX5PbhJOVgRexdfHd/KVOqHKK2ojIEvj1vdoGbIH+aLlv4CMGQ/ S2v+dqPjS3ccsY6vlhf5PxPRNSnMB5VVYUhMu9EGN3olLZva/3OGC6DOAzyr2uohJljA aw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3q6c2f89q2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 25 Apr 2023 03:41:08 -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; Tue, 25 Apr 2023 03:41:06 -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; Tue, 25 Apr 2023 03:41:06 -0700 Received: from localhost.localdomain (unknown [10.28.36.158]) by maili.marvell.com (Postfix) with ESMTP id 580CB5B692B; Tue, 25 Apr 2023 03:41:04 -0700 (PDT) From: Rahul Bhansali To: , Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Rahul Bhansali Subject: [PATCH 1/5] common/cnxk: fix IPsec IPv6 tunnel address byte swap Date: Tue, 25 Apr 2023 16:10:06 +0530 Message-ID: <20230425104010.339177-1-rbhansali@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: -nczcKNPxi7YuU2m9WAwYxNWkGKEzOn8 X-Proofpoint-ORIG-GUID: -nczcKNPxi7YuU2m9WAwYxNWkGKEzOn8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-25_03,2023-04-25_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 Fix the IPsec IPv6 tunnel address bytes swap during SA configurations in session create/update. Fixes: 78d03027f2c ("common/cnxk: add IPsec common code") Signed-off-by: Rahul Bhansali --- drivers/common/cnxk/cnxk_security.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/common/cnxk/cnxk_security.c b/drivers/common/cnxk/cnxk_security.c index 79427d48fe..13ca2c7791 100644 --- a/drivers/common/cnxk/cnxk_security.c +++ b/drivers/common/cnxk/cnxk_security.c @@ -274,6 +274,14 @@ ot_ipsec_inb_ctx_size(struct roc_ot_ipsec_inb_sa *sa) return size; } +static void +ot_ipsec_update_ipv6_addr_endianness(uint64_t *addr) +{ + *addr = rte_be_to_cpu_64(*addr); + addr++; + *addr = rte_be_to_cpu_64(*addr); +} + static int ot_ipsec_inb_tunnel_hdr_fill(struct roc_ot_ipsec_inb_sa *sa, struct rte_security_ipsec_xform *ipsec_xfrm) @@ -310,6 +318,10 @@ ot_ipsec_inb_tunnel_hdr_fill(struct roc_ot_ipsec_inb_sa *sa, memcpy(&sa->outer_hdr.ipv6.dst_addr, &tunnel->ipv6.dst_addr, sizeof(struct in6_addr)); + /* IP Source and Dest are in LE/CPU endian */ + ot_ipsec_update_ipv6_addr_endianness((uint64_t *)&sa->outer_hdr.ipv6.src_addr); + ot_ipsec_update_ipv6_addr_endianness((uint64_t *)&sa->outer_hdr.ipv6.dst_addr); + break; default: return -EINVAL; @@ -499,6 +511,10 @@ cnxk_ot_ipsec_outb_sa_fill(struct roc_ot_ipsec_outb_sa *sa, memcpy(&sa->outer_hdr.ipv6.dst_addr, &tunnel->ipv6.dst_addr, sizeof(struct in6_addr)); + /* IP Source and Dest are in LE/CPU endian */ + ot_ipsec_update_ipv6_addr_endianness((uint64_t *)&sa->outer_hdr.ipv6.src_addr); + ot_ipsec_update_ipv6_addr_endianness((uint64_t *)&sa->outer_hdr.ipv6.dst_addr); + /* Outer header flow label source */ if (!ipsec_xfrm->options.copy_flabel) { sa->w2.s.ipv4_df_src_or_ipv6_flw_lbl_src = -- 2.25.1