diff options
author | Carolyn Wyborny <carolyn.wyborny@intel.com> | 2012-04-06 19:25:19 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2012-05-12 16:17:13 -0400 |
commit | f96a8a0b78548c0ec06b0b4b438db6ee895d67e9 (patch) | |
tree | b1e6cc64dd55fc46cfb8877aa94db6a7940c1327 /drivers/net/ethernet/intel/igb/igb_main.c | |
parent | da02cde1c1ffb798df6159a2252653a9becea51a (diff) |
igb: Add Support for new i210/i211 devices.
This patch adds new initialization functions and device support
for i210 and i211 devices.
Signed-off-by: Carolyn Wyborny <carolyn.wyborny@intel.com>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/igb/igb_main.c')
-rw-r--r-- | drivers/net/ethernet/intel/igb/igb_main.c | 107 |
1 files changed, 81 insertions, 26 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 80d52d2dfea3..ba21f9c72a21 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -75,6 +75,11 @@ static const struct e1000_info *igb_info_tbl[] = { | |||
75 | }; | 75 | }; |
76 | 76 | ||
77 | static DEFINE_PCI_DEVICE_TABLE(igb_pci_tbl) = { | 77 | static DEFINE_PCI_DEVICE_TABLE(igb_pci_tbl) = { |
78 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_I211_COPPER), board_82575 }, | ||
79 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_I210_COPPER), board_82575 }, | ||
80 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_I210_FIBER), board_82575 }, | ||
81 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_I210_SERDES), board_82575 }, | ||
82 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_I210_SGMII), board_82575 }, | ||
78 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_I350_COPPER), board_82575 }, | 83 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_I350_COPPER), board_82575 }, |
79 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_I350_FIBER), board_82575 }, | 84 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_I350_FIBER), board_82575 }, |
80 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_I350_SERDES), board_82575 }, | 85 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_I350_SERDES), board_82575 }, |
@@ -641,6 +646,8 @@ static void igb_cache_ring_register(struct igb_adapter *adapter) | |||
641 | case e1000_82575: | 646 | case e1000_82575: |
642 | case e1000_82580: | 647 | case e1000_82580: |
643 | case e1000_i350: | 648 | case e1000_i350: |
649 | case e1000_i210: | ||
650 | case e1000_i211: | ||
644 | default: | 651 | default: |
645 | for (; i < adapter->num_rx_queues; i++) | 652 | for (; i < adapter->num_rx_queues; i++) |
646 | adapter->rx_ring[i]->reg_idx = rbase_offset + i; | 653 | adapter->rx_ring[i]->reg_idx = rbase_offset + i; |
@@ -727,8 +734,11 @@ static int igb_alloc_queues(struct igb_adapter *adapter) | |||
727 | if (adapter->hw.mac.type >= e1000_82576) | 734 | if (adapter->hw.mac.type >= e1000_82576) |
728 | set_bit(IGB_RING_FLAG_RX_SCTP_CSUM, &ring->flags); | 735 | set_bit(IGB_RING_FLAG_RX_SCTP_CSUM, &ring->flags); |
729 | 736 | ||
730 | /* On i350, loopback VLAN packets have the tag byte-swapped. */ | 737 | /* |
731 | if (adapter->hw.mac.type == e1000_i350) | 738 | * On i350, i210, and i211, loopback VLAN packets |
739 | * have the tag byte-swapped. | ||
740 | * */ | ||
741 | if (adapter->hw.mac.type >= e1000_i350) | ||
732 | set_bit(IGB_RING_FLAG_RX_LB_VLAN_BSWAP, &ring->flags); | 742 | set_bit(IGB_RING_FLAG_RX_LB_VLAN_BSWAP, &ring->flags); |
733 | 743 | ||
734 | adapter->rx_ring[i] = ring; | 744 | adapter->rx_ring[i] = ring; |
@@ -822,6 +832,8 @@ static void igb_assign_vector(struct igb_q_vector *q_vector, int msix_vector) | |||
822 | break; | 832 | break; |
823 | case e1000_82580: | 833 | case e1000_82580: |
824 | case e1000_i350: | 834 | case e1000_i350: |
835 | case e1000_i210: | ||
836 | case e1000_i211: | ||
825 | /* | 837 | /* |
826 | * On 82580 and newer adapters the scheme is similar to 82576 | 838 | * On 82580 and newer adapters the scheme is similar to 82576 |
827 | * however instead of ordering column-major we have things | 839 | * however instead of ordering column-major we have things |
@@ -888,6 +900,8 @@ static void igb_configure_msix(struct igb_adapter *adapter) | |||
888 | case e1000_82576: | 900 | case e1000_82576: |
889 | case e1000_82580: | 901 | case e1000_82580: |
890 | case e1000_i350: | 902 | case e1000_i350: |
903 | case e1000_i210: | ||
904 | case e1000_i211: | ||
891 | /* Turn on MSI-X capability first, or our settings | 905 | /* Turn on MSI-X capability first, or our settings |
892 | * won't stick. And it will take days to debug. */ | 906 | * won't stick. And it will take days to debug. */ |
893 | wr32(E1000_GPIE, E1000_GPIE_MSIX_MODE | | 907 | wr32(E1000_GPIE, E1000_GPIE_MSIX_MODE | |
@@ -1034,6 +1048,11 @@ static int igb_set_interrupt_capability(struct igb_adapter *adapter) | |||
1034 | if (!(adapter->flags & IGB_FLAG_QUEUE_PAIRS)) | 1048 | if (!(adapter->flags & IGB_FLAG_QUEUE_PAIRS)) |
1035 | numvecs += adapter->num_tx_queues; | 1049 | numvecs += adapter->num_tx_queues; |
1036 | 1050 | ||
1051 | /* i210 and i211 can only have 4 MSIX vectors for rx/tx queues. */ | ||
1052 | if ((adapter->hw.mac.type == e1000_i210) | ||
1053 | || (adapter->hw.mac.type == e1000_i211)) | ||
1054 | numvecs = 4; | ||
1055 | |||
1037 | /* store the number of vectors reserved for queues */ | 1056 | /* store the number of vectors reserved for queues */ |
1038 | adapter->num_q_vectors = numvecs; | 1057 | adapter->num_q_vectors = numvecs; |
1039 | 1058 | ||
@@ -1041,6 +1060,7 @@ static int igb_set_interrupt_capability(struct igb_adapter *adapter) | |||
1041 | numvecs++; | 1060 | numvecs++; |
1042 | adapter->msix_entries = kcalloc(numvecs, sizeof(struct msix_entry), | 1061 | adapter->msix_entries = kcalloc(numvecs, sizeof(struct msix_entry), |
1043 | GFP_KERNEL); | 1062 | GFP_KERNEL); |
1063 | |||
1044 | if (!adapter->msix_entries) | 1064 | if (!adapter->msix_entries) |
1045 | goto msi_only; | 1065 | goto msi_only; |
1046 | 1066 | ||
@@ -1631,6 +1651,8 @@ void igb_reset(struct igb_adapter *adapter) | |||
1631 | pba &= E1000_RXPBS_SIZE_MASK_82576; | 1651 | pba &= E1000_RXPBS_SIZE_MASK_82576; |
1632 | break; | 1652 | break; |
1633 | case e1000_82575: | 1653 | case e1000_82575: |
1654 | case e1000_i210: | ||
1655 | case e1000_i211: | ||
1634 | default: | 1656 | default: |
1635 | pba = E1000_PBA_34K; | 1657 | pba = E1000_PBA_34K; |
1636 | break; | 1658 | break; |
@@ -1826,7 +1848,7 @@ static int __devinit igb_probe(struct pci_dev *pdev, | |||
1826 | */ | 1848 | */ |
1827 | if (pdev->is_virtfn) { | 1849 | if (pdev->is_virtfn) { |
1828 | WARN(1, KERN_ERR "%s (%hx:%hx) should not be a VF!\n", | 1850 | WARN(1, KERN_ERR "%s (%hx:%hx) should not be a VF!\n", |
1829 | pci_name(pdev), pdev->vendor, pdev->device); | 1851 | pci_name(pdev), pdev->vendor, pdev->device); |
1830 | return -EINVAL; | 1852 | return -EINVAL; |
1831 | } | 1853 | } |
1832 | 1854 | ||
@@ -1980,11 +2002,16 @@ static int __devinit igb_probe(struct pci_dev *pdev, | |||
1980 | * known good starting state */ | 2002 | * known good starting state */ |
1981 | hw->mac.ops.reset_hw(hw); | 2003 | hw->mac.ops.reset_hw(hw); |
1982 | 2004 | ||
1983 | /* make sure the NVM is good */ | 2005 | /* |
1984 | if (hw->nvm.ops.validate(hw) < 0) { | 2006 | * make sure the NVM is good , i211 parts have special NVM that |
1985 | dev_err(&pdev->dev, "The NVM Checksum Is Not Valid\n"); | 2007 | * doesn't contain a checksum |
1986 | err = -EIO; | 2008 | */ |
1987 | goto err_eeprom; | 2009 | if (hw->mac.type != e1000_i211) { |
2010 | if (hw->nvm.ops.validate(hw) < 0) { | ||
2011 | dev_err(&pdev->dev, "The NVM Checksum Is Not Valid\n"); | ||
2012 | err = -EIO; | ||
2013 | goto err_eeprom; | ||
2014 | } | ||
1988 | } | 2015 | } |
1989 | 2016 | ||
1990 | /* copy the MAC address out of the NVM */ | 2017 | /* copy the MAC address out of the NVM */ |
@@ -2118,6 +2145,8 @@ static int __devinit igb_probe(struct pci_dev *pdev, | |||
2118 | adapter->num_rx_queues, adapter->num_tx_queues); | 2145 | adapter->num_rx_queues, adapter->num_tx_queues); |
2119 | switch (hw->mac.type) { | 2146 | switch (hw->mac.type) { |
2120 | case e1000_i350: | 2147 | case e1000_i350: |
2148 | case e1000_i210: | ||
2149 | case e1000_i211: | ||
2121 | igb_set_eee_i350(hw); | 2150 | igb_set_eee_i350(hw); |
2122 | break; | 2151 | break; |
2123 | default: | 2152 | default: |
@@ -2244,9 +2273,14 @@ static void __devinit igb_probe_vfs(struct igb_adapter * adapter) | |||
2244 | { | 2273 | { |
2245 | #ifdef CONFIG_PCI_IOV | 2274 | #ifdef CONFIG_PCI_IOV |
2246 | struct pci_dev *pdev = adapter->pdev; | 2275 | struct pci_dev *pdev = adapter->pdev; |
2276 | struct e1000_hw *hw = &adapter->hw; | ||
2247 | int old_vfs = igb_find_enabled_vfs(adapter); | 2277 | int old_vfs = igb_find_enabled_vfs(adapter); |
2248 | int i; | 2278 | int i; |
2249 | 2279 | ||
2280 | /* Virtualization features not supported on i210 family. */ | ||
2281 | if ((hw->mac.type == e1000_i210) || (hw->mac.type == e1000_i211)) | ||
2282 | return; | ||
2283 | |||
2250 | if (old_vfs) { | 2284 | if (old_vfs) { |
2251 | dev_info(&pdev->dev, "%d pre-allocated VFs found - override " | 2285 | dev_info(&pdev->dev, "%d pre-allocated VFs found - override " |
2252 | "max_vfs setting of %d\n", old_vfs, max_vfs); | 2286 | "max_vfs setting of %d\n", old_vfs, max_vfs); |
@@ -2258,6 +2292,7 @@ static void __devinit igb_probe_vfs(struct igb_adapter * adapter) | |||
2258 | 2292 | ||
2259 | adapter->vf_data = kcalloc(adapter->vfs_allocated_count, | 2293 | adapter->vf_data = kcalloc(adapter->vfs_allocated_count, |
2260 | sizeof(struct vf_data_storage), GFP_KERNEL); | 2294 | sizeof(struct vf_data_storage), GFP_KERNEL); |
2295 | |||
2261 | /* if allocation failed then we do not support SR-IOV */ | 2296 | /* if allocation failed then we do not support SR-IOV */ |
2262 | if (!adapter->vf_data) { | 2297 | if (!adapter->vf_data) { |
2263 | adapter->vfs_allocated_count = 0; | 2298 | adapter->vfs_allocated_count = 0; |
@@ -2332,11 +2367,28 @@ static int __devinit igb_sw_init(struct igb_adapter *adapter) | |||
2332 | } else | 2367 | } else |
2333 | adapter->vfs_allocated_count = max_vfs; | 2368 | adapter->vfs_allocated_count = max_vfs; |
2334 | break; | 2369 | break; |
2370 | case e1000_i210: | ||
2371 | case e1000_i211: | ||
2372 | adapter->vfs_allocated_count = 0; | ||
2373 | break; | ||
2335 | default: | 2374 | default: |
2336 | break; | 2375 | break; |
2337 | } | 2376 | } |
2338 | #endif /* CONFIG_PCI_IOV */ | 2377 | #endif /* CONFIG_PCI_IOV */ |
2339 | adapter->rss_queues = min_t(u32, IGB_MAX_RX_QUEUES, num_online_cpus()); | 2378 | switch (hw->mac.type) { |
2379 | case e1000_i210: | ||
2380 | adapter->rss_queues = min_t(u32, IGB_MAX_RX_QUEUES_I210, | ||
2381 | num_online_cpus()); | ||
2382 | break; | ||
2383 | case e1000_i211: | ||
2384 | adapter->rss_queues = min_t(u32, IGB_MAX_RX_QUEUES_I211, | ||
2385 | num_online_cpus()); | ||
2386 | break; | ||
2387 | default: | ||
2388 | adapter->rss_queues = min_t(u32, IGB_MAX_RX_QUEUES, | ||
2389 | num_online_cpus()); | ||
2390 | break; | ||
2391 | } | ||
2340 | /* i350 cannot do RSS and SR-IOV at the same time */ | 2392 | /* i350 cannot do RSS and SR-IOV at the same time */ |
2341 | if (hw->mac.type == e1000_i350 && adapter->vfs_allocated_count) | 2393 | if (hw->mac.type == e1000_i350 && adapter->vfs_allocated_count) |
2342 | adapter->rss_queues = 1; | 2394 | adapter->rss_queues = 1; |
@@ -2366,7 +2418,7 @@ static int __devinit igb_sw_init(struct igb_adapter *adapter) | |||
2366 | /* Explicitly disable IRQ since the NIC can be in any state. */ | 2418 | /* Explicitly disable IRQ since the NIC can be in any state. */ |
2367 | igb_irq_disable(adapter); | 2419 | igb_irq_disable(adapter); |
2368 | 2420 | ||
2369 | if (hw->mac.type == e1000_i350) | 2421 | if (hw->mac.type >= e1000_i350) |
2370 | adapter->flags &= ~IGB_FLAG_DMAC; | 2422 | adapter->flags &= ~IGB_FLAG_DMAC; |
2371 | 2423 | ||
2372 | set_bit(__IGB_DOWN, &adapter->state); | 2424 | set_bit(__IGB_DOWN, &adapter->state); |
@@ -2819,6 +2871,17 @@ static void igb_setup_mrqc(struct igb_adapter *adapter) | |||
2819 | 2871 | ||
2820 | /* Don't need to set TUOFL or IPOFL, they default to 1 */ | 2872 | /* Don't need to set TUOFL or IPOFL, they default to 1 */ |
2821 | wr32(E1000_RXCSUM, rxcsum); | 2873 | wr32(E1000_RXCSUM, rxcsum); |
2874 | /* | ||
2875 | * Generate RSS hash based on TCP port numbers and/or | ||
2876 | * IPv4/v6 src and dst addresses since UDP cannot be | ||
2877 | * hashed reliably due to IP fragmentation | ||
2878 | */ | ||
2879 | |||
2880 | mrqc = E1000_MRQC_RSS_FIELD_IPV4 | | ||
2881 | E1000_MRQC_RSS_FIELD_IPV4_TCP | | ||
2882 | E1000_MRQC_RSS_FIELD_IPV6 | | ||
2883 | E1000_MRQC_RSS_FIELD_IPV6_TCP | | ||
2884 | E1000_MRQC_RSS_FIELD_IPV6_TCP_EX; | ||
2822 | 2885 | ||
2823 | /* If VMDq is enabled then we set the appropriate mode for that, else | 2886 | /* If VMDq is enabled then we set the appropriate mode for that, else |
2824 | * we default to RSS so that an RSS hash is calculated per packet even | 2887 | * we default to RSS so that an RSS hash is calculated per packet even |
@@ -2834,25 +2897,15 @@ static void igb_setup_mrqc(struct igb_adapter *adapter) | |||
2834 | wr32(E1000_VT_CTL, vtctl); | 2897 | wr32(E1000_VT_CTL, vtctl); |
2835 | } | 2898 | } |
2836 | if (adapter->rss_queues > 1) | 2899 | if (adapter->rss_queues > 1) |
2837 | mrqc = E1000_MRQC_ENABLE_VMDQ_RSS_2Q; | 2900 | mrqc |= E1000_MRQC_ENABLE_VMDQ_RSS_2Q; |
2838 | else | 2901 | else |
2839 | mrqc = E1000_MRQC_ENABLE_VMDQ; | 2902 | mrqc |= E1000_MRQC_ENABLE_VMDQ; |
2840 | } else { | 2903 | } else { |
2841 | mrqc = E1000_MRQC_ENABLE_RSS_4Q; | 2904 | if (hw->mac.type != e1000_i211) |
2905 | mrqc |= E1000_MRQC_ENABLE_RSS_4Q; | ||
2842 | } | 2906 | } |
2843 | igb_vmm_control(adapter); | 2907 | igb_vmm_control(adapter); |
2844 | 2908 | ||
2845 | /* | ||
2846 | * Generate RSS hash based on TCP port numbers and/or | ||
2847 | * IPv4/v6 src and dst addresses since UDP cannot be | ||
2848 | * hashed reliably due to IP fragmentation | ||
2849 | */ | ||
2850 | mrqc |= E1000_MRQC_RSS_FIELD_IPV4 | | ||
2851 | E1000_MRQC_RSS_FIELD_IPV4_TCP | | ||
2852 | E1000_MRQC_RSS_FIELD_IPV6 | | ||
2853 | E1000_MRQC_RSS_FIELD_IPV6_TCP | | ||
2854 | E1000_MRQC_RSS_FIELD_IPV6_TCP_EX; | ||
2855 | |||
2856 | wr32(E1000_MRQC, mrqc); | 2909 | wr32(E1000_MRQC, mrqc); |
2857 | } | 2910 | } |
2858 | 2911 | ||
@@ -3454,7 +3507,7 @@ static void igb_set_rx_mode(struct net_device *netdev) | |||
3454 | * we will have issues with VLAN tag stripping not being done for frames | 3507 | * we will have issues with VLAN tag stripping not being done for frames |
3455 | * that are only arriving because we are the default pool | 3508 | * that are only arriving because we are the default pool |
3456 | */ | 3509 | */ |
3457 | if (hw->mac.type < e1000_82576) | 3510 | if ((hw->mac.type < e1000_82576) || (hw->mac.type > e1000_i350)) |
3458 | return; | 3511 | return; |
3459 | 3512 | ||
3460 | vmolr |= rd32(E1000_VMOLR(vfn)) & | 3513 | vmolr |= rd32(E1000_VMOLR(vfn)) & |
@@ -3551,7 +3604,7 @@ static bool igb_thermal_sensor_event(struct e1000_hw *hw, u32 event) | |||
3551 | bool ret = false; | 3604 | bool ret = false; |
3552 | u32 ctrl_ext, thstat; | 3605 | u32 ctrl_ext, thstat; |
3553 | 3606 | ||
3554 | /* check for thermal sensor event on i350, copper only */ | 3607 | /* check for thermal sensor event on i350 copper only */ |
3555 | if (hw->mac.type == e1000_i350) { | 3608 | if (hw->mac.type == e1000_i350) { |
3556 | thstat = rd32(E1000_THSTAT); | 3609 | thstat = rd32(E1000_THSTAT); |
3557 | ctrl_ext = rd32(E1000_CTRL_EXT); | 3610 | ctrl_ext = rd32(E1000_CTRL_EXT); |
@@ -7027,6 +7080,8 @@ static void igb_vmm_control(struct igb_adapter *adapter) | |||
7027 | 7080 | ||
7028 | switch (hw->mac.type) { | 7081 | switch (hw->mac.type) { |
7029 | case e1000_82575: | 7082 | case e1000_82575: |
7083 | case e1000_i210: | ||
7084 | case e1000_i211: | ||
7030 | default: | 7085 | default: |
7031 | /* replication is not supported for 82575 */ | 7086 | /* replication is not supported for 82575 */ |
7032 | return; | 7087 | return; |