netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net 0/6][pull request] Intel Wired LAN Driver Updates
@ 2013-03-26 10:42 Jeff Kirsher
  2013-03-26 10:42 ` [net 1/6] ixgbevf: don't release the soft entries Jeff Kirsher
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Jeff Kirsher @ 2013-03-26 10:42 UTC (permalink / raw)
  To: davem; +Cc: Jeff Kirsher, netdev, gospo, sassmann

This series contains updates to ixgbevf and igb.

The ixgbevf calls to pci_disable_msix() and to free the msix_entries
memory should not occur if device open fails.  Instead they should be
called during device driver removal to balance with the call to
pci_enable_msix() and the call to allocate msix_entries memory
during the device probe and driver load.

The remaining 4 of 5 igb patches are simple 1-3 line patches to fix
several issues such as possible null pointer dereference, PHC stopping
on max frequency, make sensor info static and SR-IOV initialization
reordering.

The remaining igb patch to fix anti-spoofing config fixes a problem
in i350 where anti spoofing configuration was written into a wrong
register.

The following are changes since commit a79ca223e029aa4f09abb337accf1812c900a800:
  ipv6: fix bad free of addrconf_init_net
and are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net master

Alex Williamson (2):
  igb: Fix null pointer dereference
  igb: SR-IOV init reordering

Jiri Benc (1):
  igb: fix PHC stopping on max freq

Lior Levy (1):
  igb: fix i350 anti spoofing config

Stephen Hemminger (1):
  igb: make sensor info static

xunleer (1):
  ixgbevf: don't release the soft entries

 drivers/net/ethernet/intel/igb/e1000_82575.c      | 33 +++++++++++++----------
 drivers/net/ethernet/intel/igb/igb_hwmon.c        |  2 +-
 drivers/net/ethernet/intel/igb/igb_main.c         |  4 +--
 drivers/net/ethernet/intel/igb/igb_ptp.c          |  2 +-
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 24 ++++++++++++++---
 5 files changed, 43 insertions(+), 22 deletions(-)

-- 
1.7.11.7

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [net 1/6] ixgbevf: don't release the soft entries
  2013-03-26 10:42 [net 0/6][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
@ 2013-03-26 10:42 ` Jeff Kirsher
  2013-03-26 10:42 ` [net 2/6] igb: fix i350 anti spoofing config Jeff Kirsher
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Jeff Kirsher @ 2013-03-26 10:42 UTC (permalink / raw)
  To: davem; +Cc: xunleer, netdev, gospo, sassmann, Greg Rose, Jeff Kirsher

From: xunleer <xunleer.li@huawei.com>

When the ixgbevf driver is opened the request to allocate MSIX irq
vectors may fail.  In that case the driver will call ixgbevf_down()
which will call ixgbevf_irq_disable() to clear the HW interrupt
registers and calls synchronize_irq() using the msix_entries pointer in
the adapter structure.  However, when the function to request the MSIX
irq vectors failed it had already freed the msix_entries which causes
an OOPs from using the NULL pointer in synchronize_irq().

The calls to pci_disable_msix() and to free the msix_entries memory
should not occur if device open fails.  Instead they should be called
during device driver removal to balance with the call to
pci_enable_msix() and the call to allocate msix_entries memory
during the device probe and driver load.

Signed-off-by: Li Xun <xunleer.li@huawei.com>
Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 24 +++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index c3db6cd..2b6cb5c 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -944,9 +944,17 @@ free_queue_irqs:
 		free_irq(adapter->msix_entries[vector].vector,
 			 adapter->q_vector[vector]);
 	}
-	pci_disable_msix(adapter->pdev);
-	kfree(adapter->msix_entries);
-	adapter->msix_entries = NULL;
+	/* This failure is non-recoverable - it indicates the system is
+	 * out of MSIX vector resources and the VF driver cannot run
+	 * without them.  Set the number of msix vectors to zero
+	 * indicating that not enough can be allocated.  The error
+	 * will be returned to the user indicating device open failed.
+	 * Any further attempts to force the driver to open will also
+	 * fail.  The only way to recover is to unload the driver and
+	 * reload it again.  If the system has recovered some MSIX
+	 * vectors then it may succeed.
+	 */
+	adapter->num_msix_vectors = 0;
 	return err;
 }
 
@@ -2572,6 +2580,15 @@ static int ixgbevf_open(struct net_device *netdev)
 	struct ixgbe_hw *hw = &adapter->hw;
 	int err;
 
+	/* A previous failure to open the device because of a lack of
+	 * available MSIX vector resources may have reset the number
+	 * of msix vectors variable to zero.  The only way to recover
+	 * is to unload/reload the driver and hope that the system has
+	 * been able to recover some MSIX vector resources.
+	 */
+	if (!adapter->num_msix_vectors)
+		return -ENOMEM;
+
 	/* disallow open during test */
 	if (test_bit(__IXGBEVF_TESTING, &adapter->state))
 		return -EBUSY;
@@ -2628,7 +2645,6 @@ static int ixgbevf_open(struct net_device *netdev)
 
 err_req_irq:
 	ixgbevf_down(adapter);
-	ixgbevf_free_irq(adapter);
 err_setup_rx:
 	ixgbevf_free_all_rx_resources(adapter);
 err_setup_tx:
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [net 2/6] igb: fix i350 anti spoofing config
  2013-03-26 10:42 [net 0/6][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
  2013-03-26 10:42 ` [net 1/6] ixgbevf: don't release the soft entries Jeff Kirsher
@ 2013-03-26 10:42 ` Jeff Kirsher
  2013-03-26 10:42 ` [net 3/6] igb: Fix null pointer dereference Jeff Kirsher
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Jeff Kirsher @ 2013-03-26 10:42 UTC (permalink / raw)
  To: davem; +Cc: Lior Levy, netdev, gospo, sassmann, Jeff Kirsher

From: Lior Levy <lior.levy@intel.com>

Fix a problem in i350 where anti spoofing configuration was written into a
wrong register.

Signed-off-by: Lior Levy <lior.levy@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/igb/e1000_82575.c | 33 ++++++++++++++++------------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c
index b64542a..12b1d84 100644
--- a/drivers/net/ethernet/intel/igb/e1000_82575.c
+++ b/drivers/net/ethernet/intel/igb/e1000_82575.c
@@ -1818,27 +1818,32 @@ out:
  **/
 void igb_vmdq_set_anti_spoofing_pf(struct e1000_hw *hw, bool enable, int pf)
 {
-	u32 dtxswc;
+	u32 reg_val, reg_offset;
 
 	switch (hw->mac.type) {
 	case e1000_82576:
+		reg_offset = E1000_DTXSWC;
+		break;
 	case e1000_i350:
-		dtxswc = rd32(E1000_DTXSWC);
-		if (enable) {
-			dtxswc |= (E1000_DTXSWC_MAC_SPOOF_MASK |
-				   E1000_DTXSWC_VLAN_SPOOF_MASK);
-			/* The PF can spoof - it has to in order to
-			 * support emulation mode NICs */
-			dtxswc ^= (1 << pf | 1 << (pf + MAX_NUM_VFS));
-		} else {
-			dtxswc &= ~(E1000_DTXSWC_MAC_SPOOF_MASK |
-				    E1000_DTXSWC_VLAN_SPOOF_MASK);
-		}
-		wr32(E1000_DTXSWC, dtxswc);
+		reg_offset = E1000_TXSWC;
 		break;
 	default:
-		break;
+		return;
+	}
+
+	reg_val = rd32(reg_offset);
+	if (enable) {
+		reg_val |= (E1000_DTXSWC_MAC_SPOOF_MASK |
+			     E1000_DTXSWC_VLAN_SPOOF_MASK);
+		/* The PF can spoof - it has to in order to
+		 * support emulation mode NICs
+		 */
+		reg_val ^= (1 << pf | 1 << (pf + MAX_NUM_VFS));
+	} else {
+		reg_val &= ~(E1000_DTXSWC_MAC_SPOOF_MASK |
+			     E1000_DTXSWC_VLAN_SPOOF_MASK);
 	}
+	wr32(reg_offset, reg_val);
 }
 
 /**
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [net 3/6] igb: Fix null pointer dereference
  2013-03-26 10:42 [net 0/6][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
  2013-03-26 10:42 ` [net 1/6] ixgbevf: don't release the soft entries Jeff Kirsher
  2013-03-26 10:42 ` [net 2/6] igb: fix i350 anti spoofing config Jeff Kirsher
@ 2013-03-26 10:42 ` Jeff Kirsher
  2013-03-26 10:42 ` [net 4/6] igb: SR-IOV init reordering Jeff Kirsher
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Jeff Kirsher @ 2013-03-26 10:42 UTC (permalink / raw)
  To: davem; +Cc: Alex Williamson, netdev, gospo, sassmann, Jeff Kirsher

From: Alex Williamson <alex.williamson@redhat.com>

The max_vfs= option has always been self limiting to the number of VFs
supported by the device.  fa44f2f1 added SR-IOV configuration via
sysfs, but in the process broke this self correction factor.  The
failing path is:

igb_probe
  igb_sw_init
    if (max_vfs > 7) {
        adapter->vfs_allocated_count = 7;
    ...
    igb_probe_vfs
    igb_enable_sriov(, max_vfs)
      if (num_vfs > 7) {
        err = -EPERM;
        ...

This leaves vfs_allocated_count = 7 and vf_data = NULL, so we bomb out
when igb_probe finally calls igb_reset.  It seems like a really bad
idea, and somewhat pointless, to set vfs_allocated_count separate from
vf_data, but limiting max_vfs is enough to avoid the null pointer.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Acked-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/igb/igb_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 4dbd629..2ae8886 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -2652,7 +2652,7 @@ static int igb_sw_init(struct igb_adapter *adapter)
 		if (max_vfs > 7) {
 			dev_warn(&pdev->dev,
 				 "Maximum of 7 VFs per PF, using max\n");
-			adapter->vfs_allocated_count = 7;
+			max_vfs = adapter->vfs_allocated_count = 7;
 		} else
 			adapter->vfs_allocated_count = max_vfs;
 		if (adapter->vfs_allocated_count)
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [net 4/6] igb: SR-IOV init reordering
  2013-03-26 10:42 [net 0/6][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
                   ` (2 preceding siblings ...)
  2013-03-26 10:42 ` [net 3/6] igb: Fix null pointer dereference Jeff Kirsher
@ 2013-03-26 10:42 ` Jeff Kirsher
  2013-03-26 10:42 ` [net 5/6] igb: make sensor info static Jeff Kirsher
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Jeff Kirsher @ 2013-03-26 10:42 UTC (permalink / raw)
  To: davem; +Cc: Alex Williamson, netdev, gospo, sassmann, Jeff Kirsher

From: Alex Williamson <alex.williamson@redhat.com>

igb is ineffective at setting a lower total VFs because:

int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs)
{
        ...
        /* Shouldn't change if VFs already enabled */
        if (dev->sriov->ctrl & PCI_SRIOV_CTRL_VFE)
                return -EBUSY;

