crypto/cnxk: predecrement esn value to be used in session

Message ID 20220627081233.409-1-anoobj@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series crypto/cnxk: predecrement esn value to be used in session |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-abi-testing success Testing PASS

Commit Message

Anoob Joseph June 27, 2022, 8:12 a.m. UTC
  ESN provided in the session would be the next sequence number to be
used. Hence predecrement the value, so that in datapath, incremented
value will be as expected.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
---
 drivers/crypto/cnxk/cn9k_ipsec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Akhil Goyal June 28, 2022, 12:21 p.m. UTC | #1
> ESN provided in the session would be the next sequence number to be
> used. Hence predecrement the value, so that in datapath, incremented
> value will be as expected.
> 
> Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Applied to dpdk-next-crypto

Thanks.
  

Patch

diff --git a/drivers/crypto/cnxk/cn9k_ipsec.c b/drivers/crypto/cnxk/cn9k_ipsec.c
index cb9cf174a4..6d26b0cc01 100644
--- a/drivers/crypto/cnxk/cn9k_ipsec.c
+++ b/drivers/crypto/cnxk/cn9k_ipsec.c
@@ -41,7 +41,8 @@  cn9k_ipsec_outb_sa_create(struct cnxk_cpt_qp *qp,
 	/* Initialize lookaside IPsec private data */
 	sa->dir = RTE_SECURITY_IPSEC_SA_DIR_EGRESS;
 
-	sa->esn = ipsec->esn.value;
+	if (ipsec->esn.value)
+		sa->esn = ipsec->esn.value - 1;
 
 	ret = cnxk_ipsec_outb_rlens_get(&sa->rlens, ipsec, crypto_xform);
 	if (ret)