From: Dan Carpenter <dan.carpenter@oracle.com>
To: Yinghai Lu <yinghai@kernel.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
Don Dutile <ddutile@redhat.com>,
yuvalmin@broadcom.com, bhutchings@solarflare.com,
gregory.v.rose@intel.com, davem@davemloft.net--no-chain-reply-to,
Jeff Kirsher <jeffrey.t.kirsher@intel.com>,
Jesse Brandeburg <jesse.brandeburg@intel.com>,
"David S. Miller" <davem@davemloft.net>,
John Fastabend <john.r.fastabend@intel.com>,
e1000-devel@lists.sourceforge.net, netdev@vger.kernel.org
Subject: Re: [PATCH 5/5] ixgbe: add driver set_max_vfs support
Date: Wed, 3 Oct 2012 21:45:02 +0300 [thread overview]
Message-ID: <20121003184502.GM13767@mwanda> (raw)
In-Reply-To: <1349286695-26713-6-git-send-email-yinghai@kernel.org>
On Wed, Oct 03, 2012 at 10:51:35AM -0700, Yinghai Lu wrote:
> Need ixgbe guys to close the loop to use set_max_vfs instead
> kernel parameters.
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
> Cc: Greg Rose <gregory.v.rose@intel.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: John Fastabend <john.r.fastabend@intel.com>
> Cc: e1000-devel@lists.sourceforge.net
> Cc: netdev@vger.kernel.org
> ---
> drivers/net/ethernet/intel/ixgbe/ixgbe.h | 2 +
> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 44 +++++++++++++++++++-----
> 2 files changed, 37 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
> index b9623e9..d39d975 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
> @@ -558,6 +558,8 @@ struct ixgbe_adapter {
> u32 interrupt_event;
> u32 led_reg;
>
> + struct ixgbe_info *ixgbe_info;
> +
> #ifdef CONFIG_IXGBE_PTP
> struct ptp_clock *ptp_clock;
> struct ptp_clock_info ptp_caps;
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> index ee61819..1c097c7 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> @@ -129,13 +129,6 @@ static struct notifier_block dca_notifier = {
> };
> #endif
>
> -#ifdef CONFIG_PCI_IOV
> -static unsigned int max_vfs;
> -module_param(max_vfs, uint, 0);
> -MODULE_PARM_DESC(max_vfs,
> - "Maximum number of virtual functions to allocate per physical function - default is zero and maximum value is 63");
> -#endif /* CONFIG_PCI_IOV */
> -
> static unsigned int allow_unsupported_sfp;
> module_param(allow_unsupported_sfp, uint, 0);
> MODULE_PARM_DESC(allow_unsupported_sfp,
> @@ -4496,7 +4489,7 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter)
> #ifdef CONFIG_PCI_IOV
> /* assign number of SR-IOV VFs */
> if (hw->mac.type != ixgbe_mac_82598EB)
> - adapter->num_vfs = (max_vfs > 63) ? 0 : max_vfs;
> + adapter->num_vfs = min_t(int, pdev->max_vfs, 63);
Could we make this min_t(uint, ...);
->max_vfs is type unsigned int. We take an unsigned long from sysfs.
We silently truncate it to an unsigned int. Then we cast it to a
negative number and compare against 63 and take the minimum...
It's root only so it's not a problem but it's a hassle to audit.
regards,
dan carpenter
next prev parent reply other threads:[~2012-10-03 18:45 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-01 23:27 [RFC] PCI: enable and disable sriov support via sysfs at per device level Donald Dutile
2012-10-02 7:32 ` Yuval Mintz
2012-10-02 17:38 ` Don Dutile
2012-10-02 20:01 ` Yinghai Lu
2012-10-02 20:23 ` Don Dutile
2012-10-02 20:33 ` Yinghai Lu
2012-10-02 20:39 ` Greg Kroah-Hartman
2012-10-02 21:06 ` Don Dutile
2012-10-03 3:10 ` Greg Kroah-Hartman
2012-10-03 4:58 ` Yinghai Lu
2012-10-03 5:07 ` [PATCH 1/2] PCI: Add pci_dev_type Yinghai Lu
2012-10-03 5:07 ` [PATCH 2/2] PCI, sys: Use is_visable() with boot_vga attribute for pci_dev Yinghai Lu
2012-10-03 13:18 ` [RFC] PCI: enable and disable sriov support via sysfs at per device level Don Dutile
2012-10-03 17:51 ` [PATCH 0/5] PCI: per pci device sysfs set_max_vfs support Yinghai Lu
2012-10-03 17:51 ` [PATCH 1/5] PCI: Add pci_dev_type Yinghai Lu
2012-10-04 14:10 ` Konrad Rzeszutek Wilk
2012-10-03 17:51 ` [PATCH 2/5] PCI, sys: Use is_visable() with boot_vga attribute for pci_dev Yinghai Lu
2012-10-03 19:28 ` Greg Kroah-Hartman
2012-10-03 17:51 ` [PATCH 3/5] PCI: add set_max_vfs in pci_driver ops Yinghai Lu
2012-10-03 18:55 ` Don Dutile
2012-10-03 20:41 ` Yinghai Lu
2012-10-03 21:02 ` Don Dutile
2012-10-03 17:51 ` [PATCH 4/5] PCI: Add max_vfs in sysfs per pci device where supports Yinghai Lu
2012-10-04 14:15 ` Konrad Rzeszutek Wilk
2012-10-04 15:13 ` Yinghai Lu
2012-10-03 17:51 ` [PATCH 5/5] ixgbe: add driver set_max_vfs support Yinghai Lu
2012-10-03 17:57 ` Yinghai Lu
2012-10-03 18:45 ` Dan Carpenter [this message]
2012-10-03 18:47 ` Alexander Duyck
2012-10-03 19:02 ` Don Dutile
2012-10-03 19:16 ` Rose, Gregory V
2012-10-03 20:37 ` Yinghai Lu
2012-10-03 17:55 ` [RFC] PCI: enable and disable sriov support via sysfs at per device level Yinghai Lu
2012-10-03 18:16 ` Rose, Gregory V
2012-10-03 18:28 ` Yinghai Lu
2012-10-03 13:00 ` Konrad Rzeszutek Wilk
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=20121003184502.GM13767@mwanda \
--to=dan.carpenter@oracle.com \
--cc=bhelgaas@google.com \
--cc=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=davem@davemloft.net--no-chain-reply-to \
--cc=ddutile@redhat.com \
--cc=e1000-devel@lists.sourceforge.net \
--cc=gregkh@linuxfoundation.org \
--cc=gregory.v.rose@intel.com \
--cc=jeffrey.t.kirsher@intel.com \
--cc=jesse.brandeburg@intel.com \
--cc=john.r.fastabend@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=yinghai@kernel.org \
--cc=yuvalmin@broadcom.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;
as well as URLs for NNTP newsgroup(s).