All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Corentin Labbe <clabbe.montjoie@gmail.com>
Cc: herbert@gondor.apana.org.au, corbet@lwn.net,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	fabien.dessenne@st.com,
	virtualization@lists.linux-foundation.org,
	linux-sunxi@googlegroups.com, linux-crypto@vger.kernel.org,
	mcoquelin.stm32@gmail.com, davem@davemloft.net,
	linux-arm-kernel@lists.infradead.org, alexandre.torgue@st.com
Subject: Re: [PATCH v2 4/6] crypto: virtio: convert to new crypto engine API
Date: Wed, 14 Feb 2018 17:51:59 +0200	[thread overview]
Message-ID: <20180214175137-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20180126191534.17569-5-clabbe.montjoie@gmail.com>

On Fri, Jan 26, 2018 at 08:15:32PM +0100, Corentin Labbe wrote:
> This patch convert the driver to the new crypto engine API.
> 
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>

Acked-by: Michael S. Tsirkin <mst@redhat.com>

Pls queue when/if rest of changes go in.

> ---
>  drivers/crypto/virtio/virtio_crypto_algs.c   | 16 ++++++++++------
>  drivers/crypto/virtio/virtio_crypto_common.h |  3 +--
>  drivers/crypto/virtio/virtio_crypto_core.c   |  3 ---
>  3 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/crypto/virtio/virtio_crypto_algs.c b/drivers/crypto/virtio/virtio_crypto_algs.c
> index abe8c15450df..ba190cfa7aa1 100644
> --- a/drivers/crypto/virtio/virtio_crypto_algs.c
> +++ b/drivers/crypto/virtio/virtio_crypto_algs.c
> @@ -29,6 +29,7 @@
>  
>  
>  struct virtio_crypto_ablkcipher_ctx {
> +	struct crypto_engine_ctx enginectx;
>  	struct virtio_crypto *vcrypto;
>  	struct crypto_tfm *tfm;
>  
> @@ -491,7 +492,7 @@ static int virtio_crypto_ablkcipher_encrypt(struct ablkcipher_request *req)
>  	vc_sym_req->ablkcipher_req = req;
>  	vc_sym_req->encrypt = true;
>  
> -	return crypto_transfer_cipher_request_to_engine(data_vq->engine, req);
> +	return crypto_transfer_ablkcipher_request_to_engine(data_vq->engine, req);
>  }
>  
>  static int virtio_crypto_ablkcipher_decrypt(struct ablkcipher_request *req)
> @@ -511,7 +512,7 @@ static int virtio_crypto_ablkcipher_decrypt(struct ablkcipher_request *req)
>  	vc_sym_req->ablkcipher_req = req;
>  	vc_sym_req->encrypt = false;
>  
> -	return crypto_transfer_cipher_request_to_engine(data_vq->engine, req);
> +	return crypto_transfer_ablkcipher_request_to_engine(data_vq->engine, req);
>  }
>  
>  static int virtio_crypto_ablkcipher_init(struct crypto_tfm *tfm)
> @@ -521,6 +522,9 @@ static int virtio_crypto_ablkcipher_init(struct crypto_tfm *tfm)
>  	tfm->crt_ablkcipher.reqsize = sizeof(struct virtio_crypto_sym_request);
>  	ctx->tfm = tfm;
>  
> +	ctx->enginectx.op.do_one_request = virtio_crypto_ablkcipher_crypt_req;
> +	ctx->enginectx.op.prepare_request = NULL;
> +	ctx->enginectx.op.unprepare_request = NULL;
>  	return 0;
>  }
>  
> @@ -538,9 +542,9 @@ static void virtio_crypto_ablkcipher_exit(struct crypto_tfm *tfm)
>  }
>  
>  int virtio_crypto_ablkcipher_crypt_req(
> -	struct crypto_engine *engine,
> -	struct ablkcipher_request *req)
> +	struct crypto_engine *engine, void *vreq)
>  {
> +	struct ablkcipher_request *req = container_of(vreq, struct ablkcipher_request, base);
>  	struct virtio_crypto_sym_request *vc_sym_req =
>  				ablkcipher_request_ctx(req);
>  	struct virtio_crypto_request *vc_req = &vc_sym_req->base;
> @@ -561,8 +565,8 @@ static void virtio_crypto_ablkcipher_finalize_req(
>  	struct ablkcipher_request *req,
>  	int err)
>  {
> -	crypto_finalize_cipher_request(vc_sym_req->base.dataq->engine,
> -					req, err);
> +	crypto_finalize_ablkcipher_request(vc_sym_req->base.dataq->engine,
> +					   req, err);
>  	kzfree(vc_sym_req->iv);
>  	virtcrypto_clear_request(&vc_sym_req->base);
>  }
> diff --git a/drivers/crypto/virtio/virtio_crypto_common.h b/drivers/crypto/virtio/virtio_crypto_common.h
> index e976539a05d9..72621bd67211 100644
> --- a/drivers/crypto/virtio/virtio_crypto_common.h
> +++ b/drivers/crypto/virtio/virtio_crypto_common.h
> @@ -107,8 +107,7 @@ struct virtio_crypto *virtcrypto_get_dev_node(int node);
>  int virtcrypto_dev_start(struct virtio_crypto *vcrypto);
>  void virtcrypto_dev_stop(struct virtio_crypto *vcrypto);
>  int virtio_crypto_ablkcipher_crypt_req(
> -	struct crypto_engine *engine,
> -	struct ablkcipher_request *req);
> +	struct crypto_engine *engine, void *vreq);
>  
>  void
>  virtcrypto_clear_request(struct virtio_crypto_request *vc_req);
> diff --git a/drivers/crypto/virtio/virtio_crypto_core.c b/drivers/crypto/virtio/virtio_crypto_core.c
> index ff1410a32c2b..83326986c113 100644
> --- a/drivers/crypto/virtio/virtio_crypto_core.c
> +++ b/drivers/crypto/virtio/virtio_crypto_core.c
> @@ -111,9 +111,6 @@ static int virtcrypto_find_vqs(struct virtio_crypto *vi)
>  			ret = -ENOMEM;
>  			goto err_engine;
>  		}
> -
> -		vi->data_vq[i].engine->cipher_one_request =
> -			virtio_crypto_ablkcipher_crypt_req;
>  	}
>  
>  	kfree(names);
> -- 
> 2.13.6

