aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/crypto/zcrypt_pcicc.c
diff options
context:
space:
mode:
authorRalph Wuerthner <rwuerthn@de.ibm.com>2007-07-10 05:24:19 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2007-07-10 05:24:52 -0400
commitaf512ed0f8a7e6a3c6fd93b2b5882c8e837a6939 (patch)
tree2bd15176832b8c6eb671519334d9e1ab5d994d68 /drivers/s390/crypto/zcrypt_pcicc.c
parent987ad70a4d90cf0e70dba43ece02c2e2219e092c (diff)
[S390] zcrypt: fix request timeout handling
Under very high load zcrypt requests may timeout while waiting on the request queue. Modify zcrypt that timeouts are based on crypto adapter responses. A timeout occurs only if a crypto adapter does not respond within a given time frame to sumitted requests. Signed-off-by: Ralph Wuerthner <rwuerthn@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/crypto/zcrypt_pcicc.c')
-rw-r--r--drivers/s390/crypto/zcrypt_pcicc.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/drivers/s390/crypto/zcrypt_pcicc.c b/drivers/s390/crypto/zcrypt_pcicc.c
index f295a403b29a..d6d59bf9ac38 100644
--- a/drivers/s390/crypto/zcrypt_pcicc.c
+++ b/drivers/s390/crypto/zcrypt_pcicc.c
@@ -82,6 +82,7 @@ static struct ap_driver zcrypt_pcicc_driver = {
82 .remove = zcrypt_pcicc_remove, 82 .remove = zcrypt_pcicc_remove,
83 .receive = zcrypt_pcicc_receive, 83 .receive = zcrypt_pcicc_receive,
84 .ids = zcrypt_pcicc_ids, 84 .ids = zcrypt_pcicc_ids,
85 .request_timeout = PCICC_CLEANUP_TIME,
85}; 86};
86 87
87/** 88/**
@@ -501,18 +502,13 @@ static long zcrypt_pcicc_modexpo(struct zcrypt_device *zdev,
501 goto out_free; 502 goto out_free;
502 init_completion(&work); 503 init_completion(&work);
503 ap_queue_message(zdev->ap_dev, &ap_msg); 504 ap_queue_message(zdev->ap_dev, &ap_msg);
504 rc = wait_for_completion_interruptible_timeout( 505 rc = wait_for_completion_interruptible(&work);
505 &work, PCICC_CLEANUP_TIME); 506 if (rc == 0)
506 if (rc > 0)
507 rc = convert_response(zdev, &ap_msg, mex->outputdata, 507 rc = convert_response(zdev, &ap_msg, mex->outputdata,
508 mex->outputdatalength); 508 mex->outputdatalength);
509 else { 509 else
510 /* Signal pending or message timed out. */ 510 /* Signal pending. */
511 ap_cancel_message(zdev->ap_dev, &ap_msg); 511 ap_cancel_message(zdev->ap_dev, &ap_msg);
512 if (rc == 0)
513 /* Message timed out. */
514 rc = -ETIME;
515 }
516out_free: 512out_free:
517 free_page((unsigned long) ap_msg.message); 513 free_page((unsigned long) ap_msg.message);
518 return rc; 514 return rc;
@@ -544,18 +540,13 @@ static long zcrypt_pcicc_modexpo_crt(struct zcrypt_device *zdev,
544 goto out_free; 540 goto out_free;
545 init_completion(&work); 541 init_completion(&work);
546 ap_queue_message(zdev->ap_dev, &ap_msg); 542 ap_queue_message(zdev->ap_dev, &ap_msg);
547 rc = wait_for_completion_interruptible_timeout( 543 rc = wait_for_completion_interruptible(&work);
548 &work, PCICC_CLEANUP_TIME); 544 if (rc == 0)
549 if (rc > 0)
550 rc = convert_response(zdev, &ap_msg, crt->outputdata, 545 rc = convert_response(zdev, &ap_msg, crt->outputdata,
551 crt->outputdatalength); 546 crt->outputdatalength);
552 else { 547 else
553 /* Signal pending or message timed out. */ 548 /* Signal pending. */
554 ap_cancel_message(zdev->ap_dev, &ap_msg); 549 ap_cancel_message(zdev->ap_dev, &ap_msg);
555 if (rc == 0)
556 /* Message timed out. */
557 rc = -ETIME;
558 }
559out_free: 550out_free:
560 free_page((unsigned long) ap_msg.message); 551 free_page((unsigned long) ap_msg.message);
561 return rc; 552 return rc;