Documentation ¶
Overview ¶
Package pcidevices helps to query DPDK compatibles devices and to bind/unbind drivers
Package pcidevices helps to query DPDK compatibles devices and to bind/unbind drivers
Package pcidevices helps to query DPDK compatibles devices and to bind/unbind drivers
Package pcidevices helps to query DPDK compatibles devices and to bind/unbind drivers
Index ¶
- Constants
- Variables
- func BindPci(devID, driver, vendor, device string) (string, error)
- func GetCurrentPciDriver(devID string) (string, error)
- func IsModuleLoaded(driver string) bool
- func ProbePci(devID string) (string, error)
- func UnbindPci(devID, driver string) error
- type ClassFilter
- type ClassesFilter
- type PciDevice
- func (p *PciDevice) Bind(driver string) error
- func (p *PciDevice) Class() string
- func (p *PciDevice) ClassExt() string
- func (p *PciDevice) CurrentDriver() (string, error)
- func (p *PciDevice) Device() string
- func (p *PciDevice) DeviceExt() string
- func (p *PciDevice) Driver() string
- func (p *PciDevice) GetInfo() [5]string
- func (p *PciDevice) ID() string
- func (p *PciDevice) Probe() error
- func (p *PciDevice) String() string
- func (p *PciDevice) Unbind() error
- func (p *PciDevice) Vendor() string
- func (p *PciDevice) VendorExt() string
Constants ¶
const ( DriverUioPciGeneric = "uio_pci_generic" DriverIgbUio = "igb_uio" DriverVfioPci = "vfio-pci" )
Driver names
const ( PathSysPciDevices = "/sys/bus/pci/devices" PathSysPciDrivers = "/sys/bus/pci/drivers" PathSysPciDriverProbe = "/sys/bus/pci/drivers_probe" )
Path to PCI
const (
PathSysClassNet = "/sys/class/net"
)
Path to net
Variables ¶
var ( DefaultDpdkDriver = DriverVfioPci DpdkDrivers = [...]string{DriverUioPciGeneric, DriverIgbUio, DriverVfioPci} DpdkPciDrivers = [...]string{DriverUioPciGeneric, DriverIgbUio, DriverVfioPci} )
DPDK related drivers
var ( AllDevices = ClassesFilter{allClasses} NetworkDevices = ClassesFilter{networkClass, caviumPkx, avpVnic, ifpgaClass} BasebandDevices = ClassesFilter{accelerationClass} CryptoDevices = ClassesFilter{encryptionClass, intelProcessorClass} DmaDevices = ClassesFilter{cnxkDma, hisiliconDma, intelIdxdSpr, intelIoatBdw, intelIoatIcx, intelIoatSkx} EventdevDevices = ClassesFilter{caviumSso, caviumTim, intelDlb, cnxkSso} MempoolDevices = ClassesFilter{caviumFpa, cnxkNpa} CompressDevices = ClassesFilter{caviumZip} RegexDevices = ClassesFilter{cn9kRee} MiscDevices = ClassesFilter{cnxkBphy, cnxkBphyCgx, cnxkInlDev, intelNtbSkx, intelNtbIcx, virtioBlk} )
var ( ErrNoBoundDriver = errors.New("no driver is bound to the device") ErrAlreadyBoundDriver = errors.New("device has already bound the selected driver") ErrBind = errors.New("fail to bind the driver") ErrUnbind = errors.New("fail to unbind the driver") ErrUnsupportedDriver = errors.New("unsupported DPDK driver") ErrNotProbe = errors.New("device doesn't support 'drive_probe'") ErrKernelModuleNotLoaded = errors.New("kernel module is not loaded") ErrNoValidPciID = errors.New("no valid pci identifier") ErrNoDeviceID = errors.New("can't get device ID from NIC") )
Errors of devices package
var (
IsPciID *regexp.Regexp
)
Regular expressions for PCI-ID
Functions ¶
func GetCurrentPciDriver ¶
GetCurrentPciDriver returns the current driver that device bound to.
func IsModuleLoaded ¶
IsModuleLoaded checks if the kernel has already loaded the driver or not.
Types ¶
type ClassFilter ¶
type ClassesFilter ¶
type ClassesFilter []ClassFilter
type PciDevice ¶
type PciDevice struct {
// contains filtered or unexported fields
}
func GetPciDeviceByPciID ¶
GetPciDeviceByPciID gets device info by PCI bus id.
func GetPciDevices ¶
func GetPciDevices(classFilter ClassesFilter) ([]*PciDevice, error)
get the list of current PCI devices on this system. The list can be filteren by adding a classesfilter list
func NewDeviceByNicName ¶
NewDeviceByNicName returns a device by given NIC name, e.g. eth0.
func NewDeviceByPciID ¶
NewDeviceByPciID returns a PCI device by given PCI ID