Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6

+129 -447
+3 -15
drivers/net/wireless/ath/ath5k/base.c
··· 1903 1903 rxs->noise = sc->ah->ah_noise_floor; 1904 1904 rxs->signal = rxs->noise + rs.rs_rssi; 1905 1905 1906 - /* An rssi of 35 indicates you should be able use 1907 - * 54 Mbps reliably. A more elaborate scheme can be used 1908 - * here but it requires a map of SNR/throughput for each 1909 - * possible mode used */ 1910 - rxs->qual = rs.rs_rssi * 100 / 35; 1911 - 1912 - /* rssi can be more than 35 though, anything above that 1913 - * should be considered at 100% */ 1914 - if (rxs->qual > 100) 1915 - rxs->qual = 100; 1916 - 1917 1906 rxs->antenna = rs.rs_antenna; 1918 1907 rxs->rate_idx = ath5k_hw_to_driver_rix(sc, rs.rs_rate); 1919 1908 rxs->flag |= ath5k_rx_decrypted(sc, ds, skb, &rs); ··· 2370 2381 */ 2371 2382 ath5k_stop_locked(sc); 2372 2383 2384 + /* Set PHY calibration interval */ 2385 + ah->ah_cal_intval = ath5k_calinterval; 2386 + 2373 2387 /* 2374 2388 * The basic interface to setting the hardware in a good 2375 2389 * state is ``reset''. On return the hardware is known to ··· 2400 2408 2401 2409 /* Set ack to be sent at low bit-rates */ 2402 2410 ath5k_hw_set_ack_bitrate_high(ah, false); 2403 - 2404 - /* Set PHY calibration inteval */ 2405 - ah->ah_cal_intval = ath5k_calinterval; 2406 - 2407 2411 ret = 0; 2408 2412 done: 2409 2413 mmiowb();
+3
drivers/net/wireless/ath/ath9k/mac.h
··· 77 77 #define ATH9K_TXERR_XTXOP 0x08 78 78 #define ATH9K_TXERR_TIMER_EXPIRED 0x10 79 79 #define ATH9K_TX_ACKED 0x20 80 + #define ATH9K_TXERR_MASK \ 81 + (ATH9K_TXERR_XRETRY | ATH9K_TXERR_FILT | ATH9K_TXERR_FIFO | \ 82 + ATH9K_TXERR_XTXOP | ATH9K_TXERR_TIMER_EXPIRED) 80 83 81 84 #define ATH9K_TX_BA 0x01 82 85 #define ATH9K_TX_PWRMGMT 0x02
+14
drivers/net/wireless/ath/ath9k/main.c
··· 2514 2514 return; /* another wiphy still in use */ 2515 2515 } 2516 2516 2517 + /* Ensure HW is awake when we try to shut it down. */ 2518 + ath9k_ps_wakeup(sc); 2519 + 2517 2520 if (ah->btcoex_hw.enabled) { 2518 2521 ath9k_hw_btcoex_disable(ah); 2519 2522 if (ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE) ··· 2537 2534 /* disable HAL and put h/w to sleep */ 2538 2535 ath9k_hw_disable(ah); 2539 2536 ath9k_hw_configpcipowersave(ah, 1, 1); 2537 + ath9k_ps_restore(sc); 2538 + 2539 + /* Finally, put the chip in FULL SLEEP mode */ 2540 2540 ath9k_setpower(sc, ATH9K_PM_FULL_SLEEP); 2541 2541 2542 2542 sc->sc_flags |= SC_OP_INVALID; ··· 2653 2647 if ((sc->sc_ah->opmode == NL80211_IFTYPE_AP) || 2654 2648 (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) || 2655 2649 (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT)) { 2650 + ath9k_ps_wakeup(sc); 2656 2651 ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq); 2657 2652 ath_beacon_return(sc, avp); 2653 + ath9k_ps_restore(sc); 2658 2654 } 2659 2655 2660 2656 sc->sc_flags &= ~SC_OP_BEACONS; ··· 3105 3097 case IEEE80211_AMPDU_RX_STOP: 3106 3098 break; 3107 3099 case IEEE80211_AMPDU_TX_START: 3100 + ath9k_ps_wakeup(sc); 3108 3101 ath_tx_aggr_start(sc, sta, tid, ssn); 3109 3102 ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); 3103 + ath9k_ps_restore(sc); 3110 3104 break; 3111 3105 case IEEE80211_AMPDU_TX_STOP: 3106 + ath9k_ps_wakeup(sc); 3112 3107 ath_tx_aggr_stop(sc, sta, tid); 3113 3108 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); 3109 + ath9k_ps_restore(sc); 3114 3110 break; 3115 3111 case IEEE80211_AMPDU_TX_OPERATIONAL: 3112 + ath9k_ps_wakeup(sc); 3116 3113 ath_tx_aggr_resume(sc, sta, tid); 3114 + ath9k_ps_restore(sc); 3117 3115 break; 3118 3116 default: 3119 3117 ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_FATAL,
+1 -1
drivers/net/wireless/ath/ath9k/pci.c
··· 96 96 pci_write_config_byte(pdev, ATH_PCIE_CAP_LINK_CTRL, aspm); 97 97 } 98 98 99 - const static struct ath_bus_ops ath_pci_bus_ops = { 99 + static const struct ath_bus_ops ath_pci_bus_ops = { 100 100 .read_cachesize = ath_pci_read_cachesize, 101 101 .cleanup = ath_pci_cleanup, 102 102 .eeprom_read = ath_pci_eeprom_read,
+1 -1
drivers/net/wireless/ath/ath9k/xmit.c
··· 2072 2072 &txq->axq_q, lastbf->list.prev); 2073 2073 2074 2074 txq->axq_depth--; 2075 - txok = !(ds->ds_txstat.ts_status & ATH9K_TXERR_FILT); 2075 + txok = !(ds->ds_txstat.ts_status & ATH9K_TXERR_MASK); 2076 2076 txq->axq_tx_inprogress = false; 2077 2077 spin_unlock_bh(&txq->axq_lock); 2078 2078
+44 -151
drivers/net/wireless/b43/dma.c
··· 383 383 } 384 384 } 385 385 386 - /* Check if a DMA region fits the device constraints. 387 - * Returns true, if the region is OK for usage with this device. */ 388 - static inline bool b43_dma_address_ok(struct b43_dmaring *ring, 389 - dma_addr_t addr, size_t size) 390 - { 391 - switch (ring->type) { 392 - case B43_DMA_30BIT: 393 - if ((u64)addr + size > (1ULL << 30)) 394 - return 0; 395 - break; 396 - case B43_DMA_32BIT: 397 - if ((u64)addr + size > (1ULL << 32)) 398 - return 0; 399 - break; 400 - case B43_DMA_64BIT: 401 - /* Currently we can't have addresses beyond 402 - * 64bit in the kernel. */ 403 - break; 404 - } 405 - return 1; 406 - } 407 - 408 - #define is_4k_aligned(addr) (((u64)(addr) & 0x0FFFull) == 0) 409 - #define is_8k_aligned(addr) (((u64)(addr) & 0x1FFFull) == 0) 410 - 411 - static void b43_unmap_and_free_ringmem(struct b43_dmaring *ring, void *base, 412 - dma_addr_t dmaaddr, size_t size) 413 - { 414 - ssb_dma_unmap_single(ring->dev->dev, dmaaddr, size, DMA_TO_DEVICE); 415 - free_pages((unsigned long)base, get_order(size)); 416 - } 417 - 418 - static void * __b43_get_and_map_ringmem(struct b43_dmaring *ring, 419 - dma_addr_t *dmaaddr, size_t size, 420 - gfp_t gfp_flags) 421 - { 422 - void *base; 423 - 424 - base = (void *)__get_free_pages(gfp_flags, get_order(size)); 425 - if (!base) 426 - return NULL; 427 - memset(base, 0, size); 428 - *dmaaddr = ssb_dma_map_single(ring->dev->dev, base, size, 429 - DMA_TO_DEVICE); 430 - if (ssb_dma_mapping_error(ring->dev->dev, *dmaaddr)) { 431 - free_pages((unsigned long)base, get_order(size)); 432 - return NULL; 433 - } 434 - 435 - return base; 436 - } 437 - 438 - static void * b43_get_and_map_ringmem(struct b43_dmaring *ring, 439 - dma_addr_t *dmaaddr, size_t size) 440 - { 441 - void *base; 442 - 443 - base = __b43_get_and_map_ringmem(ring, dmaaddr, size, 444 - GFP_KERNEL); 445 - if (!base) { 446 - b43err(ring->dev->wl, "Failed to allocate or map pages " 447 - "for DMA ringmemory\n"); 448 - return NULL; 449 - } 450 - if (!b43_dma_address_ok(ring, *dmaaddr, size)) { 451 - /* The memory does not fit our device constraints. 452 - * Retry with GFP_DMA set to get lower memory. */ 453 - b43_unmap_and_free_ringmem(ring, base, *dmaaddr, size); 454 - base = __b43_get_and_map_ringmem(ring, dmaaddr, size, 455 - GFP_KERNEL | GFP_DMA); 456 - if (!base) { 457 - b43err(ring->dev->wl, "Failed to allocate or map pages " 458 - "in the GFP_DMA region for DMA ringmemory\n"); 459 - return NULL; 460 - } 461 - if (!b43_dma_address_ok(ring, *dmaaddr, size)) { 462 - b43_unmap_and_free_ringmem(ring, base, *dmaaddr, size); 463 - b43err(ring->dev->wl, "Failed to allocate DMA " 464 - "ringmemory that fits device constraints\n"); 465 - return NULL; 466 - } 467 - } 468 - /* We expect the memory to be 4k aligned, at least. */ 469 - if (B43_WARN_ON(!is_4k_aligned(*dmaaddr))) { 470 - b43_unmap_and_free_ringmem(ring, base, *dmaaddr, size); 471 - return NULL; 472 - } 473 - 474 - return base; 475 - } 476 - 477 386 static int alloc_ringmemory(struct b43_dmaring *ring) 478 387 { 479 - unsigned int required; 480 - void *base; 481 - dma_addr_t dmaaddr; 388 + gfp_t flags = GFP_KERNEL; 482 389 483 - /* There are several requirements to the descriptor ring memory: 484 - * - The memory region needs to fit the address constraints for the 485 - * device (same as for frame buffers). 486 - * - For 30/32bit DMA devices, the descriptor ring must be 4k aligned. 487 - * - For 64bit DMA devices, the descriptor ring must be 8k aligned. 390 + /* The specs call for 4K buffers for 30- and 32-bit DMA with 4K 391 + * alignment and 8K buffers for 64-bit DMA with 8K alignment. Testing 392 + * has shown that 4K is sufficient for the latter as long as the buffer 393 + * does not cross an 8K boundary. 394 + * 395 + * For unknown reasons - possibly a hardware error - the BCM4311 rev 396 + * 02, which uses 64-bit DMA, needs the ring buffer in very low memory, 397 + * which accounts for the GFP_DMA flag below. 398 + * 399 + * The flags here must match the flags in free_ringmemory below! 488 400 */ 489 - 490 401 if (ring->type == B43_DMA_64BIT) 491 - required = ring->nr_slots * sizeof(struct b43_dmadesc64); 492 - else 493 - required = ring->nr_slots * sizeof(struct b43_dmadesc32); 494 - if (B43_WARN_ON(required > 0x1000)) 402 + flags |= GFP_DMA; 403 + ring->descbase = ssb_dma_alloc_consistent(ring->dev->dev, 404 + B43_DMA_RINGMEMSIZE, 405 + &(ring->dmabase), flags); 406 + if (!ring->descbase) { 407 + b43err(ring->dev->wl, "DMA ringmemory allocation failed\n"); 495 408 return -ENOMEM; 496 - 497 - ring->alloc_descsize = 0x1000; 498 - base = b43_get_and_map_ringmem(ring, &dmaaddr, ring->alloc_descsize); 499 - if (!base) 500 - return -ENOMEM; 501 - ring->alloc_descbase = base; 502 - ring->alloc_dmabase = dmaaddr; 503 - 504 - if ((ring->type != B43_DMA_64BIT) || is_8k_aligned(dmaaddr)) { 505 - /* We're on <=32bit DMA, or we already got 8k aligned memory. 506 - * That's all we need, so we're fine. */ 507 - ring->descbase = base; 508 - ring->dmabase = dmaaddr; 509 - return 0; 510 409 } 511 - b43_unmap_and_free_ringmem(ring, base, dmaaddr, ring->alloc_descsize); 512 - 513 - /* Ok, we failed at the 8k alignment requirement. 514 - * Try to force-align the memory region now. */ 515 - ring->alloc_descsize = 0x2000; 516 - base = b43_get_and_map_ringmem(ring, &dmaaddr, ring->alloc_descsize); 517 - if (!base) 518 - return -ENOMEM; 519 - ring->alloc_descbase = base; 520 - ring->alloc_dmabase = dmaaddr; 521 - 522 - if (is_8k_aligned(dmaaddr)) { 523 - /* We're already 8k aligned. That Ok, too. */ 524 - ring->descbase = base; 525 - ring->dmabase = dmaaddr; 526 - return 0; 527 - } 528 - /* Force-align it to 8k */ 529 - ring->descbase = (void *)((u8 *)base + 0x1000); 530 - ring->dmabase = dmaaddr + 0x1000; 531 - B43_WARN_ON(!is_8k_aligned(ring->dmabase)); 410 + memset(ring->descbase, 0, B43_DMA_RINGMEMSIZE); 532 411 533 412 return 0; 534 413 } 535 414 536 415 static void free_ringmemory(struct b43_dmaring *ring) 537 416 { 538 - b43_unmap_and_free_ringmem(ring, ring->alloc_descbase, 539 - ring->alloc_dmabase, ring->alloc_descsize); 417 + gfp_t flags = GFP_KERNEL; 418 + 419 + if (ring->type == B43_DMA_64BIT) 420 + flags |= GFP_DMA; 421 + 422 + ssb_dma_free_consistent(ring->dev->dev, B43_DMA_RINGMEMSIZE, 423 + ring->descbase, ring->dmabase, flags); 540 424 } 541 425 542 426 /* Reset the RX DMA channel */ ··· 530 646 if (unlikely(ssb_dma_mapping_error(ring->dev->dev, addr))) 531 647 return 1; 532 648 533 - if (!b43_dma_address_ok(ring, addr, buffersize)) { 534 - /* We can't support this address. Unmap it again. */ 535 - unmap_descbuffer(ring, addr, buffersize, dma_to_device); 536 - return 1; 649 + switch (ring->type) { 650 + case B43_DMA_30BIT: 651 + if ((u64)addr + buffersize > (1ULL << 30)) 652 + goto address_error; 653 + break; 654 + case B43_DMA_32BIT: 655 + if ((u64)addr + buffersize > (1ULL << 32)) 656 + goto address_error; 657 + break; 658 + case B43_DMA_64BIT: 659 + /* Currently we can't have addresses beyond 660 + * 64bit in the kernel. */ 661 + break; 537 662 } 538 663 539 664 /* The address is OK. */ 540 665 return 0; 666 + 667 + address_error: 668 + /* We can't support this address. Unmap it again. */ 669 + unmap_descbuffer(ring, addr, buffersize, dma_to_device); 670 + 671 + return 1; 541 672 } 542 673 543 674 static bool b43_rx_buffer_is_poisoned(struct b43_dmaring *ring, struct sk_buff *skb) ··· 614 715 meta->dmaaddr = dmaaddr; 615 716 ring->ops->fill_descriptor(ring, desc, dmaaddr, 616 717 ring->rx_buffersize, 0, 0, 0); 617 - ssb_dma_sync_single_for_device(ring->dev->dev, 618 - ring->alloc_dmabase, 619 - ring->alloc_descsize, DMA_TO_DEVICE); 620 718 621 719 return 0; 622 720 } ··· 1250 1354 } 1251 1355 /* Now transfer the whole frame. */ 1252 1356 wmb(); 1253 - ssb_dma_sync_single_for_device(ring->dev->dev, 1254 - ring->alloc_dmabase, 1255 - ring->alloc_descsize, DMA_TO_DEVICE); 1256 1357 ops->poke_tx(ring, next_slot(ring, slot)); 1257 1358 return 0; 1258 1359
+1 -6
drivers/net/wireless/b43/dma.h
··· 157 157 } __attribute__ ((__packed__)); 158 158 159 159 /* Misc DMA constants */ 160 + #define B43_DMA_RINGMEMSIZE PAGE_SIZE 160 161 #define B43_DMA0_RX_FRAMEOFFSET 30 161 162 162 163 /* DMA engine tuning knobs */ ··· 247 246 /* The QOS priority assigned to this ring. Only used for TX rings. 248 247 * This is the mac80211 "queue" value. */ 249 248 u8 queue_prio; 250 - /* Pointers and size of the originally allocated and mapped memory 251 - * region for the descriptor ring. */ 252 - void *alloc_descbase; 253 - dma_addr_t alloc_dmabase; 254 - unsigned int alloc_descsize; 255 - /* Pointer to our wireless device. */ 256 249 struct b43_wldev *dev; 257 250 #ifdef CONFIG_B43_DEBUG 258 251 /* Maximum number of used slots. */
+2 -8
drivers/net/wireless/iwlwifi/iwl-3945.c
··· 681 681 snr = rx_stats_sig_avg / rx_stats_noise_diff; 682 682 rx_status.noise = rx_status.signal - 683 683 iwl3945_calc_db_from_ratio(snr); 684 - rx_status.qual = iwl3945_calc_sig_qual(rx_status.signal, 685 - rx_status.noise); 686 - 687 - /* If noise info not available, calculate signal quality indicator (%) 688 - * using just the dBm signal level. */ 689 684 } else { 690 685 rx_status.noise = priv->last_rx_noise; 691 - rx_status.qual = iwl3945_calc_sig_qual(rx_status.signal, 0); 692 686 } 693 687 694 688 695 - IWL_DEBUG_STATS(priv, "Rssi %d noise %d qual %d sig_avg %d noise_diff %d\n", 696 - rx_status.signal, rx_status.noise, rx_status.qual, 689 + IWL_DEBUG_STATS(priv, "Rssi %d noise %d sig_avg %d noise_diff %d\n", 690 + rx_status.signal, rx_status.noise, 697 691 rx_stats_sig_avg, rx_stats_noise_diff); 698 692 699 693 header = (struct ieee80211_hdr *)IWL_RX_DATA(pkt);
-1
drivers/net/wireless/iwlwifi/iwl-3945.h
··· 222 222 * 223 223 *****************************************************************************/ 224 224 extern int iwl3945_calc_db_from_ratio(int sig_ratio); 225 - extern int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm); 226 225 extern void iwl3945_rx_replenish(void *data); 227 226 extern void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq); 228 227 extern unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv,
+1 -1
drivers/net/wireless/iwlwifi/iwl-agn-rs.c
··· 150 150 }; 151 151 152 152 /* mbps, mcs */ 153 - const static struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = { 153 + static const struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = { 154 154 { "1", "BPSK DSSS"}, 155 155 { "2", "QPSK DSSS"}, 156 156 {"5.5", "BPSK CCK"},
+2 -46
drivers/net/wireless/iwlwifi/iwl-rx.c
··· 650 650 } 651 651 EXPORT_SYMBOL(iwl_reply_statistics); 652 652 653 - #define PERFECT_RSSI (-20) /* dBm */ 654 - #define WORST_RSSI (-95) /* dBm */ 655 - #define RSSI_RANGE (PERFECT_RSSI - WORST_RSSI) 656 - 657 - /* Calculate an indication of rx signal quality (a percentage, not dBm!). 658 - * See http://www.ces.clemson.edu/linux/signal_quality.shtml for info 659 - * about formulas used below. */ 660 - static int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm) 661 - { 662 - int sig_qual; 663 - int degradation = PERFECT_RSSI - rssi_dbm; 664 - 665 - /* If we get a noise measurement, use signal-to-noise ratio (SNR) 666 - * as indicator; formula is (signal dbm - noise dbm). 667 - * SNR at or above 40 is a great signal (100%). 668 - * Below that, scale to fit SNR of 0 - 40 dB within 0 - 100% indicator. 669 - * Weakest usable signal is usually 10 - 15 dB SNR. */ 670 - if (noise_dbm) { 671 - if (rssi_dbm - noise_dbm >= 40) 672 - return 100; 673 - else if (rssi_dbm < noise_dbm) 674 - return 0; 675 - sig_qual = ((rssi_dbm - noise_dbm) * 5) / 2; 676 - 677 - /* Else use just the signal level. 678 - * This formula is a least squares fit of data points collected and 679 - * compared with a reference system that had a percentage (%) display 680 - * for signal quality. */ 681 - } else 682 - sig_qual = (100 * (RSSI_RANGE * RSSI_RANGE) - degradation * 683 - (15 * RSSI_RANGE + 62 * degradation)) / 684 - (RSSI_RANGE * RSSI_RANGE); 685 - 686 - if (sig_qual > 100) 687 - sig_qual = 100; 688 - else if (sig_qual < 1) 689 - sig_qual = 0; 690 - 691 - return sig_qual; 692 - } 693 - 694 653 /* Calc max signal level (dBm) among 3 possible receivers */ 695 654 static inline int iwl_calc_rssi(struct iwl_priv *priv, 696 655 struct iwl_rx_phy_res *rx_resp) ··· 1060 1101 if (iwl_is_associated(priv) && 1061 1102 !test_bit(STATUS_SCANNING, &priv->status)) { 1062 1103 rx_status.noise = priv->last_rx_noise; 1063 - rx_status.qual = iwl_calc_sig_qual(rx_status.signal, 1064 - rx_status.noise); 1065 1104 } else { 1066 1105 rx_status.noise = IWL_NOISE_MEAS_NOT_AVAILABLE; 1067 - rx_status.qual = iwl_calc_sig_qual(rx_status.signal, 0); 1068 1106 } 1069 1107 1070 1108 /* Reset beacon noise level if not associated. */ ··· 1074 1118 iwl_dbg_report_frame(priv, phy_res, len, header, 1); 1075 1119 #endif 1076 1120 iwl_dbg_log_rx_data_frame(priv, len, header); 1077 - IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, noise %d, qual %d, TSF %llu\n", 1078 - rx_status.signal, rx_status.noise, rx_status.qual, 1121 + IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, noise %d, TSF %llu\n", 1122 + rx_status.signal, rx_status.noise, 1079 1123 (unsigned long long)rx_status.mactime); 1080 1124 1081 1125 /*
-41
drivers/net/wireless/iwlwifi/iwl3945-base.c
··· 1299 1299 return (int)ratio2dB[sig_ratio]; 1300 1300 } 1301 1301 1302 - #define PERFECT_RSSI (-20) /* dBm */ 1303 - #define WORST_RSSI (-95) /* dBm */ 1304 - #define RSSI_RANGE (PERFECT_RSSI - WORST_RSSI) 1305 - 1306 - /* Calculate an indication of rx signal quality (a percentage, not dBm!). 1307 - * See http://www.ces.clemson.edu/linux/signal_quality.shtml for info 1308 - * about formulas used below. */ 1309 - int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm) 1310 - { 1311 - int sig_qual; 1312 - int degradation = PERFECT_RSSI - rssi_dbm; 1313 - 1314 - /* If we get a noise measurement, use signal-to-noise ratio (SNR) 1315 - * as indicator; formula is (signal dbm - noise dbm). 1316 - * SNR at or above 40 is a great signal (100%). 1317 - * Below that, scale to fit SNR of 0 - 40 dB within 0 - 100% indicator. 1318 - * Weakest usable signal is usually 10 - 15 dB SNR. */ 1319 - if (noise_dbm) { 1320 - if (rssi_dbm - noise_dbm >= 40) 1321 - return 100; 1322 - else if (rssi_dbm < noise_dbm) 1323 - return 0; 1324 - sig_qual = ((rssi_dbm - noise_dbm) * 5) / 2; 1325 - 1326 - /* Else use just the signal level. 1327 - * This formula is a least squares fit of data points collected and 1328 - * compared with a reference system that had a percentage (%) display 1329 - * for signal quality. */ 1330 - } else 1331 - sig_qual = (100 * (RSSI_RANGE * RSSI_RANGE) - degradation * 1332 - (15 * RSSI_RANGE + 62 * degradation)) / 1333 - (RSSI_RANGE * RSSI_RANGE); 1334 - 1335 - if (sig_qual > 100) 1336 - sig_qual = 100; 1337 - else if (sig_qual < 1) 1338 - sig_qual = 0; 1339 - 1340 - return sig_qual; 1341 - } 1342 - 1343 1302 /** 1344 1303 * iwl3945_rx_handle - Main entry function for receiving responses from uCode 1345 1304 *
+1 -1
drivers/net/wireless/iwmc3200wifi/iwm.h
··· 268 268 269 269 struct sk_buff_head rx_list; 270 270 struct list_head rx_tickets; 271 - struct list_head rx_packets[IWM_RX_ID_HASH]; 271 + struct list_head rx_packets[IWM_RX_ID_HASH + 1]; 272 272 struct workqueue_struct *rx_wq; 273 273 struct work_struct rx_worker; 274 274
+8 -14
drivers/net/wireless/libertas/scan.c
··· 567 567 chan_count = lbs_scan_create_channel_list(priv, chan_list); 568 568 569 569 netif_stop_queue(priv->dev); 570 - netif_carrier_off(priv->dev); 571 - if (priv->mesh_dev) { 570 + if (priv->mesh_dev) 572 571 netif_stop_queue(priv->mesh_dev); 573 - netif_carrier_off(priv->mesh_dev); 574 - } 575 572 576 573 /* Prepare to continue an interrupted scan */ 577 574 lbs_deb_scan("chan_count %d, scan_channel %d\n", ··· 632 635 priv->scan_channel = 0; 633 636 634 637 out: 635 - if (priv->connect_status == LBS_CONNECTED) { 636 - netif_carrier_on(priv->dev); 637 - if (!priv->tx_pending_len) 638 - netif_wake_queue(priv->dev); 639 - } 640 - if (priv->mesh_dev && (priv->mesh_connect_status == LBS_CONNECTED)) { 641 - netif_carrier_on(priv->mesh_dev); 642 - if (!priv->tx_pending_len) 643 - netif_wake_queue(priv->mesh_dev); 644 - } 638 + if (priv->connect_status == LBS_CONNECTED && !priv->tx_pending_len) 639 + netif_wake_queue(priv->dev); 640 + 641 + if (priv->mesh_dev && (priv->mesh_connect_status == LBS_CONNECTED) && 642 + !priv->tx_pending_len) 643 + netif_wake_queue(priv->mesh_dev); 644 + 645 645 kfree(chan_list); 646 646 647 647 lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
-1
drivers/net/wireless/libertas_tf/main.c
··· 495 495 stats.band = IEEE80211_BAND_2GHZ; 496 496 stats.signal = prxpd->snr; 497 497 stats.noise = prxpd->nf; 498 - stats.qual = prxpd->snr - prxpd->nf; 499 498 /* Marvell rate index has a hole at value 4 */ 500 499 if (prxpd->rx_rate > 4) 501 500 --prxpd->rx_rate;
+3 -3
drivers/net/wireless/orinoco/wext.c
··· 23 23 #define MAX_RID_LEN 1024 24 24 25 25 /* Helper routine to record keys 26 - * Do not call from interrupt context */ 26 + * It is called under orinoco_lock so it may not sleep */ 27 27 static int orinoco_set_key(struct orinoco_private *priv, int index, 28 28 enum orinoco_alg alg, const u8 *key, int key_len, 29 29 const u8 *seq, int seq_len) ··· 32 32 kzfree(priv->keys[index].seq); 33 33 34 34 if (key_len) { 35 - priv->keys[index].key = kzalloc(key_len, GFP_KERNEL); 35 + priv->keys[index].key = kzalloc(key_len, GFP_ATOMIC); 36 36 if (!priv->keys[index].key) 37 37 goto nomem; 38 38 } else 39 39 priv->keys[index].key = NULL; 40 40 41 41 if (seq_len) { 42 - priv->keys[index].seq = kzalloc(seq_len, GFP_KERNEL); 42 + priv->keys[index].seq = kzalloc(seq_len, GFP_ATOMIC); 43 43 if (!priv->keys[index].seq) 44 44 goto free_key; 45 45 } else
+1
drivers/net/wireless/rt2x00/rt2800usb.c
··· 922 922 { USB_DEVICE(0x1737, 0x0070), USB_DEVICE_DATA(&rt2800usb_ops) }, 923 923 { USB_DEVICE(0x1737, 0x0071), USB_DEVICE_DATA(&rt2800usb_ops) }, 924 924 { USB_DEVICE(0x1737, 0x0077), USB_DEVICE_DATA(&rt2800usb_ops) }, 925 + { USB_DEVICE(0x1737, 0x0079), USB_DEVICE_DATA(&rt2800usb_ops) }, 925 926 /* Logitec */ 926 927 { USB_DEVICE(0x0789, 0x0162), USB_DEVICE_DATA(&rt2800usb_ops) }, 927 928 { USB_DEVICE(0x0789, 0x0163), USB_DEVICE_DATA(&rt2800usb_ops) },
-1
drivers/net/wireless/rtl818x/rtl8180_dev.c
··· 132 132 133 133 rx_status.antenna = (flags2 >> 15) & 1; 134 134 /* TODO: improve signal/rssi reporting */ 135 - rx_status.qual = flags2 & 0xFF; 136 135 rx_status.signal = (flags2 >> 8) & 0x7F; 137 136 /* XXX: is this correct? */ 138 137 rx_status.rate_idx = (flags >> 20) & 0xF;
+1 -1
drivers/net/wireless/wl12xx/wl1251_boot.c
··· 256 256 } 257 257 } 258 258 259 - if (loop >= INIT_LOOP) { 259 + if (loop > INIT_LOOP) { 260 260 wl1251_error("timeout waiting for the hardware to " 261 261 "complete initialization"); 262 262 return -EIO;
+2 -2
drivers/net/wireless/wl12xx/wl1271_cmd.c
··· 777 777 return ret; 778 778 } 779 779 780 - static int wl1271_build_basic_rates(char *rates, u8 band) 780 + static int wl1271_build_basic_rates(u8 *rates, u8 band) 781 781 { 782 782 u8 index = 0; 783 783 ··· 804 804 return index; 805 805 } 806 806 807 - static int wl1271_build_extended_rates(char *rates, u8 band) 807 + static int wl1271_build_extended_rates(u8 *rates, u8 band) 808 808 { 809 809 u8 index = 0; 810 810
-140
drivers/net/wireless/zd1211rw/zd_chip.c
··· 1325 1325 return r; 1326 1326 } 1327 1327 1328 - static int ofdm_qual_db(u8 status_quality, u8 zd_rate, unsigned int size) 1329 - { 1330 - static const u16 constants[] = { 1331 - 715, 655, 585, 540, 470, 410, 360, 315, 1332 - 270, 235, 205, 175, 150, 125, 105, 85, 1333 - 65, 50, 40, 25, 15 1334 - }; 1335 - 1336 - int i; 1337 - u32 x; 1338 - 1339 - /* It seems that their quality parameter is somehow per signal 1340 - * and is now transferred per bit. 1341 - */ 1342 - switch (zd_rate) { 1343 - case ZD_OFDM_RATE_6M: 1344 - case ZD_OFDM_RATE_12M: 1345 - case ZD_OFDM_RATE_24M: 1346 - size *= 2; 1347 - break; 1348 - case ZD_OFDM_RATE_9M: 1349 - case ZD_OFDM_RATE_18M: 1350 - case ZD_OFDM_RATE_36M: 1351 - case ZD_OFDM_RATE_54M: 1352 - size *= 4; 1353 - size /= 3; 1354 - break; 1355 - case ZD_OFDM_RATE_48M: 1356 - size *= 3; 1357 - size /= 2; 1358 - break; 1359 - default: 1360 - return -EINVAL; 1361 - } 1362 - 1363 - x = (10000 * status_quality)/size; 1364 - for (i = 0; i < ARRAY_SIZE(constants); i++) { 1365 - if (x > constants[i]) 1366 - break; 1367 - } 1368 - 1369 - switch (zd_rate) { 1370 - case ZD_OFDM_RATE_6M: 1371 - case ZD_OFDM_RATE_9M: 1372 - i += 3; 1373 - break; 1374 - case ZD_OFDM_RATE_12M: 1375 - case ZD_OFDM_RATE_18M: 1376 - i += 5; 1377 - break; 1378 - case ZD_OFDM_RATE_24M: 1379 - case ZD_OFDM_RATE_36M: 1380 - i += 9; 1381 - break; 1382 - case ZD_OFDM_RATE_48M: 1383 - case ZD_OFDM_RATE_54M: 1384 - i += 15; 1385 - break; 1386 - default: 1387 - return -EINVAL; 1388 - } 1389 - 1390 - return i; 1391 - } 1392 - 1393 - static int ofdm_qual_percent(u8 status_quality, u8 zd_rate, unsigned int size) 1394 - { 1395 - int r; 1396 - 1397 - r = ofdm_qual_db(status_quality, zd_rate, size); 1398 - ZD_ASSERT(r >= 0); 1399 - if (r < 0) 1400 - r = 0; 1401 - 1402 - r = (r * 100)/29; 1403 - return r <= 100 ? r : 100; 1404 - } 1405 - 1406 - static unsigned int log10times100(unsigned int x) 1407 - { 1408 - static const u8 log10[] = { 1409 - 0, 1410 - 0, 30, 47, 60, 69, 77, 84, 90, 95, 100, 1411 - 104, 107, 111, 114, 117, 120, 123, 125, 127, 130, 1412 - 132, 134, 136, 138, 139, 141, 143, 144, 146, 147, 1413 - 149, 150, 151, 153, 154, 155, 156, 157, 159, 160, 1414 - 161, 162, 163, 164, 165, 166, 167, 168, 169, 169, 1415 - 170, 171, 172, 173, 174, 174, 175, 176, 177, 177, 1416 - 178, 179, 179, 180, 181, 181, 182, 183, 183, 184, 1417 - 185, 185, 186, 186, 187, 188, 188, 189, 189, 190, 1418 - 190, 191, 191, 192, 192, 193, 193, 194, 194, 195, 1419 - 195, 196, 196, 197, 197, 198, 198, 199, 199, 200, 1420 - 200, 200, 201, 201, 202, 202, 202, 203, 203, 204, 1421 - 204, 204, 205, 205, 206, 206, 206, 207, 207, 207, 1422 - 208, 208, 208, 209, 209, 210, 210, 210, 211, 211, 1423 - 211, 212, 212, 212, 213, 213, 213, 213, 214, 214, 1424 - 214, 215, 215, 215, 216, 216, 216, 217, 217, 217, 1425 - 217, 218, 218, 218, 219, 219, 219, 219, 220, 220, 1426 - 220, 220, 221, 221, 221, 222, 222, 222, 222, 223, 1427 - 223, 223, 223, 224, 224, 224, 224, 1428 - }; 1429 - 1430 - return x < ARRAY_SIZE(log10) ? log10[x] : 225; 1431 - } 1432 - 1433 - enum { 1434 - MAX_CCK_EVM_DB = 45, 1435 - }; 1436 - 1437 - static int cck_evm_db(u8 status_quality) 1438 - { 1439 - return (20 * log10times100(status_quality)) / 100; 1440 - } 1441 - 1442 - static int cck_snr_db(u8 status_quality) 1443 - { 1444 - int r = MAX_CCK_EVM_DB - cck_evm_db(status_quality); 1445 - ZD_ASSERT(r >= 0); 1446 - return r; 1447 - } 1448 - 1449 - static int cck_qual_percent(u8 status_quality) 1450 - { 1451 - int r; 1452 - 1453 - r = cck_snr_db(status_quality); 1454 - r = (100*r)/17; 1455 - return r <= 100 ? r : 100; 1456 - } 1457 - 1458 1328 static inline u8 zd_rate_from_ofdm_plcp_header(const void *rx_frame) 1459 1329 { 1460 1330 return ZD_OFDM | zd_ofdm_plcp_header_rate(rx_frame); 1461 - } 1462 - 1463 - u8 zd_rx_qual_percent(const void *rx_frame, unsigned int size, 1464 - const struct rx_status *status) 1465 - { 1466 - return (status->frame_status&ZD_RX_OFDM) ? 1467 - ofdm_qual_percent(status->signal_quality_ofdm, 1468 - zd_rate_from_ofdm_plcp_header(rx_frame), 1469 - size) : 1470 - cck_qual_percent(status->signal_quality_cck); 1471 1331 } 1472 1332 1473 1333 /**
-3
drivers/net/wireless/zd1211rw/zd_chip.h
··· 929 929 930 930 struct rx_status; 931 931 932 - u8 zd_rx_qual_percent(const void *rx_frame, unsigned int size, 933 - const struct rx_status *status); 934 - 935 932 u8 zd_rx_rate(const void *rx_frame, const struct rx_status *status); 936 933 937 934 struct zd_mc_hash {
-3
drivers/net/wireless/zd1211rw/zd_mac.c
··· 828 828 stats.freq = zd_channels[_zd_chip_get_channel(&mac->chip) - 1].center_freq; 829 829 stats.band = IEEE80211_BAND_2GHZ; 830 830 stats.signal = status->signal_strength; 831 - stats.qual = zd_rx_qual_percent(buffer, 832 - length - sizeof(struct rx_status), 833 - status); 834 831 835 832 rate = zd_rx_rate(buffer, status); 836 833
-2
include/net/mac80211.h
··· 547 547 * unspecified depending on the hardware capabilities flags 548 548 * @IEEE80211_HW_SIGNAL_* 549 549 * @noise: noise when receiving this frame, in dBm. 550 - * @qual: overall signal quality indication, in percent (0-100). 551 550 * @antenna: antenna used 552 551 * @rate_idx: index of data rate into band's supported rates or MCS index if 553 552 * HT rates are use (RX_FLAG_HT) ··· 558 559 int freq; 559 560 int signal; 560 561 int noise; 561 - int __deprecated qual; 562 562 int antenna; 563 563 int rate_idx; 564 564 int flag;
+4
net/mac80211/ibss.c
··· 382 382 struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, 383 383 u8 *bssid,u8 *addr, u32 supp_rates) 384 384 { 385 + struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; 385 386 struct ieee80211_local *local = sdata->local; 386 387 struct sta_info *sta; 387 388 int band = local->hw.conf.channel->band; ··· 397 396 sdata->dev->name, addr); 398 397 return NULL; 399 398 } 399 + 400 + if (ifibss->state == IEEE80211_IBSS_MLME_SEARCH) 401 + return NULL; 400 402 401 403 if (compare_ether_addr(bssid, sdata->u.ibss.bssid)) 402 404 return NULL;
+4
net/mac80211/tx.c
··· 1419 1419 if (!local->ps_sdata) 1420 1420 return false; 1421 1421 1422 + /* No point if we're going to suspend */ 1423 + if (local->quiescing) 1424 + return false; 1425 + 1422 1426 return true; 1423 1427 } 1424 1428
+12
net/mac80211/util.c
··· 1039 1039 1040 1040 /* restart hardware */ 1041 1041 if (local->open_count) { 1042 + /* 1043 + * Upon resume hardware can sometimes be goofy due to 1044 + * various platform / driver / bus issues, so restarting 1045 + * the device may at times not work immediately. Propagate 1046 + * the error. 1047 + */ 1042 1048 res = drv_start(local); 1049 + if (res) { 1050 + WARN(local->suspended, "Harware became unavailable " 1051 + "upon resume. This is could be a software issue" 1052 + "prior to suspend or a harware issue\n"); 1053 + return res; 1054 + } 1043 1055 1044 1056 ieee80211_led_radio(local, true); 1045 1057 }
+12 -1
net/wireless/mlme.c
··· 93 93 } 94 94 } 95 95 96 - WARN_ON(!bss); 96 + /* 97 + * We might be coming here because the driver reported 98 + * a successful association at the same time as the 99 + * user requested a deauth. In that case, we will have 100 + * removed the BSS from the auth_bsses list due to the 101 + * deauth request when the assoc response makes it. If 102 + * the two code paths acquire the lock the other way 103 + * around, that's just the standard situation of a 104 + * deauth being requested while connected. 105 + */ 106 + if (!bss) 107 + goto out; 97 108 } else if (wdev->conn) { 98 109 cfg80211_sme_failed_assoc(wdev); 99 110 /*
+9 -4
net/wireless/scan.c
··· 601 601 struct cfg80211_registered_device *rdev; 602 602 struct wiphy *wiphy; 603 603 struct iw_scan_req *wreq = NULL; 604 - struct cfg80211_scan_request *creq; 604 + struct cfg80211_scan_request *creq = NULL; 605 605 int i, err, n_channels = 0; 606 606 enum ieee80211_band band; 607 607 ··· 694 694 /* translate "Scan for SSID" request */ 695 695 if (wreq) { 696 696 if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { 697 - if (wreq->essid_len > IEEE80211_MAX_SSID_LEN) 698 - return -EINVAL; 697 + if (wreq->essid_len > IEEE80211_MAX_SSID_LEN) { 698 + err = -EINVAL; 699 + goto out; 700 + } 699 701 memcpy(creq->ssids[0].ssid, wreq->essid, wreq->essid_len); 700 702 creq->ssids[0].ssid_len = wreq->essid_len; 701 703 } ··· 709 707 err = rdev->ops->scan(wiphy, dev, creq); 710 708 if (err) { 711 709 rdev->scan_req = NULL; 712 - kfree(creq); 710 + /* creq will be freed below */ 713 711 } else { 714 712 nl80211_send_scan_start(rdev, dev); 713 + /* creq now owned by driver */ 714 + creq = NULL; 715 715 dev_hold(dev); 716 716 } 717 717 out: 718 + kfree(creq); 718 719 cfg80211_unlock_rdev(rdev); 719 720 return err; 720 721 }