diff options
Diffstat (limited to 'drivers/net/e1000e/netdev.c')
-rw-r--r-- | drivers/net/e1000e/netdev.c | 176 |
1 files changed, 126 insertions, 50 deletions
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 1c18f26b0812..ec0b803c501e 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 | ||
@@ -937,6 +935,9 @@ static void e1000_print_hw_hang(struct work_struct *work) | |||
937 | u16 phy_status, phy_1000t_status, phy_ext_status; | 935 | u16 phy_status, phy_1000t_status, phy_ext_status; |
938 | u16 pci_status; | 936 | u16 pci_status; |
939 | 937 | ||
938 | if (test_bit(__E1000_DOWN, &adapter->state)) | ||
939 | return; | ||
940 | |||
940 | e1e_rphy(hw, PHY_STATUS, &phy_status); | 941 | e1e_rphy(hw, PHY_STATUS, &phy_status); |
941 | e1e_rphy(hw, PHY_1000T_STATUS, &phy_1000t_status); | 942 | e1e_rphy(hw, PHY_1000T_STATUS, &phy_1000t_status); |
942 | e1e_rphy(hw, PHY_EXT_STATUS, &phy_ext_status); | 943 | e1e_rphy(hw, PHY_EXT_STATUS, &phy_ext_status); |
@@ -1057,8 +1058,6 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter) | |||
1057 | } | 1058 | } |
1058 | adapter->total_tx_bytes += total_tx_bytes; | 1059 | adapter->total_tx_bytes += total_tx_bytes; |
1059 | adapter->total_tx_packets += total_tx_packets; | 1060 | 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; | 1061 | return count < tx_ring->count; |
1063 | } | 1062 | } |
1064 | 1063 | ||
@@ -1245,8 +1244,6 @@ next_desc: | |||
1245 | 1244 | ||
1246 | adapter->total_rx_bytes += total_rx_bytes; | 1245 | adapter->total_rx_bytes += total_rx_bytes; |
1247 | adapter->total_rx_packets += total_rx_packets; | 1246 | 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; | 1247 | return cleaned; |
1251 | } | 1248 | } |
1252 | 1249 | ||
@@ -1426,8 +1423,6 @@ next_desc: | |||
1426 | 1423 | ||
1427 | adapter->total_rx_bytes += total_rx_bytes; | 1424 | adapter->total_rx_bytes += total_rx_bytes; |
1428 | adapter->total_rx_packets += total_rx_packets; | 1425 | 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; | 1426 | return cleaned; |
1432 | } | 1427 | } |
1433 | 1428 | ||
@@ -1506,6 +1501,9 @@ static void e1000e_downshift_workaround(struct work_struct *work) | |||
1506 | struct e1000_adapter *adapter = container_of(work, | 1501 | struct e1000_adapter *adapter = container_of(work, |
1507 | struct e1000_adapter, downshift_task); | 1502 | struct e1000_adapter, downshift_task); |
1508 | 1503 | ||
1504 | if (test_bit(__E1000_DOWN, &adapter->state)) | ||
1505 | return; | ||
1506 | |||
1509 | e1000e_gig_downshift_workaround_ich8lan(&adapter->hw); | 1507 | e1000e_gig_downshift_workaround_ich8lan(&adapter->hw); |
1510 | } | 1508 | } |
1511 | 1509 | ||
@@ -1851,7 +1849,9 @@ static int e1000_request_msix(struct e1000_adapter *adapter) | |||
1851 | int err = 0, vector = 0; | 1849 | int err = 0, vector = 0; |
1852 | 1850 | ||
1853 | if (strlen(netdev->name) < (IFNAMSIZ - 5)) | 1851 | if (strlen(netdev->name) < (IFNAMSIZ - 5)) |
1854 | sprintf(adapter->rx_ring->name, "%s-rx-0", netdev->name); | 1852 | snprintf(adapter->rx_ring->name, |
1853 | sizeof(adapter->rx_ring->name) - 1, | ||
1854 | "%s-rx-0", netdev->name); | ||
1855 | else | 1855 | else |
1856 | memcpy(adapter->rx_ring->name, netdev->name, IFNAMSIZ); | 1856 | memcpy(adapter->rx_ring->name, netdev->name, IFNAMSIZ); |
1857 | err = request_irq(adapter->msix_entries[vector].vector, | 1857 | err = request_irq(adapter->msix_entries[vector].vector, |
@@ -1864,7 +1864,9 @@ static int e1000_request_msix(struct e1000_adapter *adapter) | |||
1864 | vector++; | 1864 | vector++; |
1865 | 1865 | ||
1866 | if (strlen(netdev->name) < (IFNAMSIZ - 5)) | 1866 | if (strlen(netdev->name) < (IFNAMSIZ - 5)) |
1867 | sprintf(adapter->tx_ring->name, "%s-tx-0", netdev->name); | 1867 | snprintf(adapter->tx_ring->name, |
1868 | sizeof(adapter->tx_ring->name) - 1, | ||
1869 | "%s-tx-0", netdev->name); | ||
1868 | else | 1870 | else |
1869 | memcpy(adapter->tx_ring->name, netdev->name, IFNAMSIZ); | 1871 | memcpy(adapter->tx_ring->name, netdev->name, IFNAMSIZ); |
1870 | err = request_irq(adapter->msix_entries[vector].vector, | 1872 | err = request_irq(adapter->msix_entries[vector].vector, |
@@ -2728,7 +2730,6 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter) | |||
2728 | { | 2730 | { |
2729 | struct e1000_hw *hw = &adapter->hw; | 2731 | struct e1000_hw *hw = &adapter->hw; |
2730 | u32 rctl, rfctl; | 2732 | u32 rctl, rfctl; |
2731 | u32 psrctl = 0; | ||
2732 | u32 pages = 0; | 2733 | u32 pages = 0; |
2733 | 2734 | ||
2734 | /* Workaround Si errata on 82579 - configure jumbo frame flow */ | 2735 | /* Workaround Si errata on 82579 - configure jumbo frame flow */ |
@@ -2827,6 +2828,8 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter) | |||
2827 | adapter->rx_ps_pages = 0; | 2828 | adapter->rx_ps_pages = 0; |
2828 | 2829 | ||
2829 | if (adapter->rx_ps_pages) { | 2830 | if (adapter->rx_ps_pages) { |
2831 | u32 psrctl = 0; | ||
2832 | |||
2830 | /* Configure extra packet-split registers */ | 2833 | /* Configure extra packet-split registers */ |
2831 | rfctl = er32(RFCTL); | 2834 | rfctl = er32(RFCTL); |
2832 | rfctl |= E1000_RFCTL_EXTEN; | 2835 | rfctl |= E1000_RFCTL_EXTEN; |
@@ -3028,7 +3031,6 @@ static void e1000_set_multi(struct net_device *netdev) | |||
3028 | struct netdev_hw_addr *ha; | 3031 | struct netdev_hw_addr *ha; |
3029 | u8 *mta_list; | 3032 | u8 *mta_list; |
3030 | u32 rctl; | 3033 | u32 rctl; |
3031 | int i; | ||
3032 | 3034 | ||
3033 | /* Check for Promiscuous and All Multicast modes */ | 3035 | /* Check for Promiscuous and All Multicast modes */ |
3034 | 3036 | ||
@@ -3051,12 +3053,13 @@ static void e1000_set_multi(struct net_device *netdev) | |||
3051 | ew32(RCTL, rctl); | 3053 | ew32(RCTL, rctl); |
3052 | 3054 | ||
3053 | if (!netdev_mc_empty(netdev)) { | 3055 | if (!netdev_mc_empty(netdev)) { |
3056 | int i = 0; | ||
3057 | |||
3054 | mta_list = kmalloc(netdev_mc_count(netdev) * 6, GFP_ATOMIC); | 3058 | mta_list = kmalloc(netdev_mc_count(netdev) * 6, GFP_ATOMIC); |
3055 | if (!mta_list) | 3059 | if (!mta_list) |
3056 | return; | 3060 | return; |
3057 | 3061 | ||
3058 | /* prepare a packed array of only addresses. */ | 3062 | /* prepare a packed array of only addresses. */ |
3059 | i = 0; | ||
3060 | netdev_for_each_mc_addr(ha, netdev) | 3063 | netdev_for_each_mc_addr(ha, netdev) |
3061 | memcpy(mta_list + (i++ * ETH_ALEN), ha->addr, ETH_ALEN); | 3064 | memcpy(mta_list + (i++ * ETH_ALEN), ha->addr, ETH_ALEN); |
3062 | 3065 | ||
@@ -3338,6 +3341,23 @@ int e1000e_up(struct e1000_adapter *adapter) | |||
3338 | return 0; | 3341 | return 0; |
3339 | } | 3342 | } |
3340 | 3343 | ||
3344 | static void e1000e_flush_descriptors(struct e1000_adapter *adapter) | ||
3345 | { | ||
3346 | struct e1000_hw *hw = &adapter->hw; | ||
3347 | |||
3348 | if (!(adapter->flags2 & FLAG2_DMA_BURST)) | ||
3349 | return; | ||
3350 | |||
3351 | /* flush pending descriptor writebacks to memory */ | ||
3352 | ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD); | ||
3353 | ew32(RDTR, adapter->rx_int_delay | E1000_RDTR_FPD); | ||
3354 | |||
3355 | /* execute the writes immediately */ | ||
3356 | e1e_flush(); | ||
3357 | } | ||
3358 | |||
3359 | static void e1000e_update_stats(struct e1000_adapter *adapter); | ||
3360 | |||
3341 | void e1000e_down(struct e1000_adapter *adapter) | 3361 | void e1000e_down(struct e1000_adapter *adapter) |
3342 | { | 3362 | { |
3343 | struct net_device *netdev = adapter->netdev; | 3363 | struct net_device *netdev = adapter->netdev; |
@@ -3372,11 +3392,19 @@ void e1000e_down(struct e1000_adapter *adapter) | |||
3372 | del_timer_sync(&adapter->phy_info_timer); | 3392 | del_timer_sync(&adapter->phy_info_timer); |
3373 | 3393 | ||
3374 | netif_carrier_off(netdev); | 3394 | netif_carrier_off(netdev); |
3395 | |||
3396 | spin_lock(&adapter->stats64_lock); | ||
3397 | e1000e_update_stats(adapter); | ||
3398 | spin_unlock(&adapter->stats64_lock); | ||
3399 | |||
3375 | adapter->link_speed = 0; | 3400 | adapter->link_speed = 0; |
3376 | adapter->link_duplex = 0; | 3401 | adapter->link_duplex = 0; |
3377 | 3402 | ||
3378 | if (!pci_channel_offline(adapter->pdev)) | 3403 | if (!pci_channel_offline(adapter->pdev)) |
3379 | e1000e_reset(adapter); | 3404 | e1000e_reset(adapter); |
3405 | |||
3406 | e1000e_flush_descriptors(adapter); | ||
3407 | |||
3380 | e1000_clean_tx_ring(adapter); | 3408 | e1000_clean_tx_ring(adapter); |
3381 | e1000_clean_rx_ring(adapter); | 3409 | e1000_clean_rx_ring(adapter); |
3382 | 3410 | ||
@@ -3413,6 +3441,8 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter) | |||
3413 | adapter->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; | 3441 | adapter->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; |
3414 | adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN; | 3442 | adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN; |
3415 | 3443 | ||
3444 | spin_lock_init(&adapter->stats64_lock); | ||
3445 | |||
3416 | e1000e_set_interrupt_capability(adapter); | 3446 | e1000e_set_interrupt_capability(adapter); |
3417 | 3447 | ||
3418 | if (e1000_alloc_queues(adapter)) | 3448 | if (e1000_alloc_queues(adapter)) |
@@ -3765,6 +3795,10 @@ static void e1000e_update_phy_task(struct work_struct *work) | |||
3765 | { | 3795 | { |
3766 | struct e1000_adapter *adapter = container_of(work, | 3796 | struct e1000_adapter *adapter = container_of(work, |
3767 | struct e1000_adapter, update_phy_task); | 3797 | struct e1000_adapter, update_phy_task); |
3798 | |||
3799 | if (test_bit(__E1000_DOWN, &adapter->state)) | ||
3800 | return; | ||
3801 | |||
3768 | e1000_get_phy_info(&adapter->hw); | 3802 | e1000_get_phy_info(&adapter->hw); |
3769 | } | 3803 | } |
3770 | 3804 | ||
@@ -3775,6 +3809,10 @@ static void e1000e_update_phy_task(struct work_struct *work) | |||
3775 | static void e1000_update_phy_info(unsigned long data) | 3809 | static void e1000_update_phy_info(unsigned long data) |
3776 | { | 3810 | { |
3777 | struct e1000_adapter *adapter = (struct e1000_adapter *) data; | 3811 | struct e1000_adapter *adapter = (struct e1000_adapter *) data; |
3812 | |||
3813 | if (test_bit(__E1000_DOWN, &adapter->state)) | ||
3814 | return; | ||
3815 | |||
3778 | schedule_work(&adapter->update_phy_task); | 3816 | schedule_work(&adapter->update_phy_task); |
3779 | } | 3817 | } |
3780 | 3818 | ||
@@ -3886,7 +3924,7 @@ release: | |||
3886 | * e1000e_update_stats - Update the board statistics counters | 3924 | * e1000e_update_stats - Update the board statistics counters |
3887 | * @adapter: board private structure | 3925 | * @adapter: board private structure |
3888 | **/ | 3926 | **/ |
3889 | void e1000e_update_stats(struct e1000_adapter *adapter) | 3927 | static void e1000e_update_stats(struct e1000_adapter *adapter) |
3890 | { | 3928 | { |
3891 | struct net_device *netdev = adapter->netdev; | 3929 | struct net_device *netdev = adapter->netdev; |
3892 | struct e1000_hw *hw = &adapter->hw; | 3930 | struct e1000_hw *hw = &adapter->hw; |
@@ -3998,10 +4036,11 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter) | |||
3998 | { | 4036 | { |
3999 | struct e1000_hw *hw = &adapter->hw; | 4037 | struct e1000_hw *hw = &adapter->hw; |
4000 | struct e1000_phy_regs *phy = &adapter->phy_regs; | 4038 | struct e1000_phy_regs *phy = &adapter->phy_regs; |
4001 | int ret_val; | ||
4002 | 4039 | ||
4003 | if ((er32(STATUS) & E1000_STATUS_LU) && | 4040 | if ((er32(STATUS) & E1000_STATUS_LU) && |
4004 | (adapter->hw.phy.media_type == e1000_media_type_copper)) { | 4041 | (adapter->hw.phy.media_type == e1000_media_type_copper)) { |
4042 | int ret_val; | ||
4043 | |||
4005 | ret_val = e1e_rphy(hw, PHY_CONTROL, &phy->bmcr); | 4044 | ret_val = e1e_rphy(hw, PHY_CONTROL, &phy->bmcr); |
4006 | ret_val |= e1e_rphy(hw, PHY_STATUS, &phy->bmsr); | 4045 | ret_val |= e1e_rphy(hw, PHY_STATUS, &phy->bmsr); |
4007 | ret_val |= e1e_rphy(hw, PHY_AUTONEG_ADV, &phy->advertise); | 4046 | ret_val |= e1e_rphy(hw, PHY_AUTONEG_ADV, &phy->advertise); |
@@ -4147,7 +4186,9 @@ static void e1000_watchdog_task(struct work_struct *work) | |||
4147 | struct e1000_ring *tx_ring = adapter->tx_ring; | 4186 | struct e1000_ring *tx_ring = adapter->tx_ring; |
4148 | struct e1000_hw *hw = &adapter->hw; | 4187 | struct e1000_hw *hw = &adapter->hw; |
4149 | u32 link, tctl; | 4188 | u32 link, tctl; |
4150 | int tx_pending = 0; | 4189 | |
4190 | if (test_bit(__E1000_DOWN, &adapter->state)) | ||
4191 | return; | ||
4151 | 4192 | ||
4152 | link = e1000e_has_link(adapter); | 4193 | link = e1000e_has_link(adapter); |
4153 | if ((netif_carrier_ok(netdev)) && link) { | 4194 | if ((netif_carrier_ok(netdev)) && link) { |
@@ -4285,7 +4326,9 @@ static void e1000_watchdog_task(struct work_struct *work) | |||
4285 | } | 4326 | } |
4286 | 4327 | ||
4287 | link_up: | 4328 | link_up: |
4329 | spin_lock(&adapter->stats64_lock); | ||
4288 | e1000e_update_stats(adapter); | 4330 | e1000e_update_stats(adapter); |
4331 | spin_unlock(&adapter->stats64_lock); | ||
4289 | 4332 | ||
4290 | mac->tx_packet_delta = adapter->stats.tpt - adapter->tpt_old; | 4333 | mac->tx_packet_delta = adapter->stats.tpt - adapter->tpt_old; |
4291 | adapter->tpt_old = adapter->stats.tpt; | 4334 | adapter->tpt_old = adapter->stats.tpt; |
@@ -4299,21 +4342,17 @@ link_up: | |||
4299 | 4342 | ||
4300 | e1000e_update_adaptive(&adapter->hw); | 4343 | e1000e_update_adaptive(&adapter->hw); |
4301 | 4344 | ||
4302 | if (!netif_carrier_ok(netdev)) { | 4345 | if (!netif_carrier_ok(netdev) && |
4303 | tx_pending = (e1000_desc_unused(tx_ring) + 1 < | 4346 | (e1000_desc_unused(tx_ring) + 1 < tx_ring->count)) { |
4304 | tx_ring->count); | 4347 | /* |
4305 | if (tx_pending) { | 4348 | * We've lost link, so the controller stops DMA, |
4306 | /* | 4349 | * but we've got queued Tx work that's never going |
4307 | * We've lost link, so the controller stops DMA, | 4350 | * to get done, so reset controller to flush Tx. |
4308 | * but we've got queued Tx work that's never going | 4351 | * (Do the reset outside of interrupt context). |
4309 | * to get done, so reset controller to flush Tx. | 4352 | */ |
4310 | * (Do the reset outside of interrupt context). | 4353 | schedule_work(&adapter->reset_task); |
4311 | */ | 4354 | /* return immediately since reset is imminent */ |
4312 | adapter->tx_timeout_count++; | 4355 | return; |
4313 | schedule_work(&adapter->reset_task); | ||
4314 | /* return immediately since reset is imminent */ | ||
4315 | return; | ||
4316 | } | ||
4317 | } | 4356 | } |
4318 | 4357 | ||
4319 | /* Simple mode for Interrupt Throttle Rate (ITR) */ | 4358 | /* Simple mode for Interrupt Throttle Rate (ITR) */ |
@@ -4338,19 +4377,12 @@ link_up: | |||
4338 | else | 4377 | else |
4339 | ew32(ICS, E1000_ICS_RXDMT0); | 4378 | ew32(ICS, E1000_ICS_RXDMT0); |
4340 | 4379 | ||
4380 | /* flush pending descriptors to memory before detecting Tx hang */ | ||
4381 | e1000e_flush_descriptors(adapter); | ||
4382 | |||
4341 | /* Force detection of hung controller every watchdog period */ | 4383 | /* Force detection of hung controller every watchdog period */ |
4342 | adapter->detect_tx_hung = 1; | 4384 | adapter->detect_tx_hung = 1; |
4343 | 4385 | ||
4344 | /* flush partial descriptors to memory before detecting Tx hang */ | ||
4345 | if (adapter->flags2 & FLAG2_DMA_BURST) { | ||
4346 | ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD); | ||
4347 | ew32(RDTR, adapter->rx_int_delay | E1000_RDTR_FPD); | ||
4348 | /* | ||
4349 | * no need to flush the writes because the timeout code does | ||
4350 | * an er32 first thing | ||
4351 | */ | ||
4352 | } | ||
4353 | |||
4354 | /* | 4386 | /* |
4355 | * With 82571 controllers, LAA may be overwritten due to controller | 4387 | * With 82571 controllers, LAA may be overwritten due to controller |
4356 | * reset from the other port. Set the appropriate LAA in RAR[0] | 4388 | * reset from the other port. Set the appropriate LAA in RAR[0] |
@@ -4384,13 +4416,13 @@ static int e1000_tso(struct e1000_adapter *adapter, | |||
4384 | u32 cmd_length = 0; | 4416 | u32 cmd_length = 0; |
4385 | u16 ipcse = 0, tucse, mss; | 4417 | u16 ipcse = 0, tucse, mss; |
4386 | u8 ipcss, ipcso, tucss, tucso, hdr_len; | 4418 | u8 ipcss, ipcso, tucss, tucso, hdr_len; |
4387 | int err; | ||
4388 | 4419 | ||
4389 | if (!skb_is_gso(skb)) | 4420 | if (!skb_is_gso(skb)) |
4390 | return 0; | 4421 | return 0; |
4391 | 4422 | ||
4392 | if (skb_header_cloned(skb)) { | 4423 | if (skb_header_cloned(skb)) { |
4393 | err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC); | 4424 | int err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC); |
4425 | |||
4394 | if (err) | 4426 | if (err) |
4395 | return err; | 4427 | return err; |
4396 | } | 4428 | } |
@@ -4888,6 +4920,10 @@ static void e1000_reset_task(struct work_struct *work) | |||
4888 | struct e1000_adapter *adapter; | 4920 | struct e1000_adapter *adapter; |
4889 | adapter = container_of(work, struct e1000_adapter, reset_task); | 4921 | adapter = container_of(work, struct e1000_adapter, reset_task); |
4890 | 4922 | ||
4923 | /* don't run the task if already down */ | ||
4924 | if (test_bit(__E1000_DOWN, &adapter->state)) | ||
4925 | return; | ||
4926 | |||
4891 | if (!((adapter->flags & FLAG_RX_NEEDS_RESTART) && | 4927 | if (!((adapter->flags & FLAG_RX_NEEDS_RESTART) && |
4892 | (adapter->flags & FLAG_RX_RESTART_NOW))) { | 4928 | (adapter->flags & FLAG_RX_RESTART_NOW))) { |
4893 | e1000e_dump(adapter); | 4929 | e1000e_dump(adapter); |
@@ -4897,16 +4933,55 @@ static void e1000_reset_task(struct work_struct *work) | |||
4897 | } | 4933 | } |
4898 | 4934 | ||
4899 | /** | 4935 | /** |
4900 | * e1000_get_stats - Get System Network Statistics | 4936 | * e1000_get_stats64 - Get System Network Statistics |
4901 | * @netdev: network interface device structure | 4937 | * @netdev: network interface device structure |
4938 | * @stats: rtnl_link_stats64 pointer | ||
4902 | * | 4939 | * |
4903 | * Returns the address of the device statistics structure. | 4940 | * Returns the address of the device statistics structure. |
4904 | * The statistics are actually updated from the timer callback. | ||
4905 | **/ | 4941 | **/ |
4906 | static struct net_device_stats *e1000_get_stats(struct net_device *netdev) | 4942 | struct rtnl_link_stats64 *e1000e_get_stats64(struct net_device *netdev, |
4943 | struct rtnl_link_stats64 *stats) | ||
4907 | { | 4944 | { |
4908 | /* only return the current stats */ | 4945 | struct e1000_adapter *adapter = netdev_priv(netdev); |
4909 | return &netdev->stats; | 4946 | |
4947 | memset(stats, 0, sizeof(struct rtnl_link_stats64)); | ||
4948 | spin_lock(&adapter->stats64_lock); | ||
4949 | e1000e_update_stats(adapter); | ||
4950 | /* Fill out the OS statistics structure */ | ||
4951 | stats->rx_bytes = adapter->stats.gorc; | ||
4952 | stats->rx_packets = adapter->stats.gprc; | ||
4953 | stats->tx_bytes = adapter->stats.gotc; | ||
4954 | stats->tx_packets = adapter->stats.gptc; | ||
4955 | stats->multicast = adapter->stats.mprc; | ||
4956 | stats->collisions = adapter->stats.colc; | ||
4957 | |||
4958 | /* Rx Errors */ | ||
4959 | |||
4960 | /* | ||
4961 | * RLEC on some newer hardware can be incorrect so build | ||
4962 | * our own version based on RUC and ROC | ||
4963 | */ | ||
4964 | stats->rx_errors = adapter->stats.rxerrc + | ||
4965 | adapter->stats.crcerrs + adapter->stats.algnerrc + | ||
4966 | adapter->stats.ruc + adapter->stats.roc + | ||
4967 | adapter->stats.cexterr; | ||
4968 | stats->rx_length_errors = adapter->stats.ruc + | ||
4969 | adapter->stats.roc; | ||
4970 | stats->rx_crc_errors = adapter->stats.crcerrs; | ||
4971 | stats->rx_frame_errors = adapter->stats.algnerrc; | ||
4972 | stats->rx_missed_errors = adapter->stats.mpc; | ||
4973 | |||
4974 | /* Tx Errors */ | ||
4975 | stats->tx_errors = adapter->stats.ecol + | ||
4976 | adapter->stats.latecol; | ||
4977 | stats->tx_aborted_errors = adapter->stats.ecol; | ||
4978 | stats->tx_window_errors = adapter->stats.latecol; | ||
4979 | stats->tx_carrier_errors = adapter->stats.tncrs; | ||
4980 | |||
4981 | /* Tx Dropped needs to be maintained elsewhere */ | ||
4982 | |||
4983 | spin_unlock(&adapter->stats64_lock); | ||
4984 | return stats; | ||
4910 | } | 4985 | } |
4911 | 4986 | ||
4912 | /** | 4987 | /** |
@@ -5476,9 +5551,10 @@ static irqreturn_t e1000_intr_msix(int irq, void *data) | |||
5476 | { | 5551 | { |
5477 | struct net_device *netdev = data; | 5552 | struct net_device *netdev = data; |
5478 | struct e1000_adapter *adapter = netdev_priv(netdev); | 5553 | struct e1000_adapter *adapter = netdev_priv(netdev); |
5479 | int vector, msix_irq; | ||
5480 | 5554 | ||
5481 | if (adapter->msix_entries) { | 5555 | if (adapter->msix_entries) { |
5556 | int vector, msix_irq; | ||
5557 | |||
5482 | vector = 0; | 5558 | vector = 0; |
5483 | msix_irq = adapter->msix_entries[vector].vector; | 5559 | msix_irq = adapter->msix_entries[vector].vector; |
5484 | disable_irq(msix_irq); | 5560 | disable_irq(msix_irq); |
@@ -5675,7 +5751,7 @@ static const struct net_device_ops e1000e_netdev_ops = { | |||
5675 | .ndo_open = e1000_open, | 5751 | .ndo_open = e1000_open, |
5676 | .ndo_stop = e1000_close, | 5752 | .ndo_stop = e1000_close, |
5677 | .ndo_start_xmit = e1000_xmit_frame, | 5753 | .ndo_start_xmit = e1000_xmit_frame, |
5678 | .ndo_get_stats = e1000_get_stats, | 5754 | .ndo_get_stats64 = e1000e_get_stats64, |
5679 | .ndo_set_multicast_list = e1000_set_multi, | 5755 | .ndo_set_multicast_list = e1000_set_multi, |
5680 | .ndo_set_mac_address = e1000_set_mac, | 5756 | .ndo_set_mac_address = e1000_set_mac, |
5681 | .ndo_change_mtu = e1000_change_mtu, | 5757 | .ndo_change_mtu = e1000_change_mtu, |