1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*  Marvell OcteonTx2 RVU Devlink
3  *
4  * Copyright (C) 2020 Marvell.
5  *
6  */
7 
8 #ifndef RVU_DEVLINK_H
9 #define  RVU_DEVLINK_H
10 
11 #define RVU_REPORTERS(_name)  \
12 static const struct devlink_health_reporter_ops  rvu_ ## _name ## _reporter_ops =  { \
13 	.name = #_name, \
14 	.recover = rvu_ ## _name ## _recover, \
15 	.dump = rvu_ ## _name ## _dump, \
16 }
17 
18 enum npa_af_rvu_health {
19 	NPA_AF_RVU_INTR,
20 	NPA_AF_RVU_GEN,
21 	NPA_AF_RVU_ERR,
22 	NPA_AF_RVU_RAS,
23 };
24 
25 struct rvu_npa_event_ctx {
26 	u64 npa_af_rvu_int;
27 	u64 npa_af_rvu_gen;
28 	u64 npa_af_rvu_err;
29 	u64 npa_af_rvu_ras;
30 };
31 
32 struct rvu_npa_health_reporters {
33 	struct rvu_npa_event_ctx *npa_event_ctx;
34 	struct devlink_health_reporter *rvu_hw_npa_intr_reporter;
35 	struct work_struct              intr_work;
36 	struct devlink_health_reporter *rvu_hw_npa_gen_reporter;
37 	struct work_struct              gen_work;
38 	struct devlink_health_reporter *rvu_hw_npa_err_reporter;
39 	struct work_struct             err_work;
40 	struct devlink_health_reporter *rvu_hw_npa_ras_reporter;
41 	struct work_struct              ras_work;
42 };
43 
44 struct rvu_devlink {
45 	struct devlink *dl;
46 	struct rvu *rvu;
47 	struct workqueue_struct *devlink_wq;
48 	struct rvu_npa_health_reporters *rvu_npa_health_reporter;
49 };
50 
51 /* Devlink APIs */
52 int rvu_register_dl(struct rvu *rvu);
53 void rvu_unregister_dl(struct rvu *rvu);
54 
55 #endif /* RVU_DEVLINK_H */
56