On Fri, Jul 11, 2025 at 10:27 AM John Fastabend <john.fastabend@xxxxxxxxx> wrote: > > On 2025-07-09 14:47:57, Vincent Whitchurch via B4 Relay wrote: > > From: Vincent Whitchurch <vincent.whitchurch@xxxxxxxxxxxxx> > > > > The TCP BPF code will need to override splice_read(), so add it to prot. > > > > Signed-off-by: Vincent Whitchurch <vincent.whitchurch@xxxxxxxxxxxxx> > > --- > > include/net/inet_common.h | 3 +++ > > include/net/sock.h | 3 +++ > > net/ipv4/af_inet.c | 13 ++++++++++++- > > net/ipv4/tcp_ipv4.c | 1 + > > net/ipv6/af_inet6.c | 2 +- > > net/ipv6/tcp_ipv6.c | 1 + > > 6 files changed, 21 insertions(+), 2 deletions(-) > > > > diff --git a/include/net/inet_common.h b/include/net/inet_common.h > > index c17a6585d0b0..2a6480d0d575 100644 > > --- a/include/net/inet_common.h > > +++ b/include/net/inet_common.h > > @@ -35,6 +35,9 @@ void __inet_accept(struct socket *sock, struct socket *newsock, > > struct sock *newsk); > > int inet_send_prepare(struct sock *sk); > > int inet_sendmsg(struct socket *sock, struct msghdr *msg, size_t size); > > +ssize_t inet_splice_read(struct socket *sk, loff_t *ppos, > > + struct pipe_inode_info *pipe, size_t len, > > + unsigned int flags); > > void inet_splice_eof(struct socket *sock); > > int inet_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, > > int flags); > > diff --git a/include/net/sock.h b/include/net/sock.h > > index 4c37015b7cf7..4bdebcbcca38 100644 > > --- a/include/net/sock.h > > +++ b/include/net/sock.h > > @@ -1280,6 +1280,9 @@ struct proto { > > size_t len); > > int (*recvmsg)(struct sock *sk, struct msghdr *msg, > > size_t len, int flags, int *addr_len); > > + ssize_t (*splice_read)(struct socket *sock, loff_t *ppos, > > + struct pipe_inode_info *pipe, size_t len, > > + unsigned int flags); > > void (*splice_eof)(struct socket *sock); > > int (*bind)(struct sock *sk, > > struct sockaddr *addr, int addr_len); > > diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c > > index 76e38092cd8a..9c521d252f66 100644 > > --- a/net/ipv4/af_inet.c > > +++ b/net/ipv4/af_inet.c > > @@ -868,6 +868,17 @@ void inet_splice_eof(struct socket *sock) > > } > > EXPORT_SYMBOL_GPL(inet_splice_eof); > > > > +ssize_t inet_splice_read(struct socket *sock, loff_t *ppos, > > + struct pipe_inode_info *pipe, size_t len, > > + unsigned int flags) > > +{ > > + struct sock *sk = sock->sk; > > + > > + return INDIRECT_CALL_1(sk->sk_prot->splice_read, tcp_splice_read, sock, > > + ppos, pipe, len, flags); > > +} > > Could we do a indirect_call_2 here? something like this? > > INDIRECT_CALL_2(sk->sk_prot->splice_read, tcp_splice_read ... > > Otherwise the series looks reasonable to me. What's the second candidate ? I think we should specify the built-in one and cannot use bpf one.