Updating mlx4en Firmware on FreeBSD

My testbed has Nvidia/Mellanox/Chelsio 10GbE network cards which are quite old, but sit well in the price (super cheap) usability (they work great on FreeBSD ond Linux) spectrum.

There is an issue on FreeBSD 14 -CURRENT where when you load the kernel module for the card (mlx4en) kldload hangs. If you hit control C the process will continue and the module will load properly. This is also an issue when you load the module using kld_list in rc.conf and as my router machine can't be managed with serial yet I have no way to press control C when it is booting.

On the bug report I was asked if the firmware is up to date. It wasn't and doing so was not fun.

You should follow the Mellanox instructions rather than my blog post to do a firmware update, but The Mellanox FreeBSD documentation for ( Linux ) the cards is from 2015 and this is the process that worked for me in 2021.

Mellanox have a tools package you can download, there is also a port called mstflint you can install:

# pkg install mstflint

The Mellanox tools need to know which card they are speaking to, you can find the card with pciconf once you have loaded the kernel module:

# pciconf -lv | grep mlx4
mlx4_core0@pci0:9:0:0:  class=0x020000 rev=0x00 hdr=0x00 vendor=0x15b3 device=0x1007 subvendor=0x15b3 subdevice=0x000c

Downloading the firmware for card required a OPN and a PSID from the card. You can use mstflint to get information about the card with the pci address and the 'q' query command:

# mstflint -d pci0:9:0:0 q          
Image type:            FS2
FW Version:            2.40.5030
FW Release Date:       4.1.2017
Product Version:       02.40.50.30
Rom Info:              type=PXE version=3.4.746
Device ID:             4103
Description:           Node             Port1            Port2            Sys image
GUIDs:                 ffffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffff 
MACs:                                       ec0d9ae13420     ec0d9ae13421
VSD:                   
PSID:                  MT_1200111023

This didn't give me an OPN so instead I looked at every entry on the download page until I found the correct PSID.

With the firmware downloaded and unzipped you can flash it using mstflint :

# mstflint -d pci0:9:0:0 -i fw-ConnectX3Pro-rel-2_42_5000-MCX312B-XCC_Ax-FlexBoot-3.4.752.bin b

Current FW version on flash:  2.40.5030
New FW version:               2.42.5000

Burning FS2 FW image without signatures - OK  
Restoring signature                     - OK