{"id":281,"date":"2021-06-19T10:44:23","date_gmt":"2021-06-19T02:44:23","guid":{"rendered":"https:\/\/blog.swineson.me\/en\/?p=281"},"modified":"2021-07-28T10:51:11","modified_gmt":"2021-07-28T02:51:11","slug":"mellanox-connectx-3-firmware-flashing-and-configuration-for-both-ethernet-and-infiniband-in-2021","status":"publish","type":"post","link":"https:\/\/blog.swineson.me\/en\/mellanox-connectx-3-firmware-flashing-and-configuration-for-both-ethernet-and-infiniband-in-2021\/","title":{"rendered":"Mellanox ConnectX-3 Firmware Flashing and Configuration for Both Ethernet and InfiniBand in 2021"},"content":{"rendered":"<h1>Introduction<\/h1>\n<p>Although old, Mellanox ConnectX-3 has been a good card with decent performance and a good price on second-hand markets. This makes it the straightforward choice for a high-performance home or lab network. (If you intend to run InfiniBand on ESXi 7.0 or higher, go for CX4.) Sometimes you would find a card with a strange firmware or one not compatible with your existent gear. Luckily you can change the port configuration on all CX3 cards with a simple firmware flash. Here&#8217;s how.<\/p>\n<p><!--more--><\/p>\n<p>Disclaimer:<\/p>\n<ul>\n<li>Flashing firmware may brick your card and I&#8217;m not responsible for it<\/li>\n<li>Do not power off or reboot your computer during firmware flashing<\/li>\n<\/ul>\n<h1>Preparation<\/h1>\n<p>I&#8217;ll assume you are using Windows Server 2019 with all the latest patches; all programs are available under Linux too so you can apply all the instructions for a Linux server with only minor deviations.<\/p>\n<p>All the download links are for ConnectX-3 non-pro version; If you have a ConnectX-2 or ConnectX-3 Pro, you need to download a different firmware.<\/p>\n<h2>Downloads<\/h2>\n<p>Download and install Mellanox <a href=\"https:\/\/www.mellanox.com\/products\/adapter-software\/firmware-tools\" target=\"_blank\" rel=\"noopener\">firmware tools<\/a>. Install ALL the components (some of them are not selected by default).<\/p>\n<p>Download the <a href=\"https:\/\/www.mellanox.com\/support\/firmware\/connectx3ib\" target=\"_blank\" rel=\"noopener\">ConnectX-3 VPI firmware package<\/a>. EN firmware can only run Ethernet; VPI firmware run both Ethernet and IB. Thus, VPI firmware is always recommended.<\/p>\n<h2>Check Your Card<\/h2>\n<p>First of all, we need the card&#8217;s machine-dependent device ID. This device ID is used for all the commands below.<\/p>\n<pre class=\"lang:ps decode:true\">PS C:\\Users\\Administrator&gt; mst status\r\nMST devices:\r\n------------\r\n  mt4099_pci_cr0\r\n  mt4099_pciconf0<\/pre>\n<p>In this case, the card&#8217;s ID is <span class=\"lang:default highlight:0 decode:true crayon-inline \">mt4099_pci_cr0<\/span> . Then we make sure the card communicates:<\/p>\n<pre class=\"lang:ps decode:true\">PS C:\\Users\\Administrator&gt; flint -d mt4099_pci_cr0 query\r\nImage type:            FS2\r\nFW Version:            2.42.5000\r\nFW Release Date:       5.9.2017\r\nProduct Version:       02.42.50.00\r\nRom Info:              type=PXE version=3.4.752\r\nDevice ID:             4099\r\nDescription:           Node             Port1            Port2            Sys image\r\nGUIDs:                 [redacted]\r\nMACs:                  [redacted]\r\nVSD:\r\nPSID:                  MT_1090120019<\/pre>\n<p>Now we are good to go.<\/p>\n<h1>Firmware Backup<\/h1>\n<p>ALWAYS make a backup so you can go back when something went wrong.<\/p>\n<pre class=\"lang:ps decode:true\">flint -d &lt;id&gt; query full &gt; flint_query.txt\r\nflint -d &lt;id&gt; hw query &gt; flint_hwinfo.txt\r\nflint -d &lt;id&gt; ri orig_firmware.mlx\r\nflint -d &lt;id&gt; dc orig_firmware.ini\r\nflint -d &lt;id&gt; rrom orig_rom.mlx\r\nmlxburn -d &lt;id&gt; -vpd &gt; orig_vpd.txt<\/pre>\n<p>Manually open all the txt &amp; ini files to make sure they are not empty and no error messages exist.<\/p>\n<h1>Firmware Flashing<\/h1>\n<p>Unzip the firmware downloaded from Mellanox, change the file extension from <span class=\"lang:default decode:true crayon-inline \">.bin<\/span> to <span class=\"lang:default decode:true crayon-inline \">.mlx<\/span> , then verify the firmware is OK:<\/p>\n<pre class=\"lang:ps decode:true\">PS C:\\Users\\Administrator\\Desktop&gt; flint -i .\\fw-ConnectX3-rel-2_42_5000-MCX354A-FCB_A2-A5-FlexBoot-3.4.752.mlx query full\r\nImage type:            FS2\r\nFW Version:            2.42.5000\r\nFW Release Date:       5.9.2017\r\nMIC Version:           2.0.0\r\nConfig Sectors:        1\r\nPRS Name:              cx3-1_MCX354A_fdr_09v.prs\r\nProduct Version:       02.42.50.00\r\nRom Info:              type=PXE version=3.4.752\r\nDevice ID:             4099\r\nDescription:           Node             Port1            Port2            Sys image\r\nGUIDs:                 0002c9000100d050 0002c9000100d051 0002c9000100d052 0002c9000100d050\r\nMACs:                                       0002c9000001     0002c9000002\r\nVSD:                   n\/a\r\nPSID:                  MT_1090120019\r\nPS C:\\Users\\Administrator\\Desktop&gt; flint -i .\\fw-ConnectX3-rel-2_42_5000-MCX354A-FCB_A2-A5-FlexBoot-3.4.752.mlx verify\r\n\r\n     FS2 failsafe image. Start address: 0x0. Chunk size 0x80000:\r\n\r\n     NOTE: The addresses below are contiguous logical addresses. Physical addresses on\r\n           flash may be different, based on the image start address and chunk size\r\n\r\n     \/0x00000038-0x0000065b (0x000624)\/ (BOOT2) - OK\r\n     \/0x0000065c-0x0000297f (0x002324)\/ (BOOT2) - OK\r\n     \/0x00002980-0x00003923 (0x000fa4)\/ (Configuration) - OK\r\n     \/0x00003924-0x0001d14b (0x019828)\/ (ROM) - OK\r\n     \/0x0001d14c-0x0001d18f (0x000044)\/ (GUID) - OK\r\n     \/0x0001d190-0x0001d31b (0x00018c)\/ (Image Info) - OK\r\n     \/0x0001d31c-0x0002a6b3 (0x00d398)\/ (DDR) - OK\r\n     \/0x0002a6b4-0x0002b707 (0x001054)\/ (DDR) - OK\r\n     \/0x0002b708-0x0002bad7 (0x0003d0)\/ (DDR) - OK\r\n     \/0x0002bad8-0x00069aaf (0x03dfd8)\/ (DDR) - OK\r\n     \/0x00069ab0-0x0006e933 (0x004e84)\/ (DDR) - OK\r\n     \/0x0006e934-0x00072e07 (0x0044d4)\/ (DDR) - OK\r\n     \/0x00072e08-0x000738ff (0x000af8)\/ (DDR) - OK\r\n     \/0x00073900-0x000a29f3 (0x02f0f4)\/ (DDR) - OK\r\n     \/0x000a29f4-0x000a659f (0x003bac)\/ (DDR) - OK\r\n     \/0x000a65a0-0x000bb493 (0x014ef4)\/ (DDR) - OK\r\n     \/0x000bb494-0x000bb59b (0x000108)\/ (DDR) - OK\r\n     \/0x000bb59c-0x000c061f (0x005084)\/ (DDR) - OK\r\n     \/0x000c0620-0x000c1e1b (0x0017fc)\/ (Configuration) - OK\r\n     \/0x000c1e1c-0x000c1e8f (0x000074)\/ (Jump addresses) - OK\r\n     \/0x000c1e90-0x000c280f (0x000980)\/ (FW Configuration) - OK\r\n     \/0x00000000-0x000c280f (0x0c2810)\/ (Full Image) - OK\r\n\r\n-I- FW image verification succeeded. Image is bootable.\r\n<\/pre>\n<p>Make sure the PSID from the first command is the target PSID (model number) you want; and make sure the second command outputs &#8220;Image is bootable&#8221;. Then we proceed to actually burn the card. (For demonstration purposes, I burned firmware with a different PSID.)<\/p>\n<pre class=\"lang:ps decode:true\">PS C:\\Users\\Administrator\\Desktop&gt; flint -d mt4099_pci_cr0 -i .\\fw-ConnectX3-rel-2_42_5000-MCX354A-QCB_Ax-FlexBoot-3.4.752.mlx -allow_psid_change burn\r\n\r\n    Current FW version on flash:  2.42.5000\r\n    New FW version:               2.42.5000\r\n\r\n    Note: The new FW version is the same as the current FW version on flash.\r\n\r\n Do you want to continue ? (y\/n) [n] : y\r\n\r\n\r\n    You are about to replace current PSID on flash - \"MT_1090120019\" with a different PSID - \"MT_1090110018\".\r\n    Note: It is highly recommended not to change the PSID.\r\n\r\n Do you want to continue ? (y\/n) [n] : y\r\nBurning FS2 FW image without signatures - OK\r\nRestoring signature                     - OK<\/pre>\n<p>Reboot to use the new firmware.<\/p>\n<h1>FAQ\/Miscellaneous<\/h1>\n<h2>Firmware Compatibility?<\/h2>\n<p>In theory, all firmware for the same chip are compatible with all the cards with that chip. In practice, only flash a firmware that contains the same physical configuration as your card. For example, if your card have one physical port, do not flash any 2-port firmware. If your card have SFP+ ports, do not flash any QSFP firmware.<\/p>\n<h2>How to Switch Port Protocol (Ethernet\/IB)<\/h2>\n<p>In <span class=\"lang:default decode:true crayon-inline \">devmgmt.msc<\/span> , expand System Devices, double click on Mellanox ConnectX-3 VPI (MT04099) Network Adapter, go to Port Protocol tab, uncheck HW Defaults, select your desired port type. It should look like this:<\/p>\n<p><a href=\"https:\/\/blog.swineson.me\/en\/mellanox-connectx-3-firmware-flashing-and-configuration-for-both-ethernet-and-infiniband-in-2021\/mlx-cx3-port-protocol\/\" rel=\"attachment wp-att-282\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-282 size-medium\" src=\"https:\/\/blog.swineson.me\/en\/wp-content\/uploads\/sites\/2\/2021\/06\/mlx-cx3-port-protocol-260x300.png\" alt=\"\" width=\"260\" height=\"300\" srcset=\"https:\/\/blog.swineson.me\/en\/wp-content\/uploads\/sites\/2\/2021\/06\/mlx-cx3-port-protocol-260x300.png 260w, https:\/\/blog.swineson.me\/en\/wp-content\/uploads\/sites\/2\/2021\/06\/mlx-cx3-port-protocol-768x886.png 768w, https:\/\/blog.swineson.me\/en\/wp-content\/uploads\/sites\/2\/2021\/06\/mlx-cx3-port-protocol-624x720.png 624w, https:\/\/blog.swineson.me\/en\/wp-content\/uploads\/sites\/2\/2021\/06\/mlx-cx3-port-protocol.png 797w\" sizes=\"(max-width: 260px) 100vw, 260px\" \/><\/a><\/p>\n<h2>Unable to Switch Port Protocol<\/h2>\n<p>If the port protocol is locked to Ethernet or IB and the options are all grayed out, it is likely that some boot-time configuration is set incorrectly. First read them out:<\/p>\n<pre class=\"lang:default decode:true\">PS C:\\Users\\Administrator\\Desktop&gt; mlxconfig -d mt4099_pci_cr0 query\r\n\r\nDevice #1:\r\n----------\r\n\r\nDevice type:    ConnectX3\r\nDevice:         mt4099_pci_cr0\r\n\r\nConfigurations:                              Next Boot\r\n         SRIOV_EN                            False(0)\r\n         NUM_OF_VFS                          8\r\n         LINK_TYPE_P1                        IB(1)\r\n         LINK_TYPE_P2                        IB(1)\r\n         LOG_BAR_SIZE                        3\r\n         BOOT_PKEY_P1                        0\r\n         BOOT_PKEY_P2                        0\r\n         BOOT_OPTION_ROM_EN_P1               True(1)\r\n         BOOT_VLAN_EN_P1                     False(0)\r\n         BOOT_RETRY_CNT_P1                   0\r\n         LEGACY_BOOT_PROTOCOL_P1             PXE(1)\r\n         BOOT_VLAN_P1                        1\r\n         BOOT_OPTION_ROM_EN_P2               True(1)\r\n         BOOT_VLAN_EN_P2                     False(0)\r\n         BOOT_RETRY_CNT_P2                   0\r\n         LEGACY_BOOT_PROTOCOL_P2             PXE(1)\r\n         BOOT_VLAN_P2                        1\r\n         IP_VER_P1                           IPv4(0)\r\n         IP_VER_P2                           IPv4(0)\r\n         CQ_TIMESTAMP                        True(1)<\/pre>\n<p>For link type fields, 1 means IB only, 2 means Ethernet only, 3 means online configurable. In this case, we configure them all to 3:<\/p>\n<pre class=\"lang:ps decode:true \">PS C:\\Users\\Administrator\\Desktop&gt; mlxconfig -d mt4099_pci_cr0 set LINK_TYPE_P1=3 LINK_TYPE_P2=3\r\n\r\nDevice #1:\r\n----------\r\n\r\nDevice type:    ConnectX3\r\nDevice:         mt4099_pci_cr0\r\n\r\nConfigurations:                              Next Boot       New\r\n         LINK_TYPE_P1                        IB(1)           VPI(3)\r\n         LINK_TYPE_P2                        IB(1)           VPI(3)\r\n\r\n Apply new Configuration? (y\/n) [n] : y\r\nApplying... Done!\r\n-I- Please reboot machine to load new configurations.<\/pre>\n<p>Reboot the machine and profit.<\/p>\n<h2>SR-IOV\uff1f<\/h2>\n<pre class=\"lang:ps decode:true \">mlxconfig -d &lt;id&gt; set SRIOV_EN=1 NUM_OF_VFS=8<\/pre>\n<p>Then reboot. For detailed instructions, see the <a href=\"https:\/\/docs.mellanox.com\/pages\/viewpage.action?pageId=12013542\" target=\"_blank\" rel=\"noopener\">official documentation<\/a>.<\/p>\n<p>DO NOT configure too many VFs (e.g. <span class=\"lang:default decode:true crayon-inline \">NUM_OF_VFS=64<\/span> ) as the card might become IB only on that configuration even if it is in VPI mode (mode 3).<\/p>\n<h2>&#8220;Compile&#8221; the Firmware?<\/h2>\n<p>It&#8217;s known that old CX3 firmware need to be &#8220;compiled&#8221; (basically you bake a configuration into the firmware) then be flashed. New stock firmware doesn&#8217;t need this process anymore. For the completeness of this article, I&#8217;ll put the commands below.<\/p>\n<pre class=\"lang:ps decode:true \"># Compile\r\nmlxburn -fw fw-ConnectX3-rel.mlx -conf MCX312A-XCB_A2-A6.ini -wrimage mlnx_firmware.mlx\r\n\r\n# Verify\r\nflint -i mlnx_firmware.mlx query full\r\nflint -i mlnx_firmware.mlx verify\r\n\r\n# Flash\r\nflint -d &lt;id&gt; -i mlnx_firmware.mlx -allow_psid_change burn<\/pre>\n<p>The ini files are <a href=\"https:\/\/content.mellanox.com\/firmware\/ConnectX3-rel-2_40_5030.tgz\" target=\"_blank\" rel=\"noopener\">available for download here<\/a>.<\/p>\n<h2>OEM Card Firmware?<\/h2>\n<p>If you really want OEM (HP, IBM, etc.) ConnectX-3 firmware for some reason, <a href=\"http:\/\/kr.mellanox.com\/page\/custom_firmware_table\" target=\"_blank\" rel=\"noopener\">download from here<\/a>.<\/p>\n<h2>Bricked Card?<\/h2>\n<p>If you unfortunately have a bricked card, power off, try to find the DFU pins (2-pin jumper on the card), short them, then power on the computer. The card will boot in DFU mode and you might be able to flash a new firmware onto it. Then power off the computer, disconnect DFU jumper, power on again.<\/p>\n<h1>References<\/h1>\n<ul>\n<li><a href=\"https:\/\/forums.servethehome.com\/index.php?threads\/flash-oem-ibm-mellanox-connectx-3-en-with-stock-firmware.8689\/\" target=\"_blank\" rel=\"noopener\">Flash OEM (IBM) Mellanox ConnectX-3 EN with stock firmware?<\/a><\/li>\n<li><a href=\"https:\/\/forums.servethehome.com\/index.php?threads\/anyone-flashing-mellanox-connectx-3-in-qty.16298\/\" target=\"_blank\" rel=\"noopener\">Anyone flashing Mellanox ConnectX-3 in qty?<\/a><\/li>\n<li><a href=\"https:\/\/forums.servethehome.com\/index.php?threads\/flashing-stock-mellanox-firmware-to-oem-emc-connectx-3-ib-ethernet-dual-port-qsfp-adapter.20525\/\" target=\"_blank\" rel=\"noopener\">Flashing stock Mellanox firmware to OEM (EMC) ConnectX-3 IB\/Ethernet dual-port QSFP adapter<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Although old, Mellanox ConnectX-3 has been a good card with decent performance and a good price on second-hand markets. This makes it the straightforward choice for a high-performance home or lab network. (If you intend to run InfiniBand on ESXi 7.0 or higher, go for CX4.) Sometimes you would find a card with a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[5],"tags":[],"class_list":["post-281","post","type-post","status-publish","format-standard","hentry","category-networking"],"acf":[],"_links":{"self":[{"href":"https:\/\/blog.swineson.me\/en\/wp-json\/wp\/v2\/posts\/281"}],"collection":[{"href":"https:\/\/blog.swineson.me\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.swineson.me\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.swineson.me\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.swineson.me\/en\/wp-json\/wp\/v2\/comments?post=281"}],"version-history":[{"count":12,"href":"https:\/\/blog.swineson.me\/en\/wp-json\/wp\/v2\/posts\/281\/revisions"}],"predecessor-version":[{"id":294,"href":"https:\/\/blog.swineson.me\/en\/wp-json\/wp\/v2\/posts\/281\/revisions\/294"}],"wp:attachment":[{"href":"https:\/\/blog.swineson.me\/en\/wp-json\/wp\/v2\/media?parent=281"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.swineson.me\/en\/wp-json\/wp\/v2\/categories?post=281"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.swineson.me\/en\/wp-json\/wp\/v2\/tags?post=281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}