diff options
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_ethtool.c')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_ethtool.c | 62 |
1 files changed, 32 insertions, 30 deletions
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c index 020b0c7c195f..81a9c4b86726 100644 --- a/drivers/net/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ixgbe/ixgbe_ethtool.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel 10 Gigabit PCI Express Linux driver | 3 | Intel 10 Gigabit PCI Express Linux driver |
4 | Copyright(c) 1999 - 2007 Intel Corporation. | 4 | Copyright(c) 1999 - 2008 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
@@ -20,7 +20,6 @@ | |||
20 | the file called "COPYING". | 20 | the file called "COPYING". |
21 | 21 | ||
22 | Contact Information: | 22 | Contact Information: |
23 | Linux NICS <linux.nics@intel.com> | ||
24 | e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> | 23 | e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> |
25 | Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 24 | Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
26 | 25 | ||
@@ -48,7 +47,7 @@ struct ixgbe_stats { | |||
48 | }; | 47 | }; |
49 | 48 | ||
50 | #define IXGBE_STAT(m) sizeof(((struct ixgbe_adapter *)0)->m), \ | 49 | #define IXGBE_STAT(m) sizeof(((struct ixgbe_adapter *)0)->m), \ |
51 | offsetof(struct ixgbe_adapter, m) | 50 | offsetof(struct ixgbe_adapter, m) |
52 | static struct ixgbe_stats ixgbe_gstrings_stats[] = { | 51 | static struct ixgbe_stats ixgbe_gstrings_stats[] = { |
53 | {"rx_packets", IXGBE_STAT(net_stats.rx_packets)}, | 52 | {"rx_packets", IXGBE_STAT(net_stats.rx_packets)}, |
54 | {"tx_packets", IXGBE_STAT(net_stats.tx_packets)}, | 53 | {"tx_packets", IXGBE_STAT(net_stats.tx_packets)}, |
@@ -95,14 +94,15 @@ static struct ixgbe_stats ixgbe_gstrings_stats[] = { | |||
95 | }; | 94 | }; |
96 | 95 | ||
97 | #define IXGBE_QUEUE_STATS_LEN \ | 96 | #define IXGBE_QUEUE_STATS_LEN \ |
98 | ((((struct ixgbe_adapter *)netdev->priv)->num_tx_queues + \ | 97 | ((((struct ixgbe_adapter *)netdev->priv)->num_tx_queues + \ |
99 | ((struct ixgbe_adapter *)netdev->priv)->num_rx_queues) * \ | 98 | ((struct ixgbe_adapter *)netdev->priv)->num_rx_queues) * \ |
100 | (sizeof(struct ixgbe_queue_stats) / sizeof(u64))) | 99 | (sizeof(struct ixgbe_queue_stats) / sizeof(u64))) |
101 | #define IXGBE_GLOBAL_STATS_LEN ARRAY_SIZE(ixgbe_gstrings_stats) | 100 | #define IXGBE_STATS_LEN (IXGBE_GLOBAL_STATS_LEN + IXGBE_QUEUE_STATS_LEN) |
101 | #define IXGBE_GLOBAL_STATS_LEN ARRAY_SIZE(ixgbe_gstrings_stats) | ||
102 | #define IXGBE_STATS_LEN (IXGBE_GLOBAL_STATS_LEN + IXGBE_QUEUE_STATS_LEN) | 102 | #define IXGBE_STATS_LEN (IXGBE_GLOBAL_STATS_LEN + IXGBE_QUEUE_STATS_LEN) |
103 | 103 | ||
104 | static int ixgbe_get_settings(struct net_device *netdev, | 104 | static int ixgbe_get_settings(struct net_device *netdev, |
105 | struct ethtool_cmd *ecmd) | 105 | struct ethtool_cmd *ecmd) |
106 | { | 106 | { |
107 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 107 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
108 | struct ixgbe_hw *hw = &adapter->hw; | 108 | struct ixgbe_hw *hw = &adapter->hw; |
@@ -114,7 +114,7 @@ static int ixgbe_get_settings(struct net_device *netdev, | |||
114 | ecmd->transceiver = XCVR_EXTERNAL; | 114 | ecmd->transceiver = XCVR_EXTERNAL; |
115 | if (hw->phy.media_type == ixgbe_media_type_copper) { | 115 | if (hw->phy.media_type == ixgbe_media_type_copper) { |
116 | ecmd->supported |= (SUPPORTED_1000baseT_Full | | 116 | ecmd->supported |= (SUPPORTED_1000baseT_Full | |
117 | SUPPORTED_TP | SUPPORTED_Autoneg); | 117 | SUPPORTED_TP | SUPPORTED_Autoneg); |
118 | 118 | ||
119 | ecmd->advertising = (ADVERTISED_TP | ADVERTISED_Autoneg); | 119 | ecmd->advertising = (ADVERTISED_TP | ADVERTISED_Autoneg); |
120 | if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_10GB_FULL) | 120 | if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_10GB_FULL) |
@@ -126,7 +126,7 @@ static int ixgbe_get_settings(struct net_device *netdev, | |||
126 | } else { | 126 | } else { |
127 | ecmd->supported |= SUPPORTED_FIBRE; | 127 | ecmd->supported |= SUPPORTED_FIBRE; |
128 | ecmd->advertising = (ADVERTISED_10000baseT_Full | | 128 | ecmd->advertising = (ADVERTISED_10000baseT_Full | |
129 | ADVERTISED_FIBRE); | 129 | ADVERTISED_FIBRE); |
130 | ecmd->port = PORT_FIBRE; | 130 | ecmd->port = PORT_FIBRE; |
131 | ecmd->autoneg = AUTONEG_DISABLE; | 131 | ecmd->autoneg = AUTONEG_DISABLE; |
132 | } | 132 | } |
@@ -134,7 +134,7 @@ static int ixgbe_get_settings(struct net_device *netdev, | |||
134 | hw->mac.ops.check_link(hw, &link_speed, &link_up, false); | 134 | hw->mac.ops.check_link(hw, &link_speed, &link_up, false); |
135 | if (link_up) { | 135 | if (link_up) { |
136 | ecmd->speed = (link_speed == IXGBE_LINK_SPEED_10GB_FULL) ? | 136 | ecmd->speed = (link_speed == IXGBE_LINK_SPEED_10GB_FULL) ? |
137 | SPEED_10000 : SPEED_1000; | 137 | SPEED_10000 : SPEED_1000; |
138 | ecmd->duplex = DUPLEX_FULL; | 138 | ecmd->duplex = DUPLEX_FULL; |
139 | } else { | 139 | } else { |
140 | ecmd->speed = -1; | 140 | ecmd->speed = -1; |
@@ -145,7 +145,7 @@ static int ixgbe_get_settings(struct net_device *netdev, | |||
145 | } | 145 | } |
146 | 146 | ||
147 | static int ixgbe_set_settings(struct net_device *netdev, | 147 | static int ixgbe_set_settings(struct net_device *netdev, |
148 | struct ethtool_cmd *ecmd) | 148 | struct ethtool_cmd *ecmd) |
149 | { | 149 | { |
150 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 150 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
151 | struct ixgbe_hw *hw = &adapter->hw; | 151 | struct ixgbe_hw *hw = &adapter->hw; |
@@ -165,7 +165,7 @@ static int ixgbe_set_settings(struct net_device *netdev, | |||
165 | } | 165 | } |
166 | 166 | ||
167 | static void ixgbe_get_pauseparam(struct net_device *netdev, | 167 | static void ixgbe_get_pauseparam(struct net_device *netdev, |
168 | struct ethtool_pauseparam *pause) | 168 | struct ethtool_pauseparam *pause) |
169 | { | 169 | { |
170 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 170 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
171 | struct ixgbe_hw *hw = &adapter->hw; | 171 | struct ixgbe_hw *hw = &adapter->hw; |
@@ -183,7 +183,7 @@ static void ixgbe_get_pauseparam(struct net_device *netdev, | |||
183 | } | 183 | } |
184 | 184 | ||
185 | static int ixgbe_set_pauseparam(struct net_device *netdev, | 185 | static int ixgbe_set_pauseparam(struct net_device *netdev, |
186 | struct ethtool_pauseparam *pause) | 186 | struct ethtool_pauseparam *pause) |
187 | { | 187 | { |
188 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 188 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
189 | struct ixgbe_hw *hw = &adapter->hw; | 189 | struct ixgbe_hw *hw = &adapter->hw; |
@@ -282,7 +282,7 @@ static int ixgbe_get_regs_len(struct net_device *netdev) | |||
282 | #define IXGBE_GET_STAT(_A_, _R_) _A_->stats._R_ | 282 | #define IXGBE_GET_STAT(_A_, _R_) _A_->stats._R_ |
283 | 283 | ||
284 | static void ixgbe_get_regs(struct net_device *netdev, | 284 | static void ixgbe_get_regs(struct net_device *netdev, |
285 | struct ethtool_regs *regs, void *p) | 285 | struct ethtool_regs *regs, void *p) |
286 | { | 286 | { |
287 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 287 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
288 | struct ixgbe_hw *hw = &adapter->hw; | 288 | struct ixgbe_hw *hw = &adapter->hw; |
@@ -583,7 +583,7 @@ static int ixgbe_get_eeprom_len(struct net_device *netdev) | |||
583 | } | 583 | } |
584 | 584 | ||
585 | static int ixgbe_get_eeprom(struct net_device *netdev, | 585 | static int ixgbe_get_eeprom(struct net_device *netdev, |
586 | struct ethtool_eeprom *eeprom, u8 *bytes) | 586 | struct ethtool_eeprom *eeprom, u8 *bytes) |
587 | { | 587 | { |
588 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 588 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
589 | struct ixgbe_hw *hw = &adapter->hw; | 589 | struct ixgbe_hw *hw = &adapter->hw; |
@@ -607,7 +607,7 @@ static int ixgbe_get_eeprom(struct net_device *netdev, | |||
607 | 607 | ||
608 | for (i = 0; i < eeprom_len; i++) { | 608 | for (i = 0; i < eeprom_len; i++) { |
609 | if ((ret_val = hw->eeprom.ops.read(hw, first_word + i, | 609 | if ((ret_val = hw->eeprom.ops.read(hw, first_word + i, |
610 | &eeprom_buff[i]))) | 610 | &eeprom_buff[i]))) |
611 | break; | 611 | break; |
612 | } | 612 | } |
613 | 613 | ||
@@ -622,7 +622,7 @@ static int ixgbe_get_eeprom(struct net_device *netdev, | |||
622 | } | 622 | } |
623 | 623 | ||
624 | static void ixgbe_get_drvinfo(struct net_device *netdev, | 624 | static void ixgbe_get_drvinfo(struct net_device *netdev, |
625 | struct ethtool_drvinfo *drvinfo) | 625 | struct ethtool_drvinfo *drvinfo) |
626 | { | 626 | { |
627 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 627 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
628 | 628 | ||
@@ -635,7 +635,7 @@ static void ixgbe_get_drvinfo(struct net_device *netdev, | |||
635 | } | 635 | } |
636 | 636 | ||
637 | static void ixgbe_get_ringparam(struct net_device *netdev, | 637 | static void ixgbe_get_ringparam(struct net_device *netdev, |
638 | struct ethtool_ringparam *ring) | 638 | struct ethtool_ringparam *ring) |
639 | { | 639 | { |
640 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 640 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
641 | struct ixgbe_ring *tx_ring = adapter->tx_ring; | 641 | struct ixgbe_ring *tx_ring = adapter->tx_ring; |
@@ -652,7 +652,7 @@ static void ixgbe_get_ringparam(struct net_device *netdev, | |||
652 | } | 652 | } |
653 | 653 | ||
654 | static int ixgbe_set_ringparam(struct net_device *netdev, | 654 | static int ixgbe_set_ringparam(struct net_device *netdev, |
655 | struct ethtool_ringparam *ring) | 655 | struct ethtool_ringparam *ring) |
656 | { | 656 | { |
657 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 657 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
658 | struct ixgbe_ring *temp_ring; | 658 | struct ixgbe_ring *temp_ring; |
@@ -706,7 +706,8 @@ static int ixgbe_set_ringparam(struct net_device *netdev, | |||
706 | if (err) { | 706 | if (err) { |
707 | while (i) { | 707 | while (i) { |
708 | i--; | 708 | i--; |
709 | ixgbe_free_tx_resources(adapter, &temp_ring[i]); | 709 | ixgbe_free_tx_resources(adapter, |
710 | &temp_ring[i]); | ||
710 | } | 711 | } |
711 | goto err_setup; | 712 | goto err_setup; |
712 | } | 713 | } |
@@ -731,7 +732,8 @@ static int ixgbe_set_ringparam(struct net_device *netdev, | |||
731 | if (err) { | 732 | if (err) { |
732 | while (i) { | 733 | while (i) { |
733 | i--; | 734 | i--; |
734 | ixgbe_free_rx_resources(adapter, &temp_ring[i]); | 735 | ixgbe_free_rx_resources(adapter, |
736 | &temp_ring[i]); | ||
735 | } | 737 | } |
736 | goto err_setup; | 738 | goto err_setup; |
737 | } | 739 | } |
@@ -767,7 +769,7 @@ static int ixgbe_get_sset_count(struct net_device *netdev, int sset) | |||
767 | } | 769 | } |
768 | 770 | ||
769 | static void ixgbe_get_ethtool_stats(struct net_device *netdev, | 771 | static void ixgbe_get_ethtool_stats(struct net_device *netdev, |
770 | struct ethtool_stats *stats, u64 *data) | 772 | struct ethtool_stats *stats, u64 *data) |
771 | { | 773 | { |
772 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 774 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
773 | u64 *queue_stat; | 775 | u64 *queue_stat; |
@@ -788,7 +790,7 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev, | |||
788 | for (i = 0; i < IXGBE_GLOBAL_STATS_LEN; i++) { | 790 | for (i = 0; i < IXGBE_GLOBAL_STATS_LEN; i++) { |
789 | char *p = (char *)adapter + ixgbe_gstrings_stats[i].stat_offset; | 791 | char *p = (char *)adapter + ixgbe_gstrings_stats[i].stat_offset; |
790 | data[i] = (ixgbe_gstrings_stats[i].sizeof_stat == | 792 | data[i] = (ixgbe_gstrings_stats[i].sizeof_stat == |
791 | sizeof(u64)) ? *(u64 *)p : *(u32 *)p; | 793 | sizeof(u64)) ? *(u64 *)p : *(u32 *)p; |
792 | } | 794 | } |
793 | for (j = 0; j < adapter->num_tx_queues; j++) { | 795 | for (j = 0; j < adapter->num_tx_queues; j++) { |
794 | queue_stat = (u64 *)&adapter->tx_ring[j].stats; | 796 | queue_stat = (u64 *)&adapter->tx_ring[j].stats; |
@@ -805,7 +807,7 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev, | |||
805 | } | 807 | } |
806 | 808 | ||
807 | static void ixgbe_get_strings(struct net_device *netdev, u32 stringset, | 809 | static void ixgbe_get_strings(struct net_device *netdev, u32 stringset, |
808 | u8 *data) | 810 | u8 *data) |
809 | { | 811 | { |
810 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 812 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
811 | char *p = (char *)data; | 813 | char *p = (char *)data; |
@@ -830,14 +832,14 @@ static void ixgbe_get_strings(struct net_device *netdev, u32 stringset, | |||
830 | sprintf(p, "rx_queue_%u_bytes", i); | 832 | sprintf(p, "rx_queue_%u_bytes", i); |
831 | p += ETH_GSTRING_LEN; | 833 | p += ETH_GSTRING_LEN; |
832 | } | 834 | } |
833 | /* BUG_ON(p - data != IXGBE_STATS_LEN * ETH_GSTRING_LEN); */ | 835 | /* BUG_ON(p - data != IXGBE_STATS_LEN * ETH_GSTRING_LEN); */ |
834 | break; | 836 | break; |
835 | } | 837 | } |
836 | } | 838 | } |
837 | 839 | ||
838 | 840 | ||
839 | static void ixgbe_get_wol(struct net_device *netdev, | 841 | static void ixgbe_get_wol(struct net_device *netdev, |
840 | struct ethtool_wolinfo *wol) | 842 | struct ethtool_wolinfo *wol) |
841 | { | 843 | { |
842 | wol->supported = 0; | 844 | wol->supported = 0; |
843 | wol->wolopts = 0; | 845 | wol->wolopts = 0; |
@@ -879,7 +881,7 @@ static int ixgbe_phys_id(struct net_device *netdev, u32 data) | |||
879 | } | 881 | } |
880 | 882 | ||
881 | static int ixgbe_get_coalesce(struct net_device *netdev, | 883 | static int ixgbe_get_coalesce(struct net_device *netdev, |
882 | struct ethtool_coalesce *ec) | 884 | struct ethtool_coalesce *ec) |
883 | { | 885 | { |
884 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 886 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
885 | 887 | ||
@@ -904,7 +906,7 @@ static int ixgbe_get_coalesce(struct net_device *netdev, | |||
904 | } | 906 | } |
905 | 907 | ||
906 | static int ixgbe_set_coalesce(struct net_device *netdev, | 908 | static int ixgbe_set_coalesce(struct net_device *netdev, |
907 | struct ethtool_coalesce *ec) | 909 | struct ethtool_coalesce *ec) |
908 | { | 910 | { |
909 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 911 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
910 | struct ixgbe_hw *hw = &adapter->hw; | 912 | struct ixgbe_hw *hw = &adapter->hw; |
@@ -974,7 +976,7 @@ static const struct ethtool_ops ixgbe_ethtool_ops = { | |||
974 | .set_tso = ixgbe_set_tso, | 976 | .set_tso = ixgbe_set_tso, |
975 | .get_strings = ixgbe_get_strings, | 977 | .get_strings = ixgbe_get_strings, |
976 | .phys_id = ixgbe_phys_id, | 978 | .phys_id = ixgbe_phys_id, |
977 | .get_sset_count = ixgbe_get_sset_count, | 979 | .get_sset_count = ixgbe_get_sset_count, |
978 | .get_ethtool_stats = ixgbe_get_ethtool_stats, | 980 | .get_ethtool_stats = ixgbe_get_ethtool_stats, |
979 | .get_coalesce = ixgbe_get_coalesce, | 981 | .get_coalesce = ixgbe_get_coalesce, |
980 | .set_coalesce = ixgbe_set_coalesce, | 982 | .set_coalesce = ixgbe_set_coalesce, |