aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2008-01-13 13:02:26 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-01-13 13:02:26 -0500
commitd72ec9e20e4de995aa957f171cf84b136689e4c0 (patch)
treeb99c4dff73df4232faeb4f015bd6be6d8b1f7f44
parentfd4be699b5b6b1744c9b0736d991ccfb35eea575 (diff)
parentcb8da8a38015ded1df319a39b7298e69f89036ac (diff)
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: spidernet MAINTAINERship update sky2: remove check for PCI wakeup setting from BIOS sky2: large memory workaround. fs_enet: check for phydev existence in the ethtool handlers [usb netdev] asix: fix regression r8169: fix missing loop variable increment ip1000: menu location change Fixed a small typo in the loopback driver 3c509: PnP resource management fix netxen: fix byte-swapping in tx and rx netxen: optimize tx handling netxen: stop second phy correctly netxen: update driver version netxen: update MAINTAINERS endianness noise in tulip_core de4x5 fixes xircom_cb endianness fixes rt2x00: Put 802.11 data on 4 byte boundary rt2x00: Corectly initialize rt2500usb MAC rt2x00: Allow rt61 to catch up after a missing tx report
-rw-r--r--MAINTAINERS10
-rw-r--r--drivers/net/3c509.c4
-rw-r--r--drivers/net/Kconfig20
-rw-r--r--drivers/net/fs_enet/fs_enet-main.c11
-rw-r--r--drivers/net/loopback.c2
-rw-r--r--drivers/net/netxen/netxen_nic.h69
-rw-r--r--drivers/net/netxen/netxen_nic_init.c20
-rw-r--r--drivers/net/netxen/netxen_nic_main.c70
-rw-r--r--drivers/net/netxen/netxen_nic_niu.c8
-rw-r--r--drivers/net/r8169.c2
-rw-r--r--drivers/net/sky2.c48
-rw-r--r--drivers/net/sky2.h4
-rw-r--r--drivers/net/tulip/de4x5.c127
-rw-r--r--drivers/net/tulip/tulip_core.c3
-rw-r--r--drivers/net/tulip/xircom_cb.c54
-rw-r--r--drivers/net/usb/asix.c6
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00pci.c20
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c17
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c12
20 files changed, 238 insertions, 271 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index b4f611c60cfc..92aa0a7e58ea 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2739,8 +2739,8 @@ T: git kernel.org:/pub/scm/linux/kernel/git/linville/wireless-2.6.git
2739S: Maintained 2739S: Maintained
2740 2740
2741NETXEN (1/10) GbE SUPPORT 2741NETXEN (1/10) GbE SUPPORT
2742P: Amit S. Kale 2742P: Dhananjay Phadke
2743M: amitkale@netxen.com 2743M: dhananjay@netxen.com
2744L: netdev@vger.kernel.org 2744L: netdev@vger.kernel.org
2745W: http://www.netxen.com 2745W: http://www.netxen.com
2746S: Supported 2746S: Supported
@@ -3611,8 +3611,10 @@ L: linux-kernel@vger.kernel.org ?
3611S: Supported 3611S: Supported
3612 3612
3613SPIDERNET NETWORK DRIVER for CELL 3613SPIDERNET NETWORK DRIVER for CELL
3614P: Linas Vepstas 3614P: Ishizaki Kou
3615M: linas@austin.ibm.com 3615M: kou.ishizaki@toshiba.co.jp
3616P: Jens Osterkamp
3617M: jens@de.ibm.com
3616L: netdev@vger.kernel.org 3618L: netdev@vger.kernel.org
3617S: Supported 3619S: Supported
3618 3620
diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c
index edda6e10ebe5..8fafac987e0b 100644
--- a/drivers/net/3c509.c
+++ b/drivers/net/3c509.c
@@ -385,6 +385,7 @@ static int __init el3_probe(int card_idx)
385#if defined(__ISAPNP__) 385#if defined(__ISAPNP__)
386 static int pnp_cards; 386 static int pnp_cards;
387 struct pnp_dev *idev = NULL; 387 struct pnp_dev *idev = NULL;
388 int pnp_found = 0;
388 389
389 if (nopnp == 1) 390 if (nopnp == 1)
390 goto no_pnp; 391 goto no_pnp;
@@ -430,6 +431,7 @@ __again:
430 pnp_cards++; 431 pnp_cards++;
431 432
432 netdev_boot_setup_check(dev); 433 netdev_boot_setup_check(dev);
434 pnp_found = 1;
433 goto found; 435 goto found;
434 } 436 }
435 } 437 }
@@ -560,6 +562,8 @@ no_pnp:
560 lp = netdev_priv(dev); 562 lp = netdev_priv(dev);
561#if defined(__ISAPNP__) 563#if defined(__ISAPNP__)
562 lp->dev = &idev->dev; 564 lp->dev = &idev->dev;
565 if (pnp_found)
566 lp->type = EL3_PNP;
563#endif 567#endif
564 err = el3_common_init(dev); 568 err = el3_common_init(dev);
565 569
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index d9107e542dfa..114771a2a133 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -166,16 +166,6 @@ config NET_SB1000
166 166
167 If you don't have this card, of course say N. 167 If you don't have this card, of course say N.
168 168
169config IP1000
170 tristate "IP1000 Gigabit Ethernet support"
171 depends on PCI && EXPERIMENTAL
172 select MII
173 ---help---
174 This driver supports IP1000 gigabit Ethernet cards.
175
176 To compile this driver as a module, choose M here: the module
177 will be called ipg. This is recommended.
178
179source "drivers/net/arcnet/Kconfig" 169source "drivers/net/arcnet/Kconfig"
180 170
181source "drivers/net/phy/Kconfig" 171source "drivers/net/phy/Kconfig"
@@ -1992,6 +1982,16 @@ config E1000E
1992 To compile this driver as a module, choose M here. The module 1982 To compile this driver as a module, choose M here. The module
1993 will be called e1000e. 1983 will be called e1000e.
1994 1984
1985config IP1000
1986 tristate "IP1000 Gigabit Ethernet support"
1987 depends on PCI && EXPERIMENTAL
1988 select MII
1989 ---help---
1990 This driver supports IP1000 gigabit Ethernet cards.
1991
1992 To compile this driver as a module, choose M here: the module
1993 will be called ipg. This is recommended.
1994
1995source "drivers/net/ixp2000/Kconfig" 1995source "drivers/net/ixp2000/Kconfig"
1996 1996
1997config MYRI_SBUS 1997config MYRI_SBUS
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index 3e1a57a42f11..c83bd6560088 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -894,14 +894,21 @@ static void fs_get_regs(struct net_device *dev, struct ethtool_regs *regs,
894static int fs_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) 894static int fs_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
895{ 895{
896 struct fs_enet_private *fep = netdev_priv(dev); 896 struct fs_enet_private *fep = netdev_priv(dev);
897
898 if (!fep->phydev)
899 return -ENODEV;
900
897 return phy_ethtool_gset(fep->phydev, cmd); 901 return phy_ethtool_gset(fep->phydev, cmd);
898} 902}
899 903
900static int fs_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) 904static int fs_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
901{ 905{
902 struct fs_enet_private *fep = netdev_priv(dev); 906 struct fs_enet_private *fep = netdev_priv(dev);
903 phy_ethtool_sset(fep->phydev, cmd); 907
904 return 0; 908 if (!fep->phydev)
909 return -ENODEV;
910
911 return phy_ethtool_sset(fep->phydev, cmd);
905} 912}
906 913
907static int fs_nway_reset(struct net_device *dev) 914static int fs_nway_reset(struct net_device *dev)
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 662b8d16803c..fa147cd5d68c 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -242,7 +242,7 @@ static void loopback_setup(struct net_device *dev)
242 | NETIF_F_NO_CSUM 242 | NETIF_F_NO_CSUM
243 | NETIF_F_HIGHDMA 243 | NETIF_F_HIGHDMA
244 | NETIF_F_LLTX 244 | NETIF_F_LLTX
245 | NETIF_F_NETNS_LOCAL, 245 | NETIF_F_NETNS_LOCAL;
246 dev->ethtool_ops = &loopback_ethtool_ops; 246 dev->ethtool_ops = &loopback_ethtool_ops;
247 dev->header_ops = &eth_header_ops; 247 dev->header_ops = &eth_header_ops;
248 dev->init = loopback_dev_init; 248 dev->init = loopback_dev_init;
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index fbc2553275dc..a8f63c47b3cd 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -65,8 +65,8 @@
65 65
66#define _NETXEN_NIC_LINUX_MAJOR 3 66#define _NETXEN_NIC_LINUX_MAJOR 3
67#define _NETXEN_NIC_LINUX_MINOR 4 67#define _NETXEN_NIC_LINUX_MINOR 4
68#define _NETXEN_NIC_LINUX_SUBVERSION 2 68#define _NETXEN_NIC_LINUX_SUBVERSION 18
69#define NETXEN_NIC_LINUX_VERSIONID "3.4.2" 69#define NETXEN_NIC_LINUX_VERSIONID "3.4.18"
70 70
71#define NETXEN_NUM_FLASH_SECTORS (64) 71#define NETXEN_NUM_FLASH_SECTORS (64)
72#define NETXEN_FLASH_SECTOR_SIZE (64 * 1024) 72#define NETXEN_FLASH_SECTOR_SIZE (64 * 1024)
@@ -309,23 +309,26 @@ struct netxen_ring_ctx {
309 ((cmd_desc)->port_ctxid |= ((var) & 0xF0)) 309 ((cmd_desc)->port_ctxid |= ((var) & 0xF0))
310 310
311#define netxen_set_cmd_desc_flags(cmd_desc, val) \ 311#define netxen_set_cmd_desc_flags(cmd_desc, val) \
312 ((cmd_desc)->flags_opcode &= ~cpu_to_le16(0x7f), \ 312 (cmd_desc)->flags_opcode = ((cmd_desc)->flags_opcode & \
313 (cmd_desc)->flags_opcode |= cpu_to_le16((val) & 0x7f)) 313 ~cpu_to_le16(0x7f)) | cpu_to_le16((val) & 0x7f)
314#define netxen_set_cmd_desc_opcode(cmd_desc, val) \ 314#define netxen_set_cmd_desc_opcode(cmd_desc, val) \
315 ((cmd_desc)->flags_opcode &= ~cpu_to_le16(0x3f<<7), \ 315 (cmd_desc)->flags_opcode = ((cmd_desc)->flags_opcode & \
316 (cmd_desc)->flags_opcode |= cpu_to_le16(((val & 0x3f)<<7))) 316 ~cpu_to_le16((u16)0x3f << 7)) | cpu_to_le16(((val) & 0x3f) << 7)
317 317
318#define netxen_set_cmd_desc_num_of_buff(cmd_desc, val) \ 318#define netxen_set_cmd_desc_num_of_buff(cmd_desc, val) \
319 ((cmd_desc)->num_of_buffers_total_length &= ~cpu_to_le32(0xff), \ 319 (cmd_desc)->num_of_buffers_total_length = \
320 (cmd_desc)->num_of_buffers_total_length |= cpu_to_le32((val) & 0xff)) 320 ((cmd_desc)->num_of_buffers_total_length & \
321 ~cpu_to_le32(0xff)) | cpu_to_le32((val) & 0xff)
321#define netxen_set_cmd_desc_totallength(cmd_desc, val) \ 322#define netxen_set_cmd_desc_totallength(cmd_desc, val) \
322 ((cmd_desc)->num_of_buffers_total_length &= ~cpu_to_le32(0xffffff00), \ 323 (cmd_desc)->num_of_buffers_total_length = \
323 (cmd_desc)->num_of_buffers_total_length |= cpu_to_le32(val << 8)) 324 ((cmd_desc)->num_of_buffers_total_length & \
325 ~cpu_to_le32((u32)0xffffff << 8)) | \
326 cpu_to_le32(((val) & 0xffffff) << 8)
324 327
325#define netxen_get_cmd_desc_opcode(cmd_desc) \ 328#define netxen_get_cmd_desc_opcode(cmd_desc) \
326 ((le16_to_cpu((cmd_desc)->flags_opcode) >> 7) & 0x003F) 329 ((le16_to_cpu((cmd_desc)->flags_opcode) >> 7) & 0x003f)
327#define netxen_get_cmd_desc_totallength(cmd_desc) \ 330#define netxen_get_cmd_desc_totallength(cmd_desc) \
328 (le32_to_cpu((cmd_desc)->num_of_buffers_total_length) >> 8) 331 ((le32_to_cpu((cmd_desc)->num_of_buffers_total_length) >> 8) & 0xffffff)
329 332
330struct cmd_desc_type0 { 333struct cmd_desc_type0 {
331 u8 tcp_hdr_offset; /* For LSO only */ 334 u8 tcp_hdr_offset; /* For LSO only */
@@ -412,29 +415,29 @@ struct rcv_desc {
412#define netxen_get_sts_desc_lro_last_frag(status_desc) \ 415#define netxen_get_sts_desc_lro_last_frag(status_desc) \
413 (((status_desc)->lro & 0x80) >> 7) 416 (((status_desc)->lro & 0x80) >> 7)
414 417
415#define netxen_get_sts_port(status_desc) \ 418#define netxen_get_sts_port(sts_data) \
416 (le64_to_cpu((status_desc)->status_desc_data) & 0x0F) 419 ((sts_data) & 0x0F)
417#define netxen_get_sts_status(status_desc) \ 420#define netxen_get_sts_status(sts_data) \
418 ((le64_to_cpu((status_desc)->status_desc_data) >> 4) & 0x0F) 421 (((sts_data) >> 4) & 0x0F)
419#define netxen_get_sts_type(status_desc) \ 422#define netxen_get_sts_type(sts_data) \
420 ((le64_to_cpu((status_desc)->status_desc_data) >> 8) & 0x0F) 423 (((sts_data) >> 8) & 0x0F)
421#define netxen_get_sts_totallength(status_desc) \ 424#define netxen_get_sts_totallength(sts_data) \
422 ((le64_to_cpu((status_desc)->status_desc_data) >> 12) & 0xFFFF) 425 (((sts_data) >> 12) & 0xFFFF)
423#define netxen_get_sts_refhandle(status_desc) \ 426#define netxen_get_sts_refhandle(sts_data) \
424 ((le64_to_cpu((status_desc)->status_desc_data) >> 28) & 0xFFFF) 427 (((sts_data) >> 28) & 0xFFFF)
425#define netxen_get_sts_prot(status_desc) \ 428#define netxen_get_sts_prot(sts_data) \
426 ((le64_to_cpu((status_desc)->status_desc_data) >> 44) & 0x0F) 429 (((sts_data) >> 44) & 0x0F)
430#define netxen_get_sts_opcode(sts_data) \
431 (((sts_data) >> 58) & 0x03F)
432
427#define netxen_get_sts_owner(status_desc) \ 433#define netxen_get_sts_owner(status_desc) \
428 ((le64_to_cpu((status_desc)->status_desc_data) >> 56) & 0x03) 434 ((le64_to_cpu((status_desc)->status_desc_data) >> 56) & 0x03)
429#define netxen_get_sts_opcode(status_desc) \ 435#define netxen_set_sts_owner(status_desc, val) { \
430 ((le64_to_cpu((status_desc)->status_desc_data) >> 58) & 0x03F) 436 (status_desc)->status_desc_data = \
431 437 ((status_desc)->status_desc_data & \
432#define netxen_clear_sts_owner(status_desc) \ 438 ~cpu_to_le64(0x3ULL << 56)) | \
433 ((status_desc)->status_desc_data &= \ 439 cpu_to_le64((u64)((val) & 0x3) << 56); \
434 ~cpu_to_le64(((unsigned long long)3) << 56 )) 440}
435#define netxen_set_sts_owner(status_desc, val) \
436 ((status_desc)->status_desc_data |= \
437 cpu_to_le64(((unsigned long long)((val) & 0x3)) << 56 ))
438 441
439struct status_desc { 442struct status_desc {
440 /* Bit pattern: 0-3 port, 4-7 status, 8-11 type, 12-27 total_length 443 /* Bit pattern: 0-3 port, 4-7 status, 8-11 type, 12-27 total_length
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index 37589265297e..485ff9398910 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -1070,16 +1070,17 @@ netxen_process_rcv(struct netxen_adapter *adapter, int ctxid,
1070{ 1070{
1071 struct pci_dev *pdev = adapter->pdev; 1071 struct pci_dev *pdev = adapter->pdev;
1072 struct net_device *netdev = adapter->netdev; 1072 struct net_device *netdev = adapter->netdev;
1073 int index = netxen_get_sts_refhandle(desc); 1073 u64 sts_data = le64_to_cpu(desc->status_desc_data);
1074 int index = netxen_get_sts_refhandle(sts_data);
1074 struct netxen_recv_context *recv_ctx = &(adapter->recv_ctx[ctxid]); 1075 struct netxen_recv_context *recv_ctx = &(adapter->recv_ctx[ctxid]);
1075 struct netxen_rx_buffer *buffer; 1076 struct netxen_rx_buffer *buffer;
1076 struct sk_buff *skb; 1077 struct sk_buff *skb;
1077 u32 length = netxen_get_sts_totallength(desc); 1078 u32 length = netxen_get_sts_totallength(sts_data);
1078 u32 desc_ctx; 1079 u32 desc_ctx;
1079 struct netxen_rcv_desc_ctx *rcv_desc; 1080 struct netxen_rcv_desc_ctx *rcv_desc;
1080 int ret; 1081 int ret;
1081 1082
1082 desc_ctx = netxen_get_sts_type(desc); 1083 desc_ctx = netxen_get_sts_type(sts_data);
1083 if (unlikely(desc_ctx >= NUM_RCV_DESC_RINGS)) { 1084 if (unlikely(desc_ctx >= NUM_RCV_DESC_RINGS)) {
1084 printk("%s: %s Bad Rcv descriptor ring\n", 1085 printk("%s: %s Bad Rcv descriptor ring\n",
1085 netxen_nic_driver_name, netdev->name); 1086 netxen_nic_driver_name, netdev->name);
@@ -1119,7 +1120,7 @@ netxen_process_rcv(struct netxen_adapter *adapter, int ctxid,
1119 skb = (struct sk_buff *)buffer->skb; 1120 skb = (struct sk_buff *)buffer->skb;
1120 1121
1121 if (likely(adapter->rx_csum && 1122 if (likely(adapter->rx_csum &&
1122 netxen_get_sts_status(desc) == STATUS_CKSUM_OK)) { 1123 netxen_get_sts_status(sts_data) == STATUS_CKSUM_OK)) {
1123 adapter->stats.csummed++; 1124 adapter->stats.csummed++;
1124 skb->ip_summed = CHECKSUM_UNNECESSARY; 1125 skb->ip_summed = CHECKSUM_UNNECESSARY;
1125 } else 1126 } else
@@ -1209,7 +1210,6 @@ u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctxid, int max)
1209 break; 1210 break;
1210 } 1211 }
1211 netxen_process_rcv(adapter, ctxid, desc); 1212 netxen_process_rcv(adapter, ctxid, desc);
1212 netxen_clear_sts_owner(desc);
1213 netxen_set_sts_owner(desc, STATUS_OWNER_PHANTOM); 1213 netxen_set_sts_owner(desc, STATUS_OWNER_PHANTOM);
1214 consumer = (consumer + 1) & (adapter->max_rx_desc_count - 1); 1214 consumer = (consumer + 1) & (adapter->max_rx_desc_count - 1);
1215 count++; 1215 count++;
@@ -1248,7 +1248,6 @@ int netxen_process_cmd_ring(unsigned long data)
1248 struct pci_dev *pdev; 1248 struct pci_dev *pdev;
1249 struct netxen_skb_frag *frag; 1249 struct netxen_skb_frag *frag;
1250 u32 i; 1250 u32 i;
1251 struct sk_buff *skb = NULL;
1252 int done; 1251 int done;
1253 1252
1254 spin_lock(&adapter->tx_lock); 1253 spin_lock(&adapter->tx_lock);
@@ -1278,9 +1277,8 @@ int netxen_process_cmd_ring(unsigned long data)
1278 while ((last_consumer != consumer) && (count1 < MAX_STATUS_HANDLE)) { 1277 while ((last_consumer != consumer) && (count1 < MAX_STATUS_HANDLE)) {
1279 buffer = &adapter->cmd_buf_arr[last_consumer]; 1278 buffer = &adapter->cmd_buf_arr[last_consumer];
1280 pdev = adapter->pdev; 1279 pdev = adapter->pdev;
1281 frag = &buffer->frag_array[0]; 1280 if (buffer->skb) {
1282 skb = buffer->skb; 1281 frag = &buffer->frag_array[0];
1283 if (skb && (cmpxchg(&buffer->skb, skb, 0) == skb)) {
1284 pci_unmap_single(pdev, frag->dma, frag->length, 1282 pci_unmap_single(pdev, frag->dma, frag->length,
1285 PCI_DMA_TODEVICE); 1283 PCI_DMA_TODEVICE);
1286 frag->dma = 0ULL; 1284 frag->dma = 0ULL;
@@ -1293,8 +1291,8 @@ int netxen_process_cmd_ring(unsigned long data)
1293 } 1291 }
1294 1292
1295 adapter->stats.skbfreed++; 1293 adapter->stats.skbfreed++;
1296 dev_kfree_skb_any(skb); 1294 dev_kfree_skb_any(buffer->skb);
1297 skb = NULL; 1295 buffer->skb = NULL;
1298 } else if (adapter->proc_cmd_buf_counter == 1) { 1296 } else if (adapter->proc_cmd_buf_counter == 1) {
1299 adapter->stats.txnullskb++; 1297 adapter->stats.txnullskb++;
1300 } 1298 }
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 454226f7baa8..263b55e36c7a 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -732,11 +732,6 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
732 732
733 unregister_netdev(netdev); 733 unregister_netdev(netdev);
734 734
735 if (adapter->stop_port)
736 adapter->stop_port(adapter);
737
738 netxen_nic_disable_int(adapter);
739
740 if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) { 735 if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) {
741 init_firmware_done++; 736 init_firmware_done++;
742 netxen_free_hw_resources(adapter); 737 netxen_free_hw_resources(adapter);
@@ -919,6 +914,9 @@ static int netxen_nic_close(struct net_device *netdev)
919 netif_stop_queue(netdev); 914 netif_stop_queue(netdev);
920 napi_disable(&adapter->napi); 915 napi_disable(&adapter->napi);
921 916
917 if (adapter->stop_port)
918 adapter->stop_port(adapter);
919
922 netxen_nic_disable_int(adapter); 920 netxen_nic_disable_int(adapter);
923 921
924 cmd_buff = adapter->cmd_buf_arr; 922 cmd_buff = adapter->cmd_buf_arr;
@@ -996,28 +994,6 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
996 return NETDEV_TX_OK; 994 return NETDEV_TX_OK;
997 } 995 }
998 996
999 /*
1000 * Everything is set up. Now, we just need to transmit it out.
1001 * Note that we have to copy the contents of buffer over to
1002 * right place. Later on, this can be optimized out by de-coupling the
1003 * producer index from the buffer index.
1004 */
1005 retry_getting_window:
1006 spin_lock_bh(&adapter->tx_lock);
1007 if (adapter->total_threads >= MAX_XMIT_PRODUCERS) {
1008 spin_unlock_bh(&adapter->tx_lock);
1009 /*
1010 * Yield CPU
1011 */
1012 if (!in_atomic())
1013 schedule();
1014 else {
1015 for (i = 0; i < 20; i++)
1016 cpu_relax(); /*This a nop instr on i386 */
1017 }
1018 goto retry_getting_window;
1019 }
1020 local_producer = adapter->cmd_producer;
1021 /* There 4 fragments per descriptor */ 997 /* There 4 fragments per descriptor */
1022 no_of_desc = (frag_count + 3) >> 2; 998 no_of_desc = (frag_count + 3) >> 2;
1023 if (netdev->features & NETIF_F_TSO) { 999 if (netdev->features & NETIF_F_TSO) {
@@ -1031,16 +1007,19 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1031 } 1007 }
1032 } 1008 }
1033 } 1009 }
1010
1011 spin_lock_bh(&adapter->tx_lock);
1012 if (adapter->total_threads >= MAX_XMIT_PRODUCERS) {
1013 goto out_requeue;
1014 }
1015 local_producer = adapter->cmd_producer;
1034 k = adapter->cmd_producer; 1016 k = adapter->cmd_producer;
1035 max_tx_desc_count = adapter->max_tx_desc_count; 1017 max_tx_desc_count = adapter->max_tx_desc_count;
1036 last_cmd_consumer = adapter->last_cmd_consumer; 1018 last_cmd_consumer = adapter->last_cmd_consumer;
1037 if ((k + no_of_desc) >= 1019 if ((k + no_of_desc) >=
1038 ((last_cmd_consumer <= k) ? last_cmd_consumer + max_tx_desc_count : 1020 ((last_cmd_consumer <= k) ? last_cmd_consumer + max_tx_desc_count :
1039 last_cmd_consumer)) { 1021 last_cmd_consumer)) {
1040 netif_stop_queue(netdev); 1022 goto out_requeue;
1041 adapter->flags |= NETXEN_NETDEV_STATUS;
1042 spin_unlock_bh(&adapter->tx_lock);
1043 return NETDEV_TX_BUSY;
1044 } 1023 }
1045 k = get_index_range(k, max_tx_desc_count, no_of_desc); 1024 k = get_index_range(k, max_tx_desc_count, no_of_desc);
1046 adapter->cmd_producer = k; 1025 adapter->cmd_producer = k;
@@ -1093,6 +1072,8 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1093 adapter->max_tx_desc_count); 1072 adapter->max_tx_desc_count);
1094 hwdesc = &hw->cmd_desc_head[producer]; 1073 hwdesc = &hw->cmd_desc_head[producer];
1095 memset(hwdesc, 0, sizeof(struct cmd_desc_type0)); 1074 memset(hwdesc, 0, sizeof(struct cmd_desc_type0));
1075 pbuf = &adapter->cmd_buf_arr[producer];
1076 pbuf->skb = NULL;
1096 } 1077 }
1097 frag = &skb_shinfo(skb)->frags[i - 1]; 1078 frag = &skb_shinfo(skb)->frags[i - 1];
1098 len = frag->size; 1079 len = frag->size;
@@ -1148,6 +1129,8 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1148 } 1129 }
1149 /* copy the MAC/IP/TCP headers to the cmd descriptor list */ 1130 /* copy the MAC/IP/TCP headers to the cmd descriptor list */
1150 hwdesc = &hw->cmd_desc_head[producer]; 1131 hwdesc = &hw->cmd_desc_head[producer];
1132 pbuf = &adapter->cmd_buf_arr[producer];
1133 pbuf->skb = NULL;
1151 1134
1152 /* copy the first 64 bytes */ 1135 /* copy the first 64 bytes */
1153 memcpy(((void *)hwdesc) + 2, 1136 memcpy(((void *)hwdesc) + 2,
@@ -1156,6 +1139,8 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1156 1139
1157 if (more_hdr) { 1140 if (more_hdr) {
1158 hwdesc = &hw->cmd_desc_head[producer]; 1141 hwdesc = &hw->cmd_desc_head[producer];
1142 pbuf = &adapter->cmd_buf_arr[producer];
1143 pbuf->skb = NULL;
1159 /* copy the next 64 bytes - should be enough except 1144 /* copy the next 64 bytes - should be enough except
1160 * for pathological case 1145 * for pathological case
1161 */ 1146 */
@@ -1167,16 +1152,8 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1167 } 1152 }
1168 } 1153 }
1169 1154
1170 i = netxen_get_cmd_desc_totallength(&hw->cmd_desc_head[saved_producer]);
1171
1172 hw->cmd_desc_head[saved_producer].flags_opcode =
1173 cpu_to_le16(hw->cmd_desc_head[saved_producer].flags_opcode);
1174 hw->cmd_desc_head[saved_producer].num_of_buffers_total_length =
1175 cpu_to_le32(hw->cmd_desc_head[saved_producer].
1176 num_of_buffers_total_length);
1177
1178 spin_lock_bh(&adapter->tx_lock); 1155 spin_lock_bh(&adapter->tx_lock);
1179 adapter->stats.txbytes += i; 1156 adapter->stats.txbytes += skb->len;
1180 1157
1181 /* Code to update the adapter considering how many producer threads 1158 /* Code to update the adapter considering how many producer threads
1182 are currently working */ 1159 are currently working */
@@ -1189,14 +1166,17 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1189 } 1166 }
1190 1167
1191 adapter->stats.xmitfinished++; 1168 adapter->stats.xmitfinished++;
1192 spin_unlock_bh(&adapter->tx_lock);
1193
1194 netdev->trans_start = jiffies; 1169 netdev->trans_start = jiffies;
1195 1170
1196 DPRINTK(INFO, "wrote CMD producer %x to phantom\n", producer); 1171 spin_unlock_bh(&adapter->tx_lock);
1197
1198 DPRINTK(INFO, "Done. Send\n");
1199 return NETDEV_TX_OK; 1172 return NETDEV_TX_OK;
1173
1174out_requeue:
1175 netif_stop_queue(netdev);
1176 adapter->flags |= NETXEN_NETDEV_STATUS;
1177
1178 spin_unlock_bh(&adapter->tx_lock);
1179 return NETDEV_TX_BUSY;
1200} 1180}
1201 1181
1202static void netxen_watchdog(unsigned long v) 1182static void netxen_watchdog(unsigned long v)
diff --git a/drivers/net/netxen/netxen_nic_niu.c b/drivers/net/netxen/netxen_nic_niu.c
index 5b9e1b300fab..d04ecb77d08c 100644
--- a/drivers/net/netxen/netxen_nic_niu.c
+++ b/drivers/net/netxen/netxen_nic_niu.c
@@ -736,12 +736,12 @@ int netxen_niu_disable_xg_port(struct netxen_adapter *adapter)
736 __u32 mac_cfg; 736 __u32 mac_cfg;
737 u32 port = physical_port[adapter->portnum]; 737 u32 port = physical_port[adapter->portnum];
738 738
739 if (port != 0) 739 if (port > NETXEN_NIU_MAX_XG_PORTS)
740 return -EINVAL; 740 return -EINVAL;
741
741 mac_cfg = 0; 742 mac_cfg = 0;
742 netxen_xg_soft_reset(mac_cfg); 743 if (netxen_nic_hw_write_wx(adapter,
743 if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_XGE_CONFIG_0, 744 NETXEN_NIU_XGE_CONFIG_0 + (0x10000 * port), &mac_cfg, 4))
744 &mac_cfg, 4))
745 return -EIO; 745 return -EIO;
746 return 0; 746 return 0;
747} 747}
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index af8030981f10..3acfeeabdee1 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -2002,7 +2002,7 @@ static void rtl8169_set_magic_reg(void __iomem *ioaddr, unsigned mac_version)
2002 u32 clk; 2002 u32 clk;
2003 2003
2004 clk = RTL_R8(Config2) & PCI_Clock_66MHz; 2004 clk = RTL_R8(Config2) & PCI_Clock_66MHz;
2005 for (i = 0; i < ARRAY_SIZE(cfg2_info); i++) { 2005 for (i = 0; i < ARRAY_SIZE(cfg2_info); i++, p++) {
2006 if ((p->mac_version == mac_version) && (p->clk == clk)) { 2006 if ((p->mac_version == mac_version) && (p->clk == clk)) {
2007 RTL_W32(0x7c, p->val); 2007 RTL_W32(0x7c, p->val);
2008 break; 2008 break;
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 52ec89b82f64..7023bbe545ee 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -944,7 +944,6 @@ static void tx_init(struct sky2_port *sky2)
944 le = get_tx_le(sky2); 944 le = get_tx_le(sky2);
945 le->addr = 0; 945 le->addr = 0;
946 le->opcode = OP_ADDR64 | HW_OWNER; 946 le->opcode = OP_ADDR64 | HW_OWNER;
947 sky2->tx_addr64 = 0;
948} 947}
949 948
950static inline struct tx_ring_info *tx_le_re(struct sky2_port *sky2, 949static inline struct tx_ring_info *tx_le_re(struct sky2_port *sky2,
@@ -978,13 +977,11 @@ static void sky2_rx_add(struct sky2_port *sky2, u8 op,
978 dma_addr_t map, unsigned len) 977 dma_addr_t map, unsigned len)
979{ 978{
980 struct sky2_rx_le *le; 979 struct sky2_rx_le *le;
981 u32 hi = upper_32_bits(map);
982 980
983 if (sky2->rx_addr64 != hi) { 981 if (sizeof(dma_addr_t) > sizeof(u32)) {
984 le = sky2_next_rx(sky2); 982 le = sky2_next_rx(sky2);
985 le->addr = cpu_to_le32(hi); 983 le->addr = cpu_to_le32(upper_32_bits(map));
986 le->opcode = OP_ADDR64 | HW_OWNER; 984 le->opcode = OP_ADDR64 | HW_OWNER;
987 sky2->rx_addr64 = upper_32_bits(map + len);
988 } 985 }
989 986
990 le = sky2_next_rx(sky2); 987 le = sky2_next_rx(sky2);
@@ -1480,7 +1477,6 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
1480 struct tx_ring_info *re; 1477 struct tx_ring_info *re;
1481 unsigned i, len; 1478 unsigned i, len;
1482 dma_addr_t mapping; 1479 dma_addr_t mapping;
1483 u32 addr64;
1484 u16 mss; 1480 u16 mss;
1485 u8 ctrl; 1481 u8 ctrl;
1486 1482
@@ -1493,15 +1489,12 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
1493 1489
1494 len = skb_headlen(skb); 1490 len = skb_headlen(skb);
1495 mapping = pci_map_single(hw->pdev, skb->data, len, PCI_DMA_TODEVICE); 1491 mapping = pci_map_single(hw->pdev, skb->data, len, PCI_DMA_TODEVICE);
1496 addr64 = upper_32_bits(mapping);
1497 1492
1498 /* Send high bits if changed or crosses boundary */ 1493 /* Send high bits if needed */
1499 if (addr64 != sky2->tx_addr64 || 1494 if (sizeof(dma_addr_t) > sizeof(u32)) {
1500 upper_32_bits(mapping + len) != sky2->tx_addr64) {
1501 le = get_tx_le(sky2); 1495 le = get_tx_le(sky2);
1502 le->addr = cpu_to_le32(addr64); 1496 le->addr = cpu_to_le32(upper_32_bits(mapping));
1503 le->opcode = OP_ADDR64 | HW_OWNER; 1497 le->opcode = OP_ADDR64 | HW_OWNER;
1504 sky2->tx_addr64 = upper_32_bits(mapping + len);
1505 } 1498 }
1506 1499
1507 /* Check for TCP Segmentation Offload */ 1500 /* Check for TCP Segmentation Offload */
@@ -1582,13 +1575,12 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
1582 1575
1583 mapping = pci_map_page(hw->pdev, frag->page, frag->page_offset, 1576 mapping = pci_map_page(hw->pdev, frag->page, frag->page_offset,
1584 frag->size, PCI_DMA_TODEVICE); 1577 frag->size, PCI_DMA_TODEVICE);
1585 addr64 = upper_32_bits(mapping); 1578
1586 if (addr64 != sky2->tx_addr64) { 1579 if (sizeof(dma_addr_t) > sizeof(u32)) {
1587 le = get_tx_le(sky2); 1580 le = get_tx_le(sky2);
1588 le->addr = cpu_to_le32(addr64); 1581 le->addr = cpu_to_le32(upper_32_bits(mapping));
1589 le->ctrl = 0; 1582 le->ctrl = 0;
1590 le->opcode = OP_ADDR64 | HW_OWNER; 1583 le->opcode = OP_ADDR64 | HW_OWNER;
1591 sky2->tx_addr64 = addr64;
1592 } 1584 }
1593 1585
1594 le = get_tx_le(sky2); 1586 le = get_tx_le(sky2);
@@ -3957,7 +3949,7 @@ static __exit void sky2_debug_cleanup(void)
3957/* Initialize network device */ 3949/* Initialize network device */
3958static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw, 3950static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
3959 unsigned port, 3951 unsigned port,
3960 int highmem, int wol) 3952 int highmem)
3961{ 3953{
3962 struct sky2_port *sky2; 3954 struct sky2_port *sky2;
3963 struct net_device *dev = alloc_etherdev(sizeof(*sky2)); 3955 struct net_device *dev = alloc_etherdev(sizeof(*sky2));
@@ -3997,7 +3989,7 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
3997 sky2->speed = -1; 3989 sky2->speed = -1;
3998 sky2->advertising = sky2_supported_modes(hw); 3990 sky2->advertising = sky2_supported_modes(hw);
3999 sky2->rx_csum = (hw->chip_id != CHIP_ID_YUKON_XL); 3991 sky2->rx_csum = (hw->chip_id != CHIP_ID_YUKON_XL);
4000 sky2->wol = wol; 3992 sky2->wol = sky2_wol_supported(hw) & WAKE_MAGIC;
4001 3993
4002 spin_lock_init(&sky2->phy_lock); 3994 spin_lock_init(&sky2->phy_lock);
4003 sky2->tx_pending = TX_DEF_PENDING; 3995 sky2->tx_pending = TX_DEF_PENDING;
@@ -4094,24 +4086,12 @@ static int __devinit sky2_test_msi(struct sky2_hw *hw)
4094 return err; 4086 return err;
4095} 4087}
4096 4088
4097static int __devinit pci_wake_enabled(struct pci_dev *dev)
4098{
4099 int pm = pci_find_capability(dev, PCI_CAP_ID_PM);
4100 u16 value;
4101
4102 if (!pm)
4103 return 0;
4104 if (pci_read_config_word(dev, pm + PCI_PM_CTRL, &value))
4105 return 0;
4106 return value & PCI_PM_CTRL_PME_ENABLE;
4107}
4108
4109static int __devinit sky2_probe(struct pci_dev *pdev, 4089static int __devinit sky2_probe(struct pci_dev *pdev,
4110 const struct pci_device_id *ent) 4090 const struct pci_device_id *ent)
4111{ 4091{
4112 struct net_device *dev; 4092 struct net_device *dev;
4113 struct sky2_hw *hw; 4093 struct sky2_hw *hw;
4114 int err, using_dac = 0, wol_default; 4094 int err, using_dac = 0;
4115 4095
4116 err = pci_enable_device(pdev); 4096 err = pci_enable_device(pdev);
4117 if (err) { 4097 if (err) {
@@ -4144,8 +4124,6 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4144 } 4124 }
4145 } 4125 }
4146 4126
4147 wol_default = pci_wake_enabled(pdev) ? WAKE_MAGIC : 0;
4148
4149 err = -ENOMEM; 4127 err = -ENOMEM;
4150 hw = kzalloc(sizeof(*hw), GFP_KERNEL); 4128 hw = kzalloc(sizeof(*hw), GFP_KERNEL);
4151 if (!hw) { 4129 if (!hw) {
@@ -4189,7 +4167,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4189 4167
4190 sky2_reset(hw); 4168 sky2_reset(hw);
4191 4169
4192 dev = sky2_init_netdev(hw, 0, using_dac, wol_default); 4170 dev = sky2_init_netdev(hw, 0, using_dac);
4193 if (!dev) { 4171 if (!dev) {
4194 err = -ENOMEM; 4172 err = -ENOMEM;
4195 goto err_out_free_pci; 4173 goto err_out_free_pci;
@@ -4226,7 +4204,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4226 if (hw->ports > 1) { 4204 if (hw->ports > 1) {
4227 struct net_device *dev1; 4205 struct net_device *dev1;
4228 4206
4229 dev1 = sky2_init_netdev(hw, 1, using_dac, wol_default); 4207 dev1 = sky2_init_netdev(hw, 1, using_dac);
4230 if (!dev1) 4208 if (!dev1)
4231 dev_warn(&pdev->dev, "allocation for second device failed\n"); 4209 dev_warn(&pdev->dev, "allocation for second device failed\n");
4232 else if ((err = register_netdev(dev1))) { 4210 else if ((err = register_netdev(dev1))) {
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h
index bc646a47edd2..ffe9b8a50a1b 100644
--- a/drivers/net/sky2.h
+++ b/drivers/net/sky2.h
@@ -1991,14 +1991,14 @@ struct sky2_port {
1991 u16 tx_cons; /* next le to check */ 1991 u16 tx_cons; /* next le to check */
1992 u16 tx_prod; /* next le to use */ 1992 u16 tx_prod; /* next le to use */
1993 u16 tx_next; /* debug only */ 1993 u16 tx_next; /* debug only */
1994 u32 tx_addr64; 1994
1995 u16 tx_pending; 1995 u16 tx_pending;
1996 u16 tx_last_mss; 1996 u16 tx_last_mss;
1997 u32 tx_tcpsum; 1997 u32 tx_tcpsum;
1998 1998
1999 struct rx_ring_info *rx_ring ____cacheline_aligned_in_smp; 1999 struct rx_ring_info *rx_ring ____cacheline_aligned_in_smp;
2000 struct sky2_rx_le *rx_le; 2000 struct sky2_rx_le *rx_le;
2001 u32 rx_addr64; 2001
2002 u16 rx_next; /* next re to check */ 2002 u16 rx_next; /* next re to check */
2003 u16 rx_put; /* next le index to use */ 2003 u16 rx_put; /* next le index to use */
2004 u16 rx_pending; 2004 u16 rx_pending;
diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c
index 41f34bb91cad..6e8b18a3b3cc 100644
--- a/drivers/net/tulip/de4x5.c
+++ b/drivers/net/tulip/de4x5.c
@@ -911,7 +911,7 @@ static int de4x5_init(struct net_device *dev);
911static int de4x5_sw_reset(struct net_device *dev); 911static int de4x5_sw_reset(struct net_device *dev);
912static int de4x5_rx(struct net_device *dev); 912static int de4x5_rx(struct net_device *dev);
913static int de4x5_tx(struct net_device *dev); 913static int de4x5_tx(struct net_device *dev);
914static int de4x5_ast(struct net_device *dev); 914static void de4x5_ast(struct net_device *dev);
915static int de4x5_txur(struct net_device *dev); 915static int de4x5_txur(struct net_device *dev);
916static int de4x5_rx_ovfc(struct net_device *dev); 916static int de4x5_rx_ovfc(struct net_device *dev);
917 917
@@ -984,11 +984,9 @@ static int test_bad_enet(struct net_device *dev, int status);
984static int an_exception(struct de4x5_private *lp); 984static int an_exception(struct de4x5_private *lp);
985static char *build_setup_frame(struct net_device *dev, int mode); 985static char *build_setup_frame(struct net_device *dev, int mode);
986static void disable_ast(struct net_device *dev); 986static void disable_ast(struct net_device *dev);
987static void enable_ast(struct net_device *dev, u32 time_out);
988static long de4x5_switch_mac_port(struct net_device *dev); 987static long de4x5_switch_mac_port(struct net_device *dev);
989static int gep_rd(struct net_device *dev); 988static int gep_rd(struct net_device *dev);
990static void gep_wr(s32 data, struct net_device *dev); 989static void gep_wr(s32 data, struct net_device *dev);
991static void timeout(struct net_device *dev, void (*fn)(u_long data), u_long data, u_long msec);
992static void yawn(struct net_device *dev, int state); 990static void yawn(struct net_device *dev, int state);
993static void de4x5_parse_params(struct net_device *dev); 991static void de4x5_parse_params(struct net_device *dev);
994static void de4x5_dbg_open(struct net_device *dev); 992static void de4x5_dbg_open(struct net_device *dev);
@@ -1139,6 +1137,8 @@ de4x5_hw_init(struct net_device *dev, u_long iobase, struct device *gendev)
1139 lp->gendev = gendev; 1137 lp->gendev = gendev;
1140 spin_lock_init(&lp->lock); 1138 spin_lock_init(&lp->lock);
1141 init_timer(&lp->timer); 1139 init_timer(&lp->timer);
1140 lp->timer.function = (void (*)(unsigned long))de4x5_ast;
1141 lp->timer.data = (unsigned long)dev;
1142 de4x5_parse_params(dev); 1142 de4x5_parse_params(dev);
1143 1143
1144 /* 1144 /*
@@ -1311,7 +1311,7 @@ de4x5_open(struct net_device *dev)
1311 lp->state = OPEN; 1311 lp->state = OPEN;
1312 de4x5_dbg_open(dev); 1312 de4x5_dbg_open(dev);
1313 1313
1314 if (request_irq(dev->irq, (void *)de4x5_interrupt, IRQF_SHARED, 1314 if (request_irq(dev->irq, de4x5_interrupt, IRQF_SHARED,
1315 lp->adapter_name, dev)) { 1315 lp->adapter_name, dev)) {
1316 printk("de4x5_open(): Requested IRQ%d is busy - attemping FAST/SHARE...", dev->irq); 1316 printk("de4x5_open(): Requested IRQ%d is busy - attemping FAST/SHARE...", dev->irq);
1317 if (request_irq(dev->irq, de4x5_interrupt, IRQF_DISABLED | IRQF_SHARED, 1317 if (request_irq(dev->irq, de4x5_interrupt, IRQF_DISABLED | IRQF_SHARED,
@@ -1737,27 +1737,29 @@ de4x5_tx(struct net_device *dev)
1737 return 0; 1737 return 0;
1738} 1738}
1739 1739
1740static int 1740static void
1741de4x5_ast(struct net_device *dev) 1741de4x5_ast(struct net_device *dev)
1742{ 1742{
1743 struct de4x5_private *lp = netdev_priv(dev); 1743 struct de4x5_private *lp = netdev_priv(dev);
1744 int next_tick = DE4X5_AUTOSENSE_MS; 1744 int next_tick = DE4X5_AUTOSENSE_MS;
1745 int dt;
1745 1746
1746 disable_ast(dev); 1747 if (lp->useSROM)
1748 next_tick = srom_autoconf(dev);
1749 else if (lp->chipset == DC21140)
1750 next_tick = dc21140m_autoconf(dev);
1751 else if (lp->chipset == DC21041)
1752 next_tick = dc21041_autoconf(dev);
1753 else if (lp->chipset == DC21040)
1754 next_tick = dc21040_autoconf(dev);
1755 lp->linkOK = 0;
1747 1756
1748 if (lp->useSROM) { 1757 dt = (next_tick * HZ) / 1000;
1749 next_tick = srom_autoconf(dev);
1750 } else if (lp->chipset == DC21140) {
1751 next_tick = dc21140m_autoconf(dev);
1752 } else if (lp->chipset == DC21041) {
1753 next_tick = dc21041_autoconf(dev);
1754 } else if (lp->chipset == DC21040) {
1755 next_tick = dc21040_autoconf(dev);
1756 }
1757 lp->linkOK = 0;
1758 enable_ast(dev, next_tick);
1759 1758
1760 return 0; 1759 if (!dt)
1760 dt = 1;
1761
1762 mod_timer(&lp->timer, jiffies + dt);
1761} 1763}
1762 1764
1763static int 1765static int
@@ -2174,7 +2176,7 @@ srom_search(struct net_device *dev, struct pci_dev *pdev)
2174 for (j=0, i=0; i<ETH_ALEN; i++) { 2176 for (j=0, i=0; i<ETH_ALEN; i++) {
2175 j += (u_char) *((u_char *)&lp->srom + SROM_HWADD + i); 2177 j += (u_char) *((u_char *)&lp->srom + SROM_HWADD + i);
2176 } 2178 }
2177 if ((j != 0) && (j != 0x5fa)) { 2179 if (j != 0 && j != 6 * 0xff) {
2178 last.chipset = device; 2180 last.chipset = device;
2179 last.bus = pb; 2181 last.bus = pb;
2180 last.irq = irq; 2182 last.irq = irq;
@@ -2371,30 +2373,19 @@ static struct pci_driver de4x5_pci_driver = {
2371static int 2373static int
2372autoconf_media(struct net_device *dev) 2374autoconf_media(struct net_device *dev)
2373{ 2375{
2374 struct de4x5_private *lp = netdev_priv(dev); 2376 struct de4x5_private *lp = netdev_priv(dev);
2375 u_long iobase = dev->base_addr; 2377 u_long iobase = dev->base_addr;
2376 int next_tick = DE4X5_AUTOSENSE_MS;
2377 2378
2378 lp->linkOK = 0; 2379 disable_ast(dev);
2379 lp->c_media = AUTO; /* Bogus last media */
2380 disable_ast(dev);
2381 inl(DE4X5_MFC); /* Zero the lost frames counter */
2382 lp->media = INIT;
2383 lp->tcount = 0;
2384 2380
2385 if (lp->useSROM) { 2381 lp->c_media = AUTO; /* Bogus last media */
2386 next_tick = srom_autoconf(dev); 2382 inl(DE4X5_MFC); /* Zero the lost frames counter */
2387 } else if (lp->chipset == DC21040) { 2383 lp->media = INIT;
2388 next_tick = dc21040_autoconf(dev); 2384 lp->tcount = 0;
2389 } else if (lp->chipset == DC21041) {
2390 next_tick = dc21041_autoconf(dev);
2391 } else if (lp->chipset == DC21140) {
2392 next_tick = dc21140m_autoconf(dev);
2393 }
2394 2385
2395 enable_ast(dev, next_tick); 2386 de4x5_ast(dev);
2396 2387
2397 return (lp->media); 2388 return lp->media;
2398} 2389}
2399 2390
2400/* 2391/*
@@ -4018,20 +4009,22 @@ DevicePresent(struct net_device *dev, u_long aprom_addr)
4018 outl(0, aprom_addr); /* Reset Ethernet Address ROM Pointer */ 4009 outl(0, aprom_addr); /* Reset Ethernet Address ROM Pointer */
4019 } 4010 }
4020 } else { /* Read new srom */ 4011 } else { /* Read new srom */
4021 u_short tmp, *p = (short *)((char *)&lp->srom + SROM_HWADD); 4012 u_short tmp;
4013 __le16 *p = (__le16 *)((char *)&lp->srom + SROM_HWADD);
4022 for (i=0; i<(ETH_ALEN>>1); i++) { 4014 for (i=0; i<(ETH_ALEN>>1); i++) {
4023 tmp = srom_rd(aprom_addr, (SROM_HWADD>>1) + i); 4015 tmp = srom_rd(aprom_addr, (SROM_HWADD>>1) + i);
4024 *p = le16_to_cpu(tmp); 4016 j += tmp; /* for check for 0:0:0:0:0:0 or ff:ff:ff:ff:ff:ff */
4025 j += *p++; 4017 *p = cpu_to_le16(tmp);
4026 } 4018 }
4027 if ((j == 0) || (j == 0x2fffd)) { 4019 if (j == 0 || j == 3 * 0xffff) {
4028 return; 4020 /* could get 0 only from all-0 and 3 * 0xffff only from all-1 */
4021 return;
4029 } 4022 }
4030 4023
4031 p=(short *)&lp->srom; 4024 p = (__le16 *)&lp->srom;
4032 for (i=0; i<(sizeof(struct de4x5_srom)>>1); i++) { 4025 for (i=0; i<(sizeof(struct de4x5_srom)>>1); i++) {
4033 tmp = srom_rd(aprom_addr, i); 4026 tmp = srom_rd(aprom_addr, i);
4034 *p++ = le16_to_cpu(tmp); 4027 *p++ = cpu_to_le16(tmp);
4035 } 4028 }
4036 de4x5_dbg_srom((struct de4x5_srom *)&lp->srom); 4029 de4x5_dbg_srom((struct de4x5_srom *)&lp->srom);
4037 } 4030 }
@@ -5161,21 +5154,10 @@ build_setup_frame(struct net_device *dev, int mode)
5161} 5154}
5162 5155
5163static void 5156static void
5164enable_ast(struct net_device *dev, u32 time_out)
5165{
5166 timeout(dev, (void *)&de4x5_ast, (u_long)dev, time_out);
5167
5168 return;
5169}
5170
5171static void
5172disable_ast(struct net_device *dev) 5157disable_ast(struct net_device *dev)
5173{ 5158{
5174 struct de4x5_private *lp = netdev_priv(dev); 5159 struct de4x5_private *lp = netdev_priv(dev);
5175 5160 del_timer_sync(&lp->timer);
5176 del_timer(&lp->timer);
5177
5178 return;
5179} 5161}
5180 5162
5181static long 5163static long
@@ -5245,29 +5227,6 @@ gep_rd(struct net_device *dev)
5245} 5227}
5246 5228
5247static void 5229static void
5248timeout(struct net_device *dev, void (*fn)(u_long data), u_long data, u_long msec)
5249{
5250 struct de4x5_private *lp = netdev_priv(dev);
5251 int dt;
5252
5253 /* First, cancel any pending timer events */
5254 del_timer(&lp->timer);
5255
5256 /* Convert msec to ticks */
5257 dt = (msec * HZ) / 1000;
5258 if (dt==0) dt=1;
5259
5260 /* Set up timer */
5261 init_timer(&lp->timer);
5262 lp->timer.expires = jiffies + dt;
5263 lp->timer.function = fn;
5264 lp->timer.data = data;
5265 add_timer(&lp->timer);
5266
5267 return;
5268}
5269
5270static void
5271yawn(struct net_device *dev, int state) 5230yawn(struct net_device *dev, int state)
5272{ 5231{
5273 struct de4x5_private *lp = netdev_priv(dev); 5232 struct de4x5_private *lp = netdev_priv(dev);
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
index e5e2c9c4ebfe..ed600bf56e78 100644
--- a/drivers/net/tulip/tulip_core.c
+++ b/drivers/net/tulip/tulip_core.c
@@ -797,7 +797,8 @@ static int tulip_close (struct net_device *dev)
797 797
798 tp->rx_ring[i].status = 0; /* Not owned by Tulip chip. */ 798 tp->rx_ring[i].status = 0; /* Not owned by Tulip chip. */
799 tp->rx_ring[i].length = 0; 799 tp->rx_ring[i].length = 0;
800 tp->rx_ring[i].buffer1 = 0xBADF00D0; /* An invalid address. */ 800 /* An invalid address. */
801 tp->rx_ring[i].buffer1 = cpu_to_le32(0xBADF00D0);
801 if (skb) { 802 if (skb) {
802 pci_unmap_single(tp->pdev, mapping, PKT_BUF_SZ, 803 pci_unmap_single(tp->pdev, mapping, PKT_BUF_SZ,
803 PCI_DMA_FROMDEVICE); 804 PCI_DMA_FROMDEVICE);
diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c
index 70befe33e454..8fc7274642eb 100644
--- a/drivers/net/tulip/xircom_cb.c
+++ b/drivers/net/tulip/xircom_cb.c
@@ -83,8 +83,8 @@ static int bufferoffsets[NUMDESCRIPTORS] = {128,2048,4096,6144};
83struct xircom_private { 83struct xircom_private {
84 /* Send and receive buffers, kernel-addressable and dma addressable forms */ 84 /* Send and receive buffers, kernel-addressable and dma addressable forms */
85 85
86 unsigned int *rx_buffer; 86 __le32 *rx_buffer;
87 unsigned int *tx_buffer; 87 __le32 *tx_buffer;
88 88
89 dma_addr_t rx_dma_handle; 89 dma_addr_t rx_dma_handle;
90 dma_addr_t tx_dma_handle; 90 dma_addr_t tx_dma_handle;
@@ -412,19 +412,20 @@ static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev)
412 /* FIXME: The specification tells us that the length we send HAS to be a multiple of 412 /* FIXME: The specification tells us that the length we send HAS to be a multiple of
413 4 bytes. */ 413 4 bytes. */
414 414
415 card->tx_buffer[4*desc+1] = skb->len; 415 card->tx_buffer[4*desc+1] = cpu_to_le32(skb->len);
416 if (desc == NUMDESCRIPTORS-1) 416 if (desc == NUMDESCRIPTORS - 1) /* bit 25: last descriptor of the ring */
417 card->tx_buffer[4*desc+1] |= (1<<25); /* bit 25: last descriptor of the ring */ 417 card->tx_buffer[4*desc+1] |= cpu_to_le32(1<<25);
418 418
419 card->tx_buffer[4*desc+1] |= 0xF0000000; 419 card->tx_buffer[4*desc+1] |= cpu_to_le32(0xF0000000);
420 /* 0xF0... means want interrupts*/ 420 /* 0xF0... means want interrupts*/
421 card->tx_skb[desc] = skb; 421 card->tx_skb[desc] = skb;
422 422
423 wmb(); 423 wmb();
424 /* This gives the descriptor to the card */ 424 /* This gives the descriptor to the card */
425 card->tx_buffer[4*desc] = 0x80000000; 425 card->tx_buffer[4*desc] = cpu_to_le32(0x80000000);
426 trigger_transmit(card); 426 trigger_transmit(card);
427 if (((int)card->tx_buffer[nextdescriptor*4])<0) { /* next descriptor is occupied... */ 427 if (card->tx_buffer[nextdescriptor*4] & cpu_to_le32(0x8000000)) {
428 /* next descriptor is occupied... */
428 netif_stop_queue(dev); 429 netif_stop_queue(dev);
429 } 430 }
430 card->transmit_used = nextdescriptor; 431 card->transmit_used = nextdescriptor;
@@ -590,8 +591,7 @@ descriptors and programs the addresses into the card.
590*/ 591*/
591static void setup_descriptors(struct xircom_private *card) 592static void setup_descriptors(struct xircom_private *card)
592{ 593{
593 unsigned int val; 594 u32 address;
594 unsigned int address;
595 int i; 595 int i;
596 enter("setup_descriptors"); 596 enter("setup_descriptors");
597 597
@@ -604,16 +604,16 @@ static void setup_descriptors(struct xircom_private *card)
604 for (i=0;i<NUMDESCRIPTORS;i++ ) { 604 for (i=0;i<NUMDESCRIPTORS;i++ ) {
605 605
606 /* Rx Descr0: It's empty, let the card own it, no errors -> 0x80000000 */ 606 /* Rx Descr0: It's empty, let the card own it, no errors -> 0x80000000 */
607 card->rx_buffer[i*4 + 0] = 0x80000000; 607 card->rx_buffer[i*4 + 0] = cpu_to_le32(0x80000000);
608 /* Rx Descr1: buffer 1 is 1536 bytes, buffer 2 is 0 bytes */ 608 /* Rx Descr1: buffer 1 is 1536 bytes, buffer 2 is 0 bytes */
609 card->rx_buffer[i*4 + 1] = 1536; 609 card->rx_buffer[i*4 + 1] = cpu_to_le32(1536);
610 if (i==NUMDESCRIPTORS-1) 610 if (i == NUMDESCRIPTORS - 1) /* bit 25 is "last descriptor" */
611 card->rx_buffer[i*4 + 1] |= (1 << 25); /* bit 25 is "last descriptor" */ 611 card->rx_buffer[i*4 + 1] |= cpu_to_le32(1 << 25);
612 612
613 /* Rx Descr2: address of the buffer 613 /* Rx Descr2: address of the buffer
614 we store the buffer at the 2nd half of the page */ 614 we store the buffer at the 2nd half of the page */
615 615
616 address = (unsigned long) card->rx_dma_handle; 616 address = card->rx_dma_handle;
617 card->rx_buffer[i*4 + 2] = cpu_to_le32(address + bufferoffsets[i]); 617 card->rx_buffer[i*4 + 2] = cpu_to_le32(address + bufferoffsets[i]);
618 /* Rx Desc3: address of 2nd buffer -> 0 */ 618 /* Rx Desc3: address of 2nd buffer -> 0 */
619 card->rx_buffer[i*4 + 3] = 0; 619 card->rx_buffer[i*4 + 3] = 0;
@@ -621,9 +621,8 @@ static void setup_descriptors(struct xircom_private *card)
621 621
622 wmb(); 622 wmb();
623 /* Write the receive descriptor ring address to the card */ 623 /* Write the receive descriptor ring address to the card */
624 address = (unsigned long) card->rx_dma_handle; 624 address = card->rx_dma_handle;
625 val = cpu_to_le32(address); 625 outl(address, card->io_port + CSR3); /* Receive descr list address */
626 outl(val, card->io_port + CSR3); /* Receive descr list address */
627 626
628 627
629 /* transmit descriptors */ 628 /* transmit descriptors */
@@ -633,13 +632,13 @@ static void setup_descriptors(struct xircom_private *card)
633 /* Tx Descr0: Empty, we own it, no errors -> 0x00000000 */ 632 /* Tx Descr0: Empty, we own it, no errors -> 0x00000000 */
634 card->tx_buffer[i*4 + 0] = 0x00000000; 633 card->tx_buffer[i*4 + 0] = 0x00000000;
635 /* Tx Descr1: buffer 1 is 1536 bytes, buffer 2 is 0 bytes */ 634 /* Tx Descr1: buffer 1 is 1536 bytes, buffer 2 is 0 bytes */
636 card->tx_buffer[i*4 + 1] = 1536; 635 card->tx_buffer[i*4 + 1] = cpu_to_le32(1536);
637 if (i==NUMDESCRIPTORS-1) 636 if (i == NUMDESCRIPTORS - 1) /* bit 25 is "last descriptor" */
638 card->tx_buffer[i*4 + 1] |= (1 << 25); /* bit 25 is "last descriptor" */ 637 card->tx_buffer[i*4 + 1] |= cpu_to_le32(1 << 25);
639 638
640 /* Tx Descr2: address of the buffer 639 /* Tx Descr2: address of the buffer
641 we store the buffer at the 2nd half of the page */ 640 we store the buffer at the 2nd half of the page */
642 address = (unsigned long) card->tx_dma_handle; 641 address = card->tx_dma_handle;
643 card->tx_buffer[i*4 + 2] = cpu_to_le32(address + bufferoffsets[i]); 642 card->tx_buffer[i*4 + 2] = cpu_to_le32(address + bufferoffsets[i]);
644 /* Tx Desc3: address of 2nd buffer -> 0 */ 643 /* Tx Desc3: address of 2nd buffer -> 0 */
645 card->tx_buffer[i*4 + 3] = 0; 644 card->tx_buffer[i*4 + 3] = 0;
@@ -647,9 +646,8 @@ static void setup_descriptors(struct xircom_private *card)
647 646
648 wmb(); 647 wmb();
649 /* wite the transmit descriptor ring to the card */ 648 /* wite the transmit descriptor ring to the card */
650 address = (unsigned long) card->tx_dma_handle; 649 address = card->tx_dma_handle;
651 val =cpu_to_le32(address); 650 outl(address, card->io_port + CSR4); /* xmit descr list address */
652 outl(val, card->io_port + CSR4); /* xmit descr list address */
653 651
654 leave("setup_descriptors"); 652 leave("setup_descriptors");
655} 653}
@@ -1180,7 +1178,7 @@ static void investigate_read_descriptor(struct net_device *dev,struct xircom_pri
1180 int status; 1178 int status;
1181 1179
1182 enter("investigate_read_descriptor"); 1180 enter("investigate_read_descriptor");
1183 status = card->rx_buffer[4*descnr]; 1181 status = le32_to_cpu(card->rx_buffer[4*descnr]);
1184 1182
1185 if ((status > 0)) { /* packet received */ 1183 if ((status > 0)) { /* packet received */
1186 1184
@@ -1210,7 +1208,7 @@ static void investigate_read_descriptor(struct net_device *dev,struct xircom_pri
1210 1208
1211 out: 1209 out:
1212 /* give the buffer back to the card */ 1210 /* give the buffer back to the card */
1213 card->rx_buffer[4*descnr] = 0x80000000; 1211 card->rx_buffer[4*descnr] = cpu_to_le32(0x80000000);
1214 trigger_receive(card); 1212 trigger_receive(card);
1215 } 1213 }
1216 1214
@@ -1226,7 +1224,7 @@ static void investigate_write_descriptor(struct net_device *dev, struct xircom_p
1226 1224
1227 enter("investigate_write_descriptor"); 1225 enter("investigate_write_descriptor");
1228 1226
1229 status = card->tx_buffer[4*descnr]; 1227 status = le32_to_cpu(card->tx_buffer[4*descnr]);
1230#if 0 1228#if 0
1231 if (status & 0x8000) { /* Major error */ 1229 if (status & 0x8000) { /* Major error */
1232 printk(KERN_ERR "Major transmit error status %x \n", status); 1230 printk(KERN_ERR "Major transmit error status %x \n", status);
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index 1249f444039e..569028b2baf2 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -202,10 +202,10 @@ static int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
202 buf, 202 buf,
203 size, 203 size,
204 USB_CTRL_GET_TIMEOUT); 204 USB_CTRL_GET_TIMEOUT);
205 if (err >= 0 && err < size) 205 if (err == size)
206 err = -EINVAL;
207 if (!err)
208 memcpy(data, buf, size); 206 memcpy(data, buf, size);
207 else if (err >= 0)
208 err = -EINVAL;
209 kfree(buf); 209 kfree(buf);
210 210
211out: 211out:
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 50775f9234cc..18b1f9145389 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -257,7 +257,7 @@ static const struct rt2x00debug rt2500usb_rt2x00debug = {
257static void rt2500usb_config_mac_addr(struct rt2x00_dev *rt2x00dev, 257static void rt2500usb_config_mac_addr(struct rt2x00_dev *rt2x00dev,
258 __le32 *mac) 258 __le32 *mac)
259{ 259{
260 rt2500usb_register_multiwrite(rt2x00dev, MAC_CSR2, &mac, 260 rt2500usb_register_multiwrite(rt2x00dev, MAC_CSR2, mac,
261 (3 * sizeof(__le16))); 261 (3 * sizeof(__le16)));
262} 262}
263 263
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c
index 2780df00623c..6d5d9aba0b73 100644
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -124,7 +124,10 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev)
124 struct data_entry *entry; 124 struct data_entry *entry;
125 struct data_desc *rxd; 125 struct data_desc *rxd;
126 struct sk_buff *skb; 126 struct sk_buff *skb;
127 struct ieee80211_hdr *hdr;
127 struct rxdata_entry_desc desc; 128 struct rxdata_entry_desc desc;
129 int header_size;
130 int align;
128 u32 word; 131 u32 word;
129 132
130 while (1) { 133 while (1) {
@@ -138,17 +141,26 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev)
138 memset(&desc, 0x00, sizeof(desc)); 141 memset(&desc, 0x00, sizeof(desc));
139 rt2x00dev->ops->lib->fill_rxdone(entry, &desc); 142 rt2x00dev->ops->lib->fill_rxdone(entry, &desc);
140 143
144 hdr = (struct ieee80211_hdr *)entry->data_addr;
145 header_size =
146 ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control));
147
148 /*
149 * The data behind the ieee80211 header must be
150 * aligned on a 4 byte boundary.
151 */
152 align = NET_IP_ALIGN + (2 * (header_size % 4 == 0));
153
141 /* 154 /*
142 * Allocate the sk_buffer, initialize it and copy 155 * Allocate the sk_buffer, initialize it and copy
143 * all data into it. 156 * all data into it.
144 */ 157 */
145 skb = dev_alloc_skb(desc.size + NET_IP_ALIGN); 158 skb = dev_alloc_skb(desc.size + align);
146 if (!skb) 159 if (!skb)
147 return; 160 return;
148 161
149 skb_reserve(skb, NET_IP_ALIGN); 162 skb_reserve(skb, align);
150 skb_put(skb, desc.size); 163 memcpy(skb_put(skb, desc.size), entry->data_addr, desc.size);
151 memcpy(skb->data, entry->data_addr, desc.size);
152 164
153 /* 165 /*
154 * Send the frame to rt2x00lib for further processing. 166 * Send the frame to rt2x00lib for further processing.
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 1f5675dd329f..ab4797ed94c9 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -221,7 +221,9 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)
221 struct data_ring *ring = entry->ring; 221 struct data_ring *ring = entry->ring;
222 struct rt2x00_dev *rt2x00dev = ring->rt2x00dev; 222 struct rt2x00_dev *rt2x00dev = ring->rt2x00dev;
223 struct sk_buff *skb; 223 struct sk_buff *skb;
224 struct ieee80211_hdr *hdr;
224 struct rxdata_entry_desc desc; 225 struct rxdata_entry_desc desc;
226 int header_size;
225 int frame_size; 227 int frame_size;
226 228
227 if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) || 229 if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) ||
@@ -253,9 +255,20 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)
253 skb_put(skb, frame_size); 255 skb_put(skb, frame_size);
254 256
255 /* 257 /*
256 * Trim the skb_buffer to only contain the valid 258 * The data behind the ieee80211 header must be
257 * frame data (so ignore the device's descriptor). 259 * aligned on a 4 byte boundary.
260 * After that trim the entire buffer down to only
261 * contain the valid frame data excluding the device
262 * descriptor.
258 */ 263 */
264 hdr = (struct ieee80211_hdr *)entry->skb->data;
265 header_size =
266 ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control));
267
268 if (header_size % 4 == 0) {
269 skb_push(entry->skb, 2);
270 memmove(entry->skb->data, entry->skb->data + 2, skb->len - 2);
271 }
259 skb_trim(entry->skb, desc.size); 272 skb_trim(entry->skb, desc.size);
260 273
261 /* 274 /*
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 01dbef19d651..ecae968ce091 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -1738,6 +1738,7 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev)
1738{ 1738{
1739 struct data_ring *ring; 1739 struct data_ring *ring;
1740 struct data_entry *entry; 1740 struct data_entry *entry;
1741 struct data_entry *entry_done;
1741 struct data_desc *txd; 1742 struct data_desc *txd;
1742 u32 word; 1743 u32 word;
1743 u32 reg; 1744 u32 reg;
@@ -1791,6 +1792,17 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev)
1791 !rt2x00_get_field32(word, TXD_W0_VALID)) 1792 !rt2x00_get_field32(word, TXD_W0_VALID))
1792 return; 1793 return;
1793 1794
1795 entry_done = rt2x00_get_data_entry_done(ring);
1796 while (entry != entry_done) {
1797 /* Catch up. Just report any entries we missed as
1798 * failed. */
1799 WARNING(rt2x00dev,
1800 "TX status report missed for entry %p\n",
1801 entry_done);
1802 rt2x00lib_txdone(entry_done, TX_FAIL_OTHER, 0);
1803 entry_done = rt2x00_get_data_entry_done(ring);
1804 }
1805
1794 /* 1806 /*
1795 * Obtain the status about this packet. 1807 * Obtain the status about this packet.
1796 */ 1808 */