...
- Create VFs for
PhyIoNetEthPF
if requested throughPhysicalIO.cbattr["sriov-vf-count"]
:echo <vf-num> > /sys/class/net/<device-name>/device/sriov_numvfs
It may need to wait for a few seconds for the VFs to be created by the PF driver.
This could be deferred until there is at least one VF assignment requested. Once VFs are created, domainmgr needs to collect information about them, most importantly their PCI addresses. This can be obtained from the sys filesystem:
No Format $ ls -l /sys/class/net/eth0/device/virtfn* /sys/class/net/eth0/device/virtfn0 ->../0000:18:02.0 /sys/class/net/eth0/device/virtfn1 -> ../0000:18:02.1 /sys/class/net/eth0/device/virtfn2 -> ../0000:18:02.2
Note that the PCI address uses BDF notation (bus:device.function). VF ID is used as the function number.
The list of VFs would be added to
IOBundle
(bundle itself would be the PF):No Format type IoBundle struct { … VFs []EthVF } type EthVF struct { Index uint8 PciLong string Ifname string UsedByUUID uuid.UUID // etc. }
Note that
IoBundle.KeepInHost
will always be true for SR-IOV PF.- domainmgr will manage
IoBundle.VFs
. Most importantly, it will record reservations usingEthVF.UsedbyUUID
, prevent over-assignments (exceeding the number of available VFs), etc. kvmContext.CreateDomConfig
andxenContext.CreateDomConfig
will need to change to use the right PCI address for assignment - if the type of the assignment isPhyIoNetEthVF
, then they will take the PCI address from the VFs list, from the entry with the correspondingUsedByUUID
.- In
doActivateTail()
, domainmgr will additionally configure MAC addresses and VLANs before the domain is started. This can be done using the netlink package for Go. Even though this is a network configuration, it is not related to device connectivity or network instances, thus there is no need to move this to zedrouter or nim NIM and make things more complicated.
...