| ... | @@ -3503,10 +3503,6 @@ test "accept multishot" { | ... | @@ -3503,10 +3503,6 @@ test "accept multishot" { |
| 3503 | } | 3503 | } |
| 3504 | | 3504 | |
| 3505 | test "accept/connect/send_zc/recv" { | 3505 | test "accept/connect/send_zc/recv" { |
| 3506 | if (true) { | | |
| 3507 | // https://github.com/ziglang/zig/issues/20212 | | |
| 3508 | return error.SkipZigTest; | | |
| 3509 | } | | |
| 3510 | try skipKernelLessThan(.{ .major = 6, .minor = 0, .patch = 0 }); | 3506 | try skipKernelLessThan(.{ .major = 6, .minor = 0, .patch = 0 }); |
| 3511 | | 3507 | |
| 3512 | var ring = IoUring.init(16, 0) catch |err| switch (err) { | 3508 | var ring = IoUring.init(16, 0) catch |err| switch (err) { |
| ... | @@ -3528,25 +3524,28 @@ test "accept/connect/send_zc/recv" { | ... | @@ -3528,25 +3524,28 @@ test "accept/connect/send_zc/recv" { |
| 3528 | _ = try ring.recv(0xffffffff, socket_test_harness.server, .{ .buffer = buffer_recv[0..] }, 0); | 3524 | _ = try ring.recv(0xffffffff, socket_test_harness.server, .{ .buffer = buffer_recv[0..] }, 0); |
| 3529 | try testing.expectEqual(@as(u32, 2), try ring.submit()); | 3525 | try testing.expectEqual(@as(u32, 2), try ring.submit()); |
| 3530 | | 3526 | |
| | 3527 | var cqe_send, const cqe_recv = brk: { |
| | 3528 | const cqe1 = try ring.copy_cqe(); |
| | 3529 | const cqe2 = try ring.copy_cqe(); |
| | 3530 | break :brk if (cqe1.user_data == 0xeeeeeeee) .{ cqe1, cqe2 } else .{ cqe2, cqe1 }; |
| | 3531 | }; |
| | 3532 | |
| 3531 | // First completion of zero-copy send. | 3533 | // First completion of zero-copy send. |
| 3532 | // IORING_CQE_F_MORE, means that there | 3534 | // IORING_CQE_F_MORE, means that there |
| 3533 | // will be a second completion event / notification for the | 3535 | // will be a second completion event / notification for the |
| 3534 | // request, with the user_data field set to the same value. | 3536 | // request, with the user_data field set to the same value. |
| 3535 | // buffer_send must be keep alive until second cqe. | 3537 | // buffer_send must be keep alive until second cqe. |
| 3536 | var cqe_send = try ring.copy_cqe(); | | |
| 3537 | try testing.expectEqual(linux.io_uring_cqe{ | 3538 | try testing.expectEqual(linux.io_uring_cqe{ |
| 3538 | .user_data = 0xeeeeeeee, | 3539 | .user_data = 0xeeeeeeee, |
| 3539 | .res = buffer_send.len, | 3540 | .res = buffer_send.len, |
| 3540 | .flags = linux.IORING_CQE_F_MORE, | 3541 | .flags = linux.IORING_CQE_F_MORE, |
| 3541 | }, cqe_send); | 3542 | }, cqe_send); |
| 3542 | | 3543 | |
| 3543 | const cqe_recv = try ring.copy_cqe(); | | |
| 3544 | try testing.expectEqual(linux.io_uring_cqe{ | 3544 | try testing.expectEqual(linux.io_uring_cqe{ |
| 3545 | .user_data = 0xffffffff, | 3545 | .user_data = 0xffffffff, |
| 3546 | .res = buffer_recv.len, | 3546 | .res = buffer_recv.len, |
| 3547 | .flags = cqe_recv.flags & linux.IORING_CQE_F_SOCK_NONEMPTY, | 3547 | .flags = cqe_recv.flags & linux.IORING_CQE_F_SOCK_NONEMPTY, |
| 3548 | }, cqe_recv); | 3548 | }, cqe_recv); |
| 3549 | | | |
| 3550 | try testing.expectEqualSlices(u8, buffer_send[0..buffer_recv.len], buffer_recv[0..]); | 3549 | try testing.expectEqualSlices(u8, buffer_send[0..buffer_recv.len], buffer_recv[0..]); |
| 3551 | | 3550 | |
| 3552 | // Second completion of zero-copy send. | 3551 | // Second completion of zero-copy send. |