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

net/mlx5: Rename and move mlx5_esw_query_vport_vhca_id

Rename mlx5_esw_query_vport_vhca_id to mlx5_vport_get_vhca_id and move
it to vport file. Also, add function declaration to mlx5_core header
file. This better represents the function's usage and allows for it to
be called from other parts of the mlx5_core driver.

Signed-off-by: Akiva Goldberger <agoldberger@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20250209101716.112774-10-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Akiva Goldberger and committed by
Jakub Kicinski
38b3d42e a38cc570

+29 -27
+2 -27
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
··· 4157 4157 } 4158 4158 EXPORT_SYMBOL(mlx5_eswitch_get_vport_metadata_for_match); 4159 4159 4160 - static int mlx5_esw_query_vport_vhca_id(struct mlx5_eswitch *esw, u16 vport_num, u16 *vhca_id) 4161 - { 4162 - int query_out_sz = MLX5_ST_SZ_BYTES(query_hca_cap_out); 4163 - void *query_ctx; 4164 - void *hca_caps; 4165 - int err; 4166 - 4167 - *vhca_id = 0; 4168 - 4169 - query_ctx = kzalloc(query_out_sz, GFP_KERNEL); 4170 - if (!query_ctx) 4171 - return -ENOMEM; 4172 - 4173 - err = mlx5_vport_get_other_func_general_cap(esw->dev, vport_num, query_ctx); 4174 - if (err) 4175 - goto out_free; 4176 - 4177 - hca_caps = MLX5_ADDR_OF(query_hca_cap_out, query_ctx, capability); 4178 - *vhca_id = MLX5_GET(cmd_hca_cap, hca_caps, vhca_id); 4179 - 4180 - out_free: 4181 - kfree(query_ctx); 4182 - return err; 4183 - } 4184 - 4185 4160 int mlx5_esw_vport_vhca_id_set(struct mlx5_eswitch *esw, u16 vport_num) 4186 4161 { 4187 4162 u16 *old_entry, *vhca_map_entry, vhca_id; 4188 4163 int err; 4189 4164 4190 - err = mlx5_esw_query_vport_vhca_id(esw, vport_num, &vhca_id); 4165 + err = mlx5_vport_get_vhca_id(esw->dev, vport_num, &vhca_id); 4191 4166 if (err) { 4192 4167 esw_warn(esw->dev, "Getting vhca_id for vport failed (vport=%u,err=%d)\n", 4193 4168 vport_num, err); ··· 4188 4213 u16 *vhca_map_entry, vhca_id; 4189 4214 int err; 4190 4215 4191 - err = mlx5_esw_query_vport_vhca_id(esw, vport_num, &vhca_id); 4216 + err = mlx5_vport_get_vhca_id(esw->dev, vport_num, &vhca_id); 4192 4217 if (err) 4193 4218 esw_warn(esw->dev, "Getting vhca_id for vport failed (vport=%hu,err=%d)\n", 4194 4219 vport_num, err);
+2
drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
··· 346 346 #define mlx5_vport_get_other_func_general_cap(dev, vport, out) \ 347 347 mlx5_vport_get_other_func_cap(dev, vport, out, MLX5_CAP_GENERAL) 348 348 349 + int mlx5_vport_get_vhca_id(struct mlx5_core_dev *dev, u16 vport, u16 *vhca_id); 350 + 349 351 static inline u32 mlx5_sriov_get_vf_total_msix(struct pci_dev *pdev) 350 352 { 351 353 struct mlx5_core_dev *dev = pci_get_drvdata(pdev);
+25
drivers/net/ethernet/mellanox/mlx5/core/vport.c
··· 1199 1199 } 1200 1200 EXPORT_SYMBOL_GPL(mlx5_vport_get_other_func_cap); 1201 1201 1202 + int mlx5_vport_get_vhca_id(struct mlx5_core_dev *dev, u16 vport, u16 *vhca_id) 1203 + { 1204 + int query_out_sz = MLX5_ST_SZ_BYTES(query_hca_cap_out); 1205 + void *query_ctx; 1206 + void *hca_caps; 1207 + int err; 1208 + 1209 + *vhca_id = 0; 1210 + 1211 + query_ctx = kzalloc(query_out_sz, GFP_KERNEL); 1212 + if (!query_ctx) 1213 + return -ENOMEM; 1214 + 1215 + err = mlx5_vport_get_other_func_general_cap(dev, vport, query_ctx); 1216 + if (err) 1217 + goto out_free; 1218 + 1219 + hca_caps = MLX5_ADDR_OF(query_hca_cap_out, query_ctx, capability); 1220 + *vhca_id = MLX5_GET(cmd_hca_cap, hca_caps, vhca_id); 1221 + 1222 + out_free: 1223 + kfree(query_ctx); 1224 + return err; 1225 + } 1226 + 1202 1227 int mlx5_vport_set_other_func_cap(struct mlx5_core_dev *dev, const void *hca_cap, 1203 1228 u16 vport, u16 opmod) 1204 1229 {