1
0
Fork 0
mirror of https://passt.top/passt synced 2025-06-16 20:35:33 +02:00

epoll: Split handling of TCP timerfds into its own handler function

tcp_sock_handler() actually handles several different types of fd events.
This includes timerfds that aren't sockets at all.  The handling of these
has essentially nothing in common with the other cases.  So, give the
TCP timers there own epoll_type value and dispatch directly to their
handler.  This also means we can remove the timer field from tcp_epoll_ref,
the information it encoded is now implicit in the epoll_type value.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
David Gibson 2023-08-11 15:12:26 +10:00 committed by Stefano Brivio
parent 8271a2ed57
commit e6f81e5578
4 changed files with 12 additions and 14 deletions

3
tcp.h
View file

@ -13,6 +13,7 @@
struct ctx;
void tcp_timer_handler(struct ctx *c, union epoll_ref ref);
void tcp_sock_handler(struct ctx *c, union epoll_ref ref, uint32_t events,
const struct timespec *now);
int tcp_tap_handler(struct ctx *c, int af, const void *addr,
@ -31,7 +32,6 @@ void tcp_update_l2_buf(const unsigned char *eth_d, const unsigned char *eth_s,
* union tcp_epoll_ref - epoll reference portion for TCP connections
* @listen: Set if this file descriptor is a listening socket
* @outbound: Listening socket maps to outbound, spliced connection
* @timer: Reference is a timerfd descriptor for connection
* @index: Index of connection in table, or port for bound sockets
* @u32: Opaque u32 value of reference
*/
@ -39,7 +39,6 @@ union tcp_epoll_ref {
struct {
uint32_t listen:1,
outbound:1,
timer:1,
index:20;
};
uint32_t u32;