Page MenuHomeFreeBSD

mvneta: Fix 64-bit MIB reads
ClosedPublic

Authored by markj on Dec 31 2020, 6:54 PM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 7 2024, 6:26 AM
Unknown Object (File)
Dec 20 2023, 8:44 AM
Unknown Object (File)
Dec 14 2023, 10:03 PM
Unknown Object (File)
Nov 11 2023, 3:19 AM
Unknown Object (File)
Nov 10 2023, 10:08 PM
Unknown Object (File)
Nov 8 2023, 11:53 AM
Unknown Object (File)
Oct 10 2023, 2:19 AM
Unknown Object (File)
Oct 7 2023, 10:46 AM
Subscribers

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
rG FreeBSD src repository
Lint
Lint Not Applicable
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
1193

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
3540

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
3540

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
3540

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.