From: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: linux-crypto@vger.kernel.org
Subject: Re: [PATCH v2 0/2] crypto: asynchronous compression api
Date: Wed, 24 Feb 2016 17:47:22 +0000 [thread overview]
Message-ID: <20160224174722.GA2857@sivswdev01.ir.intel.com> (raw)
In-Reply-To: <20160216195717.GA4207@gondor.apana.org.au>
Hi Herbert,
On Tue, Feb 16, 2016 at 07:57:17PM +0000, Herbert Xu wrote:
> Can you give an example on how to use the noctx support with
> your acomp interface?
In this version of the acomp api an algorithm can specify different sizes for
the compression and the decompression contexts by setting the comp_reqsize and
the decomp_reqsize fields in the acomp_alg structure.
The api also provides two new function calls to allocate the request:
struct acomp_req *acomp_compression_request_alloc(
struct crypto_acomp *acomp, gfp_t gfp)
struct acomp_req *acomp_decompression_request_alloc(
struct crypto_acomp *acomp, gfp_t gfp)
The implementation of these calls use comp_reqsize and decomp_reqsize to
allocate the context and therefore, if an algorithm supports it, it is possible
to have requests with no context.
Here is a simple example that shows how to use the api from a user prospective:
struct crypto_acomp *tfm;
struct acomp_req *req = NULL;
struct scatterlist src;
struct scatterlist dst;
tfm = crypto_alloc_acomp("deflate", 0, 0);
req = acomp_compression_request_alloc(tfm, GFP_KERNEL);
/* Prepare src and dst sgls */
acomp_request_set_params(req, &src, &dst, slen, dlen);
acomp_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, cb_func,
cb_data);
ret = crypto_acomp_compress(req);
Regarding the SCOMP backends, when an algorithm registers as
CRYPTO_ALG_TYPE_SCOMPRESS, requests allocated with both
acomp_compression_request_alloc and acomp_decompression_request_alloc have
the same size (sizeof (struct acomp_req) + sizeof(void *)).
The request context stores a pointer to the scomp context allocated
using crypto_scomp_alloc_ctx().
If the algorithm specifies the CRYPTO_SCOMP_DECOMP_NOCTX flag,
acomp_decompression_request_alloc does not call crypto_scomp_alloc_ctx() and
stores NULL into the request context.
This way the scomp context is not allocated and decompression requests are
called without context. See patch v3.
Regards,
--
Giovanni
next prev parent reply other threads:[~2016-02-24 17:47 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-08 16:10 [PATCH 0/2] crypto: asynchronous compression api Giovanni Cabiddu
2016-02-08 16:10 ` [PATCH 1/2] crypto: add " Giovanni Cabiddu
2016-02-09 10:53 ` Herbert Xu
2016-02-09 17:31 ` [PATCH v2 0/2] crypto: " Giovanni Cabiddu
2016-02-09 17:31 ` [PATCH v2 1/2] crypto: add " Giovanni Cabiddu
2016-02-09 17:31 ` [PATCH v2 2/2] crypto: extended acomp api for supporting deflate algorithm parameters Giovanni Cabiddu
2016-02-16 19:57 ` [PATCH v2 0/2] crypto: asynchronous compression api Herbert Xu
2016-02-24 17:47 ` Giovanni Cabiddu [this message]
2016-02-24 17:51 ` [PATCH v3 0/8] " Giovanni Cabiddu
2016-02-24 17:51 ` [PATCH v3 1/8] crypto: add " Giovanni Cabiddu
2016-02-24 17:51 ` [PATCH v3 2/8] crypto: add driver-side scomp interface Giovanni Cabiddu
2016-03-17 11:00 ` Herbert Xu
2016-03-18 14:02 ` Giovanni Cabiddu
2016-03-23 10:18 ` Herbert Xu
2016-02-24 17:51 ` [PATCH v3 3/8] crypto: acomp - add support for lzo via scomp Giovanni Cabiddu
2016-02-24 17:51 ` [PATCH v3 4/8] crypto: acomp - add support for lz4 " Giovanni Cabiddu
2016-02-24 17:51 ` [PATCH v3 5/8] crypto: acomp - add support for lz4hc " Giovanni Cabiddu
2016-02-24 17:51 ` [PATCH v3 6/8] crypto: acomp - add support for 842 " Giovanni Cabiddu
2016-02-24 17:51 ` [PATCH v3 7/8] crypto: acomp - add support for deflate " Giovanni Cabiddu
2016-02-24 17:51 ` [PATCH v3 8/8] crypto: acomp - update testmgr with support for acomp Giovanni Cabiddu
2016-02-08 16:10 ` [PATCH 2/2] crypto: extended acomp api for supporting deflate algorithm parameters Giovanni Cabiddu
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=20160224174722.GA2857@sivswdev01.ir.intel.com \
--to=giovanni.cabiddu@intel.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).