Skip to content

Commit 47d0c50

Browse files
shayshyikuba-moo
authored andcommitted
net/mlx5: Add generic getters for other functions caps
Downstream patch requires to get other function GENERAL2 caps while mlx5_vport_get_other_func_cap() gets only one type of caps (general). Rename it to represent this and introduce a generic implementation of mlx5_vport_get_other_func_cap(). Signed-off-by: Shay Drory <[email protected]> Reviewed-by: Mark Bloch <[email protected]> Acked-by: Saeed Mahameed <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent da65e9f commit 47d0c50

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3889,7 +3889,7 @@ static int mlx5_esw_query_vport_vhca_id(struct mlx5_eswitch *esw, u16 vport_num,
38893889
if (!query_ctx)
38903890
return -ENOMEM;
38913891

3892-
err = mlx5_vport_get_other_func_cap(esw->dev, vport_num, query_ctx);
3892+
err = mlx5_vport_get_other_func_general_cap(esw->dev, vport_num, query_ctx);
38933893
if (err)
38943894
goto out_free;
38953895

drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,8 @@ void mlx5_unload_one_devl_locked(struct mlx5_core_dev *dev);
324324
int mlx5_load_one(struct mlx5_core_dev *dev, bool recovery);
325325
int mlx5_load_one_devl_locked(struct mlx5_core_dev *dev, bool recovery);
326326

327-
int mlx5_vport_get_other_func_cap(struct mlx5_core_dev *dev, u16 function_id, void *out);
327+
#define mlx5_vport_get_other_func_general_cap(dev, fid, out) \
328+
mlx5_vport_get_other_func_cap(dev, fid, out, MLX5_CAP_GENERAL)
328329

329330
void mlx5_events_work_enqueue(struct mlx5_core_dev *dev, struct work_struct *work);
330331
static inline u32 mlx5_sriov_get_vf_total_msix(struct pci_dev *pdev)

drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <linux/interrupt.h>
55
#include <linux/notifier.h>
66
#include <linux/mlx5/driver.h>
7+
#include <linux/mlx5/vport.h>
78
#include "mlx5_core.h"
89
#include "mlx5_irq.h"
910
#include "pci_irq.h"
@@ -101,7 +102,7 @@ int mlx5_set_msix_vec_count(struct mlx5_core_dev *dev, int function_id,
101102
goto out;
102103
}
103104

104-
ret = mlx5_vport_get_other_func_cap(dev, function_id, query_cap);
105+
ret = mlx5_vport_get_other_func_general_cap(dev, function_id, query_cap);
105106
if (ret)
106107
goto out;
107108

drivers/net/ethernet/mellanox/mlx5/core/vport.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,14 +1160,16 @@ u64 mlx5_query_nic_system_image_guid(struct mlx5_core_dev *mdev)
11601160
}
11611161
EXPORT_SYMBOL_GPL(mlx5_query_nic_system_image_guid);
11621162

1163-
int mlx5_vport_get_other_func_cap(struct mlx5_core_dev *dev, u16 function_id, void *out)
1163+
int mlx5_vport_get_other_func_cap(struct mlx5_core_dev *dev, u16 function_id, void *out,
1164+
u16 opmod)
11641165
{
1165-
u16 opmod = (MLX5_CAP_GENERAL << 1) | (HCA_CAP_OPMOD_GET_MAX & 0x01);
11661166
u8 in[MLX5_ST_SZ_BYTES(query_hca_cap_in)] = {};
11671167

1168+
opmod = (opmod << 1) | (HCA_CAP_OPMOD_GET_MAX & 0x01);
11681169
MLX5_SET(query_hca_cap_in, in, opcode, MLX5_CMD_OP_QUERY_HCA_CAP);
11691170
MLX5_SET(query_hca_cap_in, in, op_mod, opmod);
11701171
MLX5_SET(query_hca_cap_in, in, function_id, function_id);
11711172
MLX5_SET(query_hca_cap_in, in, other_function, true);
11721173
return mlx5_cmd_exec_inout(dev, query_hca_cap, in, out);
11731174
}
1175+
EXPORT_SYMBOL_GPL(mlx5_vport_get_other_func_cap);

include/linux/mlx5/vport.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,6 @@ int mlx5_nic_vport_affiliate_multiport(struct mlx5_core_dev *master_mdev,
132132
int mlx5_nic_vport_unaffiliate_multiport(struct mlx5_core_dev *port_mdev);
133133

134134
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,
136+
u16 opmod);
135137
#endif /* __MLX5_VPORT_H__ */

0 commit comments

Comments
 (0)