crypto/octeontx2: fix ESN seqhi

Message ID 20211028072246.27500-1-marchana@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series crypto/octeontx2: fix ESN seqhi |

Checks

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

Commit Message

Archana Muniganti Oct. 28, 2021, 7:22 a.m. UTC
  For current pkt, previous seqhi is used instead of its
guessed seqhi. Fixed it.

Fixes: 5be562bc5b78 ("crypto/octeontx2: support IPsec ESN and anti-replay")
Cc: stable@dpdk.org

Signed-off-by: Archana Muniganti <marchana@marvell.com>
---
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
  

Comments

Anoob Joseph Oct. 28, 2021, 7:24 a.m. UTC | #1
> Subject: [PATCH] crypto/octeontx2: fix ESN seqhi
> 
> For current pkt, previous seqhi is used instead of its guessed seqhi. Fixed it.
> 
> Fixes: 5be562bc5b78 ("crypto/octeontx2: support IPsec ESN and anti-replay")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Archana Muniganti <marchana@marvell.com>
> ---
>  drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 

Acked-by: Anoob Joseph <anoobj@marvell.com>
  
Akhil Goyal Oct. 31, 2021, 8:36 p.m. UTC | #2
> > Subject: [PATCH] crypto/octeontx2: fix ESN seqhi
> >
> > For current pkt, previous seqhi is used instead of its guessed seqhi. Fixed it.
> >
> > Fixes: 5be562bc5b78 ("crypto/octeontx2: support IPsec ESN and anti-
> replay")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Archana Muniganti <marchana@marvell.com>
> > ---
> >  drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 16 ++++++++--------
> >  1 file changed, 8 insertions(+), 8 deletions(-)
> >
> 
> Acked-by: Anoob Joseph <anoobj@marvell.com>
Applied to dpdk-next-crypto

Thanks.
  

Patch

diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
index f0b72e05c2..4330cbd1c1 100644
--- a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
+++ b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
@@ -736,6 +736,14 @@  otx2_cpt_enqueue_sec(struct otx2_cpt_qp *qp, struct rte_crypto_op *op,
 				otx2_err("Anti replay check failed");
 				return IPSEC_ANTI_REPLAY_FAILED;
 			}
+
+			if (esn) {
+				seq_in_sa = ((uint64_t)esn_hi << 32) | esn_low;
+				if (seq > seq_in_sa) {
+					sa->esn_low = rte_cpu_to_be_32(seql);
+					sa->esn_hi = rte_cpu_to_be_32(seqh);
+				}
+			}
 		}
 
 		ret = process_inb_sa(op, sess, &qp->meta_info, (void **)&req);
@@ -749,14 +757,6 @@  otx2_cpt_enqueue_sec(struct otx2_cpt_qp *qp, struct rte_crypto_op *op,
 	ret = otx2_cpt_enqueue_req(qp, pend_q, req, op, sess->cpt_inst_w7,
 				    burst_index);
 
-	if (winsz && esn) {
-		seq_in_sa = ((uint64_t)esn_hi << 32) | esn_low;
-		if (seq > seq_in_sa) {
-			sa->esn_low = rte_cpu_to_be_32(seql);
-			sa->esn_hi = rte_cpu_to_be_32(seqh);
-		}
-	}
-
 	return ret;
 }