aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000/e1000_main.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-09-24 13:15:13 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-24 13:15:13 -0400
commita319a2773a13bab56a0d0b3744ba8703324313b5 (patch)
treef02c86acabd1031439fd422a167784007e84ebb1 /drivers/net/e1000/e1000_main.c
parente18fa700c9a31360bc8f193aa543b7ef7b39a06b (diff)
parent183798799216fad36c7219fe8d4d6dee6b8fa755 (diff)
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: (217 commits) net/ieee80211: fix more crypto-related build breakage [PATCH] Spidernet: add ethtool -S (show statistics) [NET] GT96100: Delete bitrotting ethernet driver [PATCH] mv643xx_eth: restrict to 32-bit PPC_MULTIPLATFORM [PATCH] Cirrus Logic ep93xx ethernet driver r8169: the MMIO region of the 8167 stands behin BAR#1 e1000, ixgb: Remove pointless wrappers [PATCH] Remove powerpc specific parts of 3c509 driver [PATCH] s2io: Switch to pci_get_device [PATCH] gt96100: move to pci_get_device API [PATCH] ehea: bugfix for register access functions [PATCH] e1000 disable device on PCI error drivers/net/phy/fixed: #if 0 some incomplete code drivers/net: const-ify ethtool_ops declarations [PATCH] ethtool: allow const ethtool_ops [PATCH] sky2: big endian [PATCH] sky2: fiber support [PATCH] sky2: tx pause bug fix drivers/net: Trim trailing whitespace [PATCH] ehea: IBM eHEA Ethernet Device Driver ... Manually resolved conflicts in drivers/net/ixgb/ixgb_main.c and drivers/net/sky2.c related to CHECKSUM_HW/CHECKSUM_PARTIAL changes by commit 84fa7933a33f806bbbaae6775e87459b1ec584c0 that just happened to be next to unrelated changes in this update.
Diffstat (limited to 'drivers/net/e1000/e1000_main.c')
-rw-r--r--drivers/net/e1000/e1000_main.c154
1 files changed, 92 insertions, 62 deletions
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 2ab9f96f5dab..3f6a752700a1 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -36,7 +36,7 @@ static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver";
36#else 36#else
37#define DRIVERNAPI "-NAPI" 37#define DRIVERNAPI "-NAPI"
38#endif 38#endif
39#define DRV_VERSION "7.1.9-k4"DRIVERNAPI 39#define DRV_VERSION "7.2.7-k2"DRIVERNAPI
40char e1000_driver_version[] = DRV_VERSION; 40char e1000_driver_version[] = DRV_VERSION;
41static char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; 41static char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation.";
42 42
@@ -99,6 +99,7 @@ static struct pci_device_id e1000_pci_tbl[] = {
99 INTEL_E1000_ETHERNET_DEVICE(0x1098), 99 INTEL_E1000_ETHERNET_DEVICE(0x1098),
100 INTEL_E1000_ETHERNET_DEVICE(0x1099), 100 INTEL_E1000_ETHERNET_DEVICE(0x1099),
101 INTEL_E1000_ETHERNET_DEVICE(0x109A), 101 INTEL_E1000_ETHERNET_DEVICE(0x109A),
102 INTEL_E1000_ETHERNET_DEVICE(0x10A4),
102 INTEL_E1000_ETHERNET_DEVICE(0x10B5), 103 INTEL_E1000_ETHERNET_DEVICE(0x10B5),
103 INTEL_E1000_ETHERNET_DEVICE(0x10B9), 104 INTEL_E1000_ETHERNET_DEVICE(0x10B9),
104 INTEL_E1000_ETHERNET_DEVICE(0x10BA), 105 INTEL_E1000_ETHERNET_DEVICE(0x10BA),
@@ -245,7 +246,7 @@ e1000_init_module(void)
245 246
246 printk(KERN_INFO "%s\n", e1000_copyright); 247 printk(KERN_INFO "%s\n", e1000_copyright);
247 248
248 ret = pci_module_init(&e1000_driver); 249 ret = pci_register_driver(&e1000_driver);
249 250
250 return ret; 251 return ret;
251} 252}
@@ -485,7 +486,7 @@ e1000_up(struct e1000_adapter *adapter)
485 * 486 *
486 **/ 487 **/
487 488
488static void e1000_power_up_phy(struct e1000_adapter *adapter) 489void e1000_power_up_phy(struct e1000_adapter *adapter)
489{ 490{
490 uint16_t mii_reg = 0; 491 uint16_t mii_reg = 0;
491 492
@@ -682,9 +683,9 @@ e1000_probe(struct pci_dev *pdev,
682 unsigned long flash_start, flash_len; 683 unsigned long flash_start, flash_len;
683 684
684 static int cards_found = 0; 685 static int cards_found = 0;
685 static int e1000_ksp3_port_a = 0; /* global ksp3 port a indication */ 686 static int global_quad_port_a = 0; /* global ksp3 port a indication */
686 int i, err, pci_using_dac; 687 int i, err, pci_using_dac;
687 uint16_t eeprom_data; 688 uint16_t eeprom_data = 0;
688 uint16_t eeprom_apme_mask = E1000_EEPROM_APME; 689 uint16_t eeprom_apme_mask = E1000_EEPROM_APME;
689 if ((err = pci_enable_device(pdev))) 690 if ((err = pci_enable_device(pdev)))
690 return err; 691 return err;
@@ -696,21 +697,20 @@ e1000_probe(struct pci_dev *pdev,
696 if ((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK)) && 697 if ((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK)) &&
697 (err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK))) { 698 (err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK))) {
698 E1000_ERR("No usable DMA configuration, aborting\n"); 699 E1000_ERR("No usable DMA configuration, aborting\n");
699 return err; 700 goto err_dma;
700 } 701 }
701 pci_using_dac = 0; 702 pci_using_dac = 0;
702 } 703 }
703 704
704 if ((err = pci_request_regions(pdev, e1000_driver_name))) 705 if ((err = pci_request_regions(pdev, e1000_driver_name)))
705 return err; 706 goto err_pci_reg;
706 707
707 pci_set_master(pdev); 708 pci_set_master(pdev);
708 709
710 err = -ENOMEM;
709 netdev = alloc_etherdev(sizeof(struct e1000_adapter)); 711 netdev = alloc_etherdev(sizeof(struct e1000_adapter));
710 if (!netdev) { 712 if (!netdev)
711 err = -ENOMEM;
712 goto err_alloc_etherdev; 713 goto err_alloc_etherdev;
713 }
714 714
715 SET_MODULE_OWNER(netdev); 715 SET_MODULE_OWNER(netdev);
716 SET_NETDEV_DEV(netdev, &pdev->dev); 716 SET_NETDEV_DEV(netdev, &pdev->dev);
@@ -725,11 +725,10 @@ e1000_probe(struct pci_dev *pdev,
725 mmio_start = pci_resource_start(pdev, BAR_0); 725 mmio_start = pci_resource_start(pdev, BAR_0);
726 mmio_len = pci_resource_len(pdev, BAR_0); 726 mmio_len = pci_resource_len(pdev, BAR_0);
727 727
728 err = -EIO;
728 adapter->hw.hw_addr = ioremap(mmio_start, mmio_len); 729 adapter->hw.hw_addr = ioremap(mmio_start, mmio_len);
729 if (!adapter->hw.hw_addr) { 730 if (!adapter->hw.hw_addr)
730 err = -EIO;
731 goto err_ioremap; 731 goto err_ioremap;
732 }
733 732
734 for (i = BAR_1; i <= BAR_5; i++) { 733 for (i = BAR_1; i <= BAR_5; i++) {
735 if (pci_resource_len(pdev, i) == 0) 734 if (pci_resource_len(pdev, i) == 0)
@@ -774,6 +773,7 @@ e1000_probe(struct pci_dev *pdev,
774 if ((err = e1000_sw_init(adapter))) 773 if ((err = e1000_sw_init(adapter)))
775 goto err_sw_init; 774 goto err_sw_init;
776 775
776 err = -EIO;
777 /* Flash BAR mapping must happen after e1000_sw_init 777 /* Flash BAR mapping must happen after e1000_sw_init
778 * because it depends on mac_type */ 778 * because it depends on mac_type */
779 if ((adapter->hw.mac_type == e1000_ich8lan) && 779 if ((adapter->hw.mac_type == e1000_ich8lan) &&
@@ -781,24 +781,13 @@ e1000_probe(struct pci_dev *pdev,
781 flash_start = pci_resource_start(pdev, 1); 781 flash_start = pci_resource_start(pdev, 1);
782 flash_len = pci_resource_len(pdev, 1); 782 flash_len = pci_resource_len(pdev, 1);
783 adapter->hw.flash_address = ioremap(flash_start, flash_len); 783 adapter->hw.flash_address = ioremap(flash_start, flash_len);
784 if (!adapter->hw.flash_address) { 784 if (!adapter->hw.flash_address)
785 err = -EIO;
786 goto err_flashmap; 785 goto err_flashmap;
787 }
788 } 786 }
789 787
790 if ((err = e1000_check_phy_reset_block(&adapter->hw))) 788 if (e1000_check_phy_reset_block(&adapter->hw))
791 DPRINTK(PROBE, INFO, "PHY reset is blocked due to SOL/IDER session.\n"); 789 DPRINTK(PROBE, INFO, "PHY reset is blocked due to SOL/IDER session.\n");
792 790
793 /* if ksp3, indicate if it's port a being setup */
794 if (pdev->device == E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3 &&
795 e1000_ksp3_port_a == 0)
796 adapter->ksp3_port_a = 1;
797 e1000_ksp3_port_a++;
798 /* Reset for multiple KP3 adapters */
799 if (e1000_ksp3_port_a == 4)
800 e1000_ksp3_port_a = 0;
801
802 if (adapter->hw.mac_type >= e1000_82543) { 791 if (adapter->hw.mac_type >= e1000_82543) {
803 netdev->features = NETIF_F_SG | 792 netdev->features = NETIF_F_SG |
804 NETIF_F_HW_CSUM | 793 NETIF_F_HW_CSUM |
@@ -830,7 +819,7 @@ e1000_probe(struct pci_dev *pdev,
830 819
831 if (e1000_init_eeprom_params(&adapter->hw)) { 820 if (e1000_init_eeprom_params(&adapter->hw)) {
832 E1000_ERR("EEPROM initialization failed\n"); 821 E1000_ERR("EEPROM initialization failed\n");
833 return -EIO; 822 goto err_eeprom;
834 } 823 }
835 824
836 /* before reading the EEPROM, reset the controller to 825 /* before reading the EEPROM, reset the controller to
@@ -842,7 +831,6 @@ e1000_probe(struct pci_dev *pdev,
842 831
843 if (e1000_validate_eeprom_checksum(&adapter->hw) < 0) { 832 if (e1000_validate_eeprom_checksum(&adapter->hw) < 0) {
844 DPRINTK(PROBE, ERR, "The EEPROM Checksum Is Not Valid\n"); 833 DPRINTK(PROBE, ERR, "The EEPROM Checksum Is Not Valid\n");
845 err = -EIO;
846 goto err_eeprom; 834 goto err_eeprom;
847 } 835 }
848 836
@@ -855,12 +843,9 @@ e1000_probe(struct pci_dev *pdev,
855 843
856 if (!is_valid_ether_addr(netdev->perm_addr)) { 844 if (!is_valid_ether_addr(netdev->perm_addr)) {
857 DPRINTK(PROBE, ERR, "Invalid MAC Address\n"); 845 DPRINTK(PROBE, ERR, "Invalid MAC Address\n");
858 err = -EIO;
859 goto err_eeprom; 846 goto err_eeprom;
860 } 847 }
861 848
862 e1000_read_part_num(&adapter->hw, &(adapter->part_num));
863
864 e1000_get_bus_info(&adapter->hw); 849 e1000_get_bus_info(&adapter->hw);
865 850
866 init_timer(&adapter->tx_fifo_stall_timer); 851 init_timer(&adapter->tx_fifo_stall_timer);
@@ -921,7 +906,38 @@ e1000_probe(struct pci_dev *pdev,
921 break; 906 break;
922 } 907 }
923 if (eeprom_data & eeprom_apme_mask) 908 if (eeprom_data & eeprom_apme_mask)
924 adapter->wol |= E1000_WUFC_MAG; 909 adapter->eeprom_wol |= E1000_WUFC_MAG;
910
911 /* now that we have the eeprom settings, apply the special cases
912 * where the eeprom may be wrong or the board simply won't support
913 * wake on lan on a particular port */
914 switch (pdev->device) {
915 case E1000_DEV_ID_82546GB_PCIE:
916 adapter->eeprom_wol = 0;
917 break;
918 case E1000_DEV_ID_82546EB_FIBER:
919 case E1000_DEV_ID_82546GB_FIBER:
920 case E1000_DEV_ID_82571EB_FIBER:
921 /* Wake events only supported on port A for dual fiber
922 * regardless of eeprom setting */
923 if (E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_FUNC_1)
924 adapter->eeprom_wol = 0;
925 break;
926 case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3:
927 case E1000_DEV_ID_82571EB_QUAD_COPPER:
928 /* if quad port adapter, disable WoL on all but port A */
929 if (global_quad_port_a != 0)
930 adapter->eeprom_wol = 0;
931 else
932 adapter->quad_port_a = 1;
933 /* Reset for multiple quad port adapters */
934 if (++global_quad_port_a == 4)
935 global_quad_port_a = 0;
936 break;
937 }
938
939 /* initialize the wol settings based on the eeprom settings */
940 adapter->wol = adapter->eeprom_wol;
925 941
926 /* print bus type/speed/width info */ 942 /* print bus type/speed/width info */
927 { 943 {
@@ -964,16 +980,33 @@ e1000_probe(struct pci_dev *pdev,
964 return 0; 980 return 0;
965 981
966err_register: 982err_register:
983 e1000_release_hw_control(adapter);
984err_eeprom:
985 if (!e1000_check_phy_reset_block(&adapter->hw))
986 e1000_phy_hw_reset(&adapter->hw);
987
967 if (adapter->hw.flash_address) 988 if (adapter->hw.flash_address)
968 iounmap(adapter->hw.flash_address); 989 iounmap(adapter->hw.flash_address);
969err_flashmap: 990err_flashmap:
991#ifdef CONFIG_E1000_NAPI
992 for (i = 0; i < adapter->num_rx_queues; i++)
993 dev_put(&adapter->polling_netdev[i]);
994#endif
995
996 kfree(adapter->tx_ring);
997 kfree(adapter->rx_ring);
998#ifdef CONFIG_E1000_NAPI
999 kfree(adapter->polling_netdev);
1000#endif
970err_sw_init: 1001err_sw_init:
971err_eeprom:
972 iounmap(adapter->hw.hw_addr); 1002 iounmap(adapter->hw.hw_addr);
973err_ioremap: 1003err_ioremap:
974 free_netdev(netdev); 1004 free_netdev(netdev);
975err_alloc_etherdev: 1005err_alloc_etherdev:
976 pci_release_regions(pdev); 1006 pci_release_regions(pdev);
1007err_pci_reg:
1008err_dma:
1009 pci_disable_device(pdev);
977 return err; 1010 return err;
978} 1011}
979 1012
@@ -1208,7 +1241,7 @@ e1000_open(struct net_device *netdev)
1208 1241
1209 err = e1000_request_irq(adapter); 1242 err = e1000_request_irq(adapter);
1210 if (err) 1243 if (err)
1211 goto err_up; 1244 goto err_req_irq;
1212 1245
1213 e1000_power_up_phy(adapter); 1246 e1000_power_up_phy(adapter);
1214 1247
@@ -1229,6 +1262,9 @@ e1000_open(struct net_device *netdev)
1229 return E1000_SUCCESS; 1262 return E1000_SUCCESS;
1230 1263
1231err_up: 1264err_up:
1265 e1000_power_down_phy(adapter);
1266 e1000_free_irq(adapter);
1267err_req_irq:
1232 e1000_free_all_rx_resources(adapter); 1268 e1000_free_all_rx_resources(adapter);
1233err_setup_rx: 1269err_setup_rx:
1234 e1000_free_all_tx_resources(adapter); 1270 e1000_free_all_tx_resources(adapter);
@@ -1381,10 +1417,6 @@ setup_tx_desc_die:
1381 * (Descriptors) for all queues 1417 * (Descriptors) for all queues
1382 * @adapter: board private structure 1418 * @adapter: board private structure
1383 * 1419 *
1384 * If this function returns with an error, then it's possible one or
1385 * more of the rings is populated (while the rest are not). It is the
1386 * callers duty to clean those orphaned rings.
1387 *
1388 * Return 0 on success, negative on failure 1420 * Return 0 on success, negative on failure
1389 **/ 1421 **/
1390 1422
@@ -1398,6 +1430,9 @@ e1000_setup_all_tx_resources(struct e1000_adapter *adapter)
1398 if (err) { 1430 if (err) {
1399 DPRINTK(PROBE, ERR, 1431 DPRINTK(PROBE, ERR,
1400 "Allocation for Tx Queue %u failed\n", i); 1432 "Allocation for Tx Queue %u failed\n", i);
1433 for (i-- ; i >= 0; i--)
1434 e1000_free_tx_resources(adapter,
1435 &adapter->tx_ring[i]);
1401 break; 1436 break;
1402 } 1437 }
1403 } 1438 }
@@ -1499,8 +1534,6 @@ e1000_configure_tx(struct e1000_adapter *adapter)
1499 } else if (hw->mac_type == e1000_80003es2lan) { 1534 } else if (hw->mac_type == e1000_80003es2lan) {
1500 tarc = E1000_READ_REG(hw, TARC0); 1535 tarc = E1000_READ_REG(hw, TARC0);
1501 tarc |= 1; 1536 tarc |= 1;
1502 if (hw->media_type == e1000_media_type_internal_serdes)
1503 tarc |= (1 << 20);
1504 E1000_WRITE_REG(hw, TARC0, tarc); 1537 E1000_WRITE_REG(hw, TARC0, tarc);
1505 tarc = E1000_READ_REG(hw, TARC1); 1538 tarc = E1000_READ_REG(hw, TARC1);
1506 tarc |= 1; 1539 tarc |= 1;
@@ -1639,10 +1672,6 @@ setup_rx_desc_die:
1639 * (Descriptors) for all queues 1672 * (Descriptors) for all queues
1640 * @adapter: board private structure 1673 * @adapter: board private structure
1641 * 1674 *
1642 * If this function returns with an error, then it's possible one or
1643 * more of the rings is populated (while the rest are not). It is the
1644 * callers duty to clean those orphaned rings.
1645 *
1646 * Return 0 on success, negative on failure 1675 * Return 0 on success, negative on failure
1647 **/ 1676 **/
1648 1677
@@ -1656,6 +1685,9 @@ e1000_setup_all_rx_resources(struct e1000_adapter *adapter)
1656 if (err) { 1685 if (err) {
1657 DPRINTK(PROBE, ERR, 1686 DPRINTK(PROBE, ERR,
1658 "Allocation for Rx Queue %u failed\n", i); 1687 "Allocation for Rx Queue %u failed\n", i);
1688 for (i-- ; i >= 0; i--)
1689 e1000_free_rx_resources(adapter,
1690 &adapter->rx_ring[i]);
1659 break; 1691 break;
1660 } 1692 }
1661 } 1693 }
@@ -2442,10 +2474,9 @@ e1000_watchdog(unsigned long data)
2442 * disable receives in the ISR and 2474 * disable receives in the ISR and
2443 * reset device here in the watchdog 2475 * reset device here in the watchdog
2444 */ 2476 */
2445 if (adapter->hw.mac_type == e1000_80003es2lan) { 2477 if (adapter->hw.mac_type == e1000_80003es2lan)
2446 /* reset device */ 2478 /* reset device */
2447 schedule_work(&adapter->reset_task); 2479 schedule_work(&adapter->reset_task);
2448 }
2449 } 2480 }
2450 2481
2451 e1000_smartspeed(adapter); 2482 e1000_smartspeed(adapter);
@@ -2545,7 +2576,7 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
2545 cmd_length = E1000_TXD_CMD_IP; 2576 cmd_length = E1000_TXD_CMD_IP;
2546 ipcse = skb->h.raw - skb->data - 1; 2577 ipcse = skb->h.raw - skb->data - 1;
2547#ifdef NETIF_F_TSO_IPV6 2578#ifdef NETIF_F_TSO_IPV6
2548 } else if (skb->protocol == ntohs(ETH_P_IPV6)) { 2579 } else if (skb->protocol == htons(ETH_P_IPV6)) {
2549 skb->nh.ipv6h->payload_len = 0; 2580 skb->nh.ipv6h->payload_len = 0;
2550 skb->h.th->check = 2581 skb->h.th->check =
2551 ~csum_ipv6_magic(&skb->nh.ipv6h->saddr, 2582 ~csum_ipv6_magic(&skb->nh.ipv6h->saddr,
@@ -3680,7 +3711,7 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter,
3680 E1000_DBG("%s: Receive packet consumed multiple" 3711 E1000_DBG("%s: Receive packet consumed multiple"
3681 " buffers\n", netdev->name); 3712 " buffers\n", netdev->name);
3682 /* recycle */ 3713 /* recycle */
3683 buffer_info-> skb = skb; 3714 buffer_info->skb = skb;
3684 goto next_desc; 3715 goto next_desc;
3685 } 3716 }
3686 3717
@@ -3711,7 +3742,6 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter,
3711 netdev_alloc_skb(netdev, length + NET_IP_ALIGN); 3742 netdev_alloc_skb(netdev, length + NET_IP_ALIGN);
3712 if (new_skb) { 3743 if (new_skb) {
3713 skb_reserve(new_skb, NET_IP_ALIGN); 3744 skb_reserve(new_skb, NET_IP_ALIGN);
3714 new_skb->dev = netdev;
3715 memcpy(new_skb->data - NET_IP_ALIGN, 3745 memcpy(new_skb->data - NET_IP_ALIGN,
3716 skb->data - NET_IP_ALIGN, 3746 skb->data - NET_IP_ALIGN,
3717 length + NET_IP_ALIGN); 3747 length + NET_IP_ALIGN);
@@ -3978,13 +4008,13 @@ e1000_alloc_rx_buffers(struct e1000_adapter *adapter,
3978 buffer_info = &rx_ring->buffer_info[i]; 4008 buffer_info = &rx_ring->buffer_info[i];
3979 4009
3980 while (cleaned_count--) { 4010 while (cleaned_count--) {
3981 if (!(skb = buffer_info->skb)) 4011 skb = buffer_info->skb;
3982 skb = netdev_alloc_skb(netdev, bufsz); 4012 if (skb) {
3983 else {
3984 skb_trim(skb, 0); 4013 skb_trim(skb, 0);
3985 goto map_skb; 4014 goto map_skb;
3986 } 4015 }
3987 4016
4017 skb = netdev_alloc_skb(netdev, bufsz);
3988 if (unlikely(!skb)) { 4018 if (unlikely(!skb)) {
3989 /* Better luck next round */ 4019 /* Better luck next round */
3990 adapter->alloc_rx_buff_failed++; 4020 adapter->alloc_rx_buff_failed++;
@@ -4009,10 +4039,10 @@ e1000_alloc_rx_buffers(struct e1000_adapter *adapter,
4009 dev_kfree_skb(skb); 4039 dev_kfree_skb(skb);
4010 dev_kfree_skb(oldskb); 4040 dev_kfree_skb(oldskb);
4011 break; /* while !buffer_info->skb */ 4041 break; /* while !buffer_info->skb */
4012 } else {
4013 /* Use new allocation */
4014 dev_kfree_skb(oldskb);
4015 } 4042 }
4043
4044 /* Use new allocation */
4045 dev_kfree_skb(oldskb);
4016 } 4046 }
4017 /* Make buffer alignment 2 beyond a 16 byte boundary 4047 /* Make buffer alignment 2 beyond a 16 byte boundary
4018 * this will result in a 16 byte aligned IP header after 4048 * this will result in a 16 byte aligned IP header after
@@ -4020,8 +4050,6 @@ e1000_alloc_rx_buffers(struct e1000_adapter *adapter,
4020 */ 4050 */
4021 skb_reserve(skb, NET_IP_ALIGN); 4051 skb_reserve(skb, NET_IP_ALIGN);
4022 4052
4023 skb->dev = netdev;
4024
4025 buffer_info->skb = skb; 4053 buffer_info->skb = skb;
4026 buffer_info->length = adapter->rx_buffer_len; 4054 buffer_info->length = adapter->rx_buffer_len;
4027map_skb: 4055map_skb:
@@ -4135,8 +4163,6 @@ e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter,
4135 */ 4163 */
4136 skb_reserve(skb, NET_IP_ALIGN); 4164 skb_reserve(skb, NET_IP_ALIGN);
4137 4165
4138 skb->dev = netdev;
4139
4140 buffer_info->skb = skb; 4166 buffer_info->skb = skb;
4141 buffer_info->length = adapter->rx_ps_bsize0; 4167 buffer_info->length = adapter->rx_ps_bsize0;
4142 buffer_info->dma = pci_map_single(pdev, skb->data, 4168 buffer_info->dma = pci_map_single(pdev, skb->data,
@@ -4628,7 +4654,7 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state)
4628 e1000_set_multi(netdev); 4654 e1000_set_multi(netdev);
4629 4655
4630 /* turn on all-multi mode if wake on multicast is enabled */ 4656 /* turn on all-multi mode if wake on multicast is enabled */
4631 if (adapter->wol & E1000_WUFC_MC) { 4657 if (wufc & E1000_WUFC_MC) {
4632 rctl = E1000_READ_REG(&adapter->hw, RCTL); 4658 rctl = E1000_READ_REG(&adapter->hw, RCTL);
4633 rctl |= E1000_RCTL_MPE; 4659 rctl |= E1000_RCTL_MPE;
4634 E1000_WRITE_REG(&adapter->hw, RCTL, rctl); 4660 E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
@@ -4700,11 +4726,14 @@ e1000_resume(struct pci_dev *pdev)
4700{ 4726{
4701 struct net_device *netdev = pci_get_drvdata(pdev); 4727 struct net_device *netdev = pci_get_drvdata(pdev);
4702 struct e1000_adapter *adapter = netdev_priv(netdev); 4728 struct e1000_adapter *adapter = netdev_priv(netdev);
4703 uint32_t manc, ret_val; 4729 uint32_t manc, err;
4704 4730
4705 pci_set_power_state(pdev, PCI_D0); 4731 pci_set_power_state(pdev, PCI_D0);
4706 e1000_pci_restore_state(adapter); 4732 e1000_pci_restore_state(adapter);
4707 ret_val = pci_enable_device(pdev); 4733 if ((err = pci_enable_device(pdev))) {
4734 printk(KERN_ERR "e1000: Cannot enable PCI device from suspend\n");
4735 return err;
4736 }
4708 pci_set_master(pdev); 4737 pci_set_master(pdev);
4709 4738
4710 pci_enable_wake(pdev, PCI_D3hot, 0); 4739 pci_enable_wake(pdev, PCI_D3hot, 0);
@@ -4782,6 +4811,7 @@ static pci_ers_result_t e1000_io_error_detected(struct pci_dev *pdev, pci_channe
4782 4811
4783 if (netif_running(netdev)) 4812 if (netif_running(netdev))
4784 e1000_down(adapter); 4813 e1000_down(adapter);
4814 pci_disable_device(pdev);
4785 4815
4786 /* Request a slot slot reset. */ 4816 /* Request a slot slot reset. */
4787 return PCI_ERS_RESULT_NEED_RESET; 4817 return PCI_ERS_RESULT_NEED_RESET;