Skip to content

Commit e5c9a70

Browse files
Eran Ben Elishadavem330
authored andcommitted
net/mlx4_core: Report driver version to FW
If supported, write a driver version string to FW as part of the INIT_HCA command. Example of driver version: "Linux,mlx4_core,4.0-0" Signed-off-by: Eran Ben Elisha <[email protected]> Signed-off-by: Tariq Toukan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a37fb85 commit e5c9a70

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

drivers/net/ethernet/mellanox/mlx4/fw.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ static void dump_dev_cap_flags2(struct mlx4_dev *dev, u64 flags)
165165
[36] = "QinQ VST mode support",
166166
[37] = "sl to vl mapping table change event support",
167167
[38] = "user MAC support",
168+
[39] = "Report driver version to FW support",
168169
};
169170
int i;
170171

@@ -1038,6 +1039,8 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
10381039
dev_cap->flags2 |= MLX4_DEV_CAP_FLAG2_ETH_BACKPL_AN_REP;
10391040
if (field32 & (1 << 7))
10401041
dev_cap->flags2 |= MLX4_DEV_CAP_FLAG2_RECOVERABLE_ERROR_EVENT;
1042+
if (field32 & (1 << 8))
1043+
dev_cap->flags2 |= MLX4_DEV_CAP_FLAG2_DRIVER_VERSION_TO_FW;
10411044
MLX4_GET(field32, outbox, QUERY_DEV_CAP_DIAG_RPRT_PER_PORT);
10421045
if (field32 & (1 << 17))
10431046
dev_cap->flags2 |= MLX4_DEV_CAP_FLAG2_DIAG_PER_PORT;
@@ -1860,6 +1863,8 @@ int mlx4_INIT_HCA(struct mlx4_dev *dev, struct mlx4_init_hca_param *param)
18601863
#define INIT_HCA_UC_STEERING_OFFSET (INIT_HCA_MCAST_OFFSET + 0x18)
18611864
#define INIT_HCA_LOG_MC_TABLE_SZ_OFFSET (INIT_HCA_MCAST_OFFSET + 0x1b)
18621865
#define INIT_HCA_DEVICE_MANAGED_FLOW_STEERING_EN 0x6
1866+
#define INIT_HCA_DRIVER_VERSION_OFFSET 0x140
1867+
#define INIT_HCA_DRIVER_VERSION_SZ 0x40
18631868
#define INIT_HCA_FS_PARAM_OFFSET 0x1d0
18641869
#define INIT_HCA_FS_BASE_OFFSET (INIT_HCA_FS_PARAM_OFFSET + 0x00)
18651870
#define INIT_HCA_FS_LOG_ENTRY_SZ_OFFSET (INIT_HCA_FS_PARAM_OFFSET + 0x12)
@@ -1950,6 +1955,13 @@ int mlx4_INIT_HCA(struct mlx4_dev *dev, struct mlx4_init_hca_param *param)
19501955
if (dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RECOVERABLE_ERROR_EVENT)
19511956
*(inbox + INIT_HCA_RECOVERABLE_ERROR_EVENT_OFFSET / 4) |= cpu_to_be32(1 << 31);
19521957

1958+
if (dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_DRIVER_VERSION_TO_FW) {
1959+
u8 *dst = (u8 *)(inbox + INIT_HCA_DRIVER_VERSION_OFFSET / 4);
1960+
1961+
strncpy(dst, DRV_NAME_FOR_FW, INIT_HCA_DRIVER_VERSION_SZ - 1);
1962+
mlx4_dbg(dev, "Reporting Driver Version to FW: %s\n", dst);
1963+
}
1964+
19531965
/* QPC/EEC/CQC/EQC/RDMARC attributes */
19541966

19551967
MLX4_PUT(inbox, param->qpc_base, INIT_HCA_QPC_BASE_OFFSET);

drivers/net/ethernet/mellanox/mlx4/mlx4.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555
#include "fw_qos.h"
5656

5757
#define DRV_NAME "mlx4_core"
58-
#define PFX DRV_NAME ": "
5958
#define DRV_VERSION "4.0-0"
59+
#define DRV_NAME_FOR_FW "Linux," DRV_NAME "," DRV_VERSION
6060

6161
#define MLX4_FS_UDP_UC_EN (1 << 1)
6262
#define MLX4_FS_TCP_UC_EN (1 << 2)

include/linux/mlx4/device.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ enum {
225225
MLX4_DEV_CAP_FLAG2_SVLAN_BY_QP = 1ULL << 36,
226226
MLX4_DEV_CAP_FLAG2_SL_TO_VL_CHANGE_EVENT = 1ULL << 37,
227227
MLX4_DEV_CAP_FLAG2_USER_MAC_EN = 1ULL << 38,
228+
MLX4_DEV_CAP_FLAG2_DRIVER_VERSION_TO_FW = 1ULL << 39,
228229
};
229230

230231
enum {

0 commit comments

Comments
 (0)