Skip to content

Commit

Permalink
net/mlx5: Properly convey driver version to firmware
Browse files Browse the repository at this point in the history
[ Upstream commit 907af0f ]

mlx5 firmware expects driver version in specific format X.X.X, so
make it always correct and based on real kernel version aligned with
the driver.

Fixes: 012e50e ("net/mlx5: Set driver version into firmware")
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
rleon authored and gregkh committed Dec 30, 2020
1 parent 1669724 commit d5f9083
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/main.c
Expand Up @@ -50,6 +50,7 @@
#ifdef CONFIG_RFS_ACCEL
#include <linux/cpu_rmap.h>
#endif
#include <linux/version.h>
#include <net/devlink.h>
#include "mlx5_core.h"
#include "lib/eq.h"
Expand Down Expand Up @@ -233,7 +234,10 @@ static void mlx5_set_driver_version(struct mlx5_core_dev *dev)
strncat(string, ",", remaining_size);

remaining_size = max_t(int, 0, driver_ver_sz - strlen(string));
strncat(string, DRIVER_VERSION, remaining_size);

snprintf(string + strlen(string), remaining_size, "%u.%u.%u",
(u8)((LINUX_VERSION_CODE >> 16) & 0xff), (u8)((LINUX_VERSION_CODE >> 8) & 0xff),
(u16)(LINUX_VERSION_CODE & 0xffff));

/*Send the command*/
MLX5_SET(set_driver_version_in, in, opcode,
Expand Down

0 comments on commit d5f9083

Please sign in to comment.