diff --git a/transport-native-io_uring/src/main/c/netty_io_uring_native.c b/transport-native-io_uring/src/main/c/netty_io_uring_native.c index 4663493de9..c2ce2e860b 100644 --- a/transport-native-io_uring/src/main/c/netty_io_uring_native.c +++ b/transport-native-io_uring/src/main/c/netty_io_uring_native.c @@ -381,6 +381,10 @@ static jint netty_io_uring_ioringOpConnect(JNIEnv* env, jclass clazz) { return IORING_OP_CONNECT; } +static jint netty_io_uring_iosqeAsync(JNIEnv* env, jclass clazz) { + return IOSQE_ASYNC; +} + // JNI Method Registration Table Begin static const JNINativeMethod statically_referenced_fixed_method_table[] = { { "sockNonblock", "()I", (void *) netty_io_uring_sockNonblock }, @@ -395,7 +399,8 @@ static const JNINativeMethod statically_referenced_fixed_method_table[] = { { "ioringOpAccept", "()I", (void *) netty_io_uring_ioringOpAccept }, { "ioringOpRead", "()I", (void *) netty_io_uring_ioringOpRead }, { "ioringOpWrite", "()I", (void *) netty_io_uring_ioringOpWrite }, - { "ioringOpConnect", "()I", (void *) netty_io_uring_ioringOpConnect } + { "ioringOpConnect", "()I", (void *) netty_io_uring_ioringOpConnect }, + { "iosqeAsync", "()I", (void *) netty_io_uring_iosqeAsync } }; static const jint statically_referenced_fixed_method_table_size = sizeof(statically_referenced_fixed_method_table) / sizeof(statically_referenced_fixed_method_table[0]); diff --git a/transport-native-io_uring/src/main/java/io/netty/channel/uring/IOUringSubmissionQueue.java b/transport-native-io_uring/src/main/java/io/netty/channel/uring/IOUringSubmissionQueue.java index e74342d221..f7d66c8360 100644 --- a/transport-native-io_uring/src/main/java/io/netty/channel/uring/IOUringSubmissionQueue.java +++ b/transport-native-io_uring/src/main/java/io/netty/channel/uring/IOUringSubmissionQueue.java @@ -136,9 +136,8 @@ final class IOUringSubmissionQueue { } } - PlatformDependent.putByte(sqe + SQE_FLAGS_FIELD, (byte) 0); - - + // TODO: Make it configurable if we should use this flag or not. + PlatformDependent.putByte(sqe + SQE_FLAGS_FIELD, (byte) Native.IOSQE_ASYNC); // pad field array -> all fields should be zero long offsetIndex = 0; diff --git a/transport-native-io_uring/src/main/java/io/netty/channel/uring/Native.java b/transport-native-io_uring/src/main/java/io/netty/channel/uring/Native.java index 3d7572b94b..78b0b3cc62 100644 --- a/transport-native-io_uring/src/main/java/io/netty/channel/uring/Native.java +++ b/transport-native-io_uring/src/main/java/io/netty/channel/uring/Native.java @@ -77,6 +77,7 @@ final class Native { static final int IORING_OP_POLL_REMOVE = NativeStaticallyReferencedJniMethods.ioringOpPollRemove(); static final int IORING_OP_CONNECT = NativeStaticallyReferencedJniMethods.ioringOpConnect(); static final int IORING_OP_WRITEV = NativeStaticallyReferencedJniMethods.ioringOpWritev(); + static final int IOSQE_ASYNC = NativeStaticallyReferencedJniMethods.iosqeAsync(); public static RingBuffer createRingBuffer(int ringSize) { //Todo throw Exception if it's null diff --git a/transport-native-io_uring/src/main/java/io/netty/channel/uring/NativeStaticallyReferencedJniMethods.java b/transport-native-io_uring/src/main/java/io/netty/channel/uring/NativeStaticallyReferencedJniMethods.java index 1539516c2f..81dc182da1 100644 --- a/transport-native-io_uring/src/main/java/io/netty/channel/uring/NativeStaticallyReferencedJniMethods.java +++ b/transport-native-io_uring/src/main/java/io/netty/channel/uring/NativeStaticallyReferencedJniMethods.java @@ -44,4 +44,5 @@ final class NativeStaticallyReferencedJniMethods { static native int ioringOpRead(); static native int ioringOpWrite(); static native int ioringOpConnect(); + static native int iosqeAsync(); }