diff options
author | David S. Miller <davem@davemloft.net> | 2013-03-26 12:21:31 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-03-26 12:21:31 -0400 |
commit | 465c0a165938992455357982d7f15ac105528b4a (patch) | |
tree | f8bc5541fdac060c36bc283f7e9d33068c668170 /drivers/net/ethernet | |
parent | 76a0e68129d7d24eb995a6871ab47081bbfa0acc (diff) | |
parent | 75517d92119a3cd364f618ee962055b3ded8c396 (diff) |
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: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r-- | drivers/net/ethernet/intel/igb/e1000_82575.c | 33 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/igb/igb_hwmon.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/igb/igb_main.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/igb/igb_ptp.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 24 |
5 files changed, 43 insertions, 22 deletions
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c index b64542acfa34..12b1d8480808 100644 --- a/drivers/net/ethernet/intel/igb/e1000_82575.c +++ b/drivers/net/ethernet/intel/igb/e1000_82575.c | |||
@@ -1818,27 +1818,32 @@ out: | |||
1818 | **/ | 1818 | **/ |
1819 | void igb_vmdq_set_anti_spoofing_pf(struct e1000_hw *hw, bool enable, int pf) | 1819 | void igb_vmdq_set_anti_spoofing_pf(struct e1000_hw *hw, bool enable, int pf) |
1820 | { | 1820 | { |
1821 | u32 dtxswc; | 1821 | u32 reg_val, reg_offset; |
1822 | 1822 | ||
1823 | switch (hw->mac.type) { | 1823 | switch (hw->mac.type) { |
1824 | case e1000_82576: | 1824 | case e1000_82576: |
1825 | reg_offset = E1000_DTXSWC; | ||
1826 | break; | ||
1825 | case e1000_i350: | 1827 | case e1000_i350: |
1826 | dtxswc = rd32(E1000_DTXSWC); | 1828 | reg_offset = E1000_TXSWC; |
1827 | if (enable) { | ||
1828 | dtxswc |= (E1000_DTXSWC_MAC_SPOOF_MASK | | ||
1829 | E1000_DTXSWC_VLAN_SPOOF_MASK); | ||
1830 | /* The PF can spoof - it has to in order to | ||
1831 | * support emulation mode NICs */ | ||
1832 | dtxswc ^= (1 << pf | 1 << (pf + MAX_NUM_VFS)); | ||
1833 | } else { | ||
1834 | dtxswc &= ~(E1000_DTXSWC_MAC_SPOOF_MASK | | ||
1835 | E1000_DTXSWC_VLAN_SPOOF_MASK); | ||
1836 | } | ||
1837 | wr32(E1000_DTXSWC, dtxswc); | ||
1838 | break; | 1829 | break; |
1839 | default: | 1830 | default: |
1840 | break; | 1831 | return; |
1832 | } | ||
1833 | |||
1834 | reg_val = rd32(reg_offset); | ||
1835 | if (enable) { | ||
1836 | reg_val |= (E1000_DTXSWC_MAC_SPOOF_MASK | | ||
1837 | E1000_DTXSWC_VLAN_SPOOF_MASK); | ||
1838 | /* The PF can spoof - it has to in order to | ||
1839 | * support emulation mode NICs | ||
1840 | */ | ||
1841 | reg_val ^= (1 << pf | 1 << (pf + MAX_NUM_VFS)); | ||
1842 | } else { | ||
1843 | reg_val &= ~(E1000_DTXSWC_MAC_SPOOF_MASK | | ||
1844 | E1000_DTXSWC_VLAN_SPOOF_MASK); | ||
1841 | } | 1845 | } |
1846 | wr32(reg_offset, reg_val); | ||
1842 | } | 1847 | } |
1843 | 1848 | ||
1844 | /** | 1849 | /** |
diff --git a/drivers/net/ethernet/intel/igb/igb_hwmon.c b/drivers/net/ethernet/intel/igb/igb_hwmon.c index 4623502054d5..0478a1abe541 100644 --- a/drivers/net/ethernet/intel/igb/igb_hwmon.c +++ b/drivers/net/ethernet/intel/igb/igb_hwmon.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #include <linux/pci.h> | 39 | #include <linux/pci.h> |
40 | 40 | ||
41 | #ifdef CONFIG_IGB_HWMON | 41 | #ifdef CONFIG_IGB_HWMON |
42 | struct i2c_board_info i350_sensor_info = { | 42 | static struct i2c_board_info i350_sensor_info = { |
43 | I2C_BOARD_INFO("i350bb", (0Xf8 >> 1)), | 43 | I2C_BOARD_INFO("i350bb", (0Xf8 >> 1)), |
44 | }; | 44 | }; |
45 | 45 | ||
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 4dbd62968c7a..8496adfc6a68 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) | |||
2542 | if ((hw->mac.type == e1000_i210) || (hw->mac.type == e1000_i211)) | 2542 | if ((hw->mac.type == e1000_i210) || (hw->mac.type == e1000_i211)) |
2543 | return; | 2543 | return; |
2544 | 2544 | ||
2545 | igb_enable_sriov(pdev, max_vfs); | ||
2546 | pci_sriov_set_totalvfs(pdev, 7); | 2545 | pci_sriov_set_totalvfs(pdev, 7); |
2546 | igb_enable_sriov(pdev, max_vfs); | ||
2547 | 2547 | ||
2548 | #endif /* CONFIG_PCI_IOV */ | 2548 | #endif /* CONFIG_PCI_IOV */ |
2549 | } | 2549 | } |
@@ -2652,7 +2652,7 @@ static int igb_sw_init(struct igb_adapter *adapter) | |||
2652 | if (max_vfs > 7) { | 2652 | if (max_vfs > 7) { |
2653 | dev_warn(&pdev->dev, | 2653 | dev_warn(&pdev->dev, |
2654 | "Maximum of 7 VFs per PF, using max\n"); | 2654 | "Maximum of 7 VFs per PF, using max\n"); |
2655 | adapter->vfs_allocated_count = 7; | 2655 | max_vfs = adapter->vfs_allocated_count = 7; |
2656 | } else | 2656 | } else |
2657 | adapter->vfs_allocated_count = max_vfs; | 2657 | adapter->vfs_allocated_count = max_vfs; |
2658 | if (adapter->vfs_allocated_count) | 2658 | if (adapter->vfs_allocated_count) |
diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c index 0987822359f0..0a237507ee85 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) | |||
740 | case e1000_82576: | 740 | case e1000_82576: |
741 | snprintf(adapter->ptp_caps.name, 16, "%pm", netdev->dev_addr); | 741 | snprintf(adapter->ptp_caps.name, 16, "%pm", netdev->dev_addr); |
742 | adapter->ptp_caps.owner = THIS_MODULE; | 742 | adapter->ptp_caps.owner = THIS_MODULE; |
743 | adapter->ptp_caps.max_adj = 1000000000; | 743 | adapter->ptp_caps.max_adj = 999999881; |
744 | adapter->ptp_caps.n_ext_ts = 0; | 744 | adapter->ptp_caps.n_ext_ts = 0; |
745 | adapter->ptp_caps.pps = 0; | 745 | adapter->ptp_caps.pps = 0; |
746 | adapter->ptp_caps.adjfreq = igb_ptp_adjfreq_82576; | 746 | adapter->ptp_caps.adjfreq = igb_ptp_adjfreq_82576; |
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index c3db6cd69b68..2b6cb5ca48ee 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: | |||
944 | free_irq(adapter->msix_entries[vector].vector, | 944 | free_irq(adapter->msix_entries[vector].vector, |
945 | adapter->q_vector[vector]); | 945 | adapter->q_vector[vector]); |
946 | } | 946 | } |
947 | pci_disable_msix(adapter->pdev); | 947 | /* This failure is non-recoverable - it indicates the system is |
948 | kfree(adapter->msix_entries); | 948 | * out of MSIX vector resources and the VF driver cannot run |
949 | adapter->msix_entries = NULL; | 949 | * without them. Set the number of msix vectors to zero |
950 | * indicating that not enough can be allocated. The error | ||
951 | * will be returned to the user indicating device open failed. | ||
952 | * Any further attempts to force the driver to open will also | ||
953 | * fail. The only way to recover is to unload the driver and | ||
954 | * reload it again. If the system has recovered some MSIX | ||
955 | * vectors then it may succeed. | ||
956 | */ | ||
957 | adapter->num_msix_vectors = 0; | ||
950 | return err; | 958 | return err; |
951 | } | 959 | } |
952 | 960 | ||
@@ -2572,6 +2580,15 @@ static int ixgbevf_open(struct net_device *netdev) | |||
2572 | struct ixgbe_hw *hw = &adapter->hw; | 2580 | struct ixgbe_hw *hw = &adapter->hw; |
2573 | int err; | 2581 | int err; |
2574 | 2582 | ||
2583 | /* A previous failure to open the device because of a lack of | ||
2584 | * available MSIX vector resources may have reset the number | ||
2585 | * of msix vectors variable to zero. The only way to recover | ||
2586 | * is to unload/reload the driver and hope that the system has | ||
2587 | * been able to recover some MSIX vector resources. | ||
2588 | */ | ||
2589 | if (!adapter->num_msix_vectors) | ||
2590 | return -ENOMEM; | ||
2591 | |||
2575 | /* disallow open during test */ | 2592 | /* disallow open during test */ |
2576 | if (test_bit(__IXGBEVF_TESTING, &adapter->state)) | 2593 | if (test_bit(__IXGBEVF_TESTING, &adapter->state)) |
2577 | return -EBUSY; | 2594 | return -EBUSY; |
@@ -2628,7 +2645,6 @@ static int ixgbevf_open(struct net_device *netdev) | |||
2628 | 2645 | ||
2629 | err_req_irq: | 2646 | err_req_irq: |
2630 | ixgbevf_down(adapter); | 2647 | ixgbevf_down(adapter); |
2631 | ixgbevf_free_irq(adapter); | ||
2632 | err_setup_rx: | 2648 | err_setup_rx: |
2633 | ixgbevf_free_all_rx_resources(adapter); | 2649 | ixgbevf_free_all_rx_resources(adapter); |
2634 | err_setup_tx: | 2650 | err_setup_tx: |