diff options
Diffstat (limited to 'drivers/net/igb/igb_main.c')
-rw-r--r-- | drivers/net/igb/igb_main.c | 60 |
1 files changed, 42 insertions, 18 deletions
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index 93d02efa9a0..1f397cd9941 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c | |||
@@ -38,10 +38,11 @@ | |||
38 | #include <linux/ethtool.h> | 38 | #include <linux/ethtool.h> |
39 | #include <linux/if_vlan.h> | 39 | #include <linux/if_vlan.h> |
40 | #include <linux/pci.h> | 40 | #include <linux/pci.h> |
41 | #include <linux/pci-aspm.h> | ||
41 | #include <linux/delay.h> | 42 | #include <linux/delay.h> |
42 | #include <linux/interrupt.h> | 43 | #include <linux/interrupt.h> |
43 | #include <linux/if_ether.h> | 44 | #include <linux/if_ether.h> |
44 | #ifdef CONFIG_DCA | 45 | #ifdef CONFIG_IGB_DCA |
45 | #include <linux/dca.h> | 46 | #include <linux/dca.h> |
46 | #endif | 47 | #endif |
47 | #include "igb.h" | 48 | #include "igb.h" |
@@ -106,11 +107,11 @@ static irqreturn_t igb_msix_other(int irq, void *); | |||
106 | static irqreturn_t igb_msix_rx(int irq, void *); | 107 | static irqreturn_t igb_msix_rx(int irq, void *); |
107 | static irqreturn_t igb_msix_tx(int irq, void *); | 108 | static irqreturn_t igb_msix_tx(int irq, void *); |
108 | static int igb_clean_rx_ring_msix(struct napi_struct *, int); | 109 | static int igb_clean_rx_ring_msix(struct napi_struct *, int); |
109 | #ifdef CONFIG_DCA | 110 | #ifdef CONFIG_IGB_DCA |
110 | static void igb_update_rx_dca(struct igb_ring *); | 111 | static void igb_update_rx_dca(struct igb_ring *); |
111 | static void igb_update_tx_dca(struct igb_ring *); | 112 | static void igb_update_tx_dca(struct igb_ring *); |
112 | static void igb_setup_dca(struct igb_adapter *); | 113 | static void igb_setup_dca(struct igb_adapter *); |
113 | #endif /* CONFIG_DCA */ | 114 | #endif /* CONFIG_IGB_DCA */ |
114 | static bool igb_clean_tx_irq(struct igb_ring *); | 115 | static bool igb_clean_tx_irq(struct igb_ring *); |
115 | static int igb_poll(struct napi_struct *, int); | 116 | static int igb_poll(struct napi_struct *, int); |
116 | static bool igb_clean_rx_irq_adv(struct igb_ring *, int *, int); | 117 | static bool igb_clean_rx_irq_adv(struct igb_ring *, int *, int); |
@@ -131,7 +132,7 @@ static int igb_suspend(struct pci_dev *, pm_message_t); | |||
131 | static int igb_resume(struct pci_dev *); | 132 | static int igb_resume(struct pci_dev *); |
132 | #endif | 133 | #endif |
133 | static void igb_shutdown(struct pci_dev *); | 134 | static void igb_shutdown(struct pci_dev *); |
134 | #ifdef CONFIG_DCA | 135 | #ifdef CONFIG_IGB_DCA |
135 | static int igb_notify_dca(struct notifier_block *, unsigned long, void *); | 136 | static int igb_notify_dca(struct notifier_block *, unsigned long, void *); |
136 | static struct notifier_block dca_notifier = { | 137 | static struct notifier_block dca_notifier = { |
137 | .notifier_call = igb_notify_dca, | 138 | .notifier_call = igb_notify_dca, |
@@ -207,7 +208,7 @@ static int __init igb_init_module(void) | |||
207 | global_quad_port_a = 0; | 208 | global_quad_port_a = 0; |
208 | 209 | ||
209 | ret = pci_register_driver(&igb_driver); | 210 | ret = pci_register_driver(&igb_driver); |
210 | #ifdef CONFIG_DCA | 211 | #ifdef CONFIG_IGB_DCA |
211 | dca_register_notify(&dca_notifier); | 212 | dca_register_notify(&dca_notifier); |
212 | #endif | 213 | #endif |
213 | return ret; | 214 | return ret; |
@@ -223,7 +224,7 @@ module_init(igb_init_module); | |||
223 | **/ | 224 | **/ |
224 | static void __exit igb_exit_module(void) | 225 | static void __exit igb_exit_module(void) |
225 | { | 226 | { |
226 | #ifdef CONFIG_DCA | 227 | #ifdef CONFIG_IGB_DCA |
227 | dca_unregister_notify(&dca_notifier); | 228 | dca_unregister_notify(&dca_notifier); |
228 | #endif | 229 | #endif |
229 | pci_unregister_driver(&igb_driver); | 230 | pci_unregister_driver(&igb_driver); |
@@ -966,10 +967,11 @@ static int __devinit igb_probe(struct pci_dev *pdev, | |||
966 | struct net_device *netdev; | 967 | struct net_device *netdev; |
967 | struct igb_adapter *adapter; | 968 | struct igb_adapter *adapter; |
968 | struct e1000_hw *hw; | 969 | struct e1000_hw *hw; |
970 | struct pci_dev *us_dev; | ||
969 | const struct e1000_info *ei = igb_info_tbl[ent->driver_data]; | 971 | const struct e1000_info *ei = igb_info_tbl[ent->driver_data]; |
970 | unsigned long mmio_start, mmio_len; | 972 | unsigned long mmio_start, mmio_len; |
971 | int i, err, pci_using_dac; | 973 | int i, err, pci_using_dac, pos; |
972 | u16 eeprom_data = 0; | 974 | u16 eeprom_data = 0, state = 0; |
973 | u16 eeprom_apme_mask = IGB_EEPROM_APME; | 975 | u16 eeprom_apme_mask = IGB_EEPROM_APME; |
974 | u32 part_num; | 976 | u32 part_num; |
975 | int bars, need_ioport; | 977 | int bars, need_ioport; |
@@ -1004,6 +1006,28 @@ static int __devinit igb_probe(struct pci_dev *pdev, | |||
1004 | } | 1006 | } |
1005 | } | 1007 | } |
1006 | 1008 | ||
1009 | /* 82575 requires that the pci-e link partner disable the L0s state */ | ||
1010 | switch (pdev->device) { | ||
1011 | case E1000_DEV_ID_82575EB_COPPER: | ||
1012 | case E1000_DEV_ID_82575EB_FIBER_SERDES: | ||
1013 | case E1000_DEV_ID_82575GB_QUAD_COPPER: | ||
1014 | us_dev = pdev->bus->self; | ||
1015 | pos = pci_find_capability(us_dev, PCI_CAP_ID_EXP); | ||
1016 | if (pos) { | ||
1017 | pci_read_config_word(us_dev, pos + PCI_EXP_LNKCTL, | ||
1018 | &state); | ||
1019 | state &= ~PCIE_LINK_STATE_L0S; | ||
1020 | pci_write_config_word(us_dev, pos + PCI_EXP_LNKCTL, | ||
1021 | state); | ||
1022 | printk(KERN_INFO "Disabling ASPM L0s upstream switch " | ||
1023 | "port %x:%x.%x\n", us_dev->bus->number, | ||
1024 | PCI_SLOT(us_dev->devfn), | ||
1025 | PCI_FUNC(us_dev->devfn)); | ||
1026 | } | ||
1027 | default: | ||
1028 | break; | ||
1029 | } | ||
1030 | |||
1007 | err = pci_request_selected_regions(pdev, bars, igb_driver_name); | 1031 | err = pci_request_selected_regions(pdev, bars, igb_driver_name); |
1008 | if (err) | 1032 | if (err) |
1009 | goto err_pci_reg; | 1033 | goto err_pci_reg; |
@@ -1237,7 +1261,7 @@ static int __devinit igb_probe(struct pci_dev *pdev, | |||
1237 | if (err) | 1261 | if (err) |
1238 | goto err_register; | 1262 | goto err_register; |
1239 | 1263 | ||
1240 | #ifdef CONFIG_DCA | 1264 | #ifdef CONFIG_IGB_DCA |
1241 | if ((adapter->flags & IGB_FLAG_HAS_DCA) && | 1265 | if ((adapter->flags & IGB_FLAG_HAS_DCA) && |
1242 | (dca_add_requester(&pdev->dev) == 0)) { | 1266 | (dca_add_requester(&pdev->dev) == 0)) { |
1243 | adapter->flags |= IGB_FLAG_DCA_ENABLED; | 1267 | adapter->flags |= IGB_FLAG_DCA_ENABLED; |
@@ -1311,7 +1335,7 @@ static void __devexit igb_remove(struct pci_dev *pdev) | |||
1311 | { | 1335 | { |
1312 | struct net_device *netdev = pci_get_drvdata(pdev); | 1336 | struct net_device *netdev = pci_get_drvdata(pdev); |
1313 | struct igb_adapter *adapter = netdev_priv(netdev); | 1337 | struct igb_adapter *adapter = netdev_priv(netdev); |
1314 | #ifdef CONFIG_DCA | 1338 | #ifdef CONFIG_IGB_DCA |
1315 | struct e1000_hw *hw = &adapter->hw; | 1339 | struct e1000_hw *hw = &adapter->hw; |
1316 | #endif | 1340 | #endif |
1317 | 1341 | ||
@@ -1323,7 +1347,7 @@ static void __devexit igb_remove(struct pci_dev *pdev) | |||
1323 | 1347 | ||
1324 | flush_scheduled_work(); | 1348 | flush_scheduled_work(); |
1325 | 1349 | ||
1326 | #ifdef CONFIG_DCA | 1350 | #ifdef CONFIG_IGB_DCA |
1327 | if (adapter->flags & IGB_FLAG_DCA_ENABLED) { | 1351 | if (adapter->flags & IGB_FLAG_DCA_ENABLED) { |
1328 | dev_info(&pdev->dev, "DCA disabled\n"); | 1352 | dev_info(&pdev->dev, "DCA disabled\n"); |
1329 | dca_remove_requester(&pdev->dev); | 1353 | dca_remove_requester(&pdev->dev); |
@@ -3271,7 +3295,7 @@ static irqreturn_t igb_msix_tx(int irq, void *data) | |||
3271 | struct igb_adapter *adapter = tx_ring->adapter; | 3295 | struct igb_adapter *adapter = tx_ring->adapter; |
3272 | struct e1000_hw *hw = &adapter->hw; | 3296 | struct e1000_hw *hw = &adapter->hw; |
3273 | 3297 | ||
3274 | #ifdef CONFIG_DCA | 3298 | #ifdef CONFIG_IGB_DCA |
3275 | if (adapter->flags & IGB_FLAG_DCA_ENABLED) | 3299 | if (adapter->flags & IGB_FLAG_DCA_ENABLED) |
3276 | igb_update_tx_dca(tx_ring); | 3300 | igb_update_tx_dca(tx_ring); |
3277 | #endif | 3301 | #endif |
@@ -3323,14 +3347,14 @@ static irqreturn_t igb_msix_rx(int irq, void *data) | |||
3323 | if (netif_rx_schedule_prep(adapter->netdev, &rx_ring->napi)) | 3347 | if (netif_rx_schedule_prep(adapter->netdev, &rx_ring->napi)) |
3324 | __netif_rx_schedule(adapter->netdev, &rx_ring->napi); | 3348 | __netif_rx_schedule(adapter->netdev, &rx_ring->napi); |
3325 | 3349 | ||
3326 | #ifdef CONFIG_DCA | 3350 | #ifdef CONFIG_IGB_DCA |
3327 | if (adapter->flags & IGB_FLAG_DCA_ENABLED) | 3351 | if (adapter->flags & IGB_FLAG_DCA_ENABLED) |
3328 | igb_update_rx_dca(rx_ring); | 3352 | igb_update_rx_dca(rx_ring); |
3329 | #endif | 3353 | #endif |
3330 | return IRQ_HANDLED; | 3354 | return IRQ_HANDLED; |
3331 | } | 3355 | } |
3332 | 3356 | ||
3333 | #ifdef CONFIG_DCA | 3357 | #ifdef CONFIG_IGB_DCA |
3334 | static void igb_update_rx_dca(struct igb_ring *rx_ring) | 3358 | static void igb_update_rx_dca(struct igb_ring *rx_ring) |
3335 | { | 3359 | { |
3336 | u32 dca_rxctrl; | 3360 | u32 dca_rxctrl; |
@@ -3450,7 +3474,7 @@ static int igb_notify_dca(struct notifier_block *nb, unsigned long event, | |||
3450 | 3474 | ||
3451 | return ret_val ? NOTIFY_BAD : NOTIFY_DONE; | 3475 | return ret_val ? NOTIFY_BAD : NOTIFY_DONE; |
3452 | } | 3476 | } |
3453 | #endif /* CONFIG_DCA */ | 3477 | #endif /* CONFIG_IGB_DCA */ |
3454 | 3478 | ||
3455 | /** | 3479 | /** |
3456 | * igb_intr_msi - Interrupt Handler | 3480 | * igb_intr_msi - Interrupt Handler |
@@ -3529,13 +3553,13 @@ static int igb_poll(struct napi_struct *napi, int budget) | |||
3529 | int tx_clean_complete, work_done = 0; | 3553 | int tx_clean_complete, work_done = 0; |
3530 | 3554 | ||
3531 | /* this poll routine only supports one tx and one rx queue */ | 3555 | /* this poll routine only supports one tx and one rx queue */ |
3532 | #ifdef CONFIG_DCA | 3556 | #ifdef CONFIG_IGB_DCA |
3533 | if (adapter->flags & IGB_FLAG_DCA_ENABLED) | 3557 | if (adapter->flags & IGB_FLAG_DCA_ENABLED) |
3534 | igb_update_tx_dca(&adapter->tx_ring[0]); | 3558 | igb_update_tx_dca(&adapter->tx_ring[0]); |
3535 | #endif | 3559 | #endif |
3536 | tx_clean_complete = igb_clean_tx_irq(&adapter->tx_ring[0]); | 3560 | tx_clean_complete = igb_clean_tx_irq(&adapter->tx_ring[0]); |
3537 | 3561 | ||
3538 | #ifdef CONFIG_DCA | 3562 | #ifdef CONFIG_IGB_DCA |
3539 | if (adapter->flags & IGB_FLAG_DCA_ENABLED) | 3563 | if (adapter->flags & IGB_FLAG_DCA_ENABLED) |
3540 | igb_update_rx_dca(&adapter->rx_ring[0]); | 3564 | igb_update_rx_dca(&adapter->rx_ring[0]); |
3541 | #endif | 3565 | #endif |
@@ -3563,7 +3587,7 @@ static int igb_clean_rx_ring_msix(struct napi_struct *napi, int budget) | |||
3563 | struct net_device *netdev = adapter->netdev; | 3587 | struct net_device *netdev = adapter->netdev; |
3564 | int work_done = 0; | 3588 | int work_done = 0; |
3565 | 3589 | ||
3566 | #ifdef CONFIG_DCA | 3590 | #ifdef CONFIG_IGB_DCA |
3567 | if (adapter->flags & IGB_FLAG_DCA_ENABLED) | 3591 | if (adapter->flags & IGB_FLAG_DCA_ENABLED) |
3568 | igb_update_rx_dca(rx_ring); | 3592 | igb_update_rx_dca(rx_ring); |
3569 | #endif | 3593 | #endif |