In the Napatech main-app container, the ntmain application uses the Napatech DPDK PMD, which is connected to the physical function of the SmartNIC.
Enabling/disabling the Napatech main-app container
- Running with the Napatech main-app container: To enable this mode, the MainApp parameter in the ntdevplugin.yaml file must be set to "enabled". In this mode, the Napatech main-app container is active in the Napatech device-plugin pod. Consequently, the Napatech device-plugin pod is connected to the Napatech DPDK PMD (ntnic), which is required for configuring flows in the SmartNIC.
- Running with a custom main-app container: To configure this mode, the MainApp parameter must be set to "disabled". In this configuration, the Napatech main-app container is inactive in the Napatech device-plugin pod. This means that a custom main-app container is responsible for establishing a connection to the Napatech DPDK PMD (ntnic), which is essential for flow configuration in the SmartNIC.
Napatech DPDK PMD ntnic
- SmartNIC initialization: Detects the SmartNIC and configures the PCIe interface, onboard memory, and port speed.
- Detection of link up/down events on the physical ports.
- Reading statistics from physical ports, virtual ports (virtual functions), allocated queues and flows. These statistics can be accessed using either the DPDK API or the NTConnect API functions.
- Setting up vHost-vDPA (virtual host - virtual data path acceleration): If any virtual function is activated, the vhost-vDPA setup is executed. This involves allocating necessary queues and establishing connections to the SmartNIC.
Configuring flows in a user-application container
Using the default setup, the Napatech main-app container is deployed in the same pod as the Napatech device-plugin container. The ntmain application runs in the main-app container, attached to the physical function of the SmartNIC. In the ntmain application, the VLAN ID for each virtual function is passed to the Napatech DPDK PMD, which then creates a table of VLAN IDs with associated virtual functions as illustrated in the following figure.
When rte_flow API functions are called in the user application, they are passed to the Napatech DPDK PMD (ntnic) via the NTConnect socket connection. The Napatech DPDK PMD then adds the VLAN ID of the associated virtual function to the rte_flow configuration commands before forwarding them to the SmartNIC (see the red path in the figure). This ensures that the SmartNIC delivers traffic flows to each virtual function based on the VLAN ID of each frame (see the blue path in the figure).
The initial VLAN ID is determined by the vfVlanStart parameter in the ntdevplugin.yaml file. The VLAN ID increments for subsequent virtual functions. The total number of the virtual functions to be created is determined by the vfCount parameter in the ntdevplugin.yaml file.
For information on the ntdevplugin.yaml file, see ConfigMap. For information on how to configure VLAN IDs for virtual functions, see Associating a VLAN ID to a virtual function in the ntmain application.
Mandatory DPDK EAL command-line parameters
- --vfio-vf-token=<UUID>: Specifies a VFIO (Virtual Function I/O)
VF (Virtual Function) token file. This is used to assign a specific VF to a DPDK
application. The token file helps to ensure proper security and access control. Set
--vfio-vf-token to the UUID, which is generated using the
uuidgen command. For
example:
uuidgen 14d63f20-8445-11ea-8900-1f9ce7d5650d
- --file-prefix: Specifies a prefix for all files created by DPDK, such as shared memory files, log files, and statistics files. This option is required to ensure uniqueness when multiple DPDK applications are running on the same system as the main application and all other applications are DPDK applications.
- -a <PCI_ID>: Specifies the PCI bus ID of the SmartNIC (physical
function). For example:
-a 0000:b1:00.0
This option is also used to configure additional supported parameters for the physical function such as portqueues and exception_path.Note: If not all virtual functions are needed, it is also possible to select specific virtual functions using the -a option. The following command example specifies the physical function and selects 2 virtual functions:-a 0000:b1:00.0 -a 0000:b1:00.4 -a 0000:b1:00.5
This option loads the Napatech DPDK PMD (ntnic) on physical function 0000:b1:00.0, and performs the necessary vHost-vDPA setup for virtual function 4 and virtual function 5.
For a list of available EAL command-line parameters, see https://doc.dpdk.org/guides-22.11/linux_gsg/linux_eal_parameters.html.
Setting up multiple queues
-a <PF_PCI_ID>,portqueues=[<VF_number>:<Number_of_queues>,<VF_number>:<Number_of_queues>,…]
- PF_PCI_ID: Specifies the PCI bus ID of the physical function.
- VF_number: Specifies the virtual function number, which starts from 4.
- Number_of_queues: Specifies the number of queues to be allocated for the specified virtual function.
-a 0000:b1:00.0,portqueues=[4:3,5:3,6:3,7:3,8:3,9:3]This allocates 3 queues per virtual function for virtual function 4 to 9. This configuration does not enable receive side scaling (RSS), but only allocates the specified number of queues. RSS must be enabled using the rte_flow API in the user application running on the virtual function. See API: Setting up Receive Side Scaling (RSS). The specified number of queues must be passed to the user application via a command line parameter, as the user application needs to initialize the queues. See Receive side scaling (RSS).
For more information on the ntdevplugin.yaml file, see ConfigMap.
Associating a VLAN ID to a virtual function in the ntmain application
-a <VF_PCI_ID>,vlan=<VLAN_ID>
- VF_PCI_ID: Specifies the PCI bus ID of the target virtual function.
- VLAN_ID: Specifies the VLAN ID to be associated to the specified virtual function.
-a 0000:b1:00.4,vlan=44 -a 0000:b1:00.5,vlan=45This creates a VLAN ID table in the Napatech DPDK PMD (ntnic). When the application configures flows using the rte_flow API, the VLAN ID of the associated virtual function is appended to the rte_flow commands in the Napatech DPDK PMD, before they are delivered to the SmartNIC. VLAN ID 44 is added to the rte_flow commands for virtual function 0000:b1:00.4, and VLAN ID 45 is added for virtual function 0000:b1:00.5. There is no VLAN ID and virtual function binding by default. See Configuring flows in a user-application container.
Shared/separated socket directory
By default, files (used to connect applications and virtual functions) are placed in the /usr/local/var/run directory on the host. This directory is mounted on user-application containers running on virtual functions, enabling user applications to access the sockets of virtual functions. This setup can potentially pose a security risk, as all pods gain access to all sockets.
Using the sep=1 option, each socket file is placed in its individual directory, and each directory is then mounted on a specific container. Consequently, each container can only access its associated socket.
-a <VF_PCI_ID>,sep=1where:
- VF_PCI_ID: Specifies the PCI bus ID of the target virtual function.
- sep=1: Configures a separated directory for the vHost user socket file of the specified virtual function.
-a 0000:b1:00.4,vlan=44,sep=1The socket file directory of the 0000:b1:00.4 virtual function is /usr/local/var/run/stdvio4/stdvio4. To use the shared directory, set sep to 0 as follows.
-a 0000:b1:00.4,sep=0The directory of the stdvio4 socket is the /usr/local/var/run/ directory using the sep=0 option.
Handling non-matched frames
a <PF_PCI_ID>,exception_path=1where:
- PF_PCI_ID: Specifies the PCI bus ID of the physical function.
- exception_path=1: Enables the forwarding of non-matched frames to
queue 0.Note: This option is valid only for the physical function.
-a 0000:b1:00.0,exception_path=1The custom main application must actively poll queue 0 on all ports to handle these non-matched frames.
Configuration handling by the Napatech main-app container
/ntinl_package-<version>-linux/kubernetes_v<version>/docker/start.shwhere version is the version identifier of the corresponding package.
Mounting host directories
Directories on the host | Mounted directories on the Napatech main-app container |
---|---|
/var/run/ntconnect | /var/run/ntconnect |
/usr/local/var/run | /usr/local/var/run |