sriov

package
v0.1.0-beta Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PF: 0000:03:00.0-0xXXXX is 19.
	// VF: 0000:03:00.0-0xXXXX-vfY is 23.
	PFUIDLength    = 19
	MinVFUIDLength = 23
)
View Source
const (
	FairShareProfile = "fairShare"
)

Variables

View Source
var PerDeviceIdProfiles = map[string][]string{

	"0x56c0": {"flex170_m1", "flex170_m2", "flex170_m4", "flex170_m5", "flex170_m8", "flex170_m16"},

	"0x56c1": {"flex140_m1", "flex140_m3", "flex140_m6", "flex140_m12"},

	"0x0bd0": {"max_c1", "max_c2", "max_c4", "max_c8", "max_c16", "max_c32", "max_c63"},

	"0x0bd5": {"max_c1", "max_c2", "max_c4", "max_c8", "max_c16", "max_c32", "max_c63"},

	"0x0bd6": {"max_c1", "max_c2", "max_c4", "max_c8", "max_c16", "max_c32", "max_c63"},

	"0x0bd7": {"max_c1", "max_c2", "max_c4", "max_c8", "max_c16", "max_c32", "max_c63"},

	"0x0bd8": {"max_c1", "max_c2", "max_c4", "max_c8", "max_c16", "max_c32", "max_c63"},

	"0x0bd9": {"max_c1", "max_c2", "max_c4", "max_c8", "max_c16", "max_c32", "max_c63"},

	"0x0bda": {"max_c1", "max_c2", "max_c4", "max_c8", "max_c16", "max_c32", "max_c63"},

	"0x0bdb": {"max_c1", "max_c2", "max_c4", "max_c8", "max_c16", "max_c32", "max_c63"},
}

PerDeviceIdProfiles has to be ordered descending by size, the profile picking logic relies on this.

