From: James Hsiao <jhsiao@amcc.com>
To: Kim Phillips <kim.phillips@freescale.com>
Cc: linuxppc-dev@ozlabs.org, herbert@gondor.apana.org.au,
linux-crypto@vger.kernel.org
Subject: Re: [PATCH] AMCC Crypto4xx Device Driver v4]
Date: Fri, 05 Dec 2008 15:24:11 -0800 [thread overview]
Message-ID: <1228519451.5444.59.camel@jhsiao-usb> (raw)
In-Reply-To: <20081204193256.12dbc306.kim.phillips@freescale.com>
Hi Kim,
I try to address some of the comments. I am not mentioning things that I
agree with you.
> + */
> +static int get_sg_count(struct scatterlist *sg_list, int nbytes)
> +{
> + struct scatterlist *sg = sg_list;
> + int sg_nents = 0;
> +
> + while (nbytes) {
> + sg_nents++;
> + if (sg->length > nbytes)
> + break;
this is slightly different - this condition shouldn't need checking
here - see [1] below..
> + nbytes -= sg->length;
> + sg = sg_next(sg);
> + }
> +
> + return sg_nents;
> +}
Without the check, nbytes could become negative. The aead test case
with .np will crash(ie. gcm tests), those test have sg->length >
nbytes.
About aad_len, we didn't release code that use aad yet. We did test this
function with aad_len none zero(the gcm tests).
About the irq_disable or spin_lock.
The driver could be used by a kernel thread and esp4 at same time. As I
know process is preemptable. When the driver is used by a process it is
possible to be preempted. The hardware require scatter/gather descriptor
to be consecutive. So, if the process get a gather descriptor and then
it is preempted by another process or esp4 which get a gather descriptor
and return to the original process, the origianl process could get a non
consecutive gather descriptor.
So, if spin_lock is recommended then I have to use spin_lock_irq_save,
which use irq_disable too. Do you think that is acceptable?
Thanks and regards
James
next prev parent reply other threads:[~2008-12-05 23:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-02 22:17 [PATCH] AMCC Crypto4xx Device Driver v4] James Hsiao
2008-12-05 1:32 ` Kim Phillips
2008-12-05 5:41 ` Stefan Roese
2008-12-08 18:12 ` Kim Phillips
2008-12-05 23:24 ` James Hsiao [this message]
2008-12-08 18:09 ` Kim Phillips
2008-12-08 21:55 ` James Hsiao
2008-12-09 0:35 ` Kim Phillips
2008-12-09 0:56 ` James Hsiao
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=1228519451.5444.59.camel@jhsiao-usb \
--to=jhsiao@amcc.com \
--cc=herbert@gondor.apana.org.au \
--cc=kim.phillips@freescale.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.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).