Skip to content

Add Names for supported capabilities of interfaces#47

Merged
safchain merged 10 commits intosafchain:masterfrom
gutjuri:bit-masks
Sep 16, 2023
Merged

Add Names for supported capabilities of interfaces#47
safchain merged 10 commits intosafchain:masterfrom
gutjuri:bit-masks

Conversation

@gutjuri
Copy link
Copy Markdown
Contributor

@gutjuri gutjuri commented Feb 25, 2022

Currently, one can acquire a bitmask of supported modes of operation by using the GetCmdMapped function:

e, err := ethtool.NewEthtool()
if err != nil {
	panic(err.Error())
}
defer e.Close()
cmdGet, err := e.CmdGetMapped(*name)
if err != nil {
	panic(err.Error())
}
fmt.Printf("cmd get: %+d\n", cmdGet["Supported"])

Unfortunately, there is no information on what the individual bits mean.

In this PR, I added the names of some supported capabilities (which I got from here: https://github.com/lyonel/lshw/blob/fdab06ac0b190ea0aa02cd468f904ed69ce0d9f1/src/core/network.cc#L113). This enables users of this library to seamlessly check, which capacities the interface in question supports.

closes #46

@gutjuri gutjuri marked this pull request as draft February 25, 2022 10:25
@gutjuri gutjuri marked this pull request as ready for review February 25, 2022 10:37
@ventifus
Copy link
Copy Markdown

Hi gutjuri,

These bit flags are actually in go already, in the golang.org/x/sys/unix package. Here's how we use those constants in node_exporter:

https://github.com/prometheus/node_exporter/blob/e3a18fdd37447992c213f42d61fdaed997fe9351/collector/ethtool_linux.go#L277

@gutjuri
Copy link
Copy Markdown
Contributor Author

gutjuri commented Feb 26, 2022

Thanks for this info. I wasn't aware of that, I guess this makes this PR redundant

@gutjuri gutjuri requested a review from safchain March 14, 2022 10:38
@gutjuri
Copy link
Copy Markdown
Contributor Author

gutjuri commented Sep 7, 2023

@safchain Would you like to merge this PR into your project? Otherwise I'd close this PR. Or are more changes required?

@safchain safchain merged commit 5287db7 into safchain:master Sep 16, 2023
@gutjuri gutjuri deleted the bit-masks branch September 17, 2023 17:14
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.

Supported Link modes: Strange output

3 participants