Commit c9885fe5 authored by Patrick Rabau's avatar Patrick Rabau Committed by David S. Miller

bnx2: Fix bug when saving statistics.

This fixes the problem of dropping the carry when adding 2 32-bit values.
Switch to use array indexing for better readability.

Reported by and fix provided by Patrick Rabau.
Signed-off-by: default avatarMichael Chan <mchan@broadcom.com>
Signed-off-by: default avatarBenjamin Li <benli@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent beb499af
......@@ -6555,16 +6555,16 @@ bnx2_save_stats(struct bnx2 *bp)
u32 hi;
u64 lo;
hi = *(temp_stats + i) + *(hw_stats + i);
lo = *(temp_stats + i + 1) + *(hw_stats + i + 1);
hi = temp_stats[i] + hw_stats[i];
lo = (u64) temp_stats[i + 1] + (u64) hw_stats[i + 1];
if (lo > 0xffffffff)
hi++;
*(temp_stats + i) = hi;
*(temp_stats + i + 1) = lo & 0xffffffff;
temp_stats[i] = hi;
temp_stats[i + 1] = lo & 0xffffffff;
}
for ( ; i < sizeof(struct statistics_block) / 4; i++)
*(temp_stats + i) = *(temp_stats + i) + *(hw_stats + i);
temp_stats[i] += hw_stats[i];
}
#define GET_64BIT_NET_STATS64(ctr) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment