From eebca1115fbdb0fc72af713171434b0adbf4e87b Mon Sep 17 00:00:00 2001 From: David Gibson Date: Tue, 16 Jan 2024 11:50:33 +1100 Subject: tcp, tcp_splice: Remove redundant handling from tcp_timer() tcp_timer() scans the connection table, expiring "tap" connections and calling tcp_splice_timer() for "splice" connections. tcp_splice_timer() expires spliced connections and then does some other processing. However, tcp_timer() is always called shortly after tcp_defer_handler() (from post_handler()), which also scans the flow table expiring both tap and spliced connections. So remove the redundant handling, and only do the extra tcp_splice_timer() work from tcp_timer(). Signed-off-by: David Gibson Signed-off-by: Stefano Brivio --- tcp.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'tcp.c') diff --git a/tcp.c b/tcp.c index dbf5509..1b29661 100644 --- a/tcp.c +++ b/tcp.c @@ -3201,20 +3201,9 @@ void tcp_timer(struct ctx *c, const struct timespec *now) } } - for (flow = flowtab + c->flow_count - 1; flow >= flowtab; flow--) { - switch (flow->f.type) { - case FLOW_TCP: - if (flow->tcp.events == CLOSED) - tcp_conn_destroy(c, flow); - break; - case FLOW_TCP_SPLICE: + for (flow = flowtab + c->flow_count - 1; flow >= flowtab; flow--) + if (flow->f.type == FLOW_TCP_SPLICE) tcp_splice_timer(c, flow); - break; - default: - die("Unexpected %s in tcp_timer()", - FLOW_TYPE(&flow->f)); - } - } tcp_sock_refill_init(c); if (c->mode == MODE_PASTA) -- cgit v1.2.3