WARNING: multiple messages have this Message-ID (diff)
From: mst@redhat.com (Michael S. Tsirkin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 4/6] crypto: virtio: convert to new crypto engine API
Date: Wed, 14 Feb 2018 17:51:59 +0200	[thread overview]
Message-ID: <20180214175137-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20180126191534.17569-5-clabbe.montjoie@gmail.com>

On Fri, Jan 26, 2018 at 08:15:32PM +0100, Corentin Labbe wrote:
> This patch convert the driver to the new crypto engine API.
> 
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>

Acked-by: Michael S. Tsirkin <mst@redhat.com>

Pls queue when/if rest of changes go in.

> ---
>  drivers/crypto/virtio/virtio_crypto_algs.c   | 16 ++++++++++------
>  drivers/crypto/virtio/virtio_crypto_common.h |  3 +--
>  drivers/crypto/virtio/virtio_crypto_core.c   |  3 ---
>  3 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/crypto/virtio/virtio_crypto_algs.c b/drivers/crypto/virtio/virtio_crypto_algs.c
> index abe8c15450df..ba190cfa7aa1 100644
> --- a/drivers/crypto/virtio/virtio_crypto_algs.c
> +++ b/drivers/crypto/virtio/virtio_crypto_algs.c
> @@ -29,6 +29,7 @@
>  
>  
>  struct virtio_crypto_ablkcipher_ctx {
> +	struct crypto_engine_ctx enginectx;
>  	struct virtio_crypto *vcrypto;
>  	struct crypto_tfm *tfm;
>  
> @@ -491,7 +492,7 @@ static int virtio_crypto_ablkcipher_encrypt(struct ablkcipher_request *req)
>  	vc_sym_req->ablkcipher_req = req;
>  	vc_sym_req->encrypt = true;
>  
> -	return crypto_transfer_cipher_request_to_engine(data_vq->engine, req);
> +	return crypto_transfer_ablkcipher_request_to_engine(data_vq->engine, req);
>  }
>  
>  static int virtio_crypto_ablkcipher_decrypt(struct ablkcipher_request *req)
> @@ -511,7 +512,7 @@ static int virtio_crypto_ablkcipher_decrypt(struct ablkcipher_request *req)
>  	vc_sym_req->ablkcipher_req = req;
>  	vc_sym_req->encrypt = false;
>  
> -	return crypto_transfer_cipher_request_to_engine(data_vq->engine, req);
> +	return crypto_transfer_ablkcipher_request_to_engine(data_vq->engine, req);
>  }
>  
>  static int virtio_crypto_ablkcipher_init(struct crypto_tfm *tfm)
> @@ -521,6 +522,9 @@ static int virtio_crypto_ablkcipher_init(struct crypto_tfm *tfm)
>  	tfm->crt_ablkcipher.reqsize = sizeof(struct virtio_crypto_sym_request);
>  	ctx->tfm = tfm;
>  
> +	ctx->enginectx.op.do_one_request = virtio_crypto_ablkcipher_crypt_req;
> +	ctx->enginectx.op.prepare_request = NULL;
> +	ctx->enginectx.op.unprepare_request = NULL;
>  	return 0;
>  }
>  
> @@ -538,9 +542,9 @@ static void virtio_crypto_ablkcipher_exit(struct crypto_tfm *tfm)
>  }
>  
>  int virtio_crypto_ablkcipher_crypt_req(
> -	struct crypto_engine *engine,
> -	struct ablkcipher_request *req)
> +	struct crypto_engine *engine, void *vreq)
>  {
> +	struct ablkcipher_request *req = container_of(vreq, struct ablkcipher_request, base);
>  	struct virtio_crypto_sym_request *vc_sym_req =
>  				ablkcipher_request_ctx(req);
>  	struct virtio_crypto_request *vc_req = &vc_sym_req->base;
> @@ -561,8 +565,8 @@ static void virtio_crypto_ablkcipher_finalize_req(
>  	struct ablkcipher_request *req,
>  	int err)
>  {
> -	crypto_finalize_cipher_request(vc_sym_req->base.dataq->engine,
> -					req, err);
> +	crypto_finalize_ablkcipher_request(vc_sym_req->base.dataq->engine,
> +					   req, err);
>  	kzfree(vc_sym_req->iv);
>  	virtcrypto_clear_request(&vc_sym_req->base);
>  }
> diff --git a/drivers/crypto/virtio/virtio_crypto_common.h b/drivers/crypto/virtio/virtio_crypto_common.h
> index e976539a05d9..72621bd67211 100644
> --- a/drivers/crypto/virtio/virtio_crypto_common.h
> +++ b/drivers/crypto/virtio/virtio_crypto_common.h
> @@ -107,8 +107,7 @@ struct virtio_crypto *virtcrypto_get_dev_node(int node);
>  int virtcrypto_dev_start(struct virtio_crypto *vcrypto);
>  void virtcrypto_dev_stop(struct virtio_crypto *vcrypto);
>  int virtio_crypto_ablkcipher_crypt_req(
> -	struct crypto_engine *engine,
> -	struct ablkcipher_request *req);
> +	struct crypto_engine *engine, void *vreq);
>  
>  void
>  virtcrypto_clear_request(struct virtio_crypto_request *vc_req);
> diff --git a/drivers/crypto/virtio/virtio_crypto_core.c b/drivers/crypto/virtio/virtio_crypto_core.c
> index ff1410a32c2b..83326986c113 100644
> --- a/drivers/crypto/virtio/virtio_crypto_core.c
> +++ b/drivers/crypto/virtio/virtio_crypto_core.c
> @@ -111,9 +111,6 @@ static int virtcrypto_find_vqs(struct virtio_crypto *vi)
>  			ret = -ENOMEM;
>  			goto err_engine;
>  		}
> -
> -		vi->data_vq[i].engine->cipher_one_request =
> -			virtio_crypto_ablkcipher_crypt_req;
>  	}
>  
>  	kfree(names);
> -- 
> 2.13.6

WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Corentin Labbe <clabbe.montjoie@gmail.com>
Cc: alexandre.torgue@st.com, arei.gonglei@huawei.com, corbet@lwn.net,
	davem@davemloft.net, herbert@gondor.apana.org.au,
	jasowang@redhat.com, mcoquelin.stm32@gmail.com,
	fabien.dessenne@st.com, linux-arm-kernel@lists.infradead.org,
	linux-crypto@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	linux-sunxi@googlegroups.com
Subject: Re: [PATCH v2 4/6] crypto: virtio: convert to new crypto engine API
Date: Wed, 14 Feb 2018 17:51:59 +0200	[thread overview]
Message-ID: <20180214175137-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20180126191534.17569-5-clabbe.montjoie@gmail.com>

On Fri, Jan 26, 2018 at 08:15:32PM +0100, Corentin Labbe wrote:
> This patch convert the driver to the new crypto engine API.
> 
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>

Acked-by: Michael S. Tsirkin <mst@redhat.com>

Pls queue when/if rest of changes go in.

> ---
>  drivers/crypto/virtio/virtio_crypto_algs.c   | 16 ++++++++++------
>  drivers/crypto/virtio/virtio_crypto_common.h |  3 +--
>  drivers/crypto/virtio/virtio_crypto_core.c   |  3 ---
>  3 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/crypto/virtio/virtio_crypto_algs.c b/drivers/crypto/virtio/virtio_crypto_algs.c
> index abe8c15450df..ba190cfa7aa1 100644
> --- a/drivers/crypto/virtio/virtio_crypto_algs.c
> +++ b/drivers/crypto/virtio/virtio_crypto_algs.c
> @@ -29,6 +29,7 @@
>  
>  
>  struct virtio_crypto_ablkcipher_ctx {
> +	struct crypto_engine_ctx enginectx;
>  	struct virtio_crypto *vcrypto;
>  	struct crypto_tfm *tfm;
>  
> @@ -491,7 +492,7 @@ static int virtio_crypto_ablkcipher_encrypt(struct ablkcipher_request *req)
>  	vc_sym_req->ablkcipher_req = req;
>  	vc_sym_req->encrypt = true;
>  
> -	return crypto_transfer_cipher_request_to_engine(data_vq->engine, req);
> +	return crypto_transfer_ablkcipher_request_to_engine(data_vq->engine, req);
>  }
>  
>  static int virtio_crypto_ablkcipher_decrypt(struct ablkcipher_request *req)
> @@ -511,7 +512,7 @@ static int virtio_crypto_ablkcipher_decrypt(struct ablkcipher_request *req)
>  	vc_sym_req->ablkcipher_req = req;
>  	vc_sym_req->encrypt = false;
>  
> -	return crypto_transfer_cipher_request_to_engine(data_vq->engine, req);
> +	return crypto_transfer_ablkcipher_request_to_engine(data_vq->engine, req);
>  }
>  
>  static int virtio_crypto_ablkcipher_init(struct crypto_tfm *tfm)
> @@ -521,6 +522,9 @@ static int virtio_crypto_ablkcipher_init(struct crypto_tfm *tfm)
>  	tfm->crt_ablkcipher.reqsize = sizeof(struct virtio_crypto_sym_request);
>  	ctx->tfm = tfm;
>  
> +	ctx->enginectx.op.do_one_request = virtio_crypto_ablkcipher_crypt_req;
> +	ctx->enginectx.op.prepare_request = NULL;
> +	ctx->enginectx.op.unprepare_request = NULL;
>  	return 0;
>  }
>  
> @@ -538,9 +542,9 @@ static void virtio_crypto_ablkcipher_exit(struct crypto_tfm *tfm)
>  }
>  
>  int virtio_crypto_ablkcipher_crypt_req(
> -	struct crypto_engine *engine,
> -	struct ablkcipher_request *req)
> +	struct crypto_engine *engine, void *vreq)
>  {
> +	struct ablkcipher_request *req = container_of(vreq, struct ablkcipher_request, base);
>  	struct virtio_crypto_sym_request *vc_sym_req =
>  				ablkcipher_request_ctx(req);
>  	struct virtio_crypto_request *vc_req = &vc_sym_req->base;
> @@ -561,8 +565,8 @@ static void virtio_crypto_ablkcipher_finalize_req(
>  	struct ablkcipher_request *req,
>  	int err)
>  {
> -	crypto_finalize_cipher_request(vc_sym_req->base.dataq->engine,
> -					req, err);
> +	crypto_finalize_ablkcipher_request(vc_sym_req->base.dataq->engine,
> +					   req, err);
>  	kzfree(vc_sym_req->iv);
>  	virtcrypto_clear_request(&vc_sym_req->base);
>  }
> diff --git a/drivers/crypto/virtio/virtio_crypto_common.h b/drivers/crypto/virtio/virtio_crypto_common.h
> index e976539a05d9..72621bd67211 100644
> --- a/drivers/crypto/virtio/virtio_crypto_common.h
> +++ b/drivers/crypto/virtio/virtio_crypto_common.h
> @@ -107,8 +107,7 @@ struct virtio_crypto *virtcrypto_get_dev_node(int node);
>  int virtcrypto_dev_start(struct virtio_crypto *vcrypto);
>  void virtcrypto_dev_stop(struct virtio_crypto *vcrypto);
>  int virtio_crypto_ablkcipher_crypt_req(
> -	struct crypto_engine *engine,
> -	struct ablkcipher_request *req);
> +	struct crypto_engine *engine, void *vreq);
>  
>  void
>  virtcrypto_clear_request(struct virtio_crypto_request *vc_req);
> diff --git a/drivers/crypto/virtio/virtio_crypto_core.c b/drivers/crypto/virtio/virtio_crypto_core.c
> index ff1410a32c2b..83326986c113 100644
> --- a/drivers/crypto/virtio/virtio_crypto_core.c
> +++ b/drivers/crypto/virtio/virtio_crypto_core.c
> @@ -111,9 +111,6 @@ static int virtcrypto_find_vqs(struct virtio_crypto *vi)
>  			ret = -ENOMEM;
>  			goto err_engine;
>  		}
> -
> -		vi->data_vq[i].engine->cipher_one_request =
> -			virtio_crypto_ablkcipher_crypt_req;
>  	}
>  
>  	kfree(names);
> -- 
> 2.13.6

  reply	other threads:[~2018-02-14 15:51 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-26 19:15 [PATCH v2 0/6] crypto: engine - Permit to enqueue all async requests Corentin Labbe
2018-01-26 19:15 ` Corentin Labbe
2018-01-26 19:15 ` Corentin Labbe
2018-01-26 19:15 ` [PATCH v2 1/6] Documentation: crypto: document crypto engine API Corentin Labbe
2018-01-26 19:15 ` [PATCH v2 2/6] crypto: engine - Permit to enqueue all async requests Corentin Labbe
2018-01-26 19:15 ` [PATCH v2 3/6] crypto: omap: convert to new crypto engine API Corentin Labbe
     [not found] ` <20180126191534.17569-1-clabbe.montjoie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-01-26 19:15   ` [PATCH v2 1/6] Documentation: crypto: document " Corentin Labbe
2018-01-26 19:15     ` Corentin Labbe
2018-01-26 19:15     ` Corentin Labbe
2018-01-26 19:15   ` [PATCH v2 2/6] crypto: engine - Permit to enqueue all async requests Corentin Labbe
2018-01-26 19:15     ` Corentin Labbe
2018-01-26 19:15     ` Corentin Labbe
2018-02-14 13:31     ` Fabien DESSENNE
2018-02-14 13:31       ` Fabien DESSENNE
2018-02-14 13:31       ` Fabien DESSENNE
2018-02-14 13:31     ` Fabien DESSENNE
2018-01-26 19:15   ` [PATCH v2 3/6] crypto: omap: convert to new crypto engine API Corentin Labbe
2018-01-26 19:15     ` Corentin Labbe
2018-01-26 19:15     ` Corentin Labbe
2018-01-26 19:15   ` [PATCH v2 4/6] crypto: virtio: " Corentin Labbe
2018-01-26 19:15     ` Corentin Labbe
2018-01-26 19:15     ` Corentin Labbe
2018-02-14 15:51     ` Michael S. Tsirkin [this message]
2018-02-14 15:51       ` Michael S. Tsirkin
2018-02-14 15:51       ` Michael S. Tsirkin
2018-01-26 19:15   ` [PATCH v2 5/6] crypto: stm32-hash: convert to the " Corentin Labbe
2018-01-26 19:15     ` Corentin Labbe
2018-01-26 19:15     ` Corentin Labbe
2018-02-15 15:51   ` [PATCH v2 0/6] crypto: engine - Permit to enqueue all async requests Herbert Xu
2018-02-15 15:51     ` Herbert Xu
2018-02-15 15:51     ` Herbert Xu
2018-02-16 15:36     ` Corentin Labbe
     [not found]     ` <20180215155100.GJ7352-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
2018-02-16 15:36       ` Corentin Labbe
2018-02-16 15:36         ` Corentin Labbe
2018-02-16 15:36         ` Corentin Labbe
2018-02-17  4:42         ` Herbert Xu
2018-02-17  4:42           ` Herbert Xu
2018-02-17  4:42         ` Herbert Xu
2018-01-26 19:15 ` [PATCH v2 4/6] crypto: virtio: convert to new crypto engine API Corentin Labbe
2018-01-26 19:15 ` [PATCH v2 5/6] crypto: stm32-hash: convert to the " Corentin Labbe
2018-01-26 19:15 ` [PATCH v2 6/6] crypto: stm32-cryp: " Corentin Labbe
2018-01-26 19:15 ` Corentin Labbe
2018-01-26 19:15   ` Corentin Labbe
2018-02-15 15:51 ` [PATCH v2 0/6] crypto: engine - Permit to enqueue all async requests Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180214175137-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=alexandre.torgue@st.com \
    --cc=clabbe.montjoie@gmail.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=fabien.dessenne@st.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.