xref: /linux/drivers/net/ethernet/intel/ice/devlink/health.h (revision 816b02e63a759c4458edee142b721ab09c918b3d)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2024, Intel Corporation. */
3 
4 #ifndef _HEALTH_H_
5 #define _HEALTH_H_
6 
7 #include <linux/types.h>
8 
9 /**
10  * DOC: health.h
11  *
12  * This header file stores everything that is needed for broadly understood
13  * devlink health mechanism for ice driver.
14  */
15 
16 struct ice_pf;
17 struct ice_tx_ring;
18 
19 enum ice_mdd_src {
20 	ICE_MDD_SRC_TX_PQM,
21 	ICE_MDD_SRC_TX_TCLAN,
22 	ICE_MDD_SRC_TX_TDPU,
23 	ICE_MDD_SRC_RX,
24 };
25 
26 /**
27  * struct ice_health - stores ice devlink health reporters and accompanied data
28  * @tx_hang: devlink health reporter for tx_hang event
29  * @mdd: devlink health reporter for MDD detection event
30  * @tx_hang_buf: pre-allocated place to put info for Tx hang reporter from
31  *               non-sleeping context
32  * @tx_ring: ring that the hang occurred on
33  * @head: descriptor head
34  * @intr: interrupt register value
35  * @vsi_num: VSI owning the queue that the hang occurred on
36  */
37 struct ice_health {
38 	struct devlink_health_reporter *mdd;
39 	struct devlink_health_reporter *tx_hang;
40 	struct_group_tagged(ice_health_tx_hang_buf, tx_hang_buf,
41 		struct ice_tx_ring *tx_ring;
42 		u32 head;
43 		u32 intr;
44 		u16 vsi_num;
45 	);
46 };
47 
48 void ice_health_init(struct ice_pf *pf);
49 void ice_health_deinit(struct ice_pf *pf);
50 void ice_health_clear(struct ice_pf *pf);
51 
52 void ice_prep_tx_hang_report(struct ice_pf *pf, struct ice_tx_ring *tx_ring,
53 			     u16 vsi_num, u32 head, u32 intr);
54 void ice_report_mdd_event(struct ice_pf *pf, enum ice_mdd_src src, u8 pf_num,
55 			  u16 vf_num, u8 event, u16 queue);
56 void ice_report_tx_hang(struct ice_pf *pf);
57 
58 #endif /* _HEALTH_H_ */
59