batch ioevent_uring_submit for RDMA network
parent
de80dc19dc
commit
065184a203
|
|
@ -138,7 +138,8 @@ int ioevent_attach(IOEventPoller *ioevent, const int fd,
|
||||||
}
|
}
|
||||||
io_uring_prep_poll_multishot(sqe, fd, e | ioevent->extra_events);
|
io_uring_prep_poll_multishot(sqe, fd, e | ioevent->extra_events);
|
||||||
sqe->user_data = (long)data;
|
sqe->user_data = (long)data;
|
||||||
return ioevent_uring_submit(ioevent);
|
ioevent->submit_count++;
|
||||||
|
return 0;
|
||||||
#elif IOEVENT_USE_KQUEUE
|
#elif IOEVENT_USE_KQUEUE
|
||||||
struct kevent ev[2];
|
struct kevent ev[2];
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
@ -174,7 +175,8 @@ int ioevent_modify(IOEventPoller *ioevent, const int fd,
|
||||||
io_uring_prep_poll_update(sqe, sqe->user_data, sqe->user_data,
|
io_uring_prep_poll_update(sqe, sqe->user_data, sqe->user_data,
|
||||||
e | ioevent->extra_events, IORING_POLL_UPDATE_EVENTS);
|
e | ioevent->extra_events, IORING_POLL_UPDATE_EVENTS);
|
||||||
sqe->user_data = (long)data;
|
sqe->user_data = (long)data;
|
||||||
return ioevent_uring_submit(ioevent);
|
ioevent->submit_count++;
|
||||||
|
return 0;
|
||||||
#elif IOEVENT_USE_KQUEUE
|
#elif IOEVENT_USE_KQUEUE
|
||||||
struct kevent ev[2];
|
struct kevent ev[2];
|
||||||
int result;
|
int result;
|
||||||
|
|
@ -219,7 +221,8 @@ int ioevent_detach(IOEventPoller *ioevent, const int fd)
|
||||||
io_uring_prep_cancel_fd(sqe, fd, 0);
|
io_uring_prep_cancel_fd(sqe, fd, 0);
|
||||||
/* set sqe->flags MUST after io_uring_prep_xxx */
|
/* set sqe->flags MUST after io_uring_prep_xxx */
|
||||||
sqe->flags = IOSQE_CQE_SKIP_SUCCESS;
|
sqe->flags = IOSQE_CQE_SKIP_SUCCESS;
|
||||||
return ioevent_uring_submit(ioevent);
|
ioevent->submit_count++;
|
||||||
|
return 0;
|
||||||
#elif IOEVENT_USE_KQUEUE
|
#elif IOEVENT_USE_KQUEUE
|
||||||
struct kevent ev[1];
|
struct kevent ev[1];
|
||||||
int r, w;
|
int r, w;
|
||||||
|
|
|
||||||
|
|
@ -201,6 +201,17 @@ int ioevent_loop(struct nio_thread_data *thread_data,
|
||||||
sched_pull = true;
|
sched_pull = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if IOEVENT_USE_URING
|
||||||
|
if (thread_data->ev_puller.submit_count > 0) {
|
||||||
|
if ((result=ioevent_uring_submit(&thread_data->ev_puller)) != 0) {
|
||||||
|
logError("file: "__FILE__", line: %d, "
|
||||||
|
"io_uring_submit fail, errno: %d, error info: %s",
|
||||||
|
__LINE__, result, STRERROR(result));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (sched_pull) {
|
if (sched_pull) {
|
||||||
if ((result=ioevent_process(&thread_data->ev_puller)) != 0) {
|
if ((result=ioevent_process(&thread_data->ev_puller)) != 0) {
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -258,17 +269,6 @@ int ioevent_loop(struct nio_thread_data *thread_data,
|
||||||
if (thread_data->thread_loop_callback != NULL) {
|
if (thread_data->thread_loop_callback != NULL) {
|
||||||
thread_data->thread_loop_callback(thread_data);
|
thread_data->thread_loop_callback(thread_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if IOEVENT_USE_URING
|
|
||||||
if (thread_data->ev_puller.submit_count > 0) {
|
|
||||||
if ((result=ioevent_uring_submit(&thread_data->ev_puller)) != 0) {
|
|
||||||
logError("file: "__FILE__", line: %d, "
|
|
||||||
"io_uring_submit fail, errno: %d, error info: %s",
|
|
||||||
__LINE__, result, STRERROR(result));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue