aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/crypto/zcrypt_pcixcc.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_pcixcc.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_pcixcc.c')
-rw-r--r--drivers/s390/crypto/zcrypt_pcixcc.c40
1 files changed, 13 insertions, 27 deletions
diff --git a/drivers/s390/crypto/zcrypt_pcixcc.c b/drivers/s390/crypto/zcrypt_pcixcc.c
index 252443b6bd1b..64948788d301 100644
--- a/drivers/s390/crypto/zcrypt_pcixcc.c
+++ b/drivers/s390/crypto/zcrypt_pcixcc.c
@@ -93,6 +93,7 @@ static struct ap_driver zcrypt_pcixcc_driver = {
93 .remove = zcrypt_pcixcc_remove, 93 .remove = zcrypt_pcixcc_remove,
94 .receive = zcrypt_pcixcc_receive, 94 .receive = zcrypt_pcixcc_receive,
95 .ids = zcrypt_pcixcc_ids, 95 .ids = zcrypt_pcixcc_ids,
96 .request_timeout = PCIXCC_CLEANUP_TIME,
96}; 97};
97 98
98/** 99/**
@@ -641,18 +642,13 @@ static long zcrypt_pcixcc_modexpo(struct zcrypt_device *zdev,
641 goto out_free; 642 goto out_free;
642 init_completion(&resp_type.work); 643 init_completion(&resp_type.work);
643 ap_queue_message(zdev->ap_dev, &ap_msg); 644 ap_queue_message(zdev->ap_dev, &ap_msg);
644 rc = wait_for_completion_interruptible_timeout( 645 rc = wait_for_completion_interruptible(&resp_type.work);
645 &resp_type.work, PCIXCC_CLEANUP_TIME); 646 if (rc == 0)
646 if (rc > 0)
647 rc = convert_response_ica(zdev, &ap_msg, mex->outputdata, 647 rc = convert_response_ica(zdev, &ap_msg, mex->outputdata,
648 mex->outputdatalength); 648 mex->outputdatalength);
649 else { 649 else
650 /* Signal pending or message timed out. */ 650 /* Signal pending. */
651 ap_cancel_message(zdev->ap_dev, &ap_msg); 651 ap_cancel_message(zdev->ap_dev, &ap_msg);
652 if (rc == 0)
653 /* Message timed out. */
654 rc = -ETIME;
655 }
656out_free: 652out_free:
657 free_page((unsigned long) ap_msg.message); 653 free_page((unsigned long) ap_msg.message);
658 return rc; 654 return rc;
@@ -685,18 +681,13 @@ static long zcrypt_pcixcc_modexpo_crt(struct zcrypt_device *zdev,
685 goto out_free; 681 goto out_free;
686 init_completion(&resp_type.work); 682 init_completion(&resp_type.work);
687 ap_queue_message(zdev->ap_dev, &ap_msg); 683 ap_queue_message(zdev->ap_dev, &ap_msg);
688 rc = wait_for_completion_interruptible_timeout( 684 rc = wait_for_completion_interruptible(&resp_type.work);
689 &resp_type.work, PCIXCC_CLEANUP_TIME); 685 if (rc == 0)
690 if (rc > 0)
691 rc = convert_response_ica(zdev, &ap_msg, crt->outputdata, 686 rc = convert_response_ica(zdev, &ap_msg, crt->outputdata,
692 crt->outputdatalength); 687 crt->outputdatalength);
693 else { 688 else
694 /* Signal pending or message timed out. */ 689 /* Signal pending. */
695 ap_cancel_message(zdev->ap_dev, &ap_msg); 690 ap_cancel_message(zdev->ap_dev, &ap_msg);
696 if (rc == 0)
697 /* Message timed out. */
698 rc = -ETIME;
699 }
700out_free: 691out_free:
701 free_page((unsigned long) ap_msg.message); 692 free_page((unsigned long) ap_msg.message);
702 return rc; 693 return rc;
@@ -729,17 +720,12 @@ static long zcrypt_pcixcc_send_cprb(struct zcrypt_device *zdev,
729 goto out_free; 720 goto out_free;
730 init_completion(&resp_type.work); 721 init_completion(&resp_type.work);
731 ap_queue_message(zdev->ap_dev, &ap_msg); 722 ap_queue_message(zdev->ap_dev, &ap_msg);
732 rc = wait_for_completion_interruptible_timeout( 723 rc = wait_for_completion_interruptible(&resp_type.work);
733 &resp_type.work, PCIXCC_CLEANUP_TIME); 724 if (rc == 0)
734 if (rc > 0)
735 rc = convert_response_xcrb(zdev, &ap_msg, xcRB); 725 rc = convert_response_xcrb(zdev, &ap_msg, xcRB);
736 else { 726 else
737 /* Signal pending or message timed out. */ 727 /* Signal pending. */
738 ap_cancel_message(zdev->ap_dev, &ap_msg); 728 ap_cancel_message(zdev->ap_dev, &ap_msg);
739 if (rc == 0)
740 /* Message timed out. */
741 rc = -ETIME;
742 }
743out_free: 729out_free:
744 memset(ap_msg.message, 0x0, ap_msg.length); 730 memset(ap_msg.message, 0x0, ap_msg.length);
745 kfree(ap_msg.message); 731 kfree(ap_msg.message);