aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-19 16:23:26 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-19 16:23:26 -0500
commit2370965c5065b24b28b5ba09b60ddfbfb6d7649b (patch)
tree1929618e9d904bdd0f050c95053b8b59145f670e /drivers
parent59b8175c771040afcd4ad67022b0cc80c216b866 (diff)
parent0b3581e26d4807f36b2294366d6fbd506c30d68a (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: (51 commits) sk98lin: mark deprecated in Kconfig Hostess SV-11 depends on INET Fix link autonegotiation timer. sk98lin: planned removal B44: increase wait loop b44: replace define e1000: allow ethtool to see link status when down e1000: remove obsolete custom pci_save_state code e1000: fix shared interrupt warning message atm: Use ARRAY_SIZE macro when appropriate bugfixes and new hardware support for arcnet driver pcnet32 NAPI no longer experimental MAINTAINER macb: Remove inappropriate spinlocks around mii calls Convert meth to netdev_priv sky2: v1.13 sky2: receive error handling improvements sky2: transmit timeout sky2: flow control negotiation for Yukon-FE sky2: no need to reset pause bits on shutdown ...
Diffstat (limited to 'drivers')
-rw-r--r--drivers/atm/he.c2
-rw-r--r--drivers/atm/idt77252.c8
-rw-r--r--drivers/atm/nicstarmac.c4
-rw-r--r--drivers/net/Kconfig14
-rw-r--r--drivers/net/arcnet/arc-rawmode.c4
-rw-r--r--drivers/net/arcnet/arcnet.c2
-rw-r--r--drivers/net/arcnet/com20020-pci.c3
-rw-r--r--drivers/net/arcnet/com20020.c2
-rw-r--r--drivers/net/atl1/atl1_hw.c37
-rw-r--r--drivers/net/atl1/atl1_main.c5
-rw-r--r--drivers/net/b44.c19
-rw-r--r--drivers/net/cxgb3/cxgb3_defs.h1
-rw-r--r--drivers/net/cxgb3/cxgb3_offload.c1
-rw-r--r--drivers/net/cxgb3/cxgb3_offload.h1
-rw-r--r--drivers/net/cxgb3/l2t.c1
-rw-r--r--drivers/net/cxgb3/l2t.h1
-rw-r--r--drivers/net/cxgb3/t3cdev.h1
-rw-r--r--drivers/net/e1000/e1000.h1
-rw-r--r--drivers/net/e1000/e1000_ethtool.c2
-rw-r--r--drivers/net/e1000/e1000_main.c70
-rw-r--r--drivers/net/ehea/ehea.h2
-rw-r--r--drivers/net/ehea/ehea_main.c8
-rw-r--r--drivers/net/ehea/ehea_phyp.c10
-rw-r--r--drivers/net/ehea/ehea_phyp.h3
-rw-r--r--drivers/net/ehea/ehea_qmr.c42
-rw-r--r--drivers/net/ehea/ehea_qmr.h5
-rw-r--r--drivers/net/gianfar.c85
-rw-r--r--drivers/net/gianfar_sysfs.c108
-rw-r--r--drivers/net/ioc3-eth.c16
-rw-r--r--drivers/net/macb.c24
-rw-r--r--drivers/net/meth.c26
-rw-r--r--drivers/net/netxen/netxen_nic.h9
-rw-r--r--drivers/net/netxen/netxen_nic_ethtool.c9
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c2
-rw-r--r--drivers/net/netxen/netxen_nic_init.c12
-rw-r--r--drivers/net/netxen/netxen_nic_main.c3
-rw-r--r--drivers/net/netxen/netxen_nic_niu.c2
-rw-r--r--drivers/net/pcmcia/3c574_cs.c2
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c2
-rw-r--r--drivers/net/phy/marvell.c156
-rw-r--r--drivers/net/phy/phy_device.c4
-rw-r--r--drivers/net/sk98lin/skge.c3
-rw-r--r--drivers/net/sky2.c125
-rw-r--r--drivers/net/sky2.h3
-rw-r--r--drivers/net/wan/Kconfig2
-rw-r--r--drivers/net/wan/pc300too.c2
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx.h1
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_dma.c171
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_main.c25
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_wx.c28
-rw-r--r--drivers/net/wireless/ipw2100.c16
-rw-r--r--drivers/net/wireless/zd1211rw/zd_mac.c44
-rw-r--r--drivers/net/wireless/zd1211rw/zd_usb.c12
53 files changed, 701 insertions, 440 deletions
diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index db33f6f4dd2a..8510026b690a 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -3017,7 +3017,7 @@ read_prom_byte(struct he_dev *he_dev, int addr)
3017 he_writel(he_dev, val, HOST_CNTL); 3017 he_writel(he_dev, val, HOST_CNTL);
3018 3018
3019 /* Send READ instruction */ 3019 /* Send READ instruction */
3020 for (i = 0; i < sizeof(readtab)/sizeof(readtab[0]); i++) { 3020 for (i = 0; i < ARRAY_SIZE(readtab); i++) {
3021 he_writel(he_dev, val | readtab[i], HOST_CNTL); 3021 he_writel(he_dev, val | readtab[i], HOST_CNTL);
3022 udelay(EEPROM_DELAY); 3022 udelay(EEPROM_DELAY);
3023 } 3023 }
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
index f40786121948..b4b80140c398 100644
--- a/drivers/atm/idt77252.c
+++ b/drivers/atm/idt77252.c
@@ -388,7 +388,7 @@ idt77252_eeprom_read_status(struct idt77252_dev *card)
388 388
389 gp = idt77252_read_gp(card) & ~(SAR_GP_EESCLK|SAR_GP_EECS|SAR_GP_EEDO); 389 gp = idt77252_read_gp(card) & ~(SAR_GP_EESCLK|SAR_GP_EECS|SAR_GP_EEDO);
390 390
391 for (i = 0; i < sizeof(rdsrtab)/sizeof(rdsrtab[0]); i++) { 391 for (i = 0; i < ARRAY_SIZE(rdsrtab); i++) {
392 idt77252_write_gp(card, gp | rdsrtab[i]); 392 idt77252_write_gp(card, gp | rdsrtab[i]);
393 udelay(5); 393 udelay(5);
394 } 394 }
@@ -422,7 +422,7 @@ idt77252_eeprom_read_byte(struct idt77252_dev *card, u8 offset)
422 422
423 gp = idt77252_read_gp(card) & ~(SAR_GP_EESCLK|SAR_GP_EECS|SAR_GP_EEDO); 423 gp = idt77252_read_gp(card) & ~(SAR_GP_EESCLK|SAR_GP_EECS|SAR_GP_EEDO);
424 424
425 for (i = 0; i < sizeof(rdtab)/sizeof(rdtab[0]); i++) { 425 for (i = 0; i < ARRAY_SIZE(rdtab); i++) {
426 idt77252_write_gp(card, gp | rdtab[i]); 426 idt77252_write_gp(card, gp | rdtab[i]);
427 udelay(5); 427 udelay(5);
428 } 428 }
@@ -469,14 +469,14 @@ idt77252_eeprom_write_byte(struct idt77252_dev *card, u8 offset, u8 data)
469 469
470 gp = idt77252_read_gp(card) & ~(SAR_GP_EESCLK|SAR_GP_EECS|SAR_GP_EEDO); 470 gp = idt77252_read_gp(card) & ~(SAR_GP_EESCLK|SAR_GP_EECS|SAR_GP_EEDO);
471 471
472 for (i = 0; i < sizeof(wrentab)/sizeof(wrentab[0]); i++) { 472 for (i = 0; i < ARRAY_SIZE(wrentab); i++) {
473 idt77252_write_gp(card, gp | wrentab[i]); 473 idt77252_write_gp(card, gp | wrentab[i]);
474 udelay(5); 474 udelay(5);
475 } 475 }
476 idt77252_write_gp(card, gp | SAR_GP_EECS); 476 idt77252_write_gp(card, gp | SAR_GP_EECS);
477 udelay(5); 477 udelay(5);
478 478
479 for (i = 0; i < sizeof(wrtab)/sizeof(wrtab[0]); i++) { 479 for (i = 0; i < ARRAY_SIZE(wrtab); i++) {
480 idt77252_write_gp(card, gp | wrtab[i]); 480 idt77252_write_gp(card, gp | wrtab[i]);
481 udelay(5); 481 udelay(5);
482 } 482 }
diff --git a/drivers/atm/nicstarmac.c b/drivers/atm/nicstarmac.c
index 2c5e3ae77503..480947f4e01e 100644
--- a/drivers/atm/nicstarmac.c
+++ b/drivers/atm/nicstarmac.c
@@ -7,6 +7,8 @@
7 * Read this ForeRunner's MAC address from eprom/eeprom 7 * Read this ForeRunner's MAC address from eprom/eeprom
8 */ 8 */
9 9
10#include <linux/kernel.h>
11
10typedef void __iomem *virt_addr_t; 12typedef void __iomem *virt_addr_t;
11 13
12#define CYCLE_DELAY 5 14#define CYCLE_DELAY 5
@@ -176,7 +178,7 @@ read_eprom_byte(virt_addr_t base, u_int8_t offset)
176 val = NICSTAR_REG_READ( base, NICSTAR_REG_GENERAL_PURPOSE ) & 0xFFFFFFF0; 178 val = NICSTAR_REG_READ( base, NICSTAR_REG_GENERAL_PURPOSE ) & 0xFFFFFFF0;
177 179
178 /* Send READ instruction */ 180 /* Send READ instruction */
179 for (i=0; i<sizeof readtab/sizeof readtab[0]; i++) 181 for (i=0; i<ARRAY_SIZE(readtab); i++)
180 { 182 {
181 NICSTAR_REG_WRITE( base, NICSTAR_REG_GENERAL_PURPOSE, 183 NICSTAR_REG_WRITE( base, NICSTAR_REG_GENERAL_PURPOSE,
182 (val | readtab[i]) ); 184 (val | readtab[i]) );
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 38f41a593b12..d9400ef87195 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -1284,8 +1284,8 @@ config PCNET32
1284 will be called pcnet32. 1284 will be called pcnet32.
1285 1285
1286config PCNET32_NAPI 1286config PCNET32_NAPI
1287 bool "Use RX polling (NAPI) (EXPERIMENTAL)" 1287 bool "Use RX polling (NAPI)"
1288 depends on PCNET32 && EXPERIMENTAL 1288 depends on PCNET32
1289 help 1289 help
1290 NAPI is a new driver API designed to reduce CPU and interrupt load 1290 NAPI is a new driver API designed to reduce CPU and interrupt load
1291 when the driver is receiving lots of packets from the card. It is 1291 when the driver is receiving lots of packets from the card. It is
@@ -2125,14 +2125,16 @@ config SKY2
2125 will be called sky2. This is recommended. 2125 will be called sky2. This is recommended.
2126 2126
2127config SK98LIN 2127config SK98LIN
2128 tristate "Marvell Yukon Chipset / SysKonnect SK-98xx Support" 2128 tristate "Marvell Yukon Chipset / SysKonnect SK-98xx Support (DEPRECATED)"
2129 depends on PCI 2129 depends on PCI
2130 ---help--- 2130 ---help---
2131 Say Y here if you have a Marvell Yukon or SysKonnect SK-98xx/SK-95xx 2131 Say Y here if you have a Marvell Yukon or SysKonnect SK-98xx/SK-95xx
2132 compliant Gigabit Ethernet Adapter. 2132 compliant Gigabit Ethernet Adapter.
2133 2133
2134 This driver supports the original Yukon chipset. A cleaner driver is 2134 This driver supports the original Yukon chipset. This driver is
2135 also available (skge) which seems to work better than this one. 2135 deprecated and will be removed from the kernel in the near future,
2136 it has been replaced by the skge driver. skge is cleaner and
2137 seems to work better.
2136 2138
2137 This driver does not support the newer Yukon2 chipset. A separate 2139 This driver does not support the newer Yukon2 chipset. A separate
2138 driver, sky2, is provided to support Yukon2-based adapters. 2140 driver, sky2, is provided to support Yukon2-based adapters.
@@ -2337,7 +2339,7 @@ config QLA3XXX
2337 2339
2338config ATL1 2340config ATL1
2339 tristate "Attansic L1 Gigabit Ethernet support (EXPERIMENTAL)" 2341 tristate "Attansic L1 Gigabit Ethernet support (EXPERIMENTAL)"
2340 depends on NET_PCI && PCI && EXPERIMENTAL 2342 depends on PCI && EXPERIMENTAL
2341 select CRC32 2343 select CRC32
2342 select MII 2344 select MII
2343 help 2345 help
diff --git a/drivers/net/arcnet/arc-rawmode.c b/drivers/net/arcnet/arc-rawmode.c
index e7555d4e6ff1..6318814a11a8 100644
--- a/drivers/net/arcnet/arc-rawmode.c
+++ b/drivers/net/arcnet/arc-rawmode.c
@@ -94,7 +94,7 @@ static void rx(struct net_device *dev, int bufnum,
94 94
95 BUGMSG(D_DURING, "it's a raw packet (length=%d)\n", length); 95 BUGMSG(D_DURING, "it's a raw packet (length=%d)\n", length);
96 96
97 if (length >= MinTU) 97 if (length > MTU)
98 ofs = 512 - length; 98 ofs = 512 - length;
99 else 99 else
100 ofs = 256 - length; 100 ofs = 256 - length;
@@ -183,7 +183,7 @@ static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
183 length, XMTU); 183 length, XMTU);
184 length = XMTU; 184 length = XMTU;
185 } 185 }
186 if (length > MinTU) { 186 if (length >= MinTU) {
187 hard->offset[0] = 0; 187 hard->offset[0] = 0;
188 hard->offset[1] = ofs = 512 - length; 188 hard->offset[1] = ofs = 512 - length;
189 } else if (length > MTU) { 189 } else if (length > MTU) {
diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c
index 4e91dab1f17f..83004fdab0a4 100644
--- a/drivers/net/arcnet/arcnet.c
+++ b/drivers/net/arcnet/arcnet.c
@@ -41,7 +41,7 @@
41 * <jojo@repas.de> 41 * <jojo@repas.de>
42 */ 42 */
43 43
44#define VERSION "arcnet: v3.93 BETA 2000/04/29 - by Avery Pennarun et al.\n" 44#define VERSION "arcnet: v3.94 BETA 2007/02/08 - by Avery Pennarun et al.\n"
45 45
46#include <linux/module.h> 46#include <linux/module.h>
47#include <linux/types.h> 47#include <linux/types.h>
diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c
index 98d326b23c92..b8c0fa6d401d 100644
--- a/drivers/net/arcnet/com20020-pci.c
+++ b/drivers/net/arcnet/com20020-pci.c
@@ -155,6 +155,7 @@ static struct pci_device_id com20020pci_id_table[] = {
155 { 0x1571, 0xa00b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT }, 155 { 0x1571, 0xa00b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT },
156 { 0x1571, 0xa00c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT }, 156 { 0x1571, 0xa00c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT },
157 { 0x1571, 0xa00d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT }, 157 { 0x1571, 0xa00d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT },
158 { 0x1571, 0xa00e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT },
158 { 0x1571, 0xa201, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, 159 { 0x1571, 0xa201, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT },
159 { 0x1571, 0xa202, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, 160 { 0x1571, 0xa202, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT },
160 { 0x1571, 0xa203, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, 161 { 0x1571, 0xa203, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT },
@@ -163,6 +164,8 @@ static struct pci_device_id com20020pci_id_table[] = {
163 { 0x1571, 0xa206, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, 164 { 0x1571, 0xa206, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT },
164 { 0x10B5, 0x9030, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, 165 { 0x10B5, 0x9030, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT },
165 { 0x10B5, 0x9050, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, 166 { 0x10B5, 0x9050, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT },
167 { 0x14BA, 0x6000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT },
168 { 0x10B5, 0x2200, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT },
166 {0,} 169 {0,}
167}; 170};
168 171
diff --git a/drivers/net/arcnet/com20020.c b/drivers/net/arcnet/com20020.c
index 4218075c8aa3..7cf0a2511697 100644
--- a/drivers/net/arcnet/com20020.c
+++ b/drivers/net/arcnet/com20020.c
@@ -104,7 +104,7 @@ int com20020_check(struct net_device *dev)
104 SET_SUBADR(SUB_SETUP1); 104 SET_SUBADR(SUB_SETUP1);
105 outb(lp->setup, _XREG); 105 outb(lp->setup, _XREG);
106 106
107 if (lp->card_flags & ARC_CAN_10MBIT) 107 if (lp->clockm != 0)
108 { 108 {
109 SET_SUBADR(SUB_SETUP2); 109 SET_SUBADR(SUB_SETUP2);
110 outb(lp->setup2, _XREG); 110 outb(lp->setup2, _XREG);
diff --git a/drivers/net/atl1/atl1_hw.c b/drivers/net/atl1/atl1_hw.c
index 08b2d785469d..314dbaabb642 100644
--- a/drivers/net/atl1/atl1_hw.c
+++ b/drivers/net/atl1/atl1_hw.c
@@ -243,14 +243,8 @@ static int atl1_get_permanent_address(struct atl1_hw *hw)
243 i += 4; 243 i += 4;
244 } 244 }
245 245
246/* 246 *(u32 *) &eth_addr[2] = swab32(addr[0]);
247 * The following 2 lines are the Attansic originals. Saving for posterity. 247 *(u16 *) &eth_addr[0] = swab16(*(u16 *) &addr[1]);
248 * *(u32 *) & eth_addr[2] = LONGSWAP(addr[0]);
249 * *(u16 *) & eth_addr[0] = SHORTSWAP(*(u16 *) & addr[1]);
250 */
251 *(u32 *) & eth_addr[2] = swab32(addr[0]);
252 *(u16 *) & eth_addr[0] = swab16(*(u16 *) & addr[1]);
253
254 if (is_valid_ether_addr(eth_addr)) { 248 if (is_valid_ether_addr(eth_addr)) {
255 memcpy(hw->perm_mac_addr, eth_addr, ETH_ALEN); 249 memcpy(hw->perm_mac_addr, eth_addr, ETH_ALEN);
256 return 0; 250 return 0;
@@ -281,17 +275,28 @@ static int atl1_get_permanent_address(struct atl1_hw *hw)
281 i += 4; 275 i += 4;
282 } 276 }
283 277
284/* 278 *(u32 *) &eth_addr[2] = swab32(addr[0]);
285 * The following 2 lines are the Attansic originals. Saving for posterity. 279 *(u16 *) &eth_addr[0] = swab16(*(u16 *) &addr[1]);
286 * *(u32 *) & eth_addr[2] = LONGSWAP(addr[0]);
287 * *(u16 *) & eth_addr[0] = SHORTSWAP(*(u16 *) & addr[1]);
288 */
289 *(u32 *) & eth_addr[2] = swab32(addr[0]);
290 *(u16 *) & eth_addr[0] = swab16(*(u16 *) & addr[1]);
291 if (is_valid_ether_addr(eth_addr)) { 280 if (is_valid_ether_addr(eth_addr)) {
292 memcpy(hw->perm_mac_addr, eth_addr, ETH_ALEN); 281 memcpy(hw->perm_mac_addr, eth_addr, ETH_ALEN);
293 return 0; 282 return 0;
294 } 283 }
284
285 /*
286 * On some motherboards, the MAC address is written by the
287 * BIOS directly to the MAC register during POST, and is
288 * not stored in eeprom. If all else thus far has failed
289 * to fetch the permanent MAC address, try reading it directly.
290 */
291 addr[0] = ioread32(hw->hw_addr + REG_MAC_STA_ADDR);
292 addr[1] = ioread16(hw->hw_addr + (REG_MAC_STA_ADDR + 4));
293 *(u32 *) &eth_addr[2] = swab32(addr[0]);
294 *(u16 *) &eth_addr[0] = swab16(*(u16 *) &addr[1]);
295 if (is_valid_ether_addr(eth_addr)) {
296 memcpy(hw->perm_mac_addr, eth_addr, ETH_ALEN);
297 return 0;
298 }
299
295 return 1; 300 return 1;
296} 301}
297 302
@@ -357,7 +362,7 @@ void atl1_hash_set(struct atl1_hw *hw, u32 hash_value)
357 */ 362 */
358 hash_reg = (hash_value >> 31) & 0x1; 363 hash_reg = (hash_value >> 31) & 0x1;
359 hash_bit = (hash_value >> 26) & 0x1F; 364 hash_bit = (hash_value >> 26) & 0x1F;
360 mta = ioread32((hw + REG_RX_HASH_TABLE) + (hash_reg << 2)); 365 mta = ioread32((hw->hw_addr + REG_RX_HASH_TABLE) + (hash_reg << 2));
361 mta |= (1 << hash_bit); 366 mta |= (1 << hash_bit);
362 iowrite32(mta, (hw->hw_addr + REG_RX_HASH_TABLE) + (hash_reg << 2)); 367 iowrite32(mta, (hw->hw_addr + REG_RX_HASH_TABLE) + (hash_reg << 2));
363} 368}
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 6655640eb4ca..65673485bb6b 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -82,8 +82,7 @@
82 82
83#include "atl1.h" 83#include "atl1.h"
84 84
85#define RUN_REALTIME 0 85#define DRIVER_VERSION "2.0.7"
86#define DRIVER_VERSION "2.0.6"
87 86
88char atl1_driver_name[] = "atl1"; 87char atl1_driver_name[] = "atl1";
89static const char atl1_driver_string[] = "Attansic L1 Ethernet Network Driver"; 88static const char atl1_driver_string[] = "Attansic L1 Ethernet Network Driver";
@@ -100,7 +99,7 @@ MODULE_VERSION(DRIVER_VERSION);
100 * atl1_pci_tbl - PCI Device ID Table 99 * atl1_pci_tbl - PCI Device ID Table
101 */ 100 */
102static const struct pci_device_id atl1_pci_tbl[] = { 101static const struct pci_device_id atl1_pci_tbl[] = {
103 {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, 0x1048)}, 102 {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATTANSIC_L1)},
104 /* required last entry */ 103 /* required last entry */
105 {0,} 104 {0,}
106}; 105};
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 5ff7882297d6..aaada572732a 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -59,7 +59,6 @@
59#define B44_DEF_TX_RING_PENDING (B44_TX_RING_SIZE - 1) 59#define B44_DEF_TX_RING_PENDING (B44_TX_RING_SIZE - 1)
60#define B44_TX_RING_BYTES (sizeof(struct dma_desc) * \ 60#define B44_TX_RING_BYTES (sizeof(struct dma_desc) * \
61 B44_TX_RING_SIZE) 61 B44_TX_RING_SIZE)
62#define B44_DMA_MASK 0x3fffffff
63 62
64#define TX_RING_GAP(BP) \ 63#define TX_RING_GAP(BP) \
65 (B44_TX_RING_SIZE - (BP)->tx_pending) 64 (B44_TX_RING_SIZE - (BP)->tx_pending)
@@ -665,7 +664,7 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked)
665 /* Hardware bug work-around, the chip is unable to do PCI DMA 664 /* Hardware bug work-around, the chip is unable to do PCI DMA
666 to/from anything above 1GB :-( */ 665 to/from anything above 1GB :-( */
667 if (dma_mapping_error(mapping) || 666 if (dma_mapping_error(mapping) ||
668 mapping + RX_PKT_BUF_SZ > B44_DMA_MASK) { 667 mapping + RX_PKT_BUF_SZ > DMA_30BIT_MASK) {
669 /* Sigh... */ 668 /* Sigh... */
670 if (!dma_mapping_error(mapping)) 669 if (!dma_mapping_error(mapping))
671 pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE); 670 pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE);
@@ -677,7 +676,7 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked)
677 RX_PKT_BUF_SZ, 676 RX_PKT_BUF_SZ,
678 PCI_DMA_FROMDEVICE); 677 PCI_DMA_FROMDEVICE);
679 if (dma_mapping_error(mapping) || 678 if (dma_mapping_error(mapping) ||
680 mapping + RX_PKT_BUF_SZ > B44_DMA_MASK) { 679 mapping + RX_PKT_BUF_SZ > DMA_30BIT_MASK) {
681 if (!dma_mapping_error(mapping)) 680 if (!dma_mapping_error(mapping))
682 pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE); 681 pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE);
683 dev_kfree_skb_any(skb); 682 dev_kfree_skb_any(skb);
@@ -988,7 +987,7 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev)
988 } 987 }
989 988
990 mapping = pci_map_single(bp->pdev, skb->data, len, PCI_DMA_TODEVICE); 989 mapping = pci_map_single(bp->pdev, skb->data, len, PCI_DMA_TODEVICE);
991 if (dma_mapping_error(mapping) || mapping + len > B44_DMA_MASK) { 990 if (dma_mapping_error(mapping) || mapping + len > DMA_30BIT_MASK) {
992 /* Chip can't handle DMA to/from >1GB, use bounce buffer */ 991 /* Chip can't handle DMA to/from >1GB, use bounce buffer */
993 if (!dma_mapping_error(mapping)) 992 if (!dma_mapping_error(mapping))
994 pci_unmap_single(bp->pdev, mapping, len, PCI_DMA_TODEVICE); 993 pci_unmap_single(bp->pdev, mapping, len, PCI_DMA_TODEVICE);
@@ -1000,7 +999,7 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev)
1000 999
1001 mapping = pci_map_single(bp->pdev, bounce_skb->data, 1000 mapping = pci_map_single(bp->pdev, bounce_skb->data,
1002 len, PCI_DMA_TODEVICE); 1001 len, PCI_DMA_TODEVICE);
1003 if (dma_mapping_error(mapping) || mapping + len > B44_DMA_MASK) { 1002 if (dma_mapping_error(mapping) || mapping + len > DMA_30BIT_MASK) {
1004 if (!dma_mapping_error(mapping)) 1003 if (!dma_mapping_error(mapping))
1005 pci_unmap_single(bp->pdev, mapping, 1004 pci_unmap_single(bp->pdev, mapping,
1006 len, PCI_DMA_TODEVICE); 1005 len, PCI_DMA_TODEVICE);
@@ -1227,7 +1226,7 @@ static int b44_alloc_consistent(struct b44 *bp)
1227 DMA_BIDIRECTIONAL); 1226 DMA_BIDIRECTIONAL);
1228 1227
1229 if (dma_mapping_error(rx_ring_dma) || 1228 if (dma_mapping_error(rx_ring_dma) ||
1230 rx_ring_dma + size > B44_DMA_MASK) { 1229 rx_ring_dma + size > DMA_30BIT_MASK) {
1231 kfree(rx_ring); 1230 kfree(rx_ring);
1232 goto out_err; 1231 goto out_err;
1233 } 1232 }
@@ -1254,7 +1253,7 @@ static int b44_alloc_consistent(struct b44 *bp)
1254 DMA_TO_DEVICE); 1253 DMA_TO_DEVICE);
1255 1254
1256 if (dma_mapping_error(tx_ring_dma) || 1255 if (dma_mapping_error(tx_ring_dma) ||
1257 tx_ring_dma + size > B44_DMA_MASK) { 1256 tx_ring_dma + size > DMA_30BIT_MASK) {
1258 kfree(tx_ring); 1257 kfree(tx_ring);
1259 goto out_err; 1258 goto out_err;
1260 } 1259 }
@@ -1289,7 +1288,7 @@ static void b44_chip_reset(struct b44 *bp)
1289 if (ssb_is_core_up(bp)) { 1288 if (ssb_is_core_up(bp)) {
1290 bw32(bp, B44_RCV_LAZY, 0); 1289 bw32(bp, B44_RCV_LAZY, 0);
1291 bw32(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE); 1290 bw32(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE);
1292 b44_wait_bit(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE, 100, 1); 1291 b44_wait_bit(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE, 200, 1);
1293 bw32(bp, B44_DMATX_CTRL, 0); 1292 bw32(bp, B44_DMATX_CTRL, 0);
1294 bp->tx_prod = bp->tx_cons = 0; 1293 bp->tx_prod = bp->tx_cons = 0;
1295 if (br32(bp, B44_DMARX_STAT) & DMARX_STAT_EMASK) { 1294 if (br32(bp, B44_DMARX_STAT) & DMARX_STAT_EMASK) {
@@ -2151,13 +2150,13 @@ static int __devinit b44_init_one(struct pci_dev *pdev,
2151 2150
2152 pci_set_master(pdev); 2151 pci_set_master(pdev);
2153 2152
2154 err = pci_set_dma_mask(pdev, (u64) B44_DMA_MASK); 2153 err = pci_set_dma_mask(pdev, (u64) DMA_30BIT_MASK);
2155 if (err) { 2154 if (err) {
2156 dev_err(&pdev->dev, "No usable DMA configuration, aborting.\n"); 2155 dev_err(&pdev->dev, "No usable DMA configuration, aborting.\n");
2157 goto err_out_free_res; 2156 goto err_out_free_res;
2158 } 2157 }
2159 2158
2160 err = pci_set_consistent_dma_mask(pdev, (u64) B44_DMA_MASK); 2159 err = pci_set_consistent_dma_mask(pdev, (u64) DMA_30BIT_MASK);
2161 if (err) { 2160 if (err) {
2162 dev_err(&pdev->dev, "No usable DMA configuration, aborting.\n"); 2161 dev_err(&pdev->dev, "No usable DMA configuration, aborting.\n");
2163 goto err_out_free_res; 2162 goto err_out_free_res;
diff --git a/drivers/net/cxgb3/cxgb3_defs.h b/drivers/net/cxgb3/cxgb3_defs.h
index 16e004990c59..e14862b43d17 100644
--- a/drivers/net/cxgb3/cxgb3_defs.h
+++ b/drivers/net/cxgb3/cxgb3_defs.h
@@ -1,6 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006-2007 Chelsio, Inc. All rights reserved. 2 * Copyright (c) 2006-2007 Chelsio, Inc. All rights reserved.
3 * Copyright (c) 2006-2007 Open Grid Computing, Inc. All rights reserved.
4 * 3 *
5 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
diff --git a/drivers/net/cxgb3/cxgb3_offload.c b/drivers/net/cxgb3/cxgb3_offload.c
index c6b726643185..b2cf5f6feb4a 100644
--- a/drivers/net/cxgb3/cxgb3_offload.c
+++ b/drivers/net/cxgb3/cxgb3_offload.c
@@ -1,6 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006-2007 Chelsio, Inc. All rights reserved. 2 * Copyright (c) 2006-2007 Chelsio, Inc. All rights reserved.
3 * Copyright (c) 2006-2007 Open Grid Computing, Inc. All rights reserved.
4 * 3 *
5 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
diff --git a/drivers/net/cxgb3/cxgb3_offload.h b/drivers/net/cxgb3/cxgb3_offload.h
index 0e6beb69ba17..f15446a32efc 100644
--- a/drivers/net/cxgb3/cxgb3_offload.h
+++ b/drivers/net/cxgb3/cxgb3_offload.h
@@ -1,6 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006-2007 Chelsio, Inc. All rights reserved. 2 * Copyright (c) 2006-2007 Chelsio, Inc. All rights reserved.
3 * Copyright (c) 2006-2007 Open Grid Computing, Inc. All rights reserved.
4 * 3 *
5 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
diff --git a/drivers/net/cxgb3/l2t.c b/drivers/net/cxgb3/l2t.c
index 3c0cb8557058..d660af74606e 100644
--- a/drivers/net/cxgb3/l2t.c
+++ b/drivers/net/cxgb3/l2t.c
@@ -1,6 +1,5 @@
1/* 1/*
2 * Copyright (c) 2003-2007 Chelsio, Inc. All rights reserved. 2 * Copyright (c) 2003-2007 Chelsio, Inc. All rights reserved.
3 * Copyright (c) 2006-2007 Open Grid Computing, Inc. All rights reserved.
4 * 3 *
5 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
diff --git a/drivers/net/cxgb3/l2t.h b/drivers/net/cxgb3/l2t.h
index ba5d2cbd7241..d79001336cfd 100644
--- a/drivers/net/cxgb3/l2t.h
+++ b/drivers/net/cxgb3/l2t.h
@@ -1,6 +1,5 @@
1/* 1/*
2 * Copyright (c) 2003-2007 Chelsio, Inc. All rights reserved. 2 * Copyright (c) 2003-2007 Chelsio, Inc. All rights reserved.
3 * Copyright (c) 2006-2007 Open Grid Computing, Inc. All rights reserved.
4 * 3 *
5 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
diff --git a/drivers/net/cxgb3/t3cdev.h b/drivers/net/cxgb3/t3cdev.h
index 9af3bcd64b3b..fa4099bc0416 100644
--- a/drivers/net/cxgb3/t3cdev.h
+++ b/drivers/net/cxgb3/t3cdev.h
@@ -1,6 +1,5 @@
1/* 1/*
2 * Copyright (C) 2006-2007 Chelsio Communications. All rights reserved. 2 * Copyright (C) 2006-2007 Chelsio Communications. All rights reserved.
3 * Copyright (C) 2006-2007 Open Grid Computing, Inc. All rights reserved.
4 * 3 *
5 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
index 689f158a469e..dd4b728ac4b5 100644
--- a/drivers/net/e1000/e1000.h
+++ b/drivers/net/e1000/e1000.h
@@ -337,7 +337,6 @@ struct e1000_adapter {
337 struct e1000_rx_ring test_rx_ring; 337 struct e1000_rx_ring test_rx_ring;
338 338
339 339
340 uint32_t *config_space;
341 int msg_enable; 340 int msg_enable;
342#ifdef CONFIG_PCI_MSI 341#ifdef CONFIG_PCI_MSI
343 boolean_t have_msi; 342 boolean_t have_msi;
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index 44ebc72962dc..6777887295f5 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -166,7 +166,7 @@ e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
166 ecmd->transceiver = XCVR_EXTERNAL; 166 ecmd->transceiver = XCVR_EXTERNAL;
167 } 167 }
168 168
169 if (netif_carrier_ok(adapter->netdev)) { 169 if (E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_LU) {
170 170
171 e1000_get_speed_and_duplex(hw, &adapter->link_speed, 171 e1000_get_speed_and_duplex(hw, &adapter->link_speed,
172 &adapter->link_duplex); 172 &adapter->link_duplex);
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 619c89218b4b..a71023741c3a 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -1417,10 +1417,6 @@ e1000_open(struct net_device *netdev)
1417 if ((err = e1000_setup_all_rx_resources(adapter))) 1417 if ((err = e1000_setup_all_rx_resources(adapter)))
1418 goto err_setup_rx; 1418 goto err_setup_rx;
1419 1419
1420 err = e1000_request_irq(adapter);
1421 if (err)
1422 goto err_req_irq;
1423
1424 e1000_power_up_phy(adapter); 1420 e1000_power_up_phy(adapter);
1425 1421
1426 if ((err = e1000_up(adapter))) 1422 if ((err = e1000_up(adapter)))
@@ -1431,6 +1427,10 @@ e1000_open(struct net_device *netdev)
1431 e1000_update_mng_vlan(adapter); 1427 e1000_update_mng_vlan(adapter);
1432 } 1428 }
1433 1429
1430 err = e1000_request_irq(adapter);
1431 if (err)
1432 goto err_req_irq;
1433
1434 /* If AMT is enabled, let the firmware know that the network 1434 /* If AMT is enabled, let the firmware know that the network
1435 * interface is now open */ 1435 * interface is now open */
1436 if (adapter->hw.mac_type == e1000_82573 && 1436 if (adapter->hw.mac_type == e1000_82573 &&
@@ -1439,10 +1439,10 @@ e1000_open(struct net_device *netdev)
1439 1439
1440 return E1000_SUCCESS; 1440 return E1000_SUCCESS;
1441 1441
1442err_req_irq:
1443 e1000_down(adapter);
1442err_up: 1444err_up:
1443 e1000_power_down_phy(adapter); 1445 e1000_power_down_phy(adapter);
1444 e1000_free_irq(adapter);
1445err_req_irq:
1446 e1000_free_all_rx_resources(adapter); 1446 e1000_free_all_rx_resources(adapter);
1447err_setup_rx: 1447err_setup_rx:
1448 e1000_free_all_tx_resources(adapter); 1448 e1000_free_all_tx_resources(adapter);
@@ -5071,58 +5071,6 @@ e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx)
5071 return 0; 5071 return 0;
5072} 5072}
5073 5073
5074#ifdef CONFIG_PM
5075/* Save/restore 16 or 64 dwords of PCI config space depending on which
5076 * bus we're on (PCI(X) vs. PCI-E)
5077 */
5078#define PCIE_CONFIG_SPACE_LEN 256
5079#define PCI_CONFIG_SPACE_LEN 64
5080static int
5081e1000_pci_save_state(struct e1000_adapter *adapter)
5082{
5083 struct pci_dev *dev = adapter->pdev;
5084 int size;
5085 int i;
5086
5087 if (adapter->hw.mac_type >= e1000_82571)
5088 size = PCIE_CONFIG_SPACE_LEN;
5089 else
5090 size = PCI_CONFIG_SPACE_LEN;
5091
5092 WARN_ON(adapter->config_space != NULL);
5093
5094 adapter->config_space = kmalloc(size, GFP_KERNEL);
5095 if (!adapter->config_space) {
5096 DPRINTK(PROBE, ERR, "unable to allocate %d bytes\n", size);
5097 return -ENOMEM;
5098 }
5099 for (i = 0; i < (size / 4); i++)
5100 pci_read_config_dword(dev, i * 4, &adapter->config_space[i]);
5101 return 0;
5102}
5103
5104static void
5105e1000_pci_restore_state(struct e1000_adapter *adapter)
5106{
5107 struct pci_dev *dev = adapter->pdev;
5108 int size;
5109 int i;
5110
5111 if (adapter->config_space == NULL)
5112 return;
5113
5114 if (adapter->hw.mac_type >= e1000_82571)
5115 size = PCIE_CONFIG_SPACE_LEN;
5116 else
5117 size = PCI_CONFIG_SPACE_LEN;
5118 for (i = 0; i < (size / 4); i++)
5119 pci_write_config_dword(dev, i * 4, adapter->config_space[i]);
5120 kfree(adapter->config_space);
5121 adapter->config_space = NULL;
5122 return;
5123}
5124#endif /* CONFIG_PM */
5125
5126static int 5074static int
5127e1000_suspend(struct pci_dev *pdev, pm_message_t state) 5075e1000_suspend(struct pci_dev *pdev, pm_message_t state)
5128{ 5076{
@@ -5142,9 +5090,7 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state)
5142 } 5090 }
5143 5091
5144#ifdef CONFIG_PM 5092#ifdef CONFIG_PM
5145 /* Implement our own version of pci_save_state(pdev) because pci- 5093 retval = pci_save_state(pdev);
5146 * express adapters have 256-byte config spaces. */
5147 retval = e1000_pci_save_state(adapter);
5148 if (retval) 5094 if (retval)
5149 return retval; 5095 return retval;
5150#endif 5096#endif
@@ -5231,7 +5177,7 @@ e1000_resume(struct pci_dev *pdev)
5231 uint32_t err; 5177 uint32_t err;
5232 5178
5233 pci_set_power_state(pdev, PCI_D0); 5179 pci_set_power_state(pdev, PCI_D0);
5234 e1000_pci_restore_state(adapter); 5180 pci_restore_state(pdev);
5235 if ((err = pci_enable_device(pdev))) { 5181 if ((err = pci_enable_device(pdev))) {
5236 printk(KERN_ERR "e1000: Cannot enable PCI device from suspend\n"); 5182 printk(KERN_ERR "e1000: Cannot enable PCI device from suspend\n");
5237 return err; 5183 return err;
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index 272e1ec51aa2..42295d61ecd8 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -39,7 +39,7 @@
39#include <asm/io.h> 39#include <asm/io.h>
40 40
41#define DRV_NAME "ehea" 41#define DRV_NAME "ehea"
42#define DRV_VERSION "EHEA_0045" 42#define DRV_VERSION "EHEA_0046"
43 43
44#define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \ 44#define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \
45 | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR) 45 | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR)
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 38b2fa424b2d..88ad1c8bcee4 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -76,7 +76,7 @@ void ehea_dump(void *adr, int len, char *msg) {
76 int x; 76 int x;
77 unsigned char *deb = adr; 77 unsigned char *deb = adr;
78 for (x = 0; x < len; x += 16) { 78 for (x = 0; x < len; x += 16) {
79 printk(DRV_NAME "%s adr=%p ofs=%04x %016lx %016lx\n", msg, 79 printk(DRV_NAME " %s adr=%p ofs=%04x %016lx %016lx\n", msg,
80 deb, x, *((u64*)&deb[0]), *((u64*)&deb[8])); 80 deb, x, *((u64*)&deb[0]), *((u64*)&deb[8]));
81 deb += 16; 81 deb += 16;
82 } 82 }
@@ -555,6 +555,7 @@ static irqreturn_t ehea_qp_aff_irq_handler(int irq, void *param)
555{ 555{
556 struct ehea_port *port = param; 556 struct ehea_port *port = param;
557 struct ehea_eqe *eqe; 557 struct ehea_eqe *eqe;
558 struct ehea_qp *qp;
558 u32 qp_token; 559 u32 qp_token;
559 560
560 eqe = ehea_poll_eq(port->qp_eq); 561 eqe = ehea_poll_eq(port->qp_eq);
@@ -563,9 +564,14 @@ static irqreturn_t ehea_qp_aff_irq_handler(int irq, void *param)
563 qp_token = EHEA_BMASK_GET(EHEA_EQE_QP_TOKEN, eqe->entry); 564 qp_token = EHEA_BMASK_GET(EHEA_EQE_QP_TOKEN, eqe->entry);
564 ehea_error("QP aff_err: entry=0x%lx, token=0x%x", 565 ehea_error("QP aff_err: entry=0x%lx, token=0x%x",
565 eqe->entry, qp_token); 566 eqe->entry, qp_token);
567
568 qp = port->port_res[qp_token].qp;
569 ehea_error_data(port->adapter, qp->fw_handle);
566 eqe = ehea_poll_eq(port->qp_eq); 570 eqe = ehea_poll_eq(port->qp_eq);
567 } 571 }
568 572
573 queue_work(port->adapter->ehea_wq, &port->reset_task);
574
569 return IRQ_HANDLED; 575 return IRQ_HANDLED;
570} 576}
571 577
diff --git a/drivers/net/ehea/ehea_phyp.c b/drivers/net/ehea/ehea_phyp.c
index 37716e05e808..bc3c00547264 100644
--- a/drivers/net/ehea/ehea_phyp.c
+++ b/drivers/net/ehea/ehea_phyp.c
@@ -612,3 +612,13 @@ u64 ehea_h_reset_events(const u64 adapter_handle, const u64 neq_handle,
612 event_mask, /* R6 */ 612 event_mask, /* R6 */
613 0, 0, 0, 0); /* R7-R12 */ 613 0, 0, 0, 0); /* R7-R12 */
614} 614}
615
616u64 ehea_h_error_data(const u64 adapter_handle, const u64 ressource_handle,
617 void *rblock)
618{
619 return ehea_plpar_hcall_norets(H_ERROR_DATA,
620 adapter_handle, /* R4 */
621 ressource_handle, /* R5 */
622 virt_to_abs(rblock), /* R6 */
623 0, 0, 0, 0); /* R7-R12 */
624}
diff --git a/drivers/net/ehea/ehea_phyp.h b/drivers/net/ehea/ehea_phyp.h
index 919f94b75933..90acddb068a1 100644
--- a/drivers/net/ehea/ehea_phyp.h
+++ b/drivers/net/ehea/ehea_phyp.h
@@ -454,4 +454,7 @@ u64 ehea_h_reg_dereg_bcmc(const u64 adapter_handle, const u16 port_num,
454u64 ehea_h_reset_events(const u64 adapter_handle, const u64 neq_handle, 454u64 ehea_h_reset_events(const u64 adapter_handle, const u64 neq_handle,
455 const u64 event_mask); 455 const u64 event_mask);
456 456
457u64 ehea_h_error_data(const u64 adapter_handle, const u64 ressource_handle,
458 void *rblock);
459
457#endif /* __EHEA_PHYP_H__ */ 460#endif /* __EHEA_PHYP_H__ */
diff --git a/drivers/net/ehea/ehea_qmr.c b/drivers/net/ehea/ehea_qmr.c
index f143e13b229d..96ff3b679996 100644
--- a/drivers/net/ehea/ehea_qmr.c
+++ b/drivers/net/ehea/ehea_qmr.c
@@ -486,6 +486,7 @@ int ehea_destroy_qp(struct ehea_qp *qp)
486 if (!qp) 486 if (!qp)
487 return 0; 487 return 0;
488 488
489 ehea_h_disable_and_get_hea(qp->adapter->handle, qp->fw_handle);
489 hret = ehea_h_free_resource(qp->adapter->handle, qp->fw_handle); 490 hret = ehea_h_free_resource(qp->adapter->handle, qp->fw_handle);
490 if (hret != H_SUCCESS) { 491 if (hret != H_SUCCESS) {
491 ehea_error("destroy_qp failed"); 492 ehea_error("destroy_qp failed");
@@ -581,4 +582,45 @@ out:
581 return ret; 582 return ret;
582} 583}
583 584
585void print_error_data(u64 *data)
586{
587 int length;
588 u64 type = EHEA_BMASK_GET(ERROR_DATA_TYPE, data[2]);
589 u64 resource = data[1];
590
591 length = EHEA_BMASK_GET(ERROR_DATA_LENGTH, data[0]);
592
593 if (length > EHEA_PAGESIZE)
594 length = EHEA_PAGESIZE;
595
596 if (type == 0x8) /* Queue Pair */
597 ehea_error("QP (resource=%lX) state: AER=0x%lX, AERR=0x%lX, "
598 "port=%lX", resource, data[6], data[12], data[22]);
599
600 ehea_dump(data, length, "error data");
601}
602
603void ehea_error_data(struct ehea_adapter *adapter, u64 res_handle)
604{
605 unsigned long ret;
606 u64 *rblock;
607
608 rblock = kzalloc(PAGE_SIZE, GFP_KERNEL);
609 if (!rblock) {
610 ehea_error("Cannot allocate rblock memory.");
611 return;
612 }
584 613
614 ret = ehea_h_error_data(adapter->handle,
615 res_handle,
616 rblock);
617
618 if (ret == H_R_STATE)
619 ehea_error("No error data is available: %lX.", res_handle);
620 else if (ret == H_SUCCESS)
621 print_error_data(rblock);
622 else
623 ehea_error("Error data could not be fetched: %lX", res_handle);
624
625 kfree(rblock);
626}
diff --git a/drivers/net/ehea/ehea_qmr.h b/drivers/net/ehea/ehea_qmr.h
index 7efdc96919ca..1ff60983504d 100644
--- a/drivers/net/ehea/ehea_qmr.h
+++ b/drivers/net/ehea/ehea_qmr.h
@@ -180,6 +180,9 @@ struct ehea_eqe {
180 u64 entry; 180 u64 entry;
181}; 181};
182 182
183#define ERROR_DATA_LENGTH EHEA_BMASK_IBM(52,63)
184#define ERROR_DATA_TYPE EHEA_BMASK_IBM(0,7)
185
183static inline void *hw_qeit_calc(struct hw_queue *queue, u64 q_offset) 186static inline void *hw_qeit_calc(struct hw_queue *queue, u64 q_offset)
184{ 187{
185 struct ehea_page *current_page; 188 struct ehea_page *current_page;
@@ -355,4 +358,6 @@ int ehea_destroy_qp(struct ehea_qp *qp);
355 358
356int ehea_reg_mr_adapter(struct ehea_adapter *adapter); 359int ehea_reg_mr_adapter(struct ehea_adapter *adapter);
357 360
361void ehea_error_data(struct ehea_adapter *adapter, u64 res_handle);
362
358#endif /* __EHEA_QMR_H__ */ 363#endif /* __EHEA_QMR_H__ */
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 1be4a84dce0e..1f83988a6a64 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -10,6 +10,7 @@
10 * Maintainer: Kumar Gala 10 * Maintainer: Kumar Gala
11 * 11 *
12 * Copyright (c) 2002-2006 Freescale Semiconductor, Inc. 12 * Copyright (c) 2002-2006 Freescale Semiconductor, Inc.
13 * Copyright (c) 2007 MontaVista Software, Inc.
13 * 14 *
14 * This program is free software; you can redistribute it and/or modify it 15 * This program is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License as published by the 16 * under the terms of the GNU General Public License as published by the
@@ -1612,71 +1613,17 @@ static irqreturn_t gfar_interrupt(int irq, void *dev_id)
1612 /* Save ievent for future reference */ 1613 /* Save ievent for future reference */
1613 u32 events = gfar_read(&priv->regs->ievent); 1614 u32 events = gfar_read(&priv->regs->ievent);
1614 1615
1615 /* Clear IEVENT */
1616 gfar_write(&priv->regs->ievent, events);
1617
1618 /* Check for reception */ 1616 /* Check for reception */
1619 if ((events & IEVENT_RXF0) || (events & IEVENT_RXB0)) 1617 if (events & IEVENT_RX_MASK)
1620 gfar_receive(irq, dev_id); 1618 gfar_receive(irq, dev_id);
1621 1619
1622 /* Check for transmit completion */ 1620 /* Check for transmit completion */
1623 if ((events & IEVENT_TXF) || (events & IEVENT_TXB)) 1621 if (events & IEVENT_TX_MASK)
1624 gfar_transmit(irq, dev_id); 1622 gfar_transmit(irq, dev_id);
1625 1623
1626 /* Update error statistics */ 1624 /* Check for errors */
1627 if (events & IEVENT_TXE) { 1625 if (events & IEVENT_ERR_MASK)
1628 priv->stats.tx_errors++; 1626 gfar_error(irq, dev_id);
1629
1630 if (events & IEVENT_LC)
1631 priv->stats.tx_window_errors++;
1632 if (events & IEVENT_CRL)
1633 priv->stats.tx_aborted_errors++;
1634 if (events & IEVENT_XFUN) {
1635 if (netif_msg_tx_err(priv))
1636 printk(KERN_WARNING "%s: tx underrun. dropped packet\n", dev->name);
1637 priv->stats.tx_dropped++;
1638 priv->extra_stats.tx_underrun++;
1639
1640 /* Reactivate the Tx Queues */
1641 gfar_write(&priv->regs->tstat, TSTAT_CLEAR_THALT);
1642 }
1643 }
1644 if (events & IEVENT_BSY) {
1645 priv->stats.rx_errors++;
1646 priv->extra_stats.rx_bsy++;
1647
1648 gfar_receive(irq, dev_id);
1649
1650#ifndef CONFIG_GFAR_NAPI
1651 /* Clear the halt bit in RSTAT */
1652 gfar_write(&priv->regs->rstat, RSTAT_CLEAR_RHALT);
1653#endif
1654
1655 if (netif_msg_rx_err(priv))
1656 printk(KERN_DEBUG "%s: busy error (rhalt: %x)\n",
1657 dev->name,
1658 gfar_read(&priv->regs->rstat));
1659 }
1660 if (events & IEVENT_BABR) {
1661 priv->stats.rx_errors++;
1662 priv->extra_stats.rx_babr++;
1663
1664 if (netif_msg_rx_err(priv))
1665 printk(KERN_DEBUG "%s: babbling error\n", dev->name);
1666 }
1667 if (events & IEVENT_EBERR) {
1668 priv->extra_stats.eberr++;
1669 if (netif_msg_rx_err(priv))
1670 printk(KERN_DEBUG "%s: EBERR\n", dev->name);
1671 }
1672 if ((events & IEVENT_RXC) && (netif_msg_rx_err(priv)))
1673 printk(KERN_DEBUG "%s: control frame\n", dev->name);
1674
1675 if (events & IEVENT_BABT) {
1676 priv->extra_stats.tx_babt++;
1677 if (netif_msg_rx_err(priv))
1678 printk(KERN_DEBUG "%s: babt error\n", dev->name);
1679 }
1680 1627
1681 return IRQ_HANDLED; 1628 return IRQ_HANDLED;
1682} 1629}
@@ -1938,7 +1885,7 @@ static irqreturn_t gfar_error(int irq, void *dev_id)
1938 /* Hmm... */ 1885 /* Hmm... */
1939 if (netif_msg_rx_err(priv) || netif_msg_tx_err(priv)) 1886 if (netif_msg_rx_err(priv) || netif_msg_tx_err(priv))
1940 printk(KERN_DEBUG "%s: error interrupt (ievent=0x%08x imask=0x%08x)\n", 1887 printk(KERN_DEBUG "%s: error interrupt (ievent=0x%08x imask=0x%08x)\n",
1941 dev->name, events, gfar_read(&priv->regs->imask)); 1888 dev->name, events, gfar_read(&priv->regs->imask));
1942 1889
1943 /* Update the error counters */ 1890 /* Update the error counters */
1944 if (events & IEVENT_TXE) { 1891 if (events & IEVENT_TXE) {
@@ -1950,8 +1897,8 @@ static irqreturn_t gfar_error(int irq, void *dev_id)
1950 priv->stats.tx_aborted_errors++; 1897 priv->stats.tx_aborted_errors++;
1951 if (events & IEVENT_XFUN) { 1898 if (events & IEVENT_XFUN) {
1952 if (netif_msg_tx_err(priv)) 1899 if (netif_msg_tx_err(priv))
1953 printk(KERN_DEBUG "%s: underrun. packet dropped.\n", 1900 printk(KERN_DEBUG "%s: TX FIFO underrun, "
1954 dev->name); 1901 "packet dropped.\n", dev->name);
1955 priv->stats.tx_dropped++; 1902 priv->stats.tx_dropped++;
1956 priv->extra_stats.tx_underrun++; 1903 priv->extra_stats.tx_underrun++;
1957 1904
@@ -1973,30 +1920,28 @@ static irqreturn_t gfar_error(int irq, void *dev_id)
1973#endif 1920#endif
1974 1921
1975 if (netif_msg_rx_err(priv)) 1922 if (netif_msg_rx_err(priv))
1976 printk(KERN_DEBUG "%s: busy error (rhalt: %x)\n", 1923 printk(KERN_DEBUG "%s: busy error (rstat: %x)\n",
1977 dev->name, 1924 dev->name, gfar_read(&priv->regs->rstat));
1978 gfar_read(&priv->regs->rstat));
1979 } 1925 }
1980 if (events & IEVENT_BABR) { 1926 if (events & IEVENT_BABR) {
1981 priv->stats.rx_errors++; 1927 priv->stats.rx_errors++;
1982 priv->extra_stats.rx_babr++; 1928 priv->extra_stats.rx_babr++;
1983 1929
1984 if (netif_msg_rx_err(priv)) 1930 if (netif_msg_rx_err(priv))
1985 printk(KERN_DEBUG "%s: babbling error\n", dev->name); 1931 printk(KERN_DEBUG "%s: babbling RX error\n", dev->name);
1986 } 1932 }
1987 if (events & IEVENT_EBERR) { 1933 if (events & IEVENT_EBERR) {
1988 priv->extra_stats.eberr++; 1934 priv->extra_stats.eberr++;
1989 if (netif_msg_rx_err(priv)) 1935 if (netif_msg_rx_err(priv))
1990 printk(KERN_DEBUG "%s: EBERR\n", dev->name); 1936 printk(KERN_DEBUG "%s: bus error\n", dev->name);
1991 } 1937 }
1992 if ((events & IEVENT_RXC) && netif_msg_rx_status(priv)) 1938 if ((events & IEVENT_RXC) && netif_msg_rx_status(priv))
1993 if (netif_msg_rx_status(priv)) 1939 printk(KERN_DEBUG "%s: control frame\n", dev->name);
1994 printk(KERN_DEBUG "%s: control frame\n", dev->name);
1995 1940
1996 if (events & IEVENT_BABT) { 1941 if (events & IEVENT_BABT) {
1997 priv->extra_stats.tx_babt++; 1942 priv->extra_stats.tx_babt++;
1998 if (netif_msg_tx_err(priv)) 1943 if (netif_msg_tx_err(priv))
1999 printk(KERN_DEBUG "%s: babt error\n", dev->name); 1944 printk(KERN_DEBUG "%s: babbling TX error\n", dev->name);
2000 } 1945 }
2001 return IRQ_HANDLED; 1946 return IRQ_HANDLED;
2002} 1947}
diff --git a/drivers/net/gianfar_sysfs.c b/drivers/net/gianfar_sysfs.c
index 45ffb5d0ca33..aec9ab17a9a5 100644
--- a/drivers/net/gianfar_sysfs.c
+++ b/drivers/net/gianfar_sysfs.c
@@ -38,13 +38,15 @@
38#include "gianfar.h" 38#include "gianfar.h"
39 39
40#define GFAR_ATTR(_name) \ 40#define GFAR_ATTR(_name) \
41static ssize_t gfar_show_##_name(struct class_device *cdev, char *buf); \ 41static ssize_t gfar_show_##_name(struct device *dev, \
42static ssize_t gfar_set_##_name(struct class_device *cdev, \ 42 struct device_attribute *attr, char *buf); \
43static ssize_t gfar_set_##_name(struct device *dev, \
44 struct device_attribute *attr, \
43 const char *buf, size_t count); \ 45 const char *buf, size_t count); \
44static CLASS_DEVICE_ATTR(_name, 0644, gfar_show_##_name, gfar_set_##_name) 46static DEVICE_ATTR(_name, 0644, gfar_show_##_name, gfar_set_##_name)
45 47
46#define GFAR_CREATE_FILE(_dev, _name) \ 48#define GFAR_CREATE_FILE(_dev, _name) \
47 class_device_create_file(&_dev->class_dev, &class_device_attr_##_name) 49 device_create_file(&_dev->dev, &dev_attr_##_name)
48 50
49GFAR_ATTR(bd_stash); 51GFAR_ATTR(bd_stash);
50GFAR_ATTR(rx_stash_size); 52GFAR_ATTR(rx_stash_size);
@@ -53,29 +55,28 @@ GFAR_ATTR(fifo_threshold);
53GFAR_ATTR(fifo_starve); 55GFAR_ATTR(fifo_starve);
54GFAR_ATTR(fifo_starve_off); 56GFAR_ATTR(fifo_starve_off);
55 57
56#define to_net_dev(cd) container_of(cd, struct net_device, class_dev) 58static ssize_t gfar_show_bd_stash(struct device *dev,
57 59 struct device_attribute *attr, char *buf)
58static ssize_t gfar_show_bd_stash(struct class_device *cdev, char *buf)
59{ 60{
60 struct net_device *dev = to_net_dev(cdev); 61 struct gfar_private *priv = netdev_priv(to_net_dev(dev));
61 struct gfar_private *priv = netdev_priv(dev);
62 62
63 return sprintf(buf, "%s\n", priv->bd_stash_en? "on" : "off"); 63 return sprintf(buf, "%s\n", priv->bd_stash_en ? "on" : "off");
64} 64}
65 65
66static ssize_t gfar_set_bd_stash(struct class_device *cdev, 66static ssize_t gfar_set_bd_stash(struct device *dev,
67 const char *buf, size_t count) 67 struct device_attribute *attr,
68 const char *buf, size_t count)
68{ 69{
69 struct net_device *dev = to_net_dev(cdev); 70 struct gfar_private *priv = netdev_priv(to_net_dev(dev));
70 struct gfar_private *priv = netdev_priv(dev);
71 int new_setting = 0; 71 int new_setting = 0;
72 u32 temp; 72 u32 temp;
73 unsigned long flags; 73 unsigned long flags;
74 74
75 /* Find out the new setting */ 75 /* Find out the new setting */
76 if (!strncmp("on", buf, count-1) || !strncmp("1", buf, count-1)) 76 if (!strncmp("on", buf, count - 1) || !strncmp("1", buf, count - 1))
77 new_setting = 1; 77 new_setting = 1;
78 else if (!strncmp("off", buf, count-1) || !strncmp("0", buf, count-1)) 78 else if (!strncmp("off", buf, count - 1)
79 || !strncmp("0", buf, count - 1))
79 new_setting = 0; 80 new_setting = 0;
80 else 81 else
81 return count; 82 return count;
@@ -99,19 +100,19 @@ static ssize_t gfar_set_bd_stash(struct class_device *cdev,
99 return count; 100 return count;
100} 101}
101 102
102static ssize_t gfar_show_rx_stash_size(struct class_device *cdev, char *buf) 103static ssize_t gfar_show_rx_stash_size(struct device *dev,
104 struct device_attribute *attr, char *buf)
103{ 105{
104 struct net_device *dev = to_net_dev(cdev); 106 struct gfar_private *priv = netdev_priv(to_net_dev(dev));
105 struct gfar_private *priv = netdev_priv(dev);
106 107
107 return sprintf(buf, "%d\n", priv->rx_stash_size); 108 return sprintf(buf, "%d\n", priv->rx_stash_size);
108} 109}
109 110
110static ssize_t gfar_set_rx_stash_size(struct class_device *cdev, 111static ssize_t gfar_set_rx_stash_size(struct device *dev,
111 const char *buf, size_t count) 112 struct device_attribute *attr,
113 const char *buf, size_t count)
112{ 114{
113 struct net_device *dev = to_net_dev(cdev); 115 struct gfar_private *priv = netdev_priv(to_net_dev(dev));
114 struct gfar_private *priv = netdev_priv(dev);
115 unsigned int length = simple_strtoul(buf, NULL, 0); 116 unsigned int length = simple_strtoul(buf, NULL, 0);
116 u32 temp; 117 u32 temp;
117 unsigned long flags; 118 unsigned long flags;
@@ -145,21 +146,21 @@ static ssize_t gfar_set_rx_stash_size(struct class_device *cdev,
145 return count; 146 return count;
146} 147}
147 148
148
149/* Stashing will only be enabled when rx_stash_size != 0 */ 149/* Stashing will only be enabled when rx_stash_size != 0 */
150static ssize_t gfar_show_rx_stash_index(struct class_device *cdev, char *buf) 150static ssize_t gfar_show_rx_stash_index(struct device *dev,
151 struct device_attribute *attr,
152 char *buf)
151{ 153{
152 struct net_device *dev = to_net_dev(cdev); 154 struct gfar_private *priv = netdev_priv(to_net_dev(dev));
153 struct gfar_private *priv = netdev_priv(dev);
154 155
155 return sprintf(buf, "%d\n", priv->rx_stash_index); 156 return sprintf(buf, "%d\n", priv->rx_stash_index);
156} 157}
157 158
158static ssize_t gfar_set_rx_stash_index(struct class_device *cdev, 159static ssize_t gfar_set_rx_stash_index(struct device *dev,
159 const char *buf, size_t count) 160 struct device_attribute *attr,
161 const char *buf, size_t count)
160{ 162{
161 struct net_device *dev = to_net_dev(cdev); 163 struct gfar_private *priv = netdev_priv(to_net_dev(dev));
162 struct gfar_private *priv = netdev_priv(dev);
163 unsigned short index = simple_strtoul(buf, NULL, 0); 164 unsigned short index = simple_strtoul(buf, NULL, 0);
164 u32 temp; 165 u32 temp;
165 unsigned long flags; 166 unsigned long flags;
@@ -183,19 +184,20 @@ static ssize_t gfar_set_rx_stash_index(struct class_device *cdev,
183 return count; 184 return count;
184} 185}
185 186
186static ssize_t gfar_show_fifo_threshold(struct class_device *cdev, char *buf) 187static ssize_t gfar_show_fifo_threshold(struct device *dev,
188 struct device_attribute *attr,
189 char *buf)
187{ 190{
188 struct net_device *dev = to_net_dev(cdev); 191 struct gfar_private *priv = netdev_priv(to_net_dev(dev));
189 struct gfar_private *priv = netdev_priv(dev);
190 192
191 return sprintf(buf, "%d\n", priv->fifo_threshold); 193 return sprintf(buf, "%d\n", priv->fifo_threshold);
192} 194}
193 195
194static ssize_t gfar_set_fifo_threshold(struct class_device *cdev, 196static ssize_t gfar_set_fifo_threshold(struct device *dev,
195 const char *buf, size_t count) 197 struct device_attribute *attr,
198 const char *buf, size_t count)
196{ 199{
197 struct net_device *dev = to_net_dev(cdev); 200 struct gfar_private *priv = netdev_priv(to_net_dev(dev));
198 struct gfar_private *priv = netdev_priv(dev);
199 unsigned int length = simple_strtoul(buf, NULL, 0); 201 unsigned int length = simple_strtoul(buf, NULL, 0);
200 u32 temp; 202 u32 temp;
201 unsigned long flags; 203 unsigned long flags;
@@ -217,20 +219,19 @@ static ssize_t gfar_set_fifo_threshold(struct class_device *cdev,
217 return count; 219 return count;
218} 220}
219 221
220static ssize_t gfar_show_fifo_starve(struct class_device *cdev, char *buf) 222static ssize_t gfar_show_fifo_starve(struct device *dev,
223 struct device_attribute *attr, char *buf)
221{ 224{
222 struct net_device *dev = to_net_dev(cdev); 225 struct gfar_private *priv = netdev_priv(to_net_dev(dev));
223 struct gfar_private *priv = netdev_priv(dev);
224 226
225 return sprintf(buf, "%d\n", priv->fifo_starve); 227 return sprintf(buf, "%d\n", priv->fifo_starve);
226} 228}
227 229
228 230static ssize_t gfar_set_fifo_starve(struct device *dev,
229static ssize_t gfar_set_fifo_starve(struct class_device *cdev, 231 struct device_attribute *attr,
230 const char *buf, size_t count) 232 const char *buf, size_t count)
231{ 233{
232 struct net_device *dev = to_net_dev(cdev); 234 struct gfar_private *priv = netdev_priv(to_net_dev(dev));
233 struct gfar_private *priv = netdev_priv(dev);
234 unsigned int num = simple_strtoul(buf, NULL, 0); 235 unsigned int num = simple_strtoul(buf, NULL, 0);
235 u32 temp; 236 u32 temp;
236 unsigned long flags; 237 unsigned long flags;
@@ -252,19 +253,20 @@ static ssize_t gfar_set_fifo_starve(struct class_device *cdev,
252 return count; 253 return count;
253} 254}
254 255
255static ssize_t gfar_show_fifo_starve_off(struct class_device *cdev, char *buf) 256static ssize_t gfar_show_fifo_starve_off(struct device *dev,
257 struct device_attribute *attr,
258 char *buf)
256{ 259{
257 struct net_device *dev = to_net_dev(cdev); 260 struct gfar_private *priv = netdev_priv(to_net_dev(dev));
258 struct gfar_private *priv = netdev_priv(dev);
259 261
260 return sprintf(buf, "%d\n", priv->fifo_starve_off); 262 return sprintf(buf, "%d\n", priv->fifo_starve_off);
261} 263}
262 264
263static ssize_t gfar_set_fifo_starve_off(struct class_device *cdev, 265static ssize_t gfar_set_fifo_starve_off(struct device *dev,
264 const char *buf, size_t count) 266 struct device_attribute *attr,
267 const char *buf, size_t count)
265{ 268{
266 struct net_device *dev = to_net_dev(cdev); 269 struct gfar_private *priv = netdev_priv(to_net_dev(dev));
267 struct gfar_private *priv = netdev_priv(dev);
268 unsigned int num = simple_strtoul(buf, NULL, 0); 270 unsigned int num = simple_strtoul(buf, NULL, 0);
269 u32 temp; 271 u32 temp;
270 unsigned long flags; 272 unsigned long flags;
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c
index f0d30cf67b5f..4ad780719a84 100644
--- a/drivers/net/ioc3-eth.c
+++ b/drivers/net/ioc3-eth.c
@@ -836,13 +836,17 @@ static int ioc3_mii_init(struct ioc3_private *ip)
836 } 836 }
837 837
838 ip->mii.phy_id = i; 838 ip->mii.phy_id = i;
839
840out:
841 return res;
842}
843
844static void ioc3_mii_start(struct ioc3_private *ip)
845{
839 ip->ioc3_timer.expires = jiffies + (12 * HZ)/10; /* 1.2 sec. */ 846 ip->ioc3_timer.expires = jiffies + (12 * HZ)/10; /* 1.2 sec. */
840 ip->ioc3_timer.data = (unsigned long) ip; 847 ip->ioc3_timer.data = (unsigned long) ip;
841 ip->ioc3_timer.function = &ioc3_timer; 848 ip->ioc3_timer.function = &ioc3_timer;
842 add_timer(&ip->ioc3_timer); 849 add_timer(&ip->ioc3_timer);
843
844out:
845 return res;
846} 850}
847 851
848static inline void ioc3_clean_rx_ring(struct ioc3_private *ip) 852static inline void ioc3_clean_rx_ring(struct ioc3_private *ip)
@@ -1071,6 +1075,7 @@ static int ioc3_open(struct net_device *dev)
1071 ip->ehar_h = 0; 1075 ip->ehar_h = 0;
1072 ip->ehar_l = 0; 1076 ip->ehar_l = 0;
1073 ioc3_init(dev); 1077 ioc3_init(dev);
1078 ioc3_mii_start(ip);
1074 1079
1075 netif_start_queue(dev); 1080 netif_start_queue(dev);
1076 return 0; 1081 return 0;
@@ -1274,6 +1279,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1274 goto out_stop; 1279 goto out_stop;
1275 } 1280 }
1276 1281
1282 ioc3_mii_start(ip);
1277 ioc3_ssram_disc(ip); 1283 ioc3_ssram_disc(ip);
1278 ioc3_get_eaddr(ip); 1284 ioc3_get_eaddr(ip);
1279 1285
@@ -1314,6 +1320,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1314 1320
1315out_stop: 1321out_stop:
1316 ioc3_stop(ip); 1322 ioc3_stop(ip);
1323 del_timer_sync(&ip->ioc3_timer);
1317 ioc3_free_rings(ip); 1324 ioc3_free_rings(ip);
1318out_res: 1325out_res:
1319 pci_release_regions(pdev); 1326 pci_release_regions(pdev);
@@ -1335,6 +1342,8 @@ static void __devexit ioc3_remove_one (struct pci_dev *pdev)
1335 struct ioc3 *ioc3 = ip->regs; 1342 struct ioc3 *ioc3 = ip->regs;
1336 1343
1337 unregister_netdev(dev); 1344 unregister_netdev(dev);
1345 del_timer_sync(&ip->ioc3_timer);
1346
1338 iounmap(ioc3); 1347 iounmap(ioc3);
1339 pci_release_regions(pdev); 1348 pci_release_regions(pdev);
1340 free_netdev(dev); 1349 free_netdev(dev);
@@ -1492,6 +1501,7 @@ static void ioc3_timeout(struct net_device *dev)
1492 ioc3_stop(ip); 1501 ioc3_stop(ip);
1493 ioc3_init(dev); 1502 ioc3_init(dev);
1494 ioc3_mii_init(ip); 1503 ioc3_mii_init(ip);
1504 ioc3_mii_start(ip);
1495 1505
1496 spin_unlock_irq(&ip->ioc3_lock); 1506 spin_unlock_irq(&ip->ioc3_lock);
1497 1507
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index a41418b3c518..2e9571bf0736 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -881,27 +881,15 @@ static struct net_device_stats *macb_get_stats(struct net_device *dev)
881static int macb_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) 881static int macb_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
882{ 882{
883 struct macb *bp = netdev_priv(dev); 883 struct macb *bp = netdev_priv(dev);
884 int ret;
885 unsigned long flags;
886
887 spin_lock_irqsave(&bp->lock, flags);
888 ret = mii_ethtool_gset(&bp->mii, cmd);
889 spin_unlock_irqrestore(&bp->lock, flags);
890 884
891 return ret; 885 return mii_ethtool_gset(&bp->mii, cmd);
892} 886}
893 887
894static int macb_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) 888static int macb_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
895{ 889{
896 struct macb *bp = netdev_priv(dev); 890 struct macb *bp = netdev_priv(dev);
897 int ret;
898 unsigned long flags;
899
900 spin_lock_irqsave(&bp->lock, flags);
901 ret = mii_ethtool_sset(&bp->mii, cmd);
902 spin_unlock_irqrestore(&bp->lock, flags);
903 891
904 return ret; 892 return mii_ethtool_sset(&bp->mii, cmd);
905} 893}
906 894
907static void macb_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) 895static void macb_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
@@ -930,17 +918,11 @@ static struct ethtool_ops macb_ethtool_ops = {
930static int macb_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 918static int macb_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
931{ 919{
932 struct macb *bp = netdev_priv(dev); 920 struct macb *bp = netdev_priv(dev);
933 int ret;
934 unsigned long flags;
935 921
936 if (!netif_running(dev)) 922 if (!netif_running(dev))
937 return -EINVAL; 923 return -EINVAL;
938 924
939 spin_lock_irqsave(&bp->lock, flags); 925 return generic_mii_ioctl(&bp->mii, if_mii(rq), cmd, NULL);
940 ret = generic_mii_ioctl(&bp->mii, if_mii(rq), cmd, NULL);
941 spin_unlock_irqrestore(&bp->lock, flags);
942
943 return ret;
944} 926}
945 927
946static ssize_t macb_mii_show(const struct device *_dev, char *buf, 928static ssize_t macb_mii_show(const struct device *_dev, char *buf,
diff --git a/drivers/net/meth.c b/drivers/net/meth.c
index d38b7c723620..7e69ca6edd91 100644
--- a/drivers/net/meth.c
+++ b/drivers/net/meth.c
@@ -170,7 +170,7 @@ static int mdio_probe(struct meth_private *priv)
170 170
171static void meth_check_link(struct net_device *dev) 171static void meth_check_link(struct net_device *dev)
172{ 172{
173 struct meth_private *priv = (struct meth_private *) dev->priv; 173 struct meth_private *priv = netdev_priv(dev);
174 unsigned long mii_advertising = mdio_read(priv, 4); 174 unsigned long mii_advertising = mdio_read(priv, 4);
175 unsigned long mii_partner = mdio_read(priv, 5); 175 unsigned long mii_partner = mdio_read(priv, 5);
176 unsigned long negotiated = mii_advertising & mii_partner; 176 unsigned long negotiated = mii_advertising & mii_partner;
@@ -268,7 +268,7 @@ static void meth_free_rx_ring(struct meth_private *priv)
268 268
269int meth_reset(struct net_device *dev) 269int meth_reset(struct net_device *dev)
270{ 270{
271 struct meth_private *priv = (struct meth_private *) dev->priv; 271 struct meth_private *priv = netdev_priv(dev);
272 272
273 /* Reset card */ 273 /* Reset card */
274 mace->eth.mac_ctrl = SGI_MAC_RESET; 274 mace->eth.mac_ctrl = SGI_MAC_RESET;
@@ -310,7 +310,7 @@ int meth_reset(struct net_device *dev)
310 */ 310 */
311static int meth_open(struct net_device *dev) 311static int meth_open(struct net_device *dev)
312{ 312{
313 struct meth_private *priv = dev->priv; 313 struct meth_private *priv = netdev_priv(dev);
314 int ret; 314 int ret;
315 315
316 priv->phy_addr = -1; /* No PHY is known yet... */ 316 priv->phy_addr = -1; /* No PHY is known yet... */
@@ -354,7 +354,7 @@ out_free_tx_ring:
354 354
355static int meth_release(struct net_device *dev) 355static int meth_release(struct net_device *dev)
356{ 356{
357 struct meth_private *priv = dev->priv; 357 struct meth_private *priv = netdev_priv(dev);
358 358
359 DPRINTK("Stopping queue\n"); 359 DPRINTK("Stopping queue\n");
360 netif_stop_queue(dev); /* can't transmit any more */ 360 netif_stop_queue(dev); /* can't transmit any more */
@@ -376,7 +376,7 @@ static void meth_rx(struct net_device* dev, unsigned long int_status)
376{ 376{
377 struct sk_buff *skb; 377 struct sk_buff *skb;
378 unsigned long status; 378 unsigned long status;
379 struct meth_private *priv = (struct meth_private *) dev->priv; 379 struct meth_private *priv = netdev_priv(dev);
380 unsigned long fifo_rptr = (int_status & METH_INT_RX_RPTR_MASK) >> 8; 380 unsigned long fifo_rptr = (int_status & METH_INT_RX_RPTR_MASK) >> 8;
381 381
382 spin_lock(&priv->meth_lock); 382 spin_lock(&priv->meth_lock);
@@ -466,14 +466,14 @@ static void meth_rx(struct net_device* dev, unsigned long int_status)
466 466
467static int meth_tx_full(struct net_device *dev) 467static int meth_tx_full(struct net_device *dev)
468{ 468{
469 struct meth_private *priv = (struct meth_private *) dev->priv; 469 struct meth_private *priv = netdev_priv(dev);
470 470
471 return (priv->tx_count >= TX_RING_ENTRIES - 1); 471 return (priv->tx_count >= TX_RING_ENTRIES - 1);
472} 472}
473 473
474static void meth_tx_cleanup(struct net_device* dev, unsigned long int_status) 474static void meth_tx_cleanup(struct net_device* dev, unsigned long int_status)
475{ 475{
476 struct meth_private *priv = dev->priv; 476 struct meth_private *priv = netdev_priv(dev);
477 unsigned long status; 477 unsigned long status;
478 struct sk_buff *skb; 478 struct sk_buff *skb;
479 unsigned long rptr = (int_status&TX_INFO_RPTR) >> 16; 479 unsigned long rptr = (int_status&TX_INFO_RPTR) >> 16;
@@ -536,7 +536,7 @@ static void meth_tx_cleanup(struct net_device* dev, unsigned long int_status)
536 536
537static void meth_error(struct net_device* dev, unsigned status) 537static void meth_error(struct net_device* dev, unsigned status)
538{ 538{
539 struct meth_private *priv = (struct meth_private *) dev->priv; 539 struct meth_private *priv = netdev_priv(dev);
540 540
541 printk(KERN_WARNING "meth: error status: 0x%08x\n",status); 541 printk(KERN_WARNING "meth: error status: 0x%08x\n",status);
542 /* check for errors too... */ 542 /* check for errors too... */
@@ -570,7 +570,7 @@ static void meth_error(struct net_device* dev, unsigned status)
570static irqreturn_t meth_interrupt(int irq, void *dev_id) 570static irqreturn_t meth_interrupt(int irq, void *dev_id)
571{ 571{
572 struct net_device *dev = (struct net_device *)dev_id; 572 struct net_device *dev = (struct net_device *)dev_id;
573 struct meth_private *priv = (struct meth_private *) dev->priv; 573 struct meth_private *priv = netdev_priv(dev);
574 unsigned long status; 574 unsigned long status;
575 575
576 status = mace->eth.int_stat; 576 status = mace->eth.int_stat;
@@ -695,7 +695,7 @@ static void meth_add_to_tx_ring(struct meth_private *priv, struct sk_buff *skb)
695 */ 695 */
696static int meth_tx(struct sk_buff *skb, struct net_device *dev) 696static int meth_tx(struct sk_buff *skb, struct net_device *dev)
697{ 697{
698 struct meth_private *priv = (struct meth_private *) dev->priv; 698 struct meth_private *priv = netdev_priv(dev);
699 unsigned long flags; 699 unsigned long flags;
700 700
701 spin_lock_irqsave(&priv->meth_lock, flags); 701 spin_lock_irqsave(&priv->meth_lock, flags);
@@ -726,7 +726,7 @@ static int meth_tx(struct sk_buff *skb, struct net_device *dev)
726 */ 726 */
727static void meth_tx_timeout(struct net_device *dev) 727static void meth_tx_timeout(struct net_device *dev)
728{ 728{
729 struct meth_private *priv = (struct meth_private *) dev->priv; 729 struct meth_private *priv = netdev_priv(dev);
730 unsigned long flags; 730 unsigned long flags;
731 731
732 printk(KERN_WARNING "%s: transmit timed out\n", dev->name); 732 printk(KERN_WARNING "%s: transmit timed out\n", dev->name);
@@ -778,7 +778,7 @@ static int meth_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
778 */ 778 */
779static struct net_device_stats *meth_stats(struct net_device *dev) 779static struct net_device_stats *meth_stats(struct net_device *dev)
780{ 780{
781 struct meth_private *priv = (struct meth_private *) dev->priv; 781 struct meth_private *priv = netdev_priv(dev);
782 return &priv->stats; 782 return &priv->stats;
783} 783}
784 784
@@ -807,7 +807,7 @@ static struct net_device *meth_init(void)
807 dev->irq = MACE_ETHERNET_IRQ; 807 dev->irq = MACE_ETHERNET_IRQ;
808 dev->base_addr = (unsigned long)&mace->eth; 808 dev->base_addr = (unsigned long)&mace->eth;
809 809
810 priv = (struct meth_private *) dev->priv; 810 priv = netdev_priv(dev);
811 spin_lock_init(&priv->meth_lock); 811 spin_lock_init(&priv->meth_lock);
812 812
813 ret = register_netdev(dev); 813 ret = register_netdev(dev);
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 3f3896e98879..2807ef400fb5 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -252,7 +252,7 @@ typedef u32 netxen_ctx_msg;
252#define netxen_set_msg_ctxid(config_word, val) \ 252#define netxen_set_msg_ctxid(config_word, val) \
253 ((config_word) &= ~(0x3ff<<18), (config_word) |= (val & 0x3ff) << 18) 253 ((config_word) &= ~(0x3ff<<18), (config_word) |= (val & 0x3ff) << 18)
254#define netxen_set_msg_opcode(config_word, val) \ 254#define netxen_set_msg_opcode(config_word, val) \
255 ((config_word) &= ~(0xf<<24), (config_word) |= (val & 0xf) << 24) 255 ((config_word) &= ~(0xf<<28), (config_word) |= (val & 0xf) << 28)
256 256
257struct netxen_rcv_context { 257struct netxen_rcv_context {
258 __le64 rcv_ring_addr; 258 __le64 rcv_ring_addr;
@@ -303,14 +303,14 @@ struct netxen_ring_ctx {
303 (cmd_desc)->flags_opcode |= cpu_to_le16((val) & 0x7f)) 303 (cmd_desc)->flags_opcode |= cpu_to_le16((val) & 0x7f))
304#define netxen_set_cmd_desc_opcode(cmd_desc, val) \ 304#define netxen_set_cmd_desc_opcode(cmd_desc, val) \
305 ((cmd_desc)->flags_opcode &= ~cpu_to_le16(0x3f<<7), \ 305 ((cmd_desc)->flags_opcode &= ~cpu_to_le16(0x3f<<7), \
306 (cmd_desc)->flags_opcode |= cpu_to_le16((val) & (0x3f<<7))) 306 (cmd_desc)->flags_opcode |= cpu_to_le16(((val & 0x3f)<<7)))
307 307
308#define netxen_set_cmd_desc_num_of_buff(cmd_desc, val) \ 308#define netxen_set_cmd_desc_num_of_buff(cmd_desc, val) \
309 ((cmd_desc)->num_of_buffers_total_length &= ~cpu_to_le32(0xff), \ 309 ((cmd_desc)->num_of_buffers_total_length &= ~cpu_to_le32(0xff), \
310 (cmd_desc)->num_of_buffers_total_length |= cpu_to_le32((val) & 0xff)) 310 (cmd_desc)->num_of_buffers_total_length |= cpu_to_le32((val) & 0xff))
311#define netxen_set_cmd_desc_totallength(cmd_desc, val) \ 311#define netxen_set_cmd_desc_totallength(cmd_desc, val) \
312 ((cmd_desc)->num_of_buffers_total_length &= cpu_to_le32(0xff), \ 312 ((cmd_desc)->num_of_buffers_total_length &= ~cpu_to_le32(0xffffff00), \
313 (cmd_desc)->num_of_buffers_total_length |= cpu_to_le32(val << 24)) 313 (cmd_desc)->num_of_buffers_total_length |= cpu_to_le32(val << 8))
314 314
315#define netxen_get_cmd_desc_opcode(cmd_desc) \ 315#define netxen_get_cmd_desc_opcode(cmd_desc) \
316 ((le16_to_cpu((cmd_desc)->flags_opcode) >> 7) & 0x003F) 316 ((le16_to_cpu((cmd_desc)->flags_opcode) >> 7) & 0x003F)
@@ -1040,6 +1040,7 @@ int netxen_flash_unlock(struct netxen_adapter *adapter);
1040int netxen_backup_crbinit(struct netxen_adapter *adapter); 1040int netxen_backup_crbinit(struct netxen_adapter *adapter);
1041int netxen_flash_erase_secondary(struct netxen_adapter *adapter); 1041int netxen_flash_erase_secondary(struct netxen_adapter *adapter);
1042int netxen_flash_erase_primary(struct netxen_adapter *adapter); 1042int netxen_flash_erase_primary(struct netxen_adapter *adapter);
1043void netxen_halt_pegs(struct netxen_adapter *adapter);
1043 1044
1044int netxen_rom_fast_write(struct netxen_adapter *adapter, int addr, int data); 1045int netxen_rom_fast_write(struct netxen_adapter *adapter, int addr, int data);
1045int netxen_rom_se(struct netxen_adapter *adapter, int addr); 1046int netxen_rom_se(struct netxen_adapter *adapter, int addr);
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index cc0efe213e01..6252e9a87278 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -402,7 +402,7 @@ netxen_nic_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
402 wol->wolopts = 0; 402 wol->wolopts = 0;
403} 403}
404 404
405static u32 netxen_nic_get_link(struct net_device *dev) 405static u32 netxen_nic_test_link(struct net_device *dev)
406{ 406{
407 struct netxen_port *port = netdev_priv(dev); 407 struct netxen_port *port = netdev_priv(dev);
408 struct netxen_adapter *adapter = port->adapter; 408 struct netxen_adapter *adapter = port->adapter;
@@ -459,6 +459,7 @@ netxen_nic_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
459 int ret; 459 int ret;
460 460
461 if (flash_start == 0) { 461 if (flash_start == 0) {
462 netxen_halt_pegs(adapter);
462 ret = netxen_flash_unlock(adapter); 463 ret = netxen_flash_unlock(adapter);
463 if (ret < 0) { 464 if (ret < 0) {
464 printk(KERN_ERR "%s: Flash unlock failed.\n", 465 printk(KERN_ERR "%s: Flash unlock failed.\n",
@@ -712,7 +713,7 @@ netxen_nic_diag_test(struct net_device *dev, struct ethtool_test *eth_test,
712{ 713{
713 if (eth_test->flags == ETH_TEST_FL_OFFLINE) { /* offline tests */ 714 if (eth_test->flags == ETH_TEST_FL_OFFLINE) { /* offline tests */
714 /* link test */ 715 /* link test */
715 if (!(data[4] = (u64) netxen_nic_get_link(dev))) 716 if (!(data[4] = (u64) netxen_nic_test_link(dev)))
716 eth_test->flags |= ETH_TEST_FL_FAILED; 717 eth_test->flags |= ETH_TEST_FL_FAILED;
717 718
718 if (netif_running(dev)) 719 if (netif_running(dev))
@@ -727,7 +728,7 @@ netxen_nic_diag_test(struct net_device *dev, struct ethtool_test *eth_test,
727 dev->open(dev); 728 dev->open(dev);
728 } else { /* online tests */ 729 } else { /* online tests */
729 /* link test */ 730 /* link test */
730 if (!(data[4] = (u64) netxen_nic_get_link(dev))) 731 if (!(data[4] = (u64) netxen_nic_test_link(dev)))
731 eth_test->flags |= ETH_TEST_FL_FAILED; 732 eth_test->flags |= ETH_TEST_FL_FAILED;
732 733
733 /* other tests pass by default */ 734 /* other tests pass by default */
@@ -783,7 +784,7 @@ struct ethtool_ops netxen_nic_ethtool_ops = {
783 .get_regs_len = netxen_nic_get_regs_len, 784 .get_regs_len = netxen_nic_get_regs_len,
784 .get_regs = netxen_nic_get_regs, 785 .get_regs = netxen_nic_get_regs,
785 .get_wol = netxen_nic_get_wol, 786 .get_wol = netxen_nic_get_wol,
786 .get_link = netxen_nic_get_link, 787 .get_link = ethtool_op_get_link,
787 .get_eeprom_len = netxen_nic_get_eeprom_len, 788 .get_eeprom_len = netxen_nic_get_eeprom_len,
788 .get_eeprom = netxen_nic_get_eeprom, 789 .get_eeprom = netxen_nic_get_eeprom,
789 .set_eeprom = netxen_nic_set_eeprom, 790 .set_eeprom = netxen_nic_set_eeprom,
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index f263232f499f..7195af3e8f3d 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -420,6 +420,7 @@ static int netxen_get_flash_block(struct netxen_adapter *adapter, int base,
420 for (i = 0; i < size / sizeof(u32); i++) { 420 for (i = 0; i < size / sizeof(u32); i++) {
421 if (netxen_rom_fast_read(adapter, addr, ptr32) == -1) 421 if (netxen_rom_fast_read(adapter, addr, ptr32) == -1)
422 return -1; 422 return -1;
423 *ptr32 = cpu_to_le32(*ptr32);
423 ptr32++; 424 ptr32++;
424 addr += sizeof(u32); 425 addr += sizeof(u32);
425 } 426 }
@@ -428,6 +429,7 @@ static int netxen_get_flash_block(struct netxen_adapter *adapter, int base,
428 429
429 if (netxen_rom_fast_read(adapter, addr, &local) == -1) 430 if (netxen_rom_fast_read(adapter, addr, &local) == -1)
430 return -1; 431 return -1;
432 local = cpu_to_le32(local);
431 memcpy(ptr32, &local, (char *)buf + size - (char *)ptr32); 433 memcpy(ptr32, &local, (char *)buf + size - (char *)ptr32);
432 } 434 }
433 435
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index f7bb8c90537c..2f324366784d 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -717,6 +717,14 @@ netxen_flash_erase_primary(struct netxen_adapter *adapter)
717 return ret; 717 return ret;
718} 718}
719 719
720void netxen_halt_pegs(struct netxen_adapter *adapter)
721{
722 netxen_crb_writelit_adapter(adapter, NETXEN_CRB_PEG_NET_0 + 0x3c, 1);
723 netxen_crb_writelit_adapter(adapter, NETXEN_CRB_PEG_NET_1 + 0x3c, 1);
724 netxen_crb_writelit_adapter(adapter, NETXEN_CRB_PEG_NET_2 + 0x3c, 1);
725 netxen_crb_writelit_adapter(adapter, NETXEN_CRB_PEG_NET_3 + 0x3c, 1);
726}
727
720int netxen_flash_unlock(struct netxen_adapter *adapter) 728int netxen_flash_unlock(struct netxen_adapter *adapter)
721{ 729{
722 int ret = 0; 730 int ret = 0;
@@ -1246,7 +1254,7 @@ int netxen_process_cmd_ring(unsigned long data)
1246 * the netdev which is associated with that device. 1254 * the netdev which is associated with that device.
1247 */ 1255 */
1248 1256
1249 consumer = *(adapter->cmd_consumer); 1257 consumer = le32_to_cpu(*(adapter->cmd_consumer));
1250 if (last_consumer == consumer) { /* Ring is empty */ 1258 if (last_consumer == consumer) { /* Ring is empty */
1251 DPRINTK(INFO, "last_consumer %d == consumer %d\n", 1259 DPRINTK(INFO, "last_consumer %d == consumer %d\n",
1252 last_consumer, consumer); 1260 last_consumer, consumer);
@@ -1340,7 +1348,7 @@ int netxen_process_cmd_ring(unsigned long data)
1340 if (adapter->last_cmd_consumer == consumer && 1348 if (adapter->last_cmd_consumer == consumer &&
1341 (((adapter->cmd_producer + 1) % 1349 (((adapter->cmd_producer + 1) %
1342 adapter->max_tx_desc_count) == adapter->last_cmd_consumer)) { 1350 adapter->max_tx_desc_count) == adapter->last_cmd_consumer)) {
1343 consumer = *(adapter->cmd_consumer); 1351 consumer = le32_to_cpu(*(adapter->cmd_consumer));
1344 } 1352 }
1345 done = (adapter->last_cmd_consumer == consumer); 1353 done = (adapter->last_cmd_consumer == consumer);
1346 1354
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 36ba6a1aa363..225ff55527c4 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -434,12 +434,13 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
434 adapter->port_count++; 434 adapter->port_count++;
435 adapter->port[i] = port; 435 adapter->port[i] = port;
436 } 436 }
437 437#ifndef CONFIG_PPC64
438 writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); 438 writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE));
439 netxen_pinit_from_rom(adapter, 0); 439 netxen_pinit_from_rom(adapter, 0);
440 udelay(500); 440 udelay(500);
441 netxen_load_firmware(adapter); 441 netxen_load_firmware(adapter);
442 netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); 442 netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
443#endif
443 /* 444 /*
444 * delay a while to ensure that the Pegs are up & running. 445 * delay a while to ensure that the Pegs are up & running.
445 * Otherwise, we might see some flaky behaviour. 446 * Otherwise, we might see some flaky behaviour.
diff --git a/drivers/net/netxen/netxen_nic_niu.c b/drivers/net/netxen/netxen_nic_niu.c
index 40d7003a371c..d5d95074e569 100644
--- a/drivers/net/netxen/netxen_nic_niu.c
+++ b/drivers/net/netxen/netxen_nic_niu.c
@@ -458,7 +458,7 @@ int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port)
458 458
459int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port) 459int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port)
460{ 460{
461 long reg = 0, ret = 0; 461 u32 reg = 0, ret = 0;
462 462
463 if (adapter->ahw.boardcfg.board_type == NETXEN_BRDTYPE_P2_SB31_10G_IMEZ) { 463 if (adapter->ahw.boardcfg.board_type == NETXEN_BRDTYPE_P2_SB31_10G_IMEZ) {
464 netxen_crb_writelit_adapter(adapter, 464 netxen_crb_writelit_adapter(adapter,
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index 448bf4a78016..c7bd9c1c7f31 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -915,7 +915,7 @@ static void media_check(unsigned long arg)
915 if ((inw(ioaddr + EL3_STATUS) & IntLatch) && (inb(ioaddr + Timer) == 0xff)) { 915 if ((inw(ioaddr + EL3_STATUS) & IntLatch) && (inb(ioaddr + Timer) == 0xff)) {
916 if (!lp->fast_poll) 916 if (!lp->fast_poll)
917 printk(KERN_INFO "%s: interrupt(s) dropped!\n", dev->name); 917 printk(KERN_INFO "%s: interrupt(s) dropped!\n", dev->name);
918 el3_interrupt(dev->irq, lp); 918 el3_interrupt(dev->irq, dev);
919 lp->fast_poll = HZ; 919 lp->fast_poll = HZ;
920 } 920 }
921 if (lp->fast_poll) { 921 if (lp->fast_poll) {
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index 530df8883fe5..2561f76033ea 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -1927,7 +1927,7 @@ static void media_check(u_long arg)
1927 if (smc->watchdog++ && ((i>>8) & i)) { 1927 if (smc->watchdog++ && ((i>>8) & i)) {
1928 if (!smc->fast_poll) 1928 if (!smc->fast_poll)
1929 printk(KERN_INFO "%s: interrupt(s) dropped!\n", dev->name); 1929 printk(KERN_INFO "%s: interrupt(s) dropped!\n", dev->name);
1930 smc_interrupt(dev->irq, smc); 1930 smc_interrupt(dev->irq, dev);
1931 smc->fast_poll = HZ; 1931 smc->fast_poll = HZ;
1932 } 1932 }
1933 if (smc->fast_poll) { 1933 if (smc->fast_poll) {
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index f4d4eb659cad..22aec5cce683 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -42,6 +42,19 @@
42#define MII_M1011_IMASK_INIT 0x6400 42#define MII_M1011_IMASK_INIT 0x6400
43#define MII_M1011_IMASK_CLEAR 0x0000 43#define MII_M1011_IMASK_CLEAR 0x0000
44 44
45#define MII_M1011_PHY_SCR 0x10
46#define MII_M1011_PHY_SCR_AUTO_CROSS 0x0060
47
48#define MII_M1145_PHY_EXT_CR 0x14
49#define MII_M1145_RGMII_RX_DELAY 0x0080
50#define MII_M1145_RGMII_TX_DELAY 0x0002
51
52#define M1145_DEV_FLAGS_RESISTANCE 0x00000001
53
54#define MII_M1111_PHY_LED_CONTROL 0x18
55#define MII_M1111_PHY_LED_DIRECT 0x4100
56#define MII_M1111_PHY_LED_COMBINE 0x411c
57
45MODULE_DESCRIPTION("Marvell PHY driver"); 58MODULE_DESCRIPTION("Marvell PHY driver");
46MODULE_AUTHOR("Andy Fleming"); 59MODULE_AUTHOR("Andy Fleming");
47MODULE_LICENSE("GPL"); 60MODULE_LICENSE("GPL");
@@ -63,7 +76,7 @@ static int marvell_config_intr(struct phy_device *phydev)
63{ 76{
64 int err; 77 int err;
65 78
66 if(phydev->interrupts == PHY_INTERRUPT_ENABLED) 79 if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
67 err = phy_write(phydev, MII_M1011_IMASK, MII_M1011_IMASK_INIT); 80 err = phy_write(phydev, MII_M1011_IMASK, MII_M1011_IMASK_INIT);
68 else 81 else
69 err = phy_write(phydev, MII_M1011_IMASK, MII_M1011_IMASK_CLEAR); 82 err = phy_write(phydev, MII_M1011_IMASK, MII_M1011_IMASK_CLEAR);
@@ -103,34 +116,153 @@ static int marvell_config_aneg(struct phy_device *phydev)
103 if (err < 0) 116 if (err < 0)
104 return err; 117 return err;
105 118
119 err = phy_write(phydev, MII_M1011_PHY_SCR,
120 MII_M1011_PHY_SCR_AUTO_CROSS);
121 if (err < 0)
122 return err;
123
124 err = phy_write(phydev, MII_M1111_PHY_LED_CONTROL,
125 MII_M1111_PHY_LED_DIRECT);
126 if (err < 0)
127 return err;
106 128
107 err = genphy_config_aneg(phydev); 129 err = genphy_config_aneg(phydev);
108 130
109 return err; 131 return err;
110} 132}
111 133
134static int m88e1145_config_init(struct phy_device *phydev)
135{
136 int err;
137
138 /* Take care of errata E0 & E1 */
139 err = phy_write(phydev, 0x1d, 0x001b);
140 if (err < 0)
141 return err;
142
143 err = phy_write(phydev, 0x1e, 0x418f);
144 if (err < 0)
145 return err;
146
147 err = phy_write(phydev, 0x1d, 0x0016);
148 if (err < 0)
149 return err;
150
151 err = phy_write(phydev, 0x1e, 0xa2da);
152 if (err < 0)
153 return err;
154
155 if (phydev->interface == PHY_INTERFACE_MODE_RGMII) {
156 int temp = phy_read(phydev, MII_M1145_PHY_EXT_CR);
157 if (temp < 0)
158 return temp;
159
160 temp |= (MII_M1145_RGMII_RX_DELAY | MII_M1145_RGMII_TX_DELAY);
161
162 err = phy_write(phydev, MII_M1145_PHY_EXT_CR, temp);
163 if (err < 0)
164 return err;
165
166 if (phydev->dev_flags & M1145_DEV_FLAGS_RESISTANCE) {
167 err = phy_write(phydev, 0x1d, 0x0012);
168 if (err < 0)
169 return err;
170
171 temp = phy_read(phydev, 0x1e);
172 if (temp < 0)
173 return temp;
174
175 temp &= 0xf03f;
176 temp |= 2 << 9; /* 36 ohm */
177 temp |= 2 << 6; /* 39 ohm */
178
179 err = phy_write(phydev, 0x1e, temp);
180 if (err < 0)
181 return err;
182
183 err = phy_write(phydev, 0x1d, 0x3);
184 if (err < 0)
185 return err;
186
187 err = phy_write(phydev, 0x1e, 0x8000);
188 if (err < 0)
189 return err;
190 }
191 }
192
193 return 0;
194}
112 195
113static struct phy_driver m88e1101_driver = { 196static struct phy_driver m88e1101_driver = {
114 .phy_id = 0x01410c00, 197 .phy_id = 0x01410c60,
115 .phy_id_mask = 0xffffff00, 198 .phy_id_mask = 0xfffffff0,
116 .name = "Marvell 88E1101", 199 .name = "Marvell 88E1101",
117 .features = PHY_GBIT_FEATURES, 200 .features = PHY_GBIT_FEATURES,
118 .flags = PHY_HAS_INTERRUPT, 201 .flags = PHY_HAS_INTERRUPT,
119 .config_aneg = &marvell_config_aneg, 202 .config_aneg = &marvell_config_aneg,
120 .read_status = &genphy_read_status, 203 .read_status = &genphy_read_status,
121 .ack_interrupt = &marvell_ack_interrupt, 204 .ack_interrupt = &marvell_ack_interrupt,
122 .config_intr = &marvell_config_intr, 205 .config_intr = &marvell_config_intr,
123 .driver = { .owner = THIS_MODULE,}, 206 .driver = {.owner = THIS_MODULE,},
207};
208
209static struct phy_driver m88e1111s_driver = {
210 .phy_id = 0x01410cc0,
211 .phy_id_mask = 0xfffffff0,
212 .name = "Marvell 88E1111",
213 .features = PHY_GBIT_FEATURES,
214 .flags = PHY_HAS_INTERRUPT,
215 .config_aneg = &marvell_config_aneg,
216 .read_status = &genphy_read_status,
217 .ack_interrupt = &marvell_ack_interrupt,
218 .config_intr = &marvell_config_intr,
219 .driver = {.owner = THIS_MODULE,},
220};
221
222static struct phy_driver m88e1145_driver = {
223 .phy_id = 0x01410cd0,
224 .phy_id_mask = 0xfffffff0,
225 .name = "Marvell 88E1145",
226 .features = PHY_GBIT_FEATURES,
227 .flags = PHY_HAS_INTERRUPT,
228 .config_init = &m88e1145_config_init,
229 .config_aneg = &marvell_config_aneg,
230 .read_status = &genphy_read_status,
231 .ack_interrupt = &marvell_ack_interrupt,
232 .config_intr = &marvell_config_intr,
233 .driver = {.owner = THIS_MODULE,},
124}; 234};
125 235
126static int __init marvell_init(void) 236static int __init marvell_init(void)
127{ 237{
128 return phy_driver_register(&m88e1101_driver); 238 int ret;
239
240 ret = phy_driver_register(&m88e1101_driver);
241 if (ret)
242 return ret;
243
244 ret = phy_driver_register(&m88e1111s_driver);
245 if (ret)
246 goto err1111s;
247
248 ret = phy_driver_register(&m88e1145_driver);
249 if (ret)
250 goto err1145;
251
252 return 0;
253
254 err1145:
255 phy_driver_unregister(&m88e1111s_driver);
256 err1111s:
257 phy_driver_unregister(&m88e1101_driver);
258 return ret;
129} 259}
130 260
131static void __exit marvell_exit(void) 261static void __exit marvell_exit(void)
132{ 262{
133 phy_driver_unregister(&m88e1101_driver); 263 phy_driver_unregister(&m88e1101_driver);
264 phy_driver_unregister(&m88e1111s_driver);
265 phy_driver_unregister(&m88e1145_driver);
134} 266}
135 267
136module_init(marvell_init); 268module_init(marvell_init);
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index fdf45fdb6731..7d5b6d1838c8 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -138,7 +138,7 @@ void phy_prepare_link(struct phy_device *phydev,
138 */ 138 */
139struct phy_device * phy_connect(struct net_device *dev, const char *phy_id, 139struct phy_device * phy_connect(struct net_device *dev, const char *phy_id,
140 void (*handler)(struct net_device *), u32 flags, 140 void (*handler)(struct net_device *), u32 flags,
141 u32 interface) 141 phy_interface_t interface)
142{ 142{
143 struct phy_device *phydev; 143 struct phy_device *phydev;
144 144
@@ -187,7 +187,7 @@ static int phy_compare_id(struct device *dev, void *data)
187} 187}
188 188
189struct phy_device *phy_attach(struct net_device *dev, 189struct phy_device *phy_attach(struct net_device *dev,
190 const char *phy_id, u32 flags, u32 interface) 190 const char *phy_id, u32 flags, phy_interface_t interface)
191{ 191{
192 struct bus_type *bus = &mdio_bus_type; 192 struct bus_type *bus = &mdio_bus_type;
193 struct phy_device *phydev; 193 struct phy_device *phydev;
diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c
index 92d11b961db8..e94ab256b540 100644
--- a/drivers/net/sk98lin/skge.c
+++ b/drivers/net/sk98lin/skge.c
@@ -5188,6 +5188,9 @@ static struct pci_driver skge_driver = {
5188 5188
5189static int __init skge_init(void) 5189static int __init skge_init(void)
5190{ 5190{
5191 printk(KERN_NOTICE "sk98lin: driver has been replaced by the skge driver"
5192 " and is scheduled for removal\n");
5193
5191 return pci_register_driver(&skge_driver); 5194 return pci_register_driver(&skge_driver);
5192} 5195}
5193 5196
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index f2ab3d56e565..52edbd7ac17e 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -49,7 +49,7 @@
49#include "sky2.h" 49#include "sky2.h"
50 50
51#define DRV_NAME "sky2" 51#define DRV_NAME "sky2"
52#define DRV_VERSION "1.12" 52#define DRV_VERSION "1.13"
53#define PFX DRV_NAME " " 53#define PFX DRV_NAME " "
54 54
55/* 55/*
@@ -1742,13 +1742,6 @@ static void sky2_link_down(struct sky2_port *sky2)
1742 reg &= ~(GM_GPCR_RX_ENA | GM_GPCR_TX_ENA); 1742 reg &= ~(GM_GPCR_RX_ENA | GM_GPCR_TX_ENA);
1743 gma_write16(hw, port, GM_GP_CTRL, reg); 1743 gma_write16(hw, port, GM_GP_CTRL, reg);
1744 1744
1745 if (sky2->flow_status == FC_RX) {
1746 /* restore Asymmetric Pause bit */
1747 gm_phy_write(hw, port, PHY_MARV_AUNE_ADV,
1748 gm_phy_read(hw, port, PHY_MARV_AUNE_ADV)
1749 | PHY_M_AN_ASP);
1750 }
1751
1752 netif_carrier_off(sky2->netdev); 1745 netif_carrier_off(sky2->netdev);
1753 netif_stop_queue(sky2->netdev); 1746 netif_stop_queue(sky2->netdev);
1754 1747
@@ -1773,10 +1766,10 @@ static int sky2_autoneg_done(struct sky2_port *sky2, u16 aux)
1773{ 1766{
1774 struct sky2_hw *hw = sky2->hw; 1767 struct sky2_hw *hw = sky2->hw;
1775 unsigned port = sky2->port; 1768 unsigned port = sky2->port;
1776 u16 lpa; 1769 u16 advert, lpa;
1777 1770
1771 advert = gm_phy_read(hw, port, PHY_MARV_AUNE_ADV);
1778 lpa = gm_phy_read(hw, port, PHY_MARV_AUNE_LP); 1772 lpa = gm_phy_read(hw, port, PHY_MARV_AUNE_LP);
1779
1780 if (lpa & PHY_M_AN_RF) { 1773 if (lpa & PHY_M_AN_RF) {
1781 printk(KERN_ERR PFX "%s: remote fault", sky2->netdev->name); 1774 printk(KERN_ERR PFX "%s: remote fault", sky2->netdev->name);
1782 return -1; 1775 return -1;
@@ -1791,20 +1784,40 @@ static int sky2_autoneg_done(struct sky2_port *sky2, u16 aux)
1791 sky2->speed = sky2_phy_speed(hw, aux); 1784 sky2->speed = sky2_phy_speed(hw, aux);
1792 sky2->duplex = (aux & PHY_M_PS_FULL_DUP) ? DUPLEX_FULL : DUPLEX_HALF; 1785 sky2->duplex = (aux & PHY_M_PS_FULL_DUP) ? DUPLEX_FULL : DUPLEX_HALF;
1793 1786
1794 /* Pause bits are offset (9..8) */ 1787 /* Since the pause result bits seem to in different positions on
1795 if (hw->chip_id == CHIP_ID_YUKON_XL 1788 * different chips. look at registers.
1796 || hw->chip_id == CHIP_ID_YUKON_EC_U 1789 */
1797 || hw->chip_id == CHIP_ID_YUKON_EX) 1790 if (!sky2_is_copper(hw)) {
1798 aux >>= 6; 1791 /* Shift for bits in fiber PHY */
1799 1792 advert &= ~(ADVERTISE_PAUSE_CAP|ADVERTISE_PAUSE_ASYM);
1800 sky2->flow_status = sky2_flow(aux & PHY_M_PS_RX_P_EN, 1793 lpa &= ~(LPA_PAUSE_CAP|LPA_PAUSE_ASYM);
1801 aux & PHY_M_PS_TX_P_EN); 1794
1795 if (advert & ADVERTISE_1000XPAUSE)
1796 advert |= ADVERTISE_PAUSE_CAP;
1797 if (advert & ADVERTISE_1000XPSE_ASYM)
1798 advert |= ADVERTISE_PAUSE_ASYM;
1799 if (lpa & LPA_1000XPAUSE)
1800 lpa |= LPA_PAUSE_CAP;
1801 if (lpa & LPA_1000XPAUSE_ASYM)
1802 lpa |= LPA_PAUSE_ASYM;
1803 }
1804
1805 sky2->flow_status = FC_NONE;
1806 if (advert & ADVERTISE_PAUSE_CAP) {
1807 if (lpa & LPA_PAUSE_CAP)
1808 sky2->flow_status = FC_BOTH;
1809 else if (advert & ADVERTISE_PAUSE_ASYM)
1810 sky2->flow_status = FC_RX;
1811 } else if (advert & ADVERTISE_PAUSE_ASYM) {
1812 if ((lpa & LPA_PAUSE_CAP) && (lpa & LPA_PAUSE_ASYM))
1813 sky2->flow_status = FC_TX;
1814 }
1802 1815
1803 if (sky2->duplex == DUPLEX_HALF && sky2->speed < SPEED_1000 1816 if (sky2->duplex == DUPLEX_HALF && sky2->speed < SPEED_1000
1804 && !(hw->chip_id == CHIP_ID_YUKON_EC_U || hw->chip_id == CHIP_ID_YUKON_EX)) 1817 && !(hw->chip_id == CHIP_ID_YUKON_EC_U || hw->chip_id == CHIP_ID_YUKON_EX))
1805 sky2->flow_status = FC_NONE; 1818 sky2->flow_status = FC_NONE;
1806 1819
1807 if (aux & PHY_M_PS_RX_P_EN) 1820 if (sky2->flow_status & FC_TX)
1808 sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_ON); 1821 sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_ON);
1809 else 1822 else
1810 sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_OFF); 1823 sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_OFF);
@@ -1853,16 +1866,13 @@ out:
1853 spin_unlock(&sky2->phy_lock); 1866 spin_unlock(&sky2->phy_lock);
1854} 1867}
1855 1868
1856
1857/* Transmit timeout is only called if we are running, carrier is up 1869/* Transmit timeout is only called if we are running, carrier is up
1858 * and tx queue is full (stopped). 1870 * and tx queue is full (stopped).
1859 * Called with netif_tx_lock held.
1860 */ 1871 */
1861static void sky2_tx_timeout(struct net_device *dev) 1872static void sky2_tx_timeout(struct net_device *dev)
1862{ 1873{
1863 struct sky2_port *sky2 = netdev_priv(dev); 1874 struct sky2_port *sky2 = netdev_priv(dev);
1864 struct sky2_hw *hw = sky2->hw; 1875 struct sky2_hw *hw = sky2->hw;
1865 u32 imask;
1866 1876
1867 if (netif_msg_timer(sky2)) 1877 if (netif_msg_timer(sky2))
1868 printk(KERN_ERR PFX "%s: tx timeout\n", dev->name); 1878 printk(KERN_ERR PFX "%s: tx timeout\n", dev->name);
@@ -1872,19 +1882,8 @@ static void sky2_tx_timeout(struct net_device *dev)
1872 sky2_read16(hw, sky2->port == 0 ? STAT_TXA1_RIDX : STAT_TXA2_RIDX), 1882 sky2_read16(hw, sky2->port == 0 ? STAT_TXA1_RIDX : STAT_TXA2_RIDX),
1873 sky2_read16(hw, Q_ADDR(txqaddr[sky2->port], Q_DONE))); 1883 sky2_read16(hw, Q_ADDR(txqaddr[sky2->port], Q_DONE)));
1874 1884
1875 imask = sky2_read32(hw, B0_IMSK); /* block IRQ in hw */ 1885 /* can't restart safely under softirq */
1876 sky2_write32(hw, B0_IMSK, 0); 1886 schedule_work(&hw->restart_work);
1877 sky2_read32(hw, B0_IMSK);
1878
1879 netif_poll_disable(hw->dev[0]); /* stop NAPI poll */
1880 synchronize_irq(hw->pdev->irq);
1881
1882 netif_start_queue(dev); /* don't wakeup during flush */
1883 sky2_tx_complete(sky2, sky2->tx_prod); /* Flush transmit queue */
1884
1885 sky2_write32(hw, B0_IMSK, imask);
1886
1887 sky2_phy_reinit(sky2); /* this clears flow control etc */
1888} 1887}
1889 1888
1890static int sky2_change_mtu(struct net_device *dev, int new_mtu) 1889static int sky2_change_mtu(struct net_device *dev, int new_mtu)
@@ -2057,9 +2056,6 @@ static struct sk_buff *sky2_receive(struct net_device *dev,
2057 if (!(status & GMR_FS_RX_OK)) 2056 if (!(status & GMR_FS_RX_OK))
2058 goto resubmit; 2057 goto resubmit;
2059 2058
2060 if (length > dev->mtu + ETH_HLEN)
2061 goto oversize;
2062
2063 if (length < copybreak) 2059 if (length < copybreak)
2064 skb = receive_copy(sky2, re, length); 2060 skb = receive_copy(sky2, re, length);
2065 else 2061 else
@@ -2069,14 +2065,10 @@ resubmit:
2069 2065
2070 return skb; 2066 return skb;
2071 2067
2072oversize:
2073 ++sky2->net_stats.rx_over_errors;
2074 goto resubmit;
2075
2076error: 2068error:
2077 ++sky2->net_stats.rx_errors; 2069 ++sky2->net_stats.rx_errors;
2078 if (status & GMR_FS_RX_FF_OV) { 2070 if (status & GMR_FS_RX_FF_OV) {
2079 sky2->net_stats.rx_fifo_errors++; 2071 sky2->net_stats.rx_over_errors++;
2080 goto resubmit; 2072 goto resubmit;
2081 } 2073 }
2082 2074
@@ -2638,6 +2630,49 @@ static void sky2_reset(struct sky2_hw *hw)
2638 sky2_write8(hw, STAT_ISR_TIMER_CTRL, TIM_START); 2630 sky2_write8(hw, STAT_ISR_TIMER_CTRL, TIM_START);
2639} 2631}
2640 2632
2633static void sky2_restart(struct work_struct *work)
2634{
2635 struct sky2_hw *hw = container_of(work, struct sky2_hw, restart_work);
2636 struct net_device *dev;
2637 int i, err;
2638
2639 dev_dbg(&hw->pdev->dev, "restarting\n");
2640
2641 del_timer_sync(&hw->idle_timer);
2642
2643 rtnl_lock();
2644 sky2_write32(hw, B0_IMSK, 0);
2645 sky2_read32(hw, B0_IMSK);
2646
2647 netif_poll_disable(hw->dev[0]);
2648
2649 for (i = 0; i < hw->ports; i++) {
2650 dev = hw->dev[i];
2651 if (netif_running(dev))
2652 sky2_down(dev);
2653 }
2654
2655 sky2_reset(hw);
2656 sky2_write32(hw, B0_IMSK, Y2_IS_BASE);
2657 netif_poll_enable(hw->dev[0]);
2658
2659 for (i = 0; i < hw->ports; i++) {
2660 dev = hw->dev[i];
2661 if (netif_running(dev)) {
2662 err = sky2_up(dev);
2663 if (err) {
2664 printk(KERN_INFO PFX "%s: could not restart %d\n",
2665 dev->name, err);
2666 dev_close(dev);
2667 }
2668 }
2669 }
2670
2671 sky2_idle_start(hw);
2672
2673 rtnl_unlock();
2674}
2675
2641static inline u8 sky2_wol_supported(const struct sky2_hw *hw) 2676static inline u8 sky2_wol_supported(const struct sky2_hw *hw)
2642{ 2677{
2643 return sky2_is_copper(hw) ? (WAKE_PHY | WAKE_MAGIC) : 0; 2678 return sky2_is_copper(hw) ? (WAKE_PHY | WAKE_MAGIC) : 0;
@@ -3600,6 +3635,8 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
3600 } 3635 }
3601 3636
3602 setup_timer(&hw->idle_timer, sky2_idle, (unsigned long) hw); 3637 setup_timer(&hw->idle_timer, sky2_idle, (unsigned long) hw);
3638 INIT_WORK(&hw->restart_work, sky2_restart);
3639
3603 sky2_idle_start(hw); 3640 sky2_idle_start(hw);
3604 3641
3605 pci_set_drvdata(pdev, hw); 3642 pci_set_drvdata(pdev, hw);
@@ -3636,6 +3673,8 @@ static void __devexit sky2_remove(struct pci_dev *pdev)
3636 3673
3637 del_timer_sync(&hw->idle_timer); 3674 del_timer_sync(&hw->idle_timer);
3638 3675
3676 flush_scheduled_work();
3677
3639 sky2_write32(hw, B0_IMSK, 0); 3678 sky2_write32(hw, B0_IMSK, 0);
3640 synchronize_irq(hw->pdev->irq); 3679 synchronize_irq(hw->pdev->irq);
3641 3680
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h
index 3b0189569d52..ac24bdc42976 100644
--- a/drivers/net/sky2.h
+++ b/drivers/net/sky2.h
@@ -1589,7 +1589,7 @@ enum {
1589 1589
1590 GMR_FS_ANY_ERR = GMR_FS_RX_FF_OV | GMR_FS_CRC_ERR | 1590 GMR_FS_ANY_ERR = GMR_FS_RX_FF_OV | GMR_FS_CRC_ERR |
1591 GMR_FS_FRAGMENT | GMR_FS_LONG_ERR | 1591 GMR_FS_FRAGMENT | GMR_FS_LONG_ERR |
1592 GMR_FS_MII_ERR | GMR_FS_GOOD_FC | GMR_FS_BAD_FC | 1592 GMR_FS_MII_ERR | GMR_FS_BAD_FC |
1593 GMR_FS_UN_SIZE | GMR_FS_JABBER, 1593 GMR_FS_UN_SIZE | GMR_FS_JABBER,
1594}; 1594};
1595 1595
@@ -1933,6 +1933,7 @@ struct sky2_hw {
1933 dma_addr_t st_dma; 1933 dma_addr_t st_dma;
1934 1934
1935 struct timer_list idle_timer; 1935 struct timer_list idle_timer;
1936 struct work_struct restart_work;
1936 int msi; 1937 int msi;
1937 wait_queue_head_t msi_wait; 1938 wait_queue_head_t msi_wait;
1938}; 1939};
diff --git a/drivers/net/wan/Kconfig b/drivers/net/wan/Kconfig
index 61708cf4c85d..8897f538a7c7 100644
--- a/drivers/net/wan/Kconfig
+++ b/drivers/net/wan/Kconfig
@@ -26,7 +26,7 @@ config WAN
26# There is no way to detect a comtrol sv11 - force it modular for now. 26# There is no way to detect a comtrol sv11 - force it modular for now.
27config HOSTESS_SV11 27config HOSTESS_SV11
28 tristate "Comtrol Hostess SV-11 support" 28 tristate "Comtrol Hostess SV-11 support"
29 depends on WAN && ISA && m && ISA_DMA_API 29 depends on WAN && ISA && m && ISA_DMA_API && INET
30 help 30 help
31 Driver for Comtrol Hostess SV-11 network card which 31 Driver for Comtrol Hostess SV-11 network card which
32 operates on low speed synchronous serial links at up to 32 operates on low speed synchronous serial links at up to
diff --git a/drivers/net/wan/pc300too.c b/drivers/net/wan/pc300too.c
index bc156b51678a..aff05dba720a 100644
--- a/drivers/net/wan/pc300too.c
+++ b/drivers/net/wan/pc300too.c
@@ -542,7 +542,7 @@ static int __init pc300_init_module(void)
542 542
543 CLOCK_BASE = use_crystal_clock ? 24576000 : pci_clock_freq; 543 CLOCK_BASE = use_crystal_clock ? 24576000 : pci_clock_freq;
544 544
545 return pci_module_init(&pc300_pci_driver); 545 return pci_register_driver(&pc300_pci_driver);
546} 546}
547 547
548 548
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx.h b/drivers/net/wireless/bcm43xx/bcm43xx.h
index 3a064def162e..0e790efae683 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx.h
+++ b/drivers/net/wireless/bcm43xx/bcm43xx.h
@@ -771,6 +771,7 @@ struct bcm43xx_private {
771 * This is currently always BCM43xx_BUSTYPE_PCI 771 * This is currently always BCM43xx_BUSTYPE_PCI
772 */ 772 */
773 u8 bustype; 773 u8 bustype;
774 u64 dma_mask;
774 775
775 u16 board_vendor; 776 u16 board_vendor;
776 u16 board_type; 777 u16 board_type;
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_dma.c b/drivers/net/wireless/bcm43xx/bcm43xx_dma.c
index 978ed099e285..6e0dc76400e5 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_dma.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_dma.c
@@ -145,16 +145,14 @@ dma_addr_t map_descbuffer(struct bcm43xx_dmaring *ring,
145 int tx) 145 int tx)
146{ 146{
147 dma_addr_t dmaaddr; 147 dma_addr_t dmaaddr;
148 int direction = PCI_DMA_FROMDEVICE;
148 149
149 if (tx) { 150 if (tx)
150 dmaaddr = dma_map_single(&ring->bcm->pci_dev->dev, 151 direction = PCI_DMA_TODEVICE;
151 buf, len, 152
152 DMA_TO_DEVICE); 153 dmaaddr = pci_map_single(ring->bcm->pci_dev,
153 } else {
154 dmaaddr = dma_map_single(&ring->bcm->pci_dev->dev,
155 buf, len, 154 buf, len,
156 DMA_FROM_DEVICE); 155 direction);
157 }
158 156
159 return dmaaddr; 157 return dmaaddr;
160} 158}
@@ -166,13 +164,13 @@ void unmap_descbuffer(struct bcm43xx_dmaring *ring,
166 int tx) 164 int tx)
167{ 165{
168 if (tx) { 166 if (tx) {
169 dma_unmap_single(&ring->bcm->pci_dev->dev, 167 pci_unmap_single(ring->bcm->pci_dev,
170 addr, len, 168 addr, len,
171 DMA_TO_DEVICE); 169 PCI_DMA_TODEVICE);
172 } else { 170 } else {
173 dma_unmap_single(&ring->bcm->pci_dev->dev, 171 pci_unmap_single(ring->bcm->pci_dev,
174 addr, len, 172 addr, len,
175 DMA_FROM_DEVICE); 173 PCI_DMA_FROMDEVICE);
176 } 174 }
177} 175}
178 176
@@ -183,8 +181,8 @@ void sync_descbuffer_for_cpu(struct bcm43xx_dmaring *ring,
183{ 181{
184 assert(!ring->tx); 182 assert(!ring->tx);
185 183
186 dma_sync_single_for_cpu(&ring->bcm->pci_dev->dev, 184 pci_dma_sync_single_for_cpu(ring->bcm->pci_dev,
187 addr, len, DMA_FROM_DEVICE); 185 addr, len, PCI_DMA_FROMDEVICE);
188} 186}
189 187
190static inline 188static inline
@@ -194,8 +192,8 @@ void sync_descbuffer_for_device(struct bcm43xx_dmaring *ring,
194{ 192{
195 assert(!ring->tx); 193 assert(!ring->tx);
196 194
197 dma_sync_single_for_device(&ring->bcm->pci_dev->dev, 195 pci_dma_sync_single_for_cpu(ring->bcm->pci_dev,
198 addr, len, DMA_FROM_DEVICE); 196 addr, len, PCI_DMA_TODEVICE);
199} 197}
200 198
201/* Unmap and free a descriptor buffer. */ 199/* Unmap and free a descriptor buffer. */
@@ -214,17 +212,53 @@ void free_descriptor_buffer(struct bcm43xx_dmaring *ring,
214 212
215static int alloc_ringmemory(struct bcm43xx_dmaring *ring) 213static int alloc_ringmemory(struct bcm43xx_dmaring *ring)
216{ 214{
217 struct device *dev = &(ring->bcm->pci_dev->dev); 215 ring->descbase = pci_alloc_consistent(ring->bcm->pci_dev, BCM43xx_DMA_RINGMEMSIZE,
218 216 &(ring->dmabase));
219 ring->descbase = dma_alloc_coherent(dev, BCM43xx_DMA_RINGMEMSIZE,
220 &(ring->dmabase), GFP_KERNEL);
221 if (!ring->descbase) { 217 if (!ring->descbase) {
222 printk(KERN_ERR PFX "DMA ringmemory allocation failed\n"); 218 /* Allocation may have failed due to pci_alloc_consistent
223 return -ENOMEM; 219 insisting on use of GFP_DMA, which is more restrictive
220 than necessary... */
221 struct dma_desc *rx_ring;
222 dma_addr_t rx_ring_dma;
223
224 rx_ring = kzalloc(BCM43xx_DMA_RINGMEMSIZE, GFP_KERNEL);
225 if (!rx_ring)
226 goto out_err;
227
228 rx_ring_dma = pci_map_single(ring->bcm->pci_dev, rx_ring,
229 BCM43xx_DMA_RINGMEMSIZE,
230 PCI_DMA_BIDIRECTIONAL);
231
232 if (pci_dma_mapping_error(rx_ring_dma) ||
233 rx_ring_dma + BCM43xx_DMA_RINGMEMSIZE > ring->bcm->dma_mask) {
234 /* Sigh... */
235 if (!pci_dma_mapping_error(rx_ring_dma))
236 pci_unmap_single(ring->bcm->pci_dev,
237 rx_ring_dma, BCM43xx_DMA_RINGMEMSIZE,
238 PCI_DMA_BIDIRECTIONAL);
239 rx_ring_dma = pci_map_single(ring->bcm->pci_dev,
240 rx_ring, BCM43xx_DMA_RINGMEMSIZE,
241 PCI_DMA_BIDIRECTIONAL);
242 if (pci_dma_mapping_error(rx_ring_dma) ||
243 rx_ring_dma + BCM43xx_DMA_RINGMEMSIZE > ring->bcm->dma_mask) {
244 assert(0);
245 if (!pci_dma_mapping_error(rx_ring_dma))
246 pci_unmap_single(ring->bcm->pci_dev,
247 rx_ring_dma, BCM43xx_DMA_RINGMEMSIZE,
248 PCI_DMA_BIDIRECTIONAL);
249 goto out_err;
250 }
251 }
252
253 ring->descbase = rx_ring;
254 ring->dmabase = rx_ring_dma;
224 } 255 }
225 memset(ring->descbase, 0, BCM43xx_DMA_RINGMEMSIZE); 256 memset(ring->descbase, 0, BCM43xx_DMA_RINGMEMSIZE);
226 257
227 return 0; 258 return 0;
259out_err:
260 printk(KERN_ERR PFX "DMA ringmemory allocation failed\n");
261 return -ENOMEM;
228} 262}
229 263
230static void free_ringmemory(struct bcm43xx_dmaring *ring) 264static void free_ringmemory(struct bcm43xx_dmaring *ring)
@@ -407,6 +441,29 @@ static int setup_rx_descbuffer(struct bcm43xx_dmaring *ring,
407 if (unlikely(!skb)) 441 if (unlikely(!skb))
408 return -ENOMEM; 442 return -ENOMEM;
409 dmaaddr = map_descbuffer(ring, skb->data, ring->rx_buffersize, 0); 443 dmaaddr = map_descbuffer(ring, skb->data, ring->rx_buffersize, 0);
444 /* This hardware bug work-around adapted from the b44 driver.
445 The chip may be unable to do PCI DMA to/from anything above 1GB */
446 if (pci_dma_mapping_error(dmaaddr) ||
447 dmaaddr + ring->rx_buffersize > ring->bcm->dma_mask) {
448 /* This one has 30-bit addressing... */
449 if (!pci_dma_mapping_error(dmaaddr))
450 pci_unmap_single(ring->bcm->pci_dev,
451 dmaaddr, ring->rx_buffersize,
452 PCI_DMA_FROMDEVICE);
453 dev_kfree_skb_any(skb);
454 skb = __dev_alloc_skb(ring->rx_buffersize,GFP_DMA);
455 if (skb == NULL)
456 return -ENOMEM;
457 dmaaddr = pci_map_single(ring->bcm->pci_dev,
458 skb->data, ring->rx_buffersize,
459 PCI_DMA_FROMDEVICE);
460 if (pci_dma_mapping_error(dmaaddr) ||
461 dmaaddr + ring->rx_buffersize > ring->bcm->dma_mask) {
462 assert(0);
463 dev_kfree_skb_any(skb);
464 return -ENOMEM;
465 }
466 }
410 meta->skb = skb; 467 meta->skb = skb;
411 meta->dmaaddr = dmaaddr; 468 meta->dmaaddr = dmaaddr;
412 skb->dev = ring->bcm->net_dev; 469 skb->dev = ring->bcm->net_dev;
@@ -636,8 +693,10 @@ struct bcm43xx_dmaring * bcm43xx_setup_dmaring(struct bcm43xx_private *bcm,
636 err = dmacontroller_setup(ring); 693 err = dmacontroller_setup(ring);
637 if (err) 694 if (err)
638 goto err_free_ringmemory; 695 goto err_free_ringmemory;
696 return ring;
639 697
640out: 698out:
699 printk(KERN_ERR PFX "Error in bcm43xx_setup_dmaring\n");
641 return ring; 700 return ring;
642 701
643err_free_ringmemory: 702err_free_ringmemory:
@@ -705,30 +764,16 @@ int bcm43xx_dma_init(struct bcm43xx_private *bcm)
705 struct bcm43xx_dmaring *ring; 764 struct bcm43xx_dmaring *ring;
706 int err = -ENOMEM; 765 int err = -ENOMEM;
707 int dma64 = 0; 766 int dma64 = 0;
708 u64 mask = bcm43xx_get_supported_dma_mask(bcm);
709 int nobits;
710 767
711 if (mask == DMA_64BIT_MASK) { 768 bcm->dma_mask = bcm43xx_get_supported_dma_mask(bcm);
769 if (bcm->dma_mask == DMA_64BIT_MASK)
712 dma64 = 1; 770 dma64 = 1;
713 nobits = 64; 771 err = pci_set_dma_mask(bcm->pci_dev, bcm->dma_mask);
714 } else if (mask == DMA_32BIT_MASK) 772 if (err)
715 nobits = 32; 773 goto no_dma;
716 else 774 err = pci_set_consistent_dma_mask(bcm->pci_dev, bcm->dma_mask);
717 nobits = 30; 775 if (err)
718 err = pci_set_dma_mask(bcm->pci_dev, mask); 776 goto no_dma;
719 err |= pci_set_consistent_dma_mask(bcm->pci_dev, mask);
720 if (err) {
721#ifdef CONFIG_BCM43XX_PIO
722 printk(KERN_WARNING PFX "DMA not supported on this device."
723 " Falling back to PIO.\n");
724 bcm->__using_pio = 1;
725 return -ENOSYS;
726#else
727 printk(KERN_ERR PFX "FATAL: DMA not supported and PIO not configured. "
728 "Please recompile the driver with PIO support.\n");
729 return -ENODEV;
730#endif /* CONFIG_BCM43XX_PIO */
731 }
732 777
733 /* setup TX DMA channels. */ 778 /* setup TX DMA channels. */
734 ring = bcm43xx_setup_dmaring(bcm, 0, 1, dma64); 779 ring = bcm43xx_setup_dmaring(bcm, 0, 1, dma64);
@@ -774,7 +819,9 @@ int bcm43xx_dma_init(struct bcm43xx_private *bcm)
774 dma->rx_ring3 = ring; 819 dma->rx_ring3 = ring;
775 } 820 }
776 821
777 dprintk(KERN_INFO PFX "%d-bit DMA initialized\n", nobits); 822 dprintk(KERN_INFO PFX "%d-bit DMA initialized\n",
823 (bcm->dma_mask == DMA_64BIT_MASK) ? 64 :
824 (bcm->dma_mask == DMA_32BIT_MASK) ? 32 : 30);
778 err = 0; 825 err = 0;
779out: 826out:
780 return err; 827 return err;
@@ -800,7 +847,17 @@ err_destroy_tx1:
800err_destroy_tx0: 847err_destroy_tx0:
801 bcm43xx_destroy_dmaring(dma->tx_ring0); 848 bcm43xx_destroy_dmaring(dma->tx_ring0);
802 dma->tx_ring0 = NULL; 849 dma->tx_ring0 = NULL;
803 goto out; 850no_dma:
851#ifdef CONFIG_BCM43XX_PIO
852 printk(KERN_WARNING PFX "DMA not supported on this device."
853 " Falling back to PIO.\n");
854 bcm->__using_pio = 1;
855 return -ENOSYS;
856#else
857 printk(KERN_ERR PFX "FATAL: DMA not supported and PIO not configured. "
858 "Please recompile the driver with PIO support.\n");
859 return -ENODEV;
860#endif /* CONFIG_BCM43XX_PIO */
804} 861}
805 862
806/* Generate a cookie for the TX header. */ 863/* Generate a cookie for the TX header. */
@@ -905,6 +962,7 @@ static void dma_tx_fragment(struct bcm43xx_dmaring *ring,
905 struct bcm43xx_dmadesc_generic *desc; 962 struct bcm43xx_dmadesc_generic *desc;
906 struct bcm43xx_dmadesc_meta *meta; 963 struct bcm43xx_dmadesc_meta *meta;
907 dma_addr_t dmaaddr; 964 dma_addr_t dmaaddr;
965 struct sk_buff *bounce_skb;
908 966
909 assert(skb_shinfo(skb)->nr_frags == 0); 967 assert(skb_shinfo(skb)->nr_frags == 0);
910 968
@@ -924,9 +982,28 @@ static void dma_tx_fragment(struct bcm43xx_dmaring *ring,
924 skb->len - sizeof(struct bcm43xx_txhdr), 982 skb->len - sizeof(struct bcm43xx_txhdr),
925 (cur_frag == 0), 983 (cur_frag == 0),
926 generate_cookie(ring, slot)); 984 generate_cookie(ring, slot));
985 dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1);
986 if (dma_mapping_error(dmaaddr) || dmaaddr + skb->len > ring->bcm->dma_mask) {
987 /* chip cannot handle DMA to/from > 1GB, use bounce buffer (copied from b44 driver) */
988 if (!dma_mapping_error(dmaaddr))
989 unmap_descbuffer(ring, dmaaddr, skb->len, 1);
990 bounce_skb = __dev_alloc_skb(skb->len, GFP_ATOMIC|GFP_DMA);
991 if (!bounce_skb)
992 return;
993 dmaaddr = map_descbuffer(ring, bounce_skb->data, bounce_skb->len, 1);
994 if (dma_mapping_error(dmaaddr) || dmaaddr + skb->len > ring->bcm->dma_mask) {
995 if (!dma_mapping_error(dmaaddr))
996 unmap_descbuffer(ring, dmaaddr, skb->len, 1);
997 dev_kfree_skb_any(bounce_skb);
998 assert(0);
999 return;
1000 }
1001 memcpy(skb_put(bounce_skb, skb->len), skb->data, skb->len);
1002 dev_kfree_skb_any(skb);
1003 skb = bounce_skb;
1004 }
927 1005
928 meta->skb = skb; 1006 meta->skb = skb;
929 dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1);
930 meta->dmaaddr = dmaaddr; 1007 meta->dmaaddr = dmaaddr;
931 1008
932 fill_descriptor(ring, desc, dmaaddr, 1009 fill_descriptor(ring, desc, dmaaddr,
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
index 23aaf1ed8541..2e400aacc436 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
@@ -95,13 +95,9 @@ static int modparam_noleds;
95module_param_named(noleds, modparam_noleds, int, 0444); 95module_param_named(noleds, modparam_noleds, int, 0444);
96MODULE_PARM_DESC(noleds, "Turn off all LED activity"); 96MODULE_PARM_DESC(noleds, "Turn off all LED activity");
97 97
98#ifdef CONFIG_BCM43XX_DEBUG
99static char modparam_fwpostfix[64]; 98static char modparam_fwpostfix[64];
100module_param_string(fwpostfix, modparam_fwpostfix, 64, 0444); 99module_param_string(fwpostfix, modparam_fwpostfix, 64, 0444);
101MODULE_PARM_DESC(fwpostfix, "Postfix for .fw files. Useful for debugging."); 100MODULE_PARM_DESC(fwpostfix, "Postfix for .fw files. Useful for using multiple firmware image versions.");
102#else
103# define modparam_fwpostfix ""
104#endif /* CONFIG_BCM43XX_DEBUG*/
105 101
106 102
107/* If you want to debug with just a single device, enable this, 103/* If you want to debug with just a single device, enable this,
@@ -2983,8 +2979,10 @@ static int bcm43xx_chipset_attach(struct bcm43xx_private *bcm)
2983 err = bcm43xx_pctl_set_crystal(bcm, 1); 2979 err = bcm43xx_pctl_set_crystal(bcm, 1);
2984 if (err) 2980 if (err)
2985 goto out; 2981 goto out;
2986 bcm43xx_pci_read_config16(bcm, PCI_STATUS, &pci_status); 2982 err = bcm43xx_pci_read_config16(bcm, PCI_STATUS, &pci_status);
2987 bcm43xx_pci_write_config16(bcm, PCI_STATUS, pci_status & ~PCI_STATUS_SIG_TARGET_ABORT); 2983 if (err)
2984 goto out;
2985 err = bcm43xx_pci_write_config16(bcm, PCI_STATUS, pci_status & ~PCI_STATUS_SIG_TARGET_ABORT);
2988 2986
2989out: 2987out:
2990 return err; 2988 return err;
@@ -3796,12 +3794,18 @@ static int bcm43xx_attach_board(struct bcm43xx_private *bcm)
3796 } 3794 }
3797 net_dev->base_addr = (unsigned long)bcm->mmio_addr; 3795 net_dev->base_addr = (unsigned long)bcm->mmio_addr;
3798 3796
3799 bcm43xx_pci_read_config16(bcm, PCI_SUBSYSTEM_VENDOR_ID, 3797 err = bcm43xx_pci_read_config16(bcm, PCI_SUBSYSTEM_VENDOR_ID,
3800 &bcm->board_vendor); 3798 &bcm->board_vendor);
3801 bcm43xx_pci_read_config16(bcm, PCI_SUBSYSTEM_ID, 3799 if (err)
3800 goto err_iounmap;
3801 err = bcm43xx_pci_read_config16(bcm, PCI_SUBSYSTEM_ID,
3802 &bcm->board_type); 3802 &bcm->board_type);
3803 bcm43xx_pci_read_config16(bcm, PCI_REVISION_ID, 3803 if (err)
3804 goto err_iounmap;
3805 err = bcm43xx_pci_read_config16(bcm, PCI_REVISION_ID,
3804 &bcm->board_revision); 3806 &bcm->board_revision);
3807 if (err)
3808 goto err_iounmap;
3805 3809
3806 err = bcm43xx_chipset_attach(bcm); 3810 err = bcm43xx_chipset_attach(bcm);
3807 if (err) 3811 if (err)
@@ -3892,6 +3896,7 @@ err_pci_release:
3892 pci_release_regions(pci_dev); 3896 pci_release_regions(pci_dev);
3893err_pci_disable: 3897err_pci_disable:
3894 pci_disable_device(pci_dev); 3898 pci_disable_device(pci_dev);
3899 printk(KERN_ERR PFX "Unable to attach board\n");
3895 goto out; 3900 goto out;
3896} 3901}
3897 3902
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
index d2ca949174fe..7b665e2386a8 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
@@ -260,22 +260,22 @@ static int bcm43xx_wx_get_rangeparams(struct net_device *net_dev,
260 if (phy->type == BCM43xx_PHYTYPE_A || 260 if (phy->type == BCM43xx_PHYTYPE_A ||
261 phy->type == BCM43xx_PHYTYPE_G) { 261 phy->type == BCM43xx_PHYTYPE_G) {
262 range->num_bitrates = 8; 262 range->num_bitrates = 8;
263 range->bitrate[i++] = IEEE80211_OFDM_RATE_6MB; 263 range->bitrate[i++] = IEEE80211_OFDM_RATE_6MB * 500000;
264 range->bitrate[i++] = IEEE80211_OFDM_RATE_9MB; 264 range->bitrate[i++] = IEEE80211_OFDM_RATE_9MB * 500000;
265 range->bitrate[i++] = IEEE80211_OFDM_RATE_12MB; 265 range->bitrate[i++] = IEEE80211_OFDM_RATE_12MB * 500000;
266 range->bitrate[i++] = IEEE80211_OFDM_RATE_18MB; 266 range->bitrate[i++] = IEEE80211_OFDM_RATE_18MB * 500000;
267 range->bitrate[i++] = IEEE80211_OFDM_RATE_24MB; 267 range->bitrate[i++] = IEEE80211_OFDM_RATE_24MB * 500000;
268 range->bitrate[i++] = IEEE80211_OFDM_RATE_36MB; 268 range->bitrate[i++] = IEEE80211_OFDM_RATE_36MB * 500000;
269 range->bitrate[i++] = IEEE80211_OFDM_RATE_48MB; 269 range->bitrate[i++] = IEEE80211_OFDM_RATE_48MB * 500000;
270 range->bitrate[i++] = IEEE80211_OFDM_RATE_54MB; 270 range->bitrate[i++] = IEEE80211_OFDM_RATE_54MB * 500000;
271 } 271 }
272 if (phy->type == BCM43xx_PHYTYPE_B || 272 if (phy->type == BCM43xx_PHYTYPE_B ||
273 phy->type == BCM43xx_PHYTYPE_G) { 273 phy->type == BCM43xx_PHYTYPE_G) {
274 range->num_bitrates += 4; 274 range->num_bitrates += 4;
275 range->bitrate[i++] = IEEE80211_CCK_RATE_1MB; 275 range->bitrate[i++] = IEEE80211_CCK_RATE_1MB * 500000;
276 range->bitrate[i++] = IEEE80211_CCK_RATE_2MB; 276 range->bitrate[i++] = IEEE80211_CCK_RATE_2MB * 500000;
277 range->bitrate[i++] = IEEE80211_CCK_RATE_5MB; 277 range->bitrate[i++] = IEEE80211_CCK_RATE_5MB * 500000;
278 range->bitrate[i++] = IEEE80211_CCK_RATE_11MB; 278 range->bitrate[i++] = IEEE80211_CCK_RATE_11MB * 500000;
279 } 279 }
280 280
281 geo = ieee80211_get_geo(bcm->ieee); 281 geo = ieee80211_get_geo(bcm->ieee);
@@ -285,7 +285,7 @@ static int bcm43xx_wx_get_rangeparams(struct net_device *net_dev,
285 if (j == IW_MAX_FREQUENCIES) 285 if (j == IW_MAX_FREQUENCIES)
286 break; 286 break;
287 range->freq[j].i = j + 1; 287 range->freq[j].i = j + 1;
288 range->freq[j].m = geo->a[i].freq;//FIXME? 288 range->freq[j].m = geo->a[i].freq * 100000;
289 range->freq[j].e = 1; 289 range->freq[j].e = 1;
290 j++; 290 j++;
291 } 291 }
@@ -293,7 +293,7 @@ static int bcm43xx_wx_get_rangeparams(struct net_device *net_dev,
293 if (j == IW_MAX_FREQUENCIES) 293 if (j == IW_MAX_FREQUENCIES)
294 break; 294 break;
295 range->freq[j].i = j + 1; 295 range->freq[j].i = j + 1;
296 range->freq[j].m = geo->bg[i].freq;//FIXME? 296 range->freq[j].m = geo->bg[i].freq * 100000;
297 range->freq[j].e = 1; 297 range->freq[j].e = 1;
298 j++; 298 j++;
299 } 299 }
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c
index b85857a84870..d0639a45cd2c 100644
--- a/drivers/net/wireless/ipw2100.c
+++ b/drivers/net/wireless/ipw2100.c
@@ -175,7 +175,7 @@ that only one external action is invoked at a time.
175 175
176/* Debugging stuff */ 176/* Debugging stuff */
177#ifdef CONFIG_IPW2100_DEBUG 177#ifdef CONFIG_IPW2100_DEBUG
178#define CONFIG_IPW2100_RX_DEBUG /* Reception debugging */ 178#define IPW2100_RX_DEBUG /* Reception debugging */
179#endif 179#endif
180 180
181MODULE_DESCRIPTION(DRV_DESCRIPTION); 181MODULE_DESCRIPTION(DRV_DESCRIPTION);
@@ -2239,7 +2239,7 @@ static void ipw2100_snapshot_free(struct ipw2100_priv *priv)
2239 priv->snapshot[0] = NULL; 2239 priv->snapshot[0] = NULL;
2240} 2240}
2241 2241
2242#ifdef CONFIG_IPW2100_DEBUG_C3 2242#ifdef IPW2100_DEBUG_C3
2243static int ipw2100_snapshot_alloc(struct ipw2100_priv *priv) 2243static int ipw2100_snapshot_alloc(struct ipw2100_priv *priv)
2244{ 2244{
2245 int i; 2245 int i;
@@ -2314,13 +2314,13 @@ static u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 * in_buf,
2314 * The size of the constructed ethernet 2314 * The size of the constructed ethernet
2315 * 2315 *
2316 */ 2316 */
2317#ifdef CONFIG_IPW2100_RX_DEBUG 2317#ifdef IPW2100_RX_DEBUG
2318static u8 packet_data[IPW_RX_NIC_BUFFER_LENGTH]; 2318static u8 packet_data[IPW_RX_NIC_BUFFER_LENGTH];
2319#endif 2319#endif
2320 2320
2321static void ipw2100_corruption_detected(struct ipw2100_priv *priv, int i) 2321static void ipw2100_corruption_detected(struct ipw2100_priv *priv, int i)
2322{ 2322{
2323#ifdef CONFIG_IPW2100_DEBUG_C3 2323#ifdef IPW2100_DEBUG_C3
2324 struct ipw2100_status *status = &priv->status_queue.drv[i]; 2324 struct ipw2100_status *status = &priv->status_queue.drv[i];
2325 u32 match, reg; 2325 u32 match, reg;
2326 int j; 2326 int j;
@@ -2342,7 +2342,7 @@ static void ipw2100_corruption_detected(struct ipw2100_priv *priv, int i)
2342 } 2342 }
2343#endif 2343#endif
2344 2344
2345#ifdef CONFIG_IPW2100_DEBUG_C3 2345#ifdef IPW2100_DEBUG_C3
2346 /* Halt the fimrware so we can get a good image */ 2346 /* Halt the fimrware so we can get a good image */
2347 write_register(priv->net_dev, IPW_REG_RESET_REG, 2347 write_register(priv->net_dev, IPW_REG_RESET_REG,
2348 IPW_AUX_HOST_RESET_REG_STOP_MASTER); 2348 IPW_AUX_HOST_RESET_REG_STOP_MASTER);
@@ -2413,7 +2413,7 @@ static void isr_rx(struct ipw2100_priv *priv, int i,
2413 2413
2414 skb_put(packet->skb, status->frame_size); 2414 skb_put(packet->skb, status->frame_size);
2415 2415
2416#ifdef CONFIG_IPW2100_RX_DEBUG 2416#ifdef IPW2100_RX_DEBUG
2417 /* Make a copy of the frame so we can dump it to the logs if 2417 /* Make a copy of the frame so we can dump it to the logs if
2418 * ieee80211_rx fails */ 2418 * ieee80211_rx fails */
2419 memcpy(packet_data, packet->skb->data, 2419 memcpy(packet_data, packet->skb->data,
@@ -2421,7 +2421,7 @@ static void isr_rx(struct ipw2100_priv *priv, int i,
2421#endif 2421#endif
2422 2422
2423 if (!ieee80211_rx(priv->ieee, packet->skb, stats)) { 2423 if (!ieee80211_rx(priv->ieee, packet->skb, stats)) {
2424#ifdef CONFIG_IPW2100_RX_DEBUG 2424#ifdef IPW2100_RX_DEBUG
2425 IPW_DEBUG_DROP("%s: Non consumed packet:\n", 2425 IPW_DEBUG_DROP("%s: Non consumed packet:\n",
2426 priv->net_dev->name); 2426 priv->net_dev->name);
2427 printk_buf(IPW_DL_DROP, packet_data, status->frame_size); 2427 printk_buf(IPW_DL_DROP, packet_data, status->frame_size);
@@ -4912,7 +4912,7 @@ static int ipw2100_set_power_mode(struct ipw2100_priv *priv, int power_level)
4912 else 4912 else
4913 priv->power_mode = IPW_POWER_ENABLED | power_level; 4913 priv->power_mode = IPW_POWER_ENABLED | power_level;
4914 4914
4915#ifdef CONFIG_IPW2100_TX_POWER 4915#ifdef IPW2100_TX_POWER
4916 if (priv->port_type == IBSS && priv->adhoc_power != DFTL_IBSS_TX_POWER) { 4916 if (priv->port_type == IBSS && priv->adhoc_power != DFTL_IBSS_TX_POWER) {
4917 /* Set beacon interval */ 4917 /* Set beacon interval */
4918 cmd.host_command = TX_POWER_INDEX; 4918 cmd.host_command = TX_POWER_INDEX;
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c
index a08524191b5d..4c5f78eac349 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -156,7 +156,7 @@ void zd_mac_clear(struct zd_mac *mac)
156static int reset_mode(struct zd_mac *mac) 156static int reset_mode(struct zd_mac *mac)
157{ 157{
158 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac); 158 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
159 struct zd_ioreq32 ioreqs[3] = { 159 struct zd_ioreq32 ioreqs[] = {
160 { CR_RX_FILTER, STA_RX_FILTER }, 160 { CR_RX_FILTER, STA_RX_FILTER },
161 { CR_SNIFFER_ON, 0U }, 161 { CR_SNIFFER_ON, 0U },
162 }; 162 };
@@ -164,10 +164,9 @@ static int reset_mode(struct zd_mac *mac)
164 if (ieee->iw_mode == IW_MODE_MONITOR) { 164 if (ieee->iw_mode == IW_MODE_MONITOR) {
165 ioreqs[0].value = 0xffffffff; 165 ioreqs[0].value = 0xffffffff;
166 ioreqs[1].value = 0x1; 166 ioreqs[1].value = 0x1;
167 ioreqs[2].value = ENC_SNIFFER;
168 } 167 }
169 168
170 return zd_iowrite32a(&mac->chip, ioreqs, 3); 169 return zd_iowrite32a(&mac->chip, ioreqs, ARRAY_SIZE(ioreqs));
171} 170}
172 171
173int zd_mac_open(struct net_device *netdev) 172int zd_mac_open(struct net_device *netdev)
@@ -904,16 +903,21 @@ static int fill_ctrlset(struct zd_mac *mac,
904static int zd_mac_tx(struct zd_mac *mac, struct ieee80211_txb *txb, int pri) 903static int zd_mac_tx(struct zd_mac *mac, struct ieee80211_txb *txb, int pri)
905{ 904{
906 int i, r; 905 int i, r;
906 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
907 907
908 for (i = 0; i < txb->nr_frags; i++) { 908 for (i = 0; i < txb->nr_frags; i++) {
909 struct sk_buff *skb = txb->fragments[i]; 909 struct sk_buff *skb = txb->fragments[i];
910 910
911 r = fill_ctrlset(mac, txb, i); 911 r = fill_ctrlset(mac, txb, i);
912 if (r) 912 if (r) {
913 ieee->stats.tx_dropped++;
913 return r; 914 return r;
915 }
914 r = zd_usb_tx(&mac->chip.usb, skb->data, skb->len); 916 r = zd_usb_tx(&mac->chip.usb, skb->data, skb->len);
915 if (r) 917 if (r) {
918 ieee->stats.tx_dropped++;
916 return r; 919 return r;
920 }
917 } 921 }
918 922
919 /* FIXME: shouldn't this be handled by the upper layers? */ 923 /* FIXME: shouldn't this be handled by the upper layers? */
@@ -1063,9 +1067,23 @@ static int fill_rx_stats(struct ieee80211_rx_stats *stats,
1063 1067
1064 *pstatus = status = zd_tail(buffer, length, sizeof(struct rx_status)); 1068 *pstatus = status = zd_tail(buffer, length, sizeof(struct rx_status));
1065 if (status->frame_status & ZD_RX_ERROR) { 1069 if (status->frame_status & ZD_RX_ERROR) {
1066 /* FIXME: update? */ 1070 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
1071 ieee->stats.rx_errors++;
1072 if (status->frame_status & ZD_RX_TIMEOUT_ERROR)
1073 ieee->stats.rx_missed_errors++;
1074 else if (status->frame_status & ZD_RX_FIFO_OVERRUN_ERROR)
1075 ieee->stats.rx_fifo_errors++;
1076 else if (status->frame_status & ZD_RX_DECRYPTION_ERROR)
1077 ieee->ieee_stats.rx_discards_undecryptable++;
1078 else if (status->frame_status & ZD_RX_CRC32_ERROR) {
1079 ieee->stats.rx_crc_errors++;
1080 ieee->ieee_stats.rx_fcs_errors++;
1081 }
1082 else if (status->frame_status & ZD_RX_CRC16_ERROR)
1083 ieee->stats.rx_crc_errors++;
1067 return -EINVAL; 1084 return -EINVAL;
1068 } 1085 }
1086
1069 memset(stats, 0, sizeof(struct ieee80211_rx_stats)); 1087 memset(stats, 0, sizeof(struct ieee80211_rx_stats));
1070 stats->len = length - (ZD_PLCP_HEADER_SIZE + IEEE80211_FCS_LEN + 1088 stats->len = length - (ZD_PLCP_HEADER_SIZE + IEEE80211_FCS_LEN +
1071 + sizeof(struct rx_status)); 1089 + sizeof(struct rx_status));
@@ -1094,14 +1112,16 @@ static void zd_mac_rx(struct zd_mac *mac, struct sk_buff *skb)
1094 if (skb->len < ZD_PLCP_HEADER_SIZE + IEEE80211_1ADDR_LEN + 1112 if (skb->len < ZD_PLCP_HEADER_SIZE + IEEE80211_1ADDR_LEN +
1095 IEEE80211_FCS_LEN + sizeof(struct rx_status)) 1113 IEEE80211_FCS_LEN + sizeof(struct rx_status))
1096 { 1114 {
1097 dev_dbg_f(zd_mac_dev(mac), "Packet with length %u to small.\n", 1115 ieee->stats.rx_errors++;
1098 skb->len); 1116 ieee->stats.rx_length_errors++;
1099 goto free_skb; 1117 goto free_skb;
1100 } 1118 }
1101 1119
1102 r = fill_rx_stats(&stats, &status, mac, skb->data, skb->len); 1120 r = fill_rx_stats(&stats, &status, mac, skb->data, skb->len);
1103 if (r) { 1121 if (r) {
1104 /* Only packets with rx errors are included here. */ 1122 /* Only packets with rx errors are included here.
1123 * The error stats have already been set in fill_rx_stats.
1124 */
1105 goto free_skb; 1125 goto free_skb;
1106 } 1126 }
1107 1127
@@ -1114,8 +1134,10 @@ static void zd_mac_rx(struct zd_mac *mac, struct sk_buff *skb)
1114 1134
1115 r = filter_rx(ieee, skb->data, skb->len, &stats); 1135 r = filter_rx(ieee, skb->data, skb->len, &stats);
1116 if (r <= 0) { 1136 if (r <= 0) {
1117 if (r < 0) 1137 if (r < 0) {
1138 ieee->stats.rx_errors++;
1118 dev_dbg_f(zd_mac_dev(mac), "Error in packet.\n"); 1139 dev_dbg_f(zd_mac_dev(mac), "Error in packet.\n");
1140 }
1119 goto free_skb; 1141 goto free_skb;
1120 } 1142 }
1121 1143
@@ -1146,7 +1168,9 @@ int zd_mac_rx_irq(struct zd_mac *mac, const u8 *buffer, unsigned int length)
1146 1168
1147 skb = dev_alloc_skb(sizeof(struct zd_rt_hdr) + length); 1169 skb = dev_alloc_skb(sizeof(struct zd_rt_hdr) + length);
1148 if (!skb) { 1170 if (!skb) {
1171 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
1149 dev_warn(zd_mac_dev(mac), "Could not allocate skb.\n"); 1172 dev_warn(zd_mac_dev(mac), "Could not allocate skb.\n");
1173 ieee->stats.rx_dropped++;
1150 return -ENOMEM; 1174 return -ENOMEM;
1151 } 1175 }
1152 skb_reserve(skb, sizeof(struct zd_rt_hdr)); 1176 skb_reserve(skb, sizeof(struct zd_rt_hdr));
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c
index 75ef55624d7f..aac8a1c5ba08 100644
--- a/drivers/net/wireless/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zd1211rw/zd_usb.c
@@ -313,6 +313,12 @@ out:
313 313
314static inline void handle_retry_failed_int(struct urb *urb) 314static inline void handle_retry_failed_int(struct urb *urb)
315{ 315{
316 struct zd_usb *usb = urb->context;
317 struct zd_mac *mac = zd_usb_to_mac(usb);
318 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
319
320 ieee->stats.tx_errors++;
321 ieee->ieee_stats.tx_retry_limit_exceeded++;
316 dev_dbg_f(urb_dev(urb), "retry failed interrupt\n"); 322 dev_dbg_f(urb_dev(urb), "retry failed interrupt\n");
317} 323}
318 324
@@ -487,6 +493,9 @@ static void handle_rx_packet(struct zd_usb *usb, const u8 *buffer,
487 493
488 if (length < sizeof(struct rx_length_info)) { 494 if (length < sizeof(struct rx_length_info)) {
489 /* It's not a complete packet anyhow. */ 495 /* It's not a complete packet anyhow. */
496 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
497 ieee->stats.rx_errors++;
498 ieee->stats.rx_length_errors++;
490 return; 499 return;
491 } 500 }
492 length_info = (struct rx_length_info *) 501 length_info = (struct rx_length_info *)
@@ -923,6 +932,8 @@ static int probe(struct usb_interface *intf, const struct usb_device_id *id)
923 goto error; 932 goto error;
924 } 933 }
925 934
935 usb_reset_device(interface_to_usbdev(intf));
936
926 netdev = zd_netdev_alloc(intf); 937 netdev = zd_netdev_alloc(intf);
927 if (netdev == NULL) { 938 if (netdev == NULL) {
928 r = -ENOMEM; 939 r = -ENOMEM;
@@ -1024,6 +1035,7 @@ static int __init usb_init(void)
1024 1035
1025 r = usb_register(&driver); 1036 r = usb_register(&driver);
1026 if (r) { 1037 if (r) {
1038 destroy_workqueue(zd_workqueue);
1027 printk(KERN_ERR "%s usb_register() failed. Error number %d\n", 1039 printk(KERN_ERR "%s usb_register() failed. Error number %d\n",
1028 driver.name, r); 1040 driver.name, r);
1029 return r; 1041 return r;