From: Ben Hutchings <ben@decadent.org.uk>
To: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Cc: netdev@vger.kernel.org, Dept-HSGLinuxNICDev@qlogic.com,
gregory.v.rose@intel.com, linux-net-drivers@solarflare.com,
Ariel.Elior@qlogic.com, amirv@mellanox.com, mkubecek@suse.cz
Subject: Re: [RFC v2 1/1] net: Add support to configure SR-IOV VF minimum and maximum Tx rate through ip tool.
Date: Mon, 24 Mar 2014 18:55:00 +0000 [thread overview]
Message-ID: <1395687300.2832.37.camel@deadeye.wl.decadent.org.uk> (raw)
In-Reply-To: <1395637073-29794-2-git-send-email-sucheta.chakraborty@qlogic.com>
[-- Attachment #1: Type: text/plain, Size: 1307 bytes --]
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
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]
next prev parent reply other threads:[~2014-03-24 18:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-24 4:57 [RFC v2 0/1]: Add minimum bandwidth support in IP tool Sucheta Chakraborty
2014-03-24 4:57 ` [RFC v2 1/1] net: Add support to configure SR-IOV VF minimum and maximum Tx rate through ip tool Sucheta Chakraborty
2014-03-24 18:55 ` Ben Hutchings [this message]
2014-03-26 7:25 ` Sucheta Chakraborty
2014-03-26 7:37 ` Michal Kubecek
2014-03-28 0:26 ` Ben Hutchings
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=1395687300.2832.37.camel@deadeye.wl.decadent.org.uk \
--to=ben@decadent.org.uk \
--cc=Ariel.Elior@qlogic.com \
--cc=Dept-HSGLinuxNICDev@qlogic.com \
--cc=amirv@mellanox.com \
--cc=gregory.v.rose@intel.com \
--cc=linux-net-drivers@solarflare.com \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
--cc=sucheta.chakraborty@qlogic.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