diff options
author | Andy Gospodarek <andy@greyhouse.net> | 2010-07-21 02:40:31 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-07-21 16:48:55 -0400 |
commit | bded64a7ff82f6af56426a4ff2483888e5ad5fe9 (patch) | |
tree | bba5dac804e4e691e2879d8c5bfd79b1c3182f6b /drivers/net | |
parent | 0577589cc1d99700c2789b2fa075cc522d0de30b (diff) |
ixgbe/igb: catch invalid VF settings
Some ixgbe cards put an invalid VF device ID in the PCIe SR-IOV
capability. The ixgbe driver is only valid for PFs or non SR-IOV
hardware. It seems that the same problem could occur on igb hardware as
well, so if we discover we are trying to initialize a VF in ixbge_probe
or igb_probe, print an error and exit.
Based on a patch for ixgbe from Chris Wright <chrisw@sous-sol.org>.
Signed-off-by: Andy Gospodarek <andy@greyhouse.net>
Cc: Chris Wright <chrisw@sous-sol.org>
Acked-by: Chris Wright <chrisw@sous-sol.org>
Acked-by: Greg Rose <gregory.v.rose@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/igb/igb_main.c | 9 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_main.c | 9 |
2 files changed, 18 insertions, 0 deletions
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index 3881918f5382..cea37e0837ff 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c | |||
@@ -1722,6 +1722,15 @@ static int __devinit igb_probe(struct pci_dev *pdev, | |||
1722 | u16 eeprom_apme_mask = IGB_EEPROM_APME; | 1722 | u16 eeprom_apme_mask = IGB_EEPROM_APME; |
1723 | u32 part_num; | 1723 | u32 part_num; |
1724 | 1724 | ||
1725 | /* Catch broken hardware that put the wrong VF device ID in | ||
1726 | * the PCIe SR-IOV capability. | ||
1727 | */ | ||
1728 | if (pdev->is_virtfn) { | ||
1729 | WARN(1, KERN_ERR "%s (%hx:%hx) should not be a VF!\n", | ||
1730 | pci_name(pdev), pdev->vendor, pdev->device); | ||
1731 | return -EINVAL; | ||
1732 | } | ||
1733 | |||
1725 | err = pci_enable_device_mem(pdev); | 1734 | err = pci_enable_device_mem(pdev); |
1726 | if (err) | 1735 | if (err) |
1727 | return err; | 1736 | return err; |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 7b5d9764f317..74d9b6df3029 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -6492,6 +6492,15 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, | |||
6492 | #endif | 6492 | #endif |
6493 | u32 part_num, eec; | 6493 | u32 part_num, eec; |
6494 | 6494 | ||
6495 | /* Catch broken hardware that put the wrong VF device ID in | ||
6496 | * the PCIe SR-IOV capability. | ||
6497 | */ | ||
6498 | if (pdev->is_virtfn) { | ||
6499 | WARN(1, KERN_ERR "%s (%hx:%hx) should not be a VF!\n", | ||
6500 | pci_name(pdev), pdev->vendor, pdev->device); | ||
6501 | return -EINVAL; | ||
6502 | } | ||
6503 | |||
6495 | err = pci_enable_device_mem(pdev); | 6504 | err = pci_enable_device_mem(pdev); |
6496 | if (err) | 6505 | if (err) |
6497 | return err; | 6506 | return err; |