crypto: user - Split stats in multiple structures

Like for userspace, this patch splits stats into multiple structures,
one for each algorithm class.
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Corentin Labbe 2018-11-29 14:42:24 +00:00 committed by Herbert Xu
parent 5fff81729f
commit 17c18f9e33
3 changed files with 210 additions and 160 deletions

View file

@ -369,6 +369,115 @@ struct compress_alg {
unsigned int slen, u8 *dst, unsigned int *dlen);
};
#ifdef CONFIG_CRYPTO_STATS
/*
* struct crypto_istat_aead - statistics for AEAD algorithm
* @encrypt_cnt: number of encrypt requests
* @encrypt_tlen: total data size handled by encrypt requests
* @decrypt_cnt: number of decrypt requests
* @decrypt_tlen: total data size handled by decrypt requests
* @aead_err_cnt: number of error for AEAD requests
*/
struct crypto_istat_aead {
atomic64_t encrypt_cnt;
atomic64_t encrypt_tlen;
atomic64_t decrypt_cnt;
atomic64_t decrypt_tlen;
atomic64_t aead_err_cnt;
};
/*
* struct crypto_istat_akcipher - statistics for akcipher algorithm
* @encrypt_cnt: number of encrypt requests
* @encrypt_tlen: total data size handled by encrypt requests
* @decrypt_cnt: number of decrypt requests
* @decrypt_tlen: total data size handled by decrypt requests
* @verify_cnt: number of verify operation
* @sign_cnt: number of sign requests
* @akcipher_err_cnt: number of error for akcipher requests
*/
struct crypto_istat_akcipher {
atomic64_t encrypt_cnt;
atomic64_t encrypt_tlen;
atomic64_t decrypt_cnt;
atomic64_t decrypt_tlen;
atomic64_t verify_cnt;
atomic64_t sign_cnt;
atomic64_t akcipher_err_cnt;
};
/*
* struct crypto_istat_cipher - statistics for cipher algorithm
* @encrypt_cnt: number of encrypt requests
* @encrypt_tlen: total data size handled by encrypt requests
* @decrypt_cnt: number of decrypt requests
* @decrypt_tlen: total data size handled by decrypt requests
* @cipher_err_cnt: number of error for cipher requests
*/
struct crypto_istat_cipher {
atomic64_t encrypt_cnt;
atomic64_t encrypt_tlen;
atomic64_t decrypt_cnt;
atomic64_t decrypt_tlen;
atomic64_t cipher_err_cnt;
};
/*
* struct crypto_istat_compress - statistics for compress algorithm
* @compress_cnt: number of compress requests
* @compress_tlen: total data size handled by compress requests
* @decompress_cnt: number of decompress requests
* @decompress_tlen: total data size handled by decompress requests
* @compress_err_cnt: number of error for compress requests
*/
struct crypto_istat_compress {
atomic64_t compress_cnt;
atomic64_t compress_tlen;
atomic64_t decompress_cnt;
atomic64_t decompress_tlen;
atomic64_t compress_err_cnt;
};
/*
* struct crypto_istat_hash - statistics for has algorithm
* @hash_cnt: number of hash requests
* @hash_tlen: total data size hashed
* @hash_err_cnt: number of error for hash requests
*/
struct crypto_istat_hash {
atomic64_t hash_cnt;
atomic64_t hash_tlen;
atomic64_t hash_err_cnt;
};
/*
* struct crypto_istat_kpp - statistics for KPP algorithm
* @setsecret_cnt: number of setsecrey operation
* @generate_public_key_cnt: number of generate_public_key operation
* @compute_shared_secret_cnt: number of compute_shared_secret operation
* @kpp_err_cnt: number of error for KPP requests
*/
struct crypto_istat_kpp {
atomic64_t setsecret_cnt;
atomic64_t generate_public_key_cnt;
atomic64_t compute_shared_secret_cnt;
atomic64_t kpp_err_cnt;
};
/*
* struct crypto_istat_rng: statistics for RNG algorithm
* @generate_cnt: number of RNG generate requests
* @generate_tlen: total data size of generated data by the RNG
* @seed_cnt: number of times the RNG was seeded
* @rng_err_cnt: number of error for RNG requests
*/
struct crypto_istat_rng {
atomic64_t generate_cnt;
atomic64_t generate_tlen;
atomic64_t seed_cnt;
atomic64_t rng_err_cnt;
};
#endif /* CONFIG_CRYPTO_STATS */
#define cra_ablkcipher cra_u.ablkcipher
#define cra_blkcipher cra_u.blkcipher
@ -454,32 +563,7 @@ struct compress_alg {
* @cra_refcnt: internally used
* @cra_destroy: internally used
*
* All following statistics are for this crypto_alg
* @encrypt_cnt: number of encrypt requests
* @decrypt_cnt: number of decrypt requests
* @compress_cnt: number of compress requests
* @decompress_cnt: number of decompress requests
* @generate_cnt: number of RNG generate requests
* @seed_cnt: number of times the rng was seeded
* @hash_cnt: number of hash requests
* @sign_cnt: number of sign requests
* @setsecret_cnt: number of setsecrey operation
* @generate_public_key_cnt: number of generate_public_key operation
* @verify_cnt: number of verify operation
* @compute_shared_secret_cnt: number of compute_shared_secret operation
* @encrypt_tlen: total data size handled by encrypt requests
* @decrypt_tlen: total data size handled by decrypt requests
* @compress_tlen: total data size handled by compress requests
* @decompress_tlen: total data size handled by decompress requests
* @generate_tlen: total data size of generated data by the RNG
* @hash_tlen: total data size hashed
* @akcipher_err_cnt: number of error for akcipher requests
* @cipher_err_cnt: number of error for akcipher requests
* @compress_err_cnt: number of error for akcipher requests
* @aead_err_cnt: number of error for akcipher requests
* @hash_err_cnt: number of error for akcipher requests
* @rng_err_cnt: number of error for akcipher requests
* @kpp_err_cnt: number of error for akcipher requests
* @stats: union of all possible crypto_istat_xxx structures
*
* The struct crypto_alg describes a generic Crypto API algorithm and is common
* for all of the transformations. Any variable not documented here shall not
@ -517,42 +601,14 @@ struct crypto_alg {
#ifdef CONFIG_CRYPTO_STATS
union {
atomic64_t encrypt_cnt;
atomic64_t compress_cnt;
atomic64_t generate_cnt;
atomic64_t hash_cnt;
atomic64_t setsecret_cnt;
};
union {
atomic64_t encrypt_tlen;
atomic64_t compress_tlen;
atomic64_t generate_tlen;
atomic64_t hash_tlen;
};
union {
atomic64_t akcipher_err_cnt;
atomic64_t cipher_err_cnt;
atomic64_t compress_err_cnt;
atomic64_t aead_err_cnt;
atomic64_t hash_err_cnt;
atomic64_t rng_err_cnt;
atomic64_t kpp_err_cnt;
};
union {
atomic64_t decrypt_cnt;
atomic64_t decompress_cnt;
atomic64_t seed_cnt;
atomic64_t generate_public_key_cnt;
};
union {
atomic64_t decrypt_tlen;
atomic64_t decompress_tlen;
};
union {
atomic64_t verify_cnt;
atomic64_t compute_shared_secret_cnt;
};
atomic64_t sign_cnt;
struct crypto_istat_aead aead;
struct crypto_istat_akcipher akcipher;
struct crypto_istat_cipher cipher;
struct crypto_istat_compress compress;
struct crypto_istat_hash hash;
struct crypto_istat_rng rng;
struct crypto_istat_kpp kpp;
} stats;
#endif /* CONFIG_CRYPTO_STATS */
} CRYPTO_MINALIGN_ATTR;