diff mbox

[net,v2,3/8] ixgbe: fix vf lookup

Message ID 1328780061-25000-4-git-send-email-jeffrey.t.kirsher@intel.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Kirsher, Jeffrey T Feb. 9, 2012, 9:34 a.m. UTC
From: Greg Rose <gregory.v.rose@intel.com>

Recent addition of code to find already allocated VFs failed to take
account that systems with 2 or more multi-port SR-IOV capable controllers
might have already enabled VFs.  Make sure that the VFs the function is
finding are actually subordinate to the particular instance of the adapter
that is looking for them and not subordinate to some device that has
previously enabled SR-IOV.

This bug exists in 3.2 stable as well as 3.3 release candidates.

CC: stable@vger.kernel.org
Reported-by: David Ahern <daahern@cisco.com>
Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Robert E Garrett <robertX.e.garrett@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Comments

Rose, Gregory V Feb. 9, 2012, 4:27 p.m. UTC | #1
> -----Original Message-----
> From: Kirsher, Jeffrey T
> Sent: Thursday, February 09, 2012 1:34 AM
> To: davem@davemloft.net
> Cc: Rose, Gregory V; netdev@vger.kernel.org; gospo@redhat.com;
> sassmann@redhat.com; stable@vger.kernel.org; Kirsher, Jeffrey T
> Subject: [net v2 3/8] ixgbe: fix vf lookup
> 
> From: Greg Rose <gregory.v.rose@intel.com>
> 
> Recent addition of code to find already allocated VFs failed to take
> account that systems with 2 or more multi-port SR-IOV capable controllers
> might have already enabled VFs.  Make sure that the VFs the function is
> finding are actually subordinate to the particular instance of the adapter
> that is looking for them and not subordinate to some device that has
> previously enabled SR-IOV.
> 
> This bug exists in 3.2 stable as well as 3.3 release candidates.
> 
> CC: stable@vger.kernel.org
> Reported-by: David Ahern <daahern@cisco.com>
> Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
> Tested-by: Robert E Garrett <robertX.e.garrett@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
>  drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
> b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
> index 8d8cdbc..b982710 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
> @@ -67,7 +67,8 @@ static int ixgbe_find_enabled_vfs(struct ixgbe_adapter
> *adapter)
>  	vf_devfn = pdev->devfn + 0x80;
>  	pvfdev = pci_get_device(IXGBE_INTEL_VENDOR_ID, device_id, NULL);
>  	while (pvfdev) {
> -		if (pvfdev->devfn == vf_devfn)
> +		if (pvfdev->devfn == vf_devfn &&
> +		    (pvfdev->bus->number >= pdev->bus->number))
>  			vfs_found++;
>  		vf_devfn += 2;
>  		pvfdev = pci_get_device(IXGBE_INTEL_VENDOR_ID,
> --
> 1.7.7.6

It still has unneeded parenthesis around the second half of the if expression.  I'll fix that up in the next series of patches.  Same for the igb driver.

- Greg


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
index 8d8cdbc..b982710 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -67,7 +67,8 @@  static int ixgbe_find_enabled_vfs(struct ixgbe_adapter *adapter)
 	vf_devfn = pdev->devfn + 0x80;
 	pvfdev = pci_get_device(IXGBE_INTEL_VENDOR_ID, device_id, NULL);
 	while (pvfdev) {
-		if (pvfdev->devfn == vf_devfn)
+		if (pvfdev->devfn == vf_devfn &&
+		    (pvfdev->bus->number >= pdev->bus->number))
 			vfs_found++;
 		vf_devfn += 2;
 		pvfdev = pci_get_device(IXGBE_INTEL_VENDOR_ID,