Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

greybus: loopback: fix double error count

Make sure not count errors during asynchronous tests twice (first in
the timeout handler then again in the completion handler) to avoid
obviously broken error stats such as:

$ loopback_test -i 1000 -t transfer -p -o 200000 -c 64 -x -s 2000

1970-1-1 1:3:35
test: transfer
path: gb_loopback0
size: 2000
iterations: 1000
errors: 1998
async: Enabled
requests per-sec: min=0, max=0, average=0.310556, jitter=0
ap-throughput B/s: min=0 max=4026 average=1254.647461 jitter=4026
ap-latency usec: min=12803 max=12803 average=12803.000000 jitter=0
apbridge-latency usec: min=89 max=89 average=89.000000 jitter=0
gpbridge-latency usec: min=294 max=294 average=294.000000 jitter=0

where we supposedly have more errors than iterations (operations
initiated).

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>

authored by

Johan Hovold and committed by
Greg Kroah-Hartman
41993cd5 5bbe14b7

+3 -3
+3 -3
drivers/staging/greybus/loopback.c
··· 516 516 err = true; 517 517 } 518 518 519 - if (err) { 520 - gb->error++; 521 - } else { 519 + if (!err) { 522 520 gb_loopback_push_latency_ts(gb, &op_async->ts, &te); 523 521 gb->elapsed_nsecs = gb_loopback_calc_latency(&op_async->ts, 524 522 &te); 525 523 } 526 524 527 525 if (op_async->pending) { 526 + if (err) 527 + gb->error++; 528 528 gb->iteration_count++; 529 529 op_async->pending = false; 530 530 del_timer_sync(&op_async->timer);