From 02e092b4feb8abf9f9beb77a9155ad75b0e4e3d5 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Tue, 16 Jan 2024 11:50:38 +1100 Subject: tcp, tcp_splice: Avoid double layered dispatch for connected TCP sockets Currently connected TCP sockets have the same epoll type, whether they're for a "tap" connection or a spliced connection. This means that tcp_sock_handler() has to do a secondary check on the type of the connection to call the right function. We can avoid this by adding a new epoll type and dispatching directly to the right thing. Signed-off-by: David Gibson Signed-off-by: Stefano Brivio --- passt.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'passt.c') diff --git a/passt.c b/passt.c index a37a2f4..71bea8f 100644 --- a/passt.c +++ b/passt.c @@ -50,6 +50,7 @@ #include "pasta.h" #include "arch.h" #include "log.h" +#include "tcp_splice.h" #define EPOLL_EVENTS 8 @@ -61,6 +62,7 @@ char pkt_buf[PKT_BUF_BYTES] __attribute__ ((aligned(PAGE_SIZE))); char *epoll_type_str[] = { [EPOLL_TYPE_TCP] = "connected TCP socket", + [EPOLL_TYPE_TCP_SPLICE] = "connected spliced TCP socket", [EPOLL_TYPE_TCP_LISTEN] = "listening TCP socket", [EPOLL_TYPE_TCP_TIMER] = "TCP timer", [EPOLL_TYPE_UDP] = "UDP socket", @@ -373,8 +375,10 @@ loop: pasta_netns_quit_handler(&c, quit_fd); break; case EPOLL_TYPE_TCP: - if (!c.no_tcp) - tcp_sock_handler(&c, ref, eventmask); + tcp_sock_handler(&c, ref, eventmask); + break; + case EPOLL_TYPE_TCP_SPLICE: + tcp_splice_sock_handler(&c, ref, eventmask); break; case EPOLL_TYPE_TCP_LISTEN: tcp_listen_handler(&c, ref, &now); -- cgit v1.2.3