1 // SPDX-License-Identifier: BSD-3-Clause
3 * Loopback test application
5 * Copyright 2015 Google Inc.
6 * Copyright 2015 Linaro Ltd.
15 #include <sys/types.h>
21 #define MAX_NUM_DEVICES 10
22 #define MAX_SYSFS_PATH 0x200
23 #define CSV_MAX_LINE 0x1000
24 #define SYSFS_MAX_INT 0x20
25 #define MAX_STR_LEN 255
26 #define DEFAULT_ASYNC_TIMEOUT 200000
33 static struct dict dict[] = {
37 {NULL,} /* list termination */
40 struct loopback_results {
44 uint32_t latency_jitter;
49 uint32_t request_jitter;
52 uint32_t throughput_max;
53 uint32_t throughput_min;
54 uint32_t throughput_jitter;
56 float apbridge_unipro_latency_avg;
57 uint32_t apbridge_unipro_latency_max;
58 uint32_t apbridge_unipro_latency_min;
59 uint32_t apbridge_unipro_latency_jitter;
61 float gbphy_firmware_latency_avg;
62 uint32_t gbphy_firmware_latency_max;
63 uint32_t gbphy_firmware_latency_min;
64 uint32_t gbphy_firmware_latency_jitter;
69 struct loopback_device {
70 char name[MAX_SYSFS_PATH];
71 char sysfs_entry[MAX_SYSFS_PATH];
72 char debugfs_entry[MAX_SYSFS_PATH];
73 struct loopback_results results;
76 struct loopback_test {
90 int async_outstanding_operations;
95 char test_name[MAX_STR_LEN];
96 char sysfs_prefix[MAX_SYSFS_PATH];
97 char debugfs_prefix[MAX_SYSFS_PATH];
98 struct timespec poll_timeout;
99 struct loopback_device devices[MAX_NUM_DEVICES];
100 struct loopback_results aggregate_results;
101 struct pollfd fds[MAX_NUM_DEVICES];
104 struct loopback_test t;
106 /* Helper macros to calculate the aggregate results for all devices */
107 static inline int device_enabled(struct loopback_test *t, int dev_idx);
109 #define GET_MAX(field) \
110 static int get_##field##_aggregate(struct loopback_test *t) \
114 for (i = 0; i < t->device_count; i++) { \
115 if (!device_enabled(t, i)) \
117 if (t->devices[i].results.field > max) \
118 max = t->devices[i].results.field; \
123 #define GET_MIN(field) \
124 static int get_##field##_aggregate(struct loopback_test *t) \
128 for (i = 0; i < t->device_count; i++) { \
129 if (!device_enabled(t, i)) \
131 if (t->devices[i].results.field < min) \
132 min = t->devices[i].results.field; \
137 #define GET_AVG(field) \
138 static int get_##field##_aggregate(struct loopback_test *t) \
141 uint32_t count = 0; \
143 for (i = 0; i < t->device_count; i++) { \
144 if (!device_enabled(t, i)) \
147 val += t->devices[i].results.field; \
154 GET_MAX(throughput_max);
155 GET_MAX(request_max);
156 GET_MAX(latency_max);
157 GET_MAX(apbridge_unipro_latency_max);
158 GET_MAX(gbphy_firmware_latency_max);
159 GET_MIN(throughput_min);
160 GET_MIN(request_min);
161 GET_MIN(latency_min);
162 GET_MIN(apbridge_unipro_latency_min);
163 GET_MIN(gbphy_firmware_latency_min);
164 GET_AVG(throughput_avg);
165 GET_AVG(request_avg);
166 GET_AVG(latency_avg);
167 GET_AVG(apbridge_unipro_latency_avg);
168 GET_AVG(gbphy_firmware_latency_avg);
177 fprintf(stderr, "Usage: loopback_test TEST [SIZE] ITERATIONS [SYSPATH] [DBGPATH]\n\n"
178 " Run TEST for a number of ITERATIONS with operation data SIZE bytes\n"
179 " TEST may be \'ping\' \'transfer\' or \'sink\'\n"
180 " SIZE indicates the size of transfer <= greybus max payload bytes\n"
181 " ITERATIONS indicates the number of times to execute TEST at SIZE bytes\n"
182 " Note if ITERATIONS is set to zero then this utility will\n"
183 " initiate an infinite (non terminating) test and exit\n"
184 " without logging any metrics data\n"
185 " SYSPATH indicates the sysfs path for the loopback greybus entries e.g.\n"
186 " /sys/bus/greybus/devices\n"
187 " DBGPATH indicates the debugfs path for the loopback greybus entries e.g.\n"
188 " /sys/kernel/debug/gb_loopback/\n"
189 " Mandatory arguments\n"
190 " -t must be one of the test names - sink, transfer or ping\n"
191 " -i iteration count - the number of iterations to run the test over\n"
192 " Optional arguments\n"
193 " -S sysfs location - location for greybus 'endo' entries default /sys/bus/greybus/devices/\n"
194 " -D debugfs location - location for loopback debugfs entries default /sys/kernel/debug/gb_loopback/\n"
195 " -s size of data packet to send during test - defaults to zero\n"
196 " -m mask - a bit mask of connections to include example: -m 8 = 4th connection -m 9 = 1st and 4th connection etc\n"
197 " default is zero which means broadcast to all connections\n"
198 " -v verbose output\n"
200 " -r raw data output - when specified the full list of latency values are included in the output CSV\n"
201 " -p porcelain - when specified printout is in a user-friendly non-CSV format. This option suppresses writing to CSV file\n"
202 " -a aggregate - show aggregation of all enabled devices\n"
203 " -l list found loopback devices and exit\n"
204 " -x Async - Enable async transfers\n"
205 " -o Async Timeout - Timeout in uSec for async operations\n"
206 " -O Poll loop time out in seconds(max time a test is expected to last, default: 30sec)\n"
207 " -c Max number of outstanding operations for async operations\n"
208 " -w Wait in uSec between operations\n"
209 " -z Enable output to a CSV file (incompatible with -p)\n"
210 " -f When starting new loopback test, stop currently running tests on all devices\n"
212 " Send 10000 transfers with a packet size of 128 bytes to all active connections\n"
213 " loopback_test -t transfer -s 128 -i 10000 -S /sys/bus/greybus/devices/ -D /sys/kernel/debug/gb_loopback/\n"
214 " loopback_test -t transfer -s 128 -i 10000 -m 0\n"
215 " Send 10000 transfers with a packet size of 128 bytes to connection 1 and 4\n"
216 " loopback_test -t transfer -s 128 -i 10000 -m 9\n"
217 " loopback_test -t ping -s 0 128 -i -S /sys/bus/greybus/devices/ -D /sys/kernel/debug/gb_loopback/\n"
218 " loopback_test -t sink -s 2030 -i 32768 -S /sys/bus/greybus/devices/ -D /sys/kernel/debug/gb_loopback/\n");
222 static inline int device_enabled(struct loopback_test *t, int dev_idx)
224 if (!t->mask || (t->mask & (1 << dev_idx)))
230 static void show_loopback_devices(struct loopback_test *t)
234 if (t->device_count == 0) {
235 printf("No loopback devices.\n");
239 for (i = 0; i < t->device_count; i++)
240 printf("device[%d] = %s\n", i, t->devices[i].name);
244 int open_sysfs(const char *sys_pfx, const char *node, int flags)
247 char path[MAX_SYSFS_PATH];
249 snprintf(path, sizeof(path), "%s%s", sys_pfx, node);
250 fd = open(path, flags);
252 fprintf(stderr, "unable to open %s\n", path);
258 int read_sysfs_int_fd(int fd, const char *sys_pfx, const char *node)
260 char buf[SYSFS_MAX_INT];
262 if (read(fd, buf, sizeof(buf)) < 0) {
263 fprintf(stderr, "unable to read from %s%s %s\n", sys_pfx, node,
271 float read_sysfs_float_fd(int fd, const char *sys_pfx, const char *node)
273 char buf[SYSFS_MAX_INT];
275 if (read(fd, buf, sizeof(buf)) < 0) {
277 fprintf(stderr, "unable to read from %s%s %s\n", sys_pfx, node,
285 int read_sysfs_int(const char *sys_pfx, const char *node)
289 fd = open_sysfs(sys_pfx, node, O_RDONLY);
290 val = read_sysfs_int_fd(fd, sys_pfx, node);
295 float read_sysfs_float(const char *sys_pfx, const char *node)
300 fd = open_sysfs(sys_pfx, node, O_RDONLY);
301 val = read_sysfs_float_fd(fd, sys_pfx, node);
306 void write_sysfs_val(const char *sys_pfx, const char *node, int val)
309 char buf[SYSFS_MAX_INT];
311 fd = open_sysfs(sys_pfx, node, O_RDWR);
312 len = snprintf(buf, sizeof(buf), "%d", val);
313 if (write(fd, buf, len) < 0) {
314 fprintf(stderr, "unable to write to %s%s %s\n", sys_pfx, node,
322 static int get_results(struct loopback_test *t)
324 struct loopback_device *d;
325 struct loopback_results *r;
328 for (i = 0; i < t->device_count; i++) {
329 if (!device_enabled(t, i))
335 r->error = read_sysfs_int(d->sysfs_entry, "error");
336 r->request_min = read_sysfs_int(d->sysfs_entry, "requests_per_second_min");
337 r->request_max = read_sysfs_int(d->sysfs_entry, "requests_per_second_max");
338 r->request_avg = read_sysfs_float(d->sysfs_entry, "requests_per_second_avg");
340 r->latency_min = read_sysfs_int(d->sysfs_entry, "latency_min");
341 r->latency_max = read_sysfs_int(d->sysfs_entry, "latency_max");
342 r->latency_avg = read_sysfs_float(d->sysfs_entry, "latency_avg");
344 r->throughput_min = read_sysfs_int(d->sysfs_entry, "throughput_min");
345 r->throughput_max = read_sysfs_int(d->sysfs_entry, "throughput_max");
346 r->throughput_avg = read_sysfs_float(d->sysfs_entry, "throughput_avg");
348 r->apbridge_unipro_latency_min =
349 read_sysfs_int(d->sysfs_entry, "apbridge_unipro_latency_min");
350 r->apbridge_unipro_latency_max =
351 read_sysfs_int(d->sysfs_entry, "apbridge_unipro_latency_max");
352 r->apbridge_unipro_latency_avg =
353 read_sysfs_float(d->sysfs_entry, "apbridge_unipro_latency_avg");
355 r->gbphy_firmware_latency_min =
356 read_sysfs_int(d->sysfs_entry, "gbphy_firmware_latency_min");
357 r->gbphy_firmware_latency_max =
358 read_sysfs_int(d->sysfs_entry, "gbphy_firmware_latency_max");
359 r->gbphy_firmware_latency_avg =
360 read_sysfs_float(d->sysfs_entry, "gbphy_firmware_latency_avg");
362 r->request_jitter = r->request_max - r->request_min;
363 r->latency_jitter = r->latency_max - r->latency_min;
364 r->throughput_jitter = r->throughput_max - r->throughput_min;
365 r->apbridge_unipro_latency_jitter =
366 r->apbridge_unipro_latency_max - r->apbridge_unipro_latency_min;
367 r->gbphy_firmware_latency_jitter =
368 r->gbphy_firmware_latency_max - r->gbphy_firmware_latency_min;
372 /*calculate the aggregate results of all enabled devices */
373 if (t->aggregate_output) {
374 r = &t->aggregate_results;
376 r->request_min = get_request_min_aggregate(t);
377 r->request_max = get_request_max_aggregate(t);
378 r->request_avg = get_request_avg_aggregate(t);
380 r->latency_min = get_latency_min_aggregate(t);
381 r->latency_max = get_latency_max_aggregate(t);
382 r->latency_avg = get_latency_avg_aggregate(t);
384 r->throughput_min = get_throughput_min_aggregate(t);
385 r->throughput_max = get_throughput_max_aggregate(t);
386 r->throughput_avg = get_throughput_avg_aggregate(t);
388 r->apbridge_unipro_latency_min =
389 get_apbridge_unipro_latency_min_aggregate(t);
390 r->apbridge_unipro_latency_max =
391 get_apbridge_unipro_latency_max_aggregate(t);
392 r->apbridge_unipro_latency_avg =
393 get_apbridge_unipro_latency_avg_aggregate(t);
395 r->gbphy_firmware_latency_min =
396 get_gbphy_firmware_latency_min_aggregate(t);
397 r->gbphy_firmware_latency_max =
398 get_gbphy_firmware_latency_max_aggregate(t);
399 r->gbphy_firmware_latency_avg =
400 get_gbphy_firmware_latency_avg_aggregate(t);
402 r->request_jitter = r->request_max - r->request_min;
403 r->latency_jitter = r->latency_max - r->latency_min;
404 r->throughput_jitter = r->throughput_max - r->throughput_min;
405 r->apbridge_unipro_latency_jitter =
406 r->apbridge_unipro_latency_max - r->apbridge_unipro_latency_min;
407 r->gbphy_firmware_latency_jitter =
408 r->gbphy_firmware_latency_max - r->gbphy_firmware_latency_min;
415 int format_output(struct loopback_test *t,
416 struct loopback_results *r,
417 const char *dev_name,
418 char *buf, int buf_len,
423 memset(buf, 0x00, buf_len);
424 len = snprintf(buf, buf_len, "%u-%u-%u %u:%u:%u",
425 tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
426 tm->tm_hour, tm->tm_min, tm->tm_sec);
429 len += snprintf(&buf[len], buf_len - len,
430 "\n test:\t\t\t%s\n path:\t\t\t%s\n size:\t\t\t%u\n iterations:\t\t%u\n errors:\t\t%u\n async:\t\t\t%s\n",
436 t->use_async ? "Enabled" : "Disabled");
438 len += snprintf(&buf[len], buf_len - len,
439 " requests per-sec:\tmin=%u, max=%u, average=%f, jitter=%u\n",
445 len += snprintf(&buf[len], buf_len - len,
446 " ap-throughput B/s:\tmin=%u max=%u average=%f jitter=%u\n",
450 r->throughput_jitter);
451 len += snprintf(&buf[len], buf_len - len,
452 " ap-latency usec:\tmin=%u max=%u average=%f jitter=%u\n",
457 len += snprintf(&buf[len], buf_len - len,
458 " apbridge-latency usec:\tmin=%u max=%u average=%f jitter=%u\n",
459 r->apbridge_unipro_latency_min,
460 r->apbridge_unipro_latency_max,
461 r->apbridge_unipro_latency_avg,
462 r->apbridge_unipro_latency_jitter);
464 len += snprintf(&buf[len], buf_len - len,
465 " gbphy-latency usec:\tmin=%u max=%u average=%f jitter=%u\n",
466 r->gbphy_firmware_latency_min,
467 r->gbphy_firmware_latency_max,
468 r->gbphy_firmware_latency_avg,
469 r->gbphy_firmware_latency_jitter);
472 len += snprintf(&buf[len], buf_len - len, ",%s,%s,%u,%u,%u",
473 t->test_name, dev_name, t->size, t->iteration_max,
476 len += snprintf(&buf[len], buf_len - len, ",%u,%u,%f,%u",
482 len += snprintf(&buf[len], buf_len - len, ",%u,%u,%f,%u",
488 len += snprintf(&buf[len], buf_len - len, ",%u,%u,%f,%u",
492 r->throughput_jitter);
494 len += snprintf(&buf[len], buf_len - len, ",%u,%u,%f,%u",
495 r->apbridge_unipro_latency_min,
496 r->apbridge_unipro_latency_max,
497 r->apbridge_unipro_latency_avg,
498 r->apbridge_unipro_latency_jitter);
500 len += snprintf(&buf[len], buf_len - len, ",%u,%u,%f,%u",
501 r->gbphy_firmware_latency_min,
502 r->gbphy_firmware_latency_max,
503 r->gbphy_firmware_latency_avg,
504 r->gbphy_firmware_latency_jitter);
507 printf("\n%s\n", buf);
512 static int log_results(struct loopback_test *t)
517 char file_name[MAX_SYSFS_PATH];
518 char data[CSV_MAX_LINE];
520 local_time = time(NULL);
521 tm = *localtime(&local_time);
524 * file name will test_name_size_iteration_max.csv
525 * every time the same test with the same parameters is run we will then
526 * append to the same CSV with datestamp - representing each test
529 if (t->file_output && !t->porcelain) {
530 snprintf(file_name, sizeof(file_name), "%s_%d_%d.csv",
531 t->test_name, t->size, t->iteration_max);
533 fd = open(file_name, O_WRONLY | O_CREAT | O_APPEND, 0644);
535 fprintf(stderr, "unable to open %s for appendation\n", file_name);
540 for (i = 0; i < t->device_count; i++) {
541 if (!device_enabled(t, i))
544 len = format_output(t, &t->devices[i].results,
546 data, sizeof(data), &tm);
547 if (t->file_output && !t->porcelain) {
548 ret = write(fd, data, len);
550 fprintf(stderr, "unable to write %d bytes to csv.\n", len);
556 if (t->aggregate_output) {
557 len = format_output(t, &t->aggregate_results, "aggregate",
558 data, sizeof(data), &tm);
559 if (t->file_output && !t->porcelain) {
560 ret = write(fd, data, len);
562 fprintf(stderr, "unable to write %d bytes to csv.\n", len);
566 if (t->file_output && !t->porcelain)
572 int is_loopback_device(const char *path, const char *node)
574 char file[MAX_SYSFS_PATH];
576 snprintf(file, MAX_SYSFS_PATH, "%s%s/iteration_count", path, node);
577 if (access(file, F_OK) == 0)
582 int find_loopback_devices(struct loopback_test *t)
584 struct dirent **namelist;
587 struct loopback_device *d;
589 n = scandir(t->sysfs_prefix, &namelist, NULL, alphasort);
596 /* Don't include '.' and '..' */
602 for (i = 0; i < n; i++) {
603 ret = sscanf(namelist[i]->d_name, "gb_loopback%u", &dev_id);
607 if (!is_loopback_device(t->sysfs_prefix, namelist[i]->d_name))
610 if (t->device_count == MAX_NUM_DEVICES) {
611 fprintf(stderr, "max number of devices reached!\n");
615 d = &t->devices[t->device_count++];
616 snprintf(d->name, MAX_STR_LEN, "gb_loopback%u", dev_id);
618 snprintf(d->sysfs_entry, MAX_SYSFS_PATH, "%s%s/",
619 t->sysfs_prefix, d->name);
621 snprintf(d->debugfs_entry, MAX_SYSFS_PATH, "%sraw_latency_%s",
622 t->debugfs_prefix, d->name);
625 printf("add %s %s\n", d->sysfs_entry, d->debugfs_entry);
630 for (i = 0; i < n; i++)
637 static int open_poll_files(struct loopback_test *t)
639 struct loopback_device *dev;
640 char buf[MAX_STR_LEN];
645 for (i = 0; i < t->device_count; i++) {
646 dev = &t->devices[i];
648 if (!device_enabled(t, i))
651 snprintf(buf, sizeof(buf), "%s%s", dev->sysfs_entry, "iteration_count");
652 t->fds[fds_idx].fd = open(buf, O_RDONLY);
653 if (t->fds[fds_idx].fd < 0) {
654 fprintf(stderr, "Error opening poll file!\n");
657 read(t->fds[fds_idx].fd, &dummy, 1);
658 t->fds[fds_idx].events = EPOLLERR|EPOLLPRI;
659 t->fds[fds_idx].revents = 0;
663 t->poll_count = fds_idx;
668 for (i = 0; i < fds_idx; i++)
674 static int close_poll_files(struct loopback_test *t)
677 for (i = 0; i < t->poll_count; i++)
682 static int is_complete(struct loopback_test *t)
687 for (i = 0; i < t->device_count; i++) {
688 if (!device_enabled(t, i))
691 iteration_count = read_sysfs_int(t->devices[i].sysfs_entry,
694 /* at least one device did not finish yet */
695 if (iteration_count != t->iteration_max)
702 static void stop_tests(struct loopback_test *t)
706 for (i = 0; i < t->device_count; i++) {
707 if (!device_enabled(t, i))
709 write_sysfs_val(t->devices[i].sysfs_entry, "type", 0);
713 static void handler(int sig) { /* do nothing */ }
715 static int wait_for_complete(struct loopback_test *t)
717 int number_of_events = 0;
721 struct timespec *ts = NULL;
723 sigset_t mask_old, mask;
726 sigemptyset(&mask_old);
727 sigaddset(&mask, SIGINT);
728 sigprocmask(SIG_BLOCK, &mask, &mask_old);
730 sa.sa_handler = handler;
732 sigemptyset(&sa.sa_mask);
733 if (sigaction(SIGINT, &sa, NULL) == -1) {
734 fprintf(stderr, "sigaction error\n");
738 if (t->poll_timeout.tv_sec != 0)
739 ts = &t->poll_timeout;
743 ret = ppoll(t->fds, t->poll_count, ts, &mask_old);
746 fprintf(stderr, "Poll exit with errno %d\n", errno);
750 for (i = 0; i < t->poll_count; i++) {
751 if (t->fds[i].revents & EPOLLPRI) {
752 /* Dummy read to clear the event */
753 read(t->fds[i].fd, &dummy, 1);
758 if (number_of_events == t->poll_count)
762 if (!is_complete(t)) {
763 fprintf(stderr, "Iteration count did not finish!\n");
770 static void prepare_devices(struct loopback_test *t)
775 * Cancel any running tests on enabled devices. If
776 * stop_all option is given, stop test on all devices.
778 for (i = 0; i < t->device_count; i++)
779 if (t->stop_all || device_enabled(t, i))
780 write_sysfs_val(t->devices[i].sysfs_entry, "type", 0);
783 for (i = 0; i < t->device_count; i++) {
784 if (!device_enabled(t, i))
787 write_sysfs_val(t->devices[i].sysfs_entry, "us_wait",
790 /* Set operation size */
791 write_sysfs_val(t->devices[i].sysfs_entry, "size", t->size);
794 write_sysfs_val(t->devices[i].sysfs_entry, "iteration_max",
798 write_sysfs_val(t->devices[i].sysfs_entry, "async", 1);
799 write_sysfs_val(t->devices[i].sysfs_entry,
800 "timeout", t->async_timeout);
801 write_sysfs_val(t->devices[i].sysfs_entry,
802 "outstanding_operations_max",
803 t->async_outstanding_operations);
805 write_sysfs_val(t->devices[i].sysfs_entry, "async", 0);
809 static int start(struct loopback_test *t)
813 /* the test starts by writing test_id to the type file. */
814 for (i = 0; i < t->device_count; i++) {
815 if (!device_enabled(t, i))
818 write_sysfs_val(t->devices[i].sysfs_entry, "type", t->test_id);
825 void loopback_run(struct loopback_test *t)
830 for (i = 0; dict[i].name != NULL; i++) {
831 if (strstr(dict[i].name, t->test_name))
832 t->test_id = dict[i].type;
835 fprintf(stderr, "invalid test %s\n", t->test_name);
842 ret = open_poll_files(t);
848 ret = wait_for_complete(t);
861 printf("Error running test\n");
865 static int sanity_check(struct loopback_test *t)
869 if (t->device_count == 0) {
870 fprintf(stderr, "No loopback devices found\n");
874 for (i = 0; i < MAX_NUM_DEVICES; i++) {
875 if (!device_enabled(t, i))
878 if (t->mask && !strcmp(t->devices[i].name, "")) {
879 fprintf(stderr, "Bad device mask %x\n", (1 << i));
889 int main(int argc, char *argv[])
892 char *sysfs_prefix = "/sys/class/gb_loopback/";
893 char *debugfs_prefix = "/sys/kernel/debug/gb_loopback/";
895 memset(&t, 0, sizeof(t));
897 while ((o = getopt(argc, argv,
898 "t:s:i:S:D:m:v::d::r::p::a::l::x::o:O:c:w:z::f::")) != -1) {
901 snprintf(t.test_name, MAX_STR_LEN, "%s", optarg);
904 t.size = atoi(optarg);
907 t.iteration_max = atoi(optarg);
910 snprintf(t.sysfs_prefix, MAX_SYSFS_PATH, "%s", optarg);
913 snprintf(t.debugfs_prefix, MAX_SYSFS_PATH, "%s", optarg);
916 t.mask = atol(optarg);
931 t.aggregate_output = 1;
940 t.async_timeout = atoi(optarg);
943 t.poll_timeout.tv_sec = atoi(optarg);
946 t.async_outstanding_operations = atoi(optarg);
949 t.us_wait = atoi(optarg);
963 if (!strcmp(t.sysfs_prefix, ""))
964 snprintf(t.sysfs_prefix, MAX_SYSFS_PATH, "%s", sysfs_prefix);
966 if (!strcmp(t.debugfs_prefix, ""))
967 snprintf(t.debugfs_prefix, MAX_SYSFS_PATH, "%s", debugfs_prefix);
969 ret = find_loopback_devices(&t);
972 ret = sanity_check(&t);
976 if (t.list_devices) {
977 show_loopback_devices(&t);
981 if (t.test_name[0] == '\0' || t.iteration_max == 0)
984 if (t.async_timeout == 0)
985 t.async_timeout = DEFAULT_ASYNC_TIMEOUT;