Commit fb6328bc authored by Jens Axboe's avatar Jens Axboe

io_uring/net: simplify msghd->msg_inq checking

Just check for larger than zero rather than check for non-zero and
not -1. This is easier to read, and also protects against any errants
< 0 values that aren't -1.
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 186daf23
...@@ -697,7 +697,7 @@ static inline bool io_recv_finish(struct io_kiocb *req, int *ret, ...@@ -697,7 +697,7 @@ static inline bool io_recv_finish(struct io_kiocb *req, int *ret,
unsigned int cflags; unsigned int cflags;
cflags = io_put_kbuf(req, issue_flags); cflags = io_put_kbuf(req, issue_flags);
if (msg->msg_inq && msg->msg_inq != -1) if (msg->msg_inq > 0)
cflags |= IORING_CQE_F_SOCK_NONEMPTY; cflags |= IORING_CQE_F_SOCK_NONEMPTY;
if (!(req->flags & REQ_F_APOLL_MULTISHOT)) { if (!(req->flags & REQ_F_APOLL_MULTISHOT)) {
...@@ -720,7 +720,7 @@ static inline bool io_recv_finish(struct io_kiocb *req, int *ret, ...@@ -720,7 +720,7 @@ static inline bool io_recv_finish(struct io_kiocb *req, int *ret,
io_recv_prep_retry(req); io_recv_prep_retry(req);
/* Known not-empty or unknown state, retry */ /* Known not-empty or unknown state, retry */
if (cflags & IORING_CQE_F_SOCK_NONEMPTY || msg->msg_inq == -1) { if (cflags & IORING_CQE_F_SOCK_NONEMPTY || msg->msg_inq < 0) {
if (sr->nr_multishot_loops++ < MULTISHOT_MAX_RETRY) if (sr->nr_multishot_loops++ < MULTISHOT_MAX_RETRY)
return false; return false;
/* mshot retries exceeded, force a requeue */ /* mshot retries exceeded, force a requeue */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment