Skip to contentSkip to conversation

Intel Wired LAN Driver Updates

PATCH In review Aaron Brown 3 participants 5 messages Jan 17, 2014 – Jan 18, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v6 cover Intel Wired LAN Driver Updates

This series contains updates to ixgbe Ethan Zhao. The first one replaces the magic number "63" with a macro, IXGBE_MAX_VFS_DRV_LIMIT, the second moves the call to set driver_max_VFS to before SRIOV is enabled.

The code of these patches match the v3 (1/2) and v2 (2/2) versions sent to the e1000-devel and netdev mailing lists. The intermediate versions (v4, v5) are from sorting out style issues, mostly tabs to spaces and split lines probably introduced via mailer.

ethan.zhao (2):
1/2 ixgbe: define IXGBE_MAX_VFS_DRV_LIMIT macro and cleanup const 63 2/2 ixgbe: set driver_max_VFs should be done before enabling SRIOV

 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c  | 4 ++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 4 ++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h | 5 +++++
 3 files changed, 9 insertions(+), 4 deletions(-)
Signature · 1 line
1.8.5.GIT
#1 lore raw

PATCH v6 1/2 ixgbe: define IXGBE_MAX_VFS_DRV_LIMIT macro and cleanup const 63

From: "ethan.zhao" <[email protected]>

Because ixgbe driver limit the max number of VF
functions could be enabled to 63, so define one macro IXGBE_MAX_VFS_DRV_LIMIT and cleanup the const 63 in code.

v3: revised for net-next tree.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c  | 4 ++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 4 ++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h | 5 +++++
 3 files changed, 9 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +2 -2
index b445ad1..3fd4d3f 100644
@@ -5067,7 +5067,7 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter)
 
 	/* assign number of SR-IOV VFs */
 	if (hw->mac.type != ixgbe_mac_82598EB) {
-		if (max_vfs > 63) {
+		if (max_vfs > IXGBE_MAX_VFS_DRV_LIMIT) {
 			adapter->num_vfs = 0;
 			e_dev_warn("max_vfs parameter out of range. Not assigning any SR-IOV VFs\n");
 		} else {
@@ -8020,7 +8020,7 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	ixgbe_init_mbx_params_pf(hw);
 	memcpy(&hw->mbx.ops, ii->mbx_ops, sizeof(hw->mbx.ops));
 	ixgbe_enable_sriov(adapter);
-	pci_sriov_set_totalvfs(pdev, 63);
+	pci_sriov_set_totalvfs(pdev, IXGBE_MAX_VFS_DRV_LIMIT);
 skip_sriov:
 
 #endif
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +2 -2
index 0558c71..dff0977 100644
@@ -148,7 +148,7 @@ void ixgbe_enable_sriov(struct ixgbe_adapter *adapter)
 		 * physical function.  If the user requests greater thn
 		 * 63 VFs then it is an error - reset to default of zero.
 		 */
-		adapter->num_vfs = min_t(unsigned int, adapter->num_vfs, 63);
+		adapter->num_vfs = min_t(unsigned int, adapter->num_vfs, IXGBE_MAX_VFS_DRV_LIMIT);
 
 		err = pci_enable_sriov(adapter->pdev, adapter->num_vfs);
 		if (err) {
@@ -257,7 +257,7 @@ static int ixgbe_pci_sriov_enable(struct pci_dev *dev, int num_vfs)
 	 * PF.  The PCI bus driver already checks for other values out of
 	 * range.
 	 */
-	if (num_vfs > 63) {
+	if (num_vfs > IXGBE_MAX_VFS_DRV_LIMIT) {
 		err = -EPERM;
 		goto err_out;
 	}
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h +5 -0
index 4713f9f..8bd2919 100644
@@ -28,6 +28,11 @@
 #ifndef _IXGBE_SRIOV_H_
 #define _IXGBE_SRIOV_H_
 
+/*  ixgbe driver limit the max number of VFs could be enabled to
+ *  63 (IXGBE_MAX_VF_FUNCTIONS - 1)
+ */
+#define IXGBE_MAX_VFS_DRV_LIMIT  (IXGBE_MAX_VF_FUNCTIONS - 1)
+
 void ixgbe_restore_vf_multicasts(struct ixgbe_adapter *adapter);
 void ixgbe_msg_task(struct ixgbe_adapter *adapter);
 int ixgbe_vf_configuration(struct pci_dev *pdev, unsigned int event_mask);
Signature · 1 line
1.8.5.GIT
#2 lore raw

PATCH v6 2/2 ixgbe: set driver_max_VFs should be done before enabling SRIOV

In reply to Aaron Brown

From: "ethan.zhao" <[email protected]>

commit 43dc4e01 Limit number of reported VFs to device
specific value It doesn't work and always returns -EBUSY because VFs are already enabled.

ixgbe_enable_sriov()

        pci_enable_sriov()
                sriov_enable()
                {
                ... ..
                iov->ctrl |= PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE;
                pci_cfg_access_lock(dev);
                ... ...
                }

pci_sriov_set_totalvfs()
{
... ...
if (dev->sriov->ctrl & PCI_SRIOV_CTRL_VFE)

                return -EBUSY;

...
}

So should set driver_max_VFs with pci_sriov_set_totalvfs() before enable VFs with ixgbe_enable_sriov().

V2: revised for net-next tree.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +1 -1
index 3fd4d3f..61d985c 100644
@@ -8019,8 +8019,8 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	/* Mailbox */
 	ixgbe_init_mbx_params_pf(hw);
 	memcpy(&hw->mbx.ops, ii->mbx_ops, sizeof(hw->mbx.ops));
-	ixgbe_enable_sriov(adapter);
 	pci_sriov_set_totalvfs(pdev, IXGBE_MAX_VFS_DRV_LIMIT);
+	ixgbe_enable_sriov(adapter);
 skip_sriov:
 
 #endif
Signature · 1 line
1.8.5.GIT
#3 lore raw

Re: [Patch 2/2 net-next v6] ixgbe: set driver_max_VFs should be done before enabling SRIOV

Great job. Thanks a lot.

Ethan

Quoted 50 lines · Aaron Brown

From: "ethan.zhao" <[email protected]>

commit 43dc4e01 Limit number of reported VFs to device
specific value It doesn't work and always returns -EBUSY because VFs are already enabled.

ixgbe_enable_sriov()

         pci_enable_sriov()
                 sriov_enable()
                 {
                 ... ..
                 iov->ctrl |= PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE;
                 pci_cfg_access_lock(dev);
                 ... ...
                 }

pci_sriov_set_totalvfs()
{
... ...
if (dev->sriov->ctrl & PCI_SRIOV_CTRL_VFE)

                 return -EBUSY;

...
}

So should set driver_max_VFs with pci_sriov_set_totalvfs() before enable VFs with ixgbe_enable_sriov().

V2: revised for net-next tree.

---
  drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +1 -1
index 3fd4d3f..61d985c 100644
@@ -8019,8 +8019,8 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
  	/* Mailbox */
  	ixgbe_init_mbx_params_pf(hw);
  	memcpy(&hw->mbx.ops, ii->mbx_ops, sizeof(hw->mbx.ops));
-	ixgbe_enable_sriov(adapter);
  	pci_sriov_set_totalvfs(pdev, IXGBE_MAX_VFS_DRV_LIMIT);
+	ixgbe_enable_sriov(adapter);
  skip_sriov:
 
  #endif
maintainer
#4 lore raw
In reply to Aaron Brown

From: Aaron Brown <[email protected]>
Date: Thu, 16 Jan 2014 19:41:03 -0800

Quoted 8 lines

This series contains updates to ixgbe Ethan Zhao. The first one replaces the magic number "63" with a macro, IXGBE_MAX_VFS_DRV_LIMIT, the second moves the call to set driver_max_VFS to before SRIOV is enabled.

The code of these patches match the v3 (1/2) and v2 (2/2) versions sent to the e1000-devel and netdev mailing lists. The intermediate versions (v4, v5) are from sorting out style issues, mostly tabs to spaces and split lines probably introduced via mailer.

Series applied, thanks.