diff options
Diffstat (limited to 'drivers/net/atlx')
-rw-r--r-- | drivers/net/atlx/atl1.c | 96 | ||||
-rw-r--r-- | drivers/net/atlx/atl1.h | 4 | ||||
-rw-r--r-- | drivers/net/atlx/atl2.c | 97 | ||||
-rw-r--r-- | drivers/net/atlx/atl2.h | 1 | ||||
-rw-r--r-- | drivers/net/atlx/atlx.c | 13 |
5 files changed, 86 insertions, 125 deletions
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c index aef403d299ee..7a0fb04e3480 100644 --- a/drivers/net/atlx/atl1.c +++ b/drivers/net/atlx/atl1.c | |||
@@ -1390,7 +1390,8 @@ static u32 atl1_check_link(struct atl1_adapter *adapter) | |||
1390 | /* auto-neg, insert timer to re-config phy */ | 1390 | /* auto-neg, insert timer to re-config phy */ |
1391 | if (!adapter->phy_timer_pending) { | 1391 | if (!adapter->phy_timer_pending) { |
1392 | adapter->phy_timer_pending = true; | 1392 | adapter->phy_timer_pending = true; |
1393 | mod_timer(&adapter->phy_config_timer, jiffies + 3 * HZ); | 1393 | mod_timer(&adapter->phy_config_timer, |
1394 | round_jiffies(jiffies + 3 * HZ)); | ||
1394 | } | 1395 | } |
1395 | 1396 | ||
1396 | return 0; | 1397 | return 0; |
@@ -1662,6 +1663,7 @@ static void atl1_via_workaround(struct atl1_adapter *adapter) | |||
1662 | 1663 | ||
1663 | static void atl1_inc_smb(struct atl1_adapter *adapter) | 1664 | static void atl1_inc_smb(struct atl1_adapter *adapter) |
1664 | { | 1665 | { |
1666 | struct net_device *netdev = adapter->netdev; | ||
1665 | struct stats_msg_block *smb = adapter->smb.smb; | 1667 | struct stats_msg_block *smb = adapter->smb.smb; |
1666 | 1668 | ||
1667 | /* Fill out the OS statistics structure */ | 1669 | /* Fill out the OS statistics structure */ |
@@ -1704,30 +1706,30 @@ static void atl1_inc_smb(struct atl1_adapter *adapter) | |||
1704 | adapter->soft_stats.tx_trunc += smb->tx_trunc; | 1706 | adapter->soft_stats.tx_trunc += smb->tx_trunc; |
1705 | adapter->soft_stats.tx_pause += smb->tx_pause; | 1707 | adapter->soft_stats.tx_pause += smb->tx_pause; |
1706 | 1708 | ||
1707 | adapter->net_stats.rx_packets = adapter->soft_stats.rx_packets; | 1709 | netdev->stats.rx_packets = adapter->soft_stats.rx_packets; |
1708 | adapter->net_stats.tx_packets = adapter->soft_stats.tx_packets; | 1710 | netdev->stats.tx_packets = adapter->soft_stats.tx_packets; |
1709 | adapter->net_stats.rx_bytes = adapter->soft_stats.rx_bytes; | 1711 | netdev->stats.rx_bytes = adapter->soft_stats.rx_bytes; |
1710 | adapter->net_stats.tx_bytes = adapter->soft_stats.tx_bytes; | 1712 | netdev->stats.tx_bytes = adapter->soft_stats.tx_bytes; |
1711 | adapter->net_stats.multicast = adapter->soft_stats.multicast; | 1713 | netdev->stats.multicast = adapter->soft_stats.multicast; |
1712 | adapter->net_stats.collisions = adapter->soft_stats.collisions; | 1714 | netdev->stats.collisions = adapter->soft_stats.collisions; |
1713 | adapter->net_stats.rx_errors = adapter->soft_stats.rx_errors; | 1715 | netdev->stats.rx_errors = adapter->soft_stats.rx_errors; |
1714 | adapter->net_stats.rx_over_errors = | 1716 | netdev->stats.rx_over_errors = |
1715 | adapter->soft_stats.rx_missed_errors; | 1717 | adapter->soft_stats.rx_missed_errors; |
1716 | adapter->net_stats.rx_length_errors = | 1718 | netdev->stats.rx_length_errors = |
1717 | adapter->soft_stats.rx_length_errors; | 1719 | adapter->soft_stats.rx_length_errors; |
1718 | adapter->net_stats.rx_crc_errors = adapter->soft_stats.rx_crc_errors; | 1720 | netdev->stats.rx_crc_errors = adapter->soft_stats.rx_crc_errors; |
1719 | adapter->net_stats.rx_frame_errors = | 1721 | netdev->stats.rx_frame_errors = |
1720 | adapter->soft_stats.rx_frame_errors; | 1722 | adapter->soft_stats.rx_frame_errors; |
1721 | adapter->net_stats.rx_fifo_errors = adapter->soft_stats.rx_fifo_errors; | 1723 | netdev->stats.rx_fifo_errors = adapter->soft_stats.rx_fifo_errors; |
1722 | adapter->net_stats.rx_missed_errors = | 1724 | netdev->stats.rx_missed_errors = |
1723 | adapter->soft_stats.rx_missed_errors; | 1725 | adapter->soft_stats.rx_missed_errors; |
1724 | adapter->net_stats.tx_errors = adapter->soft_stats.tx_errors; | 1726 | netdev->stats.tx_errors = adapter->soft_stats.tx_errors; |
1725 | adapter->net_stats.tx_fifo_errors = adapter->soft_stats.tx_fifo_errors; | 1727 | netdev->stats.tx_fifo_errors = adapter->soft_stats.tx_fifo_errors; |
1726 | adapter->net_stats.tx_aborted_errors = | 1728 | netdev->stats.tx_aborted_errors = |
1727 | adapter->soft_stats.tx_aborted_errors; | 1729 | adapter->soft_stats.tx_aborted_errors; |
1728 | adapter->net_stats.tx_window_errors = | 1730 | netdev->stats.tx_window_errors = |
1729 | adapter->soft_stats.tx_window_errors; | 1731 | adapter->soft_stats.tx_window_errors; |
1730 | adapter->net_stats.tx_carrier_errors = | 1732 | netdev->stats.tx_carrier_errors = |
1731 | adapter->soft_stats.tx_carrier_errors; | 1733 | adapter->soft_stats.tx_carrier_errors; |
1732 | } | 1734 | } |
1733 | 1735 | ||
@@ -1860,7 +1862,7 @@ static u16 atl1_alloc_rx_buffers(struct atl1_adapter *adapter) | |||
1860 | adapter->rx_buffer_len + NET_IP_ALIGN); | 1862 | adapter->rx_buffer_len + NET_IP_ALIGN); |
1861 | if (unlikely(!skb)) { | 1863 | if (unlikely(!skb)) { |
1862 | /* Better luck next round */ | 1864 | /* Better luck next round */ |
1863 | adapter->net_stats.rx_dropped++; | 1865 | adapter->netdev->stats.rx_dropped++; |
1864 | break; | 1866 | break; |
1865 | } | 1867 | } |
1866 | 1868 | ||
@@ -2026,8 +2028,6 @@ rrd_ok: | |||
2026 | buffer_info->skb = NULL; | 2028 | buffer_info->skb = NULL; |
2027 | buffer_info->alloced = 0; | 2029 | buffer_info->alloced = 0; |
2028 | rrd->xsz.valid = 0; | 2030 | rrd->xsz.valid = 0; |
2029 | |||
2030 | adapter->netdev->last_rx = jiffies; | ||
2031 | } | 2031 | } |
2032 | 2032 | ||
2033 | atomic_set(&rrd_ring->next_to_clean, rrd_next_to_clean); | 2033 | atomic_set(&rrd_ring->next_to_clean, rrd_next_to_clean); |
@@ -2524,17 +2524,6 @@ static irqreturn_t atl1_intr(int irq, void *data) | |||
2524 | return IRQ_HANDLED; | 2524 | return IRQ_HANDLED; |
2525 | } | 2525 | } |
2526 | 2526 | ||
2527 | /* | ||
2528 | * atl1_watchdog - Timer Call-back | ||
2529 | * @data: pointer to netdev cast into an unsigned long | ||
2530 | */ | ||
2531 | static void atl1_watchdog(unsigned long data) | ||
2532 | { | ||
2533 | struct atl1_adapter *adapter = (struct atl1_adapter *)data; | ||
2534 | |||
2535 | /* Reset the timer */ | ||
2536 | mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); | ||
2537 | } | ||
2538 | 2527 | ||
2539 | /* | 2528 | /* |
2540 | * atl1_phy_config - Timer Call-back | 2529 | * atl1_phy_config - Timer Call-back |
@@ -2607,7 +2596,6 @@ static s32 atl1_up(struct atl1_adapter *adapter) | |||
2607 | if (unlikely(err)) | 2596 | if (unlikely(err)) |
2608 | goto err_up; | 2597 | goto err_up; |
2609 | 2598 | ||
2610 | mod_timer(&adapter->watchdog_timer, jiffies); | ||
2611 | atlx_irq_enable(adapter); | 2599 | atlx_irq_enable(adapter); |
2612 | atl1_check_link(adapter); | 2600 | atl1_check_link(adapter); |
2613 | netif_start_queue(netdev); | 2601 | netif_start_queue(netdev); |
@@ -2625,7 +2613,6 @@ static void atl1_down(struct atl1_adapter *adapter) | |||
2625 | struct net_device *netdev = adapter->netdev; | 2613 | struct net_device *netdev = adapter->netdev; |
2626 | 2614 | ||
2627 | netif_stop_queue(netdev); | 2615 | netif_stop_queue(netdev); |
2628 | del_timer_sync(&adapter->watchdog_timer); | ||
2629 | del_timer_sync(&adapter->phy_config_timer); | 2616 | del_timer_sync(&adapter->phy_config_timer); |
2630 | adapter->phy_timer_pending = false; | 2617 | adapter->phy_timer_pending = false; |
2631 | 2618 | ||
@@ -2893,6 +2880,21 @@ static void atl1_poll_controller(struct net_device *netdev) | |||
2893 | } | 2880 | } |
2894 | #endif | 2881 | #endif |
2895 | 2882 | ||
2883 | static const struct net_device_ops atl1_netdev_ops = { | ||
2884 | .ndo_open = atl1_open, | ||
2885 | .ndo_stop = atl1_close, | ||
2886 | .ndo_set_multicast_list = atlx_set_multi, | ||
2887 | .ndo_validate_addr = eth_validate_addr, | ||
2888 | .ndo_set_mac_address = atl1_set_mac, | ||
2889 | .ndo_change_mtu = atl1_change_mtu, | ||
2890 | .ndo_do_ioctl = atlx_ioctl, | ||
2891 | .ndo_tx_timeout = atlx_tx_timeout, | ||
2892 | .ndo_vlan_rx_register = atlx_vlan_rx_register, | ||
2893 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
2894 | .ndo_poll_controller = atl1_poll_controller, | ||
2895 | #endif | ||
2896 | }; | ||
2897 | |||
2896 | /* | 2898 | /* |
2897 | * atl1_probe - Device Initialization Routine | 2899 | * atl1_probe - Device Initialization Routine |
2898 | * @pdev: PCI device information struct | 2900 | * @pdev: PCI device information struct |
@@ -2980,20 +2982,9 @@ static int __devinit atl1_probe(struct pci_dev *pdev, | |||
2980 | adapter->mii.phy_id_mask = 0x1f; | 2982 | adapter->mii.phy_id_mask = 0x1f; |
2981 | adapter->mii.reg_num_mask = 0x1f; | 2983 | adapter->mii.reg_num_mask = 0x1f; |
2982 | 2984 | ||
2983 | netdev->open = &atl1_open; | 2985 | netdev->netdev_ops = &atl1_netdev_ops; |
2984 | netdev->stop = &atl1_close; | ||
2985 | netdev->hard_start_xmit = &atl1_xmit_frame; | 2986 | netdev->hard_start_xmit = &atl1_xmit_frame; |
2986 | netdev->get_stats = &atlx_get_stats; | ||
2987 | netdev->set_multicast_list = &atlx_set_multi; | ||
2988 | netdev->set_mac_address = &atl1_set_mac; | ||
2989 | netdev->change_mtu = &atl1_change_mtu; | ||
2990 | netdev->do_ioctl = &atlx_ioctl; | ||
2991 | netdev->tx_timeout = &atlx_tx_timeout; | ||
2992 | netdev->watchdog_timeo = 5 * HZ; | 2987 | netdev->watchdog_timeo = 5 * HZ; |
2993 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
2994 | netdev->poll_controller = atl1_poll_controller; | ||
2995 | #endif | ||
2996 | netdev->vlan_rx_register = atlx_vlan_rx_register; | ||
2997 | 2988 | ||
2998 | netdev->ethtool_ops = &atl1_ethtool_ops; | 2989 | netdev->ethtool_ops = &atl1_ethtool_ops; |
2999 | adapter->bd_number = cards_found; | 2990 | adapter->bd_number = cards_found; |
@@ -3049,13 +3040,8 @@ static int __devinit atl1_probe(struct pci_dev *pdev, | |||
3049 | netif_carrier_off(netdev); | 3040 | netif_carrier_off(netdev); |
3050 | netif_stop_queue(netdev); | 3041 | netif_stop_queue(netdev); |
3051 | 3042 | ||
3052 | init_timer(&adapter->watchdog_timer); | 3043 | setup_timer(&adapter->phy_config_timer, &atl1_phy_config, |
3053 | adapter->watchdog_timer.function = &atl1_watchdog; | 3044 | (unsigned long)adapter); |
3054 | adapter->watchdog_timer.data = (unsigned long)adapter; | ||
3055 | |||
3056 | init_timer(&adapter->phy_config_timer); | ||
3057 | adapter->phy_config_timer.function = &atl1_phy_config; | ||
3058 | adapter->phy_config_timer.data = (unsigned long)adapter; | ||
3059 | adapter->phy_timer_pending = false; | 3045 | adapter->phy_timer_pending = false; |
3060 | 3046 | ||
3061 | INIT_WORK(&adapter->tx_timeout_task, atl1_tx_timeout_task); | 3047 | INIT_WORK(&adapter->tx_timeout_task, atl1_tx_timeout_task); |
@@ -3173,8 +3159,6 @@ static struct atl1_stats atl1_gstrings_stats[] = { | |||
3173 | {"tx_bytes", ATL1_STAT(soft_stats.tx_bytes)}, | 3159 | {"tx_bytes", ATL1_STAT(soft_stats.tx_bytes)}, |
3174 | {"rx_errors", ATL1_STAT(soft_stats.rx_errors)}, | 3160 | {"rx_errors", ATL1_STAT(soft_stats.rx_errors)}, |
3175 | {"tx_errors", ATL1_STAT(soft_stats.tx_errors)}, | 3161 | {"tx_errors", ATL1_STAT(soft_stats.tx_errors)}, |
3176 | {"rx_dropped", ATL1_STAT(net_stats.rx_dropped)}, | ||
3177 | {"tx_dropped", ATL1_STAT(net_stats.tx_dropped)}, | ||
3178 | {"multicast", ATL1_STAT(soft_stats.multicast)}, | 3162 | {"multicast", ATL1_STAT(soft_stats.multicast)}, |
3179 | {"collisions", ATL1_STAT(soft_stats.collisions)}, | 3163 | {"collisions", ATL1_STAT(soft_stats.collisions)}, |
3180 | {"rx_length_errors", ATL1_STAT(soft_stats.rx_length_errors)}, | 3164 | {"rx_length_errors", ATL1_STAT(soft_stats.rx_length_errors)}, |
diff --git a/drivers/net/atlx/atl1.h b/drivers/net/atlx/atl1.h index ffa73fc8d95e..146372fd6683 100644 --- a/drivers/net/atlx/atl1.h +++ b/drivers/net/atlx/atl1.h | |||
@@ -754,7 +754,7 @@ struct atl1_hw { | |||
754 | struct atl1_adapter { | 754 | struct atl1_adapter { |
755 | struct net_device *netdev; | 755 | struct net_device *netdev; |
756 | struct pci_dev *pdev; | 756 | struct pci_dev *pdev; |
757 | struct net_device_stats net_stats; | 757 | |
758 | struct atl1_sft_stats soft_stats; | 758 | struct atl1_sft_stats soft_stats; |
759 | struct vlan_group *vlgrp; | 759 | struct vlan_group *vlgrp; |
760 | u32 rx_buffer_len; | 760 | u32 rx_buffer_len; |
@@ -765,7 +765,7 @@ struct atl1_adapter { | |||
765 | struct work_struct tx_timeout_task; | 765 | struct work_struct tx_timeout_task; |
766 | struct work_struct link_chg_task; | 766 | struct work_struct link_chg_task; |
767 | struct work_struct pcie_dma_to_rst_task; | 767 | struct work_struct pcie_dma_to_rst_task; |
768 | struct timer_list watchdog_timer; | 768 | |
769 | struct timer_list phy_config_timer; | 769 | struct timer_list phy_config_timer; |
770 | bool phy_timer_pending; | 770 | bool phy_timer_pending; |
771 | 771 | ||
diff --git a/drivers/net/atlx/atl2.c b/drivers/net/atlx/atl2.c index 8571e8c0bc67..b8d585722e1a 100644 --- a/drivers/net/atlx/atl2.c +++ b/drivers/net/atlx/atl2.c | |||
@@ -418,7 +418,7 @@ static void atl2_intr_rx(struct atl2_adapter *adapter) | |||
418 | * Check that some rx space is free. If not, | 418 | * Check that some rx space is free. If not, |
419 | * free one and mark stats->rx_dropped++. | 419 | * free one and mark stats->rx_dropped++. |
420 | */ | 420 | */ |
421 | adapter->net_stats.rx_dropped++; | 421 | netdev->stats.rx_dropped++; |
422 | break; | 422 | break; |
423 | } | 423 | } |
424 | skb_reserve(skb, NET_IP_ALIGN); | 424 | skb_reserve(skb, NET_IP_ALIGN); |
@@ -435,20 +435,19 @@ static void atl2_intr_rx(struct atl2_adapter *adapter) | |||
435 | } else | 435 | } else |
436 | #endif | 436 | #endif |
437 | netif_rx(skb); | 437 | netif_rx(skb); |
438 | adapter->net_stats.rx_bytes += rx_size; | 438 | netdev->stats.rx_bytes += rx_size; |
439 | adapter->net_stats.rx_packets++; | 439 | netdev->stats.rx_packets++; |
440 | netdev->last_rx = jiffies; | ||
441 | } else { | 440 | } else { |
442 | adapter->net_stats.rx_errors++; | 441 | netdev->stats.rx_errors++; |
443 | 442 | ||
444 | if (rxd->status.ok && rxd->status.pkt_size <= 60) | 443 | if (rxd->status.ok && rxd->status.pkt_size <= 60) |
445 | adapter->net_stats.rx_length_errors++; | 444 | netdev->stats.rx_length_errors++; |
446 | if (rxd->status.mcast) | 445 | if (rxd->status.mcast) |
447 | adapter->net_stats.multicast++; | 446 | netdev->stats.multicast++; |
448 | if (rxd->status.crc) | 447 | if (rxd->status.crc) |
449 | adapter->net_stats.rx_crc_errors++; | 448 | netdev->stats.rx_crc_errors++; |
450 | if (rxd->status.align) | 449 | if (rxd->status.align) |
451 | adapter->net_stats.rx_frame_errors++; | 450 | netdev->stats.rx_frame_errors++; |
452 | } | 451 | } |
453 | 452 | ||
454 | /* advance write ptr */ | 453 | /* advance write ptr */ |
@@ -463,6 +462,7 @@ static void atl2_intr_rx(struct atl2_adapter *adapter) | |||
463 | 462 | ||
464 | static void atl2_intr_tx(struct atl2_adapter *adapter) | 463 | static void atl2_intr_tx(struct atl2_adapter *adapter) |
465 | { | 464 | { |
465 | struct net_device *netdev = adapter->netdev; | ||
466 | u32 txd_read_ptr; | 466 | u32 txd_read_ptr; |
467 | u32 txs_write_ptr; | 467 | u32 txs_write_ptr; |
468 | struct tx_pkt_status *txs; | 468 | struct tx_pkt_status *txs; |
@@ -522,20 +522,20 @@ static void atl2_intr_tx(struct atl2_adapter *adapter) | |||
522 | 522 | ||
523 | /* tx statistics: */ | 523 | /* tx statistics: */ |
524 | if (txs->ok) { | 524 | if (txs->ok) { |
525 | adapter->net_stats.tx_bytes += txs->pkt_size; | 525 | netdev->stats.tx_bytes += txs->pkt_size; |
526 | adapter->net_stats.tx_packets++; | 526 | netdev->stats.tx_packets++; |
527 | } | 527 | } |
528 | else | 528 | else |
529 | adapter->net_stats.tx_errors++; | 529 | netdev->stats.tx_errors++; |
530 | 530 | ||
531 | if (txs->defer) | 531 | if (txs->defer) |
532 | adapter->net_stats.collisions++; | 532 | netdev->stats.collisions++; |
533 | if (txs->abort_col) | 533 | if (txs->abort_col) |
534 | adapter->net_stats.tx_aborted_errors++; | 534 | netdev->stats.tx_aborted_errors++; |
535 | if (txs->late_col) | 535 | if (txs->late_col) |
536 | adapter->net_stats.tx_window_errors++; | 536 | netdev->stats.tx_window_errors++; |
537 | if (txs->underun) | 537 | if (txs->underun) |
538 | adapter->net_stats.tx_fifo_errors++; | 538 | netdev->stats.tx_fifo_errors++; |
539 | } while (1); | 539 | } while (1); |
540 | 540 | ||
541 | if (free_hole) { | 541 | if (free_hole) { |
@@ -621,7 +621,7 @@ static irqreturn_t atl2_intr(int irq, void *data) | |||
621 | 621 | ||
622 | /* link event */ | 622 | /* link event */ |
623 | if (status & (ISR_PHY | ISR_MANUAL)) { | 623 | if (status & (ISR_PHY | ISR_MANUAL)) { |
624 | adapter->net_stats.tx_carrier_errors++; | 624 | adapter->netdev->stats.tx_carrier_errors++; |
625 | atl2_check_for_link(adapter); | 625 | atl2_check_for_link(adapter); |
626 | } | 626 | } |
627 | 627 | ||
@@ -723,7 +723,7 @@ static int atl2_open(struct net_device *netdev) | |||
723 | 723 | ||
724 | clear_bit(__ATL2_DOWN, &adapter->flags); | 724 | clear_bit(__ATL2_DOWN, &adapter->flags); |
725 | 725 | ||
726 | mod_timer(&adapter->watchdog_timer, jiffies + 4*HZ); | 726 | mod_timer(&adapter->watchdog_timer, round_jiffies(jiffies + 4*HZ)); |
727 | 727 | ||
728 | val = ATL2_READ_REG(&adapter->hw, REG_MASTER_CTRL); | 728 | val = ATL2_READ_REG(&adapter->hw, REG_MASTER_CTRL); |
729 | ATL2_WRITE_REG(&adapter->hw, REG_MASTER_CTRL, | 729 | ATL2_WRITE_REG(&adapter->hw, REG_MASTER_CTRL, |
@@ -900,19 +900,6 @@ static int atl2_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
900 | } | 900 | } |
901 | 901 | ||
902 | /* | 902 | /* |
903 | * atl2_get_stats - Get System Network Statistics | ||
904 | * @netdev: network interface device structure | ||
905 | * | ||
906 | * Returns the address of the device statistics structure. | ||
907 | * The statistics are actually updated from the timer callback. | ||
908 | */ | ||
909 | static struct net_device_stats *atl2_get_stats(struct net_device *netdev) | ||
910 | { | ||
911 | struct atl2_adapter *adapter = netdev_priv(netdev); | ||
912 | return &adapter->net_stats; | ||
913 | } | ||
914 | |||
915 | /* | ||
916 | * atl2_change_mtu - Change the Maximum Transfer Unit | 903 | * atl2_change_mtu - Change the Maximum Transfer Unit |
917 | * @netdev: network interface device structure | 904 | * @netdev: network interface device structure |
918 | * @new_mtu: new value for maximum frame size | 905 | * @new_mtu: new value for maximum frame size |
@@ -1050,18 +1037,21 @@ static void atl2_tx_timeout(struct net_device *netdev) | |||
1050 | static void atl2_watchdog(unsigned long data) | 1037 | static void atl2_watchdog(unsigned long data) |
1051 | { | 1038 | { |
1052 | struct atl2_adapter *adapter = (struct atl2_adapter *) data; | 1039 | struct atl2_adapter *adapter = (struct atl2_adapter *) data; |
1053 | u32 drop_rxd, drop_rxs; | ||
1054 | unsigned long flags; | ||
1055 | 1040 | ||
1056 | if (!test_bit(__ATL2_DOWN, &adapter->flags)) { | 1041 | if (!test_bit(__ATL2_DOWN, &adapter->flags)) { |
1042 | u32 drop_rxd, drop_rxs; | ||
1043 | unsigned long flags; | ||
1044 | |||
1057 | spin_lock_irqsave(&adapter->stats_lock, flags); | 1045 | spin_lock_irqsave(&adapter->stats_lock, flags); |
1058 | drop_rxd = ATL2_READ_REG(&adapter->hw, REG_STS_RXD_OV); | 1046 | drop_rxd = ATL2_READ_REG(&adapter->hw, REG_STS_RXD_OV); |
1059 | drop_rxs = ATL2_READ_REG(&adapter->hw, REG_STS_RXS_OV); | 1047 | drop_rxs = ATL2_READ_REG(&adapter->hw, REG_STS_RXS_OV); |
1060 | adapter->net_stats.rx_over_errors += (drop_rxd+drop_rxs); | ||
1061 | spin_unlock_irqrestore(&adapter->stats_lock, flags); | 1048 | spin_unlock_irqrestore(&adapter->stats_lock, flags); |
1062 | 1049 | ||
1050 | adapter->netdev->stats.rx_over_errors += drop_rxd + drop_rxs; | ||
1051 | |||
1063 | /* Reset the timer */ | 1052 | /* Reset the timer */ |
1064 | mod_timer(&adapter->watchdog_timer, jiffies + 4 * HZ); | 1053 | mod_timer(&adapter->watchdog_timer, |
1054 | round_jiffies(jiffies + 4 * HZ)); | ||
1065 | } | 1055 | } |
1066 | } | 1056 | } |
1067 | 1057 | ||
@@ -1265,7 +1255,8 @@ static int atl2_check_link(struct atl2_adapter *adapter) | |||
1265 | * (if interval smaller than 5 seconds, something strange) */ | 1255 | * (if interval smaller than 5 seconds, something strange) */ |
1266 | if (!test_bit(__ATL2_DOWN, &adapter->flags)) { | 1256 | if (!test_bit(__ATL2_DOWN, &adapter->flags)) { |
1267 | if (!test_and_set_bit(0, &adapter->cfg_phy)) | 1257 | if (!test_and_set_bit(0, &adapter->cfg_phy)) |
1268 | mod_timer(&adapter->phy_config_timer, jiffies + 5 * HZ); | 1258 | mod_timer(&adapter->phy_config_timer, |
1259 | round_jiffies(jiffies + 5 * HZ)); | ||
1269 | } | 1260 | } |
1270 | 1261 | ||
1271 | return 0; | 1262 | return 0; |
@@ -1320,6 +1311,22 @@ static void atl2_poll_controller(struct net_device *netdev) | |||
1320 | } | 1311 | } |
1321 | #endif | 1312 | #endif |
1322 | 1313 | ||
1314 | |||
1315 | static const struct net_device_ops atl2_netdev_ops = { | ||
1316 | .ndo_open = atl2_open, | ||
1317 | .ndo_stop = atl2_close, | ||
1318 | .ndo_set_multicast_list = atl2_set_multi, | ||
1319 | .ndo_validate_addr = eth_validate_addr, | ||
1320 | .ndo_set_mac_address = atl2_set_mac, | ||
1321 | .ndo_change_mtu = atl2_change_mtu, | ||
1322 | .ndo_do_ioctl = atl2_ioctl, | ||
1323 | .ndo_tx_timeout = atl2_tx_timeout, | ||
1324 | .ndo_vlan_rx_register = atl2_vlan_rx_register, | ||
1325 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
1326 | .ndo_poll_controller = atl2_poll_controller, | ||
1327 | #endif | ||
1328 | }; | ||
1329 | |||
1323 | /* | 1330 | /* |
1324 | * atl2_probe - Device Initialization Routine | 1331 | * atl2_probe - Device Initialization Routine |
1325 | * @pdev: PCI device information struct | 1332 | * @pdev: PCI device information struct |
@@ -1393,26 +1400,10 @@ static int __devinit atl2_probe(struct pci_dev *pdev, | |||
1393 | 1400 | ||
1394 | atl2_setup_pcicmd(pdev); | 1401 | atl2_setup_pcicmd(pdev); |
1395 | 1402 | ||
1396 | netdev->open = &atl2_open; | ||
1397 | netdev->stop = &atl2_close; | ||
1398 | netdev->hard_start_xmit = &atl2_xmit_frame; | 1403 | netdev->hard_start_xmit = &atl2_xmit_frame; |
1399 | netdev->get_stats = &atl2_get_stats; | 1404 | netdev->netdev_ops = &atl2_netdev_ops; |
1400 | netdev->set_multicast_list = &atl2_set_multi; | ||
1401 | netdev->set_mac_address = &atl2_set_mac; | ||
1402 | netdev->change_mtu = &atl2_change_mtu; | ||
1403 | netdev->do_ioctl = &atl2_ioctl; | ||
1404 | atl2_set_ethtool_ops(netdev); | 1405 | atl2_set_ethtool_ops(netdev); |
1405 | |||
1406 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
1407 | netdev->poll_controller = atl2_poll_controller; | ||
1408 | #endif | ||
1409 | #ifdef HAVE_TX_TIMEOUT | ||
1410 | netdev->tx_timeout = &atl2_tx_timeout; | ||
1411 | netdev->watchdog_timeo = 5 * HZ; | 1406 | netdev->watchdog_timeo = 5 * HZ; |
1412 | #endif | ||
1413 | #ifdef NETIF_F_HW_VLAN_TX | ||
1414 | netdev->vlan_rx_register = atl2_vlan_rx_register; | ||
1415 | #endif | ||
1416 | strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1); | 1407 | strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1); |
1417 | 1408 | ||
1418 | netdev->mem_start = mmio_start; | 1409 | netdev->mem_start = mmio_start; |
diff --git a/drivers/net/atlx/atl2.h b/drivers/net/atlx/atl2.h index 09974df76b18..d918bbe621ea 100644 --- a/drivers/net/atlx/atl2.h +++ b/drivers/net/atlx/atl2.h | |||
@@ -453,7 +453,6 @@ struct atl2_adapter { | |||
453 | /* OS defined structs */ | 453 | /* OS defined structs */ |
454 | struct net_device *netdev; | 454 | struct net_device *netdev; |
455 | struct pci_dev *pdev; | 455 | struct pci_dev *pdev; |
456 | struct net_device_stats net_stats; | ||
457 | #ifdef NETIF_F_HW_VLAN_TX | 456 | #ifdef NETIF_F_HW_VLAN_TX |
458 | struct vlan_group *vlgrp; | 457 | struct vlan_group *vlgrp; |
459 | #endif | 458 | #endif |
diff --git a/drivers/net/atlx/atlx.c b/drivers/net/atlx/atlx.c index 3cc9d1089ca1..3dc014215679 100644 --- a/drivers/net/atlx/atlx.c +++ b/drivers/net/atlx/atlx.c | |||
@@ -182,19 +182,6 @@ static void atlx_clear_phy_int(struct atlx_adapter *adapter) | |||
182 | } | 182 | } |
183 | 183 | ||
184 | /* | 184 | /* |
185 | * atlx_get_stats - Get System Network Statistics | ||
186 | * @netdev: network interface device structure | ||
187 | * | ||
188 | * Returns the address of the device statistics structure. | ||
189 | * The statistics are actually updated from the timer callback. | ||
190 | */ | ||
191 | static struct net_device_stats *atlx_get_stats(struct net_device *netdev) | ||
192 | { | ||
193 | struct atlx_adapter *adapter = netdev_priv(netdev); | ||
194 | return &adapter->net_stats; | ||
195 | } | ||
196 | |||
197 | /* | ||
198 | * atlx_tx_timeout - Respond to a Tx Hang | 185 | * atlx_tx_timeout - Respond to a Tx Hang |
199 | * @netdev: network interface device structure | 186 | * @netdev: network interface device structure |
200 | */ | 187 | */ |