Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3498885imu; Wed, 7 Nov 2018 11:14:07 -0800 (PST) X-Google-Smtp-Source: AJdET5e015ND0cwLZGERDvSVMzEyv5lwFtcclEFs6hAk9x5Z4AJGMImsDU8C0iUyXWLqP+TwKNpR X-Received: by 2002:a63:9402:: with SMTP id m2mr1190487pge.93.1541618047867; Wed, 07 Nov 2018 11:14:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541618047; cv=none; d=google.com; s=arc-20160816; b=wF1IR6DA4TWRsprSJQMPGbDDjg/v56iB8yyRbkGC8OWcvuVUMknAl80y4DEhi7vAf2 2NbCpFayHD47n8P7frDEI6sLHFkaIXqgqapY9w49FWzkB1t8pfAAt3X2DfYARcB+NVDV ucvCTX4ULURXKbqSA+4Ewwra/1TPJha6PADO0RMJpScPda8aXAsH/WEhS25bdwov78dS 4gy7YmeKghe2pynOzIc488UQNWqKkAIeUZy3C7iX43qmaVr+OWnpzpt7gz5iNBq3JaIK kjTDCgWqKF5lf9AtL09DZ/Sd7EraqgDRVS8KVwyRVQ1ofgLn/LF0jVbmdU6drpGv0bl2 OhVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=p5Lw+4jChNndEjetsb1d1aMcOGAqFHMxBB+/5N3ESBM=; b=xtejzIrAp6y2MCa62xD37EEKgPVI6xhsroDZnCACAU9NI+CIWx6KjDJveLWkPU0woN pLTcIC0Vf1mFYCV+JCID2LhYk/TFyuKpzxKa5fo0hxPFFIHDNMr3aFQ/xPnixv11tfxl u0PAQPXzeugeWKh/pkOsBDnrH0l/7v3WhaeQl0J2xyCCyiy+1ciFW/YCQamGVf6r2QSu P8RoARkLVQRUAzozEWdJ0PGakZupAdzVwb2+B30BnvJa4ycvK26CMYYmAqLf0iQVjroX zgxZTrY9dr+pnhFdV5a6mu9+6lcdWDuVTfwb2Fc7LymZ92ss6/4YiPgcFwIMjp2T9blN BxWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=uQrwD7lG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y23-v6si1493859plr.8.2018.11.07.11.13.52; Wed, 07 Nov 2018 11:14:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=uQrwD7lG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729478AbeKHEo4 (ORCPT + 99 others); Wed, 7 Nov 2018 23:44:56 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:38441 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726453AbeKHEoz (ORCPT ); Wed, 7 Nov 2018 23:44:55 -0500 Received: by mail-wr1-f66.google.com with SMTP id d10-v6so18613296wrs.5 for ; Wed, 07 Nov 2018 11:13:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=p5Lw+4jChNndEjetsb1d1aMcOGAqFHMxBB+/5N3ESBM=; b=uQrwD7lGFHOoX2HWT9Y2R+0K/5iKTYGImuLTnA6brJgu6jgzvulW+eQhCVpQVC1Q13 gZh1nGIj5sndZDumu2ybDUEKAN6StmdvhLClDYHxvaYYioQ8ByjogNRVHNLBuE9HGxr7 RKzA106a0gBFFFbg+TgG1ekCGF9bVjCno0cmBmrfUELBR08oKZvBrfAl0OL14ItsDLoc k5QM4lwwH5PNoNFskrTJJJ8aPeP3+GR9SPP8UB/CMZjaXMM3RXXR6ye+fUZK9tjFe+4o nL+YmkJupfdShFPbTcPUpfisDuYgSHGj1GZjlGmb0XVJzqAyKR7D333GWP1huuIi6U37 i7LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=p5Lw+4jChNndEjetsb1d1aMcOGAqFHMxBB+/5N3ESBM=; b=owAgYRGgrnXf6UBSZYfN3lxr9099hw2gHEPh8G6z5pQuX+gjtYYLqTvRWXvV8e7Itt UjwWYlfcHW4NCvbYNCihvkS943fM/gKLXyjtSlzZwFJ9s9mMSrDHE0bp5xFSz3JcR+eT natgW1j9hFf10ImGFulxN3rhmYfeXVpeGz9y2EOn4YMCv5yzh+ENEWiCgNrFL3j3LkCa HGa5DEczGosy9+CeZ0eqxdS6m3k/IsVLvge8EEBtd01/w1Rz/4gATk8tQIYs1w8C2VXl R5S64mLdMmKg23X+UfSMzQiiAB4GV8xaSnqgBDe1z0NJSqqnUYRWnQ/6HLljgHM4ktHW HkWA== X-Gm-Message-State: AGRZ1gJTtOkvsetASgVzoHrml68ybg4mC0EKm7HwxKyeEEtC6vTNkrnp 0++aDcAcbwy21f/zShgChyC/pg== X-Received: by 2002:adf:c7d1:: with SMTP id y17-v6mr1377153wrg.230.1541617991609; Wed, 07 Nov 2018 11:13:11 -0800 (PST) Received: from Red ([2a01:cb1d:147:7200:2e56:dcff:fed2:c6d6]) by smtp.googlemail.com with ESMTPSA id e14-v6sm747167wrv.93.2018.11.07.11.13.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Nov 2018 11:13:10 -0800 (PST) Date: Wed, 7 Nov 2018 20:13:08 +0100 From: LABBE Corentin To: Eric Biggers Cc: davem@davemloft.net, herbert@gondor.apana.org.au, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/5] crypto: crypto_user_stat: split user space crypto stat structures Message-ID: <20181107191308.GD5133@Red> References: <1541422274-40060-1-git-send-email-clabbe@baylibre.com> <1541422274-40060-4-git-send-email-clabbe@baylibre.com> <20181106014419.GE28490@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181106014419.GE28490@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 05, 2018 at 05:44:19PM -0800, Eric Biggers wrote: > Hi Corentin, > > On Mon, Nov 05, 2018 at 12:51:12PM +0000, Corentin Labbe wrote: > > It is cleaner to have each stat in their own structures. > > > > Signed-off-by: Corentin Labbe > > --- > > crypto/crypto_user_stat.c | 20 +++---- > > include/uapi/linux/cryptouser.h | 101 ++++++++++++++++++++------------ > > 2 files changed, 73 insertions(+), 48 deletions(-) > > > > diff --git a/crypto/crypto_user_stat.c b/crypto/crypto_user_stat.c > > index 352569f378a0..3c14be2f7a1b 100644 > > --- a/crypto/crypto_user_stat.c > > +++ b/crypto/crypto_user_stat.c > > @@ -33,7 +33,7 @@ struct crypto_dump_info { > > > > static int crypto_report_aead(struct sk_buff *skb, struct crypto_alg *alg) > > { > > - struct crypto_stat raead; > > + struct crypto_stat_aead raead; > > u64 v64; > > > > memset(&raead, 0, sizeof(raead)); > > @@ -56,7 +56,7 @@ static int crypto_report_aead(struct sk_buff *skb, struct crypto_alg *alg) > > > > static int crypto_report_cipher(struct sk_buff *skb, struct crypto_alg *alg) > > { > > - struct crypto_stat rcipher; > > + struct crypto_stat_cipher rcipher; > > u64 v64; > > > > memset(&rcipher, 0, sizeof(rcipher)); > > @@ -79,7 +79,7 @@ static int crypto_report_cipher(struct sk_buff *skb, struct crypto_alg *alg) > > > > static int crypto_report_comp(struct sk_buff *skb, struct crypto_alg *alg) > > { > > - struct crypto_stat rcomp; > > + struct crypto_stat_compress rcomp; > > u64 v64; > > > > memset(&rcomp, 0, sizeof(rcomp)); > > @@ -101,7 +101,7 @@ static int crypto_report_comp(struct sk_buff *skb, struct crypto_alg *alg) > > > > static int crypto_report_acomp(struct sk_buff *skb, struct crypto_alg *alg) > > { > > - struct crypto_stat racomp; > > + struct crypto_stat_compress racomp; > > u64 v64; > > > > memset(&racomp, 0, sizeof(racomp)); > > @@ -123,7 +123,7 @@ static int crypto_report_acomp(struct sk_buff *skb, struct crypto_alg *alg) > > > > static int crypto_report_akcipher(struct sk_buff *skb, struct crypto_alg *alg) > > { > > - struct crypto_stat rakcipher; > > + struct crypto_stat_akcipher rakcipher; > > u64 v64; > > > > memset(&rakcipher, 0, sizeof(rakcipher)); > > @@ -150,7 +150,7 @@ static int crypto_report_akcipher(struct sk_buff *skb, struct crypto_alg *alg) > > > > static int crypto_report_kpp(struct sk_buff *skb, struct crypto_alg *alg) > > { > > - struct crypto_stat rkpp; > > + struct crypto_stat_kpp rkpp; > > u64 v; > > > > memset(&rkpp, 0, sizeof(rkpp)); > > @@ -171,7 +171,7 @@ static int crypto_report_kpp(struct sk_buff *skb, struct crypto_alg *alg) > > > > static int crypto_report_ahash(struct sk_buff *skb, struct crypto_alg *alg) > > { > > - struct crypto_stat rhash; > > + struct crypto_stat_hash rhash; > > u64 v64; > > > > memset(&rhash, 0, sizeof(rhash)); > > @@ -190,7 +190,7 @@ static int crypto_report_ahash(struct sk_buff *skb, struct crypto_alg *alg) > > > > static int crypto_report_shash(struct sk_buff *skb, struct crypto_alg *alg) > > { > > - struct crypto_stat rhash; > > + struct crypto_stat_hash rhash; > > u64 v64; > > > > memset(&rhash, 0, sizeof(rhash)); > > @@ -209,7 +209,7 @@ static int crypto_report_shash(struct sk_buff *skb, struct crypto_alg *alg) > > > > static int crypto_report_rng(struct sk_buff *skb, struct crypto_alg *alg) > > { > > - struct crypto_stat rrng; > > + struct crypto_stat_rng rrng; > > u64 v64; > > > > memset(&rrng, 0, sizeof(rrng)); > > @@ -248,7 +248,7 @@ static int crypto_reportstat_one(struct crypto_alg *alg, > > if (nla_put_u32(skb, CRYPTOCFGA_PRIORITY_VAL, alg->cra_priority)) > > goto nla_put_failure; > > if (alg->cra_flags & CRYPTO_ALG_LARVAL) { > > - struct crypto_stat rl; > > + struct crypto_stat_larval rl; > > > > memset(&rl, 0, sizeof(rl)); > > strscpy(rl.type, "larval", sizeof(rl.type)); > > diff --git a/include/uapi/linux/cryptouser.h b/include/uapi/linux/cryptouser.h > > index 9f8187077ce4..790b5c6511e5 100644 > > --- a/include/uapi/linux/cryptouser.h > > +++ b/include/uapi/linux/cryptouser.h > > @@ -76,47 +76,72 @@ struct crypto_user_alg { > > __u32 cru_flags; > > }; > > > > -struct crypto_stat { > > - char type[CRYPTO_MAX_NAME]; > > - union { > > - __u64 stat_encrypt_cnt; > > - __u64 stat_compress_cnt; > > - __u64 stat_generate_cnt; > > - __u64 stat_hash_cnt; > > - __u64 stat_setsecret_cnt; > > - }; > > - union { > > - __u64 stat_encrypt_tlen; > > - __u64 stat_compress_tlen; > > - __u64 stat_generate_tlen; > > - __u64 stat_hash_tlen; > > - }; > > - union { > > - __u64 stat_akcipher_err_cnt; > > - __u64 stat_cipher_err_cnt; > > - __u64 stat_compress_err_cnt; > > - __u64 stat_aead_err_cnt; > > - __u64 stat_hash_err_cnt; > > - __u64 stat_rng_err_cnt; > > - __u64 stat_kpp_err_cnt; > > - }; > > - union { > > - __u64 stat_decrypt_cnt; > > - __u64 stat_decompress_cnt; > > - __u64 stat_seed_cnt; > > - __u64 stat_generate_public_key_cnt; > > - }; > > - union { > > - __u64 stat_decrypt_tlen; > > - __u64 stat_decompress_tlen; > > - }; > > - union { > > - __u64 stat_verify_cnt; > > - __u64 stat_compute_shared_secret_cnt; > > - }; > > +struct crypto_stat_cipher { > > + char type[CRYPTO_MAX_NAME]; > > + __u64 stat_encrypt_cnt; > > + __u64 stat_encrypt_tlen; > > + __u64 stat_decrypt_cnt; > > + __u64 stat_decrypt_tlen; > > + __u64 stat_cipher_err_cnt; > > +}; > > + > > +struct crypto_stat_aead { > > + char type[CRYPTO_MAX_NAME]; > > + __u64 stat_encrypt_cnt; > > + __u64 stat_encrypt_tlen; > > + __u64 stat_decrypt_cnt; > > + __u64 stat_decrypt_tlen; > > + __u64 stat_cipher_err_cnt; > > + __u64 stat_aead_err_cnt; > > +}; > > + > > +struct crypto_stat_akcipher { > > + char type[CRYPTO_MAX_NAME]; > > + __u64 stat_encrypt_cnt; > > + __u64 stat_encrypt_tlen; > > + __u64 stat_decrypt_cnt; > > + __u64 stat_decrypt_tlen; > > + __u64 stat_akcipher_err_cnt; > > + __u64 stat_verify_cnt; > > __u64 stat_sign_cnt; > > }; > > > > +struct crypto_stat_compress { > > + char type[CRYPTO_MAX_NAME]; > > + __u64 stat_compress_cnt; > > + __u64 stat_compress_tlen; > > + __u64 stat_decompress_cnt; > > + __u64 stat_decompress_tlen; > > + __u64 stat_compress_err_cnt; > > +}; > > + > > +struct crypto_stat_rng { > > + char type[CRYPTO_MAX_NAME]; > > + __u64 stat_generate_cnt; > > + __u64 stat_generate_tlen; > > + __u64 stat_rng_err_cnt; > > + __u64 stat_seed_cnt; > > +}; > > + > > +struct crypto_stat_hash { > > + char type[CRYPTO_MAX_NAME]; > > + __u64 stat_hash_cnt; > > + __u64 stat_hash_tlen; > > + __u64 stat_hash_err_cnt; > > +}; > > + > > +struct crypto_stat_kpp { > > + char type[CRYPTO_MAX_NAME]; > > + __u64 stat_setsecret_cnt; > > + __u64 stat_kpp_err_cnt; > > + __u64 stat_generate_public_key_cnt; > > + __u64 stat_compute_shared_secret_cnt; > > +}; > > + > > +struct crypto_stat_larval { > > + char type[CRYPTO_MAX_NAME]; > > +}; > > + > > struct crypto_report_larval { > > char type[CRYPTO_MAX_NAME]; > > }; > > -- > > 2.18.1 > > > > Is there any particular reason this patch only changes the UAPI structures, > not the internal structures in 'struct crypto_alg'? > While changing it for user space will be clearly better, I didnt see any benefit for the internal ones. But perhaps it is cleaner to have the sames. I will do it. Regards