Re: [Intel-wired-lan] [PATCH iwl-next v4 6/6] ice: convert all ring stats to u64_stats_t

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 6/6] ice: convert all ring 
> stats to u64_stats_t
>
> After several cleanups, the ice driver is now finally ready to convert all Tx 
> and Rx ring stats to the u64_stats_t and proper use of the u64 stats APIs.
>
> The final remaining part to cleanup is the VSI stats accumulation logic in 
> ice_update_vsi_ring_stats().
>
> Refactor the function and its helpers so that all stat values (and not just 
> pkts and bytes) use the u64_stats APIs. The ice_fetch_u64_(tx|rx)_stats 
> functions read the stat values using u64_stats_read and then copy them into 
> local ice_vsi_(tx|rx)_stats structures. This does require making a new struct 
> with the stat fields as u64.
>
> The ice_update_vsi_(tx|rx)_ring_stats functions call the fetch functions per 
> ring and accumulate the result into one copy of the struct. This accumulated 
> total is then used to update the relevant VSI fields.
>
> Since these are relatively small, the contents are all stored on the stack 
> rather than allocating and freeing memory.
>
> Once the accumulator side is updated, the helper ice_stats_read and 
> ice_stats_inc and other related helper functions all easily translate to use 
> of u64_stats_read and u64_stats_inc. This completes the refactor and ensures 
> that all stats accesses now make proper use of the API.
>
> Reviewed-by: Aleksandr Loktionov 
> Signed-off-by: Jacob Keller 
> ---
> drivers/net/ethernet/intel/ice/ice_txrx.h |  28 +++--  
> drivers/net/ethernet/intel/ice/ice_lib.c  |  29 ++---  
> drivers/net/ethernet/intel/ice/ice_main.c | 180 --
> 3 files changed, 147 insertions(+), 90 deletions(-)
>

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


Re: [Intel-wired-lan] [PATCH iwl-next v4 6/6] ice: convert all ring stats to u64_stats_t

2025-12-03 Thread Jacob Keller


On 11/25/2025 2:17 AM, Simon Horman wrote:
> On Thu, Nov 20, 2025 at 12:20:46PM -0800, Jacob Keller wrote:
>> After several cleanups, the ice driver is now finally ready to convert all
>> Tx and Rx ring stats to the u64_stats_t and proper use of the u64 stats
>> APIs.
>>
>> The final remaining part to cleanup is the VSI stats accumulation logic in
>> ice_update_vsi_ring_stats().
>>
>> Refactor the function and its helpers so that all stat values (and not
>> just pkts and bytes) use the u64_stats APIs. The
>> ice_fetch_u64_(tx|rx)_stats functions read the stat values using
>> u64_stats_read and then copy them into local ice_vsi_(tx|rx)_stats
>> structures. This does require making a new struct with the stat fields as
>> u64.
>>
>> The ice_update_vsi_(tx|rx)_ring_stats functions call the fetch functions
>> per ring and accumulate the result into one copy of the struct. This
>> accumulated total is then used to update the relevant VSI fields.
>>
>> Since these are relatively small, the contents are all stored on the stack
>> rather than allocating and freeing memory.
>>
>> Once the accumulator side is updated, the helper ice_stats_read and
>> ice_stats_inc and other related helper functions all easily translate to
>> use of u64_stats_read and u64_stats_inc. This completes the refactor and
>> ensures that all stats accesses now make proper use of the API.
>>
>> Reviewed-by: Aleksandr Loktionov 
>> Signed-off-by: Jacob Keller 
> 
> Thanks.
> 
> I do notice in the cover that you solicit alternate approaches to
> lead to a yet cleaner solution. But I think that the approach you have
> taken does significantly improve both the cleanliness and correctness
> of the code. So even if we think of something better later, I think
> this is a good step to take now.
> 

Thanks. In particular, I was wondering if there is a way to help improve
or extend the overall u64_stats API to make some of this non-driver
specific.

It does seem like quite a lot of boilerplate code is needed to make
correct use of the APIs, especially with the u64_stat_t type existing
now which is necessary even on some 64-bit arch.

Perhaps some of the macro wrappers could migrate into u64_stats.h header
somehow. Though I'm not sure we can keep them quite as short without
being in the driver.

> Thanks for breaking out the series into bite-sized chunks, especially
> the last few patches. It really helped me in my review.
> 

Yep. I originally had this all munged together but it became impossible
to follow the logic of how I got to this point, and also obscured
several of the outright fixes.

> Reviewed-by: Simon Horman 
> 



OpenPGP_signature.asc
Description: OpenPGP digital signature


Re: [Intel-wired-lan] [PATCH iwl-next v4 6/6] ice: convert all ring stats to u64_stats_t

2025-11-25 Thread Simon Horman
On Thu, Nov 20, 2025 at 12:20:46PM -0800, Jacob Keller wrote:
> After several cleanups, the ice driver is now finally ready to convert all
> Tx and Rx ring stats to the u64_stats_t and proper use of the u64 stats
> APIs.
> 
> The final remaining part to cleanup is the VSI stats accumulation logic in
> ice_update_vsi_ring_stats().
> 
> Refactor the function and its helpers so that all stat values (and not
> just pkts and bytes) use the u64_stats APIs. The
> ice_fetch_u64_(tx|rx)_stats functions read the stat values using
> u64_stats_read and then copy them into local ice_vsi_(tx|rx)_stats
> structures. This does require making a new struct with the stat fields as
> u64.
> 
> The ice_update_vsi_(tx|rx)_ring_stats functions call the fetch functions
> per ring and accumulate the result into one copy of the struct. This
> accumulated total is then used to update the relevant VSI fields.
> 
> Since these are relatively small, the contents are all stored on the stack
> rather than allocating and freeing memory.
> 
> Once the accumulator side is updated, the helper ice_stats_read and
> ice_stats_inc and other related helper functions all easily translate to
> use of u64_stats_read and u64_stats_inc. This completes the refactor and
> ensures that all stats accesses now make proper use of the API.
> 
> Reviewed-by: Aleksandr Loktionov 
> Signed-off-by: Jacob Keller 

Thanks.

I do notice in the cover that you solicit alternate approaches to
lead to a yet cleaner solution. But I think that the approach you have
taken does significantly improve both the cleanliness and correctness
of the code. So even if we think of something better later, I think
this is a good step to take now.

Thanks for breaking out the series into bite-sized chunks, especially
the last few patches. It really helped me in my review.

Reviewed-by: Simon Horman