aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/82596.c7
-rw-r--r--drivers/net/Kconfig2
-rw-r--r--drivers/net/apne.c3
-rw-r--r--drivers/net/atlx/atl1.c1
-rw-r--r--drivers/net/cs89x0.c10
-rw-r--r--drivers/net/irda/Kconfig1
-rw-r--r--drivers/net/irda/irda-usb.c2
-rw-r--r--drivers/net/irda/irda-usb.h4
-rw-r--r--drivers/net/mac89x0.c3
-rw-r--r--drivers/net/macmace.c3
-rw-r--r--drivers/net/myri10ge/myri10ge.c2
-rw-r--r--drivers/net/pppol2tp.c111
-rw-r--r--drivers/net/sc92031.c2
-rw-r--r--drivers/net/sfc/falcon_xmac.c2
-rw-r--r--drivers/net/sun3lance.c3
-rw-r--r--drivers/net/sunhme.c4
-rw-r--r--drivers/net/tg3.c29
-rw-r--r--drivers/net/tulip/tulip_core.c10
-rw-r--r--drivers/net/ucc_geth_ethtool.c3
-rw-r--r--drivers/net/usb/cdc_subset.c2
-rw-r--r--drivers/net/virtio_net.c36
-rw-r--r--drivers/net/wireless/airo.c2
-rw-r--r--drivers/net/wireless/atmel.c2
-rw-r--r--drivers/net/wireless/b43/Kconfig2
-rw-r--r--drivers/net/wireless/b43/b43.h1
-rw-r--r--drivers/net/wireless/b43/main.c70
-rw-r--r--drivers/net/wireless/b43legacy/Kconfig2
-rw-r--r--drivers/net/wireless/b43legacy/main.c17
-rw-r--r--drivers/net/wireless/ipw2200.c203
-rw-r--r--drivers/net/wireless/ipw2200.h6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-led.c5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965-rs.c3
-rw-r--r--drivers/net/wireless/libertas/cmd.c5
-rw-r--r--drivers/net/wireless/libertas/debugfs.c4
-rw-r--r--drivers/net/wireless/libertas/main.c2
-rw-r--r--drivers/net/wireless/p54/p54usb.c1
-rw-r--r--drivers/net/wireless/rndis_wlan.c65
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h5
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00config.c1
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c6
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00mac.c1
-rw-r--r--drivers/net/wireless/rtl8180_grf5101.c2
-rw-r--r--drivers/net/wireless/rtl8180_max2820.c5
-rw-r--r--drivers/net/wireless/rtl8180_sa2400.c2
-rw-r--r--drivers/net/wireless/zd1211rw/zd_mac.c2
45 files changed, 464 insertions, 190 deletions
diff --git a/drivers/net/82596.c b/drivers/net/82596.c
index 2797da7eeee6..da292e647eb1 100644
--- a/drivers/net/82596.c
+++ b/drivers/net/82596.c
@@ -1162,6 +1162,7 @@ struct net_device * __init i82596_probe(int unit)
1162 memcpy(eth_addr, (void *) 0xfffc1f2c, 6); /* YUCK! Get addr from NOVRAM */ 1162 memcpy(eth_addr, (void *) 0xfffc1f2c, 6); /* YUCK! Get addr from NOVRAM */
1163 dev->base_addr = MVME_I596_BASE; 1163 dev->base_addr = MVME_I596_BASE;
1164 dev->irq = (unsigned) MVME16x_IRQ_I596; 1164 dev->irq = (unsigned) MVME16x_IRQ_I596;
1165 goto found;
1165 } 1166 }
1166#endif 1167#endif
1167#ifdef ENABLE_BVME6000_NET 1168#ifdef ENABLE_BVME6000_NET
@@ -1176,6 +1177,7 @@ struct net_device * __init i82596_probe(int unit)
1176 rtc[3] = msr; 1177 rtc[3] = msr;
1177 dev->base_addr = BVME_I596_BASE; 1178 dev->base_addr = BVME_I596_BASE;
1178 dev->irq = (unsigned) BVME_IRQ_I596; 1179 dev->irq = (unsigned) BVME_IRQ_I596;
1180 goto found;
1179 } 1181 }
1180#endif 1182#endif
1181#ifdef ENABLE_APRICOT 1183#ifdef ENABLE_APRICOT
@@ -1212,8 +1214,13 @@ struct net_device * __init i82596_probe(int unit)
1212 } 1214 }
1213 1215
1214 dev->irq = 10; 1216 dev->irq = 10;
1217 goto found;
1215 } 1218 }
1216#endif 1219#endif
1220 err = -ENODEV;
1221 goto out;
1222
1223found:
1217 dev->mem_start = (int)__get_free_pages(GFP_ATOMIC, 0); 1224 dev->mem_start = (int)__get_free_pages(GFP_ATOMIC, 0);
1218 if (!dev->mem_start) { 1225 if (!dev->mem_start) {
1219 err = -ENOMEM; 1226 err = -ENOMEM;
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 654a78c31087..c537f53ffcb9 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -1353,7 +1353,7 @@ config APRICOT
1353 1353
1354config B44 1354config B44
1355 tristate "Broadcom 440x/47xx ethernet support" 1355 tristate "Broadcom 440x/47xx ethernet support"
1356 depends on SSB_POSSIBLE 1356 depends on SSB_POSSIBLE && HAS_DMA
1357 select SSB 1357 select SSB
1358 select MII 1358 select MII
1359 help 1359 help
diff --git a/drivers/net/apne.c b/drivers/net/apne.c
index 47a8275d3962..867f6fff543c 100644
--- a/drivers/net/apne.c
+++ b/drivers/net/apne.c
@@ -127,6 +127,9 @@ struct net_device * __init apne_probe(int unit)
127#endif 127#endif
128 int err; 128 int err;
129 129
130 if (!MACH_IS_AMIGA)
131 return ERR_PTR(-ENODEV);
132
130 if (apne_owned) 133 if (apne_owned)
131 return ERR_PTR(-ENODEV); 134 return ERR_PTR(-ENODEV);
132 135
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index db04bfb3460f..32dc391e63cc 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -2024,6 +2024,7 @@ rrd_ok:
2024 /* Good Receive */ 2024 /* Good Receive */
2025 pci_unmap_page(adapter->pdev, buffer_info->dma, 2025 pci_unmap_page(adapter->pdev, buffer_info->dma,
2026 buffer_info->length, PCI_DMA_FROMDEVICE); 2026 buffer_info->length, PCI_DMA_FROMDEVICE);
2027 buffer_info->dma = 0;
2027 skb = buffer_info->skb; 2028 skb = buffer_info->skb;
2028 length = le16_to_cpu(rrd->xsz.xsum_sz.pkt_size); 2029 length = le16_to_cpu(rrd->xsz.xsum_sz.pkt_size);
2029 2030
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c
index 348371fda597..fba87abe78ee 100644
--- a/drivers/net/cs89x0.c
+++ b/drivers/net/cs89x0.c
@@ -1394,7 +1394,11 @@ net_open(struct net_device *dev)
1394#endif 1394#endif
1395 if (!result) { 1395 if (!result) {
1396 printk(KERN_ERR "%s: EEPROM is configured for unavailable media\n", dev->name); 1396 printk(KERN_ERR "%s: EEPROM is configured for unavailable media\n", dev->name);
1397 release_irq: 1397release_dma:
1398#if ALLOW_DMA
1399 free_dma(dev->dma);
1400#endif
1401release_irq:
1398#if ALLOW_DMA 1402#if ALLOW_DMA
1399 release_dma_buff(lp); 1403 release_dma_buff(lp);
1400#endif 1404#endif
@@ -1442,12 +1446,12 @@ net_open(struct net_device *dev)
1442 if ((result = detect_bnc(dev)) != DETECTED_NONE) 1446 if ((result = detect_bnc(dev)) != DETECTED_NONE)
1443 break; 1447 break;
1444 printk(KERN_ERR "%s: no media detected\n", dev->name); 1448 printk(KERN_ERR "%s: no media detected\n", dev->name);
1445 goto release_irq; 1449 goto release_dma;
1446 } 1450 }
1447 switch(result) { 1451 switch(result) {
1448 case DETECTED_NONE: 1452 case DETECTED_NONE:
1449 printk(KERN_ERR "%s: no network cable attached to configured media\n", dev->name); 1453 printk(KERN_ERR "%s: no network cable attached to configured media\n", dev->name);
1450 goto release_irq; 1454 goto release_dma;
1451 case DETECTED_RJ45H: 1455 case DETECTED_RJ45H:
1452 printk(KERN_INFO "%s: using half-duplex 10Base-T (RJ-45)\n", dev->name); 1456 printk(KERN_INFO "%s: using half-duplex 10Base-T (RJ-45)\n", dev->name);
1453 break; 1457 break;
diff --git a/drivers/net/irda/Kconfig b/drivers/net/irda/Kconfig
index ce816ba9c40d..e6317557a531 100644
--- a/drivers/net/irda/Kconfig
+++ b/drivers/net/irda/Kconfig
@@ -329,6 +329,7 @@ config PXA_FICP
329config MCS_FIR 329config MCS_FIR
330 tristate "MosChip MCS7780 IrDA-USB dongle" 330 tristate "MosChip MCS7780 IrDA-USB dongle"
331 depends on IRDA && USB && EXPERIMENTAL 331 depends on IRDA && USB && EXPERIMENTAL
332 select CRC32
332 help 333 help
333 Say Y or M here if you want to build support for the MosChip 334 Say Y or M here if you want to build support for the MosChip
334 MCS7780 IrDA-USB bridge device driver. 335 MCS7780 IrDA-USB bridge device driver.
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
index 9081234ab458..6f50ed7b183f 100644
--- a/drivers/net/irda/irda-usb.c
+++ b/drivers/net/irda/irda-usb.c
@@ -1120,7 +1120,7 @@ static int stir421x_patch_device(struct irda_usb_cb *self)
1120 } 1120 }
1121 } 1121 }
1122 1122
1123 if (self->usbdev->descriptor.bcdDevice == fw_version) { 1123 if (self->usbdev->descriptor.bcdDevice == cpu_to_le16(fw_version)) {
1124 /* 1124 /*
1125 * If we're here, we've found a correct patch 1125 * If we're here, we've found a correct patch
1126 * The actual image starts after the "STMP" keyword 1126 * The actual image starts after the "STMP" keyword
diff --git a/drivers/net/irda/irda-usb.h b/drivers/net/irda/irda-usb.h
index e846c38224a3..a0ca9c1fe196 100644
--- a/drivers/net/irda/irda-usb.h
+++ b/drivers/net/irda/irda-usb.h
@@ -117,11 +117,11 @@
117struct irda_class_desc { 117struct irda_class_desc {
118 __u8 bLength; 118 __u8 bLength;
119 __u8 bDescriptorType; 119 __u8 bDescriptorType;
120 __u16 bcdSpecRevision; 120 __le16 bcdSpecRevision;
121 __u8 bmDataSize; 121 __u8 bmDataSize;
122 __u8 bmWindowSize; 122 __u8 bmWindowSize;
123 __u8 bmMinTurnaroundTime; 123 __u8 bmMinTurnaroundTime;
124 __u16 wBaudRate; 124 __le16 wBaudRate;
125 __u8 bmAdditionalBOFs; 125 __u8 bmAdditionalBOFs;
126 __u8 bIrdaRateSniff; 126 __u8 bIrdaRateSniff;
127 __u8 bMaxUnicastList; 127 __u8 bMaxUnicastList;
diff --git a/drivers/net/mac89x0.c b/drivers/net/mac89x0.c
index 2a66e5b7cebc..4ce8afd481c3 100644
--- a/drivers/net/mac89x0.c
+++ b/drivers/net/mac89x0.c
@@ -183,6 +183,9 @@ struct net_device * __init mac89x0_probe(int unit)
183 int err = -ENODEV; 183 int err = -ENODEV;
184 DECLARE_MAC_BUF(mac); 184 DECLARE_MAC_BUF(mac);
185 185
186 if (!MACH_IS_MAC)
187 return ERR_PTR(-ENODEV);
188
186 dev = alloc_etherdev(sizeof(struct net_local)); 189 dev = alloc_etherdev(sizeof(struct net_local));
187 if (!dev) 190 if (!dev)
188 return ERR_PTR(-ENOMEM); 191 return ERR_PTR(-ENOMEM);
diff --git a/drivers/net/macmace.c b/drivers/net/macmace.c
index 18770527df99..51ad3765e075 100644
--- a/drivers/net/macmace.c
+++ b/drivers/net/macmace.c
@@ -781,6 +781,9 @@ static int __init mac_mace_init_module(void)
781{ 781{
782 int err; 782 int err;
783 783
784 if (!MACH_IS_MAC)
785 return -ENODEV;
786
784 if ((err = platform_driver_register(&mac_mace_driver))) { 787 if ((err = platform_driver_register(&mac_mace_driver))) {
785 printk(KERN_ERR "Driver registration failed\n"); 788 printk(KERN_ERR "Driver registration failed\n");
786 return err; 789 return err;
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 93007d38df57..9a68d2ea5f3e 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -76,7 +76,7 @@
76#include "myri10ge_mcp.h" 76#include "myri10ge_mcp.h"
77#include "myri10ge_mcp_gen_header.h" 77#include "myri10ge_mcp_gen_header.h"
78 78
79#define MYRI10GE_VERSION_STR "1.3.2-1.287" 79#define MYRI10GE_VERSION_STR "1.3.99-1.347"
80 80
81MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); 81MODULE_DESCRIPTION("Myricom 10G driver (10GbE)");
82MODULE_AUTHOR("Maintainer: help@myri.com"); 82MODULE_AUTHOR("Maintainer: help@myri.com");
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c
index 8db342f2fdc9..70cfdb46aa27 100644
--- a/drivers/net/pppol2tp.c
+++ b/drivers/net/pppol2tp.c
@@ -240,12 +240,15 @@ static inline struct pppol2tp_session *pppol2tp_sock_to_session(struct sock *sk)
240 if (sk == NULL) 240 if (sk == NULL)
241 return NULL; 241 return NULL;
242 242
243 sock_hold(sk);
243 session = (struct pppol2tp_session *)(sk->sk_user_data); 244 session = (struct pppol2tp_session *)(sk->sk_user_data);
244 if (session == NULL) 245 if (session == NULL) {
245 return NULL; 246 sock_put(sk);
247 goto out;
248 }
246 249
247 BUG_ON(session->magic != L2TP_SESSION_MAGIC); 250 BUG_ON(session->magic != L2TP_SESSION_MAGIC);
248 251out:
249 return session; 252 return session;
250} 253}
251 254
@@ -256,12 +259,15 @@ static inline struct pppol2tp_tunnel *pppol2tp_sock_to_tunnel(struct sock *sk)
256 if (sk == NULL) 259 if (sk == NULL)
257 return NULL; 260 return NULL;
258 261
262 sock_hold(sk);
259 tunnel = (struct pppol2tp_tunnel *)(sk->sk_user_data); 263 tunnel = (struct pppol2tp_tunnel *)(sk->sk_user_data);
260 if (tunnel == NULL) 264 if (tunnel == NULL) {
261 return NULL; 265 sock_put(sk);
266 goto out;
267 }
262 268
263 BUG_ON(tunnel->magic != L2TP_TUNNEL_MAGIC); 269 BUG_ON(tunnel->magic != L2TP_TUNNEL_MAGIC);
264 270out:
265 return tunnel; 271 return tunnel;
266} 272}
267 273
@@ -716,12 +722,14 @@ discard:
716 session->stats.rx_errors++; 722 session->stats.rx_errors++;
717 kfree_skb(skb); 723 kfree_skb(skb);
718 sock_put(session->sock); 724 sock_put(session->sock);
725 sock_put(sock);
719 726
720 return 0; 727 return 0;
721 728
722error: 729error:
723 /* Put UDP header back */ 730 /* Put UDP header back */
724 __skb_push(skb, sizeof(struct udphdr)); 731 __skb_push(skb, sizeof(struct udphdr));
732 sock_put(sock);
725 733
726no_tunnel: 734no_tunnel:
727 return 1; 735 return 1;
@@ -745,10 +753,13 @@ static int pppol2tp_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
745 "%s: received %d bytes\n", tunnel->name, skb->len); 753 "%s: received %d bytes\n", tunnel->name, skb->len);
746 754
747 if (pppol2tp_recv_core(sk, skb)) 755 if (pppol2tp_recv_core(sk, skb))
748 goto pass_up; 756 goto pass_up_put;
749 757
758 sock_put(sk);
750 return 0; 759 return 0;
751 760
761pass_up_put:
762 sock_put(sk);
752pass_up: 763pass_up:
753 return 1; 764 return 1;
754} 765}
@@ -858,7 +869,7 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh
858 869
859 tunnel = pppol2tp_sock_to_tunnel(session->tunnel_sock); 870 tunnel = pppol2tp_sock_to_tunnel(session->tunnel_sock);
860 if (tunnel == NULL) 871 if (tunnel == NULL)
861 goto error; 872 goto error_put_sess;
862 873
863 /* What header length is configured for this session? */ 874 /* What header length is configured for this session? */
864 hdr_len = pppol2tp_l2tp_header_len(session); 875 hdr_len = pppol2tp_l2tp_header_len(session);
@@ -870,7 +881,7 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh
870 sizeof(ppph) + total_len, 881 sizeof(ppph) + total_len,
871 0, GFP_KERNEL); 882 0, GFP_KERNEL);
872 if (!skb) 883 if (!skb)
873 goto error; 884 goto error_put_sess_tun;
874 885
875 /* Reserve space for headers. */ 886 /* Reserve space for headers. */
876 skb_reserve(skb, NET_SKB_PAD); 887 skb_reserve(skb, NET_SKB_PAD);
@@ -900,7 +911,7 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh
900 error = memcpy_fromiovec(skb->data, m->msg_iov, total_len); 911 error = memcpy_fromiovec(skb->data, m->msg_iov, total_len);
901 if (error < 0) { 912 if (error < 0) {
902 kfree_skb(skb); 913 kfree_skb(skb);
903 goto error; 914 goto error_put_sess_tun;
904 } 915 }
905 skb_put(skb, total_len); 916 skb_put(skb, total_len);
906 917
@@ -947,10 +958,33 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh
947 session->stats.tx_errors++; 958 session->stats.tx_errors++;
948 } 959 }
949 960
961 return error;
962
963error_put_sess_tun:
964 sock_put(session->tunnel_sock);
965error_put_sess:
966 sock_put(sk);
950error: 967error:
951 return error; 968 return error;
952} 969}
953 970
971/* Automatically called when the skb is freed.
972 */
973static void pppol2tp_sock_wfree(struct sk_buff *skb)
974{
975 sock_put(skb->sk);
976}
977
978/* For data skbs that we transmit, we associate with the tunnel socket
979 * but don't do accounting.
980 */
981static inline void pppol2tp_skb_set_owner_w(struct sk_buff *skb, struct sock *sk)
982{
983 sock_hold(sk);
984 skb->sk = sk;
985 skb->destructor = pppol2tp_sock_wfree;
986}
987
954/* Transmit function called by generic PPP driver. Sends PPP frame 988/* Transmit function called by generic PPP driver. Sends PPP frame
955 * over PPPoL2TP socket. 989 * over PPPoL2TP socket.
956 * 990 *
@@ -993,10 +1027,10 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
993 1027
994 sk_tun = session->tunnel_sock; 1028 sk_tun = session->tunnel_sock;
995 if (sk_tun == NULL) 1029 if (sk_tun == NULL)
996 goto abort; 1030 goto abort_put_sess;
997 tunnel = pppol2tp_sock_to_tunnel(sk_tun); 1031 tunnel = pppol2tp_sock_to_tunnel(sk_tun);
998 if (tunnel == NULL) 1032 if (tunnel == NULL)
999 goto abort; 1033 goto abort_put_sess;
1000 1034
1001 /* What header length is configured for this session? */ 1035 /* What header length is configured for this session? */
1002 hdr_len = pppol2tp_l2tp_header_len(session); 1036 hdr_len = pppol2tp_l2tp_header_len(session);
@@ -1009,7 +1043,7 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
1009 sizeof(struct udphdr) + hdr_len + sizeof(ppph); 1043 sizeof(struct udphdr) + hdr_len + sizeof(ppph);
1010 old_headroom = skb_headroom(skb); 1044 old_headroom = skb_headroom(skb);
1011 if (skb_cow_head(skb, headroom)) 1045 if (skb_cow_head(skb, headroom))
1012 goto abort; 1046 goto abort_put_sess_tun;
1013 1047
1014 new_headroom = skb_headroom(skb); 1048 new_headroom = skb_headroom(skb);
1015 skb_orphan(skb); 1049 skb_orphan(skb);
@@ -1069,7 +1103,7 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
1069 /* Get routing info from the tunnel socket */ 1103 /* Get routing info from the tunnel socket */
1070 dst_release(skb->dst); 1104 dst_release(skb->dst);
1071 skb->dst = dst_clone(__sk_dst_get(sk_tun)); 1105 skb->dst = dst_clone(__sk_dst_get(sk_tun));
1072 skb->sk = sk_tun; 1106 pppol2tp_skb_set_owner_w(skb, sk_tun);
1073 1107
1074 /* Queue the packet to IP for output */ 1108 /* Queue the packet to IP for output */
1075 len = skb->len; 1109 len = skb->len;
@@ -1086,8 +1120,14 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
1086 session->stats.tx_errors++; 1120 session->stats.tx_errors++;
1087 } 1121 }
1088 1122
1123 sock_put(sk_tun);
1124 sock_put(sk);
1089 return 1; 1125 return 1;
1090 1126
1127abort_put_sess_tun:
1128 sock_put(sk_tun);
1129abort_put_sess:
1130 sock_put(sk);
1091abort: 1131abort:
1092 /* Free the original skb */ 1132 /* Free the original skb */
1093 kfree_skb(skb); 1133 kfree_skb(skb);
@@ -1191,7 +1231,7 @@ static void pppol2tp_tunnel_destruct(struct sock *sk)
1191{ 1231{
1192 struct pppol2tp_tunnel *tunnel; 1232 struct pppol2tp_tunnel *tunnel;
1193 1233
1194 tunnel = pppol2tp_sock_to_tunnel(sk); 1234 tunnel = sk->sk_user_data;
1195 if (tunnel == NULL) 1235 if (tunnel == NULL)
1196 goto end; 1236 goto end;
1197 1237
@@ -1230,10 +1270,12 @@ static void pppol2tp_session_destruct(struct sock *sk)
1230 if (sk->sk_user_data != NULL) { 1270 if (sk->sk_user_data != NULL) {
1231 struct pppol2tp_tunnel *tunnel; 1271 struct pppol2tp_tunnel *tunnel;
1232 1272
1233 session = pppol2tp_sock_to_session(sk); 1273 session = sk->sk_user_data;
1234 if (session == NULL) 1274 if (session == NULL)
1235 goto out; 1275 goto out;
1236 1276
1277 BUG_ON(session->magic != L2TP_SESSION_MAGIC);
1278
1237 /* Don't use pppol2tp_sock_to_tunnel() here to 1279 /* Don't use pppol2tp_sock_to_tunnel() here to
1238 * get the tunnel context because the tunnel 1280 * get the tunnel context because the tunnel
1239 * socket might have already been closed (its 1281 * socket might have already been closed (its
@@ -1279,6 +1321,7 @@ out:
1279static int pppol2tp_release(struct socket *sock) 1321static int pppol2tp_release(struct socket *sock)
1280{ 1322{
1281 struct sock *sk = sock->sk; 1323 struct sock *sk = sock->sk;
1324 struct pppol2tp_session *session;
1282 int error; 1325 int error;
1283 1326
1284 if (!sk) 1327 if (!sk)
@@ -1296,9 +1339,18 @@ static int pppol2tp_release(struct socket *sock)
1296 sock_orphan(sk); 1339 sock_orphan(sk);
1297 sock->sk = NULL; 1340 sock->sk = NULL;
1298 1341
1342 session = pppol2tp_sock_to_session(sk);
1343
1299 /* Purge any queued data */ 1344 /* Purge any queued data */
1300 skb_queue_purge(&sk->sk_receive_queue); 1345 skb_queue_purge(&sk->sk_receive_queue);
1301 skb_queue_purge(&sk->sk_write_queue); 1346 skb_queue_purge(&sk->sk_write_queue);
1347 if (session != NULL) {
1348 struct sk_buff *skb;
1349 while ((skb = skb_dequeue(&session->reorder_q))) {
1350 kfree_skb(skb);
1351 sock_put(sk);
1352 }
1353 }
1302 1354
1303 release_sock(sk); 1355 release_sock(sk);
1304 1356
@@ -1601,7 +1653,7 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
1601 1653
1602 error = ppp_register_channel(&po->chan); 1654 error = ppp_register_channel(&po->chan);
1603 if (error) 1655 if (error)
1604 goto end; 1656 goto end_put_tun;
1605 1657
1606 /* This is how we get the session context from the socket. */ 1658 /* This is how we get the session context from the socket. */
1607 sk->sk_user_data = session; 1659 sk->sk_user_data = session;
@@ -1621,6 +1673,8 @@ out_no_ppp:
1621 PRINTK(session->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, 1673 PRINTK(session->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO,
1622 "%s: created\n", session->name); 1674 "%s: created\n", session->name);
1623 1675
1676end_put_tun:
1677 sock_put(tunnel_sock);
1624end: 1678end:
1625 release_sock(sk); 1679 release_sock(sk);
1626 1680
@@ -1668,6 +1722,7 @@ static int pppol2tp_getname(struct socket *sock, struct sockaddr *uaddr,
1668 *usockaddr_len = len; 1722 *usockaddr_len = len;
1669 1723
1670 error = 0; 1724 error = 0;
1725 sock_put(sock->sk);
1671 1726
1672end: 1727end:
1673 return error; 1728 return error;
@@ -1906,14 +1961,17 @@ static int pppol2tp_ioctl(struct socket *sock, unsigned int cmd,
1906 err = -EBADF; 1961 err = -EBADF;
1907 tunnel = pppol2tp_sock_to_tunnel(session->tunnel_sock); 1962 tunnel = pppol2tp_sock_to_tunnel(session->tunnel_sock);
1908 if (tunnel == NULL) 1963 if (tunnel == NULL)
1909 goto end; 1964 goto end_put_sess;
1910 1965
1911 err = pppol2tp_tunnel_ioctl(tunnel, cmd, arg); 1966 err = pppol2tp_tunnel_ioctl(tunnel, cmd, arg);
1912 goto end; 1967 sock_put(session->tunnel_sock);
1968 goto end_put_sess;
1913 } 1969 }
1914 1970
1915 err = pppol2tp_session_ioctl(session, cmd, arg); 1971 err = pppol2tp_session_ioctl(session, cmd, arg);
1916 1972
1973end_put_sess:
1974 sock_put(sk);
1917end: 1975end:
1918 return err; 1976 return err;
1919} 1977}
@@ -2059,14 +2117,17 @@ static int pppol2tp_setsockopt(struct socket *sock, int level, int optname,
2059 err = -EBADF; 2117 err = -EBADF;
2060 tunnel = pppol2tp_sock_to_tunnel(session->tunnel_sock); 2118 tunnel = pppol2tp_sock_to_tunnel(session->tunnel_sock);
2061 if (tunnel == NULL) 2119 if (tunnel == NULL)
2062 goto end; 2120 goto end_put_sess;
2063 2121
2064 err = pppol2tp_tunnel_setsockopt(sk, tunnel, optname, val); 2122 err = pppol2tp_tunnel_setsockopt(sk, tunnel, optname, val);
2123 sock_put(session->tunnel_sock);
2065 } else 2124 } else
2066 err = pppol2tp_session_setsockopt(sk, session, optname, val); 2125 err = pppol2tp_session_setsockopt(sk, session, optname, val);
2067 2126
2068 err = 0; 2127 err = 0;
2069 2128
2129end_put_sess:
2130 sock_put(sk);
2070end: 2131end:
2071 return err; 2132 return err;
2072} 2133}
@@ -2181,20 +2242,24 @@ static int pppol2tp_getsockopt(struct socket *sock, int level,
2181 err = -EBADF; 2242 err = -EBADF;
2182 tunnel = pppol2tp_sock_to_tunnel(session->tunnel_sock); 2243 tunnel = pppol2tp_sock_to_tunnel(session->tunnel_sock);
2183 if (tunnel == NULL) 2244 if (tunnel == NULL)
2184 goto end; 2245 goto end_put_sess;
2185 2246
2186 err = pppol2tp_tunnel_getsockopt(sk, tunnel, optname, &val); 2247 err = pppol2tp_tunnel_getsockopt(sk, tunnel, optname, &val);
2248 sock_put(session->tunnel_sock);
2187 } else 2249 } else
2188 err = pppol2tp_session_getsockopt(sk, session, optname, &val); 2250 err = pppol2tp_session_getsockopt(sk, session, optname, &val);
2189 2251
2190 err = -EFAULT; 2252 err = -EFAULT;
2191 if (put_user(len, (int __user *) optlen)) 2253 if (put_user(len, (int __user *) optlen))
2192 goto end; 2254 goto end_put_sess;
2193 2255
2194 if (copy_to_user((void __user *) optval, &val, len)) 2256 if (copy_to_user((void __user *) optval, &val, len))
2195 goto end; 2257 goto end_put_sess;
2196 2258
2197 err = 0; 2259 err = 0;
2260
2261end_put_sess:
2262 sock_put(sk);
2198end: 2263end:
2199 return err; 2264 return err;
2200} 2265}
diff --git a/drivers/net/sc92031.c b/drivers/net/sc92031.c
index b4b63805ee8f..61955f8d8011 100644
--- a/drivers/net/sc92031.c
+++ b/drivers/net/sc92031.c
@@ -972,7 +972,7 @@ static int sc92031_start_xmit(struct sk_buff *skb, struct net_device *dev)
972 skb_copy_and_csum_dev(skb, priv->tx_bufs + entry * TX_BUF_SIZE); 972 skb_copy_and_csum_dev(skb, priv->tx_bufs + entry * TX_BUF_SIZE);
973 973
974 len = skb->len; 974 len = skb->len;
975 if (unlikely(len < ETH_ZLEN)) { 975 if (len < ETH_ZLEN) {
976 memset(priv->tx_bufs + entry * TX_BUF_SIZE + len, 976 memset(priv->tx_bufs + entry * TX_BUF_SIZE + len,
977 0, ETH_ZLEN - len); 977 0, ETH_ZLEN - len);
978 len = ETH_ZLEN; 978 len = ETH_ZLEN;
diff --git a/drivers/net/sfc/falcon_xmac.c b/drivers/net/sfc/falcon_xmac.c
index dbdcee4b0f8d..55c0d9760be8 100644
--- a/drivers/net/sfc/falcon_xmac.c
+++ b/drivers/net/sfc/falcon_xmac.c
@@ -459,7 +459,7 @@ static int falcon_check_xaui_link_up(struct efx_nic *efx)
459 tries--; 459 tries--;
460 } 460 }
461 461
462 EFX_ERR(efx, "Failed to bring XAUI link back up in %d tries!\n", 462 EFX_LOG(efx, "Failed to bring XAUI link back up in %d tries!\n",
463 max_tries); 463 max_tries);
464 return 0; 464 return 0;
465} 465}
diff --git a/drivers/net/sun3lance.c b/drivers/net/sun3lance.c
index f8d46134daca..359452a06c67 100644
--- a/drivers/net/sun3lance.c
+++ b/drivers/net/sun3lance.c
@@ -250,6 +250,9 @@ struct net_device * __init sun3lance_probe(int unit)
250 static int found; 250 static int found;
251 int err = -ENODEV; 251 int err = -ENODEV;
252 252
253 if (!MACH_IS_SUN3 && !MACH_IS_SUN3X)
254 return ERR_PTR(-ENODEV);
255
253 /* check that this machine has an onboard lance */ 256 /* check that this machine has an onboard lance */
254 switch(idprom->id_machtype) { 257 switch(idprom->id_machtype) {
255 case SM_SUN3|SM_3_50: 258 case SM_SUN3|SM_3_50:
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index b4e7f30ea4e8..1aa425be3067 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -111,7 +111,7 @@ static __inline__ void tx_add_log(struct happy_meal *hp, unsigned int a, unsigne
111 struct hme_tx_logent *tlp; 111 struct hme_tx_logent *tlp;
112 unsigned long flags; 112 unsigned long flags;
113 113
114 save_and_cli(flags); 114 local_irq_save(flags);
115 tlp = &tx_log[txlog_cur_entry]; 115 tlp = &tx_log[txlog_cur_entry];
116 tlp->tstamp = (unsigned int)jiffies; 116 tlp->tstamp = (unsigned int)jiffies;
117 tlp->tx_new = hp->tx_new; 117 tlp->tx_new = hp->tx_new;
@@ -119,7 +119,7 @@ static __inline__ void tx_add_log(struct happy_meal *hp, unsigned int a, unsigne
119 tlp->action = a; 119 tlp->action = a;
120 tlp->status = s; 120 tlp->status = s;
121 txlog_cur_entry = (txlog_cur_entry + 1) & (TX_LOG_LEN - 1); 121 txlog_cur_entry = (txlog_cur_entry + 1) & (TX_LOG_LEN - 1);
122 restore_flags(flags); 122 local_irq_restore(flags);
123} 123}
124static __inline__ void tx_dump_log(void) 124static __inline__ void tx_dump_log(void)
125{ 125{
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index d9f248f23b97..633c128a6228 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -1828,6 +1828,21 @@ static void tg3_frob_aux_power(struct tg3 *tp)
1828 GRC_LCLCTRL_GPIO_OUTPUT0 | 1828 GRC_LCLCTRL_GPIO_OUTPUT0 |
1829 GRC_LCLCTRL_GPIO_OUTPUT1), 1829 GRC_LCLCTRL_GPIO_OUTPUT1),
1830 100); 1830 100);
1831 } else if (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5761) {
1832 /* The 5761 non-e device swaps GPIO 0 and GPIO 2. */
1833 u32 grc_local_ctrl = GRC_LCLCTRL_GPIO_OE0 |
1834 GRC_LCLCTRL_GPIO_OE1 |
1835 GRC_LCLCTRL_GPIO_OE2 |
1836 GRC_LCLCTRL_GPIO_OUTPUT0 |
1837 GRC_LCLCTRL_GPIO_OUTPUT1 |
1838 tp->grc_local_ctrl;
1839 tw32_wait_f(GRC_LOCAL_CTRL, grc_local_ctrl, 100);
1840
1841 grc_local_ctrl |= GRC_LCLCTRL_GPIO_OUTPUT2;
1842 tw32_wait_f(GRC_LOCAL_CTRL, grc_local_ctrl, 100);
1843
1844 grc_local_ctrl &= ~GRC_LCLCTRL_GPIO_OUTPUT0;
1845 tw32_wait_f(GRC_LOCAL_CTRL, grc_local_ctrl, 100);
1831 } else { 1846 } else {
1832 u32 no_gpio2; 1847 u32 no_gpio2;
1833 u32 grc_local_ctrl = 0; 1848 u32 grc_local_ctrl = 0;
@@ -3534,8 +3549,7 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, int force_reset)
3534 err |= tg3_readphy(tp, MII_BMCR, &bmcr); 3549 err |= tg3_readphy(tp, MII_BMCR, &bmcr);
3535 3550
3536 if ((tp->link_config.autoneg == AUTONEG_ENABLE) && !force_reset && 3551 if ((tp->link_config.autoneg == AUTONEG_ENABLE) && !force_reset &&
3537 (tp->tg3_flags2 & TG3_FLG2_PARALLEL_DETECT) && 3552 (tp->tg3_flags2 & TG3_FLG2_PARALLEL_DETECT)) {
3538 tp->link_config.flowctrl == tp->link_config.active_flowctrl) {
3539 /* do nothing, just check for link up at the end */ 3553 /* do nothing, just check for link up at the end */
3540 } else if (tp->link_config.autoneg == AUTONEG_ENABLE) { 3554 } else if (tp->link_config.autoneg == AUTONEG_ENABLE) {
3541 u32 adv, new_adv; 3555 u32 adv, new_adv;
@@ -9008,7 +9022,7 @@ static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
9008 (cmd->speed == SPEED_1000)) 9022 (cmd->speed == SPEED_1000))
9009 return -EINVAL; 9023 return -EINVAL;
9010 else if ((cmd->speed == SPEED_1000) && 9024 else if ((cmd->speed == SPEED_1000) &&
9011 (tp->tg3_flags2 & TG3_FLAG_10_100_ONLY)) 9025 (tp->tg3_flags & TG3_FLAG_10_100_ONLY))
9012 return -EINVAL; 9026 return -EINVAL;
9013 9027
9014 tg3_full_lock(tp, 0); 9028 tg3_full_lock(tp, 0);
@@ -12275,6 +12289,15 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
12275 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755) 12289 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755)
12276 tp->grc_local_ctrl |= GRC_LCLCTRL_GPIO_UART_SEL; 12290 tp->grc_local_ctrl |= GRC_LCLCTRL_GPIO_UART_SEL;
12277 12291
12292 if (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5761) {
12293 /* Turn off the debug UART. */
12294 tp->grc_local_ctrl |= GRC_LCLCTRL_GPIO_UART_SEL;
12295 if (tp->tg3_flags2 & TG3_FLG2_IS_NIC)
12296 /* Keep VMain power. */
12297 tp->grc_local_ctrl |= GRC_LCLCTRL_GPIO_OE0 |
12298 GRC_LCLCTRL_GPIO_OUTPUT0;
12299 }
12300
12278 /* Force the chip into D0. */ 12301 /* Force the chip into D0. */
12279 err = tg3_set_power_state(tp, PCI_D0); 12302 err = tg3_set_power_state(tp, PCI_D0);
12280 if (err) { 12303 if (err) {
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
index f9d13fa05d64..55670b5eb611 100644
--- a/drivers/net/tulip/tulip_core.c
+++ b/drivers/net/tulip/tulip_core.c
@@ -1729,12 +1729,15 @@ static int tulip_suspend (struct pci_dev *pdev, pm_message_t state)
1729 if (!dev) 1729 if (!dev)
1730 return -EINVAL; 1730 return -EINVAL;
1731 1731
1732 if (netif_running(dev)) 1732 if (!netif_running(dev))
1733 tulip_down(dev); 1733 goto save_state;
1734
1735 tulip_down(dev);
1734 1736
1735 netif_device_detach(dev); 1737 netif_device_detach(dev);
1736 free_irq(dev->irq, dev); 1738 free_irq(dev->irq, dev);
1737 1739
1740save_state:
1738 pci_save_state(pdev); 1741 pci_save_state(pdev);
1739 pci_disable_device(pdev); 1742 pci_disable_device(pdev);
1740 pci_set_power_state(pdev, pci_choose_state(pdev, state)); 1743 pci_set_power_state(pdev, pci_choose_state(pdev, state));
@@ -1754,6 +1757,9 @@ static int tulip_resume(struct pci_dev *pdev)
1754 pci_set_power_state(pdev, PCI_D0); 1757 pci_set_power_state(pdev, PCI_D0);
1755 pci_restore_state(pdev); 1758 pci_restore_state(pdev);
1756 1759
1760 if (!netif_running(dev))
1761 return 0;
1762
1757 if ((retval = pci_enable_device(pdev))) { 1763 if ((retval = pci_enable_device(pdev))) {
1758 printk (KERN_ERR "tulip: pci_enable_device failed in resume\n"); 1764 printk (KERN_ERR "tulip: pci_enable_device failed in resume\n");
1759 return retval; 1765 return retval;
diff --git a/drivers/net/ucc_geth_ethtool.c b/drivers/net/ucc_geth_ethtool.c
index 5f176f2b1c17..cfbbfee55836 100644
--- a/drivers/net/ucc_geth_ethtool.c
+++ b/drivers/net/ucc_geth_ethtool.c
@@ -73,6 +73,7 @@ static char tx_fw_stat_gstrings[][ETH_GSTRING_LEN] = {
73 "tx-frames-ok", 73 "tx-frames-ok",
74 "tx-excessive-differ-frames", 74 "tx-excessive-differ-frames",
75 "tx-256-511-frames", 75 "tx-256-511-frames",
76 "tx-512-1023-frames",
76 "tx-1024-1518-frames", 77 "tx-1024-1518-frames",
77 "tx-jumbo-frames", 78 "tx-jumbo-frames",
78}; 79};
@@ -308,7 +309,7 @@ static void uec_get_strings(struct net_device *netdev, u32 stringset, u8 *buf)
308 buf += UEC_TX_FW_STATS_LEN * ETH_GSTRING_LEN; 309 buf += UEC_TX_FW_STATS_LEN * ETH_GSTRING_LEN;
309 } 310 }
310 if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX) 311 if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX)
311 memcpy(buf, tx_fw_stat_gstrings, UEC_RX_FW_STATS_LEN * 312 memcpy(buf, rx_fw_stat_gstrings, UEC_RX_FW_STATS_LEN *
312 ETH_GSTRING_LEN); 313 ETH_GSTRING_LEN);
313} 314}
314 315
diff --git a/drivers/net/usb/cdc_subset.c b/drivers/net/usb/cdc_subset.c
index 0ec7936cbe21..c66b9c324f54 100644
--- a/drivers/net/usb/cdc_subset.c
+++ b/drivers/net/usb/cdc_subset.c
@@ -218,7 +218,7 @@ static const struct driver_info blob_info = {
218/*-------------------------------------------------------------------------*/ 218/*-------------------------------------------------------------------------*/
219 219
220#ifndef HAVE_HARDWARE 220#ifndef HAVE_HARDWARE
221#error You need to configure some hardware for this driver 221#warning You need to configure some hardware for this driver
222#endif 222#endif
223 223
224/* 224/*
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index fe7cdf2a2a23..5450eac9e263 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -47,6 +47,9 @@ struct virtnet_info
47 /* Number of input buffers, and max we've ever had. */ 47 /* Number of input buffers, and max we've ever had. */
48 unsigned int num, max; 48 unsigned int num, max;
49 49
50 /* For cleaning up after transmission. */
51 struct tasklet_struct tasklet;
52
50 /* Receive & send queues. */ 53 /* Receive & send queues. */
51 struct sk_buff_head recv; 54 struct sk_buff_head recv;
52 struct sk_buff_head send; 55 struct sk_buff_head send;
@@ -68,8 +71,13 @@ static void skb_xmit_done(struct virtqueue *svq)
68 71
69 /* Suppress further interrupts. */ 72 /* Suppress further interrupts. */
70 svq->vq_ops->disable_cb(svq); 73 svq->vq_ops->disable_cb(svq);
74
71 /* We were waiting for more output buffers. */ 75 /* We were waiting for more output buffers. */
72 netif_wake_queue(vi->dev); 76 netif_wake_queue(vi->dev);
77
78 /* Make sure we re-xmit last_xmit_skb: if there are no more packets
79 * queued, start_xmit won't be called. */
80 tasklet_schedule(&vi->tasklet);
73} 81}
74 82
75static void receive_skb(struct net_device *dev, struct sk_buff *skb, 83static void receive_skb(struct net_device *dev, struct sk_buff *skb,
@@ -278,6 +286,18 @@ static int xmit_skb(struct virtnet_info *vi, struct sk_buff *skb)
278 return vi->svq->vq_ops->add_buf(vi->svq, sg, num, 0, skb); 286 return vi->svq->vq_ops->add_buf(vi->svq, sg, num, 0, skb);
279} 287}
280 288
289static void xmit_tasklet(unsigned long data)
290{
291 struct virtnet_info *vi = (void *)data;
292
293 netif_tx_lock_bh(vi->dev);
294 if (vi->last_xmit_skb && xmit_skb(vi, vi->last_xmit_skb) == 0) {
295 vi->svq->vq_ops->kick(vi->svq);
296 vi->last_xmit_skb = NULL;
297 }
298 netif_tx_unlock_bh(vi->dev);
299}
300
281static int start_xmit(struct sk_buff *skb, struct net_device *dev) 301static int start_xmit(struct sk_buff *skb, struct net_device *dev)
282{ 302{
283 struct virtnet_info *vi = netdev_priv(dev); 303 struct virtnet_info *vi = netdev_priv(dev);
@@ -287,21 +307,25 @@ again:
287 free_old_xmit_skbs(vi); 307 free_old_xmit_skbs(vi);
288 308
289 /* If we has a buffer left over from last time, send it now. */ 309 /* If we has a buffer left over from last time, send it now. */
290 if (vi->last_xmit_skb) { 310 if (unlikely(vi->last_xmit_skb)) {
291 if (xmit_skb(vi, vi->last_xmit_skb) != 0) { 311 if (xmit_skb(vi, vi->last_xmit_skb) != 0) {
292 /* Drop this skb: we only queue one. */ 312 /* Drop this skb: we only queue one. */
293 vi->dev->stats.tx_dropped++; 313 vi->dev->stats.tx_dropped++;
294 kfree_skb(skb); 314 kfree_skb(skb);
315 skb = NULL;
295 goto stop_queue; 316 goto stop_queue;
296 } 317 }
297 vi->last_xmit_skb = NULL; 318 vi->last_xmit_skb = NULL;
298 } 319 }
299 320
300 /* Put new one in send queue and do transmit */ 321 /* Put new one in send queue and do transmit */
301 __skb_queue_head(&vi->send, skb); 322 if (likely(skb)) {
302 if (xmit_skb(vi, skb) != 0) { 323 __skb_queue_head(&vi->send, skb);
303 vi->last_xmit_skb = skb; 324 if (xmit_skb(vi, skb) != 0) {
304 goto stop_queue; 325 vi->last_xmit_skb = skb;
326 skb = NULL;
327 goto stop_queue;
328 }
305 } 329 }
306done: 330done:
307 vi->svq->vq_ops->kick(vi->svq); 331 vi->svq->vq_ops->kick(vi->svq);
@@ -428,6 +452,8 @@ static int virtnet_probe(struct virtio_device *vdev)
428 skb_queue_head_init(&vi->recv); 452 skb_queue_head_init(&vi->recv);
429 skb_queue_head_init(&vi->send); 453 skb_queue_head_init(&vi->send);
430 454
455 tasklet_init(&vi->tasklet, xmit_tasklet, (unsigned long)vi);
456
431 err = register_netdev(dev); 457 err = register_netdev(dev);
432 if (err) { 458 if (err) {
433 pr_debug("virtio_net: registering device failed\n"); 459 pr_debug("virtio_net: registering device failed\n");
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 17ced37e55ed..1e1446bf4b48 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -2906,7 +2906,7 @@ EXPORT_SYMBOL(init_airo_card);
2906 2906
2907static int waitbusy (struct airo_info *ai) { 2907static int waitbusy (struct airo_info *ai) {
2908 int delay = 0; 2908 int delay = 0;
2909 while ((IN4500 (ai, COMMAND) & COMMAND_BUSY) && (delay < 10000)) { 2909 while ((IN4500(ai, COMMAND) & COMMAND_BUSY) && (delay < 10000)) {
2910 udelay (10); 2910 udelay (10);
2911 if ((++delay % 20) == 0) 2911 if ((++delay % 20) == 0)
2912 OUT4500(ai, EVACK, EV_CLEARCOMMANDBUSY); 2912 OUT4500(ai, EVACK, EV_CLEARCOMMANDBUSY);
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index f978a9d5190b..7bb2646ae0ef 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -47,6 +47,7 @@
47#include <linux/string.h> 47#include <linux/string.h>
48#include <linux/ctype.h> 48#include <linux/ctype.h>
49#include <linux/timer.h> 49#include <linux/timer.h>
50#include <asm/byteorder.h>
50#include <asm/io.h> 51#include <asm/io.h>
51#include <asm/system.h> 52#include <asm/system.h>
52#include <asm/uaccess.h> 53#include <asm/uaccess.h>
@@ -60,7 +61,6 @@
60#include <linux/delay.h> 61#include <linux/delay.h>
61#include <linux/wireless.h> 62#include <linux/wireless.h>
62#include <net/iw_handler.h> 63#include <net/iw_handler.h>
63#include <linux/byteorder/generic.h>
64#include <linux/crc32.h> 64#include <linux/crc32.h>
65#include <linux/proc_fs.h> 65#include <linux/proc_fs.h>
66#include <linux/device.h> 66#include <linux/device.h>
diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig
index f51b2d9b085b..1fa043d1802c 100644
--- a/drivers/net/wireless/b43/Kconfig
+++ b/drivers/net/wireless/b43/Kconfig
@@ -1,6 +1,6 @@
1config B43 1config B43
2 tristate "Broadcom 43xx wireless support (mac80211 stack)" 2 tristate "Broadcom 43xx wireless support (mac80211 stack)"
3 depends on SSB_POSSIBLE && MAC80211 && WLAN_80211 3 depends on SSB_POSSIBLE && MAC80211 && WLAN_80211 && HAS_DMA
4 select SSB 4 select SSB
5 select FW_LOADER 5 select FW_LOADER
6 select HW_RANDOM 6 select HW_RANDOM
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index e919189919bb..239e71c3d1b1 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -755,6 +755,7 @@ struct b43_wl {
755 struct sk_buff *current_beacon; 755 struct sk_buff *current_beacon;
756 bool beacon0_uploaded; 756 bool beacon0_uploaded;
757 bool beacon1_uploaded; 757 bool beacon1_uploaded;
758 bool beacon_templates_virgin; /* Never wrote the templates? */
758 struct work_struct beacon_update_trigger; 759 struct work_struct beacon_update_trigger;
759 760
760 /* The current QOS parameters for the 4 queues. 761 /* The current QOS parameters for the 4 queues.
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index f9c14c66434e..1e31e0bca744 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -1550,6 +1550,30 @@ static void b43_write_probe_resp_template(struct b43_wldev *dev,
1550 kfree(probe_resp_data); 1550 kfree(probe_resp_data);
1551} 1551}
1552 1552
1553static void b43_upload_beacon0(struct b43_wldev *dev)
1554{
1555 struct b43_wl *wl = dev->wl;
1556
1557 if (wl->beacon0_uploaded)
1558 return;
1559 b43_write_beacon_template(dev, 0x68, 0x18);
1560 /* FIXME: Probe resp upload doesn't really belong here,
1561 * but we don't use that feature anyway. */
1562 b43_write_probe_resp_template(dev, 0x268, 0x4A,
1563 &__b43_ratetable[3]);
1564 wl->beacon0_uploaded = 1;
1565}
1566
1567static void b43_upload_beacon1(struct b43_wldev *dev)
1568{
1569 struct b43_wl *wl = dev->wl;
1570
1571 if (wl->beacon1_uploaded)
1572 return;
1573 b43_write_beacon_template(dev, 0x468, 0x1A);
1574 wl->beacon1_uploaded = 1;
1575}
1576
1553static void handle_irq_beacon(struct b43_wldev *dev) 1577static void handle_irq_beacon(struct b43_wldev *dev)
1554{ 1578{
1555 struct b43_wl *wl = dev->wl; 1579 struct b43_wl *wl = dev->wl;
@@ -1575,24 +1599,27 @@ static void handle_irq_beacon(struct b43_wldev *dev)
1575 return; 1599 return;
1576 } 1600 }
1577 1601
1578 if (!beacon0_valid) { 1602 if (unlikely(wl->beacon_templates_virgin)) {
1579 if (!wl->beacon0_uploaded) { 1603 /* We never uploaded a beacon before.
1580 b43_write_beacon_template(dev, 0x68, 0x18); 1604 * Upload both templates now, but only mark one valid. */
1581 b43_write_probe_resp_template(dev, 0x268, 0x4A, 1605 wl->beacon_templates_virgin = 0;
1582 &__b43_ratetable[3]); 1606 b43_upload_beacon0(dev);
1583 wl->beacon0_uploaded = 1; 1607 b43_upload_beacon1(dev);
1584 }
1585 cmd = b43_read32(dev, B43_MMIO_MACCMD); 1608 cmd = b43_read32(dev, B43_MMIO_MACCMD);
1586 cmd |= B43_MACCMD_BEACON0_VALID; 1609 cmd |= B43_MACCMD_BEACON0_VALID;
1587 b43_write32(dev, B43_MMIO_MACCMD, cmd); 1610 b43_write32(dev, B43_MMIO_MACCMD, cmd);
1588 } else if (!beacon1_valid) { 1611 } else {
1589 if (!wl->beacon1_uploaded) { 1612 if (!beacon0_valid) {
1590 b43_write_beacon_template(dev, 0x468, 0x1A); 1613 b43_upload_beacon0(dev);
1591 wl->beacon1_uploaded = 1; 1614 cmd = b43_read32(dev, B43_MMIO_MACCMD);
1615 cmd |= B43_MACCMD_BEACON0_VALID;
1616 b43_write32(dev, B43_MMIO_MACCMD, cmd);
1617 } else if (!beacon1_valid) {
1618 b43_upload_beacon1(dev);
1619 cmd = b43_read32(dev, B43_MMIO_MACCMD);
1620 cmd |= B43_MACCMD_BEACON1_VALID;
1621 b43_write32(dev, B43_MMIO_MACCMD, cmd);
1592 } 1622 }
1593 cmd = b43_read32(dev, B43_MMIO_MACCMD);
1594 cmd |= B43_MACCMD_BEACON1_VALID;
1595 b43_write32(dev, B43_MMIO_MACCMD, cmd);
1596 } 1623 }
1597} 1624}
1598 1625
@@ -4172,6 +4199,9 @@ static int b43_op_start(struct ieee80211_hw *hw)
4172 wl->filter_flags = 0; 4199 wl->filter_flags = 0;
4173 wl->radiotap_enabled = 0; 4200 wl->radiotap_enabled = 0;
4174 b43_qos_clear(wl); 4201 b43_qos_clear(wl);
4202 wl->beacon0_uploaded = 0;
4203 wl->beacon1_uploaded = 0;
4204 wl->beacon_templates_virgin = 1;
4175 4205
4176 /* First register RFkill. 4206 /* First register RFkill.
4177 * LEDs that are registered later depend on it. */ 4207 * LEDs that are registered later depend on it. */
@@ -4338,7 +4368,9 @@ static void b43_chip_reset(struct work_struct *work)
4338 goto out; 4368 goto out;
4339 } 4369 }
4340 } 4370 }
4341 out: 4371out:
4372 if (err)
4373 wl->current_dev = NULL; /* Failed to init the dev. */
4342 mutex_unlock(&wl->mutex); 4374 mutex_unlock(&wl->mutex);
4343 if (err) 4375 if (err)
4344 b43err(wl, "Controller restart FAILED\n"); 4376 b43err(wl, "Controller restart FAILED\n");
@@ -4479,9 +4511,11 @@ static void b43_one_core_detach(struct ssb_device *dev)
4479 struct b43_wldev *wldev; 4511 struct b43_wldev *wldev;
4480 struct b43_wl *wl; 4512 struct b43_wl *wl;
4481 4513
4514 /* Do not cancel ieee80211-workqueue based work here.
4515 * See comment in b43_remove(). */
4516
4482 wldev = ssb_get_drvdata(dev); 4517 wldev = ssb_get_drvdata(dev);
4483 wl = wldev->wl; 4518 wl = wldev->wl;
4484 cancel_work_sync(&wldev->restart_work);
4485 b43_debugfs_remove_device(wldev); 4519 b43_debugfs_remove_device(wldev);
4486 b43_wireless_core_detach(wldev); 4520 b43_wireless_core_detach(wldev);
4487 list_del(&wldev->list); 4521 list_del(&wldev->list);
@@ -4666,6 +4700,10 @@ static void b43_remove(struct ssb_device *dev)
4666 struct b43_wl *wl = ssb_get_devtypedata(dev); 4700 struct b43_wl *wl = ssb_get_devtypedata(dev);
4667 struct b43_wldev *wldev = ssb_get_drvdata(dev); 4701 struct b43_wldev *wldev = ssb_get_drvdata(dev);
4668 4702
4703 /* We must cancel any work here before unregistering from ieee80211,
4704 * as the ieee80211 unreg will destroy the workqueue. */
4705 cancel_work_sync(&wldev->restart_work);
4706
4669 B43_WARN_ON(!wl); 4707 B43_WARN_ON(!wl);
4670 if (wl->current_dev == wldev) 4708 if (wl->current_dev == wldev)
4671 ieee80211_unregister_hw(wl->hw); 4709 ieee80211_unregister_hw(wl->hw);
diff --git a/drivers/net/wireless/b43legacy/Kconfig b/drivers/net/wireless/b43legacy/Kconfig
index 13c65faf0247..aef2298d37ac 100644
--- a/drivers/net/wireless/b43legacy/Kconfig
+++ b/drivers/net/wireless/b43legacy/Kconfig
@@ -1,6 +1,6 @@
1config B43LEGACY 1config B43LEGACY
2 tristate "Broadcom 43xx-legacy wireless support (mac80211 stack)" 2 tristate "Broadcom 43xx-legacy wireless support (mac80211 stack)"
3 depends on SSB_POSSIBLE && MAC80211 && WLAN_80211 3 depends on SSB_POSSIBLE && MAC80211 && WLAN_80211 && HAS_DMA
4 select SSB 4 select SSB
5 select FW_LOADER 5 select FW_LOADER
6 select HW_RANDOM 6 select HW_RANDOM
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index f706ca65f159..5f533b93ad5d 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -3036,7 +3036,6 @@ static void b43legacy_set_pretbtt(struct b43legacy_wldev *dev)
3036/* Locking: wl->mutex */ 3036/* Locking: wl->mutex */
3037static void b43legacy_wireless_core_exit(struct b43legacy_wldev *dev) 3037static void b43legacy_wireless_core_exit(struct b43legacy_wldev *dev)
3038{ 3038{
3039 struct b43legacy_wl *wl = dev->wl;
3040 struct b43legacy_phy *phy = &dev->phy; 3039 struct b43legacy_phy *phy = &dev->phy;
3041 u32 macctl; 3040 u32 macctl;
3042 3041
@@ -3051,12 +3050,6 @@ static void b43legacy_wireless_core_exit(struct b43legacy_wldev *dev)
3051 macctl |= B43legacy_MACCTL_PSM_JMP0; 3050 macctl |= B43legacy_MACCTL_PSM_JMP0;
3052 b43legacy_write32(dev, B43legacy_MMIO_MACCTL, macctl); 3051 b43legacy_write32(dev, B43legacy_MMIO_MACCTL, macctl);
3053 3052
3054 mutex_unlock(&wl->mutex);
3055 /* Must unlock as it would otherwise deadlock. No races here.
3056 * Cancel possibly pending workqueues. */
3057 cancel_work_sync(&dev->restart_work);
3058 mutex_lock(&wl->mutex);
3059
3060 b43legacy_leds_exit(dev); 3053 b43legacy_leds_exit(dev);
3061 b43legacy_rng_exit(dev->wl); 3054 b43legacy_rng_exit(dev->wl);
3062 b43legacy_pio_free(dev); 3055 b43legacy_pio_free(dev);
@@ -3482,6 +3475,8 @@ static void b43legacy_chip_reset(struct work_struct *work)
3482 } 3475 }
3483 } 3476 }
3484out: 3477out:
3478 if (err)
3479 wl->current_dev = NULL; /* Failed to init the dev. */
3485 mutex_unlock(&wl->mutex); 3480 mutex_unlock(&wl->mutex);
3486 if (err) 3481 if (err)
3487 b43legacyerr(wl, "Controller restart FAILED\n"); 3482 b43legacyerr(wl, "Controller restart FAILED\n");
@@ -3614,9 +3609,11 @@ static void b43legacy_one_core_detach(struct ssb_device *dev)
3614 struct b43legacy_wldev *wldev; 3609 struct b43legacy_wldev *wldev;
3615 struct b43legacy_wl *wl; 3610 struct b43legacy_wl *wl;
3616 3611
3612 /* Do not cancel ieee80211-workqueue based work here.
3613 * See comment in b43legacy_remove(). */
3614
3617 wldev = ssb_get_drvdata(dev); 3615 wldev = ssb_get_drvdata(dev);
3618 wl = wldev->wl; 3616 wl = wldev->wl;
3619 cancel_work_sync(&wldev->restart_work);
3620 b43legacy_debugfs_remove_device(wldev); 3617 b43legacy_debugfs_remove_device(wldev);
3621 b43legacy_wireless_core_detach(wldev); 3618 b43legacy_wireless_core_detach(wldev);
3622 list_del(&wldev->list); 3619 list_del(&wldev->list);
@@ -3784,6 +3781,10 @@ static void b43legacy_remove(struct ssb_device *dev)
3784 struct b43legacy_wl *wl = ssb_get_devtypedata(dev); 3781 struct b43legacy_wl *wl = ssb_get_devtypedata(dev);
3785 struct b43legacy_wldev *wldev = ssb_get_drvdata(dev); 3782 struct b43legacy_wldev *wldev = ssb_get_drvdata(dev);
3786 3783
3784 /* We must cancel any work here before unregistering from ieee80211,
3785 * as the ieee80211 unreg will destroy the workqueue. */
3786 cancel_work_sync(&wldev->restart_work);
3787
3787 B43legacy_WARN_ON(!wl); 3788 B43legacy_WARN_ON(!wl);
3788 if (wl->current_dev == wldev) 3789 if (wl->current_dev == wldev)
3789 ieee80211_unregister_hw(wl->hw); 3790 ieee80211_unregister_hw(wl->hw);
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index d74c061994ae..6e704608947c 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -1753,6 +1753,8 @@ static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio)
1753 1753
1754 if (priv->workqueue) { 1754 if (priv->workqueue) {
1755 cancel_delayed_work(&priv->request_scan); 1755 cancel_delayed_work(&priv->request_scan);
1756 cancel_delayed_work(&priv->request_direct_scan);
1757 cancel_delayed_work(&priv->request_passive_scan);
1756 cancel_delayed_work(&priv->scan_event); 1758 cancel_delayed_work(&priv->scan_event);
1757 } 1759 }
1758 queue_work(priv->workqueue, &priv->down); 1760 queue_work(priv->workqueue, &priv->down);
@@ -2005,6 +2007,8 @@ static void ipw_irq_tasklet(struct ipw_priv *priv)
2005 wake_up_interruptible(&priv->wait_command_queue); 2007 wake_up_interruptible(&priv->wait_command_queue);
2006 priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); 2008 priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING);
2007 cancel_delayed_work(&priv->request_scan); 2009 cancel_delayed_work(&priv->request_scan);
2010 cancel_delayed_work(&priv->request_direct_scan);
2011 cancel_delayed_work(&priv->request_passive_scan);
2008 cancel_delayed_work(&priv->scan_event); 2012 cancel_delayed_work(&priv->scan_event);
2009 schedule_work(&priv->link_down); 2013 schedule_work(&priv->link_down);
2010 queue_delayed_work(priv->workqueue, &priv->rf_kill, 2 * HZ); 2014 queue_delayed_work(priv->workqueue, &priv->rf_kill, 2 * HZ);
@@ -4712,6 +4716,12 @@ static void ipw_rx_notification(struct ipw_priv *priv,
4712 priv->status &= ~STATUS_SCAN_FORCED; 4716 priv->status &= ~STATUS_SCAN_FORCED;
4713#endif /* CONFIG_IPW2200_MONITOR */ 4717#endif /* CONFIG_IPW2200_MONITOR */
4714 4718
4719 /* Do queued direct scans first */
4720 if (priv->status & STATUS_DIRECT_SCAN_PENDING) {
4721 queue_delayed_work(priv->workqueue,
4722 &priv->request_direct_scan, 0);
4723 }
4724
4715 if (!(priv->status & (STATUS_ASSOCIATED | 4725 if (!(priv->status & (STATUS_ASSOCIATED |
4716 STATUS_ASSOCIATING | 4726 STATUS_ASSOCIATING |
4717 STATUS_ROAMING | 4727 STATUS_ROAMING |
@@ -6267,7 +6277,7 @@ static void ipw_add_scan_channels(struct ipw_priv *priv,
6267 } 6277 }
6268} 6278}
6269 6279
6270static int ipw_request_scan_helper(struct ipw_priv *priv, int type) 6280static int ipw_request_scan_helper(struct ipw_priv *priv, int type, int direct)
6271{ 6281{
6272 struct ipw_scan_request_ext scan; 6282 struct ipw_scan_request_ext scan;
6273 int err = 0, scan_type; 6283 int err = 0, scan_type;
@@ -6278,22 +6288,31 @@ static int ipw_request_scan_helper(struct ipw_priv *priv, int type)
6278 6288
6279 mutex_lock(&priv->mutex); 6289 mutex_lock(&priv->mutex);
6280 6290
6291 if (direct && (priv->direct_scan_ssid_len == 0)) {
6292 IPW_DEBUG_HC("Direct scan requested but no SSID to scan for\n");
6293 priv->status &= ~STATUS_DIRECT_SCAN_PENDING;
6294 goto done;
6295 }
6296
6281 if (priv->status & STATUS_SCANNING) { 6297 if (priv->status & STATUS_SCANNING) {
6282 IPW_DEBUG_HC("Concurrent scan requested. Ignoring.\n"); 6298 IPW_DEBUG_HC("Concurrent scan requested. Queuing.\n");
6283 priv->status |= STATUS_SCAN_PENDING; 6299 priv->status |= direct ? STATUS_DIRECT_SCAN_PENDING :
6300 STATUS_SCAN_PENDING;
6284 goto done; 6301 goto done;
6285 } 6302 }
6286 6303
6287 if (!(priv->status & STATUS_SCAN_FORCED) && 6304 if (!(priv->status & STATUS_SCAN_FORCED) &&
6288 priv->status & STATUS_SCAN_ABORTING) { 6305 priv->status & STATUS_SCAN_ABORTING) {
6289 IPW_DEBUG_HC("Scan request while abort pending. Queuing.\n"); 6306 IPW_DEBUG_HC("Scan request while abort pending. Queuing.\n");
6290 priv->status |= STATUS_SCAN_PENDING; 6307 priv->status |= direct ? STATUS_DIRECT_SCAN_PENDING :
6308 STATUS_SCAN_PENDING;
6291 goto done; 6309 goto done;
6292 } 6310 }
6293 6311
6294 if (priv->status & STATUS_RF_KILL_MASK) { 6312 if (priv->status & STATUS_RF_KILL_MASK) {
6295 IPW_DEBUG_HC("Aborting scan due to RF Kill activation\n"); 6313 IPW_DEBUG_HC("Queuing scan due to RF Kill activation\n");
6296 priv->status |= STATUS_SCAN_PENDING; 6314 priv->status |= direct ? STATUS_DIRECT_SCAN_PENDING :
6315 STATUS_SCAN_PENDING;
6297 goto done; 6316 goto done;
6298 } 6317 }
6299 6318
@@ -6321,6 +6340,7 @@ static int ipw_request_scan_helper(struct ipw_priv *priv, int type)
6321 cpu_to_le16(20); 6340 cpu_to_le16(20);
6322 6341
6323 scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = cpu_to_le16(120); 6342 scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = cpu_to_le16(120);
6343 scan.dwell_time[IPW_SCAN_ACTIVE_DIRECT_SCAN] = cpu_to_le16(20);
6324 6344
6325#ifdef CONFIG_IPW2200_MONITOR 6345#ifdef CONFIG_IPW2200_MONITOR
6326 if (priv->ieee->iw_mode == IW_MODE_MONITOR) { 6346 if (priv->ieee->iw_mode == IW_MODE_MONITOR) {
@@ -6360,13 +6380,23 @@ static int ipw_request_scan_helper(struct ipw_priv *priv, int type)
6360 cpu_to_le16(2000); 6380 cpu_to_le16(2000);
6361 } else { 6381 } else {
6362#endif /* CONFIG_IPW2200_MONITOR */ 6382#endif /* CONFIG_IPW2200_MONITOR */
6363 /* If we are roaming, then make this a directed scan for the 6383 /* Honor direct scans first, otherwise if we are roaming make
6364 * current network. Otherwise, ensure that every other scan 6384 * this a direct scan for the current network. Finally,
6365 * is a fast channel hop scan */ 6385 * ensure that every other scan is a fast channel hop scan */
6366 if ((priv->status & STATUS_ROAMING) 6386 if (direct) {
6367 || (!(priv->status & STATUS_ASSOCIATED) 6387 err = ipw_send_ssid(priv, priv->direct_scan_ssid,
6368 && (priv->config & CFG_STATIC_ESSID) 6388 priv->direct_scan_ssid_len);
6369 && (le32_to_cpu(scan.full_scan_index) % 2))) { 6389 if (err) {
6390 IPW_DEBUG_HC("Attempt to send SSID command "
6391 "failed\n");
6392 goto done;
6393 }
6394
6395 scan_type = IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN;
6396 } else if ((priv->status & STATUS_ROAMING)
6397 || (!(priv->status & STATUS_ASSOCIATED)
6398 && (priv->config & CFG_STATIC_ESSID)
6399 && (le32_to_cpu(scan.full_scan_index) % 2))) {
6370 err = ipw_send_ssid(priv, priv->essid, priv->essid_len); 6400 err = ipw_send_ssid(priv, priv->essid, priv->essid_len);
6371 if (err) { 6401 if (err) {
6372 IPW_DEBUG_HC("Attempt to send SSID command " 6402 IPW_DEBUG_HC("Attempt to send SSID command "
@@ -6391,7 +6421,12 @@ send_request:
6391 } 6421 }
6392 6422
6393 priv->status |= STATUS_SCANNING; 6423 priv->status |= STATUS_SCANNING;
6394 priv->status &= ~STATUS_SCAN_PENDING; 6424 if (direct) {
6425 priv->status &= ~STATUS_DIRECT_SCAN_PENDING;
6426 priv->direct_scan_ssid_len = 0;
6427 } else
6428 priv->status &= ~STATUS_SCAN_PENDING;
6429
6395 queue_delayed_work(priv->workqueue, &priv->scan_check, 6430 queue_delayed_work(priv->workqueue, &priv->scan_check,
6396 IPW_SCAN_CHECK_WATCHDOG); 6431 IPW_SCAN_CHECK_WATCHDOG);
6397done: 6432done:
@@ -6402,15 +6437,22 @@ done:
6402static void ipw_request_passive_scan(struct work_struct *work) 6437static void ipw_request_passive_scan(struct work_struct *work)
6403{ 6438{
6404 struct ipw_priv *priv = 6439 struct ipw_priv *priv =
6405 container_of(work, struct ipw_priv, request_passive_scan); 6440 container_of(work, struct ipw_priv, request_passive_scan.work);
6406 ipw_request_scan_helper(priv, IW_SCAN_TYPE_PASSIVE); 6441 ipw_request_scan_helper(priv, IW_SCAN_TYPE_PASSIVE, 0);
6407} 6442}
6408 6443
6409static void ipw_request_scan(struct work_struct *work) 6444static void ipw_request_scan(struct work_struct *work)
6410{ 6445{
6411 struct ipw_priv *priv = 6446 struct ipw_priv *priv =
6412 container_of(work, struct ipw_priv, request_scan.work); 6447 container_of(work, struct ipw_priv, request_scan.work);
6413 ipw_request_scan_helper(priv, IW_SCAN_TYPE_ACTIVE); 6448 ipw_request_scan_helper(priv, IW_SCAN_TYPE_ACTIVE, 0);
6449}
6450
6451static void ipw_request_direct_scan(struct work_struct *work)
6452{
6453 struct ipw_priv *priv =
6454 container_of(work, struct ipw_priv, request_direct_scan.work);
6455 ipw_request_scan_helper(priv, IW_SCAN_TYPE_ACTIVE, 1);
6414} 6456}
6415 6457
6416static void ipw_bg_abort_scan(struct work_struct *work) 6458static void ipw_bg_abort_scan(struct work_struct *work)
@@ -7558,8 +7600,31 @@ static int ipw_associate(void *data)
7558 priv->ieee->iw_mode == IW_MODE_ADHOC && 7600 priv->ieee->iw_mode == IW_MODE_ADHOC &&
7559 priv->config & CFG_ADHOC_CREATE && 7601 priv->config & CFG_ADHOC_CREATE &&
7560 priv->config & CFG_STATIC_ESSID && 7602 priv->config & CFG_STATIC_ESSID &&
7561 priv->config & CFG_STATIC_CHANNEL && 7603 priv->config & CFG_STATIC_CHANNEL) {
7562 !list_empty(&priv->ieee->network_free_list)) { 7604 /* Use oldest network if the free list is empty */
7605 if (list_empty(&priv->ieee->network_free_list)) {
7606 struct ieee80211_network *oldest = NULL;
7607 struct ieee80211_network *target;
7608 DECLARE_MAC_BUF(mac);
7609
7610 list_for_each_entry(target, &priv->ieee->network_list, list) {
7611 if ((oldest == NULL) ||
7612 (target->last_scanned < oldest->last_scanned))
7613 oldest = target;
7614 }
7615
7616 /* If there are no more slots, expire the oldest */
7617 list_del(&oldest->list);
7618 target = oldest;
7619 IPW_DEBUG_ASSOC("Expired '%s' (%s) from "
7620 "network list.\n",
7621 escape_essid(target->ssid,
7622 target->ssid_len),
7623 print_mac(mac, target->bssid));
7624 list_add_tail(&target->list,
7625 &priv->ieee->network_free_list);
7626 }
7627
7563 element = priv->ieee->network_free_list.next; 7628 element = priv->ieee->network_free_list.next;
7564 network = list_entry(element, struct ieee80211_network, list); 7629 network = list_entry(element, struct ieee80211_network, list);
7565 ipw_adhoc_create(priv, network); 7630 ipw_adhoc_create(priv, network);
@@ -9454,99 +9519,38 @@ static int ipw_wx_get_retry(struct net_device *dev,
9454 return 0; 9519 return 0;
9455} 9520}
9456 9521
9457static int ipw_request_direct_scan(struct ipw_priv *priv, char *essid,
9458 int essid_len)
9459{
9460 struct ipw_scan_request_ext scan;
9461 int err = 0, scan_type;
9462
9463 if (!(priv->status & STATUS_INIT) ||
9464 (priv->status & STATUS_EXIT_PENDING))
9465 return 0;
9466
9467 mutex_lock(&priv->mutex);
9468
9469 if (priv->status & STATUS_RF_KILL_MASK) {
9470 IPW_DEBUG_HC("Aborting scan due to RF kill activation\n");
9471 priv->status |= STATUS_SCAN_PENDING;
9472 goto done;
9473 }
9474
9475 IPW_DEBUG_HC("starting request direct scan!\n");
9476
9477 if (priv->status & (STATUS_SCANNING | STATUS_SCAN_ABORTING)) {
9478 /* We should not sleep here; otherwise we will block most
9479 * of the system (for instance, we hold rtnl_lock when we
9480 * get here).
9481 */
9482 err = -EAGAIN;
9483 goto done;
9484 }
9485 memset(&scan, 0, sizeof(scan));
9486
9487 if (priv->config & CFG_SPEED_SCAN)
9488 scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] =
9489 cpu_to_le16(30);
9490 else
9491 scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] =
9492 cpu_to_le16(20);
9493
9494 scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN] =
9495 cpu_to_le16(20);
9496 scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = cpu_to_le16(120);
9497 scan.dwell_time[IPW_SCAN_ACTIVE_DIRECT_SCAN] = cpu_to_le16(20);
9498
9499 scan.full_scan_index = cpu_to_le32(ieee80211_get_scans(priv->ieee));
9500
9501 err = ipw_send_ssid(priv, essid, essid_len);
9502 if (err) {
9503 IPW_DEBUG_HC("Attempt to send SSID command failed\n");
9504 goto done;
9505 }
9506 scan_type = IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN;
9507
9508 ipw_add_scan_channels(priv, &scan, scan_type);
9509
9510 err = ipw_send_scan_request_ext(priv, &scan);
9511 if (err) {
9512 IPW_DEBUG_HC("Sending scan command failed: %08X\n", err);
9513 goto done;
9514 }
9515
9516 priv->status |= STATUS_SCANNING;
9517
9518 done:
9519 mutex_unlock(&priv->mutex);
9520 return err;
9521}
9522
9523static int ipw_wx_set_scan(struct net_device *dev, 9522static int ipw_wx_set_scan(struct net_device *dev,
9524 struct iw_request_info *info, 9523 struct iw_request_info *info,
9525 union iwreq_data *wrqu, char *extra) 9524 union iwreq_data *wrqu, char *extra)
9526{ 9525{
9527 struct ipw_priv *priv = ieee80211_priv(dev); 9526 struct ipw_priv *priv = ieee80211_priv(dev);
9528 struct iw_scan_req *req = (struct iw_scan_req *)extra; 9527 struct iw_scan_req *req = (struct iw_scan_req *)extra;
9528 struct delayed_work *work = NULL;
9529 9529
9530 mutex_lock(&priv->mutex); 9530 mutex_lock(&priv->mutex);
9531
9531 priv->user_requested_scan = 1; 9532 priv->user_requested_scan = 1;
9532 mutex_unlock(&priv->mutex);
9533 9533
9534 if (wrqu->data.length == sizeof(struct iw_scan_req)) { 9534 if (wrqu->data.length == sizeof(struct iw_scan_req)) {
9535 if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { 9535 if (wrqu->data.flags & IW_SCAN_THIS_ESSID) {
9536 ipw_request_direct_scan(priv, req->essid, 9536 int len = min((int)req->essid_len,
9537 req->essid_len); 9537 (int)sizeof(priv->direct_scan_ssid));
9538 return 0; 9538 memcpy(priv->direct_scan_ssid, req->essid, len);
9539 } 9539 priv->direct_scan_ssid_len = len;
9540 if (req->scan_type == IW_SCAN_TYPE_PASSIVE) { 9540 work = &priv->request_direct_scan;
9541 queue_work(priv->workqueue, 9541 } else if (req->scan_type == IW_SCAN_TYPE_PASSIVE) {
9542 &priv->request_passive_scan); 9542 work = &priv->request_passive_scan;
9543 return 0;
9544 } 9543 }
9544 } else {
9545 /* Normal active broadcast scan */
9546 work = &priv->request_scan;
9545 } 9547 }
9546 9548
9549 mutex_unlock(&priv->mutex);
9550
9547 IPW_DEBUG_WX("Start scan\n"); 9551 IPW_DEBUG_WX("Start scan\n");
9548 9552
9549 queue_delayed_work(priv->workqueue, &priv->request_scan, 0); 9553 queue_delayed_work(priv->workqueue, work, 0);
9550 9554
9551 return 0; 9555 return 0;
9552} 9556}
@@ -10708,6 +10712,8 @@ static void ipw_link_up(struct ipw_priv *priv)
10708 } 10712 }
10709 10713
10710 cancel_delayed_work(&priv->request_scan); 10714 cancel_delayed_work(&priv->request_scan);
10715 cancel_delayed_work(&priv->request_direct_scan);
10716 cancel_delayed_work(&priv->request_passive_scan);
10711 cancel_delayed_work(&priv->scan_event); 10717 cancel_delayed_work(&priv->scan_event);
10712 ipw_reset_stats(priv); 10718 ipw_reset_stats(priv);
10713 /* Ensure the rate is updated immediately */ 10719 /* Ensure the rate is updated immediately */
@@ -10738,6 +10744,8 @@ static void ipw_link_down(struct ipw_priv *priv)
10738 10744
10739 /* Cancel any queued work ... */ 10745 /* Cancel any queued work ... */
10740 cancel_delayed_work(&priv->request_scan); 10746 cancel_delayed_work(&priv->request_scan);
10747 cancel_delayed_work(&priv->request_direct_scan);
10748 cancel_delayed_work(&priv->request_passive_scan);
10741 cancel_delayed_work(&priv->adhoc_check); 10749 cancel_delayed_work(&priv->adhoc_check);
10742 cancel_delayed_work(&priv->gather_stats); 10750 cancel_delayed_work(&priv->gather_stats);
10743 10751
@@ -10777,8 +10785,9 @@ static int __devinit ipw_setup_deferred_work(struct ipw_priv *priv)
10777 INIT_WORK(&priv->up, ipw_bg_up); 10785 INIT_WORK(&priv->up, ipw_bg_up);
10778 INIT_WORK(&priv->down, ipw_bg_down); 10786 INIT_WORK(&priv->down, ipw_bg_down);
10779 INIT_DELAYED_WORK(&priv->request_scan, ipw_request_scan); 10787 INIT_DELAYED_WORK(&priv->request_scan, ipw_request_scan);
10788 INIT_DELAYED_WORK(&priv->request_direct_scan, ipw_request_direct_scan);
10789 INIT_DELAYED_WORK(&priv->request_passive_scan, ipw_request_passive_scan);
10780 INIT_DELAYED_WORK(&priv->scan_event, ipw_scan_event); 10790 INIT_DELAYED_WORK(&priv->scan_event, ipw_scan_event);
10781 INIT_WORK(&priv->request_passive_scan, ipw_request_passive_scan);
10782 INIT_DELAYED_WORK(&priv->gather_stats, ipw_bg_gather_stats); 10791 INIT_DELAYED_WORK(&priv->gather_stats, ipw_bg_gather_stats);
10783 INIT_WORK(&priv->abort_scan, ipw_bg_abort_scan); 10792 INIT_WORK(&priv->abort_scan, ipw_bg_abort_scan);
10784 INIT_WORK(&priv->roam, ipw_bg_roam); 10793 INIT_WORK(&priv->roam, ipw_bg_roam);
@@ -11812,6 +11821,8 @@ static void __devexit ipw_pci_remove(struct pci_dev *pdev)
11812 cancel_delayed_work(&priv->adhoc_check); 11821 cancel_delayed_work(&priv->adhoc_check);
11813 cancel_delayed_work(&priv->gather_stats); 11822 cancel_delayed_work(&priv->gather_stats);
11814 cancel_delayed_work(&priv->request_scan); 11823 cancel_delayed_work(&priv->request_scan);
11824 cancel_delayed_work(&priv->request_direct_scan);
11825 cancel_delayed_work(&priv->request_passive_scan);
11815 cancel_delayed_work(&priv->scan_event); 11826 cancel_delayed_work(&priv->scan_event);
11816 cancel_delayed_work(&priv->rf_kill); 11827 cancel_delayed_work(&priv->rf_kill);
11817 cancel_delayed_work(&priv->scan_check); 11828 cancel_delayed_work(&priv->scan_check);
diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h
index cd3295b66dd6..d4ab28b73b32 100644
--- a/drivers/net/wireless/ipw2200.h
+++ b/drivers/net/wireless/ipw2200.h
@@ -1037,6 +1037,7 @@ struct ipw_cmd { /* XXX */
1037#define STATUS_DISASSOC_PENDING (1<<12) 1037#define STATUS_DISASSOC_PENDING (1<<12)
1038#define STATUS_STATE_PENDING (1<<13) 1038#define STATUS_STATE_PENDING (1<<13)
1039 1039
1040#define STATUS_DIRECT_SCAN_PENDING (1<<19)
1040#define STATUS_SCAN_PENDING (1<<20) 1041#define STATUS_SCAN_PENDING (1<<20)
1041#define STATUS_SCANNING (1<<21) 1042#define STATUS_SCANNING (1<<21)
1042#define STATUS_SCAN_ABORTING (1<<22) 1043#define STATUS_SCAN_ABORTING (1<<22)
@@ -1292,6 +1293,8 @@ struct ipw_priv {
1292 struct iw_public_data wireless_data; 1293 struct iw_public_data wireless_data;
1293 1294
1294 int user_requested_scan; 1295 int user_requested_scan;
1296 u8 direct_scan_ssid[IW_ESSID_MAX_SIZE];
1297 u8 direct_scan_ssid_len;
1295 1298
1296 struct workqueue_struct *workqueue; 1299 struct workqueue_struct *workqueue;
1297 1300
@@ -1301,8 +1304,9 @@ struct ipw_priv {
1301 struct work_struct system_config; 1304 struct work_struct system_config;
1302 struct work_struct rx_replenish; 1305 struct work_struct rx_replenish;
1303 struct delayed_work request_scan; 1306 struct delayed_work request_scan;
1307 struct delayed_work request_direct_scan;
1308 struct delayed_work request_passive_scan;
1304 struct delayed_work scan_event; 1309 struct delayed_work scan_event;
1305 struct work_struct request_passive_scan;
1306 struct work_struct adapter_restart; 1310 struct work_struct adapter_restart;
1307 struct delayed_work rf_kill; 1311 struct delayed_work rf_kill;
1308 struct work_struct up; 1312 struct work_struct up;
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-led.c b/drivers/net/wireless/iwlwifi/iwl-3945-led.c
index d200d08fb086..8b1528e52d43 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-led.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-led.c
@@ -229,14 +229,15 @@ static int iwl3945_led_register_led(struct iwl3945_priv *priv,
229 led->led_dev.brightness_set = iwl3945_led_brightness_set; 229 led->led_dev.brightness_set = iwl3945_led_brightness_set;
230 led->led_dev.default_trigger = trigger; 230 led->led_dev.default_trigger = trigger;
231 231
232 led->priv = priv;
233 led->type = type;
234
232 ret = led_classdev_register(device, &led->led_dev); 235 ret = led_classdev_register(device, &led->led_dev);
233 if (ret) { 236 if (ret) {
234 IWL_ERROR("Error: failed to register led handler.\n"); 237 IWL_ERROR("Error: failed to register led handler.\n");
235 return ret; 238 return ret;
236 } 239 }
237 240
238 led->priv = priv;
239 led->type = type;
240 led->registered = 1; 241 led->registered = 1;
241 242
242 if (set_led && led->led_on) 243 if (set_led && led->led_on)
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
index a955f9c1b9ee..d8f2b4d33fd9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
@@ -1145,7 +1145,6 @@ static s32 rs_get_best_rate(struct iwl_priv *priv,
1145 1145
1146 /* Higher rate not available, use the original */ 1146 /* Higher rate not available, use the original */
1147 } else { 1147 } else {
1148 new_rate = rate;
1149 break; 1148 break;
1150 } 1149 }
1151 } 1150 }
@@ -1977,7 +1976,7 @@ lq_update:
1977 * 2) Not just finishing up a search 1976 * 2) Not just finishing up a search
1978 * 3) Allowing a new search 1977 * 3) Allowing a new search
1979 */ 1978 */
1980 if (!update_lq && !done_search && !lq_sta->stay_in_tbl) { 1979 if (!update_lq && !done_search && !lq_sta->stay_in_tbl && window->counter) {
1981 /* Save current throughput to compare with "search" throughput*/ 1980 /* Save current throughput to compare with "search" throughput*/
1982 lq_sta->last_tpt = current_tpt; 1981 lq_sta->last_tpt = current_tpt;
1983 1982
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index cf261d3487fd..75427e61898d 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -1858,6 +1858,9 @@ static void lbs_send_confirmsleep(struct lbs_private *priv)
1858 1858
1859 spin_lock_irqsave(&priv->driver_lock, flags); 1859 spin_lock_irqsave(&priv->driver_lock, flags);
1860 1860
1861 /* We don't get a response on the sleep-confirmation */
1862 priv->dnld_sent = DNLD_RES_RECEIVED;
1863
1861 /* If nothing to do, go back to sleep (?) */ 1864 /* If nothing to do, go back to sleep (?) */
1862 if (!__kfifo_len(priv->event_fifo) && !priv->resp_len[priv->resp_idx]) 1865 if (!__kfifo_len(priv->event_fifo) && !priv->resp_len[priv->resp_idx])
1863 priv->psstate = PS_STATE_SLEEP; 1866 priv->psstate = PS_STATE_SLEEP;
@@ -1920,12 +1923,12 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv)
1920 1923
1921 lbs_deb_enter(LBS_DEB_HOST); 1924 lbs_deb_enter(LBS_DEB_HOST);
1922 1925
1926 spin_lock_irqsave(&priv->driver_lock, flags);
1923 if (priv->dnld_sent) { 1927 if (priv->dnld_sent) {
1924 allowed = 0; 1928 allowed = 0;
1925 lbs_deb_host("dnld_sent was set\n"); 1929 lbs_deb_host("dnld_sent was set\n");
1926 } 1930 }
1927 1931
1928 spin_lock_irqsave(&priv->driver_lock, flags);
1929 /* In-progress command? */ 1932 /* In-progress command? */
1930 if (priv->cur_cmd) { 1933 if (priv->cur_cmd) {
1931 allowed = 0; 1934 allowed = 0;
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
index ad2fabca9116..0aa0ce3b2c42 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -312,8 +312,8 @@ static ssize_t lbs_threshold_write(uint16_t tlv_type, uint16_t event_mask,
312 if (tlv_type != TLV_TYPE_BCNMISS) 312 if (tlv_type != TLV_TYPE_BCNMISS)
313 tlv->freq = freq; 313 tlv->freq = freq;
314 314
315 /* The command header, the event mask, and the one TLV */ 315 /* The command header, the action, the event mask, and one TLV */
316 events->hdr.size = cpu_to_le16(sizeof(events->hdr) + 2 + sizeof(*tlv)); 316 events->hdr.size = cpu_to_le16(sizeof(events->hdr) + 4 + sizeof(*tlv));
317 317
318 ret = lbs_cmd_with_response(priv, CMD_802_11_SUBSCRIBE_EVENT, events); 318 ret = lbs_cmd_with_response(priv, CMD_802_11_SUBSCRIBE_EVENT, events);
319 319
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index b7ab3590b586..abd6d9ed8f4b 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -765,8 +765,8 @@ static int lbs_thread(void *data)
765 lbs_deb_thread("4: currenttxskb %p, dnld_sent %d\n", 765 lbs_deb_thread("4: currenttxskb %p, dnld_sent %d\n",
766 priv->currenttxskb, priv->dnld_sent); 766 priv->currenttxskb, priv->dnld_sent);
767 767
768 spin_lock_irq(&priv->driver_lock);
769 /* Process any pending command response */ 768 /* Process any pending command response */
769 spin_lock_irq(&priv->driver_lock);
770 resp_idx = priv->resp_idx; 770 resp_idx = priv->resp_idx;
771 if (priv->resp_len[resp_idx]) { 771 if (priv->resp_len[resp_idx]) {
772 spin_unlock_irq(&priv->driver_lock); 772 spin_unlock_irq(&priv->driver_lock);
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
index 98ddbb3b3273..1610a7308c1d 100644
--- a/drivers/net/wireless/p54/p54usb.c
+++ b/drivers/net/wireless/p54/p54usb.c
@@ -49,6 +49,7 @@ static struct usb_device_id p54u_table[] __devinitdata = {
49 {USB_DEVICE(0x5041, 0x2235)}, /* Linksys WUSB54G Portable */ 49 {USB_DEVICE(0x5041, 0x2235)}, /* Linksys WUSB54G Portable */
50 50
51 /* Version 2 devices (3887) */ 51 /* Version 2 devices (3887) */
52 {USB_DEVICE(0x0471, 0x1230)}, /* Philips CPWUA054/00 */
52 {USB_DEVICE(0x050d, 0x7050)}, /* Belkin F5D7050 ver 1000 */ 53 {USB_DEVICE(0x050d, 0x7050)}, /* Belkin F5D7050 ver 1000 */
53 {USB_DEVICE(0x0572, 0x2000)}, /* Cohiba Proto board */ 54 {USB_DEVICE(0x0572, 0x2000)}, /* Cohiba Proto board */
54 {USB_DEVICE(0x0572, 0x2002)}, /* Cohiba Proto board */ 55 {USB_DEVICE(0x0572, 0x2002)}, /* Cohiba Proto board */
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index ed310f84f28b..3954897d0678 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -116,6 +116,7 @@ MODULE_PARM_DESC(workaround_interval,
116#define OID_802_11_ENCRYPTION_STATUS ccpu2(0x0d01011b) 116#define OID_802_11_ENCRYPTION_STATUS ccpu2(0x0d01011b)
117#define OID_802_11_ADD_KEY ccpu2(0x0d01011d) 117#define OID_802_11_ADD_KEY ccpu2(0x0d01011d)
118#define OID_802_11_REMOVE_KEY ccpu2(0x0d01011e) 118#define OID_802_11_REMOVE_KEY ccpu2(0x0d01011e)
119#define OID_802_11_ASSOCIATION_INFORMATION ccpu2(0x0d01011f)
119#define OID_802_11_PMKID ccpu2(0x0d010123) 120#define OID_802_11_PMKID ccpu2(0x0d010123)
120#define OID_802_11_NETWORK_TYPES_SUPPORTED ccpu2(0x0d010203) 121#define OID_802_11_NETWORK_TYPES_SUPPORTED ccpu2(0x0d010203)
121#define OID_802_11_NETWORK_TYPE_IN_USE ccpu2(0x0d010204) 122#define OID_802_11_NETWORK_TYPE_IN_USE ccpu2(0x0d010204)
@@ -271,6 +272,26 @@ struct ndis_config_param {
271 __le32 value_length; 272 __le32 value_length;
272} __attribute__((packed)); 273} __attribute__((packed));
273 274
275struct ndis_80211_assoc_info {
276 __le32 length;
277 __le16 req_ies;
278 struct req_ie {
279 __le16 capa;
280 __le16 listen_interval;
281 u8 cur_ap_address[6];
282 } req_ie;
283 __le32 req_ie_length;
284 __le32 offset_req_ies;
285 __le16 resp_ies;
286 struct resp_ie {
287 __le16 capa;
288 __le16 status_code;
289 __le16 assoc_id;
290 } resp_ie;
291 __le32 resp_ie_length;
292 __le32 offset_resp_ies;
293} __attribute__((packed));
294
274/* these have to match what is in wpa_supplicant */ 295/* these have to match what is in wpa_supplicant */
275enum wpa_alg { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP }; 296enum wpa_alg { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP };
276enum wpa_cipher { CIPHER_NONE, CIPHER_WEP40, CIPHER_TKIP, CIPHER_CCMP, 297enum wpa_cipher { CIPHER_NONE, CIPHER_WEP40, CIPHER_TKIP, CIPHER_CCMP,
@@ -674,6 +695,12 @@ static int get_bssid(struct usbnet *usbdev, u8 bssid[ETH_ALEN])
674 return ret; 695 return ret;
675} 696}
676 697
698static int get_association_info(struct usbnet *usbdev,
699 struct ndis_80211_assoc_info *info, int len)
700{
701 return rndis_query_oid(usbdev, OID_802_11_ASSOCIATION_INFORMATION,
702 info, &len);
703}
677 704
678static int is_associated(struct usbnet *usbdev) 705static int is_associated(struct usbnet *usbdev)
679{ 706{
@@ -2182,11 +2209,40 @@ static void rndis_wext_worker(struct work_struct *work)
2182 struct usbnet *usbdev = priv->usbdev; 2209 struct usbnet *usbdev = priv->usbdev;
2183 union iwreq_data evt; 2210 union iwreq_data evt;
2184 unsigned char bssid[ETH_ALEN]; 2211 unsigned char bssid[ETH_ALEN];
2185 int ret; 2212 struct ndis_80211_assoc_info *info;
2213 int assoc_size = sizeof(*info) + IW_CUSTOM_MAX + 32;
2214 int ret, offset;
2186 2215
2187 if (test_and_clear_bit(WORK_CONNECTION_EVENT, &priv->work_pending)) { 2216 if (test_and_clear_bit(WORK_CONNECTION_EVENT, &priv->work_pending)) {
2188 ret = get_bssid(usbdev, bssid); 2217 info = kzalloc(assoc_size, GFP_KERNEL);
2218 if (!info)
2219 goto get_bssid;
2220
2221 /* Get association info IEs from device and send them back to
2222 * userspace. */
2223 ret = get_association_info(usbdev, info, assoc_size);
2224 if (!ret) {
2225 evt.data.length = le32_to_cpu(info->req_ie_length);
2226 if (evt.data.length > 0) {
2227 offset = le32_to_cpu(info->offset_req_ies);
2228 wireless_send_event(usbdev->net,
2229 IWEVASSOCREQIE, &evt,
2230 (char *)info + offset);
2231 }
2232
2233 evt.data.length = le32_to_cpu(info->resp_ie_length);
2234 if (evt.data.length > 0) {
2235 offset = le32_to_cpu(info->offset_resp_ies);
2236 wireless_send_event(usbdev->net,
2237 IWEVASSOCRESPIE, &evt,
2238 (char *)info + offset);
2239 }
2240 }
2241
2242 kfree(info);
2189 2243
2244get_bssid:
2245 ret = get_bssid(usbdev, bssid);
2190 if (!ret) { 2246 if (!ret) {
2191 evt.data.flags = 0; 2247 evt.data.flags = 0;
2192 evt.data.length = 0; 2248 evt.data.length = 0;
@@ -2414,6 +2470,11 @@ static int bcm4320_early_init(struct usbnet *dev)
2414 else if (priv->param_power_save > 2) 2470 else if (priv->param_power_save > 2)
2415 priv->param_power_save = 2; 2471 priv->param_power_save = 2;
2416 2472
2473 if (priv->param_power_output < 0)
2474 priv->param_power_output = 0;
2475 else if (priv->param_power_output > 3)
2476 priv->param_power_output = 3;
2477
2417 if (priv->param_roamtrigger < -80) 2478 if (priv->param_roamtrigger < -80)
2418 priv->param_roamtrigger = -80; 2479 priv->param_roamtrigger = -80;
2419 else if (priv->param_roamtrigger > -60) 2480 else if (priv->param_roamtrigger > -60)
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 5c7220ea46e6..15ec797c5ec1 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -328,6 +328,11 @@ static inline int rt2x00_get_link_ant_rssi(struct link *link)
328 return DEFAULT_RSSI; 328 return DEFAULT_RSSI;
329} 329}
330 330
331static inline void rt2x00_reset_link_ant_rssi(struct link *link)
332{
333 link->ant.rssi_ant = 0;
334}
335
331static inline int rt2x00_get_link_ant_rssi_history(struct link *link, 336static inline int rt2x00_get_link_ant_rssi_history(struct link *link,
332 enum antenna ant) 337 enum antenna ant)
333{ 338{
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c
index a9930a03f450..48608e8cc8b4 100644
--- a/drivers/net/wireless/rt2x00/rt2x00config.c
+++ b/drivers/net/wireless/rt2x00/rt2x00config.c
@@ -129,6 +129,7 @@ void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev,
129 */ 129 */
130 rt2x00dev->ops->lib->config(rt2x00dev, &libconf, CONFIG_UPDATE_ANTENNA); 130 rt2x00dev->ops->lib->config(rt2x00dev, &libconf, CONFIG_UPDATE_ANTENNA);
131 rt2x00lib_reset_link_tuner(rt2x00dev); 131 rt2x00lib_reset_link_tuner(rt2x00dev);
132 rt2x00_reset_link_ant_rssi(&rt2x00dev->link);
132 133
133 rt2x00dev->link.ant.active.rx = libconf.ant.rx; 134 rt2x00dev->link.ant.active.rx = libconf.ant.rx;
134 rt2x00dev->link.ant.active.tx = libconf.ant.tx; 135 rt2x00dev->link.ant.active.tx = libconf.ant.tx;
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 69e233610c94..f7a44170c025 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -481,9 +481,9 @@ void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev)
481 if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags)) 481 if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
482 return; 482 return;
483 483
484 ieee80211_iterate_active_interfaces(rt2x00dev->hw, 484 ieee80211_iterate_active_interfaces_atomic(rt2x00dev->hw,
485 rt2x00lib_beacondone_iter, 485 rt2x00lib_beacondone_iter,
486 rt2x00dev); 486 rt2x00dev);
487 487
488 queue_work(rt2x00dev->hw->workqueue, &rt2x00dev->intf_work); 488 queue_work(rt2x00dev->hw->workqueue, &rt2x00dev->intf_work);
489} 489}
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index c05e05b58887..b02dbc8a666e 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -114,6 +114,7 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
114 */ 114 */
115 if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags)) { 115 if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags)) {
116 ieee80211_stop_queues(hw); 116 ieee80211_stop_queues(hw);
117 dev_kfree_skb_any(skb);
117 return NETDEV_TX_OK; 118 return NETDEV_TX_OK;
118 } 119 }
119 120
diff --git a/drivers/net/wireless/rtl8180_grf5101.c b/drivers/net/wireless/rtl8180_grf5101.c
index 5d47935dbac3..947ee55f18b2 100644
--- a/drivers/net/wireless/rtl8180_grf5101.c
+++ b/drivers/net/wireless/rtl8180_grf5101.c
@@ -88,7 +88,7 @@ static void grf5101_rf_set_channel(struct ieee80211_hw *dev,
88 write_grf5101(dev, 0x0B, chan); 88 write_grf5101(dev, 0x0B, chan);
89 write_grf5101(dev, 0x07, 0x1000); 89 write_grf5101(dev, 0x07, 0x1000);
90 90
91 grf5101_write_phy_antenna(dev, chan); 91 grf5101_write_phy_antenna(dev, channel);
92} 92}
93 93
94static void grf5101_rf_stop(struct ieee80211_hw *dev) 94static void grf5101_rf_stop(struct ieee80211_hw *dev)
diff --git a/drivers/net/wireless/rtl8180_max2820.c b/drivers/net/wireless/rtl8180_max2820.c
index a34dfd382b6d..6c825fd7f3b6 100644
--- a/drivers/net/wireless/rtl8180_max2820.c
+++ b/drivers/net/wireless/rtl8180_max2820.c
@@ -78,7 +78,8 @@ static void max2820_rf_set_channel(struct ieee80211_hw *dev,
78 struct ieee80211_conf *conf) 78 struct ieee80211_conf *conf)
79{ 79{
80 struct rtl8180_priv *priv = dev->priv; 80 struct rtl8180_priv *priv = dev->priv;
81 int channel = ieee80211_frequency_to_channel(conf->channel->center_freq); 81 int channel = conf ?
82 ieee80211_frequency_to_channel(conf->channel->center_freq) : 1;
82 unsigned int chan_idx = channel - 1; 83 unsigned int chan_idx = channel - 1;
83 u32 txpw = priv->channels[chan_idx].hw_value & 0xFF; 84 u32 txpw = priv->channels[chan_idx].hw_value & 0xFF;
84 u32 chan = max2820_chan[chan_idx]; 85 u32 chan = max2820_chan[chan_idx];
@@ -87,7 +88,7 @@ static void max2820_rf_set_channel(struct ieee80211_hw *dev,
87 * sa2400, for MAXIM we do this directly from BB */ 88 * sa2400, for MAXIM we do this directly from BB */
88 rtl8180_write_phy(dev, 3, txpw); 89 rtl8180_write_phy(dev, 3, txpw);
89 90
90 max2820_write_phy_antenna(dev, chan); 91 max2820_write_phy_antenna(dev, channel);
91 write_max2820(dev, 3, chan); 92 write_max2820(dev, 3, chan);
92} 93}
93 94
diff --git a/drivers/net/wireless/rtl8180_sa2400.c b/drivers/net/wireless/rtl8180_sa2400.c
index 0311b4ea124c..cea4e0ccb92d 100644
--- a/drivers/net/wireless/rtl8180_sa2400.c
+++ b/drivers/net/wireless/rtl8180_sa2400.c
@@ -86,7 +86,7 @@ static void sa2400_rf_set_channel(struct ieee80211_hw *dev,
86 86
87 write_sa2400(dev, 7, txpw); 87 write_sa2400(dev, 7, txpw);
88 88
89 sa2400_write_phy_antenna(dev, chan); 89 sa2400_write_phy_antenna(dev, channel);
90 90
91 write_sa2400(dev, 0, chan); 91 write_sa2400(dev, 0, chan);
92 write_sa2400(dev, 1, 0xbb50); 92 write_sa2400(dev, 1, 0xbb50);
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c
index d2378d083a35..6d86b365f150 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -647,7 +647,7 @@ int zd_mac_rx(struct ieee80211_hw *hw, const u8 *buffer, unsigned int length)
647 fc = le16_to_cpu(*((__le16 *) buffer)); 647 fc = le16_to_cpu(*((__le16 *) buffer));
648 648
649 is_qos = ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) && 649 is_qos = ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) &&
650 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_QOS_DATA); 650 (fc & IEEE80211_STYPE_QOS_DATA);
651 is_4addr = (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == 651 is_4addr = (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==
652 (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS); 652 (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS);
653 need_padding = is_qos ^ is_4addr; 653 need_padding = is_qos ^ is_4addr;