diff options
Diffstat (limited to 'drivers/net/e100.c')
-rw-r--r-- | drivers/net/e100.c | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index e8bfcce6b319..5894716de19f 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -1880,7 +1880,6 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx, | |||
1880 | } else { | 1880 | } else { |
1881 | dev->stats.rx_packets++; | 1881 | dev->stats.rx_packets++; |
1882 | dev->stats.rx_bytes += actual_size; | 1882 | dev->stats.rx_bytes += actual_size; |
1883 | nic->netdev->last_rx = jiffies; | ||
1884 | netif_receive_skb(skb); | 1883 | netif_receive_skb(skb); |
1885 | if(work_done) | 1884 | if(work_done) |
1886 | (*work_done)++; | 1885 | (*work_done)++; |
@@ -2322,7 +2321,8 @@ static int e100_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) | |||
2322 | { | 2321 | { |
2323 | struct nic *nic = netdev_priv(netdev); | 2322 | struct nic *nic = netdev_priv(netdev); |
2324 | 2323 | ||
2325 | if(wol->wolopts != WAKE_MAGIC && wol->wolopts != 0) | 2324 | if ((wol->wolopts && wol->wolopts != WAKE_MAGIC) || |
2325 | !device_can_wakeup(&nic->pdev->dev)) | ||
2326 | return -EOPNOTSUPP; | 2326 | return -EOPNOTSUPP; |
2327 | 2327 | ||
2328 | if(wol->wolopts) | 2328 | if(wol->wolopts) |
@@ -2330,6 +2330,8 @@ static int e100_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) | |||
2330 | else | 2330 | else |
2331 | nic->flags &= ~wol_magic; | 2331 | nic->flags &= ~wol_magic; |
2332 | 2332 | ||
2333 | device_set_wakeup_enable(&nic->pdev->dev, wol->wolopts); | ||
2334 | |||
2333 | e100_exec_cb(nic, NULL, e100_configure); | 2335 | e100_exec_cb(nic, NULL, e100_configure); |
2334 | 2336 | ||
2335 | return 0; | 2337 | return 0; |
@@ -2610,13 +2612,26 @@ static int e100_close(struct net_device *netdev) | |||
2610 | return 0; | 2612 | return 0; |
2611 | } | 2613 | } |
2612 | 2614 | ||
2615 | static const struct net_device_ops e100_netdev_ops = { | ||
2616 | .ndo_open = e100_open, | ||
2617 | .ndo_stop = e100_close, | ||
2618 | .ndo_validate_addr = eth_validate_addr, | ||
2619 | .ndo_set_multicast_list = e100_set_multicast_list, | ||
2620 | .ndo_set_mac_address = e100_set_mac_address, | ||
2621 | .ndo_change_mtu = e100_change_mtu, | ||
2622 | .ndo_do_ioctl = e100_do_ioctl, | ||
2623 | .ndo_tx_timeout = e100_tx_timeout, | ||
2624 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
2625 | .ndo_poll_controller = e100_netpoll, | ||
2626 | #endif | ||
2627 | }; | ||
2628 | |||
2613 | static int __devinit e100_probe(struct pci_dev *pdev, | 2629 | static int __devinit e100_probe(struct pci_dev *pdev, |
2614 | const struct pci_device_id *ent) | 2630 | const struct pci_device_id *ent) |
2615 | { | 2631 | { |
2616 | struct net_device *netdev; | 2632 | struct net_device *netdev; |
2617 | struct nic *nic; | 2633 | struct nic *nic; |
2618 | int err; | 2634 | int err; |
2619 | DECLARE_MAC_BUF(mac); | ||
2620 | 2635 | ||
2621 | if(!(netdev = alloc_etherdev(sizeof(struct nic)))) { | 2636 | if(!(netdev = alloc_etherdev(sizeof(struct nic)))) { |
2622 | if(((1 << debug) - 1) & NETIF_MSG_PROBE) | 2637 | if(((1 << debug) - 1) & NETIF_MSG_PROBE) |
@@ -2624,19 +2639,10 @@ static int __devinit e100_probe(struct pci_dev *pdev, | |||
2624 | return -ENOMEM; | 2639 | return -ENOMEM; |
2625 | } | 2640 | } |
2626 | 2641 | ||
2627 | netdev->open = e100_open; | 2642 | netdev->netdev_ops = &e100_netdev_ops; |
2628 | netdev->stop = e100_close; | ||
2629 | netdev->hard_start_xmit = e100_xmit_frame; | 2643 | netdev->hard_start_xmit = e100_xmit_frame; |
2630 | netdev->set_multicast_list = e100_set_multicast_list; | ||
2631 | netdev->set_mac_address = e100_set_mac_address; | ||
2632 | netdev->change_mtu = e100_change_mtu; | ||
2633 | netdev->do_ioctl = e100_do_ioctl; | ||
2634 | SET_ETHTOOL_OPS(netdev, &e100_ethtool_ops); | 2644 | SET_ETHTOOL_OPS(netdev, &e100_ethtool_ops); |
2635 | netdev->tx_timeout = e100_tx_timeout; | ||
2636 | netdev->watchdog_timeo = E100_WATCHDOG_PERIOD; | 2645 | netdev->watchdog_timeo = E100_WATCHDOG_PERIOD; |
2637 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
2638 | netdev->poll_controller = e100_netpoll; | ||
2639 | #endif | ||
2640 | strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1); | 2646 | strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1); |
2641 | 2647 | ||
2642 | nic = netdev_priv(netdev); | 2648 | nic = netdev_priv(netdev); |
@@ -2734,8 +2740,10 @@ static int __devinit e100_probe(struct pci_dev *pdev, | |||
2734 | 2740 | ||
2735 | /* Wol magic packet can be enabled from eeprom */ | 2741 | /* Wol magic packet can be enabled from eeprom */ |
2736 | if((nic->mac >= mac_82558_D101_A4) && | 2742 | if((nic->mac >= mac_82558_D101_A4) && |
2737 | (nic->eeprom[eeprom_id] & eeprom_id_wol)) | 2743 | (nic->eeprom[eeprom_id] & eeprom_id_wol)) { |
2738 | nic->flags |= wol_magic; | 2744 | nic->flags |= wol_magic; |
2745 | device_set_wakeup_enable(&pdev->dev, true); | ||
2746 | } | ||
2739 | 2747 | ||
2740 | /* ack any pending wake events, disable PME */ | 2748 | /* ack any pending wake events, disable PME */ |
2741 | pci_pme_active(pdev, false); | 2749 | pci_pme_active(pdev, false); |
@@ -2746,9 +2754,9 @@ static int __devinit e100_probe(struct pci_dev *pdev, | |||
2746 | goto err_out_free; | 2754 | goto err_out_free; |
2747 | } | 2755 | } |
2748 | 2756 | ||
2749 | DPRINTK(PROBE, INFO, "addr 0x%llx, irq %d, MAC addr %s\n", | 2757 | DPRINTK(PROBE, INFO, "addr 0x%llx, irq %d, MAC addr %pM\n", |
2750 | (unsigned long long)pci_resource_start(pdev, use_io ? 1 : 0), | 2758 | (unsigned long long)pci_resource_start(pdev, use_io ? 1 : 0), |
2751 | pdev->irq, print_mac(mac, netdev->dev_addr)); | 2759 | pdev->irq, netdev->dev_addr); |
2752 | 2760 | ||
2753 | return 0; | 2761 | return 0; |
2754 | 2762 | ||
@@ -2794,11 +2802,10 @@ static int e100_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2794 | pci_save_state(pdev); | 2802 | pci_save_state(pdev); |
2795 | 2803 | ||
2796 | if ((nic->flags & wol_magic) | e100_asf(nic)) { | 2804 | if ((nic->flags & wol_magic) | e100_asf(nic)) { |
2797 | pci_enable_wake(pdev, PCI_D3hot, 1); | 2805 | if (pci_enable_wake(pdev, PCI_D3cold, true)) |
2798 | pci_enable_wake(pdev, PCI_D3cold, 1); | 2806 | pci_enable_wake(pdev, PCI_D3hot, true); |
2799 | } else { | 2807 | } else { |
2800 | pci_enable_wake(pdev, PCI_D3hot, 0); | 2808 | pci_enable_wake(pdev, PCI_D3hot, false); |
2801 | pci_enable_wake(pdev, PCI_D3cold, 0); | ||
2802 | } | 2809 | } |
2803 | 2810 | ||
2804 | pci_disable_device(pdev); | 2811 | pci_disable_device(pdev); |
@@ -2843,7 +2850,7 @@ static pci_ers_result_t e100_io_error_detected(struct pci_dev *pdev, pci_channel | |||
2843 | struct nic *nic = netdev_priv(netdev); | 2850 | struct nic *nic = netdev_priv(netdev); |
2844 | 2851 | ||
2845 | /* Similar to calling e100_down(), but avoids adapter I/O. */ | 2852 | /* Similar to calling e100_down(), but avoids adapter I/O. */ |
2846 | netdev->stop(netdev); | 2853 | e100_close(netdev); |
2847 | 2854 | ||
2848 | /* Detach; put netif into a state similar to hotplug unplug. */ | 2855 | /* Detach; put netif into a state similar to hotplug unplug. */ |
2849 | napi_enable(&nic->napi); | 2856 | napi_enable(&nic->napi); |