aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-02-15 18:56:47 -0500
committerDavid S. Miller <davem@davemloft.net>2008-02-15 18:56:47 -0500
commit42fe95cae50bbea4c83b15962b853d6d3b14db37 (patch)
tree08b8ce6c26fbfd63d03d84caf5843a503a2c9a24
parent997b37da1515c1620692521786a74af271664eb7 (diff)
parent6fff1c64ffd899e0b70fbb0201c6603f078ea942 (diff)
Merge branch 'fixes' of master.kernel.org:/pub/scm/linux/kernel/git/linville/wireless-2.6
-rw-r--r--drivers/net/wireless/ath5k/base.c4
-rw-r--r--drivers/net/wireless/ath5k/hw.c34
-rw-r--r--drivers/net/wireless/b43/b43.h6
-rw-r--r--drivers/net/wireless/b43/main.c40
-rw-r--r--drivers/net/wireless/b43legacy/b43legacy.h4
-rw-r--r--drivers/net/wireless/b43legacy/dma.c167
-rw-r--r--drivers/net/wireless/b43legacy/dma.h33
-rw-r--r--drivers/net/wireless/b43legacy/main.c41
-rw-r--r--drivers/net/wireless/ipw2200.c45
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c19
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c17
-rw-r--r--drivers/net/wireless/rndis_wlan.c14
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c2
-rw-r--r--drivers/net/wireless/wavelan.h6
-rw-r--r--net/mac80211/ieee80211.c5
15 files changed, 291 insertions, 146 deletions
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index ddc87149fe31..dfdaec020739 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -1256,7 +1256,7 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
1256 if (ctl->flags & IEEE80211_TXCTL_NO_ACK) 1256 if (ctl->flags & IEEE80211_TXCTL_NO_ACK)
1257 flags |= AR5K_TXDESC_NOACK; 1257 flags |= AR5K_TXDESC_NOACK;
1258 1258
1259 pktlen = skb->len + FCS_LEN; 1259 pktlen = skb->len;
1260 1260
1261 if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) { 1261 if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) {
1262 keyidx = ctl->key_idx; 1262 keyidx = ctl->key_idx;
@@ -1952,7 +1952,7 @@ ath5k_beacon_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
1952 } 1952 }
1953 1953
1954 ds->ds_data = bf->skbaddr; 1954 ds->ds_data = bf->skbaddr;
1955 ret = ah->ah_setup_tx_desc(ah, ds, skb->len + FCS_LEN, 1955 ret = ah->ah_setup_tx_desc(ah, ds, skb->len,
1956 ieee80211_get_hdrlen_from_skb(skb), 1956 ieee80211_get_hdrlen_from_skb(skb),
1957 AR5K_PKT_TYPE_BEACON, (ctl->power_level * 2), ctl->tx_rate, 1, 1957 AR5K_PKT_TYPE_BEACON, (ctl->power_level * 2), ctl->tx_rate, 1,
1958 AR5K_TXKEYIX_INVALID, antenna, flags, 0, 0); 1958 AR5K_TXKEYIX_INVALID, antenna, flags, 0, 0);
diff --git a/drivers/net/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c
index 3a4bf4035a23..1ab57aa6e4dc 100644
--- a/drivers/net/wireless/ath5k/hw.c
+++ b/drivers/net/wireless/ath5k/hw.c
@@ -3506,7 +3506,7 @@ ath5k_hw_setup_2word_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
3506{ 3506{
3507 u32 frame_type; 3507 u32 frame_type;
3508 struct ath5k_hw_2w_tx_desc *tx_desc; 3508 struct ath5k_hw_2w_tx_desc *tx_desc;
3509 unsigned int buff_len; 3509 unsigned int frame_len;
3510 3510
3511 tx_desc = (struct ath5k_hw_2w_tx_desc *)&desc->ds_ctl0; 3511 tx_desc = (struct ath5k_hw_2w_tx_desc *)&desc->ds_ctl0;
3512 3512
@@ -3537,22 +3537,25 @@ ath5k_hw_setup_2word_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
3537 /* Setup control descriptor */ 3537 /* Setup control descriptor */
3538 3538
3539 /* Verify and set frame length */ 3539 /* Verify and set frame length */
3540 if (pkt_len & ~AR5K_2W_TX_DESC_CTL0_FRAME_LEN) 3540
3541 /* remove padding we might have added before */
3542 frame_len = pkt_len - (hdr_len & 3) + FCS_LEN;
3543
3544 if (frame_len & ~AR5K_2W_TX_DESC_CTL0_FRAME_LEN)
3541 return -EINVAL; 3545 return -EINVAL;
3542 3546
3543 tx_desc->tx_control_0 = pkt_len & AR5K_2W_TX_DESC_CTL0_FRAME_LEN; 3547 tx_desc->tx_control_0 = frame_len & AR5K_2W_TX_DESC_CTL0_FRAME_LEN;
3544 3548
3545 /* Verify and set buffer length */ 3549 /* Verify and set buffer length */
3546 buff_len = pkt_len - FCS_LEN;
3547 3550
3548 /* NB: beacon's BufLen must be a multiple of 4 bytes */ 3551 /* NB: beacon's BufLen must be a multiple of 4 bytes */
3549 if(type == AR5K_PKT_TYPE_BEACON) 3552 if(type == AR5K_PKT_TYPE_BEACON)
3550 buff_len = roundup(buff_len, 4); 3553 pkt_len = roundup(pkt_len, 4);
3551 3554
3552 if (buff_len & ~AR5K_2W_TX_DESC_CTL1_BUF_LEN) 3555 if (pkt_len & ~AR5K_2W_TX_DESC_CTL1_BUF_LEN)
3553 return -EINVAL; 3556 return -EINVAL;
3554 3557
3555 tx_desc->tx_control_1 = buff_len & AR5K_2W_TX_DESC_CTL1_BUF_LEN; 3558 tx_desc->tx_control_1 = pkt_len & AR5K_2W_TX_DESC_CTL1_BUF_LEN;
3556 3559
3557 /* 3560 /*
3558 * Verify and set header length 3561 * Verify and set header length
@@ -3634,7 +3637,7 @@ static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *ah,
3634{ 3637{
3635 struct ath5k_hw_4w_tx_desc *tx_desc; 3638 struct ath5k_hw_4w_tx_desc *tx_desc;
3636 struct ath5k_hw_tx_status *tx_status; 3639 struct ath5k_hw_tx_status *tx_status;
3637 unsigned int buff_len; 3640 unsigned int frame_len;
3638 3641
3639 ATH5K_TRACE(ah->ah_sc); 3642 ATH5K_TRACE(ah->ah_sc);
3640 tx_desc = (struct ath5k_hw_4w_tx_desc *)&desc->ds_ctl0; 3643 tx_desc = (struct ath5k_hw_4w_tx_desc *)&desc->ds_ctl0;
@@ -3669,22 +3672,25 @@ static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *ah,
3669 /* Setup control descriptor */ 3672 /* Setup control descriptor */
3670 3673
3671 /* Verify and set frame length */ 3674 /* Verify and set frame length */
3672 if (pkt_len & ~AR5K_4W_TX_DESC_CTL0_FRAME_LEN) 3675
3676 /* remove padding we might have added before */
3677 frame_len = pkt_len - (hdr_len & 3) + FCS_LEN;
3678
3679 if (frame_len & ~AR5K_4W_TX_DESC_CTL0_FRAME_LEN)
3673 return -EINVAL; 3680 return -EINVAL;
3674 3681
3675 tx_desc->tx_control_0 = pkt_len & AR5K_4W_TX_DESC_CTL0_FRAME_LEN; 3682 tx_desc->tx_control_0 = frame_len & AR5K_4W_TX_DESC_CTL0_FRAME_LEN;
3676 3683
3677 /* Verify and set buffer length */ 3684 /* Verify and set buffer length */
3678 buff_len = pkt_len - FCS_LEN;
3679 3685
3680 /* NB: beacon's BufLen must be a multiple of 4 bytes */ 3686 /* NB: beacon's BufLen must be a multiple of 4 bytes */
3681 if(type == AR5K_PKT_TYPE_BEACON) 3687 if(type == AR5K_PKT_TYPE_BEACON)
3682 buff_len = roundup(buff_len, 4); 3688 pkt_len = roundup(pkt_len, 4);
3683 3689
3684 if (buff_len & ~AR5K_4W_TX_DESC_CTL1_BUF_LEN) 3690 if (pkt_len & ~AR5K_4W_TX_DESC_CTL1_BUF_LEN)
3685 return -EINVAL; 3691 return -EINVAL;
3686 3692
3687 tx_desc->tx_control_1 = buff_len & AR5K_4W_TX_DESC_CTL1_BUF_LEN; 3693 tx_desc->tx_control_1 = pkt_len & AR5K_4W_TX_DESC_CTL1_BUF_LEN;
3688 3694
3689 tx_desc->tx_control_0 |= 3695 tx_desc->tx_control_0 |=
3690 AR5K_REG_SM(tx_power, AR5K_4W_TX_DESC_CTL0_XMIT_POWER) | 3696 AR5K_REG_SM(tx_power, AR5K_4W_TX_DESC_CTL0_XMIT_POWER) |
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index 08a011f0834a..f13346ba9dd2 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -14,6 +14,12 @@
14#include "lo.h" 14#include "lo.h"
15#include "phy.h" 15#include "phy.h"
16 16
17
18/* The unique identifier of the firmware that's officially supported by
19 * this driver version. */
20#define B43_SUPPORTED_FIRMWARE_ID "FW13"
21
22
17#ifdef CONFIG_B43_DEBUG 23#ifdef CONFIG_B43_DEBUG
18# define B43_DEBUG 1 24# define B43_DEBUG 1
19#else 25#else
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index ef65c41af00f..51dfce16178a 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -58,6 +58,8 @@ MODULE_AUTHOR("Stefano Brivio");
58MODULE_AUTHOR("Michael Buesch"); 58MODULE_AUTHOR("Michael Buesch");
59MODULE_LICENSE("GPL"); 59MODULE_LICENSE("GPL");
60 60
61MODULE_FIRMWARE(B43_SUPPORTED_FIRMWARE_ID);
62
61 63
62static int modparam_bad_frames_preempt; 64static int modparam_bad_frames_preempt;
63module_param_named(bad_frames_preempt, modparam_bad_frames_preempt, int, 0444); 65module_param_named(bad_frames_preempt, modparam_bad_frames_preempt, int, 0444);
@@ -1859,11 +1861,11 @@ static int b43_upload_microcode(struct b43_wldev *dev)
1859 err = -EOPNOTSUPP; 1861 err = -EOPNOTSUPP;
1860 goto error; 1862 goto error;
1861 } 1863 }
1862 b43dbg(dev->wl, "Loading firmware version %u.%u " 1864 b43info(dev->wl, "Loading firmware version %u.%u "
1863 "(20%.2i-%.2i-%.2i %.2i:%.2i:%.2i)\n", 1865 "(20%.2i-%.2i-%.2i %.2i:%.2i:%.2i)\n",
1864 fwrev, fwpatch, 1866 fwrev, fwpatch,
1865 (fwdate >> 12) & 0xF, (fwdate >> 8) & 0xF, fwdate & 0xFF, 1867 (fwdate >> 12) & 0xF, (fwdate >> 8) & 0xF, fwdate & 0xFF,
1866 (fwtime >> 11) & 0x1F, (fwtime >> 5) & 0x3F, fwtime & 0x1F); 1868 (fwtime >> 11) & 0x1F, (fwtime >> 5) & 0x3F, fwtime & 0x1F);
1867 1869
1868 dev->fw.rev = fwrev; 1870 dev->fw.rev = fwrev;
1869 dev->fw.patch = fwpatch; 1871 dev->fw.patch = fwpatch;
@@ -4200,6 +4202,33 @@ static struct ssb_driver b43_ssb_driver = {
4200 .resume = b43_resume, 4202 .resume = b43_resume,
4201}; 4203};
4202 4204
4205static void b43_print_driverinfo(void)
4206{
4207 const char *feat_pci = "", *feat_pcmcia = "", *feat_nphy = "",
4208 *feat_leds = "", *feat_rfkill = "";
4209
4210#ifdef CONFIG_B43_PCI_AUTOSELECT
4211 feat_pci = "P";
4212#endif
4213#ifdef CONFIG_B43_PCMCIA
4214 feat_pcmcia = "M";
4215#endif
4216#ifdef CONFIG_B43_NPHY
4217 feat_nphy = "N";
4218#endif
4219#ifdef CONFIG_B43_LEDS
4220 feat_leds = "L";
4221#endif
4222#ifdef CONFIG_B43_RFKILL
4223 feat_rfkill = "R";
4224#endif
4225 printk(KERN_INFO "Broadcom 43xx driver loaded "
4226 "[ Features: %s%s%s%s%s, Firmware-ID: "
4227 B43_SUPPORTED_FIRMWARE_ID " ]\n",
4228 feat_pci, feat_pcmcia, feat_nphy,
4229 feat_leds, feat_rfkill);
4230}
4231
4203static int __init b43_init(void) 4232static int __init b43_init(void)
4204{ 4233{
4205 int err; 4234 int err;
@@ -4211,6 +4240,7 @@ static int __init b43_init(void)
4211 err = ssb_driver_register(&b43_ssb_driver); 4240 err = ssb_driver_register(&b43_ssb_driver);
4212 if (err) 4241 if (err)
4213 goto err_pcmcia_exit; 4242 goto err_pcmcia_exit;
4243 b43_print_driverinfo();
4214 4244
4215 return err; 4245 return err;
4216 4246
diff --git a/drivers/net/wireless/b43legacy/b43legacy.h b/drivers/net/wireless/b43legacy/b43legacy.h
index c80edd2b9044..93d45b71799a 100644
--- a/drivers/net/wireless/b43legacy/b43legacy.h
+++ b/drivers/net/wireless/b43legacy/b43legacy.h
@@ -23,6 +23,10 @@
23#include "phy.h" 23#include "phy.h"
24 24
25 25
26/* The unique identifier of the firmware that's officially supported by this
27 * driver version. */
28#define B43legacy_SUPPORTED_FIRMWARE_ID "FW10"
29
26#define B43legacy_IRQWAIT_MAX_RETRIES 20 30#define B43legacy_IRQWAIT_MAX_RETRIES 20
27 31
28#define B43legacy_RX_MAX_SSI 60 /* best guess at max ssi */ 32#define B43legacy_RX_MAX_SSI 60 /* best guess at max ssi */
diff --git a/drivers/net/wireless/b43legacy/dma.c b/drivers/net/wireless/b43legacy/dma.c
index 6e08405e8026..e87b427d5e43 100644
--- a/drivers/net/wireless/b43legacy/dma.c
+++ b/drivers/net/wireless/b43legacy/dma.c
@@ -354,7 +354,8 @@ return 0;
354} 354}
355 355
356 356
357u16 b43legacy_dmacontroller_base(int dma64bit, int controller_idx) 357static u16 b43legacy_dmacontroller_base(enum b43legacy_dmatype type,
358 int controller_idx)
358{ 359{
359 static const u16 map64[] = { 360 static const u16 map64[] = {
360 B43legacy_MMIO_DMA64_BASE0, 361 B43legacy_MMIO_DMA64_BASE0,
@@ -373,7 +374,7 @@ u16 b43legacy_dmacontroller_base(int dma64bit, int controller_idx)
373 B43legacy_MMIO_DMA32_BASE5, 374 B43legacy_MMIO_DMA32_BASE5,
374 }; 375 };
375 376
376 if (dma64bit) { 377 if (type == B43legacy_DMA_64BIT) {
377 B43legacy_WARN_ON(!(controller_idx >= 0 && 378 B43legacy_WARN_ON(!(controller_idx >= 0 &&
378 controller_idx < ARRAY_SIZE(map64))); 379 controller_idx < ARRAY_SIZE(map64)));
379 return map64[controller_idx]; 380 return map64[controller_idx];
@@ -480,8 +481,9 @@ static void free_ringmemory(struct b43legacy_dmaring *ring)
480} 481}
481 482
482/* Reset the RX DMA channel */ 483/* Reset the RX DMA channel */
483int b43legacy_dmacontroller_rx_reset(struct b43legacy_wldev *dev, 484static int b43legacy_dmacontroller_rx_reset(struct b43legacy_wldev *dev,
484 u16 mmio_base, int dma64) 485 u16 mmio_base,
486 enum b43legacy_dmatype type)
485{ 487{
486 int i; 488 int i;
487 u32 value; 489 u32 value;
@@ -489,13 +491,14 @@ int b43legacy_dmacontroller_rx_reset(struct b43legacy_wldev *dev,
489 491
490 might_sleep(); 492 might_sleep();
491 493
492 offset = dma64 ? B43legacy_DMA64_RXCTL : B43legacy_DMA32_RXCTL; 494 offset = (type == B43legacy_DMA_64BIT) ?
495 B43legacy_DMA64_RXCTL : B43legacy_DMA32_RXCTL;
493 b43legacy_write32(dev, mmio_base + offset, 0); 496 b43legacy_write32(dev, mmio_base + offset, 0);
494 for (i = 0; i < 10; i++) { 497 for (i = 0; i < 10; i++) {
495 offset = dma64 ? B43legacy_DMA64_RXSTATUS : 498 offset = (type == B43legacy_DMA_64BIT) ?
496 B43legacy_DMA32_RXSTATUS; 499 B43legacy_DMA64_RXSTATUS : B43legacy_DMA32_RXSTATUS;
497 value = b43legacy_read32(dev, mmio_base + offset); 500 value = b43legacy_read32(dev, mmio_base + offset);
498 if (dma64) { 501 if (type == B43legacy_DMA_64BIT) {
499 value &= B43legacy_DMA64_RXSTAT; 502 value &= B43legacy_DMA64_RXSTAT;
500 if (value == B43legacy_DMA64_RXSTAT_DISABLED) { 503 if (value == B43legacy_DMA64_RXSTAT_DISABLED) {
501 i = -1; 504 i = -1;
@@ -519,8 +522,9 @@ int b43legacy_dmacontroller_rx_reset(struct b43legacy_wldev *dev,
519} 522}
520 523
521/* Reset the RX DMA channel */ 524/* Reset the RX DMA channel */
522int b43legacy_dmacontroller_tx_reset(struct b43legacy_wldev *dev, 525static int b43legacy_dmacontroller_tx_reset(struct b43legacy_wldev *dev,
523 u16 mmio_base, int dma64) 526 u16 mmio_base,
527 enum b43legacy_dmatype type)
524{ 528{
525 int i; 529 int i;
526 u32 value; 530 u32 value;
@@ -529,10 +533,10 @@ int b43legacy_dmacontroller_tx_reset(struct b43legacy_wldev *dev,
529 might_sleep(); 533 might_sleep();
530 534
531 for (i = 0; i < 10; i++) { 535 for (i = 0; i < 10; i++) {
532 offset = dma64 ? B43legacy_DMA64_TXSTATUS : 536 offset = (type == B43legacy_DMA_64BIT) ?
533 B43legacy_DMA32_TXSTATUS; 537 B43legacy_DMA64_TXSTATUS : B43legacy_DMA32_TXSTATUS;
534 value = b43legacy_read32(dev, mmio_base + offset); 538 value = b43legacy_read32(dev, mmio_base + offset);
535 if (dma64) { 539 if (type == B43legacy_DMA_64BIT) {
536 value &= B43legacy_DMA64_TXSTAT; 540 value &= B43legacy_DMA64_TXSTAT;
537 if (value == B43legacy_DMA64_TXSTAT_DISABLED || 541 if (value == B43legacy_DMA64_TXSTAT_DISABLED ||
538 value == B43legacy_DMA64_TXSTAT_IDLEWAIT || 542 value == B43legacy_DMA64_TXSTAT_IDLEWAIT ||
@@ -547,13 +551,14 @@ int b43legacy_dmacontroller_tx_reset(struct b43legacy_wldev *dev,
547 } 551 }
548 msleep(1); 552 msleep(1);
549 } 553 }
550 offset = dma64 ? B43legacy_DMA64_TXCTL : B43legacy_DMA32_TXCTL; 554 offset = (type == B43legacy_DMA_64BIT) ? B43legacy_DMA64_TXCTL :
555 B43legacy_DMA32_TXCTL;
551 b43legacy_write32(dev, mmio_base + offset, 0); 556 b43legacy_write32(dev, mmio_base + offset, 0);
552 for (i = 0; i < 10; i++) { 557 for (i = 0; i < 10; i++) {
553 offset = dma64 ? B43legacy_DMA64_TXSTATUS : 558 offset = (type == B43legacy_DMA_64BIT) ?
554 B43legacy_DMA32_TXSTATUS; 559 B43legacy_DMA64_TXSTATUS : B43legacy_DMA32_TXSTATUS;
555 value = b43legacy_read32(dev, mmio_base + offset); 560 value = b43legacy_read32(dev, mmio_base + offset);
556 if (dma64) { 561 if (type == B43legacy_DMA_64BIT) {
557 value &= B43legacy_DMA64_TXSTAT; 562 value &= B43legacy_DMA64_TXSTAT;
558 if (value == B43legacy_DMA64_TXSTAT_DISABLED) { 563 if (value == B43legacy_DMA64_TXSTAT_DISABLED) {
559 i = -1; 564 i = -1;
@@ -578,6 +583,32 @@ int b43legacy_dmacontroller_tx_reset(struct b43legacy_wldev *dev,
578 return 0; 583 return 0;
579} 584}
580 585
586/* Check if a DMA mapping address is invalid. */
587static bool b43legacy_dma_mapping_error(struct b43legacy_dmaring *ring,
588 dma_addr_t addr,
589 size_t buffersize)
590{
591 if (unlikely(dma_mapping_error(addr)))
592 return 1;
593
594 switch (ring->type) {
595 case B43legacy_DMA_30BIT:
596 if ((u64)addr + buffersize > (1ULL << 30))
597 return 1;
598 break;
599 case B43legacy_DMA_32BIT:
600 if ((u64)addr + buffersize > (1ULL << 32))
601 return 1;
602 break;
603 case B43legacy_DMA_64BIT:
604 /* Currently we can't have addresses beyond 64 bits in the kernel. */
605 break;
606 }
607
608 /* The address is OK. */
609 return 0;
610}
611
581static int setup_rx_descbuffer(struct b43legacy_dmaring *ring, 612static int setup_rx_descbuffer(struct b43legacy_dmaring *ring,
582 struct b43legacy_dmadesc_generic *desc, 613 struct b43legacy_dmadesc_generic *desc,
583 struct b43legacy_dmadesc_meta *meta, 614 struct b43legacy_dmadesc_meta *meta,
@@ -595,7 +626,7 @@ static int setup_rx_descbuffer(struct b43legacy_dmaring *ring,
595 return -ENOMEM; 626 return -ENOMEM;
596 dmaaddr = map_descbuffer(ring, skb->data, 627 dmaaddr = map_descbuffer(ring, skb->data,
597 ring->rx_buffersize, 0); 628 ring->rx_buffersize, 0);
598 if (dma_mapping_error(dmaaddr)) { 629 if (b43legacy_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize)) {
599 /* ugh. try to realloc in zone_dma */ 630 /* ugh. try to realloc in zone_dma */
600 gfp_flags |= GFP_DMA; 631 gfp_flags |= GFP_DMA;
601 632
@@ -608,7 +639,7 @@ static int setup_rx_descbuffer(struct b43legacy_dmaring *ring,
608 ring->rx_buffersize, 0); 639 ring->rx_buffersize, 0);
609 } 640 }
610 641
611 if (dma_mapping_error(dmaaddr)) { 642 if (b43legacy_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize)) {
612 dev_kfree_skb_any(skb); 643 dev_kfree_skb_any(skb);
613 return -EIO; 644 return -EIO;
614 } 645 }
@@ -674,7 +705,7 @@ static int dmacontroller_setup(struct b43legacy_dmaring *ring)
674 u32 trans = ssb_dma_translation(ring->dev->dev); 705 u32 trans = ssb_dma_translation(ring->dev->dev);
675 706
676 if (ring->tx) { 707 if (ring->tx) {
677 if (ring->dma64) { 708 if (ring->type == B43legacy_DMA_64BIT) {
678 u64 ringbase = (u64)(ring->dmabase); 709 u64 ringbase = (u64)(ring->dmabase);
679 710
680 addrext = ((ringbase >> 32) & SSB_DMA_TRANSLATION_MASK) 711 addrext = ((ringbase >> 32) & SSB_DMA_TRANSLATION_MASK)
@@ -709,7 +740,7 @@ static int dmacontroller_setup(struct b43legacy_dmaring *ring)
709 err = alloc_initial_descbuffers(ring); 740 err = alloc_initial_descbuffers(ring);
710 if (err) 741 if (err)
711 goto out; 742 goto out;
712 if (ring->dma64) { 743 if (ring->type == B43legacy_DMA_64BIT) {
713 u64 ringbase = (u64)(ring->dmabase); 744 u64 ringbase = (u64)(ring->dmabase);
714 745
715 addrext = ((ringbase >> 32) & SSB_DMA_TRANSLATION_MASK) 746 addrext = ((ringbase >> 32) & SSB_DMA_TRANSLATION_MASK)
@@ -760,16 +791,16 @@ static void dmacontroller_cleanup(struct b43legacy_dmaring *ring)
760{ 791{
761 if (ring->tx) { 792 if (ring->tx) {
762 b43legacy_dmacontroller_tx_reset(ring->dev, ring->mmio_base, 793 b43legacy_dmacontroller_tx_reset(ring->dev, ring->mmio_base,
763 ring->dma64); 794 ring->type);
764 if (ring->dma64) { 795 if (ring->type == B43legacy_DMA_64BIT) {
765 b43legacy_dma_write(ring, B43legacy_DMA64_TXRINGLO, 0); 796 b43legacy_dma_write(ring, B43legacy_DMA64_TXRINGLO, 0);
766 b43legacy_dma_write(ring, B43legacy_DMA64_TXRINGHI, 0); 797 b43legacy_dma_write(ring, B43legacy_DMA64_TXRINGHI, 0);
767 } else 798 } else
768 b43legacy_dma_write(ring, B43legacy_DMA32_TXRING, 0); 799 b43legacy_dma_write(ring, B43legacy_DMA32_TXRING, 0);
769 } else { 800 } else {
770 b43legacy_dmacontroller_rx_reset(ring->dev, ring->mmio_base, 801 b43legacy_dmacontroller_rx_reset(ring->dev, ring->mmio_base,
771 ring->dma64); 802 ring->type);
772 if (ring->dma64) { 803 if (ring->type == B43legacy_DMA_64BIT) {
773 b43legacy_dma_write(ring, B43legacy_DMA64_RXRINGLO, 0); 804 b43legacy_dma_write(ring, B43legacy_DMA64_RXRINGLO, 0);
774 b43legacy_dma_write(ring, B43legacy_DMA64_RXRINGHI, 0); 805 b43legacy_dma_write(ring, B43legacy_DMA64_RXRINGHI, 0);
775 } else 806 } else
@@ -824,11 +855,10 @@ static u64 supported_dma_mask(struct b43legacy_wldev *dev)
824 855
825/* Main initialization function. */ 856/* Main initialization function. */
826static 857static
827struct b43legacy_dmaring *b43legacy_setup_dmaring( 858struct b43legacy_dmaring *b43legacy_setup_dmaring(struct b43legacy_wldev *dev,
828 struct b43legacy_wldev *dev, 859 int controller_index,
829 int controller_index, 860 int for_tx,
830 int for_tx, 861 enum b43legacy_dmatype type)
831 int dma64)
832{ 862{
833 struct b43legacy_dmaring *ring; 863 struct b43legacy_dmaring *ring;
834 int err; 864 int err;
@@ -838,6 +868,7 @@ struct b43legacy_dmaring *b43legacy_setup_dmaring(
838 ring = kzalloc(sizeof(*ring), GFP_KERNEL); 868 ring = kzalloc(sizeof(*ring), GFP_KERNEL);
839 if (!ring) 869 if (!ring)
840 goto out; 870 goto out;
871 ring->type = type;
841 872
842 nr_slots = B43legacy_RXRING_SLOTS; 873 nr_slots = B43legacy_RXRING_SLOTS;
843 if (for_tx) 874 if (for_tx)
@@ -855,12 +886,12 @@ struct b43legacy_dmaring *b43legacy_setup_dmaring(
855 goto err_kfree_meta; 886 goto err_kfree_meta;
856 887
857 /* test for ability to dma to txhdr_cache */ 888 /* test for ability to dma to txhdr_cache */
858 dma_test = dma_map_single(dev->dev->dev, 889 dma_test = dma_map_single(dev->dev->dev, ring->txhdr_cache,
859 ring->txhdr_cache, 890 sizeof(struct b43legacy_txhdr_fw3),
860 sizeof(struct b43legacy_txhdr_fw3), 891 DMA_TO_DEVICE);
861 DMA_TO_DEVICE);
862 892
863 if (dma_mapping_error(dma_test)) { 893 if (b43legacy_dma_mapping_error(ring, dma_test,
894 sizeof(struct b43legacy_txhdr_fw3))) {
864 /* ugh realloc */ 895 /* ugh realloc */
865 kfree(ring->txhdr_cache); 896 kfree(ring->txhdr_cache);
866 ring->txhdr_cache = kcalloc(nr_slots, 897 ring->txhdr_cache = kcalloc(nr_slots,
@@ -874,7 +905,8 @@ struct b43legacy_dmaring *b43legacy_setup_dmaring(
874 sizeof(struct b43legacy_txhdr_fw3), 905 sizeof(struct b43legacy_txhdr_fw3),
875 DMA_TO_DEVICE); 906 DMA_TO_DEVICE);
876 907
877 if (dma_mapping_error(dma_test)) 908 if (b43legacy_dma_mapping_error(ring, dma_test,
909 sizeof(struct b43legacy_txhdr_fw3)))
878 goto err_kfree_txhdr_cache; 910 goto err_kfree_txhdr_cache;
879 } 911 }
880 912
@@ -885,11 +917,9 @@ struct b43legacy_dmaring *b43legacy_setup_dmaring(
885 917
886 ring->dev = dev; 918 ring->dev = dev;
887 ring->nr_slots = nr_slots; 919 ring->nr_slots = nr_slots;
888 ring->mmio_base = b43legacy_dmacontroller_base(dma64, 920 ring->mmio_base = b43legacy_dmacontroller_base(type, controller_index);
889 controller_index);
890 ring->index = controller_index; 921 ring->index = controller_index;
891 ring->dma64 = !!dma64; 922 if (type == B43legacy_DMA_64BIT)
892 if (dma64)
893 ring->ops = &dma64_ops; 923 ring->ops = &dma64_ops;
894 else 924 else
895 ring->ops = &dma32_ops; 925 ring->ops = &dma32_ops;
@@ -939,10 +969,10 @@ static void b43legacy_destroy_dmaring(struct b43legacy_dmaring *ring)
939 if (!ring) 969 if (!ring)
940 return; 970 return;
941 971
942 b43legacydbg(ring->dev->wl, "DMA-%s 0x%04X (%s) max used slots:" 972 b43legacydbg(ring->dev->wl, "DMA-%u 0x%04X (%s) max used slots:"
943 " %d/%d\n", (ring->dma64) ? "64" : "32", ring->mmio_base, 973 " %d/%d\n", (unsigned int)(ring->type), ring->mmio_base,
944 (ring->tx) ? "TX" : "RX", 974 (ring->tx) ? "TX" : "RX", ring->max_used_slots,
945 ring->max_used_slots, ring->nr_slots); 975 ring->nr_slots);
946 /* Device IRQs are disabled prior entering this function, 976 /* Device IRQs are disabled prior entering this function,
947 * so no need to take care of concurrency with rx handler stuff. 977 * so no need to take care of concurrency with rx handler stuff.
948 */ 978 */
@@ -988,11 +1018,22 @@ int b43legacy_dma_init(struct b43legacy_wldev *dev)
988 struct b43legacy_dmaring *ring; 1018 struct b43legacy_dmaring *ring;
989 int err; 1019 int err;
990 u64 dmamask; 1020 u64 dmamask;
991 int dma64 = 0; 1021 enum b43legacy_dmatype type;
992 1022
993 dmamask = supported_dma_mask(dev); 1023 dmamask = supported_dma_mask(dev);
994 if (dmamask == DMA_64BIT_MASK) 1024 switch (dmamask) {
995 dma64 = 1; 1025 default:
1026 B43legacy_WARN_ON(1);
1027 case DMA_30BIT_MASK:
1028 type = B43legacy_DMA_30BIT;
1029 break;
1030 case DMA_32BIT_MASK:
1031 type = B43legacy_DMA_32BIT;
1032 break;
1033 case DMA_64BIT_MASK:
1034 type = B43legacy_DMA_64BIT;
1035 break;
1036 }
996 1037
997 err = ssb_dma_set_mask(dev->dev, dmamask); 1038 err = ssb_dma_set_mask(dev->dev, dmamask);
998 if (err) { 1039 if (err) {
@@ -1010,52 +1051,50 @@ int b43legacy_dma_init(struct b43legacy_wldev *dev)
1010 1051
1011 err = -ENOMEM; 1052 err = -ENOMEM;
1012 /* setup TX DMA channels. */ 1053 /* setup TX DMA channels. */
1013 ring = b43legacy_setup_dmaring(dev, 0, 1, dma64); 1054 ring = b43legacy_setup_dmaring(dev, 0, 1, type);
1014 if (!ring) 1055 if (!ring)
1015 goto out; 1056 goto out;
1016 dma->tx_ring0 = ring; 1057 dma->tx_ring0 = ring;
1017 1058
1018 ring = b43legacy_setup_dmaring(dev, 1, 1, dma64); 1059 ring = b43legacy_setup_dmaring(dev, 1, 1, type);
1019 if (!ring) 1060 if (!ring)
1020 goto err_destroy_tx0; 1061 goto err_destroy_tx0;
1021 dma->tx_ring1 = ring; 1062 dma->tx_ring1 = ring;
1022 1063
1023 ring = b43legacy_setup_dmaring(dev, 2, 1, dma64); 1064 ring = b43legacy_setup_dmaring(dev, 2, 1, type);
1024 if (!ring) 1065 if (!ring)
1025 goto err_destroy_tx1; 1066 goto err_destroy_tx1;
1026 dma->tx_ring2 = ring; 1067 dma->tx_ring2 = ring;
1027 1068
1028 ring = b43legacy_setup_dmaring(dev, 3, 1, dma64); 1069 ring = b43legacy_setup_dmaring(dev, 3, 1, type);
1029 if (!ring) 1070 if (!ring)
1030 goto err_destroy_tx2; 1071 goto err_destroy_tx2;
1031 dma->tx_ring3 = ring; 1072 dma->tx_ring3 = ring;
1032 1073
1033 ring = b43legacy_setup_dmaring(dev, 4, 1, dma64); 1074 ring = b43legacy_setup_dmaring(dev, 4, 1, type);
1034 if (!ring) 1075 if (!ring)
1035 goto err_destroy_tx3; 1076 goto err_destroy_tx3;
1036 dma->tx_ring4 = ring; 1077 dma->tx_ring4 = ring;
1037 1078
1038 ring = b43legacy_setup_dmaring(dev, 5, 1, dma64); 1079 ring = b43legacy_setup_dmaring(dev, 5, 1, type);
1039 if (!ring) 1080 if (!ring)
1040 goto err_destroy_tx4; 1081 goto err_destroy_tx4;
1041 dma->tx_ring5 = ring; 1082 dma->tx_ring5 = ring;
1042 1083
1043 /* setup RX DMA channels. */ 1084 /* setup RX DMA channels. */
1044 ring = b43legacy_setup_dmaring(dev, 0, 0, dma64); 1085 ring = b43legacy_setup_dmaring(dev, 0, 0, type);
1045 if (!ring) 1086 if (!ring)
1046 goto err_destroy_tx5; 1087 goto err_destroy_tx5;
1047 dma->rx_ring0 = ring; 1088 dma->rx_ring0 = ring;
1048 1089
1049 if (dev->dev->id.revision < 5) { 1090 if (dev->dev->id.revision < 5) {
1050 ring = b43legacy_setup_dmaring(dev, 3, 0, dma64); 1091 ring = b43legacy_setup_dmaring(dev, 3, 0, type);
1051 if (!ring) 1092 if (!ring)
1052 goto err_destroy_rx0; 1093 goto err_destroy_rx0;
1053 dma->rx_ring3 = ring; 1094 dma->rx_ring3 = ring;
1054 } 1095 }
1055 1096
1056 b43legacydbg(dev->wl, "%d-bit DMA initialized\n", 1097 b43legacydbg(dev->wl, "%u-bit DMA initialized\n", (unsigned int)type);
1057 (dmamask == DMA_64BIT_MASK) ? 64 :
1058 (dmamask == DMA_32BIT_MASK) ? 32 : 30);
1059 err = 0; 1098 err = 0;
1060out: 1099out:
1061 return err; 1100 return err;
@@ -1194,9 +1233,13 @@ static int dma_tx_fragment(struct b43legacy_dmaring *ring,
1194 } 1233 }
1195 1234
1196 meta_hdr->dmaaddr = map_descbuffer(ring, (unsigned char *)header, 1235 meta_hdr->dmaaddr = map_descbuffer(ring, (unsigned char *)header,
1197 sizeof(struct b43legacy_txhdr_fw3), 1); 1236 sizeof(struct b43legacy_txhdr_fw3), 1);
1198 if (dma_mapping_error(meta_hdr->dmaaddr)) 1237 if (b43legacy_dma_mapping_error(ring, meta_hdr->dmaaddr,
1238 sizeof(struct b43legacy_txhdr_fw3))) {
1239 ring->current_slot = old_top_slot;
1240 ring->used_slots = old_used_slots;
1199 return -EIO; 1241 return -EIO;
1242 }
1200 ops->fill_descriptor(ring, desc, meta_hdr->dmaaddr, 1243 ops->fill_descriptor(ring, desc, meta_hdr->dmaaddr,
1201 sizeof(struct b43legacy_txhdr_fw3), 1, 0, 0); 1244 sizeof(struct b43legacy_txhdr_fw3), 1, 0, 0);
1202 1245
@@ -1211,7 +1254,7 @@ static int dma_tx_fragment(struct b43legacy_dmaring *ring,
1211 1254
1212 meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1); 1255 meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1);
1213 /* create a bounce buffer in zone_dma on mapping failure. */ 1256 /* create a bounce buffer in zone_dma on mapping failure. */
1214 if (dma_mapping_error(meta->dmaaddr)) { 1257 if (b43legacy_dma_mapping_error(ring, meta->dmaaddr, skb->len)) {
1215 bounce_skb = __dev_alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA); 1258 bounce_skb = __dev_alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA);
1216 if (!bounce_skb) { 1259 if (!bounce_skb) {
1217 ring->current_slot = old_top_slot; 1260 ring->current_slot = old_top_slot;
@@ -1225,7 +1268,7 @@ static int dma_tx_fragment(struct b43legacy_dmaring *ring,
1225 skb = bounce_skb; 1268 skb = bounce_skb;
1226 meta->skb = skb; 1269 meta->skb = skb;
1227 meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1); 1270 meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1);
1228 if (dma_mapping_error(meta->dmaaddr)) { 1271 if (b43legacy_dma_mapping_error(ring, meta->dmaaddr, skb->len)) {
1229 ring->current_slot = old_top_slot; 1272 ring->current_slot = old_top_slot;
1230 ring->used_slots = old_used_slots; 1273 ring->used_slots = old_used_slots;
1231 err = -EIO; 1274 err = -EIO;
diff --git a/drivers/net/wireless/b43legacy/dma.h b/drivers/net/wireless/b43legacy/dma.h
index 26f6ab08de75..2dd488c5be2d 100644
--- a/drivers/net/wireless/b43legacy/dma.h
+++ b/drivers/net/wireless/b43legacy/dma.h
@@ -218,6 +218,12 @@ struct b43legacy_dma_ops {
218 void (*set_current_rxslot)(struct b43legacy_dmaring *ring, int slot); 218 void (*set_current_rxslot)(struct b43legacy_dmaring *ring, int slot);
219}; 219};
220 220
221enum b43legacy_dmatype {
222 B43legacy_DMA_30BIT = 30,
223 B43legacy_DMA_32BIT = 32,
224 B43legacy_DMA_64BIT = 64,
225};
226
221struct b43legacy_dmaring { 227struct b43legacy_dmaring {
222 /* Lowlevel DMA ops. */ 228 /* Lowlevel DMA ops. */
223 const struct b43legacy_dma_ops *ops; 229 const struct b43legacy_dma_ops *ops;
@@ -250,8 +256,8 @@ struct b43legacy_dmaring {
250 int index; 256 int index;
251 /* Boolean. Is this a TX ring? */ 257 /* Boolean. Is this a TX ring? */
252 bool tx; 258 bool tx;
253 /* Boolean. 64bit DMA if true, 32bit DMA otherwise. */ 259 /* The type of DMA engine used. */
254 bool dma64; 260 enum b43legacy_dmatype type;
255 /* Boolean. Is this ring stopped at ieee80211 level? */ 261 /* Boolean. Is this ring stopped at ieee80211 level? */
256 bool stopped; 262 bool stopped;
257 /* Lock, only used for TX. */ 263 /* Lock, only used for TX. */
@@ -284,15 +290,6 @@ void b43legacy_dma_write(struct b43legacy_dmaring *ring,
284int b43legacy_dma_init(struct b43legacy_wldev *dev); 290int b43legacy_dma_init(struct b43legacy_wldev *dev);
285void b43legacy_dma_free(struct b43legacy_wldev *dev); 291void b43legacy_dma_free(struct b43legacy_wldev *dev);
286 292
287int b43legacy_dmacontroller_rx_reset(struct b43legacy_wldev *dev,
288 u16 dmacontroller_mmio_base,
289 int dma64);
290int b43legacy_dmacontroller_tx_reset(struct b43legacy_wldev *dev,
291 u16 dmacontroller_mmio_base,
292 int dma64);
293
294u16 b43legacy_dmacontroller_base(int dma64bit, int dmacontroller_idx);
295
296void b43legacy_dma_tx_suspend(struct b43legacy_wldev *dev); 293void b43legacy_dma_tx_suspend(struct b43legacy_wldev *dev);
297void b43legacy_dma_tx_resume(struct b43legacy_wldev *dev); 294void b43legacy_dma_tx_resume(struct b43legacy_wldev *dev);
298 295
@@ -320,20 +317,6 @@ void b43legacy_dma_free(struct b43legacy_wldev *dev)
320{ 317{
321} 318}
322static inline 319static inline
323int b43legacy_dmacontroller_rx_reset(struct b43legacy_wldev *dev,
324 u16 dmacontroller_mmio_base,
325 int dma64)
326{
327 return 0;
328}
329static inline
330int b43legacy_dmacontroller_tx_reset(struct b43legacy_wldev *dev,
331 u16 dmacontroller_mmio_base,
332 int dma64)
333{
334 return 0;
335}
336static inline
337void b43legacy_dma_get_tx_stats(struct b43legacy_wldev *dev, 320void b43legacy_dma_get_tx_stats(struct b43legacy_wldev *dev,
338 struct ieee80211_tx_queue_stats *stats) 321 struct ieee80211_tx_queue_stats *stats)
339{ 322{
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index 53f7f2e97615..c39de422e220 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -3,7 +3,7 @@
3 * Broadcom B43legacy wireless driver 3 * Broadcom B43legacy wireless driver
4 * 4 *
5 * Copyright (c) 2005 Martin Langer <martin-langer@gmx.de> 5 * Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>
6 * Copyright (c) 2005-2007 Stefano Brivio <stefano.brivio@polimi.it> 6 * Copyright (c) 2005-2008 Stefano Brivio <stefano.brivio@polimi.it>
7 * Copyright (c) 2005, 2006 Michael Buesch <mb@bu3sch.de> 7 * Copyright (c) 2005, 2006 Michael Buesch <mb@bu3sch.de>
8 * Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org> 8 * Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org>
9 * Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch> 9 * Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch>
@@ -60,6 +60,8 @@ MODULE_AUTHOR("Stefano Brivio");
60MODULE_AUTHOR("Michael Buesch"); 60MODULE_AUTHOR("Michael Buesch");
61MODULE_LICENSE("GPL"); 61MODULE_LICENSE("GPL");
62 62
63MODULE_FIRMWARE(B43legacy_SUPPORTED_FIRMWARE_ID);
64
63#if defined(CONFIG_B43LEGACY_DMA) && defined(CONFIG_B43LEGACY_PIO) 65#if defined(CONFIG_B43LEGACY_DMA) && defined(CONFIG_B43LEGACY_PIO)
64static int modparam_pio; 66static int modparam_pio;
65module_param_named(pio, modparam_pio, int, 0444); 67module_param_named(pio, modparam_pio, int, 0444);
@@ -1640,10 +1642,11 @@ static int b43legacy_upload_microcode(struct b43legacy_wldev *dev)
1640 err = -EOPNOTSUPP; 1642 err = -EOPNOTSUPP;
1641 goto error; 1643 goto error;
1642 } 1644 }
1643 b43legacydbg(dev->wl, "Loading firmware version 0x%X, patch level %u " 1645 b43legacyinfo(dev->wl, "Loading firmware version 0x%X, patch level %u "
1644 "(20%.2i-%.2i-%.2i %.2i:%.2i:%.2i)\n", fwrev, fwpatch, 1646 "(20%.2i-%.2i-%.2i %.2i:%.2i:%.2i)\n", fwrev, fwpatch,
1645 (fwdate >> 12) & 0xF, (fwdate >> 8) & 0xF, fwdate & 0xFF, 1647 (fwdate >> 12) & 0xF, (fwdate >> 8) & 0xF, fwdate & 0xFF,
1646 (fwtime >> 11) & 0x1F, (fwtime >> 5) & 0x3F, fwtime & 0x1F); 1648 (fwtime >> 11) & 0x1F, (fwtime >> 5) & 0x3F,
1649 fwtime & 0x1F);
1647 1650
1648 dev->fw.rev = fwrev; 1651 dev->fw.rev = fwrev;
1649 dev->fw.patch = fwpatch; 1652 dev->fw.patch = fwpatch;
@@ -3806,6 +3809,32 @@ static struct ssb_driver b43legacy_ssb_driver = {
3806 .resume = b43legacy_resume, 3809 .resume = b43legacy_resume,
3807}; 3810};
3808 3811
3812static void b43legacy_print_driverinfo(void)
3813{
3814 const char *feat_pci = "", *feat_leds = "", *feat_rfkill = "",
3815 *feat_pio = "", *feat_dma = "";
3816
3817#ifdef CONFIG_B43LEGACY_PCI_AUTOSELECT
3818 feat_pci = "P";
3819#endif
3820#ifdef CONFIG_B43LEGACY_LEDS
3821 feat_leds = "L";
3822#endif
3823#ifdef CONFIG_B43LEGACY_RFKILL
3824 feat_rfkill = "R";
3825#endif
3826#ifdef CONFIG_B43LEGACY_PIO
3827 feat_pio = "I";
3828#endif
3829#ifdef CONFIG_B43LEGACY_DMA
3830 feat_dma = "D";
3831#endif
3832 printk(KERN_INFO "Broadcom 43xx driver loaded "
3833 "[ Features: %s%s%s%s%s, Firmware-ID: "
3834 B43legacy_SUPPORTED_FIRMWARE_ID " ]\n",
3835 feat_pci, feat_leds, feat_rfkill, feat_pio, feat_dma);
3836}
3837
3809static int __init b43legacy_init(void) 3838static int __init b43legacy_init(void)
3810{ 3839{
3811 int err; 3840 int err;
@@ -3816,6 +3845,8 @@ static int __init b43legacy_init(void)
3816 if (err) 3845 if (err)
3817 goto err_dfs_exit; 3846 goto err_dfs_exit;
3818 3847
3848 b43legacy_print_driverinfo();
3849
3819 return err; 3850 return err;
3820 3851
3821err_dfs_exit: 3852err_dfs_exit:
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 3e6ad7b92c83..a56d9fc6354f 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -3365,7 +3365,6 @@ static void ipw_rx_queue_reset(struct ipw_priv *priv,
3365 /* Set us so that we have processed and used all buffers, but have 3365 /* Set us so that we have processed and used all buffers, but have
3366 * not restocked the Rx queue with fresh buffers */ 3366 * not restocked the Rx queue with fresh buffers */
3367 rxq->read = rxq->write = 0; 3367 rxq->read = rxq->write = 0;
3368 rxq->processed = RX_QUEUE_SIZE - 1;
3369 rxq->free_count = 0; 3368 rxq->free_count = 0;
3370 spin_unlock_irqrestore(&rxq->lock, flags); 3369 spin_unlock_irqrestore(&rxq->lock, flags);
3371} 3370}
@@ -3607,7 +3606,22 @@ static int ipw_load(struct ipw_priv *priv)
3607 * Driver allocates buffers of this size for Rx 3606 * Driver allocates buffers of this size for Rx
3608 */ 3607 */
3609 3608
3610static inline int ipw_queue_space(const struct clx2_queue *q) 3609/**
3610 * ipw_rx_queue_space - Return number of free slots available in queue.
3611 */
3612static int ipw_rx_queue_space(const struct ipw_rx_queue *q)
3613{
3614 int s = q->read - q->write;
3615 if (s <= 0)
3616 s += RX_QUEUE_SIZE;
3617 /* keep some buffer to not confuse full and empty queue */
3618 s -= 2;
3619 if (s < 0)
3620 s = 0;
3621 return s;
3622}
3623
3624static inline int ipw_tx_queue_space(const struct clx2_queue *q)
3611{ 3625{
3612 int s = q->last_used - q->first_empty; 3626 int s = q->last_used - q->first_empty;
3613 if (s <= 0) 3627 if (s <= 0)
@@ -4947,7 +4961,7 @@ static int ipw_queue_tx_reclaim(struct ipw_priv *priv,
4947 priv->tx_packets++; 4961 priv->tx_packets++;
4948 } 4962 }
4949 done: 4963 done:
4950 if ((ipw_queue_space(q) > q->low_mark) && 4964 if ((ipw_tx_queue_space(q) > q->low_mark) &&
4951 (qindex >= 0) && 4965 (qindex >= 0) &&
4952 (priv->status & STATUS_ASSOCIATED) && netif_running(priv->net_dev)) 4966 (priv->status & STATUS_ASSOCIATED) && netif_running(priv->net_dev))
4953 netif_wake_queue(priv->net_dev); 4967 netif_wake_queue(priv->net_dev);
@@ -4965,7 +4979,7 @@ static int ipw_queue_tx_hcmd(struct ipw_priv *priv, int hcmd, void *buf,
4965 struct clx2_queue *q = &txq->q; 4979 struct clx2_queue *q = &txq->q;
4966 struct tfd_frame *tfd; 4980 struct tfd_frame *tfd;
4967 4981
4968 if (ipw_queue_space(q) < (sync ? 1 : 2)) { 4982 if (ipw_tx_queue_space(q) < (sync ? 1 : 2)) {
4969 IPW_ERROR("No space for Tx\n"); 4983 IPW_ERROR("No space for Tx\n");
4970 return -EBUSY; 4984 return -EBUSY;
4971 } 4985 }
@@ -5070,7 +5084,7 @@ static void ipw_rx_queue_restock(struct ipw_priv *priv)
5070 5084
5071 spin_lock_irqsave(&rxq->lock, flags); 5085 spin_lock_irqsave(&rxq->lock, flags);
5072 write = rxq->write; 5086 write = rxq->write;
5073 while ((rxq->write != rxq->processed) && (rxq->free_count)) { 5087 while ((ipw_rx_queue_space(rxq) > 0) && (rxq->free_count)) {
5074 element = rxq->rx_free.next; 5088 element = rxq->rx_free.next;
5075 rxb = list_entry(element, struct ipw_rx_mem_buffer, list); 5089 rxb = list_entry(element, struct ipw_rx_mem_buffer, list);
5076 list_del(element); 5090 list_del(element);
@@ -5187,7 +5201,6 @@ static struct ipw_rx_queue *ipw_rx_queue_alloc(struct ipw_priv *priv)
5187 /* Set us so that we have processed and used all buffers, but have 5201 /* Set us so that we have processed and used all buffers, but have
5188 * not restocked the Rx queue with fresh buffers */ 5202 * not restocked the Rx queue with fresh buffers */
5189 rxq->read = rxq->write = 0; 5203 rxq->read = rxq->write = 0;
5190 rxq->processed = RX_QUEUE_SIZE - 1;
5191 rxq->free_count = 0; 5204 rxq->free_count = 0;
5192 5205
5193 return rxq; 5206 return rxq;
@@ -8223,13 +8236,17 @@ static void ipw_rx(struct ipw_priv *priv)
8223 struct ieee80211_hdr_4addr *header; 8236 struct ieee80211_hdr_4addr *header;
8224 u32 r, w, i; 8237 u32 r, w, i;
8225 u8 network_packet; 8238 u8 network_packet;
8239 u8 fill_rx = 0;
8226 DECLARE_MAC_BUF(mac); 8240 DECLARE_MAC_BUF(mac);
8227 DECLARE_MAC_BUF(mac2); 8241 DECLARE_MAC_BUF(mac2);
8228 DECLARE_MAC_BUF(mac3); 8242 DECLARE_MAC_BUF(mac3);
8229 8243
8230 r = ipw_read32(priv, IPW_RX_READ_INDEX); 8244 r = ipw_read32(priv, IPW_RX_READ_INDEX);
8231 w = ipw_read32(priv, IPW_RX_WRITE_INDEX); 8245 w = ipw_read32(priv, IPW_RX_WRITE_INDEX);
8232 i = (priv->rxq->processed + 1) % RX_QUEUE_SIZE; 8246 i = priv->rxq->read;
8247
8248 if (ipw_rx_queue_space (priv->rxq) > (RX_QUEUE_SIZE / 2))
8249 fill_rx = 1;
8233 8250
8234 while (i != r) { 8251 while (i != r) {
8235 rxb = priv->rxq->queue[i]; 8252 rxb = priv->rxq->queue[i];
@@ -8404,11 +8421,17 @@ static void ipw_rx(struct ipw_priv *priv)
8404 list_add_tail(&rxb->list, &priv->rxq->rx_used); 8421 list_add_tail(&rxb->list, &priv->rxq->rx_used);
8405 8422
8406 i = (i + 1) % RX_QUEUE_SIZE; 8423 i = (i + 1) % RX_QUEUE_SIZE;
8424
8425 /* If there are a lot of unsued frames, restock the Rx queue
8426 * so the ucode won't assert */
8427 if (fill_rx) {
8428 priv->rxq->read = i;
8429 ipw_rx_queue_replenish(priv);
8430 }
8407 } 8431 }
8408 8432
8409 /* Backtrack one entry */ 8433 /* Backtrack one entry */
8410 priv->rxq->processed = (i ? i : RX_QUEUE_SIZE) - 1; 8434 priv->rxq->read = i;
8411
8412 ipw_rx_queue_restock(priv); 8435 ipw_rx_queue_restock(priv);
8413} 8436}
8414 8437
@@ -10336,7 +10359,7 @@ static int ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb,
10336 q->first_empty = ipw_queue_inc_wrap(q->first_empty, q->n_bd); 10359 q->first_empty = ipw_queue_inc_wrap(q->first_empty, q->n_bd);
10337 ipw_write32(priv, q->reg_w, q->first_empty); 10360 ipw_write32(priv, q->reg_w, q->first_empty);
10338 10361
10339 if (ipw_queue_space(q) < q->high_mark) 10362 if (ipw_tx_queue_space(q) < q->high_mark)
10340 netif_stop_queue(priv->net_dev); 10363 netif_stop_queue(priv->net_dev);
10341 10364
10342 return NETDEV_TX_OK; 10365 return NETDEV_TX_OK;
@@ -10357,7 +10380,7 @@ static int ipw_net_is_queue_full(struct net_device *dev, int pri)
10357 struct clx2_tx_queue *txq = &priv->txq[0]; 10380 struct clx2_tx_queue *txq = &priv->txq[0];
10358#endif /* CONFIG_IPW2200_QOS */ 10381#endif /* CONFIG_IPW2200_QOS */
10359 10382
10360 if (ipw_queue_space(&txq->q) < txq->q.high_mark) 10383 if (ipw_tx_queue_space(&txq->q) < txq->q.high_mark)
10361 return 1; 10384 return 1;
10362 10385
10363 return 0; 10386 return 0;
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 5ee1ad69898b..40b71bc2c4a4 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -687,6 +687,12 @@ static int iwl3945_enqueue_hcmd(struct iwl3945_priv *priv, struct iwl3945_host_c
687 BUG_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) && 687 BUG_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) &&
688 !(cmd->meta.flags & CMD_SIZE_HUGE)); 688 !(cmd->meta.flags & CMD_SIZE_HUGE));
689 689
690
691 if (iwl3945_is_rfkill(priv)) {
692 IWL_DEBUG_INFO("Not sending command - RF KILL");
693 return -EIO;
694 }
695
690 if (iwl3945_queue_space(q) < ((cmd->meta.flags & CMD_ASYNC) ? 2 : 1)) { 696 if (iwl3945_queue_space(q) < ((cmd->meta.flags & CMD_ASYNC) ? 2 : 1)) {
691 IWL_ERROR("No space for Tx\n"); 697 IWL_ERROR("No space for Tx\n");
692 return -ENOSPC; 698 return -ENOSPC;
@@ -1580,7 +1586,7 @@ static inline int iwl3945_eeprom_acquire_semaphore(struct iwl3945_priv *priv)
1580 */ 1586 */
1581int iwl3945_eeprom_init(struct iwl3945_priv *priv) 1587int iwl3945_eeprom_init(struct iwl3945_priv *priv)
1582{ 1588{
1583 __le16 *e = (__le16 *)&priv->eeprom; 1589 u16 *e = (u16 *)&priv->eeprom;
1584 u32 gp = iwl3945_read32(priv, CSR_EEPROM_GP); 1590 u32 gp = iwl3945_read32(priv, CSR_EEPROM_GP);
1585 u32 r; 1591 u32 r;
1586 int sz = sizeof(priv->eeprom); 1592 int sz = sizeof(priv->eeprom);
@@ -1623,7 +1629,7 @@ int iwl3945_eeprom_init(struct iwl3945_priv *priv)
1623 IWL_ERROR("Time out reading EEPROM[%d]", addr); 1629 IWL_ERROR("Time out reading EEPROM[%d]", addr);
1624 return -ETIMEDOUT; 1630 return -ETIMEDOUT;
1625 } 1631 }
1626 e[addr / 2] = cpu_to_le16(r >> 16); 1632 e[addr / 2] = le16_to_cpu((__force __le16)(r >> 16));
1627 } 1633 }
1628 1634
1629 return 0; 1635 return 0;
@@ -2806,7 +2812,8 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv,
2806#endif 2812#endif
2807 2813
2808 /* drop all data frame if we are not associated */ 2814 /* drop all data frame if we are not associated */
2809 if ((!iwl3945_is_associated(priv) || !priv->assoc_id) && 2815 if ((!iwl3945_is_associated(priv) ||
2816 ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && !priv->assoc_id)) &&
2810 ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) { 2817 ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) {
2811 IWL_DEBUG_DROP("Dropping - !iwl3945_is_associated\n"); 2818 IWL_DEBUG_DROP("Dropping - !iwl3945_is_associated\n");
2812 goto drop_unlock; 2819 goto drop_unlock;
@@ -4281,7 +4288,7 @@ static void iwl3945_rx_handle(struct iwl3945_priv *priv)
4281 int reclaim; 4288 int reclaim;
4282 unsigned long flags; 4289 unsigned long flags;
4283 u8 fill_rx = 0; 4290 u8 fill_rx = 0;
4284 u32 count = 0; 4291 u32 count = 8;
4285 4292
4286 /* uCode's read index (stored in shared DRAM) indicates the last Rx 4293 /* uCode's read index (stored in shared DRAM) indicates the last Rx
4287 * buffer that the driver may process (last buffer filled by ucode). */ 4294 * buffer that the driver may process (last buffer filled by ucode). */
@@ -6256,6 +6263,8 @@ static void __iwl3945_down(struct iwl3945_priv *priv)
6256 STATUS_RF_KILL_HW | 6263 STATUS_RF_KILL_HW |
6257 test_bit(STATUS_RF_KILL_SW, &priv->status) << 6264 test_bit(STATUS_RF_KILL_SW, &priv->status) <<
6258 STATUS_RF_KILL_SW | 6265 STATUS_RF_KILL_SW |
6266 test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
6267 STATUS_GEO_CONFIGURED |
6259 test_bit(STATUS_IN_SUSPEND, &priv->status) << 6268 test_bit(STATUS_IN_SUSPEND, &priv->status) <<
6260 STATUS_IN_SUSPEND; 6269 STATUS_IN_SUSPEND;
6261 goto exit; 6270 goto exit;
@@ -6267,6 +6276,8 @@ static void __iwl3945_down(struct iwl3945_priv *priv)
6267 STATUS_RF_KILL_HW | 6276 STATUS_RF_KILL_HW |
6268 test_bit(STATUS_RF_KILL_SW, &priv->status) << 6277 test_bit(STATUS_RF_KILL_SW, &priv->status) <<
6269 STATUS_RF_KILL_SW | 6278 STATUS_RF_KILL_SW |
6279 test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
6280 STATUS_GEO_CONFIGURED |
6270 test_bit(STATUS_IN_SUSPEND, &priv->status) << 6281 test_bit(STATUS_IN_SUSPEND, &priv->status) <<
6271 STATUS_IN_SUSPEND | 6282 STATUS_IN_SUSPEND |
6272 test_bit(STATUS_FW_ERROR, &priv->status) << 6283 test_bit(STATUS_FW_ERROR, &priv->status) <<
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index f423241b9567..a23d4798653b 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -692,6 +692,11 @@ static int iwl4965_enqueue_hcmd(struct iwl4965_priv *priv, struct iwl4965_host_c
692 BUG_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) && 692 BUG_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) &&
693 !(cmd->meta.flags & CMD_SIZE_HUGE)); 693 !(cmd->meta.flags & CMD_SIZE_HUGE));
694 694
695 if (iwl4965_is_rfkill(priv)) {
696 IWL_DEBUG_INFO("Not sending command - RF KILL");
697 return -EIO;
698 }
699
695 if (iwl4965_queue_space(q) < ((cmd->meta.flags & CMD_ASYNC) ? 2 : 1)) { 700 if (iwl4965_queue_space(q) < ((cmd->meta.flags & CMD_ASYNC) ? 2 : 1)) {
696 IWL_ERROR("No space for Tx\n"); 701 IWL_ERROR("No space for Tx\n");
697 return -ENOSPC; 702 return -ENOSPC;
@@ -1654,7 +1659,7 @@ static inline void iwl4965_eeprom_release_semaphore(struct iwl4965_priv *priv)
1654 */ 1659 */
1655int iwl4965_eeprom_init(struct iwl4965_priv *priv) 1660int iwl4965_eeprom_init(struct iwl4965_priv *priv)
1656{ 1661{
1657 __le16 *e = (__le16 *)&priv->eeprom; 1662 u16 *e = (u16 *)&priv->eeprom;
1658 u32 gp = iwl4965_read32(priv, CSR_EEPROM_GP); 1663 u32 gp = iwl4965_read32(priv, CSR_EEPROM_GP);
1659 u32 r; 1664 u32 r;
1660 int sz = sizeof(priv->eeprom); 1665 int sz = sizeof(priv->eeprom);
@@ -1698,7 +1703,7 @@ int iwl4965_eeprom_init(struct iwl4965_priv *priv)
1698 rc = -ETIMEDOUT; 1703 rc = -ETIMEDOUT;
1699 goto done; 1704 goto done;
1700 } 1705 }
1701 e[addr / 2] = cpu_to_le16(r >> 16); 1706 e[addr / 2] = le16_to_cpu((__force __le16)(r >> 16));
1702 } 1707 }
1703 rc = 0; 1708 rc = 0;
1704 1709
@@ -2935,7 +2940,7 @@ static int iwl4965_tx_skb(struct iwl4965_priv *priv,
2935 /* drop all data frame if we are not associated */ 2940 /* drop all data frame if we are not associated */
2936 if (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) && 2941 if (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) &&
2937 (!iwl4965_is_associated(priv) || 2942 (!iwl4965_is_associated(priv) ||
2938 !priv->assoc_id || 2943 ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && !priv->assoc_id) ||
2939 !priv->assoc_station_added)) { 2944 !priv->assoc_station_added)) {
2940 IWL_DEBUG_DROP("Dropping - !iwl4965_is_associated\n"); 2945 IWL_DEBUG_DROP("Dropping - !iwl4965_is_associated\n");
2941 goto drop_unlock; 2946 goto drop_unlock;
@@ -4664,7 +4669,7 @@ static void iwl4965_rx_handle(struct iwl4965_priv *priv)
4664 int reclaim; 4669 int reclaim;
4665 unsigned long flags; 4670 unsigned long flags;
4666 u8 fill_rx = 0; 4671 u8 fill_rx = 0;
4667 u32 count = 0; 4672 u32 count = 8;
4668 4673
4669 /* uCode's read index (stored in shared DRAM) indicates the last Rx 4674 /* uCode's read index (stored in shared DRAM) indicates the last Rx
4670 * buffer that the driver may process (last buffer filled by ucode). */ 4675 * buffer that the driver may process (last buffer filled by ucode). */
@@ -6680,6 +6685,8 @@ static void __iwl4965_down(struct iwl4965_priv *priv)
6680 STATUS_RF_KILL_HW | 6685 STATUS_RF_KILL_HW |
6681 test_bit(STATUS_RF_KILL_SW, &priv->status) << 6686 test_bit(STATUS_RF_KILL_SW, &priv->status) <<
6682 STATUS_RF_KILL_SW | 6687 STATUS_RF_KILL_SW |
6688 test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
6689 STATUS_GEO_CONFIGURED |
6683 test_bit(STATUS_IN_SUSPEND, &priv->status) << 6690 test_bit(STATUS_IN_SUSPEND, &priv->status) <<
6684 STATUS_IN_SUSPEND; 6691 STATUS_IN_SUSPEND;
6685 goto exit; 6692 goto exit;
@@ -6691,6 +6698,8 @@ static void __iwl4965_down(struct iwl4965_priv *priv)
6691 STATUS_RF_KILL_HW | 6698 STATUS_RF_KILL_HW |
6692 test_bit(STATUS_RF_KILL_SW, &priv->status) << 6699 test_bit(STATUS_RF_KILL_SW, &priv->status) <<
6693 STATUS_RF_KILL_SW | 6700 STATUS_RF_KILL_SW |
6701 test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
6702 STATUS_GEO_CONFIGURED |
6694 test_bit(STATUS_IN_SUSPEND, &priv->status) << 6703 test_bit(STATUS_IN_SUSPEND, &priv->status) <<
6695 STATUS_IN_SUSPEND | 6704 STATUS_IN_SUSPEND |
6696 test_bit(STATUS_FW_ERROR, &priv->status) << 6705 test_bit(STATUS_FW_ERROR, &priv->status) <<
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index d3ecf89abd93..8ce2ddf8024f 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -2300,7 +2300,7 @@ static void rndis_update_wireless_stats(struct work_struct *work)
2300 struct usbnet *usbdev = priv->usbdev; 2300 struct usbnet *usbdev = priv->usbdev;
2301 struct iw_statistics iwstats; 2301 struct iw_statistics iwstats;
2302 __le32 rssi, tmp; 2302 __le32 rssi, tmp;
2303 int len, ret, bitrate, j; 2303 int len, ret, j;
2304 unsigned long flags; 2304 unsigned long flags;
2305 int update_jiffies = STATS_UPDATE_JIFFIES; 2305 int update_jiffies = STATS_UPDATE_JIFFIES;
2306 void *buf; 2306 void *buf;
@@ -2352,14 +2352,10 @@ static void rndis_update_wireless_stats(struct work_struct *work)
2352 if (ret == 0) 2352 if (ret == 0)
2353 iwstats.discard.misc += le32_to_cpu(tmp); 2353 iwstats.discard.misc += le32_to_cpu(tmp);
2354 2354
2355 /* Workaround transfer stalls on poor quality links. */ 2355 /* Workaround transfer stalls on poor quality links.
2356 len = sizeof(tmp); 2356 * TODO: find right way to fix these stalls (as stalls do not happen
2357 ret = rndis_query_oid(usbdev, OID_GEN_LINK_SPEED, &tmp, &len); 2357 * with ndiswrapper/windows driver). */
2358 if (ret == 0) { 2358 if (iwstats.qual.qual <= 25) {
2359 bitrate = le32_to_cpu(tmp) * 100;
2360 if (bitrate > 11000000)
2361 goto end;
2362
2363 /* Decrease stats worker interval to catch stalls. 2359 /* Decrease stats worker interval to catch stalls.
2364 * faster. Faster than 400-500ms causes packet loss, 2360 * faster. Faster than 400-500ms causes packet loss,
2365 * Slower doesn't catch stalls fast enough. 2361 * Slower doesn't catch stalls fast enough.
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 86ded4066f5b..4ca9730e5e92 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -1839,11 +1839,11 @@ static struct usb_device_id rt2500usb_device_table[] = {
1839 /* Hercules */ 1839 /* Hercules */
1840 { USB_DEVICE(0x06f8, 0xe000), USB_DEVICE_DATA(&rt2500usb_ops) }, 1840 { USB_DEVICE(0x06f8, 0xe000), USB_DEVICE_DATA(&rt2500usb_ops) },
1841 /* Melco */ 1841 /* Melco */
1842 { USB_DEVICE(0x0411, 0x005e), USB_DEVICE_DATA(&rt2500usb_ops) },
1842 { USB_DEVICE(0x0411, 0x0066), USB_DEVICE_DATA(&rt2500usb_ops) }, 1843 { USB_DEVICE(0x0411, 0x0066), USB_DEVICE_DATA(&rt2500usb_ops) },
1843 { USB_DEVICE(0x0411, 0x0067), USB_DEVICE_DATA(&rt2500usb_ops) }, 1844 { USB_DEVICE(0x0411, 0x0067), USB_DEVICE_DATA(&rt2500usb_ops) },
1844 { USB_DEVICE(0x0411, 0x008b), USB_DEVICE_DATA(&rt2500usb_ops) }, 1845 { USB_DEVICE(0x0411, 0x008b), USB_DEVICE_DATA(&rt2500usb_ops) },
1845 { USB_DEVICE(0x0411, 0x0097), USB_DEVICE_DATA(&rt2500usb_ops) }, 1846 { USB_DEVICE(0x0411, 0x0097), USB_DEVICE_DATA(&rt2500usb_ops) },
1846
1847 /* MSI */ 1847 /* MSI */
1848 { USB_DEVICE(0x0db0, 0x6861), USB_DEVICE_DATA(&rt2500usb_ops) }, 1848 { USB_DEVICE(0x0db0, 0x6861), USB_DEVICE_DATA(&rt2500usb_ops) },
1849 { USB_DEVICE(0x0db0, 0x6865), USB_DEVICE_DATA(&rt2500usb_ops) }, 1849 { USB_DEVICE(0x0db0, 0x6865), USB_DEVICE_DATA(&rt2500usb_ops) },
diff --git a/drivers/net/wireless/wavelan.h b/drivers/net/wireless/wavelan.h
index 27172cde5a39..9ab360558ffd 100644
--- a/drivers/net/wireless/wavelan.h
+++ b/drivers/net/wireless/wavelan.h
@@ -85,7 +85,7 @@ union hacs_u
85#define HASR_MMC_INTR 0x0002 /* Interrupt request from MMC */ 85#define HASR_MMC_INTR 0x0002 /* Interrupt request from MMC */
86#define HASR_MMC_BUSY 0x0004 /* MMC busy indication */ 86#define HASR_MMC_BUSY 0x0004 /* MMC busy indication */
87#define HASR_PSA_BUSY 0x0008 /* LAN parameter storage area busy */ 87#define HASR_PSA_BUSY 0x0008 /* LAN parameter storage area busy */
88}; 88} __attribute__ ((packed));
89 89
90typedef struct ha_t ha_t; 90typedef struct ha_t ha_t;
91struct ha_t 91struct ha_t
@@ -292,7 +292,7 @@ struct mmw_t
292#define MMW_EXT_ANT_INTERNAL 0x00 /* Internal antenna */ 292#define MMW_EXT_ANT_INTERNAL 0x00 /* Internal antenna */
293#define MMW_EXT_ANT_EXTERNAL 0x03 /* External antenna */ 293#define MMW_EXT_ANT_EXTERNAL 0x03 /* External antenna */
294#define MMW_EXT_ANT_IQ_TEST 0x1C /* IQ test pattern (set to 0) */ 294#define MMW_EXT_ANT_IQ_TEST 0x1C /* IQ test pattern (set to 0) */
295}; 295} __attribute__ ((packed));
296 296
297#define MMW_SIZE 37 297#define MMW_SIZE 37
298 298
@@ -347,7 +347,7 @@ struct mmr_t
347 unsigned char mmr_unused4[1]; /* unused */ 347 unsigned char mmr_unused4[1]; /* unused */
348 unsigned char mmr_fee_data_l; /* Read data from EEPROM (low) */ 348 unsigned char mmr_fee_data_l; /* Read data from EEPROM (low) */
349 unsigned char mmr_fee_data_h; /* Read data from EEPROM (high) */ 349 unsigned char mmr_fee_data_h; /* Read data from EEPROM (high) */
350}; 350} __attribute__ ((packed));
351 351
352#define MMR_SIZE 36 352#define MMR_SIZE 36
353 353
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index 67b7c75c430d..28bcdf9fc3df 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -165,6 +165,7 @@ static int ieee80211_open(struct net_device *dev)
165 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 165 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
166 struct ieee80211_if_init_conf conf; 166 struct ieee80211_if_init_conf conf;
167 int res; 167 int res;
168 bool need_hw_reconfig = 0;
168 169
169 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 170 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
170 171
@@ -218,7 +219,7 @@ static int ieee80211_open(struct net_device *dev)
218 res = local->ops->start(local_to_hw(local)); 219 res = local->ops->start(local_to_hw(local));
219 if (res) 220 if (res)
220 return res; 221 return res;
221 ieee80211_hw_config(local); 222 need_hw_reconfig = 1;
222 ieee80211_led_radio(local, local->hw.conf.radio_enabled); 223 ieee80211_led_radio(local, local->hw.conf.radio_enabled);
223 } 224 }
224 225
@@ -282,6 +283,8 @@ static int ieee80211_open(struct net_device *dev)
282 atomic_inc(&local->iff_promiscs); 283 atomic_inc(&local->iff_promiscs);
283 284
284 local->open_count++; 285 local->open_count++;
286 if (need_hw_reconfig)
287 ieee80211_hw_config(local);
285 288
286 netif_start_queue(dev); 289 netif_start_queue(dev);
287 290