Skip to content

Commit 82a9f1d

Browse files
sanilkumar0pbg-intel
authored andcommitted
Updates to virtualmanagment API
Signed-off-by: Kumar, Sanil <sanil.kumar@intel.com>
1 parent 513d4d6 commit 82a9f1d

3 files changed

Lines changed: 44 additions & 77 deletions

File tree

scripts/sysman/EXT_Exp_VirtualFunctionManagement.rst

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,18 @@ API
2121

2222
* Functions
2323

24-
* ${s}DeviceEnumActiveVFExp
25-
* ${s}VFManagementGetVFPropertiesExp
24+
* ${s}DeviceEnumEnabledVFExp
25+
* ${s}VFManagementGetVFCapabilitiesExp
2626
* ${s}VFManagementGetVFMemoryUtilizationExp
2727
* ${s}VFManagementGetVFEngineUtilizationExp
2828

2929
* Enumerations
3030

3131
* ${s}_vf_management_exp_version_t
32-
* ${s}_vf_info_mem_type_exp_flags_t
33-
* ${s}_vf_info_util_exp_flags_t
3432

3533
* Structures
3634

37-
* ${s}_vf_exp_properties_t
35+
* ${s}_vf_exp_capabilities_t
3836
* ${s}_vf_util_mem_exp_t
3937
* ${s}_vf_util_engine_exp_t
4038

@@ -51,33 +49,29 @@ The following pseudo-code demonstrates a sequence for obtaining the engine activ
5149
5250
// Gather count of VF handles
5351
uint32_t numVf = 0;
54-
${s}_vf_exp_properties_t vfProps {};
55-
${s}DeviceEnumActiveVFExp(hDevice, &numVf, nullptr);
52+
${s}_vf_exp_capabilities_t vfProps {};
53+
${s}DeviceEnumEnabledVFExp(hDevice, &numVf, nullptr);
5654
5755
// Allocate memory for vf handles and call back in to gather handles
5856
std::vector<${s}_vf_handle_t> vfs(numVf, nullptr);
59-
${s}DeviceEnumActiveVFExp(hDevice, &numVf, vfs.data());
57+
${s}DeviceEnumEnabledVFExp(hDevice, &numVf, vfs.data());
6058
6159
// Gather VF properties
62-
std::vector <${s}_vf_exp_properties_t> vfProps(numVf);
60+
std::vector <${s}_vf_exp_capabilities_t> vfProps(numVf);
6361
for (uint32_t i = 0; i < numVf; i++) {
64-
${s}VFManagementGetVFPropertiesExp(vfs[i], &vfProps[i]);
62+
${s}VFManagementGetVFCapabilitiesExp(vfs[i], &vfProps[i]);
6563
}
6664
6765
// Detect the info types a particular VF supports
6866
6967
// Using VF# 0 to demonstrate how to detect engine info type and query engine util info
7068
${s}_vf_handle_t activeVf = vfs[0];
71-
uint32_t count = 1;
72-
unit32_t engineUtilPercent = 0;
73-
if (vfProps[0].flags & ZES_VF_INFO_ENGINE) {
74-
${s}_vf_util_engine_exp_t engineUtil0 = {};
75-
${s}VFManagementGetVFEngineUtilizationExp(activeVf, &count, &engineUtil0);
76-
sleep(1)
77-
${s}_vf_util_engine_exp_t engineUtil1 = {};
78-
${s}VFManagementGetVFEngineUtilizationExp(activeVf, &count, &engineUtil1);
79-
// Use formula to calculate engine utilization % based on the 2 snapshots above
80-
engineUtilPercent = (engineUtil1.activeCounterValue - engineUtil0.activeCounterValue) / engineUtil1.samplingCounterValue - engineUtil0.samplingCounterValue
81-
}
82-
83-
69+
uint32_t engineStatCount = 0;
70+
71+
${s}VFManagementGetVFEngineUtilizationExp(activeVf, &engineStatCount, nullptr);
72+
// Allocate memory for vf engine stats
73+
${s}_vf_util_engine_exp_t* engineStats0 = (${s}_vf_util_engine_exp_t*) allocate(engineStatCount * sizeof(${s}_vf_util_engine_exp_t));
74+
${s}VFManagementGetVFEngineUtilizationExp(activeVf, &engineStatCount, engineStats0);
75+
sleep(1)
76+
${s}_vf_util_engine_exp_t* engineStats1 = (${s}_vf_util_engine_exp_t*) allocate(engineStatCount * sizeof(${s}_vf_util_engine_exp_t));
77+
${s}VFManagementGetVFEngineUtilizationExp(activeVf, &engineStatCount, &engineStats1);

scripts/sysman/common.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,10 @@ etors:
233233
value: "0x00020004"
234234
desc: $s_subdevice_exp_properties_t
235235
version: "1.9"
236-
- name: VF_EXP_PROPERTIES
236+
- name: VF_EXP_CAPABILITIES
237237
value: "0x00020005"
238-
desc: $s_vf_exp_properties_t
239-
version: "1.9"
238+
desc: $s_vf_exp_capabilities_t
239+
version: "1.10"
240240
- name: VF_UTIL_MEM_EXP
241241
value: "0x00020006"
242242
desc: $s_vf_util_mem_exp_t

scripts/sysman/virtualFunctionManagement.yml

