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.
128 lines
5.3 KiB
128 lines
5.3 KiB
4 years ago
|
From c7e15c25bf93c8163905184c17829ac840677ab6 Mon Sep 17 00:00:00 2001
|
||
|
From: Alaa Hleihel <ahleihel@redhat.com>
|
||
|
Date: Tue, 12 May 2020 10:54:43 -0400
|
||
|
Subject: [PATCH 171/312] [netdrv] net/mlx5e: Use preactivate hook to set the
|
||
|
indirection table
|
||
|
|
||
|
Message-id: <20200512105530.4207-78-ahleihel@redhat.com>
|
||
|
Patchwork-id: 306949
|
||
|
Patchwork-instance: patchwork
|
||
|
O-Subject: [RHEL8.3 BZ 1789382 077/124] net/mlx5e: Use preactivate hook to set the indirection table
|
||
|
Bugzilla: 1789382
|
||
|
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
|
||
|
RH-Acked-by: Kamal Heib <kheib@redhat.com>
|
||
|
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
|
||
|
|
||
|
Bugzilla: http://bugzilla.redhat.com/1789382
|
||
|
Upstream: v5.7-rc1
|
||
|
|
||
|
commit fe867cac9e1967c553e4ac2aece5fc8675258010
|
||
|
Author: Maxim Mikityanskiy <maximmi@mellanox.com>
|
||
|
Date: Mon Nov 4 12:02:14 2019 +0200
|
||
|
|
||
|
net/mlx5e: Use preactivate hook to set the indirection table
|
||
|
|
||
|
mlx5e_ethtool_set_channels updates the indirection table before
|
||
|
switching to the new channels. If the switch fails, the indirection
|
||
|
table is new, but the channels are old, which is wrong. Fix it by using
|
||
|
the preactivate hook of mlx5e_safe_switch_channels to update the
|
||
|
indirection table at the stage when nothing can fail anymore.
|
||
|
|
||
|
As the code that updates the indirection table is now encapsulated into
|
||
|
a new function, use that function in the attach flow when the driver has
|
||
|
to reduce the number of channels, and prepare the code for the next
|
||
|
commit.
|
||
|
|
||
|
Fixes: 85082dba0a ("net/mlx5e: Correctly handle RSS indirection table when changing number of channels")
|
||
|
Signed-off-by: Maxim Mikityanskiy <maximmi@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 | 1 +
|
||
|
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 10 ++--------
|
||
|
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 16 ++++++++++++++--
|
||
|
3 files changed, 17 insertions(+), 10 deletions(-)
|
||
|
|
||
|
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
|
||
|
index 99c7a8047b26..cef4c1cba2b8 100644
|
||
|
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
|
||
|
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
|
||
|
@@ -1032,6 +1032,7 @@ int mlx5e_safe_reopen_channels(struct mlx5e_priv *priv);
|
||
|
int mlx5e_safe_switch_channels(struct mlx5e_priv *priv,
|
||
|
struct mlx5e_channels *new_chs,
|
||
|
mlx5e_fp_preactivate preactivate);
|
||
|
+int mlx5e_num_channels_changed(struct mlx5e_priv *priv);
|
||
|
void mlx5e_activate_priv_channels(struct mlx5e_priv *priv);
|
||
|
void mlx5e_deactivate_priv_channels(struct mlx5e_priv *priv);
|
||
|
|
||
|
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
|
||
|
index 70ca9bf51cdd..e7043f68a38f 100644
|
||
|
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
|
||
|
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
|
||
|
@@ -432,9 +432,7 @@ int mlx5e_ethtool_set_channels(struct mlx5e_priv *priv,
|
||
|
|
||
|
if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) {
|
||
|
*cur_params = new_channels.params;
|
||
|
- if (!netif_is_rxfh_configured(priv->netdev))
|
||
|
- mlx5e_build_default_indir_rqt(priv->rss_params.indirection_rqt,
|
||
|
- MLX5E_INDIR_RQT_SIZE, count);
|
||
|
+ mlx5e_num_channels_changed(priv);
|
||
|
goto out;
|
||
|
}
|
||
|
|
||
|
@@ -442,12 +440,8 @@ int mlx5e_ethtool_set_channels(struct mlx5e_priv *priv,
|
||
|
if (arfs_enabled)
|
||
|
mlx5e_arfs_disable(priv);
|
||
|
|
||
|
- if (!netif_is_rxfh_configured(priv->netdev))
|
||
|
- mlx5e_build_default_indir_rqt(priv->rss_params.indirection_rqt,
|
||
|
- MLX5E_INDIR_RQT_SIZE, count);
|
||
|
-
|
||
|
/* Switch to new channels, set new parameters and close old ones */
|
||
|
- err = mlx5e_safe_switch_channels(priv, &new_channels, NULL);
|
||
|
+ err = mlx5e_safe_switch_channels(priv, &new_channels, mlx5e_num_channels_changed);
|
||
|
|
||
|
if (arfs_enabled) {
|
||
|
int err2 = mlx5e_arfs_enable(priv);
|
||
|
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
|
||
|
index 70bcd75e241e..1d72ee543447 100644
|
||
|
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
|
||
|
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
|
||
|
@@ -2898,6 +2898,17 @@ static void mlx5e_update_netdev_queues(struct mlx5e_priv *priv)
|
||
|
netif_set_real_num_rx_queues(netdev, num_rxqs);
|
||
|
}
|
||
|
|
||
|
+int mlx5e_num_channels_changed(struct mlx5e_priv *priv)
|
||
|
+{
|
||
|
+ u16 count = priv->channels.params.num_channels;
|
||
|
+
|
||
|
+ if (!netif_is_rxfh_configured(priv->netdev))
|
||
|
+ mlx5e_build_default_indir_rqt(priv->rss_params.indirection_rqt,
|
||
|
+ MLX5E_INDIR_RQT_SIZE, count);
|
||
|
+
|
||
|
+ return 0;
|
||
|
+}
|
||
|
+
|
||
|
static void mlx5e_build_txq_maps(struct mlx5e_priv *priv)
|
||
|
{
|
||
|
int i, ch;
|
||
|
@@ -5309,9 +5320,10 @@ int mlx5e_attach_netdev(struct mlx5e_priv *priv)
|
||
|
max_nch = mlx5e_get_max_num_channels(priv->mdev);
|
||
|
if (priv->channels.params.num_channels > max_nch) {
|
||
|
mlx5_core_warn(priv->mdev, "MLX5E: Reducing number of channels to %d\n", max_nch);
|
||
|
+ /* Reducing the number of channels - RXFH has to be reset. */
|
||
|
+ priv->netdev->priv_flags &= ~IFF_RXFH_CONFIGURED;
|
||
|
priv->channels.params.num_channels = max_nch;
|
||
|
- mlx5e_build_default_indir_rqt(priv->rss_params.indirection_rqt,
|
||
|
- MLX5E_INDIR_RQT_SIZE, max_nch);
|
||
|
+ mlx5e_num_channels_changed(priv);
|
||
|
}
|
||
|
|
||
|
err = profile->init_tx(priv);
|
||
|
--
|
||
|
2.13.6
|
||
|
|