From: Anoob Joseph <ano...@marvell.com>

Update sess pointer while working on next set of packets.

Signed-off-by: Anoob Joseph <ano...@marvell.com>
---
 drivers/crypto/cnxk/cn10k_cryptodev_ops.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c 
b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
index 3fd002d549..0afd623990 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
@@ -1460,6 +1460,8 @@ cn10k_cryptodev_sec_inb_rx_inject(void *dev, struct 
rte_mbuf **pkts,
 
        vf = cdev->data->dev_private;
 
+       const int nb_pkts_per_loop = 2 * CN10K_PKTS_PER_LOOP;
+
        lmt_base = vf->rx_inj_lmtline.lmt_base;
        io_addr = vf->rx_inj_lmtline.io_addr;
        fc_addr = vf->rx_inj_lmtline.fc_addr;
@@ -1479,7 +1481,7 @@ cn10k_cryptodev_sec_inb_rx_inject(void *dev, struct 
rte_mbuf **pkts,
        if (unlikely(fc.s.qsize > fc_thresh))
                goto exit;
 
-       for (; i < RTE_MIN(2 * CN10K_PKTS_PER_LOOP, nb_pkts); i++) {
+       for (; i < RTE_MIN(nb_pkts_per_loop, nb_pkts); i++) {
 
                m = pkts[i];
                sec_sess = (struct cn10k_sec_session *)sess[i];
@@ -1537,10 +1539,11 @@ cn10k_cryptodev_sec_inb_rx_inject(void *dev, struct 
rte_mbuf **pkts,
 
        cn10k_cpt_lmtst_dual_submit(&io_addr, lmt_id, &i);
 
-       if (nb_pkts - i > 0 && i == 2 * CN10K_PKTS_PER_LOOP) {
-               nb_pkts -= i;
-               pkts += i;
-               count += i;
+       if (nb_pkts - i > 0 && i == nb_pkts_per_loop) {
+               nb_pkts -= nb_pkts_per_loop;
+               pkts += nb_pkts_per_loop;
+               count += nb_pkts_per_loop;
+               sess += nb_pkts_per_loop;
                goto again;
        }
 
-- 
2.25.1

Reply via email to