You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
164 lines
6.6 KiB
164 lines
6.6 KiB
From 43b996d1219f2ea80cc56d91384e00948bc71174 Mon Sep 17 00:00:00 2001
|
|
From: Alaa Hleihel <ahleihel@redhat.com>
|
|
Date: Mon, 1 Jun 2020 15:40:57 -0400
|
|
Subject: [PATCH 302/312] [netdrv] net/mlx5e: Properly set default values when
|
|
disabling adaptive moderation
|
|
|
|
Message-id: <20200601154102.25980-35-ahleihel@redhat.com>
|
|
Patchwork-id: 315739
|
|
Patchwork-instance: patchwork
|
|
O-Subject: [RHEL8.3 BZ 1842258 34/39] net/mlx5e: Properly set default values when disabling adaptive moderation
|
|
Bugzilla: 1842258
|
|
RH-Acked-by: Honggang Li <honli@redhat.com>
|
|
RH-Acked-by: Kamal Heib <kheib@redhat.com>
|
|
RH-Acked-by: Marcelo Leitner <mleitner@redhat.com>
|
|
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
|
|
|
|
Bugzilla: http://bugzilla.redhat.com/1842258
|
|
Upstream: v5.7
|
|
|
|
commit ebeaf084ad5c0eeaf8ea3314f62cc28cb79d529f
|
|
Author: Tal Gilboa <talgi@mellanox.com>
|
|
Date: Thu Apr 23 13:23:06 2020 +0300
|
|
|
|
net/mlx5e: Properly set default values when disabling adaptive moderation
|
|
|
|
Add a call to mlx5e_reset_rx/tx_moderation() when enabling/disabling
|
|
adaptive moderation, in order to select the proper default values.
|
|
|
|
In order to do so, we separate the logic of selecting the moderation values
|
|
and setting moderion mode (CQE/EQE based).
|
|
|
|
Fixes: 0088cbbc4b66 ("net/mlx5e: Enable CQE based moderation on TX CQ")
|
|
Fixes: 9908aa292971 ("net/mlx5e: CQE based moderation")
|
|
Signed-off-by: Tal Gilboa <talgi@mellanox.com>
|
|
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
|
|
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
|
|
|
|
Signed-off-by: Alaa Hleihel <ahleihel@redhat.com>
|
|
Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
|
|
---
|
|
drivers/net/ethernet/mellanox/mlx5/core/en.h | 10 ++++++----
|
|
.../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 21 +++++++++++++++++----
|
|
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 20 ++++++++++++++------
|
|
3 files changed, 37 insertions(+), 14 deletions(-)
|
|
|
|
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
|
|
index 9832ac9a55dc..75f4b5a29ae3 100644
|
|
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
|
|
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
|
|
@@ -1056,10 +1056,12 @@ void mlx5e_deactivate_priv_channels(struct mlx5e_priv *priv);
|
|
|
|
void mlx5e_build_default_indir_rqt(u32 *indirection_rqt, int len,
|
|
int num_channels);
|
|
-void mlx5e_set_tx_cq_mode_params(struct mlx5e_params *params,
|
|
- u8 cq_period_mode);
|
|
-void mlx5e_set_rx_cq_mode_params(struct mlx5e_params *params,
|
|
- u8 cq_period_mode);
|
|
+
|
|
+void mlx5e_reset_tx_moderation(struct mlx5e_params *params, u8 cq_period_mode);
|
|
+void mlx5e_reset_rx_moderation(struct mlx5e_params *params, u8 cq_period_mode);
|
|
+void mlx5e_set_tx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode);
|
|
+void mlx5e_set_rx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode);
|
|
+
|
|
void mlx5e_set_rq_type(struct mlx5_core_dev *mdev, struct mlx5e_params *params);
|
|
void mlx5e_init_rq_type_params(struct mlx5_core_dev *mdev,
|
|
struct mlx5e_params *params);
|
|
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
|
|
index cae5da83e793..a6fadcfae236 100644
|
|
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
|
|
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
|
|
@@ -527,8 +527,8 @@ int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv,
|
|
struct dim_cq_moder *rx_moder, *tx_moder;
|
|
struct mlx5_core_dev *mdev = priv->mdev;
|
|
struct mlx5e_channels new_channels = {};
|
|
+ bool reset_rx, reset_tx;
|
|
int err = 0;
|
|
- bool reset;
|
|
|
|
if (!MLX5_CAP_GEN(mdev, cq_moderation))
|
|
return -EOPNOTSUPP;
|
|
@@ -566,15 +566,28 @@ int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv,
|
|
}
|
|
/* we are opened */
|
|
|
|
- reset = (!!coal->use_adaptive_rx_coalesce != priv->channels.params.rx_dim_enabled) ||
|
|
- (!!coal->use_adaptive_tx_coalesce != priv->channels.params.tx_dim_enabled);
|
|
+ reset_rx = !!coal->use_adaptive_rx_coalesce != priv->channels.params.rx_dim_enabled;
|
|
+ reset_tx = !!coal->use_adaptive_tx_coalesce != priv->channels.params.tx_dim_enabled;
|
|
|
|
- if (!reset) {
|
|
+ if (!reset_rx && !reset_tx) {
|
|
mlx5e_set_priv_channels_coalesce(priv, coal);
|
|
priv->channels.params = new_channels.params;
|
|
goto out;
|
|
}
|
|
|
|
+ if (reset_rx) {
|
|
+ u8 mode = MLX5E_GET_PFLAG(&new_channels.params,
|
|
+ MLX5E_PFLAG_RX_CQE_BASED_MODER);
|
|
+
|
|
+ mlx5e_reset_rx_moderation(&new_channels.params, mode);
|
|
+ }
|
|
+ if (reset_tx) {
|
|
+ u8 mode = MLX5E_GET_PFLAG(&new_channels.params,
|
|
+ MLX5E_PFLAG_TX_CQE_BASED_MODER);
|
|
+
|
|
+ mlx5e_reset_tx_moderation(&new_channels.params, mode);
|
|
+ }
|
|
+
|
|
err = mlx5e_safe_switch_channels(priv, &new_channels, NULL, NULL);
|
|
|
|
out:
|
|
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
|
|
index e0bd700634c8..98f153022f2d 100644
|
|
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
|
|
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
|
|
@@ -4723,7 +4723,7 @@ static u8 mlx5_to_net_dim_cq_period_mode(u8 cq_period_mode)
|
|
DIM_CQ_PERIOD_MODE_START_FROM_EQE;
|
|
}
|
|
|
|
-void mlx5e_set_tx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode)
|
|
+void mlx5e_reset_tx_moderation(struct mlx5e_params *params, u8 cq_period_mode)
|
|
{
|
|
if (params->tx_dim_enabled) {
|
|
u8 dim_period_mode = mlx5_to_net_dim_cq_period_mode(cq_period_mode);
|
|
@@ -4732,13 +4732,9 @@ void mlx5e_set_tx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode)
|
|
} else {
|
|
params->tx_cq_moderation = mlx5e_get_def_tx_moderation(cq_period_mode);
|
|
}
|
|
-
|
|
- MLX5E_SET_PFLAG(params, MLX5E_PFLAG_TX_CQE_BASED_MODER,
|
|
- params->tx_cq_moderation.cq_period_mode ==
|
|
- MLX5_CQ_PERIOD_MODE_START_FROM_CQE);
|
|
}
|
|
|
|
-void mlx5e_set_rx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode)
|
|
+void mlx5e_reset_rx_moderation(struct mlx5e_params *params, u8 cq_period_mode)
|
|
{
|
|
if (params->rx_dim_enabled) {
|
|
u8 dim_period_mode = mlx5_to_net_dim_cq_period_mode(cq_period_mode);
|
|
@@ -4747,7 +4743,19 @@ void mlx5e_set_rx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode)
|
|
} else {
|
|
params->rx_cq_moderation = mlx5e_get_def_rx_moderation(cq_period_mode);
|
|
}
|
|
+}
|
|
+
|
|
+void mlx5e_set_tx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode)
|
|
+{
|
|
+ mlx5e_reset_tx_moderation(params, cq_period_mode);
|
|
+ MLX5E_SET_PFLAG(params, MLX5E_PFLAG_TX_CQE_BASED_MODER,
|
|
+ params->tx_cq_moderation.cq_period_mode ==
|
|
+ MLX5_CQ_PERIOD_MODE_START_FROM_CQE);
|
|
+}
|
|
|
|
+void mlx5e_set_rx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode)
|
|
+{
|
|
+ mlx5e_reset_rx_moderation(params, cq_period_mode);
|
|
MLX5E_SET_PFLAG(params, MLX5E_PFLAG_RX_CQE_BASED_MODER,
|
|
params->rx_cq_moderation.cq_period_mode ==
|
|
MLX5_CQ_PERIOD_MODE_START_FROM_CQE);
|
|
--
|
|
2.13.6
|
|
|