public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Laurent Vivier <lvivier@redhat.com>
To: passt-dev@passt.top
Cc: Laurent Vivier <lvivier@redhat.com>
Subject: [PATCH 5/5] udp: Use epollfd from flow_common structure
Date: Fri,  3 Oct 2025 17:27:17 +0200	[thread overview]
Message-ID: <20251003152717.2437765-6-lvivier@redhat.com> (raw)
In-Reply-To: <20251003152717.2437765-1-lvivier@redhat.com>

Update UDP flow handling to use the epollfd field from the flow_common
structure instead of accessing it from the context. This aligns UDP with
the recent changes to TCP and ICMP flow management.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 udp_flow.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/udp_flow.c b/udp_flow.c
index f99994523a6c..9843b9f5fb2f 100644
--- a/udp_flow.c
+++ b/udp_flow.c
@@ -51,7 +51,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(uflow->f.epollfd, uflow->s[sidei]);
 			close(uflow->s[sidei]);
 			uflow->s[sidei] = -1;
 		}
@@ -91,9 +91,11 @@ static int udp_flow_sock(const struct ctx *c,
 	ref.data = fref.data;
 	ref.fd = s;
 
+	uflow->f.epollfd = c->epollfd;
+
 	ev.events = EPOLLIN;
 	ev.data.u64 = ref.u64;
-	if (epoll_ctl(c->epollfd, EPOLL_CTL_ADD, s, &ev) == -1) {
+	if (epoll_ctl(uflow->f.epollfd, EPOLL_CTL_ADD, s, &ev) == -1) {
 		int rc = -errno;
 		close(s);
 		warn("L4 epoll_ctl: %s", strerror_(-rc));
@@ -103,7 +105,7 @@ static int udp_flow_sock(const struct ctx *c,
 	if (flowside_connect(c, s, pif, side) < 0) {
 		int rc = -errno;
 
-		epoll_del(c->epollfd, s);
+		epoll_del(uflow->f.epollfd, s);
 		close(s);
 
 		flow_dbg_perror(uflow, "Couldn't connect flow socket");
-- 
2.50.1


      parent reply	other threads:[~2025-10-03 15:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-03 15:27 [PATCH 0/5] Refactor epoll handling in preparation for multithreading Laurent Vivier
2025-10-03 15:27 ` [PATCH 1/5] util: Simplify epoll_del() interface to take epollfd directly Laurent Vivier
2025-10-07  5:26   ` David Gibson
2025-10-03 15:27 ` [PATCH 2/5] util: Move epoll registration out of sock_l4_sa() Laurent Vivier
2025-10-07  5:57   ` David Gibson
2025-10-03 15:27 ` [PATCH 3/5] tcp, flow: Replace per-connection in_epoll flag with epollfd in flow_common Laurent Vivier
2025-10-07  6:07   ` David Gibson
2025-10-07  9:51     ` Stefano Brivio
2025-10-03 15:27 ` [PATCH 4/5] icmp: Use epollfd from flow_common structure Laurent Vivier
2025-10-03 15:27 ` Laurent Vivier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251003152717.2437765-6-lvivier@redhat.com \
    --to=lvivier@redhat.com \
    --cc=passt-dev@passt.top \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).