Re: [Intel-wired-lan] [PATCH iwl-next v4 5/6] ice: shorten ring stat names and add accessors

2025-12-18 Thread Rinitha, SX
> -Original Message-
> From: Intel-wired-lan  On Behalf Of Jacob 
> Keller
> Sent: 21 November 2025 01:51
> To: Loktionov, Aleksandr ; Lobakin, Aleksander 
> ; Nguyen, Anthony L 
> ; Kitszel, Przemyslaw 
> 
> Cc: Simon Horman ; [email protected]; 
> [email protected]; Keller, Jacob E ; 
> Loktionov, Aleksandr 
> Subject: [Intel-wired-lan] [PATCH iwl-next v4 5/6] 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.
>
> Reviewed-by: Aleksandr Loktionov 
> Signed-off-by: Jacob Keller 
> ---
> drivers/net/ethernet/intel/ice/ice_txrx.h | 55 +++
> drivers/net/ethernet/intel/ice/ice_txrx_lib.h |  2 +-
> drivers/net/ethernet/intel/ice/ice_main.c | 16 
> drivers/net/ethernet/intel/ice/ice_txrx.c | 16 
> drivers/net/ethernet/intel/ice/ice_txrx_lib.c |  2 +-
> drivers/net/ethernet/intel/ice/ice_xsk.c  |  4 +-
> 6 files changed, 60 insertions(+), 35 deletions(-)
>

Tested-by: Rinitha S  (A Contingent worker at Intel)


Re: [Intel-wired-lan] [PATCH iwl-next v4 5/6] ice: shorten ring stat names and add accessors

2025-12-03 Thread Jacob Keller


On 11/25/2025 2:17 AM, Simon Horman wrote:
> On Thu, Nov 20, 2025 at 12:20:45PM -0800, Jacob Keller wrote:
>> 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.
>>
>> Reviewed-by: Aleksandr Loktionov 
>> Signed-off-by: Jacob Keller 
> 
> I had to read this and the next patch a few times to understand what was
> going on. In the end, the key for me understanding this patch is "...
> accessor macros for the cases where only a single stat value is touched at
> once.". Especially the "once" bit.
> 

I'm a little unhappy with needing access macros like this because its
yet another "driver specific wrapper".. but I couldn't come up with
something better..

> In the context of the following patch I think this change makes sense.
> And I appreciate that keeping lines short also makes sense. So no
> objections to the direction you've taken here. But I might not have
> thought to use struct_group for this myself.
> 

Right. The main issue I had was all the places where we increment one
stat we'd end up needing *at least* 3 lines. And trying to split or
refactor all of those updates seemed like it would be problematic.

I liked the use of struct_group since it lets us keep size information
and logical separation without needing to add the extra layer of
indirection in the accesses.

> Reviewed-by: Simon Horman 



OpenPGP_signature.asc
Description: OpenPGP digital signature


Re: [Intel-wired-lan] [PATCH iwl-next v4 5/6] ice: shorten ring stat names and add accessors

2025-11-25 Thread Simon Horman
On Thu, Nov 20, 2025 at 12:20:45PM -0800, Jacob Keller wrote:
> 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.
> 
> Reviewed-by: Aleksandr Loktionov 
> Signed-off-by: Jacob Keller 

I had to read this and the next patch a few times to understand what was
going on. In the end, the key for me understanding this patch is "...
accessor macros for the cases where only a single stat value is touched at
once.". Especially the "once" bit.

In the context of the following patch I think this change makes sense.
And I appreciate that keeping lines short also makes sense. So no
objections to the direction you've taken here. But I might not have
thought to use struct_group for this myself.

Reviewed-by: Simon Horman