lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 12 Mar 2015 10:25:32 +0200
From:	Or Gerlitz <gerlitz.or@...il.com>
To:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
Cc:	Or Gerlitz <ogerlitz@...lanox.com>,
	"David S. Miller" <davem@...emloft.net>,
	John Fastabend <john.r.fastabend@...el.com>,
	Linux Netdev List <netdev@...r.kernel.org>,
	Amir Vadai <amirv@...lanox.com>,
	Ido Shamay <idos@...lanox.com>,
	Matan Barak <matanb@...lanox.com>
Subject: Re: [PATCH net-next 3/3] net/mlx4_en: Add tx queue maxrate support

On Wed, Mar 11, 2015 at 5:44 PM, Sergei Shtylyov
<sergei.shtylyov@...entembedded.com> wrote:
> 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@...lanox.com>
>> Signed-off-by: Ido Shamay <idos@...lanox.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,
>
> [...]

Sure, will fix your two comments from this reply and also the one
related to Mbps in your other post

Or.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