Lines changed: 24 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -28,65 +28,36 @@ etors:
2828
value: "$X_MAKE_VERSION( 1, 1 )"
2929
desc: "version 1.1"
3030
--- #--------------------------------------------------------------------------
31-
type: enum
32-
desc: "Virtual function memory types"
33-
version: "1.9"
34-
class: $sVFManagement
35-
name: $s_vf_info_mem_type_exp_flags_t
36-
etors:
37-
- name: MEM_TYPE_SYSTEM
38-
desc: "System memory"
39-
- name: MEM_TYPE_DEVICE
40-
desc: "Device local memory"
41-
--- #--------------------------------------------------------------------------
42-
type: enum
43-
desc: "Virtual function utilization flag bit fields"
44-
version: "1.9"
45-
class: $sVFManagement
46-
name: $s_vf_info_util_exp_flags_t
47-
etors:
48-
- name: INFO_NONE
49-
desc: "No info associated with virtual function"
50-
- name: INFO_MEM_CPU
51-
desc: "System memory utilization associated with virtual function"
52-
- name: INFO_MEM_GPU
53-
desc: "Device memory utilization associated with virtual function"
54-
- name: INFO_ENGINE
55-
desc: 'Engine utilization associated with virtual function'
56-
--- #--------------------------------------------------------------------------
5731
type: struct
58-
desc: "Virtual function management properties"
59-
version: "1.9"
32+
desc: "Virtual function management capabilities"
33+
version: "1.10"
6034
class: $sVFManagement
61-
name: $s_vf_exp_properties_t
35+
name: $s_vf_exp_capabilities_t
6236
base: $s_base_properties_t
6337
members:
6438
- type: $s_pci_address_t
6539
name: "address"
6640
desc: "[out] Virtual function BDF address"
67-
- type: $s_uuid_t
68-
name: uuid
69-
desc: "[out] universal unique identifier of the device"
70-
- type: $s_vf_info_util_exp_flags_t
71-
name: "flags"
72-
desc: "[out] utilization flags available. May be 0 or a valid combination of $s_vf_info_util_exp_flag_t."
41+
- type: uint32_t
42+
name: "vfDeviceMemSize"
43+
desc: "[out] Virtual function memory size in bytes"
44+
- type: uint32_t
45+
name: "vfID"
46+
desc: "[out] Virtual Function ID"
7347
--- #--------------------------------------------------------------------------
7448
type: struct
7549
desc: "Provides memory utilization values for a virtual function"
76-
version: "1.9"
50+
version: "1.10"
7751
class: $sVFManagement
7852
name: $s_vf_util_mem_exp_t
7953
base: $s_base_state_t
8054
members:
81-
- type: $s_vf_info_mem_type_exp_flags_t
82-
name: "memTypeFlags"
83-
desc: "[out] Memory type flags."
55+
- type: $s_mem_loc_t
56+
name: "vfMemLocation"
57+
desc: "[out] Location of this memory (system, device)"
8458
- type: uint64_t
85-
name: "free"
59+
name: "vfMemUtilized"
8660
desc: "[out] Free memory size in bytes."
87-
- type: uint64_t
88-
name: "size"
89-
desc: "[out] Total allocatable memory in bytes."
9061
--- #--------------------------------------------------------------------------
9162
type: struct
9263
desc: "Provides engine utilization values for a virtual function"
@@ -98,7 +69,7 @@ name: $s_vf_util_engine_exp_t
9869
base: $s_base_state_t
9970
members:
10071
- type: $s_engine_group_t
101-
name: "type"
72+
name: "vfEngineType"
10273
desc: "[out] The engine group."
10374
- type: uint64_t
10475
name: "activeCounterValue"
@@ -111,7 +82,7 @@ type: function
11182
desc: "Get handle of virtual function modules"
11283
version: "1.9"
11384
class: $sDevice
114-
name: EnumActiveVFExp
85+
name: EnumEnabledVFExp
11586
details:
11687
- "The application may call this function from simultaneous threads."
11788
- "The implementation of this function should be lock-free."
@@ -132,20 +103,20 @@ params:
132103
if count is less than the number of components of this type that are available, then the driver shall only retrieve that number of component handles.
133104
--- #--------------------------------------------------------------------------
134105
type: function
135-
desc: "Get virtual function management properties"
136-
version: "1.9"
106+
desc: "Get virtual function management capabilities"
107+
version: "1.10"
137108
class: $sVFManagement
138-
name: GetVFPropertiesExp
109+
name: GetVFCapabilitiesExp
139110
details:
140111
- "The application may call this function from simultaneous threads."
141112
- "The implementation of this function should be lock-free."
142113
params:
143114
- type: $s_vf_handle_t
144115
name: hVFhandle
145116
desc: "[in] Sysman handle for the VF component."
146-
- type: $s_vf_exp_properties_t*
147-
name: pProperties
148-
desc: "[in,out] Will contain VF properties."
117+
- type: $s_vf_exp_capabilities_t*
118+
name: pCapability
119+
desc: "[in,out] Will contain VF capability."
149120
--- #--------------------------------------------------------------------------
150121
type: function
151122
desc: "Get memory activity stats for each available memory types associated with Virtual Function (VF)"
@@ -155,6 +126,7 @@ name: GetVFMemoryUtilizationExp
155126
details:
156127
- "The application may call this function from simultaneous threads."
157128
- "The implementation of this function should be lock-free."
129+
- "If VF is disable/pause/not active, utilization will give zero value."
158130
params:
159131
- type: $s_vf_handle_t
160132
name: hVFhandle
@@ -180,6 +152,7 @@ name: GetVFEngineUtilizationExp
180152
details:
181153
- "The application may call this function from simultaneous threads."
182154
- "The implementation of this function should be lock-free."
155+
- "If VF is disable/pause/not active, utilization will give zero value."
183156
params:
184157
- type: $s_vf_handle_t
185158
name: hVFhandle

0 commit comments

Comments
 (0)