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