Use the imgctrl tool to query, program and switch to a new FPGA image.
Before you begin
- Check the correct FPGA image number of the SmartNIC. See the FPGA images table in FPGA images or DN-1355.
- Unbind the SmartNIC from its current driver using the
dpdk-devbind tool. For
example:
DEV=$(lspci -Dd 18f4: | cut -d' ' -f1 | head -1) echo $DEV > /sys/bus/pci/devices/$DEV/driver/unbind
About this task
The imgctrl tool is a Napatech standalone tool which manages the FPGA image configuration of Napatech SmartNICs. This procedure describes imgctrl command examples to query, program and switch to a new FPGA image.
Procedure
-
Check the FPGA state of the SmartNIC.
cd <package_root_directory>/imgctrl ./imgctrl -q
where:- package_root_directory is the directory to the unpacked Napatech package.
… Scanning for Napatech adapters..Adapter 0: PCI SLOT : 0000:42:00.0 PCI DEVICE ID : 01C5 PCI LANES : x16 ADAPTER TYPE : NT200A02-01-SCC-2x100/40-E3-FF-ANL 2x100Gb QSFP28 / 2x40Gb QSFP+ platform RUNNING FPGA: FPGA IDENT : 200-9563-55-11-0000 DESCRIPTION : 2x100Gb, capture w.flow-matcher FPGA BANK0: PRODUCT CODE : 9563 VERSION : 55.11 DOWNLOADED BY : ntope FPGA BANK1: PRODUCT CODE : 9563 VERSION : 55.11 DOWNLOADED BY : ntope SUPPORTCHIP INFO: NT200A02 : v3.5r FPGA IMAGE STATE: IMAGE STATE : NEUTRAL (code 0) PRIMARY BANK : 0 RUNNING BANK : 0
There are two flash banks in the SmartNIC as shown in the output example. The currently loaded FPGA image is displayed as PRIMARY BANK which is bank 0 in this example.Note: The imgctrl tool generates an error as follows if another driver is currently loaded. Unbind the SmartNIC from the vfio-pci driver. See Prerequisite.... Error: Failed opening adapter 0 Adapter 0: PCI SLOT : 0000:42:00.0 PCI DEVICE ID : 01C5 PCI LANES : x16 This adapter is in use by kernel driver.
-
Enter the following command to list the available FPGA images.
ls -R <package_root_directory>/images/
where:- package_root_directory is the directory to the unpacked Napatech package.
-
Program the FPGA with the appropriate image using the imgctrl
command.
./imgctrl -a 0 -p --ntimg <path_to_image_file> --ini <id_string>
where:- path_to_image_file specifies the path to the .ntimg FPGA image file to be uploaded to the flash.
- id_string specifies a user-chosen identifier.
./imgctrl -a0 -p --ntimg ../images/200-9563-55-16-00.ntimg --ini jmh
An output example:… Scanning for Napatech adapters.. Adapter upgrade commencing.. Writing FPGA bank 1 Erasing................... 100% done Writing................... 100% done Verifying................. 100% done Done writing FPGA bank 1 ... Upgrade process complete
The FPGA upgrade must not be interrupted. -
Switch to the new FPGA image using the imgctrl command.
./imgctrl -a0 -s ./imgctrl -a0 -s --confirm
Run the following command to complete switching the image../imgctrl -a0 -s --confirm
An output example:Scanning for Napatech adapters.. Applying current running image as safeboot image.. OK. Adapter PrimaryImage has been updated to reflect current running image.
-
Switching to the new FPGA image may fail with an error as follows on some
servers.
… Error: Adapter did not wake up after image switch. Please reboot machine to re-enable adapter. You may need to apply --pcirst next time you switch image. FAIL. Switching failed. Use --query to examine adapter
You must reboot the server to be able to detect the SmartNIC again.reboot
After the server reboot, check the image state of the SmartNIC../imgctrl -q
An output example:… FPGA IMAGE STATE: IMAGE STATE : FAILED (code 3) …
The image is in FAILED state. Run the following command to reset the image to the NEUTRAL state../imgctrl -a0 -s --discard
An output example:Scanning for Napatech adapters.. Resetting bank switch statemachine back to neutral.. OK. Adapter bank switch statemachine is reset back to neutral
Check the image state again../imgctrl -q
Confirm that the image is in NEUTRAL state and switch the image with the --pcirst parameter../imgctrl -a0 -s --pcirst
An output example:Scanning for Napatech adapters.. Switching image on adapter 0: OK. Reboot required to switch image. Do not forget to --confirm/--discard the adapter once rebooted!
Reboot the server.reboot
Run the following command to complete switching the image../imgctrl -a0 -s --confirm
An output example:Scanning for Napatech adapters.. Applying current running image as safeboot image.. OK. Adapter PrimaryImage has been updated to reflect current running image.
-
Confirm the FPGA image state.
./imgctrl -q
An output example:… Scanning for Napatech adapters.. Adapter 0: PCI SLOT : 0000:42:00.0 PCI DEVICE ID : 01C5 PCI LANES : x16 ADAPTER TYPE : NT200A02-01-SCC-2x100/40-E3-FF-ANL 2x100Gb QSFP28 / 2x40Gb QSFP+ platform RUNNING FPGA: FPGA IDENT : 200-9563-55-16-0000 DESCRIPTION : 2x100Gb, capture w.flow-matcher FPGA BANK0: PRODUCT CODE : 9563 VERSION : 55.11 DOWNLOADED BY : ntope FPGA BANK1: PRODUCT CODE : 9563 VERSION : 55.16 DOWNLOADED BY : jmh SUPPORTCHIP INFO: NT200A02 : v3.5r FPGA IMAGE STATE: IMAGE STATE : NEUTRAL (code 0) PRIMARY BANK : 1 RUNNING BANK : 1
Note: Refer to DN-0487 for complete documentation on the imgctrl tool.