]> git.droids-corp.org - dpdk.git/commitdiff
crypto/octeontx2: fix ESN seqhi
authorArchana Muniganti <marchana@marvell.com>
Thu, 28 Oct 2021 07:22:46 +0000 (12:52 +0530)
committerAkhil Goyal <gakhil@marvell.com>
Thu, 4 Nov 2021 18:46:27 +0000 (19:46 +0100)
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>
Acked-by: Anoob Joseph <anoobj@marvell.com>
drivers/crypto/octeontx2/otx2_cryptodev_ops.c

index f0b72e05c29cb3a791e9270d8ea9b20f17388fb5..4330cbd1c1fbcff4be5a95434170c92137bf514e 100644 (file)
@@ -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;
 }