| 347 | } |
| 348 | |
| 349 | static int __do_send_bundle(struct recv_data *rd, struct io_uring *ring, int sockfd) |
| 350 | { |
| 351 | struct io_uring_cqe *cqe; |
| 352 | int bytes_needed = MSG_SIZE * nr_msgs; |
| 353 | int i, ret; |
| 354 | |
| 355 | submit_bundle(ring, sockfd); |
| 356 | |
| 357 | pthread_barrier_wait(&rd->barrier); |
| 358 | |
| 359 | for (i = 0; i < nr_msgs; i++) { |
| 360 | ret = io_uring_wait_cqe(ring, &cqe); |
| 361 | if (ret) { |
| 362 | fprintf(stderr, "wait send: %d\n", ret); |
| 363 | return 1; |
| 364 | } |
| 365 | if (!i && cqe->res == -EINVAL) { |
| 366 | rd->abort = 1; |
| 367 | no_send_mshot = 1; |
| 368 | break; |
| 369 | } |
| 370 | if (cqe->res < 0) { |
| 371 | fprintf(stderr, "bad send cqe res: %d\n", cqe->res); |
| 372 | return 1; |
| 373 | } |
| 374 | bytes_needed -= cqe->res; |
| 375 | if (!bytes_needed) { |
| 376 | io_uring_cqe_seen(ring, cqe); |
| 377 | break; |
| 378 | } |
| 379 | /* bundle finished, resubmit as more is pending */ |
| 380 | if (!(cqe->flags & IORING_CQE_F_MORE)) |
| 381 | submit_bundle(ring, sockfd); |
| 382 | io_uring_cqe_seen(ring, cqe); |
| 383 | } |
| 384 | |
| 385 | return 0; |
| 386 | } |
| 387 | |
| 388 | static int __do_send(struct recv_data *rd, struct io_uring *ring, int sockfd) |
| 389 | { |
no test coverage detected