Creating virtual functions (VFs)

7.1 LPAR mode z/VM guest KVM guest

Virtual functions (VFs) can be created on a physical function (PF) that supports SR-IOV by configuring the number of VFs through sysfs.

Before you begin

  • The Linux instance owns the PF of the adapter.
  • The PF is a NETD device that supports SR-IOV.

Procedure

  1. Set the number of virtual functions to 0 to remove existing VFs.
    # echo 0 > /sys/bus/pci/devices/<pci_id>/sriov_numvfs
  2. Set the required number of virtual functions.
    # echo <number_of_vfs> > /sys/bus/pci/devices/<pci_id>/sriov_numvfs

Results

The specified number of VFs is created and associated with the PF.

Example

# smc_rnics
FID   PCI_ID        PCHID  VF   Net-Dev
------------------------------------------
1880  1880:00:00.0  01ac   n    eno6272np0

# echo 3 > /sys/bus/pci/devices/1880:00:00.0/sriov_numvfs

# ip link show eno6272np0
14: eno6272np0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 94:6d:ae:f6:5c:3c brd ff:ff:ff:ff:ff:ff
    vf 0     link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff, spoof checking off, link-state auto, ...
    vf 1     link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff, spoof checking off, link-state auto, ...
    vf 2     link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff, spoof checking off, link-state auto, ...
 
# smc_rnics
FID   PCI_ID        PCHID  VF   Net-Dev
------------------------------------------
1880  1880:00:00.0  01ac   n    eno6272np0
1881  1880:00:00.2  01ac   y    eno6272v0
1882  1880:00:00.3  01ac   y    eno6272v1
1883  1880:00:00.4  01ac   y    eno6272v2
      
(Output shortened.)

Constraints

  • The number of VFs cannot be changed unless the existing VFs are removed first.
  • The number of VFs cannot exceed sriov_totalvfs.
  • VFs are usable only if they are defined in the hardware configuration.
  • Creating more VFs than defined in the hardware configuration creates entries in the PF, but corresponding PCI functions are not available to the system.
  • A PF cannot be deconfigured while VFs exist (sriov_numvfs ≠ 0).
DPM: On systems managed by Dynamic Partition Manager (DPM), VFs become available automatically after creation.
PR/SM: On PR/SM-based systems, VFs might require explicit activation, for example by using:
# smc_rnics --all
# smc_rnics -e <vf_fid>
      

What to do next

Newly created VFs can be used or assigned to guests after they are made available by the platform.