diff options
Diffstat (limited to 'drivers/net/atl1c/atl1c_main.c')
-rw-r--r-- | drivers/net/atl1c/atl1c_main.c | 104 |
1 files changed, 49 insertions, 55 deletions
diff --git a/drivers/net/atl1c/atl1c_main.c b/drivers/net/atl1c/atl1c_main.c index c7b8ef507ebd..1269ba5d6e56 100644 --- a/drivers/net/atl1c/atl1c_main.c +++ b/drivers/net/atl1c/atl1c_main.c | |||
@@ -48,6 +48,7 @@ static DEFINE_PCI_DEVICE_TABLE(atl1c_pci_tbl) = { | |||
48 | {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATHEROS_L2C_B)}, | 48 | {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATHEROS_L2C_B)}, |
49 | {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATHEROS_L2C_B2)}, | 49 | {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATHEROS_L2C_B2)}, |
50 | {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATHEROS_L1D)}, | 50 | {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATHEROS_L1D)}, |
51 | {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATHEROS_L1D_2_0)}, | ||
51 | /* required last entry */ | 52 | /* required last entry */ |
52 | { 0 } | 53 | { 0 } |
53 | }; | 54 | }; |
@@ -66,6 +67,8 @@ static void atl1c_set_aspm(struct atl1c_hw *hw, bool linkup); | |||
66 | static void atl1c_setup_mac_ctrl(struct atl1c_adapter *adapter); | 67 | static void atl1c_setup_mac_ctrl(struct atl1c_adapter *adapter); |
67 | static void atl1c_clean_rx_irq(struct atl1c_adapter *adapter, u8 que, | 68 | static void atl1c_clean_rx_irq(struct atl1c_adapter *adapter, u8 que, |
68 | int *work_done, int work_to_do); | 69 | int *work_done, int work_to_do); |
70 | static int atl1c_up(struct atl1c_adapter *adapter); | ||
71 | static void atl1c_down(struct atl1c_adapter *adapter); | ||
69 | 72 | ||
70 | static const u16 atl1c_pay_load_size[] = { | 73 | static const u16 atl1c_pay_load_size[] = { |
71 | 128, 256, 512, 1024, 2048, 4096, | 74 | 128, 256, 512, 1024, 2048, 4096, |
@@ -322,7 +325,7 @@ static void atl1c_link_chg_event(struct atl1c_adapter *adapter) | |||
322 | } | 325 | } |
323 | } | 326 | } |
324 | 327 | ||
325 | adapter->work_event |= ATL1C_WORK_EVENT_LINK_CHANGE; | 328 | set_bit(ATL1C_WORK_EVENT_LINK_CHANGE, &adapter->work_event); |
326 | schedule_work(&adapter->common_task); | 329 | schedule_work(&adapter->common_task); |
327 | } | 330 | } |
328 | 331 | ||
@@ -334,20 +337,16 @@ static void atl1c_common_task(struct work_struct *work) | |||
334 | adapter = container_of(work, struct atl1c_adapter, common_task); | 337 | adapter = container_of(work, struct atl1c_adapter, common_task); |
335 | netdev = adapter->netdev; | 338 | netdev = adapter->netdev; |
336 | 339 | ||
337 | if (adapter->work_event & ATL1C_WORK_EVENT_RESET) { | 340 | if (test_and_clear_bit(ATL1C_WORK_EVENT_RESET, &adapter->work_event)) { |
338 | adapter->work_event &= ~ATL1C_WORK_EVENT_RESET; | ||
339 | netif_device_detach(netdev); | 341 | netif_device_detach(netdev); |
340 | atl1c_down(adapter); | 342 | atl1c_down(adapter); |
341 | atl1c_up(adapter); | 343 | atl1c_up(adapter); |
342 | netif_device_attach(netdev); | 344 | netif_device_attach(netdev); |
343 | return; | ||
344 | } | 345 | } |
345 | 346 | ||
346 | if (adapter->work_event & ATL1C_WORK_EVENT_LINK_CHANGE) { | 347 | if (test_and_clear_bit(ATL1C_WORK_EVENT_LINK_CHANGE, |
347 | adapter->work_event &= ~ATL1C_WORK_EVENT_LINK_CHANGE; | 348 | &adapter->work_event)) |
348 | atl1c_check_link_status(adapter); | 349 | atl1c_check_link_status(adapter); |
349 | } | ||
350 | return; | ||
351 | } | 350 | } |
352 | 351 | ||
353 | 352 | ||
@@ -366,7 +365,7 @@ static void atl1c_tx_timeout(struct net_device *netdev) | |||
366 | struct atl1c_adapter *adapter = netdev_priv(netdev); | 365 | struct atl1c_adapter *adapter = netdev_priv(netdev); |
367 | 366 | ||
368 | /* Do the reset outside of interrupt context */ | 367 | /* Do the reset outside of interrupt context */ |
369 | adapter->work_event |= ATL1C_WORK_EVENT_RESET; | 368 | set_bit(ATL1C_WORK_EVENT_RESET, &adapter->work_event); |
370 | schedule_work(&adapter->common_task); | 369 | schedule_work(&adapter->common_task); |
371 | } | 370 | } |
372 | 371 | ||
@@ -481,6 +480,15 @@ static void atl1c_set_rxbufsize(struct atl1c_adapter *adapter, | |||
481 | adapter->rx_buffer_len = mtu > AT_RX_BUF_SIZE ? | 480 | adapter->rx_buffer_len = mtu > AT_RX_BUF_SIZE ? |
482 | roundup(mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN, 8) : AT_RX_BUF_SIZE; | 481 | roundup(mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN, 8) : AT_RX_BUF_SIZE; |
483 | } | 482 | } |
483 | |||
484 | static u32 atl1c_fix_features(struct net_device *netdev, u32 features) | ||
485 | { | ||
486 | if (netdev->mtu > MAX_TSO_FRAME_SIZE) | ||
487 | features &= ~(NETIF_F_TSO | NETIF_F_TSO6); | ||
488 | |||
489 | return features; | ||
490 | } | ||
491 | |||
484 | /* | 492 | /* |
485 | * atl1c_change_mtu - Change the Maximum Transfer Unit | 493 | * atl1c_change_mtu - Change the Maximum Transfer Unit |
486 | * @netdev: network interface device structure | 494 | * @netdev: network interface device structure |
@@ -507,14 +515,8 @@ static int atl1c_change_mtu(struct net_device *netdev, int new_mtu) | |||
507 | netdev->mtu = new_mtu; | 515 | netdev->mtu = new_mtu; |
508 | adapter->hw.max_frame_size = new_mtu; | 516 | adapter->hw.max_frame_size = new_mtu; |
509 | atl1c_set_rxbufsize(adapter, netdev); | 517 | atl1c_set_rxbufsize(adapter, netdev); |
510 | if (new_mtu > MAX_TSO_FRAME_SIZE) { | ||
511 | adapter->netdev->features &= ~NETIF_F_TSO; | ||
512 | adapter->netdev->features &= ~NETIF_F_TSO6; | ||
513 | } else { | ||
514 | adapter->netdev->features |= NETIF_F_TSO; | ||
515 | adapter->netdev->features |= NETIF_F_TSO6; | ||
516 | } | ||
517 | atl1c_down(adapter); | 518 | atl1c_down(adapter); |
519 | netdev_update_features(netdev); | ||
518 | atl1c_up(adapter); | 520 | atl1c_up(adapter); |
519 | clear_bit(__AT_RESETTING, &adapter->flags); | 521 | clear_bit(__AT_RESETTING, &adapter->flags); |
520 | if (adapter->hw.ctrl_flags & ATL1C_FPGA_VERSION) { | 522 | if (adapter->hw.ctrl_flags & ATL1C_FPGA_VERSION) { |
@@ -700,6 +702,7 @@ static int __devinit atl1c_sw_init(struct atl1c_adapter *adapter) | |||
700 | 702 | ||
701 | 703 | ||
702 | adapter->wol = 0; | 704 | adapter->wol = 0; |
705 | device_set_wakeup_enable(&pdev->dev, false); | ||
703 | adapter->link_speed = SPEED_0; | 706 | adapter->link_speed = SPEED_0; |
704 | adapter->link_duplex = FULL_DUPLEX; | 707 | adapter->link_duplex = FULL_DUPLEX; |
705 | adapter->num_rx_queues = AT_DEF_RECEIVE_QUEUE; | 708 | adapter->num_rx_queues = AT_DEF_RECEIVE_QUEUE; |
@@ -1088,20 +1091,18 @@ static void atl1c_configure_tx(struct atl1c_adapter *adapter) | |||
1088 | u32 max_pay_load; | 1091 | u32 max_pay_load; |
1089 | u16 tx_offload_thresh; | 1092 | u16 tx_offload_thresh; |
1090 | u32 txq_ctrl_data; | 1093 | u32 txq_ctrl_data; |
1091 | u32 extra_size = 0; /* Jumbo frame threshold in QWORD unit */ | ||
1092 | u32 max_pay_load_data; | 1094 | u32 max_pay_load_data; |
1093 | 1095 | ||
1094 | extra_size = ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN; | ||
1095 | tx_offload_thresh = MAX_TX_OFFLOAD_THRESH; | 1096 | tx_offload_thresh = MAX_TX_OFFLOAD_THRESH; |
1096 | AT_WRITE_REG(hw, REG_TX_TSO_OFFLOAD_THRESH, | 1097 | AT_WRITE_REG(hw, REG_TX_TSO_OFFLOAD_THRESH, |
1097 | (tx_offload_thresh >> 3) & TX_TSO_OFFLOAD_THRESH_MASK); | 1098 | (tx_offload_thresh >> 3) & TX_TSO_OFFLOAD_THRESH_MASK); |
1098 | AT_READ_REG(hw, REG_DEVICE_CTRL, &dev_ctrl_data); | 1099 | AT_READ_REG(hw, REG_DEVICE_CTRL, &dev_ctrl_data); |
1099 | max_pay_load = (dev_ctrl_data >> DEVICE_CTRL_MAX_PAYLOAD_SHIFT) & | 1100 | max_pay_load = (dev_ctrl_data >> DEVICE_CTRL_MAX_PAYLOAD_SHIFT) & |
1100 | DEVICE_CTRL_MAX_PAYLOAD_MASK; | 1101 | DEVICE_CTRL_MAX_PAYLOAD_MASK; |
1101 | hw->dmaw_block = min(max_pay_load, hw->dmaw_block); | 1102 | hw->dmaw_block = min_t(u32, max_pay_load, hw->dmaw_block); |
1102 | max_pay_load = (dev_ctrl_data >> DEVICE_CTRL_MAX_RREQ_SZ_SHIFT) & | 1103 | max_pay_load = (dev_ctrl_data >> DEVICE_CTRL_MAX_RREQ_SZ_SHIFT) & |
1103 | DEVICE_CTRL_MAX_RREQ_SZ_MASK; | 1104 | DEVICE_CTRL_MAX_RREQ_SZ_MASK; |
1104 | hw->dmar_block = min(max_pay_load, hw->dmar_block); | 1105 | hw->dmar_block = min_t(u32, max_pay_load, hw->dmar_block); |
1105 | 1106 | ||
1106 | txq_ctrl_data = (hw->tpd_burst & TXQ_NUM_TPD_BURST_MASK) << | 1107 | txq_ctrl_data = (hw->tpd_burst & TXQ_NUM_TPD_BURST_MASK) << |
1107 | TXQ_NUM_TPD_BURST_SHIFT; | 1108 | TXQ_NUM_TPD_BURST_SHIFT; |
@@ -1562,7 +1563,7 @@ static struct net_device_stats *atl1c_get_stats(struct net_device *netdev) | |||
1562 | { | 1563 | { |
1563 | struct atl1c_adapter *adapter = netdev_priv(netdev); | 1564 | struct atl1c_adapter *adapter = netdev_priv(netdev); |
1564 | struct atl1c_hw_stats *hw_stats = &adapter->hw_stats; | 1565 | struct atl1c_hw_stats *hw_stats = &adapter->hw_stats; |
1565 | struct net_device_stats *net_stats = &adapter->net_stats; | 1566 | struct net_device_stats *net_stats = &netdev->stats; |
1566 | 1567 | ||
1567 | atl1c_update_hw_stats(adapter); | 1568 | atl1c_update_hw_stats(adapter); |
1568 | net_stats->rx_packets = hw_stats->rx_ok; | 1569 | net_stats->rx_packets = hw_stats->rx_ok; |
@@ -1590,7 +1591,7 @@ static struct net_device_stats *atl1c_get_stats(struct net_device *netdev) | |||
1590 | net_stats->tx_aborted_errors = hw_stats->tx_abort_col; | 1591 | net_stats->tx_aborted_errors = hw_stats->tx_abort_col; |
1591 | net_stats->tx_window_errors = hw_stats->tx_late_col; | 1592 | net_stats->tx_window_errors = hw_stats->tx_late_col; |
1592 | 1593 | ||
1593 | return &adapter->net_stats; | 1594 | return net_stats; |
1594 | } | 1595 | } |
1595 | 1596 | ||
1596 | static inline void atl1c_clear_phy_int(struct atl1c_adapter *adapter) | 1597 | static inline void atl1c_clear_phy_int(struct atl1c_adapter *adapter) |
@@ -1700,7 +1701,7 @@ static irqreturn_t atl1c_intr(int irq, void *data) | |||
1700 | 1701 | ||
1701 | /* link event */ | 1702 | /* link event */ |
1702 | if (status & (ISR_GPHY | ISR_MANUAL)) { | 1703 | if (status & (ISR_GPHY | ISR_MANUAL)) { |
1703 | adapter->net_stats.tx_carrier_errors++; | 1704 | netdev->stats.tx_carrier_errors++; |
1704 | atl1c_link_chg_event(adapter); | 1705 | atl1c_link_chg_event(adapter); |
1705 | break; | 1706 | break; |
1706 | } | 1707 | } |
@@ -1719,7 +1720,7 @@ static inline void atl1c_rx_checksum(struct atl1c_adapter *adapter, | |||
1719 | * cannot figure out if the packet is fragmented or not, | 1720 | * cannot figure out if the packet is fragmented or not, |
1720 | * so we tell the KERNEL CHECKSUM_NONE | 1721 | * so we tell the KERNEL CHECKSUM_NONE |
1721 | */ | 1722 | */ |
1722 | skb->ip_summed = CHECKSUM_NONE; | 1723 | skb_checksum_none_assert(skb); |
1723 | } | 1724 | } |
1724 | 1725 | ||
1725 | static int atl1c_alloc_rx_buffer(struct atl1c_adapter *adapter, const int ringid) | 1726 | static int atl1c_alloc_rx_buffer(struct atl1c_adapter *adapter, const int ringid) |
@@ -2076,7 +2077,7 @@ static int atl1c_tso_csum(struct atl1c_adapter *adapter, | |||
2076 | check_sum: | 2077 | check_sum: |
2077 | if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { | 2078 | if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { |
2078 | u8 css, cso; | 2079 | u8 css, cso; |
2079 | cso = skb_transport_offset(skb); | 2080 | cso = skb_checksum_start_offset(skb); |
2080 | 2081 | ||
2081 | if (unlikely(cso & 0x1)) { | 2082 | if (unlikely(cso & 0x1)) { |
2082 | if (netif_msg_tx_err(adapter)) | 2083 | if (netif_msg_tx_err(adapter)) |
@@ -2243,7 +2244,7 @@ static netdev_tx_t atl1c_xmit_frame(struct sk_buff *skb, | |||
2243 | return NETDEV_TX_OK; | 2244 | return NETDEV_TX_OK; |
2244 | } | 2245 | } |
2245 | 2246 | ||
2246 | if (unlikely(adapter->vlgrp && vlan_tx_tag_present(skb))) { | 2247 | if (unlikely(vlan_tx_tag_present(skb))) { |
2247 | u16 vlan = vlan_tx_tag_get(skb); | 2248 | u16 vlan = vlan_tx_tag_get(skb); |
2248 | __le16 tag; | 2249 | __le16 tag; |
2249 | 2250 | ||
@@ -2309,7 +2310,7 @@ static int atl1c_request_irq(struct atl1c_adapter *adapter) | |||
2309 | return err; | 2310 | return err; |
2310 | } | 2311 | } |
2311 | 2312 | ||
2312 | int atl1c_up(struct atl1c_adapter *adapter) | 2313 | static int atl1c_up(struct atl1c_adapter *adapter) |
2313 | { | 2314 | { |
2314 | struct net_device *netdev = adapter->netdev; | 2315 | struct net_device *netdev = adapter->netdev; |
2315 | int num; | 2316 | int num; |
@@ -2351,7 +2352,7 @@ err_alloc_rx: | |||
2351 | return err; | 2352 | return err; |
2352 | } | 2353 | } |
2353 | 2354 | ||
2354 | void atl1c_down(struct atl1c_adapter *adapter) | 2355 | static void atl1c_down(struct atl1c_adapter *adapter) |
2355 | { | 2356 | { |
2356 | struct net_device *netdev = adapter->netdev; | 2357 | struct net_device *netdev = adapter->netdev; |
2357 | 2358 | ||
@@ -2442,8 +2443,9 @@ static int atl1c_close(struct net_device *netdev) | |||
2442 | return 0; | 2443 | return 0; |
2443 | } | 2444 | } |
2444 | 2445 | ||
2445 | static int atl1c_suspend(struct pci_dev *pdev, pm_message_t state) | 2446 | static int atl1c_suspend(struct device *dev) |
2446 | { | 2447 | { |
2448 | struct pci_dev *pdev = to_pci_dev(dev); | ||
2447 | struct net_device *netdev = pci_get_drvdata(pdev); | 2449 | struct net_device *netdev = pci_get_drvdata(pdev); |
2448 | struct atl1c_adapter *adapter = netdev_priv(netdev); | 2450 | struct atl1c_adapter *adapter = netdev_priv(netdev); |
2449 | struct atl1c_hw *hw = &adapter->hw; | 2451 | struct atl1c_hw *hw = &adapter->hw; |
@@ -2452,7 +2454,6 @@ static int atl1c_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2452 | u32 wol_ctrl_data = 0; | 2454 | u32 wol_ctrl_data = 0; |
2453 | u16 mii_intr_status_data = 0; | 2455 | u16 mii_intr_status_data = 0; |
2454 | u32 wufc = adapter->wol; | 2456 | u32 wufc = adapter->wol; |
2455 | int retval = 0; | ||
2456 | 2457 | ||
2457 | atl1c_disable_l0s_l1(hw); | 2458 | atl1c_disable_l0s_l1(hw); |
2458 | if (netif_running(netdev)) { | 2459 | if (netif_running(netdev)) { |
@@ -2460,9 +2461,6 @@ static int atl1c_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2460 | atl1c_down(adapter); | 2461 | atl1c_down(adapter); |
2461 | } | 2462 | } |
2462 | netif_device_detach(netdev); | 2463 | netif_device_detach(netdev); |
2463 | retval = pci_save_state(pdev); | ||
2464 | if (retval) | ||
2465 | return retval; | ||
2466 | 2464 | ||
2467 | if (wufc) | 2465 | if (wufc) |
2468 | if (atl1c_phy_power_saving(hw) != 0) | 2466 | if (atl1c_phy_power_saving(hw) != 0) |
@@ -2523,12 +2521,8 @@ static int atl1c_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2523 | AT_WRITE_REG(hw, REG_WOL_CTRL, wol_ctrl_data); | 2521 | AT_WRITE_REG(hw, REG_WOL_CTRL, wol_ctrl_data); |
2524 | AT_WRITE_REG(hw, REG_MAC_CTRL, mac_ctrl_data); | 2522 | AT_WRITE_REG(hw, REG_MAC_CTRL, mac_ctrl_data); |
2525 | 2523 | ||
2526 | /* pcie patch */ | ||
2527 | device_set_wakeup_enable(&pdev->dev, 1); | ||
2528 | |||
2529 | AT_WRITE_REG(hw, REG_GPHY_CTRL, GPHY_CTRL_DEFAULT | | 2524 | AT_WRITE_REG(hw, REG_GPHY_CTRL, GPHY_CTRL_DEFAULT | |
2530 | GPHY_CTRL_EXT_RESET); | 2525 | GPHY_CTRL_EXT_RESET); |
2531 | pci_prepare_to_sleep(pdev); | ||
2532 | } else { | 2526 | } else { |
2533 | AT_WRITE_REG(hw, REG_GPHY_CTRL, GPHY_CTRL_POWER_SAVING); | 2527 | AT_WRITE_REG(hw, REG_GPHY_CTRL, GPHY_CTRL_POWER_SAVING); |
2534 | master_ctrl_data |= MASTER_CTRL_CLK_SEL_DIS; | 2528 | master_ctrl_data |= MASTER_CTRL_CLK_SEL_DIS; |
@@ -2538,25 +2532,18 @@ static int atl1c_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2538 | AT_WRITE_REG(hw, REG_MAC_CTRL, mac_ctrl_data); | 2532 | AT_WRITE_REG(hw, REG_MAC_CTRL, mac_ctrl_data); |
2539 | AT_WRITE_REG(hw, REG_WOL_CTRL, 0); | 2533 | AT_WRITE_REG(hw, REG_WOL_CTRL, 0); |
2540 | hw->phy_configured = false; /* re-init PHY when resume */ | 2534 | hw->phy_configured = false; /* re-init PHY when resume */ |
2541 | pci_enable_wake(pdev, pci_choose_state(pdev, state), 0); | ||
2542 | } | 2535 | } |
2543 | 2536 | ||
2544 | pci_disable_device(pdev); | ||
2545 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | ||
2546 | |||
2547 | return 0; | 2537 | return 0; |
2548 | } | 2538 | } |
2549 | 2539 | ||
2550 | static int atl1c_resume(struct pci_dev *pdev) | 2540 | #ifdef CONFIG_PM_SLEEP |
2541 | static int atl1c_resume(struct device *dev) | ||
2551 | { | 2542 | { |
2543 | struct pci_dev *pdev = to_pci_dev(dev); | ||
2552 | struct net_device *netdev = pci_get_drvdata(pdev); | 2544 | struct net_device *netdev = pci_get_drvdata(pdev); |
2553 | struct atl1c_adapter *adapter = netdev_priv(netdev); | 2545 | struct atl1c_adapter *adapter = netdev_priv(netdev); |
2554 | 2546 | ||
2555 | pci_set_power_state(pdev, PCI_D0); | ||
2556 | pci_restore_state(pdev); | ||
2557 | pci_enable_wake(pdev, PCI_D3hot, 0); | ||
2558 | pci_enable_wake(pdev, PCI_D3cold, 0); | ||
2559 | |||
2560 | AT_WRITE_REG(&adapter->hw, REG_WOL_CTRL, 0); | 2547 | AT_WRITE_REG(&adapter->hw, REG_WOL_CTRL, 0); |
2561 | atl1c_reset_pcie(&adapter->hw, ATL1C_PCIE_L0S_L1_DISABLE | | 2548 | atl1c_reset_pcie(&adapter->hw, ATL1C_PCIE_L0S_L1_DISABLE | |
2562 | ATL1C_PCIE_PHY_RESET); | 2549 | ATL1C_PCIE_PHY_RESET); |
@@ -2577,10 +2564,16 @@ static int atl1c_resume(struct pci_dev *pdev) | |||
2577 | 2564 | ||
2578 | return 0; | 2565 | return 0; |
2579 | } | 2566 | } |
2567 | #endif | ||
2580 | 2568 | ||
2581 | static void atl1c_shutdown(struct pci_dev *pdev) | 2569 | static void atl1c_shutdown(struct pci_dev *pdev) |
2582 | { | 2570 | { |
2583 | atl1c_suspend(pdev, PMSG_SUSPEND); | 2571 | struct net_device *netdev = pci_get_drvdata(pdev); |
2572 | struct atl1c_adapter *adapter = netdev_priv(netdev); | ||
2573 | |||
2574 | atl1c_suspend(&pdev->dev); | ||
2575 | pci_wake_from_d3(pdev, adapter->wol); | ||
2576 | pci_set_power_state(pdev, PCI_D3hot); | ||
2584 | } | 2577 | } |
2585 | 2578 | ||
2586 | static const struct net_device_ops atl1c_netdev_ops = { | 2579 | static const struct net_device_ops atl1c_netdev_ops = { |
@@ -2591,6 +2584,7 @@ static const struct net_device_ops atl1c_netdev_ops = { | |||
2591 | .ndo_set_mac_address = atl1c_set_mac_addr, | 2584 | .ndo_set_mac_address = atl1c_set_mac_addr, |
2592 | .ndo_set_multicast_list = atl1c_set_multi, | 2585 | .ndo_set_multicast_list = atl1c_set_multi, |
2593 | .ndo_change_mtu = atl1c_change_mtu, | 2586 | .ndo_change_mtu = atl1c_change_mtu, |
2587 | .ndo_fix_features = atl1c_fix_features, | ||
2594 | .ndo_do_ioctl = atl1c_ioctl, | 2588 | .ndo_do_ioctl = atl1c_ioctl, |
2595 | .ndo_tx_timeout = atl1c_tx_timeout, | 2589 | .ndo_tx_timeout = atl1c_tx_timeout, |
2596 | .ndo_get_stats = atl1c_get_stats, | 2590 | .ndo_get_stats = atl1c_get_stats, |
@@ -2611,12 +2605,13 @@ static int atl1c_init_netdev(struct net_device *netdev, struct pci_dev *pdev) | |||
2611 | atl1c_set_ethtool_ops(netdev); | 2605 | atl1c_set_ethtool_ops(netdev); |
2612 | 2606 | ||
2613 | /* TODO: add when ready */ | 2607 | /* TODO: add when ready */ |
2614 | netdev->features = NETIF_F_SG | | 2608 | netdev->hw_features = NETIF_F_SG | |
2615 | NETIF_F_HW_CSUM | | 2609 | NETIF_F_HW_CSUM | |
2616 | NETIF_F_HW_VLAN_TX | | 2610 | NETIF_F_HW_VLAN_TX | |
2617 | NETIF_F_HW_VLAN_RX | | ||
2618 | NETIF_F_TSO | | 2611 | NETIF_F_TSO | |
2619 | NETIF_F_TSO6; | 2612 | NETIF_F_TSO6; |
2613 | netdev->features = netdev->hw_features | | ||
2614 | NETIF_F_HW_VLAN_RX; | ||
2620 | return 0; | 2615 | return 0; |
2621 | } | 2616 | } |
2622 | 2617 | ||
@@ -2724,7 +2719,6 @@ static int __devinit atl1c_probe(struct pci_dev *pdev, | |||
2724 | goto err_reset; | 2719 | goto err_reset; |
2725 | } | 2720 | } |
2726 | 2721 | ||
2727 | device_init_wakeup(&pdev->dev, 1); | ||
2728 | /* reset the controller to | 2722 | /* reset the controller to |
2729 | * put the device in a known good starting state */ | 2723 | * put the device in a known good starting state */ |
2730 | err = atl1c_phy_init(&adapter->hw); | 2724 | err = atl1c_phy_init(&adapter->hw); |
@@ -2884,16 +2878,16 @@ static struct pci_error_handlers atl1c_err_handler = { | |||
2884 | .resume = atl1c_io_resume, | 2878 | .resume = atl1c_io_resume, |
2885 | }; | 2879 | }; |
2886 | 2880 | ||
2881 | static SIMPLE_DEV_PM_OPS(atl1c_pm_ops, atl1c_suspend, atl1c_resume); | ||
2882 | |||
2887 | static struct pci_driver atl1c_driver = { | 2883 | static struct pci_driver atl1c_driver = { |
2888 | .name = atl1c_driver_name, | 2884 | .name = atl1c_driver_name, |
2889 | .id_table = atl1c_pci_tbl, | 2885 | .id_table = atl1c_pci_tbl, |
2890 | .probe = atl1c_probe, | 2886 | .probe = atl1c_probe, |
2891 | .remove = __devexit_p(atl1c_remove), | 2887 | .remove = __devexit_p(atl1c_remove), |
2892 | /* Power Managment Hooks */ | ||
2893 | .suspend = atl1c_suspend, | ||
2894 | .resume = atl1c_resume, | ||
2895 | .shutdown = atl1c_shutdown, | 2888 | .shutdown = atl1c_shutdown, |
2896 | .err_handler = &atl1c_err_handler | 2889 | .err_handler = &atl1c_err_handler, |
2890 | .driver.pm = &atl1c_pm_ops, | ||
2897 | }; | 2891 | }; |
2898 | 2892 | ||
2899 | /* | 2893 | /* |