DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tejasree Kondoj <ktejasree@marvell.com>
To: Akhil Goyal <akhil.goyal@nxp.com>, Radu Nicolau <radu.nicolau@intel.com>
Cc: Tejasree Kondoj <ktejasree@marvell.com>,
	Anoob Joseph <anoobj@marvell.com>,
	Ankur Dwivedi <adwivedi@marvell.com>, <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 1/2] crypto/octeontx2: make anti-replay routine generic
Date: Fri, 18 Dec 2020 19:44:09 +0530
Message-ID: <20201218141410.1918-2-ktejasree@marvell.com> (raw)
In-Reply-To: <20201218141410.1918-1-ktejasree@marvell.com>

Adding changes to make anti-replay routine common to both inline and
lookaside IPsec.

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
---
 drivers/crypto/octeontx2/otx2_ipsec_anti_replay.h | 11 +++++------
 drivers/net/octeontx2/otx2_rx.h                   |  2 +-
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/crypto/octeontx2/otx2_ipsec_anti_replay.h b/drivers/crypto/octeontx2/otx2_ipsec_anti_replay.h
index 858ce5b15f..d599692a75 100644
--- a/drivers/crypto/octeontx2/otx2_ipsec_anti_replay.h
+++ b/drivers/crypto/octeontx2/otx2_ipsec_anti_replay.h
@@ -16,11 +16,10 @@
 #define IPSEC_ANTI_REPLAY_FAILED	(-1)
 
 static inline int
-anti_replay_check(uint64_t seq, struct otx2_ipsec_fp_in_sa *sa)
+anti_replay_check(struct otx2_ipsec_replay *replay, uint64_t seq,
+			uint64_t winsz)
 {
-	struct otx2_ipsec_replay *replay = sa->replay;
 	uint64_t *window = &replay->window[0];
-	uint64_t winsz = sa->replay_win_sz;
 	uint64_t ex_winsz = winsz + WORD_SIZE;
 	uint64_t winwords = ex_winsz >> WORD_SHIFT;
 	uint64_t base = replay->base;
@@ -166,8 +165,8 @@ anti_replay_check(uint64_t seq, struct otx2_ipsec_fp_in_sa *sa)
 	return 0;
 }
 
-static int
-cpt_ipsec_antireplay_check(struct otx2_ipsec_fp_in_sa *sa, char *data)
+static inline int
+cpt_ipsec_ip_antireplay_check(struct otx2_ipsec_fp_in_sa *sa, char *data)
 {
 	uint64_t seq_in_sa;
 	uint32_t seqh = 0;
@@ -192,7 +191,7 @@ cpt_ipsec_antireplay_check(struct otx2_ipsec_fp_in_sa *sa, char *data)
 		return IPSEC_ANTI_REPLAY_FAILED;
 
 	rte_spinlock_lock(&sa->replay->lock);
-	ret = anti_replay_check(seq, sa);
+	ret = anti_replay_check(sa->replay, seq, sa->replay_win_sz);
 	if (esn && (ret == 0)) {
 		seq_in_sa = ((uint64_t)rte_be_to_cpu_32(sa->esn_hi) << 32) |
 				rte_be_to_cpu_32(sa->esn_low);
diff --git a/drivers/net/octeontx2/otx2_rx.h b/drivers/net/octeontx2/otx2_rx.h
index 926f614a4e..523f36e9f1 100644
--- a/drivers/net/octeontx2/otx2_rx.h
+++ b/drivers/net/octeontx2/otx2_rx.h
@@ -259,7 +259,7 @@ nix_rx_sec_mbuf_update(const struct nix_cqe_hdr_s *cq, struct rte_mbuf *m,
 	data = rte_pktmbuf_mtod(m, char *);
 
 	if (sa->replay_win_sz) {
-		if (cpt_ipsec_antireplay_check(sa, data) < 0)
+		if (cpt_ipsec_ip_antireplay_check(sa, data) < 0)
 			return PKT_RX_SEC_OFFLOAD | PKT_RX_SEC_OFFLOAD_FAILED;
 	}
 
-- 
2.27.0


  reply	other threads:[~2020-12-18 13:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-18 14:14 [dpdk-dev] [PATCH 0/2] add lookaside IPsec ESN and anti-replay support Tejasree Kondoj
2020-12-18 14:14 ` Tejasree Kondoj [this message]
2020-12-18 14:14 ` [dpdk-dev] [PATCH 2/2] crypto/octeontx2: " Tejasree Kondoj
2021-01-15  5:32 ` [dpdk-dev] [PATCH 0/2] " Anoob Joseph
2021-01-15 16:03   ` Akhil Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201218141410.1918-2-ktejasree@marvell.com \
    --to=ktejasree@marvell.com \
    --cc=adwivedi@marvell.com \
    --cc=akhil.goyal@nxp.com \
    --cc=anoobj@marvell.com \
    --cc=dev@dpdk.org \
    --cc=radu.nicolau@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git