DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v1] net/mlx5: remove counter alignment
@ 2025-10-28  9:26 Rongwei Liu
  2025-10-28 10:14 ` Dariusz Sosnowski
  0 siblings, 1 reply; 2+ messages in thread
From: Rongwei Liu @ 2025-10-28  9:26 UTC (permalink / raw)
  To: dev, matan, viacheslavo, orika, suanmingm, thomas
  Cc: Dariusz Sosnowski, Bing Zhao

The memory footprint was increased due to the alignment.

Signed-off-by: Rongwei Liu <rongweil@nvidia.com>
---
 drivers/net/mlx5/mlx5_hws_cnt.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_hws_cnt.h b/drivers/net/mlx5/mlx5_hws_cnt.h
index f5b7e8f643..d19a7bf37e 100644
--- a/drivers/net/mlx5/mlx5_hws_cnt.h
+++ b/drivers/net/mlx5/mlx5_hws_cnt.h
@@ -43,7 +43,7 @@ struct mlx5_hws_cnt_dcs_mng {
 };
 
 union mlx5_hws_cnt_state {
-	alignas(RTE_CACHE_LINE_SIZE) RTE_ATOMIC(uint32_t)data;
+	RTE_ATOMIC(uint32_t)data;
 	struct {
 		uint32_t in_used:1;
 		/* Indicator whether this counter in used or in pool. */
@@ -64,7 +64,7 @@ struct mlx5_hws_cnt {
 	struct flow_counter_stats reset;
 	union mlx5_hws_cnt_state cnt_state;
 	/* This struct is only meaningful when user own this counter. */
-	alignas(RTE_CACHE_LINE_SIZE) RTE_ATOMIC(uint32_t)query_gen_when_free;
+	RTE_ATOMIC(uint32_t)query_gen_when_free;
 	/*
 	 * When PMD own this counter (user put back counter to PMD
 	 * counter pool, i.e), this field recorded value of counter
-- 
2.27.0


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

* Re: [PATCH v1] net/mlx5: remove counter alignment
  2025-10-28  9:26 [PATCH v1] net/mlx5: remove counter alignment Rongwei Liu
@ 2025-10-28 10:14 ` Dariusz Sosnowski
  0 siblings, 0 replies; 2+ messages in thread
From: Dariusz Sosnowski @ 2025-10-28 10:14 UTC (permalink / raw)
  To: Rongwei Liu; +Cc: dev, matan, viacheslavo, orika, suanmingm, thomas, Bing Zhao

Hi,

On Tue, Oct 28, 2025 at 11:26:11AM +0200, Rongwei Liu wrote:
> The memory footprint was increased due to the alignment.

s/alignment/overalignment/

For clarity that the relevant fields were overaligned.

> 
> Signed-off-by: Rongwei Liu <rongweil@nvidia.com>
> ---

Since this is a bug fix, please add Fixes tag for the following commit:

	820ca7361bb7 ("net/mlx5: fix flow aging race condition")

Cc-ing to stable mailing list won't be needed,
because the offending patch is only in 25.11-rc1

>  drivers/net/mlx5/mlx5_hws_cnt.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_hws_cnt.h b/drivers/net/mlx5/mlx5_hws_cnt.h
> index f5b7e8f643..d19a7bf37e 100644
> --- a/drivers/net/mlx5/mlx5_hws_cnt.h
> +++ b/drivers/net/mlx5/mlx5_hws_cnt.h
> @@ -43,7 +43,7 @@ struct mlx5_hws_cnt_dcs_mng {
>  };
>  
>  union mlx5_hws_cnt_state {
> -	alignas(RTE_CACHE_LINE_SIZE) RTE_ATOMIC(uint32_t)data;
> +	RTE_ATOMIC(uint32_t)data;

Please add a space between `RTE_ATOMIC(uint32_t)` and `data`.

>  	struct {
>  		uint32_t in_used:1;
>  		/* Indicator whether this counter in used or in pool. */
> @@ -64,7 +64,7 @@ struct mlx5_hws_cnt {
>  	struct flow_counter_stats reset;
>  	union mlx5_hws_cnt_state cnt_state;
>  	/* This struct is only meaningful when user own this counter. */
> -	alignas(RTE_CACHE_LINE_SIZE) RTE_ATOMIC(uint32_t)query_gen_when_free;
> +	RTE_ATOMIC(uint32_t)query_gen_when_free;

Same as above.

>  	/*
>  	 * When PMD own this counter (user put back counter to PMD
>  	 * counter pool, i.e), this field recorded value of counter
> -- 
> 2.27.0
> 

Best regards,
Dariusz Sosnowski

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

end of thread, other threads:[~2025-10-28 10:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-28  9:26 [PATCH v1] net/mlx5: remove counter alignment Rongwei Liu
2025-10-28 10:14 ` Dariusz Sosnowski

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 NNTP newsgroup(s).