From: Ben Hutchings <bhutchings@solarflare.com>
To: Greg Rose <gregory.v.rose@intel.com>
Cc: netdev@vger.kernel.org
Subject: Re: [RFC PATCH V2] ethtool: Add command to configure IOV features
Date: Sat, 08 Oct 2011 01:41:25 +0100 [thread overview]
Message-ID: <1318034485.2771.162.camel@bwh-desktop> (raw)
In-Reply-To: <20110922213543.26713.23525.stgit@gitlad.jf.intel.com>
On Thu, 2011-09-22 at 14:35 -0700, Greg Rose wrote:
> New command to allow configuration of IOV features such as the number of
> Virtual Functions to allocate for a given Physical Function interface,
> the number of semi-independent net devices to allocate from partitioned
> I/O resources in the PF and to set the number of queues per VF.
[...]
> @@ -266,6 +270,8 @@ static struct option {
> { "-W", "--set-dump", MODE_SET_DUMP,
> "Set dump flag of the device",
> " N\n"},
> + { "-v", "--get-iov", MODE_GET_IOV, "Get IOV parameters", "\n" },
> + { "-V", "--set_iov", MODE_SET_IOV, "Set IOV parameters", "[ N ]\n" },
Doesn't match the implementation.
[...]
> +static int do_get_iov(int fd, struct ifreq *ifr)
> +{
> + int err;
> + struct ethtool_iov_get_cmd iov_cmd;
> +
> + iov_cmd.cmd = ETHTOOL_IOV_GET_CMD;
> + ifr->ifr_data = (caddr_t)&iov_cmd;
> + err = send_ioctl(fd, ifr);
> + if (err < 0) {
> + perror("Can not get current IOV mode\n");
> + return 1;
> + }
> +
> + memcpy(&iov_cmd, ifr->ifr_data, sizeof(iov_cmd));
But ifr->ifr_data == &iov_cmd. So this is both pointless and dangerous
(as memcpy() doesn't handle overlapping source and destination).
[...]
> +static int do_set_iov(int fd, struct ifreq *ifr)
> +{
> + int err;
> + struct ethtool_iov_set_cmd iov_cmd;
> +
> + if (iov_changed) {
> + iov_cmd.cmd = ETHTOOL_IOV_SET_CMD;
> + if (iov_numvfs_wanted >= 0) {
> + iov_cmd.set_cmd = ETHTOOL_IOV_CMD_CONFIGURE_SRIOV;
> + iov_cmd.cmd_param = iov_numvfs_wanted;
> + } else if (iov_numnetdevs_wanted >= 0) {
> + iov_cmd.set_cmd = ETHTOOL_IOV_CMD_CONFIGURE_NETDEVS;
> + iov_cmd.cmd_param = iov_numnetdevs_wanted;
> + } else if (iov_numvqueues_wanted >= 0) {
> + iov_cmd.set_cmd = ETHTOOL_IOV_CMD_CONFIGURE_VF_QUEUES;
> + iov_cmd.cmd_param = iov_numvqueues_wanted;
> + } else {
> + return -EINVAL;
> + }
[...]
So what if the user specifies multiple keywords?
Also missing an update to the manual page.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
next prev parent reply other threads:[~2011-10-08 0:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-22 21:35 [RFC PATCH V2] ethtool: Add command to configure IOV features Greg Rose
2011-10-08 0:41 ` Ben Hutchings [this message]
2011-10-13 17:07 ` Rose, Gregory V
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=1318034485.2771.162.camel@bwh-desktop \
--to=bhutchings@solarflare.com \
--cc=gregory.v.rose@intel.com \
--cc=netdev@vger.kernel.org \
/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