All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Saeed Mahameed <saeedm@mellanox.com>
Subject: [net-next 01/14] net/mlx5e: Set SQ max rate on mlx5e_open_txqsq rather on open_channel
Date: Mon, 27 Mar 2017 23:48:57 +0300	[thread overview]
Message-ID: <20170327204910.20287-2-saeedm@mellanox.com> (raw)
In-Reply-To: <20170327204910.20287-1-saeedm@mellanox.com>

Instead of iterating over the channel SQs to set their max rate, do it
on SQ creation per TXQ SQ.

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index e849a0fc2653..469d6c147db7 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -1207,6 +1207,9 @@ static int mlx5e_create_sq_rdy(struct mlx5e_priv *priv,
 	return err;
 }
 
+static int mlx5e_set_sq_maxrate(struct net_device *dev,
+				struct mlx5e_txqsq *sq, u32 rate);
+
 static int mlx5e_open_txqsq(struct mlx5e_channel *c,
 			    int tc,
 			    struct mlx5e_sq_param *param,
@@ -1214,6 +1217,8 @@ static int mlx5e_open_txqsq(struct mlx5e_channel *c,
 {
 	struct mlx5e_create_sq_param csp = {};
 	struct mlx5e_priv *priv = c->priv;
+	u32 tx_rate;
+	int txq_ix;
 	int err;
 
 	err = mlx5e_alloc_txqsq(c, tc, param, sq);
@@ -1230,6 +1235,11 @@ static int mlx5e_open_txqsq(struct mlx5e_channel *c,
 	if (err)
 		goto err_free_txqsq;
 
+	txq_ix = c->ix + tc * priv->params.num_channels;
+	tx_rate = priv->tx_rates[txq_ix];
+	if (tx_rate)
+		mlx5e_set_sq_maxrate(priv->netdev, sq, tx_rate);
+
 	netdev_tx_reset_queue(sq->txq);
 	netif_tx_start_queue(sq->txq);
 	return 0;
@@ -1692,7 +1702,6 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
 	int cpu = mlx5e_get_cpu(priv, ix);
 	struct mlx5e_channel *c;
 	int err;
-	int i;
 
 	c = kzalloc_node(sizeof(*c), GFP_KERNEL, cpu_to_node(cpu));
 	if (!c)
@@ -1745,17 +1754,6 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
 	if (err)
 		goto err_close_icosq;
 
-	for (i = 0; i < priv->params.num_tc; i++) {
-		u32 txq_ix = priv->channeltc_to_txq_map[ix][i];
-
-		if (priv->tx_rates[txq_ix]) {
-			struct mlx5e_txqsq *sq = priv->txq_to_sq_map[txq_ix];
-
-			mlx5e_set_sq_maxrate(priv->netdev, sq,
-					     priv->tx_rates[txq_ix]);
-		}
-	}
-
 	err = c->xdp ? mlx5e_open_xdpsq(c, &cparam->xdp_sq, &c->rq.xdpsq) : 0;
 	if (err)
 		goto err_close_sqs;
-- 
2.11.0

  reply	other threads:[~2017-03-27 20:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-27 20:48 [pull request][net-next 00/14] Mellanox mlx5e Fail-safe config Saeed Mahameed
2017-03-27 20:48 ` Saeed Mahameed [this message]
2017-03-27 20:48 ` [net-next 02/14] net/mlx5e: Set netdev->rx_cpu_rmap on netdev creation Saeed Mahameed
2017-03-27 20:48 ` [net-next 03/14] net/mlx5e: Introduce mlx5e_channels Saeed Mahameed
2017-03-27 20:49 ` [net-next 04/14] net/mlx5e: Redirect RQT refactoring Saeed Mahameed
2017-03-27 20:49 ` [net-next 05/14] net/mlx5e: Refactor refresh TIRs Saeed Mahameed
2017-03-27 20:49 ` [net-next 06/14] net/mlx5e: Split open/close channels to stages Saeed Mahameed
2017-03-27 20:49 ` [net-next 07/14] net/mlx5e: Isolate open_channels from priv->params Saeed Mahameed
2017-03-27 20:49 ` [net-next 08/14] net/mlx5e: CQ and RQ don't need priv pointer Saeed Mahameed
2017-03-27 20:49 ` [net-next 09/14] net/mlx5e: Minimize mlx5e_{open/close}_locked Saeed Mahameed
2017-03-29  4:11   ` Jakub Kicinski
2017-03-27 20:49 ` [net-next 10/14] net/mlx5e: Introduce switch channels Saeed Mahameed
2017-03-27 20:49 ` [net-next 11/14] net/mlx5e: Fail safe ethtool settings Saeed Mahameed
2017-03-27 20:49 ` [net-next 12/14] net/mlx5e: Fail safe cqe compressing/moderation mode setting Saeed Mahameed
2017-03-27 20:49 ` [net-next 13/14] net/mlx5e: Fail safe tc setup Saeed Mahameed
2017-03-27 20:49 ` [net-next 14/14] net/mlx5e: Fail safe mtu and lro setting Saeed Mahameed
2017-03-28  4:22 ` [pull request][net-next 00/14] Mellanox mlx5e Fail-safe config 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=20170327204910.20287-2-saeedm@mellanox.com \
    --to=saeedm@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /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.