tcp: Zero-copy receive from a socket into a bio
Subsystems (3)
RFC 2/3 tcp: Zero-copy receive from a socket into a bio
"Receive" data from a tcp socket by directly mapping sectors in the socket receive buffers into a bio without copying. This requires that the receive buffer contains contiguous sectors which are well-enough aligned for the block device associated with the bio.
Any data that cannot be mapped into the bio is left in the socket receive buffers and can be received conventionally, by copying it out of the buffers.
Signed-off-by Andreas Gruenbacher <[email protected]>
--- include/net/tcp.h | 3 + net/ipv4/Makefile | 3 +- net/ipv4/tcp_recvbio.c | 168 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 173 insertions(+), 1 deletion(-) create mode 100644 net/ipv4/tcp_recvbio.c
include/net/tcp.h +3 -0
@@ -538,6 +538,9 @@ typedef int (*sk_read_actor_t)(read_descriptor_t *, struct sk_buff *,extern int tcp_read_sock (struct sock *sk,read_descriptor_t *desc,sk_read_actor_t recv_actor); +/* tcp_recvbio.c */ +extern int tcp_recvbio (struct sock *sk,struct bio *bio,size_t size); +extern void tcp_initialize_rcv_mss (struct sock *sk);extern int tcp_mtu_to_mss (struct sock *sk,int pmtu);
net/ipv4/Makefile +2 -1
@@ -11,7 +11,8 @@ obj-y := route.o inetpeer.o protocol.o \ datagram.o raw.o udp.o udplite.o \ arp.o icmp.o devinet.o af_inet.o igmp.o \ fib_frontend.o fib_semantics.o fib_trie.o \ - inet_fragment.o ping.o + inet_fragment.o ping.o \ + tcp_recvbio.o obj-$(CONFIG_SYSCTL) += sysctl_net_ipv4.o obj-$(CONFIG_PROC_FS) += proc.o
net/ipv4/tcp_recvbio.c new file +168 -0
168 lines not on this page · raw message
Signature · 1 line
1.7.10.2