diff options
author | Malli Chilakala <mallikarjuna.chilakala@intel.com> | 2005-04-28 22:44:46 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-05-12 20:48:55 -0400 |
commit | 2648345fcbadfae8e7113112ff9402e465a184dc (patch) | |
tree | ed615c4e72328e4ba137d700d341c96b7e611229 /drivers/net/e1000/e1000_main.c | |
parent | 1125ecbc0a89db07bb4eb1ba892a23367c3bdeb5 (diff) |
[PATCH] e1000:Driver version,white space,comments,device id
Driver version, white space, comments, device id & other
Signed-off-by: Mallikarjuna R Chilakala <mallikarjuna.chilakala@intel.com>
Signed-off-by: Ganesh Venkatesan <ganesh.venkatesan@intel.com>
Signed-off-by: John Ronciak <john.ronciak@intel.com>
diff -up net-drivers-2.6/drivers/net/e1000/e1000_ethtool.c net-drivers-2.6/drivers/net/e1000.new/e1000_ethtool.c
Diffstat (limited to 'drivers/net/e1000/e1000_main.c')
-rw-r--r-- | drivers/net/e1000/e1000_main.c | 199 |
1 files changed, 87 insertions, 112 deletions
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 24d96c02b509..325495b8b60c 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | 3 | ||
4 | Copyright(c) 1999 - 2004 Intel Corporation. All rights reserved. | 4 | Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms of the GNU General Public License as published by the Free | 7 | under the terms of the GNU General Public License as published by the Free |
@@ -29,33 +29,9 @@ | |||
29 | #include "e1000.h" | 29 | #include "e1000.h" |
30 | 30 | ||
31 | /* Change Log | 31 | /* Change Log |
32 | * 5.3.12 6/7/04 | 32 | * 6.0.44+ 2/15/05 |
33 | * - kcompat NETIF_MSG for older kernels (2.4.9) <sean.p.mcdermott@intel.com> | 33 | * o applied Anton's patch to resolve tx hang in hardware |
34 | * - if_mii support and associated kcompat for older kernels | 34 | * o Applied Andrew Mortons patch - e1000 stops working after resume |
35 | * - More errlogging support from Jon Mason <jonmason@us.ibm.com> | ||
36 | * - Fix TSO issues on PPC64 machines -- Jon Mason <jonmason@us.ibm.com> | ||
37 | * | ||
38 | * 5.7.1 12/16/04 | ||
39 | * - Resurrect 82547EI/GI related fix in e1000_intr to avoid deadlocks. This | ||
40 | * fix was removed as it caused system instability. The suspected cause of | ||
41 | * this is the called to e1000_irq_disable in e1000_intr. Inlined the | ||
42 | * required piece of e1000_irq_disable into e1000_intr - Anton Blanchard | ||
43 | * 5.7.0 12/10/04 | ||
44 | * - include fix to the condition that determines when to quit NAPI - Robert Olsson | ||
45 | * - use netif_poll_{disable/enable} to synchronize between NAPI and i/f up/down | ||
46 | * 5.6.5 11/01/04 | ||
47 | * - Enabling NETIF_F_SG without checksum offload is illegal - | ||
48 | John Mason <jdmason@us.ibm.com> | ||
49 | * 5.6.3 10/26/04 | ||
50 | * - Remove redundant initialization - Jamal Hadi | ||
51 | * - Reset buffer_info->dma in tx resource cleanup logic | ||
52 | * 5.6.2 10/12/04 | ||
53 | * - Avoid filling tx_ring completely - shemminger@osdl.org | ||
54 | * - Replace schedule_timeout() with msleep()/msleep_interruptible() - | ||
55 | * nacc@us.ibm.com | ||
56 | * - Sparse cleanup - shemminger@osdl.org | ||
57 | * - Fix tx resource cleanup logic | ||
58 | * - LLTX support - ak@suse.de and hadi@cyberus.ca | ||
59 | */ | 35 | */ |
60 | 36 | ||
61 | char e1000_driver_name[] = "e1000"; | 37 | char e1000_driver_name[] = "e1000"; |
@@ -65,7 +41,7 @@ char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; | |||
65 | #else | 41 | #else |
66 | #define DRIVERNAPI "-NAPI" | 42 | #define DRIVERNAPI "-NAPI" |
67 | #endif | 43 | #endif |
68 | #define DRV_VERSION "5.7.6-k2"DRIVERNAPI | 44 | #define DRV_VERSION "6.0.54-k2"DRIVERNAPI |
69 | char e1000_driver_version[] = DRV_VERSION; | 45 | char e1000_driver_version[] = DRV_VERSION; |
70 | char e1000_copyright[] = "Copyright (c) 1999-2004 Intel Corporation."; | 46 | char e1000_copyright[] = "Copyright (c) 1999-2004 Intel Corporation."; |
71 | 47 | ||
@@ -96,6 +72,7 @@ static struct pci_device_id e1000_pci_tbl[] = { | |||
96 | INTEL_E1000_ETHERNET_DEVICE(0x1017), | 72 | INTEL_E1000_ETHERNET_DEVICE(0x1017), |
97 | INTEL_E1000_ETHERNET_DEVICE(0x1018), | 73 | INTEL_E1000_ETHERNET_DEVICE(0x1018), |
98 | INTEL_E1000_ETHERNET_DEVICE(0x1019), | 74 | INTEL_E1000_ETHERNET_DEVICE(0x1019), |
75 | INTEL_E1000_ETHERNET_DEVICE(0x101A), | ||
99 | INTEL_E1000_ETHERNET_DEVICE(0x101D), | 76 | INTEL_E1000_ETHERNET_DEVICE(0x101D), |
100 | INTEL_E1000_ETHERNET_DEVICE(0x101E), | 77 | INTEL_E1000_ETHERNET_DEVICE(0x101E), |
101 | INTEL_E1000_ETHERNET_DEVICE(0x1026), | 78 | INTEL_E1000_ETHERNET_DEVICE(0x1026), |
@@ -110,6 +87,9 @@ static struct pci_device_id e1000_pci_tbl[] = { | |||
110 | INTEL_E1000_ETHERNET_DEVICE(0x107B), | 87 | INTEL_E1000_ETHERNET_DEVICE(0x107B), |
111 | INTEL_E1000_ETHERNET_DEVICE(0x107C), | 88 | INTEL_E1000_ETHERNET_DEVICE(0x107C), |
112 | INTEL_E1000_ETHERNET_DEVICE(0x108A), | 89 | INTEL_E1000_ETHERNET_DEVICE(0x108A), |
90 | INTEL_E1000_ETHERNET_DEVICE(0x108B), | ||
91 | INTEL_E1000_ETHERNET_DEVICE(0x108C), | ||
92 | INTEL_E1000_ETHERNET_DEVICE(0x1099), | ||
113 | /* required last entry */ | 93 | /* required last entry */ |
114 | {0,} | 94 | {0,} |
115 | }; | 95 | }; |
@@ -350,8 +330,11 @@ e1000_up(struct e1000_adapter *adapter) | |||
350 | #endif | 330 | #endif |
351 | if((err = request_irq(adapter->pdev->irq, &e1000_intr, | 331 | if((err = request_irq(adapter->pdev->irq, &e1000_intr, |
352 | SA_SHIRQ | SA_SAMPLE_RANDOM, | 332 | SA_SHIRQ | SA_SAMPLE_RANDOM, |
353 | netdev->name, netdev))) | 333 | netdev->name, netdev))) { |
334 | DPRINTK(PROBE, ERR, | ||
335 | "Unable to allocate interrupt Error: %d\n", err); | ||
354 | return err; | 336 | return err; |
337 | } | ||
355 | 338 | ||
356 | mod_timer(&adapter->watchdog_timer, jiffies); | 339 | mod_timer(&adapter->watchdog_timer, jiffies); |
357 | 340 | ||
@@ -636,7 +619,7 @@ e1000_probe(struct pci_dev *pdev, | |||
636 | 619 | ||
637 | /* copy the MAC address out of the EEPROM */ | 620 | /* copy the MAC address out of the EEPROM */ |
638 | 621 | ||
639 | if (e1000_read_mac_addr(&adapter->hw)) | 622 | if(e1000_read_mac_addr(&adapter->hw)) |
640 | DPRINTK(PROBE, ERR, "EEPROM Read Error\n"); | 623 | DPRINTK(PROBE, ERR, "EEPROM Read Error\n"); |
641 | memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len); | 624 | memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len); |
642 | 625 | ||
@@ -963,12 +946,10 @@ e1000_check_64k_bound(struct e1000_adapter *adapter, | |||
963 | unsigned long begin = (unsigned long) start; | 946 | unsigned long begin = (unsigned long) start; |
964 | unsigned long end = begin + len; | 947 | unsigned long end = begin + len; |
965 | 948 | ||
966 | /* first rev 82545 and 82546 need to not allow any memory | 949 | /* First rev 82545 and 82546 need to not allow any memory |
967 | * write location to cross a 64k boundary due to errata 23 */ | 950 | * write location to cross 64k boundary due to errata 23 */ |
968 | if (adapter->hw.mac_type == e1000_82545 || | 951 | if (adapter->hw.mac_type == e1000_82545 || |
969 | adapter->hw.mac_type == e1000_82546 ) { | 952 | adapter->hw.mac_type == e1000_82546) { |
970 | |||
971 | /* check buffer doesn't cross 64kB */ | ||
972 | return ((begin ^ (end - 1)) >> 16) != 0 ? FALSE : TRUE; | 953 | return ((begin ^ (end - 1)) >> 16) != 0 ? FALSE : TRUE; |
973 | } | 954 | } |
974 | 955 | ||
@@ -992,8 +973,8 @@ e1000_setup_tx_resources(struct e1000_adapter *adapter) | |||
992 | size = sizeof(struct e1000_buffer) * txdr->count; | 973 | size = sizeof(struct e1000_buffer) * txdr->count; |
993 | txdr->buffer_info = vmalloc(size); | 974 | txdr->buffer_info = vmalloc(size); |
994 | if(!txdr->buffer_info) { | 975 | if(!txdr->buffer_info) { |
995 | DPRINTK(PROBE, ERR, | 976 | DPRINTK(PROBE, ERR, |
996 | "Unable to Allocate Memory for the Transmit descriptor ring\n"); | 977 | "Unable to allocate memory for the transmit descriptor ring\n"); |
997 | return -ENOMEM; | 978 | return -ENOMEM; |
998 | } | 979 | } |
999 | memset(txdr->buffer_info, 0, size); | 980 | memset(txdr->buffer_info, 0, size); |
@@ -1006,38 +987,38 @@ e1000_setup_tx_resources(struct e1000_adapter *adapter) | |||
1006 | txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma); | 987 | txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma); |
1007 | if(!txdr->desc) { | 988 | if(!txdr->desc) { |
1008 | setup_tx_desc_die: | 989 | setup_tx_desc_die: |
1009 | DPRINTK(PROBE, ERR, | ||
1010 | "Unable to Allocate Memory for the Transmit descriptor ring\n"); | ||
1011 | vfree(txdr->buffer_info); | 990 | vfree(txdr->buffer_info); |
991 | DPRINTK(PROBE, ERR, | ||
992 | "Unable to allocate memory for the transmit descriptor ring\n"); | ||
1012 | return -ENOMEM; | 993 | return -ENOMEM; |
1013 | } | 994 | } |
1014 | 995 | ||
1015 | /* fix for errata 23, cant cross 64kB boundary */ | 996 | /* Fix for errata 23, can't cross 64kB boundary */ |
1016 | if (!e1000_check_64k_bound(adapter, txdr->desc, txdr->size)) { | 997 | if (!e1000_check_64k_bound(adapter, txdr->desc, txdr->size)) { |
1017 | void *olddesc = txdr->desc; | 998 | void *olddesc = txdr->desc; |
1018 | dma_addr_t olddma = txdr->dma; | 999 | dma_addr_t olddma = txdr->dma; |
1019 | DPRINTK(TX_ERR,ERR,"txdr align check failed: %u bytes at %p\n", | 1000 | DPRINTK(TX_ERR, ERR, "txdr align check failed: %u bytes " |
1020 | txdr->size, txdr->desc); | 1001 | "at %p\n", txdr->size, txdr->desc); |
1021 | /* try again, without freeing the previous */ | 1002 | /* Try again, without freeing the previous */ |
1022 | txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma); | 1003 | txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma); |
1023 | /* failed allocation, critial failure */ | ||
1024 | if(!txdr->desc) { | 1004 | if(!txdr->desc) { |
1005 | /* Failed allocation, critical failure */ | ||
1025 | pci_free_consistent(pdev, txdr->size, olddesc, olddma); | 1006 | pci_free_consistent(pdev, txdr->size, olddesc, olddma); |
1026 | goto setup_tx_desc_die; | 1007 | goto setup_tx_desc_die; |
1027 | } | 1008 | } |
1028 | 1009 | ||
1029 | if (!e1000_check_64k_bound(adapter, txdr->desc, txdr->size)) { | 1010 | if (!e1000_check_64k_bound(adapter, txdr->desc, txdr->size)) { |
1030 | /* give up */ | 1011 | /* give up */ |
1031 | pci_free_consistent(pdev, txdr->size, | 1012 | pci_free_consistent(pdev, txdr->size, txdr->desc, |
1032 | txdr->desc, txdr->dma); | 1013 | txdr->dma); |
1033 | pci_free_consistent(pdev, txdr->size, olddesc, olddma); | 1014 | pci_free_consistent(pdev, txdr->size, olddesc, olddma); |
1034 | DPRINTK(PROBE, ERR, | 1015 | DPRINTK(PROBE, ERR, |
1035 | "Unable to Allocate aligned Memory for the Transmit" | 1016 | "Unable to allocate aligned memory " |
1036 | " descriptor ring\n"); | 1017 | "for the transmit descriptor ring\n"); |
1037 | vfree(txdr->buffer_info); | 1018 | vfree(txdr->buffer_info); |
1038 | return -ENOMEM; | 1019 | return -ENOMEM; |
1039 | } else { | 1020 | } else { |
1040 | /* free old, move on with the new one since its okay */ | 1021 | /* Free old allocation, new allocation was successful */ |
1041 | pci_free_consistent(pdev, txdr->size, olddesc, olddma); | 1022 | pci_free_consistent(pdev, txdr->size, olddesc, olddma); |
1042 | } | 1023 | } |
1043 | } | 1024 | } |
@@ -1144,8 +1125,8 @@ e1000_setup_rx_resources(struct e1000_adapter *adapter) | |||
1144 | size = sizeof(struct e1000_buffer) * rxdr->count; | 1125 | size = sizeof(struct e1000_buffer) * rxdr->count; |
1145 | rxdr->buffer_info = vmalloc(size); | 1126 | rxdr->buffer_info = vmalloc(size); |
1146 | if(!rxdr->buffer_info) { | 1127 | if(!rxdr->buffer_info) { |
1147 | DPRINTK(PROBE, ERR, | 1128 | DPRINTK(PROBE, ERR, |
1148 | "Unable to Allocate Memory for the Recieve descriptor ring\n"); | 1129 | "Unable to allocate memory for the receive descriptor ring\n"); |
1149 | return -ENOMEM; | 1130 | return -ENOMEM; |
1150 | } | 1131 | } |
1151 | memset(rxdr->buffer_info, 0, size); | 1132 | memset(rxdr->buffer_info, 0, size); |
@@ -1185,43 +1166,42 @@ e1000_setup_rx_resources(struct e1000_adapter *adapter) | |||
1185 | 1166 | ||
1186 | if(!rxdr->desc) { | 1167 | if(!rxdr->desc) { |
1187 | setup_rx_desc_die: | 1168 | setup_rx_desc_die: |
1188 | DPRINTK(PROBE, ERR, | ||
1189 | "Unble to Allocate Memory for the Recieve descriptor ring\n"); | ||
1190 | vfree(rxdr->buffer_info); | 1169 | vfree(rxdr->buffer_info); |
1191 | kfree(rxdr->ps_page); | 1170 | kfree(rxdr->ps_page); |
1192 | kfree(rxdr->ps_page_dma); | 1171 | kfree(rxdr->ps_page_dma); |
1172 | DPRINTK(PROBE, ERR, | ||
1173 | "Unable to allocate memory for the receive descriptor ring\n"); | ||
1193 | return -ENOMEM; | 1174 | return -ENOMEM; |
1194 | } | 1175 | } |
1195 | 1176 | ||
1196 | /* fix for errata 23, cant cross 64kB boundary */ | 1177 | /* Fix for errata 23, can't cross 64kB boundary */ |
1197 | if (!e1000_check_64k_bound(adapter, rxdr->desc, rxdr->size)) { | 1178 | if (!e1000_check_64k_bound(adapter, rxdr->desc, rxdr->size)) { |
1198 | void *olddesc = rxdr->desc; | 1179 | void *olddesc = rxdr->desc; |
1199 | dma_addr_t olddma = rxdr->dma; | 1180 | dma_addr_t olddma = rxdr->dma; |
1200 | DPRINTK(RX_ERR,ERR, | 1181 | DPRINTK(RX_ERR, ERR, "rxdr align check failed: %u bytes " |
1201 | "rxdr align check failed: %u bytes at %p\n", | 1182 | "at %p\n", rxdr->size, rxdr->desc); |
1202 | rxdr->size, rxdr->desc); | 1183 | /* Try again, without freeing the previous */ |
1203 | /* try again, without freeing the previous */ | ||
1204 | rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma); | 1184 | rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma); |
1205 | /* failed allocation, critial failure */ | ||
1206 | if(!rxdr->desc) { | 1185 | if(!rxdr->desc) { |
1186 | /* Failed allocation, critical failure */ | ||
1207 | pci_free_consistent(pdev, rxdr->size, olddesc, olddma); | 1187 | pci_free_consistent(pdev, rxdr->size, olddesc, olddma); |
1208 | goto setup_rx_desc_die; | 1188 | goto setup_rx_desc_die; |
1209 | } | 1189 | } |
1210 | 1190 | ||
1211 | if (!e1000_check_64k_bound(adapter, rxdr->desc, rxdr->size)) { | 1191 | if (!e1000_check_64k_bound(adapter, rxdr->desc, rxdr->size)) { |
1212 | /* give up */ | 1192 | /* give up */ |
1213 | pci_free_consistent(pdev, rxdr->size, | 1193 | pci_free_consistent(pdev, rxdr->size, rxdr->desc, |
1214 | rxdr->desc, rxdr->dma); | 1194 | rxdr->dma); |
1215 | pci_free_consistent(pdev, rxdr->size, olddesc, olddma); | 1195 | pci_free_consistent(pdev, rxdr->size, olddesc, olddma); |
1216 | DPRINTK(PROBE, ERR, | 1196 | DPRINTK(PROBE, ERR, |
1217 | "Unable to Allocate aligned Memory for the" | 1197 | "Unable to allocate aligned memory " |
1218 | " Receive descriptor ring\n"); | 1198 | "for the receive descriptor ring\n"); |
1219 | vfree(rxdr->buffer_info); | 1199 | vfree(rxdr->buffer_info); |
1220 | kfree(rxdr->ps_page); | 1200 | kfree(rxdr->ps_page); |
1221 | kfree(rxdr->ps_page_dma); | 1201 | kfree(rxdr->ps_page_dma); |
1222 | return -ENOMEM; | 1202 | return -ENOMEM; |
1223 | } else { | 1203 | } else { |
1224 | /* free old, move on with the new one since its okay */ | 1204 | /* Free old allocation, new allocation was successful */ |
1225 | pci_free_consistent(pdev, rxdr->size, olddesc, olddma); | 1205 | pci_free_consistent(pdev, rxdr->size, olddesc, olddma); |
1226 | } | 1206 | } |
1227 | } | 1207 | } |
@@ -1234,7 +1214,7 @@ setup_rx_desc_die: | |||
1234 | } | 1214 | } |
1235 | 1215 | ||
1236 | /** | 1216 | /** |
1237 | * e1000_setup_rctl - configure the receive control register | 1217 | * e1000_setup_rctl - configure the receive control registers |
1238 | * @adapter: Board private structure | 1218 | * @adapter: Board private structure |
1239 | **/ | 1219 | **/ |
1240 | 1220 | ||
@@ -1426,13 +1406,11 @@ static inline void | |||
1426 | e1000_unmap_and_free_tx_resource(struct e1000_adapter *adapter, | 1406 | e1000_unmap_and_free_tx_resource(struct e1000_adapter *adapter, |
1427 | struct e1000_buffer *buffer_info) | 1407 | struct e1000_buffer *buffer_info) |
1428 | { | 1408 | { |
1429 | struct pci_dev *pdev = adapter->pdev; | ||
1430 | |||
1431 | if(buffer_info->dma) { | 1409 | if(buffer_info->dma) { |
1432 | pci_unmap_page(pdev, | 1410 | pci_unmap_page(adapter->pdev, |
1433 | buffer_info->dma, | 1411 | buffer_info->dma, |
1434 | buffer_info->length, | 1412 | buffer_info->length, |
1435 | PCI_DMA_TODEVICE); | 1413 | PCI_DMA_TODEVICE); |
1436 | buffer_info->dma = 0; | 1414 | buffer_info->dma = 0; |
1437 | } | 1415 | } |
1438 | if(buffer_info->skb) { | 1416 | if(buffer_info->skb) { |
@@ -1457,7 +1435,7 @@ e1000_clean_tx_ring(struct e1000_adapter *adapter) | |||
1457 | /* Free all the Tx ring sk_buffs */ | 1435 | /* Free all the Tx ring sk_buffs */ |
1458 | 1436 | ||
1459 | if (likely(adapter->previous_buffer_info.skb != NULL)) { | 1437 | if (likely(adapter->previous_buffer_info.skb != NULL)) { |
1460 | e1000_unmap_and_free_tx_resource(adapter, | 1438 | e1000_unmap_and_free_tx_resource(adapter, |
1461 | &adapter->previous_buffer_info); | 1439 | &adapter->previous_buffer_info); |
1462 | } | 1440 | } |
1463 | 1441 | ||
@@ -1659,15 +1637,15 @@ e1000_set_multi(struct net_device *netdev) | |||
1659 | struct e1000_adapter *adapter = netdev->priv; | 1637 | struct e1000_adapter *adapter = netdev->priv; |
1660 | struct e1000_hw *hw = &adapter->hw; | 1638 | struct e1000_hw *hw = &adapter->hw; |
1661 | struct dev_mc_list *mc_ptr; | 1639 | struct dev_mc_list *mc_ptr; |
1640 | unsigned long flags; | ||
1662 | uint32_t rctl; | 1641 | uint32_t rctl; |
1663 | uint32_t hash_value; | 1642 | uint32_t hash_value; |
1664 | int i; | 1643 | int i; |
1665 | unsigned long flags; | ||
1666 | |||
1667 | /* Check for Promiscuous and All Multicast modes */ | ||
1668 | 1644 | ||
1669 | spin_lock_irqsave(&adapter->tx_lock, flags); | 1645 | spin_lock_irqsave(&adapter->tx_lock, flags); |
1670 | 1646 | ||
1647 | /* Check for Promiscuous and All Multicast modes */ | ||
1648 | |||
1671 | rctl = E1000_READ_REG(hw, RCTL); | 1649 | rctl = E1000_READ_REG(hw, RCTL); |
1672 | 1650 | ||
1673 | if(netdev->flags & IFF_PROMISC) { | 1651 | if(netdev->flags & IFF_PROMISC) { |
@@ -1874,7 +1852,7 @@ e1000_watchdog_task(struct e1000_adapter *adapter) | |||
1874 | /* Cause software interrupt to ensure rx ring is cleaned */ | 1852 | /* Cause software interrupt to ensure rx ring is cleaned */ |
1875 | E1000_WRITE_REG(&adapter->hw, ICS, E1000_ICS_RXDMT0); | 1853 | E1000_WRITE_REG(&adapter->hw, ICS, E1000_ICS_RXDMT0); |
1876 | 1854 | ||
1877 | /* Force detection of hung controller every watchdog period*/ | 1855 | /* Force detection of hung controller every watchdog period */ |
1878 | adapter->detect_tx_hung = TRUE; | 1856 | adapter->detect_tx_hung = TRUE; |
1879 | 1857 | ||
1880 | /* Reset the timer */ | 1858 | /* Reset the timer */ |
@@ -2255,7 +2233,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
2255 | 2233 | ||
2256 | #ifdef NETIF_F_TSO | 2234 | #ifdef NETIF_F_TSO |
2257 | mss = skb_shinfo(skb)->tso_size; | 2235 | mss = skb_shinfo(skb)->tso_size; |
2258 | /* The controller does a simple calculation to | 2236 | /* The controller does a simple calculation to |
2259 | * make sure there is enough room in the FIFO before | 2237 | * make sure there is enough room in the FIFO before |
2260 | * initiating the DMA for each buffer. The calc is: | 2238 | * initiating the DMA for each buffer. The calc is: |
2261 | * 4 = ceil(buffer len/mss). To make sure we don't | 2239 | * 4 = ceil(buffer len/mss). To make sure we don't |
@@ -2268,7 +2246,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
2268 | 2246 | ||
2269 | if((mss) || (skb->ip_summed == CHECKSUM_HW)) | 2247 | if((mss) || (skb->ip_summed == CHECKSUM_HW)) |
2270 | count++; | 2248 | count++; |
2271 | count++; /* for sentinel desc */ | 2249 | count++; |
2272 | #else | 2250 | #else |
2273 | if(skb->ip_summed == CHECKSUM_HW) | 2251 | if(skb->ip_summed == CHECKSUM_HW) |
2274 | count++; | 2252 | count++; |
@@ -2658,7 +2636,7 @@ e1000_intr(int irq, void *data, struct pt_regs *regs) | |||
2658 | */ | 2636 | */ |
2659 | if(hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2){ | 2637 | if(hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2){ |
2660 | atomic_inc(&adapter->irq_sem); | 2638 | atomic_inc(&adapter->irq_sem); |
2661 | E1000_WRITE_REG(&adapter->hw, IMC, ~0); | 2639 | E1000_WRITE_REG(hw, IMC, ~0); |
2662 | } | 2640 | } |
2663 | 2641 | ||
2664 | for(i = 0; i < E1000_MAX_INTR; i++) | 2642 | for(i = 0; i < E1000_MAX_INTR; i++) |
@@ -2686,7 +2664,7 @@ e1000_clean(struct net_device *netdev, int *budget) | |||
2686 | int work_to_do = min(*budget, netdev->quota); | 2664 | int work_to_do = min(*budget, netdev->quota); |
2687 | int tx_cleaned; | 2665 | int tx_cleaned; |
2688 | int work_done = 0; | 2666 | int work_done = 0; |
2689 | 2667 | ||
2690 | tx_cleaned = e1000_clean_tx_irq(adapter); | 2668 | tx_cleaned = e1000_clean_tx_irq(adapter); |
2691 | adapter->clean_rx(adapter, &work_done, work_to_do); | 2669 | adapter->clean_rx(adapter, &work_done, work_to_do); |
2692 | 2670 | ||
@@ -2776,9 +2754,9 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter) | |||
2776 | netif_wake_queue(netdev); | 2754 | netif_wake_queue(netdev); |
2777 | 2755 | ||
2778 | spin_unlock(&adapter->tx_lock); | 2756 | spin_unlock(&adapter->tx_lock); |
2779 | |||
2780 | if(adapter->detect_tx_hung) { | 2757 | if(adapter->detect_tx_hung) { |
2781 | /* detect a transmit hang in hardware, this serializes the | 2758 | |
2759 | /* Detect a transmit hang in hardware, this serializes the | ||
2782 | * check with the clearing of time_stamp and movement of i */ | 2760 | * check with the clearing of time_stamp and movement of i */ |
2783 | adapter->detect_tx_hung = FALSE; | 2761 | adapter->detect_tx_hung = FALSE; |
2784 | if (tx_ring->buffer_info[i].dma && | 2762 | if (tx_ring->buffer_info[i].dma && |
@@ -2923,7 +2901,7 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter) | |||
2923 | if(unlikely(!(rx_desc->status & E1000_RXD_STAT_EOP))) { | 2901 | if(unlikely(!(rx_desc->status & E1000_RXD_STAT_EOP))) { |
2924 | /* All receives must fit into a single buffer */ | 2902 | /* All receives must fit into a single buffer */ |
2925 | E1000_DBG("%s: Receive packet consumed multiple" | 2903 | E1000_DBG("%s: Receive packet consumed multiple" |
2926 | " buffers\n", netdev->name); | 2904 | " buffers\n", netdev->name); |
2927 | dev_kfree_skb_irq(skb); | 2905 | dev_kfree_skb_irq(skb); |
2928 | goto next_desc; | 2906 | goto next_desc; |
2929 | } | 2907 | } |
@@ -3130,43 +3108,43 @@ e1000_alloc_rx_buffers(struct e1000_adapter *adapter) | |||
3130 | struct e1000_rx_desc *rx_desc; | 3108 | struct e1000_rx_desc *rx_desc; |
3131 | struct e1000_buffer *buffer_info; | 3109 | struct e1000_buffer *buffer_info; |
3132 | struct sk_buff *skb; | 3110 | struct sk_buff *skb; |
3133 | unsigned int i, bufsz; | 3111 | unsigned int i; |
3112 | unsigned int bufsz = adapter->rx_buffer_len + NET_IP_ALIGN; | ||
3134 | 3113 | ||
3135 | i = rx_ring->next_to_use; | 3114 | i = rx_ring->next_to_use; |
3136 | buffer_info = &rx_ring->buffer_info[i]; | 3115 | buffer_info = &rx_ring->buffer_info[i]; |
3137 | 3116 | ||
3138 | while(!buffer_info->skb) { | 3117 | while(!buffer_info->skb) { |
3139 | bufsz = adapter->rx_buffer_len + NET_IP_ALIGN; | ||
3140 | |||
3141 | skb = dev_alloc_skb(bufsz); | 3118 | skb = dev_alloc_skb(bufsz); |
3119 | |||
3142 | if(unlikely(!skb)) { | 3120 | if(unlikely(!skb)) { |
3143 | /* Better luck next round */ | 3121 | /* Better luck next round */ |
3144 | break; | 3122 | break; |
3145 | } | 3123 | } |
3146 | 3124 | ||
3147 | /* fix for errata 23, cant cross 64kB boundary */ | 3125 | /* Fix for errata 23, can't cross 64kB boundary */ |
3148 | if (!e1000_check_64k_bound(adapter, skb->data, bufsz)) { | 3126 | if (!e1000_check_64k_bound(adapter, skb->data, bufsz)) { |
3149 | struct sk_buff *oldskb = skb; | 3127 | struct sk_buff *oldskb = skb; |
3150 | DPRINTK(RX_ERR,ERR, | 3128 | DPRINTK(RX_ERR, ERR, "skb align check failed: %u bytes " |
3151 | "skb align check failed: %u bytes at %p\n", | 3129 | "at %p\n", bufsz, skb->data); |
3152 | bufsz, skb->data); | 3130 | /* Try again, without freeing the previous */ |
3153 | /* try again, without freeing the previous */ | ||
3154 | skb = dev_alloc_skb(bufsz); | 3131 | skb = dev_alloc_skb(bufsz); |
3132 | /* Failed allocation, critical failure */ | ||
3155 | if (!skb) { | 3133 | if (!skb) { |
3156 | dev_kfree_skb(oldskb); | 3134 | dev_kfree_skb(oldskb); |
3157 | break; | 3135 | break; |
3158 | } | 3136 | } |
3137 | |||
3159 | if (!e1000_check_64k_bound(adapter, skb->data, bufsz)) { | 3138 | if (!e1000_check_64k_bound(adapter, skb->data, bufsz)) { |
3160 | /* give up */ | 3139 | /* give up */ |
3161 | dev_kfree_skb(skb); | 3140 | dev_kfree_skb(skb); |
3162 | dev_kfree_skb(oldskb); | 3141 | dev_kfree_skb(oldskb); |
3163 | break; /* while !buffer_info->skb */ | 3142 | break; /* while !buffer_info->skb */ |
3164 | } else { | 3143 | } else { |
3165 | /* move on with the new one */ | 3144 | /* Use new allocation */ |
3166 | dev_kfree_skb(oldskb); | 3145 | dev_kfree_skb(oldskb); |
3167 | } | 3146 | } |
3168 | } | 3147 | } |
3169 | |||
3170 | /* Make buffer alignment 2 beyond a 16 byte boundary | 3148 | /* Make buffer alignment 2 beyond a 16 byte boundary |
3171 | * this will result in a 16 byte aligned IP header after | 3149 | * this will result in a 16 byte aligned IP header after |
3172 | * the 14 byte MAC header is removed | 3150 | * the 14 byte MAC header is removed |
@@ -3182,25 +3160,23 @@ e1000_alloc_rx_buffers(struct e1000_adapter *adapter) | |||
3182 | adapter->rx_buffer_len, | 3160 | adapter->rx_buffer_len, |
3183 | PCI_DMA_FROMDEVICE); | 3161 | PCI_DMA_FROMDEVICE); |
3184 | 3162 | ||
3185 | /* fix for errata 23, cant cross 64kB boundary */ | 3163 | /* Fix for errata 23, can't cross 64kB boundary */ |
3186 | if(!e1000_check_64k_bound(adapter, | 3164 | if (!e1000_check_64k_bound(adapter, |
3187 | (void *)(unsigned long)buffer_info->dma, | 3165 | (void *)(unsigned long)buffer_info->dma, |
3188 | adapter->rx_buffer_len)) { | 3166 | adapter->rx_buffer_len)) { |
3189 | DPRINTK(RX_ERR,ERR, | 3167 | DPRINTK(RX_ERR, ERR, |
3190 | "dma align check failed: %u bytes at %ld\n", | 3168 | "dma align check failed: %u bytes at %p\n", |
3191 | adapter->rx_buffer_len, (unsigned long)buffer_info->dma); | 3169 | adapter->rx_buffer_len, |
3192 | 3170 | (void *)(unsigned long)buffer_info->dma); | |
3193 | dev_kfree_skb(skb); | 3171 | dev_kfree_skb(skb); |
3194 | buffer_info->skb = NULL; | 3172 | buffer_info->skb = NULL; |
3195 | 3173 | ||
3196 | pci_unmap_single(pdev, | 3174 | pci_unmap_single(pdev, buffer_info->dma, |
3197 | buffer_info->dma, | ||
3198 | adapter->rx_buffer_len, | 3175 | adapter->rx_buffer_len, |
3199 | PCI_DMA_FROMDEVICE); | 3176 | PCI_DMA_FROMDEVICE); |
3200 | 3177 | ||
3201 | break; /* while !buffer_info->skb */ | 3178 | break; /* while !buffer_info->skb */ |
3202 | } | 3179 | } |
3203 | |||
3204 | rx_desc = E1000_RX_DESC(*rx_ring, i); | 3180 | rx_desc = E1000_RX_DESC(*rx_ring, i); |
3205 | rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma); | 3181 | rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma); |
3206 | 3182 | ||
@@ -3210,7 +3186,6 @@ e1000_alloc_rx_buffers(struct e1000_adapter *adapter) | |||
3210 | * applicable for weak-ordered memory model archs, | 3186 | * applicable for weak-ordered memory model archs, |
3211 | * such as IA-64). */ | 3187 | * such as IA-64). */ |
3212 | wmb(); | 3188 | wmb(); |
3213 | |||
3214 | E1000_WRITE_REG(&adapter->hw, RDT, i); | 3189 | E1000_WRITE_REG(&adapter->hw, RDT, i); |
3215 | } | 3190 | } |
3216 | 3191 | ||
@@ -3483,9 +3458,10 @@ void | |||
3483 | e1000_pci_set_mwi(struct e1000_hw *hw) | 3458 | e1000_pci_set_mwi(struct e1000_hw *hw) |
3484 | { | 3459 | { |
3485 | struct e1000_adapter *adapter = hw->back; | 3460 | struct e1000_adapter *adapter = hw->back; |
3461 | int ret_val = pci_set_mwi(adapter->pdev); | ||
3486 | 3462 | ||
3487 | int ret; | 3463 | if(ret_val) |
3488 | ret = pci_set_mwi(adapter->pdev); | 3464 | DPRINTK(PROBE, ERR, "Error in setting MWI\n"); |
3489 | } | 3465 | } |
3490 | 3466 | ||
3491 | void | 3467 | void |
@@ -3643,8 +3619,7 @@ e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx) | |||
3643 | break; | 3619 | break; |
3644 | case SPEED_1000 + DUPLEX_HALF: /* not supported */ | 3620 | case SPEED_1000 + DUPLEX_HALF: /* not supported */ |
3645 | default: | 3621 | default: |
3646 | DPRINTK(PROBE, ERR, | 3622 | DPRINTK(PROBE, ERR, "Unsupported Speed/Duplex configuration\n"); |
3647 | "Unsupported Speed/Duplexity configuration\n"); | ||
3648 | return -EINVAL; | 3623 | return -EINVAL; |
3649 | } | 3624 | } |
3650 | return 0; | 3625 | return 0; |
@@ -3810,7 +3785,7 @@ e1000_resume(struct pci_dev *pdev) | |||
3810 | * the interrupt routine is executing. | 3785 | * the interrupt routine is executing. |
3811 | */ | 3786 | */ |
3812 | static void | 3787 | static void |
3813 | e1000_netpoll (struct net_device *netdev) | 3788 | e1000_netpoll(struct net_device *netdev) |
3814 | { | 3789 | { |
3815 | struct e1000_adapter *adapter = netdev->priv; | 3790 | struct e1000_adapter *adapter = netdev->priv; |
3816 | disable_irq(adapter->pdev->irq); | 3791 | disable_irq(adapter->pdev->irq); |