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

diff --git a/queue-5.6/net-mlx5e-encapsulate-updating-netdev-queues-into-a-.patch b/queue-5.6/net-mlx5e-encapsulate-updating-netdev-queues-into-a-.patch
new file mode 100644 (file)
index 0000000..099399e
--- /dev/null
@@ -0,0 +1,62 @@
+From 4ede7100bfef4baff3500d6b1cf44fc1b897739c 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 4ef3dc79f73c7..8125c605780be 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+@@ -2886,6 +2886,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;
+@@ -2907,13 +2918,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.6/net-mlx5e-rename-hw_modify-to-preactivate.patch b/queue-5.6/net-mlx5e-rename-hw_modify-to-preactivate.patch
new file mode 100644 (file)
index 0000000..4ff25ed
--- /dev/null
@@ -0,0 +1,100 @@
+From c7c1a09f02b20ae1b6c48e37a7dda2e0cd08e244 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 c9606b8ab6efd..704bd6d5277d2 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
+@@ -1036,14 +1036,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 8125c605780be..1c8a4235a48c5 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+@@ -2954,7 +2954,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;
+@@ -2973,9 +2973,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);
+@@ -2987,7 +2989,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;
+@@ -2995,7 +2997,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.6/net-mlx5e-use-preactivate-hook-to-set-the-indirectio.patch b/queue-5.6/net-mlx5e-use-preactivate-hook-to-set-the-indirectio.patch
new file mode 100644 (file)
index 0000000..4c9eee9
--- /dev/null
@@ -0,0 +1,110 @@
+From 058877f88539d0523f25d646134a5ad82762ae95 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 704bd6d5277d2..ddd2409fc8bef 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
+@@ -1044,6 +1044,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 d674cb6798950..d2cfa247abc86 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 1c8a4235a48c5..2650739964326 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+@@ -2897,6 +2897,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;
+@@ -5305,9 +5316,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 08fb0c4bbb0e248927264a316b68268b666cd9a0..a44327836b5a5c472c460965c64899b514f02028 100644 (file)
@@ -52,3 +52,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