Commit 465c0a16 authored by David S. Miller's avatar David S. Miller

Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net

Jeff Kirsher says:

====================
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.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 76a0e681 75517d92
...@@ -1818,27 +1818,32 @@ static s32 igb_set_pcie_completion_timeout(struct e1000_hw *hw) ...@@ -1818,27 +1818,32 @@ static s32 igb_set_pcie_completion_timeout(struct e1000_hw *hw)
**/ **/
void igb_vmdq_set_anti_spoofing_pf(struct e1000_hw *hw, bool enable, int pf) 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) { switch (hw->mac.type) {
case e1000_82576: case e1000_82576:
reg_offset = E1000_DTXSWC;
break;
case e1000_i350: case e1000_i350:
dtxswc = rd32(E1000_DTXSWC); reg_offset = E1000_TXSWC;
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);
break; break;
default: 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);
} }
/** /**
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#include <linux/pci.h> #include <linux/pci.h>
#ifdef CONFIG_IGB_HWMON #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)), I2C_BOARD_INFO("i350bb", (0Xf8 >> 1)),
}; };
......
...@@ -2542,8 +2542,8 @@ static void igb_probe_vfs(struct igb_adapter *adapter) ...@@ -2542,8 +2542,8 @@ static void igb_probe_vfs(struct igb_adapter *adapter)
if ((hw->mac.type == e1000_i210) || (hw->mac.type == e1000_i211)) if ((hw->mac.type == e1000_i210) || (hw->mac.type == e1000_i211))
return; return;
igb_enable_sriov(pdev, max_vfs);
pci_sriov_set_totalvfs(pdev, 7); pci_sriov_set_totalvfs(pdev, 7);
igb_enable_sriov(pdev, max_vfs);
#endif /* CONFIG_PCI_IOV */ #endif /* CONFIG_PCI_IOV */
} }
...@@ -2652,7 +2652,7 @@ static int igb_sw_init(struct igb_adapter *adapter) ...@@ -2652,7 +2652,7 @@ static int igb_sw_init(struct igb_adapter *adapter)
if (max_vfs > 7) { if (max_vfs > 7) {
dev_warn(&pdev->dev, dev_warn(&pdev->dev,
"Maximum of 7 VFs per PF, using max\n"); "Maximum of 7 VFs per PF, using max\n");
adapter->vfs_allocated_count = 7; max_vfs = adapter->vfs_allocated_count = 7;
} else } else
adapter->vfs_allocated_count = max_vfs; adapter->vfs_allocated_count = max_vfs;
if (adapter->vfs_allocated_count) if (adapter->vfs_allocated_count)
......
...@@ -740,7 +740,7 @@ void igb_ptp_init(struct igb_adapter *adapter) ...@@ -740,7 +740,7 @@ void igb_ptp_init(struct igb_adapter *adapter)
case e1000_82576: case e1000_82576:
snprintf(adapter->ptp_caps.name, 16, "%pm", netdev->dev_addr); snprintf(adapter->ptp_caps.name, 16, "%pm", netdev->dev_addr);
adapter->ptp_caps.owner = THIS_MODULE; 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.n_ext_ts = 0;
adapter->ptp_caps.pps = 0; adapter->ptp_caps.pps = 0;
adapter->ptp_caps.adjfreq = igb_ptp_adjfreq_82576; adapter->ptp_caps.adjfreq = igb_ptp_adjfreq_82576;
......
...@@ -944,9 +944,17 @@ static int ixgbevf_request_msix_irqs(struct ixgbevf_adapter *adapter) ...@@ -944,9 +944,17 @@ static int ixgbevf_request_msix_irqs(struct ixgbevf_adapter *adapter)
free_irq(adapter->msix_entries[vector].vector, free_irq(adapter->msix_entries[vector].vector,
adapter->q_vector[vector]); adapter->q_vector[vector]);
} }
pci_disable_msix(adapter->pdev); /* This failure is non-recoverable - it indicates the system is
kfree(adapter->msix_entries); * out of MSIX vector resources and the VF driver cannot run
adapter->msix_entries = NULL; * 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; return err;
} }
...@@ -2572,6 +2580,15 @@ static int ixgbevf_open(struct net_device *netdev) ...@@ -2572,6 +2580,15 @@ static int ixgbevf_open(struct net_device *netdev)
struct ixgbe_hw *hw = &adapter->hw; struct ixgbe_hw *hw = &adapter->hw;
int err; 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 */ /* disallow open during test */
if (test_bit(__IXGBEVF_TESTING, &adapter->state)) if (test_bit(__IXGBEVF_TESTING, &adapter->state))
return -EBUSY; return -EBUSY;
...@@ -2628,7 +2645,6 @@ static int ixgbevf_open(struct net_device *netdev) ...@@ -2628,7 +2645,6 @@ static int ixgbevf_open(struct net_device *netdev)
err_req_irq: err_req_irq:
ixgbevf_down(adapter); ixgbevf_down(adapter);
ixgbevf_free_irq(adapter);
err_setup_rx: err_setup_rx:
ixgbevf_free_all_rx_resources(adapter); ixgbevf_free_all_rx_resources(adapter);
err_setup_tx: err_setup_tx:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment