lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <IA3PR11MB8986D85BE508C02341F832CEE5C4A@IA3PR11MB8986.namprd11.prod.outlook.com>
Date: Tue, 4 Nov 2025 07:29:00 +0000
From: "Loktionov, Aleksandr" <aleksandr.loktionov@...el.com>
To: "Keller, Jacob E" <jacob.e.keller@...el.com>, "Lobakin, Aleksander"
	<aleksander.lobakin@...el.com>, "Nguyen, Anthony L"
	<anthony.l.nguyen@...el.com>, "Kitszel, Przemyslaw"
	<przemyslaw.kitszel@...el.com>
CC: "intel-wired-lan@...ts.osuosl.org" <intel-wired-lan@...ts.osuosl.org>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [PATCH iwl-next 8/9] ice: shorten ring stat names and add
 accessors



> -----Original Message-----
> From: Keller, Jacob E <jacob.e.keller@...el.com>
> Sent: Tuesday, November 4, 2025 2:07 AM
> To: Loktionov, Aleksandr <aleksandr.loktionov@...el.com>; Lobakin,
> Aleksander <aleksander.lobakin@...el.com>; Nguyen, Anthony L
> <anthony.l.nguyen@...el.com>; Kitszel, Przemyslaw
> <przemyslaw.kitszel@...el.com>
> Cc: intel-wired-lan@...ts.osuosl.org; netdev@...r.kernel.org; Keller,
> Jacob E <jacob.e.keller@...el.com>
> Subject: [PATCH iwl-next 8/9] ice: shorten ring stat names and add
> accessors
> 
> The ice Tx/Rx hotpath has a few statistics counters for tracking
> unexpected events. These values are stored as u64 but are not
> accumulated using the u64_stats API. This could result in load/tear
> stores on some architectures.
> Even some 64-bit architectures could have issues since the fields are
> not read or written using ACCESS_ONCE or READ_ONCE.
> 
> A following change is going to refactor the stats accumulator code to
> use the u64_stats API for all of these stats, and to use
> u64_stats_read and u64_stats_inc properly to prevent load/store tears
> on all architectures.
> 
> Using u64_stats_inc and the syncp pointer is slightly verbose and
> would be duplicated in a number of places in the Tx and Rx hot path.
> Add accessor macros for the cases where only a single stat value is
> touched at once. To keep lines short, also shorten the stats names and
> convert ice_txq_stats and ice_rxq_stats to struct_group.
> 
> This will ease the transition to properly using the u64_stats API in
> the following change.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@...el.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_txrx.h     | 52
> +++++++++++++++++++--------
>  drivers/net/ethernet/intel/ice/ice_txrx_lib.h |  2 +-
>  drivers/net/ethernet/intel/ice/ice_main.c     | 12 +++----
>  drivers/net/ethernet/intel/ice/ice_txrx.c     | 14 ++++----
>  drivers/net/ethernet/intel/ice/ice_txrx_lib.c |  2 +-
>  drivers/net/ethernet/intel/ice/ice_xsk.c      |  4 +--
>  6 files changed, 55 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.h
> b/drivers/net/ethernet/intel/ice/ice_txrx.h
> index 8586d5bebac7..cf3656dc560c 100644
> --- a/drivers/net/ethernet/intel/ice/ice_txrx.h
> +++ b/drivers/net/ethernet/intel/ice/ice_txrx.h
> @@ -129,18 +129,6 @@ struct ice_tx_offload_params {
>  	u8 header_len;
>  };
> 
> -struct ice_txq_stats {
> -	u64 restart_q;
> -	u64 tx_busy;
> -	u64 tx_linearize;
> -};
> -
> -struct ice_rxq_stats {
> -	u64 non_eop_descs;
> -	u64 alloc_page_failed;
> -	u64 alloc_buf_failed;
> -};
> -
>  struct ice_ring_stats {
>  	struct rcu_head rcu;	/* to avoid race on free */
>  	struct u64_stats_sync syncp;
> @@ -148,12 +136,48 @@ struct ice_ring_stats {
>  		u64 pkts;
>  		u64 bytes;
>  		union {
> -			struct ice_txq_stats tx_stats;
> -			struct ice_rxq_stats rx_stats;
> +			struct_group(tx,
> +				u64 tx_restart_q;
> +				u64 tx_busy;
> +				u64 tx_linearize;
> +			);
> +			struct_group(rx,
> +				u64 rx_non_eop_descs;
> +				u64 rx_page_failed;
> +				u64 rx_buf_failed;
> +			);
>  		};
>  	);
>  };
> 
> +/**
> + * ice_stats_read - Read a single ring stat value
> + * @stats: pointer to ring_stats structure for a queue
> + * @member: the ice_ring_stats member to read
> + *
> + * Shorthand for reading a single 64-bit stat value from struct
> + * ice_ring_stats.
> + *
> + * Return: the value of the requested stat.
> + */
> +#define ice_stats_read(stats, member) ({				\
> +	struct ice_ring_stats *__stats = (stats);			\
> +	__stats->member;						\
> +})
> +
> +/**
> + * ice_stats_inc - Increment a single ring stat value
> + * @stats: pointer to the ring_stats structure for a queue
> + * @member: the ice_string_stats member to increment
> + *

"ice_string_stats" -> "ice_ring_stats"


...
 
> --
> 2.51.0.rc1.197.g6d975e95c9d7

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