Commit 83f619f3 authored by Steffen Klassert's avatar Steffen Klassert Committed by Herbert Xu

padata: make padata_do_parallel to return zero on success

To return -EINPROGRESS on success in padata_do_parallel was
considered to be odd. This patch changes this to return zero
on success. Also the only user of padata, pcrypt is adapted to
convert a return of zero to -EINPROGRESS within the crypto layer.
This also removes the pcrypt fallback if padata_do_parallel
was called on a not running padata instance as we can't handle it
anymore. This fallback was unused, so it's save to remove it.
Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 33e54450
...@@ -143,10 +143,8 @@ static int pcrypt_aead_encrypt(struct aead_request *req) ...@@ -143,10 +143,8 @@ static int pcrypt_aead_encrypt(struct aead_request *req)
aead_request_set_assoc(creq, req->assoc, req->assoclen); aead_request_set_assoc(creq, req->assoc, req->assoclen);
err = pcrypt_do_parallel(padata, &ctx->cb_cpu, pcrypt_enc_padata); err = pcrypt_do_parallel(padata, &ctx->cb_cpu, pcrypt_enc_padata);
if (err) if (!err)
return err; return -EINPROGRESS;
else
err = crypto_aead_encrypt(creq);
return err; return err;
} }
...@@ -187,10 +185,8 @@ static int pcrypt_aead_decrypt(struct aead_request *req) ...@@ -187,10 +185,8 @@ static int pcrypt_aead_decrypt(struct aead_request *req)
aead_request_set_assoc(creq, req->assoc, req->assoclen); aead_request_set_assoc(creq, req->assoc, req->assoclen);
err = pcrypt_do_parallel(padata, &ctx->cb_cpu, pcrypt_dec_padata); err = pcrypt_do_parallel(padata, &ctx->cb_cpu, pcrypt_dec_padata);
if (err) if (!err)
return err; return -EINPROGRESS;
else
err = crypto_aead_decrypt(creq);
return err; return err;
} }
...@@ -233,10 +229,8 @@ static int pcrypt_aead_givencrypt(struct aead_givcrypt_request *req) ...@@ -233,10 +229,8 @@ static int pcrypt_aead_givencrypt(struct aead_givcrypt_request *req)
aead_givcrypt_set_giv(creq, req->giv, req->seq); aead_givcrypt_set_giv(creq, req->giv, req->seq);
err = pcrypt_do_parallel(padata, &ctx->cb_cpu, pcrypt_enc_padata); err = pcrypt_do_parallel(padata, &ctx->cb_cpu, pcrypt_enc_padata);
if (err) if (!err)
return err; return -EINPROGRESS;
else
err = crypto_aead_givencrypt(creq);
return err; return err;
} }
......
...@@ -111,10 +111,13 @@ int padata_do_parallel(struct padata_instance *pinst, ...@@ -111,10 +111,13 @@ int padata_do_parallel(struct padata_instance *pinst,
pd = rcu_dereference(pinst->pd); pd = rcu_dereference(pinst->pd);
err = 0; err = -EINVAL;
if (!(pinst->flags & PADATA_INIT)) if (!(pinst->flags & PADATA_INIT))
goto out; goto out;
if (!cpumask_test_cpu(cb_cpu, pd->cpumask))
goto out;
err = -EBUSY; err = -EBUSY;
if ((pinst->flags & PADATA_RESET)) if ((pinst->flags & PADATA_RESET))
goto out; goto out;
...@@ -122,11 +125,7 @@ int padata_do_parallel(struct padata_instance *pinst, ...@@ -122,11 +125,7 @@ int padata_do_parallel(struct padata_instance *pinst,
if (atomic_read(&pd->refcnt) >= MAX_OBJ_NUM) if (atomic_read(&pd->refcnt) >= MAX_OBJ_NUM)
goto out; goto out;
err = -EINVAL; err = 0;
if (!cpumask_test_cpu(cb_cpu, pd->cpumask))
goto out;
err = -EINPROGRESS;
atomic_inc(&pd->refcnt); atomic_inc(&pd->refcnt);
padata->pd = pd; padata->pd = pd;
padata->cb_cpu = cb_cpu; padata->cb_cpu = cb_cpu;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment