diff options
Diffstat (limited to 'drivers/net/e1000e/ethtool.c')
-rw-r--r-- | drivers/net/e1000e/ethtool.c | 65 |
1 files changed, 32 insertions, 33 deletions
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index fa08b6336cfb..65ef9b5548d8 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c | |||
@@ -46,15 +46,15 @@ struct e1000_stats { | |||
46 | }; | 46 | }; |
47 | 47 | ||
48 | #define E1000_STAT(str, m) { \ | 48 | #define E1000_STAT(str, m) { \ |
49 | .stat_string = str, \ | 49 | .stat_string = str, \ |
50 | .type = E1000_STATS, \ | 50 | .type = E1000_STATS, \ |
51 | .sizeof_stat = sizeof(((struct e1000_adapter *)0)->m), \ | 51 | .sizeof_stat = sizeof(((struct e1000_adapter *)0)->m), \ |
52 | .stat_offset = offsetof(struct e1000_adapter, m) } | 52 | .stat_offset = offsetof(struct e1000_adapter, m) } |
53 | #define E1000_NETDEV_STAT(str, m) { \ | 53 | #define E1000_NETDEV_STAT(str, m) { \ |
54 | .stat_string = str, \ | 54 | .stat_string = str, \ |
55 | .type = NETDEV_STATS, \ | 55 | .type = NETDEV_STATS, \ |
56 | .sizeof_stat = sizeof(((struct net_device *)0)->m), \ | 56 | .sizeof_stat = sizeof(((struct rtnl_link_stats64 *)0)->m), \ |
57 | .stat_offset = offsetof(struct net_device, m) } | 57 | .stat_offset = offsetof(struct rtnl_link_stats64, m) } |
58 | 58 | ||
59 | static const struct e1000_stats e1000_gstrings_stats[] = { | 59 | static const struct e1000_stats e1000_gstrings_stats[] = { |
60 | E1000_STAT("rx_packets", stats.gprc), | 60 | E1000_STAT("rx_packets", stats.gprc), |
@@ -65,21 +65,21 @@ static const struct e1000_stats e1000_gstrings_stats[] = { | |||
65 | E1000_STAT("tx_broadcast", stats.bptc), | 65 | E1000_STAT("tx_broadcast", stats.bptc), |
66 | E1000_STAT("rx_multicast", stats.mprc), | 66 | E1000_STAT("rx_multicast", stats.mprc), |
67 | E1000_STAT("tx_multicast", stats.mptc), | 67 | E1000_STAT("tx_multicast", stats.mptc), |
68 | E1000_NETDEV_STAT("rx_errors", stats.rx_errors), | 68 | E1000_NETDEV_STAT("rx_errors", rx_errors), |
69 | E1000_NETDEV_STAT("tx_errors", stats.tx_errors), | 69 | E1000_NETDEV_STAT("tx_errors", tx_errors), |
70 | E1000_NETDEV_STAT("tx_dropped", stats.tx_dropped), | 70 | E1000_NETDEV_STAT("tx_dropped", tx_dropped), |
71 | E1000_STAT("multicast", stats.mprc), | 71 | E1000_STAT("multicast", stats.mprc), |
72 | E1000_STAT("collisions", stats.colc), | 72 | E1000_STAT("collisions", stats.colc), |
73 | E1000_NETDEV_STAT("rx_length_errors", stats.rx_length_errors), | 73 | E1000_NETDEV_STAT("rx_length_errors", rx_length_errors), |
74 | E1000_NETDEV_STAT("rx_over_errors", stats.rx_over_errors), | 74 | E1000_NETDEV_STAT("rx_over_errors", rx_over_errors), |
75 | E1000_STAT("rx_crc_errors", stats.crcerrs), | 75 | E1000_STAT("rx_crc_errors", stats.crcerrs), |
76 | E1000_NETDEV_STAT("rx_frame_errors", stats.rx_frame_errors), | 76 | E1000_NETDEV_STAT("rx_frame_errors", rx_frame_errors), |
77 | E1000_STAT("rx_no_buffer_count", stats.rnbc), | 77 | E1000_STAT("rx_no_buffer_count", stats.rnbc), |
78 | E1000_STAT("rx_missed_errors", stats.mpc), | 78 | E1000_STAT("rx_missed_errors", stats.mpc), |
79 | E1000_STAT("tx_aborted_errors", stats.ecol), | 79 | E1000_STAT("tx_aborted_errors", stats.ecol), |
80 | E1000_STAT("tx_carrier_errors", stats.tncrs), | 80 | E1000_STAT("tx_carrier_errors", stats.tncrs), |
81 | E1000_NETDEV_STAT("tx_fifo_errors", stats.tx_fifo_errors), | 81 | E1000_NETDEV_STAT("tx_fifo_errors", tx_fifo_errors), |
82 | E1000_NETDEV_STAT("tx_heartbeat_errors", stats.tx_heartbeat_errors), | 82 | E1000_NETDEV_STAT("tx_heartbeat_errors", tx_heartbeat_errors), |
83 | E1000_STAT("tx_window_errors", stats.latecol), | 83 | E1000_STAT("tx_window_errors", stats.latecol), |
84 | E1000_STAT("tx_abort_late_coll", stats.latecol), | 84 | E1000_STAT("tx_abort_late_coll", stats.latecol), |
85 | E1000_STAT("tx_deferred_ok", stats.dc), | 85 | E1000_STAT("tx_deferred_ok", stats.dc), |
@@ -684,20 +684,13 @@ static int e1000_set_ringparam(struct net_device *netdev, | |||
684 | rx_old = adapter->rx_ring; | 684 | rx_old = adapter->rx_ring; |
685 | 685 | ||
686 | err = -ENOMEM; | 686 | err = -ENOMEM; |
687 | tx_ring = kzalloc(sizeof(struct e1000_ring), GFP_KERNEL); | 687 | tx_ring = kmemdup(tx_old, sizeof(struct e1000_ring), GFP_KERNEL); |
688 | if (!tx_ring) | 688 | if (!tx_ring) |
689 | goto err_alloc_tx; | 689 | goto err_alloc_tx; |
690 | /* | ||
691 | * use a memcpy to save any previously configured | ||
692 | * items like napi structs from having to be | ||
693 | * reinitialized | ||
694 | */ | ||
695 | memcpy(tx_ring, tx_old, sizeof(struct e1000_ring)); | ||
696 | 690 | ||
697 | rx_ring = kzalloc(sizeof(struct e1000_ring), GFP_KERNEL); | 691 | rx_ring = kmemdup(rx_old, sizeof(struct e1000_ring), GFP_KERNEL); |
698 | if (!rx_ring) | 692 | if (!rx_ring) |
699 | goto err_alloc_rx; | 693 | goto err_alloc_rx; |
700 | memcpy(rx_ring, rx_old, sizeof(struct e1000_ring)); | ||
701 | 694 | ||
702 | adapter->tx_ring = tx_ring; | 695 | adapter->tx_ring = tx_ring; |
703 | adapter->rx_ring = rx_ring; | 696 | adapter->rx_ring = rx_ring; |
@@ -1255,7 +1248,6 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter) | |||
1255 | { | 1248 | { |
1256 | struct e1000_hw *hw = &adapter->hw; | 1249 | struct e1000_hw *hw = &adapter->hw; |
1257 | u32 ctrl_reg = 0; | 1250 | u32 ctrl_reg = 0; |
1258 | u32 stat_reg = 0; | ||
1259 | u16 phy_reg = 0; | 1251 | u16 phy_reg = 0; |
1260 | s32 ret_val = 0; | 1252 | s32 ret_val = 0; |
1261 | 1253 | ||
@@ -1363,8 +1355,7 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter) | |||
1363 | * Set the ILOS bit on the fiber Nic if half duplex link is | 1355 | * Set the ILOS bit on the fiber Nic if half duplex link is |
1364 | * detected. | 1356 | * detected. |
1365 | */ | 1357 | */ |
1366 | stat_reg = er32(STATUS); | 1358 | if ((er32(STATUS) & E1000_STATUS_FD) == 0) |
1367 | if ((stat_reg & E1000_STATUS_FD) == 0) | ||
1368 | ctrl_reg |= (E1000_CTRL_ILOS | E1000_CTRL_SLU); | 1359 | ctrl_reg |= (E1000_CTRL_ILOS | E1000_CTRL_SLU); |
1369 | } | 1360 | } |
1370 | 1361 | ||
@@ -1972,8 +1963,15 @@ static int e1000_set_coalesce(struct net_device *netdev, | |||
1972 | static int e1000_nway_reset(struct net_device *netdev) | 1963 | static int e1000_nway_reset(struct net_device *netdev) |
1973 | { | 1964 | { |
1974 | struct e1000_adapter *adapter = netdev_priv(netdev); | 1965 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1975 | if (netif_running(netdev)) | 1966 | |
1976 | e1000e_reinit_locked(adapter); | 1967 | if (!netif_running(netdev)) |
1968 | return -EAGAIN; | ||
1969 | |||
1970 | if (!adapter->hw.mac.autoneg) | ||
1971 | return -EINVAL; | ||
1972 | |||
1973 | e1000e_reinit_locked(adapter); | ||
1974 | |||
1977 | return 0; | 1975 | return 0; |
1978 | } | 1976 | } |
1979 | 1977 | ||
@@ -1982,14 +1980,15 @@ static void e1000_get_ethtool_stats(struct net_device *netdev, | |||
1982 | u64 *data) | 1980 | u64 *data) |
1983 | { | 1981 | { |
1984 | struct e1000_adapter *adapter = netdev_priv(netdev); | 1982 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1983 | struct rtnl_link_stats64 net_stats; | ||
1985 | int i; | 1984 | int i; |
1986 | char *p = NULL; | 1985 | char *p = NULL; |
1987 | 1986 | ||
1988 | e1000e_update_stats(adapter); | 1987 | e1000e_get_stats64(netdev, &net_stats); |
1989 | for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { | 1988 | for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { |
1990 | switch (e1000_gstrings_stats[i].type) { | 1989 | switch (e1000_gstrings_stats[i].type) { |
1991 | case NETDEV_STATS: | 1990 | case NETDEV_STATS: |
1992 | p = (char *) netdev + | 1991 | p = (char *) &net_stats + |
1993 | e1000_gstrings_stats[i].stat_offset; | 1992 | e1000_gstrings_stats[i].stat_offset; |
1994 | break; | 1993 | break; |
1995 | case E1000_STATS: | 1994 | case E1000_STATS: |
@@ -2014,7 +2013,7 @@ static void e1000_get_strings(struct net_device *netdev, u32 stringset, | |||
2014 | 2013 | ||
2015 | switch (stringset) { | 2014 | switch (stringset) { |
2016 | case ETH_SS_TEST: | 2015 | case ETH_SS_TEST: |
2017 | memcpy(data, *e1000_gstrings_test, sizeof(e1000_gstrings_test)); | 2016 | memcpy(data, e1000_gstrings_test, sizeof(e1000_gstrings_test)); |
2018 | break; | 2017 | break; |
2019 | case ETH_SS_STATS: | 2018 | case ETH_SS_STATS: |
2020 | for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { | 2019 | for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { |