public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: Laurent Vivier <lvivier@redhat.com>
Cc: passt-dev@passt.top, David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [PATCH] passt, tcp: Inline CALL_PROTO_HANDLER() and merge tcp_timer()
Date: Fri, 05 Jun 2026 08:28:42 +0200 (CEST)	[thread overview]
Message-ID: <20260605082833.79ff6ff9@elisabeth> (raw)
In-Reply-To: <20260602131708.2726632-1-lvivier@redhat.com>

On Tue,  2 Jun 2026 15:17:08 +0200
Laurent Vivier <lvivier@redhat.com> wrote:

> Since 260075bde769 ("tcp, udp, fwd: Run all port scanning from a
> single timer"), CALL_PROTO_HANDLER() has only one user (tcp), so
> inline it at the call site and remove the macro.
> 
> Merge tcp_timer() into tcp_defer_handler(), moving the timer interval
> check there, matching the pattern used by flow_defer_handler() and
> fwd_scan_ports_timer().
> 
> The weak declaration and null check for tcp_defer_handler are also
> dropped as the function is always defined.
> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
>  passt.c | 23 ++---------------------
>  tcp.c   | 22 ++++++++++------------
>  tcp.h   |  3 +--
>  3 files changed, 13 insertions(+), 35 deletions(-)
> 
> diff --git a/passt.c b/passt.c
> index b6fc12d4ed81..b3f806b9a15e 100644
> --- a/passt.c
> +++ b/passt.c
> @@ -101,27 +101,8 @@ struct passt_stats {
>   */
>  static void post_handler(struct ctx *c, const struct timespec *now)
>  {
> -#define CALL_PROTO_HANDLER(lc, uc)					\
> -	do {								\
> -		extern void						\
> -		lc ## _defer_handler (struct ctx *c)			\
> -		__attribute__ ((weak));					\
> -									\
> -		if (!c->no_ ## lc) {					\
> -			if (lc ## _defer_handler)			\
> -				lc ## _defer_handler(c);		\
> -									\
> -			if (timespec_diff_ms((now), &c->lc.timer_run)	\
> -			    >= uc ## _TIMER_INTERVAL) {			\  
> -				lc ## _timer(c, now);			\
> -				c->lc.timer_run = *now;			\
> -			}						\
> -		} 							\

My beautiful write-only macro crap going away... :(

Applied.

-- 
Stefano


      parent reply	other threads:[~2026-06-05  6:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-02 13:17 Laurent Vivier
2026-06-03  2:37 ` David Gibson
2026-06-05  6:28 ` Stefano Brivio [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=20260605082833.79ff6ff9@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=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).