Skip to content

Commit 44f1313

Browse files
montjoieherbertx
authored andcommitted
crypto: user - rename err_cnt parameter
Since now all crypto stats are on their own structures, it is now useless to have the algorithm name in the err_cnt member. Signed-off-by: Corentin Labbe <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 17c18f9 commit 44f1313

File tree

5 files changed

+58
-58
lines changed

5 files changed

+58
-58
lines changed

crypto/algapi.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ void crypto_stats_ablkcipher_encrypt(unsigned int nbytes, int ret,
10831083
struct crypto_alg *alg)
10841084
{
10851085
if (ret && ret != -EINPROGRESS && ret != -EBUSY) {
1086-
atomic64_inc(&alg->stats.cipher.cipher_err_cnt);
1086+
atomic64_inc(&alg->stats.cipher.err_cnt);
10871087
} else {
10881088
atomic64_inc(&alg->stats.cipher.encrypt_cnt);
10891089
atomic64_add(nbytes, &alg->stats.cipher.encrypt_tlen);
@@ -1096,7 +1096,7 @@ void crypto_stats_ablkcipher_decrypt(unsigned int nbytes, int ret,
10961096
struct crypto_alg *alg)
10971097
{
10981098
if (ret && ret != -EINPROGRESS && ret != -EBUSY) {
1099-
atomic64_inc(&alg->stats.cipher.cipher_err_cnt);
1099+
atomic64_inc(&alg->stats.cipher.err_cnt);
11001100
} else {
11011101
atomic64_inc(&alg->stats.cipher.decrypt_cnt);
11021102
atomic64_add(nbytes, &alg->stats.cipher.decrypt_tlen);
@@ -1109,7 +1109,7 @@ void crypto_stats_aead_encrypt(unsigned int cryptlen, struct crypto_alg *alg,
11091109
int ret)
11101110
{
11111111
if (ret && ret != -EINPROGRESS && ret != -EBUSY) {
1112-
atomic64_inc(&alg->stats.aead.aead_err_cnt);
1112+
atomic64_inc(&alg->stats.aead.err_cnt);
11131113
} else {
11141114
atomic64_inc(&alg->stats.aead.encrypt_cnt);
11151115
atomic64_add(cryptlen, &alg->stats.aead.encrypt_tlen);
@@ -1122,7 +1122,7 @@ void crypto_stats_aead_decrypt(unsigned int cryptlen, struct crypto_alg *alg,
11221122
int ret)
11231123
{
11241124
if (ret && ret != -EINPROGRESS && ret != -EBUSY) {
1125-
atomic64_inc(&alg->stats.aead.aead_err_cnt);
1125+
atomic64_inc(&alg->stats.aead.err_cnt);
11261126
} else {
11271127
atomic64_inc(&alg->stats.aead.decrypt_cnt);
11281128
atomic64_add(cryptlen, &alg->stats.aead.decrypt_tlen);
@@ -1135,7 +1135,7 @@ void crypto_stats_akcipher_encrypt(unsigned int src_len, int ret,
11351135
struct crypto_alg *alg)
11361136
{
11371137
if (ret && ret != -EINPROGRESS && ret != -EBUSY) {
1138-
atomic64_inc(&alg->stats.akcipher.akcipher_err_cnt);
1138+
atomic64_inc(&alg->stats.akcipher.err_cnt);
11391139
} else {
11401140
atomic64_inc(&alg->stats.akcipher.encrypt_cnt);
11411141
atomic64_add(src_len, &alg->stats.akcipher.encrypt_tlen);
@@ -1148,7 +1148,7 @@ void crypto_stats_akcipher_decrypt(unsigned int src_len, int ret,
11481148
struct crypto_alg *alg)
11491149
{
11501150
if (ret && ret != -EINPROGRESS && ret != -EBUSY) {
1151-
atomic64_inc(&alg->stats.akcipher.akcipher_err_cnt);
1151+
atomic64_inc(&alg->stats.akcipher.err_cnt);
11521152
} else {
11531153
atomic64_inc(&alg->stats.akcipher.decrypt_cnt);
11541154
atomic64_add(src_len, &alg->stats.akcipher.decrypt_tlen);
@@ -1160,7 +1160,7 @@ EXPORT_SYMBOL_GPL(crypto_stats_akcipher_decrypt);
11601160
void crypto_stats_akcipher_sign(int ret, struct crypto_alg *alg)
11611161
{
11621162
if (ret && ret != -EINPROGRESS && ret != -EBUSY)
1163-
atomic64_inc(&alg->stats.akcipher.akcipher_err_cnt);
1163+
atomic64_inc(&alg->stats.akcipher.err_cnt);
11641164
else
11651165
atomic64_inc(&alg->stats.akcipher.sign_cnt);
11661166
crypto_alg_put(alg);
@@ -1170,7 +1170,7 @@ EXPORT_SYMBOL_GPL(crypto_stats_akcipher_sign);
11701170
void crypto_stats_akcipher_verify(int ret, struct crypto_alg *alg)
11711171
{
11721172
if (ret && ret != -EINPROGRESS && ret != -EBUSY)
1173-
atomic64_inc(&alg->stats.akcipher.akcipher_err_cnt);
1173+
atomic64_inc(&alg->stats.akcipher.err_cnt);
11741174
else
11751175
atomic64_inc(&alg->stats.akcipher.verify_cnt);
11761176
crypto_alg_put(alg);
@@ -1180,7 +1180,7 @@ EXPORT_SYMBOL_GPL(crypto_stats_akcipher_verify);
11801180
void crypto_stats_compress(unsigned int slen, int ret, struct crypto_alg *alg)
11811181
{
11821182
if (ret && ret != -EINPROGRESS && ret != -EBUSY) {
1183-
atomic64_inc(&alg->stats.compress.compress_err_cnt);
1183+
atomic64_inc(&alg->stats.compress.err_cnt);
11841184
} else {
11851185
atomic64_inc(&alg->stats.compress.compress_cnt);
11861186
atomic64_add(slen, &alg->stats.compress.compress_tlen);
@@ -1192,7 +1192,7 @@ EXPORT_SYMBOL_GPL(crypto_stats_compress);
11921192
void crypto_stats_decompress(unsigned int slen, int ret, struct crypto_alg *alg)
11931193
{
11941194
if (ret && ret != -EINPROGRESS && ret != -EBUSY) {
1195-
atomic64_inc(&alg->stats.compress.compress_err_cnt);
1195+
atomic64_inc(&alg->stats.compress.err_cnt);
11961196
} else {
11971197
atomic64_inc(&alg->stats.compress.decompress_cnt);
11981198
atomic64_add(slen, &alg->stats.compress.decompress_tlen);
@@ -1205,7 +1205,7 @@ void crypto_stats_ahash_update(unsigned int nbytes, int ret,
12051205
struct crypto_alg *alg)
12061206
{
12071207
if (ret && ret != -EINPROGRESS && ret != -EBUSY)
1208-
atomic64_inc(&alg->stats.hash.hash_err_cnt);
1208+
atomic64_inc(&alg->stats.hash.err_cnt);
12091209
else
12101210
atomic64_add(nbytes, &alg->stats.hash.hash_tlen);
12111211
crypto_alg_put(alg);
@@ -1216,7 +1216,7 @@ void crypto_stats_ahash_final(unsigned int nbytes, int ret,
12161216
struct crypto_alg *alg)
12171217
{
12181218
if (ret && ret != -EINPROGRESS && ret != -EBUSY) {
1219-
atomic64_inc(&alg->stats.hash.hash_err_cnt);
1219+
atomic64_inc(&alg->stats.hash.err_cnt);
12201220
} else {
12211221
atomic64_inc(&alg->stats.hash.hash_cnt);
12221222
atomic64_add(nbytes, &alg->stats.hash.hash_tlen);
@@ -1228,7 +1228,7 @@ EXPORT_SYMBOL_GPL(crypto_stats_ahash_final);
12281228
void crypto_stats_kpp_set_secret(struct crypto_alg *alg, int ret)
12291229
{
12301230
if (ret)
1231-
atomic64_inc(&alg->stats.kpp.kpp_err_cnt);
1231+
atomic64_inc(&alg->stats.kpp.err_cnt);
12321232
else
12331233
atomic64_inc(&alg->stats.kpp.setsecret_cnt);
12341234
crypto_alg_put(alg);
@@ -1238,7 +1238,7 @@ EXPORT_SYMBOL_GPL(crypto_stats_kpp_set_secret);
12381238
void crypto_stats_kpp_generate_public_key(struct crypto_alg *alg, int ret)
12391239
{
12401240
if (ret)
1241-
atomic64_inc(&alg->stats.kpp.kpp_err_cnt);
1241+
atomic64_inc(&alg->stats.kpp.err_cnt);
12421242
else
12431243
atomic64_inc(&alg->stats.kpp.generate_public_key_cnt);
12441244
crypto_alg_put(alg);
@@ -1248,7 +1248,7 @@ EXPORT_SYMBOL_GPL(crypto_stats_kpp_generate_public_key);
12481248
void crypto_stats_kpp_compute_shared_secret(struct crypto_alg *alg, int ret)
12491249
{
12501250
if (ret)
1251-
atomic64_inc(&alg->stats.kpp.kpp_err_cnt);
1251+
atomic64_inc(&alg->stats.kpp.err_cnt);
12521252
else
12531253
atomic64_inc(&alg->stats.kpp.compute_shared_secret_cnt);
12541254
crypto_alg_put(alg);
@@ -1258,7 +1258,7 @@ EXPORT_SYMBOL_GPL(crypto_stats_kpp_compute_shared_secret);
12581258
void crypto_stats_rng_seed(struct crypto_alg *alg, int ret)
12591259
{
12601260
if (ret && ret != -EINPROGRESS && ret != -EBUSY)
1261-
atomic64_inc(&alg->stats.rng.rng_err_cnt);
1261+
atomic64_inc(&alg->stats.rng.err_cnt);
12621262
else
12631263
atomic64_inc(&alg->stats.rng.seed_cnt);
12641264
crypto_alg_put(alg);
@@ -1269,7 +1269,7 @@ void crypto_stats_rng_generate(struct crypto_alg *alg, unsigned int dlen,
12691269
int ret)
12701270
{
12711271
if (ret && ret != -EINPROGRESS && ret != -EBUSY) {
1272-
atomic64_inc(&alg->stats.rng.rng_err_cnt);
1272+
atomic64_inc(&alg->stats.rng.err_cnt);
12731273
} else {
12741274
atomic64_inc(&alg->stats.rng.generate_cnt);
12751275
atomic64_add(dlen, &alg->stats.rng.generate_tlen);
@@ -1282,7 +1282,7 @@ void crypto_stats_skcipher_encrypt(unsigned int cryptlen, int ret,
12821282
struct crypto_alg *alg)
12831283
{
12841284
if (ret && ret != -EINPROGRESS && ret != -EBUSY) {
1285-
atomic64_inc(&alg->stats.cipher.cipher_err_cnt);
1285+
atomic64_inc(&alg->stats.cipher.err_cnt);
12861286
} else {
12871287
atomic64_inc(&alg->stats.cipher.encrypt_cnt);
12881288
atomic64_add(cryptlen, &alg->stats.cipher.encrypt_tlen);
@@ -1295,7 +1295,7 @@ void crypto_stats_skcipher_decrypt(unsigned int cryptlen, int ret,
12951295
struct crypto_alg *alg)
12961296
{
12971297
if (ret && ret != -EINPROGRESS && ret != -EBUSY) {
1298-
atomic64_inc(&alg->stats.cipher.cipher_err_cnt);
1298+
atomic64_inc(&alg->stats.cipher.err_cnt);
12991299
} else {
13001300
atomic64_inc(&alg->stats.cipher.decrypt_cnt);
13011301
atomic64_add(cryptlen, &alg->stats.cipher.decrypt_tlen);

crypto/crypto_user_stat.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static int crypto_report_aead(struct sk_buff *skb, struct crypto_alg *alg)
4343
raead.stat_encrypt_tlen = atomic64_read(&alg->stats.aead.encrypt_tlen);
4444
raead.stat_decrypt_cnt = atomic64_read(&alg->stats.aead.decrypt_cnt);
4545
raead.stat_decrypt_tlen = atomic64_read(&alg->stats.aead.decrypt_tlen);
46-
raead.stat_aead_err_cnt = atomic64_read(&alg->stats.aead.aead_err_cnt);
46+
raead.stat_err_cnt = atomic64_read(&alg->stats.aead.err_cnt);
4747

4848
return nla_put(skb, CRYPTOCFGA_STAT_AEAD, sizeof(raead), &raead);
4949
}
@@ -60,7 +60,7 @@ static int crypto_report_cipher(struct sk_buff *skb, struct crypto_alg *alg)
6060
rcipher.stat_encrypt_tlen = atomic64_read(&alg->stats.cipher.encrypt_tlen);
6161
rcipher.stat_decrypt_cnt = atomic64_read(&alg->stats.cipher.decrypt_cnt);
6262
rcipher.stat_decrypt_tlen = atomic64_read(&alg->stats.cipher.decrypt_tlen);
63-
rcipher.stat_cipher_err_cnt = atomic64_read(&alg->stats.cipher.cipher_err_cnt);
63+
rcipher.stat_err_cnt = atomic64_read(&alg->stats.cipher.err_cnt);
6464

6565
return nla_put(skb, CRYPTOCFGA_STAT_CIPHER, sizeof(rcipher), &rcipher);
6666
}
@@ -76,7 +76,7 @@ static int crypto_report_comp(struct sk_buff *skb, struct crypto_alg *alg)
7676
rcomp.stat_compress_tlen = atomic64_read(&alg->stats.compress.compress_tlen);
7777
rcomp.stat_decompress_cnt = atomic64_read(&alg->stats.compress.decompress_cnt);
7878
rcomp.stat_decompress_tlen = atomic64_read(&alg->stats.compress.decompress_tlen);
79-
rcomp.stat_compress_err_cnt = atomic64_read(&alg->stats.compress.compress_err_cnt);
79+
rcomp.stat_err_cnt = atomic64_read(&alg->stats.compress.err_cnt);
8080

8181
return nla_put(skb, CRYPTOCFGA_STAT_COMPRESS, sizeof(rcomp), &rcomp);
8282
}
@@ -92,7 +92,7 @@ static int crypto_report_acomp(struct sk_buff *skb, struct crypto_alg *alg)
9292
racomp.stat_compress_tlen = atomic64_read(&alg->stats.compress.compress_tlen);
9393
racomp.stat_decompress_cnt = atomic64_read(&alg->stats.compress.decompress_cnt);
9494
racomp.stat_decompress_tlen = atomic64_read(&alg->stats.compress.decompress_tlen);
95-
racomp.stat_compress_err_cnt = atomic64_read(&alg->stats.compress.compress_err_cnt);
95+
racomp.stat_err_cnt = atomic64_read(&alg->stats.compress.err_cnt);
9696

9797
return nla_put(skb, CRYPTOCFGA_STAT_ACOMP, sizeof(racomp), &racomp);
9898
}
@@ -110,7 +110,7 @@ static int crypto_report_akcipher(struct sk_buff *skb, struct crypto_alg *alg)
110110
rakcipher.stat_decrypt_tlen = atomic64_read(&alg->stats.akcipher.decrypt_tlen);
111111
rakcipher.stat_sign_cnt = atomic64_read(&alg->stats.akcipher.sign_cnt);
112112
rakcipher.stat_verify_cnt = atomic64_read(&alg->stats.akcipher.verify_cnt);
113-
rakcipher.stat_akcipher_err_cnt = atomic64_read(&alg->stats.akcipher.akcipher_err_cnt);
113+
rakcipher.stat_err_cnt = atomic64_read(&alg->stats.akcipher.err_cnt);
114114

115115
return nla_put(skb, CRYPTOCFGA_STAT_AKCIPHER,
116116
sizeof(rakcipher), &rakcipher);
@@ -127,7 +127,7 @@ static int crypto_report_kpp(struct sk_buff *skb, struct crypto_alg *alg)
127127
rkpp.stat_setsecret_cnt = atomic64_read(&alg->stats.kpp.setsecret_cnt);
128128
rkpp.stat_generate_public_key_cnt = atomic64_read(&alg->stats.kpp.generate_public_key_cnt);
129129
rkpp.stat_compute_shared_secret_cnt = atomic64_read(&alg->stats.kpp.compute_shared_secret_cnt);
130-
rkpp.stat_kpp_err_cnt = atomic64_read(&alg->stats.kpp.kpp_err_cnt);
130+
rkpp.stat_err_cnt = atomic64_read(&alg->stats.kpp.err_cnt);
131131

132132
return nla_put(skb, CRYPTOCFGA_STAT_KPP, sizeof(rkpp), &rkpp);
133133
}
@@ -142,7 +142,7 @@ static int crypto_report_ahash(struct sk_buff *skb, struct crypto_alg *alg)
142142

143143
rhash.stat_hash_cnt = atomic64_read(&alg->stats.hash.hash_cnt);
144144
rhash.stat_hash_tlen = atomic64_read(&alg->stats.hash.hash_tlen);
145-
rhash.stat_hash_err_cnt = atomic64_read(&alg->stats.hash.hash_err_cnt);
145+
rhash.stat_err_cnt = atomic64_read(&alg->stats.hash.err_cnt);
146146

147147
return nla_put(skb, CRYPTOCFGA_STAT_HASH, sizeof(rhash), &rhash);
148148
}
@@ -157,7 +157,7 @@ static int crypto_report_shash(struct sk_buff *skb, struct crypto_alg *alg)
157157

158158
rhash.stat_hash_cnt = atomic64_read(&alg->stats.hash.hash_cnt);
159159
rhash.stat_hash_tlen = atomic64_read(&alg->stats.hash.hash_tlen);
160-
rhash.stat_hash_err_cnt = atomic64_read(&alg->stats.hash.hash_err_cnt);
160+
rhash.stat_err_cnt = atomic64_read(&alg->stats.hash.err_cnt);
161161

162162
return nla_put(skb, CRYPTOCFGA_STAT_HASH, sizeof(rhash), &rhash);
163163
}
@@ -173,7 +173,7 @@ static int crypto_report_rng(struct sk_buff *skb, struct crypto_alg *alg)
173173
rrng.stat_generate_cnt = atomic64_read(&alg->stats.rng.generate_cnt);
174174
rrng.stat_generate_tlen = atomic64_read(&alg->stats.rng.generate_tlen);
175175
rrng.stat_seed_cnt = atomic64_read(&alg->stats.rng.seed_cnt);
176-
rrng.stat_rng_err_cnt = atomic64_read(&alg->stats.rng.rng_err_cnt);
176+
rrng.stat_err_cnt = atomic64_read(&alg->stats.rng.err_cnt);
177177

178178
return nla_put(skb, CRYPTOCFGA_STAT_RNG, sizeof(rrng), &rrng);
179179
}

include/linux/crypto.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -376,14 +376,14 @@ struct compress_alg {
376376
* @encrypt_tlen: total data size handled by encrypt requests
377377
* @decrypt_cnt: number of decrypt requests
378378
* @decrypt_tlen: total data size handled by decrypt requests
379-
* @aead_err_cnt: number of error for AEAD requests
379+
* @err_cnt: number of error for AEAD requests
380380
*/
381381
struct crypto_istat_aead {
382382
atomic64_t encrypt_cnt;
383383
atomic64_t encrypt_tlen;
384384
atomic64_t decrypt_cnt;
385385
atomic64_t decrypt_tlen;
386-
atomic64_t aead_err_cnt;
386+
atomic64_t err_cnt;
387387
};
388388

389389
/*
@@ -394,7 +394,7 @@ struct crypto_istat_aead {
394394
* @decrypt_tlen: total data size handled by decrypt requests
395395
* @verify_cnt: number of verify operation
396396
* @sign_cnt: number of sign requests
397-
* @akcipher_err_cnt: number of error for akcipher requests
397+
* @err_cnt: number of error for akcipher requests
398398
*/
399399
struct crypto_istat_akcipher {
400400
atomic64_t encrypt_cnt;
@@ -403,7 +403,7 @@ struct crypto_istat_akcipher {
403403
atomic64_t decrypt_tlen;
404404
atomic64_t verify_cnt;
405405
atomic64_t sign_cnt;
406-
atomic64_t akcipher_err_cnt;
406+
atomic64_t err_cnt;
407407
};
408408

409409
/*
@@ -412,14 +412,14 @@ struct crypto_istat_akcipher {
412412
* @encrypt_tlen: total data size handled by encrypt requests
413413
* @decrypt_cnt: number of decrypt requests
414414
* @decrypt_tlen: total data size handled by decrypt requests
415-
* @cipher_err_cnt: number of error for cipher requests
415+
* @err_cnt: number of error for cipher requests
416416
*/
417417
struct crypto_istat_cipher {
418418
atomic64_t encrypt_cnt;
419419
atomic64_t encrypt_tlen;
420420
atomic64_t decrypt_cnt;
421421
atomic64_t decrypt_tlen;
422-
atomic64_t cipher_err_cnt;
422+
atomic64_t err_cnt;
423423
};
424424

425425
/*
@@ -428,54 +428,54 @@ struct crypto_istat_cipher {
428428
* @compress_tlen: total data size handled by compress requests
429429
* @decompress_cnt: number of decompress requests
430430
* @decompress_tlen: total data size handled by decompress requests
431-
* @compress_err_cnt: number of error for compress requests
431+
* @err_cnt: number of error for compress requests
432432
*/
433433
struct crypto_istat_compress {
434434
atomic64_t compress_cnt;
435435
atomic64_t compress_tlen;
436436
atomic64_t decompress_cnt;
437437
atomic64_t decompress_tlen;
438-
atomic64_t compress_err_cnt;
438+
atomic64_t err_cnt;
439439
};
440440

441441
/*
442442
* struct crypto_istat_hash - statistics for has algorithm
443443
* @hash_cnt: number of hash requests
444444
* @hash_tlen: total data size hashed
445-
* @hash_err_cnt: number of error for hash requests
445+
* @err_cnt: number of error for hash requests
446446
*/
447447
struct crypto_istat_hash {
448448
atomic64_t hash_cnt;
449449
atomic64_t hash_tlen;
450-
atomic64_t hash_err_cnt;
450+
atomic64_t err_cnt;
451451
};
452452

453453
/*
454454
* struct crypto_istat_kpp - statistics for KPP algorithm
455455
* @setsecret_cnt: number of setsecrey operation
456456
* @generate_public_key_cnt: number of generate_public_key operation
457457
* @compute_shared_secret_cnt: number of compute_shared_secret operation
458-
* @kpp_err_cnt: number of error for KPP requests
458+
* @err_cnt: number of error for KPP requests
459459
*/
460460
struct crypto_istat_kpp {
461461
atomic64_t setsecret_cnt;
462462
atomic64_t generate_public_key_cnt;
463463
atomic64_t compute_shared_secret_cnt;
464-
atomic64_t kpp_err_cnt;
464+
atomic64_t err_cnt;
465465
};
466466

467467
/*
468468
* struct crypto_istat_rng: statistics for RNG algorithm
469469
* @generate_cnt: number of RNG generate requests
470470
* @generate_tlen: total data size of generated data by the RNG
471471
* @seed_cnt: number of times the RNG was seeded
472-
* @rng_err_cnt: number of error for RNG requests
472+
* @err_cnt: number of error for RNG requests
473473
*/
474474
struct crypto_istat_rng {
475475
atomic64_t generate_cnt;
476476
atomic64_t generate_tlen;
477477
atomic64_t seed_cnt;
478-
atomic64_t rng_err_cnt;
478+
atomic64_t err_cnt;
479479
};
480480
#endif /* CONFIG_CRYPTO_STATS */
481481

0 commit comments

Comments
 (0)