[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1395687300.2832.37.camel@deadeye.wl.decadent.org.uk>
Date: Mon, 24 Mar 2014 18:55:00 +0000
From: Ben Hutchings <ben@...adent.org.uk>
To: Sucheta Chakraborty <sucheta.chakraborty@...gic.com>
Cc: netdev@...r.kernel.org, Dept-HSGLinuxNICDev@...gic.com,
gregory.v.rose@...el.com, linux-net-drivers@...arflare.com,
Ariel.Elior@...gic.com, amirv@...lanox.com, mkubecek@...e.cz
Subject: Re: [RFC v2 1/1] net: Add support to configure SR-IOV VF minimum
and maximum Tx rate through ip tool.
On Mon, 2014-03-24 at 00:57 -0400, Sucheta Chakraborty wrote:
[...]
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
[...]
> + case IFLA_VF_RATE: {
> + struct ifla_vf_rate *ivt;
> + struct ifla_vf_info ivf;
> ivt = nla_data(vf);
> err = -EOPNOTSUPP;
> - if (ops->ndo_set_vf_tx_rate)
> - err = ops->ndo_set_vf_tx_rate(dev, ivt->vf,
> - ivt->rate);
> + if ((ivt->min_tx_rate == -1 ||
> + ivt->max_tx_rate == -1) &&
> + ops->ndo_get_vf_config)
> + err = ops->ndo_get_vf_config(dev, ivt->vf,
> + &ivf);
> + else
> + err = 0;
> + if (err)
> + break;
> + if (ivt->min_tx_rate == -1)
> + ivt->min_tx_rate = ivf.min_tx_rate;
> + if (ivt->max_tx_rate == -1)
> + ivt->max_tx_rate = ivf.max_tx_rate;
[...]
This is modifying the the content of the netlink skb, which I think is
not allowed. I think you need to use local variables for this instead.
Also, this special-casing of -1 isn't documented anywhere. Is it even
necessary? If userland needs to set just one limit, it can read the
existing limits and set both.
Ben.
--
Ben Hutchings
Everything should be made as simple as possible, but not simpler.
- Albert Einstein
Download attachment "signature.asc" of type "application/pgp-signature" (812 bytes)
Powered by blists - more mailing lists