io_uring/net.c

Source file repositories/reference/linux-study-clean/io_uring/net.c

File Facts

System
Linux kernel
Corpus path
io_uring/net.c
Extension
.c
Size
51947 bytes
Lines
1978
Domain
Kernel Services
Bucket
io_uring
Inferred role
Kernel Services: implementation source
Status
source implementation candidate

Why This File Exists

Shared kernel service surface used by multiple subsystems, including helpers, cryptography, virtualization support, and async I/O infrastructure.

Dependency Surface

Detected Declarations

Annotated Snippet

struct io_shutdown {
	struct file			*file;
	int				how;
};

struct io_accept {
	struct file			*file;
	struct sockaddr __user		*addr;
	int __user			*addr_len;
	int				flags;
	int				iou_flags;
	u32				file_slot;
	unsigned long			nofile;
};

struct io_socket {
	struct file			*file;
	int				domain;
	int				type;
	int				protocol;
	int				flags;
	u32				file_slot;
	unsigned long			nofile;
};

struct io_connect {
	struct file			*file;
	struct sockaddr __user		*addr;
	int				addr_len;
	bool				in_progress;
	bool				seen_econnaborted;
};

struct io_bind {
	struct file			*file;
	int				addr_len;
};

struct io_listen {
	struct file			*file;
	int				backlog;
};

struct io_sr_msg {
	struct file			*file;
	union {
		struct compat_msghdr __user	*umsg_compat;
		struct user_msghdr __user	*umsg;
		void __user			*buf;
	};
	int				len;
	unsigned			done_io;
	unsigned			msg_flags;
	unsigned			nr_multishot_loops;
	u16				flags;
	/* initialised and used only by !msg send variants */
	u16				buf_group;
	/* per-invocation mshot limit */
	unsigned			mshot_len;
	/* overall mshot byte limit */
	unsigned			mshot_total_len;
	void __user			*msg_control;
	/* used only for send zerocopy */
	struct io_kiocb 		*notif;
};

/*
 * The UAPI flags are the lower 8 bits, as that's all sqe->ioprio will hold
 * anyway. Use the upper 8 bits for internal uses.
 */
enum sr_retry_flags {
	IORING_RECV_RETRY	= (1U << 15),
	IORING_RECV_PARTIAL_MAP	= (1U << 14),
	IORING_RECV_MSHOT_CAP	= (1U << 13),
	IORING_RECV_MSHOT_LIM	= (1U << 12),
	IORING_RECV_MSHOT_DONE	= (1U << 11),

	IORING_RECV_RETRY_CLEAR	= IORING_RECV_RETRY | IORING_RECV_PARTIAL_MAP,
	IORING_RECV_NO_RETRY	= IORING_RECV_RETRY | IORING_RECV_PARTIAL_MAP |
				  IORING_RECV_MSHOT_CAP | IORING_RECV_MSHOT_DONE,
};

/*
 * Number of times we'll try and do receives if there's more data. If we
 * exceed this limit, then add us to the back of the queue and retry from
 * there. This helps fairness between flooding clients.
 */
#define MULTISHOT_MAX_RETRY	32

struct io_recvzc {

Annotation

Implementation Notes