]> git.itanic.dy.fi Git - linux-stable/commitdiff
net/mlx5: Add generic getters for other functions caps
authorShay Drory <shayd@nvidia.com>
Tue, 6 Dec 2022 18:51:16 +0000 (20:51 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 8 Dec 2022 04:09:18 +0000 (20:09 -0800)
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>
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c
drivers/net/ethernet/mellanox/mlx5/core/vport.c
include/linux/mlx5/vport.h

index 9b6fbb19c22a95bed78bb88f74270d17bea48533..33dffcb8bdd7dfef9da3e409159b0c58d2f17e16 100644 (file)
@@ -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;
 
index a806e3de7b7c321ddb17861951e91d47c92bd881..09473983778f9efb836a8fa5cf4f85bbe27ac76c 100644 (file)
@@ -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)
index 662f1d55e30e0f7b8a5b1f4a2585c0c449662995..6bde18bcd42f5df399505a1aec2b46c4b4142552 100644 (file)
@@ -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;
 
index d5c3173250309192f41b465fd3ca13afda8d299d..7eca7582f243736ad59892b0844df22972216422 100644 (file)
@@ -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);
index aad53cb72f1791986110f20261e35b158a8f12e4..7f31432f44c2c620d543b2bad11992594b11992e 100644 (file)
@@ -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__ */