Documentation ¶
Overview ¶
Package config is used to collect the devices configurations on the machine.
Index ¶
- Constants
- type Context
- func (c *Context) AddDevice(id int, path string, busType string) (err error)
- func (c *Context) DedicatedWQs(typ DeviceType) []*WorkQueue
- func (c *Context) Engines(typ DeviceType) (results []*Engine)
- func (c *Context) Init()
- func (c *Context) SharedWQs(typ DeviceType) []*WorkQueue
- func (c *Context) WorkQueues(typ DeviceType) []*WorkQueue
- type Device
- type DeviceType
- type Engine
- type GenCap
- type Group
- type WQType
- type WorkQueue
Constants ¶
const ( ModeDedicated = "dedicated" // ModeDedicated represents a dedicated workqueue mode )
const ( DeviceStateUnknown = "unknown" DeviceStateEnabled = "enabled" DeviceStateDisabled = "disabled" )
Device state constants.
const ( BlockOnFaultSupport = 1 << iota // Block on fault support. OverlappingSupport // Overlapping support. CacheControlSupportMemory // Cache control support memory. CacheControlSupportCacheFlush // Cache control support cache flush. CommandCapabilitiesSupport // Command capabilities support. DestinationReadbackSupport // Destination readback support. DrainDescriptorReadbackAddressSupport // Drain descriptor readback address support. ConfigurationSupport = 1 << 31 // Configuration support. )
Device capabilities constants.
const ( WQTypeKernel // WQTypeKernel indicates current wq is kernel mode. WQTypeUser // WQTypeUser indicates current wq is User mode. WQTypeMDev // WQTypeMDev indicates current wq is Mdev mode. )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
Devices []*Device
}
Context represents the devices information which supported on the local machine.
func (*Context) DedicatedWQs ¶
func (c *Context) DedicatedWQs(typ DeviceType) []*WorkQueue
DedicatedWQs returns the dedicated work queues of the specified device type.
func (*Context) Engines ¶
func (c *Context) Engines(typ DeviceType) (results []*Engine)
Engines returns the engines of the specified device type.
func (*Context) Init ¶
func (c *Context) Init()
Init starts to load devices information from the local sysfs.
func (*Context) SharedWQs ¶
func (c *Context) SharedWQs(typ DeviceType) []*WorkQueue
SharedWQs returns the shared work queues of the specified device type.
func (*Context) WorkQueues ¶
func (c *Context) WorkQueues(typ DeviceType) []*WorkQueue
WorkQueues returns the work queues of the specified device type.
type Device ¶
type Device struct { MaxGroups int `binding:""` // Maximum number of groups. MaxWorkQueues int `binding:""` // Maximum number of work queues. MaxEngines int `binding:""` // Maximum number of engines. MaxWorkQueuesSize int `binding:""` // Maximum size of work queues. NumaNode int `binding:""` // NUMA node. ImsSize int `binding:""` // IMS size. MaxBatchSize int `binding:""` // Maximum batch size. MaxTransferSize uint64 `binding:""` // Maximum transfer size. GenCap uint64 `binding:""` // Generation capabilities. Configurable int `binding:""` // Configurable parameters. PasidEnabled bool `binding:""` // PASID enabled. MaxReadBuffers int `binding:""` // Maximum number of read buffers. ReadBufferLimit uint64 `binding:""` // Read buffer limit. CdevMajor uint64 `binding:""` // cdev major number. Version uint64 `binding:""` // Device version number. State string `binding:""` // Device state. ID uint64 // Device ID. OpCap [4]uint64 // Device operation capabilities. Path string // Device's sysfs path. MDevPath string // Device's mediated device path. Type DeviceType // Device type. BusType string // Bus type. Groups []*Group // Groups associated with the device. Engines []*Engine `json:"-"` // Engines associated with the device. WorkQueues []*WorkQueue `json:"-"` // Work queues associated with the device. }
Device represents a device with parameters.
type DeviceType ¶
type DeviceType uint8
DeviceType is a type of device.
const ( DSA DeviceType = 0 // DSA represents a device type of DSA. IAA DeviceType = 1 // IAA represents a device type of IAA. )
func (DeviceType) Name ¶
func (t DeviceType) Name() string
Name returns the name of the device type.
func (DeviceType) Names ¶
func (t DeviceType) Names() []string
Names returns the names of the device type.
func (DeviceType) String ¶
func (t DeviceType) String() string
String returns the string representation of the device type.
type Engine ¶
type Engine struct { // Device is the device this engine belongs to. Device *Device `json:"-"` // Group is the group this engine belongs to. Group *Group `json:"-"` // Type is the type of this engine. Type int // ID is the ID of this engine. ID int // GroupID is the ID of the group this engine belongs to. GroupID int `binding:""` }
Engine represents an engine in a device.
type GenCap ¶
type GenCap struct { BlockOnFault bool // Block on fault support. Overlapping bool // Overlapping support. CacheControlMemory bool // Cache control support memory. CacheControlCacheFlush bool // Cache control support cache flush. CommandCapabilities bool // Command capabilities support. DestinationReadback bool // Destination readback support. DrainDescriptorReadbackAddress bool // Drain descriptor readback address support. ConfigurationSupport bool // Configuration support. MaxTransferSize uint64 // Maximum transfer size. MaxBatchSize uint64 // Maximum batch size. InterruptMessageStorageSize uint64 // Interrupt message storage size. }
GenCap represents a device's generation capabilities.
func ParseGenCap ¶
ParseGenCap parses a uint64 value representing a device's generation capabilities.
type Group ¶
type Group struct { // Device is the device that manages the group. Device *Device `json:"-"` // ID is the ID of the group. ID int // Path is the path to the group. Path string // NumaNode is the NUMA node the group belongs to. NumaNode int // GroupID is the ID of the group. GroupID int // Engines is the list of engines in the group. Engines string `binding:""` // WorkQueues is the list of work queues in the group. WorkQueues string `binding:""` // ReadBuffersReserved is the number of read buffers reserved. ReadBuffersReserved uint64 `binding:""` // ReadBufferAllowed is the number of read buffers allowed. ReadBufferAllowed uint64 `binding:""` // UseReadBufferLimit is the number of read buffers to use. UseReadBufferLimit uint64 `binding:""` // TrafficClassA is the number of traffic class A messages. TrafficClassA uint64 `binding:""` // TrafficClassB is the number of traffic class B messages. TrafficClassB uint64 `binding:""` // GroupedEngines is the list of engines in the group. GroupedEngines []*Engine // GroupedWorkQueues is the list of work queues in the group. GroupedWorkQueues []*WorkQueue }
Group represents a group of devices managed by a device.
type WorkQueue ¶
type WorkQueue struct { Device *Device `json:"-"` // Device associated with the work queue. Group *Group `json:"-"` // Group associated with the work queue. ID int // Work queue ID. NumaNode int // NUMA node. DeviceName string // Device name. Path string // Path to the work queue. GroupID int `binding:""` // ID of the group associated with the work queue. Size int `binding:""` // Work queue size. Priority int `binding:""` // Queue priority. BlockOnFault int `binding:""` // Block on fault flag. CdevMinor int `binding:""` // cdev minor number. Type string `binding:""` // Type of the work queue. Name string `binding:""` // Name of the work queue. Mode string `binding:""` // Mode of the work queue. State string `binding:""` // State of the work queue. DriverName string `binding:""` // Name of the driver. Threshold uint `binding:""` // Threshold limit. MaxBatchSize uint `binding:""` // Maximum batch size. MaxTransferSize uint64 `binding:""` // Maximum transfer size. AtsDisable int `binding:""` // ATS disable flag. }
WorkQueue represents a work queue of a device.
func (*WorkQueue) DevicePath ¶
DevicePath returns the device path of a work queue.