Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net/mlx5: Query device memory capabilities

This patch adds querying of device memory capabilities by the mlx5_core
driver during initialization.

Device memory capabilities is a new capability type and structure
which contains the necessary data that is needed for future device
memory allocation.

The presence of this new capabilities struct is indicated in the
general capabilities struct which is queried first by the driver.
If the presence bit is set, the driver will also query the new
capabilities struct and save it in the device context.

Signed-off-by: Ariel Levkovich <lariel@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>

authored by

Ariel Levkovich and committed by
Jason Gunthorpe
e72bd817 be934cca

+34 -1
+6
drivers/net/ethernet/mellanox/mlx5/core/fw.c
··· 192 192 if (MLX5_CAP_GEN(dev, qcam_reg)) 193 193 mlx5_get_qcam_reg(dev); 194 194 195 + if (MLX5_CAP_GEN(dev, device_memory)) { 196 + err = mlx5_core_get_caps(dev, MLX5_CAP_DEV_MEM); 197 + if (err) 198 + return err; 199 + } 200 + 195 201 return 0; 196 202 } 197 203
+9
include/linux/mlx5/device.h
··· 1013 1013 MLX5_CAP_RESERVED, 1014 1014 MLX5_CAP_VECTOR_CALC, 1015 1015 MLX5_CAP_QOS, 1016 + MLX5_CAP_DEBUG, 1017 + MLX5_CAP_RESERVED_14, 1018 + MLX5_CAP_DEV_MEM, 1016 1019 /* NUM OF CAP Types */ 1017 1020 MLX5_CAP_NUM 1018 1021 }; ··· 1163 1160 1164 1161 #define MLX5_CAP64_FPGA(mdev, cap) \ 1165 1162 MLX5_GET64(fpga_cap, (mdev)->caps.fpga, cap) 1163 + 1164 + #define MLX5_CAP_DEV_MEM(mdev, cap)\ 1165 + MLX5_GET(device_mem_cap, mdev->caps.hca_cur[MLX5_CAP_DEV_MEM], cap) 1166 + 1167 + #define MLX5_CAP64_DEV_MEM(mdev, cap)\ 1168 + MLX5_GET64(device_mem_cap, mdev->caps.hca_cur[MLX5_CAP_DEV_MEM], cap) 1166 1169 1167 1170 enum { 1168 1171 MLX5_CMD_STAT_OK = 0x0,
+19 -1
include/linux/mlx5/mlx5_ifc.h
··· 658 658 u8 reserved_at_100[0x700]; 659 659 }; 660 660 661 + struct mlx5_ifc_device_mem_cap_bits { 662 + u8 memic[0x1]; 663 + u8 reserved_at_1[0x1f]; 664 + 665 + u8 reserved_at_20[0xb]; 666 + u8 log_min_memic_alloc_size[0x5]; 667 + u8 reserved_at_30[0x8]; 668 + u8 log_max_memic_addr_alignment[0x8]; 669 + 670 + u8 memic_bar_start_addr[0x40]; 671 + 672 + u8 memic_bar_size[0x20]; 673 + 674 + u8 max_memic_size[0x20]; 675 + 676 + u8 reserved_at_c0[0x740]; 677 + }; 678 + 661 679 enum { 662 680 MLX5_ATOMIC_CAPS_ATOMIC_SIZE_QP_1_BYTE = 0x0, 663 681 MLX5_ATOMIC_CAPS_ATOMIC_SIZE_QP_2_BYTES = 0x2, ··· 890 872 u8 ets[0x1]; 891 873 u8 nic_flow_table[0x1]; 892 874 u8 eswitch_flow_table[0x1]; 893 - u8 early_vf_enable[0x1]; 875 + u8 device_memory[0x1]; 894 876 u8 mcam_reg[0x1]; 895 877 u8 pcam_reg[0x1]; 896 878 u8 local_ca_ack_delay[0x5];