DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tejasree Kondoj <ktejasree@marvell.com>
To: Akhil Goyal <gakhil@marvell.com>
Cc: Vidya Sagar Velumuri <vvelumuri@marvell.com>,
	Anoob Joseph <anoobj@marvell.com>, <dev@dpdk.org>
Subject: [PATCH 10/13] crypto/cnxk: acquire lock while updating antireplay
Date: Thu, 20 Oct 2022 16:44:50 +0530	[thread overview]
Message-ID: <20221020111453.1982947-4-ktejasree@marvell.com> (raw)
In-Reply-To: <20221020111453.1982947-1-ktejasree@marvell.com>

From: Vidya Sagar Velumuri <vvelumuri@marvell.com>

Acquire locks in antireplay logic to avoid race condition

Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>
---
 drivers/crypto/cnxk/cn9k_cryptodev_ops.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
index 2a5c00eadd..04c004bc7a 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
@@ -500,6 +500,7 @@ ipsec_antireplay_check(struct cn9k_sec_session *sess, uint32_t win_sz,
 	if (unlikely(seq == 0))
 		return IPSEC_ANTI_REPLAY_FAILED;
 
+	rte_spinlock_lock(&sess->ar.lock);
 	ret = cnxk_on_anti_replay_check(seq, &sess->ar, win_sz);
 	if (esn && !ret) {
 		esn_low = rte_be_to_cpu_32(common_sa->seq_t.tl);
@@ -510,6 +511,7 @@ ipsec_antireplay_check(struct cn9k_sec_session *sess, uint32_t win_sz,
 			common_sa->seq_t.th = rte_cpu_to_be_32(seqh);
 		}
 	}
+	rte_spinlock_unlock(&sess->ar.lock);
 
 	return ret;
 }
-- 
2.25.1


  parent reply	other threads:[~2022-10-20 11:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-20 11:14 [PATCH 00/13] fixes and improvements to cnxk crypto PMD Tejasree Kondoj
2022-10-20 11:14 ` [PATCH 08/13] common/cnxk: add opad ipad gen for md5 Tejasree Kondoj
2022-10-20 11:14 ` [PATCH 09/13] crypto/cnxk: support PDCP AAD in CPT PMD Tejasree Kondoj
2022-10-20 11:14 ` Tejasree Kondoj [this message]
2022-10-20 11:14 ` [PATCH 11/13] crypto/cnxk: switch to SG when metabuf is allocated Tejasree Kondoj
2022-10-25  7:21   ` Akhil Goyal
2022-10-20 11:14 ` [PATCH 12/13] crypto/cnxk: verify IV length during session create Tejasree Kondoj
2022-10-20 11:14 ` [PATCH 13/13] crypto/cnxk: remove dead code Tejasree Kondoj
2022-10-21 15:00 ` [PATCH 00/13] fixes and improvements to cnxk crypto PMD 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=20221020111453.1982947-4-ktejasree@marvell.com \
    --to=ktejasree@marvell.com \
    --cc=anoobj@marvell.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=vvelumuri@marvell.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).