Page MenuHomeFreeBSD

mvneta: Fix 64-bit MIB reads
ClosedPublic

Authored by markj on Dec 31 2020, 6:54 PM.

Details

Summary

It appears we must read them as 2 4-byte words, lower address first.
Otherwise both reads return the same value, resulting in bogus byte
counter values.

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

markj requested review of this revision.Dec 31 2020, 6:54 PM
mw requested changes to this revision.Dec 31 2020, 11:50 PM
mw added inline comments.
sys/dev/neta/if_mvneta.c
1192

Please replace the for loop with mvneta_clear_mib()

This revision now requires changes to proceed.Dec 31 2020, 11:50 PM
markj marked an inline comment as done.

Use mvneta_clear_mib().

mw requested changes to this revision.Jan 2 2021, 7:39 AM
mw added inline comments.
sys/dev/neta/if_mvneta.c
3539

Sorry for not spotting this before - val is unitialized, so we need to make sure, the upper half of it is not a random data. Please add:

val = 0;

Otherwise LGTM.

This revision now requires changes to proceed.Jan 2 2021, 7:39 AM
sys/dev/neta/if_mvneta.c
3539

I don't follow. We assign val = MVNETA_READ_MIB(sc, mib->regnum) a couple of lines below. The right-hand side of that statement will be promoted to a 64-bit value before the assignment.

mw added inline comments.
sys/dev/neta/if_mvneta.c
3539

You are right.

This revision is now accepted and ready to land.Jan 4 2021, 1:19 AM
This revision was automatically updated to reflect the committed changes.