All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>, kuba@kernel.org
Cc: netdev@vger.kernel.org, Maxim Mikityanskiy <maximmi@mellanox.com>,
	Tariq Toukan <tariqt@mellanox.com>,
	Saeed Mahameed <saeedm@mellanox.com>
Subject: [net-next 03/16] net/mlx5e: Encapsulate updating netdev queues into a function
Date: Tue, 25 Feb 2020 17:12:33 -0800	[thread overview]
Message-ID: <20200226011246.70129-4-saeedm@mellanox.com> (raw)
In-Reply-To: <20200226011246.70129-1-saeedm@mellanox.com>

From: Maxim Mikityanskiy <maximmi@mellanox.com>

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>
---
 .../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 a4d3e1b6ab20..85a86ff72aac 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -2869,6 +2869,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;
@@ -2890,13 +2901,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.24.1


  parent reply	other threads:[~2020-02-26  1:13 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-26  1:12 [pull request][net-next 00/16] Mellanox, mlx5 updates 2020-02-25 Saeed Mahameed
2020-02-26  1:12 ` [net-next 01/16] net/mlx5e: Define one flow for TXQ selection when TCs are configured Saeed Mahameed
2020-02-26  1:12 ` [net-next 02/16] net/mlx5e: Add missing LRO cap check Saeed Mahameed
2020-02-26  1:12 ` Saeed Mahameed [this message]
2020-02-26  1:41   ` [net-next 03/16] net/mlx5e: Encapsulate updating netdev queues into a function Jakub Kicinski
2020-02-26  7:38     ` Saeed Mahameed
2020-02-26  1:12 ` [net-next 04/16] net/mlx5e: Rename hw_modify to preactivate Saeed Mahameed
2020-02-26  1:12 ` [net-next 05/16] net/mlx5e: Use preactivate hook to set the indirection table Saeed Mahameed
2020-02-26  1:12 ` [net-next 06/16] net/mlx5e: Fix configuration of XPS cpumasks and netdev queues in corner cases Saeed Mahameed
2020-02-26  1:12 ` [net-next 07/16] net/mlx5e: Remove unneeded netif_set_real_num_tx_queues Saeed Mahameed
2020-02-26  1:12 ` [net-next 08/16] net/mlx5e: Allow mlx5e_switch_priv_channels to fail and recover Saeed Mahameed
2020-02-26  1:12 ` [net-next 09/16] net/mlx5e: Add context to the preactivate hook Saeed Mahameed
2020-02-26  1:12 ` [net-next 10/16] net/mlx5e: Change inline mode correctly when changing trust state Saeed Mahameed
2020-02-26  1:12 ` [net-next 11/16] net/mlx5e: RX, Use indirect calls wrapper for posting descriptors Saeed Mahameed
2020-02-26  1:12 ` [net-next 12/16] net/mlx5e: RX, Use indirect calls wrapper for handling compressed completions Saeed Mahameed
2020-02-26  1:12 ` [net-next 13/16] Documentation: fix vxlan typo in mlx5.rst Saeed Mahameed
2020-02-26  1:12 ` [net-next 14/16] net/mlx5: Fix header guard in rsc_dump.h Saeed Mahameed
2020-02-26  1:12 ` [net-next 15/16] net/mlx5: sparse: warning: incorrect type in assignment Saeed Mahameed
2020-02-26  1:12 ` [net-next 16/16] net/mlx5: sparse: warning: Using plain integer as NULL pointer Saeed Mahameed
2020-02-27  4:31 ` [pull request][net-next 00/16] Mellanox, mlx5 updates 2020-02-25 David Miller

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=20200226011246.70129-4-saeedm@mellanox.com \
    --to=saeedm@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=maximmi@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=tariqt@mellanox.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.