Swap init ordering.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Acked-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/igb/igb_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 2ae8886..8496adf 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -2542,8 +2542,8 @@ static void igb_probe_vfs(struct igb_adapter *adapter)
 	if ((hw->mac.type == e1000_i210) || (hw->mac.type == e1000_i211))
 		return;
 
-	igb_enable_sriov(pdev, max_vfs);
 	pci_sriov_set_totalvfs(pdev, 7);
+	igb_enable_sriov(pdev, max_vfs);
 
 #endif /* CONFIG_PCI_IOV */
 }
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [net 5/6] igb: make sensor info static
  2013-03-26 10:42 [net 0/6][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
                   ` (3 preceding siblings ...)
  2013-03-26 10:42 ` [net 4/6] igb: SR-IOV init reordering Jeff Kirsher
@ 2013-03-26 10:42 ` Jeff Kirsher
  2013-03-26 10:42 ` [net 6/6] igb: fix PHC stopping on max freq Jeff Kirsher
  2013-03-26 16:22 ` [net 0/6][pull request] Intel Wired LAN Driver Updates David Miller
  6 siblings, 0 replies; 8+ messages in thread
From: Jeff Kirsher @ 2013-03-26 10:42 UTC (permalink / raw)
  To: davem; +Cc: Stephen Hemminger, netdev, gospo, sassmann, Jeff Kirsher

From: Stephen Hemminger <stephen@networkplumber.org>

Trivial sparse warning.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/igb/igb_hwmon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_hwmon.c b/drivers/net/ethernet/intel/igb/igb_hwmon.c
index 4623502..0478a1a 100644
--- a/drivers/net/ethernet/intel/igb/igb_hwmon.c
+++ b/drivers/net/ethernet/intel/igb/igb_hwmon.c
@@ -39,7 +39,7 @@
 #include <linux/pci.h>
 
 #ifdef CONFIG_IGB_HWMON
-struct i2c_board_info i350_sensor_info = {
+static struct i2c_board_info i350_sensor_info = {
 	I2C_BOARD_INFO("i350bb", (0Xf8 >> 1)),
 };
 
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [net 6/6] igb: fix PHC stopping on max freq
  2013-03-26 10:42 [net 0/6][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
                   ` (4 preceding siblings ...)
  2013-03-26 10:42 ` [net 5/6] igb: make sensor info static Jeff Kirsher
@ 2013-03-26 10:42 ` Jeff Kirsher
  2013-03-26 16:22 ` [net 0/6][pull request] Intel Wired LAN Driver Updates David Miller
  6 siblings, 0 replies; 8+ messages in thread
From: Jeff Kirsher @ 2013-03-26 10:42 UTC (permalink / raw)
  To: davem; +Cc: Jiri Benc, netdev, gospo, sassmann, Jeff Kirsher

From: Jiri Benc <jbenc@redhat.com>

For 82576 MAC type, max_adj is reported as 1000000000 ppb. However, if
this value is passed to igb_ptp_adjfreq_82576, incvalue overflows out of
INCVALUE_82576_MASK, resulting in setting of zero TIMINCA.incvalue, stopping
the PHC (instead of going at twice the nominal speed).

Fix the advertised max_adj value to the largest value hardware can handle.
As there is no min_adj value available (-max_adj is used instead), this will
also prevent stopping the clock intentionally. It's probably not a big deal,
other igb MAC types don't support stopping the clock, either.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Matthew Vick <matthew.vick@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/igb/igb_ptp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
index 0987822..0a23750 100644
--- a/drivers/net/ethernet/intel/igb/igb_ptp.c
+++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
@@ -740,7 +740,7 @@ void igb_ptp_init(struct igb_adapter *adapter)
 	case e1000_82576:
 		snprintf(adapter->ptp_caps.name, 16, "%pm", netdev->dev_addr);
 		adapter->ptp_caps.owner = THIS_MODULE;
-		adapter->ptp_caps.max_adj = 1000000000;
+		adapter->ptp_caps.max_adj = 999999881;
 		adapter->ptp_caps.n_ext_ts = 0;
 		adapter->ptp_caps.pps = 0;
 		adapter->ptp_caps.adjfreq = igb_ptp_adjfreq_82576;
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [net 0/6][pull request] Intel Wired LAN Driver Updates
  2013-03-26 10:42 [net 0/6][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
                   ` (5 preceding siblings ...)
  2013-03-26 10:42 ` [net 6/6] igb: fix PHC stopping on max freq Jeff Kirsher
@ 2013-03-26 16:22 ` David Miller
  6 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2013-03-26 16:22 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: netdev, gospo, sassmann

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Tue, 26 Mar 2013 03:42:28 -0700

> This series contains updates to ixgbevf and igb.
> 
> The ixgbevf calls to pci_disable_msix() and to free the msix_entries
> memory should not occur if device open fails.  Instead they should be
> called during device driver removal to balance with the call to
> pci_enable_msix() and the call to allocate msix_entries memory
> during the device probe and driver load.
> 
> The remaining 4 of 5 igb patches are simple 1-3 line patches to fix
> several issues such as possible null pointer dereference, PHC stopping
> on max frequency, make sensor info static and SR-IOV initialization
> reordering.
> 
> The remaining igb patch to fix anti-spoofing config fixes a problem
> in i350 where anti spoofing configuration was written into a wrong
> register.
> 
> The following are changes since commit a79ca223e029aa4f09abb337accf1812c900a800:
>   ipv6: fix bad free of addrconf_init_net
> and are available in the git repository at:
>   git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net master

Pulled, thanks Jeff.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-03-26 16:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-26 10:42 [net 0/6][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2013-03-26 10:42 ` [net 1/6] ixgbevf: don't release the soft entries Jeff Kirsher
2013-03-26 10:42 ` [net 2/6] igb: fix i350 anti spoofing config Jeff Kirsher
2013-03-26 10:42 ` [net 3/6] igb: Fix null pointer dereference Jeff Kirsher
2013-03-26 10:42 ` [net 4/6] igb: SR-IOV init reordering Jeff Kirsher
2013-03-26 10:42 ` [net 5/6] igb: make sensor info static Jeff Kirsher
2013-03-26 10:42 ` [net 6/6] igb: fix PHC stopping on max freq Jeff Kirsher
2013-03-26 16:22 ` [net 0/6][pull request] Intel Wired LAN Driver Updates 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).