View Source
var Profiles = map[string]map[string]uint64{

	"flex170_m1": {
		"contexts_quota":     1024,
		"doorbells_quota":    240,
		"exec_quantum_ms":    64,
		"ggtt_quota":         4026531840,
		"lmem_quota":         16106127360,
		"preempt_timeout_us": 128000,
		"numvfs":             1,
	},
	"flex170_m2": {
		"contexts_quota":     1024,
		"doorbells_quota":    120,
		"exec_quantum_ms":    32,
		"ggtt_quota":         2013265920,
		"lmem_quota":         8053063680,
		"preempt_timeout_us": 64000,
		"numvfs":             2,
	},
	"flex170_m4": {
		"contexts_quota":     1024,
		"doorbells_quota":    60,
		"exec_quantum_ms":    16,
		"ggtt_quota":         1006632960,
		"lmem_quota":         4026531840,
		"preempt_timeout_us": 32000,
		"numvfs":             4,
	},
	"flex170_m5": {
		"contexts_quota":     1024,
		"doorbells_quota":    48,
		"exec_quantum_ms":    12,
		"ggtt_quota":         805306368,
		"lmem_quota":         3221225472,
		"preempt_timeout_us": 24000,
		"numvfs":             5,
	},
	"flex170_m8": {
		"contexts_quota":     1024,
		"doorbells_quota":    30,
		"exec_quantum_ms":    8,
		"ggtt_quota":         503316480,
		"lmem_quota":         2013265920,
		"preempt_timeout_us": 16000,
		"numvfs":             8,
	},
	"flex170_m16": {
		"contexts_quota":     1024,
		"doorbells_quota":    15,
		"exec_quantum_ms":    4,
		"ggtt_quota":         251658240,
		"lmem_quota":         1006632960,
		"preempt_timeout_us": 8000,
		"numvfs":             16,
	},

	"flex140_m1": {
		"contexts_quota":     1024,
		"doorbells_quota":    240,
		"exec_quantum_ms":    64,
		"ggtt_quota":         4026531840,
		"lmem_quota":         5368709120,
		"preempt_timeout_us": 128000,
		"numvfs":             1,
	},
	"flex140_m3": {
		"contexts_quota":     1024,
		"doorbells_quota":    80,
		"exec_quantum_ms":    22,
		"ggtt_quota":         1342177280,
		"lmem_quota":         1788870656,
		"preempt_timeout_us": 44000,
		"numvfs":             3,
	},
	"flex140_m6": {
		"contexts_quota":     1024,
		"doorbells_quota":    40,
		"exec_quantum_ms":    16,
		"ggtt_quota":         671088640,
		"lmem_quota":         893386752,
		"preempt_timeout_us": 32000,
		"numvfs":             6,
	},
	"flex140_m12": {
		"contexts_quota":     1024,
		"doorbells_quota":    20,
		"exec_quantum_ms":    8,
		"ggtt_quota":         335544320,
		"lmem_quota":         446693376,
		"preempt_timeout_us": 16000,
		"numvfs":             12,
	},

	"max_c1": {
		"contexts_quota":     1024,
		"doorbells_quota":    240,
		"exec_quantum_ms":    64,
		"ggtt_quota":         4026531840,
		"lmem_quota":         64424509440,
		"preempt_timeout_us": 128000,
		"numvfs":             1,
	},
	"max_c2": {
		"contexts_quota":     1024,
		"doorbells_quota":    120,
		"exec_quantum_ms":    64,
		"ggtt_quota":         2013265920,
		"lmem_quota":         32212254720,
		"preempt_timeout_us": 128000,
		"numvfs":             2,
	},
	"max_c4": {
		"contexts_quota":     1024,
		"doorbells_quota":    60,
		"exec_quantum_ms":    64,
		"ggtt_quota":         1006632960,
		"lmem_quota":         16106127360,
		"preempt_timeout_us": 128000,
		"numvfs":             4,
	},
	"max_c8": {
		"contexts_quota":     1024,
		"doorbells_quota":    30,
		"exec_quantum_ms":    32,
		"ggtt_quota":         503316480,
		"lmem_quota":         8053063680,
		"preempt_timeout_us": 64000,
		"numvfs":             8,
	},
	"max_c16": {
		"contexts_quota":     1024,
		"doorbells_quota":    15,
		"exec_quantum_ms":    16,
		"ggtt_quota":         251658240,
		"lmem_quota":         4026531840,
		"preempt_timeout_us": 32000,
		"numvfs":             16,
	},
	"max_c32": {
		"contexts_quota":     1024,
		"doorbells_quota":    7,
		"exec_quantum_ms":    8,
		"ggtt_quota":         125829120,
		"lmem_quota":         2013265920,
		"preempt_timeout_us": 16000,
		"numvfs":             32,
	},
	"max_c63": {
		"contexts_quota":     1024,
		"doorbells_quota":    3,
		"exec_quantum_ms":    4,
		"ggtt_quota":         63897600,
		"lmem_quota":         1021313024,
		"preempt_timeout_us": 8000,
		"numvfs":             32,
	},
	FairShareProfile: {
		"contexts_quota":     0,
		"doorbells_quota":    0,
		"exec_quantum_ms":    0,
		"ggtt_quota":         0,
		"lmem_quota":         0,
		"preempt_timeout_us": 0,
		"numvfs":             0,
	},
}
View Source
var VfAttributeFiles = []string{
	"contexts_quota",
	"doorbells_quota",
	"exec_quantum_ms",
	"ggtt_quota",
	"lmem_quota",
	"preempt_timeout_us",
}

Functions

func MaxFairVFs

func MaxFairVFs(deviceId string, vfs []int) (int, error)

Return maximum number of VFs that PF resources can be split fairly into to suit for requested VFs combination. Example 1: 16 GiB GPU memory can be split into 4, 4, 4, 4 to serve two VFs that requested 2 and 4 GiB respectively. Four VFs can be provisioned by simple fair-share provisioning. Example 2: 16GiB GPU memory cannot be evenly split to server VFs that requested 8, 2, 2 GiB respectively because minimum fair-share split 16 / 3 would yield less memory (5.3 GiB) per VF than the biggest memory request (8).

func PfUIDFromVfUID

func PfUIDFromVfUID(uid string) (string, error)

Return PF UID parsed from VF UID. VF contains fully PF UID and VF index, for instance '0000:03:00.0-vf0-0x1234'.

func PickVFProfile

func PickVFProfile(deviceId string, vfMemoryRequestMiB int) (string, error)

Based on memory request - select suitable VF profile. Can be used in case fair share is not suitable.

func PreConfigureVF

func PreConfigureVF(vfAttrsPath string, drmVfIndex int, vfProfile string) error

Set custom VF settings from profile for manual provisioning mode, in case fair share is not suitable. pf/auto_provisioning will be automatically set to 0 in this case.

func UnConfigureVF

func UnConfigureVF(attrsDir string) error

Set VF settings to auto mode, writing 0 to all configuration files. It is important to set pf/auto_provisioning to 1 after all VFs are unconfigured.

func VFIndexFromUID

func VFIndexFromUID(uid string) (int, error)

Return PF UID parsed from VF UID. VF contains fully PF UID and VF index, for instance '0000:03:00.0-vf0-0x1234'.

Types

This section is empty.

Jump to

Keyboard shortcuts

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