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

net/mlx5: Update vport caps query/set for EC VFs

These functions are for query/set by vport, there was an underlying
assumption that vport was equal to function ID. That's not the case for
EC VF functions. Set the ec_vf_function bit accordingly.

Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
Reviewed-by: William Tu <witu@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>

authored by

Daniel Jurgens and committed by
Saeed Mahameed
9ac0b128 dc131808

+19 -8
+3 -3
drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
··· 325 325 int mlx5_load_one(struct mlx5_core_dev *dev, bool recovery); 326 326 int mlx5_load_one_devl_locked(struct mlx5_core_dev *dev, bool recovery); 327 327 328 - int mlx5_vport_set_other_func_cap(struct mlx5_core_dev *dev, const void *hca_cap, u16 function_id, 328 + int mlx5_vport_set_other_func_cap(struct mlx5_core_dev *dev, const void *hca_cap, u16 vport, 329 329 u16 opmod); 330 - #define mlx5_vport_get_other_func_general_cap(dev, fid, out) \ 331 - mlx5_vport_get_other_func_cap(dev, fid, out, MLX5_CAP_GENERAL) 330 + #define mlx5_vport_get_other_func_general_cap(dev, vport, out) \ 331 + mlx5_vport_get_other_func_cap(dev, vport, out, MLX5_CAP_GENERAL) 332 332 333 333 void mlx5_events_work_enqueue(struct mlx5_core_dev *dev, struct work_struct *work); 334 334 static inline u32 mlx5_sriov_get_vf_total_msix(struct pci_dev *pdev)
+15 -4
drivers/net/ethernet/mellanox/mlx5/core/vport.c
··· 1161 1161 } 1162 1162 EXPORT_SYMBOL_GPL(mlx5_query_nic_system_image_guid); 1163 1163 1164 - int mlx5_vport_get_other_func_cap(struct mlx5_core_dev *dev, u16 function_id, void *out, 1164 + static int mlx5_vport_to_func_id(const struct mlx5_core_dev *dev, u16 vport, bool ec_vf_func) 1165 + { 1166 + return ec_vf_func ? vport - mlx5_core_ec_vf_vport_base(dev) 1167 + : vport; 1168 + } 1169 + 1170 + int mlx5_vport_get_other_func_cap(struct mlx5_core_dev *dev, u16 vport, void *out, 1165 1171 u16 opmod) 1166 1172 { 1173 + bool ec_vf_func = mlx5_core_is_ec_vf_vport(dev, vport); 1167 1174 u8 in[MLX5_ST_SZ_BYTES(query_hca_cap_in)] = {}; 1168 1175 1169 1176 opmod = (opmod << 1) | (HCA_CAP_OPMOD_GET_MAX & 0x01); 1170 1177 MLX5_SET(query_hca_cap_in, in, opcode, MLX5_CMD_OP_QUERY_HCA_CAP); 1171 1178 MLX5_SET(query_hca_cap_in, in, op_mod, opmod); 1172 - MLX5_SET(query_hca_cap_in, in, function_id, function_id); 1179 + MLX5_SET(query_hca_cap_in, in, function_id, mlx5_vport_to_func_id(dev, vport, ec_vf_func)); 1173 1180 MLX5_SET(query_hca_cap_in, in, other_function, true); 1181 + MLX5_SET(query_hca_cap_in, in, ec_vf_function, ec_vf_func); 1174 1182 return mlx5_cmd_exec_inout(dev, query_hca_cap, in, out); 1175 1183 } 1176 1184 EXPORT_SYMBOL_GPL(mlx5_vport_get_other_func_cap); 1177 1185 1178 1186 int mlx5_vport_set_other_func_cap(struct mlx5_core_dev *dev, const void *hca_cap, 1179 - u16 function_id, u16 opmod) 1187 + u16 vport, u16 opmod) 1180 1188 { 1189 + bool ec_vf_func = mlx5_core_is_ec_vf_vport(dev, vport); 1181 1190 int set_sz = MLX5_ST_SZ_BYTES(set_hca_cap_in); 1182 1191 void *set_hca_cap; 1183 1192 void *set_ctx; ··· 1200 1191 MLX5_SET(set_hca_cap_in, set_ctx, op_mod, opmod << 1); 1201 1192 set_hca_cap = MLX5_ADDR_OF(set_hca_cap_in, set_ctx, capability); 1202 1193 memcpy(set_hca_cap, hca_cap, MLX5_ST_SZ_BYTES(cmd_hca_cap)); 1203 - MLX5_SET(set_hca_cap_in, set_ctx, function_id, function_id); 1194 + MLX5_SET(set_hca_cap_in, set_ctx, function_id, 1195 + mlx5_vport_to_func_id(dev, vport, ec_vf_func)); 1204 1196 MLX5_SET(set_hca_cap_in, set_ctx, other_function, true); 1197 + MLX5_SET(set_hca_cap_in, set_ctx, ec_vf_function, ec_vf_func); 1205 1198 ret = mlx5_cmd_exec_in(dev, set_hca_cap, set_ctx); 1206 1199 1207 1200 kfree(set_ctx);
+1 -1
include/linux/mlx5/vport.h
··· 132 132 int mlx5_nic_vport_unaffiliate_multiport(struct mlx5_core_dev *port_mdev); 133 133 134 134 u64 mlx5_query_nic_system_image_guid(struct mlx5_core_dev *mdev); 135 - int mlx5_vport_get_other_func_cap(struct mlx5_core_dev *dev, u16 function_id, void *out, 135 + int mlx5_vport_get_other_func_cap(struct mlx5_core_dev *dev, u16 vport, void *out, 136 136 u16 opmod); 137 137 #endif /* __MLX5_VPORT_H__ */