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 CFB3B440F0; Tue, 28 May 2024 09:05:50 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1A07F406B4; Tue, 28 May 2024 09:05:40 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id B8A2A4068E for ; Tue, 28 May 2024 09:05:38 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44RMw3eO032176 for ; Tue, 28 May 2024 00:05:38 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=F 9tZqYEIgy6soConm5HBgHmm6tiOQAq4kEdjeVQ319g=; b=aKomKiv+aghd6d1Ae hNQNh4KanJN75SA8of53o0w9sRHwyEFYTVZmIo/kzJ7nCqWLll268tWemsGzBSym e0V8+vTaI+Cm5i0ZQUMIWzy82Np1UQlu8ynS2yGmaJnixytWEi09I24GAj3lP2iz YD5Pkp+uVB12ORnUiELV7Q7oR2ZShC3vuWtl2VrdQ/httC8ns1OImhOoKiNlweYi qa+g/mv/JYJayM+Rn8UcVgLK+fzm5NqZCTBKR4zMF1D91/YCNSS4VjO+1+mpJXTp j2eVn4W0Fm8h4u7DBSiIcMZfAPedKtsJBxYXabUmAy8AIfR2oD6Lm7sJY32St2XX xpWkQ== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3ycqpykr03-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 28 May 2024 00:05:37 -0700 (PDT) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 28 May 2024 00:05:37 -0700 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Tue, 28 May 2024 00:05:37 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id C1E7F3F7099; Tue, 28 May 2024 00:05:34 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Harman Kalra CC: , Subject: [PATCH v2 04/10] common/cnxk: override UDP encap ports with session data Date: Tue, 28 May 2024 12:35:16 +0530 Message-ID: <20240528070522.3857626-4-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240528070522.3857626-1-ndabilpuram@marvell.com> References: <20240517074448.3146611-1-ndabilpuram@marvell.com> <20240528070522.3857626-1-ndabilpuram@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: cQn72jNLf62kX8cxdLeER9s2qgwcJMfF X-Proofpoint-ORIG-GUID: cQn72jNLf62kX8cxdLeER9s2qgwcJMfF X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-28_04,2024-05-27_01,2024-05-17_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 Override UDP encap ports with session info when non-zero on cn10k. This makes the UDP encap ports configurable by user as needed. Default UDP source and destination ports will still be 4500. Signed-off-by: Nithin Dabilpuram --- drivers/common/cnxk/cnxk_security.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/common/cnxk/cnxk_security.c b/drivers/common/cnxk/cnxk_security.c index bab015e3b3..15b0bedf43 100644 --- a/drivers/common/cnxk/cnxk_security.c +++ b/drivers/common/cnxk/cnxk_security.c @@ -308,6 +308,7 @@ cnxk_ot_ipsec_inb_sa_fill(struct roc_ot_ipsec_inb_sa *sa, struct rte_crypto_sym_xform *crypto_xfrm, bool is_inline) { + uint16_t sport = 4500, dport = 4500; union roc_ot_ipsec_sa_word2 w2; uint32_t replay_win_sz; size_t offset; @@ -353,8 +354,14 @@ cnxk_ot_ipsec_inb_sa_fill(struct roc_ot_ipsec_inb_sa *sa, /* ESN */ sa->w2.s.esn_en = !!ipsec_xfrm->options.esn; if (ipsec_xfrm->options.udp_encap) { - sa->w10.s.udp_src_port = 4500; - sa->w10.s.udp_dst_port = 4500; + if (ipsec_xfrm->udp.sport) + sport = ipsec_xfrm->udp.sport; + + if (ipsec_xfrm->udp.dport) + dport = ipsec_xfrm->udp.dport; + + sa->w10.s.udp_src_port = sport; + sa->w10.s.udp_dst_port = dport; } if (ipsec_xfrm->options.udp_ports_verify) @@ -411,6 +418,7 @@ cnxk_ot_ipsec_outb_sa_fill(struct roc_ot_ipsec_outb_sa *sa, struct rte_crypto_sym_xform *crypto_xfrm) { struct rte_security_ipsec_tunnel_param *tunnel = &ipsec_xfrm->tunnel; + uint16_t sport = 4500, dport = 4500; union roc_ot_ipsec_sa_word2 w2; size_t offset; int rc; @@ -506,8 +514,14 @@ cnxk_ot_ipsec_outb_sa_fill(struct roc_ot_ipsec_outb_sa *sa, sa->ctx.esn_val = ipsec_xfrm->esn.value - 1; if (ipsec_xfrm->options.udp_encap) { - sa->w10.s.udp_src_port = 4500; - sa->w10.s.udp_dst_port = 4500; + if (ipsec_xfrm->udp.sport) + sport = ipsec_xfrm->udp.sport; + + if (ipsec_xfrm->udp.dport) + dport = ipsec_xfrm->udp.dport; + + sa->w10.s.udp_src_port = sport; + sa->w10.s.udp_dst_port = dport; } offset = offsetof(struct roc_ot_ipsec_outb_sa, ctx); -- 2.25.1