From 6d06921276b5e17fc63b72d7a9ea60724806764a Mon Sep 17 00:00:00 2001 From: Alexandra Winter Date: Mon, 18 Sep 2023 18:40:37 +0200 Subject: [PATCH] zdev:qeth: adapt performance_stats attribute semantics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Behaviour of the qeth performance_stats sysfs attribute has changed with kernel commit b0abc4f5df76 ("s390/qeth: overhaul ethtool statistics") that went into kernel v5.1. Before the kernel commit - collection of statistics was turned on and off by writing 1 or 0 - default after device activation was 0 - statistics were reset by writing 0 After the kernel commit: - collection is always on - attribute always reads 1 - statistics is reset by writing 1; writing 0 is a no-op Problems of chzdev on new kernels: chzdev cannot reset statistics ('performance_stats=1' does nothing). 'chzdev --export' always lists performance_stats. 'chzdev qeth --help-attribute performance_stats' reflects old behaviour. This patch will do the following: 'chzdev qeth --help-attribute performance_stats' reflects new behaviour. 'chzdev --export' does not list performance_stats on new kernels. 'chzdev performance_stats=1' resets statistics on new kernels. 'chzdev performance_stats=0' still resets statistics on old kernels, does nothing on new kernels. Suggested-by: Steffen Maier Signed-off-by: Alexandra Winter Signed-off-by: Jan Höppner --- zdev/src/qeth.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/zdev/src/qeth.c b/zdev/src/qeth.c index ebe8bb10..0b0eb213 100644 --- a/zdev/src/qeth.c +++ b/zdev/src/qeth.c @@ -413,13 +413,16 @@ static struct attrib qeth_attr_isolation = { static struct attrib qeth_attr_performance_stats = { .name = "performance_stats", - .title = "Control performance statistics collection", + .title = "Reset the statistic values", .desc = - "Control the collection of QETH performance statistics data:\n" - " 0: Performance statistics data is not collected\n" - " 1: Performance statistics data is collected\n", - .defval = "0", + "Write '1' to this attribute to reset the statistic values to 0.\n" + "Use the ethtool command to display the statistics.\n", + /* read will always return 1 */ + .defval = "1", + /* writing 0 is possible, but has no effect */ .accept = ACCEPT_ARRAY(ACCEPT_RANGE(0, 1)), + .activeonly = 1, + .rewrite = 1, .st_data = QETH_DATA(layer_any, group_none), };