* [PATCH net-2.6] ixgbe/igb: catch invalid VF settings
@ 2010-07-21 16:40 Andy Gospodarek
2010-07-21 16:50 ` Chris Wright
0 siblings, 1 reply; 6+ messages in thread
From: Andy Gospodarek @ 2010-07-21 16:40 UTC (permalink / raw)
To: netdev; +Cc: chrisw
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>
---
drivers/net/igb/igb_main.c | 9 +++++++++
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 3881918..cea37e0 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,
u16 eeprom_apme_mask = IGB_EEPROM_APME;
u32 part_num;
+ /* Catch broken hardware that put the wrong VF device ID in
+ * the PCIe SR-IOV capability.
+ */
+ if (pdev->is_virtfn) {
+ WARN(1, KERN_ERR "%s (%hx:%hx) should not be a VF!\n",
+ pci_name(pdev), pdev->vendor, pdev->device);
+ return -EINVAL;
+ }
+
err = pci_enable_device_mem(pdev);
if (err)
return err;
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 7b5d976..74d9b6d 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,
#endif
u32 part_num, eec;
+ /* Catch broken hardware that put the wrong VF device ID in
+ * the PCIe SR-IOV capability.
+ */
+ if (pdev->is_virtfn) {
+ WARN(1, KERN_ERR "%s (%hx:%hx) should not be a VF!\n",
+ pci_name(pdev), pdev->vendor, pdev->device);
+ return -EINVAL;
+ }
+
err = pci_enable_device_mem(pdev);
if (err)
return err;
--
1.6.2.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-2.6] ixgbe/igb: catch invalid VF settings
2010-07-21 16:40 [PATCH net-2.6] ixgbe/igb: catch invalid VF settings Andy Gospodarek
@ 2010-07-21 16:50 ` Chris Wright
2010-07-21 20:23 ` Rose, Gregory V
0 siblings, 1 reply; 6+ messages in thread
From: Chris Wright @ 2010-07-21 16:50 UTC (permalink / raw)
To: Andy Gospodarek; +Cc: netdev, chrisw
* Andy Gospodarek (andy@greyhouse.net) wrote:
> 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>
Only seen this on ixgbe, but since the result there is a kernel panic
makes sense to be defensive.
thanks,
-chris
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH net-2.6] ixgbe/igb: catch invalid VF settings
2010-07-21 16:50 ` Chris Wright
@ 2010-07-21 20:23 ` Rose, Gregory V
2010-07-21 20:31 ` Jeff Kirsher
0 siblings, 1 reply; 6+ messages in thread
From: Rose, Gregory V @ 2010-07-21 20:23 UTC (permalink / raw)
To: Chris Wright, Andy Gospodarek; +Cc: netdev@vger.kernel.org
>-----Original Message-----
>From: netdev-owner@vger.kernel.org [mailto:netdev-owner@vger.kernel.org]
>On Behalf Of Chris Wright
>Sent: Wednesday, July 21, 2010 9:51 AM
>To: Andy Gospodarek
>Cc: netdev@vger.kernel.org; chrisw@sous-sol.org
>Subject: Re: [PATCH net-2.6] ixgbe/igb: catch invalid VF settings
>
>* Andy Gospodarek (andy@greyhouse.net) wrote:
>> 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>
>
>Only seen this on ixgbe, but since the result there is a kernel panic
>makes sense to be defensive.
>
>thanks,
>-chris
Acked-by: Greg Rose <gregory.v.rose@intel.com>
Looks good, thanks.
- Greg
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-2.6] ixgbe/igb: catch invalid VF settings
2010-07-21 20:23 ` Rose, Gregory V
@ 2010-07-21 20:31 ` Jeff Kirsher
2010-07-21 20:45 ` David Miller
0 siblings, 1 reply; 6+ messages in thread
From: Jeff Kirsher @ 2010-07-21 20:31 UTC (permalink / raw)
To: David Miller; +Cc: Chris Wright, Andy Gospodarek, netdev@vger.kernel.org
On Wed, Jul 21, 2010 at 13:23, Rose, Gregory V <gregory.v.rose@intel.com> wrote:
>>-----Original Message-----
>>From: netdev-owner@vger.kernel.org [mailto:netdev-owner@vger.kernel.org]
>>On Behalf Of Chris Wright
>>Sent: Wednesday, July 21, 2010 9:51 AM
>>To: Andy Gospodarek
>>Cc: netdev@vger.kernel.org; chrisw@sous-sol.org
>>Subject: Re: [PATCH net-2.6] ixgbe/igb: catch invalid VF settings
>>
>>* Andy Gospodarek (andy@greyhouse.net) wrote:
>>> 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>
>>
>>Only seen this on ixgbe, but since the result there is a kernel panic
>>makes sense to be defensive.
>>
>>thanks,
>>-chris
>
> Acked-by: Greg Rose <gregory.v.rose@intel.com>
>
> Looks good, thanks.
>
> - Greg
>
Dave, I do not plan on adding this patch to my queue, so feel free to
take this patch after review.
--
Cheers,
Jeff
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-2.6] ixgbe/igb: catch invalid VF settings
2010-07-21 20:31 ` Jeff Kirsher
@ 2010-07-21 20:45 ` David Miller
2010-07-21 20:51 ` David Miller
0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2010-07-21 20:45 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: chrisw, andy, netdev
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Wed, 21 Jul 2010 13:31:38 -0700
> On Wed, Jul 21, 2010 at 13:23, Rose, Gregory V <gregory.v.rose@intel.com> wrote:
>>>-----Original Message-----
>>>From: netdev-owner@vger.kernel.org [mailto:netdev-owner@vger.kernel.org]
>>>On Behalf Of Chris Wright
>>>Sent: Wednesday, July 21, 2010 9:51 AM
>>>To: Andy Gospodarek
>>>Cc: netdev@vger.kernel.org; chrisw@sous-sol.org
>>>Subject: Re: [PATCH net-2.6] ixgbe/igb: catch invalid VF settings
>>>
>>>* Andy Gospodarek (andy@greyhouse.net) wrote:
>>>> 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>
>>>
>>>Only seen this on ixgbe, but since the result there is a kernel panic
>>>makes sense to be defensive.
>>>
>>>thanks,
>>>-chris
>>
>> Acked-by: Greg Rose <gregory.v.rose@intel.com>
>>
>> Looks good, thanks.
>>
>> - Greg
>>
>
> Dave, I do not plan on adding this patch to my queue, so feel free to
> take this patch after review.
Ok, will do.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-2.6] ixgbe/igb: catch invalid VF settings
2010-07-21 20:45 ` David Miller
@ 2010-07-21 20:51 ` David Miller
0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2010-07-21 20:51 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: chrisw, andy, netdev
From: David Miller <davem@davemloft.net>
Date: Wed, 21 Jul 2010 13:45:13 -0700 (PDT)
> From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> Date: Wed, 21 Jul 2010 13:31:38 -0700
>
>> Dave, I do not plan on adding this patch to my queue, so feel free to
>> take this patch after review.
>
> Ok, will do.
Applied, thanks everyone.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-07-21 20:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-21 16:40 [PATCH net-2.6] ixgbe/igb: catch invalid VF settings Andy Gospodarek
2010-07-21 16:50 ` Chris Wright
2010-07-21 20:23 ` Rose, Gregory V
2010-07-21 20:31 ` Jeff Kirsher
2010-07-21 20:45 ` David Miller
2010-07-21 20:51 ` David Miller
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).