Use lcore LMT line for CPT context write as no one else
is using it.

Signed-off-by: Nithin Dabilpuram <ndabilpu...@marvell.com>
---
 drivers/common/cnxk/roc_cpt.c | 3 ++-
 drivers/common/cnxk/roc_io.h  | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/common/cnxk/roc_cpt.c b/drivers/common/cnxk/roc_cpt.c
index 9a90d4d853..e336edb77e 100644
--- a/drivers/common/cnxk/roc_cpt.c
+++ b/drivers/common/cnxk/roc_cpt.c
@@ -1020,7 +1020,8 @@ roc_cpt_ctx_write(struct roc_cpt_lf *lf, void *sa_dptr, 
void *sa_cptr,
        uint64_t *dptr;
        int i;
 
-       ROC_LMT_CPT_BASE_ID_GET(lmt_base, lmt_id);
+       /* Use this lcore's LMT line as no one else is using it */
+       ROC_LMT_BASE_ID_GET(lmt_base, lmt_id);
        inst = (struct cpt_inst_s *)lmt_base;
 
        memset(inst, 0, sizeof(struct cpt_inst_s));
diff --git a/drivers/common/cnxk/roc_io.h b/drivers/common/cnxk/roc_io.h
index 13f98ed549..1e5c1f8c04 100644
--- a/drivers/common/cnxk/roc_io.h
+++ b/drivers/common/cnxk/roc_io.h
@@ -7,6 +7,7 @@
 
 #include "roc_platform.h" /* for __plt_always_inline macro */
 
+#ifndef ROC_LMT_BASE_ID_GET
 #define ROC_LMT_BASE_ID_GET(lmt_addr, lmt_id)                                  
\
        do {                                                                   \
                /* 32 Lines per core */                                        \
@@ -14,7 +15,10 @@
                /* Each line is of 128B */                                     \
                (lmt_addr) += ((uint64_t)lmt_id << ROC_LMT_LINE_SIZE_LOG2);    \
        } while (0)
+#endif
 
+/* Define it if not defined in roc_platform.h */
+#ifndef ROC_LMT_CPT_BASE_ID_GET
 #define ROC_LMT_CPT_BASE_ID_GET(lmt_addr, lmt_id)                              
\
        do {                                                                   \
                /* 16 Lines per core */                                        \
@@ -23,6 +27,7 @@
                /* Each line is of 128B */                                     \
                (lmt_addr) += ((uint64_t)lmt_id << ROC_LMT_LINE_SIZE_LOG2);    \
        } while (0)
+#endif
 
 #define roc_load_pair(val0, val1, addr)                                        
\
        ({                                                                     \
-- 
2.25.1

Reply via email to