(Optional) Enabling SR-IOV
This section explains how to create virtual functions (VFs) for SR-IOV–capable devices, such as NVMe drives and NICs.
Currently, Huawei ES3000 V6 NVMe drives (using the NVMe driver) and SP680 SmartNIC are supported. The SP680 NIC supports VF RoCE.
- Create VFs.
- NVMe driver
echo ${VF_NUM} > /sys/class/nvme/nvme0/device/sriov_numvfs # Allocates resources. nvme virt-mgmt -c ${CTRL_ID} -a 7 /dev/nvme0 nvme virt-mgmt -c ${CTRL_ID} -r 0 -a 8 -n 8 /dev/nvme0 nvme virt-mgmt -c ${CTRL_ID} -a 9 /dev/nvme0 # Search for available namespaces. nvme list-ns -a /dev/nvme0 # Create a namespace (if no namespace is available). nvme create-ns /dev/nvme0 --nsze ${NS_SIZE} --ncap ${NS_SIZE} --flbas 0x0 --dps 0 --nmic 0 # Attach the namespace to the CTRL_ID that corresponds to the VF. nvme attach-ns -n ${NSID} -c ${CTRL_ID} /dev/nvme0
CTRL_ID indicates the controller ID corresponding to the VF. The controller ID for the first VF is 0x2, and so on.
NSID indicates the namespace ID. Each VF must be assigned a dedicated namespace.
- Hi1823 and Mellanox NICs
echo ${VF_NUM} > /sys/class/net/eth0/device/sriov_numvfs
- NVMe driver
- Destroy the VFs.
- NVMe driver
echo 0 > /sys/class/nvme/nvme0/device/sriov_numvfs
- Hi1823 and Mellanox NICs
echo 0 > /sys/class/net/eth0/device/sriov_numvfs
- NVMe driver
Parent topic: Enabling Confidential Device Passthrough