Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d0360d7b authored by Harald Freudenberger's avatar Harald Freudenberger Committed by Martin Schwidefsky
Browse files

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: default avatarHarald Freudenberger <freude@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 54397bb0
Loading
Loading
Loading
Loading
+20 −4
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ static ssize_t ap_functions_show(struct device *dev,

static DEVICE_ATTR(ap_functions, 0444, ap_functions_show, NULL);

static ssize_t ap_request_count_show(struct device *dev,
static ssize_t ap_req_count_show(struct device *dev,
				 struct device_attribute *attr,
				 char *buf)
{
@@ -72,7 +72,23 @@ static ssize_t ap_request_count_show(struct device *dev,
	return snprintf(buf, PAGE_SIZE, "%d\n", req_cnt);
}

static DEVICE_ATTR(request_count, 0444, ap_request_count_show, NULL);
static ssize_t ap_req_count_store(struct device *dev,
				  struct device_attribute *attr,
				  const char *buf, size_t count)
{
	struct ap_card *ac = to_ap_card(dev);
	struct ap_queue *aq;

	spin_lock_bh(&ap_list_lock);
	for_each_ap_queue(aq, ac)
		aq->total_request_count = 0;
	spin_unlock_bh(&ap_list_lock);
	atomic_set(&ac->total_request_count, 0);

	return count;
}

static DEVICE_ATTR(request_count, 0644, ap_req_count_show, ap_req_count_store);

static ssize_t ap_requestq_count_show(struct device *dev,
				      struct device_attribute *attr, char *buf)
+17 −4
Original line number Diff line number Diff line
@@ -459,7 +459,7 @@ EXPORT_SYMBOL(ap_queue_resume);
/*
 * AP queue related attributes.
 */
static ssize_t ap_request_count_show(struct device *dev,
static ssize_t ap_req_count_show(struct device *dev,
				 struct device_attribute *attr,
				 char *buf)
{
@@ -472,7 +472,20 @@ static ssize_t ap_request_count_show(struct device *dev,
	return snprintf(buf, PAGE_SIZE, "%d\n", req_cnt);
}

static DEVICE_ATTR(request_count, 0444, ap_request_count_show, NULL);
static ssize_t ap_req_count_store(struct device *dev,
				  struct device_attribute *attr,
				  const char *buf, size_t count)
{
	struct ap_queue *aq = to_ap_queue(dev);

	spin_lock_bh(&aq->lock);
	aq->total_request_count = 0;
	spin_unlock_bh(&aq->lock);

	return count;
}

static DEVICE_ATTR(request_count, 0644, ap_req_count_show, ap_req_count_store);

static ssize_t ap_requestq_count_show(struct device *dev,
				      struct device_attribute *attr, char *buf)