Commit b637ac5d authored by Eli Cohen's avatar Eli Cohen Committed by Saeed Mahameed

net/mlx5: Use one completion vector if eth is disabled

If eth is disabled by devlink, use only a single completion vector to
have minimum performance of all users of completion vectors. This also
affects Infiniband performance.

The rest of the vectors can be used by other consumers on a first come
first served basis.

mlx5_vdpa will make use of this to allocate dedicated vectors for its
own use.
Signed-off-by: default avatarEli Cohen <elic@nvidia.com>
Reviewed-by: default avatarShay Drory <shayd@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
parent 1dc85133
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <linux/mlx5/mlx5_ifc_vdpa.h> #include <linux/mlx5/mlx5_ifc_vdpa.h>
#include <linux/mlx5/vport.h> #include <linux/mlx5/vport.h>
#include "mlx5_core.h" #include "mlx5_core.h"
#include "devlink.h"
/* intf dev list mutex */ /* intf dev list mutex */
static DEFINE_MUTEX(mlx5_intf_mutex); static DEFINE_MUTEX(mlx5_intf_mutex);
...@@ -109,17 +110,6 @@ bool mlx5_eth_supported(struct mlx5_core_dev *dev) ...@@ -109,17 +110,6 @@ bool mlx5_eth_supported(struct mlx5_core_dev *dev)
return true; return true;
} }
static bool is_eth_enabled(struct mlx5_core_dev *dev)
{
union devlink_param_value val;
int err;
err = devl_param_driverinit_value_get(priv_to_devlink(dev),
DEVLINK_PARAM_GENERIC_ID_ENABLE_ETH,
&val);
return err ? false : val.vbool;
}
bool mlx5_vnet_supported(struct mlx5_core_dev *dev) bool mlx5_vnet_supported(struct mlx5_core_dev *dev)
{ {
if (!IS_ENABLED(CONFIG_MLX5_VDPA_NET)) if (!IS_ENABLED(CONFIG_MLX5_VDPA_NET))
...@@ -251,7 +241,7 @@ static const struct mlx5_adev_device { ...@@ -251,7 +241,7 @@ static const struct mlx5_adev_device {
.is_enabled = &is_ib_enabled }, .is_enabled = &is_ib_enabled },
[MLX5_INTERFACE_PROTOCOL_ETH] = { .suffix = "eth", [MLX5_INTERFACE_PROTOCOL_ETH] = { .suffix = "eth",
.is_supported = &mlx5_eth_supported, .is_supported = &mlx5_eth_supported,
.is_enabled = &is_eth_enabled }, .is_enabled = &mlx5_core_is_eth_enabled },
[MLX5_INTERFACE_PROTOCOL_ETH_REP] = { .suffix = "eth-rep", [MLX5_INTERFACE_PROTOCOL_ETH_REP] = { .suffix = "eth-rep",
.is_supported = &is_eth_rep_supported }, .is_supported = &is_eth_rep_supported },
[MLX5_INTERFACE_PROTOCOL_IB_REP] = { .suffix = "rdma-rep", [MLX5_INTERFACE_PROTOCOL_IB_REP] = { .suffix = "rdma-rep",
......
...@@ -44,4 +44,15 @@ void mlx5_devlink_free(struct devlink *devlink); ...@@ -44,4 +44,15 @@ void mlx5_devlink_free(struct devlink *devlink);
int mlx5_devlink_params_register(struct devlink *devlink); int mlx5_devlink_params_register(struct devlink *devlink);
void mlx5_devlink_params_unregister(struct devlink *devlink); void mlx5_devlink_params_unregister(struct devlink *devlink);
static inline bool mlx5_core_is_eth_enabled(struct mlx5_core_dev *dev)
{
union devlink_param_value val;
int err;
err = devl_param_driverinit_value_get(priv_to_devlink(dev),
DEVLINK_PARAM_GENERIC_ID_ENABLE_ETH,
&val);
return err ? false : val.vbool;
}
#endif /* __MLX5_DEVLINK_H__ */ #endif /* __MLX5_DEVLINK_H__ */
...@@ -1120,6 +1120,13 @@ static int get_num_eqs(struct mlx5_core_dev *dev) ...@@ -1120,6 +1120,13 @@ static int get_num_eqs(struct mlx5_core_dev *dev)
int max_eqs_sf; int max_eqs_sf;
int num_eqs; int num_eqs;
/* If ethernet is disabled we use just a single completion vector to
* have the other vectors available for other drivers using mlx5_core. For
* example, mlx5_vdpa
*/
if (!mlx5_core_is_eth_enabled(dev) && mlx5_eth_supported(dev))
return 1;
max_dev_eqs = MLX5_CAP_GEN(dev, max_num_eqs) ? max_dev_eqs = MLX5_CAP_GEN(dev, max_num_eqs) ?
MLX5_CAP_GEN(dev, max_num_eqs) : MLX5_CAP_GEN(dev, max_num_eqs) :
1 << MLX5_CAP_GEN(dev, log_max_eq); 1 << MLX5_CAP_GEN(dev, log_max_eq);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment