Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

io_uring/net: move io_sr_msg->retry_flags to io_sr_msg->flags

There's plenty of space left, as sr->flags is a 16-bit type. The UAPI
bits are the lower 8 bits, as that's all that sqe->ioprio can carry in
the SQE anyway. Use a few of the upper 8 bits for internal uses, rather
than have two separate flags entries.

Link: https://lore.kernel.org/io-uring/20250709203420.1321689-2-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>

Jens Axboe 3919b695 e227c8cd

+15 -11
+15 -11
io_uring/net.c
··· 75 75 u16 flags; 76 76 /* initialised and used only by !msg send variants */ 77 77 u16 buf_group; 78 - unsigned short retry_flags; 79 78 void __user *msg_control; 80 79 /* used only for send zerocopy */ 81 80 struct io_kiocb *notif; 82 81 }; 83 82 83 + /* 84 + * The UAPI flags are the lower 8 bits, as that's all sqe->ioprio will hold 85 + * anyway. Use the upper 8 bits for internal uses. 86 + */ 84 87 enum sr_retry_flags { 85 - IO_SR_MSG_RETRY = 1, 86 - IO_SR_MSG_PARTIAL_MAP = 2, 88 + IORING_RECV_RETRY = (1U << 15), 89 + IORING_RECV_PARTIAL_MAP = (1U << 14), 90 + 91 + IORING_RECV_RETRY_CLEAR = IORING_RECV_RETRY | IORING_RECV_PARTIAL_MAP, 92 + IORING_RECV_NO_RETRY = IORING_RECV_RETRY | IORING_RECV_PARTIAL_MAP, 87 93 }; 88 94 89 95 /* ··· 198 192 199 193 req->flags &= ~REQ_F_BL_EMPTY; 200 194 sr->done_io = 0; 201 - sr->retry_flags = 0; 195 + sr->flags &= ~IORING_RECV_RETRY_CLEAR; 202 196 sr->len = 0; /* get from the provided buffer */ 203 197 } 204 198 ··· 408 402 struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg); 409 403 410 404 sr->done_io = 0; 411 - sr->retry_flags = 0; 412 405 sr->len = READ_ONCE(sqe->len); 413 406 sr->flags = READ_ONCE(sqe->ioprio); 414 407 if (sr->flags & ~SENDMSG_FLAGS) ··· 761 756 struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg); 762 757 763 758 sr->done_io = 0; 764 - sr->retry_flags = 0; 765 759 766 760 if (unlikely(sqe->file_index || sqe->addr2)) 767 761 return -EINVAL; ··· 832 828 833 829 cflags |= io_put_kbufs(req, this_ret, io_bundle_nbufs(kmsg, this_ret), 834 830 issue_flags); 835 - if (sr->retry_flags & IO_SR_MSG_RETRY) 831 + if (sr->flags & IORING_RECV_RETRY) 836 832 cflags = req->cqe.flags | (cflags & CQE_F_MASK); 837 833 /* bundle with no more immediate buffers, we're done */ 838 834 if (req->flags & REQ_F_BL_EMPTY) ··· 841 837 * If more is available AND it was a full transfer, retry and 842 838 * append to this one 843 839 */ 844 - if (!sr->retry_flags && kmsg->msg.msg_inq > 1 && this_ret > 0 && 840 + if (!(sr->flags & IORING_RECV_NO_RETRY) && 841 + kmsg->msg.msg_inq > 1 && this_ret > 0 && 845 842 !iov_iter_count(&kmsg->msg.msg_iter)) { 846 843 req->cqe.flags = cflags & ~CQE_F_MASK; 847 844 sr->len = kmsg->msg.msg_inq; 848 845 sr->done_io += this_ret; 849 - sr->retry_flags |= IO_SR_MSG_RETRY; 846 + sr->flags |= IORING_RECV_RETRY; 850 847 return false; 851 848 } 852 849 } else { ··· 1093 1088 req->flags |= REQ_F_NEED_CLEANUP; 1094 1089 } 1095 1090 if (arg.partial_map) 1096 - sr->retry_flags |= IO_SR_MSG_PARTIAL_MAP; 1091 + sr->flags |= IORING_RECV_PARTIAL_MAP; 1097 1092 1098 1093 /* special case 1 vec, can be a fast path */ 1099 1094 if (ret == 1) { ··· 1288 1283 int ret; 1289 1284 1290 1285 zc->done_io = 0; 1291 - zc->retry_flags = 0; 1292 1286 1293 1287 if (unlikely(READ_ONCE(sqe->__pad2[0]) || READ_ONCE(sqe->addr3))) 1294 1288 return -EINVAL;