diff options
author | Harald Freudenberger <freude@linux.vnet.ibm.com> | 2016-11-15 03:05:00 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2017-02-23 04:06:39 -0500 |
commit | d0360d7b523f150c2ff0ab3c9361dfc3b4185cbf (patch) | |
tree | b80655186deb374865263cb274c5d1a46791f877 | |
parent | 54397bb0bbedbb9f7d77a62f6ddc6869354e3d9f (diff) |
s390/zcrypt: Enable request count reset for cards and queues.
This patch introduces the possibility to reset the
request_count attribute for cards and queues to zero.
This can be used to set a clear state on the counters before
running an application and try out if and which hardware is
actually used. If the request_count counter of a card is
reset, for all associated queues the request_count is also
zeroed. If just a queue request_count is reset the card
counter is not updated however.
Signed-off-by: Harald Freudenberger <freude@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | drivers/s390/crypto/ap_card.c | 24 | ||||
-rw-r--r-- | drivers/s390/crypto/ap_queue.c | 21 |
2 files changed, 37 insertions, 8 deletions
diff --git a/drivers/s390/crypto/ap_card.c b/drivers/s390/crypto/ap_card.c index 1cd9128593e4..cfa161ccc74e 100644 --- a/drivers/s390/crypto/ap_card.c +++ b/drivers/s390/crypto/ap_card.c | |||
@@ -58,9 +58,9 @@ static ssize_t ap_functions_show(struct device *dev, | |||
58 | 58 | ||
59 | static DEVICE_ATTR(ap_functions, 0444, ap_functions_show, NULL); | 59 | static DEVICE_ATTR(ap_functions, 0444, ap_functions_show, NULL); |
60 | 60 | ||
61 | static ssize_t ap_request_count_show(struct device *dev, | 61 | static ssize_t ap_req_count_show(struct device *dev, |
62 | struct device_attribute *attr, | 62 | struct device_attribute *attr, |
63 | char *buf) | 63 | char *buf) |
64 | { | 64 | { |
65 | struct ap_card *ac = to_ap_card(dev); | 65 | struct ap_card *ac = to_ap_card(dev); |
66 | unsigned int req_cnt; | 66 | unsigned int req_cnt; |
@@ -72,7 +72,23 @@ static ssize_t ap_request_count_show(struct device *dev, | |||
72 | return snprintf(buf, PAGE_SIZE, "%d\n", req_cnt); | 72 | return snprintf(buf, PAGE_SIZE, "%d\n", req_cnt); |
73 | } | 73 | } |
74 | 74 | ||
75 | static DEVICE_ATTR(request_count, 0444, ap_request_count_show, NULL); | 75 | static ssize_t ap_req_count_store(struct device *dev, |
76 | struct device_attribute *attr, | ||
77 | const char *buf, size_t count) | ||
78 | { | ||
79 | struct ap_card *ac = to_ap_card(dev); | ||
80 | struct ap_queue *aq; | ||
81 | |||
82 | spin_lock_bh(&ap_list_lock); | ||
83 | for_each_ap_queue(aq, ac) | ||
84 | aq->total_request_count = 0; | ||
85 | spin_unlock_bh(&ap_list_lock); | ||
86 | atomic_set(&ac->total_request_count, 0); | ||
87 | |||
88 | return count; | ||
89 | } | ||
90 | |||
91 | static DEVICE_ATTR(request_count, 0644, ap_req_count_show, ap_req_count_store); | ||
76 | 92 | ||
77 | static ssize_t ap_requestq_count_show(struct device *dev, | 93 | static ssize_t ap_requestq_count_show(struct device *dev, |
78 | struct device_attribute *attr, char *buf) | 94 | struct device_attribute *attr, char *buf) |
diff --git a/drivers/s390/crypto/ap_queue.c b/drivers/s390/crypto/ap_queue.c index 7be67fa9f224..480c58a63769 100644 --- a/drivers/s390/crypto/ap_queue.c +++ b/drivers/s390/crypto/ap_queue.c | |||
@@ -459,9 +459,9 @@ EXPORT_SYMBOL(ap_queue_resume); | |||
459 | /* | 459 | /* |
460 | * AP queue related attributes. | 460 | * AP queue related attributes. |
461 | */ | 461 | */ |
462 | static ssize_t ap_request_count_show(struct device *dev, | 462 | static ssize_t ap_req_count_show(struct device *dev, |
463 | struct device_attribute *attr, | 463 | struct device_attribute *attr, |
464 | char *buf) | 464 | char *buf) |
465 | { | 465 | { |
466 | struct ap_queue *aq = to_ap_queue(dev); | 466 | struct ap_queue *aq = to_ap_queue(dev); |
467 | unsigned int req_cnt; | 467 | unsigned int req_cnt; |
@@ -472,7 +472,20 @@ static ssize_t ap_request_count_show(struct device *dev, | |||
472 | return snprintf(buf, PAGE_SIZE, "%d\n", req_cnt); | 472 | return snprintf(buf, PAGE_SIZE, "%d\n", req_cnt); |
473 | } | 473 | } |
474 | 474 | ||
475 | static DEVICE_ATTR(request_count, 0444, ap_request_count_show, NULL); | 475 | static ssize_t ap_req_count_store(struct device *dev, |
476 | struct device_attribute *attr, | ||
477 | const char *buf, size_t count) | ||
478 | { | ||
479 | struct ap_queue *aq = to_ap_queue(dev); | ||
480 | |||
481 | spin_lock_bh(&aq->lock); | ||
482 | aq->total_request_count = 0; | ||
483 | spin_unlock_bh(&aq->lock); | ||
484 | |||
485 | return count; | ||
486 | } | ||
487 | |||
488 | static DEVICE_ATTR(request_count, 0644, ap_req_count_show, ap_req_count_store); | ||
476 | 489 | ||
477 | static ssize_t ap_requestq_count_show(struct device *dev, | 490 | static ssize_t ap_requestq_count_show(struct device *dev, |
478 | struct device_attribute *attr, char *buf) | 491 | struct device_attribute *attr, char *buf) |