From aaa8f347351841fc16bd2a012b84f2b976c9dfb2 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Tue, 21 Oct 2025 23:01:15 +0200 Subject: udp: Use epoll instance management for UDP flows Store the epoll id in the flow_common structure for UDP flows using flow_epollid_set() and retrieve the corresponding epoll file descriptor with flow_epollfd() instead of passing c->epollfd directly. This makes UDP consistent with the recent TCP and ICMP changes. Signed-off-by: Laurent Vivier Reviewed-by: David Gibson Signed-off-by: Stefano Brivio --- udp_flow.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/udp_flow.c b/udp_flow.c index 00e231f..8907f2f 100644 --- a/udp_flow.c +++ b/udp_flow.c @@ -52,7 +52,7 @@ void udp_flow_close(const struct ctx *c, struct udp_flow *uflow) flow_foreach_sidei(sidei) { flow_hash_remove(c, FLOW_SIDX(uflow, sidei)); if (uflow->s[sidei] >= 0) { - epoll_del(c->epollfd, uflow->s[sidei]); + epoll_del(flow_epollfd(&uflow->f), uflow->s[sidei]); close(uflow->s[sidei]); uflow->s[sidei] = -1; } @@ -92,7 +92,9 @@ static int udp_flow_sock(const struct ctx *c, ref.data = fref.data; ref.fd = s; - rc = epoll_add(c->epollfd, EPOLLIN, ref); + flow_epollid_set(&uflow->f, EPOLLFD_ID_DEFAULT); + + rc = epoll_add(flow_epollfd(&uflow->f), EPOLLIN, ref); if (rc < 0) { close(s); return rc; @@ -101,7 +103,7 @@ static int udp_flow_sock(const struct ctx *c, if (flowside_connect(c, s, pif, side) < 0) { rc = -errno; - epoll_del(c->epollfd, s); + epoll_del(flow_epollfd(&uflow->f), s); close(s); flow_dbg_perror(uflow, "Couldn't connect flow socket"); -- cgit v1.2.3