public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH] udp, icmp: Remove unused timer_run fields from protocol contexts
@ 2026-06-19 10:30 Laurent Vivier
  2026-06-22  2:39 ` David Gibson
  0 siblings, 1 reply; 2+ messages in thread
From: Laurent Vivier @ 2026-06-19 10:30 UTC (permalink / raw)
  To: passt-dev; +Cc: Laurent Vivier

Since 260075bde769 ("tcp, udp, fwd: Run all port scanning from a
single timer"), CALL_PROTO_HANDLER() is only used for TCP.  UDP and
ICMP timers now run from flow_defer_handler(), making the timer_run
fields in struct udp_ctx and struct icmp_ctx dead stores.

Remove the unused fields, drop struct icmp_ctx entirely (it has no
remaining members), and stop initialising them in timer_init().

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 icmp.h  | 7 -------
 passt.c | 2 +-
 passt.h | 2 --
 udp.h   | 2 --
 4 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/icmp.h b/icmp.h
index e8b928b61370..556260461995 100644
--- a/icmp.h
+++ b/icmp.h
@@ -19,12 +19,5 @@ int icmp_tap_handler(const struct ctx *c, uint8_t pif, sa_family_t af,
 		     struct iov_tail *data, const struct timespec *now);
 void icmp_init(void);
 
-/**
- * struct icmp_ctx - Execution context for ICMP routines
- * @timer_run:		Timestamp of most recent timer run
- */
-struct icmp_ctx {
-	struct timespec timer_run;
-};
 
 #endif /* ICMP_H */
diff --git a/passt.c b/passt.c
index b1d35d5bf988..677c8471a105 100644
--- a/passt.c
+++ b/passt.c
@@ -141,7 +141,7 @@ static void random_init(struct ctx *c)
  */
 static void timer_init(struct ctx *c, const struct timespec *now)
 {
-	c->tcp.timer_run = c->udp.timer_run = c->icmp.timer_run = *now;
+	c->tcp.timer_run = *now;
 }
 
 /**
diff --git a/passt.h b/passt.h
index 3a072945c382..205d7eecede7 100644
--- a/passt.h
+++ b/passt.h
@@ -194,7 +194,6 @@ struct ip6_ctx {
  * @no_udp:		Disable UDP operation
  * @udp:		Context for UDP protocol handler
  * @no_icmp:		Disable ICMP operation
- * @icmp:		Context for ICMP protocol handler
  * @mtu:		MTU passed via DHCP/NDP
  * @no_dns:		Do not source/use DNS servers for any purpose
  * @no_dns_search:	Do not source/use domain search lists for any purpose
@@ -279,7 +278,6 @@ struct ctx {
 	int no_udp;
 	struct udp_ctx udp;
 	int no_icmp;
-	struct icmp_ctx icmp;
 
 	int no_dns;
 	int no_dns_search;
diff --git a/udp.h b/udp.h
index 9ea7de682caf..b50283eab198 100644
--- a/udp.h
+++ b/udp.h
@@ -26,14 +26,12 @@ void udp_update_l2_buf(const unsigned char *eth_d);
  * struct udp_ctx - Execution context for UDP
  * @scan_in:		Port scanning state for inbound packets
  * @scan_out:		Port scanning state for outbound packets
- * @timer_run:		Timestamp of most recent timer run
  * @timeout:		Timeout for unidirectional flows (in s)
  * @stream_timeout:	Timeout for stream-like flows (in s)
  */
 struct udp_ctx {
 	struct fwd_scan scan_in;
 	struct fwd_scan scan_out;
-	struct timespec timer_run;
 	int timeout;
 	int stream_timeout;
 };
-- 
2.54.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] udp, icmp: Remove unused timer_run fields from protocol contexts
  2026-06-19 10:30 [PATCH] udp, icmp: Remove unused timer_run fields from protocol contexts Laurent Vivier
@ 2026-06-22  2:39 ` David Gibson
  0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2026-06-22  2:39 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: passt-dev

