From: Joel Fernandes <joelf@ti.com>
To: Lokesh Vutla <lokeshvutla@ti.com>
Cc: Herbert Xu <herbert@gondor.hengli.com.au>,
"David S. Miller" <davem@davemloft.net>,
Mark Greer <mgreer@animalcreek.com>,
Tony Lindgren <tony@atomide.com>,
Santosh Shilimkar <santosh.shilimkar@ti.com>,
Rajendra Nayak <rnayak@ti.com>,
Linux OMAP List <linux-omap@vger.kernel.org>,
Linux ARM Kernel List <linux-arm-kernel@lists.infradead.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux Crypto Mailing List <linux-crypto@vger.kernel.org>
Subject: Re: [PATCH v2 04/14] crypto: omap-aes: Simplify DMA usage by using direct SGs
Date: Tue, 20 Aug 2013 19:54:42 -0500 [thread overview]
Message-ID: <52140FD2.7020403@ti.com> (raw)
In-Reply-To: <521367B4.2020203@ti.com>
On 08/20/2013 07:57 AM, Lokesh Vutla wrote:
> Hi Joel,
>
> On Sunday 18 August 2013 08:12 AM, Joel Fernandes wrote:
>> In early version of this driver, assumptions were made such as DMA layer
>> requires contiguous buffers etc. Due to this, new buffers were allocated,
>> mapped and used for DMA. These assumptions are no longer true and DMAEngine
>> scatter-gather DMA doesn't have such requirements. We simply the DMA operations
>> by directly using the scatter-gather buffers provided by the crypto layer
>> instead of creating our own.
>>
>> Lot of logic that handled DMA'ing only X number of bytes of the total, or as
>> much as fitted into a 3rd party buffer is removed and is no longer required.
>>
>> Also, good performance improvement of atleast ~20% seen with encrypting a
>> buffer size of 8K (1800 ops/sec vs 1400 ops/sec). Improvement will be higher
>> for much larger blocks though such benchmarking is left as an exercise for the
>> reader. Also DMA usage is much more simplified and coherent with rest of the
>> code.
>>
>> Signed-off-by: Joel Fernandes <joelf@ti.com>
>> ---
>> drivers/crypto/omap-aes.c | 147 ++++++++-------------------------------------
>> 1 file changed, 25 insertions(+), 122 deletions(-)
>>
>> diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c
>> index e369e6e..64dd5c1 100644
>> --- a/drivers/crypto/omap-aes.c
>> +++ b/drivers/crypto/omap-aes.c
>> @@ -480,22 +480,14 @@ static int sg_copy(struct scatterlist **sg, size_t *offset, void *buf,
>> }
>>
>> static int omap_aes_crypt_dma(struct crypto_tfm *tfm,
>> - struct scatterlist *in_sg, struct scatterlist *out_sg)
>> + struct scatterlist *in_sg, struct scatterlist *out_sg,
>> + int in_sg_len, int out_sg_len)
>> {
>> struct omap_aes_ctx *ctx = crypto_tfm_ctx(tfm);
>> struct omap_aes_dev *dd = ctx->dd;
>> struct dma_async_tx_descriptor *tx_in, *tx_out;
>> struct dma_slave_config cfg;
>> - dma_addr_t dma_addr_in = sg_dma_address(in_sg);
>> - int ret, length = sg_dma_len(in_sg);
>> -
>> - pr_debug("len: %d\n", length);
>> -
>> - dd->dma_size = length;
>> -
>> - if (!(dd->flags & FLAGS_FAST))
>> - dma_sync_single_for_device(dd->dev, dma_addr_in, length,
>> - DMA_TO_DEVICE);
>> + int ret;
> By this change FLAGS_FAST is unsed, it can be cleaned right?
> or Am I missing something?
Yes, FLAGS_FAST would be unused now and can go away. Since it is very trivial
change, I will make this change in the not-immediate future and submit.
Thanks,
-Joel
WARNING: multiple messages have this Message-ID (diff)
From: joelf@ti.com (Joel Fernandes)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 04/14] crypto: omap-aes: Simplify DMA usage by using direct SGs
Date: Tue, 20 Aug 2013 19:54:42 -0500 [thread overview]
Message-ID: <52140FD2.7020403@ti.com> (raw)
In-Reply-To: <521367B4.2020203@ti.com>
On 08/20/2013 07:57 AM, Lokesh Vutla wrote:
> Hi Joel,
>
> On Sunday 18 August 2013 08:12 AM, Joel Fernandes wrote:
>> In early version of this driver, assumptions were made such as DMA layer
>> requires contiguous buffers etc. Due to this, new buffers were allocated,
>> mapped and used for DMA. These assumptions are no longer true and DMAEngine
>> scatter-gather DMA doesn't have such requirements. We simply the DMA operations
>> by directly using the scatter-gather buffers provided by the crypto layer
>> instead of creating our own.
>>
>> Lot of logic that handled DMA'ing only X number of bytes of the total, or as
>> much as fitted into a 3rd party buffer is removed and is no longer required.
>>
>> Also, good performance improvement of atleast ~20% seen with encrypting a
>> buffer size of 8K (1800 ops/sec vs 1400 ops/sec). Improvement will be higher
>> for much larger blocks though such benchmarking is left as an exercise for the
>> reader. Also DMA usage is much more simplified and coherent with rest of the
>> code.
>>
>> Signed-off-by: Joel Fernandes <joelf@ti.com>
>> ---
>> drivers/crypto/omap-aes.c | 147 ++++++++-------------------------------------
>> 1 file changed, 25 insertions(+), 122 deletions(-)
>>
>> diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c
>> index e369e6e..64dd5c1 100644
>> --- a/drivers/crypto/omap-aes.c
>> +++ b/drivers/crypto/omap-aes.c
>> @@ -480,22 +480,14 @@ static int sg_copy(struct scatterlist **sg, size_t *offset, void *buf,
>> }
>>
>> static int omap_aes_crypt_dma(struct crypto_tfm *tfm,
>> - struct scatterlist *in_sg, struct scatterlist *out_sg)
>> + struct scatterlist *in_sg, struct scatterlist *out_sg,
>> + int in_sg_len, int out_sg_len)
>> {
>> struct omap_aes_ctx *ctx = crypto_tfm_ctx(tfm);
>> struct omap_aes_dev *dd = ctx->dd;
>> struct dma_async_tx_descriptor *tx_in, *tx_out;
>> struct dma_slave_config cfg;
>> - dma_addr_t dma_addr_in = sg_dma_address(in_sg);
>> - int ret, length = sg_dma_len(in_sg);
>> -
>> - pr_debug("len: %d\n", length);
>> -
>> - dd->dma_size = length;
>> -
>> - if (!(dd->flags & FLAGS_FAST))
>> - dma_sync_single_for_device(dd->dev, dma_addr_in, length,
>> - DMA_TO_DEVICE);
>> + int ret;
> By this change FLAGS_FAST is unsed, it can be cleaned right?
> or Am I missing something?
Yes, FLAGS_FAST would be unused now and can go away. Since it is very trivial
change, I will make this change in the not-immediate future and submit.
Thanks,
-Joel
next prev parent reply other threads:[~2013-08-21 0:55 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-18 2:42 [PATCH v2 00/14] crypto: omap-aes: Improve DMA, add PIO mode and support for AM437x Joel Fernandes
2013-08-18 2:42 ` Joel Fernandes
2013-08-18 2:42 ` [PATCH v2 01/14] crypto: scatterwalk: Add support for calculating number of SG elements Joel Fernandes
2013-08-18 2:42 ` Joel Fernandes
2013-08-18 2:42 ` [PATCH v2 02/14] crypto: omap-aes: Add useful debug macros Joel Fernandes
2013-08-18 2:42 ` Joel Fernandes
2013-08-18 4:22 ` Joe Perches
2013-08-18 4:22 ` Joe Perches
2013-08-18 5:56 ` Joel Fernandes
2013-08-18 5:56 ` Joel Fernandes
2013-08-18 2:42 ` [PATCH v2 03/14] crypto: omap-aes: Populate number of SG elements Joel Fernandes
2013-08-18 2:42 ` Joel Fernandes
2013-08-18 2:42 ` Joel Fernandes
2013-08-18 2:42 ` [PATCH v2 04/14] crypto: omap-aes: Simplify DMA usage by using direct SGs Joel Fernandes
2013-08-18 2:42 ` Joel Fernandes
2013-08-20 12:57 ` Lokesh Vutla
2013-08-20 12:57 ` Lokesh Vutla
2013-08-21 0:54 ` Joel Fernandes [this message]
2013-08-21 0:54 ` Joel Fernandes
2013-08-18 2:42 ` [PATCH v2 05/14] crypto: omap-aes: Sync SG before DMA operation Joel Fernandes
2013-08-18 2:42 ` Joel Fernandes
2013-08-18 2:42 ` [PATCH v2 06/14] crypto: omap-aes: Remove previously used intermediate buffers Joel Fernandes
2013-08-18 2:42 ` Joel Fernandes
2013-08-18 2:42 ` [PATCH v2 07/14] crypto: omap-aes: Add IRQ info and helper macros Joel Fernandes
2013-08-18 2:42 ` Joel Fernandes
2013-08-18 2:42 ` [PATCH v2 08/14] crypto: omap-aes: PIO mode: Add IRQ handler and walk SGs Joel Fernandes
2013-08-18 2:42 ` Joel Fernandes
2013-08-18 2:42 ` [PATCH v2 09/14] crypto: omap-aes: PIO mode: platform data for OMAP4/AM437x and trigger Joel Fernandes
2013-08-18 2:42 ` Joel Fernandes
2013-08-18 2:42 ` [PATCH v2 10/14] crypto: omap-aes: Switch to PIO mode during probe Joel Fernandes
2013-08-18 2:42 ` Joel Fernandes
2013-08-18 2:42 ` [PATCH v2 11/14] crypto: omap-aes: Add support for cases of unaligned lengths Joel Fernandes
2013-08-18 2:42 ` Joel Fernandes
2013-08-18 2:42 ` Joel Fernandes
2013-08-18 2:42 ` [PATCH v2 12/14] crypto: omap-aes: Convert kzalloc to devm_kzalloc Joel Fernandes
2013-08-18 2:42 ` Joel Fernandes
2013-08-18 2:42 ` [PATCH v2 13/14] crypto: omap-aes: Convert request_irq to devm_request_irq Joel Fernandes
2013-08-18 2:42 ` Joel Fernandes
2013-08-18 2:42 ` [PATCH v2 14/14] crypto: omap-aes: Kconfig: Add build support for AM437x Joel Fernandes
2013-08-18 2:42 ` Joel Fernandes
2013-08-18 2:42 ` Joel Fernandes
2013-08-21 11:50 ` [PATCH v2 00/14] crypto: omap-aes: Improve DMA, add PIO mode and " Herbert Xu
2013-08-21 11:50 ` Herbert Xu
2013-08-21 11:50 ` 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=52140FD2.7020403@ti.com \
--to=joelf@ti.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.hengli.com.au \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=lokeshvutla@ti.com \
--cc=mgreer@animalcreek.com \
--cc=rnayak@ti.com \
--cc=santosh.shilimkar@ti.com \
--cc=tony@atomide.com \
/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.