How to install a device driver for Mellanox ConnectX-4 Ethernet card on Linux

Last updated on September 26, 2020 by Dan Nanni

Question: I installed a Mellanox ConnectX-4 Lx EN Ethernet card on my Linux server, but the NIC card is not recognized by the system. How can I install a driver for Mellanox ConnectX-4 NIC on [insert Linux distro]?

Mellanox provides a wide range of high-speed interconnection solutions including Gigabit Ethernet cards and InfiniBand adapter cards. ConnectX-4 EN is one of Mellanox's flagship Ethernet adapters offering 10/25/40/50/100GbE speed. To meet the stringent demand of today's data center interconnection environments, Mellanox ConnectX-4 provides a multitude of powerful features such as SR-IOV I/O virtualization, NVGRE/VxLAN hardware offload, RDMA over Converged Ethernet, Erasure Coding offload, etc.

As of this writing, device drivers for Mellanox ConnectX product series are not part of Linux distributions. Therefore if you want to use a ConnectX card (e.g., ConnectX-4 Lx EN), you need to build and install the driver.

Fortunately, Mellanox does a pretty good job making sure that their NIC card is accessible on all major operating system platforms via up-to-date drivers.

Here is how to compile and install Mellanox ConnectX-4 EN driver (mlx4_en) on Linux. Other Mellanox card drivers can be installed in a similar fashion.

Preparation

Before building the Mellanox driver, first set up a necessary build environment by installing dependencies as follows.

Install dependencies on Debian, Ubuntu or Linux Mint

$ sudo apt-get install debhelper autotools-dev dkms zlib1g-dev gcc make patch gcc-c++

Install dependencies on CentOS, Fedora or Red Hat

$ sudo yum install gcc make patch gcc-c++ redhat-rpm-config rpm-build

Install dependencies on OpenSUSE

$ sudo zypper install gcc make patch gcc-c++ kernel-syms

Compile and Install Mellanox ConnectX-4 Driver

Download the latest device driver for Mellanox ConnectX-4 card from the official website. The driver's tarball contains the device driver's source code as well as the latest NIC firmware.

Extract the tarball, and run the installation script (install.sh) as root.

$ tar -xf mlnx-en-3.3-1.0.0.0.tgz 
$ cd mlnx-en-3.3-1.0.0.0
$ sudo ./install.sh

The script builds the Mellanox NIC driver from the source, and installs it.

Once installation is completed, the script then queries the Mellanox NIC's firmware, and updates outdated firmware automatically.

Finally, any previously installed mlnx module is unloaded and the new Mellanox NIC driver is loaded.

The installed NIC driver for Mellanox ConnectX-4 EN is named mlx4_en. Verify that is is successfully loaded as follows.

$ lsmod | grep mlx4
$ modinfo mlx4_en

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal or credit card

Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean