| 431 | } |
| 432 | |
| 433 | static int __prep_server(struct t_executor *ctx, unsigned config_flags) |
| 434 | { |
| 435 | struct io_uring_zcrx_ifq_reg *zcrx_reg = &ctx->reg.zcrx; |
| 436 | char *rqp; |
| 437 | int ret; |
| 438 | |
| 439 | ret = t_create_ring(128, &ctx->ring, RING_FLAGS); |
| 440 | if (ret != T_SETUP_OK) { |
| 441 | fprintf(stderr, "ring create failed: %d\n", ret); |
| 442 | return -1; |
| 443 | } |
| 444 | |
| 445 | default_reg(&ctx->reg, config_flags); |
| 446 | rqp = (char *)(uintptr_t)ctx->reg.rq_region.user_addr; |
| 447 | memset(rqp, 0, get_rq_size(0)); |
| 448 | |
| 449 | ret = io_uring_register_ifq(&ctx->ring, zcrx_reg); |
| 450 | if (ret) { |
| 451 | fprintf(stderr, "Can't register zcrx %i\n", ret); |
| 452 | return ret; |
| 453 | } |
| 454 | |
| 455 | ctx->rq.khead = (unsigned int *)((char *)rqp + zcrx_reg->offsets.head); |
| 456 | ctx->rq.ktail = (unsigned int *)((char *)rqp + zcrx_reg->offsets.tail); |
| 457 | ctx->rq.rqes = (struct io_uring_zcrx_rqe *)((char *)rqp + zcrx_reg->offsets.rqes); |
| 458 | ctx->rq.rq_tail = 0; |
| 459 | ctx->rq.ring_entries = zcrx_reg->rq_entries; |
| 460 | |
| 461 | ret = t_create_socket_pair(ctx->fds, true); |
| 462 | if (ret) { |
| 463 | fprintf(stderr, "t_create_socket_pair failed: %d\n", ret); |
| 464 | return ret; |
| 465 | } |
| 466 | |
| 467 | return 0; |
| 468 | } |
| 469 | |
| 470 | static int prep_server(struct t_executor *ctx) |
| 471 | { |