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 <shayd@nvidia.com> Reviewed-by: Mark Bloch <mbloch@nvidia.com> Acked-by: Saeed Mahameed <saeedm@nvidia.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
da65e9ff3b
commit
47d0c500d7
@ -3889,7 +3889,7 @@ static int mlx5_esw_query_vport_vhca_id(struct mlx5_eswitch *esw, u16 vport_num,
|
||||
if (!query_ctx)
|
||||
return -ENOMEM;
|
||||
|
||||
err = mlx5_vport_get_other_func_cap(esw->dev, vport_num, query_ctx);
|
||||
err = mlx5_vport_get_other_func_general_cap(esw->dev, vport_num, query_ctx);
|
||||
if (err)
|
||||
goto out_free;
|
||||
|
||||
|
@ -324,7 +324,8 @@ void mlx5_unload_one_devl_locked(struct mlx5_core_dev *dev);
|
||||
int mlx5_load_one(struct mlx5_core_dev *dev, bool recovery);
|
||||
int mlx5_load_one_devl_locked(struct mlx5_core_dev *dev, bool recovery);
|
||||
|
||||
int mlx5_vport_get_other_func_cap(struct mlx5_core_dev *dev, u16 function_id, void *out);
|
||||
#define mlx5_vport_get_other_func_general_cap(dev, fid, out) \
|
||||
mlx5_vport_get_other_func_cap(dev, fid, out, MLX5_CAP_GENERAL)
|
||||
|
||||
void mlx5_events_work_enqueue(struct mlx5_core_dev *dev, struct work_struct *work);
|
||||
static inline u32 mlx5_sriov_get_vf_total_msix(struct pci_dev *pdev)
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/notifier.h>
|
||||
#include <linux/mlx5/driver.h>
|
||||
#include <linux/mlx5/vport.h>
|
||||
#include "mlx5_core.h"
|
||||
#include "mlx5_irq.h"
|
||||
#include "pci_irq.h"
|
||||
@ -101,7 +102,7 @@ int mlx5_set_msix_vec_count(struct mlx5_core_dev *dev, int function_id,
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = mlx5_vport_get_other_func_cap(dev, function_id, query_cap);
|
||||
ret = mlx5_vport_get_other_func_general_cap(dev, function_id, query_cap);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
|
@ -1160,14 +1160,16 @@ u64 mlx5_query_nic_system_image_guid(struct mlx5_core_dev *mdev)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mlx5_query_nic_system_image_guid);
|
||||
|
||||
int mlx5_vport_get_other_func_cap(struct mlx5_core_dev *dev, u16 function_id, void *out)
|
||||
int mlx5_vport_get_other_func_cap(struct mlx5_core_dev *dev, u16 function_id, void *out,
|
||||
u16 opmod)
|
||||
{
|
||||
u16 opmod = (MLX5_CAP_GENERAL << 1) | (HCA_CAP_OPMOD_GET_MAX & 0x01);
|
||||
u8 in[MLX5_ST_SZ_BYTES(query_hca_cap_in)] = {};
|
||||
|
||||
opmod = (opmod << 1) | (HCA_CAP_OPMOD_GET_MAX & 0x01);
|
||||
MLX5_SET(query_hca_cap_in, in, opcode, MLX5_CMD_OP_QUERY_HCA_CAP);
|
||||
MLX5_SET(query_hca_cap_in, in, op_mod, opmod);
|
||||
MLX5_SET(query_hca_cap_in, in, function_id, function_id);
|
||||
MLX5_SET(query_hca_cap_in, in, other_function, true);
|
||||
return mlx5_cmd_exec_inout(dev, query_hca_cap, in, out);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mlx5_vport_get_other_func_cap);
|
||||
|
@ -132,4 +132,6 @@ int mlx5_nic_vport_affiliate_multiport(struct mlx5_core_dev *master_mdev,
|
||||
int mlx5_nic_vport_unaffiliate_multiport(struct mlx5_core_dev *port_mdev);
|
||||
|
||||
u64 mlx5_query_nic_system_image_guid(struct mlx5_core_dev *mdev);
|
||||
int mlx5_vport_get_other_func_cap(struct mlx5_core_dev *dev, u16 function_id, void *out,
|
||||
u16 opmod);
|
||||
#endif /* __MLX5_VPORT_H__ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user