From: Hauke Mehrtens <hauke@hauke-m.de>
To: Stefan Assmann <sassmann@kpanic.de>, mcgrof@kernel.org
Cc: backports@vger.kernel.org
Subject: Re: [PATCH v3 04/11] backports: igb fixes for linux-3.7
Date: Thu, 09 Jan 2014 22:13:36 +0100 [thread overview]
Message-ID: <52CF1100.7090708@hauke-m.de> (raw)
In-Reply-To: <1389177854-24292-5-git-send-email-sassmann@kpanic.de>
On 01/08/2014 11:44 AM, Stefan Assmann wrote:
> - add pci_sriov_set_totalvfs()
> - add patches/collateral-evolutions/network/82-ethernet/0002-igb_pci_sriov_configure.patch
>
> Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
> ---
> backport/backport-include/linux/pci.h | 5 +-
> backport/compat/compat-3.8.c | 34 +++++++++++++
> .../82-ethernet/0002-igb_pci_sriov_configure.patch | 57 ++++++++++++++++++++++
> 3 files changed, 95 insertions(+), 1 deletion(-)
> create mode 100644 patches/collateral-evolutions/network/82-ethernet/0002-igb_pci_sriov_configure.patch
>
> diff --git a/backport/backport-include/linux/pci.h b/backport/backport-include/linux/pci.h
> index 9083255..65a76a1 100644
> --- a/backport/backport-include/linux/pci.h
> +++ b/backport/backport-include/linux/pci.h
> @@ -178,6 +178,10 @@ bool pci_pme_capable(struct pci_dev *dev, pci_power_t state);
> .subvendor = (subvend), .subdevice = (subdev)
> #endif /* PCI_DEVICE_SUB */
>
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
Please add this here:
#define pci_sriov_set_totalvfs LINUX_BACKPORT(pci_sriov_set_totalvfs)
> +int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs);
> +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0) */
> +
> #if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
> /* Taken from drivers/pci/pci.h */
> struct pci_sriov {
> @@ -210,5 +214,4 @@ static inline int pci_vfs_assigned(struct pci_dev *dev)
> #endif
>
> #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) */
> -
> #endif /* _BACKPORT_LINUX_PCI_H */
> diff --git a/backport/compat/compat-3.8.c b/backport/compat/compat-3.8.c
> index c6824bf..9d96b36 100644
> --- a/backport/compat/compat-3.8.c
> +++ b/backport/compat/compat-3.8.c
> @@ -18,6 +18,8 @@
> #include <linux/netdevice.h>
> #include <linux/random.h>
> #include <linux/of.h>
> +#include <linux/pci.h>
> +#include <linux/pci_regs.h>
>
> #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,8))
> void netdev_set_default_ethtool_ops(struct net_device *dev,
> @@ -514,3 +516,35 @@ int of_property_read_u8_array(const struct device_node *np,
> }
> EXPORT_SYMBOL_GPL(of_property_read_u8_array);
> #endif /* CONFIG_OF */
> +
> +#ifdef CONFIG_PCI_IOV
> +/**
> + * pci_sriov_set_totalvfs -- reduce the TotalVFs available
> + * @dev: the PCI PF device
> + * @numvfs: number that should be used for TotalVFs supported
> + *
> + * Should be called from PF driver's probe routine with
> + * device's mutex held.
> + *
> + * Returns 0 if PF is an SRIOV-capable device and
> + * value of numvfs valid. If not a PF return -ENOSYS;
> + * if numvfs is invalid return -EINVAL;
> + * if VFs already enabled, return -EBUSY.
> + */
> +int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs)
> +{
> + if (!dev->is_physfn)
> + return -ENOSYS;
> + if (numvfs > dev->sriov->total_VFs)
> + return -EINVAL;
> +
> + /* Shouldn't change if VFs already enabled */
> + if (dev->sriov->ctrl & PCI_SRIOV_CTRL_VFE)
> + return -EBUSY;
> + else
> + dev->sriov->driver_max_VFs = numvfs;
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(pci_sriov_set_totalvfs);
> +#endif /* CONFIG_PCI_IOV */
> diff --git a/patches/collateral-evolutions/network/82-ethernet/0002-igb_pci_sriov_configure.patch b/patches/collateral-evolutions/network/82-ethernet/0002-igb_pci_sriov_configure.patch
> new file mode 100644
> index 0000000..47722cc
> --- /dev/null
> +++ b/patches/collateral-evolutions/network/82-ethernet/0002-igb_pci_sriov_configure.patch
> @@ -0,0 +1,57 @@
> +diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> +index f2a5abf..dd878b6 100644
> +--- a/drivers/net/ethernet/intel/igb/igb_main.c
> ++++ b/drivers/net/ethernet/intel/igb/igb_main.c
> +@@ -207,7 +207,9 @@ static const struct dev_pm_ops igb_pm_ops = {
> + };
> + #endif
> + static void igb_shutdown(struct pci_dev *);
> ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)
> + static int igb_pci_sriov_configure(struct pci_dev *dev, int num_vfs);
> ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) */
> + #ifdef CONFIG_IGB_DCA
> + static int igb_notify_dca(struct notifier_block *, unsigned long, void *);
> + static struct notifier_block dca_notifier = {
> +@@ -249,7 +251,9 @@ static struct pci_driver igb_driver = {
> + .driver.pm = &igb_pm_ops,
> + #endif
> + .shutdown = igb_shutdown,
> ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)
> + .sriov_configure = igb_pci_sriov_configure,
> ++#endif
> + .err_handler = &igb_err_handler
> + };
> +
> +@@ -7310,6 +7314,7 @@ static int igb_sriov_reinit(struct pci_dev *dev)
> + return 0;
> + }
> +
> ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)
> + static int igb_pci_disable_sriov(struct pci_dev *dev)
> + {
> + int err = igb_disable_sriov(dev);
> +@@ -7319,6 +7324,7 @@ static int igb_pci_disable_sriov(struct pci_dev *dev)
> +
> + return err;
> + }
> ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) */
> +
> + static int igb_pci_enable_sriov(struct pci_dev *dev, int num_vfs)
> + {
> +@@ -7336,6 +7342,8 @@ out:
> + }
> +
> + #endif
> ++
> ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)
> + static int igb_pci_sriov_configure(struct pci_dev *dev, int num_vfs)
> + {
> + #ifdef CONFIG_PCI_IOV
> +@@ -7346,6 +7354,7 @@ static int igb_pci_sriov_configure(struct pci_dev *dev, int num_vfs)
> + #endif
> + return 0;
> + }
> ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) */
> +
> + #ifdef CONFIG_NET_POLL_CONTROLLER
> + /* Polling 'interrupt' - used by things like netconsole to send skbs
>
next prev parent reply other threads:[~2014-01-09 21:13 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-08 10:44 [PATCH v3 00/11] backports: add igb driver Stefan Assmann
2014-01-08 10:44 ` [PATCH v3 01/11] backports: igb fixes for linux-3.12 Stefan Assmann
2014-01-09 20:55 ` Hauke Mehrtens
2014-01-08 10:44 ` [PATCH v3 02/11] backports: igb fixes for linux-3.9 Stefan Assmann
2014-01-09 21:01 ` Hauke Mehrtens
2014-01-08 10:44 ` [PATCH v3 03/11] backports: igb fixes for linux-3.8 Stefan Assmann
2014-01-08 10:44 ` [PATCH v3 04/11] backports: igb fixes for linux-3.7 Stefan Assmann
2014-01-09 21:13 ` Hauke Mehrtens [this message]
2014-01-13 7:40 ` Stefan Assmann
2014-01-08 10:44 ` [PATCH v3 05/11] backports: igb fixes for linux-3.6 Stefan Assmann
2014-01-08 10:44 ` [PATCH v3 06/11] backports: igb fixes for linux-3.5 Stefan Assmann
2014-01-08 10:44 ` [PATCH v3 07/11] backports: igb fixes for linux-3.4 Stefan Assmann
2014-01-08 10:44 ` [PATCH v3 08/11] backports: igb fixes for linux-3.3 Stefan Assmann
2014-01-08 10:44 ` [PATCH v3 09/11] backports: igb fixes for linux-3.2 Stefan Assmann
2014-01-08 10:44 ` [PATCH v3 10/11] backports: igb fixes for linux-3.1 Stefan Assmann
2014-01-08 10:44 ` [PATCH v3 11/11] backports: enable igb and add defconfig Stefan Assmann
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=52CF1100.7090708@hauke-m.de \
--to=hauke@hauke-m.de \
--cc=backports@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=sassmann@kpanic.de \
/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