From ebc84f96c5658da77c9968869714434eed7fed1f Mon Sep 17 00:00:00 2001 From: Jon Mason Date: Fri, 10 Dec 2010 14:02:57 +0000 Subject: [PATCH] --- yaml --- r: 224983 b: refs/heads/master c: c92bf70dcb9d08f821e4c9f09f8fc328495ba998 h: refs/heads/master i: 224981: 144366d4364e64509ba01e738d465c3343573f37 224979: 5c890729eb08706ad49c4bae52a173cd1dd575cb 224975: 25b1981c82dee66046cd30799aab4913688cf65c v: v3 --- [refs] | 2 +- trunk/drivers/net/vxge/vxge-main.c | 25 ++++++++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/[refs] b/[refs] index e5f828351ad1..b4337cb13340 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 528f727279ae840db8a06c94f5e82cdaeb00da6f +refs/heads/master: c92bf70dcb9d08f821e4c9f09f8fc328495ba998 diff --git a/trunk/drivers/net/vxge/vxge-main.c b/trunk/drivers/net/vxge/vxge-main.c index 70c327910f09..9c68c60f27d8 100644 --- a/trunk/drivers/net/vxge/vxge-main.c +++ b/trunk/drivers/net/vxge/vxge-main.c @@ -4182,6 +4182,20 @@ static int vxge_probe_fw_update(struct vxgedev *vdev) return ret; } +static int __devinit is_sriov_initialized(struct pci_dev *pdev) +{ + int pos; + u16 ctrl; + + pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_SRIOV); + if (pos) { + pci_read_config_word(pdev, pos + PCI_SRIOV_CTRL, &ctrl); + if (ctrl & PCI_SRIOV_CTRL_VFE) + return 1; + } + return 0; +} + /** * vxge_probe * @pdev : structure containing the PCI related information of the device. @@ -4370,14 +4384,13 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre) num_vfs = vxge_get_num_vfs(function_mode) - 1; /* Enable SRIOV mode, if firmware has SRIOV support and if it is a PF */ - if (is_sriov(function_mode) && (max_config_dev > 1) && - (ll_config->intr_type != INTA) && - (is_privileged == VXGE_HW_OK)) { - ret = pci_enable_sriov(pdev, ((max_config_dev - 1) < num_vfs) - ? (max_config_dev - 1) : num_vfs); + if (is_sriov(function_mode) && !is_sriov_initialized(pdev) && + (ll_config->intr_type != INTA)) { + ret = pci_enable_sriov(pdev, num_vfs); if (ret) vxge_debug_ll_config(VXGE_ERR, "Failed in enabling SRIOV mode: %d\n", ret); + /* No need to fail out, as an error here is non-fatal */ } /* @@ -4673,8 +4686,6 @@ static void __devexit vxge_remove(struct pci_dev *pdev) iounmap(vdev->bar0); - pci_disable_sriov(pdev); - /* we are safe to free it now */ free_netdev(dev);