• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Marvell RVU Admin Function 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 enum nix_af_rvu_health {
45 	NIX_AF_RVU_INTR,
46 	NIX_AF_RVU_GEN,
47 	NIX_AF_RVU_ERR,
48 	NIX_AF_RVU_RAS,
49 };
50 
51 struct rvu_nix_event_ctx {
52 	u64 nix_af_rvu_int;
53 	u64 nix_af_rvu_gen;
54 	u64 nix_af_rvu_err;
55 	u64 nix_af_rvu_ras;
56 };
57 
58 struct rvu_nix_health_reporters {
59 	struct rvu_nix_event_ctx *nix_event_ctx;
60 	struct devlink_health_reporter *rvu_hw_nix_intr_reporter;
61 	struct work_struct		intr_work;
62 	struct devlink_health_reporter *rvu_hw_nix_gen_reporter;
63 	struct work_struct		gen_work;
64 	struct devlink_health_reporter *rvu_hw_nix_err_reporter;
65 	struct work_struct		err_work;
66 	struct devlink_health_reporter *rvu_hw_nix_ras_reporter;
67 	struct work_struct		ras_work;
68 };
69 
70 struct rvu_devlink {
71 	struct devlink *dl;
72 	struct rvu *rvu;
73 	struct workqueue_struct *devlink_wq;
74 	struct rvu_npa_health_reporters *rvu_npa_health_reporter;
75 	struct rvu_nix_health_reporters *rvu_nix_health_reporter;
76 };
77 
78 /* Devlink APIs */
79 int rvu_register_dl(struct rvu *rvu);
80 void rvu_unregister_dl(struct rvu *rvu);
81 
82 #endif /* RVU_DEVLINK_H */
83