aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/crypto/zcrypt_cex2a.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_cex2a.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_cex2a.c')
-rw-r--r--drivers/s390/crypto/zcrypt_cex2a.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/drivers/s390/crypto/zcrypt_cex2a.c b/drivers/s390/crypto/zcrypt_cex2a.c
index 5bb13a9d0898..08657f604b8c 100644
--- a/drivers/s390/crypto/zcrypt_cex2a.c
+++ b/drivers/s390/crypto/zcrypt_cex2a.c
@@ -70,6 +70,7 @@ static struct ap_driver zcrypt_cex2a_driver = {
70 .remove = zcrypt_cex2a_remove, 70 .remove = zcrypt_cex2a_remove,
71 .receive = zcrypt_cex2a_receive, 71 .receive = zcrypt_cex2a_receive,
72 .ids = zcrypt_cex2a_ids, 72 .ids = zcrypt_cex2a_ids,
73 .request_timeout = CEX2A_CLEANUP_TIME,
73}; 74};
74 75
75/** 76/**
@@ -306,18 +307,13 @@ static long zcrypt_cex2a_modexpo(struct zcrypt_device *zdev,
306 goto out_free; 307 goto out_free;
307 init_completion(&work); 308 init_completion(&work);
308 ap_queue_message(zdev->ap_dev, &ap_msg); 309 ap_queue_message(zdev->ap_dev, &ap_msg);
309 rc = wait_for_completion_interruptible_timeout( 310 rc = wait_for_completion_interruptible(&work);
310 &work, CEX2A_CLEANUP_TIME); 311 if (rc == 0)
311 if (rc > 0)
312 rc = convert_response(zdev, &ap_msg, mex->outputdata, 312 rc = convert_response(zdev, &ap_msg, mex->outputdata,
313 mex->outputdatalength); 313 mex->outputdatalength);
314 else { 314 else
315 /* Signal pending or message timed out. */ 315 /* Signal pending. */
316 ap_cancel_message(zdev->ap_dev, &ap_msg); 316 ap_cancel_message(zdev->ap_dev, &ap_msg);
317 if (rc == 0)
318 /* Message timed out. */
319 rc = -ETIME;
320 }
321out_free: 317out_free:
322 kfree(ap_msg.message); 318 kfree(ap_msg.message);
323 return rc; 319 return rc;
@@ -348,18 +344,13 @@ static long zcrypt_cex2a_modexpo_crt(struct zcrypt_device *zdev,
348 goto out_free; 344 goto out_free;
349 init_completion(&work); 345 init_completion(&work);
350 ap_queue_message(zdev->ap_dev, &ap_msg); 346 ap_queue_message(zdev->ap_dev, &ap_msg);
351 rc = wait_for_completion_interruptible_timeout( 347 rc = wait_for_completion_interruptible(&work);
352 &work, CEX2A_CLEANUP_TIME); 348 if (rc == 0)
353 if (rc > 0)
354 rc = convert_response(zdev, &ap_msg, crt->outputdata, 349 rc = convert_response(zdev, &ap_msg, crt->outputdata,
355 crt->outputdatalength); 350 crt->outputdatalength);
356 else { 351 else
357 /* Signal pending or message timed out. */ 352 /* Signal pending. */
358 ap_cancel_message(zdev->ap_dev, &ap_msg); 353 ap_cancel_message(zdev->ap_dev, &ap_msg);
359 if (rc == 0)
360 /* Message timed out. */
361 rc = -ETIME;
362 }
363out_free: 354out_free:
364 kfree(ap_msg.message); 355 kfree(ap_msg.message);
365 return rc; 356 return rc;