zdev:qeth: adapt performance_stats attribute semantics

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 <maier@linux.ibm.com>
Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Alexandra Winter
2023-09-18 18:40:37 +02:00
committed by Jan Höppner
parent 2996b34ddf
commit 6d06921276

View File

@@ -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),
};