diff options
-rw-r--r-- | drivers/net/e1000e/e1000.h | 5 | ||||
-rw-r--r-- | drivers/net/e1000e/ethtool.c | 52 | ||||
-rw-r--r-- | drivers/net/e1000e/ich8lan.c | 3 | ||||
-rw-r--r-- | drivers/net/e1000e/lib.c | 4 | ||||
-rw-r--r-- | drivers/net/e1000e/netdev.c | 117 | ||||
-rw-r--r-- | drivers/net/e1000e/phy.c | 8 | ||||
-rw-r--r-- | drivers/net/igb/e1000_82575.c | 1 | ||||
-rw-r--r-- | drivers/net/igb/e1000_hw.h | 1 | ||||
-rw-r--r-- | drivers/net/igb/igb_main.c | 1 |
9 files changed, 116 insertions, 76 deletions
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index e610e1369053..00bf595ebd67 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h | |||
@@ -364,6 +364,7 @@ struct e1000_adapter { | |||
364 | /* structs defined in e1000_hw.h */ | 364 | /* structs defined in e1000_hw.h */ |
365 | struct e1000_hw hw; | 365 | struct e1000_hw hw; |
366 | 366 | ||
367 | spinlock_t stats64_lock; | ||
367 | struct e1000_hw_stats stats; | 368 | struct e1000_hw_stats stats; |
368 | struct e1000_phy_info phy_info; | 369 | struct e1000_phy_info phy_info; |
369 | struct e1000_phy_stats phy_stats; | 370 | struct e1000_phy_stats phy_stats; |
@@ -494,7 +495,9 @@ extern int e1000e_setup_rx_resources(struct e1000_adapter *adapter); | |||
494 | extern int e1000e_setup_tx_resources(struct e1000_adapter *adapter); | 495 | extern int e1000e_setup_tx_resources(struct e1000_adapter *adapter); |
495 | extern void e1000e_free_rx_resources(struct e1000_adapter *adapter); | 496 | extern void e1000e_free_rx_resources(struct e1000_adapter *adapter); |
496 | extern void e1000e_free_tx_resources(struct e1000_adapter *adapter); | 497 | extern void e1000e_free_tx_resources(struct e1000_adapter *adapter); |
497 | extern void e1000e_update_stats(struct e1000_adapter *adapter); | 498 | extern struct rtnl_link_stats64 *e1000e_get_stats64(struct net_device *netdev, |
499 | struct rtnl_link_stats64 | ||
500 | *stats); | ||
498 | extern void e1000e_set_interrupt_capability(struct e1000_adapter *adapter); | 501 | extern void e1000e_set_interrupt_capability(struct e1000_adapter *adapter); |
499 | extern void e1000e_reset_interrupt_capability(struct e1000_adapter *adapter); | 502 | extern void e1000e_reset_interrupt_capability(struct e1000_adapter *adapter); |
500 | extern void e1000e_get_hw_control(struct e1000_adapter *adapter); | 503 | extern void e1000e_get_hw_control(struct e1000_adapter *adapter); |
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index fa08b6336cfb..daa7fe4b9fdd 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 | ||
@@ -1982,14 +1973,15 @@ static void e1000_get_ethtool_stats(struct net_device *netdev, | |||
1982 | u64 *data) | 1973 | u64 *data) |
1983 | { | 1974 | { |
1984 | struct e1000_adapter *adapter = netdev_priv(netdev); | 1975 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1976 | struct rtnl_link_stats64 net_stats; | ||
1985 | int i; | 1977 | int i; |
1986 | char *p = NULL; | 1978 | char *p = NULL; |
1987 | 1979 | ||
1988 | e1000e_update_stats(adapter); | 1980 | e1000e_get_stats64(netdev, &net_stats); |
1989 | for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { | 1981 | for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { |
1990 | switch (e1000_gstrings_stats[i].type) { | 1982 | switch (e1000_gstrings_stats[i].type) { |
1991 | case NETDEV_STATS: | 1983 | case NETDEV_STATS: |
1992 | p = (char *) netdev + | 1984 | p = (char *) &net_stats + |
1993 | e1000_gstrings_stats[i].stat_offset; | 1985 | e1000_gstrings_stats[i].stat_offset; |
1994 | break; | 1986 | break; |
1995 | case E1000_STATS: | 1987 | case E1000_STATS: |
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c index fb46974cfec1..232b42b7f7ce 100644 --- a/drivers/net/e1000e/ich8lan.c +++ b/drivers/net/e1000e/ich8lan.c | |||
@@ -2104,7 +2104,6 @@ static s32 e1000_flash_cycle_init_ich8lan(struct e1000_hw *hw) | |||
2104 | { | 2104 | { |
2105 | union ich8_hws_flash_status hsfsts; | 2105 | union ich8_hws_flash_status hsfsts; |
2106 | s32 ret_val = -E1000_ERR_NVM; | 2106 | s32 ret_val = -E1000_ERR_NVM; |
2107 | s32 i = 0; | ||
2108 | 2107 | ||
2109 | hsfsts.regval = er16flash(ICH_FLASH_HSFSTS); | 2108 | hsfsts.regval = er16flash(ICH_FLASH_HSFSTS); |
2110 | 2109 | ||
@@ -2140,6 +2139,8 @@ static s32 e1000_flash_cycle_init_ich8lan(struct e1000_hw *hw) | |||
2140 | ew16flash(ICH_FLASH_HSFSTS, hsfsts.regval); | 2139 | ew16flash(ICH_FLASH_HSFSTS, hsfsts.regval); |
2141 | ret_val = 0; | 2140 | ret_val = 0; |
2142 | } else { | 2141 | } else { |
2142 | s32 i = 0; | ||
2143 | |||
2143 | /* | 2144 | /* |
2144 | * Otherwise poll for sometime so the current | 2145 | * Otherwise poll for sometime so the current |
2145 | * cycle has a chance to end before giving up. | 2146 | * cycle has a chance to end before giving up. |
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c index 68aa1749bf66..96921de5df2e 100644 --- a/drivers/net/e1000e/lib.c +++ b/drivers/net/e1000e/lib.c | |||
@@ -1978,15 +1978,15 @@ static s32 e1000_ready_nvm_eeprom(struct e1000_hw *hw) | |||
1978 | { | 1978 | { |
1979 | struct e1000_nvm_info *nvm = &hw->nvm; | 1979 | struct e1000_nvm_info *nvm = &hw->nvm; |
1980 | u32 eecd = er32(EECD); | 1980 | u32 eecd = er32(EECD); |
1981 | u16 timeout = 0; | ||
1982 | u8 spi_stat_reg; | 1981 | u8 spi_stat_reg; |
1983 | 1982 | ||
1984 | if (nvm->type == e1000_nvm_eeprom_spi) { | 1983 | if (nvm->type == e1000_nvm_eeprom_spi) { |
1984 | u16 timeout = NVM_MAX_RETRY_SPI; | ||
1985 | |||
1985 | /* Clear SK and CS */ | 1986 | /* Clear SK and CS */ |
1986 | eecd &= ~(E1000_EECD_CS | E1000_EECD_SK); | 1987 | eecd &= ~(E1000_EECD_CS | E1000_EECD_SK); |
1987 | ew32(EECD, eecd); | 1988 | ew32(EECD, eecd); |
1988 | udelay(1); | 1989 | udelay(1); |
1989 | timeout = NVM_MAX_RETRY_SPI; | ||
1990 | 1990 | ||
1991 | /* | 1991 | /* |
1992 | * Read "Status Register" repeatedly until the LSB is cleared. | 1992 | * Read "Status Register" repeatedly until the LSB is cleared. |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 1c18f26b0812..5b916b01805f 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -900,8 +900,6 @@ next_desc: | |||
900 | 900 | ||
901 | adapter->total_rx_bytes += total_rx_bytes; | 901 | adapter->total_rx_bytes += total_rx_bytes; |
902 | adapter->total_rx_packets += total_rx_packets; | 902 | adapter->total_rx_packets += total_rx_packets; |
903 | netdev->stats.rx_bytes += total_rx_bytes; | ||
904 | netdev->stats.rx_packets += total_rx_packets; | ||
905 | return cleaned; | 903 | return cleaned; |
906 | } | 904 | } |
907 | 905 | ||
@@ -1057,8 +1055,6 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter) | |||
1057 | } | 1055 | } |
1058 | adapter->total_tx_bytes += total_tx_bytes; | 1056 | adapter->total_tx_bytes += total_tx_bytes; |
1059 | adapter->total_tx_packets += total_tx_packets; | 1057 | adapter->total_tx_packets += total_tx_packets; |
1060 | netdev->stats.tx_bytes += total_tx_bytes; | ||
1061 | netdev->stats.tx_packets += total_tx_packets; | ||
1062 | return count < tx_ring->count; | 1058 | return count < tx_ring->count; |
1063 | } | 1059 | } |
1064 | 1060 | ||
@@ -1245,8 +1241,6 @@ next_desc: | |||
1245 | 1241 | ||
1246 | adapter->total_rx_bytes += total_rx_bytes; | 1242 | adapter->total_rx_bytes += total_rx_bytes; |
1247 | adapter->total_rx_packets += total_rx_packets; | 1243 | adapter->total_rx_packets += total_rx_packets; |
1248 | netdev->stats.rx_bytes += total_rx_bytes; | ||
1249 | netdev->stats.rx_packets += total_rx_packets; | ||
1250 | return cleaned; | 1244 | return cleaned; |
1251 | } | 1245 | } |
1252 | 1246 | ||
@@ -1426,8 +1420,6 @@ next_desc: | |||
1426 | 1420 | ||
1427 | adapter->total_rx_bytes += total_rx_bytes; | 1421 | adapter->total_rx_bytes += total_rx_bytes; |
1428 | adapter->total_rx_packets += total_rx_packets; | 1422 | adapter->total_rx_packets += total_rx_packets; |
1429 | netdev->stats.rx_bytes += total_rx_bytes; | ||
1430 | netdev->stats.rx_packets += total_rx_packets; | ||
1431 | return cleaned; | 1423 | return cleaned; |
1432 | } | 1424 | } |
1433 | 1425 | ||
@@ -2728,7 +2720,6 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter) | |||
2728 | { | 2720 | { |
2729 | struct e1000_hw *hw = &adapter->hw; | 2721 | struct e1000_hw *hw = &adapter->hw; |
2730 | u32 rctl, rfctl; | 2722 | u32 rctl, rfctl; |
2731 | u32 psrctl = 0; | ||
2732 | u32 pages = 0; | 2723 | u32 pages = 0; |
2733 | 2724 | ||
2734 | /* Workaround Si errata on 82579 - configure jumbo frame flow */ | 2725 | /* Workaround Si errata on 82579 - configure jumbo frame flow */ |
@@ -2827,6 +2818,8 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter) | |||
2827 | adapter->rx_ps_pages = 0; | 2818 | adapter->rx_ps_pages = 0; |
2828 | 2819 | ||
2829 | if (adapter->rx_ps_pages) { | 2820 | if (adapter->rx_ps_pages) { |
2821 | u32 psrctl = 0; | ||
2822 | |||
2830 | /* Configure extra packet-split registers */ | 2823 | /* Configure extra packet-split registers */ |
2831 | rfctl = er32(RFCTL); | 2824 | rfctl = er32(RFCTL); |
2832 | rfctl |= E1000_RFCTL_EXTEN; | 2825 | rfctl |= E1000_RFCTL_EXTEN; |
@@ -3028,7 +3021,6 @@ static void e1000_set_multi(struct net_device *netdev) | |||
3028 | struct netdev_hw_addr *ha; | 3021 | struct netdev_hw_addr *ha; |
3029 | u8 *mta_list; | 3022 | u8 *mta_list; |
3030 | u32 rctl; | 3023 | u32 rctl; |
3031 | int i; | ||
3032 | 3024 | ||
3033 | /* Check for Promiscuous and All Multicast modes */ | 3025 | /* Check for Promiscuous and All Multicast modes */ |
3034 | 3026 | ||
@@ -3051,12 +3043,13 @@ static void e1000_set_multi(struct net_device *netdev) | |||
3051 | ew32(RCTL, rctl); | 3043 | ew32(RCTL, rctl); |
3052 | 3044 | ||
3053 | if (!netdev_mc_empty(netdev)) { | 3045 | if (!netdev_mc_empty(netdev)) { |
3046 | int i = 0; | ||
3047 | |||
3054 | mta_list = kmalloc(netdev_mc_count(netdev) * 6, GFP_ATOMIC); | 3048 | mta_list = kmalloc(netdev_mc_count(netdev) * 6, GFP_ATOMIC); |
3055 | if (!mta_list) | 3049 | if (!mta_list) |
3056 | return; | 3050 | return; |
3057 | 3051 | ||
3058 | /* prepare a packed array of only addresses. */ | 3052 | /* prepare a packed array of only addresses. */ |
3059 | i = 0; | ||
3060 | netdev_for_each_mc_addr(ha, netdev) | 3053 | netdev_for_each_mc_addr(ha, netdev) |
3061 | memcpy(mta_list + (i++ * ETH_ALEN), ha->addr, ETH_ALEN); | 3054 | memcpy(mta_list + (i++ * ETH_ALEN), ha->addr, ETH_ALEN); |
3062 | 3055 | ||
@@ -3338,6 +3331,8 @@ int e1000e_up(struct e1000_adapter *adapter) | |||
3338 | return 0; | 3331 | return 0; |
3339 | } | 3332 | } |
3340 | 3333 | ||
3334 | static void e1000e_update_stats(struct e1000_adapter *adapter); | ||
3335 | |||
3341 | void e1000e_down(struct e1000_adapter *adapter) | 3336 | void e1000e_down(struct e1000_adapter *adapter) |
3342 | { | 3337 | { |
3343 | struct net_device *netdev = adapter->netdev; | 3338 | struct net_device *netdev = adapter->netdev; |
@@ -3372,6 +3367,11 @@ void e1000e_down(struct e1000_adapter *adapter) | |||
3372 | del_timer_sync(&adapter->phy_info_timer); | 3367 | del_timer_sync(&adapter->phy_info_timer); |
3373 | 3368 | ||
3374 | netif_carrier_off(netdev); | 3369 | netif_carrier_off(netdev); |
3370 | |||
3371 | spin_lock(&adapter->stats64_lock); | ||
3372 | e1000e_update_stats(adapter); | ||
3373 | spin_unlock(&adapter->stats64_lock); | ||
3374 | |||
3375 | adapter->link_speed = 0; | 3375 | adapter->link_speed = 0; |
3376 | adapter->link_duplex = 0; | 3376 | adapter->link_duplex = 0; |
3377 | 3377 | ||
@@ -3413,6 +3413,8 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter) | |||
3413 | adapter->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; | 3413 | adapter->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; |
3414 | adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN; | 3414 | adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN; |
3415 | 3415 | ||
3416 | spin_lock_init(&adapter->stats64_lock); | ||
3417 | |||
3416 | e1000e_set_interrupt_capability(adapter); | 3418 | e1000e_set_interrupt_capability(adapter); |
3417 | 3419 | ||
3418 | if (e1000_alloc_queues(adapter)) | 3420 | if (e1000_alloc_queues(adapter)) |
@@ -3886,7 +3888,7 @@ release: | |||
3886 | * e1000e_update_stats - Update the board statistics counters | 3888 | * e1000e_update_stats - Update the board statistics counters |
3887 | * @adapter: board private structure | 3889 | * @adapter: board private structure |
3888 | **/ | 3890 | **/ |
3889 | void e1000e_update_stats(struct e1000_adapter *adapter) | 3891 | static void e1000e_update_stats(struct e1000_adapter *adapter) |
3890 | { | 3892 | { |
3891 | struct net_device *netdev = adapter->netdev; | 3893 | struct net_device *netdev = adapter->netdev; |
3892 | struct e1000_hw *hw = &adapter->hw; | 3894 | struct e1000_hw *hw = &adapter->hw; |
@@ -3998,10 +4000,11 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter) | |||
3998 | { | 4000 | { |
3999 | struct e1000_hw *hw = &adapter->hw; | 4001 | struct e1000_hw *hw = &adapter->hw; |
4000 | struct e1000_phy_regs *phy = &adapter->phy_regs; | 4002 | struct e1000_phy_regs *phy = &adapter->phy_regs; |
4001 | int ret_val; | ||
4002 | 4003 | ||
4003 | if ((er32(STATUS) & E1000_STATUS_LU) && | 4004 | if ((er32(STATUS) & E1000_STATUS_LU) && |
4004 | (adapter->hw.phy.media_type == e1000_media_type_copper)) { | 4005 | (adapter->hw.phy.media_type == e1000_media_type_copper)) { |
4006 | int ret_val; | ||
4007 | |||
4005 | ret_val = e1e_rphy(hw, PHY_CONTROL, &phy->bmcr); | 4008 | ret_val = e1e_rphy(hw, PHY_CONTROL, &phy->bmcr); |
4006 | ret_val |= e1e_rphy(hw, PHY_STATUS, &phy->bmsr); | 4009 | ret_val |= e1e_rphy(hw, PHY_STATUS, &phy->bmsr); |
4007 | ret_val |= e1e_rphy(hw, PHY_AUTONEG_ADV, &phy->advertise); | 4010 | ret_val |= e1e_rphy(hw, PHY_AUTONEG_ADV, &phy->advertise); |
@@ -4147,7 +4150,6 @@ static void e1000_watchdog_task(struct work_struct *work) | |||
4147 | struct e1000_ring *tx_ring = adapter->tx_ring; | 4150 | struct e1000_ring *tx_ring = adapter->tx_ring; |
4148 | struct e1000_hw *hw = &adapter->hw; | 4151 | struct e1000_hw *hw = &adapter->hw; |
4149 | u32 link, tctl; | 4152 | u32 link, tctl; |
4150 | int tx_pending = 0; | ||
4151 | 4153 | ||
4152 | link = e1000e_has_link(adapter); | 4154 | link = e1000e_has_link(adapter); |
4153 | if ((netif_carrier_ok(netdev)) && link) { | 4155 | if ((netif_carrier_ok(netdev)) && link) { |
@@ -4285,7 +4287,9 @@ static void e1000_watchdog_task(struct work_struct *work) | |||
4285 | } | 4287 | } |
4286 | 4288 | ||
4287 | link_up: | 4289 | link_up: |
4290 | spin_lock(&adapter->stats64_lock); | ||
4288 | e1000e_update_stats(adapter); | 4291 | e1000e_update_stats(adapter); |
4292 | spin_unlock(&adapter->stats64_lock); | ||
4289 | 4293 | ||
4290 | mac->tx_packet_delta = adapter->stats.tpt - adapter->tpt_old; | 4294 | mac->tx_packet_delta = adapter->stats.tpt - adapter->tpt_old; |
4291 | adapter->tpt_old = adapter->stats.tpt; | 4295 | adapter->tpt_old = adapter->stats.tpt; |
@@ -4299,21 +4303,18 @@ link_up: | |||
4299 | 4303 | ||
4300 | e1000e_update_adaptive(&adapter->hw); | 4304 | e1000e_update_adaptive(&adapter->hw); |
4301 | 4305 | ||
4302 | if (!netif_carrier_ok(netdev)) { | 4306 | if (!netif_carrier_ok(netdev) && |
4303 | tx_pending = (e1000_desc_unused(tx_ring) + 1 < | 4307 | (e1000_desc_unused(tx_ring) + 1 < tx_ring->count)) { |
4304 | tx_ring->count); | 4308 | /* |
4305 | if (tx_pending) { | 4309 | * We've lost link, so the controller stops DMA, |
4306 | /* | 4310 | * but we've got queued Tx work that's never going |
4307 | * We've lost link, so the controller stops DMA, | 4311 | * to get done, so reset controller to flush Tx. |
4308 | * but we've got queued Tx work that's never going | 4312 | * (Do the reset outside of interrupt context). |
4309 | * to get done, so reset controller to flush Tx. | 4313 | */ |
4310 | * (Do the reset outside of interrupt context). | 4314 | adapter->tx_timeout_count++; |
4311 | */ | 4315 | schedule_work(&adapter->reset_task); |
4312 | adapter->tx_timeout_count++; | 4316 | /* return immediately since reset is imminent */ |
4313 | schedule_work(&adapter->reset_task); | 4317 | return; |
4314 | /* return immediately since reset is imminent */ | ||
4315 | return; | ||
4316 | } | ||
4317 | } | 4318 | } |
4318 | 4319 | ||
4319 | /* Simple mode for Interrupt Throttle Rate (ITR) */ | 4320 | /* Simple mode for Interrupt Throttle Rate (ITR) */ |
@@ -4384,13 +4385,13 @@ static int e1000_tso(struct e1000_adapter *adapter, | |||
4384 | u32 cmd_length = 0; | 4385 | u32 cmd_length = 0; |
4385 | u16 ipcse = 0, tucse, mss; | 4386 | u16 ipcse = 0, tucse, mss; |
4386 | u8 ipcss, ipcso, tucss, tucso, hdr_len; | 4387 | u8 ipcss, ipcso, tucss, tucso, hdr_len; |
4387 | int err; | ||
4388 | 4388 | ||
4389 | if (!skb_is_gso(skb)) | 4389 | if (!skb_is_gso(skb)) |
4390 | return 0; | 4390 | return 0; |
4391 | 4391 | ||
4392 | if (skb_header_cloned(skb)) { | 4392 | if (skb_header_cloned(skb)) { |
4393 | err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC); | 4393 | int err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC); |
4394 | |||
4394 | if (err) | 4395 | if (err) |
4395 | return err; | 4396 | return err; |
4396 | } | 4397 | } |
@@ -4897,16 +4898,55 @@ static void e1000_reset_task(struct work_struct *work) | |||
4897 | } | 4898 | } |
4898 | 4899 | ||
4899 | /** | 4900 | /** |
4900 | * e1000_get_stats - Get System Network Statistics | 4901 | * e1000_get_stats64 - Get System Network Statistics |
4901 | * @netdev: network interface device structure | 4902 | * @netdev: network interface device structure |
4903 | * @stats: rtnl_link_stats64 pointer | ||
4902 | * | 4904 | * |
4903 | * Returns the address of the device statistics structure. | 4905 | * Returns the address of the device statistics structure. |
4904 | * The statistics are actually updated from the timer callback. | ||
4905 | **/ | 4906 | **/ |
4906 | static struct net_device_stats *e1000_get_stats(struct net_device *netdev) | 4907 | struct rtnl_link_stats64 *e1000e_get_stats64(struct net_device *netdev, |
4908 | struct rtnl_link_stats64 *stats) | ||
4907 | { | 4909 | { |
4908 | /* only return the current stats */ | 4910 | struct e1000_adapter *adapter = netdev_priv(netdev); |
4909 | return &netdev->stats; | 4911 | |
4912 | memset(stats, 0, sizeof(struct rtnl_link_stats64)); | ||
4913 | spin_lock(&adapter->stats64_lock); | ||
4914 | e1000e_update_stats(adapter); | ||
4915 | /* Fill out the OS statistics structure */ | ||
4916 | stats->rx_bytes = adapter->stats.gorc; | ||
4917 | stats->rx_packets = adapter->stats.gprc; | ||
4918 | stats->tx_bytes = adapter->stats.gotc; | ||
4919 | stats->tx_packets = adapter->stats.gptc; | ||
4920 | stats->multicast = adapter->stats.mprc; | ||
4921 | stats->collisions = adapter->stats.colc; | ||
4922 | |||
4923 | /* Rx Errors */ | ||
4924 | |||
4925 | /* | ||
4926 | * RLEC on some newer hardware can be incorrect so build | ||
4927 | * our own version based on RUC and ROC | ||
4928 | */ | ||
4929 | stats->rx_errors = adapter->stats.rxerrc + | ||
4930 | adapter->stats.crcerrs + adapter->stats.algnerrc + | ||
4931 | adapter->stats.ruc + adapter->stats.roc + | ||
4932 | adapter->stats.cexterr; | ||
4933 | stats->rx_length_errors = adapter->stats.ruc + | ||
4934 | adapter->stats.roc; | ||
4935 | stats->rx_crc_errors = adapter->stats.crcerrs; | ||
4936 | stats->rx_frame_errors = adapter->stats.algnerrc; | ||
4937 | stats->rx_missed_errors = adapter->stats.mpc; | ||
4938 | |||
4939 | /* Tx Errors */ | ||
4940 | stats->tx_errors = adapter->stats.ecol + | ||
4941 | adapter->stats.latecol; | ||
4942 | stats->tx_aborted_errors = adapter->stats.ecol; | ||
4943 | stats->tx_window_errors = adapter->stats.latecol; | ||
4944 | stats->tx_carrier_errors = adapter->stats.tncrs; | ||
4945 | |||
4946 | /* Tx Dropped needs to be maintained elsewhere */ | ||
4947 | |||
4948 | spin_unlock(&adapter->stats64_lock); | ||
4949 | return stats; | ||
4910 | } | 4950 | } |
4911 | 4951 | ||
4912 | /** | 4952 | /** |
@@ -5476,9 +5516,10 @@ static irqreturn_t e1000_intr_msix(int irq, void *data) | |||
5476 | { | 5516 | { |
5477 | struct net_device *netdev = data; | 5517 | struct net_device *netdev = data; |
5478 | struct e1000_adapter *adapter = netdev_priv(netdev); | 5518 | struct e1000_adapter *adapter = netdev_priv(netdev); |
5479 | int vector, msix_irq; | ||
5480 | 5519 | ||
5481 | if (adapter->msix_entries) { | 5520 | if (adapter->msix_entries) { |
5521 | int vector, msix_irq; | ||
5522 | |||
5482 | vector = 0; | 5523 | vector = 0; |
5483 | msix_irq = adapter->msix_entries[vector].vector; | 5524 | msix_irq = adapter->msix_entries[vector].vector; |
5484 | disable_irq(msix_irq); | 5525 | disable_irq(msix_irq); |
@@ -5675,7 +5716,7 @@ static const struct net_device_ops e1000e_netdev_ops = { | |||
5675 | .ndo_open = e1000_open, | 5716 | .ndo_open = e1000_open, |
5676 | .ndo_stop = e1000_close, | 5717 | .ndo_stop = e1000_close, |
5677 | .ndo_start_xmit = e1000_xmit_frame, | 5718 | .ndo_start_xmit = e1000_xmit_frame, |
5678 | .ndo_get_stats = e1000_get_stats, | 5719 | .ndo_get_stats64 = e1000e_get_stats64, |
5679 | .ndo_set_multicast_list = e1000_set_multi, | 5720 | .ndo_set_multicast_list = e1000_set_multi, |
5680 | .ndo_set_mac_address = e1000_set_mac, | 5721 | .ndo_set_mac_address = e1000_set_mac, |
5681 | .ndo_change_mtu = e1000_change_mtu, | 5722 | .ndo_change_mtu = e1000_change_mtu, |
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c index 6bea051b134b..6ae31fcfb629 100644 --- a/drivers/net/e1000e/phy.c +++ b/drivers/net/e1000e/phy.c | |||
@@ -2409,9 +2409,7 @@ static u32 e1000_get_phy_addr_for_bm_page(u32 page, u32 reg) | |||
2409 | s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data) | 2409 | s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data) |
2410 | { | 2410 | { |
2411 | s32 ret_val; | 2411 | s32 ret_val; |
2412 | u32 page_select = 0; | ||
2413 | u32 page = offset >> IGP_PAGE_SHIFT; | 2412 | u32 page = offset >> IGP_PAGE_SHIFT; |
2414 | u32 page_shift = 0; | ||
2415 | 2413 | ||
2416 | ret_val = hw->phy.ops.acquire(hw); | 2414 | ret_val = hw->phy.ops.acquire(hw); |
2417 | if (ret_val) | 2415 | if (ret_val) |
@@ -2427,6 +2425,8 @@ s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data) | |||
2427 | hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); | 2425 | hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); |
2428 | 2426 | ||
2429 | if (offset > MAX_PHY_MULTI_PAGE_REG) { | 2427 | if (offset > MAX_PHY_MULTI_PAGE_REG) { |
2428 | u32 page_shift, page_select; | ||
2429 | |||
2430 | /* | 2430 | /* |
2431 | * Page select is register 31 for phy address 1 and 22 for | 2431 | * Page select is register 31 for phy address 1 and 22 for |
2432 | * phy address 2 and 3. Page select is shifted only for | 2432 | * phy address 2 and 3. Page select is shifted only for |
@@ -2468,9 +2468,7 @@ out: | |||
2468 | s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data) | 2468 | s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data) |
2469 | { | 2469 | { |
2470 | s32 ret_val; | 2470 | s32 ret_val; |
2471 | u32 page_select = 0; | ||
2472 | u32 page = offset >> IGP_PAGE_SHIFT; | 2471 | u32 page = offset >> IGP_PAGE_SHIFT; |
2473 | u32 page_shift = 0; | ||
2474 | 2472 | ||
2475 | ret_val = hw->phy.ops.acquire(hw); | 2473 | ret_val = hw->phy.ops.acquire(hw); |
2476 | if (ret_val) | 2474 | if (ret_val) |
@@ -2486,6 +2484,8 @@ s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data) | |||
2486 | hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); | 2484 | hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); |
2487 | 2485 | ||
2488 | if (offset > MAX_PHY_MULTI_PAGE_REG) { | 2486 | if (offset > MAX_PHY_MULTI_PAGE_REG) { |
2487 | u32 page_shift, page_select; | ||
2488 | |||
2489 | /* | 2489 | /* |
2490 | * Page select is register 31 for phy address 1 and 22 for | 2490 | * Page select is register 31 for phy address 1 and 22 for |
2491 | * phy address 2 and 3. Page select is shifted only for | 2491 | * phy address 2 and 3. Page select is shifted only for |
diff --git a/drivers/net/igb/e1000_82575.c b/drivers/net/igb/e1000_82575.c index 0a2368fa6bc6..c1552b6f4a68 100644 --- a/drivers/net/igb/e1000_82575.c +++ b/drivers/net/igb/e1000_82575.c | |||
@@ -129,6 +129,7 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw) | |||
129 | break; | 129 | break; |
130 | case E1000_DEV_ID_82580_COPPER: | 130 | case E1000_DEV_ID_82580_COPPER: |
131 | case E1000_DEV_ID_82580_FIBER: | 131 | case E1000_DEV_ID_82580_FIBER: |
132 | case E1000_DEV_ID_82580_QUAD_FIBER: | ||
132 | case E1000_DEV_ID_82580_SERDES: | 133 | case E1000_DEV_ID_82580_SERDES: |
133 | case E1000_DEV_ID_82580_SGMII: | 134 | case E1000_DEV_ID_82580_SGMII: |
134 | case E1000_DEV_ID_82580_COPPER_DUAL: | 135 | case E1000_DEV_ID_82580_COPPER_DUAL: |
diff --git a/drivers/net/igb/e1000_hw.h b/drivers/net/igb/e1000_hw.h index e2638afb8cdc..281324e85980 100644 --- a/drivers/net/igb/e1000_hw.h +++ b/drivers/net/igb/e1000_hw.h | |||
@@ -54,6 +54,7 @@ struct e1000_hw; | |||
54 | #define E1000_DEV_ID_82580_SERDES 0x1510 | 54 | #define E1000_DEV_ID_82580_SERDES 0x1510 |
55 | #define E1000_DEV_ID_82580_SGMII 0x1511 | 55 | #define E1000_DEV_ID_82580_SGMII 0x1511 |
56 | #define E1000_DEV_ID_82580_COPPER_DUAL 0x1516 | 56 | #define E1000_DEV_ID_82580_COPPER_DUAL 0x1516 |
57 | #define E1000_DEV_ID_82580_QUAD_FIBER 0x1527 | ||
57 | #define E1000_DEV_ID_DH89XXCC_SGMII 0x0438 | 58 | #define E1000_DEV_ID_DH89XXCC_SGMII 0x0438 |
58 | #define E1000_DEV_ID_DH89XXCC_SERDES 0x043A | 59 | #define E1000_DEV_ID_DH89XXCC_SERDES 0x043A |
59 | #define E1000_DEV_ID_DH89XXCC_BACKPLANE 0x043C | 60 | #define E1000_DEV_ID_DH89XXCC_BACKPLANE 0x043C |
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index 58c665b7513d..200cc3209672 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c | |||
@@ -68,6 +68,7 @@ static DEFINE_PCI_DEVICE_TABLE(igb_pci_tbl) = { | |||
68 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_I350_SGMII), board_82575 }, | 68 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_I350_SGMII), board_82575 }, |
69 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_COPPER), board_82575 }, | 69 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_COPPER), board_82575 }, |
70 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_FIBER), board_82575 }, | 70 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_FIBER), board_82575 }, |
71 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_QUAD_FIBER), board_82575 }, | ||
71 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_SERDES), board_82575 }, | 72 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_SERDES), board_82575 }, |
72 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_SGMII), board_82575 }, | 73 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_SGMII), board_82575 }, |
73 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_COPPER_DUAL), board_82575 }, | 74 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_COPPER_DUAL), board_82575 }, |