1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /* Copyright(c) 2007-2022 Intel Corporation */
3 /* $FreeBSD$ */
4 /**
5  *****************************************************************************
6  * @file sal_statistics.h
7  *
8  * @ingroup SalStats
9  *
10  * @description
11  *     Statistics related defines, structures and functions
12  *
13  *****************************************************************************/
14 
15 #ifndef SAL_STATISTICS_H
16 #define SAL_STATISTICS_H
17 
18 #include "sal_statistics_strings.h"
19 
20 #define SAL_STATS_SYM 0
21 #define SAL_STATS_DSA 1
22 #define SAL_STATS_DSA2 2
23 #define SAL_STATS_RSA 3
24 #define SAL_STATS_DH 4
25 #define SAL_STATS_KEYGEN 5
26 #define SAL_STATS_LN 6
27 #define SAL_STATS_PRIME 7
28 #define SAL_STATS_ECC 8
29 #define SAL_STATS_ECDH 9
30 #define SAL_STATS_ECDSA 10
31 /**< Numeric values for crypto statistics */
32 
33 #define SAL_STATISTICS_STRING_OFF "0"
34 /**< String representing the value for disabled statistics */
35 
36 /**
37 *****************************************************************************
38  * @ingroup SalStats
39  *      Structure describing stats enabled/disabled in the system
40  *
41  * @description
42  *      Structure describing stats enabled/disabled in the system
43  *
44  *****************************************************************************/
45 typedef struct sal_statistics_collection_s {
46 	CpaBoolean bStatsEnabled;
47 	/**< If CPA_TRUE then statistics functionality is enabled */
48 	CpaBoolean bDcStatsEnabled;
49 	/**< If CPA_TRUE then Compression statistics are enabled */
50 	CpaBoolean bDhStatsEnabled;
51 	/**< If CPA_TRUE then Diffie-Helman statistics are enabled */
52 	CpaBoolean bDsaStatsEnabled;
53 	/**< If CPA_TRUE then DSA statistics are enabled */
54 	CpaBoolean bEccStatsEnabled;
55 	/**< If CPA_TRUE then ECC statistics are enabled */
56 	CpaBoolean bKeyGenStatsEnabled;
57 	/**< If CPA_TRUE then Key Gen statistics are enabled */
58 	CpaBoolean bLnStatsEnabled;
59 	/**< If CPA_TRUE then Large Number statistics are enabled */
60 	CpaBoolean bPrimeStatsEnabled;
61 	/**< If CPA_TRUE then Prime statistics are enabled */
62 	CpaBoolean bRsaStatsEnabled;
63 	/**< If CPA_TRUE then RSA statistics are enabled */
64 	CpaBoolean bSymStatsEnabled;
65 	/**< If CPA_TRUE then Symmetric Crypto statistics are enabled */
66 } sal_statistics_collection_t;
67 
68 /**
69  ******************************************************************************
70  * @ingroup SalStats
71  *
72  * @description
73  *      Initializes structure describing which statistics
74  *      are enabled for the acceleration device.
75  *
76  * @param[in]  device             Pointer to an acceleration device structure
77  *
78  * @retval  CPA_STATUS_SUCCESS          Operation successful
79  * @retval  CPA_STATUS_INVALID_PARAM    Invalid param provided
80  * @retval  CPA_STATUS_RESOURCE         Memory alloc failed
81  * @retval  CPA_STATUS_FAIL             Operation failed
82  *
83  ******************************************************************************/
84 CpaStatus SalStatistics_InitStatisticsCollection(icp_accel_dev_t *device);
85 
86 /**
87  ******************************************************************************
88  * @ingroup SalStats
89  *
90  * @description
91  *      Cleans structure describing which statistics
92  *      are enabled for the acceleration device.
93  *
94  * @param[in]  device             Pointer to an acceleration device structure
95  *
96  * @retval  CPA_STATUS_SUCCESS          Operation successful
97  * @retval  CPA_STATUS_INVALID_PARAM    Invalid param provided
98  * @retval  CPA_STATUS_FAIL             Operation failed
99  *
100  ******************************************************************************/
101 CpaStatus SalStatistics_CleanStatisticsCollection(icp_accel_dev_t *device);
102 #endif
103