From: David Gibson <david@gibson.dropbear.id.au>
To: passt-dev@passt.top, Stefano Brivio <sbrivio@redhat.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH 1/3] tcp: Use flow_foreach_of_type() in tcp_{keepalive,inactivity}
Date: Mon, 2 Mar 2026 15:31:33 +1100 [thread overview]
Message-ID: <20260302043135.800803-2-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20260302043135.800803-1-david@gibson.dropbear.id.au>
These functions step through all TCP flows. I forgot there was already
a flow_foreach_of_type() macro which makes this easier. Use it.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
tcp.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/tcp.c b/tcp.c
index 88ad886d..16470703 100644
--- a/tcp.c
+++ b/tcp.c
@@ -2907,12 +2907,9 @@ static void tcp_keepalive(struct ctx *c, const struct timespec *now)
c->tcp.keepalive_run = now->tv_sec;
- flow_foreach(flow) {
+ flow_foreach_of_type(flow, FLOW_TCP) {
struct tcp_tap_conn *conn = &flow->tcp;
- if (flow->f.type != FLOW_TCP)
- continue;
-
if (conn->tap_inactive) {
flow_dbg(conn, "No tap activity for least %us, send keepalive",
KEEPALIVE_INTERVAL);
@@ -2938,12 +2935,9 @@ static void tcp_inactivity(struct ctx *c, const struct timespec *now)
debug("TCP inactivity scan");
c->tcp.inactivity_run = now->tv_sec;
- flow_foreach(flow) {
+ flow_foreach_of_type(flow, FLOW_TCP) {
struct tcp_tap_conn *conn = &flow->tcp;
- if (flow->f.type != FLOW_TCP)
- continue;
-
if (conn->inactive) {
/* No activity in this interval, reset */
flow_dbg(conn, "Inactive for at least %us, resetting",
--
2.53.0
next prev parent reply other threads:[~2026-03-02 4:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-02 4:31 [PATCH 0/3] Miscellaneous minor fixes David Gibson
2026-03-02 4:31 ` David Gibson [this message]
2026-03-05 0:38 ` [PATCH 1/3] tcp: Use flow_foreach_of_type() in tcp_{keepalive,inactivity} Stefano Brivio
2026-03-02 4:31 ` [PATCH 2/3] fwd, pif: Replace with pif_sock_l4() with pif_listen() David Gibson
2026-03-03 19:11 ` Stefano Brivio
2026-03-03 22:55 ` David Gibson
2026-03-05 0:38 ` Stefano Brivio
2026-03-02 4:31 ` [PATCH 3/3] clang-tidy: Don't insist on #ifdef over #if defined() David Gibson
2026-03-05 0:38 ` 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=20260302043135.800803-2-david@gibson.dropbear.id.au \
--to=david@gibson.dropbear.id.au \
--cc=passt-dev@passt.top \
--cc=sbrivio@redhat.com \
/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).