diff options
author | Jon Maloy <jmaloy@redhat.com> | 2024-07-12 15:04:49 -0400 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-07-15 17:57:03 +0200 |
commit | e63d281871efff5e411275ce2ba1509314c75898 (patch) | |
tree | 72b7c84dfd19ec2bf936f72a72adebd07307d027 /tcp.h | |
parent | 8bd57bf25bab5ad14bd43242558243b20b49f80e (diff) | |
download | passt-e63d281871efff5e411275ce2ba1509314c75898.tar passt-e63d281871efff5e411275ce2ba1509314c75898.tar.gz passt-e63d281871efff5e411275ce2ba1509314c75898.tar.bz2 passt-e63d281871efff5e411275ce2ba1509314c75898.tar.lz passt-e63d281871efff5e411275ce2ba1509314c75898.tar.xz passt-e63d281871efff5e411275ce2ba1509314c75898.tar.zst passt-e63d281871efff5e411275ce2ba1509314c75898.zip |
tcp: leverage support of SO_PEEK_OFF socket option when available
>From linux-6.9.0 the kernel will contain
commit 05ea491641d3 ("tcp: add support for SO_PEEK_OFF socket option").
This new feature makes is possible to call recv_msg(MSG_PEEK) and make
it start reading data from a given offset set by the SO_PEEK_OFF socket
option. This way, we can avoid repeated reading of already read bytes of
a received message, hence saving read cycles when forwarding TCP
messages in the host->name space direction.
In this commit, we add functionality to leverage this feature when
available, while we fall back to the previous behavior when not.
Measurements with iperf3 shows that throughput increases with 15-20
percent in the host->namespace direction when this feature is used.
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tcp.h')
-rw-r--r-- | tcp.h | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -24,6 +24,9 @@ void tcp_timer(struct ctx *c, const struct timespec *now); void tcp_defer_handler(struct ctx *c); void tcp_update_l2_buf(const unsigned char *eth_d, const unsigned char *eth_s); +int tcp_set_peek_offset(int s, int offset); + +extern bool peek_offset_cap; /** * union tcp_epoll_ref - epoll reference portion for TCP connections |