summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/intel/igb/igb_main.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2013-10-26 00:28:35 -0400
committerDavid S. Miller <davem@davemloft.net>2013-10-26 00:28:35 -0400
commita00f6fcc7d0c62a91768d9c4ccba4c7d64fbbce3 (patch)
tree11e96a6559dbb8251a973730ea8276a2ce4f2083 /drivers/net/ethernet/intel/igb/igb_main.c
parent7f29405403d7c17f539c099987972b862e7e5255 (diff)
parent9e6fcae767da775df1679646749717c223440382 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next
Jeff Kirsher says: ==================== Intel Wired LAN Driver Updates This series contains updates to igb, igbvf, i40e, ixgbe and ixgbevf. Dan Carpenter provides a patch for igbvf to fix a bug found by a static checker. If the new MTU is very large, then "new_mtu + ETH_HLEN + ETH_FCS_LEN" can wrap and the check on the next line can underflow. Wei Yongjun provides 2 patches, the first against igbvf adds a missing iounmap() before the return from igbvf_probe(). The second against i40e, removes the include <linux/version.h> because it is not needed. Carolyn provides a patch for igb to fix a call to set the master/slave mode for all m88 generation 2 PHY's and removes the call for I210 devices which do not need it. Stefan Assmann provides a patch for igb to fix an issue which was broke by: commit fa44f2f185f7f9da19d331929bb1b56c1ccd1d93 Author: Greg Rose <gregory.v.rose@intel.com> Date: Thu Jan 17 01:03:06 2013 -0800 igb: Enable SR-IOV configuration via PCI sysfs interface which breaks the reloading of igb when VFs are assigned to a guest, in several ways. Jacob provides a patch for ixgbe and ixgbevf. First, against ixgbe, cleans up ixgbe_enumerate_functions to reduce code complexity. The second, against ixgbevf, adds support for ethtool's get_coalesce and set_coalesce command for the ixgbevf driver. Yijing Wang provides a patch for ixgbe to use pcie_capability_read_word() to simplify the code. Emil provides a ixgbe patch to fix an issue where the logic used to detect changes in rx-usecs was incorrect and was masked by the call to ixgbe_update_rsc(). Don provides 2 patches for ixgbevf. First creates a new function to set PSRTYPE. The second bumps the ixgbevf driver version. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/intel/igb/igb_main.c')
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c37
1 files changed, 16 insertions, 21 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index a505d3bad09a..ebe6370c4b18 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -182,6 +182,7 @@ static void igb_check_vf_rate_limit(struct igb_adapter *);
#ifdef CONFIG_PCI_IOV
static int igb_vf_configure(struct igb_adapter *adapter, int vf);
+static int igb_pci_enable_sriov(struct pci_dev *dev, int num_vfs);
#endif
#ifdef CONFIG_PM
@@ -2429,7 +2430,7 @@ err_dma:
}
#ifdef CONFIG_PCI_IOV
-static int igb_disable_sriov(struct pci_dev *pdev)
+static int igb_disable_sriov(struct pci_dev *pdev)
{
struct net_device *netdev = pci_get_drvdata(pdev);
struct igb_adapter *adapter = netdev_priv(netdev);
@@ -2470,27 +2471,19 @@ static int igb_enable_sriov(struct pci_dev *pdev, int num_vfs)
int err = 0;
int i;
- if (!adapter->msix_entries) {
+ if (!adapter->msix_entries || num_vfs > 7) {
err = -EPERM;
goto out;
}
-
if (!num_vfs)
goto out;
- else if (old_vfs && old_vfs == num_vfs)
- goto out;
- else if (old_vfs && old_vfs != num_vfs)
- err = igb_disable_sriov(pdev);
-
- if (err)
- goto out;
- if (num_vfs > 7) {
- err = -EPERM;
- goto out;
- }
-
- adapter->vfs_allocated_count = num_vfs;
+ if (old_vfs) {
+ dev_info(&pdev->dev, "%d pre-allocated VFs found - override max_vfs setting of %d\n",
+ old_vfs, max_vfs);
+ adapter->vfs_allocated_count = old_vfs;
+ } else
+ adapter->vfs_allocated_count = num_vfs;
adapter->vf_data = kcalloc(adapter->vfs_allocated_count,
sizeof(struct vf_data_storage), GFP_KERNEL);
@@ -2504,10 +2497,12 @@ static int igb_enable_sriov(struct pci_dev *pdev, int num_vfs)
goto out;
}
- err = pci_enable_sriov(pdev, adapter->vfs_allocated_count);
- if (err)
- goto err_out;
-
+ /* only call pci_enable_sriov() if no VFs are allocated already */
+ if (!old_vfs) {
+ err = pci_enable_sriov(pdev, adapter->vfs_allocated_count);
+ if (err)
+ goto err_out;
+ }
dev_info(&pdev->dev, "%d VFs allocated\n",
adapter->vfs_allocated_count);
for (i = 0; i < adapter->vfs_allocated_count; i++)
@@ -2623,7 +2618,7 @@ static void igb_probe_vfs(struct igb_adapter *adapter)
return;
pci_sriov_set_totalvfs(pdev, 7);
- igb_enable_sriov(pdev, max_vfs);
+ igb_pci_enable_sriov(pdev, max_vfs);
#endif /* CONFIG_PCI_IOV */
}