[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZOPZK98UOsK2HFSC3V6fdzvJfWVKg6pZzxptE97MTgOAk7-w@mail.gmail.com>
Date: Sat, 1 Dec 2012 17:50:09 +0200
From: Or Gerlitz <or.gerlitz@...il.com>
To: Ben Hutchings <bhutchings@...arflare.com>
Cc: Amir Vadai <amirv@...lanox.com>,
"David S. Miller" <davem@...emloft.net>,
Or Gerlitz <ogerlitz@...lanox.com>,
Oren Duer <oren@...lanox.com>, netdev@...r.kernel.org
Subject: Re: [PATCH net-next v1 3/3] net/mlx4_en: Set number of rx/tx channels
using ethtool
On Sat, Dec 1, 2012 at 1:58 AM, Ben Hutchings <bhutchings@...arflare.com> wrote:
>
> On Thu, 2012-11-29 at 21:21 +0200, Amir Vadai wrote:
> > Add support to changing number of rx/tx channels using
> > ethtool ('ethtool -[lL]'). Where the number of tx channels specified in
> > ethtool
> > is the number of rings per user priority - not total number of tx rings.
> >
> > Signed-off-by: Amir Vadai <amirv@...lanox.com>
> > ---
> > drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 69
> > +++++++++++++++++++++++
> > drivers/net/ethernet/mellanox/mlx4/en_main.c | 2 +-
> > drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 26 +++++----
> > drivers/net/ethernet/mellanox/mlx4/en_tx.c | 2 +-
> > drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 8 ++-
> > 5 files changed, 93 insertions(+), 14 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
> > b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
> > index dc8ccb4..681bc1b 100644
> > --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
> > +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
> > @@ -999,6 +999,73 @@ static int mlx4_en_set_rxnfc(struct net_device
> > *dev, struct ethtool_rxnfc *cmd)
> [...]
> > +static int mlx4_en_set_channels(struct net_device *dev,
> > + struct ethtool_channels *channel)
> > +{
> > + struct mlx4_en_priv *priv = netdev_priv(dev);
> > + struct mlx4_en_dev *mdev = priv->mdev;
> > + int port_up;
> > + int err = 0;
> > +
> > + if (channel->other_count || channel->combined_count ||
> > + channel->tx_count > channel->max_tx ||
> > + channel->rx_count > channel->max_rx ||
>
> The values of max_tx and max_rx are passed in from userland, so you
> can't trust them.
Is this a general statement re ethtool values passed from user space
or something specific here? can't one assume that the ethtool process
runs under the appropriate admin permission?
>> + !channel->tx_count || !channel->rx_count)
>> + return -EINVAL;
> [...]
--
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