linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: boris.brezillon@free-electrons.com (Boris Brezillon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 05/14] crypto: marvell/CESA: add TDMA support
Date: Wed, 17 Jun 2015 09:15:03 +0200	[thread overview]
Message-ID: <20150617091503.5f74b6e5@bbrezillon> (raw)
In-Reply-To: <20150617055633.GA9123@gondor.apana.org.au>

On Wed, 17 Jun 2015 13:56:33 +0800
Herbert Xu <herbert@gondor.apana.org.au> wrote:

> On Wed, Jun 17, 2015 at 01:05:27PM +0800, Herbert Xu wrote:
> > On Tue, Jun 16, 2015 at 11:58:59AM +0200, Boris Brezillon wrote:
> > >
> > > +	ret = dma_map_sg(cesa_dev->dev, req->src, creq->src_nents,
> > > +			 DMA_TO_DEVICE);
> > > +	if (ret != creq->src_nents)
> > > +		return -ENOMEM;
> > 
> > Hmm it doesn't quite work like that.  It returns zero on error,
> > otherwise it returns the number (n) of mapped entries which may be
> > less than what you gave it due to merging.  You're then supposed
> > to use only the first n entries which should contain everything.
> 
> Please take a look at Documentation/DMA-API-HOWTO.txt, it has
> everything you need to know about the dma_map_sg interface.

Yep, I read it, but apparently not carefully enough ;-).
I'll fix that.

Note that I did not ignore your previous comment on purpose (checking
for !ret to verify if the sg entries were successfully mapped), but I
have a specific case in the hash code where the requested len is 0
(final request) and thus the src_nents is 0 too. Which means I'm
expecting the dma_sg_map to return 0.

Anyway, now I'm doing the following test:

if (creq->src_nents && !ret)
	return -ENOMEM;

Best Regards,

Boris

-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  reply	other threads:[~2015-06-17  7:15 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-16  9:58 [PATCH v5 00/14] crypto: add a new driver for Marvell's CESA Boris Brezillon
2015-06-16  9:58 ` [PATCH v5 01/14] crypto: mv_cesa: document the clocks property Boris Brezillon
2015-06-16  9:58 ` [PATCH v5 02/14] crypto: mv_cesa: use gen_pool to reserve the SRAM memory region Boris Brezillon
2015-06-16  9:58 ` [PATCH v5 03/14] crypto: mv_cesa: explicitly define kirkwood and dove compatible strings Boris Brezillon
2015-06-16  9:58 ` [PATCH v5 04/14] crypto: add a new driver for Marvell's CESA Boris Brezillon
2015-06-17  5:58   ` Herbert Xu
2015-06-17  7:15     ` Boris Brezillon
2015-06-16  9:58 ` [PATCH v5 05/14] crypto: marvell/CESA: add TDMA support Boris Brezillon
2015-06-17  5:05   ` Herbert Xu
2015-06-17  5:56     ` Herbert Xu
2015-06-17  7:15       ` Boris Brezillon [this message]
2015-06-17  7:18         ` Herbert Xu
2015-06-17  7:37           ` Boris Brezillon
2015-06-16  9:59 ` [PATCH v5 06/14] crypto: marvell/CESA: add DES support Boris Brezillon
2015-06-17 18:07   ` Sandy Harris
2015-06-16  9:59 ` [PATCH v5 07/14] crypto: marvell/CESA: add Triple-DES support Boris Brezillon
2015-06-16  9:59 ` [PATCH v5 08/14] crypto: marvell/CESA: add MD5 support Boris Brezillon
2015-06-16  9:59 ` [PATCH v5 09/14] crypto: marvell/CESA: add SHA256 support Boris Brezillon
2015-06-16  9:59 ` [PATCH v5 10/14] crypto: marvell/CESA: add support for all armada SoCs Boris Brezillon
2015-06-16  9:59 ` [PATCH v5 11/14] crypto: marvell/CESA: add allhwsupport module parameter Boris Brezillon
2015-06-16  9:59 ` [PATCH v5 12/14] crypto: marvell/CESA: add support for Orion SoCs Boris Brezillon
2015-06-16  9:59 ` [PATCH v5 13/14] crypto: marvell/CESA: add support for Kirkwood and Dove SoCs Boris Brezillon
2015-06-16  9:59 ` [PATCH v5 14/14] crypto: marvell/CESA: add DT bindings documentation Boris Brezillon

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=20150617091503.5f74b6e5@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=linux-arm-kernel@lists.infradead.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).