For CN20k platform, CPT RXC time config is common across
all RXC queues. Reassembly configurations are updated to
have fix granularity and variable active limit time for
reassembly entries.

Signed-off-by: Rahul Bhansali <[email protected]>
---
 drivers/common/cnxk/roc_nix.h     |  1 +
 drivers/common/cnxk/roc_nix_inl.c | 21 +++++++++++++++++----
 drivers/common/cnxk/roc_nix_inl.h |  2 ++
 3 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/drivers/common/cnxk/roc_nix.h b/drivers/common/cnxk/roc_nix.h
index 7bc3e1f5c6..8ba8b3e0b6 100644
--- a/drivers/common/cnxk/roc_nix.h
+++ b/drivers/common/cnxk/roc_nix.h
@@ -605,6 +605,7 @@ struct roc_nix {
        bool dis_xqe_drop;
        bool sq_resize_ena;
        uint8_t def_first_skip;
+       uint32_t rxc_step;
        /* End of input parameters */
        /* LMT line base for "Per Core Tx LMT line" mode*/
        uintptr_t lmt_base;
diff --git a/drivers/common/cnxk/roc_nix_inl.c 
b/drivers/common/cnxk/roc_nix_inl.c
index 26be1adac9..0c6211e68e 100644
--- a/drivers/common/cnxk/roc_nix_inl.c
+++ b/drivers/common/cnxk/roc_nix_inl.c
@@ -973,19 +973,16 @@ roc_nix_reassembly_configure(struct roc_cpt_rxc_time_cfg 
*req_cfg, uint32_t max_
        struct roc_cpt_rxc_time_cfg cfg;
        struct roc_cpt *roc_cpt;
        struct mbox *mbox;
+       uint32_t val;
        int rc;
 
        if (!idev)
                return -EFAULT;
 
-       cfg.step = req_cfg->step ? req_cfg->step :
-                                  (max_wait_time * 1000 / 
ROC_NIX_INL_REAS_ACTIVE_LIMIT);
        cfg.zombie_limit =
                req_cfg->zombie_limit ? req_cfg->zombie_limit : 
ROC_NIX_INL_REAS_ZOMBIE_LIMIT;
        cfg.zombie_thres =
                req_cfg->zombie_thres ? req_cfg->zombie_thres : 
ROC_NIX_INL_REAS_ZOMBIE_THRESHOLD;
-       cfg.active_limit =
-               req_cfg->active_limit ? req_cfg->active_limit : 
ROC_NIX_INL_REAS_ACTIVE_LIMIT;
        cfg.active_thres =
                req_cfg->active_thres ? req_cfg->active_thres : 
ROC_NIX_INL_REAS_ACTIVE_THRESHOLD;
 
@@ -995,6 +992,12 @@ roc_nix_reassembly_configure(struct roc_cpt_rxc_time_cfg 
*req_cfg, uint32_t max_
                        plt_err("Cryptodev not probed");
                        return -ENOTSUP;
                }
+
+               val = max_wait_time ? (max_wait_time * 1000 / 
ROC_NIX_INL_REAS_ACTIVE_LIMIT) : 0;
+               cfg.step = req_cfg->step ? req_cfg->step : val;
+               cfg.active_limit = req_cfg->active_limit ? 
req_cfg->active_limit :
+                                                          
ROC_NIX_INL_REAS_ACTIVE_LIMIT;
+
                return roc_cpt_rxc_time_cfg(roc_cpt, &cfg);
        }
 
@@ -1012,6 +1015,16 @@ roc_nix_reassembly_configure(struct roc_cpt_rxc_time_cfg 
*req_cfg, uint32_t max_
                goto exit;
        }
 
+       /* For CN20K, Configure step size fix and active limit per RXC queue,
+        * Default CPT_AF_RXC_TIME_CFG::AGE_STEP will be 1ms, so max reassembly
+        * timeout can be up to 4095 ms.
+        */
+       cfg.step = req_cfg->step ? req_cfg->step : ROC_NIX_INL_REAS_STEP_DFLT;
+       val = max_wait_time ? (max_wait_time * 1000 / cfg.step) : 0;
+       cfg.active_limit = req_cfg->active_limit ? req_cfg->active_limit : val;
+       if (cfg.active_limit > ROC_NIX_INL_REAS_ACTIVE_LIMIT)
+               cfg.active_limit = ROC_NIX_INL_REAS_ACTIVE_LIMIT;
+
        req->blkaddr = 0;
        req->queue_id = inl_dev->nix_inb_qids[inl_dev->inb_cpt_lf_id];
        req->step = cfg.step;
diff --git a/drivers/common/cnxk/roc_nix_inl.h 
b/drivers/common/cnxk/roc_nix_inl.h
index d1a08a4495..82dae4b1ba 100644
--- a/drivers/common/cnxk/roc_nix_inl.h
+++ b/drivers/common/cnxk/roc_nix_inl.h
@@ -36,6 +36,8 @@
 #define ROC_NIX_INL_INB_CUSTOM_SA_SZ 512
 
 /* Reassembly configuration */
+#define ROC_NIX_INL_REAS_STEP_MAX        0xFFFFF
+#define ROC_NIX_INL_REAS_STEP_DFLT       0x3E8 /* 1 ms */
 #define ROC_NIX_INL_REAS_ACTIVE_LIMIT    0xFFF
 #define ROC_NIX_INL_REAS_ACTIVE_THRESHOLD 10
 #define ROC_NIX_INL_REAS_ZOMBIE_LIMIT    0xFFF
-- 
2.34.1

Reply via email to