[-- Attachment #1: Type: text/plain, Size: 3232 bytes --]

On Fri, Jun 19, 2026 at 12:30:06PM +0200, Laurent Vivier wrote:
> Since 260075bde769 ("tcp, udp, fwd: Run all port scanning from a
> single timer"), CALL_PROTO_HANDLER() is only used for TCP.  UDP and
> ICMP timers now run from flow_defer_handler(), making the timer_run
> fields in struct udp_ctx and struct icmp_ctx dead stores.
> 
> Remove the unused fields, drop struct icmp_ctx entirely (it has no
> remaining members), and stop initialising them in timer_init().
> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

Nice catch.

> ---
>  icmp.h  | 7 -------
>  passt.c | 2 +-
>  passt.h | 2 --
>  udp.h   | 2 --
>  4 files changed, 1 insertion(+), 12 deletions(-)
> 
> diff --git a/icmp.h b/icmp.h
> index e8b928b61370..556260461995 100644
> --- a/icmp.h
> +++ b/icmp.h
> @@ -19,12 +19,5 @@ int icmp_tap_handler(const struct ctx *c, uint8_t pif, sa_family_t af,
>  		     struct iov_tail *data, const struct timespec *now);
>  void icmp_init(void);
>  
> -/**
> - * struct icmp_ctx - Execution context for ICMP routines
> - * @timer_run:		Timestamp of most recent timer run
> - */
> -struct icmp_ctx {
> -	struct timespec timer_run;
> -};
>  
>  #endif /* ICMP_H */
> diff --git a/passt.c b/passt.c
> index b1d35d5bf988..677c8471a105 100644
> --- a/passt.c
> +++ b/passt.c
> @@ -141,7 +141,7 @@ static void random_init(struct ctx *c)
>   */
>  static void timer_init(struct ctx *c, const struct timespec *now)
>  {
> -	c->tcp.timer_run = c->udp.timer_run = c->icmp.timer_run = *now;
> +	c->tcp.timer_run = *now;
>  }
>  
>  /**
> diff --git a/passt.h b/passt.h
> index 3a072945c382..205d7eecede7 100644
> --- a/passt.h
> +++ b/passt.h
> @@ -194,7 +194,6 @@ struct ip6_ctx {
>   * @no_udp:		Disable UDP operation
>   * @udp:		Context for UDP protocol handler
>   * @no_icmp:		Disable ICMP operation
> - * @icmp:		Context for ICMP protocol handler
>   * @mtu:		MTU passed via DHCP/NDP
>   * @no_dns:		Do not source/use DNS servers for any purpose
>   * @no_dns_search:	Do not source/use domain search lists for any purpose
> @@ -279,7 +278,6 @@ struct ctx {
>  	int no_udp;
>  	struct udp_ctx udp;
>  	int no_icmp;
> -	struct icmp_ctx icmp;
>  
>  	int no_dns;
>  	int no_dns_search;
> diff --git a/udp.h b/udp.h
> index 9ea7de682caf..b50283eab198 100644
> --- a/udp.h
> +++ b/udp.h
> @@ -26,14 +26,12 @@ void udp_update_l2_buf(const unsigned char *eth_d);
>   * struct udp_ctx - Execution context for UDP
>   * @scan_in:		Port scanning state for inbound packets
>   * @scan_out:		Port scanning state for outbound packets
> - * @timer_run:		Timestamp of most recent timer run
>   * @timeout:		Timeout for unidirectional flows (in s)
>   * @stream_timeout:	Timeout for stream-like flows (in s)
>   */
>  struct udp_ctx {
>  	struct fwd_scan scan_in;
>  	struct fwd_scan scan_out;
> -	struct timespec timer_run;
>  	int timeout;
>  	int stream_timeout;
>  };
> -- 
> 2.54.0
> 

-- 
David Gibson (he or they)	| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you, not the other way
				| around.
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-22  2:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-19 10:30 [PATCH] udp, icmp: Remove unused timer_run fields from protocol contexts Laurent Vivier
2026-06-22  2:39 ` David Gibson

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).