* [PATCH for-next] io_uring: separate header for exported net bits
@ 2024-04-09 21:05 David Wei
2024-04-10 2:39 ` Jens Axboe
2024-04-10 2:39 ` Jens Axboe
0 siblings, 2 replies; 3+ messages in thread
From: David Wei @ 2024-04-09 21:05 UTC (permalink / raw)
To: io-uring; +Cc: Jens Axboe, Pavel Begunkov
From: Pavel Begunkov <[email protected]>
From: Pavel Begunkov <[email protected]>
We're exporting some io_uring bits to networking, e.g. for implementing
a net callback for io_uring cmds, but we don't want to expose more than
needed. Add a separate header for networking.
Signed-off-by: Pavel Begunkov <[email protected]>
(cherry picked from commit 9218ba39c2bf0e7bb44e88968801cdc4e6e9fb3e)
Signed-off-by: David Wei <[email protected]>
---
David: This has been pulled out from ZC Rx patchset as it can be merged
separately.
---
include/linux/io_uring.h | 6 ------
include/linux/io_uring/net.h | 18 ++++++++++++++++++
io_uring/uring_cmd.c | 1 +
net/socket.c | 2 +-
4 files changed, 20 insertions(+), 7 deletions(-)
create mode 100644 include/linux/io_uring/net.h
diff --git a/include/linux/io_uring.h b/include/linux/io_uring.h
index 68ed6697fece..e123d5e17b52 100644
--- a/include/linux/io_uring.h
+++ b/include/linux/io_uring.h
@@ -11,7 +11,6 @@ void __io_uring_cancel(bool cancel_all);
void __io_uring_free(struct task_struct *tsk);
void io_uring_unreg_ringfd(void);
const char *io_uring_get_opcode(u8 opcode);
-int io_uring_cmd_sock(struct io_uring_cmd *cmd, unsigned int issue_flags);
bool io_is_uring_fops(struct file *file);
static inline void io_uring_files_cancel(void)
@@ -45,11 +44,6 @@ static inline const char *io_uring_get_opcode(u8 opcode)
{
return "";
}
-static inline int io_uring_cmd_sock(struct io_uring_cmd *cmd,
- unsigned int issue_flags)
-{
- return -EOPNOTSUPP;
-}
static inline bool io_is_uring_fops(struct file *file)
{
return false;
diff --git a/include/linux/io_uring/net.h b/include/linux/io_uring/net.h
new file mode 100644
index 000000000000..b58f39fed4d5
--- /dev/null
+++ b/include/linux/io_uring/net.h
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#ifndef _LINUX_IO_URING_NET_H
+#define _LINUX_IO_URING_NET_H
+
+struct io_uring_cmd;
+
+#if defined(CONFIG_IO_URING)
+int io_uring_cmd_sock(struct io_uring_cmd *cmd, unsigned int issue_flags);
+
+#else
+static inline int io_uring_cmd_sock(struct io_uring_cmd *cmd,
+ unsigned int issue_flags)
+{
+ return -EOPNOTSUPP;
+}
+#endif
+
+#endif
diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c
index 334d31dd6628..21ac5fb2d5f0 100644
--- a/io_uring/uring_cmd.c
+++ b/io_uring/uring_cmd.c
@@ -3,6 +3,7 @@
#include <linux/errno.h>
#include <linux/file.h>
#include <linux/io_uring/cmd.h>
+#include <linux/io_uring/net.h>
#include <linux/security.h>
#include <linux/nospec.h>
#include <net/sock.h>
diff --git a/net/socket.c b/net/socket.c
index e5f3af49a8b6..01a71ae10c35 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -88,7 +88,7 @@
#include <linux/xattr.h>
#include <linux/nospec.h>
#include <linux/indirect_call_wrapper.h>
-#include <linux/io_uring.h>
+#include <linux/io_uring/net.h>
#include <linux/uaccess.h>
#include <asm/unistd.h>
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH for-next] io_uring: separate header for exported net bits
2024-04-09 21:05 [PATCH for-next] io_uring: separate header for exported net bits David Wei
@ 2024-04-10 2:39 ` Jens Axboe
2024-04-10 2:39 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2024-04-10 2:39 UTC (permalink / raw)
To: David Wei, io-uring; +Cc: Pavel Begunkov
On 4/9/24 3:05 PM, David Wei wrote:
> (cherry picked from commit 9218ba39c2bf0e7bb44e88968801cdc4e6e9fb3e)
This one doesn't make any sense for the commit message, as it's some sha
from a tree that nobody knows about. Not a big deal, I axed it from the
commit message, just mentioning it for future patches.
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH for-next] io_uring: separate header for exported net bits
2024-04-09 21:05 [PATCH for-next] io_uring: separate header for exported net bits David Wei
2024-04-10 2:39 ` Jens Axboe
@ 2024-04-10 2:39 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2024-04-10 2:39 UTC (permalink / raw)
To: io-uring, David Wei; +Cc: Pavel Begunkov
On Tue, 09 Apr 2024 14:05:53 -0700, David Wei wrote:
> From: Pavel Begunkov <[email protected]>
>
> We're exporting some io_uring bits to networking, e.g. for implementing
> a net callback for io_uring cmds, but we don't want to expose more than
> needed. Add a separate header for networking.
>
> (cherry picked from commit 9218ba39c2bf0e7bb44e88968801cdc4e6e9fb3e)
>
> [...]
Applied, thanks!
[1/1] io_uring: separate header for exported net bits
commit: fb34c62057a7d040dedb3169f5fab9b9d341a561
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-04-10 2:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-09 21:05 [PATCH for-next] io_uring: separate header for exported net bits David Wei
2024-04-10 2:39 ` Jens Axboe
2024-04-10 2:39 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox