From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=XoTcupBq; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id 8E7255A0269 for ; Thu, 05 Mar 2026 01:38:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772671130; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OMjxuAj7syaeZhFdKhen7WODj6Z0fDGV3NyBX4Qfr5o=; b=XoTcupBqXW3UvpaWZTgnqSxXKNTa1DNha+SzvgK8kcMyBM9vUrDze7+BOLlQ+LXIPQjFgY AmZXPH28z7vuESu9kvB4jCXsXJyHr4SiwapunSb5S9/xhuT3AbMD/jGfzaobY/EqkuqFSs aIwrs9f7iSonKDIbGthfSRsLoon1++M= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-593-fqV6X4A2NgGACfKbQX73Qw-1; Wed, 04 Mar 2026 19:38:48 -0500 X-MC-Unique: fqV6X4A2NgGACfKbQX73Qw-1 X-Mimecast-MFC-AGG-ID: fqV6X4A2NgGACfKbQX73Qw_1772671128 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-439b9116e2eso2416163f8f.2 for ; Wed, 04 Mar 2026 16:38:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772671127; x=1773275927; h=date:content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=OMjxuAj7syaeZhFdKhen7WODj6Z0fDGV3NyBX4Qfr5o=; b=Vl3SVa0iNXIQjq6lezZhzFiG80P5xmmjr84027XA6MrYDjapztvljg58tNKMdjC/RW TBLQRb9UJqMQIKzxPdjv2hUH0wYvNFvJLFzLgkJd2sTo7R7OJsNS28G6EuMiH4Ftvo5u hKqk5bdwoYYEe6UeDoqepOxDRmFWsmCYSJKEEDQNHlfAAtWLbm069NusVyVIGhKOaZbd SqF8GNhr4YoXSeqHvX9P3WsmIXk3t0CkXL+eGt2iTMCB7FCbT0BZRIGPXokAxdNtLxc2 xBEnd00KRjVddcN7MQh4o5C5RiVHSyIMajcg5usvSs0zOxJLuEQXn1ggkXExDNmjbVKw zfAg== X-Gm-Message-State: AOJu0YyRLC0flBUGlB8NW8sxhzkJgi+PF3/DK6VQTmamuVLoIoU/Q25O T064UYsBDX61QM2yTFKMU/97PYZZG3KP5vQ8vUIFuhNz+LyaA0iubw7fx0iuh7uNU8e5AfWJLoC PXgIWpV2fzei0EIIr/91WhjcS2B0fqu6L3IBqP9K02iSLvbBjF2UZBeHRBXFGug== X-Gm-Gg: ATEYQzycDKYaJgf1vpwKIJXDm1x5fXONXWScBIDsKGFrv03Xb/g5xQBUv/QtLhDEaHt Fd0amgo170ByBg4LPXiCJR9LngeX+QZw22YnzhrJfT3lZrDVkufRnuYdLHaigT0kzAmIFMXDtMC gWFmS2iu1xBeTj+Umhl0JaB42BBjtOkMYUmc3zjDUngjCtNLqjbt5yGxdDOOkCog94+8jGBhgnk r8L2tSkax2HP2ClhtoPSpYNiVVrx5ujGXFOgECqwcssk9PVuVxB+mP3afKvlLhaBljE71gs6l/E AvjB4vkllkrXcnYX7hyeGpUtZwhRe+DNb5w/gPPHhdWNTKlg8YN1Ls4Ot5pJza9JpDcsmll2AG5 BoQZ34FyiQrs/yXlx3htNS4mLyVtA3CtJ X-Received: by 2002:a05:6000:288a:b0:439:cee7:714f with SMTP id ffacd0b85a97d-439cee77bfamr1242406f8f.53.1772671127141; Wed, 04 Mar 2026 16:38:47 -0800 (PST) X-Received: by 2002:a05:6000:288a:b0:439:cee7:714f with SMTP id ffacd0b85a97d-439cee77bfamr1242380f8f.53.1772671126642; Wed, 04 Mar 2026 16:38:46 -0800 (PST) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [2a10:fc81:a806:d6a9::1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-439ba2a58dasm22113394f8f.27.2026.03.04.16.38.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Mar 2026 16:38:46 -0800 (PST) From: Stefano Brivio To: David Gibson Subject: Re: [PATCH 1/3] tcp: Use flow_foreach_of_type() in tcp_{keepalive,inactivity} Message-ID: <20260305013845.12c563e0@elisabeth> In-Reply-To: <20260302043135.800803-2-david@gibson.dropbear.id.au> References: <20260302043135.800803-1-david@gibson.dropbear.id.au> <20260302043135.800803-2-david@gibson.dropbear.id.au> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 Date: Thu, 05 Mar 2026 01:38:45 +0100 (CET) X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: PENxAojCadTfAU24ruXtdjhphldnZors_vytPeJ06AY_1772671128 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: XKPZNY7R77MG5TCR6UKGMLAWCNGEJAYO X-Message-ID-Hash: XKPZNY7R77MG5TCR6UKGMLAWCNGEJAYO X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Mon, 2 Mar 2026 15:31:33 +1100 David Gibson wrote: > 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 Applied with: Suggested-by: Stefano Brivio > --- > 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", -- Stefano