Re: [Ocf-linux-users] crypto_dispatch update for 20080917
Brought to you by:
david-m
|
From: David M. <Dav...@se...> - 2009-04-29 23:03:33
|
Jivin Kennedy, Brendan lays it down ...
> Hi All,
>
> I am having trouble understanding the update to the crypto_dispatch function in crypto.c for ocf-linux-20080917 from ocf-linux-2071215:
>
> 2007 code:
> if (!cap->cc_qblocked) {
> result = crypto_invoke(cap, crp, 0);
> if (result != ERESTART)
> return (result);
>
> 2008 code:
> result = crypto_invoke(cap, crp, 0);
> CRYPTO_Q_LOCK();
> if (result != ERESTART)
> crypto_drivers[hid].cc_qblocked = 0;
>
> In the 2008 code an error is not returned to cryptodev.c if crypto_invoke returns an error code.
> Should we now always call crypto_done() if there is a fail in the driver invoke function?
>
> I ask because I've tried this but am getting a soft lockup when using crypto-tools and testing some fail case scenarios if I set the crp->etype before calling crypto-done.
Yeah, I can't explain it either and I made that change. It was part of a
SMP/locking problem and it looks like I lost the result code. Here is a
quick patch (untested :-) that I think will return the functionality that
was lost. Let me know how it goes.
Out of interest, what is the condition error that the driver you are using
is reporting ? EINVAL perhaps ?
Thanks for tracking this down,
Cheers,
Davidm
Index: ocf/crypto.c
===================================================================
RCS file: ocf/crypto.c,v
retrieving revision 1.42
diff -u -r1.42 crypto.c
--- ocf/crypto.c 31 Mar 2009 00:41:14 -0000 1.42
+++ ocf/crypto.c 29 Apr 2009 23:01:08 -0000
@@ -838,13 +838,15 @@
*/
list_add(&crp->crp_next, &crp_q);
cryptostats.cs_blocks++;
+ result = 0;
} else if (result == -1) {
TAILQ_INSERT_TAIL(&crp_q, crp, crp_next);
+ result = 0;
}
if (crp_sleep)
wake_up_interruptible(&cryptoproc_wait);
CRYPTO_Q_UNLOCK();
- return 0;
+ return result;
}
/*
--
David McCullough, dav...@se..., Ph:+61 734352815
McAfee - SnapGear http://www.snapgear.com http://www.uCdot.org
|