Documentation
¶
Overview ¶
Package ethtool aims to provide a library giving a simple access to the Linux SIOCETHTOOL ioctl operations. It can be used to retrieve informations from a network device like statistics, driver related informations or even the peer of a VETH interface.
Package ethtool aims to provide a library giving a simple access to the Linux SIOCETHTOOL ioctl operations. It can be used to retrieve informations from a network device like statistics, driver related informations or even the peer of a VETH interface.
Package ethtool aims to provide a library giving a simple access to the Linux SIOCETHTOOL ioctl operations. It can be used to retrieve informations from a network device like statistics, driver related informations or even the peer of a VETH interface.
Index ¶
- Constants
- func BusInfo(intf string) (string, error)
- func CmdGetMapped(intf string) (map[string]uint64, error)
- func DriverName(intf string) (string, error)
- func MsglvlGet(intf string) (uint32, error)
- func MsglvlSet(intf string, valset uint32) (uint32, uint32, error)
- func PermAddr(intf string) (string, error)
- func Stats(intf string) (map[string]uint64, error)
- type Ethtool
- func (e *Ethtool) BusInfo(intf string) (string, error)
- func (e *Ethtool) Change(intf string, config map[string]bool) error
- func (e *Ethtool) Close()
- func (e *Ethtool) CmdGet(ecmd *EthtoolCmd, intf string) (uint32, error)
- func (e *Ethtool) CmdGetMapped(intf string) (map[string]uint64, error)
- func (e *Ethtool) CmdSet(ecmd *EthtoolCmd, intf string) (uint32, error)
- func (e *Ethtool) DriverInfo(intf string) (ethtoolDrvInfo, error)
- func (e *Ethtool) DriverName(intf string) (string, error)
- func (e *Ethtool) FeatureNames(intf string) (map[string]uint, error)
- func (e *Ethtool) Features(intf string) (map[string]bool, error)
- func (e *Ethtool) LinkState(intf string) (uint32, error)
- func (e *Ethtool) ModuleEeprom(intf string) ([]byte, error)
- func (e *Ethtool) ModuleEepromHex(intf string) (string, error)
- func (e *Ethtool) MsglvlGet(intf string) (uint32, error)
- func (e *Ethtool) MsglvlSet(intf string, valset uint32) (uint32, uint32, error)
- func (e *Ethtool) PermAddr(intf string) (string, error)
- func (e *Ethtool) Stats(intf string) (map[string]uint64, error)
- type EthtoolCmd
Constants ¶
const ( ETH_GSTRING_LEN = 32 ETH_SS_STATS = 1 ETH_SS_FEATURES = 4 ETHTOOL_GDRVINFO = 0x00000003 ETHTOOL_GSTRINGS = 0x0000001b ETHTOOL_GSTATS = 0x0000001d // other CMDs from ethtool-copy.h of ethtool-3.5 package ETHTOOL_GSET = 0x00000001 /* Get settings. */ ETHTOOL_SSET = 0x00000002 /* Set settings. */ ETHTOOL_GMSGLVL = 0x00000007 /* Get driver message level */ ETHTOOL_SMSGLVL = 0x00000008 /* Set driver msg level. */ /* Get link status for host, i.e. whether the interface *and* the * physical port (if there is one) are up (ethtool_value). */ ETHTOOL_GLINK = 0x0000000a ETHTOOL_GMODULEINFO = 0x00000042 /* Get plug-in module information */ ETHTOOL_GMODULEEEPROM = 0x00000043 /* Get plug-in module eeprom */ ETHTOOL_GPERMADDR = 0x00000020 ETHTOOL_GFEATURES = 0x0000003a /* Get device offload settings */ ETHTOOL_SFEATURES = 0x0000003b /* Change device offload settings */ ETHTOOL_GFLAGS = 0x00000025 /* Get flags bitmap(ethtool_value) */ ETHTOOL_GSSET_INFO = 0x00000037 /* Get string set info */ )
ethtool stats related constants.
const ( MAX_GSTRINGS = 300000 MAX_FEATURE_BLOCKS = (MAX_GSTRINGS + 32 - 1) / 32 EEPROM_LEN = 640 PERMADDR_LEN = 32 )
MAX_GSTRINGS maximum number of stats entries that ethtool can retrieve currently.
const (
IFNAMSIZ = 16
)
Maximum size of an interface name
const (
SIOCETHTOOL = 0x8946
)
ioctl ethtool request
Variables ¶
This section is empty.
Functions ¶
func DriverName ¶
DriverName returns the driver name of the given interface name.
Types ¶
type Ethtool ¶
type Ethtool struct {
// contains filtered or unexported fields
}
func (*Ethtool) CmdGet ¶
func (e *Ethtool) CmdGet(ecmd *EthtoolCmd, intf string) (uint32, error)
CmdGet returns the interface settings in the receiver struct and returns speed
func (*Ethtool) CmdGetMapped ¶
CmdGetMapped returns the interface settings in a map
func (*Ethtool) CmdSet ¶
func (e *Ethtool) CmdSet(ecmd *EthtoolCmd, intf string) (uint32, error)
CmdSet sets and returns the settings in the receiver struct and returns speed
func (*Ethtool) DriverInfo ¶
DriverInfo returns driver information of the given interface name.
func (*Ethtool) DriverName ¶
DriverName returns the driver name of the given interface name.
func (*Ethtool) FeatureNames ¶
FeatureNames shows supported features by their name.
func (*Ethtool) ModuleEeprom ¶
ModuleEeprom returns Eeprom information of the given interface name.
func (*Ethtool) ModuleEepromHex ¶
ModuleEeprom returns Eeprom information of the given interface name.
func (*Ethtool) MsglvlSet ¶
MsglvlSet returns the read-msglvl, post-set-msglvl of the given interface.
type EthtoolCmd ¶
type EthtoolCmd struct {
Cmd uint32
Supported uint32
Advertising uint32
Speed uint16
Duplex uint8
Port uint8
Phy_address uint8
Transceiver uint8
Autoneg uint8
Mdio_support uint8
Maxtxpkt uint32
Maxrxpkt uint32
Speed_hi uint16
Eth_tp_mdix uint8
Reserved2 uint8
Lp_advertising uint32
Reserved [2]uint32
}
