diff options
Diffstat (limited to 'drivers/net/e1000e')
-rw-r--r-- | drivers/net/e1000e/82571.c | 24 | ||||
-rw-r--r-- | drivers/net/e1000e/defines.h | 2 | ||||
-rw-r--r-- | drivers/net/e1000e/e1000.h | 7 | ||||
-rw-r--r-- | drivers/net/e1000e/ethtool.c | 39 | ||||
-rw-r--r-- | drivers/net/e1000e/ich8lan.c | 30 | ||||
-rw-r--r-- | drivers/net/e1000e/netdev.c | 627 | ||||
-rw-r--r-- | drivers/net/e1000e/param.c | 5 |
7 files changed, 581 insertions, 153 deletions
diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c index 4b0016d69530..1e73eddee24a 100644 --- a/drivers/net/e1000e/82571.c +++ b/drivers/net/e1000e/82571.c | |||
@@ -336,7 +336,6 @@ static s32 e1000_get_variants_82571(struct e1000_adapter *adapter) | |||
336 | struct e1000_hw *hw = &adapter->hw; | 336 | struct e1000_hw *hw = &adapter->hw; |
337 | static int global_quad_port_a; /* global port a indication */ | 337 | static int global_quad_port_a; /* global port a indication */ |
338 | struct pci_dev *pdev = adapter->pdev; | 338 | struct pci_dev *pdev = adapter->pdev; |
339 | u16 eeprom_data = 0; | ||
340 | int is_port_b = er32(STATUS) & E1000_STATUS_FUNC_1; | 339 | int is_port_b = er32(STATUS) & E1000_STATUS_FUNC_1; |
341 | s32 rc; | 340 | s32 rc; |
342 | 341 | ||
@@ -387,16 +386,15 @@ static s32 e1000_get_variants_82571(struct e1000_adapter *adapter) | |||
387 | if (pdev->device == E1000_DEV_ID_82571EB_SERDES_QUAD) | 386 | if (pdev->device == E1000_DEV_ID_82571EB_SERDES_QUAD) |
388 | adapter->flags &= ~FLAG_HAS_WOL; | 387 | adapter->flags &= ~FLAG_HAS_WOL; |
389 | break; | 388 | break; |
390 | |||
391 | case e1000_82573: | 389 | case e1000_82573: |
390 | case e1000_82574: | ||
391 | case e1000_82583: | ||
392 | /* Disable ASPM L0s due to hardware errata */ | ||
393 | e1000e_disable_aspm(adapter->pdev, PCIE_LINK_STATE_L0S); | ||
394 | |||
392 | if (pdev->device == E1000_DEV_ID_82573L) { | 395 | if (pdev->device == E1000_DEV_ID_82573L) { |
393 | if (e1000_read_nvm(&adapter->hw, NVM_INIT_3GIO_3, 1, | 396 | adapter->flags |= FLAG_HAS_JUMBO_FRAMES; |
394 | &eeprom_data) < 0) | 397 | adapter->max_hw_frame_size = DEFAULT_JUMBO; |
395 | break; | ||
396 | if (!(eeprom_data & NVM_WORD1A_ASPM_MASK)) { | ||
397 | adapter->flags |= FLAG_HAS_JUMBO_FRAMES; | ||
398 | adapter->max_hw_frame_size = DEFAULT_JUMBO; | ||
399 | } | ||
400 | } | 398 | } |
401 | break; | 399 | break; |
402 | default: | 400 | default: |
@@ -1792,6 +1790,7 @@ struct e1000_info e1000_82571_info = { | |||
1792 | | FLAG_RESET_OVERWRITES_LAA /* errata */ | 1790 | | FLAG_RESET_OVERWRITES_LAA /* errata */ |
1793 | | FLAG_TARC_SPEED_MODE_BIT /* errata */ | 1791 | | FLAG_TARC_SPEED_MODE_BIT /* errata */ |
1794 | | FLAG_APME_CHECK_PORT_B, | 1792 | | FLAG_APME_CHECK_PORT_B, |
1793 | .flags2 = FLAG2_DISABLE_ASPM_L1, /* errata 13 */ | ||
1795 | .pba = 38, | 1794 | .pba = 38, |
1796 | .max_hw_frame_size = DEFAULT_JUMBO, | 1795 | .max_hw_frame_size = DEFAULT_JUMBO, |
1797 | .get_variants = e1000_get_variants_82571, | 1796 | .get_variants = e1000_get_variants_82571, |
@@ -1809,6 +1808,7 @@ struct e1000_info e1000_82572_info = { | |||
1809 | | FLAG_RX_CSUM_ENABLED | 1808 | | FLAG_RX_CSUM_ENABLED |
1810 | | FLAG_HAS_CTRLEXT_ON_LOAD | 1809 | | FLAG_HAS_CTRLEXT_ON_LOAD |
1811 | | FLAG_TARC_SPEED_MODE_BIT, /* errata */ | 1810 | | FLAG_TARC_SPEED_MODE_BIT, /* errata */ |
1811 | .flags2 = FLAG2_DISABLE_ASPM_L1, /* errata 13 */ | ||
1812 | .pba = 38, | 1812 | .pba = 38, |
1813 | .max_hw_frame_size = DEFAULT_JUMBO, | 1813 | .max_hw_frame_size = DEFAULT_JUMBO, |
1814 | .get_variants = e1000_get_variants_82571, | 1814 | .get_variants = e1000_get_variants_82571, |
@@ -1820,13 +1820,11 @@ struct e1000_info e1000_82572_info = { | |||
1820 | struct e1000_info e1000_82573_info = { | 1820 | struct e1000_info e1000_82573_info = { |
1821 | .mac = e1000_82573, | 1821 | .mac = e1000_82573, |
1822 | .flags = FLAG_HAS_HW_VLAN_FILTER | 1822 | .flags = FLAG_HAS_HW_VLAN_FILTER |
1823 | | FLAG_HAS_JUMBO_FRAMES | ||
1824 | | FLAG_HAS_WOL | 1823 | | FLAG_HAS_WOL |
1825 | | FLAG_APME_IN_CTRL3 | 1824 | | FLAG_APME_IN_CTRL3 |
1826 | | FLAG_RX_CSUM_ENABLED | 1825 | | FLAG_RX_CSUM_ENABLED |
1827 | | FLAG_HAS_SMART_POWER_DOWN | 1826 | | FLAG_HAS_SMART_POWER_DOWN |
1828 | | FLAG_HAS_AMT | 1827 | | FLAG_HAS_AMT |
1829 | | FLAG_HAS_ERT | ||
1830 | | FLAG_HAS_SWSM_ON_LOAD, | 1828 | | FLAG_HAS_SWSM_ON_LOAD, |
1831 | .pba = 20, | 1829 | .pba = 20, |
1832 | .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN, | 1830 | .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN, |
@@ -1847,7 +1845,7 @@ struct e1000_info e1000_82574_info = { | |||
1847 | | FLAG_HAS_SMART_POWER_DOWN | 1845 | | FLAG_HAS_SMART_POWER_DOWN |
1848 | | FLAG_HAS_AMT | 1846 | | FLAG_HAS_AMT |
1849 | | FLAG_HAS_CTRLEXT_ON_LOAD, | 1847 | | FLAG_HAS_CTRLEXT_ON_LOAD, |
1850 | .pba = 20, | 1848 | .pba = 36, |
1851 | .max_hw_frame_size = DEFAULT_JUMBO, | 1849 | .max_hw_frame_size = DEFAULT_JUMBO, |
1852 | .get_variants = e1000_get_variants_82571, | 1850 | .get_variants = e1000_get_variants_82571, |
1853 | .mac_ops = &e82571_mac_ops, | 1851 | .mac_ops = &e82571_mac_ops, |
@@ -1864,7 +1862,7 @@ struct e1000_info e1000_82583_info = { | |||
1864 | | FLAG_HAS_SMART_POWER_DOWN | 1862 | | FLAG_HAS_SMART_POWER_DOWN |
1865 | | FLAG_HAS_AMT | 1863 | | FLAG_HAS_AMT |
1866 | | FLAG_HAS_CTRLEXT_ON_LOAD, | 1864 | | FLAG_HAS_CTRLEXT_ON_LOAD, |
1867 | .pba = 20, | 1865 | .pba = 36, |
1868 | .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN, | 1866 | .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN, |
1869 | .get_variants = e1000_get_variants_82571, | 1867 | .get_variants = e1000_get_variants_82571, |
1870 | .mac_ops = &e82571_mac_ops, | 1868 | .mac_ops = &e82571_mac_ops, |
diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h index e301e26d6897..7f760aa9efe5 100644 --- a/drivers/net/e1000e/defines.h +++ b/drivers/net/e1000e/defines.h | |||
@@ -214,6 +214,8 @@ | |||
214 | #define E1000_CTRL_SPD_1000 0x00000200 /* Force 1Gb */ | 214 | #define E1000_CTRL_SPD_1000 0x00000200 /* Force 1Gb */ |
215 | #define E1000_CTRL_FRCSPD 0x00000800 /* Force Speed */ | 215 | #define E1000_CTRL_FRCSPD 0x00000800 /* Force Speed */ |
216 | #define E1000_CTRL_FRCDPX 0x00001000 /* Force Duplex */ | 216 | #define E1000_CTRL_FRCDPX 0x00001000 /* Force Duplex */ |
217 | #define E1000_CTRL_LANPHYPC_OVERRIDE 0x00010000 /* SW control of LANPHYPC */ | ||
218 | #define E1000_CTRL_LANPHYPC_VALUE 0x00020000 /* SW value of LANPHYPC */ | ||
217 | #define E1000_CTRL_SWDPIN0 0x00040000 /* SWDPIN 0 value */ | 219 | #define E1000_CTRL_SWDPIN0 0x00040000 /* SWDPIN 0 value */ |
218 | #define E1000_CTRL_SWDPIN1 0x00080000 /* SWDPIN 1 value */ | 220 | #define E1000_CTRL_SWDPIN1 0x00080000 /* SWDPIN 1 value */ |
219 | #define E1000_CTRL_SWDPIO0 0x00400000 /* SWDPIN 0 Input or output */ | 221 | #define E1000_CTRL_SWDPIO0 0x00400000 /* SWDPIN 0 Input or output */ |
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index 12648a1cdb78..c0b3db40bd73 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/io.h> | 37 | #include <linux/io.h> |
38 | #include <linux/netdevice.h> | 38 | #include <linux/netdevice.h> |
39 | #include <linux/pci.h> | 39 | #include <linux/pci.h> |
40 | #include <linux/pci-aspm.h> | ||
40 | 41 | ||
41 | #include "hw.h" | 42 | #include "hw.h" |
42 | 43 | ||
@@ -188,6 +189,8 @@ struct e1000_buffer { | |||
188 | unsigned long time_stamp; | 189 | unsigned long time_stamp; |
189 | u16 length; | 190 | u16 length; |
190 | u16 next_to_watch; | 191 | u16 next_to_watch; |
192 | unsigned int segs; | ||
193 | unsigned int bytecount; | ||
191 | u16 mapped_as_page; | 194 | u16 mapped_as_page; |
192 | }; | 195 | }; |
193 | /* Rx */ | 196 | /* Rx */ |
@@ -370,7 +373,7 @@ struct e1000_adapter { | |||
370 | struct e1000_info { | 373 | struct e1000_info { |
371 | enum e1000_mac_type mac; | 374 | enum e1000_mac_type mac; |
372 | unsigned int flags; | 375 | unsigned int flags; |
373 | unsigned int flags2; | 376 | unsigned int flags2; |
374 | u32 pba; | 377 | u32 pba; |
375 | u32 max_hw_frame_size; | 378 | u32 max_hw_frame_size; |
376 | s32 (*get_variants)(struct e1000_adapter *); | 379 | s32 (*get_variants)(struct e1000_adapter *); |
@@ -417,6 +420,7 @@ struct e1000_info { | |||
417 | #define FLAG2_CRC_STRIPPING (1 << 0) | 420 | #define FLAG2_CRC_STRIPPING (1 << 0) |
418 | #define FLAG2_HAS_PHY_WAKEUP (1 << 1) | 421 | #define FLAG2_HAS_PHY_WAKEUP (1 << 1) |
419 | #define FLAG2_IS_DISCARDING (1 << 2) | 422 | #define FLAG2_IS_DISCARDING (1 << 2) |
423 | #define FLAG2_DISABLE_ASPM_L1 (1 << 3) | ||
420 | 424 | ||
421 | #define E1000_RX_DESC_PS(R, i) \ | 425 | #define E1000_RX_DESC_PS(R, i) \ |
422 | (&(((union e1000_rx_desc_packet_split *)((R).desc))[i])) | 426 | (&(((union e1000_rx_desc_packet_split *)((R).desc))[i])) |
@@ -457,6 +461,7 @@ extern void e1000e_update_stats(struct e1000_adapter *adapter); | |||
457 | extern bool e1000e_has_link(struct e1000_adapter *adapter); | 461 | extern bool e1000e_has_link(struct e1000_adapter *adapter); |
458 | extern void e1000e_set_interrupt_capability(struct e1000_adapter *adapter); | 462 | extern void e1000e_set_interrupt_capability(struct e1000_adapter *adapter); |
459 | extern void e1000e_reset_interrupt_capability(struct e1000_adapter *adapter); | 463 | extern void e1000e_reset_interrupt_capability(struct e1000_adapter *adapter); |
464 | extern void e1000e_disable_aspm(struct pci_dev *pdev, u16 state); | ||
460 | 465 | ||
461 | extern unsigned int copybreak; | 466 | extern unsigned int copybreak; |
462 | 467 | ||
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index 983493f2330c..6ff376cfe139 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c | |||
@@ -412,7 +412,6 @@ static int e1000_set_tso(struct net_device *netdev, u32 data) | |||
412 | netdev->features &= ~NETIF_F_TSO6; | 412 | netdev->features &= ~NETIF_F_TSO6; |
413 | } | 413 | } |
414 | 414 | ||
415 | e_info("TSO is %s\n", data ? "Enabled" : "Disabled"); | ||
416 | adapter->flags |= FLAG_TSO_FORCE; | 415 | adapter->flags |= FLAG_TSO_FORCE; |
417 | return 0; | 416 | return 0; |
418 | } | 417 | } |
@@ -1069,10 +1068,10 @@ static void e1000_free_desc_rings(struct e1000_adapter *adapter) | |||
1069 | if (tx_ring->desc && tx_ring->buffer_info) { | 1068 | if (tx_ring->desc && tx_ring->buffer_info) { |
1070 | for (i = 0; i < tx_ring->count; i++) { | 1069 | for (i = 0; i < tx_ring->count; i++) { |
1071 | if (tx_ring->buffer_info[i].dma) | 1070 | if (tx_ring->buffer_info[i].dma) |
1072 | pci_unmap_single(pdev, | 1071 | dma_unmap_single(&pdev->dev, |
1073 | tx_ring->buffer_info[i].dma, | 1072 | tx_ring->buffer_info[i].dma, |
1074 | tx_ring->buffer_info[i].length, | 1073 | tx_ring->buffer_info[i].length, |
1075 | PCI_DMA_TODEVICE); | 1074 | DMA_TO_DEVICE); |
1076 | if (tx_ring->buffer_info[i].skb) | 1075 | if (tx_ring->buffer_info[i].skb) |
1077 | dev_kfree_skb(tx_ring->buffer_info[i].skb); | 1076 | dev_kfree_skb(tx_ring->buffer_info[i].skb); |
1078 | } | 1077 | } |
@@ -1081,9 +1080,9 @@ static void e1000_free_desc_rings(struct e1000_adapter *adapter) | |||
1081 | if (rx_ring->desc && rx_ring->buffer_info) { | 1080 | if (rx_ring->desc && rx_ring->buffer_info) { |
1082 | for (i = 0; i < rx_ring->count; i++) { | 1081 | for (i = 0; i < rx_ring->count; i++) { |
1083 | if (rx_ring->buffer_info[i].dma) | 1082 | if (rx_ring->buffer_info[i].dma) |
1084 | pci_unmap_single(pdev, | 1083 | dma_unmap_single(&pdev->dev, |
1085 | rx_ring->buffer_info[i].dma, | 1084 | rx_ring->buffer_info[i].dma, |
1086 | 2048, PCI_DMA_FROMDEVICE); | 1085 | 2048, DMA_FROM_DEVICE); |
1087 | if (rx_ring->buffer_info[i].skb) | 1086 | if (rx_ring->buffer_info[i].skb) |
1088 | dev_kfree_skb(rx_ring->buffer_info[i].skb); | 1087 | dev_kfree_skb(rx_ring->buffer_info[i].skb); |
1089 | } | 1088 | } |
@@ -1163,9 +1162,10 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1163 | tx_ring->buffer_info[i].skb = skb; | 1162 | tx_ring->buffer_info[i].skb = skb; |
1164 | tx_ring->buffer_info[i].length = skb->len; | 1163 | tx_ring->buffer_info[i].length = skb->len; |
1165 | tx_ring->buffer_info[i].dma = | 1164 | tx_ring->buffer_info[i].dma = |
1166 | pci_map_single(pdev, skb->data, skb->len, | 1165 | dma_map_single(&pdev->dev, skb->data, skb->len, |
1167 | PCI_DMA_TODEVICE); | 1166 | DMA_TO_DEVICE); |
1168 | if (pci_dma_mapping_error(pdev, tx_ring->buffer_info[i].dma)) { | 1167 | if (dma_mapping_error(&pdev->dev, |
1168 | tx_ring->buffer_info[i].dma)) { | ||
1169 | ret_val = 4; | 1169 | ret_val = 4; |
1170 | goto err_nomem; | 1170 | goto err_nomem; |
1171 | } | 1171 | } |
@@ -1226,9 +1226,10 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1226 | skb_reserve(skb, NET_IP_ALIGN); | 1226 | skb_reserve(skb, NET_IP_ALIGN); |
1227 | rx_ring->buffer_info[i].skb = skb; | 1227 | rx_ring->buffer_info[i].skb = skb; |
1228 | rx_ring->buffer_info[i].dma = | 1228 | rx_ring->buffer_info[i].dma = |
1229 | pci_map_single(pdev, skb->data, 2048, | 1229 | dma_map_single(&pdev->dev, skb->data, 2048, |
1230 | PCI_DMA_FROMDEVICE); | 1230 | DMA_FROM_DEVICE); |
1231 | if (pci_dma_mapping_error(pdev, rx_ring->buffer_info[i].dma)) { | 1231 | if (dma_mapping_error(&pdev->dev, |
1232 | rx_ring->buffer_info[i].dma)) { | ||
1232 | ret_val = 8; | 1233 | ret_val = 8; |
1233 | goto err_nomem; | 1234 | goto err_nomem; |
1234 | } | 1235 | } |
@@ -1556,10 +1557,10 @@ static int e1000_run_loopback_test(struct e1000_adapter *adapter) | |||
1556 | for (i = 0; i < 64; i++) { /* send the packets */ | 1557 | for (i = 0; i < 64; i++) { /* send the packets */ |
1557 | e1000_create_lbtest_frame(tx_ring->buffer_info[k].skb, | 1558 | e1000_create_lbtest_frame(tx_ring->buffer_info[k].skb, |
1558 | 1024); | 1559 | 1024); |
1559 | pci_dma_sync_single_for_device(pdev, | 1560 | dma_sync_single_for_device(&pdev->dev, |
1560 | tx_ring->buffer_info[k].dma, | 1561 | tx_ring->buffer_info[k].dma, |
1561 | tx_ring->buffer_info[k].length, | 1562 | tx_ring->buffer_info[k].length, |
1562 | PCI_DMA_TODEVICE); | 1563 | DMA_TO_DEVICE); |
1563 | k++; | 1564 | k++; |
1564 | if (k == tx_ring->count) | 1565 | if (k == tx_ring->count) |
1565 | k = 0; | 1566 | k = 0; |
@@ -1569,9 +1570,9 @@ static int e1000_run_loopback_test(struct e1000_adapter *adapter) | |||
1569 | time = jiffies; /* set the start time for the receive */ | 1570 | time = jiffies; /* set the start time for the receive */ |
1570 | good_cnt = 0; | 1571 | good_cnt = 0; |
1571 | do { /* receive the sent packets */ | 1572 | do { /* receive the sent packets */ |
1572 | pci_dma_sync_single_for_cpu(pdev, | 1573 | dma_sync_single_for_cpu(&pdev->dev, |
1573 | rx_ring->buffer_info[l].dma, 2048, | 1574 | rx_ring->buffer_info[l].dma, 2048, |
1574 | PCI_DMA_FROMDEVICE); | 1575 | DMA_FROM_DEVICE); |
1575 | 1576 | ||
1576 | ret_val = e1000_check_lbtest_frame( | 1577 | ret_val = e1000_check_lbtest_frame( |
1577 | rx_ring->buffer_info[l].skb, 1024); | 1578 | rx_ring->buffer_info[l].skb, 1024); |
@@ -1889,7 +1890,7 @@ static int e1000_get_coalesce(struct net_device *netdev, | |||
1889 | { | 1890 | { |
1890 | struct e1000_adapter *adapter = netdev_priv(netdev); | 1891 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1891 | 1892 | ||
1892 | if (adapter->itr_setting <= 3) | 1893 | if (adapter->itr_setting <= 4) |
1893 | ec->rx_coalesce_usecs = adapter->itr_setting; | 1894 | ec->rx_coalesce_usecs = adapter->itr_setting; |
1894 | else | 1895 | else |
1895 | ec->rx_coalesce_usecs = 1000000 / adapter->itr_setting; | 1896 | ec->rx_coalesce_usecs = 1000000 / adapter->itr_setting; |
@@ -1904,12 +1905,14 @@ static int e1000_set_coalesce(struct net_device *netdev, | |||
1904 | struct e1000_hw *hw = &adapter->hw; | 1905 | struct e1000_hw *hw = &adapter->hw; |
1905 | 1906 | ||
1906 | if ((ec->rx_coalesce_usecs > E1000_MAX_ITR_USECS) || | 1907 | if ((ec->rx_coalesce_usecs > E1000_MAX_ITR_USECS) || |
1907 | ((ec->rx_coalesce_usecs > 3) && | 1908 | ((ec->rx_coalesce_usecs > 4) && |
1908 | (ec->rx_coalesce_usecs < E1000_MIN_ITR_USECS)) || | 1909 | (ec->rx_coalesce_usecs < E1000_MIN_ITR_USECS)) || |
1909 | (ec->rx_coalesce_usecs == 2)) | 1910 | (ec->rx_coalesce_usecs == 2)) |
1910 | return -EINVAL; | 1911 | return -EINVAL; |
1911 | 1912 | ||
1912 | if (ec->rx_coalesce_usecs <= 3) { | 1913 | if (ec->rx_coalesce_usecs == 4) { |
1914 | adapter->itr = adapter->itr_setting = 4; | ||
1915 | } else if (ec->rx_coalesce_usecs <= 3) { | ||
1913 | adapter->itr = 20000; | 1916 | adapter->itr = 20000; |
1914 | adapter->itr_setting = ec->rx_coalesce_usecs; | 1917 | adapter->itr_setting = ec->rx_coalesce_usecs; |
1915 | } else { | 1918 | } else { |
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c index 5059c22155d9..b8c4dce01a04 100644 --- a/drivers/net/e1000e/ich8lan.c +++ b/drivers/net/e1000e/ich8lan.c | |||
@@ -83,6 +83,8 @@ | |||
83 | 83 | ||
84 | 84 | ||
85 | #define E1000_ICH_FWSM_RSPCIPHY 0x00000040 /* Reset PHY on PCI Reset */ | 85 | #define E1000_ICH_FWSM_RSPCIPHY 0x00000040 /* Reset PHY on PCI Reset */ |
86 | /* FW established a valid mode */ | ||
87 | #define E1000_ICH_FWSM_FW_VALID 0x00008000 | ||
86 | 88 | ||
87 | #define E1000_ICH_MNG_IAMT_MODE 0x2 | 89 | #define E1000_ICH_MNG_IAMT_MODE 0x2 |
88 | 90 | ||
@@ -259,6 +261,7 @@ static inline void __ew32flash(struct e1000_hw *hw, unsigned long reg, u32 val) | |||
259 | static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) | 261 | static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) |
260 | { | 262 | { |
261 | struct e1000_phy_info *phy = &hw->phy; | 263 | struct e1000_phy_info *phy = &hw->phy; |
264 | u32 ctrl; | ||
262 | s32 ret_val = 0; | 265 | s32 ret_val = 0; |
263 | 266 | ||
264 | phy->addr = 1; | 267 | phy->addr = 1; |
@@ -274,6 +277,33 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) | |||
274 | phy->ops.power_down = e1000_power_down_phy_copper_ich8lan; | 277 | phy->ops.power_down = e1000_power_down_phy_copper_ich8lan; |
275 | phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; | 278 | phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; |
276 | 279 | ||
280 | if (!(er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) { | ||
281 | /* | ||
282 | * The MAC-PHY interconnect may still be in SMBus mode | ||
283 | * after Sx->S0. Toggle the LANPHYPC Value bit to force | ||
284 | * the interconnect to PCIe mode, but only if there is no | ||
285 | * firmware present otherwise firmware will have done it. | ||
286 | */ | ||
287 | ctrl = er32(CTRL); | ||
288 | ctrl |= E1000_CTRL_LANPHYPC_OVERRIDE; | ||
289 | ctrl &= ~E1000_CTRL_LANPHYPC_VALUE; | ||
290 | ew32(CTRL, ctrl); | ||
291 | udelay(10); | ||
292 | ctrl &= ~E1000_CTRL_LANPHYPC_OVERRIDE; | ||
293 | ew32(CTRL, ctrl); | ||
294 | msleep(50); | ||
295 | } | ||
296 | |||
297 | /* | ||
298 | * Reset the PHY before any acccess to it. Doing so, ensures that | ||
299 | * the PHY is in a known good state before we read/write PHY registers. | ||
300 | * The generic reset is sufficient here, because we haven't determined | ||
301 | * the PHY type yet. | ||
302 | */ | ||
303 | ret_val = e1000e_phy_hw_reset_generic(hw); | ||
304 | if (ret_val) | ||
305 | goto out; | ||
306 | |||
277 | phy->id = e1000_phy_unknown; | 307 | phy->id = e1000_phy_unknown; |
278 | ret_val = e1000e_get_phy_id(hw); | 308 | ret_val = e1000e_get_phy_id(hw); |
279 | if (ret_val) | 309 | if (ret_val) |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 5f70c437fa41..c5f65a29865a 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -52,7 +52,7 @@ | |||
52 | 52 | ||
53 | #include "e1000.h" | 53 | #include "e1000.h" |
54 | 54 | ||
55 | #define DRV_VERSION "1.0.2-k2" | 55 | #define DRV_VERSION "1.0.2-k4" |
56 | char e1000e_driver_name[] = "e1000e"; | 56 | char e1000e_driver_name[] = "e1000e"; |
57 | const char e1000e_driver_version[] = DRV_VERSION; | 57 | const char e1000e_driver_version[] = DRV_VERSION; |
58 | 58 | ||
@@ -69,6 +69,361 @@ static const struct e1000_info *e1000_info_tbl[] = { | |||
69 | [board_pchlan] = &e1000_pch_info, | 69 | [board_pchlan] = &e1000_pch_info, |
70 | }; | 70 | }; |
71 | 71 | ||
72 | struct e1000_reg_info { | ||
73 | u32 ofs; | ||
74 | char *name; | ||
75 | }; | ||
76 | |||
77 | #define E1000_RDFH 0x02410 /* Rx Data FIFO Head - RW */ | ||
78 | #define E1000_RDFT 0x02418 /* Rx Data FIFO Tail - RW */ | ||
79 | #define E1000_RDFHS 0x02420 /* Rx Data FIFO Head Saved - RW */ | ||
80 | #define E1000_RDFTS 0x02428 /* Rx Data FIFO Tail Saved - RW */ | ||
81 | #define E1000_RDFPC 0x02430 /* Rx Data FIFO Packet Count - RW */ | ||
82 | |||
83 | #define E1000_TDFH 0x03410 /* Tx Data FIFO Head - RW */ | ||
84 | #define E1000_TDFT 0x03418 /* Tx Data FIFO Tail - RW */ | ||
85 | #define E1000_TDFHS 0x03420 /* Tx Data FIFO Head Saved - RW */ | ||
86 | #define E1000_TDFTS 0x03428 /* Tx Data FIFO Tail Saved - RW */ | ||
87 | #define E1000_TDFPC 0x03430 /* Tx Data FIFO Packet Count - RW */ | ||
88 | |||
89 | static const struct e1000_reg_info e1000_reg_info_tbl[] = { | ||
90 | |||
91 | /* General Registers */ | ||
92 | {E1000_CTRL, "CTRL"}, | ||
93 | {E1000_STATUS, "STATUS"}, | ||
94 | {E1000_CTRL_EXT, "CTRL_EXT"}, | ||
95 | |||
96 | /* Interrupt Registers */ | ||
97 | {E1000_ICR, "ICR"}, | ||
98 | |||
99 | /* RX Registers */ | ||
100 | {E1000_RCTL, "RCTL"}, | ||
101 | {E1000_RDLEN, "RDLEN"}, | ||
102 | {E1000_RDH, "RDH"}, | ||
103 | {E1000_RDT, "RDT"}, | ||
104 | {E1000_RDTR, "RDTR"}, | ||
105 | {E1000_RXDCTL(0), "RXDCTL"}, | ||
106 | {E1000_ERT, "ERT"}, | ||
107 | {E1000_RDBAL, "RDBAL"}, | ||
108 | {E1000_RDBAH, "RDBAH"}, | ||
109 | {E1000_RDFH, "RDFH"}, | ||
110 | {E1000_RDFT, "RDFT"}, | ||
111 | {E1000_RDFHS, "RDFHS"}, | ||
112 | {E1000_RDFTS, "RDFTS"}, | ||
113 | {E1000_RDFPC, "RDFPC"}, | ||
114 | |||
115 | /* TX Registers */ | ||
116 | {E1000_TCTL, "TCTL"}, | ||
117 | {E1000_TDBAL, "TDBAL"}, | ||
118 | {E1000_TDBAH, "TDBAH"}, | ||
119 | {E1000_TDLEN, "TDLEN"}, | ||
120 | {E1000_TDH, "TDH"}, | ||
121 | {E1000_TDT, "TDT"}, | ||
122 | {E1000_TIDV, "TIDV"}, | ||
123 | {E1000_TXDCTL(0), "TXDCTL"}, | ||
124 | {E1000_TADV, "TADV"}, | ||
125 | {E1000_TARC(0), "TARC"}, | ||
126 | {E1000_TDFH, "TDFH"}, | ||
127 | {E1000_TDFT, "TDFT"}, | ||
128 | {E1000_TDFHS, "TDFHS"}, | ||
129 | {E1000_TDFTS, "TDFTS"}, | ||
130 | {E1000_TDFPC, "TDFPC"}, | ||
131 | |||
132 | /* List Terminator */ | ||
133 | {} | ||
134 | }; | ||
135 | |||
136 | /* | ||
137 | * e1000_regdump - register printout routine | ||
138 | */ | ||
139 | static void e1000_regdump(struct e1000_hw *hw, struct e1000_reg_info *reginfo) | ||
140 | { | ||
141 | int n = 0; | ||
142 | char rname[16]; | ||
143 | u32 regs[8]; | ||
144 | |||
145 | switch (reginfo->ofs) { | ||
146 | case E1000_RXDCTL(0): | ||
147 | for (n = 0; n < 2; n++) | ||
148 | regs[n] = __er32(hw, E1000_RXDCTL(n)); | ||
149 | break; | ||
150 | case E1000_TXDCTL(0): | ||
151 | for (n = 0; n < 2; n++) | ||
152 | regs[n] = __er32(hw, E1000_TXDCTL(n)); | ||
153 | break; | ||
154 | case E1000_TARC(0): | ||
155 | for (n = 0; n < 2; n++) | ||
156 | regs[n] = __er32(hw, E1000_TARC(n)); | ||
157 | break; | ||
158 | default: | ||
159 | printk(KERN_INFO "%-15s %08x\n", | ||
160 | reginfo->name, __er32(hw, reginfo->ofs)); | ||
161 | return; | ||
162 | } | ||
163 | |||
164 | snprintf(rname, 16, "%s%s", reginfo->name, "[0-1]"); | ||
165 | printk(KERN_INFO "%-15s ", rname); | ||
166 | for (n = 0; n < 2; n++) | ||
167 | printk(KERN_CONT "%08x ", regs[n]); | ||
168 | printk(KERN_CONT "\n"); | ||
169 | } | ||
170 | |||
171 | |||
172 | /* | ||
173 | * e1000e_dump - Print registers, tx-ring and rx-ring | ||
174 | */ | ||
175 | static void e1000e_dump(struct e1000_adapter *adapter) | ||
176 | { | ||
177 | struct net_device *netdev = adapter->netdev; | ||
178 | struct e1000_hw *hw = &adapter->hw; | ||
179 | struct e1000_reg_info *reginfo; | ||
180 | struct e1000_ring *tx_ring = adapter->tx_ring; | ||
181 | struct e1000_tx_desc *tx_desc; | ||
182 | struct my_u0 { u64 a; u64 b; } *u0; | ||
183 | struct e1000_buffer *buffer_info; | ||
184 | struct e1000_ring *rx_ring = adapter->rx_ring; | ||
185 | union e1000_rx_desc_packet_split *rx_desc_ps; | ||
186 | struct e1000_rx_desc *rx_desc; | ||
187 | struct my_u1 { u64 a; u64 b; u64 c; u64 d; } *u1; | ||
188 | u32 staterr; | ||
189 | int i = 0; | ||
190 | |||
191 | if (!netif_msg_hw(adapter)) | ||
192 | return; | ||
193 | |||
194 | /* Print netdevice Info */ | ||
195 | if (netdev) { | ||
196 | dev_info(&adapter->pdev->dev, "Net device Info\n"); | ||
197 | printk(KERN_INFO "Device Name state " | ||
198 | "trans_start last_rx\n"); | ||
199 | printk(KERN_INFO "%-15s %016lX %016lX %016lX\n", | ||
200 | netdev->name, | ||
201 | netdev->state, | ||
202 | netdev->trans_start, | ||
203 | netdev->last_rx); | ||
204 | } | ||
205 | |||
206 | /* Print Registers */ | ||
207 | dev_info(&adapter->pdev->dev, "Register Dump\n"); | ||
208 | printk(KERN_INFO " Register Name Value\n"); | ||
209 | for (reginfo = (struct e1000_reg_info *)e1000_reg_info_tbl; | ||
210 | reginfo->name; reginfo++) { | ||
211 | e1000_regdump(hw, reginfo); | ||
212 | } | ||
213 | |||
214 | /* Print TX Ring Summary */ | ||
215 | if (!netdev || !netif_running(netdev)) | ||
216 | goto exit; | ||
217 | |||
218 | dev_info(&adapter->pdev->dev, "TX Rings Summary\n"); | ||
219 | printk(KERN_INFO "Queue [NTU] [NTC] [bi(ntc)->dma ]" | ||
220 | " leng ntw timestamp\n"); | ||
221 | buffer_info = &tx_ring->buffer_info[tx_ring->next_to_clean]; | ||
222 | printk(KERN_INFO " %5d %5X %5X %016llX %04X %3X %016llX\n", | ||
223 | 0, tx_ring->next_to_use, tx_ring->next_to_clean, | ||
224 | (u64)buffer_info->dma, | ||
225 | buffer_info->length, | ||
226 | buffer_info->next_to_watch, | ||
227 | (u64)buffer_info->time_stamp); | ||
228 | |||
229 | /* Print TX Rings */ | ||
230 | if (!netif_msg_tx_done(adapter)) | ||
231 | goto rx_ring_summary; | ||
232 | |||
233 | dev_info(&adapter->pdev->dev, "TX Rings Dump\n"); | ||
234 | |||
235 | /* Transmit Descriptor Formats - DEXT[29] is 0 (Legacy) or 1 (Extended) | ||
236 | * | ||
237 | * Legacy Transmit Descriptor | ||
238 | * +--------------------------------------------------------------+ | ||
239 | * 0 | Buffer Address [63:0] (Reserved on Write Back) | | ||
240 | * +--------------------------------------------------------------+ | ||
241 | * 8 | Special | CSS | Status | CMD | CSO | Length | | ||
242 | * +--------------------------------------------------------------+ | ||
243 | * 63 48 47 36 35 32 31 24 23 16 15 0 | ||
244 | * | ||
245 | * Extended Context Descriptor (DTYP=0x0) for TSO or checksum offload | ||
246 | * 63 48 47 40 39 32 31 16 15 8 7 0 | ||
247 | * +----------------------------------------------------------------+ | ||
248 | * 0 | TUCSE | TUCS0 | TUCSS | IPCSE | IPCS0 | IPCSS | | ||
249 | * +----------------------------------------------------------------+ | ||
250 | * 8 | MSS | HDRLEN | RSV | STA | TUCMD | DTYP | PAYLEN | | ||
251 | * +----------------------------------------------------------------+ | ||
252 | * 63 48 47 40 39 36 35 32 31 24 23 20 19 0 | ||
253 | * | ||
254 | * Extended Data Descriptor (DTYP=0x1) | ||
255 | * +----------------------------------------------------------------+ | ||
256 | * 0 | Buffer Address [63:0] | | ||
257 | * +----------------------------------------------------------------+ | ||
258 | * 8 | VLAN tag | POPTS | Rsvd | Status | Command | DTYP | DTALEN | | ||
259 | * +----------------------------------------------------------------+ | ||
260 | * 63 48 47 40 39 36 35 32 31 24 23 20 19 0 | ||
261 | */ | ||
262 | printk(KERN_INFO "Tl[desc] [address 63:0 ] [SpeCssSCmCsLen]" | ||
263 | " [bi->dma ] leng ntw timestamp bi->skb " | ||
264 | "<-- Legacy format\n"); | ||
265 | printk(KERN_INFO "Tc[desc] [Ce CoCsIpceCoS] [MssHlRSCm0Plen]" | ||
266 | " [bi->dma ] leng ntw timestamp bi->skb " | ||
267 | "<-- Ext Context format\n"); | ||
268 | printk(KERN_INFO "Td[desc] [address 63:0 ] [VlaPoRSCm1Dlen]" | ||
269 | " [bi->dma ] leng ntw timestamp bi->skb " | ||
270 | "<-- Ext Data format\n"); | ||
271 | for (i = 0; tx_ring->desc && (i < tx_ring->count); i++) { | ||
272 | tx_desc = E1000_TX_DESC(*tx_ring, i); | ||
273 | buffer_info = &tx_ring->buffer_info[i]; | ||
274 | u0 = (struct my_u0 *)tx_desc; | ||
275 | printk(KERN_INFO "T%c[0x%03X] %016llX %016llX %016llX " | ||
276 | "%04X %3X %016llX %p", | ||
277 | (!(le64_to_cpu(u0->b) & (1<<29)) ? 'l' : | ||
278 | ((le64_to_cpu(u0->b) & (1<<20)) ? 'd' : 'c')), i, | ||
279 | le64_to_cpu(u0->a), le64_to_cpu(u0->b), | ||
280 | (u64)buffer_info->dma, buffer_info->length, | ||
281 | buffer_info->next_to_watch, (u64)buffer_info->time_stamp, | ||
282 | buffer_info->skb); | ||
283 | if (i == tx_ring->next_to_use && i == tx_ring->next_to_clean) | ||
284 | printk(KERN_CONT " NTC/U\n"); | ||
285 | else if (i == tx_ring->next_to_use) | ||
286 | printk(KERN_CONT " NTU\n"); | ||
287 | else if (i == tx_ring->next_to_clean) | ||
288 | printk(KERN_CONT " NTC\n"); | ||
289 | else | ||
290 | printk(KERN_CONT "\n"); | ||
291 | |||
292 | if (netif_msg_pktdata(adapter) && buffer_info->dma != 0) | ||
293 | print_hex_dump(KERN_INFO, "", DUMP_PREFIX_ADDRESS, | ||
294 | 16, 1, phys_to_virt(buffer_info->dma), | ||
295 | buffer_info->length, true); | ||
296 | } | ||
297 | |||
298 | /* Print RX Rings Summary */ | ||
299 | rx_ring_summary: | ||
300 | dev_info(&adapter->pdev->dev, "RX Rings Summary\n"); | ||
301 | printk(KERN_INFO "Queue [NTU] [NTC]\n"); | ||
302 | printk(KERN_INFO " %5d %5X %5X\n", 0, | ||
303 | rx_ring->next_to_use, rx_ring->next_to_clean); | ||
304 | |||
305 | /* Print RX Rings */ | ||
306 | if (!netif_msg_rx_status(adapter)) | ||
307 | goto exit; | ||
308 | |||
309 | dev_info(&adapter->pdev->dev, "RX Rings Dump\n"); | ||
310 | switch (adapter->rx_ps_pages) { | ||
311 | case 1: | ||
312 | case 2: | ||
313 | case 3: | ||
314 | /* [Extended] Packet Split Receive Descriptor Format | ||
315 | * | ||
316 | * +-----------------------------------------------------+ | ||
317 | * 0 | Buffer Address 0 [63:0] | | ||
318 | * +-----------------------------------------------------+ | ||
319 | * 8 | Buffer Address 1 [63:0] | | ||
320 | * +-----------------------------------------------------+ | ||
321 | * 16 | Buffer Address 2 [63:0] | | ||
322 | * +-----------------------------------------------------+ | ||
323 | * 24 | Buffer Address 3 [63:0] | | ||
324 | * +-----------------------------------------------------+ | ||
325 | */ | ||
326 | printk(KERN_INFO "R [desc] [buffer 0 63:0 ] " | ||
327 | "[buffer 1 63:0 ] " | ||
328 | "[buffer 2 63:0 ] [buffer 3 63:0 ] [bi->dma ] " | ||
329 | "[bi->skb] <-- Ext Pkt Split format\n"); | ||
330 | /* [Extended] Receive Descriptor (Write-Back) Format | ||
331 | * | ||
332 | * 63 48 47 32 31 13 12 8 7 4 3 0 | ||
333 | * +------------------------------------------------------+ | ||
334 | * 0 | Packet | IP | Rsvd | MRQ | Rsvd | MRQ RSS | | ||
335 | * | Checksum | Ident | | Queue | | Type | | ||
336 | * +------------------------------------------------------+ | ||
337 | * 8 | VLAN Tag | Length | Extended Error | Extended Status | | ||
338 | * +------------------------------------------------------+ | ||
339 | * 63 48 47 32 31 20 19 0 | ||
340 | */ | ||
341 | printk(KERN_INFO "RWB[desc] [ck ipid mrqhsh] " | ||
342 | "[vl l0 ee es] " | ||
343 | "[ l3 l2 l1 hs] [reserved ] ---------------- " | ||
344 | "[bi->skb] <-- Ext Rx Write-Back format\n"); | ||
345 | for (i = 0; i < rx_ring->count; i++) { | ||
346 | buffer_info = &rx_ring->buffer_info[i]; | ||
347 | rx_desc_ps = E1000_RX_DESC_PS(*rx_ring, i); | ||
348 | u1 = (struct my_u1 *)rx_desc_ps; | ||
349 | staterr = | ||
350 | le32_to_cpu(rx_desc_ps->wb.middle.status_error); | ||
351 | if (staterr & E1000_RXD_STAT_DD) { | ||
352 | /* Descriptor Done */ | ||
353 | printk(KERN_INFO "RWB[0x%03X] %016llX " | ||
354 | "%016llX %016llX %016llX " | ||
355 | "---------------- %p", i, | ||
356 | le64_to_cpu(u1->a), | ||
357 | le64_to_cpu(u1->b), | ||
358 | le64_to_cpu(u1->c), | ||
359 | le64_to_cpu(u1->d), | ||
360 | buffer_info->skb); | ||
361 | } else { | ||
362 | printk(KERN_INFO "R [0x%03X] %016llX " | ||
363 | "%016llX %016llX %016llX %016llX %p", i, | ||
364 | le64_to_cpu(u1->a), | ||
365 | le64_to_cpu(u1->b), | ||
366 | le64_to_cpu(u1->c), | ||
367 | le64_to_cpu(u1->d), | ||
368 | (u64)buffer_info->dma, | ||
369 | buffer_info->skb); | ||
370 | |||
371 | if (netif_msg_pktdata(adapter)) | ||
372 | print_hex_dump(KERN_INFO, "", | ||
373 | DUMP_PREFIX_ADDRESS, 16, 1, | ||
374 | phys_to_virt(buffer_info->dma), | ||
375 | adapter->rx_ps_bsize0, true); | ||
376 | } | ||
377 | |||
378 | if (i == rx_ring->next_to_use) | ||
379 | printk(KERN_CONT " NTU\n"); | ||
380 | else if (i == rx_ring->next_to_clean) | ||
381 | printk(KERN_CONT " NTC\n"); | ||
382 | else | ||
383 | printk(KERN_CONT "\n"); | ||
384 | } | ||
385 | break; | ||
386 | default: | ||
387 | case 0: | ||
388 | /* Legacy Receive Descriptor Format | ||
389 | * | ||
390 | * +-----------------------------------------------------+ | ||
391 | * | Buffer Address [63:0] | | ||
392 | * +-----------------------------------------------------+ | ||
393 | * | VLAN Tag | Errors | Status 0 | Packet csum | Length | | ||
394 | * +-----------------------------------------------------+ | ||
395 | * 63 48 47 40 39 32 31 16 15 0 | ||
396 | */ | ||
397 | printk(KERN_INFO "Rl[desc] [address 63:0 ] " | ||
398 | "[vl er S cks ln] [bi->dma ] [bi->skb] " | ||
399 | "<-- Legacy format\n"); | ||
400 | for (i = 0; rx_ring->desc && (i < rx_ring->count); i++) { | ||
401 | rx_desc = E1000_RX_DESC(*rx_ring, i); | ||
402 | buffer_info = &rx_ring->buffer_info[i]; | ||
403 | u0 = (struct my_u0 *)rx_desc; | ||
404 | printk(KERN_INFO "Rl[0x%03X] %016llX %016llX " | ||
405 | "%016llX %p", | ||
406 | i, le64_to_cpu(u0->a), le64_to_cpu(u0->b), | ||
407 | (u64)buffer_info->dma, buffer_info->skb); | ||
408 | if (i == rx_ring->next_to_use) | ||
409 | printk(KERN_CONT " NTU\n"); | ||
410 | else if (i == rx_ring->next_to_clean) | ||
411 | printk(KERN_CONT " NTC\n"); | ||
412 | else | ||
413 | printk(KERN_CONT "\n"); | ||
414 | |||
415 | if (netif_msg_pktdata(adapter)) | ||
416 | print_hex_dump(KERN_INFO, "", | ||
417 | DUMP_PREFIX_ADDRESS, | ||
418 | 16, 1, phys_to_virt(buffer_info->dma), | ||
419 | adapter->rx_buffer_len, true); | ||
420 | } | ||
421 | } | ||
422 | |||
423 | exit: | ||
424 | return; | ||
425 | } | ||
426 | |||
72 | /** | 427 | /** |
73 | * e1000_desc_unused - calculate if we have unused descriptors | 428 | * e1000_desc_unused - calculate if we have unused descriptors |
74 | **/ | 429 | **/ |
@@ -181,10 +536,10 @@ static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter, | |||
181 | 536 | ||
182 | buffer_info->skb = skb; | 537 | buffer_info->skb = skb; |
183 | map_skb: | 538 | map_skb: |
184 | buffer_info->dma = pci_map_single(pdev, skb->data, | 539 | buffer_info->dma = dma_map_single(&pdev->dev, skb->data, |
185 | adapter->rx_buffer_len, | 540 | adapter->rx_buffer_len, |
186 | PCI_DMA_FROMDEVICE); | 541 | DMA_FROM_DEVICE); |
187 | if (pci_dma_mapping_error(pdev, buffer_info->dma)) { | 542 | if (dma_mapping_error(&pdev->dev, buffer_info->dma)) { |
188 | dev_err(&pdev->dev, "RX DMA map failed\n"); | 543 | dev_err(&pdev->dev, "RX DMA map failed\n"); |
189 | adapter->rx_dma_failed++; | 544 | adapter->rx_dma_failed++; |
190 | break; | 545 | break; |
@@ -193,26 +548,23 @@ map_skb: | |||
193 | rx_desc = E1000_RX_DESC(*rx_ring, i); | 548 | rx_desc = E1000_RX_DESC(*rx_ring, i); |
194 | rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma); | 549 | rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma); |
195 | 550 | ||
551 | if (unlikely(!(i & (E1000_RX_BUFFER_WRITE - 1)))) { | ||
552 | /* | ||
553 | * Force memory writes to complete before letting h/w | ||
554 | * know there are new descriptors to fetch. (Only | ||
555 | * applicable for weak-ordered memory model archs, | ||
556 | * such as IA-64). | ||
557 | */ | ||
558 | wmb(); | ||
559 | writel(i, adapter->hw.hw_addr + rx_ring->tail); | ||
560 | } | ||
196 | i++; | 561 | i++; |
197 | if (i == rx_ring->count) | 562 | if (i == rx_ring->count) |
198 | i = 0; | 563 | i = 0; |
199 | buffer_info = &rx_ring->buffer_info[i]; | 564 | buffer_info = &rx_ring->buffer_info[i]; |
200 | } | 565 | } |
201 | 566 | ||
202 | if (rx_ring->next_to_use != i) { | 567 | rx_ring->next_to_use = i; |
203 | rx_ring->next_to_use = i; | ||
204 | if (i-- == 0) | ||
205 | i = (rx_ring->count - 1); | ||
206 | |||
207 | /* | ||
208 | * Force memory writes to complete before letting h/w | ||
209 | * know there are new descriptors to fetch. (Only | ||
210 | * applicable for weak-ordered memory model archs, | ||
211 | * such as IA-64). | ||
212 | */ | ||
213 | wmb(); | ||
214 | writel(i, adapter->hw.hw_addr + rx_ring->tail); | ||
215 | } | ||
216 | } | 568 | } |
217 | 569 | ||
218 | /** | 570 | /** |
@@ -250,11 +602,12 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, | |||
250 | adapter->alloc_rx_buff_failed++; | 602 | adapter->alloc_rx_buff_failed++; |
251 | goto no_buffers; | 603 | goto no_buffers; |
252 | } | 604 | } |
253 | ps_page->dma = pci_map_page(pdev, | 605 | ps_page->dma = dma_map_page(&pdev->dev, |
254 | ps_page->page, | 606 | ps_page->page, |
255 | 0, PAGE_SIZE, | 607 | 0, PAGE_SIZE, |
256 | PCI_DMA_FROMDEVICE); | 608 | DMA_FROM_DEVICE); |
257 | if (pci_dma_mapping_error(pdev, ps_page->dma)) { | 609 | if (dma_mapping_error(&pdev->dev, |
610 | ps_page->dma)) { | ||
258 | dev_err(&adapter->pdev->dev, | 611 | dev_err(&adapter->pdev->dev, |
259 | "RX DMA page map failed\n"); | 612 | "RX DMA page map failed\n"); |
260 | adapter->rx_dma_failed++; | 613 | adapter->rx_dma_failed++; |
@@ -279,10 +632,10 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, | |||
279 | } | 632 | } |
280 | 633 | ||
281 | buffer_info->skb = skb; | 634 | buffer_info->skb = skb; |
282 | buffer_info->dma = pci_map_single(pdev, skb->data, | 635 | buffer_info->dma = dma_map_single(&pdev->dev, skb->data, |
283 | adapter->rx_ps_bsize0, | 636 | adapter->rx_ps_bsize0, |
284 | PCI_DMA_FROMDEVICE); | 637 | DMA_FROM_DEVICE); |
285 | if (pci_dma_mapping_error(pdev, buffer_info->dma)) { | 638 | if (dma_mapping_error(&pdev->dev, buffer_info->dma)) { |
286 | dev_err(&pdev->dev, "RX DMA map failed\n"); | 639 | dev_err(&pdev->dev, "RX DMA map failed\n"); |
287 | adapter->rx_dma_failed++; | 640 | adapter->rx_dma_failed++; |
288 | /* cleanup skb */ | 641 | /* cleanup skb */ |
@@ -293,6 +646,17 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, | |||
293 | 646 | ||
294 | rx_desc->read.buffer_addr[0] = cpu_to_le64(buffer_info->dma); | 647 | rx_desc->read.buffer_addr[0] = cpu_to_le64(buffer_info->dma); |
295 | 648 | ||
649 | if (unlikely(!(i & (E1000_RX_BUFFER_WRITE - 1)))) { | ||
650 | /* | ||
651 | * Force memory writes to complete before letting h/w | ||
652 | * know there are new descriptors to fetch. (Only | ||
653 | * applicable for weak-ordered memory model archs, | ||
654 | * such as IA-64). | ||
655 | */ | ||
656 | wmb(); | ||
657 | writel(i<<1, adapter->hw.hw_addr + rx_ring->tail); | ||
658 | } | ||
659 | |||
296 | i++; | 660 | i++; |
297 | if (i == rx_ring->count) | 661 | if (i == rx_ring->count) |
298 | i = 0; | 662 | i = 0; |
@@ -300,26 +664,7 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, | |||
300 | } | 664 | } |
301 | 665 | ||
302 | no_buffers: | 666 | no_buffers: |
303 | if (rx_ring->next_to_use != i) { | 667 | rx_ring->next_to_use = i; |
304 | rx_ring->next_to_use = i; | ||
305 | |||
306 | if (!(i--)) | ||
307 | i = (rx_ring->count - 1); | ||
308 | |||
309 | /* | ||
310 | * Force memory writes to complete before letting h/w | ||
311 | * know there are new descriptors to fetch. (Only | ||
312 | * applicable for weak-ordered memory model archs, | ||
313 | * such as IA-64). | ||
314 | */ | ||
315 | wmb(); | ||
316 | /* | ||
317 | * Hardware increments by 16 bytes, but packet split | ||
318 | * descriptors are 32 bytes...so we increment tail | ||
319 | * twice as much. | ||
320 | */ | ||
321 | writel(i<<1, adapter->hw.hw_addr + rx_ring->tail); | ||
322 | } | ||
323 | } | 668 | } |
324 | 669 | ||
325 | /** | 670 | /** |
@@ -369,10 +714,10 @@ check_page: | |||
369 | } | 714 | } |
370 | 715 | ||
371 | if (!buffer_info->dma) | 716 | if (!buffer_info->dma) |
372 | buffer_info->dma = pci_map_page(pdev, | 717 | buffer_info->dma = dma_map_page(&pdev->dev, |
373 | buffer_info->page, 0, | 718 | buffer_info->page, 0, |
374 | PAGE_SIZE, | 719 | PAGE_SIZE, |
375 | PCI_DMA_FROMDEVICE); | 720 | DMA_FROM_DEVICE); |
376 | 721 | ||
377 | rx_desc = E1000_RX_DESC(*rx_ring, i); | 722 | rx_desc = E1000_RX_DESC(*rx_ring, i); |
378 | rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma); | 723 | rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma); |
@@ -446,10 +791,10 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter, | |||
446 | 791 | ||
447 | cleaned = 1; | 792 | cleaned = 1; |
448 | cleaned_count++; | 793 | cleaned_count++; |
449 | pci_unmap_single(pdev, | 794 | dma_unmap_single(&pdev->dev, |
450 | buffer_info->dma, | 795 | buffer_info->dma, |
451 | adapter->rx_buffer_len, | 796 | adapter->rx_buffer_len, |
452 | PCI_DMA_FROMDEVICE); | 797 | DMA_FROM_DEVICE); |
453 | buffer_info->dma = 0; | 798 | buffer_info->dma = 0; |
454 | 799 | ||
455 | length = le16_to_cpu(rx_desc->length); | 800 | length = le16_to_cpu(rx_desc->length); |
@@ -550,12 +895,11 @@ static void e1000_put_txbuf(struct e1000_adapter *adapter, | |||
550 | { | 895 | { |
551 | if (buffer_info->dma) { | 896 | if (buffer_info->dma) { |
552 | if (buffer_info->mapped_as_page) | 897 | if (buffer_info->mapped_as_page) |
553 | pci_unmap_page(adapter->pdev, buffer_info->dma, | 898 | dma_unmap_page(&adapter->pdev->dev, buffer_info->dma, |
554 | buffer_info->length, PCI_DMA_TODEVICE); | 899 | buffer_info->length, DMA_TO_DEVICE); |
555 | else | 900 | else |
556 | pci_unmap_single(adapter->pdev, buffer_info->dma, | 901 | dma_unmap_single(&adapter->pdev->dev, buffer_info->dma, |
557 | buffer_info->length, | 902 | buffer_info->length, DMA_TO_DEVICE); |
558 | PCI_DMA_TODEVICE); | ||
559 | buffer_info->dma = 0; | 903 | buffer_info->dma = 0; |
560 | } | 904 | } |
561 | if (buffer_info->skb) { | 905 | if (buffer_info->skb) { |
@@ -646,14 +990,8 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter) | |||
646 | cleaned = (i == eop); | 990 | cleaned = (i == eop); |
647 | 991 | ||
648 | if (cleaned) { | 992 | if (cleaned) { |
649 | struct sk_buff *skb = buffer_info->skb; | 993 | total_tx_packets += buffer_info->segs; |
650 | unsigned int segs, bytecount; | 994 | total_tx_bytes += buffer_info->bytecount; |
651 | segs = skb_shinfo(skb)->gso_segs ?: 1; | ||
652 | /* multiply data chunks by size of headers */ | ||
653 | bytecount = ((segs - 1) * skb_headlen(skb)) + | ||
654 | skb->len; | ||
655 | total_tx_packets += segs; | ||
656 | total_tx_bytes += bytecount; | ||
657 | } | 995 | } |
658 | 996 | ||
659 | e1000_put_txbuf(adapter, buffer_info); | 997 | e1000_put_txbuf(adapter, buffer_info); |
@@ -756,9 +1094,9 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | |||
756 | 1094 | ||
757 | cleaned = 1; | 1095 | cleaned = 1; |
758 | cleaned_count++; | 1096 | cleaned_count++; |
759 | pci_unmap_single(pdev, buffer_info->dma, | 1097 | dma_unmap_single(&pdev->dev, buffer_info->dma, |
760 | adapter->rx_ps_bsize0, | 1098 | adapter->rx_ps_bsize0, |
761 | PCI_DMA_FROMDEVICE); | 1099 | DMA_FROM_DEVICE); |
762 | buffer_info->dma = 0; | 1100 | buffer_info->dma = 0; |
763 | 1101 | ||
764 | /* see !EOP comment in other rx routine */ | 1102 | /* see !EOP comment in other rx routine */ |
@@ -814,13 +1152,13 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | |||
814 | * kmap_atomic, so we can't hold the mapping | 1152 | * kmap_atomic, so we can't hold the mapping |
815 | * very long | 1153 | * very long |
816 | */ | 1154 | */ |
817 | pci_dma_sync_single_for_cpu(pdev, ps_page->dma, | 1155 | dma_sync_single_for_cpu(&pdev->dev, ps_page->dma, |
818 | PAGE_SIZE, PCI_DMA_FROMDEVICE); | 1156 | PAGE_SIZE, DMA_FROM_DEVICE); |
819 | vaddr = kmap_atomic(ps_page->page, KM_SKB_DATA_SOFTIRQ); | 1157 | vaddr = kmap_atomic(ps_page->page, KM_SKB_DATA_SOFTIRQ); |
820 | memcpy(skb_tail_pointer(skb), vaddr, l1); | 1158 | memcpy(skb_tail_pointer(skb), vaddr, l1); |
821 | kunmap_atomic(vaddr, KM_SKB_DATA_SOFTIRQ); | 1159 | kunmap_atomic(vaddr, KM_SKB_DATA_SOFTIRQ); |
822 | pci_dma_sync_single_for_device(pdev, ps_page->dma, | 1160 | dma_sync_single_for_device(&pdev->dev, ps_page->dma, |
823 | PAGE_SIZE, PCI_DMA_FROMDEVICE); | 1161 | PAGE_SIZE, DMA_FROM_DEVICE); |
824 | 1162 | ||
825 | /* remove the CRC */ | 1163 | /* remove the CRC */ |
826 | if (!(adapter->flags2 & FLAG2_CRC_STRIPPING)) | 1164 | if (!(adapter->flags2 & FLAG2_CRC_STRIPPING)) |
@@ -837,8 +1175,8 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | |||
837 | break; | 1175 | break; |
838 | 1176 | ||
839 | ps_page = &buffer_info->ps_pages[j]; | 1177 | ps_page = &buffer_info->ps_pages[j]; |
840 | pci_unmap_page(pdev, ps_page->dma, PAGE_SIZE, | 1178 | dma_unmap_page(&pdev->dev, ps_page->dma, PAGE_SIZE, |
841 | PCI_DMA_FROMDEVICE); | 1179 | DMA_FROM_DEVICE); |
842 | ps_page->dma = 0; | 1180 | ps_page->dma = 0; |
843 | skb_fill_page_desc(skb, j, ps_page->page, 0, length); | 1181 | skb_fill_page_desc(skb, j, ps_page->page, 0, length); |
844 | ps_page->page = NULL; | 1182 | ps_page->page = NULL; |
@@ -956,8 +1294,8 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter, | |||
956 | 1294 | ||
957 | cleaned = true; | 1295 | cleaned = true; |
958 | cleaned_count++; | 1296 | cleaned_count++; |
959 | pci_unmap_page(pdev, buffer_info->dma, PAGE_SIZE, | 1297 | dma_unmap_page(&pdev->dev, buffer_info->dma, PAGE_SIZE, |
960 | PCI_DMA_FROMDEVICE); | 1298 | DMA_FROM_DEVICE); |
961 | buffer_info->dma = 0; | 1299 | buffer_info->dma = 0; |
962 | 1300 | ||
963 | length = le16_to_cpu(rx_desc->length); | 1301 | length = le16_to_cpu(rx_desc->length); |
@@ -1093,17 +1431,17 @@ static void e1000_clean_rx_ring(struct e1000_adapter *adapter) | |||
1093 | buffer_info = &rx_ring->buffer_info[i]; | 1431 | buffer_info = &rx_ring->buffer_info[i]; |
1094 | if (buffer_info->dma) { | 1432 | if (buffer_info->dma) { |
1095 | if (adapter->clean_rx == e1000_clean_rx_irq) | 1433 | if (adapter->clean_rx == e1000_clean_rx_irq) |
1096 | pci_unmap_single(pdev, buffer_info->dma, | 1434 | dma_unmap_single(&pdev->dev, buffer_info->dma, |
1097 | adapter->rx_buffer_len, | 1435 | adapter->rx_buffer_len, |
1098 | PCI_DMA_FROMDEVICE); | 1436 | DMA_FROM_DEVICE); |
1099 | else if (adapter->clean_rx == e1000_clean_jumbo_rx_irq) | 1437 | else if (adapter->clean_rx == e1000_clean_jumbo_rx_irq) |
1100 | pci_unmap_page(pdev, buffer_info->dma, | 1438 | dma_unmap_page(&pdev->dev, buffer_info->dma, |
1101 | PAGE_SIZE, | 1439 | PAGE_SIZE, |
1102 | PCI_DMA_FROMDEVICE); | 1440 | DMA_FROM_DEVICE); |
1103 | else if (adapter->clean_rx == e1000_clean_rx_irq_ps) | 1441 | else if (adapter->clean_rx == e1000_clean_rx_irq_ps) |
1104 | pci_unmap_single(pdev, buffer_info->dma, | 1442 | dma_unmap_single(&pdev->dev, buffer_info->dma, |
1105 | adapter->rx_ps_bsize0, | 1443 | adapter->rx_ps_bsize0, |
1106 | PCI_DMA_FROMDEVICE); | 1444 | DMA_FROM_DEVICE); |
1107 | buffer_info->dma = 0; | 1445 | buffer_info->dma = 0; |
1108 | } | 1446 | } |
1109 | 1447 | ||
@@ -1121,8 +1459,8 @@ static void e1000_clean_rx_ring(struct e1000_adapter *adapter) | |||
1121 | ps_page = &buffer_info->ps_pages[j]; | 1459 | ps_page = &buffer_info->ps_pages[j]; |
1122 | if (!ps_page->page) | 1460 | if (!ps_page->page) |
1123 | break; | 1461 | break; |
1124 | pci_unmap_page(pdev, ps_page->dma, PAGE_SIZE, | 1462 | dma_unmap_page(&pdev->dev, ps_page->dma, PAGE_SIZE, |
1125 | PCI_DMA_FROMDEVICE); | 1463 | DMA_FROM_DEVICE); |
1126 | ps_page->dma = 0; | 1464 | ps_page->dma = 0; |
1127 | put_page(ps_page->page); | 1465 | put_page(ps_page->page); |
1128 | ps_page->page = NULL; | 1466 | ps_page->page = NULL; |
@@ -3732,6 +4070,22 @@ link_up: | |||
3732 | } | 4070 | } |
3733 | } | 4071 | } |
3734 | 4072 | ||
4073 | /* Simple mode for Interrupt Throttle Rate (ITR) */ | ||
4074 | if (adapter->itr_setting == 4) { | ||
4075 | /* | ||
4076 | * Symmetric Tx/Rx gets a reduced ITR=2000; | ||
4077 | * Total asymmetrical Tx or Rx gets ITR=8000; | ||
4078 | * everyone else is between 2000-8000. | ||
4079 | */ | ||
4080 | u32 goc = (adapter->gotc + adapter->gorc) / 10000; | ||
4081 | u32 dif = (adapter->gotc > adapter->gorc ? | ||
4082 | adapter->gotc - adapter->gorc : | ||
4083 | adapter->gorc - adapter->gotc) / 10000; | ||
4084 | u32 itr = goc > 0 ? (dif * 6000 / goc + 2000) : 8000; | ||
4085 | |||
4086 | ew32(ITR, 1000000000 / (itr * 256)); | ||
4087 | } | ||
4088 | |||
3735 | /* Cause software interrupt to ensure Rx ring is cleaned */ | 4089 | /* Cause software interrupt to ensure Rx ring is cleaned */ |
3736 | if (adapter->msix_entries) | 4090 | if (adapter->msix_entries) |
3737 | ew32(ICS, adapter->rx_ring->ims_val); | 4091 | ew32(ICS, adapter->rx_ring->ims_val); |
@@ -3906,7 +4260,7 @@ static int e1000_tx_map(struct e1000_adapter *adapter, | |||
3906 | struct e1000_buffer *buffer_info; | 4260 | struct e1000_buffer *buffer_info; |
3907 | unsigned int len = skb_headlen(skb); | 4261 | unsigned int len = skb_headlen(skb); |
3908 | unsigned int offset = 0, size, count = 0, i; | 4262 | unsigned int offset = 0, size, count = 0, i; |
3909 | unsigned int f; | 4263 | unsigned int f, bytecount, segs; |
3910 | 4264 | ||
3911 | i = tx_ring->next_to_use; | 4265 | i = tx_ring->next_to_use; |
3912 | 4266 | ||
@@ -3917,10 +4271,11 @@ static int e1000_tx_map(struct e1000_adapter *adapter, | |||
3917 | buffer_info->length = size; | 4271 | buffer_info->length = size; |
3918 | buffer_info->time_stamp = jiffies; | 4272 | buffer_info->time_stamp = jiffies; |
3919 | buffer_info->next_to_watch = i; | 4273 | buffer_info->next_to_watch = i; |
3920 | buffer_info->dma = pci_map_single(pdev, skb->data + offset, | 4274 | buffer_info->dma = dma_map_single(&pdev->dev, |
3921 | size, PCI_DMA_TODEVICE); | 4275 | skb->data + offset, |
4276 | size, DMA_TO_DEVICE); | ||
3922 | buffer_info->mapped_as_page = false; | 4277 | buffer_info->mapped_as_page = false; |
3923 | if (pci_dma_mapping_error(pdev, buffer_info->dma)) | 4278 | if (dma_mapping_error(&pdev->dev, buffer_info->dma)) |
3924 | goto dma_error; | 4279 | goto dma_error; |
3925 | 4280 | ||
3926 | len -= size; | 4281 | len -= size; |
@@ -3952,11 +4307,11 @@ static int e1000_tx_map(struct e1000_adapter *adapter, | |||
3952 | buffer_info->length = size; | 4307 | buffer_info->length = size; |
3953 | buffer_info->time_stamp = jiffies; | 4308 | buffer_info->time_stamp = jiffies; |
3954 | buffer_info->next_to_watch = i; | 4309 | buffer_info->next_to_watch = i; |
3955 | buffer_info->dma = pci_map_page(pdev, frag->page, | 4310 | buffer_info->dma = dma_map_page(&pdev->dev, frag->page, |
3956 | offset, size, | 4311 | offset, size, |
3957 | PCI_DMA_TODEVICE); | 4312 | DMA_TO_DEVICE); |
3958 | buffer_info->mapped_as_page = true; | 4313 | buffer_info->mapped_as_page = true; |
3959 | if (pci_dma_mapping_error(pdev, buffer_info->dma)) | 4314 | if (dma_mapping_error(&pdev->dev, buffer_info->dma)) |
3960 | goto dma_error; | 4315 | goto dma_error; |
3961 | 4316 | ||
3962 | len -= size; | 4317 | len -= size; |
@@ -3965,7 +4320,13 @@ static int e1000_tx_map(struct e1000_adapter *adapter, | |||
3965 | } | 4320 | } |
3966 | } | 4321 | } |
3967 | 4322 | ||
4323 | segs = skb_shinfo(skb)->gso_segs ?: 1; | ||
4324 | /* multiply data chunks by size of headers */ | ||
4325 | bytecount = ((segs - 1) * skb_headlen(skb)) + skb->len; | ||
4326 | |||
3968 | tx_ring->buffer_info[i].skb = skb; | 4327 | tx_ring->buffer_info[i].skb = skb; |
4328 | tx_ring->buffer_info[i].segs = segs; | ||
4329 | tx_ring->buffer_info[i].bytecount = bytecount; | ||
3969 | tx_ring->buffer_info[first].next_to_watch = i; | 4330 | tx_ring->buffer_info[first].next_to_watch = i; |
3970 | 4331 | ||
3971 | return count; | 4332 | return count; |
@@ -4268,6 +4629,8 @@ static void e1000_reset_task(struct work_struct *work) | |||
4268 | struct e1000_adapter *adapter; | 4629 | struct e1000_adapter *adapter; |
4269 | adapter = container_of(work, struct e1000_adapter, reset_task); | 4630 | adapter = container_of(work, struct e1000_adapter, reset_task); |
4270 | 4631 | ||
4632 | e1000e_dump(adapter); | ||
4633 | e_err("Reset adapter\n"); | ||
4271 | e1000e_reinit_locked(adapter); | 4634 | e1000e_reinit_locked(adapter); |
4272 | } | 4635 | } |
4273 | 4636 | ||
@@ -4310,6 +4673,14 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
4310 | return -EINVAL; | 4673 | return -EINVAL; |
4311 | } | 4674 | } |
4312 | 4675 | ||
4676 | /* 82573 Errata 17 */ | ||
4677 | if (((adapter->hw.mac.type == e1000_82573) || | ||
4678 | (adapter->hw.mac.type == e1000_82574)) && | ||
4679 | (max_frame > ETH_FRAME_LEN + ETH_FCS_LEN)) { | ||
4680 | adapter->flags2 |= FLAG2_DISABLE_ASPM_L1; | ||
4681 | e1000e_disable_aspm(adapter->pdev, PCIE_LINK_STATE_L1); | ||
4682 | } | ||
4683 | |||
4313 | while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) | 4684 | while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) |
4314 | msleep(1); | 4685 | msleep(1); |
4315 | /* e1000e_down -> e1000e_reset dependent on max_frame_size & mtu */ | 4686 | /* e1000e_down -> e1000e_reset dependent on max_frame_size & mtu */ |
@@ -4634,29 +5005,42 @@ static void e1000_complete_shutdown(struct pci_dev *pdev, bool sleep, | |||
4634 | } | 5005 | } |
4635 | } | 5006 | } |
4636 | 5007 | ||
4637 | static void e1000e_disable_l1aspm(struct pci_dev *pdev) | 5008 | #ifdef CONFIG_PCIEASPM |
5009 | static void __e1000e_disable_aspm(struct pci_dev *pdev, u16 state) | ||
5010 | { | ||
5011 | pci_disable_link_state(pdev, state); | ||
5012 | } | ||
5013 | #else | ||
5014 | static void __e1000e_disable_aspm(struct pci_dev *pdev, u16 state) | ||
4638 | { | 5015 | { |
4639 | int pos; | 5016 | int pos; |
4640 | u16 val; | 5017 | u16 reg16; |
4641 | 5018 | ||
4642 | /* | 5019 | /* |
4643 | * 82573 workaround - disable L1 ASPM on mobile chipsets | 5020 | * Both device and parent should have the same ASPM setting. |
4644 | * | 5021 | * Disable ASPM in downstream component first and then upstream. |
4645 | * L1 ASPM on various mobile (ich7) chipsets do not behave properly | ||
4646 | * resulting in lost data or garbage information on the pci-e link | ||
4647 | * level. This could result in (false) bad EEPROM checksum errors, | ||
4648 | * long ping times (up to 2s) or even a system freeze/hang. | ||
4649 | * | ||
4650 | * Unfortunately this feature saves about 1W power consumption when | ||
4651 | * active. | ||
4652 | */ | 5022 | */ |
4653 | pos = pci_find_capability(pdev, PCI_CAP_ID_EXP); | 5023 | pos = pci_pcie_cap(pdev); |
4654 | pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, &val); | 5024 | pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, ®16); |
4655 | if (val & 0x2) { | 5025 | reg16 &= ~state; |
4656 | dev_warn(&pdev->dev, "Disabling L1 ASPM\n"); | 5026 | pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, reg16); |
4657 | val &= ~0x2; | 5027 | |
4658 | pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, val); | 5028 | if (!pdev->bus->self) |
4659 | } | 5029 | return; |
5030 | |||
5031 | pos = pci_pcie_cap(pdev->bus->self); | ||
5032 | pci_read_config_word(pdev->bus->self, pos + PCI_EXP_LNKCTL, ®16); | ||
5033 | reg16 &= ~state; | ||
5034 | pci_write_config_word(pdev->bus->self, pos + PCI_EXP_LNKCTL, reg16); | ||
5035 | } | ||
5036 | #endif | ||
5037 | void e1000e_disable_aspm(struct pci_dev *pdev, u16 state) | ||
5038 | { | ||
5039 | dev_info(&pdev->dev, "Disabling ASPM %s %s\n", | ||
5040 | (state & PCIE_LINK_STATE_L0S) ? "L0s" : "", | ||
5041 | (state & PCIE_LINK_STATE_L1) ? "L1" : ""); | ||
5042 | |||
5043 | __e1000e_disable_aspm(pdev, state); | ||
4660 | } | 5044 | } |
4661 | 5045 | ||
4662 | #ifdef CONFIG_PM_OPS | 5046 | #ifdef CONFIG_PM_OPS |
@@ -4672,7 +5056,11 @@ static int __e1000_resume(struct pci_dev *pdev) | |||
4672 | struct e1000_hw *hw = &adapter->hw; | 5056 | struct e1000_hw *hw = &adapter->hw; |
4673 | u32 err; | 5057 | u32 err; |
4674 | 5058 | ||
4675 | e1000e_disable_l1aspm(pdev); | 5059 | pci_set_power_state(pdev, PCI_D0); |
5060 | pci_restore_state(pdev); | ||
5061 | pci_save_state(pdev); | ||
5062 | if (adapter->flags2 & FLAG2_DISABLE_ASPM_L1) | ||
5063 | e1000e_disable_aspm(pdev, PCIE_LINK_STATE_L1); | ||
4676 | 5064 | ||
4677 | e1000e_set_interrupt_capability(adapter); | 5065 | e1000e_set_interrupt_capability(adapter); |
4678 | if (netif_running(netdev)) { | 5066 | if (netif_running(netdev)) { |
@@ -4877,7 +5265,8 @@ static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev) | |||
4877 | int err; | 5265 | int err; |
4878 | pci_ers_result_t result; | 5266 | pci_ers_result_t result; |
4879 | 5267 | ||
4880 | e1000e_disable_l1aspm(pdev); | 5268 | if (adapter->flags2 & FLAG2_DISABLE_ASPM_L1) |
5269 | e1000e_disable_aspm(pdev, PCIE_LINK_STATE_L1); | ||
4881 | err = pci_enable_device_mem(pdev); | 5270 | err = pci_enable_device_mem(pdev); |
4882 | if (err) { | 5271 | if (err) { |
4883 | dev_err(&pdev->dev, | 5272 | dev_err(&pdev->dev, |
@@ -4971,13 +5360,6 @@ static void e1000_eeprom_checks(struct e1000_adapter *adapter) | |||
4971 | dev_warn(&adapter->pdev->dev, | 5360 | dev_warn(&adapter->pdev->dev, |
4972 | "Warning: detected DSPD enabled in EEPROM\n"); | 5361 | "Warning: detected DSPD enabled in EEPROM\n"); |
4973 | } | 5362 | } |
4974 | |||
4975 | ret_val = e1000_read_nvm(hw, NVM_INIT_3GIO_3, 1, &buf); | ||
4976 | if (!ret_val && (le16_to_cpu(buf) & (3 << 2))) { | ||
4977 | /* ASPM enable */ | ||
4978 | dev_warn(&adapter->pdev->dev, | ||
4979 | "Warning: detected ASPM enabled in EEPROM\n"); | ||
4980 | } | ||
4981 | } | 5363 | } |
4982 | 5364 | ||
4983 | static const struct net_device_ops e1000e_netdev_ops = { | 5365 | static const struct net_device_ops e1000e_netdev_ops = { |
@@ -5026,23 +5408,24 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
5026 | u16 eeprom_data = 0; | 5408 | u16 eeprom_data = 0; |
5027 | u16 eeprom_apme_mask = E1000_EEPROM_APME; | 5409 | u16 eeprom_apme_mask = E1000_EEPROM_APME; |
5028 | 5410 | ||
5029 | e1000e_disable_l1aspm(pdev); | 5411 | if (ei->flags2 & FLAG2_DISABLE_ASPM_L1) |
5412 | e1000e_disable_aspm(pdev, PCIE_LINK_STATE_L1); | ||
5030 | 5413 | ||
5031 | err = pci_enable_device_mem(pdev); | 5414 | err = pci_enable_device_mem(pdev); |
5032 | if (err) | 5415 | if (err) |
5033 | return err; | 5416 | return err; |
5034 | 5417 | ||
5035 | pci_using_dac = 0; | 5418 | pci_using_dac = 0; |
5036 | err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64)); | 5419 | err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)); |
5037 | if (!err) { | 5420 | if (!err) { |
5038 | err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); | 5421 | err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64)); |
5039 | if (!err) | 5422 | if (!err) |
5040 | pci_using_dac = 1; | 5423 | pci_using_dac = 1; |
5041 | } else { | 5424 | } else { |
5042 | err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | 5425 | err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); |
5043 | if (err) { | 5426 | if (err) { |
5044 | err = pci_set_consistent_dma_mask(pdev, | 5427 | err = dma_set_coherent_mask(&pdev->dev, |
5045 | DMA_BIT_MASK(32)); | 5428 | DMA_BIT_MASK(32)); |
5046 | if (err) { | 5429 | if (err) { |
5047 | dev_err(&pdev->dev, "No usable DMA " | 5430 | dev_err(&pdev->dev, "No usable DMA " |
5048 | "configuration, aborting\n"); | 5431 | "configuration, aborting\n"); |
@@ -5073,6 +5456,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
5073 | 5456 | ||
5074 | SET_NETDEV_DEV(netdev, &pdev->dev); | 5457 | SET_NETDEV_DEV(netdev, &pdev->dev); |
5075 | 5458 | ||
5459 | netdev->irq = pdev->irq; | ||
5460 | |||
5076 | pci_set_drvdata(pdev, netdev); | 5461 | pci_set_drvdata(pdev, netdev); |
5077 | adapter = netdev_priv(netdev); | 5462 | adapter = netdev_priv(netdev); |
5078 | hw = &adapter->hw; | 5463 | hw = &adapter->hw; |
diff --git a/drivers/net/e1000e/param.c b/drivers/net/e1000e/param.c index f775a481063d..0f4077c3d538 100644 --- a/drivers/net/e1000e/param.c +++ b/drivers/net/e1000e/param.c | |||
@@ -351,6 +351,11 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) | |||
351 | adapter->itr_setting = adapter->itr; | 351 | adapter->itr_setting = adapter->itr; |
352 | adapter->itr = 20000; | 352 | adapter->itr = 20000; |
353 | break; | 353 | break; |
354 | case 4: | ||
355 | e_info("%s set to simplified (2000-8000 ints) " | ||
356 | "mode\n", opt.name); | ||
357 | adapter->itr_setting = 4; | ||
358 | break; | ||
354 | default: | 359 | default: |
355 | /* | 360 | /* |
356 | * Save the setting, because the dynamic bits | 361 | * Save the setting, because the dynamic bits |