netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@nvidia.com>
To: Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>,
	Maxim Mikityanskiy <maximmi@mellanox.com>,
	"Tariq Toukan" <tariqt@nvidia.com>,
	Saeed Mahameed <saeedm@nvidia.com>
Subject: [net 09/12] net/mlx5e: Correctly handle changing the number of queues when the interface is down
Date: Tue, 26 Jan 2021 15:43:42 -0800	[thread overview]
Message-ID: <20210126234345.202096-10-saeedm@nvidia.com> (raw)
In-Reply-To: <20210126234345.202096-1-saeedm@nvidia.com>

From: Maxim Mikityanskiy <maximmi@mellanox.com>

This commit addresses two issues related to changing the number of
queues when the channels are closed:

1. Missing call to mlx5e_num_channels_changed to update
real_num_tx_queues when the number of TCs is changed.

2. When mlx5e_num_channels_changed returns an error, the channel
parameters must be reverted.

Two Fixes: tags correspond to the first commits where these two issues
were introduced.

Fixes: 3909a12e7913 ("net/mlx5e: Fix configuration of XPS cpumasks and netdev queues in corner cases")
Fixes: fa3748775b92 ("net/mlx5e: Handle errors from netif_set_real_num_{tx,rx}_queues")
Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 8 +++++++-
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c    | 7 +++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index 2d37742a888c..302001d6661e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -447,12 +447,18 @@ int mlx5e_ethtool_set_channels(struct mlx5e_priv *priv,
 		goto out;
 	}
 
-	new_channels.params = priv->channels.params;
+	new_channels.params = *cur_params;
 	new_channels.params.num_channels = count;
 
 	if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) {
+		struct mlx5e_params old_params;
+
+		old_params = *cur_params;
 		*cur_params = new_channels.params;
 		err = mlx5e_num_channels_changed(priv);
+		if (err)
+			*cur_params = old_params;
+
 		goto out;
 	}
 
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 300e0e9f96b6..ac76d32bad7d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -3614,7 +3614,14 @@ static int mlx5e_setup_tc_mqprio(struct mlx5e_priv *priv,
 	new_channels.params.num_tc = tc ? tc : 1;
 
 	if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) {
+		struct mlx5e_params old_params;
+
+		old_params = priv->channels.params;
 		priv->channels.params = new_channels.params;
+		err = mlx5e_num_channels_changed(priv);
+		if (err)
+			priv->channels.params = old_params;
+
 		goto out;
 	}
 
-- 
2.29.2


  parent reply	other threads:[~2021-01-27  7:37 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-26 23:43 [pull request][net 00/12] mlx5 fixes 2021-01-26 Saeed Mahameed
2021-01-26 23:43 ` [net 01/12] net/mlx5: Fix memory leak on flow table creation error flow Saeed Mahameed
2021-01-28  3:30   ` patchwork-bot+netdevbpf
2021-01-28  8:33     ` Saeed Mahameed
2021-01-29  1:37       ` Jakub Kicinski
2021-01-26 23:43 ` [net 02/12] net/mlx5e: E-switch, Fix rate calculation for overflow Saeed Mahameed
2021-01-26 23:43 ` [net 03/12] net/mlx5e: free page before return Saeed Mahameed
2021-01-26 23:43 ` [net 04/12] net/mlx5e: Reduce tc unsupported key print level Saeed Mahameed
2021-01-26 23:43 ` [net 05/12] net/mlx5e: Fix IPSEC stats Saeed Mahameed
2021-01-26 23:43 ` [net 06/12] net/mlx5: Maintain separate page trees for ECPF and PF functions Saeed Mahameed
2021-01-26 23:43 ` [net 07/12] net/mlx5e: Disable hw-tc-offload when MLX5_CLS_ACT config is disabled Saeed Mahameed
2021-01-26 23:43 ` [net 08/12] net/mlx5e: Fix CT rule + encap slow path offload and deletion Saeed Mahameed
2021-01-26 23:43 ` Saeed Mahameed [this message]
2021-01-26 23:43 ` [net 10/12] net/mlx5e: Revert parameters on errors when changing trust state without reset Saeed Mahameed
2021-01-26 23:43 ` [net 11/12] net/mlx5e: Revert parameters on errors when changing MTU and LRO " Saeed Mahameed
2021-01-27 20:00   ` Willem de Bruijn
2021-01-27 23:06     ` Saeed Mahameed
2021-01-26 23:43 ` [net 12/12] net/mlx5: CT: Fix incorrect removal of tuple_nat_node from nat rhashtable Saeed Mahameed
2021-01-27 20:03 ` [pull request][net 00/12] mlx5 fixes 2021-01-26 Willem de Bruijn
2021-01-27 23:08   ` Saeed Mahameed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210126234345.202096-10-saeedm@nvidia.com \
    --to=saeedm@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=maximmi@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=tariqt@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).