Custom Main-App Container

Link-Inline™ Software User Guide

Platform
Napatech SmartNIC
Content Type
User Guide
Capture Software Version
Link-Inline™ Software 3.2

To be able to access the SmartNIC, a custom main-app container must request resources for the physical function.

Accessing the SmartNIC from a custom main application

See the napatech.com/nt_pf parameter in the following example.
        resources:
          limits:
            napatech.com/nt_pf: 1
            hugepages-1Gi: 2Gi
            memory: 2Gi
Using this manifest file, the container requests 1 physical function to the Napatech device plugin. The physical function can be allocated to only one container. The container then receives information about the PF0 device's PCI bus ID as well as details regarding all configured virtual functions.
The inline-test application demonstrates how to implement a custom main application. The manifest file is included in the following directory of the Link-Inline™ Software package.
ntinl_package-<version>/kubernetes_v<version>/manifest/k8s-inline-test.yaml
where version is the version identifier of the corresponding package.

Environment variables in the custom main-app container

After the Napatech device plugin allocates the physical function to the custom main-application container, it creates environment variables. This table shows environment variables in the custom main-app container that are set by the Napatech device plugin.

Environment variable Description
NT_PF_NUM Allocated physical function number. Always 0.
NT_PF_DEV PCI bus ID of the SmartNIC. For example, 0000:65:00.0.
NT_DPDK_PREFIX Unique DPDK prefix to avoid clash with other DPDK based applications For example, nt-container0.
NT_VF_NUM Virtual function list. For example, 4 5 6 7.
NT_VF_QUEUES Number of queues to be configured per virtual function. For example, 3.
NT_VF_DEV PCI bus ID list for all configured virtual functions. For example, 0000:65:00.4 0000:65:00.5 0000:65:00.6 0000:65:00.7.
NT_VF_MAC MAC address list for all configured virtual functions. For example, 02:11:22:33:44:01 02:11:22:33:44:02 02:11:22:33:44:03 02:11:22:33:44:00.
NT_VF_VLAN VLAN ID list for all configured virtual functions. For example, 44 45 46 47.
NT_VF_SOCKET vHost socket file list for all configured virtual functions. For example, /usr/local/var/run/stdvio4/stdvio4 /usr/local/var/run/stdvio5/stdvio5 /usr/local/var/run/stdvio6/stdvio6.

Mounting host directories

The Napatech device plugin mounts the following host directories on the custom main-app container.
Directories on the host Mounted directories on the main-app container
/var/run/ntconnect /var/run/ntconnect
/usr/local/var/run/stdvio4 /usr/local/var/run/stdvio4
/usr/local/var/run/stdvio5 /usr/local/var/run/stdvio5
As the sep=1 option is used, each vHost-user socket file is placed in its individual directory. See Shared/separated socket directory.
The Napatech device plugin also mounts the following host device files on the custom main-app containers.
Host path Pod path
/dev/vfio/vfio /dev/vfio/vfio
/dev/vfio/<PF_group_number> /dev/vfio/<PF_group_number>
/dev/vfio/<VF_group_number> /dev/vfio/<VF_group_number>
where:
  • PF_group_number is the IOMMU group number for the vfio device of the assigned physical function.
  • VF_group_number is the IOMMU group number for the vfio device of the assigned virtual functions.