Skip to content

Commit b637ac5

Browse files
elic307iSaeed Mahameed
authored andcommitted
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: Eli Cohen <[email protected]> Reviewed-by: Shay Drory <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]> Reviewed-by: Jacob Keller <[email protected]>
1 parent 1dc8513 commit b637ac5

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

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

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include <linux/mlx5/mlx5_ifc_vdpa.h>
3636
#include <linux/mlx5/vport.h>
3737
#include "mlx5_core.h"
38+
#include "devlink.h"
3839

3940
/* intf dev list mutex */
4041
static DEFINE_MUTEX(mlx5_intf_mutex);
@@ -109,17 +110,6 @@ bool mlx5_eth_supported(struct mlx5_core_dev *dev)
109110
return true;
110111
}
111112

112-
static bool is_eth_enabled(struct mlx5_core_dev *dev)
113-
{
114-
union devlink_param_value val;
115-
int err;
116-
117-
err = devl_param_driverinit_value_get(priv_to_devlink(dev),
118-
DEVLINK_PARAM_GENERIC_ID_ENABLE_ETH,
119-
&val);
120-
return err ? false : val.vbool;
121-
}
122-
123113
bool mlx5_vnet_supported(struct mlx5_core_dev *dev)
124114
{
125115
if (!IS_ENABLED(CONFIG_MLX5_VDPA_NET))
@@ -251,7 +241,7 @@ static const struct mlx5_adev_device {
251241
.is_enabled = &is_ib_enabled },
252242
[MLX5_INTERFACE_PROTOCOL_ETH] = { .suffix = "eth",
253243
.is_supported = &mlx5_eth_supported,
254-
.is_enabled = &is_eth_enabled },
244+
.is_enabled = &mlx5_core_is_eth_enabled },
255245
[MLX5_INTERFACE_PROTOCOL_ETH_REP] = { .suffix = "eth-rep",
256246
.is_supported = &is_eth_rep_supported },
257247
[MLX5_INTERFACE_PROTOCOL_IB_REP] = { .suffix = "rdma-rep",

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,15 @@ void mlx5_devlink_free(struct devlink *devlink);
4444
int mlx5_devlink_params_register(struct devlink *devlink);
4545
void mlx5_devlink_params_unregister(struct devlink *devlink);
4646

47+
static inline bool mlx5_core_is_eth_enabled(struct mlx5_core_dev *dev)
48+
{
49+
union devlink_param_value val;
50+
int err;
51+
52+
err = devl_param_driverinit_value_get(priv_to_devlink(dev),
53+
DEVLINK_PARAM_GENERIC_ID_ENABLE_ETH,
54+
&val);
55+
return err ? false : val.vbool;
56+
}
57+
4758
#endif /* __MLX5_DEVLINK_H__ */

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,6 +1120,13 @@ static int get_num_eqs(struct mlx5_core_dev *dev)
11201120
int max_eqs_sf;
11211121
int num_eqs;
11221122

1123+
/* If ethernet is disabled we use just a single completion vector to
1124+
* have the other vectors available for other drivers using mlx5_core. For
1125+
* example, mlx5_vdpa
1126+
*/
1127+
if (!mlx5_core_is_eth_enabled(dev) && mlx5_eth_supported(dev))
1128+
return 1;
1129+
11231130
max_dev_eqs = MLX5_CAP_GEN(dev, max_num_eqs) ?
11241131
MLX5_CAP_GEN(dev, max_num_eqs) :
11251132
1 << MLX5_CAP_GEN(dev, log_max_eq);

0 commit comments

Comments
 (0)