]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ice: remove ice_q_stats struct and use struct_group
authorJacob Keller <jacob.e.keller@intel.com>
Thu, 20 Nov 2025 20:20:43 +0000 (12:20 -0800)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Mon, 26 Jan 2026 17:32:36 +0000 (09:32 -0800)
commitb470944ee6e8f51c1d561899c045286b6c416b46
treeb4f9a93993e3be0c9038673e7feb2d346bd314d4
parentfb5b8f3c887067a925e021c148ae41bb88f4d22b
ice: remove ice_q_stats struct and use struct_group

The ice_qp_reset_stats function resets the stats for all rings on a VSI. It
currently behaves differently for Tx and Rx rings. For Rx rings, it only
clears the rx_stats which do not include the pkt and byte counts. For Tx
rings and XDP rings, it clears only the pkt and byte counts.

We could add extra memset calls to cover both the stats and relevant
tx/rx stats fields. Instead, lets convert stats into a struct_group which
contains both the pkts and bytes fields as well as the Tx or Rx stats, and
remove the ice_q_stats structure entirely.

The only remaining user of ice_q_stats is the ice_q_stats_len function in
ice_ethtool.c, which just counts the number of fields. Replace this with a
simple multiplication by 2. I find this to be simpler to reason about than
relying on knowing the layout of the ice_q_stats structure.

Now that the stats field of the ice_ring_stats covers all of the statistic
values, the ice_qp_reset_stats function will properly zero out all of the
fields.

Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/ice_base.c
drivers/net/ethernet/intel/ice/ice_ethtool.c
drivers/net/ethernet/intel/ice/ice_lib.c
drivers/net/ethernet/intel/ice/ice_txrx.h