Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ethtool: statistics support #1126

Merged
merged 3 commits into from
Oct 27, 2023
Merged

Conversation

pspacek
Copy link
Contributor

@pspacek pspacek commented Aug 24, 2023

No description provided.

Stringset length varies by driver and set_id.

Hack: The ctypes library does not allow us to assign redefined/resized
Gstring structures to the same IfReq because it (rightly) considers a
new structure definition incompatible with the original one. If we were
to comply with strict type checking we would have to redefine IfReq
every time, but that creates new sort of mess.

Instead of redefining IfReq we define gstrings structure member as
void* pointer and that allows us to reassign resized structure without
redefining the whole IfReq every time. The same applies to gstats member.
get_statistics() is not exposed outside of Ioctl submodule because
the netlink provides different set of statistics.
See ethtool commit f8d2bc2ccd8bb24f42ce5023227f21a6433c782f.

Stat names are cached within IoctlEthtool object as they should not
ever change, and it serves as optimization for high-frequency stats
gathering.
Return stats as list of (key, counter) tuples.

Some drivers, e.g. vmx3, use non-unique key (GSTRING) names
and create some sort of nested structures based on
key name and/or counter value and/or whitespace indentation.

Abbreviated example from vmx3 driver:

[('Tx Queue#', 0),
 ('  TSO pkts tx', 3637),
 ('  TSO bytes tx', 14809448),
 ('Tx Queue#', 1),
 ('  TSO pkts tx', 46608),
 ('  TSO bytes tx', 182510287)]

This is driver-dependent and thus up to caller to decide how return
value should be interpreted.
@pspacek
Copy link
Contributor Author

pspacek commented Sep 18, 2023

@svinota Hello! I don't want to be inpatient, but what do you think about this PR? :-)

@svinota
Copy link
Owner

svinota commented Oct 27, 2023

Sorry for delay, I was having some issues.

And thanks for your patience

@svinota svinota merged commit d25d27d into svinota:master Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants