diff options
author | Uri Simchoni <uri@jdland.co.il> | 2010-04-08 12:30:19 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2010-04-13 04:50:48 -0400 |
commit | a58094ac5f95d6969e5c52ff096d2fd2864542af (patch) | |
tree | 64ea1061de285e1da28c51939635da90fcc32ba5 /drivers/crypto | |
parent | 7a5f691ef03f4c01d2703b5ec4ddd4c17e645dec (diff) |
crypto: mv_cesa - Execute some code via function pointers rathr than direct calls
Execute some code via function pointers rathr than direct calls
(to allow customization in the hashing request)
Signed-off-by: Uri Simchoni <uri@jdland.co.il>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/mv_cesa.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/crypto/mv_cesa.c b/drivers/crypto/mv_cesa.c index 4262932d4a27..2b4f07aa89e8 100644 --- a/drivers/crypto/mv_cesa.c +++ b/drivers/crypto/mv_cesa.c | |||
@@ -51,6 +51,8 @@ enum engine_status { | |||
51 | struct req_progress { | 51 | struct req_progress { |
52 | struct sg_mapping_iter src_sg_it; | 52 | struct sg_mapping_iter src_sg_it; |
53 | struct sg_mapping_iter dst_sg_it; | 53 | struct sg_mapping_iter dst_sg_it; |
54 | void (*complete) (void); | ||
55 | void (*process) (int is_first); | ||
54 | 56 | ||
55 | /* src mostly */ | 57 | /* src mostly */ |
56 | int sg_src_left; | 58 | int sg_src_left; |
@@ -251,6 +253,9 @@ static void mv_crypto_algo_completion(void) | |||
251 | struct ablkcipher_request *req = ablkcipher_request_cast(cpg->cur_req); | 253 | struct ablkcipher_request *req = ablkcipher_request_cast(cpg->cur_req); |
252 | struct mv_req_ctx *req_ctx = ablkcipher_request_ctx(req); | 254 | struct mv_req_ctx *req_ctx = ablkcipher_request_ctx(req); |
253 | 255 | ||
256 | sg_miter_stop(&cpg->p.src_sg_it); | ||
257 | sg_miter_stop(&cpg->p.dst_sg_it); | ||
258 | |||
254 | if (req_ctx->op != COP_AES_CBC) | 259 | if (req_ctx->op != COP_AES_CBC) |
255 | return ; | 260 | return ; |
256 | 261 | ||
@@ -294,11 +299,9 @@ static void dequeue_complete_req(void) | |||
294 | if (cpg->p.hw_processed_bytes < cpg->p.hw_nbytes) { | 299 | if (cpg->p.hw_processed_bytes < cpg->p.hw_nbytes) { |
295 | /* process next scatter list entry */ | 300 | /* process next scatter list entry */ |
296 | cpg->eng_st = ENGINE_BUSY; | 301 | cpg->eng_st = ENGINE_BUSY; |
297 | mv_process_current_q(0); | 302 | cpg->p.process(0); |
298 | } else { | 303 | } else { |
299 | sg_miter_stop(&cpg->p.src_sg_it); | 304 | cpg->p.complete(); |
300 | sg_miter_stop(&cpg->p.dst_sg_it); | ||
301 | mv_crypto_algo_completion(); | ||
302 | cpg->eng_st = ENGINE_IDLE; | 305 | cpg->eng_st = ENGINE_IDLE; |
303 | local_bh_disable(); | 306 | local_bh_disable(); |
304 | req->complete(req, 0); | 307 | req->complete(req, 0); |
@@ -331,6 +334,8 @@ static void mv_enqueue_new_req(struct ablkcipher_request *req) | |||
331 | cpg->cur_req = &req->base; | 334 | cpg->cur_req = &req->base; |
332 | memset(p, 0, sizeof(struct req_progress)); | 335 | memset(p, 0, sizeof(struct req_progress)); |
333 | p->hw_nbytes = req->nbytes; | 336 | p->hw_nbytes = req->nbytes; |
337 | p->complete = mv_crypto_algo_completion; | ||
338 | p->process = mv_process_current_q; | ||
334 | 339 | ||
335 | num_sgs = count_sgs(req->src, req->nbytes); | 340 | num_sgs = count_sgs(req->src, req->nbytes); |
336 | sg_miter_start(&p->src_sg_it, req->src, num_sgs, SG_MITER_FROM_SG); | 341 | sg_miter_start(&p->src_sg_it, req->src, num_sgs, SG_MITER_FROM_SG); |