mlxconfig Backup Command
The backup command is used to save the current non-volatile configurations (TLV) in the device into a file in raw TLV syntax so it can be restored anytime using the set_raw command.
mlxconfig backup command allows backing up the all of the configurations which are related only to the PCI Physical Function associated with the given MST device. To back up all of the device configurations, perform the operation from every PCI Physical Function the device exposes. Restoring the configurations must be made from the matching PCI Physical Function.
In a MultiHost environment, these operations are required to be executed per host.
# mlxconfig -d /dev/mst/mt4117_pciconf0 -f /tmp/backup.conf backup Collecting... Saving output... Done! # cat /tmp/backup.conf MLNX_RAW_TLV_FILE % TLV Type: 0x00000400, Writer ID: ICMD MLXCONFIG(0x09), Writer Host ID: 0x00 0x00000014 0x00000400 0x00000000 0x00000000 0x000e0000 0x001000f6 0x20160526 0x11250000 # mlxconfig -d /dev/mst/mt4117_pciconf0 -f /tmp/backup.conf set_raw Raw TLV #1 Info: Length: 0x14 Version: 0 OverrideEn: 0 Type: 0x00000400 Data: 0x00000000 0x000e0000 0x001000f6 0x20160526 0x11250000 Operation intended for advanced users. Are you sure you want to apply raw TLV file? ? (y/n) [n] : y Applying... Done! -I- Please reboot machine to load new configurations.
Generating an XML Template for the Configurations
Users can generate an XML file that contains a template for the configurations. The template describes the configurations and their parameters. No values are included in the template.
To generate such a template, run the gen_tlvs_file command. This command will generate a file containing a list of all supported configurations by mlxconfig, with a zero appearing in the end of each configuration. To choose a configuration, change the 0 to 1, then save the file and run the gen_xml_template command. An XML file containing the required configurations will be generated.
# mlxconfig gen_tlvs_file /tmp/confs.txt Saving output... Done! # cat /tmp/confs.txt nv_host_to_bmc 0 nv_kdnet_data 0 nv_fpga_data 0 nv_packet_pacing 0 nv_debug_mode 0 nv_global_pci_conf 0
In order to include the nv_kdnet_data configuration in the template, change the 0 to 1, as demonstrated in the following example.
nv_kdnet_data 1 #mlxconfig gen_xml_template /tmp/confs.txt /tmp/template.xml Saving output... Done! #cat /tmp/template.xml <?xml version="1.0" encoding="UTF-8"?> <config xmlns="http://www.mellanox.com/config"> <nv_kdnet_data> <!-- Legal Values: False/True --> <kdnet_en></kdnet_en> </nv_kdnet_data> </config>
mlxconfig xml2raw Command
The xml2raw command is an easy way to generate a flawless raw configuration file that can be used in the set_raw command. The input for the command is an XML file that contains the data of the required configurations. To generate an XML file and fill it with the desired values, run the commands from Generating an XML Template for the Configurations, and then use the xml2raw command to generate a raw file.
# cat /tmp/template.xml <?xml version="1.0" encoding="UTF-8"?> <config xmlns="http://www.mellanox.com/config"> <nv_kdnet_data> <!-- Legal Values: False/True --> <kdnet_en>True</kdnet_en> </nv_kdnet_data> </config> #mlxconfig xml2raw /tmp/template.xml /tmp/confs.raw Saving output... Done! #cat /tmp/confs.raw MLNX_RAW_TLV_FILE 0x03000004 0x00000085 0x00000000 0x80000000
mlxconfig xml2bin Command
The xml2bin command is an easy way to generate a binary file that contains a binary dump of configurations. The input for the command is an XML file that contains the data of the required configurations. To generate an XML file and fill it with the desired values, run the commands from Section 2.4.10, and then use the xml2bin command to generate a binary file.
#mlxconfig xml2bin /tmp/template.xml /tmp/confs.bin Saving output... Done! # hexdump -C /tmp/confs.bin 00000000 80 00 00 00 |....| 00000004
mlxconfig create_conf Command
The create_conf command assists in creating an NV configuration file that can be used for LifeCycle and Secure Firmware Updates purposes. The flow for creating a configuration file is the same as the flow for xml2bin. The user must provide the command with an XML file containing the required configurations and their values. The command can sign the configuration file, if the user provides a private key and UUID. The sign result will be appended to the end of the configuration file. If no private key and UUID are provided, the tool will compute an SHA256/SHA512 digest and append it to the file. The generated signature will be used by the firmware for authentication purposes.
Currently the only supported NV configurations types are CS tokens, Debug tokens, BTC tokens, and MLNX ID which are used for Secure Firmware Updates. Additionally, it supports two RSA keys of 2048 or 4096 bits length for all tokens except BTC which supports only 4096 bits.
The NV configurations files must have the applicable_to configuration.
# mlxconfig create_conf --private_key privatekey.pem --key_uuid "29ee36ee-13b7-11e7-83de-0cc47a6d39d2" /tmp/template.xml /tmp/nvconf.bin Saving output... Done!
# mlxconfig create_conf --private_key privatekey.pem --key_uuid "29ee36ee-13b7-11e7-83de-0cc47a6d39d2" /tmp/template.xml /tmp/nvconf.bin --openssl_engine pkcs11 --openssl_key_id "pkcs11:serial=0123456789abcdef;token=My%20token%201;type=private;object=example_pkey;id=%12%34%56%78" --key_uuid "e0129552-13ba-11e7-a990-0cc47a6d39d2" /tmp/template.xml /tmp/nvconf.bin Saving output... Done!
mlxconfig apply Command
The apply command can be used to apply the NV configurations files to the firmware using the apply command. Only Firmware that supports applying configurations files can be used.
# mlxconfig -d /dev/mst/mt4115_pciconf0 apply /tmp/nvconf.bin Applying... Done!