Skip to content

Commit c1cd734

Browse files
LorenzoBianconiborkmann
authored andcommitted
selftests/bpf: Improve error logs in XDP compliance test tool
Improve some error logs reported in the XDP compliance test tool. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/212fc5bd214ff706f6ef1acbe7272cf4d803ca9c.1678382940.git.lorenzo@kernel.org
1 parent 27a36bc commit c1cd734

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

tools/testing/selftests/bpf/xdp_features.c

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,20 +152,26 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
152152
case 'D':
153153
if (make_sockaddr(AF_INET6, arg, DUT_ECHO_PORT,
154154
&env.dut_addr, NULL)) {
155-
fprintf(stderr, "Invalid DUT address: %s\n", arg);
155+
fprintf(stderr,
156+
"Invalid address assigned to the Device Under Test: %s\n",
157+
arg);
156158
return ARGP_ERR_UNKNOWN;
157159
}
158160
break;
159161
case 'C':
160162
if (make_sockaddr(AF_INET6, arg, DUT_CTRL_PORT,
161163
&env.dut_ctrl_addr, NULL)) {
162-
fprintf(stderr, "Invalid DUT CTRL address: %s\n", arg);
164+
fprintf(stderr,
165+
"Invalid address assigned to the Device Under Test: %s\n",
166+
arg);
163167
return ARGP_ERR_UNKNOWN;
164168
}
165169
break;
166170
case 'T':
167171
if (make_sockaddr(AF_INET6, arg, 0, &env.tester_addr, NULL)) {
168-
fprintf(stderr, "Invalid Tester address: %s\n", arg);
172+
fprintf(stderr,
173+
"Invalid address assigned to the Tester device: %s\n",
174+
arg);
169175
return ARGP_ERR_UNKNOWN;
170176
}
171177
break;
@@ -454,7 +460,8 @@ static int dut_run(struct xdp_features *skel)
454460
&key, sizeof(key),
455461
&val, sizeof(val), 0);
456462
if (err) {
457-
fprintf(stderr, "bpf_map_lookup_elem failed\n");
463+
fprintf(stderr,
464+
"bpf_map_lookup_elem failed (%d)\n", err);
458465
goto end_thread;
459466
}
460467

@@ -496,7 +503,7 @@ static bool tester_collect_detected_cap(struct xdp_features *skel,
496503
err = bpf_map__lookup_elem(skel->maps.stats, &key, sizeof(key),
497504
&val, sizeof(val), 0);
498505
if (err) {
499-
fprintf(stderr, "bpf_map_lookup_elem failed\n");
506+
fprintf(stderr, "bpf_map_lookup_elem failed (%d)\n", err);
500507
return false;
501508
}
502509

@@ -574,7 +581,8 @@ static int tester_run(struct xdp_features *skel)
574581

575582
sockfd = socket(AF_INET6, SOCK_STREAM, 0);
576583
if (sockfd < 0) {
577-
fprintf(stderr, "Failed to create tester socket\n");
584+
fprintf(stderr,
585+
"Failed creating tester service control socket\n");
578586
return -errno;
579587
}
580588

@@ -584,7 +592,8 @@ static int tester_run(struct xdp_features *skel)
584592
err = connect(sockfd, (struct sockaddr *)&env.dut_ctrl_addr,
585593
sizeof(env.dut_ctrl_addr));
586594
if (err) {
587-
fprintf(stderr, "Failed to connect to the DUT\n");
595+
fprintf(stderr,
596+
"Failed connecting to the Device Under Test control socket\n");
588597
return -errno;
589598
}
590599

0 commit comments

Comments
 (0)