[1/4] common/cnxk: add CPT HW error callback register functions
Checks
Commit Message
Adds functions to register callback API to report CPT_MISC_INT
to the driver.
Signed-off-by: Srujana Challa <schalla@marvell.com>
---
drivers/common/cnxk/roc_cpt.c | 31 +++++++++++++++++++++++++++++++
drivers/common/cnxk/roc_cpt.h | 8 +++++++-
drivers/common/cnxk/version.map | 2 ++
3 files changed, 40 insertions(+), 1 deletion(-)
@@ -25,6 +25,11 @@
#define CPT_LF_DEFAULT_NB_DESC 1024
#define CPT_LF_FC_MIN_THRESHOLD 32
+static struct cpt_int_cb {
+ roc_cpt_int_misc_cb_t cb;
+ void *cb_args;
+} int_cb;
+
static void
cpt_lf_misc_intr_enb_dis(struct roc_cpt_lf *lf, bool enb)
{
@@ -57,6 +62,9 @@ cpt_lf_misc_irq(void *param)
/* Clear interrupt */
plt_write64(intr, lf->rbase + CPT_LF_MISC_INT);
+
+ if (int_cb.cb != NULL)
+ int_cb.cb(lf, int_cb.cb_args);
}
static int
@@ -1079,3 +1087,26 @@ roc_cpt_ctx_write(struct roc_cpt_lf *lf, void *sa_dptr, void *sa_cptr,
return 0;
}
+
+void
+roc_cpt_int_misc_cb_register(roc_cpt_int_misc_cb_t cb, void *args)
+{
+ if (int_cb.cb != NULL)
+ return;
+
+ int_cb.cb = cb;
+ int_cb.cb_args = args;
+}
+
+int
+roc_cpt_int_misc_cb_unregister(roc_cpt_int_misc_cb_t cb, void *args)
+{
+ if (int_cb.cb == NULL)
+ return 0;
+ if (int_cb.cb != cb || int_cb.cb_args != args)
+ return -EINVAL;
+
+ int_cb.cb = NULL;
+ int_cb.cb_args = NULL;
+ return 0;
+}
@@ -131,7 +131,7 @@ struct roc_cpt {
union cpt_eng_caps hw_caps[CPT_MAX_ENG_TYPES];
uint8_t eng_grp[CPT_MAX_ENG_TYPES];
uint8_t cpt_revision;
-
+ void *opaque;
#define ROC_CPT_MEM_SZ (6 * 1024)
uint8_t reserved[ROC_CPT_MEM_SZ] __plt_cache_aligned;
} __plt_cache_aligned;
@@ -144,6 +144,9 @@ struct roc_cpt_rxc_time_cfg {
uint16_t zombie_thres;
};
+/* CPT MISC interrupt callback */
+typedef void (*roc_cpt_int_misc_cb_t)(struct roc_cpt_lf *lf, void *args);
+
int __roc_api roc_cpt_rxc_time_cfg(struct roc_cpt *roc_cpt,
struct roc_cpt_rxc_time_cfg *cfg);
int __roc_api roc_cpt_dev_init(struct roc_cpt *roc_cpt);
@@ -174,4 +177,7 @@ int __roc_api roc_cpt_lmtline_init(struct roc_cpt *roc_cpt,
void __roc_api roc_cpt_parse_hdr_dump(const struct cpt_parse_hdr_s *cpth);
int __roc_api roc_cpt_ctx_write(struct roc_cpt_lf *lf, void *sa_dptr,
void *sa_cptr, uint16_t sa_len);
+
+void __roc_api roc_cpt_int_misc_cb_register(roc_cpt_int_misc_cb_t cb, void *args);
+int __roc_api roc_cpt_int_misc_cb_unregister(roc_cpt_int_misc_cb_t cb, void *args);
#endif /* _ROC_CPT_H_ */
@@ -78,6 +78,8 @@ INTERNAL {
roc_cpt_parse_hdr_dump;
roc_cpt_rxc_time_cfg;
roc_cpt_ctx_write;
+ roc_cpt_int_misc_cb_register;
+ roc_cpt_int_misc_cb_unregister;
roc_dpi_configure;
roc_dpi_dev_fini;
roc_dpi_dev_init;