vxge: Enable SRIOV support in the driver.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Thursday, June 18, 2009 - 3:02 pm

Gitweb:     http://git.kernel.org/linus/5dbc901172fb952409940cd7ca55d8e6e5a7cc2c
Commit:     5dbc901172fb952409940cd7ca55d8e6e5a7cc2c
Parent:     a42fc8f6943127787ad2a416436cf211d5531229
Author:     Sivakumar Subramani <Sivakumar.Subramani@neterion.com>
AuthorDate: Tue Jun 16 18:48:55 2009 +0000
Committer:  David S. Miller <davem@davemloft.net>
CommitDate: Wed Jun 17 04:31:14 2009 -0700

    vxge: Enable SRIOV support in the driver.
    
    - Enabled SRIOV support in the driver.
    - Call __vxge_hw_verify_pci_e_info() for the PF only. This function
      verifies the negotiated link width and current link speed in the
      Link Status Register (offset 12h) which are reserved fields for VFs
      as per the SRIOV specification, section 3.5.8.
    - Implemented David Miller's comment to remove the #ifdef CONFIG_PCI_IOV as
      these intefaces have NOP versions declared when the defintion is not set.
    
    Signed-off-by: Sivakumar Subramani <sivakumar.subramani@neterion.com>
    Signed-off-by: Rastapur Santosh <santosh.rastapur@neterion.com>
    Signed-off-by: Ramkrishna Vepa <ram.vepa@neterion.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
---
 drivers/net/vxge/vxge-config.c  |   12 +++++++-----
 drivers/net/vxge/vxge-main.c    |   13 +++++++++++++
 drivers/net/vxge/vxge-version.h |    4 ++--
 3 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/drivers/net/vxge/vxge-config.c b/drivers/net/vxge/vxge-config.c
index 26cde57..58d2551 100644
--- a/drivers/net/vxge/vxge-config.c
+++ b/drivers/net/vxge/vxge-config.c
@@ -454,7 +454,7 @@ __vxge_hw_verify_pci_e_info(struct __vxge_hw_device *hldev)
 	return VXGE_HW_OK;
 }
 
-static enum vxge_hw_status
+enum vxge_hw_status
 __vxge_hw_device_is_privilaged(struct __vxge_hw_device *hldev)
 {
 	if ((hldev->host_type == VXGE_HW_NO_MR_NO_SR_NORMAL_FUNCTION ||
@@ -676,10 +676,12 @@ enum vxge_hw_status __vxge_hw_device_initialize(struct __vxge_hw_device *hldev)
 {
 	enum vxge_hw_status status = VXGE_HW_OK;
 
-	/* Validate the pci-e link width and speed */
-	status = __vxge_hw_verify_pci_e_info(hldev);
-	if (status != VXGE_HW_OK)
-		goto exit;
+	if (VXGE_HW_OK == __vxge_hw_device_is_privilaged(hldev)) {
+		/* Validate the pci-e link width and speed */
+		status = __vxge_hw_verify_pci_e_info(hldev);
+		if (status != VXGE_HW_OK)
+			goto exit;
+	}
 
 	vxge_hw_wrr_rebalance(hldev);
 exit:
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c
index 6c838b3..6034497 100644
--- a/drivers/net/vxge/vxge-main.c
+++ b/drivers/net/vxge/vxge-main.c
@@ -4203,6 +4203,16 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
 		max_vpath_supported++;
 	}
 
+	/* Enable SRIOV mode, if firmware has SRIOV support and if it is a PF */
+	if ((VXGE_HW_FUNCTION_MODE_SRIOV ==
+		ll_config.device_hw_info.function_mode) &&
+		(max_config_dev > 1) && (pdev->is_physfn)) {
+			ret = pci_enable_sriov(pdev, max_config_dev - 1);
+			if (ret)
+				vxge_debug_ll_config(VXGE_ERR,
+					"Failed to enable SRIOV: %d \n", ret);
+	}
+
 	/*
 	 * Configure vpaths and get driver configured number of vpaths
 	 * which is less than or equal to the maximum vpaths per function.
@@ -4366,6 +4376,7 @@ _exit6:
 
 	vxge_device_unregister(hldev);
 _exit5:
+	pci_disable_sriov(pdev);
 	vxge_hw_device_terminate(hldev);
 _exit4:
 	iounmap(attr.bar1);
@@ -4429,6 +4440,8 @@ vxge_remove(struct pci_dev *pdev)
 	iounmap(vdev->bar0);
 	iounmap(vdev->bar1);
 
+	pci_disable_sriov(pdev);
+
 	/* we are safe to free it now */
 	free_netdev(dev);
 
diff --git a/drivers/net/vxge/vxge-version.h b/drivers/net/vxge/vxge-version.h
index 7da02c5..82786ff 100644
--- a/drivers/net/vxge/vxge-version.h
+++ b/drivers/net/vxge/vxge-version.h
@@ -17,7 +17,7 @@
 
 #define VXGE_VERSION_MAJOR	"2"
 #define VXGE_VERSION_MINOR	"0"
-#define VXGE_VERSION_FIX	"1"
-#define VXGE_VERSION_BUILD	"17129"
+#define VXGE_VERSION_FIX	"4"
+#define VXGE_VERSION_BUILD	"17795"
 #define VXGE_VERSION_FOR	"k"
 #endif
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
vxge: Enable SRIOV support in the driver., Linux Kernel Mailing ..., (Thu Jun 18, 3:02 pm)