netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Or Gerlitz <ogerlitz@mellanox.com>,
	"David S. Miller" <davem@davemloft.net>,
	John Fastabend <john.r.fastabend@intel.com>
Cc: netdev@vger.kernel.org, Amir Vadai <amirv@mellanox.com>,
	Ido Shamay <idos@mellanox.com>, Matan Barak <matanb@mellanox.com>
Subject: Re: [PATCH net-next 3/3] net/mlx4_en: Add tx queue maxrate support
Date: Wed, 11 Mar 2015 18:44:21 +0300	[thread overview]
Message-ID: <550062D5.8030407@cogentembedded.com> (raw)
In-Reply-To: <1426079690-28271-4-git-send-email-ogerlitz@mellanox.com>

Hello.

On 3/11/2015 4:14 PM, Or Gerlitz wrote:

> Add ndo_set_tx_maxrate support.

> To support per tx queue maxrate limit, we use the update-qp firmware
> command to do run-time rate setting for the qp that serves this tx ring.
>
> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
> Signed-off-by: Ido Shamay <idos@mellanox.com>
> ---
>   drivers/net/ethernet/mellanox/mlx4/en_netdev.c |   33 ++++++++++++++++++++++++
>   1 files changed, 33 insertions(+), 0 deletions(-)

> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> index c59ed92..2a58d2a 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> @@ -2379,6 +2379,37 @@ static netdev_features_t mlx4_en_features_check(struct sk_buff *skb,
>   }
>   #endif
>
> +int mlx4_en_set_tx_maxrate(struct net_device *dev, int queue_index, u32 maxrate)
> +{
> +	struct mlx4_en_priv *priv = netdev_priv(dev);
> +	struct mlx4_en_tx_ring *tx_ring = priv->tx_ring[queue_index];
> +	struct mlx4_update_qp_params params;
> +	int err;
> +
> +	if (!(priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_QP_RATE_LIMIT)) {
> +		err = -EOPNOTSUPP;
> +		goto out;

    I would have just used *return*...

> +	}
> +
> +	/* rate provided to us in Mbs, check if it fits into 12 bits, if not use Gbs */
> +	if ((maxrate >> 12)) {

    Double parens make not sense.

[...]
> +	err = mlx4_update_qp(priv->mdev->dev, tx_ring->qpn, MLX4_UPDATE_QP_RATE_LIMIT,
> +			     &params);
> +
> +out:
> +	return err;
> +}
> +
>   static const struct net_device_ops mlx4_netdev_ops = {
>   	.ndo_open		= mlx4_en_open,
>   	.ndo_stop		= mlx4_en_close,
[...]

WBR, Sergei

  reply	other threads:[~2015-03-11 15:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-11 13:14 [PATCH net-next 0/3] Add max rate TXQ attribute Or Gerlitz
2015-03-11 13:14 ` [PATCH net-next 1/3] net: Add max rate tx queue attribute Or Gerlitz
2015-03-11 18:50   ` John Fastabend
2015-03-11 20:11     ` Or Gerlitz
2015-03-11 13:14 ` [PATCH net-next 2/3] net/mlx4_core: Add basic support for QP max-rate limiting Or Gerlitz
2015-03-11 13:14 ` [PATCH net-next 3/3] net/mlx4_en: Add tx queue maxrate support Or Gerlitz
2015-03-11 15:44   ` Sergei Shtylyov [this message]
2015-03-12  8:25     ` Or Gerlitz
2015-03-11 15:47   ` Sergei Shtylyov

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=550062D5.8030407@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=amirv@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=idos@mellanox.com \
    --cc=john.r.fastabend@intel.com \
    --cc=matanb@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@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 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).