diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-10-28 12:31:34 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-10-28 12:31:34 -0400 |
commit | 96b88fb850cc419171f926ad04650ec509e9f543 (patch) | |
tree | 5bf9537bde467534608b3acdbfa5f7726ede8c3f /drivers/net/e1000/e1000_ethtool.c | |
parent | e78a57de94480226f7fc90d0b4837bfc6c99a9e0 (diff) | |
parent | 5fadd053d9bb4345ec6f405d24db4e7eb49cf81e (diff) |
Merge branch 'master'
Diffstat (limited to 'drivers/net/e1000/e1000_ethtool.c')
-rw-r--r-- | drivers/net/e1000/e1000_ethtool.c | 95 |
1 files changed, 67 insertions, 28 deletions
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) |