mlnxofedinstall script should do all the work and it will prompt to run kernel support if necessary by running mlnx_add_kernel_support. However, be sure that your OS is in the listed as supported in Mellanox OFED release notes.
Once Mellanox OFED installed properly it will load the driver automatically.
mlx4_en & mlx4_ib - are the drivers for ConnectX-2 and ConnectX-3 devices
mlx5_ib - for ConnectX-4 and newer devices.
There are other dependencies, but when you do 'modprobe mlx4_ib' kernel will resolve them automatically. If you gonna load drivers manually, you might need to load another module one explicitly - ib_uverbs. But as I said, if Mellanox OFED installed in the right way, nothing need to be done manually.
Do you know which deb package is installed for mlx4_en and mlx4_ib?
Or, if I only install the driver, which deb file should be used?
I have another problem. When I execute the ib_write_bw command, I have the following output. What is wrong with this? How to solve it?
Port number 1 state is Init Couldn't set the link layer Couldn't get context for the device