@@ -119,6 +119,8 @@
#define SO_DETACH_REUSEPORT_BPF 68
+#define SO_REGISTER_DMA 69
+
#if !defined(__KERNEL__)
#if __BITS_PER_LONG == 64 || (defined(__x86_64__) && defined(__ILP32__))
@@ -828,6 +828,25 @@ void sock_set_rcvbuf(struct sock *sk, int val)
}
EXPORT_SYMBOL(sock_set_rcvbuf);
+extern int netgpu_register_dma(struct sock *sk, char __user *optval, unsigned int optlen);
+
+static int
+sock_register_dma(struct sock *sk, char __user *optval, unsigned int optlen)
+{
+ int rc;
+ int (*fn)(struct sock *sk, char __user *optval, unsigned int optlen);
+
+ fn = symbol_get(netgpu_register_dma);
+ if (!fn)
+ return -EINVAL;
+
+ rc = fn(sk, optval, optlen);
+
+ symbol_put(netgpu_register_dma);
+
+ return rc;
+}
+
/*
* This is meant for all protocols to use and covers goings on
* at the socket level. Everything here is generic.
@@ -1232,6 +1251,13 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
}
break;
+ case SO_REGISTER_DMA:
+ if (!sk->sk_bound_dev_if)
+ ret = -EINVAL;
+ else
+ ret = sock_register_dma(sk, optval, optlen);
+ break;
+
case SO_TXTIME:
if (optlen != sizeof(struct sock_txtime)) {
ret = -EINVAL;
This option says that the socket will be performing zero copy sends and receives through the netgpu module. Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com> --- include/uapi/asm-generic/socket.h | 2 ++ net/core/sock.c | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+)