Documentation ¶
Index ¶
- Constants
- func BindVf(handle *PfNetdevHandle, vf *VfObj) error
- func ConfigVfs(handle *PfNetdevHandle, privileged bool) error
- func DisableSriov(pfNetdevName string) error
- func EnableSriov(pfNetdevName string) error
- func FreeVf(handle *PfNetdevHandle, vf *VfObj)
- func FreeVfByNetdevName(handle *PfNetdevHandle, vfIndex int) error
- func GetNetDevicesFromAux(auxDev string) ([]string, error)
- func GetNetDevicesFromPci(pciAddress string) ([]string, error)
- func GetPfPciFromAux(auxDev string) (string, error)
- func GetPfPciFromVfPci(vfPciAddress string) (string, error)
- func GetRepresentorPeerMacAddress(netdev string) (net.HardwareAddr, error)
- func GetSfIndexByAuxDev(auxDev string) (int, error)
- func GetSfRepresentor(uplink string, sfNum int) (string, error)
- func GetUplinkRepresentor(pciAddress string) (string, error)
- func GetUplinkRepresentorFromAux(auxDev string) (string, error)
- func GetVfDefaultMacAddr(vfNetdevName string) (string, error)
- func GetVfIndexByPciAddress(vfPciAddress string) (int, error)
- func GetVfNetdevName(handle *PfNetdevHandle, vf *VfObj) string
- func GetVfPciDevList(pfNetdevName string) ([]string, error)
- func GetVfRepresentor(uplink string, vfIndex int) (string, error)
- func GetVfRepresentorDPU(pfID, vfIndex string) (string, error)
- func IsSriovEnabled(netdevName string) bool
- func IsSriovSupported(netdevName string) bool
- func IsVfPciVfioBound(pciAddr string) bool
- func SetPFLinkUp(pfNetdevName string) error
- func SetRepresentorPeerMacAddress(netdev string, mac net.HardwareAddr) error
- func SetVfDefaultGUID(handle *PfNetdevHandle, vf *VfObj) error
- func SetVfDefaultMacAddress(handle *PfNetdevHandle, vf *VfObj) error
- func SetVfPrivileged(handle *PfNetdevHandle, vf *VfObj, privileged bool) error
- func SetVfVlan(handle *PfNetdevHandle, vf *VfObj, vlan int) error
- func UnbindVf(handle *PfNetdevHandle, vf *VfObj) error
- type PfNetdevHandle
- type PortFlavour
- type VfObj
- type VfObject
Constants ¶
const ( NetSysDir = "/sys/class/net" PciSysDir = "/sys/bus/pci/devices" AuxSysDir = "/sys/bus/auxiliary/devices" )
const ( PORT_FLAVOUR_PHYSICAL = iota PORT_FLAVOUR_CPU PORT_FLAVOUR_DSA PORT_FLAVOUR_PCI_PF PORT_FLAVOUR_PCI_VF PORT_FLAVOUR_VIRTUAL PORT_FLAVOUR_UNUSED PORT_FLAVOUR_PCI_SF PORT_FLAVOUR_UNKNOWN = 0xffff )
Keep things consistent with netlink lib constants nolint:golint,stylecheck
Variables ¶
This section is empty.
Functions ¶
func BindVf ¶
func BindVf(handle *PfNetdevHandle, vf *VfObj) error
func ConfigVfs ¶
func ConfigVfs(handle *PfNetdevHandle, privileged bool) error
func DisableSriov ¶
func EnableSriov ¶
func FreeVf ¶
func FreeVf(handle *PfNetdevHandle, vf *VfObj)
func FreeVfByNetdevName ¶
func FreeVfByNetdevName(handle *PfNetdevHandle, vfIndex int) error
func GetNetDevicesFromAux ¶ added in v1.1.0
GetNetDeviceFromAux gets auxiliary device name (e.g 'mlx5_core.sf.2') and returns the correlate netdevice
func GetNetDevicesFromPci ¶
GetNetDevicesFromPci gets a PCI address (e.g '0000:03:00.1') and returns the correlate list of netdevices
func GetPfPciFromAux ¶ added in v1.1.0
GetPfPciFromAux retrieves the parent PF PCI address of the provided auxiliary device in D.T.f format
func GetPfPciFromVfPci ¶ added in v1.0.2
GetPfPciFromVfPci retrieves the parent PF PCI address of the provided VF PCI address in D:B:D.f format
func GetRepresentorPeerMacAddress ¶ added in v1.0.3
func GetRepresentorPeerMacAddress(netdev string) (net.HardwareAddr, error)
GetRepresentorPeerMacAddress returns the MAC address of the peer netdev associated with the given representor netdev Note:
This method functionality is currently supported only on DPUs. Currently only netdev representors with PORT_FLAVOUR_PCI_PF are supported
func GetSfIndexByAuxDev ¶ added in v1.1.0
GetSfIndexByAuxDev gets a SF device name (e.g 'mlx5_core.sf.2') and returns the correlate SF index.
func GetSfRepresentor ¶ added in v1.1.0
func GetUplinkRepresentor ¶
GetUplinkRepresentor gets a VF or PF PCI address (e.g '0000:03:00.4') and returns the uplink represntor netdev name for that VF or PF.
func GetUplinkRepresentorFromAux ¶ added in v1.1.0
GetUplinkRepresentorFromAux gets auxiliary device name (e.g 'mlx5_core.sf.2') and returns the uplink representor netdev name for device.
func GetVfDefaultMacAddr ¶
func GetVfIndexByPciAddress ¶
GetVfIndexByPciAddress gets a VF PCI address (e.g '0000:03:00.4') and returns the correlate VF index.
func GetVfNetdevName ¶
func GetVfNetdevName(handle *PfNetdevHandle, vf *VfObj) string
func GetVfPciDevList ¶
func GetVfRepresentorDPU ¶ added in v1.0.3
GetVfRepresentorDPU returns VF representor on DPU for a host VF identified by pfID and vfIndex
func IsSriovEnabled ¶
func IsSriovSupported ¶
func IsVfPciVfioBound ¶ added in v1.0.3
func SetPFLinkUp ¶
func SetRepresentorPeerMacAddress ¶ added in v1.0.3
func SetRepresentorPeerMacAddress(netdev string, mac net.HardwareAddr) error
SetRepresentorPeerMacAddress sets the given MAC addresss of the peer netdev associated with the given representor netdev. Note: This method functionality is currently supported only for DPUs. Currently only netdev representors with PORT_FLAVOUR_PCI_VF are supported
func SetVfDefaultGUID ¶
func SetVfDefaultGUID(handle *PfNetdevHandle, vf *VfObj) error
func SetVfDefaultMacAddress ¶
func SetVfDefaultMacAddress(handle *PfNetdevHandle, vf *VfObj) error
func SetVfPrivileged ¶
func SetVfPrivileged(handle *PfNetdevHandle, vf *VfObj, privileged bool) error
func UnbindVf ¶
func UnbindVf(handle *PfNetdevHandle, vf *VfObj) error
Types ¶
type PfNetdevHandle ¶
type PfNetdevHandle struct { PfNetdevName string List []*VfObj // contains filtered or unexported fields }
func GetPfNetdevHandle ¶
func GetPfNetdevHandle(pfNetdevName string) (*PfNetdevHandle, error)
type PortFlavour ¶ added in v1.0.3
type PortFlavour uint16
func GetRepresentorPortFlavour ¶ added in v1.0.3
func GetRepresentorPortFlavour(netdev string) (PortFlavour, error)
GetRepresentorPortFlavour returns the representor port flavour Note: this method does not support old representor names used by old kernels e.g <vf_num> and will return PORT_FLAVOUR_UNKNOWN for such cases.
type VfObj ¶
func AllocateVf ¶
func AllocateVf(handle *PfNetdevHandle) (*VfObj, error)
func AllocateVfByMacAddress ¶
func AllocateVfByMacAddress(handle *PfNetdevHandle, vfMacAddress string) (*VfObj, error)