PCI passthrough SRIOV support
the grouping implemtation is generic, not only for SRIOV, and flexible.
Contents
Requements from SRIOV
- group device
for SRIOV, all VFs belong to same PF share same physical network reachability. so if you want, say, deploy a vlan network, you need choose the right PF's VF, otherwise network does not work for you.
- tracking device alloced to the NIC
networking or other special deive is not as simple as pass though to the VM, there is need more configration. to acheive this, SRIOV must know the device infomation allocation to the specific NIC.
group the devices
spec: a filter defined by (k,v) paris extra_spec: the filter defined by (k, v) and k not in the pci object fileds.
pci utils/objects support grouping
* pci utils k,v match support the list values * objects provide a class level extrac interface to extract base spec and extra spec
white list import address set
* white list support 'address':[bdf1, ....] * white list support any other (k,v) pair to group or store special infomation * object extrac specs and extra_info, specs use as whitelist spec, extra info will be updated to device's extra_info fields
enable alias request extra property
* alis can specify extra (k,v) pairs * pci manager use extrac method extrac the specs and extra_specs, match them agains the pci object object.extra_info.
pci stats grouping device on demand
* pci_grouping_key configration option define a set of key name which will used to group the device to stats * default value is [vendor_id, product_id], this current implemtation * limited support to 3 keys grouping for algorithm simplicity.
tracking device allocated to alias
here is the idea how user can identify which device allocated for the pci alias.
* while allocated such device, user put a marker into the device ( in the pci device extra_info fileds) *after finised allocation, user can seach a instance's pci devices to find the specific marker
the way marker data transfer from user to device utilize the pci_request, which convert from the pci alias.
API for whitelist
not only the whitelist, the alias API also meaningful for administrator's pespective. the horizon could utilized the alias db to find what kind of device is avaliable to the tenants.
white list/ alias/ group on demand is all some kind of (k, v) pairs, PCI API can exploit this to achive high flexibility.
here is the very draft idea about API.
DB for pci configration
talbe: pci_config{ id compute_node_id object : whitelist/alias/group on demand key value value_type: string, RE, list # for further enhancement }
alias and on-demand group key is global.
DB API:
pci_config_get(context, obj_name):
pci_config_get_by_node(context, obj_name, node_id):
pci_config_update(context, obj_name, node_id, vlaues): update the one object one time, ie, the white list on host "A": pci_config_update(context, 'whitelist', "A", {"vendor_id":"v1", "proudect_id":"p1", "address":"a1" }):
PCI releated Objects
Objects: white list/ alias/ group keys(on demand grop) objects property: sets of k,v
API interface
config-object-name: whitelist/alias/group
GET/v2/{tenant_id}/os-pci-config show the pci configraion objects name. {"pci_config": ['alias', 'whitelist', 'group']}
GET/v2/{tenant_id}/os-pci-config/{config-object-name} show the pci configraion object's detail i.e {config-object-name} is pci_alias: {"pci_alias": [{'product_id':'8086', 'group':'nic-g1', 'compute-node-id':""}]} GET/v2/{tenant_id}/os-pci-config/{config-object-name}/{compute-node-id'} show the pci configraion object's detail i.e {config-object-name} is pci_whitelist: {"pci_whitelist": {'product_id':'8086', 'group':'nic-g1', 'compute-node-id':"3"}}
PUT/v2/{tenant_id}/os-pci-config/{config-object-name}/{compute-node-id} ie. i.e {config-object-name} is pci_whitelist: {"pci_whitelist": {'product_id':'8086', 'address':'a1' , 'group':'nic-g1'}} PUT/v2/{tenant_id}/os-pci-config/{config-object-name}/ update a global configration. DELETE/v2/{tenant_id}/os-pci-config/{config-object-name}/{compute_node_id} DELETE/v2/{tenant_id}/os-pci-config/{config-object-name}/
UPDATE//v2/{tenant_id}/os-pci-config/{config-object-name}/ UPDATE//v2/{tenant_id}/os-pci-config/{config-object-name}/{compute_node_id} make config config-object-name