xref: /freebsd/sys/dev/qat/qat_api/common/utils/sal_service_state.c (revision 71625ec9ad2a9bc8c09784fbd23b759830e0ee5f)
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /* Copyright(c) 2007-2022 Intel Corporation */
3 /**
4  ***************************************************************************
5  * @file sal_service_state.c     Service state checks
6  *
7  * @ingroup SalServiceState
8  *
9  ***************************************************************************/
10 
11 /*
12 *******************************************************************************
13 * Include public/global header files
14 *******************************************************************************
15 */
16 
17 #include "cpa.h"
18 #include "qat_utils.h"
19 #include "lac_list.h"
20 #include "icp_accel_devices.h"
21 #include "icp_adf_debug.h"
22 #include "lac_sal_types.h"
23 #include "sal_service_state.h"
24 
25 CpaBoolean
Sal_ServiceIsRunning(CpaInstanceHandle instanceHandle)26 Sal_ServiceIsRunning(CpaInstanceHandle instanceHandle)
27 {
28 	sal_service_t *pService = (sal_service_t *)instanceHandle;
29 
30 	if (SAL_SERVICE_STATE_RUNNING == pService->state) {
31 		return CPA_TRUE;
32 	}
33 	return CPA_FALSE;
34 }
35 
36 CpaBoolean
Sal_ServiceIsRestarting(CpaInstanceHandle instanceHandle)37 Sal_ServiceIsRestarting(CpaInstanceHandle instanceHandle)
38 {
39 	sal_service_t *pService = (sal_service_t *)instanceHandle;
40 
41 	if (SAL_SERVICE_STATE_RESTARTING == pService->state) {
42 		return CPA_TRUE;
43 	}
44 	return CPA_FALSE;
45 }
46