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>,
	David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH v5 5/7] icmp: Use epoll instance management for ICMP flows
Date: Tue, 21 Oct 2025 23:01:14 +0200	[thread overview]
Message-ID: <20251021210116.314674-6-lvivier@redhat.com> (raw)
In-Reply-To: <20251021210116.314674-1-lvivier@redhat.com>

Store the epoll id in the flow_common structure for ICMP ping flows
using flow_epollid_set() and retrieve the corresponding epoll
file descriptor with flow_epollfd() instead of passing c->epollfd
directly. This makes ICMP consistent with the recent TCP changes and
follows the pattern established in previous commit.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
---
 icmp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/icmp.c b/icmp.c
index d7c64739876f..d6fee38dd802 100644
--- a/icmp.c
+++ b/icmp.c
@@ -149,7 +149,7 @@ unexpected:
 static void icmp_ping_close(const struct ctx *c,
 			    const struct icmp_ping_flow *pingf)
 {
-	epoll_del(c->epollfd, pingf->sock);
+	epoll_del(flow_epollfd(&pingf->f), pingf->sock);
 	close(pingf->sock);
 	flow_hash_remove(c, FLOW_SIDX(pingf, INISIDE));
 }
@@ -206,11 +206,13 @@ static struct icmp_ping_flow *icmp_ping_new(const struct ctx *c,
 	if (pingf->sock > FD_REF_MAX)
 		goto cancel;
 
+	flow_epollid_set(&pingf->f, EPOLLFD_ID_DEFAULT);
+
 	ref.type = EPOLL_TYPE_PING;
 	ref.flowside = FLOW_SIDX(flow, TGTSIDE);
 	ref.fd = pingf->sock;
 
-	if (epoll_add(c->epollfd, EPOLLIN, ref) < 0) {
+	if (epoll_add(flow_epollfd(&pingf->f), EPOLLIN, ref) < 0) {
 		close(pingf->sock);
 		goto cancel;
 	}
-- 
2.51.0


  parent reply	other threads:[~2025-10-21 21:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-21 21:01 [PATCH v5 0/7] Refactor epoll handling in preparation for multithreading Laurent Vivier
2025-10-21 21:01 ` [PATCH v5 1/7] util: Simplify epoll_del() interface to take epollfd directly Laurent Vivier
2025-10-21 21:01 ` [PATCH v5 2/7] epoll_ctl: Extract epoll operations Laurent Vivier
2025-10-23  1:29   ` David Gibson
2025-10-21 21:01 ` [PATCH v5 3/7] util: Move epoll registration out of sock_l4_sa() Laurent Vivier
2025-10-21 21:01 ` [PATCH v5 4/7] tcp, flow: Replace per-connection in_epoll flag with an epollid in flow_common Laurent Vivier
2025-10-23  1:39   ` David Gibson
2025-10-30 17:00   ` Stefano Brivio
2025-10-21 21:01 ` Laurent Vivier [this message]
2025-10-21 21:01 ` [PATCH v5 6/7] udp: Use epoll instance management for UDP flows Laurent Vivier
2025-10-23  1:40   ` David Gibson
2025-10-21 21:01 ` [PATCH v5 7/7] passt: Move main event loop processing into passt_worker() Laurent Vivier
2025-10-23  1:42   ` David Gibson
2025-10-30 17:00 ` [PATCH v5 0/7] Refactor epoll handling in preparation for multithreading Stefano Brivio

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=20251021210116.314674-6-lvivier@redhat.com \
    --to=lvivier@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --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).