Skip to content

Commit b6b8653

Browse files
isilenceaxboe
authored andcommitted
tests: test both TCP ends in send zc tests
Test sending data from both ends of a TCP connection to tests any modifications need for zc in the accept path. Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/83dce097a9930b47788cc5c14a9f19b0f901146e.1666807018.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
1 parent 8f9c930 commit b6b8653

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test/send-zerocopy.c

+10-1
Original file line numberDiff line numberDiff line change
@@ -445,21 +445,30 @@ static int test_inet_send(struct io_uring *ring)
445445
int sock_client = -1, sock_server = -1;
446446
int ret, j, i;
447447

448-
for (j = 0; j < 16; j++) {
448+
for (j = 0; j < 32; j++) {
449449
bool ipv6 = j & 1;
450450
bool client_connect = j & 2;
451451
bool msg_zc_set = j & 4;
452452
bool tcp = j & 8;
453+
bool swap_sockets = j & 16;
453454

454455
if (tcp && !client_connect)
455456
continue;
457+
if (swap_sockets && !tcp)
458+
continue;
456459

457460
ret = prepare_ip(&addr, &sock_client, &sock_server, ipv6,
458461
client_connect, msg_zc_set, tcp);
459462
if (ret) {
460463
fprintf(stderr, "sock prep failed %d\n", ret);
461464
return 1;
462465
}
466+
if (swap_sockets) {
467+
int tmp_sock = sock_client;
468+
469+
sock_client = sock_server;
470+
sock_server = tmp_sock;
471+
}
463472

464473
for (i = 0; i < 4096; i++) {
465474
bool regbuf;

0 commit comments

Comments
 (0)