kvdpa

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2022 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

View Source
const (
	VhostVdpaDriver  = "vhost_vdpa"
	VirtioVdpaDriver = "virtio_vdpa"
)

Exported constants

View Source
const (
	VdpaCmdUnspec uint8 = iota
	VdpaCmdMgmtDevNew
	VdpaCmdMgmtDevGet /* can dump */
	VdpaCmdDevNew
	VdpaCmdDevDel
	VdpaCmdDevGet       /* can dump */
	VdpaCmdDevConfigGet /* can dump */
)

VDPA Netlink Commands

View Source
const (
	VdpaAttrUnspec = iota

	/* bus name (optional) + dev name together make the parent device handle */
	VdpaAttrMgmtDevBusName          /* string */
	VdpaAttrMgmtDevDevName          /* string */
	VdpaAttrMgmtDevSupportedClasses /* u64 */

	VdpaAttrDevName      /* string */
	VdpaAttrDevID        /* u32 */
	VdpaAttrDevVendorID  /* u32 */
	VdpaAttrDevMaxVqs    /* u32 */
	VdpaAttrDevMaxVqSize /* u16 */
	VdpaAttrDevMinVqSize /* u16 */

	VdpaAttrDevNetCfgMacAddr /* binary */
	VdpaAttrDevNetStatus     /* u8 */
	VdpaAttrDevNetCfgMaxVqp  /* u16 */
	VdpaAttrGetNetCfgMTU     /* u16 */

	/* new attributes must be added above here */
	VdpaAttrMax
)

VDPA Netlink Attributes

View Source
const (
	VdpaGenlName = "vdpa"
)

Vdpa Netlink Name

Variables

This section is empty.

Functions

func AddVdpaDevice added in v0.1.4

func AddVdpaDevice(mgmtDeviceName string, vdpaDeviceName string) error

AddVdpaDevice adds a new vdpa device to the given management device

func DeleteVdpaDevice added in v0.1.4

func DeleteVdpaDevice(vdpaDeviceName string) error

DeleteVdpaDevice deletes a vdpa device

func SetNetlinkOps added in v0.1.4

func SetNetlinkOps(mockInst NetlinkOps)

SetNetlinkOps method would be used by unit tests

Types

type MgmtDev added in v0.1.4

type MgmtDev interface {
	BusName() string // Optional
	DevName() string //
	Name() string    // The MgmtDevName is BusName/DevName
}

MgmtDev represents a Vdpa Management Device

func GetVdpaMgmtDevices added in v0.1.4

func GetVdpaMgmtDevices(busName, devName string) (MgmtDev, error)

GetVdpaMgmtDevices returns a MgmtDev based on a busName and deviceName

func ListVdpaMgmtDevices added in v0.1.4

func ListVdpaMgmtDevices() ([]MgmtDev, error)

ListVdpaMgmtDevices returns the list of all available MgmtDevs

type NetlinkOps added in v0.1.4

type NetlinkOps interface {
	RunVdpaNetlinkCmd(command uint8, flags int, data []*nl.RtAttr) ([][]byte, error)
	NewAttribute(attrType int, data interface{}) (*nl.RtAttr, error)
}

NetlinkOps defines the Netlink Operations

func GetNetlinkOps added in v0.1.4

func GetNetlinkOps() NetlinkOps

GetNetlinkOps will be invoked by functions in other packages that would need access to the sriovnet library methods.

type VdpaDevice

type VdpaDevice interface {
	Driver() string
	Name() string
	MgmtDev() MgmtDev
	VirtioNet() VirtioNet
	VhostVdpa() VhostVdpa
	ParentDevicePath() (string, error)
}

VdpaDevice contains information about a Vdpa Device

func GetVdpaDevice added in v0.1.4

func GetVdpaDevice(name string) (VdpaDevice, error)

GetVdpaDevice returns the vdpa device information by a vdpa device name

func GetVdpaDevicesByMgmtDev added in v0.1.4

func GetVdpaDevicesByMgmtDev(busName, devName string) ([]VdpaDevice, error)

GetVdpaDevicesByMgmtDev returns the VdpaDevice objects whose MgmtDev has the given bus and device names.

func GetVdpaDevicesByPciAddress added in v0.1.4

func GetVdpaDevicesByPciAddress(pciAddress string) ([]VdpaDevice, error)

GetVdpaDevicesByPciAddress returns the VdpaDevice objects for the given pciAddress

The pciAddress must have one of the following formats:
- MgmtBusName/MgmtDevName
- MgmtDevName

func ListVdpaDevices added in v0.1.4

func ListVdpaDevices() ([]VdpaDevice, error)

ListVdpaDevices returns a list of all available vdpa devices

type VhostVdpa added in v0.1.4

type VhostVdpa interface {
	Name() string
	Path() string
}

VhostVdpa is the vhost-vdpa device information

func GetVhostVdpaDevInPath added in v0.1.4

func GetVhostVdpaDevInPath(parentPath string) (VhostVdpa, error)

GetVhostVdpaDevInPath returns the VhostVdpa found in the provided parent device's path

type VirtioNet added in v0.1.4

type VirtioNet interface {
	Name() string
	NetDev() string
}

VirtioNet is the virtio-net device information

func GetVirtioNetInPath added in v0.1.4

func GetVirtioNetInPath(parentPath string) (VirtioNet, error)

GetVirtioNetInPath returns the VirtioNet found in the provided parent device's path

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL