safchain / ethtool

A simple ethtool "like" library for GO
Apache License 2.0
120 stars 69 forks source link

Supported Link modes: Strange output #46

Closed gutjuri closed 2 years ago

gutjuri commented 2 years ago

Hello, if I do

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"])

i get 25327, which is a bitmask (01100010 11101111) that has 10 bits set. These bits correspond to the linkmodes 10baseT_Half 10baseT_Full 100baseT_Half 100baseT_Full 1000baseT_Full 10000baseT_Full 2500baseX_Full 10000baseKX4_Full 20000baseKR2_Full 40000baseKR4_Full.

If I run the command ethtool however, I only get 5 supported linkmodes, namely 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full.

How can this difference be explained? Unfortunately, there is no documentation on the ethtool (https://mirrors.edge.kernel.org/pub/software/network/ethtool/devel.html). Like this tool, they also use the SIOCETHTOOL syscall, for which I can't find any documentation either.

I'd be grateful for any advice :)

peanut-cc commented 2 years ago

Hi, do you now know the meaning of the cmdGet["Supported"] value ?

gutjuri commented 2 years ago

Hi, do you now know the meaning of the cmdGet["Supported"] value ?

Yes, see the linked PR for details. Unfortunately there's still no goo documentation of this value.