Skip to content

Commit 2a7207b

Browse files
zengzhichao233bruce-richardson
authored andcommitted
net/ice: fix statistics read error
The statistics contain 40 bits. The lower 32 bits are read first, followed by the upper 8 bits. In some cases, after reading the lower 32 bits, a carry occurs from the lower bits, which causes the final statistics to be incorrect. This commit fixes this issue. Fixes: a37bde5 ("net/ice: support statistics") Cc: [email protected] Signed-off-by: Zhichao Zeng <[email protected]> Acked-by: Bruce Richardson <[email protected]>
1 parent 0bd37d3 commit 2a7207b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

drivers/net/intel/ice/ice_ethdev.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6417,10 +6417,16 @@ ice_stat_update_40(struct ice_hw *hw,
64176417
uint64_t *stat)
64186418
{
64196419
uint64_t new_data;
6420+
uint32_t lo_old, hi, lo;
64206421

6421-
new_data = (uint64_t)ICE_READ_REG(hw, loreg);
6422-
new_data |= (uint64_t)(ICE_READ_REG(hw, hireg) & ICE_8_BIT_MASK) <<
6423-
ICE_32_BIT_WIDTH;
6422+
do {
6423+
lo_old = ICE_READ_REG(hw, loreg);
6424+
hi = ICE_READ_REG(hw, hireg);
6425+
lo = ICE_READ_REG(hw, loreg);
6426+
} while (lo_old > lo);
6427+
6428+
new_data = (uint64_t)lo;
6429+
new_data |= (uint64_t)(hi & ICE_8_BIT_MASK) << ICE_32_BIT_WIDTH;
64246430

64256431
if (!offset_loaded)
64266432
*offset = new_data;

0 commit comments

Comments
 (0)