diff options
Diffstat (limited to 'drivers/net/e1000')
-rw-r--r-- | drivers/net/e1000/e1000.h | 74 | ||||
-rw-r--r-- | drivers/net/e1000/e1000_ethtool.c | 95 | ||||
-rw-r--r-- | drivers/net/e1000/e1000_hw.c | 220 | ||||
-rw-r--r-- | drivers/net/e1000/e1000_hw.h | 96 | ||||
-rw-r--r-- | drivers/net/e1000/e1000_main.c | 1078 | ||||
-rw-r--r-- | drivers/net/e1000/e1000_param.c | 10 |
6 files changed, 1228 insertions, 345 deletions
diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h index 092757bc721f..3f653a93e1bc 100644 --- a/drivers/net/e1000/e1000.h +++ b/drivers/net/e1000/e1000.h | |||
@@ -72,6 +72,10 @@ | |||
72 | #include <linux/mii.h> | 72 | #include <linux/mii.h> |
73 | #include <linux/ethtool.h> | 73 | #include <linux/ethtool.h> |
74 | #include <linux/if_vlan.h> | 74 | #include <linux/if_vlan.h> |
75 | #ifdef CONFIG_E1000_MQ | ||
76 | #include <linux/cpu.h> | ||
77 | #include <linux/smp.h> | ||
78 | #endif | ||
75 | 79 | ||
76 | #define BAR_0 0 | 80 | #define BAR_0 0 |
77 | #define BAR_1 1 | 81 | #define BAR_1 1 |
@@ -165,10 +169,33 @@ struct e1000_buffer { | |||
165 | uint16_t next_to_watch; | 169 | uint16_t next_to_watch; |
166 | }; | 170 | }; |
167 | 171 | ||
168 | struct e1000_ps_page { struct page *ps_page[MAX_PS_BUFFERS]; }; | 172 | struct e1000_ps_page { struct page *ps_page[PS_PAGE_BUFFERS]; }; |
169 | struct e1000_ps_page_dma { uint64_t ps_page_dma[MAX_PS_BUFFERS]; }; | 173 | struct e1000_ps_page_dma { uint64_t ps_page_dma[PS_PAGE_BUFFERS]; }; |
174 | |||
175 | struct e1000_tx_ring { | ||
176 | /* pointer to the descriptor ring memory */ | ||
177 | void *desc; | ||
178 | /* physical address of the descriptor ring */ | ||
179 | dma_addr_t dma; | ||
180 | /* length of descriptor ring in bytes */ | ||
181 | unsigned int size; | ||
182 | /* number of descriptors in the ring */ | ||
183 | unsigned int count; | ||
184 | /* next descriptor to associate a buffer with */ | ||
185 | unsigned int next_to_use; | ||
186 | /* next descriptor to check for DD status bit */ | ||
187 | unsigned int next_to_clean; | ||
188 | /* array of buffer information structs */ | ||
189 | struct e1000_buffer *buffer_info; | ||
190 | |||
191 | struct e1000_buffer previous_buffer_info; | ||
192 | spinlock_t tx_lock; | ||
193 | uint16_t tdh; | ||
194 | uint16_t tdt; | ||
195 | uint64_t pkt; | ||
196 | }; | ||
170 | 197 | ||
171 | struct e1000_desc_ring { | 198 | struct e1000_rx_ring { |
172 | /* pointer to the descriptor ring memory */ | 199 | /* pointer to the descriptor ring memory */ |
173 | void *desc; | 200 | void *desc; |
174 | /* physical address of the descriptor ring */ | 201 | /* physical address of the descriptor ring */ |
@@ -186,6 +213,10 @@ struct e1000_desc_ring { | |||
186 | /* arrays of page information for packet split */ | 213 | /* arrays of page information for packet split */ |
187 | struct e1000_ps_page *ps_page; | 214 | struct e1000_ps_page *ps_page; |
188 | struct e1000_ps_page_dma *ps_page_dma; | 215 | struct e1000_ps_page_dma *ps_page_dma; |
216 | |||
217 | uint16_t rdh; | ||
218 | uint16_t rdt; | ||
219 | uint64_t pkt; | ||
189 | }; | 220 | }; |
190 | 221 | ||
191 | #define E1000_DESC_UNUSED(R) \ | 222 | #define E1000_DESC_UNUSED(R) \ |
@@ -227,9 +258,10 @@ struct e1000_adapter { | |||
227 | unsigned long led_status; | 258 | unsigned long led_status; |
228 | 259 | ||
229 | /* TX */ | 260 | /* TX */ |
230 | struct e1000_desc_ring tx_ring; | 261 | struct e1000_tx_ring *tx_ring; /* One per active queue */ |
231 | struct e1000_buffer previous_buffer_info; | 262 | #ifdef CONFIG_E1000_MQ |
232 | spinlock_t tx_lock; | 263 | struct e1000_tx_ring **cpu_tx_ring; /* per-cpu */ |
264 | #endif | ||
233 | uint32_t txd_cmd; | 265 | uint32_t txd_cmd; |
234 | uint32_t tx_int_delay; | 266 | uint32_t tx_int_delay; |
235 | uint32_t tx_abs_int_delay; | 267 | uint32_t tx_abs_int_delay; |
@@ -246,19 +278,33 @@ struct e1000_adapter { | |||
246 | 278 | ||
247 | /* RX */ | 279 | /* RX */ |
248 | #ifdef CONFIG_E1000_NAPI | 280 | #ifdef CONFIG_E1000_NAPI |
249 | boolean_t (*clean_rx) (struct e1000_adapter *adapter, int *work_done, | 281 | boolean_t (*clean_rx) (struct e1000_adapter *adapter, |
250 | int work_to_do); | 282 | struct e1000_rx_ring *rx_ring, |
283 | int *work_done, int work_to_do); | ||
251 | #else | 284 | #else |
252 | boolean_t (*clean_rx) (struct e1000_adapter *adapter); | 285 | boolean_t (*clean_rx) (struct e1000_adapter *adapter, |
286 | struct e1000_rx_ring *rx_ring); | ||
253 | #endif | 287 | #endif |
254 | void (*alloc_rx_buf) (struct e1000_adapter *adapter); | 288 | void (*alloc_rx_buf) (struct e1000_adapter *adapter, |
255 | struct e1000_desc_ring rx_ring; | 289 | struct e1000_rx_ring *rx_ring); |
290 | struct e1000_rx_ring *rx_ring; /* One per active queue */ | ||
291 | #ifdef CONFIG_E1000_NAPI | ||
292 | struct net_device *polling_netdev; /* One per active queue */ | ||
293 | #endif | ||
294 | #ifdef CONFIG_E1000_MQ | ||
295 | struct net_device **cpu_netdev; /* per-cpu */ | ||
296 | struct call_async_data_struct rx_sched_call_data; | ||
297 | int cpu_for_queue[4]; | ||
298 | #endif | ||
299 | int num_queues; | ||
300 | |||
256 | uint64_t hw_csum_err; | 301 | uint64_t hw_csum_err; |
257 | uint64_t hw_csum_good; | 302 | uint64_t hw_csum_good; |
303 | uint64_t rx_hdr_split; | ||
258 | uint32_t rx_int_delay; | 304 | uint32_t rx_int_delay; |
259 | uint32_t rx_abs_int_delay; | 305 | uint32_t rx_abs_int_delay; |
260 | boolean_t rx_csum; | 306 | boolean_t rx_csum; |
261 | boolean_t rx_ps; | 307 | unsigned int rx_ps_pages; |
262 | uint32_t gorcl; | 308 | uint32_t gorcl; |
263 | uint64_t gorcl_old; | 309 | uint64_t gorcl_old; |
264 | uint16_t rx_ps_bsize0; | 310 | uint16_t rx_ps_bsize0; |
@@ -278,8 +324,8 @@ struct e1000_adapter { | |||
278 | struct e1000_phy_stats phy_stats; | 324 | struct e1000_phy_stats phy_stats; |
279 | 325 | ||
280 | uint32_t test_icr; | 326 | uint32_t test_icr; |
281 | struct e1000_desc_ring test_tx_ring; | 327 | struct e1000_tx_ring test_tx_ring; |
282 | struct e1000_desc_ring test_rx_ring; | 328 | struct e1000_rx_ring test_rx_ring; |
283 | 329 | ||
284 | 330 | ||
285 | int msg_enable; | 331 | int msg_enable; |
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c index f133ff0b0b94..6b9acc7f94a3 100644 --- a/drivers/net/e1000/e1000_ethtool.c +++ b/drivers/net/e1000/e1000_ethtool.c | |||
@@ -39,10 +39,10 @@ extern int e1000_up(struct e1000_adapter *adapter); | |||
39 | extern void e1000_down(struct e1000_adapter *adapter); | 39 | extern void e1000_down(struct e1000_adapter *adapter); |
40 | extern void e1000_reset(struct e1000_adapter *adapter); | 40 | extern void e1000_reset(struct e1000_adapter *adapter); |
41 | extern int e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx); | 41 | extern int e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx); |
42 | extern int e1000_setup_rx_resources(struct e1000_adapter *adapter); | 42 | extern int e1000_setup_all_rx_resources(struct e1000_adapter *adapter); |
43 | extern int e1000_setup_tx_resources(struct e1000_adapter *adapter); | 43 | extern int e1000_setup_all_tx_resources(struct e1000_adapter *adapter); |
44 | extern void e1000_free_rx_resources(struct e1000_adapter *adapter); | 44 | extern void e1000_free_all_rx_resources(struct e1000_adapter *adapter); |
45 | extern void e1000_free_tx_resources(struct e1000_adapter *adapter); | 45 | extern void e1000_free_all_tx_resources(struct e1000_adapter *adapter); |
46 | extern void e1000_update_stats(struct e1000_adapter *adapter); | 46 | extern void e1000_update_stats(struct e1000_adapter *adapter); |
47 | 47 | ||
48 | struct e1000_stats { | 48 | struct e1000_stats { |
@@ -91,7 +91,8 @@ static const struct e1000_stats e1000_gstrings_stats[] = { | |||
91 | { "tx_flow_control_xoff", E1000_STAT(stats.xofftxc) }, | 91 | { "tx_flow_control_xoff", E1000_STAT(stats.xofftxc) }, |
92 | { "rx_long_byte_count", E1000_STAT(stats.gorcl) }, | 92 | { "rx_long_byte_count", E1000_STAT(stats.gorcl) }, |
93 | { "rx_csum_offload_good", E1000_STAT(hw_csum_good) }, | 93 | { "rx_csum_offload_good", E1000_STAT(hw_csum_good) }, |
94 | { "rx_csum_offload_errors", E1000_STAT(hw_csum_err) } | 94 | { "rx_csum_offload_errors", E1000_STAT(hw_csum_err) }, |
95 | { "rx_header_split", E1000_STAT(rx_hdr_split) }, | ||
95 | }; | 96 | }; |
96 | #define E1000_STATS_LEN \ | 97 | #define E1000_STATS_LEN \ |
97 | sizeof(e1000_gstrings_stats) / sizeof(struct e1000_stats) | 98 | sizeof(e1000_gstrings_stats) / sizeof(struct e1000_stats) |
@@ -546,8 +547,10 @@ e1000_set_eeprom(struct net_device *netdev, | |||
546 | ret_val = e1000_write_eeprom(hw, first_word, | 547 | ret_val = e1000_write_eeprom(hw, first_word, |
547 | last_word - first_word + 1, eeprom_buff); | 548 | last_word - first_word + 1, eeprom_buff); |
548 | 549 | ||
549 | /* Update the checksum over the first part of the EEPROM if needed */ | 550 | /* Update the checksum over the first part of the EEPROM if needed |
550 | if((ret_val == 0) && first_word <= EEPROM_CHECKSUM_REG) | 551 | * and flush shadow RAM for 82573 conrollers */ |
552 | if((ret_val == 0) && ((first_word <= EEPROM_CHECKSUM_REG) || | ||
553 | (hw->mac_type == e1000_82573))) | ||
551 | e1000_update_eeprom_checksum(hw); | 554 | e1000_update_eeprom_checksum(hw); |
552 | 555 | ||
553 | kfree(eeprom_buff); | 556 | kfree(eeprom_buff); |
@@ -576,8 +579,8 @@ e1000_get_ringparam(struct net_device *netdev, | |||
576 | { | 579 | { |
577 | struct e1000_adapter *adapter = netdev_priv(netdev); | 580 | struct e1000_adapter *adapter = netdev_priv(netdev); |
578 | e1000_mac_type mac_type = adapter->hw.mac_type; | 581 | e1000_mac_type mac_type = adapter->hw.mac_type; |
579 | struct e1000_desc_ring *txdr = &adapter->tx_ring; | 582 | struct e1000_tx_ring *txdr = adapter->tx_ring; |
580 | struct e1000_desc_ring *rxdr = &adapter->rx_ring; | 583 | struct e1000_rx_ring *rxdr = adapter->rx_ring; |
581 | 584 | ||
582 | ring->rx_max_pending = (mac_type < e1000_82544) ? E1000_MAX_RXD : | 585 | ring->rx_max_pending = (mac_type < e1000_82544) ? E1000_MAX_RXD : |
583 | E1000_MAX_82544_RXD; | 586 | E1000_MAX_82544_RXD; |
@@ -597,20 +600,40 @@ e1000_set_ringparam(struct net_device *netdev, | |||
597 | { | 600 | { |
598 | struct e1000_adapter *adapter = netdev_priv(netdev); | 601 | struct e1000_adapter *adapter = netdev_priv(netdev); |
599 | e1000_mac_type mac_type = adapter->hw.mac_type; | 602 | e1000_mac_type mac_type = adapter->hw.mac_type; |
600 | struct e1000_desc_ring *txdr = &adapter->tx_ring; | 603 | struct e1000_tx_ring *txdr, *tx_old, *tx_new; |
601 | struct e1000_desc_ring *rxdr = &adapter->rx_ring; | 604 | struct e1000_rx_ring *rxdr, *rx_old, *rx_new; |
602 | struct e1000_desc_ring tx_old, tx_new, rx_old, rx_new; | 605 | int i, err, tx_ring_size, rx_ring_size; |
603 | int err; | 606 | |
607 | tx_ring_size = sizeof(struct e1000_tx_ring) * adapter->num_queues; | ||
608 | rx_ring_size = sizeof(struct e1000_rx_ring) * adapter->num_queues; | ||
609 | |||
610 | if (netif_running(adapter->netdev)) | ||
611 | e1000_down(adapter); | ||
604 | 612 | ||
605 | tx_old = adapter->tx_ring; | 613 | tx_old = adapter->tx_ring; |
606 | rx_old = adapter->rx_ring; | 614 | rx_old = adapter->rx_ring; |
607 | 615 | ||
616 | adapter->tx_ring = kmalloc(tx_ring_size, GFP_KERNEL); | ||
617 | if (!adapter->tx_ring) { | ||
618 | err = -ENOMEM; | ||
619 | goto err_setup_rx; | ||
620 | } | ||
621 | memset(adapter->tx_ring, 0, tx_ring_size); | ||
622 | |||
623 | adapter->rx_ring = kmalloc(rx_ring_size, GFP_KERNEL); | ||
624 | if (!adapter->rx_ring) { | ||
625 | kfree(adapter->tx_ring); | ||
626 | err = -ENOMEM; | ||
627 | goto err_setup_rx; | ||
628 | } | ||
629 | memset(adapter->rx_ring, 0, rx_ring_size); | ||
630 | |||
631 | txdr = adapter->tx_ring; | ||
632 | rxdr = adapter->rx_ring; | ||
633 | |||
608 | if((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) | 634 | if((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) |
609 | return -EINVAL; | 635 | return -EINVAL; |
610 | 636 | ||
611 | if(netif_running(adapter->netdev)) | ||
612 | e1000_down(adapter); | ||
613 | |||
614 | rxdr->count = max(ring->rx_pending,(uint32_t)E1000_MIN_RXD); | 637 | rxdr->count = max(ring->rx_pending,(uint32_t)E1000_MIN_RXD); |
615 | rxdr->count = min(rxdr->count,(uint32_t)(mac_type < e1000_82544 ? | 638 | rxdr->count = min(rxdr->count,(uint32_t)(mac_type < e1000_82544 ? |
616 | E1000_MAX_RXD : E1000_MAX_82544_RXD)); | 639 | E1000_MAX_RXD : E1000_MAX_82544_RXD)); |
@@ -621,11 +644,16 @@ e1000_set_ringparam(struct net_device *netdev, | |||
621 | E1000_MAX_TXD : E1000_MAX_82544_TXD)); | 644 | E1000_MAX_TXD : E1000_MAX_82544_TXD)); |
622 | E1000_ROUNDUP(txdr->count, REQ_TX_DESCRIPTOR_MULTIPLE); | 645 | E1000_ROUNDUP(txdr->count, REQ_TX_DESCRIPTOR_MULTIPLE); |
623 | 646 | ||
647 | for (i = 0; i < adapter->num_queues; i++) { | ||
648 | txdr[i].count = txdr->count; | ||
649 | rxdr[i].count = rxdr->count; | ||
650 | } | ||
651 | |||
624 | if(netif_running(adapter->netdev)) { | 652 | if(netif_running(adapter->netdev)) { |
625 | /* Try to get new resources before deleting old */ | 653 | /* Try to get new resources before deleting old */ |
626 | if((err = e1000_setup_rx_resources(adapter))) | 654 | if ((err = e1000_setup_all_rx_resources(adapter))) |
627 | goto err_setup_rx; | 655 | goto err_setup_rx; |
628 | if((err = e1000_setup_tx_resources(adapter))) | 656 | if ((err = e1000_setup_all_tx_resources(adapter))) |
629 | goto err_setup_tx; | 657 | goto err_setup_tx; |
630 | 658 | ||
631 | /* save the new, restore the old in order to free it, | 659 | /* save the new, restore the old in order to free it, |
@@ -635,8 +663,10 @@ e1000_set_ringparam(struct net_device *netdev, | |||
635 | tx_new = adapter->tx_ring; | 663 | tx_new = adapter->tx_ring; |
636 | adapter->rx_ring = rx_old; | 664 | adapter->rx_ring = rx_old; |
637 | adapter->tx_ring = tx_old; | 665 | adapter->tx_ring = tx_old; |
638 | e1000_free_rx_resources(adapter); | 666 | e1000_free_all_rx_resources(adapter); |
639 | e1000_free_tx_resources(adapter); | 667 | e1000_free_all_tx_resources(adapter); |
668 | kfree(tx_old); | ||
669 | kfree(rx_old); | ||
640 | adapter->rx_ring = rx_new; | 670 | adapter->rx_ring = rx_new; |
641 | adapter->tx_ring = tx_new; | 671 | adapter->tx_ring = tx_new; |
642 | if((err = e1000_up(adapter))) | 672 | if((err = e1000_up(adapter))) |
@@ -645,7 +675,7 @@ e1000_set_ringparam(struct net_device *netdev, | |||
645 | 675 | ||
646 | return 0; | 676 | return 0; |
647 | err_setup_tx: | 677 | err_setup_tx: |
648 | e1000_free_rx_resources(adapter); | 678 | e1000_free_all_rx_resources(adapter); |
649 | err_setup_rx: | 679 | err_setup_rx: |
650 | adapter->rx_ring = rx_old; | 680 | adapter->rx_ring = rx_old; |
651 | adapter->tx_ring = tx_old; | 681 | adapter->tx_ring = tx_old; |
@@ -696,6 +726,11 @@ e1000_reg_test(struct e1000_adapter *adapter, uint64_t *data) | |||
696 | * Some bits that get toggled are ignored. | 726 | * Some bits that get toggled are ignored. |
697 | */ | 727 | */ |
698 | switch (adapter->hw.mac_type) { | 728 | switch (adapter->hw.mac_type) { |
729 | /* there are several bits on newer hardware that are r/w */ | ||
730 | case e1000_82571: | ||
731 | case e1000_82572: | ||
732 | toggle = 0x7FFFF3FF; | ||
733 | break; | ||
699 | case e1000_82573: | 734 | case e1000_82573: |
700 | toggle = 0x7FFFF033; | 735 | toggle = 0x7FFFF033; |
701 | break; | 736 | break; |
@@ -898,8 +933,8 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data) | |||
898 | static void | 933 | static void |
899 | e1000_free_desc_rings(struct e1000_adapter *adapter) | 934 | e1000_free_desc_rings(struct e1000_adapter *adapter) |
900 | { | 935 | { |
901 | struct e1000_desc_ring *txdr = &adapter->test_tx_ring; | 936 | struct e1000_tx_ring *txdr = &adapter->test_tx_ring; |
902 | struct e1000_desc_ring *rxdr = &adapter->test_rx_ring; | 937 | struct e1000_rx_ring *rxdr = &adapter->test_rx_ring; |
903 | struct pci_dev *pdev = adapter->pdev; | 938 | struct pci_dev *pdev = adapter->pdev; |
904 | int i; | 939 | int i; |
905 | 940 | ||
@@ -941,8 +976,8 @@ e1000_free_desc_rings(struct e1000_adapter *adapter) | |||
941 | static int | 976 | static int |
942 | e1000_setup_desc_rings(struct e1000_adapter *adapter) | 977 | e1000_setup_desc_rings(struct e1000_adapter *adapter) |
943 | { | 978 | { |
944 | struct e1000_desc_ring *txdr = &adapter->test_tx_ring; | 979 | struct e1000_tx_ring *txdr = &adapter->test_tx_ring; |
945 | struct e1000_desc_ring *rxdr = &adapter->test_rx_ring; | 980 | struct e1000_rx_ring *rxdr = &adapter->test_rx_ring; |
946 | struct pci_dev *pdev = adapter->pdev; | 981 | struct pci_dev *pdev = adapter->pdev; |
947 | uint32_t rctl; | 982 | uint32_t rctl; |
948 | int size, i, ret_val; | 983 | int size, i, ret_val; |
@@ -1245,6 +1280,8 @@ e1000_set_phy_loopback(struct e1000_adapter *adapter) | |||
1245 | case e1000_82541_rev_2: | 1280 | case e1000_82541_rev_2: |
1246 | case e1000_82547: | 1281 | case e1000_82547: |
1247 | case e1000_82547_rev_2: | 1282 | case e1000_82547_rev_2: |
1283 | case e1000_82571: | ||
1284 | case e1000_82572: | ||
1248 | case e1000_82573: | 1285 | case e1000_82573: |
1249 | return e1000_integrated_phy_loopback(adapter); | 1286 | return e1000_integrated_phy_loopback(adapter); |
1250 | break; | 1287 | break; |
@@ -1340,8 +1377,8 @@ e1000_check_lbtest_frame(struct sk_buff *skb, unsigned int frame_size) | |||
1340 | static int | 1377 | static int |
1341 | e1000_run_loopback_test(struct e1000_adapter *adapter) | 1378 | e1000_run_loopback_test(struct e1000_adapter *adapter) |
1342 | { | 1379 | { |
1343 | struct e1000_desc_ring *txdr = &adapter->test_tx_ring; | 1380 | struct e1000_tx_ring *txdr = &adapter->test_tx_ring; |
1344 | struct e1000_desc_ring *rxdr = &adapter->test_rx_ring; | 1381 | struct e1000_rx_ring *rxdr = &adapter->test_rx_ring; |
1345 | struct pci_dev *pdev = adapter->pdev; | 1382 | struct pci_dev *pdev = adapter->pdev; |
1346 | int i, j, k, l, lc, good_cnt, ret_val=0; | 1383 | int i, j, k, l, lc, good_cnt, ret_val=0; |
1347 | unsigned long time; | 1384 | unsigned long time; |
@@ -1509,6 +1546,7 @@ e1000_diag_test(struct net_device *netdev, | |||
1509 | data[2] = 0; | 1546 | data[2] = 0; |
1510 | data[3] = 0; | 1547 | data[3] = 0; |
1511 | } | 1548 | } |
1549 | msleep_interruptible(4 * 1000); | ||
1512 | } | 1550 | } |
1513 | 1551 | ||
1514 | static void | 1552 | static void |
@@ -1625,7 +1663,7 @@ e1000_phys_id(struct net_device *netdev, uint32_t data) | |||
1625 | if(!data || data > (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ)) | 1663 | if(!data || data > (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ)) |
1626 | data = (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ); | 1664 | data = (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ); |
1627 | 1665 | ||
1628 | if(adapter->hw.mac_type < e1000_82573) { | 1666 | if(adapter->hw.mac_type < e1000_82571) { |
1629 | if(!adapter->blink_timer.function) { | 1667 | if(!adapter->blink_timer.function) { |
1630 | init_timer(&adapter->blink_timer); | 1668 | init_timer(&adapter->blink_timer); |
1631 | adapter->blink_timer.function = e1000_led_blink_callback; | 1669 | adapter->blink_timer.function = e1000_led_blink_callback; |
@@ -1739,6 +1777,7 @@ struct ethtool_ops e1000_ethtool_ops = { | |||
1739 | .phys_id = e1000_phys_id, | 1777 | .phys_id = e1000_phys_id, |
1740 | .get_stats_count = e1000_get_stats_count, | 1778 | .get_stats_count = e1000_get_stats_count, |
1741 | .get_ethtool_stats = e1000_get_ethtool_stats, | 1779 | .get_ethtool_stats = e1000_get_ethtool_stats, |
1780 | .get_perm_addr = ethtool_op_get_perm_addr, | ||
1742 | }; | 1781 | }; |
1743 | 1782 | ||
1744 | void e1000_set_ethtool_ops(struct net_device *netdev) | 1783 | void e1000_set_ethtool_ops(struct net_device *netdev) |
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c index 045f5426ab9a..8fc876da43b4 100644 --- a/drivers/net/e1000/e1000_hw.c +++ b/drivers/net/e1000/e1000_hw.c | |||
@@ -83,14 +83,14 @@ uint16_t e1000_igp_cable_length_table[IGP01E1000_AGC_LENGTH_TABLE_SIZE] = | |||
83 | 83 | ||
84 | static const | 84 | static const |
85 | uint16_t e1000_igp_2_cable_length_table[IGP02E1000_AGC_LENGTH_TABLE_SIZE] = | 85 | uint16_t e1000_igp_2_cable_length_table[IGP02E1000_AGC_LENGTH_TABLE_SIZE] = |
86 | { 8, 13, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, | 86 | { 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 8, 11, 13, 16, 18, 21, |
87 | 22, 24, 27, 30, 32, 35, 37, 40, 42, 44, 47, 49, 51, 54, 56, 58, | 87 | 0, 0, 0, 3, 6, 10, 13, 16, 19, 23, 26, 29, 32, 35, 38, 41, |
88 | 32, 35, 38, 41, 44, 47, 50, 53, 55, 58, 61, 63, 66, 69, 71, 74, | 88 | 6, 10, 14, 18, 22, 26, 30, 33, 37, 41, 44, 48, 51, 54, 58, 61, |
89 | 43, 47, 51, 54, 58, 61, 64, 67, 71, 74, 77, 80, 82, 85, 88, 90, | 89 | 21, 26, 31, 35, 40, 44, 49, 53, 57, 61, 65, 68, 72, 75, 79, 82, |
90 | 57, 62, 66, 70, 74, 77, 81, 85, 88, 91, 94, 97, 100, 103, 106, 108, | 90 | 40, 45, 51, 56, 61, 66, 70, 75, 79, 83, 87, 91, 94, 98, 101, 104, |
91 | 73, 78, 82, 87, 91, 95, 98, 102, 105, 109, 112, 114, 117, 119, 122, 124, | 91 | 60, 66, 72, 77, 82, 87, 92, 96, 100, 104, 108, 111, 114, 117, 119, 121, |
92 | 91, 96, 101, 105, 109, 113, 116, 119, 122, 125, 127, 128, 128, 128, 128, 128, | 92 | 83, 89, 95, 100, 105, 109, 113, 116, 119, 122, 124, |
93 | 108, 113, 117, 121, 124, 127, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}; | 93 | 104, 109, 114, 118, 121, 124}; |
94 | 94 | ||
95 | 95 | ||
96 | /****************************************************************************** | 96 | /****************************************************************************** |
@@ -286,7 +286,6 @@ e1000_set_mac_type(struct e1000_hw *hw) | |||
286 | case E1000_DEV_ID_82546GB_FIBER: | 286 | case E1000_DEV_ID_82546GB_FIBER: |
287 | case E1000_DEV_ID_82546GB_SERDES: | 287 | case E1000_DEV_ID_82546GB_SERDES: |
288 | case E1000_DEV_ID_82546GB_PCIE: | 288 | case E1000_DEV_ID_82546GB_PCIE: |
289 | case E1000_DEV_ID_82546GB_QUAD_COPPER: | ||
290 | hw->mac_type = e1000_82546_rev_3; | 289 | hw->mac_type = e1000_82546_rev_3; |
291 | break; | 290 | break; |
292 | case E1000_DEV_ID_82541EI: | 291 | case E1000_DEV_ID_82541EI: |
@@ -305,8 +304,19 @@ e1000_set_mac_type(struct e1000_hw *hw) | |||
305 | case E1000_DEV_ID_82547GI: | 304 | case E1000_DEV_ID_82547GI: |
306 | hw->mac_type = e1000_82547_rev_2; | 305 | hw->mac_type = e1000_82547_rev_2; |
307 | break; | 306 | break; |
307 | case E1000_DEV_ID_82571EB_COPPER: | ||
308 | case E1000_DEV_ID_82571EB_FIBER: | ||
309 | case E1000_DEV_ID_82571EB_SERDES: | ||
310 | hw->mac_type = e1000_82571; | ||
311 | break; | ||
312 | case E1000_DEV_ID_82572EI_COPPER: | ||
313 | case E1000_DEV_ID_82572EI_FIBER: | ||
314 | case E1000_DEV_ID_82572EI_SERDES: | ||
315 | hw->mac_type = e1000_82572; | ||
316 | break; | ||
308 | case E1000_DEV_ID_82573E: | 317 | case E1000_DEV_ID_82573E: |
309 | case E1000_DEV_ID_82573E_IAMT: | 318 | case E1000_DEV_ID_82573E_IAMT: |
319 | case E1000_DEV_ID_82573L: | ||
310 | hw->mac_type = e1000_82573; | 320 | hw->mac_type = e1000_82573; |
311 | break; | 321 | break; |
312 | default: | 322 | default: |
@@ -315,6 +325,8 @@ e1000_set_mac_type(struct e1000_hw *hw) | |||
315 | } | 325 | } |
316 | 326 | ||
317 | switch(hw->mac_type) { | 327 | switch(hw->mac_type) { |
328 | case e1000_82571: | ||
329 | case e1000_82572: | ||
318 | case e1000_82573: | 330 | case e1000_82573: |
319 | hw->eeprom_semaphore_present = TRUE; | 331 | hw->eeprom_semaphore_present = TRUE; |
320 | /* fall through */ | 332 | /* fall through */ |
@@ -351,6 +363,8 @@ e1000_set_media_type(struct e1000_hw *hw) | |||
351 | switch (hw->device_id) { | 363 | switch (hw->device_id) { |
352 | case E1000_DEV_ID_82545GM_SERDES: | 364 | case E1000_DEV_ID_82545GM_SERDES: |
353 | case E1000_DEV_ID_82546GB_SERDES: | 365 | case E1000_DEV_ID_82546GB_SERDES: |
366 | case E1000_DEV_ID_82571EB_SERDES: | ||
367 | case E1000_DEV_ID_82572EI_SERDES: | ||
354 | hw->media_type = e1000_media_type_internal_serdes; | 368 | hw->media_type = e1000_media_type_internal_serdes; |
355 | break; | 369 | break; |
356 | default: | 370 | default: |
@@ -523,6 +537,8 @@ e1000_reset_hw(struct e1000_hw *hw) | |||
523 | E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); | 537 | E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); |
524 | E1000_WRITE_FLUSH(hw); | 538 | E1000_WRITE_FLUSH(hw); |
525 | /* fall through */ | 539 | /* fall through */ |
540 | case e1000_82571: | ||
541 | case e1000_82572: | ||
526 | ret_val = e1000_get_auto_rd_done(hw); | 542 | ret_val = e1000_get_auto_rd_done(hw); |
527 | if(ret_val) | 543 | if(ret_val) |
528 | /* We don't want to continue accessing MAC registers. */ | 544 | /* We don't want to continue accessing MAC registers. */ |
@@ -683,6 +699,9 @@ e1000_init_hw(struct e1000_hw *hw) | |||
683 | switch (hw->mac_type) { | 699 | switch (hw->mac_type) { |
684 | default: | 700 | default: |
685 | break; | 701 | break; |
702 | case e1000_82571: | ||
703 | case e1000_82572: | ||
704 | ctrl |= (1 << 22); | ||
686 | case e1000_82573: | 705 | case e1000_82573: |
687 | ctrl |= E1000_TXDCTL_COUNT_DESC; | 706 | ctrl |= E1000_TXDCTL_COUNT_DESC; |
688 | break; | 707 | break; |
@@ -694,6 +713,26 @@ e1000_init_hw(struct e1000_hw *hw) | |||
694 | e1000_enable_tx_pkt_filtering(hw); | 713 | e1000_enable_tx_pkt_filtering(hw); |
695 | } | 714 | } |
696 | 715 | ||
716 | switch (hw->mac_type) { | ||
717 | default: | ||
718 | break; | ||
719 | case e1000_82571: | ||
720 | case e1000_82572: | ||
721 | ctrl = E1000_READ_REG(hw, TXDCTL1); | ||
722 | ctrl &= ~E1000_TXDCTL_WTHRESH; | ||
723 | ctrl |= E1000_TXDCTL_COUNT_DESC | E1000_TXDCTL_FULL_TX_DESC_WB; | ||
724 | ctrl |= (1 << 22); | ||
725 | E1000_WRITE_REG(hw, TXDCTL1, ctrl); | ||
726 | break; | ||
727 | } | ||
728 | |||
729 | |||
730 | |||
731 | if (hw->mac_type == e1000_82573) { | ||
732 | uint32_t gcr = E1000_READ_REG(hw, GCR); | ||
733 | gcr |= E1000_GCR_L1_ACT_WITHOUT_L0S_RX; | ||
734 | E1000_WRITE_REG(hw, GCR, gcr); | ||
735 | } | ||
697 | 736 | ||
698 | /* Clear all of the statistics registers (clear on read). It is | 737 | /* Clear all of the statistics registers (clear on read). It is |
699 | * important that we do this after we have tried to establish link | 738 | * important that we do this after we have tried to establish link |
@@ -878,6 +917,14 @@ e1000_setup_fiber_serdes_link(struct e1000_hw *hw) | |||
878 | 917 | ||
879 | DEBUGFUNC("e1000_setup_fiber_serdes_link"); | 918 | DEBUGFUNC("e1000_setup_fiber_serdes_link"); |
880 | 919 | ||
920 | /* On 82571 and 82572 Fiber connections, SerDes loopback mode persists | ||
921 | * until explicitly turned off or a power cycle is performed. A read to | ||
922 | * the register does not indicate its status. Therefore, we ensure | ||
923 | * loopback mode is disabled during initialization. | ||
924 | */ | ||
925 | if (hw->mac_type == e1000_82571 || hw->mac_type == e1000_82572) | ||
926 | E1000_WRITE_REG(hw, SCTL, E1000_DISABLE_SERDES_LOOPBACK); | ||
927 | |||
881 | /* On adapters with a MAC newer than 82544, SW Defineable pin 1 will be | 928 | /* On adapters with a MAC newer than 82544, SW Defineable pin 1 will be |
882 | * set when the optics detect a signal. On older adapters, it will be | 929 | * set when the optics detect a signal. On older adapters, it will be |
883 | * cleared when there is a signal. This applies to fiber media only. | 930 | * cleared when there is a signal. This applies to fiber media only. |
@@ -2943,6 +2990,8 @@ e1000_phy_reset(struct e1000_hw *hw) | |||
2943 | 2990 | ||
2944 | switch (hw->mac_type) { | 2991 | switch (hw->mac_type) { |
2945 | case e1000_82541_rev_2: | 2992 | case e1000_82541_rev_2: |
2993 | case e1000_82571: | ||
2994 | case e1000_82572: | ||
2946 | ret_val = e1000_phy_hw_reset(hw); | 2995 | ret_val = e1000_phy_hw_reset(hw); |
2947 | if(ret_val) | 2996 | if(ret_val) |
2948 | return ret_val; | 2997 | return ret_val; |
@@ -2981,6 +3030,16 @@ e1000_detect_gig_phy(struct e1000_hw *hw) | |||
2981 | 3030 | ||
2982 | DEBUGFUNC("e1000_detect_gig_phy"); | 3031 | DEBUGFUNC("e1000_detect_gig_phy"); |
2983 | 3032 | ||
3033 | /* The 82571 firmware may still be configuring the PHY. In this | ||
3034 | * case, we cannot access the PHY until the configuration is done. So | ||
3035 | * we explicitly set the PHY values. */ | ||
3036 | if(hw->mac_type == e1000_82571 || | ||
3037 | hw->mac_type == e1000_82572) { | ||
3038 | hw->phy_id = IGP01E1000_I_PHY_ID; | ||
3039 | hw->phy_type = e1000_phy_igp_2; | ||
3040 | return E1000_SUCCESS; | ||
3041 | } | ||
3042 | |||
2984 | /* Read the PHY ID Registers to identify which PHY is onboard. */ | 3043 | /* Read the PHY ID Registers to identify which PHY is onboard. */ |
2985 | ret_val = e1000_read_phy_reg(hw, PHY_ID1, &phy_id_high); | 3044 | ret_val = e1000_read_phy_reg(hw, PHY_ID1, &phy_id_high); |
2986 | if(ret_val) | 3045 | if(ret_val) |
@@ -3334,6 +3393,21 @@ e1000_init_eeprom_params(struct e1000_hw *hw) | |||
3334 | eeprom->use_eerd = FALSE; | 3393 | eeprom->use_eerd = FALSE; |
3335 | eeprom->use_eewr = FALSE; | 3394 | eeprom->use_eewr = FALSE; |
3336 | break; | 3395 | break; |
3396 | case e1000_82571: | ||
3397 | case e1000_82572: | ||
3398 | eeprom->type = e1000_eeprom_spi; | ||
3399 | eeprom->opcode_bits = 8; | ||
3400 | eeprom->delay_usec = 1; | ||
3401 | if (eecd & E1000_EECD_ADDR_BITS) { | ||
3402 | eeprom->page_size = 32; | ||
3403 | eeprom->address_bits = 16; | ||
3404 | } else { | ||
3405 | eeprom->page_size = 8; | ||
3406 | eeprom->address_bits = 8; | ||
3407 | } | ||
3408 | eeprom->use_eerd = FALSE; | ||
3409 | eeprom->use_eewr = FALSE; | ||
3410 | break; | ||
3337 | case e1000_82573: | 3411 | case e1000_82573: |
3338 | eeprom->type = e1000_eeprom_spi; | 3412 | eeprom->type = e1000_eeprom_spi; |
3339 | eeprom->opcode_bits = 8; | 3413 | eeprom->opcode_bits = 8; |
@@ -3543,25 +3617,26 @@ e1000_acquire_eeprom(struct e1000_hw *hw) | |||
3543 | eecd = E1000_READ_REG(hw, EECD); | 3617 | eecd = E1000_READ_REG(hw, EECD); |
3544 | 3618 | ||
3545 | if (hw->mac_type != e1000_82573) { | 3619 | if (hw->mac_type != e1000_82573) { |
3546 | /* Request EEPROM Access */ | 3620 | /* Request EEPROM Access */ |
3547 | if(hw->mac_type > e1000_82544) { | 3621 | if(hw->mac_type > e1000_82544) { |
3548 | eecd |= E1000_EECD_REQ; | 3622 | eecd |= E1000_EECD_REQ; |
3549 | E1000_WRITE_REG(hw, EECD, eecd); | ||
3550 | eecd = E1000_READ_REG(hw, EECD); | ||
3551 | while((!(eecd & E1000_EECD_GNT)) && | ||
3552 | (i < E1000_EEPROM_GRANT_ATTEMPTS)) { | ||
3553 | i++; | ||
3554 | udelay(5); | ||
3555 | eecd = E1000_READ_REG(hw, EECD); | ||
3556 | } | ||
3557 | if(!(eecd & E1000_EECD_GNT)) { | ||
3558 | eecd &= ~E1000_EECD_REQ; | ||
3559 | E1000_WRITE_REG(hw, EECD, eecd); | 3623 | E1000_WRITE_REG(hw, EECD, eecd); |
3560 | DEBUGOUT("Could not acquire EEPROM grant\n"); | 3624 | eecd = E1000_READ_REG(hw, EECD); |
3561 | return -E1000_ERR_EEPROM; | 3625 | while((!(eecd & E1000_EECD_GNT)) && |
3626 | (i < E1000_EEPROM_GRANT_ATTEMPTS)) { | ||
3627 | i++; | ||
3628 | udelay(5); | ||
3629 | eecd = E1000_READ_REG(hw, EECD); | ||
3630 | } | ||
3631 | if(!(eecd & E1000_EECD_GNT)) { | ||
3632 | eecd &= ~E1000_EECD_REQ; | ||
3633 | E1000_WRITE_REG(hw, EECD, eecd); | ||
3634 | DEBUGOUT("Could not acquire EEPROM grant\n"); | ||
3635 | e1000_put_hw_eeprom_semaphore(hw); | ||
3636 | return -E1000_ERR_EEPROM; | ||
3637 | } | ||
3562 | } | 3638 | } |
3563 | } | 3639 | } |
3564 | } | ||
3565 | 3640 | ||
3566 | /* Setup EEPROM for Read/Write */ | 3641 | /* Setup EEPROM for Read/Write */ |
3567 | 3642 | ||
@@ -4064,7 +4139,7 @@ e1000_write_eeprom(struct e1000_hw *hw, | |||
4064 | return -E1000_ERR_EEPROM; | 4139 | return -E1000_ERR_EEPROM; |
4065 | } | 4140 | } |
4066 | 4141 | ||
4067 | /* 82573 reads only through eerd */ | 4142 | /* 82573 writes only through eewr */ |
4068 | if(eeprom->use_eewr == TRUE) | 4143 | if(eeprom->use_eewr == TRUE) |
4069 | return e1000_write_eeprom_eewr(hw, offset, words, data); | 4144 | return e1000_write_eeprom_eewr(hw, offset, words, data); |
4070 | 4145 | ||
@@ -4353,9 +4428,16 @@ e1000_read_mac_addr(struct e1000_hw * hw) | |||
4353 | hw->perm_mac_addr[i] = (uint8_t) (eeprom_data & 0x00FF); | 4428 | hw->perm_mac_addr[i] = (uint8_t) (eeprom_data & 0x00FF); |
4354 | hw->perm_mac_addr[i+1] = (uint8_t) (eeprom_data >> 8); | 4429 | hw->perm_mac_addr[i+1] = (uint8_t) (eeprom_data >> 8); |
4355 | } | 4430 | } |
4356 | if(((hw->mac_type == e1000_82546) || (hw->mac_type == e1000_82546_rev_3)) && | 4431 | switch (hw->mac_type) { |
4357 | (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1)) | 4432 | default: |
4433 | break; | ||
4434 | case e1000_82546: | ||
4435 | case e1000_82546_rev_3: | ||
4436 | case e1000_82571: | ||
4437 | if(E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) | ||
4358 | hw->perm_mac_addr[5] ^= 0x01; | 4438 | hw->perm_mac_addr[5] ^= 0x01; |
4439 | break; | ||
4440 | } | ||
4359 | 4441 | ||
4360 | for(i = 0; i < NODE_ADDRESS_SIZE; i++) | 4442 | for(i = 0; i < NODE_ADDRESS_SIZE; i++) |
4361 | hw->mac_addr[i] = hw->perm_mac_addr[i]; | 4443 | hw->mac_addr[i] = hw->perm_mac_addr[i]; |
@@ -4385,6 +4467,12 @@ e1000_init_rx_addrs(struct e1000_hw *hw) | |||
4385 | e1000_rar_set(hw, hw->mac_addr, 0); | 4467 | e1000_rar_set(hw, hw->mac_addr, 0); |
4386 | 4468 | ||
4387 | rar_num = E1000_RAR_ENTRIES; | 4469 | rar_num = E1000_RAR_ENTRIES; |
4470 | |||
4471 | /* Reserve a spot for the Locally Administered Address to work around | ||
4472 | * an 82571 issue in which a reset on one port will reload the MAC on | ||
4473 | * the other port. */ | ||
4474 | if ((hw->mac_type == e1000_82571) && (hw->laa_is_present == TRUE)) | ||
4475 | rar_num -= 1; | ||
4388 | /* Zero out the other 15 receive addresses. */ | 4476 | /* Zero out the other 15 receive addresses. */ |
4389 | DEBUGOUT("Clearing RAR[1-15]\n"); | 4477 | DEBUGOUT("Clearing RAR[1-15]\n"); |
4390 | for(i = 1; i < rar_num; i++) { | 4478 | for(i = 1; i < rar_num; i++) { |
@@ -4427,6 +4515,12 @@ e1000_mc_addr_list_update(struct e1000_hw *hw, | |||
4427 | /* Clear RAR[1-15] */ | 4515 | /* Clear RAR[1-15] */ |
4428 | DEBUGOUT(" Clearing RAR[1-15]\n"); | 4516 | DEBUGOUT(" Clearing RAR[1-15]\n"); |
4429 | num_rar_entry = E1000_RAR_ENTRIES; | 4517 | num_rar_entry = E1000_RAR_ENTRIES; |
4518 | /* Reserve a spot for the Locally Administered Address to work around | ||
4519 | * an 82571 issue in which a reset on one port will reload the MAC on | ||
4520 | * the other port. */ | ||
4521 | if ((hw->mac_type == e1000_82571) && (hw->laa_is_present == TRUE)) | ||
4522 | num_rar_entry -= 1; | ||
4523 | |||
4430 | for(i = rar_used_count; i < num_rar_entry; i++) { | 4524 | for(i = rar_used_count; i < num_rar_entry; i++) { |
4431 | E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0); | 4525 | E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0); |
4432 | E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0); | 4526 | E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0); |
@@ -4984,7 +5078,6 @@ e1000_clear_hw_cntrs(struct e1000_hw *hw) | |||
4984 | temp = E1000_READ_REG(hw, ICTXQEC); | 5078 | temp = E1000_READ_REG(hw, ICTXQEC); |
4985 | temp = E1000_READ_REG(hw, ICTXQMTC); | 5079 | temp = E1000_READ_REG(hw, ICTXQMTC); |
4986 | temp = E1000_READ_REG(hw, ICRXDMTC); | 5080 | temp = E1000_READ_REG(hw, ICRXDMTC); |
4987 | |||
4988 | } | 5081 | } |
4989 | 5082 | ||
4990 | /****************************************************************************** | 5083 | /****************************************************************************** |
@@ -5151,6 +5244,8 @@ e1000_get_bus_info(struct e1000_hw *hw) | |||
5151 | hw->bus_speed = e1000_bus_speed_unknown; | 5244 | hw->bus_speed = e1000_bus_speed_unknown; |
5152 | hw->bus_width = e1000_bus_width_unknown; | 5245 | hw->bus_width = e1000_bus_width_unknown; |
5153 | break; | 5246 | break; |
5247 | case e1000_82571: | ||
5248 | case e1000_82572: | ||
5154 | case e1000_82573: | 5249 | case e1000_82573: |
5155 | hw->bus_type = e1000_bus_type_pci_express; | 5250 | hw->bus_type = e1000_bus_type_pci_express; |
5156 | hw->bus_speed = e1000_bus_speed_2500; | 5251 | hw->bus_speed = e1000_bus_speed_2500; |
@@ -5250,6 +5345,7 @@ e1000_get_cable_length(struct e1000_hw *hw, | |||
5250 | int32_t ret_val; | 5345 | int32_t ret_val; |
5251 | uint16_t agc_value = 0; | 5346 | uint16_t agc_value = 0; |
5252 | uint16_t cur_agc, min_agc = IGP01E1000_AGC_LENGTH_TABLE_SIZE; | 5347 | uint16_t cur_agc, min_agc = IGP01E1000_AGC_LENGTH_TABLE_SIZE; |
5348 | uint16_t max_agc = 0; | ||
5253 | uint16_t i, phy_data; | 5349 | uint16_t i, phy_data; |
5254 | uint16_t cable_length; | 5350 | uint16_t cable_length; |
5255 | 5351 | ||
@@ -5338,6 +5434,40 @@ e1000_get_cable_length(struct e1000_hw *hw, | |||
5338 | IGP01E1000_AGC_RANGE) : 0; | 5434 | IGP01E1000_AGC_RANGE) : 0; |
5339 | *max_length = e1000_igp_cable_length_table[agc_value] + | 5435 | *max_length = e1000_igp_cable_length_table[agc_value] + |
5340 | IGP01E1000_AGC_RANGE; | 5436 | IGP01E1000_AGC_RANGE; |
5437 | } else if (hw->phy_type == e1000_phy_igp_2) { | ||
5438 | uint16_t agc_reg_array[IGP02E1000_PHY_CHANNEL_NUM] = | ||
5439 | {IGP02E1000_PHY_AGC_A, | ||
5440 | IGP02E1000_PHY_AGC_B, | ||
5441 | IGP02E1000_PHY_AGC_C, | ||
5442 | IGP02E1000_PHY_AGC_D}; | ||
5443 | /* Read the AGC registers for all channels */ | ||
5444 | for (i = 0; i < IGP02E1000_PHY_CHANNEL_NUM; i++) { | ||
5445 | ret_val = e1000_read_phy_reg(hw, agc_reg_array[i], &phy_data); | ||
5446 | if (ret_val) | ||
5447 | return ret_val; | ||
5448 | |||
5449 | /* Getting bits 15:9, which represent the combination of course and | ||
5450 | * fine gain values. The result is a number that can be put into | ||
5451 | * the lookup table to obtain the approximate cable length. */ | ||
5452 | cur_agc = (phy_data >> IGP02E1000_AGC_LENGTH_SHIFT) & | ||
5453 | IGP02E1000_AGC_LENGTH_MASK; | ||
5454 | |||
5455 | /* Remove min & max AGC values from calculation. */ | ||
5456 | if (e1000_igp_2_cable_length_table[min_agc] > e1000_igp_2_cable_length_table[cur_agc]) | ||
5457 | min_agc = cur_agc; | ||
5458 | if (e1000_igp_2_cable_length_table[max_agc] < e1000_igp_2_cable_length_table[cur_agc]) | ||
5459 | max_agc = cur_agc; | ||
5460 | |||
5461 | agc_value += e1000_igp_2_cable_length_table[cur_agc]; | ||
5462 | } | ||
5463 | |||
5464 | agc_value -= (e1000_igp_2_cable_length_table[min_agc] + e1000_igp_2_cable_length_table[max_agc]); | ||
5465 | agc_value /= (IGP02E1000_PHY_CHANNEL_NUM - 2); | ||
5466 | |||
5467 | /* Calculate cable length with the error range of +/- 10 meters. */ | ||
5468 | *min_length = ((agc_value - IGP02E1000_AGC_RANGE) > 0) ? | ||
5469 | (agc_value - IGP02E1000_AGC_RANGE) : 0; | ||
5470 | *max_length = agc_value + IGP02E1000_AGC_RANGE; | ||
5341 | } | 5471 | } |
5342 | 5472 | ||
5343 | return E1000_SUCCESS; | 5473 | return E1000_SUCCESS; |
@@ -6465,6 +6595,8 @@ e1000_get_auto_rd_done(struct e1000_hw *hw) | |||
6465 | default: | 6595 | default: |
6466 | msec_delay(5); | 6596 | msec_delay(5); |
6467 | break; | 6597 | break; |
6598 | case e1000_82571: | ||
6599 | case e1000_82572: | ||
6468 | case e1000_82573: | 6600 | case e1000_82573: |
6469 | while(timeout) { | 6601 | while(timeout) { |
6470 | if (E1000_READ_REG(hw, EECD) & E1000_EECD_AUTO_RD) break; | 6602 | if (E1000_READ_REG(hw, EECD) & E1000_EECD_AUTO_RD) break; |
@@ -6494,10 +6626,31 @@ e1000_get_auto_rd_done(struct e1000_hw *hw) | |||
6494 | int32_t | 6626 | int32_t |
6495 | e1000_get_phy_cfg_done(struct e1000_hw *hw) | 6627 | e1000_get_phy_cfg_done(struct e1000_hw *hw) |
6496 | { | 6628 | { |
6629 | int32_t timeout = PHY_CFG_TIMEOUT; | ||
6630 | uint32_t cfg_mask = E1000_EEPROM_CFG_DONE; | ||
6631 | |||
6497 | DEBUGFUNC("e1000_get_phy_cfg_done"); | 6632 | DEBUGFUNC("e1000_get_phy_cfg_done"); |
6498 | 6633 | ||
6499 | /* Simply wait for 10ms */ | 6634 | switch (hw->mac_type) { |
6500 | msec_delay(10); | 6635 | default: |
6636 | msec_delay(10); | ||
6637 | break; | ||
6638 | case e1000_82571: | ||
6639 | case e1000_82572: | ||
6640 | while (timeout) { | ||
6641 | if (E1000_READ_REG(hw, EEMNGCTL) & cfg_mask) | ||
6642 | break; | ||
6643 | else | ||
6644 | msec_delay(1); | ||
6645 | timeout--; | ||
6646 | } | ||
6647 | |||
6648 | if (!timeout) { | ||
6649 | DEBUGOUT("MNG configuration cycle has not completed.\n"); | ||
6650 | return -E1000_ERR_RESET; | ||
6651 | } | ||
6652 | break; | ||
6653 | } | ||
6501 | 6654 | ||
6502 | return E1000_SUCCESS; | 6655 | return E1000_SUCCESS; |
6503 | } | 6656 | } |
@@ -6569,8 +6722,7 @@ e1000_put_hw_eeprom_semaphore(struct e1000_hw *hw) | |||
6569 | return; | 6722 | return; |
6570 | 6723 | ||
6571 | swsm = E1000_READ_REG(hw, SWSM); | 6724 | swsm = E1000_READ_REG(hw, SWSM); |
6572 | /* Release both semaphores. */ | 6725 | swsm &= ~(E1000_SWSM_SWESMBI); |
6573 | swsm &= ~(E1000_SWSM_SMBI | E1000_SWSM_SWESMBI); | ||
6574 | E1000_WRITE_REG(hw, SWSM, swsm); | 6726 | E1000_WRITE_REG(hw, SWSM, swsm); |
6575 | } | 6727 | } |
6576 | 6728 | ||
@@ -6606,6 +6758,8 @@ e1000_arc_subsystem_valid(struct e1000_hw *hw) | |||
6606 | * if this is the case. We read FWSM to determine the manageability mode. | 6758 | * if this is the case. We read FWSM to determine the manageability mode. |
6607 | */ | 6759 | */ |
6608 | switch (hw->mac_type) { | 6760 | switch (hw->mac_type) { |
6761 | case e1000_82571: | ||
6762 | case e1000_82572: | ||
6609 | case e1000_82573: | 6763 | case e1000_82573: |
6610 | fwsm = E1000_READ_REG(hw, FWSM); | 6764 | fwsm = E1000_READ_REG(hw, FWSM); |
6611 | if((fwsm & E1000_FWSM_MODE_MASK) != 0) | 6765 | if((fwsm & E1000_FWSM_MODE_MASK) != 0) |
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h index 51c2b3a18b6f..4f2c196dc314 100644 --- a/drivers/net/e1000/e1000_hw.h +++ b/drivers/net/e1000/e1000_hw.h | |||
@@ -57,6 +57,8 @@ typedef enum { | |||
57 | e1000_82541_rev_2, | 57 | e1000_82541_rev_2, |
58 | e1000_82547, | 58 | e1000_82547, |
59 | e1000_82547_rev_2, | 59 | e1000_82547_rev_2, |
60 | e1000_82571, | ||
61 | e1000_82572, | ||
60 | e1000_82573, | 62 | e1000_82573, |
61 | e1000_num_macs | 63 | e1000_num_macs |
62 | } e1000_mac_type; | 64 | } e1000_mac_type; |
@@ -478,10 +480,16 @@ uint8_t e1000_arc_subsystem_valid(struct e1000_hw *hw); | |||
478 | #define E1000_DEV_ID_82546GB_SERDES 0x107B | 480 | #define E1000_DEV_ID_82546GB_SERDES 0x107B |
479 | #define E1000_DEV_ID_82546GB_PCIE 0x108A | 481 | #define E1000_DEV_ID_82546GB_PCIE 0x108A |
480 | #define E1000_DEV_ID_82547EI 0x1019 | 482 | #define E1000_DEV_ID_82547EI 0x1019 |
483 | #define E1000_DEV_ID_82571EB_COPPER 0x105E | ||
484 | #define E1000_DEV_ID_82571EB_FIBER 0x105F | ||
485 | #define E1000_DEV_ID_82571EB_SERDES 0x1060 | ||
486 | #define E1000_DEV_ID_82572EI_COPPER 0x107D | ||
487 | #define E1000_DEV_ID_82572EI_FIBER 0x107E | ||
488 | #define E1000_DEV_ID_82572EI_SERDES 0x107F | ||
481 | #define E1000_DEV_ID_82573E 0x108B | 489 | #define E1000_DEV_ID_82573E 0x108B |
482 | #define E1000_DEV_ID_82573E_IAMT 0x108C | 490 | #define E1000_DEV_ID_82573E_IAMT 0x108C |
491 | #define E1000_DEV_ID_82573L 0x109A | ||
483 | 492 | ||
484 | #define E1000_DEV_ID_82546GB_QUAD_COPPER 0x1099 | ||
485 | 493 | ||
486 | #define NODE_ADDRESS_SIZE 6 | 494 | #define NODE_ADDRESS_SIZE 6 |
487 | #define ETH_LENGTH_OF_ADDRESS 6 | 495 | #define ETH_LENGTH_OF_ADDRESS 6 |
@@ -833,6 +841,8 @@ struct e1000_ffvt_entry { | |||
833 | #define E1000_FFMT_SIZE E1000_FLEXIBLE_FILTER_SIZE_MAX | 841 | #define E1000_FFMT_SIZE E1000_FLEXIBLE_FILTER_SIZE_MAX |
834 | #define E1000_FFVT_SIZE E1000_FLEXIBLE_FILTER_SIZE_MAX | 842 | #define E1000_FFVT_SIZE E1000_FLEXIBLE_FILTER_SIZE_MAX |
835 | 843 | ||
844 | #define E1000_DISABLE_SERDES_LOOPBACK 0x0400 | ||
845 | |||
836 | /* Register Set. (82543, 82544) | 846 | /* Register Set. (82543, 82544) |
837 | * | 847 | * |
838 | * Registers are defined to be 32 bits and should be accessed as 32 bit values. | 848 | * Registers are defined to be 32 bits and should be accessed as 32 bit values. |
@@ -853,6 +863,7 @@ struct e1000_ffvt_entry { | |||
853 | #define E1000_CTRL_EXT 0x00018 /* Extended Device Control - RW */ | 863 | #define E1000_CTRL_EXT 0x00018 /* Extended Device Control - RW */ |
854 | #define E1000_FLA 0x0001C /* Flash Access - RW */ | 864 | #define E1000_FLA 0x0001C /* Flash Access - RW */ |
855 | #define E1000_MDIC 0x00020 /* MDI Control - RW */ | 865 | #define E1000_MDIC 0x00020 /* MDI Control - RW */ |
866 | #define E1000_SCTL 0x00024 /* SerDes Control - RW */ | ||
856 | #define E1000_FCAL 0x00028 /* Flow Control Address Low - RW */ | 867 | #define E1000_FCAL 0x00028 /* Flow Control Address Low - RW */ |
857 | #define E1000_FCAH 0x0002C /* Flow Control Address High -RW */ | 868 | #define E1000_FCAH 0x0002C /* Flow Control Address High -RW */ |
858 | #define E1000_FCT 0x00030 /* Flow Control Type - RW */ | 869 | #define E1000_FCT 0x00030 /* Flow Control Type - RW */ |
@@ -864,6 +875,12 @@ struct e1000_ffvt_entry { | |||
864 | #define E1000_IMC 0x000D8 /* Interrupt Mask Clear - WO */ | 875 | #define E1000_IMC 0x000D8 /* Interrupt Mask Clear - WO */ |
865 | #define E1000_IAM 0x000E0 /* Interrupt Acknowledge Auto Mask */ | 876 | #define E1000_IAM 0x000E0 /* Interrupt Acknowledge Auto Mask */ |
866 | #define E1000_RCTL 0x00100 /* RX Control - RW */ | 877 | #define E1000_RCTL 0x00100 /* RX Control - RW */ |
878 | #define E1000_RDTR1 0x02820 /* RX Delay Timer (1) - RW */ | ||
879 | #define E1000_RDBAL1 0x02900 /* RX Descriptor Base Address Low (1) - RW */ | ||
880 | #define E1000_RDBAH1 0x02904 /* RX Descriptor Base Address High (1) - RW */ | ||
881 | #define E1000_RDLEN1 0x02908 /* RX Descriptor Length (1) - RW */ | ||
882 | #define E1000_RDH1 0x02910 /* RX Descriptor Head (1) - RW */ | ||
883 | #define E1000_RDT1 0x02918 /* RX Descriptor Tail (1) - RW */ | ||
867 | #define E1000_FCTTV 0x00170 /* Flow Control Transmit Timer Value - RW */ | 884 | #define E1000_FCTTV 0x00170 /* Flow Control Transmit Timer Value - RW */ |
868 | #define E1000_TXCW 0x00178 /* TX Configuration Word - RW */ | 885 | #define E1000_TXCW 0x00178 /* TX Configuration Word - RW */ |
869 | #define E1000_RXCW 0x00180 /* RX Configuration Word - RO */ | 886 | #define E1000_RXCW 0x00180 /* RX Configuration Word - RO */ |
@@ -895,6 +912,12 @@ struct e1000_ffvt_entry { | |||
895 | #define E1000_RDH 0x02810 /* RX Descriptor Head - RW */ | 912 | #define E1000_RDH 0x02810 /* RX Descriptor Head - RW */ |
896 | #define E1000_RDT 0x02818 /* RX Descriptor Tail - RW */ | 913 | #define E1000_RDT 0x02818 /* RX Descriptor Tail - RW */ |
897 | #define E1000_RDTR 0x02820 /* RX Delay Timer - RW */ | 914 | #define E1000_RDTR 0x02820 /* RX Delay Timer - RW */ |
915 | #define E1000_RDBAL0 E1000_RDBAL /* RX Desc Base Address Low (0) - RW */ | ||
916 | #define E1000_RDBAH0 E1000_RDBAH /* RX Desc Base Address High (0) - RW */ | ||
917 | #define E1000_RDLEN0 E1000_RDLEN /* RX Desc Length (0) - RW */ | ||
918 | #define E1000_RDH0 E1000_RDH /* RX Desc Head (0) - RW */ | ||
919 | #define E1000_RDT0 E1000_RDT /* RX Desc Tail (0) - RW */ | ||
920 | #define E1000_RDTR0 E1000_RDTR /* RX Delay Timer (0) - RW */ | ||
898 | #define E1000_RXDCTL 0x02828 /* RX Descriptor Control - RW */ | 921 | #define E1000_RXDCTL 0x02828 /* RX Descriptor Control - RW */ |
899 | #define E1000_RADV 0x0282C /* RX Interrupt Absolute Delay Timer - RW */ | 922 | #define E1000_RADV 0x0282C /* RX Interrupt Absolute Delay Timer - RW */ |
900 | #define E1000_RSRPD 0x02C00 /* RX Small Packet Detect - RW */ | 923 | #define E1000_RSRPD 0x02C00 /* RX Small Packet Detect - RW */ |
@@ -980,15 +1003,15 @@ struct e1000_ffvt_entry { | |||
980 | #define E1000_BPTC 0x040F4 /* Broadcast Packets TX Count - R/clr */ | 1003 | #define E1000_BPTC 0x040F4 /* Broadcast Packets TX Count - R/clr */ |
981 | #define E1000_TSCTC 0x040F8 /* TCP Segmentation Context TX - R/clr */ | 1004 | #define E1000_TSCTC 0x040F8 /* TCP Segmentation Context TX - R/clr */ |
982 | #define E1000_TSCTFC 0x040FC /* TCP Segmentation Context TX Fail - R/clr */ | 1005 | #define E1000_TSCTFC 0x040FC /* TCP Segmentation Context TX Fail - R/clr */ |
983 | #define E1000_IAC 0x4100 /* Interrupt Assertion Count */ | 1006 | #define E1000_IAC 0x04100 /* Interrupt Assertion Count */ |
984 | #define E1000_ICRXPTC 0x4104 /* Interrupt Cause Rx Packet Timer Expire Count */ | 1007 | #define E1000_ICRXPTC 0x04104 /* Interrupt Cause Rx Packet Timer Expire Count */ |
985 | #define E1000_ICRXATC 0x4108 /* Interrupt Cause Rx Absolute Timer Expire Count */ | 1008 | #define E1000_ICRXATC 0x04108 /* Interrupt Cause Rx Absolute Timer Expire Count */ |
986 | #define E1000_ICTXPTC 0x410C /* Interrupt Cause Tx Packet Timer Expire Count */ | 1009 | #define E1000_ICTXPTC 0x0410C /* Interrupt Cause Tx Packet Timer Expire Count */ |
987 | #define E1000_ICTXATC 0x4110 /* Interrupt Cause Tx Absolute Timer Expire Count */ | 1010 | #define E1000_ICTXATC 0x04110 /* Interrupt Cause Tx Absolute Timer Expire Count */ |
988 | #define E1000_ICTXQEC 0x4118 /* Interrupt Cause Tx Queue Empty Count */ | 1011 | #define E1000_ICTXQEC 0x04118 /* Interrupt Cause Tx Queue Empty Count */ |
989 | #define E1000_ICTXQMTC 0x411C /* Interrupt Cause Tx Queue Minimum Threshold Count */ | 1012 | #define E1000_ICTXQMTC 0x0411C /* Interrupt Cause Tx Queue Minimum Threshold Count */ |
990 | #define E1000_ICRXDMTC 0x4120 /* Interrupt Cause Rx Descriptor Minimum Threshold Count */ | 1013 | #define E1000_ICRXDMTC 0x04120 /* Interrupt Cause Rx Descriptor Minimum Threshold Count */ |
991 | #define E1000_ICRXOC 0x4124 /* Interrupt Cause Receiver Overrun Count */ | 1014 | #define E1000_ICRXOC 0x04124 /* Interrupt Cause Receiver Overrun Count */ |
992 | #define E1000_RXCSUM 0x05000 /* RX Checksum Control - RW */ | 1015 | #define E1000_RXCSUM 0x05000 /* RX Checksum Control - RW */ |
993 | #define E1000_RFCTL 0x05008 /* Receive Filter Control*/ | 1016 | #define E1000_RFCTL 0x05008 /* Receive Filter Control*/ |
994 | #define E1000_MTA 0x05200 /* Multicast Table Array - RW Array */ | 1017 | #define E1000_MTA 0x05200 /* Multicast Table Array - RW Array */ |
@@ -1018,6 +1041,14 @@ struct e1000_ffvt_entry { | |||
1018 | #define E1000_FWSM 0x05B54 /* FW Semaphore */ | 1041 | #define E1000_FWSM 0x05B54 /* FW Semaphore */ |
1019 | #define E1000_FFLT_DBG 0x05F04 /* Debug Register */ | 1042 | #define E1000_FFLT_DBG 0x05F04 /* Debug Register */ |
1020 | #define E1000_HICR 0x08F00 /* Host Inteface Control */ | 1043 | #define E1000_HICR 0x08F00 /* Host Inteface Control */ |
1044 | |||
1045 | /* RSS registers */ | ||
1046 | #define E1000_CPUVEC 0x02C10 /* CPU Vector Register - RW */ | ||
1047 | #define E1000_MRQC 0x05818 /* Multiple Receive Control - RW */ | ||
1048 | #define E1000_RETA 0x05C00 /* Redirection Table - RW Array */ | ||
1049 | #define E1000_RSSRK 0x05C80 /* RSS Random Key - RW Array */ | ||
1050 | #define E1000_RSSIM 0x05864 /* RSS Interrupt Mask */ | ||
1051 | #define E1000_RSSIR 0x05868 /* RSS Interrupt Request */ | ||
1021 | /* Register Set (82542) | 1052 | /* Register Set (82542) |
1022 | * | 1053 | * |
1023 | * Some of the 82542 registers are located at different offsets than they are | 1054 | * Some of the 82542 registers are located at different offsets than they are |
@@ -1032,6 +1063,7 @@ struct e1000_ffvt_entry { | |||
1032 | #define E1000_82542_CTRL_EXT E1000_CTRL_EXT | 1063 | #define E1000_82542_CTRL_EXT E1000_CTRL_EXT |
1033 | #define E1000_82542_FLA E1000_FLA | 1064 | #define E1000_82542_FLA E1000_FLA |
1034 | #define E1000_82542_MDIC E1000_MDIC | 1065 | #define E1000_82542_MDIC E1000_MDIC |
1066 | #define E1000_82542_SCTL E1000_SCTL | ||
1035 | #define E1000_82542_FCAL E1000_FCAL | 1067 | #define E1000_82542_FCAL E1000_FCAL |
1036 | #define E1000_82542_FCAH E1000_FCAH | 1068 | #define E1000_82542_FCAH E1000_FCAH |
1037 | #define E1000_82542_FCT E1000_FCT | 1069 | #define E1000_82542_FCT E1000_FCT |
@@ -1049,6 +1081,18 @@ struct e1000_ffvt_entry { | |||
1049 | #define E1000_82542_RDLEN 0x00118 | 1081 | #define E1000_82542_RDLEN 0x00118 |
1050 | #define E1000_82542_RDH 0x00120 | 1082 | #define E1000_82542_RDH 0x00120 |
1051 | #define E1000_82542_RDT 0x00128 | 1083 | #define E1000_82542_RDT 0x00128 |
1084 | #define E1000_82542_RDTR0 E1000_82542_RDTR | ||
1085 | #define E1000_82542_RDBAL0 E1000_82542_RDBAL | ||
1086 | #define E1000_82542_RDBAH0 E1000_82542_RDBAH | ||
1087 | #define E1000_82542_RDLEN0 E1000_82542_RDLEN | ||
1088 | #define E1000_82542_RDH0 E1000_82542_RDH | ||
1089 | #define E1000_82542_RDT0 E1000_82542_RDT | ||
1090 | #define E1000_82542_RDTR1 0x00130 | ||
1091 | #define E1000_82542_RDBAL1 0x00138 | ||
1092 | #define E1000_82542_RDBAH1 0x0013C | ||
1093 | #define E1000_82542_RDLEN1 0x00140 | ||
1094 | #define E1000_82542_RDH1 0x00148 | ||
1095 | #define E1000_82542_RDT1 0x00150 | ||
1052 | #define E1000_82542_FCRTH 0x00160 | 1096 | #define E1000_82542_FCRTH 0x00160 |
1053 | #define E1000_82542_FCRTL 0x00168 | 1097 | #define E1000_82542_FCRTL 0x00168 |
1054 | #define E1000_82542_FCTTV E1000_FCTTV | 1098 | #define E1000_82542_FCTTV E1000_FCTTV |
@@ -1197,6 +1241,13 @@ struct e1000_ffvt_entry { | |||
1197 | #define E1000_82542_ICRXOC E1000_ICRXOC | 1241 | #define E1000_82542_ICRXOC E1000_ICRXOC |
1198 | #define E1000_82542_HICR E1000_HICR | 1242 | #define E1000_82542_HICR E1000_HICR |
1199 | 1243 | ||
1244 | #define E1000_82542_CPUVEC E1000_CPUVEC | ||
1245 | #define E1000_82542_MRQC E1000_MRQC | ||
1246 | #define E1000_82542_RETA E1000_RETA | ||
1247 | #define E1000_82542_RSSRK E1000_RSSRK | ||
1248 | #define E1000_82542_RSSIM E1000_RSSIM | ||
1249 | #define E1000_82542_RSSIR E1000_RSSIR | ||
1250 | |||
1200 | /* Statistics counters collected by the MAC */ | 1251 | /* Statistics counters collected by the MAC */ |
1201 | struct e1000_hw_stats { | 1252 | struct e1000_hw_stats { |
1202 | uint64_t crcerrs; | 1253 | uint64_t crcerrs; |
@@ -1336,6 +1387,7 @@ struct e1000_hw { | |||
1336 | boolean_t serdes_link_down; | 1387 | boolean_t serdes_link_down; |
1337 | boolean_t tbi_compatibility_en; | 1388 | boolean_t tbi_compatibility_en; |
1338 | boolean_t tbi_compatibility_on; | 1389 | boolean_t tbi_compatibility_on; |
1390 | boolean_t laa_is_present; | ||
1339 | boolean_t phy_reset_disable; | 1391 | boolean_t phy_reset_disable; |
1340 | boolean_t fc_send_xon; | 1392 | boolean_t fc_send_xon; |
1341 | boolean_t fc_strict_ieee; | 1393 | boolean_t fc_strict_ieee; |
@@ -1374,6 +1426,7 @@ struct e1000_hw { | |||
1374 | #define E1000_CTRL_BEM32 0x00000400 /* Big Endian 32 mode */ | 1426 | #define E1000_CTRL_BEM32 0x00000400 /* Big Endian 32 mode */ |
1375 | #define E1000_CTRL_FRCSPD 0x00000800 /* Force Speed */ | 1427 | #define E1000_CTRL_FRCSPD 0x00000800 /* Force Speed */ |
1376 | #define E1000_CTRL_FRCDPX 0x00001000 /* Force Duplex */ | 1428 | #define E1000_CTRL_FRCDPX 0x00001000 /* Force Duplex */ |
1429 | #define E1000_CTRL_D_UD_EN 0x00002000 /* Dock/Undock enable */ | ||
1377 | #define E1000_CTRL_D_UD_POLARITY 0x00004000 /* Defined polarity of Dock/Undock indication in SDP[0] */ | 1430 | #define E1000_CTRL_D_UD_POLARITY 0x00004000 /* Defined polarity of Dock/Undock indication in SDP[0] */ |
1378 | #define E1000_CTRL_SWDPIN0 0x00040000 /* SWDPIN 0 value */ | 1431 | #define E1000_CTRL_SWDPIN0 0x00040000 /* SWDPIN 0 value */ |
1379 | #define E1000_CTRL_SWDPIN1 0x00080000 /* SWDPIN 1 value */ | 1432 | #define E1000_CTRL_SWDPIN1 0x00080000 /* SWDPIN 1 value */ |
@@ -1491,6 +1544,8 @@ struct e1000_hw { | |||
1491 | #define E1000_CTRL_EXT_WR_WMARK_320 0x01000000 | 1544 | #define E1000_CTRL_EXT_WR_WMARK_320 0x01000000 |
1492 | #define E1000_CTRL_EXT_WR_WMARK_384 0x02000000 | 1545 | #define E1000_CTRL_EXT_WR_WMARK_384 0x02000000 |
1493 | #define E1000_CTRL_EXT_WR_WMARK_448 0x03000000 | 1546 | #define E1000_CTRL_EXT_WR_WMARK_448 0x03000000 |
1547 | #define E1000_CTRL_EXT_CANC 0x04000000 /* Interrupt delay cancellation */ | ||
1548 | #define E1000_CTRL_EXT_DRV_LOAD 0x10000000 /* Driver loaded bit for FW */ | ||
1494 | #define E1000_CTRL_EXT_IAME 0x08000000 /* Interrupt acknowledge Auto-mask */ | 1549 | #define E1000_CTRL_EXT_IAME 0x08000000 /* Interrupt acknowledge Auto-mask */ |
1495 | #define E1000_CTRL_EXT_INT_TIMER_CLR 0x20000000 /* Clear Interrupt timers after IMS clear */ | 1550 | #define E1000_CTRL_EXT_INT_TIMER_CLR 0x20000000 /* Clear Interrupt timers after IMS clear */ |
1496 | 1551 | ||
@@ -1524,6 +1579,7 @@ struct e1000_hw { | |||
1524 | #define E1000_LEDCTL_LED2_BLINK 0x00800000 | 1579 | #define E1000_LEDCTL_LED2_BLINK 0x00800000 |
1525 | #define E1000_LEDCTL_LED3_MODE_MASK 0x0F000000 | 1580 | #define E1000_LEDCTL_LED3_MODE_MASK 0x0F000000 |
1526 | #define E1000_LEDCTL_LED3_MODE_SHIFT 24 | 1581 | #define E1000_LEDCTL_LED3_MODE_SHIFT 24 |
1582 | #define E1000_LEDCTL_LED3_BLINK_RATE 0x20000000 | ||
1527 | #define E1000_LEDCTL_LED3_IVRT 0x40000000 | 1583 | #define E1000_LEDCTL_LED3_IVRT 0x40000000 |
1528 | #define E1000_LEDCTL_LED3_BLINK 0x80000000 | 1584 | #define E1000_LEDCTL_LED3_BLINK 0x80000000 |
1529 | 1585 | ||
@@ -1784,6 +1840,16 @@ struct e1000_hw { | |||
1784 | #define E1000_RXCSUM_IPPCSE 0x00001000 /* IP payload checksum enable */ | 1840 | #define E1000_RXCSUM_IPPCSE 0x00001000 /* IP payload checksum enable */ |
1785 | #define E1000_RXCSUM_PCSD 0x00002000 /* packet checksum disabled */ | 1841 | #define E1000_RXCSUM_PCSD 0x00002000 /* packet checksum disabled */ |
1786 | 1842 | ||
1843 | /* Multiple Receive Queue Control */ | ||
1844 | #define E1000_MRQC_ENABLE_MASK 0x00000003 | ||
1845 | #define E1000_MRQC_ENABLE_RSS_2Q 0x00000001 | ||
1846 | #define E1000_MRQC_ENABLE_RSS_INT 0x00000004 | ||
1847 | #define E1000_MRQC_RSS_FIELD_MASK 0xFFFF0000 | ||
1848 | #define E1000_MRQC_RSS_FIELD_IPV4_TCP 0x00010000 | ||
1849 | #define E1000_MRQC_RSS_FIELD_IPV4 0x00020000 | ||
1850 | #define E1000_MRQC_RSS_FIELD_IPV6_TCP 0x00040000 | ||
1851 | #define E1000_MRQC_RSS_FIELD_IPV6_EX 0x00080000 | ||
1852 | #define E1000_MRQC_RSS_FIELD_IPV6 0x00100000 | ||
1787 | 1853 | ||
1788 | /* Definitions for power management and wakeup registers */ | 1854 | /* Definitions for power management and wakeup registers */ |
1789 | /* Wake Up Control */ | 1855 | /* Wake Up Control */ |
@@ -1928,6 +1994,7 @@ struct e1000_host_command_info { | |||
1928 | #define E1000_MDALIGN 4096 | 1994 | #define E1000_MDALIGN 4096 |
1929 | 1995 | ||
1930 | #define E1000_GCR_BEM32 0x00400000 | 1996 | #define E1000_GCR_BEM32 0x00400000 |
1997 | #define E1000_GCR_L1_ACT_WITHOUT_L0S_RX 0x08000000 | ||
1931 | /* Function Active and Power State to MNG */ | 1998 | /* Function Active and Power State to MNG */ |
1932 | #define E1000_FACTPS_FUNC0_POWER_STATE_MASK 0x00000003 | 1999 | #define E1000_FACTPS_FUNC0_POWER_STATE_MASK 0x00000003 |
1933 | #define E1000_FACTPS_LAN0_VALID 0x00000004 | 2000 | #define E1000_FACTPS_LAN0_VALID 0x00000004 |
@@ -1980,6 +2047,7 @@ struct e1000_host_command_info { | |||
1980 | /* EEPROM Word Offsets */ | 2047 | /* EEPROM Word Offsets */ |
1981 | #define EEPROM_COMPAT 0x0003 | 2048 | #define EEPROM_COMPAT 0x0003 |
1982 | #define EEPROM_ID_LED_SETTINGS 0x0004 | 2049 | #define EEPROM_ID_LED_SETTINGS 0x0004 |
2050 | #define EEPROM_VERSION 0x0005 | ||
1983 | #define EEPROM_SERDES_AMPLITUDE 0x0006 /* For SERDES output amplitude adjustment. */ | 2051 | #define EEPROM_SERDES_AMPLITUDE 0x0006 /* For SERDES output amplitude adjustment. */ |
1984 | #define EEPROM_PHY_CLASS_WORD 0x0007 | 2052 | #define EEPROM_PHY_CLASS_WORD 0x0007 |
1985 | #define EEPROM_INIT_CONTROL1_REG 0x000A | 2053 | #define EEPROM_INIT_CONTROL1_REG 0x000A |
@@ -1990,6 +2058,8 @@ struct e1000_host_command_info { | |||
1990 | #define EEPROM_FLASH_VERSION 0x0032 | 2058 | #define EEPROM_FLASH_VERSION 0x0032 |
1991 | #define EEPROM_CHECKSUM_REG 0x003F | 2059 | #define EEPROM_CHECKSUM_REG 0x003F |
1992 | 2060 | ||
2061 | #define E1000_EEPROM_CFG_DONE 0x00040000 /* MNG config cycle done */ | ||
2062 | |||
1993 | /* Word definitions for ID LED Settings */ | 2063 | /* Word definitions for ID LED Settings */ |
1994 | #define ID_LED_RESERVED_0000 0x0000 | 2064 | #define ID_LED_RESERVED_0000 0x0000 |
1995 | #define ID_LED_RESERVED_FFFF 0xFFFF | 2065 | #define ID_LED_RESERVED_FFFF 0xFFFF |
@@ -2108,6 +2178,8 @@ struct e1000_host_command_info { | |||
2108 | #define E1000_PBA_22K 0x0016 | 2178 | #define E1000_PBA_22K 0x0016 |
2109 | #define E1000_PBA_24K 0x0018 | 2179 | #define E1000_PBA_24K 0x0018 |
2110 | #define E1000_PBA_30K 0x001E | 2180 | #define E1000_PBA_30K 0x001E |
2181 | #define E1000_PBA_32K 0x0020 | ||
2182 | #define E1000_PBA_38K 0x0026 | ||
2111 | #define E1000_PBA_40K 0x0028 | 2183 | #define E1000_PBA_40K 0x0028 |
2112 | #define E1000_PBA_48K 0x0030 /* 48KB, default RX allocation */ | 2184 | #define E1000_PBA_48K 0x0030 /* 48KB, default RX allocation */ |
2113 | 2185 | ||
@@ -2592,11 +2664,11 @@ struct e1000_host_command_info { | |||
2592 | 2664 | ||
2593 | /* 7 bits (3 Coarse + 4 Fine) --> 128 optional values */ | 2665 | /* 7 bits (3 Coarse + 4 Fine) --> 128 optional values */ |
2594 | #define IGP01E1000_AGC_LENGTH_TABLE_SIZE 128 | 2666 | #define IGP01E1000_AGC_LENGTH_TABLE_SIZE 128 |
2595 | #define IGP02E1000_AGC_LENGTH_TABLE_SIZE 128 | 2667 | #define IGP02E1000_AGC_LENGTH_TABLE_SIZE 113 |
2596 | 2668 | ||
2597 | /* The precision error of the cable length is +/- 10 meters */ | 2669 | /* The precision error of the cable length is +/- 10 meters */ |
2598 | #define IGP01E1000_AGC_RANGE 10 | 2670 | #define IGP01E1000_AGC_RANGE 10 |
2599 | #define IGP02E1000_AGC_RANGE 10 | 2671 | #define IGP02E1000_AGC_RANGE 15 |
2600 | 2672 | ||
2601 | /* IGP01E1000 PCS Initialization register */ | 2673 | /* IGP01E1000 PCS Initialization register */ |
2602 | /* bits 3:6 in the PCS registers stores the channels polarity */ | 2674 | /* bits 3:6 in the PCS registers stores the channels polarity */ |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index ee687c902a20..6b72f6acdd54 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -43,7 +43,7 @@ char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; | |||
43 | #else | 43 | #else |
44 | #define DRIVERNAPI "-NAPI" | 44 | #define DRIVERNAPI "-NAPI" |
45 | #endif | 45 | #endif |
46 | #define DRV_VERSION "6.0.60-k2"DRIVERNAPI | 46 | #define DRV_VERSION "6.1.16-k2"DRIVERNAPI |
47 | char e1000_driver_version[] = DRV_VERSION; | 47 | char e1000_driver_version[] = DRV_VERSION; |
48 | char e1000_copyright[] = "Copyright (c) 1999-2005 Intel Corporation."; | 48 | char e1000_copyright[] = "Copyright (c) 1999-2005 Intel Corporation."; |
49 | 49 | ||
@@ -80,6 +80,9 @@ static struct pci_device_id e1000_pci_tbl[] = { | |||
80 | INTEL_E1000_ETHERNET_DEVICE(0x1026), | 80 | INTEL_E1000_ETHERNET_DEVICE(0x1026), |
81 | INTEL_E1000_ETHERNET_DEVICE(0x1027), | 81 | INTEL_E1000_ETHERNET_DEVICE(0x1027), |
82 | INTEL_E1000_ETHERNET_DEVICE(0x1028), | 82 | INTEL_E1000_ETHERNET_DEVICE(0x1028), |
83 | INTEL_E1000_ETHERNET_DEVICE(0x105E), | ||
84 | INTEL_E1000_ETHERNET_DEVICE(0x105F), | ||
85 | INTEL_E1000_ETHERNET_DEVICE(0x1060), | ||
83 | INTEL_E1000_ETHERNET_DEVICE(0x1075), | 86 | INTEL_E1000_ETHERNET_DEVICE(0x1075), |
84 | INTEL_E1000_ETHERNET_DEVICE(0x1076), | 87 | INTEL_E1000_ETHERNET_DEVICE(0x1076), |
85 | INTEL_E1000_ETHERNET_DEVICE(0x1077), | 88 | INTEL_E1000_ETHERNET_DEVICE(0x1077), |
@@ -88,10 +91,13 @@ static struct pci_device_id e1000_pci_tbl[] = { | |||
88 | INTEL_E1000_ETHERNET_DEVICE(0x107A), | 91 | INTEL_E1000_ETHERNET_DEVICE(0x107A), |
89 | INTEL_E1000_ETHERNET_DEVICE(0x107B), | 92 | INTEL_E1000_ETHERNET_DEVICE(0x107B), |
90 | INTEL_E1000_ETHERNET_DEVICE(0x107C), | 93 | INTEL_E1000_ETHERNET_DEVICE(0x107C), |
94 | INTEL_E1000_ETHERNET_DEVICE(0x107D), | ||
95 | INTEL_E1000_ETHERNET_DEVICE(0x107E), | ||
96 | INTEL_E1000_ETHERNET_DEVICE(0x107F), | ||
91 | INTEL_E1000_ETHERNET_DEVICE(0x108A), | 97 | INTEL_E1000_ETHERNET_DEVICE(0x108A), |
92 | INTEL_E1000_ETHERNET_DEVICE(0x108B), | 98 | INTEL_E1000_ETHERNET_DEVICE(0x108B), |
93 | INTEL_E1000_ETHERNET_DEVICE(0x108C), | 99 | INTEL_E1000_ETHERNET_DEVICE(0x108C), |
94 | INTEL_E1000_ETHERNET_DEVICE(0x1099), | 100 | INTEL_E1000_ETHERNET_DEVICE(0x109A), |
95 | /* required last entry */ | 101 | /* required last entry */ |
96 | {0,} | 102 | {0,} |
97 | }; | 103 | }; |
@@ -102,10 +108,18 @@ int e1000_up(struct e1000_adapter *adapter); | |||
102 | void e1000_down(struct e1000_adapter *adapter); | 108 | void e1000_down(struct e1000_adapter *adapter); |
103 | void e1000_reset(struct e1000_adapter *adapter); | 109 | void e1000_reset(struct e1000_adapter *adapter); |
104 | int e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx); | 110 | int e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx); |
105 | int e1000_setup_tx_resources(struct e1000_adapter *adapter); | 111 | int e1000_setup_all_tx_resources(struct e1000_adapter *adapter); |
106 | int e1000_setup_rx_resources(struct e1000_adapter *adapter); | 112 | int e1000_setup_all_rx_resources(struct e1000_adapter *adapter); |
107 | void e1000_free_tx_resources(struct e1000_adapter *adapter); | 113 | void e1000_free_all_tx_resources(struct e1000_adapter *adapter); |
108 | void e1000_free_rx_resources(struct e1000_adapter *adapter); | 114 | void e1000_free_all_rx_resources(struct e1000_adapter *adapter); |
115 | int e1000_setup_tx_resources(struct e1000_adapter *adapter, | ||
116 | struct e1000_tx_ring *txdr); | ||
117 | int e1000_setup_rx_resources(struct e1000_adapter *adapter, | ||
118 | struct e1000_rx_ring *rxdr); | ||
119 | void e1000_free_tx_resources(struct e1000_adapter *adapter, | ||
120 | struct e1000_tx_ring *tx_ring); | ||
121 | void e1000_free_rx_resources(struct e1000_adapter *adapter, | ||
122 | struct e1000_rx_ring *rx_ring); | ||
109 | void e1000_update_stats(struct e1000_adapter *adapter); | 123 | void e1000_update_stats(struct e1000_adapter *adapter); |
110 | 124 | ||
111 | /* Local Function Prototypes */ | 125 | /* Local Function Prototypes */ |
@@ -114,14 +128,22 @@ static int e1000_init_module(void); | |||
114 | static void e1000_exit_module(void); | 128 | static void e1000_exit_module(void); |
115 | static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent); | 129 | static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent); |
116 | static void __devexit e1000_remove(struct pci_dev *pdev); | 130 | static void __devexit e1000_remove(struct pci_dev *pdev); |
131 | static int e1000_alloc_queues(struct e1000_adapter *adapter); | ||
132 | #ifdef CONFIG_E1000_MQ | ||
133 | static void e1000_setup_queue_mapping(struct e1000_adapter *adapter); | ||
134 | #endif | ||
117 | static int e1000_sw_init(struct e1000_adapter *adapter); | 135 | static int e1000_sw_init(struct e1000_adapter *adapter); |
118 | static int e1000_open(struct net_device *netdev); | 136 | static int e1000_open(struct net_device *netdev); |
119 | static int e1000_close(struct net_device *netdev); | 137 | static int e1000_close(struct net_device *netdev); |
120 | static void e1000_configure_tx(struct e1000_adapter *adapter); | 138 | static void e1000_configure_tx(struct e1000_adapter *adapter); |
121 | static void e1000_configure_rx(struct e1000_adapter *adapter); | 139 | static void e1000_configure_rx(struct e1000_adapter *adapter); |
122 | static void e1000_setup_rctl(struct e1000_adapter *adapter); | 140 | static void e1000_setup_rctl(struct e1000_adapter *adapter); |
123 | static void e1000_clean_tx_ring(struct e1000_adapter *adapter); | 141 | static void e1000_clean_all_tx_rings(struct e1000_adapter *adapter); |
124 | static void e1000_clean_rx_ring(struct e1000_adapter *adapter); | 142 | static void e1000_clean_all_rx_rings(struct e1000_adapter *adapter); |
143 | static void e1000_clean_tx_ring(struct e1000_adapter *adapter, | ||
144 | struct e1000_tx_ring *tx_ring); | ||
145 | static void e1000_clean_rx_ring(struct e1000_adapter *adapter, | ||
146 | struct e1000_rx_ring *rx_ring); | ||
125 | static void e1000_set_multi(struct net_device *netdev); | 147 | static void e1000_set_multi(struct net_device *netdev); |
126 | static void e1000_update_phy_info(unsigned long data); | 148 | static void e1000_update_phy_info(unsigned long data); |
127 | static void e1000_watchdog(unsigned long data); | 149 | static void e1000_watchdog(unsigned long data); |
@@ -132,19 +154,26 @@ static struct net_device_stats * e1000_get_stats(struct net_device *netdev); | |||
132 | static int e1000_change_mtu(struct net_device *netdev, int new_mtu); | 154 | static int e1000_change_mtu(struct net_device *netdev, int new_mtu); |
133 | static int e1000_set_mac(struct net_device *netdev, void *p); | 155 | static int e1000_set_mac(struct net_device *netdev, void *p); |
134 | static irqreturn_t e1000_intr(int irq, void *data, struct pt_regs *regs); | 156 | static irqreturn_t e1000_intr(int irq, void *data, struct pt_regs *regs); |
135 | static boolean_t e1000_clean_tx_irq(struct e1000_adapter *adapter); | 157 | static boolean_t e1000_clean_tx_irq(struct e1000_adapter *adapter, |
158 | struct e1000_tx_ring *tx_ring); | ||
136 | #ifdef CONFIG_E1000_NAPI | 159 | #ifdef CONFIG_E1000_NAPI |
137 | static int e1000_clean(struct net_device *netdev, int *budget); | 160 | static int e1000_clean(struct net_device *poll_dev, int *budget); |
138 | static boolean_t e1000_clean_rx_irq(struct e1000_adapter *adapter, | 161 | static boolean_t e1000_clean_rx_irq(struct e1000_adapter *adapter, |
162 | struct e1000_rx_ring *rx_ring, | ||
139 | int *work_done, int work_to_do); | 163 | int *work_done, int work_to_do); |
140 | static boolean_t e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | 164 | static boolean_t e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, |
165 | struct e1000_rx_ring *rx_ring, | ||
141 | int *work_done, int work_to_do); | 166 | int *work_done, int work_to_do); |
142 | #else | 167 | #else |
143 | static boolean_t e1000_clean_rx_irq(struct e1000_adapter *adapter); | 168 | static boolean_t e1000_clean_rx_irq(struct e1000_adapter *adapter, |
144 | static boolean_t e1000_clean_rx_irq_ps(struct e1000_adapter *adapter); | 169 | struct e1000_rx_ring *rx_ring); |
170 | static boolean_t e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | ||
171 | struct e1000_rx_ring *rx_ring); | ||
145 | #endif | 172 | #endif |
146 | static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter); | 173 | static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter, |
147 | static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter); | 174 | struct e1000_rx_ring *rx_ring); |
175 | static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, | ||
176 | struct e1000_rx_ring *rx_ring); | ||
148 | static int e1000_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd); | 177 | static int e1000_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd); |
149 | static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, | 178 | static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, |
150 | int cmd); | 179 | int cmd); |
@@ -172,6 +201,11 @@ static int e1000_resume(struct pci_dev *pdev); | |||
172 | static void e1000_netpoll (struct net_device *netdev); | 201 | static void e1000_netpoll (struct net_device *netdev); |
173 | #endif | 202 | #endif |
174 | 203 | ||
204 | #ifdef CONFIG_E1000_MQ | ||
205 | /* for multiple Rx queues */ | ||
206 | void e1000_rx_schedule(void *data); | ||
207 | #endif | ||
208 | |||
175 | /* Exported from other modules */ | 209 | /* Exported from other modules */ |
176 | 210 | ||
177 | extern void e1000_check_options(struct e1000_adapter *adapter); | 211 | extern void e1000_check_options(struct e1000_adapter *adapter); |
@@ -289,7 +323,7 @@ int | |||
289 | e1000_up(struct e1000_adapter *adapter) | 323 | e1000_up(struct e1000_adapter *adapter) |
290 | { | 324 | { |
291 | struct net_device *netdev = adapter->netdev; | 325 | struct net_device *netdev = adapter->netdev; |
292 | int err; | 326 | int i, err; |
293 | 327 | ||
294 | /* hardware has been reset, we need to reload some things */ | 328 | /* hardware has been reset, we need to reload some things */ |
295 | 329 | ||
@@ -308,7 +342,8 @@ e1000_up(struct e1000_adapter *adapter) | |||
308 | e1000_configure_tx(adapter); | 342 | e1000_configure_tx(adapter); |
309 | e1000_setup_rctl(adapter); | 343 | e1000_setup_rctl(adapter); |
310 | e1000_configure_rx(adapter); | 344 | e1000_configure_rx(adapter); |
311 | adapter->alloc_rx_buf(adapter); | 345 | for (i = 0; i < adapter->num_queues; i++) |
346 | adapter->alloc_rx_buf(adapter, &adapter->rx_ring[i]); | ||
312 | 347 | ||
313 | #ifdef CONFIG_PCI_MSI | 348 | #ifdef CONFIG_PCI_MSI |
314 | if(adapter->hw.mac_type > e1000_82547_rev_2) { | 349 | if(adapter->hw.mac_type > e1000_82547_rev_2) { |
@@ -344,6 +379,9 @@ e1000_down(struct e1000_adapter *adapter) | |||
344 | struct net_device *netdev = adapter->netdev; | 379 | struct net_device *netdev = adapter->netdev; |
345 | 380 | ||
346 | e1000_irq_disable(adapter); | 381 | e1000_irq_disable(adapter); |
382 | #ifdef CONFIG_E1000_MQ | ||
383 | while (atomic_read(&adapter->rx_sched_call_data.count) != 0); | ||
384 | #endif | ||
347 | free_irq(adapter->pdev->irq, netdev); | 385 | free_irq(adapter->pdev->irq, netdev); |
348 | #ifdef CONFIG_PCI_MSI | 386 | #ifdef CONFIG_PCI_MSI |
349 | if(adapter->hw.mac_type > e1000_82547_rev_2 && | 387 | if(adapter->hw.mac_type > e1000_82547_rev_2 && |
@@ -363,11 +401,10 @@ e1000_down(struct e1000_adapter *adapter) | |||
363 | netif_stop_queue(netdev); | 401 | netif_stop_queue(netdev); |
364 | 402 | ||
365 | e1000_reset(adapter); | 403 | e1000_reset(adapter); |
366 | e1000_clean_tx_ring(adapter); | 404 | e1000_clean_all_tx_rings(adapter); |
367 | e1000_clean_rx_ring(adapter); | 405 | e1000_clean_all_rx_rings(adapter); |
368 | 406 | ||
369 | /* If WoL is not enabled | 407 | /* If WoL is not enabled and management mode is not IAMT |
370 | * and management mode is not IAMT | ||
371 | * Power down the PHY so no link is implied when interface is down */ | 408 | * Power down the PHY so no link is implied when interface is down */ |
372 | if(!adapter->wol && adapter->hw.mac_type >= e1000_82540 && | 409 | if(!adapter->wol && adapter->hw.mac_type >= e1000_82540 && |
373 | adapter->hw.media_type == e1000_media_type_copper && | 410 | adapter->hw.media_type == e1000_media_type_copper && |
@@ -398,6 +435,10 @@ e1000_reset(struct e1000_adapter *adapter) | |||
398 | case e1000_82547_rev_2: | 435 | case e1000_82547_rev_2: |
399 | pba = E1000_PBA_30K; | 436 | pba = E1000_PBA_30K; |
400 | break; | 437 | break; |
438 | case e1000_82571: | ||
439 | case e1000_82572: | ||
440 | pba = E1000_PBA_38K; | ||
441 | break; | ||
401 | case e1000_82573: | 442 | case e1000_82573: |
402 | pba = E1000_PBA_12K; | 443 | pba = E1000_PBA_12K; |
403 | break; | 444 | break; |
@@ -475,6 +516,7 @@ e1000_probe(struct pci_dev *pdev, | |||
475 | struct net_device *netdev; | 516 | struct net_device *netdev; |
476 | struct e1000_adapter *adapter; | 517 | struct e1000_adapter *adapter; |
477 | unsigned long mmio_start, mmio_len; | 518 | unsigned long mmio_start, mmio_len; |
519 | uint32_t ctrl_ext; | ||
478 | uint32_t swsm; | 520 | uint32_t swsm; |
479 | 521 | ||
480 | static int cards_found = 0; | 522 | static int cards_found = 0; |
@@ -614,8 +656,9 @@ e1000_probe(struct pci_dev *pdev, | |||
614 | if(e1000_read_mac_addr(&adapter->hw)) | 656 | if(e1000_read_mac_addr(&adapter->hw)) |
615 | DPRINTK(PROBE, ERR, "EEPROM Read Error\n"); | 657 | DPRINTK(PROBE, ERR, "EEPROM Read Error\n"); |
616 | memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len); | 658 | memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len); |
659 | memcpy(netdev->perm_addr, adapter->hw.mac_addr, netdev->addr_len); | ||
617 | 660 | ||
618 | if(!is_valid_ether_addr(netdev->dev_addr)) { | 661 | if(!is_valid_ether_addr(netdev->perm_addr)) { |
619 | DPRINTK(PROBE, ERR, "Invalid MAC Address\n"); | 662 | DPRINTK(PROBE, ERR, "Invalid MAC Address\n"); |
620 | err = -EIO; | 663 | err = -EIO; |
621 | goto err_eeprom; | 664 | goto err_eeprom; |
@@ -687,6 +730,12 @@ e1000_probe(struct pci_dev *pdev, | |||
687 | 730 | ||
688 | /* Let firmware know the driver has taken over */ | 731 | /* Let firmware know the driver has taken over */ |
689 | switch(adapter->hw.mac_type) { | 732 | switch(adapter->hw.mac_type) { |
733 | case e1000_82571: | ||
734 | case e1000_82572: | ||
735 | ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT); | ||
736 | E1000_WRITE_REG(&adapter->hw, CTRL_EXT, | ||
737 | ctrl_ext | E1000_CTRL_EXT_DRV_LOAD); | ||
738 | break; | ||
690 | case e1000_82573: | 739 | case e1000_82573: |
691 | swsm = E1000_READ_REG(&adapter->hw, SWSM); | 740 | swsm = E1000_READ_REG(&adapter->hw, SWSM); |
692 | E1000_WRITE_REG(&adapter->hw, SWSM, | 741 | E1000_WRITE_REG(&adapter->hw, SWSM, |
@@ -731,7 +780,11 @@ e1000_remove(struct pci_dev *pdev) | |||
731 | { | 780 | { |
732 | struct net_device *netdev = pci_get_drvdata(pdev); | 781 | struct net_device *netdev = pci_get_drvdata(pdev); |
733 | struct e1000_adapter *adapter = netdev_priv(netdev); | 782 | struct e1000_adapter *adapter = netdev_priv(netdev); |
783 | uint32_t ctrl_ext; | ||
734 | uint32_t manc, swsm; | 784 | uint32_t manc, swsm; |
785 | #ifdef CONFIG_E1000_NAPI | ||
786 | int i; | ||
787 | #endif | ||
735 | 788 | ||
736 | flush_scheduled_work(); | 789 | flush_scheduled_work(); |
737 | 790 | ||
@@ -745,6 +798,12 @@ e1000_remove(struct pci_dev *pdev) | |||
745 | } | 798 | } |
746 | 799 | ||
747 | switch(adapter->hw.mac_type) { | 800 | switch(adapter->hw.mac_type) { |
801 | case e1000_82571: | ||
802 | case e1000_82572: | ||
803 | ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT); | ||
804 | E1000_WRITE_REG(&adapter->hw, CTRL_EXT, | ||
805 | ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD); | ||
806 | break; | ||
748 | case e1000_82573: | 807 | case e1000_82573: |
749 | swsm = E1000_READ_REG(&adapter->hw, SWSM); | 808 | swsm = E1000_READ_REG(&adapter->hw, SWSM); |
750 | E1000_WRITE_REG(&adapter->hw, SWSM, | 809 | E1000_WRITE_REG(&adapter->hw, SWSM, |
@@ -756,13 +815,27 @@ e1000_remove(struct pci_dev *pdev) | |||
756 | } | 815 | } |
757 | 816 | ||
758 | unregister_netdev(netdev); | 817 | unregister_netdev(netdev); |
818 | #ifdef CONFIG_E1000_NAPI | ||
819 | for (i = 0; i < adapter->num_queues; i++) | ||
820 | __dev_put(&adapter->polling_netdev[i]); | ||
821 | #endif | ||
759 | 822 | ||
760 | if(!e1000_check_phy_reset_block(&adapter->hw)) | 823 | if(!e1000_check_phy_reset_block(&adapter->hw)) |
761 | e1000_phy_hw_reset(&adapter->hw); | 824 | e1000_phy_hw_reset(&adapter->hw); |
762 | 825 | ||
826 | kfree(adapter->tx_ring); | ||
827 | kfree(adapter->rx_ring); | ||
828 | #ifdef CONFIG_E1000_NAPI | ||
829 | kfree(adapter->polling_netdev); | ||
830 | #endif | ||
831 | |||
763 | iounmap(adapter->hw.hw_addr); | 832 | iounmap(adapter->hw.hw_addr); |
764 | pci_release_regions(pdev); | 833 | pci_release_regions(pdev); |
765 | 834 | ||
835 | #ifdef CONFIG_E1000_MQ | ||
836 | free_percpu(adapter->cpu_netdev); | ||
837 | free_percpu(adapter->cpu_tx_ring); | ||
838 | #endif | ||
766 | free_netdev(netdev); | 839 | free_netdev(netdev); |
767 | 840 | ||
768 | pci_disable_device(pdev); | 841 | pci_disable_device(pdev); |
@@ -783,6 +856,9 @@ e1000_sw_init(struct e1000_adapter *adapter) | |||
783 | struct e1000_hw *hw = &adapter->hw; | 856 | struct e1000_hw *hw = &adapter->hw; |
784 | struct net_device *netdev = adapter->netdev; | 857 | struct net_device *netdev = adapter->netdev; |
785 | struct pci_dev *pdev = adapter->pdev; | 858 | struct pci_dev *pdev = adapter->pdev; |
859 | #ifdef CONFIG_E1000_NAPI | ||
860 | int i; | ||
861 | #endif | ||
786 | 862 | ||
787 | /* PCI config space info */ | 863 | /* PCI config space info */ |
788 | 864 | ||
@@ -840,14 +916,123 @@ e1000_sw_init(struct e1000_adapter *adapter) | |||
840 | hw->master_slave = E1000_MASTER_SLAVE; | 916 | hw->master_slave = E1000_MASTER_SLAVE; |
841 | } | 917 | } |
842 | 918 | ||
919 | #ifdef CONFIG_E1000_MQ | ||
920 | /* Number of supported queues */ | ||
921 | switch (hw->mac_type) { | ||
922 | case e1000_82571: | ||
923 | case e1000_82572: | ||
924 | adapter->num_queues = 2; | ||
925 | break; | ||
926 | default: | ||
927 | adapter->num_queues = 1; | ||
928 | break; | ||
929 | } | ||
930 | adapter->num_queues = min(adapter->num_queues, num_online_cpus()); | ||
931 | #else | ||
932 | adapter->num_queues = 1; | ||
933 | #endif | ||
934 | |||
935 | if (e1000_alloc_queues(adapter)) { | ||
936 | DPRINTK(PROBE, ERR, "Unable to allocate memory for queues\n"); | ||
937 | return -ENOMEM; | ||
938 | } | ||
939 | |||
940 | #ifdef CONFIG_E1000_NAPI | ||
941 | for (i = 0; i < adapter->num_queues; i++) { | ||
942 | adapter->polling_netdev[i].priv = adapter; | ||
943 | adapter->polling_netdev[i].poll = &e1000_clean; | ||
944 | adapter->polling_netdev[i].weight = 64; | ||
945 | dev_hold(&adapter->polling_netdev[i]); | ||
946 | set_bit(__LINK_STATE_START, &adapter->polling_netdev[i].state); | ||
947 | } | ||
948 | #endif | ||
949 | |||
950 | #ifdef CONFIG_E1000_MQ | ||
951 | e1000_setup_queue_mapping(adapter); | ||
952 | #endif | ||
953 | |||
843 | atomic_set(&adapter->irq_sem, 1); | 954 | atomic_set(&adapter->irq_sem, 1); |
844 | spin_lock_init(&adapter->stats_lock); | 955 | spin_lock_init(&adapter->stats_lock); |
845 | spin_lock_init(&adapter->tx_lock); | ||
846 | 956 | ||
847 | return 0; | 957 | return 0; |
848 | } | 958 | } |
849 | 959 | ||
850 | /** | 960 | /** |
961 | * e1000_alloc_queues - Allocate memory for all rings | ||
962 | * @adapter: board private structure to initialize | ||
963 | * | ||
964 | * We allocate one ring per queue at run-time since we don't know the | ||
965 | * number of queues at compile-time. The polling_netdev array is | ||
966 | * intended for Multiqueue, but should work fine with a single queue. | ||
967 | **/ | ||
968 | |||
969 | static int __devinit | ||
970 | e1000_alloc_queues(struct e1000_adapter *adapter) | ||
971 | { | ||
972 | int size; | ||
973 | |||
974 | size = sizeof(struct e1000_tx_ring) * adapter->num_queues; | ||
975 | adapter->tx_ring = kmalloc(size, GFP_KERNEL); | ||
976 | if (!adapter->tx_ring) | ||
977 | return -ENOMEM; | ||
978 | memset(adapter->tx_ring, 0, size); | ||
979 | |||
980 | size = sizeof(struct e1000_rx_ring) * adapter->num_queues; | ||
981 | adapter->rx_ring = kmalloc(size, GFP_KERNEL); | ||
982 | if (!adapter->rx_ring) { | ||
983 | kfree(adapter->tx_ring); | ||
984 | return -ENOMEM; | ||
985 | } | ||
986 | memset(adapter->rx_ring, 0, size); | ||
987 | |||
988 | #ifdef CONFIG_E1000_NAPI | ||
989 | size = sizeof(struct net_device) * adapter->num_queues; | ||
990 | adapter->polling_netdev = kmalloc(size, GFP_KERNEL); | ||
991 | if (!adapter->polling_netdev) { | ||
992 | kfree(adapter->tx_ring); | ||
993 | kfree(adapter->rx_ring); | ||
994 | return -ENOMEM; | ||
995 | } | ||
996 | memset(adapter->polling_netdev, 0, size); | ||
997 | #endif | ||
998 | |||
999 | return E1000_SUCCESS; | ||
1000 | } | ||
1001 | |||
1002 | #ifdef CONFIG_E1000_MQ | ||
1003 | static void __devinit | ||
1004 | e1000_setup_queue_mapping(struct e1000_adapter *adapter) | ||
1005 | { | ||
1006 | int i, cpu; | ||
1007 | |||
1008 | adapter->rx_sched_call_data.func = e1000_rx_schedule; | ||
1009 | adapter->rx_sched_call_data.info = adapter->netdev; | ||
1010 | cpus_clear(adapter->rx_sched_call_data.cpumask); | ||
1011 | |||
1012 | adapter->cpu_netdev = alloc_percpu(struct net_device *); | ||
1013 | adapter->cpu_tx_ring = alloc_percpu(struct e1000_tx_ring *); | ||
1014 | |||
1015 | lock_cpu_hotplug(); | ||
1016 | i = 0; | ||
1017 | for_each_online_cpu(cpu) { | ||
1018 | *per_cpu_ptr(adapter->cpu_tx_ring, cpu) = &adapter->tx_ring[i % adapter->num_queues]; | ||
1019 | /* This is incomplete because we'd like to assign separate | ||
1020 | * physical cpus to these netdev polling structures and | ||
1021 | * avoid saturating a subset of cpus. | ||
1022 | */ | ||
1023 | if (i < adapter->num_queues) { | ||
1024 | *per_cpu_ptr(adapter->cpu_netdev, cpu) = &adapter->polling_netdev[i]; | ||
1025 | adapter->cpu_for_queue[i] = cpu; | ||
1026 | } else | ||
1027 | *per_cpu_ptr(adapter->cpu_netdev, cpu) = NULL; | ||
1028 | |||
1029 | i++; | ||
1030 | } | ||
1031 | unlock_cpu_hotplug(); | ||
1032 | } | ||
1033 | #endif | ||
1034 | |||
1035 | /** | ||
851 | * e1000_open - Called when a network interface is made active | 1036 | * e1000_open - Called when a network interface is made active |
852 | * @netdev: network interface device structure | 1037 | * @netdev: network interface device structure |
853 | * | 1038 | * |
@@ -868,12 +1053,12 @@ e1000_open(struct net_device *netdev) | |||
868 | 1053 | ||
869 | /* allocate transmit descriptors */ | 1054 | /* allocate transmit descriptors */ |
870 | 1055 | ||
871 | if((err = e1000_setup_tx_resources(adapter))) | 1056 | if ((err = e1000_setup_all_tx_resources(adapter))) |
872 | goto err_setup_tx; | 1057 | goto err_setup_tx; |
873 | 1058 | ||
874 | /* allocate receive descriptors */ | 1059 | /* allocate receive descriptors */ |
875 | 1060 | ||
876 | if((err = e1000_setup_rx_resources(adapter))) | 1061 | if ((err = e1000_setup_all_rx_resources(adapter))) |
877 | goto err_setup_rx; | 1062 | goto err_setup_rx; |
878 | 1063 | ||
879 | if((err = e1000_up(adapter))) | 1064 | if((err = e1000_up(adapter))) |
@@ -887,9 +1072,9 @@ e1000_open(struct net_device *netdev) | |||
887 | return E1000_SUCCESS; | 1072 | return E1000_SUCCESS; |
888 | 1073 | ||
889 | err_up: | 1074 | err_up: |
890 | e1000_free_rx_resources(adapter); | 1075 | e1000_free_all_rx_resources(adapter); |
891 | err_setup_rx: | 1076 | err_setup_rx: |
892 | e1000_free_tx_resources(adapter); | 1077 | e1000_free_all_tx_resources(adapter); |
893 | err_setup_tx: | 1078 | err_setup_tx: |
894 | e1000_reset(adapter); | 1079 | e1000_reset(adapter); |
895 | 1080 | ||
@@ -915,8 +1100,8 @@ e1000_close(struct net_device *netdev) | |||
915 | 1100 | ||
916 | e1000_down(adapter); | 1101 | e1000_down(adapter); |
917 | 1102 | ||
918 | e1000_free_tx_resources(adapter); | 1103 | e1000_free_all_tx_resources(adapter); |
919 | e1000_free_rx_resources(adapter); | 1104 | e1000_free_all_rx_resources(adapter); |
920 | 1105 | ||
921 | if((adapter->hw.mng_cookie.status & | 1106 | if((adapter->hw.mng_cookie.status & |
922 | E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) { | 1107 | E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) { |
@@ -951,14 +1136,15 @@ e1000_check_64k_bound(struct e1000_adapter *adapter, | |||
951 | /** | 1136 | /** |
952 | * e1000_setup_tx_resources - allocate Tx resources (Descriptors) | 1137 | * e1000_setup_tx_resources - allocate Tx resources (Descriptors) |
953 | * @adapter: board private structure | 1138 | * @adapter: board private structure |
1139 | * @txdr: tx descriptor ring (for a specific queue) to setup | ||
954 | * | 1140 | * |
955 | * Return 0 on success, negative on failure | 1141 | * Return 0 on success, negative on failure |
956 | **/ | 1142 | **/ |
957 | 1143 | ||
958 | int | 1144 | int |
959 | e1000_setup_tx_resources(struct e1000_adapter *adapter) | 1145 | e1000_setup_tx_resources(struct e1000_adapter *adapter, |
1146 | struct e1000_tx_ring *txdr) | ||
960 | { | 1147 | { |
961 | struct e1000_desc_ring *txdr = &adapter->tx_ring; | ||
962 | struct pci_dev *pdev = adapter->pdev; | 1148 | struct pci_dev *pdev = adapter->pdev; |
963 | int size; | 1149 | int size; |
964 | 1150 | ||
@@ -970,6 +1156,7 @@ e1000_setup_tx_resources(struct e1000_adapter *adapter) | |||
970 | return -ENOMEM; | 1156 | return -ENOMEM; |
971 | } | 1157 | } |
972 | memset(txdr->buffer_info, 0, size); | 1158 | memset(txdr->buffer_info, 0, size); |
1159 | memset(&txdr->previous_buffer_info, 0, sizeof(struct e1000_buffer)); | ||
973 | 1160 | ||
974 | /* round up to nearest 4K */ | 1161 | /* round up to nearest 4K */ |
975 | 1162 | ||
@@ -1018,11 +1205,41 @@ setup_tx_desc_die: | |||
1018 | 1205 | ||
1019 | txdr->next_to_use = 0; | 1206 | txdr->next_to_use = 0; |
1020 | txdr->next_to_clean = 0; | 1207 | txdr->next_to_clean = 0; |
1208 | spin_lock_init(&txdr->tx_lock); | ||
1021 | 1209 | ||
1022 | return 0; | 1210 | return 0; |
1023 | } | 1211 | } |
1024 | 1212 | ||
1025 | /** | 1213 | /** |
1214 | * e1000_setup_all_tx_resources - wrapper to allocate Tx resources | ||
1215 | * (Descriptors) for all queues | ||
1216 | * @adapter: board private structure | ||
1217 | * | ||
1218 | * If this function returns with an error, then it's possible one or | ||
1219 | * more of the rings is populated (while the rest are not). It is the | ||
1220 | * callers duty to clean those orphaned rings. | ||
1221 | * | ||
1222 | * Return 0 on success, negative on failure | ||
1223 | **/ | ||
1224 | |||
1225 | int | ||
1226 | e1000_setup_all_tx_resources(struct e1000_adapter *adapter) | ||
1227 | { | ||
1228 | int i, err = 0; | ||
1229 | |||
1230 | for (i = 0; i < adapter->num_queues; i++) { | ||
1231 | err = e1000_setup_tx_resources(adapter, &adapter->tx_ring[i]); | ||
1232 | if (err) { | ||
1233 | DPRINTK(PROBE, ERR, | ||
1234 | "Allocation for Tx Queue %u failed\n", i); | ||
1235 | break; | ||
1236 | } | ||
1237 | } | ||
1238 | |||
1239 | return err; | ||
1240 | } | ||
1241 | |||
1242 | /** | ||
1026 | * e1000_configure_tx - Configure 8254x Transmit Unit after Reset | 1243 | * e1000_configure_tx - Configure 8254x Transmit Unit after Reset |
1027 | * @adapter: board private structure | 1244 | * @adapter: board private structure |
1028 | * | 1245 | * |
@@ -1032,23 +1249,43 @@ setup_tx_desc_die: | |||
1032 | static void | 1249 | static void |
1033 | e1000_configure_tx(struct e1000_adapter *adapter) | 1250 | e1000_configure_tx(struct e1000_adapter *adapter) |
1034 | { | 1251 | { |
1035 | uint64_t tdba = adapter->tx_ring.dma; | 1252 | uint64_t tdba; |
1036 | uint32_t tdlen = adapter->tx_ring.count * sizeof(struct e1000_tx_desc); | 1253 | struct e1000_hw *hw = &adapter->hw; |
1037 | uint32_t tctl, tipg; | 1254 | uint32_t tdlen, tctl, tipg, tarc; |
1038 | |||
1039 | E1000_WRITE_REG(&adapter->hw, TDBAL, (tdba & 0x00000000ffffffffULL)); | ||
1040 | E1000_WRITE_REG(&adapter->hw, TDBAH, (tdba >> 32)); | ||
1041 | |||
1042 | E1000_WRITE_REG(&adapter->hw, TDLEN, tdlen); | ||
1043 | 1255 | ||
1044 | /* Setup the HW Tx Head and Tail descriptor pointers */ | 1256 | /* Setup the HW Tx Head and Tail descriptor pointers */ |
1045 | 1257 | ||
1046 | E1000_WRITE_REG(&adapter->hw, TDH, 0); | 1258 | switch (adapter->num_queues) { |
1047 | E1000_WRITE_REG(&adapter->hw, TDT, 0); | 1259 | case 2: |
1260 | tdba = adapter->tx_ring[1].dma; | ||
1261 | tdlen = adapter->tx_ring[1].count * | ||
1262 | sizeof(struct e1000_tx_desc); | ||
1263 | E1000_WRITE_REG(hw, TDBAL1, (tdba & 0x00000000ffffffffULL)); | ||
1264 | E1000_WRITE_REG(hw, TDBAH1, (tdba >> 32)); | ||
1265 | E1000_WRITE_REG(hw, TDLEN1, tdlen); | ||
1266 | E1000_WRITE_REG(hw, TDH1, 0); | ||
1267 | E1000_WRITE_REG(hw, TDT1, 0); | ||
1268 | adapter->tx_ring[1].tdh = E1000_TDH1; | ||
1269 | adapter->tx_ring[1].tdt = E1000_TDT1; | ||
1270 | /* Fall Through */ | ||
1271 | case 1: | ||
1272 | default: | ||
1273 | tdba = adapter->tx_ring[0].dma; | ||
1274 | tdlen = adapter->tx_ring[0].count * | ||
1275 | sizeof(struct e1000_tx_desc); | ||
1276 | E1000_WRITE_REG(hw, TDBAL, (tdba & 0x00000000ffffffffULL)); | ||
1277 | E1000_WRITE_REG(hw, TDBAH, (tdba >> 32)); | ||
1278 | E1000_WRITE_REG(hw, TDLEN, tdlen); | ||
1279 | E1000_WRITE_REG(hw, TDH, 0); | ||
1280 | E1000_WRITE_REG(hw, TDT, 0); | ||
1281 | adapter->tx_ring[0].tdh = E1000_TDH; | ||
1282 | adapter->tx_ring[0].tdt = E1000_TDT; | ||
1283 | break; | ||
1284 | } | ||
1048 | 1285 | ||
1049 | /* Set the default values for the Tx Inter Packet Gap timer */ | 1286 | /* Set the default values for the Tx Inter Packet Gap timer */ |
1050 | 1287 | ||
1051 | switch (adapter->hw.mac_type) { | 1288 | switch (hw->mac_type) { |
1052 | case e1000_82542_rev2_0: | 1289 | case e1000_82542_rev2_0: |
1053 | case e1000_82542_rev2_1: | 1290 | case e1000_82542_rev2_1: |
1054 | tipg = DEFAULT_82542_TIPG_IPGT; | 1291 | tipg = DEFAULT_82542_TIPG_IPGT; |
@@ -1056,67 +1293,81 @@ e1000_configure_tx(struct e1000_adapter *adapter) | |||
1056 | tipg |= DEFAULT_82542_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT; | 1293 | tipg |= DEFAULT_82542_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT; |
1057 | break; | 1294 | break; |
1058 | default: | 1295 | default: |
1059 | if(adapter->hw.media_type == e1000_media_type_fiber || | 1296 | if (hw->media_type == e1000_media_type_fiber || |
1060 | adapter->hw.media_type == e1000_media_type_internal_serdes) | 1297 | hw->media_type == e1000_media_type_internal_serdes) |
1061 | tipg = DEFAULT_82543_TIPG_IPGT_FIBER; | 1298 | tipg = DEFAULT_82543_TIPG_IPGT_FIBER; |
1062 | else | 1299 | else |
1063 | tipg = DEFAULT_82543_TIPG_IPGT_COPPER; | 1300 | tipg = DEFAULT_82543_TIPG_IPGT_COPPER; |
1064 | tipg |= DEFAULT_82543_TIPG_IPGR1 << E1000_TIPG_IPGR1_SHIFT; | 1301 | tipg |= DEFAULT_82543_TIPG_IPGR1 << E1000_TIPG_IPGR1_SHIFT; |
1065 | tipg |= DEFAULT_82543_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT; | 1302 | tipg |= DEFAULT_82543_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT; |
1066 | } | 1303 | } |
1067 | E1000_WRITE_REG(&adapter->hw, TIPG, tipg); | 1304 | E1000_WRITE_REG(hw, TIPG, tipg); |
1068 | 1305 | ||
1069 | /* Set the Tx Interrupt Delay register */ | 1306 | /* Set the Tx Interrupt Delay register */ |
1070 | 1307 | ||
1071 | E1000_WRITE_REG(&adapter->hw, TIDV, adapter->tx_int_delay); | 1308 | E1000_WRITE_REG(hw, TIDV, adapter->tx_int_delay); |
1072 | if(adapter->hw.mac_type >= e1000_82540) | 1309 | if (hw->mac_type >= e1000_82540) |
1073 | E1000_WRITE_REG(&adapter->hw, TADV, adapter->tx_abs_int_delay); | 1310 | E1000_WRITE_REG(hw, TADV, adapter->tx_abs_int_delay); |
1074 | 1311 | ||
1075 | /* Program the Transmit Control Register */ | 1312 | /* Program the Transmit Control Register */ |
1076 | 1313 | ||
1077 | tctl = E1000_READ_REG(&adapter->hw, TCTL); | 1314 | tctl = E1000_READ_REG(hw, TCTL); |
1078 | 1315 | ||
1079 | tctl &= ~E1000_TCTL_CT; | 1316 | tctl &= ~E1000_TCTL_CT; |
1080 | tctl |= E1000_TCTL_EN | E1000_TCTL_PSP | | 1317 | tctl |= E1000_TCTL_EN | E1000_TCTL_PSP | E1000_TCTL_RTLC | |
1081 | (E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT); | 1318 | (E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT); |
1082 | 1319 | ||
1083 | E1000_WRITE_REG(&adapter->hw, TCTL, tctl); | 1320 | E1000_WRITE_REG(hw, TCTL, tctl); |
1084 | 1321 | ||
1085 | e1000_config_collision_dist(&adapter->hw); | 1322 | if (hw->mac_type == e1000_82571 || hw->mac_type == e1000_82572) { |
1323 | tarc = E1000_READ_REG(hw, TARC0); | ||
1324 | tarc |= ((1 << 25) | (1 << 21)); | ||
1325 | E1000_WRITE_REG(hw, TARC0, tarc); | ||
1326 | tarc = E1000_READ_REG(hw, TARC1); | ||
1327 | tarc |= (1 << 25); | ||
1328 | if (tctl & E1000_TCTL_MULR) | ||
1329 | tarc &= ~(1 << 28); | ||
1330 | else | ||
1331 | tarc |= (1 << 28); | ||
1332 | E1000_WRITE_REG(hw, TARC1, tarc); | ||
1333 | } | ||
1334 | |||
1335 | e1000_config_collision_dist(hw); | ||
1086 | 1336 | ||
1087 | /* Setup Transmit Descriptor Settings for eop descriptor */ | 1337 | /* Setup Transmit Descriptor Settings for eop descriptor */ |
1088 | adapter->txd_cmd = E1000_TXD_CMD_IDE | E1000_TXD_CMD_EOP | | 1338 | adapter->txd_cmd = E1000_TXD_CMD_IDE | E1000_TXD_CMD_EOP | |
1089 | E1000_TXD_CMD_IFCS; | 1339 | E1000_TXD_CMD_IFCS; |
1090 | 1340 | ||
1091 | if(adapter->hw.mac_type < e1000_82543) | 1341 | if (hw->mac_type < e1000_82543) |
1092 | adapter->txd_cmd |= E1000_TXD_CMD_RPS; | 1342 | adapter->txd_cmd |= E1000_TXD_CMD_RPS; |
1093 | else | 1343 | else |
1094 | adapter->txd_cmd |= E1000_TXD_CMD_RS; | 1344 | adapter->txd_cmd |= E1000_TXD_CMD_RS; |
1095 | 1345 | ||
1096 | /* Cache if we're 82544 running in PCI-X because we'll | 1346 | /* Cache if we're 82544 running in PCI-X because we'll |
1097 | * need this to apply a workaround later in the send path. */ | 1347 | * need this to apply a workaround later in the send path. */ |
1098 | if(adapter->hw.mac_type == e1000_82544 && | 1348 | if (hw->mac_type == e1000_82544 && |
1099 | adapter->hw.bus_type == e1000_bus_type_pcix) | 1349 | hw->bus_type == e1000_bus_type_pcix) |
1100 | adapter->pcix_82544 = 1; | 1350 | adapter->pcix_82544 = 1; |
1101 | } | 1351 | } |
1102 | 1352 | ||
1103 | /** | 1353 | /** |
1104 | * e1000_setup_rx_resources - allocate Rx resources (Descriptors) | 1354 | * e1000_setup_rx_resources - allocate Rx resources (Descriptors) |
1105 | * @adapter: board private structure | 1355 | * @adapter: board private structure |
1356 | * @rxdr: rx descriptor ring (for a specific queue) to setup | ||
1106 | * | 1357 | * |
1107 | * Returns 0 on success, negative on failure | 1358 | * Returns 0 on success, negative on failure |
1108 | **/ | 1359 | **/ |
1109 | 1360 | ||
1110 | int | 1361 | int |
1111 | e1000_setup_rx_resources(struct e1000_adapter *adapter) | 1362 | e1000_setup_rx_resources(struct e1000_adapter *adapter, |
1363 | struct e1000_rx_ring *rxdr) | ||
1112 | { | 1364 | { |
1113 | struct e1000_desc_ring *rxdr = &adapter->rx_ring; | ||
1114 | struct pci_dev *pdev = adapter->pdev; | 1365 | struct pci_dev *pdev = adapter->pdev; |
1115 | int size, desc_len; | 1366 | int size, desc_len; |
1116 | 1367 | ||
1117 | size = sizeof(struct e1000_buffer) * rxdr->count; | 1368 | size = sizeof(struct e1000_buffer) * rxdr->count; |
1118 | rxdr->buffer_info = vmalloc(size); | 1369 | rxdr->buffer_info = vmalloc(size); |
1119 | if(!rxdr->buffer_info) { | 1370 | if (!rxdr->buffer_info) { |
1120 | DPRINTK(PROBE, ERR, | 1371 | DPRINTK(PROBE, ERR, |
1121 | "Unable to allocate memory for the receive descriptor ring\n"); | 1372 | "Unable to allocate memory for the receive descriptor ring\n"); |
1122 | return -ENOMEM; | 1373 | return -ENOMEM; |
@@ -1156,13 +1407,13 @@ e1000_setup_rx_resources(struct e1000_adapter *adapter) | |||
1156 | 1407 | ||
1157 | rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma); | 1408 | rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma); |
1158 | 1409 | ||
1159 | if(!rxdr->desc) { | 1410 | if (!rxdr->desc) { |
1411 | DPRINTK(PROBE, ERR, | ||
1412 | "Unable to allocate memory for the receive descriptor ring\n"); | ||
1160 | setup_rx_desc_die: | 1413 | setup_rx_desc_die: |
1161 | vfree(rxdr->buffer_info); | 1414 | vfree(rxdr->buffer_info); |
1162 | kfree(rxdr->ps_page); | 1415 | kfree(rxdr->ps_page); |
1163 | kfree(rxdr->ps_page_dma); | 1416 | kfree(rxdr->ps_page_dma); |
1164 | DPRINTK(PROBE, ERR, | ||
1165 | "Unable to allocate memory for the receive descriptor ring\n"); | ||
1166 | return -ENOMEM; | 1417 | return -ENOMEM; |
1167 | } | 1418 | } |
1168 | 1419 | ||
@@ -1174,9 +1425,12 @@ setup_rx_desc_die: | |||
1174 | "at %p\n", rxdr->size, rxdr->desc); | 1425 | "at %p\n", rxdr->size, rxdr->desc); |
1175 | /* Try again, without freeing the previous */ | 1426 | /* Try again, without freeing the previous */ |
1176 | rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma); | 1427 | rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma); |
1177 | if(!rxdr->desc) { | ||
1178 | /* Failed allocation, critical failure */ | 1428 | /* Failed allocation, critical failure */ |
1429 | if (!rxdr->desc) { | ||
1179 | pci_free_consistent(pdev, rxdr->size, olddesc, olddma); | 1430 | pci_free_consistent(pdev, rxdr->size, olddesc, olddma); |
1431 | DPRINTK(PROBE, ERR, | ||
1432 | "Unable to allocate memory " | ||
1433 | "for the receive descriptor ring\n"); | ||
1180 | goto setup_rx_desc_die; | 1434 | goto setup_rx_desc_die; |
1181 | } | 1435 | } |
1182 | 1436 | ||
@@ -1188,10 +1442,7 @@ setup_rx_desc_die: | |||
1188 | DPRINTK(PROBE, ERR, | 1442 | DPRINTK(PROBE, ERR, |
1189 | "Unable to allocate aligned memory " | 1443 | "Unable to allocate aligned memory " |
1190 | "for the receive descriptor ring\n"); | 1444 | "for the receive descriptor ring\n"); |
1191 | vfree(rxdr->buffer_info); | 1445 | goto setup_rx_desc_die; |
1192 | kfree(rxdr->ps_page); | ||
1193 | kfree(rxdr->ps_page_dma); | ||
1194 | return -ENOMEM; | ||
1195 | } else { | 1446 | } else { |
1196 | /* Free old allocation, new allocation was successful */ | 1447 | /* Free old allocation, new allocation was successful */ |
1197 | pci_free_consistent(pdev, rxdr->size, olddesc, olddma); | 1448 | pci_free_consistent(pdev, rxdr->size, olddesc, olddma); |
@@ -1206,15 +1457,48 @@ setup_rx_desc_die: | |||
1206 | } | 1457 | } |
1207 | 1458 | ||
1208 | /** | 1459 | /** |
1460 | * e1000_setup_all_rx_resources - wrapper to allocate Rx resources | ||
1461 | * (Descriptors) for all queues | ||
1462 | * @adapter: board private structure | ||
1463 | * | ||
1464 | * If this function returns with an error, then it's possible one or | ||
1465 | * more of the rings is populated (while the rest are not). It is the | ||
1466 | * callers duty to clean those orphaned rings. | ||
1467 | * | ||
1468 | * Return 0 on success, negative on failure | ||
1469 | **/ | ||
1470 | |||
1471 | int | ||
1472 | e1000_setup_all_rx_resources(struct e1000_adapter *adapter) | ||
1473 | { | ||
1474 | int i, err = 0; | ||
1475 | |||
1476 | for (i = 0; i < adapter->num_queues; i++) { | ||
1477 | err = e1000_setup_rx_resources(adapter, &adapter->rx_ring[i]); | ||
1478 | if (err) { | ||
1479 | DPRINTK(PROBE, ERR, | ||
1480 | "Allocation for Rx Queue %u failed\n", i); | ||
1481 | break; | ||
1482 | } | ||
1483 | } | ||
1484 | |||
1485 | return err; | ||
1486 | } | ||
1487 | |||
1488 | /** | ||
1209 | * e1000_setup_rctl - configure the receive control registers | 1489 | * e1000_setup_rctl - configure the receive control registers |
1210 | * @adapter: Board private structure | 1490 | * @adapter: Board private structure |
1211 | **/ | 1491 | **/ |
1212 | 1492 | #define PAGE_USE_COUNT(S) (((S) >> PAGE_SHIFT) + \ | |
1493 | (((S) & (PAGE_SIZE - 1)) ? 1 : 0)) | ||
1213 | static void | 1494 | static void |
1214 | e1000_setup_rctl(struct e1000_adapter *adapter) | 1495 | e1000_setup_rctl(struct e1000_adapter *adapter) |
1215 | { | 1496 | { |
1216 | uint32_t rctl, rfctl; | 1497 | uint32_t rctl, rfctl; |
1217 | uint32_t psrctl = 0; | 1498 | uint32_t psrctl = 0; |
1499 | #ifdef CONFIG_E1000_PACKET_SPLIT | ||
1500 | uint32_t pages = 0; | ||
1501 | #endif | ||
1218 | 1502 | ||
1219 | rctl = E1000_READ_REG(&adapter->hw, RCTL); | 1503 | rctl = E1000_READ_REG(&adapter->hw, RCTL); |
1220 | 1504 | ||
@@ -1235,7 +1519,7 @@ e1000_setup_rctl(struct e1000_adapter *adapter) | |||
1235 | rctl |= E1000_RCTL_LPE; | 1519 | rctl |= E1000_RCTL_LPE; |
1236 | 1520 | ||
1237 | /* Setup buffer sizes */ | 1521 | /* Setup buffer sizes */ |
1238 | if(adapter->hw.mac_type == e1000_82573) { | 1522 | if(adapter->hw.mac_type >= e1000_82571) { |
1239 | /* We can now specify buffers in 1K increments. | 1523 | /* We can now specify buffers in 1K increments. |
1240 | * BSIZE and BSEX are ignored in this case. */ | 1524 | * BSIZE and BSEX are ignored in this case. */ |
1241 | rctl |= adapter->rx_buffer_len << 0x11; | 1525 | rctl |= adapter->rx_buffer_len << 0x11; |
@@ -1268,11 +1552,14 @@ e1000_setup_rctl(struct e1000_adapter *adapter) | |||
1268 | * followed by the page buffers. Therefore, skb->data is | 1552 | * followed by the page buffers. Therefore, skb->data is |
1269 | * sized to hold the largest protocol header. | 1553 | * sized to hold the largest protocol header. |
1270 | */ | 1554 | */ |
1271 | adapter->rx_ps = (adapter->hw.mac_type > e1000_82547_rev_2) | 1555 | pages = PAGE_USE_COUNT(adapter->netdev->mtu); |
1272 | && (adapter->netdev->mtu | 1556 | if ((adapter->hw.mac_type > e1000_82547_rev_2) && (pages <= 3) && |
1273 | < ((3 * PAGE_SIZE) + adapter->rx_ps_bsize0)); | 1557 | PAGE_SIZE <= 16384) |
1558 | adapter->rx_ps_pages = pages; | ||
1559 | else | ||
1560 | adapter->rx_ps_pages = 0; | ||
1274 | #endif | 1561 | #endif |
1275 | if(adapter->rx_ps) { | 1562 | if (adapter->rx_ps_pages) { |
1276 | /* Configure extra packet-split registers */ | 1563 | /* Configure extra packet-split registers */ |
1277 | rfctl = E1000_READ_REG(&adapter->hw, RFCTL); | 1564 | rfctl = E1000_READ_REG(&adapter->hw, RFCTL); |
1278 | rfctl |= E1000_RFCTL_EXTEN; | 1565 | rfctl |= E1000_RFCTL_EXTEN; |
@@ -1284,12 +1571,19 @@ e1000_setup_rctl(struct e1000_adapter *adapter) | |||
1284 | 1571 | ||
1285 | psrctl |= adapter->rx_ps_bsize0 >> | 1572 | psrctl |= adapter->rx_ps_bsize0 >> |
1286 | E1000_PSRCTL_BSIZE0_SHIFT; | 1573 | E1000_PSRCTL_BSIZE0_SHIFT; |
1287 | psrctl |= PAGE_SIZE >> | 1574 | |
1288 | E1000_PSRCTL_BSIZE1_SHIFT; | 1575 | switch (adapter->rx_ps_pages) { |
1289 | psrctl |= PAGE_SIZE << | 1576 | case 3: |
1290 | E1000_PSRCTL_BSIZE2_SHIFT; | 1577 | psrctl |= PAGE_SIZE << |
1291 | psrctl |= PAGE_SIZE << | 1578 | E1000_PSRCTL_BSIZE3_SHIFT; |
1292 | E1000_PSRCTL_BSIZE3_SHIFT; | 1579 | case 2: |
1580 | psrctl |= PAGE_SIZE << | ||
1581 | E1000_PSRCTL_BSIZE2_SHIFT; | ||
1582 | case 1: | ||
1583 | psrctl |= PAGE_SIZE >> | ||
1584 | E1000_PSRCTL_BSIZE1_SHIFT; | ||
1585 | break; | ||
1586 | } | ||
1293 | 1587 | ||
1294 | E1000_WRITE_REG(&adapter->hw, PSRCTL, psrctl); | 1588 | E1000_WRITE_REG(&adapter->hw, PSRCTL, psrctl); |
1295 | } | 1589 | } |
@@ -1307,91 +1601,181 @@ e1000_setup_rctl(struct e1000_adapter *adapter) | |||
1307 | static void | 1601 | static void |
1308 | e1000_configure_rx(struct e1000_adapter *adapter) | 1602 | e1000_configure_rx(struct e1000_adapter *adapter) |
1309 | { | 1603 | { |
1310 | uint64_t rdba = adapter->rx_ring.dma; | 1604 | uint64_t rdba; |
1311 | uint32_t rdlen, rctl, rxcsum; | 1605 | struct e1000_hw *hw = &adapter->hw; |
1606 | uint32_t rdlen, rctl, rxcsum, ctrl_ext; | ||
1607 | #ifdef CONFIG_E1000_MQ | ||
1608 | uint32_t reta, mrqc; | ||
1609 | int i; | ||
1610 | #endif | ||
1312 | 1611 | ||
1313 | if(adapter->rx_ps) { | 1612 | if (adapter->rx_ps_pages) { |
1314 | rdlen = adapter->rx_ring.count * | 1613 | rdlen = adapter->rx_ring[0].count * |
1315 | sizeof(union e1000_rx_desc_packet_split); | 1614 | sizeof(union e1000_rx_desc_packet_split); |
1316 | adapter->clean_rx = e1000_clean_rx_irq_ps; | 1615 | adapter->clean_rx = e1000_clean_rx_irq_ps; |
1317 | adapter->alloc_rx_buf = e1000_alloc_rx_buffers_ps; | 1616 | adapter->alloc_rx_buf = e1000_alloc_rx_buffers_ps; |
1318 | } else { | 1617 | } else { |
1319 | rdlen = adapter->rx_ring.count * sizeof(struct e1000_rx_desc); | 1618 | rdlen = adapter->rx_ring[0].count * |
1619 | sizeof(struct e1000_rx_desc); | ||
1320 | adapter->clean_rx = e1000_clean_rx_irq; | 1620 | adapter->clean_rx = e1000_clean_rx_irq; |
1321 | adapter->alloc_rx_buf = e1000_alloc_rx_buffers; | 1621 | adapter->alloc_rx_buf = e1000_alloc_rx_buffers; |
1322 | } | 1622 | } |
1323 | 1623 | ||
1324 | /* disable receives while setting up the descriptors */ | 1624 | /* disable receives while setting up the descriptors */ |
1325 | rctl = E1000_READ_REG(&adapter->hw, RCTL); | 1625 | rctl = E1000_READ_REG(hw, RCTL); |
1326 | E1000_WRITE_REG(&adapter->hw, RCTL, rctl & ~E1000_RCTL_EN); | 1626 | E1000_WRITE_REG(hw, RCTL, rctl & ~E1000_RCTL_EN); |
1327 | 1627 | ||
1328 | /* set the Receive Delay Timer Register */ | 1628 | /* set the Receive Delay Timer Register */ |
1329 | E1000_WRITE_REG(&adapter->hw, RDTR, adapter->rx_int_delay); | 1629 | E1000_WRITE_REG(hw, RDTR, adapter->rx_int_delay); |
1330 | 1630 | ||
1331 | if(adapter->hw.mac_type >= e1000_82540) { | 1631 | if (hw->mac_type >= e1000_82540) { |
1332 | E1000_WRITE_REG(&adapter->hw, RADV, adapter->rx_abs_int_delay); | 1632 | E1000_WRITE_REG(hw, RADV, adapter->rx_abs_int_delay); |
1333 | if(adapter->itr > 1) | 1633 | if(adapter->itr > 1) |
1334 | E1000_WRITE_REG(&adapter->hw, ITR, | 1634 | E1000_WRITE_REG(hw, ITR, |
1335 | 1000000000 / (adapter->itr * 256)); | 1635 | 1000000000 / (adapter->itr * 256)); |
1336 | } | 1636 | } |
1337 | 1637 | ||
1338 | /* Setup the Base and Length of the Rx Descriptor Ring */ | 1638 | if (hw->mac_type >= e1000_82571) { |
1339 | E1000_WRITE_REG(&adapter->hw, RDBAL, (rdba & 0x00000000ffffffffULL)); | 1639 | /* Reset delay timers after every interrupt */ |
1340 | E1000_WRITE_REG(&adapter->hw, RDBAH, (rdba >> 32)); | 1640 | ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); |
1641 | ctrl_ext |= E1000_CTRL_EXT_CANC; | ||
1642 | E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); | ||
1643 | E1000_WRITE_FLUSH(hw); | ||
1644 | } | ||
1645 | |||
1646 | /* Setup the HW Rx Head and Tail Descriptor Pointers and | ||
1647 | * the Base and Length of the Rx Descriptor Ring */ | ||
1648 | switch (adapter->num_queues) { | ||
1649 | #ifdef CONFIG_E1000_MQ | ||
1650 | case 2: | ||
1651 | rdba = adapter->rx_ring[1].dma; | ||
1652 | E1000_WRITE_REG(hw, RDBAL1, (rdba & 0x00000000ffffffffULL)); | ||
1653 | E1000_WRITE_REG(hw, RDBAH1, (rdba >> 32)); | ||
1654 | E1000_WRITE_REG(hw, RDLEN1, rdlen); | ||
1655 | E1000_WRITE_REG(hw, RDH1, 0); | ||
1656 | E1000_WRITE_REG(hw, RDT1, 0); | ||
1657 | adapter->rx_ring[1].rdh = E1000_RDH1; | ||
1658 | adapter->rx_ring[1].rdt = E1000_RDT1; | ||
1659 | /* Fall Through */ | ||
1660 | #endif | ||
1661 | case 1: | ||
1662 | default: | ||
1663 | rdba = adapter->rx_ring[0].dma; | ||
1664 | E1000_WRITE_REG(hw, RDBAL, (rdba & 0x00000000ffffffffULL)); | ||
1665 | E1000_WRITE_REG(hw, RDBAH, (rdba >> 32)); | ||
1666 | E1000_WRITE_REG(hw, RDLEN, rdlen); | ||
1667 | E1000_WRITE_REG(hw, RDH, 0); | ||
1668 | E1000_WRITE_REG(hw, RDT, 0); | ||
1669 | adapter->rx_ring[0].rdh = E1000_RDH; | ||
1670 | adapter->rx_ring[0].rdt = E1000_RDT; | ||
1671 | break; | ||
1672 | } | ||
1673 | |||
1674 | #ifdef CONFIG_E1000_MQ | ||
1675 | if (adapter->num_queues > 1) { | ||
1676 | uint32_t random[10]; | ||
1677 | |||
1678 | get_random_bytes(&random[0], 40); | ||
1679 | |||
1680 | if (hw->mac_type <= e1000_82572) { | ||
1681 | E1000_WRITE_REG(hw, RSSIR, 0); | ||
1682 | E1000_WRITE_REG(hw, RSSIM, 0); | ||
1683 | } | ||
1684 | |||
1685 | switch (adapter->num_queues) { | ||
1686 | case 2: | ||
1687 | default: | ||
1688 | reta = 0x00800080; | ||
1689 | mrqc = E1000_MRQC_ENABLE_RSS_2Q; | ||
1690 | break; | ||
1691 | } | ||
1692 | |||
1693 | /* Fill out redirection table */ | ||
1694 | for (i = 0; i < 32; i++) | ||
1695 | E1000_WRITE_REG_ARRAY(hw, RETA, i, reta); | ||
1696 | /* Fill out hash function seeds */ | ||
1697 | for (i = 0; i < 10; i++) | ||
1698 | E1000_WRITE_REG_ARRAY(hw, RSSRK, i, random[i]); | ||
1699 | |||
1700 | mrqc |= (E1000_MRQC_RSS_FIELD_IPV4 | | ||
1701 | E1000_MRQC_RSS_FIELD_IPV4_TCP); | ||
1702 | E1000_WRITE_REG(hw, MRQC, mrqc); | ||
1703 | } | ||
1341 | 1704 | ||
1342 | E1000_WRITE_REG(&adapter->hw, RDLEN, rdlen); | 1705 | /* Multiqueue and packet checksumming are mutually exclusive. */ |
1706 | if (hw->mac_type >= e1000_82571) { | ||
1707 | rxcsum = E1000_READ_REG(hw, RXCSUM); | ||
1708 | rxcsum |= E1000_RXCSUM_PCSD; | ||
1709 | E1000_WRITE_REG(hw, RXCSUM, rxcsum); | ||
1710 | } | ||
1343 | 1711 | ||
1344 | /* Setup the HW Rx Head and Tail Descriptor Pointers */ | 1712 | #else |
1345 | E1000_WRITE_REG(&adapter->hw, RDH, 0); | ||
1346 | E1000_WRITE_REG(&adapter->hw, RDT, 0); | ||
1347 | 1713 | ||
1348 | /* Enable 82543 Receive Checksum Offload for TCP and UDP */ | 1714 | /* Enable 82543 Receive Checksum Offload for TCP and UDP */ |
1349 | if(adapter->hw.mac_type >= e1000_82543) { | 1715 | if (hw->mac_type >= e1000_82543) { |
1350 | rxcsum = E1000_READ_REG(&adapter->hw, RXCSUM); | 1716 | rxcsum = E1000_READ_REG(hw, RXCSUM); |
1351 | if(adapter->rx_csum == TRUE) { | 1717 | if(adapter->rx_csum == TRUE) { |
1352 | rxcsum |= E1000_RXCSUM_TUOFL; | 1718 | rxcsum |= E1000_RXCSUM_TUOFL; |
1353 | 1719 | ||
1354 | /* Enable 82573 IPv4 payload checksum for UDP fragments | 1720 | /* Enable 82571 IPv4 payload checksum for UDP fragments |
1355 | * Must be used in conjunction with packet-split. */ | 1721 | * Must be used in conjunction with packet-split. */ |
1356 | if((adapter->hw.mac_type > e1000_82547_rev_2) && | 1722 | if ((hw->mac_type >= e1000_82571) && |
1357 | (adapter->rx_ps)) { | 1723 | (adapter->rx_ps_pages)) { |
1358 | rxcsum |= E1000_RXCSUM_IPPCSE; | 1724 | rxcsum |= E1000_RXCSUM_IPPCSE; |
1359 | } | 1725 | } |
1360 | } else { | 1726 | } else { |
1361 | rxcsum &= ~E1000_RXCSUM_TUOFL; | 1727 | rxcsum &= ~E1000_RXCSUM_TUOFL; |
1362 | /* don't need to clear IPPCSE as it defaults to 0 */ | 1728 | /* don't need to clear IPPCSE as it defaults to 0 */ |
1363 | } | 1729 | } |
1364 | E1000_WRITE_REG(&adapter->hw, RXCSUM, rxcsum); | 1730 | E1000_WRITE_REG(hw, RXCSUM, rxcsum); |
1365 | } | 1731 | } |
1732 | #endif /* CONFIG_E1000_MQ */ | ||
1366 | 1733 | ||
1367 | if (adapter->hw.mac_type == e1000_82573) | 1734 | if (hw->mac_type == e1000_82573) |
1368 | E1000_WRITE_REG(&adapter->hw, ERT, 0x0100); | 1735 | E1000_WRITE_REG(hw, ERT, 0x0100); |
1369 | 1736 | ||
1370 | /* Enable Receives */ | 1737 | /* Enable Receives */ |
1371 | E1000_WRITE_REG(&adapter->hw, RCTL, rctl); | 1738 | E1000_WRITE_REG(hw, RCTL, rctl); |
1372 | } | 1739 | } |
1373 | 1740 | ||
1374 | /** | 1741 | /** |
1375 | * e1000_free_tx_resources - Free Tx Resources | 1742 | * e1000_free_tx_resources - Free Tx Resources per Queue |
1376 | * @adapter: board private structure | 1743 | * @adapter: board private structure |
1744 | * @tx_ring: Tx descriptor ring for a specific queue | ||
1377 | * | 1745 | * |
1378 | * Free all transmit software resources | 1746 | * Free all transmit software resources |
1379 | **/ | 1747 | **/ |
1380 | 1748 | ||
1381 | void | 1749 | void |
1382 | e1000_free_tx_resources(struct e1000_adapter *adapter) | 1750 | e1000_free_tx_resources(struct e1000_adapter *adapter, |
1751 | struct e1000_tx_ring *tx_ring) | ||
1383 | { | 1752 | { |
1384 | struct pci_dev *pdev = adapter->pdev; | 1753 | struct pci_dev *pdev = adapter->pdev; |
1385 | 1754 | ||
1386 | e1000_clean_tx_ring(adapter); | 1755 | e1000_clean_tx_ring(adapter, tx_ring); |
1756 | |||
1757 | vfree(tx_ring->buffer_info); | ||
1758 | tx_ring->buffer_info = NULL; | ||
1387 | 1759 | ||
1388 | vfree(adapter->tx_ring.buffer_info); | 1760 | pci_free_consistent(pdev, tx_ring->size, tx_ring->desc, tx_ring->dma); |
1389 | adapter->tx_ring.buffer_info = NULL; | 1761 | |
1762 | tx_ring->desc = NULL; | ||
1763 | } | ||
1390 | 1764 | ||
1391 | pci_free_consistent(pdev, adapter->tx_ring.size, | 1765 | /** |
1392 | adapter->tx_ring.desc, adapter->tx_ring.dma); | 1766 | * e1000_free_all_tx_resources - Free Tx Resources for All Queues |
1767 | * @adapter: board private structure | ||
1768 | * | ||
1769 | * Free all transmit software resources | ||
1770 | **/ | ||
1771 | |||
1772 | void | ||
1773 | e1000_free_all_tx_resources(struct e1000_adapter *adapter) | ||
1774 | { | ||
1775 | int i; | ||
1393 | 1776 | ||
1394 | adapter->tx_ring.desc = NULL; | 1777 | for (i = 0; i < adapter->num_queues; i++) |
1778 | e1000_free_tx_resources(adapter, &adapter->tx_ring[i]); | ||
1395 | } | 1779 | } |
1396 | 1780 | ||
1397 | static inline void | 1781 | static inline void |
@@ -1414,21 +1798,22 @@ e1000_unmap_and_free_tx_resource(struct e1000_adapter *adapter, | |||
1414 | /** | 1798 | /** |
1415 | * e1000_clean_tx_ring - Free Tx Buffers | 1799 | * e1000_clean_tx_ring - Free Tx Buffers |
1416 | * @adapter: board private structure | 1800 | * @adapter: board private structure |
1801 | * @tx_ring: ring to be cleaned | ||
1417 | **/ | 1802 | **/ |
1418 | 1803 | ||
1419 | static void | 1804 | static void |
1420 | e1000_clean_tx_ring(struct e1000_adapter *adapter) | 1805 | e1000_clean_tx_ring(struct e1000_adapter *adapter, |
1806 | struct e1000_tx_ring *tx_ring) | ||
1421 | { | 1807 | { |
1422 | struct e1000_desc_ring *tx_ring = &adapter->tx_ring; | ||
1423 | struct e1000_buffer *buffer_info; | 1808 | struct e1000_buffer *buffer_info; |
1424 | unsigned long size; | 1809 | unsigned long size; |
1425 | unsigned int i; | 1810 | unsigned int i; |
1426 | 1811 | ||
1427 | /* Free all the Tx ring sk_buffs */ | 1812 | /* Free all the Tx ring sk_buffs */ |
1428 | 1813 | ||
1429 | if (likely(adapter->previous_buffer_info.skb != NULL)) { | 1814 | if (likely(tx_ring->previous_buffer_info.skb != NULL)) { |
1430 | e1000_unmap_and_free_tx_resource(adapter, | 1815 | e1000_unmap_and_free_tx_resource(adapter, |
1431 | &adapter->previous_buffer_info); | 1816 | &tx_ring->previous_buffer_info); |
1432 | } | 1817 | } |
1433 | 1818 | ||
1434 | for(i = 0; i < tx_ring->count; i++) { | 1819 | for(i = 0; i < tx_ring->count; i++) { |
@@ -1446,24 +1831,39 @@ e1000_clean_tx_ring(struct e1000_adapter *adapter) | |||
1446 | tx_ring->next_to_use = 0; | 1831 | tx_ring->next_to_use = 0; |
1447 | tx_ring->next_to_clean = 0; | 1832 | tx_ring->next_to_clean = 0; |
1448 | 1833 | ||
1449 | E1000_WRITE_REG(&adapter->hw, TDH, 0); | 1834 | writel(0, adapter->hw.hw_addr + tx_ring->tdh); |
1450 | E1000_WRITE_REG(&adapter->hw, TDT, 0); | 1835 | writel(0, adapter->hw.hw_addr + tx_ring->tdt); |
1836 | } | ||
1837 | |||
1838 | /** | ||
1839 | * e1000_clean_all_tx_rings - Free Tx Buffers for all queues | ||
1840 | * @adapter: board private structure | ||
1841 | **/ | ||
1842 | |||
1843 | static void | ||
1844 | e1000_clean_all_tx_rings(struct e1000_adapter *adapter) | ||
1845 | { | ||
1846 | int i; | ||
1847 | |||
1848 | for (i = 0; i < adapter->num_queues; i++) | ||
1849 | e1000_clean_tx_ring(adapter, &adapter->tx_ring[i]); | ||
1451 | } | 1850 | } |
1452 | 1851 | ||
1453 | /** | 1852 | /** |
1454 | * e1000_free_rx_resources - Free Rx Resources | 1853 | * e1000_free_rx_resources - Free Rx Resources |
1455 | * @adapter: board private structure | 1854 | * @adapter: board private structure |
1855 | * @rx_ring: ring to clean the resources from | ||
1456 | * | 1856 | * |
1457 | * Free all receive software resources | 1857 | * Free all receive software resources |
1458 | **/ | 1858 | **/ |
1459 | 1859 | ||
1460 | void | 1860 | void |
1461 | e1000_free_rx_resources(struct e1000_adapter *adapter) | 1861 | e1000_free_rx_resources(struct e1000_adapter *adapter, |
1862 | struct e1000_rx_ring *rx_ring) | ||
1462 | { | 1863 | { |
1463 | struct e1000_desc_ring *rx_ring = &adapter->rx_ring; | ||
1464 | struct pci_dev *pdev = adapter->pdev; | 1864 | struct pci_dev *pdev = adapter->pdev; |
1465 | 1865 | ||
1466 | e1000_clean_rx_ring(adapter); | 1866 | e1000_clean_rx_ring(adapter, rx_ring); |
1467 | 1867 | ||
1468 | vfree(rx_ring->buffer_info); | 1868 | vfree(rx_ring->buffer_info); |
1469 | rx_ring->buffer_info = NULL; | 1869 | rx_ring->buffer_info = NULL; |
@@ -1478,14 +1878,31 @@ e1000_free_rx_resources(struct e1000_adapter *adapter) | |||
1478 | } | 1878 | } |
1479 | 1879 | ||
1480 | /** | 1880 | /** |
1481 | * e1000_clean_rx_ring - Free Rx Buffers | 1881 | * e1000_free_all_rx_resources - Free Rx Resources for All Queues |
1882 | * @adapter: board private structure | ||
1883 | * | ||
1884 | * Free all receive software resources | ||
1885 | **/ | ||
1886 | |||
1887 | void | ||
1888 | e1000_free_all_rx_resources(struct e1000_adapter *adapter) | ||
1889 | { | ||
1890 | int i; | ||
1891 | |||
1892 | for (i = 0; i < adapter->num_queues; i++) | ||
1893 | e1000_free_rx_resources(adapter, &adapter->rx_ring[i]); | ||
1894 | } | ||
1895 | |||
1896 | /** | ||
1897 | * e1000_clean_rx_ring - Free Rx Buffers per Queue | ||
1482 | * @adapter: board private structure | 1898 | * @adapter: board private structure |
1899 | * @rx_ring: ring to free buffers from | ||
1483 | **/ | 1900 | **/ |
1484 | 1901 | ||
1485 | static void | 1902 | static void |
1486 | e1000_clean_rx_ring(struct e1000_adapter *adapter) | 1903 | e1000_clean_rx_ring(struct e1000_adapter *adapter, |
1904 | struct e1000_rx_ring *rx_ring) | ||
1487 | { | 1905 | { |
1488 | struct e1000_desc_ring *rx_ring = &adapter->rx_ring; | ||
1489 | struct e1000_buffer *buffer_info; | 1906 | struct e1000_buffer *buffer_info; |
1490 | struct e1000_ps_page *ps_page; | 1907 | struct e1000_ps_page *ps_page; |
1491 | struct e1000_ps_page_dma *ps_page_dma; | 1908 | struct e1000_ps_page_dma *ps_page_dma; |
@@ -1508,7 +1925,7 @@ e1000_clean_rx_ring(struct e1000_adapter *adapter) | |||
1508 | dev_kfree_skb(buffer_info->skb); | 1925 | dev_kfree_skb(buffer_info->skb); |
1509 | buffer_info->skb = NULL; | 1926 | buffer_info->skb = NULL; |
1510 | 1927 | ||
1511 | for(j = 0; j < PS_PAGE_BUFFERS; j++) { | 1928 | for(j = 0; j < adapter->rx_ps_pages; j++) { |
1512 | if(!ps_page->ps_page[j]) break; | 1929 | if(!ps_page->ps_page[j]) break; |
1513 | pci_unmap_single(pdev, | 1930 | pci_unmap_single(pdev, |
1514 | ps_page_dma->ps_page_dma[j], | 1931 | ps_page_dma->ps_page_dma[j], |
@@ -1534,8 +1951,22 @@ e1000_clean_rx_ring(struct e1000_adapter *adapter) | |||
1534 | rx_ring->next_to_clean = 0; | 1951 | rx_ring->next_to_clean = 0; |
1535 | rx_ring->next_to_use = 0; | 1952 | rx_ring->next_to_use = 0; |
1536 | 1953 | ||
1537 | E1000_WRITE_REG(&adapter->hw, RDH, 0); | 1954 | writel(0, adapter->hw.hw_addr + rx_ring->rdh); |
1538 | E1000_WRITE_REG(&adapter->hw, RDT, 0); | 1955 | writel(0, adapter->hw.hw_addr + rx_ring->rdt); |
1956 | } | ||
1957 | |||
1958 | /** | ||
1959 | * e1000_clean_all_rx_rings - Free Rx Buffers for all queues | ||
1960 | * @adapter: board private structure | ||
1961 | **/ | ||
1962 | |||
1963 | static void | ||
1964 | e1000_clean_all_rx_rings(struct e1000_adapter *adapter) | ||
1965 | { | ||
1966 | int i; | ||
1967 | |||
1968 | for (i = 0; i < adapter->num_queues; i++) | ||
1969 | e1000_clean_rx_ring(adapter, &adapter->rx_ring[i]); | ||
1539 | } | 1970 | } |
1540 | 1971 | ||
1541 | /* The 82542 2.0 (revision 2) needs to have the receive unit in reset | 1972 | /* The 82542 2.0 (revision 2) needs to have the receive unit in reset |
@@ -1556,7 +1987,7 @@ e1000_enter_82542_rst(struct e1000_adapter *adapter) | |||
1556 | mdelay(5); | 1987 | mdelay(5); |
1557 | 1988 | ||
1558 | if(netif_running(netdev)) | 1989 | if(netif_running(netdev)) |
1559 | e1000_clean_rx_ring(adapter); | 1990 | e1000_clean_all_rx_rings(adapter); |
1560 | } | 1991 | } |
1561 | 1992 | ||
1562 | static void | 1993 | static void |
@@ -1576,7 +2007,7 @@ e1000_leave_82542_rst(struct e1000_adapter *adapter) | |||
1576 | 2007 | ||
1577 | if(netif_running(netdev)) { | 2008 | if(netif_running(netdev)) { |
1578 | e1000_configure_rx(adapter); | 2009 | e1000_configure_rx(adapter); |
1579 | e1000_alloc_rx_buffers(adapter); | 2010 | e1000_alloc_rx_buffers(adapter, &adapter->rx_ring[0]); |
1580 | } | 2011 | } |
1581 | } | 2012 | } |
1582 | 2013 | ||
@@ -1607,6 +2038,22 @@ e1000_set_mac(struct net_device *netdev, void *p) | |||
1607 | 2038 | ||
1608 | e1000_rar_set(&adapter->hw, adapter->hw.mac_addr, 0); | 2039 | e1000_rar_set(&adapter->hw, adapter->hw.mac_addr, 0); |
1609 | 2040 | ||
2041 | /* With 82571 controllers, LAA may be overwritten (with the default) | ||
2042 | * due to controller reset from the other port. */ | ||
2043 | if (adapter->hw.mac_type == e1000_82571) { | ||
2044 | /* activate the work around */ | ||
2045 | adapter->hw.laa_is_present = 1; | ||
2046 | |||
2047 | /* Hold a copy of the LAA in RAR[14] This is done so that | ||
2048 | * between the time RAR[0] gets clobbered and the time it | ||
2049 | * gets fixed (in e1000_watchdog), the actual LAA is in one | ||
2050 | * of the RARs and no incoming packets directed to this port | ||
2051 | * are dropped. Eventaully the LAA will be in RAR[0] and | ||
2052 | * RAR[14] */ | ||
2053 | e1000_rar_set(&adapter->hw, adapter->hw.mac_addr, | ||
2054 | E1000_RAR_ENTRIES - 1); | ||
2055 | } | ||
2056 | |||
1610 | if(adapter->hw.mac_type == e1000_82542_rev2_0) | 2057 | if(adapter->hw.mac_type == e1000_82542_rev2_0) |
1611 | e1000_leave_82542_rst(adapter); | 2058 | e1000_leave_82542_rst(adapter); |
1612 | 2059 | ||
@@ -1629,12 +2076,13 @@ e1000_set_multi(struct net_device *netdev) | |||
1629 | struct e1000_adapter *adapter = netdev_priv(netdev); | 2076 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1630 | struct e1000_hw *hw = &adapter->hw; | 2077 | struct e1000_hw *hw = &adapter->hw; |
1631 | struct dev_mc_list *mc_ptr; | 2078 | struct dev_mc_list *mc_ptr; |
1632 | unsigned long flags; | ||
1633 | uint32_t rctl; | 2079 | uint32_t rctl; |
1634 | uint32_t hash_value; | 2080 | uint32_t hash_value; |
1635 | int i; | 2081 | int i, rar_entries = E1000_RAR_ENTRIES; |
1636 | 2082 | ||
1637 | spin_lock_irqsave(&adapter->tx_lock, flags); | 2083 | /* reserve RAR[14] for LAA over-write work-around */ |
2084 | if (adapter->hw.mac_type == e1000_82571) | ||
2085 | rar_entries--; | ||
1638 | 2086 | ||
1639 | /* Check for Promiscuous and All Multicast modes */ | 2087 | /* Check for Promiscuous and All Multicast modes */ |
1640 | 2088 | ||
@@ -1659,11 +2107,12 @@ e1000_set_multi(struct net_device *netdev) | |||
1659 | /* load the first 14 multicast address into the exact filters 1-14 | 2107 | /* load the first 14 multicast address into the exact filters 1-14 |
1660 | * RAR 0 is used for the station MAC adddress | 2108 | * RAR 0 is used for the station MAC adddress |
1661 | * if there are not 14 addresses, go ahead and clear the filters | 2109 | * if there are not 14 addresses, go ahead and clear the filters |
2110 | * -- with 82571 controllers only 0-13 entries are filled here | ||
1662 | */ | 2111 | */ |
1663 | mc_ptr = netdev->mc_list; | 2112 | mc_ptr = netdev->mc_list; |
1664 | 2113 | ||
1665 | for(i = 1; i < E1000_RAR_ENTRIES; i++) { | 2114 | for(i = 1; i < rar_entries; i++) { |
1666 | if(mc_ptr) { | 2115 | if (mc_ptr) { |
1667 | e1000_rar_set(hw, mc_ptr->dmi_addr, i); | 2116 | e1000_rar_set(hw, mc_ptr->dmi_addr, i); |
1668 | mc_ptr = mc_ptr->next; | 2117 | mc_ptr = mc_ptr->next; |
1669 | } else { | 2118 | } else { |
@@ -1686,8 +2135,6 @@ e1000_set_multi(struct net_device *netdev) | |||
1686 | 2135 | ||
1687 | if(hw->mac_type == e1000_82542_rev2_0) | 2136 | if(hw->mac_type == e1000_82542_rev2_0) |
1688 | e1000_leave_82542_rst(adapter); | 2137 | e1000_leave_82542_rst(adapter); |
1689 | |||
1690 | spin_unlock_irqrestore(&adapter->tx_lock, flags); | ||
1691 | } | 2138 | } |
1692 | 2139 | ||
1693 | /* Need to wait a few seconds after link up to get diagnostic information from | 2140 | /* Need to wait a few seconds after link up to get diagnostic information from |
@@ -1759,7 +2206,7 @@ static void | |||
1759 | e1000_watchdog_task(struct e1000_adapter *adapter) | 2206 | e1000_watchdog_task(struct e1000_adapter *adapter) |
1760 | { | 2207 | { |
1761 | struct net_device *netdev = adapter->netdev; | 2208 | struct net_device *netdev = adapter->netdev; |
1762 | struct e1000_desc_ring *txdr = &adapter->tx_ring; | 2209 | struct e1000_tx_ring *txdr = &adapter->tx_ring[0]; |
1763 | uint32_t link; | 2210 | uint32_t link; |
1764 | 2211 | ||
1765 | e1000_check_for_link(&adapter->hw); | 2212 | e1000_check_for_link(&adapter->hw); |
@@ -1818,8 +2265,8 @@ e1000_watchdog_task(struct e1000_adapter *adapter) | |||
1818 | 2265 | ||
1819 | e1000_update_adaptive(&adapter->hw); | 2266 | e1000_update_adaptive(&adapter->hw); |
1820 | 2267 | ||
1821 | if(!netif_carrier_ok(netdev)) { | 2268 | if (adapter->num_queues == 1 && !netif_carrier_ok(netdev)) { |
1822 | if(E1000_DESC_UNUSED(txdr) + 1 < txdr->count) { | 2269 | if (E1000_DESC_UNUSED(txdr) + 1 < txdr->count) { |
1823 | /* We've lost link, so the controller stops DMA, | 2270 | /* We've lost link, so the controller stops DMA, |
1824 | * but we've got queued Tx work that's never going | 2271 | * but we've got queued Tx work that's never going |
1825 | * to get done, so reset controller to flush Tx. | 2272 | * to get done, so reset controller to flush Tx. |
@@ -1847,6 +2294,11 @@ e1000_watchdog_task(struct e1000_adapter *adapter) | |||
1847 | /* Force detection of hung controller every watchdog period */ | 2294 | /* Force detection of hung controller every watchdog period */ |
1848 | adapter->detect_tx_hung = TRUE; | 2295 | adapter->detect_tx_hung = TRUE; |
1849 | 2296 | ||
2297 | /* With 82571 controllers, LAA may be overwritten due to controller | ||
2298 | * reset from the other port. Set the appropriate LAA in RAR[0] */ | ||
2299 | if (adapter->hw.mac_type == e1000_82571 && adapter->hw.laa_is_present) | ||
2300 | e1000_rar_set(&adapter->hw, adapter->hw.mac_addr, 0); | ||
2301 | |||
1850 | /* Reset the timer */ | 2302 | /* Reset the timer */ |
1851 | mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); | 2303 | mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); |
1852 | } | 2304 | } |
@@ -1859,7 +2311,8 @@ e1000_watchdog_task(struct e1000_adapter *adapter) | |||
1859 | #define E1000_TX_FLAGS_VLAN_SHIFT 16 | 2311 | #define E1000_TX_FLAGS_VLAN_SHIFT 16 |
1860 | 2312 | ||
1861 | static inline int | 2313 | static inline int |
1862 | e1000_tso(struct e1000_adapter *adapter, struct sk_buff *skb) | 2314 | e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, |
2315 | struct sk_buff *skb) | ||
1863 | { | 2316 | { |
1864 | #ifdef NETIF_F_TSO | 2317 | #ifdef NETIF_F_TSO |
1865 | struct e1000_context_desc *context_desc; | 2318 | struct e1000_context_desc *context_desc; |
@@ -1910,8 +2363,8 @@ e1000_tso(struct e1000_adapter *adapter, struct sk_buff *skb) | |||
1910 | cmd_length |= (E1000_TXD_CMD_DEXT | E1000_TXD_CMD_TSE | | 2363 | cmd_length |= (E1000_TXD_CMD_DEXT | E1000_TXD_CMD_TSE | |
1911 | E1000_TXD_CMD_TCP | (skb->len - (hdr_len))); | 2364 | E1000_TXD_CMD_TCP | (skb->len - (hdr_len))); |
1912 | 2365 | ||
1913 | i = adapter->tx_ring.next_to_use; | 2366 | i = tx_ring->next_to_use; |
1914 | context_desc = E1000_CONTEXT_DESC(adapter->tx_ring, i); | 2367 | context_desc = E1000_CONTEXT_DESC(*tx_ring, i); |
1915 | 2368 | ||
1916 | context_desc->lower_setup.ip_fields.ipcss = ipcss; | 2369 | context_desc->lower_setup.ip_fields.ipcss = ipcss; |
1917 | context_desc->lower_setup.ip_fields.ipcso = ipcso; | 2370 | context_desc->lower_setup.ip_fields.ipcso = ipcso; |
@@ -1923,8 +2376,8 @@ e1000_tso(struct e1000_adapter *adapter, struct sk_buff *skb) | |||
1923 | context_desc->tcp_seg_setup.fields.hdr_len = hdr_len; | 2376 | context_desc->tcp_seg_setup.fields.hdr_len = hdr_len; |
1924 | context_desc->cmd_and_length = cpu_to_le32(cmd_length); | 2377 | context_desc->cmd_and_length = cpu_to_le32(cmd_length); |
1925 | 2378 | ||
1926 | if(++i == adapter->tx_ring.count) i = 0; | 2379 | if (++i == tx_ring->count) i = 0; |
1927 | adapter->tx_ring.next_to_use = i; | 2380 | tx_ring->next_to_use = i; |
1928 | 2381 | ||
1929 | return 1; | 2382 | return 1; |
1930 | } | 2383 | } |
@@ -1934,7 +2387,8 @@ e1000_tso(struct e1000_adapter *adapter, struct sk_buff *skb) | |||
1934 | } | 2387 | } |
1935 | 2388 | ||
1936 | static inline boolean_t | 2389 | static inline boolean_t |
1937 | e1000_tx_csum(struct e1000_adapter *adapter, struct sk_buff *skb) | 2390 | e1000_tx_csum(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, |
2391 | struct sk_buff *skb) | ||
1938 | { | 2392 | { |
1939 | struct e1000_context_desc *context_desc; | 2393 | struct e1000_context_desc *context_desc; |
1940 | unsigned int i; | 2394 | unsigned int i; |
@@ -1943,8 +2397,8 @@ e1000_tx_csum(struct e1000_adapter *adapter, struct sk_buff *skb) | |||
1943 | if(likely(skb->ip_summed == CHECKSUM_HW)) { | 2397 | if(likely(skb->ip_summed == CHECKSUM_HW)) { |
1944 | css = skb->h.raw - skb->data; | 2398 | css = skb->h.raw - skb->data; |
1945 | 2399 | ||
1946 | i = adapter->tx_ring.next_to_use; | 2400 | i = tx_ring->next_to_use; |
1947 | context_desc = E1000_CONTEXT_DESC(adapter->tx_ring, i); | 2401 | context_desc = E1000_CONTEXT_DESC(*tx_ring, i); |
1948 | 2402 | ||
1949 | context_desc->upper_setup.tcp_fields.tucss = css; | 2403 | context_desc->upper_setup.tcp_fields.tucss = css; |
1950 | context_desc->upper_setup.tcp_fields.tucso = css + skb->csum; | 2404 | context_desc->upper_setup.tcp_fields.tucso = css + skb->csum; |
@@ -1952,8 +2406,8 @@ e1000_tx_csum(struct e1000_adapter *adapter, struct sk_buff *skb) | |||
1952 | context_desc->tcp_seg_setup.data = 0; | 2406 | context_desc->tcp_seg_setup.data = 0; |
1953 | context_desc->cmd_and_length = cpu_to_le32(E1000_TXD_CMD_DEXT); | 2407 | context_desc->cmd_and_length = cpu_to_le32(E1000_TXD_CMD_DEXT); |
1954 | 2408 | ||
1955 | if(unlikely(++i == adapter->tx_ring.count)) i = 0; | 2409 | if (unlikely(++i == tx_ring->count)) i = 0; |
1956 | adapter->tx_ring.next_to_use = i; | 2410 | tx_ring->next_to_use = i; |
1957 | 2411 | ||
1958 | return TRUE; | 2412 | return TRUE; |
1959 | } | 2413 | } |
@@ -1965,11 +2419,10 @@ e1000_tx_csum(struct e1000_adapter *adapter, struct sk_buff *skb) | |||
1965 | #define E1000_MAX_DATA_PER_TXD (1<<E1000_MAX_TXD_PWR) | 2419 | #define E1000_MAX_DATA_PER_TXD (1<<E1000_MAX_TXD_PWR) |
1966 | 2420 | ||
1967 | static inline int | 2421 | static inline int |
1968 | e1000_tx_map(struct e1000_adapter *adapter, struct sk_buff *skb, | 2422 | e1000_tx_map(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, |
1969 | unsigned int first, unsigned int max_per_txd, | 2423 | struct sk_buff *skb, unsigned int first, unsigned int max_per_txd, |
1970 | unsigned int nr_frags, unsigned int mss) | 2424 | unsigned int nr_frags, unsigned int mss) |
1971 | { | 2425 | { |
1972 | struct e1000_desc_ring *tx_ring = &adapter->tx_ring; | ||
1973 | struct e1000_buffer *buffer_info; | 2426 | struct e1000_buffer *buffer_info; |
1974 | unsigned int len = skb->len; | 2427 | unsigned int len = skb->len; |
1975 | unsigned int offset = 0, size, count = 0, i; | 2428 | unsigned int offset = 0, size, count = 0, i; |
@@ -2065,9 +2518,9 @@ e1000_tx_map(struct e1000_adapter *adapter, struct sk_buff *skb, | |||
2065 | } | 2518 | } |
2066 | 2519 | ||
2067 | static inline void | 2520 | static inline void |
2068 | e1000_tx_queue(struct e1000_adapter *adapter, int count, int tx_flags) | 2521 | e1000_tx_queue(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, |
2522 | int tx_flags, int count) | ||
2069 | { | 2523 | { |
2070 | struct e1000_desc_ring *tx_ring = &adapter->tx_ring; | ||
2071 | struct e1000_tx_desc *tx_desc = NULL; | 2524 | struct e1000_tx_desc *tx_desc = NULL; |
2072 | struct e1000_buffer *buffer_info; | 2525 | struct e1000_buffer *buffer_info; |
2073 | uint32_t txd_upper = 0, txd_lower = E1000_TXD_CMD_IFCS; | 2526 | uint32_t txd_upper = 0, txd_lower = E1000_TXD_CMD_IFCS; |
@@ -2113,7 +2566,7 @@ e1000_tx_queue(struct e1000_adapter *adapter, int count, int tx_flags) | |||
2113 | wmb(); | 2566 | wmb(); |
2114 | 2567 | ||
2115 | tx_ring->next_to_use = i; | 2568 | tx_ring->next_to_use = i; |
2116 | E1000_WRITE_REG(&adapter->hw, TDT, i); | 2569 | writel(i, adapter->hw.hw_addr + tx_ring->tdt); |
2117 | } | 2570 | } |
2118 | 2571 | ||
2119 | /** | 2572 | /** |
@@ -2206,6 +2659,7 @@ static int | |||
2206 | e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | 2659 | e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) |
2207 | { | 2660 | { |
2208 | struct e1000_adapter *adapter = netdev_priv(netdev); | 2661 | struct e1000_adapter *adapter = netdev_priv(netdev); |
2662 | struct e1000_tx_ring *tx_ring; | ||
2209 | unsigned int first, max_per_txd = E1000_MAX_DATA_PER_TXD; | 2663 | unsigned int first, max_per_txd = E1000_MAX_DATA_PER_TXD; |
2210 | unsigned int max_txd_pwr = E1000_MAX_TXD_PWR; | 2664 | unsigned int max_txd_pwr = E1000_MAX_TXD_PWR; |
2211 | unsigned int tx_flags = 0; | 2665 | unsigned int tx_flags = 0; |
@@ -2218,7 +2672,13 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
2218 | unsigned int f; | 2672 | unsigned int f; |
2219 | len -= skb->data_len; | 2673 | len -= skb->data_len; |
2220 | 2674 | ||
2221 | if(unlikely(skb->len <= 0)) { | 2675 | #ifdef CONFIG_E1000_MQ |
2676 | tx_ring = *per_cpu_ptr(adapter->cpu_tx_ring, smp_processor_id()); | ||
2677 | #else | ||
2678 | tx_ring = adapter->tx_ring; | ||
2679 | #endif | ||
2680 | |||
2681 | if (unlikely(skb->len <= 0)) { | ||
2222 | dev_kfree_skb_any(skb); | 2682 | dev_kfree_skb_any(skb); |
2223 | return NETDEV_TX_OK; | 2683 | return NETDEV_TX_OK; |
2224 | } | 2684 | } |
@@ -2262,21 +2722,42 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
2262 | if(adapter->pcix_82544) | 2722 | if(adapter->pcix_82544) |
2263 | count += nr_frags; | 2723 | count += nr_frags; |
2264 | 2724 | ||
2265 | local_irq_save(flags); | 2725 | #ifdef NETIF_F_TSO |
2266 | if (!spin_trylock(&adapter->tx_lock)) { | 2726 | /* TSO Workaround for 82571/2 Controllers -- if skb->data |
2267 | /* Collision - tell upper layer to requeue */ | 2727 | * points to just header, pull a few bytes of payload from |
2268 | local_irq_restore(flags); | 2728 | * frags into skb->data */ |
2269 | return NETDEV_TX_LOCKED; | 2729 | if (skb_shinfo(skb)->tso_size) { |
2270 | } | 2730 | uint8_t hdr_len; |
2731 | hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2)); | ||
2732 | if (skb->data_len && (hdr_len < (skb->len - skb->data_len)) && | ||
2733 | (adapter->hw.mac_type == e1000_82571 || | ||
2734 | adapter->hw.mac_type == e1000_82572)) { | ||
2735 | unsigned int pull_size; | ||
2736 | pull_size = min((unsigned int)4, skb->data_len); | ||
2737 | if (!__pskb_pull_tail(skb, pull_size)) { | ||
2738 | printk(KERN_ERR "__pskb_pull_tail failed.\n"); | ||
2739 | dev_kfree_skb_any(skb); | ||
2740 | return -EFAULT; | ||
2741 | } | ||
2742 | } | ||
2743 | } | ||
2744 | #endif | ||
2745 | |||
2271 | if(adapter->hw.tx_pkt_filtering && (adapter->hw.mac_type == e1000_82573) ) | 2746 | if(adapter->hw.tx_pkt_filtering && (adapter->hw.mac_type == e1000_82573) ) |
2272 | e1000_transfer_dhcp_info(adapter, skb); | 2747 | e1000_transfer_dhcp_info(adapter, skb); |
2273 | 2748 | ||
2749 | local_irq_save(flags); | ||
2750 | if (!spin_trylock(&tx_ring->tx_lock)) { | ||
2751 | /* Collision - tell upper layer to requeue */ | ||
2752 | local_irq_restore(flags); | ||
2753 | return NETDEV_TX_LOCKED; | ||
2754 | } | ||
2274 | 2755 | ||
2275 | /* need: count + 2 desc gap to keep tail from touching | 2756 | /* need: count + 2 desc gap to keep tail from touching |
2276 | * head, otherwise try next time */ | 2757 | * head, otherwise try next time */ |
2277 | if(unlikely(E1000_DESC_UNUSED(&adapter->tx_ring) < count + 2)) { | 2758 | if (unlikely(E1000_DESC_UNUSED(tx_ring) < count + 2)) { |
2278 | netif_stop_queue(netdev); | 2759 | netif_stop_queue(netdev); |
2279 | spin_unlock_irqrestore(&adapter->tx_lock, flags); | 2760 | spin_unlock_irqrestore(&tx_ring->tx_lock, flags); |
2280 | return NETDEV_TX_BUSY; | 2761 | return NETDEV_TX_BUSY; |
2281 | } | 2762 | } |
2282 | 2763 | ||
@@ -2284,7 +2765,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
2284 | if(unlikely(e1000_82547_fifo_workaround(adapter, skb))) { | 2765 | if(unlikely(e1000_82547_fifo_workaround(adapter, skb))) { |
2285 | netif_stop_queue(netdev); | 2766 | netif_stop_queue(netdev); |
2286 | mod_timer(&adapter->tx_fifo_stall_timer, jiffies); | 2767 | mod_timer(&adapter->tx_fifo_stall_timer, jiffies); |
2287 | spin_unlock_irqrestore(&adapter->tx_lock, flags); | 2768 | spin_unlock_irqrestore(&tx_ring->tx_lock, flags); |
2288 | return NETDEV_TX_BUSY; | 2769 | return NETDEV_TX_BUSY; |
2289 | } | 2770 | } |
2290 | } | 2771 | } |
@@ -2294,37 +2775,37 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
2294 | tx_flags |= (vlan_tx_tag_get(skb) << E1000_TX_FLAGS_VLAN_SHIFT); | 2775 | tx_flags |= (vlan_tx_tag_get(skb) << E1000_TX_FLAGS_VLAN_SHIFT); |
2295 | } | 2776 | } |
2296 | 2777 | ||
2297 | first = adapter->tx_ring.next_to_use; | 2778 | first = tx_ring->next_to_use; |
2298 | 2779 | ||
2299 | tso = e1000_tso(adapter, skb); | 2780 | tso = e1000_tso(adapter, tx_ring, skb); |
2300 | if (tso < 0) { | 2781 | if (tso < 0) { |
2301 | dev_kfree_skb_any(skb); | 2782 | dev_kfree_skb_any(skb); |
2302 | spin_unlock_irqrestore(&adapter->tx_lock, flags); | 2783 | spin_unlock_irqrestore(&tx_ring->tx_lock, flags); |
2303 | return NETDEV_TX_OK; | 2784 | return NETDEV_TX_OK; |
2304 | } | 2785 | } |
2305 | 2786 | ||
2306 | if (likely(tso)) | 2787 | if (likely(tso)) |
2307 | tx_flags |= E1000_TX_FLAGS_TSO; | 2788 | tx_flags |= E1000_TX_FLAGS_TSO; |
2308 | else if(likely(e1000_tx_csum(adapter, skb))) | 2789 | else if (likely(e1000_tx_csum(adapter, tx_ring, skb))) |
2309 | tx_flags |= E1000_TX_FLAGS_CSUM; | 2790 | tx_flags |= E1000_TX_FLAGS_CSUM; |
2310 | 2791 | ||
2311 | /* Old method was to assume IPv4 packet by default if TSO was enabled. | 2792 | /* Old method was to assume IPv4 packet by default if TSO was enabled. |
2312 | * 82573 hardware supports TSO capabilities for IPv6 as well... | 2793 | * 82571 hardware supports TSO capabilities for IPv6 as well... |
2313 | * no longer assume, we must. */ | 2794 | * no longer assume, we must. */ |
2314 | if(likely(skb->protocol == ntohs(ETH_P_IP))) | 2795 | if (likely(skb->protocol == ntohs(ETH_P_IP))) |
2315 | tx_flags |= E1000_TX_FLAGS_IPV4; | 2796 | tx_flags |= E1000_TX_FLAGS_IPV4; |
2316 | 2797 | ||
2317 | e1000_tx_queue(adapter, | 2798 | e1000_tx_queue(adapter, tx_ring, tx_flags, |
2318 | e1000_tx_map(adapter, skb, first, max_per_txd, nr_frags, mss), | 2799 | e1000_tx_map(adapter, tx_ring, skb, first, |
2319 | tx_flags); | 2800 | max_per_txd, nr_frags, mss)); |
2320 | 2801 | ||
2321 | netdev->trans_start = jiffies; | 2802 | netdev->trans_start = jiffies; |
2322 | 2803 | ||
2323 | /* Make sure there is space in the ring for the next send. */ | 2804 | /* Make sure there is space in the ring for the next send. */ |
2324 | if(unlikely(E1000_DESC_UNUSED(&adapter->tx_ring) < MAX_SKB_FRAGS + 2)) | 2805 | if (unlikely(E1000_DESC_UNUSED(tx_ring) < MAX_SKB_FRAGS + 2)) |
2325 | netif_stop_queue(netdev); | 2806 | netif_stop_queue(netdev); |
2326 | 2807 | ||
2327 | spin_unlock_irqrestore(&adapter->tx_lock, flags); | 2808 | spin_unlock_irqrestore(&tx_ring->tx_lock, flags); |
2328 | return NETDEV_TX_OK; | 2809 | return NETDEV_TX_OK; |
2329 | } | 2810 | } |
2330 | 2811 | ||
@@ -2388,9 +2869,18 @@ e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
2388 | return -EINVAL; | 2869 | return -EINVAL; |
2389 | } | 2870 | } |
2390 | 2871 | ||
2391 | #define MAX_STD_JUMBO_FRAME_SIZE 9216 | 2872 | #define MAX_STD_JUMBO_FRAME_SIZE 9234 |
2392 | /* might want this to be bigger enum check... */ | 2873 | /* might want this to be bigger enum check... */ |
2393 | if (adapter->hw.mac_type == e1000_82573 && | 2874 | /* 82571 controllers limit jumbo frame size to 10500 bytes */ |
2875 | if ((adapter->hw.mac_type == e1000_82571 || | ||
2876 | adapter->hw.mac_type == e1000_82572) && | ||
2877 | max_frame > MAX_STD_JUMBO_FRAME_SIZE) { | ||
2878 | DPRINTK(PROBE, ERR, "MTU > 9216 bytes not supported " | ||
2879 | "on 82571 and 82572 controllers.\n"); | ||
2880 | return -EINVAL; | ||
2881 | } | ||
2882 | |||
2883 | if(adapter->hw.mac_type == e1000_82573 && | ||
2394 | max_frame > MAXIMUM_ETHERNET_FRAME_SIZE) { | 2884 | max_frame > MAXIMUM_ETHERNET_FRAME_SIZE) { |
2395 | DPRINTK(PROBE, ERR, "Jumbo Frames not supported " | 2885 | DPRINTK(PROBE, ERR, "Jumbo Frames not supported " |
2396 | "on 82573\n"); | 2886 | "on 82573\n"); |
@@ -2578,6 +3068,29 @@ e1000_update_stats(struct e1000_adapter *adapter) | |||
2578 | spin_unlock_irqrestore(&adapter->stats_lock, flags); | 3068 | spin_unlock_irqrestore(&adapter->stats_lock, flags); |
2579 | } | 3069 | } |
2580 | 3070 | ||
3071 | #ifdef CONFIG_E1000_MQ | ||
3072 | void | ||
3073 | e1000_rx_schedule(void *data) | ||
3074 | { | ||
3075 | struct net_device *poll_dev, *netdev = data; | ||
3076 | struct e1000_adapter *adapter = netdev->priv; | ||
3077 | int this_cpu = get_cpu(); | ||
3078 | |||
3079 | poll_dev = *per_cpu_ptr(adapter->cpu_netdev, this_cpu); | ||
3080 | if (poll_dev == NULL) { | ||
3081 | put_cpu(); | ||
3082 | return; | ||
3083 | } | ||
3084 | |||
3085 | if (likely(netif_rx_schedule_prep(poll_dev))) | ||
3086 | __netif_rx_schedule(poll_dev); | ||
3087 | else | ||
3088 | e1000_irq_enable(adapter); | ||
3089 | |||
3090 | put_cpu(); | ||
3091 | } | ||
3092 | #endif | ||
3093 | |||
2581 | /** | 3094 | /** |
2582 | * e1000_intr - Interrupt Handler | 3095 | * e1000_intr - Interrupt Handler |
2583 | * @irq: interrupt number | 3096 | * @irq: interrupt number |
@@ -2592,8 +3105,8 @@ e1000_intr(int irq, void *data, struct pt_regs *regs) | |||
2592 | struct e1000_adapter *adapter = netdev_priv(netdev); | 3105 | struct e1000_adapter *adapter = netdev_priv(netdev); |
2593 | struct e1000_hw *hw = &adapter->hw; | 3106 | struct e1000_hw *hw = &adapter->hw; |
2594 | uint32_t icr = E1000_READ_REG(hw, ICR); | 3107 | uint32_t icr = E1000_READ_REG(hw, ICR); |
2595 | #ifndef CONFIG_E1000_NAPI | 3108 | #if defined(CONFIG_E1000_NAPI) && defined(CONFIG_E1000_MQ) || !defined(CONFIG_E1000_NAPI) |
2596 | unsigned int i; | 3109 | int i; |
2597 | #endif | 3110 | #endif |
2598 | 3111 | ||
2599 | if(unlikely(!icr)) | 3112 | if(unlikely(!icr)) |
@@ -2605,17 +3118,31 @@ e1000_intr(int irq, void *data, struct pt_regs *regs) | |||
2605 | } | 3118 | } |
2606 | 3119 | ||
2607 | #ifdef CONFIG_E1000_NAPI | 3120 | #ifdef CONFIG_E1000_NAPI |
2608 | if(likely(netif_rx_schedule_prep(netdev))) { | 3121 | atomic_inc(&adapter->irq_sem); |
2609 | 3122 | E1000_WRITE_REG(hw, IMC, ~0); | |
2610 | /* Disable interrupts and register for poll. The flush | 3123 | E1000_WRITE_FLUSH(hw); |
2611 | of the posted write is intentionally left out. | 3124 | #ifdef CONFIG_E1000_MQ |
2612 | */ | 3125 | if (atomic_read(&adapter->rx_sched_call_data.count) == 0) { |
2613 | 3126 | cpu_set(adapter->cpu_for_queue[0], | |
2614 | atomic_inc(&adapter->irq_sem); | 3127 | adapter->rx_sched_call_data.cpumask); |
2615 | E1000_WRITE_REG(hw, IMC, ~0); | 3128 | for (i = 1; i < adapter->num_queues; i++) { |
2616 | __netif_rx_schedule(netdev); | 3129 | cpu_set(adapter->cpu_for_queue[i], |
3130 | adapter->rx_sched_call_data.cpumask); | ||
3131 | atomic_inc(&adapter->irq_sem); | ||
3132 | } | ||
3133 | atomic_set(&adapter->rx_sched_call_data.count, i); | ||
3134 | smp_call_async_mask(&adapter->rx_sched_call_data); | ||
3135 | } else { | ||
3136 | printk("call_data.count == %u\n", atomic_read(&adapter->rx_sched_call_data.count)); | ||
2617 | } | 3137 | } |
2618 | #else | 3138 | #else /* if !CONFIG_E1000_MQ */ |
3139 | if (likely(netif_rx_schedule_prep(&adapter->polling_netdev[0]))) | ||
3140 | __netif_rx_schedule(&adapter->polling_netdev[0]); | ||
3141 | else | ||
3142 | e1000_irq_enable(adapter); | ||
3143 | #endif /* CONFIG_E1000_MQ */ | ||
3144 | |||
3145 | #else /* if !CONFIG_E1000_NAPI */ | ||
2619 | /* Writing IMC and IMS is needed for 82547. | 3146 | /* Writing IMC and IMS is needed for 82547. |
2620 | Due to Hub Link bus being occupied, an interrupt | 3147 | Due to Hub Link bus being occupied, an interrupt |
2621 | de-assertion message is not able to be sent. | 3148 | de-assertion message is not able to be sent. |
@@ -2632,13 +3159,14 @@ e1000_intr(int irq, void *data, struct pt_regs *regs) | |||
2632 | } | 3159 | } |
2633 | 3160 | ||
2634 | for(i = 0; i < E1000_MAX_INTR; i++) | 3161 | for(i = 0; i < E1000_MAX_INTR; i++) |
2635 | if(unlikely(!adapter->clean_rx(adapter) & | 3162 | if(unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) & |
2636 | !e1000_clean_tx_irq(adapter))) | 3163 | !e1000_clean_tx_irq(adapter, adapter->tx_ring))) |
2637 | break; | 3164 | break; |
2638 | 3165 | ||
2639 | if(hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2) | 3166 | if(hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2) |
2640 | e1000_irq_enable(adapter); | 3167 | e1000_irq_enable(adapter); |
2641 | #endif | 3168 | |
3169 | #endif /* CONFIG_E1000_NAPI */ | ||
2642 | 3170 | ||
2643 | return IRQ_HANDLED; | 3171 | return IRQ_HANDLED; |
2644 | } | 3172 | } |
@@ -2650,22 +3178,37 @@ e1000_intr(int irq, void *data, struct pt_regs *regs) | |||
2650 | **/ | 3178 | **/ |
2651 | 3179 | ||
2652 | static int | 3180 | static int |
2653 | e1000_clean(struct net_device *netdev, int *budget) | 3181 | e1000_clean(struct net_device *poll_dev, int *budget) |
2654 | { | 3182 | { |
2655 | struct e1000_adapter *adapter = netdev_priv(netdev); | 3183 | struct e1000_adapter *adapter; |
2656 | int work_to_do = min(*budget, netdev->quota); | 3184 | int work_to_do = min(*budget, poll_dev->quota); |
2657 | int tx_cleaned; | 3185 | int tx_cleaned, i = 0, work_done = 0; |
2658 | int work_done = 0; | ||
2659 | 3186 | ||
2660 | tx_cleaned = e1000_clean_tx_irq(adapter); | 3187 | /* Must NOT use netdev_priv macro here. */ |
2661 | adapter->clean_rx(adapter, &work_done, work_to_do); | 3188 | adapter = poll_dev->priv; |
3189 | |||
3190 | /* Keep link state information with original netdev */ | ||
3191 | if (!netif_carrier_ok(adapter->netdev)) | ||
3192 | goto quit_polling; | ||
3193 | |||
3194 | while (poll_dev != &adapter->polling_netdev[i]) { | ||
3195 | i++; | ||
3196 | if (unlikely(i == adapter->num_queues)) | ||
3197 | BUG(); | ||
3198 | } | ||
3199 | |||
3200 | tx_cleaned = e1000_clean_tx_irq(adapter, &adapter->tx_ring[i]); | ||
3201 | adapter->clean_rx(adapter, &adapter->rx_ring[i], | ||
3202 | &work_done, work_to_do); | ||
2662 | 3203 | ||
2663 | *budget -= work_done; | 3204 | *budget -= work_done; |
2664 | netdev->quota -= work_done; | 3205 | poll_dev->quota -= work_done; |
2665 | 3206 | ||
2666 | if ((!tx_cleaned && (work_done == 0)) || !netif_running(netdev)) { | ||
2667 | /* If no Tx and not enough Rx work done, exit the polling mode */ | 3207 | /* If no Tx and not enough Rx work done, exit the polling mode */ |
2668 | netif_rx_complete(netdev); | 3208 | if((!tx_cleaned && (work_done == 0)) || |
3209 | !netif_running(adapter->netdev)) { | ||
3210 | quit_polling: | ||
3211 | netif_rx_complete(poll_dev); | ||
2669 | e1000_irq_enable(adapter); | 3212 | e1000_irq_enable(adapter); |
2670 | return 0; | 3213 | return 0; |
2671 | } | 3214 | } |
@@ -2680,9 +3223,9 @@ e1000_clean(struct net_device *netdev, int *budget) | |||
2680 | **/ | 3223 | **/ |
2681 | 3224 | ||
2682 | static boolean_t | 3225 | static boolean_t |
2683 | e1000_clean_tx_irq(struct e1000_adapter *adapter) | 3226 | e1000_clean_tx_irq(struct e1000_adapter *adapter, |
3227 | struct e1000_tx_ring *tx_ring) | ||
2684 | { | 3228 | { |
2685 | struct e1000_desc_ring *tx_ring = &adapter->tx_ring; | ||
2686 | struct net_device *netdev = adapter->netdev; | 3229 | struct net_device *netdev = adapter->netdev; |
2687 | struct e1000_tx_desc *tx_desc, *eop_desc; | 3230 | struct e1000_tx_desc *tx_desc, *eop_desc; |
2688 | struct e1000_buffer *buffer_info; | 3231 | struct e1000_buffer *buffer_info; |
@@ -2693,12 +3236,12 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter) | |||
2693 | eop = tx_ring->buffer_info[i].next_to_watch; | 3236 | eop = tx_ring->buffer_info[i].next_to_watch; |
2694 | eop_desc = E1000_TX_DESC(*tx_ring, eop); | 3237 | eop_desc = E1000_TX_DESC(*tx_ring, eop); |
2695 | 3238 | ||
2696 | while(eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) { | 3239 | while (eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) { |
2697 | /* Premature writeback of Tx descriptors clear (free buffers | 3240 | /* Premature writeback of Tx descriptors clear (free buffers |
2698 | * and unmap pci_mapping) previous_buffer_info */ | 3241 | * and unmap pci_mapping) previous_buffer_info */ |
2699 | if (likely(adapter->previous_buffer_info.skb != NULL)) { | 3242 | if (likely(tx_ring->previous_buffer_info.skb != NULL)) { |
2700 | e1000_unmap_and_free_tx_resource(adapter, | 3243 | e1000_unmap_and_free_tx_resource(adapter, |
2701 | &adapter->previous_buffer_info); | 3244 | &tx_ring->previous_buffer_info); |
2702 | } | 3245 | } |
2703 | 3246 | ||
2704 | for(cleaned = FALSE; !cleaned; ) { | 3247 | for(cleaned = FALSE; !cleaned; ) { |
@@ -2714,7 +3257,7 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter) | |||
2714 | #ifdef NETIF_F_TSO | 3257 | #ifdef NETIF_F_TSO |
2715 | } else { | 3258 | } else { |
2716 | if (cleaned) { | 3259 | if (cleaned) { |
2717 | memcpy(&adapter->previous_buffer_info, | 3260 | memcpy(&tx_ring->previous_buffer_info, |
2718 | buffer_info, | 3261 | buffer_info, |
2719 | sizeof(struct e1000_buffer)); | 3262 | sizeof(struct e1000_buffer)); |
2720 | memset(buffer_info, 0, | 3263 | memset(buffer_info, 0, |
@@ -2732,6 +3275,8 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter) | |||
2732 | 3275 | ||
2733 | if(unlikely(++i == tx_ring->count)) i = 0; | 3276 | if(unlikely(++i == tx_ring->count)) i = 0; |
2734 | } | 3277 | } |
3278 | |||
3279 | tx_ring->pkt++; | ||
2735 | 3280 | ||
2736 | eop = tx_ring->buffer_info[i].next_to_watch; | 3281 | eop = tx_ring->buffer_info[i].next_to_watch; |
2737 | eop_desc = E1000_TX_DESC(*tx_ring, eop); | 3282 | eop_desc = E1000_TX_DESC(*tx_ring, eop); |
@@ -2739,15 +3284,15 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter) | |||
2739 | 3284 | ||
2740 | tx_ring->next_to_clean = i; | 3285 | tx_ring->next_to_clean = i; |
2741 | 3286 | ||
2742 | spin_lock(&adapter->tx_lock); | 3287 | spin_lock(&tx_ring->tx_lock); |
2743 | 3288 | ||
2744 | if(unlikely(cleaned && netif_queue_stopped(netdev) && | 3289 | if(unlikely(cleaned && netif_queue_stopped(netdev) && |
2745 | netif_carrier_ok(netdev))) | 3290 | netif_carrier_ok(netdev))) |
2746 | netif_wake_queue(netdev); | 3291 | netif_wake_queue(netdev); |
2747 | 3292 | ||
2748 | spin_unlock(&adapter->tx_lock); | 3293 | spin_unlock(&tx_ring->tx_lock); |
2749 | if(adapter->detect_tx_hung) { | ||
2750 | 3294 | ||
3295 | if (adapter->detect_tx_hung) { | ||
2751 | /* Detect a transmit hang in hardware, this serializes the | 3296 | /* Detect a transmit hang in hardware, this serializes the |
2752 | * check with the clearing of time_stamp and movement of i */ | 3297 | * check with the clearing of time_stamp and movement of i */ |
2753 | adapter->detect_tx_hung = FALSE; | 3298 | adapter->detect_tx_hung = FALSE; |
@@ -2771,8 +3316,8 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter) | |||
2771 | " next_to_watch <%x>\n" | 3316 | " next_to_watch <%x>\n" |
2772 | " jiffies <%lx>\n" | 3317 | " jiffies <%lx>\n" |
2773 | " next_to_watch.status <%x>\n", | 3318 | " next_to_watch.status <%x>\n", |
2774 | E1000_READ_REG(&adapter->hw, TDH), | 3319 | readl(adapter->hw.hw_addr + tx_ring->tdh), |
2775 | E1000_READ_REG(&adapter->hw, TDT), | 3320 | readl(adapter->hw.hw_addr + tx_ring->tdt), |
2776 | tx_ring->next_to_use, | 3321 | tx_ring->next_to_use, |
2777 | i, | 3322 | i, |
2778 | (unsigned long long)tx_ring->buffer_info[i].dma, | 3323 | (unsigned long long)tx_ring->buffer_info[i].dma, |
@@ -2784,12 +3329,10 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter) | |||
2784 | } | 3329 | } |
2785 | } | 3330 | } |
2786 | #ifdef NETIF_F_TSO | 3331 | #ifdef NETIF_F_TSO |
2787 | 3332 | if (unlikely(!(eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) && | |
2788 | if( unlikely(!(eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) && | 3333 | time_after(jiffies, tx_ring->previous_buffer_info.time_stamp + HZ))) |
2789 | time_after(jiffies, adapter->previous_buffer_info.time_stamp + HZ))) | ||
2790 | e1000_unmap_and_free_tx_resource( | 3334 | e1000_unmap_and_free_tx_resource( |
2791 | adapter, &adapter->previous_buffer_info); | 3335 | adapter, &tx_ring->previous_buffer_info); |
2792 | |||
2793 | #endif | 3336 | #endif |
2794 | return cleaned; | 3337 | return cleaned; |
2795 | } | 3338 | } |
@@ -2852,13 +3395,14 @@ e1000_rx_checksum(struct e1000_adapter *adapter, | |||
2852 | 3395 | ||
2853 | static boolean_t | 3396 | static boolean_t |
2854 | #ifdef CONFIG_E1000_NAPI | 3397 | #ifdef CONFIG_E1000_NAPI |
2855 | e1000_clean_rx_irq(struct e1000_adapter *adapter, int *work_done, | 3398 | e1000_clean_rx_irq(struct e1000_adapter *adapter, |
2856 | int work_to_do) | 3399 | struct e1000_rx_ring *rx_ring, |
3400 | int *work_done, int work_to_do) | ||
2857 | #else | 3401 | #else |
2858 | e1000_clean_rx_irq(struct e1000_adapter *adapter) | 3402 | e1000_clean_rx_irq(struct e1000_adapter *adapter, |
3403 | struct e1000_rx_ring *rx_ring) | ||
2859 | #endif | 3404 | #endif |
2860 | { | 3405 | { |
2861 | struct e1000_desc_ring *rx_ring = &adapter->rx_ring; | ||
2862 | struct net_device *netdev = adapter->netdev; | 3406 | struct net_device *netdev = adapter->netdev; |
2863 | struct pci_dev *pdev = adapter->pdev; | 3407 | struct pci_dev *pdev = adapter->pdev; |
2864 | struct e1000_rx_desc *rx_desc; | 3408 | struct e1000_rx_desc *rx_desc; |
@@ -2944,6 +3488,7 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter) | |||
2944 | } | 3488 | } |
2945 | #endif /* CONFIG_E1000_NAPI */ | 3489 | #endif /* CONFIG_E1000_NAPI */ |
2946 | netdev->last_rx = jiffies; | 3490 | netdev->last_rx = jiffies; |
3491 | rx_ring->pkt++; | ||
2947 | 3492 | ||
2948 | next_desc: | 3493 | next_desc: |
2949 | rx_desc->status = 0; | 3494 | rx_desc->status = 0; |
@@ -2953,7 +3498,7 @@ next_desc: | |||
2953 | rx_desc = E1000_RX_DESC(*rx_ring, i); | 3498 | rx_desc = E1000_RX_DESC(*rx_ring, i); |
2954 | } | 3499 | } |
2955 | rx_ring->next_to_clean = i; | 3500 | rx_ring->next_to_clean = i; |
2956 | adapter->alloc_rx_buf(adapter); | 3501 | adapter->alloc_rx_buf(adapter, rx_ring); |
2957 | 3502 | ||
2958 | return cleaned; | 3503 | return cleaned; |
2959 | } | 3504 | } |
@@ -2965,13 +3510,14 @@ next_desc: | |||
2965 | 3510 | ||
2966 | static boolean_t | 3511 | static boolean_t |
2967 | #ifdef CONFIG_E1000_NAPI | 3512 | #ifdef CONFIG_E1000_NAPI |
2968 | e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, int *work_done, | 3513 | e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, |
2969 | int work_to_do) | 3514 | struct e1000_rx_ring *rx_ring, |
3515 | int *work_done, int work_to_do) | ||
2970 | #else | 3516 | #else |
2971 | e1000_clean_rx_irq_ps(struct e1000_adapter *adapter) | 3517 | e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, |
3518 | struct e1000_rx_ring *rx_ring) | ||
2972 | #endif | 3519 | #endif |
2973 | { | 3520 | { |
2974 | struct e1000_desc_ring *rx_ring = &adapter->rx_ring; | ||
2975 | union e1000_rx_desc_packet_split *rx_desc; | 3521 | union e1000_rx_desc_packet_split *rx_desc; |
2976 | struct net_device *netdev = adapter->netdev; | 3522 | struct net_device *netdev = adapter->netdev; |
2977 | struct pci_dev *pdev = adapter->pdev; | 3523 | struct pci_dev *pdev = adapter->pdev; |
@@ -3027,7 +3573,7 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter) | |||
3027 | /* Good Receive */ | 3573 | /* Good Receive */ |
3028 | skb_put(skb, length); | 3574 | skb_put(skb, length); |
3029 | 3575 | ||
3030 | for(j = 0; j < PS_PAGE_BUFFERS; j++) { | 3576 | for(j = 0; j < adapter->rx_ps_pages; j++) { |
3031 | if(!(length = le16_to_cpu(rx_desc->wb.upper.length[j]))) | 3577 | if(!(length = le16_to_cpu(rx_desc->wb.upper.length[j]))) |
3032 | break; | 3578 | break; |
3033 | 3579 | ||
@@ -3048,11 +3594,13 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter) | |||
3048 | rx_desc->wb.lower.hi_dword.csum_ip.csum, skb); | 3594 | rx_desc->wb.lower.hi_dword.csum_ip.csum, skb); |
3049 | skb->protocol = eth_type_trans(skb, netdev); | 3595 | skb->protocol = eth_type_trans(skb, netdev); |
3050 | 3596 | ||
3051 | #ifdef HAVE_RX_ZERO_COPY | ||
3052 | if(likely(rx_desc->wb.upper.header_status & | 3597 | if(likely(rx_desc->wb.upper.header_status & |
3053 | E1000_RXDPS_HDRSTAT_HDRSP)) | 3598 | E1000_RXDPS_HDRSTAT_HDRSP)) { |
3599 | adapter->rx_hdr_split++; | ||
3600 | #ifdef HAVE_RX_ZERO_COPY | ||
3054 | skb_shinfo(skb)->zero_copy = TRUE; | 3601 | skb_shinfo(skb)->zero_copy = TRUE; |
3055 | #endif | 3602 | #endif |
3603 | } | ||
3056 | #ifdef CONFIG_E1000_NAPI | 3604 | #ifdef CONFIG_E1000_NAPI |
3057 | if(unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) { | 3605 | if(unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) { |
3058 | vlan_hwaccel_receive_skb(skb, adapter->vlgrp, | 3606 | vlan_hwaccel_receive_skb(skb, adapter->vlgrp, |
@@ -3071,6 +3619,7 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter) | |||
3071 | } | 3619 | } |
3072 | #endif /* CONFIG_E1000_NAPI */ | 3620 | #endif /* CONFIG_E1000_NAPI */ |
3073 | netdev->last_rx = jiffies; | 3621 | netdev->last_rx = jiffies; |
3622 | rx_ring->pkt++; | ||
3074 | 3623 | ||
3075 | next_desc: | 3624 | next_desc: |
3076 | rx_desc->wb.middle.status_error &= ~0xFF; | 3625 | rx_desc->wb.middle.status_error &= ~0xFF; |
@@ -3081,7 +3630,7 @@ next_desc: | |||
3081 | staterr = le32_to_cpu(rx_desc->wb.middle.status_error); | 3630 | staterr = le32_to_cpu(rx_desc->wb.middle.status_error); |
3082 | } | 3631 | } |
3083 | rx_ring->next_to_clean = i; | 3632 | rx_ring->next_to_clean = i; |
3084 | adapter->alloc_rx_buf(adapter); | 3633 | adapter->alloc_rx_buf(adapter, rx_ring); |
3085 | 3634 | ||
3086 | return cleaned; | 3635 | return cleaned; |
3087 | } | 3636 | } |
@@ -3092,9 +3641,9 @@ next_desc: | |||
3092 | **/ | 3641 | **/ |
3093 | 3642 | ||
3094 | static void | 3643 | static void |
3095 | e1000_alloc_rx_buffers(struct e1000_adapter *adapter) | 3644 | e1000_alloc_rx_buffers(struct e1000_adapter *adapter, |
3645 | struct e1000_rx_ring *rx_ring) | ||
3096 | { | 3646 | { |
3097 | struct e1000_desc_ring *rx_ring = &adapter->rx_ring; | ||
3098 | struct net_device *netdev = adapter->netdev; | 3647 | struct net_device *netdev = adapter->netdev; |
3099 | struct pci_dev *pdev = adapter->pdev; | 3648 | struct pci_dev *pdev = adapter->pdev; |
3100 | struct e1000_rx_desc *rx_desc; | 3649 | struct e1000_rx_desc *rx_desc; |
@@ -3178,7 +3727,7 @@ e1000_alloc_rx_buffers(struct e1000_adapter *adapter) | |||
3178 | * applicable for weak-ordered memory model archs, | 3727 | * applicable for weak-ordered memory model archs, |
3179 | * such as IA-64). */ | 3728 | * such as IA-64). */ |
3180 | wmb(); | 3729 | wmb(); |
3181 | E1000_WRITE_REG(&adapter->hw, RDT, i); | 3730 | writel(i, adapter->hw.hw_addr + rx_ring->rdt); |
3182 | } | 3731 | } |
3183 | 3732 | ||
3184 | if(unlikely(++i == rx_ring->count)) i = 0; | 3733 | if(unlikely(++i == rx_ring->count)) i = 0; |
@@ -3194,9 +3743,9 @@ e1000_alloc_rx_buffers(struct e1000_adapter *adapter) | |||
3194 | **/ | 3743 | **/ |
3195 | 3744 | ||
3196 | static void | 3745 | static void |
3197 | e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter) | 3746 | e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, |
3747 | struct e1000_rx_ring *rx_ring) | ||
3198 | { | 3748 | { |
3199 | struct e1000_desc_ring *rx_ring = &adapter->rx_ring; | ||
3200 | struct net_device *netdev = adapter->netdev; | 3749 | struct net_device *netdev = adapter->netdev; |
3201 | struct pci_dev *pdev = adapter->pdev; | 3750 | struct pci_dev *pdev = adapter->pdev; |
3202 | union e1000_rx_desc_packet_split *rx_desc; | 3751 | union e1000_rx_desc_packet_split *rx_desc; |
@@ -3215,22 +3764,26 @@ e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter) | |||
3215 | rx_desc = E1000_RX_DESC_PS(*rx_ring, i); | 3764 | rx_desc = E1000_RX_DESC_PS(*rx_ring, i); |
3216 | 3765 | ||
3217 | for(j = 0; j < PS_PAGE_BUFFERS; j++) { | 3766 | for(j = 0; j < PS_PAGE_BUFFERS; j++) { |
3218 | if(unlikely(!ps_page->ps_page[j])) { | 3767 | if (j < adapter->rx_ps_pages) { |
3219 | ps_page->ps_page[j] = | 3768 | if (likely(!ps_page->ps_page[j])) { |
3220 | alloc_page(GFP_ATOMIC); | 3769 | ps_page->ps_page[j] = |
3221 | if(unlikely(!ps_page->ps_page[j])) | 3770 | alloc_page(GFP_ATOMIC); |
3222 | goto no_buffers; | 3771 | if (unlikely(!ps_page->ps_page[j])) |
3223 | ps_page_dma->ps_page_dma[j] = | 3772 | goto no_buffers; |
3224 | pci_map_page(pdev, | 3773 | ps_page_dma->ps_page_dma[j] = |
3225 | ps_page->ps_page[j], | 3774 | pci_map_page(pdev, |
3226 | 0, PAGE_SIZE, | 3775 | ps_page->ps_page[j], |
3227 | PCI_DMA_FROMDEVICE); | 3776 | 0, PAGE_SIZE, |
3228 | } | 3777 | PCI_DMA_FROMDEVICE); |
3229 | /* Refresh the desc even if buffer_addrs didn't | 3778 | } |
3230 | * change because each write-back erases this info. | 3779 | /* Refresh the desc even if buffer_addrs didn't |
3231 | */ | 3780 | * change because each write-back erases |
3232 | rx_desc->read.buffer_addr[j+1] = | 3781 | * this info. |
3233 | cpu_to_le64(ps_page_dma->ps_page_dma[j]); | 3782 | */ |
3783 | rx_desc->read.buffer_addr[j+1] = | ||
3784 | cpu_to_le64(ps_page_dma->ps_page_dma[j]); | ||
3785 | } else | ||
3786 | rx_desc->read.buffer_addr[j+1] = ~0; | ||
3234 | } | 3787 | } |
3235 | 3788 | ||
3236 | skb = dev_alloc_skb(adapter->rx_ps_bsize0 + NET_IP_ALIGN); | 3789 | skb = dev_alloc_skb(adapter->rx_ps_bsize0 + NET_IP_ALIGN); |
@@ -3264,7 +3817,7 @@ e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter) | |||
3264 | * descriptors are 32 bytes...so we increment tail | 3817 | * descriptors are 32 bytes...so we increment tail |
3265 | * twice as much. | 3818 | * twice as much. |
3266 | */ | 3819 | */ |
3267 | E1000_WRITE_REG(&adapter->hw, RDT, i<<1); | 3820 | writel(i<<1, adapter->hw.hw_addr + rx_ring->rdt); |
3268 | } | 3821 | } |
3269 | 3822 | ||
3270 | if(unlikely(++i == rx_ring->count)) i = 0; | 3823 | if(unlikely(++i == rx_ring->count)) i = 0; |
@@ -3715,6 +4268,12 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state) | |||
3715 | } | 4268 | } |
3716 | 4269 | ||
3717 | switch(adapter->hw.mac_type) { | 4270 | switch(adapter->hw.mac_type) { |
4271 | case e1000_82571: | ||
4272 | case e1000_82572: | ||
4273 | ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT); | ||
4274 | E1000_WRITE_REG(&adapter->hw, CTRL_EXT, | ||
4275 | ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD); | ||
4276 | break; | ||
3718 | case e1000_82573: | 4277 | case e1000_82573: |
3719 | swsm = E1000_READ_REG(&adapter->hw, SWSM); | 4278 | swsm = E1000_READ_REG(&adapter->hw, SWSM); |
3720 | E1000_WRITE_REG(&adapter->hw, SWSM, | 4279 | E1000_WRITE_REG(&adapter->hw, SWSM, |
@@ -3737,6 +4296,7 @@ e1000_resume(struct pci_dev *pdev) | |||
3737 | struct net_device *netdev = pci_get_drvdata(pdev); | 4296 | struct net_device *netdev = pci_get_drvdata(pdev); |
3738 | struct e1000_adapter *adapter = netdev_priv(netdev); | 4297 | struct e1000_adapter *adapter = netdev_priv(netdev); |
3739 | uint32_t manc, ret_val, swsm; | 4298 | uint32_t manc, ret_val, swsm; |
4299 | uint32_t ctrl_ext; | ||
3740 | 4300 | ||
3741 | pci_set_power_state(pdev, PCI_D0); | 4301 | pci_set_power_state(pdev, PCI_D0); |
3742 | pci_restore_state(pdev); | 4302 | pci_restore_state(pdev); |
@@ -3762,6 +4322,12 @@ e1000_resume(struct pci_dev *pdev) | |||
3762 | } | 4322 | } |
3763 | 4323 | ||
3764 | switch(adapter->hw.mac_type) { | 4324 | switch(adapter->hw.mac_type) { |
4325 | case e1000_82571: | ||
4326 | case e1000_82572: | ||
4327 | ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT); | ||
4328 | E1000_WRITE_REG(&adapter->hw, CTRL_EXT, | ||
4329 | ctrl_ext | E1000_CTRL_EXT_DRV_LOAD); | ||
4330 | break; | ||
3765 | case e1000_82573: | 4331 | case e1000_82573: |
3766 | swsm = E1000_READ_REG(&adapter->hw, SWSM); | 4332 | swsm = E1000_READ_REG(&adapter->hw, SWSM); |
3767 | E1000_WRITE_REG(&adapter->hw, SWSM, | 4333 | E1000_WRITE_REG(&adapter->hw, SWSM, |
@@ -3786,7 +4352,7 @@ e1000_netpoll(struct net_device *netdev) | |||
3786 | struct e1000_adapter *adapter = netdev_priv(netdev); | 4352 | struct e1000_adapter *adapter = netdev_priv(netdev); |
3787 | disable_irq(adapter->pdev->irq); | 4353 | disable_irq(adapter->pdev->irq); |
3788 | e1000_intr(adapter->pdev->irq, netdev, NULL); | 4354 | e1000_intr(adapter->pdev->irq, netdev, NULL); |
3789 | e1000_clean_tx_irq(adapter); | 4355 | e1000_clean_tx_irq(adapter, adapter->tx_ring); |
3790 | enable_irq(adapter->pdev->irq); | 4356 | enable_irq(adapter->pdev->irq); |
3791 | } | 4357 | } |
3792 | #endif | 4358 | #endif |
diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c index 676247f9f1cc..38695d5b4637 100644 --- a/drivers/net/e1000/e1000_param.c +++ b/drivers/net/e1000/e1000_param.c | |||
@@ -306,7 +306,8 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
306 | .def = E1000_DEFAULT_TXD, | 306 | .def = E1000_DEFAULT_TXD, |
307 | .arg = { .r = { .min = E1000_MIN_TXD }} | 307 | .arg = { .r = { .min = E1000_MIN_TXD }} |
308 | }; | 308 | }; |
309 | struct e1000_desc_ring *tx_ring = &adapter->tx_ring; | 309 | struct e1000_tx_ring *tx_ring = adapter->tx_ring; |
310 | int i; | ||
310 | e1000_mac_type mac_type = adapter->hw.mac_type; | 311 | e1000_mac_type mac_type = adapter->hw.mac_type; |
311 | opt.arg.r.max = mac_type < e1000_82544 ? | 312 | opt.arg.r.max = mac_type < e1000_82544 ? |
312 | E1000_MAX_TXD : E1000_MAX_82544_TXD; | 313 | E1000_MAX_TXD : E1000_MAX_82544_TXD; |
@@ -319,6 +320,8 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
319 | } else { | 320 | } else { |
320 | tx_ring->count = opt.def; | 321 | tx_ring->count = opt.def; |
321 | } | 322 | } |
323 | for (i = 0; i < adapter->num_queues; i++) | ||
324 | tx_ring[i].count = tx_ring->count; | ||
322 | } | 325 | } |
323 | { /* Receive Descriptor Count */ | 326 | { /* Receive Descriptor Count */ |
324 | struct e1000_option opt = { | 327 | struct e1000_option opt = { |
@@ -329,7 +332,8 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
329 | .def = E1000_DEFAULT_RXD, | 332 | .def = E1000_DEFAULT_RXD, |
330 | .arg = { .r = { .min = E1000_MIN_RXD }} | 333 | .arg = { .r = { .min = E1000_MIN_RXD }} |
331 | }; | 334 | }; |
332 | struct e1000_desc_ring *rx_ring = &adapter->rx_ring; | 335 | struct e1000_rx_ring *rx_ring = adapter->rx_ring; |
336 | int i; | ||
333 | e1000_mac_type mac_type = adapter->hw.mac_type; | 337 | e1000_mac_type mac_type = adapter->hw.mac_type; |
334 | opt.arg.r.max = mac_type < e1000_82544 ? E1000_MAX_RXD : | 338 | opt.arg.r.max = mac_type < e1000_82544 ? E1000_MAX_RXD : |
335 | E1000_MAX_82544_RXD; | 339 | E1000_MAX_82544_RXD; |
@@ -342,6 +346,8 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
342 | } else { | 346 | } else { |
343 | rx_ring->count = opt.def; | 347 | rx_ring->count = opt.def; |
344 | } | 348 | } |
349 | for (i = 0; i < adapter->num_queues; i++) | ||
350 | rx_ring[i].count = rx_ring->count; | ||
345 | } | 351 | } |
346 | { /* Checksum Offload Enable/Disable */ | 352 | { /* Checksum Offload Enable/Disable */ |
347 | struct e1000_option opt = { | 353 | struct e1000_option opt = { |