xref: /linux/io_uring/loop.h (revision 23acda7c221a76ff711d65f4ca90029d43b249a0)
1*033af2b3SPavel Begunkov // SPDX-License-Identifier: GPL-2.0
2*033af2b3SPavel Begunkov #ifndef IOU_LOOP_H
3*033af2b3SPavel Begunkov #define IOU_LOOP_H
4*033af2b3SPavel Begunkov 
5*033af2b3SPavel Begunkov #include <linux/io_uring_types.h>
6*033af2b3SPavel Begunkov 
7*033af2b3SPavel Begunkov struct iou_loop_params {
8*033af2b3SPavel Begunkov 	/*
9*033af2b3SPavel Begunkov 	 * The CQE index to wait for. Only serves as a hint and can still be
10*033af2b3SPavel Begunkov 	 * woken up earlier.
11*033af2b3SPavel Begunkov 	 */
12*033af2b3SPavel Begunkov 	__u32			cq_wait_idx;
13*033af2b3SPavel Begunkov };
14*033af2b3SPavel Begunkov 
15*033af2b3SPavel Begunkov enum {
16*033af2b3SPavel Begunkov 	IOU_LOOP_CONTINUE = 0,
17*033af2b3SPavel Begunkov 	IOU_LOOP_STOP,
18*033af2b3SPavel Begunkov };
19*033af2b3SPavel Begunkov 
io_has_loop_ops(struct io_ring_ctx * ctx)20*033af2b3SPavel Begunkov static inline bool io_has_loop_ops(struct io_ring_ctx *ctx)
21*033af2b3SPavel Begunkov {
22*033af2b3SPavel Begunkov 	return data_race(ctx->loop_step);
23*033af2b3SPavel Begunkov }
24*033af2b3SPavel Begunkov 
25*033af2b3SPavel Begunkov int io_run_loop(struct io_ring_ctx *ctx);
26*033af2b3SPavel Begunkov 
27*033af2b3SPavel Begunkov #endif
28