aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx.h1
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_dma.c171
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_main.c25
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_wx.c28
-rw-r--r--drivers/net/wireless/ipw2100.c16
-rw-r--r--drivers/net/wireless/zd1211rw/zd_mac.c44
-rw-r--r--drivers/net/wireless/zd1211rw/zd_usb.c12
-rw-r--r--net/core/net-sysfs.c4
-rw-r--r--net/ieee80211/ieee80211_tx.c3
9 files changed, 210 insertions, 94 deletions
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx.h b/drivers/net/wireless/bcm43xx/bcm43xx.h
index 3a064def162e..0e790efae683 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx.h
+++ b/drivers/net/wireless/bcm43xx/bcm43xx.h
@@ -771,6 +771,7 @@ struct bcm43xx_private {
771 * This is currently always BCM43xx_BUSTYPE_PCI 771 * This is currently always BCM43xx_BUSTYPE_PCI
772 */ 772 */
773 u8 bustype; 773 u8 bustype;
774 u64 dma_mask;
774 775
775 u16 board_vendor; 776 u16 board_vendor;
776 u16 board_type; 777 u16 board_type;
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_dma.c b/drivers/net/wireless/bcm43xx/bcm43xx_dma.c
index 978ed099e285..6e0dc76400e5 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_dma.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_dma.c
@@ -145,16 +145,14 @@ dma_addr_t map_descbuffer(struct bcm43xx_dmaring *ring,
145 int tx) 145 int tx)
146{ 146{
147 dma_addr_t dmaaddr; 147 dma_addr_t dmaaddr;
148 int direction = PCI_DMA_FROMDEVICE;
148 149
149 if (tx) { 150 if (tx)
150 dmaaddr = dma_map_single(&ring->bcm->pci_dev->dev, 151 direction = PCI_DMA_TODEVICE;
151 buf, len, 152
152 DMA_TO_DEVICE); 153 dmaaddr = pci_map_single(ring->bcm->pci_dev,
153 } else {
154 dmaaddr = dma_map_single(&ring->bcm->pci_dev->dev,
155 buf, len, 154 buf, len,
156 DMA_FROM_DEVICE); 155 direction);
157 }
158 156
159 return dmaaddr; 157 return dmaaddr;
160} 158}
@@ -166,13 +164,13 @@ void unmap_descbuffer(struct bcm43xx_dmaring *ring,
166 int tx) 164 int tx)
167{ 165{
168 if (tx) { 166 if (tx) {
169 dma_unmap_single(&ring->bcm->pci_dev->dev, 167 pci_unmap_single(ring->bcm->pci_dev,
170 addr, len, 168 addr, len,
171 DMA_TO_DEVICE); 169 PCI_DMA_TODEVICE);
172 } else { 170 } else {
173 dma_unmap_single(&ring->bcm->pci_dev->dev, 171 pci_unmap_single(ring->bcm->pci_dev,
174 addr, len, 172 addr, len,
175 DMA_FROM_DEVICE); 173 PCI_DMA_FROMDEVICE);
176 } 174 }
177} 175}
178 176
@@ -183,8 +181,8 @@ void sync_descbuffer_for_cpu(struct bcm43xx_dmaring *ring,
183{ 181{
184 assert(!ring->tx); 182 assert(!ring->tx);
185 183
186 dma_sync_single_for_cpu(&ring->bcm->pci_dev->dev, 184 pci_dma_sync_single_for_cpu(ring->bcm->pci_dev,
187 addr, len, DMA_FROM_DEVICE); 185 addr, len, PCI_DMA_FROMDEVICE);
188} 186}
189 187
190static inline 188static inline
@@ -194,8 +192,8 @@ void sync_descbuffer_for_device(struct bcm43xx_dmaring *ring,
194{ 192{
195 assert(!ring->tx); 193 assert(!ring->tx);
196 194
197 dma_sync_single_for_device(&ring->bcm->pci_dev->dev, 195 pci_dma_sync_single_for_cpu(ring->bcm->pci_dev,
198 addr, len, DMA_FROM_DEVICE); 196 addr, len, PCI_DMA_TODEVICE);
199} 197}
200 198
201/* Unmap and free a descriptor buffer. */ 199/* Unmap and free a descriptor buffer. */
@@ -214,17 +212,53 @@ void free_descriptor_buffer(struct bcm43xx_dmaring *ring,
214 212
215static int alloc_ringmemory(struct bcm43xx_dmaring *ring) 213static int alloc_ringmemory(struct bcm43xx_dmaring *ring)
216{ 214{
217 struct device *dev = &(ring->bcm->pci_dev->dev); 215 ring->descbase = pci_alloc_consistent(ring->bcm->pci_dev, BCM43xx_DMA_RINGMEMSIZE,
218 216 &(ring->dmabase));
219 ring->descbase = dma_alloc_coherent(dev, BCM43xx_DMA_RINGMEMSIZE,
220 &(ring->dmabase), GFP_KERNEL);
221 if (!ring->descbase) { 217 if (!ring->descbase) {
222 printk(KERN_ERR PFX "DMA ringmemory allocation failed\n"); 218 /* Allocation may have failed due to pci_alloc_consistent
223 return -ENOMEM; 219 insisting on use of GFP_DMA, which is more restrictive
220 than necessary... */
221 struct dma_desc *rx_ring;
222 dma_addr_t rx_ring_dma;
223
224 rx_ring = kzalloc(BCM43xx_DMA_RINGMEMSIZE, GFP_KERNEL);
225 if (!rx_ring)
226 goto out_err;
227
228 rx_ring_dma = pci_map_single(ring->bcm->pci_dev, rx_ring,
229 BCM43xx_DMA_RINGMEMSIZE,
230 PCI_DMA_BIDIRECTIONAL);
231
232 if (pci_dma_mapping_error(rx_ring_dma) ||
233 rx_ring_dma + BCM43xx_DMA_RINGMEMSIZE > ring->bcm->dma_mask) {
234 /* Sigh... */
235 if (!pci_dma_mapping_error(rx_ring_dma))
236 pci_unmap_single(ring->bcm->pci_dev,
237 rx_ring_dma, BCM43xx_DMA_RINGMEMSIZE,
238 PCI_DMA_BIDIRECTIONAL);
239 rx_ring_dma = pci_map_single(ring->bcm->pci_dev,
240 rx_ring, BCM43xx_DMA_RINGMEMSIZE,
241 PCI_DMA_BIDIRECTIONAL);
242 if (pci_dma_mapping_error(rx_ring_dma) ||
243 rx_ring_dma + BCM43xx_DMA_RINGMEMSIZE > ring->bcm->dma_mask) {
244 assert(0);
245 if (!pci_dma_mapping_error(rx_ring_dma))
246 pci_unmap_single(ring->bcm->pci_dev,
247 rx_ring_dma, BCM43xx_DMA_RINGMEMSIZE,
248 PCI_DMA_BIDIRECTIONAL);
249 goto out_err;
250 }
251 }
252
253 ring->descbase = rx_ring;
254 ring->dmabase = rx_ring_dma;
224 } 255 }
225 memset(ring->descbase, 0, BCM43xx_DMA_RINGMEMSIZE); 256 memset(ring->descbase, 0, BCM43xx_DMA_RINGMEMSIZE);
226 257
227 return 0; 258 return 0;
259out_err:
260 printk(KERN_ERR PFX "DMA ringmemory allocation failed\n");
261 return -ENOMEM;
228} 262}
229 263
230static void free_ringmemory(struct bcm43xx_dmaring *ring) 264static void free_ringmemory(struct bcm43xx_dmaring *ring)
@@ -407,6 +441,29 @@ static int setup_rx_descbuffer(struct bcm43xx_dmaring *ring,
407 if (unlikely(!skb)) 441 if (unlikely(!skb))
408 return -ENOMEM; 442 return -ENOMEM;
409 dmaaddr = map_descbuffer(ring, skb->data, ring->rx_buffersize, 0); 443 dmaaddr = map_descbuffer(ring, skb->data, ring->rx_buffersize, 0);
444 /* This hardware bug work-around adapted from the b44 driver.
445 The chip may be unable to do PCI DMA to/from anything above 1GB */
446 if (pci_dma_mapping_error(dmaaddr) ||
447 dmaaddr + ring->rx_buffersize > ring->bcm->dma_mask) {
448 /* This one has 30-bit addressing... */
449 if (!pci_dma_mapping_error(dmaaddr))
450 pci_unmap_single(ring->bcm->pci_dev,
451 dmaaddr, ring->rx_buffersize,
452 PCI_DMA_FROMDEVICE);
453 dev_kfree_skb_any(skb);
454 skb = __dev_alloc_skb(ring->rx_buffersize,GFP_DMA);
455 if (skb == NULL)
456 return -ENOMEM;
457 dmaaddr = pci_map_single(ring->bcm->pci_dev,
458 skb->data, ring->rx_buffersize,
459 PCI_DMA_FROMDEVICE);
460 if (pci_dma_mapping_error(dmaaddr) ||
461 dmaaddr + ring->rx_buffersize > ring->bcm->dma_mask) {
462 assert(0);
463 dev_kfree_skb_any(skb);
464 return -ENOMEM;
465 }
466 }
410 meta->skb = skb; 467 meta->skb = skb;
411 meta->dmaaddr = dmaaddr; 468 meta->dmaaddr = dmaaddr;
412 skb->dev = ring->bcm->net_dev; 469 skb->dev = ring->bcm->net_dev;
@@ -636,8 +693,10 @@ struct bcm43xx_dmaring * bcm43xx_setup_dmaring(struct bcm43xx_private *bcm,
636 err = dmacontroller_setup(ring); 693 err = dmacontroller_setup(ring);
637 if (err) 694 if (err)
638 goto err_free_ringmemory; 695 goto err_free_ringmemory;
696 return ring;
639 697
640out: 698out:
699 printk(KERN_ERR PFX "Error in bcm43xx_setup_dmaring\n");
641 return ring; 700 return ring;
642 701
643err_free_ringmemory: 702err_free_ringmemory:
@@ -705,30 +764,16 @@ int bcm43xx_dma_init(struct bcm43xx_private *bcm)
705 struct bcm43xx_dmaring *ring; 764 struct bcm43xx_dmaring *ring;
706 int err = -ENOMEM; 765 int err = -ENOMEM;
707 int dma64 = 0; 766 int dma64 = 0;
708 u64 mask = bcm43xx_get_supported_dma_mask(bcm);
709 int nobits;
710 767
711 if (mask == DMA_64BIT_MASK) { 768 bcm->dma_mask = bcm43xx_get_supported_dma_mask(bcm);
769 if (bcm->dma_mask == DMA_64BIT_MASK)
712 dma64 = 1; 770 dma64 = 1;
713 nobits = 64; 771 err = pci_set_dma_mask(bcm->pci_dev, bcm->dma_mask);
714 } else if (mask == DMA_32BIT_MASK) 772 if (err)
715 nobits = 32; 773 goto no_dma;
716 else 774 err = pci_set_consistent_dma_mask(bcm->pci_dev, bcm->dma_mask);
717 nobits = 30; 775 if (err)
718 err = pci_set_dma_mask(bcm->pci_dev, mask); 776 goto no_dma;
719 err |= pci_set_consistent_dma_mask(bcm->pci_dev, mask);
720 if (err) {
721#ifdef CONFIG_BCM43XX_PIO
722 printk(KERN_WARNING PFX "DMA not supported on this device."
723 " Falling back to PIO.\n");
724 bcm->__using_pio = 1;
725 return -ENOSYS;
726#else
727 printk(KERN_ERR PFX "FATAL: DMA not supported and PIO not configured. "
728 "Please recompile the driver with PIO support.\n");
729 return -ENODEV;
730#endif /* CONFIG_BCM43XX_PIO */
731 }
732 777
733 /* setup TX DMA channels. */ 778 /* setup TX DMA channels. */
734 ring = bcm43xx_setup_dmaring(bcm, 0, 1, dma64); 779 ring = bcm43xx_setup_dmaring(bcm, 0, 1, dma64);
@@ -774,7 +819,9 @@ int bcm43xx_dma_init(struct bcm43xx_private *bcm)
774 dma->rx_ring3 = ring; 819 dma->rx_ring3 = ring;
775 } 820 }
776 821
777 dprintk(KERN_INFO PFX "%d-bit DMA initialized\n", nobits); 822 dprintk(KERN_INFO PFX "%d-bit DMA initialized\n",
823 (bcm->dma_mask == DMA_64BIT_MASK) ? 64 :
824 (bcm->dma_mask == DMA_32BIT_MASK) ? 32 : 30);
778 err = 0; 825 err = 0;
779out: 826out:
780 return err; 827 return err;
@@ -800,7 +847,17 @@ err_destroy_tx1:
800err_destroy_tx0: 847err_destroy_tx0:
801 bcm43xx_destroy_dmaring(dma->tx_ring0); 848 bcm43xx_destroy_dmaring(dma->tx_ring0);
802 dma->tx_ring0 = NULL; 849 dma->tx_ring0 = NULL;
803 goto out; 850no_dma:
851#ifdef CONFIG_BCM43XX_PIO
852 printk(KERN_WARNING PFX "DMA not supported on this device."
853 " Falling back to PIO.\n");
854 bcm->__using_pio = 1;
855 return -ENOSYS;
856#else
857 printk(KERN_ERR PFX "FATAL: DMA not supported and PIO not configured. "
858 "Please recompile the driver with PIO support.\n");
859 return -ENODEV;
860#endif /* CONFIG_BCM43XX_PIO */
804} 861}
805 862
806/* Generate a cookie for the TX header. */ 863/* Generate a cookie for the TX header. */
@@ -905,6 +962,7 @@ static void dma_tx_fragment(struct bcm43xx_dmaring *ring,
905 struct bcm43xx_dmadesc_generic *desc; 962 struct bcm43xx_dmadesc_generic *desc;
906 struct bcm43xx_dmadesc_meta *meta; 963 struct bcm43xx_dmadesc_meta *meta;
907 dma_addr_t dmaaddr; 964 dma_addr_t dmaaddr;
965 struct sk_buff *bounce_skb;
908 966
909 assert(skb_shinfo(skb)->nr_frags == 0); 967 assert(skb_shinfo(skb)->nr_frags == 0);
910 968
@@ -924,9 +982,28 @@ static void dma_tx_fragment(struct bcm43xx_dmaring *ring,
924 skb->len - sizeof(struct bcm43xx_txhdr), 982 skb->len - sizeof(struct bcm43xx_txhdr),
925 (cur_frag == 0), 983 (cur_frag == 0),
926 generate_cookie(ring, slot)); 984 generate_cookie(ring, slot));
985 dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1);
986 if (dma_mapping_error(dmaaddr) || dmaaddr + skb->len > ring->bcm->dma_mask) {
987 /* chip cannot handle DMA to/from > 1GB, use bounce buffer (copied from b44 driver) */
988 if (!dma_mapping_error(dmaaddr))
989 unmap_descbuffer(ring, dmaaddr, skb->len, 1);
990 bounce_skb = __dev_alloc_skb(skb->len, GFP_ATOMIC|GFP_DMA);
991 if (!bounce_skb)
992 return;
993 dmaaddr = map_descbuffer(ring, bounce_skb->data, bounce_skb->len, 1);
994 if (dma_mapping_error(dmaaddr) || dmaaddr + skb->len > ring->bcm->dma_mask) {
995 if (!dma_mapping_error(dmaaddr))
996 unmap_descbuffer(ring, dmaaddr, skb->len, 1);
997 dev_kfree_skb_any(bounce_skb);
998 assert(0);
999 return;
1000 }
1001 memcpy(skb_put(bounce_skb, skb->len), skb->data, skb->len);
1002 dev_kfree_skb_any(skb);
1003 skb = bounce_skb;
1004 }
927 1005
928 meta->skb = skb; 1006 meta->skb = skb;
929 dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1);
930 meta->dmaaddr = dmaaddr; 1007 meta->dmaaddr = dmaaddr;
931 1008
932 fill_descriptor(ring, desc, dmaaddr, 1009 fill_descriptor(ring, desc, dmaaddr,
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
index 23aaf1ed8541..2e400aacc436 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
@@ -95,13 +95,9 @@ static int modparam_noleds;
95module_param_named(noleds, modparam_noleds, int, 0444); 95module_param_named(noleds, modparam_noleds, int, 0444);
96MODULE_PARM_DESC(noleds, "Turn off all LED activity"); 96MODULE_PARM_DESC(noleds, "Turn off all LED activity");
97 97
98#ifdef CONFIG_BCM43XX_DEBUG
99static char modparam_fwpostfix[64]; 98static char modparam_fwpostfix[64];
100module_param_string(fwpostfix, modparam_fwpostfix, 64, 0444); 99module_param_string(fwpostfix, modparam_fwpostfix, 64, 0444);
101MODULE_PARM_DESC(fwpostfix, "Postfix for .fw files. Useful for debugging."); 100MODULE_PARM_DESC(fwpostfix, "Postfix for .fw files. Useful for using multiple firmware image versions.");
102#else
103# define modparam_fwpostfix ""
104#endif /* CONFIG_BCM43XX_DEBUG*/
105 101
106 102
107/* If you want to debug with just a single device, enable this, 103/* If you want to debug with just a single device, enable this,
@@ -2983,8 +2979,10 @@ static int bcm43xx_chipset_attach(struct bcm43xx_private *bcm)
2983 err = bcm43xx_pctl_set_crystal(bcm, 1); 2979 err = bcm43xx_pctl_set_crystal(bcm, 1);
2984 if (err) 2980 if (err)
2985 goto out; 2981 goto out;
2986 bcm43xx_pci_read_config16(bcm, PCI_STATUS, &pci_status); 2982 err = bcm43xx_pci_read_config16(bcm, PCI_STATUS, &pci_status);
2987 bcm43xx_pci_write_config16(bcm, PCI_STATUS, pci_status & ~PCI_STATUS_SIG_TARGET_ABORT); 2983 if (err)
2984 goto out;
2985 err = bcm43xx_pci_write_config16(bcm, PCI_STATUS, pci_status & ~PCI_STATUS_SIG_TARGET_ABORT);
2988 2986
2989out: 2987out:
2990 return err; 2988 return err;
@@ -3796,12 +3794,18 @@ static int bcm43xx_attach_board(struct bcm43xx_private *bcm)
3796 } 3794 }
3797 net_dev->base_addr = (unsigned long)bcm->mmio_addr; 3795 net_dev->base_addr = (unsigned long)bcm->mmio_addr;
3798 3796
3799 bcm43xx_pci_read_config16(bcm, PCI_SUBSYSTEM_VENDOR_ID, 3797 err = bcm43xx_pci_read_config16(bcm, PCI_SUBSYSTEM_VENDOR_ID,
3800 &bcm->board_vendor); 3798 &bcm->board_vendor);
3801 bcm43xx_pci_read_config16(bcm, PCI_SUBSYSTEM_ID, 3799 if (err)
3800 goto err_iounmap;
3801 err = bcm43xx_pci_read_config16(bcm, PCI_SUBSYSTEM_ID,
3802 &bcm->board_type); 3802 &bcm->board_type);
3803 bcm43xx_pci_read_config16(bcm, PCI_REVISION_ID, 3803 if (err)
3804 goto err_iounmap;
3805 err = bcm43xx_pci_read_config16(bcm, PCI_REVISION_ID,
3804 &bcm->board_revision); 3806 &bcm->board_revision);
3807 if (err)
3808 goto err_iounmap;
3805 3809
3806 err = bcm43xx_chipset_attach(bcm); 3810 err = bcm43xx_chipset_attach(bcm);
3807 if (err) 3811 if (err)
@@ -3892,6 +3896,7 @@ err_pci_release:
3892 pci_release_regions(pci_dev); 3896 pci_release_regions(pci_dev);
3893err_pci_disable: 3897err_pci_disable:
3894 pci_disable_device(pci_dev); 3898 pci_disable_device(pci_dev);
3899 printk(KERN_ERR PFX "Unable to attach board\n");
3895 goto out; 3900 goto out;
3896} 3901}
3897 3902
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
index a659442b9c15..6961be682c9d 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
@@ -261,22 +261,22 @@ static int bcm43xx_wx_get_rangeparams(struct net_device *net_dev,
261 if (phy->type == BCM43xx_PHYTYPE_A || 261 if (phy->type == BCM43xx_PHYTYPE_A ||
262 phy->type == BCM43xx_PHYTYPE_G) { 262 phy->type == BCM43xx_PHYTYPE_G) {
263 range->num_bitrates = 8; 263 range->num_bitrates = 8;
264 range->bitrate[i++] = IEEE80211_OFDM_RATE_6MB; 264 range->bitrate[i++] = IEEE80211_OFDM_RATE_6MB * 500000;
265 range->bitrate[i++] = IEEE80211_OFDM_RATE_9MB; 265 range->bitrate[i++] = IEEE80211_OFDM_RATE_9MB * 500000;
266 range->bitrate[i++] = IEEE80211_OFDM_RATE_12MB; 266 range->bitrate[i++] = IEEE80211_OFDM_RATE_12MB * 500000;
267 range->bitrate[i++] = IEEE80211_OFDM_RATE_18MB; 267 range->bitrate[i++] = IEEE80211_OFDM_RATE_18MB * 500000;
268 range->bitrate[i++] = IEEE80211_OFDM_RATE_24MB; 268 range->bitrate[i++] = IEEE80211_OFDM_RATE_24MB * 500000;
269 range->bitrate[i++] = IEEE80211_OFDM_RATE_36MB; 269 range->bitrate[i++] = IEEE80211_OFDM_RATE_36MB * 500000;
270 range->bitrate[i++] = IEEE80211_OFDM_RATE_48MB; 270 range->bitrate[i++] = IEEE80211_OFDM_RATE_48MB * 500000;
271 range->bitrate[i++] = IEEE80211_OFDM_RATE_54MB; 271 range->bitrate[i++] = IEEE80211_OFDM_RATE_54MB * 500000;
272 } 272 }
273 if (phy->type == BCM43xx_PHYTYPE_B || 273 if (phy->type == BCM43xx_PHYTYPE_B ||
274 phy->type == BCM43xx_PHYTYPE_G) { 274 phy->type == BCM43xx_PHYTYPE_G) {
275 range->num_bitrates += 4; 275 range->num_bitrates += 4;
276 range->bitrate[i++] = IEEE80211_CCK_RATE_1MB; 276 range->bitrate[i++] = IEEE80211_CCK_RATE_1MB * 500000;
277 range->bitrate[i++] = IEEE80211_CCK_RATE_2MB; 277 range->bitrate[i++] = IEEE80211_CCK_RATE_2MB * 500000;
278 range->bitrate[i++] = IEEE80211_CCK_RATE_5MB; 278 range->bitrate[i++] = IEEE80211_CCK_RATE_5MB * 500000;
279 range->bitrate[i++] = IEEE80211_CCK_RATE_11MB; 279 range->bitrate[i++] = IEEE80211_CCK_RATE_11MB * 500000;
280 } 280 }
281 281
282 geo = ieee80211_get_geo(bcm->ieee); 282 geo = ieee80211_get_geo(bcm->ieee);
@@ -286,7 +286,7 @@ static int bcm43xx_wx_get_rangeparams(struct net_device *net_dev,
286 if (j == IW_MAX_FREQUENCIES) 286 if (j == IW_MAX_FREQUENCIES)
287 break; 287 break;
288 range->freq[j].i = j + 1; 288 range->freq[j].i = j + 1;
289 range->freq[j].m = geo->a[i].freq;//FIXME? 289 range->freq[j].m = geo->a[i].freq * 100000;
290 range->freq[j].e = 1; 290 range->freq[j].e = 1;
291 j++; 291 j++;
292 } 292 }
@@ -294,7 +294,7 @@ static int bcm43xx_wx_get_rangeparams(struct net_device *net_dev,
294 if (j == IW_MAX_FREQUENCIES) 294 if (j == IW_MAX_FREQUENCIES)
295 break; 295 break;
296 range->freq[j].i = j + 1; 296 range->freq[j].i = j + 1;
297 range->freq[j].m = geo->bg[i].freq;//FIXME? 297 range->freq[j].m = geo->bg[i].freq * 100000;
298 range->freq[j].e = 1; 298 range->freq[j].e = 1;
299 j++; 299 j++;
300 } 300 }
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c
index b85857a84870..d0639a45cd2c 100644
--- a/drivers/net/wireless/ipw2100.c
+++ b/drivers/net/wireless/ipw2100.c
@@ -175,7 +175,7 @@ that only one external action is invoked at a time.
175 175
176/* Debugging stuff */ 176/* Debugging stuff */
177#ifdef CONFIG_IPW2100_DEBUG 177#ifdef CONFIG_IPW2100_DEBUG
178#define CONFIG_IPW2100_RX_DEBUG /* Reception debugging */ 178#define IPW2100_RX_DEBUG /* Reception debugging */
179#endif 179#endif
180 180
181MODULE_DESCRIPTION(DRV_DESCRIPTION); 181MODULE_DESCRIPTION(DRV_DESCRIPTION);
@@ -2239,7 +2239,7 @@ static void ipw2100_snapshot_free(struct ipw2100_priv *priv)
2239 priv->snapshot[0] = NULL; 2239 priv->snapshot[0] = NULL;
2240} 2240}
2241 2241
2242#ifdef CONFIG_IPW2100_DEBUG_C3 2242#ifdef IPW2100_DEBUG_C3
2243static int ipw2100_snapshot_alloc(struct ipw2100_priv *priv) 2243static int ipw2100_snapshot_alloc(struct ipw2100_priv *priv)
2244{ 2244{
2245 int i; 2245 int i;
@@ -2314,13 +2314,13 @@ static u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 * in_buf,
2314 * The size of the constructed ethernet 2314 * The size of the constructed ethernet
2315 * 2315 *
2316 */ 2316 */
2317#ifdef CONFIG_IPW2100_RX_DEBUG 2317#ifdef IPW2100_RX_DEBUG
2318static u8 packet_data[IPW_RX_NIC_BUFFER_LENGTH]; 2318static u8 packet_data[IPW_RX_NIC_BUFFER_LENGTH];
2319#endif 2319#endif
2320 2320
2321static void ipw2100_corruption_detected(struct ipw2100_priv *priv, int i) 2321static void ipw2100_corruption_detected(struct ipw2100_priv *priv, int i)
2322{ 2322{
2323#ifdef CONFIG_IPW2100_DEBUG_C3 2323#ifdef IPW2100_DEBUG_C3
2324 struct ipw2100_status *status = &priv->status_queue.drv[i]; 2324 struct ipw2100_status *status = &priv->status_queue.drv[i];
2325 u32 match, reg; 2325 u32 match, reg;
2326 int j; 2326 int j;
@@ -2342,7 +2342,7 @@ static void ipw2100_corruption_detected(struct ipw2100_priv *priv, int i)
2342 } 2342 }
2343#endif 2343#endif
2344 2344
2345#ifdef CONFIG_IPW2100_DEBUG_C3 2345#ifdef IPW2100_DEBUG_C3
2346 /* Halt the fimrware so we can get a good image */ 2346 /* Halt the fimrware so we can get a good image */
2347 write_register(priv->net_dev, IPW_REG_RESET_REG, 2347 write_register(priv->net_dev, IPW_REG_RESET_REG,
2348 IPW_AUX_HOST_RESET_REG_STOP_MASTER); 2348 IPW_AUX_HOST_RESET_REG_STOP_MASTER);
@@ -2413,7 +2413,7 @@ static void isr_rx(struct ipw2100_priv *priv, int i,
2413 2413
2414 skb_put(packet->skb, status->frame_size); 2414 skb_put(packet->skb, status->frame_size);
2415 2415
2416#ifdef CONFIG_IPW2100_RX_DEBUG 2416#ifdef IPW2100_RX_DEBUG
2417 /* Make a copy of the frame so we can dump it to the logs if 2417 /* Make a copy of the frame so we can dump it to the logs if
2418 * ieee80211_rx fails */ 2418 * ieee80211_rx fails */
2419 memcpy(packet_data, packet->skb->data, 2419 memcpy(packet_data, packet->skb->data,
@@ -2421,7 +2421,7 @@ static void isr_rx(struct ipw2100_priv *priv, int i,
2421#endif 2421#endif
2422 2422
2423 if (!ieee80211_rx(priv->ieee, packet->skb, stats)) { 2423 if (!ieee80211_rx(priv->ieee, packet->skb, stats)) {
2424#ifdef CONFIG_IPW2100_RX_DEBUG 2424#ifdef IPW2100_RX_DEBUG
2425 IPW_DEBUG_DROP("%s: Non consumed packet:\n", 2425 IPW_DEBUG_DROP("%s: Non consumed packet:\n",
2426 priv->net_dev->name); 2426 priv->net_dev->name);
2427 printk_buf(IPW_DL_DROP, packet_data, status->frame_size); 2427 printk_buf(IPW_DL_DROP, packet_data, status->frame_size);
@@ -4912,7 +4912,7 @@ static int ipw2100_set_power_mode(struct ipw2100_priv *priv, int power_level)
4912 else 4912 else
4913 priv->power_mode = IPW_POWER_ENABLED | power_level; 4913 priv->power_mode = IPW_POWER_ENABLED | power_level;
4914 4914
4915#ifdef CONFIG_IPW2100_TX_POWER 4915#ifdef IPW2100_TX_POWER
4916 if (priv->port_type == IBSS && priv->adhoc_power != DFTL_IBSS_TX_POWER) { 4916 if (priv->port_type == IBSS && priv->adhoc_power != DFTL_IBSS_TX_POWER) {
4917 /* Set beacon interval */ 4917 /* Set beacon interval */
4918 cmd.host_command = TX_POWER_INDEX; 4918 cmd.host_command = TX_POWER_INDEX;
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c
index a08524191b5d..4c5f78eac349 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -156,7 +156,7 @@ void zd_mac_clear(struct zd_mac *mac)
156static int reset_mode(struct zd_mac *mac) 156static int reset_mode(struct zd_mac *mac)
157{ 157{
158 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac); 158 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
159 struct zd_ioreq32 ioreqs[3] = { 159 struct zd_ioreq32 ioreqs[] = {
160 { CR_RX_FILTER, STA_RX_FILTER }, 160 { CR_RX_FILTER, STA_RX_FILTER },
161 { CR_SNIFFER_ON, 0U }, 161 { CR_SNIFFER_ON, 0U },
162 }; 162 };
@@ -164,10 +164,9 @@ static int reset_mode(struct zd_mac *mac)
164 if (ieee->iw_mode == IW_MODE_MONITOR) { 164 if (ieee->iw_mode == IW_MODE_MONITOR) {
165 ioreqs[0].value = 0xffffffff; 165 ioreqs[0].value = 0xffffffff;
166 ioreqs[1].value = 0x1; 166 ioreqs[1].value = 0x1;
167 ioreqs[2].value = ENC_SNIFFER;
168 } 167 }
169 168
170 return zd_iowrite32a(&mac->chip, ioreqs, 3); 169 return zd_iowrite32a(&mac->chip, ioreqs, ARRAY_SIZE(ioreqs));
171} 170}
172 171
173int zd_mac_open(struct net_device *netdev) 172int zd_mac_open(struct net_device *netdev)
@@ -904,16 +903,21 @@ static int fill_ctrlset(struct zd_mac *mac,
904static int zd_mac_tx(struct zd_mac *mac, struct ieee80211_txb *txb, int pri) 903static int zd_mac_tx(struct zd_mac *mac, struct ieee80211_txb *txb, int pri)
905{ 904{
906 int i, r; 905 int i, r;
906 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
907 907
908 for (i = 0; i < txb->nr_frags; i++) { 908 for (i = 0; i < txb->nr_frags; i++) {
909 struct sk_buff *skb = txb->fragments[i]; 909 struct sk_buff *skb = txb->fragments[i];
910 910
911 r = fill_ctrlset(mac, txb, i); 911 r = fill_ctrlset(mac, txb, i);
912 if (r) 912 if (r) {
913 ieee->stats.tx_dropped++;
913 return r; 914 return r;
915 }
914 r = zd_usb_tx(&mac->chip.usb, skb->data, skb->len); 916 r = zd_usb_tx(&mac->chip.usb, skb->data, skb->len);
915 if (r) 917 if (r) {
918 ieee->stats.tx_dropped++;
916 return r; 919 return r;
920 }
917 } 921 }
918 922
919 /* FIXME: shouldn't this be handled by the upper layers? */ 923 /* FIXME: shouldn't this be handled by the upper layers? */
@@ -1063,9 +1067,23 @@ static int fill_rx_stats(struct ieee80211_rx_stats *stats,
1063 1067
1064 *pstatus = status = zd_tail(buffer, length, sizeof(struct rx_status)); 1068 *pstatus = status = zd_tail(buffer, length, sizeof(struct rx_status));
1065 if (status->frame_status & ZD_RX_ERROR) { 1069 if (status->frame_status & ZD_RX_ERROR) {
1066 /* FIXME: update? */ 1070 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
1071 ieee->stats.rx_errors++;
1072 if (status->frame_status & ZD_RX_TIMEOUT_ERROR)
1073 ieee->stats.rx_missed_errors++;
1074 else if (status->frame_status & ZD_RX_FIFO_OVERRUN_ERROR)
1075 ieee->stats.rx_fifo_errors++;
1076 else if (status->frame_status & ZD_RX_DECRYPTION_ERROR)
1077 ieee->ieee_stats.rx_discards_undecryptable++;
1078 else if (status->frame_status & ZD_RX_CRC32_ERROR) {
1079 ieee->stats.rx_crc_errors++;
1080 ieee->ieee_stats.rx_fcs_errors++;
1081 }
1082 else if (status->frame_status & ZD_RX_CRC16_ERROR)
1083 ieee->stats.rx_crc_errors++;
1067 return -EINVAL; 1084 return -EINVAL;
1068 } 1085 }
1086
1069 memset(stats, 0, sizeof(struct ieee80211_rx_stats)); 1087 memset(stats, 0, sizeof(struct ieee80211_rx_stats));
1070 stats->len = length - (ZD_PLCP_HEADER_SIZE + IEEE80211_FCS_LEN + 1088 stats->len = length - (ZD_PLCP_HEADER_SIZE + IEEE80211_FCS_LEN +
1071 + sizeof(struct rx_status)); 1089 + sizeof(struct rx_status));
@@ -1094,14 +1112,16 @@ static void zd_mac_rx(struct zd_mac *mac, struct sk_buff *skb)
1094 if (skb->len < ZD_PLCP_HEADER_SIZE + IEEE80211_1ADDR_LEN + 1112 if (skb->len < ZD_PLCP_HEADER_SIZE + IEEE80211_1ADDR_LEN +
1095 IEEE80211_FCS_LEN + sizeof(struct rx_status)) 1113 IEEE80211_FCS_LEN + sizeof(struct rx_status))
1096 { 1114 {
1097 dev_dbg_f(zd_mac_dev(mac), "Packet with length %u to small.\n", 1115 ieee->stats.rx_errors++;
1098 skb->len); 1116 ieee->stats.rx_length_errors++;
1099 goto free_skb; 1117 goto free_skb;
1100 } 1118 }
1101 1119
1102 r = fill_rx_stats(&stats, &status, mac, skb->data, skb->len); 1120 r = fill_rx_stats(&stats, &status, mac, skb->data, skb->len);
1103 if (r) { 1121 if (r) {
1104 /* Only packets with rx errors are included here. */ 1122 /* Only packets with rx errors are included here.
1123 * The error stats have already been set in fill_rx_stats.
1124 */
1105 goto free_skb; 1125 goto free_skb;
1106 } 1126 }
1107 1127
@@ -1114,8 +1134,10 @@ static void zd_mac_rx(struct zd_mac *mac, struct sk_buff *skb)
1114 1134
1115 r = filter_rx(ieee, skb->data, skb->len, &stats); 1135 r = filter_rx(ieee, skb->data, skb->len, &stats);
1116 if (r <= 0) { 1136 if (r <= 0) {
1117 if (r < 0) 1137 if (r < 0) {
1138 ieee->stats.rx_errors++;
1118 dev_dbg_f(zd_mac_dev(mac), "Error in packet.\n"); 1139 dev_dbg_f(zd_mac_dev(mac), "Error in packet.\n");
1140 }
1119 goto free_skb; 1141 goto free_skb;
1120 } 1142 }
1121 1143
@@ -1146,7 +1168,9 @@ int zd_mac_rx_irq(struct zd_mac *mac, const u8 *buffer, unsigned int length)
1146 1168
1147 skb = dev_alloc_skb(sizeof(struct zd_rt_hdr) + length); 1169 skb = dev_alloc_skb(sizeof(struct zd_rt_hdr) + length);
1148 if (!skb) { 1170 if (!skb) {
1171 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
1149 dev_warn(zd_mac_dev(mac), "Could not allocate skb.\n"); 1172 dev_warn(zd_mac_dev(mac), "Could not allocate skb.\n");
1173 ieee->stats.rx_dropped++;
1150 return -ENOMEM; 1174 return -ENOMEM;
1151 } 1175 }
1152 skb_reserve(skb, sizeof(struct zd_rt_hdr)); 1176 skb_reserve(skb, sizeof(struct zd_rt_hdr));
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c
index 75ef55624d7f..aac8a1c5ba08 100644
--- a/drivers/net/wireless/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zd1211rw/zd_usb.c
@@ -313,6 +313,12 @@ out:
313 313
314static inline void handle_retry_failed_int(struct urb *urb) 314static inline void handle_retry_failed_int(struct urb *urb)
315{ 315{
316 struct zd_usb *usb = urb->context;
317 struct zd_mac *mac = zd_usb_to_mac(usb);
318 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
319
320 ieee->stats.tx_errors++;
321 ieee->ieee_stats.tx_retry_limit_exceeded++;
316 dev_dbg_f(urb_dev(urb), "retry failed interrupt\n"); 322 dev_dbg_f(urb_dev(urb), "retry failed interrupt\n");
317} 323}
318 324
@@ -487,6 +493,9 @@ static void handle_rx_packet(struct zd_usb *usb, const u8 *buffer,
487 493
488 if (length < sizeof(struct rx_length_info)) { 494 if (length < sizeof(struct rx_length_info)) {
489 /* It's not a complete packet anyhow. */ 495 /* It's not a complete packet anyhow. */
496 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
497 ieee->stats.rx_errors++;
498 ieee->stats.rx_length_errors++;
490 return; 499 return;
491 } 500 }
492 length_info = (struct rx_length_info *) 501 length_info = (struct rx_length_info *)
@@ -923,6 +932,8 @@ static int probe(struct usb_interface *intf, const struct usb_device_id *id)
923 goto error; 932 goto error;
924 } 933 }
925 934
935 usb_reset_device(interface_to_usbdev(intf));
936
926 netdev = zd_netdev_alloc(intf); 937 netdev = zd_netdev_alloc(intf);
927 if (netdev == NULL) { 938 if (netdev == NULL) {
928 r = -ENOMEM; 939 r = -ENOMEM;
@@ -1024,6 +1035,7 @@ static int __init usb_init(void)
1024 1035
1025 r = usb_register(&driver); 1036 r = usb_register(&driver);
1026 if (r) { 1037 if (r) {
1038 destroy_workqueue(zd_workqueue);
1027 printk(KERN_ERR "%s usb_register() failed. Error number %d\n", 1039 printk(KERN_ERR "%s usb_register() failed. Error number %d\n",
1028 driver.name, r); 1040 driver.name, r);
1029 return r; 1041 return r;
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 44db095a8f7e..cd59ac620092 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -340,7 +340,7 @@ static struct attribute_group netstat_group = {
340 .attrs = netstat_attrs, 340 .attrs = netstat_attrs,
341}; 341};
342 342
343#ifdef WIRELESS_EXT 343#ifdef CONFIG_WIRELESS_EXT
344/* helper function that does all the locking etc for wireless stats */ 344/* helper function that does all the locking etc for wireless stats */
345static ssize_t wireless_show(struct device *d, char *buf, 345static ssize_t wireless_show(struct device *d, char *buf,
346 ssize_t (*format)(const struct iw_statistics *, 346 ssize_t (*format)(const struct iw_statistics *,
@@ -473,7 +473,7 @@ int netdev_register_sysfs(struct net_device *net)
473 if (net->get_stats) 473 if (net->get_stats)
474 *groups++ = &netstat_group; 474 *groups++ = &netstat_group;
475 475
476#ifdef WIRELESS_EXT 476#ifdef CONFIG_WIRELESS_EXT
477 if (net->wireless_handlers && net->wireless_handlers->get_wireless_stats) 477 if (net->wireless_handlers && net->wireless_handlers->get_wireless_stats)
478 *groups++ = &wireless_group; 478 *groups++ = &wireless_group;
479#endif 479#endif
diff --git a/net/ieee80211/ieee80211_tx.c b/net/ieee80211/ieee80211_tx.c
index 854fc13cd78d..54e01160166f 100644
--- a/net/ieee80211/ieee80211_tx.c
+++ b/net/ieee80211/ieee80211_tx.c
@@ -502,9 +502,6 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
502 if (host_encrypt) 502 if (host_encrypt)
503 ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len); 503 ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len);
504 else if (host_build_iv) { 504 else if (host_build_iv) {
505 struct ieee80211_crypt_data *crypt;
506
507 crypt = ieee->crypt[ieee->tx_keyidx];
508 atomic_inc(&crypt->refcnt); 505 atomic_inc(&crypt->refcnt);
509 if (crypt->ops->build_iv) 506 if (crypt->ops->build_iv)
510 crypt->ops->build_iv(skb_frag, hdr_len, 507 crypt->ops->build_iv(skb_frag, hdr_len,