[RFT 4/4] net/mlx5: fix counter truncation in queue counter read
Dariusz Sosnowski
dsosnowski at nvidia.com
Thu Feb 26 10:58:29 CET 2026
On Tue, Feb 17, 2026 at 07:05:02AM -0800, Stephen Hemminger wrote:
> mlx5_read_queue_counter() casts its uint64_t *stat argument to
> uint32_t * before passing it to mlx5_devx_cmd_queue_counter_query().
> The query function writes a single uint32_t, so:
>
> - On little-endian (x86): only the low 32 bits of *stat are
> written; the upper 32 bits retain whatever value they had
> before the call (stack garbage or a stale value).
> - On big-endian (PowerPC): the write hits the wrong half of the
> 64-bit word entirely.
>
> Use a local uint32_t for the query and widen to uint64_t on
> assignment.
>
> Fixes: f0c0731b6d40 ("net/mlx5: add counters for hairpin drop")
> Cc: stable at dpdk.org
>
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
Acked-by: Dariusz Sosnowski <dsosnowski at nvidia.com>
More information about the stable
mailing list