]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 5.5
authorSasha Levin <sashal@kernel.org>
Sat, 18 Apr 2020 21:06:04 +0000 (17:06 -0400)
committerSasha Levin <sashal@kernel.org>
Sat, 18 Apr 2020 21:06:04 +0000 (17:06 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-5.5/net-mlx5e-encapsulate-updating-netdev-queues-into-a-.patch [new file with mode: 0644]
queue-5.5/net-mlx5e-rename-hw_modify-to-preactivate.patch [new file with mode: 0644]
queue-5.5/net-mlx5e-use-preactivate-hook-to-set-the-indirectio.patch [new file with mode: 0644]
queue-5.5/series

diff --git a/queue-5.5/net-mlx5e-encapsulate-updating-netdev-queues-into-a-.patch b/queue-5.5/net-mlx5e-encapsulate-updating-netdev-queues-into-a-.patch
new file mode 100644 (file)
index 0000000..8ba8fef
--- /dev/null
@@ -0,0 +1,62 @@
+From 13f6c1b6b878beebbd01e07003da866664d25498 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 3 Sep 2019 17:38:43 +0300
+Subject: net/mlx5e: Encapsulate updating netdev queues into a function
+
+From: Maxim Mikityanskiy <maximmi@mellanox.com>
+
+[ Upstream commit c2c95271f9f39ea9b34db2301b3b6c5105cdb447 ]
+
+As a preparation for one of the following commits, create a function to
+encapsulate the code that notifies the kernel about the new amount of
+RX and TX queues. The code will be called multiple times in the next
+commit.
+
+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: Sasha Levin <sashal@kernel.org>
+---
+ .../net/ethernet/mellanox/mlx5/core/en_main.c | 19 ++++++++++++-------
+ 1 file changed, 12 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+index 67fe002dfade5..35b0acce425f8 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+@@ -2895,6 +2895,17 @@ static void mlx5e_netdev_set_tcs(struct net_device *netdev)
+               netdev_set_tc_queue(netdev, tc, nch, 0);
+ }
++static void mlx5e_update_netdev_queues(struct mlx5e_priv *priv)
++{
++      int num_txqs = priv->channels.num * priv->channels.params.num_tc;
++      int num_rxqs = priv->channels.num * priv->profile->rq_groups;
++      struct net_device *netdev = priv->netdev;
++
++      mlx5e_netdev_set_tcs(netdev);
++      netif_set_real_num_tx_queues(netdev, num_txqs);
++      netif_set_real_num_rx_queues(netdev, num_rxqs);
++}
++
+ static void mlx5e_build_txq_maps(struct mlx5e_priv *priv)
+ {
+       int i, ch;
+@@ -2916,13 +2927,7 @@ static void mlx5e_build_txq_maps(struct mlx5e_priv *priv)
+ void mlx5e_activate_priv_channels(struct mlx5e_priv *priv)
+ {
+-      int num_txqs = priv->channels.num * priv->channels.params.num_tc;
+-      int num_rxqs = priv->channels.num * priv->profile->rq_groups;
+-      struct net_device *netdev = priv->netdev;
+-
+-      mlx5e_netdev_set_tcs(netdev);
+-      netif_set_real_num_tx_queues(netdev, num_txqs);
+-      netif_set_real_num_rx_queues(netdev, num_rxqs);
++      mlx5e_update_netdev_queues(priv);
+       mlx5e_build_txq_maps(priv);
+       mlx5e_activate_channels(&priv->channels);
+-- 
+2.20.1
+
diff --git a/queue-5.5/net-mlx5e-rename-hw_modify-to-preactivate.patch b/queue-5.5/net-mlx5e-rename-hw_modify-to-preactivate.patch
new file mode 100644 (file)
index 0000000..99bd1ba
--- /dev/null
@@ -0,0 +1,100 @@
+From 8786568f3fa2ff9664308787c62c11e1cebdf6e8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 31 Oct 2019 09:39:34 +0200
+Subject: net/mlx5e: Rename hw_modify to preactivate
+
+From: Maxim Mikityanskiy <maximmi@mellanox.com>
+
+[ Upstream commit dca147b3dce5abb5284ff747211960fd2db5ec2e ]
+
+mlx5e_safe_switch_channels accepts a callback to be called before
+activating new channels. It is intended to configure some hardware
+parameters in cases where channels are recreated because some
+configuration has changed.
+
+Recently, this callback has started being used to update the driver's
+internal MLX5E_STATE_XDP_OPEN flag, and the following patches also
+intend to use this callback for software preparations. This patch
+renames the hw_modify callback to preactivate, so that the name fits
+better.
+
+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: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/mellanox/mlx5/core/en.h      |  6 +++---
+ drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 14 ++++++++------
+ 2 files changed, 11 insertions(+), 9 deletions(-)
+
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
+index 55ceabf077b29..3cb5b4321bf93 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
+@@ -1035,14 +1035,14 @@ int mlx5e_open_channels(struct mlx5e_priv *priv,
+                       struct mlx5e_channels *chs);
+ void mlx5e_close_channels(struct mlx5e_channels *chs);
+-/* Function pointer to be used to modify WH settings while
++/* Function pointer to be used to modify HW or kernel settings while
+  * switching channels
+  */
+-typedef int (*mlx5e_fp_hw_modify)(struct mlx5e_priv *priv);
++typedef int (*mlx5e_fp_preactivate)(struct mlx5e_priv *priv);
+ 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_hw_modify hw_modify);
++                             mlx5e_fp_preactivate preactivate);
+ 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_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+index 35b0acce425f8..25690d52d48ed 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+@@ -2963,7 +2963,7 @@ void mlx5e_deactivate_priv_channels(struct mlx5e_priv *priv)
+ static void mlx5e_switch_priv_channels(struct mlx5e_priv *priv,
+                                      struct mlx5e_channels *new_chs,
+-                                     mlx5e_fp_hw_modify hw_modify)
++                                     mlx5e_fp_preactivate preactivate)
+ {
+       struct net_device *netdev = priv->netdev;
+       int new_num_txqs;
+@@ -2982,9 +2982,11 @@ static void mlx5e_switch_priv_channels(struct mlx5e_priv *priv,
+       priv->channels = *new_chs;
+-      /* New channels are ready to roll, modify HW settings if needed */
+-      if (hw_modify)
+-              hw_modify(priv);
++      /* New channels are ready to roll, call the preactivate hook if needed
++       * to modify HW settings or update kernel parameters.
++       */
++      if (preactivate)
++              preactivate(priv);
+       priv->profile->update_rx(priv);
+       mlx5e_activate_priv_channels(priv);
+@@ -2996,7 +2998,7 @@ static void mlx5e_switch_priv_channels(struct mlx5e_priv *priv,
+ int mlx5e_safe_switch_channels(struct mlx5e_priv *priv,
+                              struct mlx5e_channels *new_chs,
+-                             mlx5e_fp_hw_modify hw_modify)
++                             mlx5e_fp_preactivate preactivate)
+ {
+       int err;
+@@ -3004,7 +3006,7 @@ int mlx5e_safe_switch_channels(struct mlx5e_priv *priv,
+       if (err)
+               return err;
+-      mlx5e_switch_priv_channels(priv, new_chs, hw_modify);
++      mlx5e_switch_priv_channels(priv, new_chs, preactivate);
+       return 0;
+ }
+-- 
+2.20.1
+
diff --git a/queue-5.5/net-mlx5e-use-preactivate-hook-to-set-the-indirectio.patch b/queue-5.5/net-mlx5e-use-preactivate-hook-to-set-the-indirectio.patch
new file mode 100644 (file)
index 0000000..0b84650
--- /dev/null
@@ -0,0 +1,110 @@
+From b2b205e7f8c5f612f028ca27db8d1d0df3599839 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 4 Nov 2019 12:02:14 +0200
+Subject: net/mlx5e: Use preactivate hook to set the indirection table
+
+From: Maxim Mikityanskiy <maximmi@mellanox.com>
+
+[ Upstream commit fe867cac9e1967c553e4ac2aece5fc8675258010 ]
+
+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: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/mellanox/mlx5/core/en.h     |  1 +
+ .../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 10 ++--------
+ .../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 3cb5b4321bf93..11426f94c90c6 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
+@@ -1043,6 +1043,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 c6776f308d5e6..304ddce6b0872 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+@@ -445,9 +445,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;
+       }
+@@ -455,12 +453,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 25690d52d48ed..e56088db30dfb 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+@@ -2906,6 +2906,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;
+@@ -5308,9 +5319,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.20.1
+
index 4bd60011ee724d6083236a6c46d27d641269f284..e9c600b662dec6796debca5ec4fb13f46fb09009 100644 (file)
@@ -49,3 +49,6 @@ btrfs-check-commit-root-generation-in-should_ignore_root.patch
 nl80211-fix-nl80211_attr_ftm_responder-policy.patch
 mac80211-fix-race-in-ieee80211_register_hw.patch
 mac80211_hwsim-use-kstrndup-in-place-of-kasprintf.patch
+net-mlx5e-encapsulate-updating-netdev-queues-into-a-.patch
+net-mlx5e-rename-hw_modify-to-preactivate.patch
+net-mlx5e-use-preactivate-hook-to-set-the-indirectio.patch