Skip to content

Commit 819630b

Browse files
isilenceaxboe
authored andcommitted
io_uring/zcrx: remove sync refill uapi
There is a better way to handle the problem IORING_REGISTER_ZCRX_REFILL solves. The uapi can also be slightly adjusted to accommodate future extensions. Remove the feature for now, it'll be reworked for the next release. Signed-off-by: Pavel Begunkov <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 6f1cbf6 commit 819630b

File tree

4 files changed

+0
-90
lines changed

4 files changed

+0
-90
lines changed

include/uapi/linux/io_uring.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -689,9 +689,6 @@ enum io_uring_register_op {
689689
/* query various aspects of io_uring, see linux/io_uring/query.h */
690690
IORING_REGISTER_QUERY = 35,
691691

692-
/* return zcrx buffers back into circulation */
693-
IORING_REGISTER_ZCRX_REFILL = 36,
694-
695692
/* this goes last */
696693
IORING_REGISTER_LAST,
697694

@@ -1073,15 +1070,6 @@ struct io_uring_zcrx_ifq_reg {
10731070
__u64 __resv[3];
10741071
};
10751072

1076-
struct io_uring_zcrx_sync_refill {
1077-
__u32 zcrx_id;
1078-
/* the number of entries to return */
1079-
__u32 nr_entries;
1080-
/* pointer to an array of struct io_uring_zcrx_rqe */
1081-
__u64 rqes;
1082-
__u64 __resv[2];
1083-
};
1084-
10851073
#ifdef __cplusplus
10861074
}
10871075
#endif

io_uring/register.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -827,9 +827,6 @@ static int __io_uring_register(struct io_ring_ctx *ctx, unsigned opcode,
827827
case IORING_REGISTER_QUERY:
828828
ret = io_query(ctx, arg, nr_args);
829829
break;
830-
case IORING_REGISTER_ZCRX_REFILL:
831-
ret = io_zcrx_return_bufs(ctx, arg, nr_args);
832-
break;
833830
default:
834831
ret = -EINVAL;
835832
break;

io_uring/zcrx.c

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -928,74 +928,6 @@ static const struct memory_provider_ops io_uring_pp_zc_ops = {
928928
.uninstall = io_pp_uninstall,
929929
};
930930

931-
#define IO_ZCRX_MAX_SYS_REFILL_BUFS (1 << 16)
932-
#define IO_ZCRX_SYS_REFILL_BATCH 32
933-
934-
static void io_return_buffers(struct io_zcrx_ifq *ifq,
935-
struct io_uring_zcrx_rqe *rqes, unsigned nr)
936-
{
937-
int i;
938-
939-
for (i = 0; i < nr; i++) {
940-
struct net_iov *niov;
941-
netmem_ref netmem;
942-
943-
if (!io_parse_rqe(&rqes[i], ifq, &niov))
944-
continue;
945-
946-
scoped_guard(spinlock_bh, &ifq->rq_lock) {
947-
if (!io_zcrx_put_niov_uref(niov))
948-
continue;
949-
}
950-
951-
netmem = net_iov_to_netmem(niov);
952-
if (!page_pool_unref_and_test(netmem))
953-
continue;
954-
io_zcrx_return_niov(niov);
955-
}
956-
}
957-
958-
int io_zcrx_return_bufs(struct io_ring_ctx *ctx,
959-
void __user *arg, unsigned nr_arg)
960-
{
961-
struct io_uring_zcrx_rqe rqes[IO_ZCRX_SYS_REFILL_BATCH];
962-
struct io_uring_zcrx_rqe __user *user_rqes;
963-
struct io_uring_zcrx_sync_refill zr;
964-
struct io_zcrx_ifq *ifq;
965-
unsigned nr, i;
966-
967-
if (nr_arg)
968-
return -EINVAL;
969-
if (copy_from_user(&zr, arg, sizeof(zr)))
970-
return -EFAULT;
971-
if (!zr.nr_entries || zr.nr_entries > IO_ZCRX_MAX_SYS_REFILL_BUFS)
972-
return -EINVAL;
973-
if (!mem_is_zero(&zr.__resv, sizeof(zr.__resv)))
974-
return -EINVAL;
975-
976-
ifq = xa_load(&ctx->zcrx_ctxs, zr.zcrx_id);
977-
if (!ifq)
978-
return -EINVAL;
979-
nr = zr.nr_entries;
980-
user_rqes = u64_to_user_ptr(zr.rqes);
981-
982-
for (i = 0; i < nr;) {
983-
unsigned batch = min(nr - i, IO_ZCRX_SYS_REFILL_BATCH);
984-
size_t size = batch * sizeof(rqes[0]);
985-
986-
if (copy_from_user(rqes, user_rqes + i, size))
987-
return i ? i : -EFAULT;
988-
io_return_buffers(ifq, rqes, batch);
989-
990-
i += batch;
991-
992-
if (fatal_signal_pending(current))
993-
return i;
994-
cond_resched();
995-
}
996-
return nr;
997-
}
998-
999931
static bool io_zcrx_queue_cqe(struct io_kiocb *req, struct net_iov *niov,
1000932
struct io_zcrx_ifq *ifq, int off, int len)
1001933
{

io_uring/zcrx.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ struct io_zcrx_ifq {
6363
};
6464

6565
#if defined(CONFIG_IO_URING_ZCRX)
66-
int io_zcrx_return_bufs(struct io_ring_ctx *ctx,
67-
void __user *arg, unsigned nr_arg);
6866
int io_register_zcrx_ifq(struct io_ring_ctx *ctx,
6967
struct io_uring_zcrx_ifq_reg __user *arg);
7068
void io_unregister_zcrx_ifqs(struct io_ring_ctx *ctx);
@@ -97,11 +95,6 @@ static inline struct io_mapped_region *io_zcrx_get_region(struct io_ring_ctx *ct
9795
{
9896
return NULL;
9997
}
100-
static inline int io_zcrx_return_bufs(struct io_ring_ctx *ctx,
101-
void __user *arg, unsigned nr_arg)
102-
{
103-
return -EOPNOTSUPP;
104-
}
10598
#endif
10699

107100
int io_recvzc(struct io_kiocb *req, unsigned int issue_flags);

0 commit comments

Comments
 (0)