Using KAE on Docker
KAE can be used on Docker. Before using KAE, ensure that Docker containers have been created on the host OS, KAE has been installed, and related configurations have been completed on the host OS.
The accelerator device complies with the PCIe specifications. It is presented as a PCIe device on the OS and supports SR-IOV. Each accelerator provides 1024 queues. A PF uses 256 queues by default, and the other 768 queues are reserved for VFs. Number of VF queues = (1024 – Number of PF queues)/Number of VFs. The remainder queues are added to the last VF. It is recommended that one PF be virtualized into eight VFs.
Configuring Virtualization Settings on the Host OS
- Query the accelerators installed in the host OS environment and the corresponding BDF numbers.
1ls -al /sys/class/uacce

- Configure accelerator VF settings. For example, virtualize three VFs from the hisi_sec devices each, corresponding to hisi_sec-8 to hisi_sec-13.
1 2
echo 3 > /sys/devices/pci0000:74/0000:74:01.0/0000:76:00.0/sriov_numvfs echo 3 > /sys/devices/pci0000:b4/0000:b4:01.0/0000:b6:00.0/sriov_numvfs

- Start the Docker container and allocate an accelerator VF to the container.
1docker run -it -v /usr/:/usr/ --device=/dev/hisi_sec-8:/dev/hisi_sec-2:rwm -m 8192m --cpuset-cpus="4-7" 90b5058926a2 /bin/bash

Table 1 Startup parameters Parameter
Description
- i
Enables Docker to allocate a pseudo terminal and bind it to the standard input of the container.
- t
Always enables the standard input of the container.
- v
Mounts the host directory to the image. The directory before the colon (:) is the host directory, which must be an absolute path. The directory after the colon (:) is the mount path in the image.
--device
Specifies the host device used by the container. The value before the colon (:) indicates the VF device created on the host. The value after the colon (:) indicates the directory in the container. r, w, m indicates that the container has the permissions to read, write, and create device files.
-m
Specifies the maximum memory used by the container.
--cpuset-cpus
Specifies the CPU cores on which the container runs.
90b5058926a2
Indicates the image ID. You can also use the image name. To query the image name, run the docker images command.
/bin/bash
Indicates the bash that starts the container.