diff options
Diffstat (limited to 'drivers/net/e1000e/netdev.c')
-rw-r--r-- | drivers/net/e1000e/netdev.c | 111 |
1 files changed, 74 insertions, 37 deletions
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 122539a0e1f..65fd9797d02 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -103,8 +103,6 @@ static void e1000_receive_skb(struct e1000_adapter *adapter, | |||
103 | le16_to_cpu(vlan)); | 103 | le16_to_cpu(vlan)); |
104 | else | 104 | else |
105 | netif_receive_skb(skb); | 105 | netif_receive_skb(skb); |
106 | |||
107 | netdev->last_rx = jiffies; | ||
108 | } | 106 | } |
109 | 107 | ||
110 | /** | 108 | /** |
@@ -2003,8 +2001,7 @@ static int e1000_clean(struct napi_struct *napi, int budget) | |||
2003 | struct net_device *poll_dev = adapter->netdev; | 2001 | struct net_device *poll_dev = adapter->netdev; |
2004 | int tx_cleaned = 0, work_done = 0; | 2002 | int tx_cleaned = 0, work_done = 0; |
2005 | 2003 | ||
2006 | /* Must NOT use netdev_priv macro here. */ | 2004 | adapter = netdev_priv(poll_dev); |
2007 | adapter = poll_dev->priv; | ||
2008 | 2005 | ||
2009 | if (adapter->msix_entries && | 2006 | if (adapter->msix_entries && |
2010 | !(adapter->rx_ring->ims_val & adapter->tx_ring->ims_val)) | 2007 | !(adapter->rx_ring->ims_val & adapter->tx_ring->ims_val)) |
@@ -2787,7 +2784,7 @@ void e1000e_reset(struct e1000_adapter *adapter) | |||
2787 | else | 2784 | else |
2788 | fc->pause_time = E1000_FC_PAUSE_TIME; | 2785 | fc->pause_time = E1000_FC_PAUSE_TIME; |
2789 | fc->send_xon = 1; | 2786 | fc->send_xon = 1; |
2790 | fc->type = fc->original_type; | 2787 | fc->current_mode = fc->requested_mode; |
2791 | 2788 | ||
2792 | /* Allow time for pending master requests to run */ | 2789 | /* Allow time for pending master requests to run */ |
2793 | mac->ops.reset_hw(hw); | 2790 | mac->ops.reset_hw(hw); |
@@ -3410,7 +3407,10 @@ static void e1000_print_link_info(struct e1000_adapter *adapter) | |||
3410 | struct e1000_hw *hw = &adapter->hw; | 3407 | struct e1000_hw *hw = &adapter->hw; |
3411 | u32 ctrl = er32(CTRL); | 3408 | u32 ctrl = er32(CTRL); |
3412 | 3409 | ||
3413 | e_info("Link is Up %d Mbps %s, Flow Control: %s\n", | 3410 | /* Link status message must follow this format for user tools */ |
3411 | printk(KERN_INFO "e1000e: %s NIC Link is Up %d Mbps %s, " | ||
3412 | "Flow Control: %s\n", | ||
3413 | adapter->netdev->name, | ||
3414 | adapter->link_speed, | 3414 | adapter->link_speed, |
3415 | (adapter->link_duplex == FULL_DUPLEX) ? | 3415 | (adapter->link_duplex == FULL_DUPLEX) ? |
3416 | "Full Duplex" : "Half Duplex", | 3416 | "Full Duplex" : "Half Duplex", |
@@ -3420,7 +3420,7 @@ static void e1000_print_link_info(struct e1000_adapter *adapter) | |||
3420 | ((ctrl & E1000_CTRL_TFCE) ? "TX" : "None" ))); | 3420 | ((ctrl & E1000_CTRL_TFCE) ? "TX" : "None" ))); |
3421 | } | 3421 | } |
3422 | 3422 | ||
3423 | static bool e1000_has_link(struct e1000_adapter *adapter) | 3423 | bool e1000_has_link(struct e1000_adapter *adapter) |
3424 | { | 3424 | { |
3425 | struct e1000_hw *hw = &adapter->hw; | 3425 | struct e1000_hw *hw = &adapter->hw; |
3426 | bool link_active = 0; | 3426 | bool link_active = 0; |
@@ -3495,6 +3495,7 @@ static void e1000_watchdog_task(struct work_struct *work) | |||
3495 | struct e1000_adapter, watchdog_task); | 3495 | struct e1000_adapter, watchdog_task); |
3496 | struct net_device *netdev = adapter->netdev; | 3496 | struct net_device *netdev = adapter->netdev; |
3497 | struct e1000_mac_info *mac = &adapter->hw.mac; | 3497 | struct e1000_mac_info *mac = &adapter->hw.mac; |
3498 | struct e1000_phy_info *phy = &adapter->hw.phy; | ||
3498 | struct e1000_ring *tx_ring = adapter->tx_ring; | 3499 | struct e1000_ring *tx_ring = adapter->tx_ring; |
3499 | struct e1000_hw *hw = &adapter->hw; | 3500 | struct e1000_hw *hw = &adapter->hw; |
3500 | u32 link, tctl; | 3501 | u32 link, tctl; |
@@ -3601,6 +3602,13 @@ static void e1000_watchdog_task(struct work_struct *work) | |||
3601 | tctl |= E1000_TCTL_EN; | 3602 | tctl |= E1000_TCTL_EN; |
3602 | ew32(TCTL, tctl); | 3603 | ew32(TCTL, tctl); |
3603 | 3604 | ||
3605 | /* | ||
3606 | * Perform any post-link-up configuration before | ||
3607 | * reporting link up. | ||
3608 | */ | ||
3609 | if (phy->ops.cfg_on_link_up) | ||
3610 | phy->ops.cfg_on_link_up(hw); | ||
3611 | |||
3604 | netif_carrier_on(netdev); | 3612 | netif_carrier_on(netdev); |
3605 | netif_tx_wake_all_queues(netdev); | 3613 | netif_tx_wake_all_queues(netdev); |
3606 | 3614 | ||
@@ -3612,7 +3620,9 @@ static void e1000_watchdog_task(struct work_struct *work) | |||
3612 | if (netif_carrier_ok(netdev)) { | 3620 | if (netif_carrier_ok(netdev)) { |
3613 | adapter->link_speed = 0; | 3621 | adapter->link_speed = 0; |
3614 | adapter->link_duplex = 0; | 3622 | adapter->link_duplex = 0; |
3615 | e_info("Link is Down\n"); | 3623 | /* Link status message must follow this format */ |
3624 | printk(KERN_INFO "e1000e: %s NIC Link is Down\n", | ||
3625 | adapter->netdev->name); | ||
3616 | netif_carrier_off(netdev); | 3626 | netif_carrier_off(netdev); |
3617 | netif_tx_stop_all_queues(netdev); | 3627 | netif_tx_stop_all_queues(netdev); |
3618 | if (!test_bit(__E1000_DOWN, &adapter->state)) | 3628 | if (!test_bit(__E1000_DOWN, &adapter->state)) |
@@ -4464,7 +4474,27 @@ static int e1000_suspend(struct pci_dev *pdev, pm_message_t state) | |||
4464 | 4474 | ||
4465 | pci_disable_device(pdev); | 4475 | pci_disable_device(pdev); |
4466 | 4476 | ||
4467 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | 4477 | /* |
4478 | * The pci-e switch on some quad port adapters will report a | ||
4479 | * correctable error when the MAC transitions from D0 to D3. To | ||
4480 | * prevent this we need to mask off the correctable errors on the | ||
4481 | * downstream port of the pci-e switch. | ||
4482 | */ | ||
4483 | if (adapter->flags & FLAG_IS_QUAD_PORT) { | ||
4484 | struct pci_dev *us_dev = pdev->bus->self; | ||
4485 | int pos = pci_find_capability(us_dev, PCI_CAP_ID_EXP); | ||
4486 | u16 devctl; | ||
4487 | |||
4488 | pci_read_config_word(us_dev, pos + PCI_EXP_DEVCTL, &devctl); | ||
4489 | pci_write_config_word(us_dev, pos + PCI_EXP_DEVCTL, | ||
4490 | (devctl & ~PCI_EXP_DEVCTL_CERE)); | ||
4491 | |||
4492 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | ||
4493 | |||
4494 | pci_write_config_word(us_dev, pos + PCI_EXP_DEVCTL, devctl); | ||
4495 | } else { | ||
4496 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | ||
4497 | } | ||
4468 | 4498 | ||
4469 | return 0; | 4499 | return 0; |
4470 | } | 4500 | } |
@@ -4669,14 +4699,12 @@ static void e1000_print_device_info(struct e1000_adapter *adapter) | |||
4669 | u32 pba_num; | 4699 | u32 pba_num; |
4670 | 4700 | ||
4671 | /* print bus type/speed/width info */ | 4701 | /* print bus type/speed/width info */ |
4672 | e_info("(PCI Express:2.5GB/s:%s) %02x:%02x:%02x:%02x:%02x:%02x\n", | 4702 | e_info("(PCI Express:2.5GB/s:%s) %pM\n", |
4673 | /* bus width */ | 4703 | /* bus width */ |
4674 | ((hw->bus.width == e1000_bus_width_pcie_x4) ? "Width x4" : | 4704 | ((hw->bus.width == e1000_bus_width_pcie_x4) ? "Width x4" : |
4675 | "Width x1"), | 4705 | "Width x1"), |
4676 | /* MAC address */ | 4706 | /* MAC address */ |
4677 | netdev->dev_addr[0], netdev->dev_addr[1], | 4707 | netdev->dev_addr); |
4678 | netdev->dev_addr[2], netdev->dev_addr[3], | ||
4679 | netdev->dev_addr[4], netdev->dev_addr[5]); | ||
4680 | e_info("Intel(R) PRO/%s Network Connection\n", | 4708 | e_info("Intel(R) PRO/%s Network Connection\n", |
4681 | (hw->phy.type == e1000_phy_ife) ? "10/100" : "1000"); | 4709 | (hw->phy.type == e1000_phy_ife) ? "10/100" : "1000"); |
4682 | e1000e_read_pba_num(hw, &pba_num); | 4710 | e1000e_read_pba_num(hw, &pba_num); |
@@ -4694,20 +4722,40 @@ static void e1000_eeprom_checks(struct e1000_adapter *adapter) | |||
4694 | return; | 4722 | return; |
4695 | 4723 | ||
4696 | ret_val = e1000_read_nvm(hw, NVM_INIT_CONTROL2_REG, 1, &buf); | 4724 | ret_val = e1000_read_nvm(hw, NVM_INIT_CONTROL2_REG, 1, &buf); |
4697 | if (!(le16_to_cpu(buf) & (1 << 0))) { | 4725 | if (!ret_val && (!(le16_to_cpu(buf) & (1 << 0)))) { |
4698 | /* Deep Smart Power Down (DSPD) */ | 4726 | /* Deep Smart Power Down (DSPD) */ |
4699 | dev_warn(&adapter->pdev->dev, | 4727 | dev_warn(&adapter->pdev->dev, |
4700 | "Warning: detected DSPD enabled in EEPROM\n"); | 4728 | "Warning: detected DSPD enabled in EEPROM\n"); |
4701 | } | 4729 | } |
4702 | 4730 | ||
4703 | ret_val = e1000_read_nvm(hw, NVM_INIT_3GIO_3, 1, &buf); | 4731 | ret_val = e1000_read_nvm(hw, NVM_INIT_3GIO_3, 1, &buf); |
4704 | if (le16_to_cpu(buf) & (3 << 2)) { | 4732 | if (!ret_val && (le16_to_cpu(buf) & (3 << 2))) { |
4705 | /* ASPM enable */ | 4733 | /* ASPM enable */ |
4706 | dev_warn(&adapter->pdev->dev, | 4734 | dev_warn(&adapter->pdev->dev, |
4707 | "Warning: detected ASPM enabled in EEPROM\n"); | 4735 | "Warning: detected ASPM enabled in EEPROM\n"); |
4708 | } | 4736 | } |
4709 | } | 4737 | } |
4710 | 4738 | ||
4739 | static const struct net_device_ops e1000e_netdev_ops = { | ||
4740 | .ndo_open = e1000_open, | ||
4741 | .ndo_stop = e1000_close, | ||
4742 | .ndo_start_xmit = e1000_xmit_frame, | ||
4743 | .ndo_get_stats = e1000_get_stats, | ||
4744 | .ndo_set_multicast_list = e1000_set_multi, | ||
4745 | .ndo_set_mac_address = e1000_set_mac, | ||
4746 | .ndo_change_mtu = e1000_change_mtu, | ||
4747 | .ndo_do_ioctl = e1000_ioctl, | ||
4748 | .ndo_tx_timeout = e1000_tx_timeout, | ||
4749 | .ndo_validate_addr = eth_validate_addr, | ||
4750 | |||
4751 | .ndo_vlan_rx_register = e1000_vlan_rx_register, | ||
4752 | .ndo_vlan_rx_add_vid = e1000_vlan_rx_add_vid, | ||
4753 | .ndo_vlan_rx_kill_vid = e1000_vlan_rx_kill_vid, | ||
4754 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
4755 | .ndo_poll_controller = e1000_netpoll, | ||
4756 | #endif | ||
4757 | }; | ||
4758 | |||
4711 | /** | 4759 | /** |
4712 | * e1000_probe - Device Initialization Routine | 4760 | * e1000_probe - Device Initialization Routine |
4713 | * @pdev: PCI device information struct | 4761 | * @pdev: PCI device information struct |
@@ -4766,7 +4814,10 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
4766 | goto err_pci_reg; | 4814 | goto err_pci_reg; |
4767 | 4815 | ||
4768 | pci_set_master(pdev); | 4816 | pci_set_master(pdev); |
4769 | pci_save_state(pdev); | 4817 | /* PCI config space info */ |
4818 | err = pci_save_state(pdev); | ||
4819 | if (err) | ||
4820 | goto err_alloc_etherdev; | ||
4770 | 4821 | ||
4771 | err = -ENOMEM; | 4822 | err = -ENOMEM; |
4772 | netdev = alloc_etherdev(sizeof(struct e1000_adapter)); | 4823 | netdev = alloc_etherdev(sizeof(struct e1000_adapter)); |
@@ -4806,24 +4857,10 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
4806 | } | 4857 | } |
4807 | 4858 | ||
4808 | /* construct the net_device struct */ | 4859 | /* construct the net_device struct */ |
4809 | netdev->open = &e1000_open; | 4860 | netdev->netdev_ops = &e1000e_netdev_ops; |
4810 | netdev->stop = &e1000_close; | ||
4811 | netdev->hard_start_xmit = &e1000_xmit_frame; | ||
4812 | netdev->get_stats = &e1000_get_stats; | ||
4813 | netdev->set_multicast_list = &e1000_set_multi; | ||
4814 | netdev->set_mac_address = &e1000_set_mac; | ||
4815 | netdev->change_mtu = &e1000_change_mtu; | ||
4816 | netdev->do_ioctl = &e1000_ioctl; | ||
4817 | e1000e_set_ethtool_ops(netdev); | 4861 | e1000e_set_ethtool_ops(netdev); |
4818 | netdev->tx_timeout = &e1000_tx_timeout; | ||
4819 | netdev->watchdog_timeo = 5 * HZ; | 4862 | netdev->watchdog_timeo = 5 * HZ; |
4820 | netif_napi_add(netdev, &adapter->napi, e1000_clean, 64); | 4863 | netif_napi_add(netdev, &adapter->napi, e1000_clean, 64); |
4821 | netdev->vlan_rx_register = e1000_vlan_rx_register; | ||
4822 | netdev->vlan_rx_add_vid = e1000_vlan_rx_add_vid; | ||
4823 | netdev->vlan_rx_kill_vid = e1000_vlan_rx_kill_vid; | ||
4824 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
4825 | netdev->poll_controller = e1000_netpoll; | ||
4826 | #endif | ||
4827 | strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1); | 4864 | strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1); |
4828 | 4865 | ||
4829 | netdev->mem_start = mmio_start; | 4866 | netdev->mem_start = mmio_start; |
@@ -4924,10 +4961,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
4924 | memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len); | 4961 | memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len); |
4925 | 4962 | ||
4926 | if (!is_valid_ether_addr(netdev->perm_addr)) { | 4963 | if (!is_valid_ether_addr(netdev->perm_addr)) { |
4927 | e_err("Invalid MAC Address: %02x:%02x:%02x:%02x:%02x:%02x\n", | 4964 | e_err("Invalid MAC Address: %pM\n", netdev->perm_addr); |
4928 | netdev->perm_addr[0], netdev->perm_addr[1], | ||
4929 | netdev->perm_addr[2], netdev->perm_addr[3], | ||
4930 | netdev->perm_addr[4], netdev->perm_addr[5]); | ||
4931 | err = -EIO; | 4965 | err = -EIO; |
4932 | goto err_eeprom; | 4966 | goto err_eeprom; |
4933 | } | 4967 | } |
@@ -4948,8 +4982,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
4948 | /* Initialize link parameters. User can change them with ethtool */ | 4982 | /* Initialize link parameters. User can change them with ethtool */ |
4949 | adapter->hw.mac.autoneg = 1; | 4983 | adapter->hw.mac.autoneg = 1; |
4950 | adapter->fc_autoneg = 1; | 4984 | adapter->fc_autoneg = 1; |
4951 | adapter->hw.fc.original_type = e1000_fc_default; | 4985 | adapter->hw.fc.requested_mode = e1000_fc_default; |
4952 | adapter->hw.fc.type = e1000_fc_default; | 4986 | adapter->hw.fc.current_mode = e1000_fc_default; |
4953 | adapter->hw.phy.autoneg_advertised = 0x2f; | 4987 | adapter->hw.phy.autoneg_advertised = 0x2f; |
4954 | 4988 | ||
4955 | /* ring size defaults */ | 4989 | /* ring size defaults */ |
@@ -4990,6 +5024,9 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
4990 | adapter->wol = adapter->eeprom_wol; | 5024 | adapter->wol = adapter->eeprom_wol; |
4991 | device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); | 5025 | device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); |
4992 | 5026 | ||
5027 | /* save off EEPROM version number */ | ||
5028 | e1000_read_nvm(&adapter->hw, 5, 1, &adapter->eeprom_vers); | ||
5029 | |||
4993 | /* reset the hardware with the new settings */ | 5030 | /* reset the hardware with the new settings */ |
4994 | e1000e_reset(adapter); | 5031 | e1000e_reset(adapter); |
4995 | 5032 | ||