xref: /freebsd/sys/dev/qat/include/adf_heartbeat.h (revision 38a52bd3b5cac3da6f7f6eef3dd050e6aa08ebb3)
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /* Copyright(c) 2007-2022 Intel Corporation */
3 /* $FreeBSD$ */
4 #ifndef ADF_HEARTBEAT_H_
5 #define ADF_HEARTBEAT_H_
6 
7 #include "adf_cfg_common.h"
8 
9 struct adf_accel_dev;
10 
11 struct qat_sysctl {
12 	unsigned int hb_sysctlvar;
13 	struct sysctl_oid *oid;
14 };
15 
16 struct adf_heartbeat {
17 	unsigned int hb_sent_counter;
18 	unsigned int hb_failed_counter;
19 	u64 last_hb_check_time;
20 	enum adf_device_heartbeat_status last_hb_status;
21 	struct qat_sysctl heartbeat;
22 	struct qat_sysctl *heartbeat_sent;
23 	struct qat_sysctl *heartbeat_failed;
24 };
25 
26 int adf_heartbeat_init(struct adf_accel_dev *accel_dev);
27 void adf_heartbeat_clean(struct adf_accel_dev *accel_dev);
28 
29 int adf_get_hb_timer(struct adf_accel_dev *accel_dev, unsigned int *value);
30 int adf_get_heartbeat_status(struct adf_accel_dev *accel_dev);
31 int adf_heartbeat_status(struct adf_accel_dev *accel_dev,
32 			 enum adf_device_heartbeat_status *hb_status);
33 #endif /* ADF_HEARTBEAT_H_ */
34