diff options
Diffstat (limited to 'drivers/net/wireless')
43 files changed, 210 insertions, 551 deletions
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index a4c086f069b1..e63b7c40d0ee 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
@@ -1903,17 +1903,6 @@ accept: | |||
1903 | rxs->noise = sc->ah->ah_noise_floor; | 1903 | rxs->noise = sc->ah->ah_noise_floor; |
1904 | rxs->signal = rxs->noise + rs.rs_rssi; | 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 | rxs->antenna = rs.rs_antenna; | 1906 | rxs->antenna = rs.rs_antenna; |
1918 | rxs->rate_idx = ath5k_hw_to_driver_rix(sc, rs.rs_rate); | 1907 | rxs->rate_idx = ath5k_hw_to_driver_rix(sc, rs.rs_rate); |
1919 | rxs->flag |= ath5k_rx_decrypted(sc, ds, skb, &rs); | 1908 | rxs->flag |= ath5k_rx_decrypted(sc, ds, skb, &rs); |
@@ -2381,6 +2370,9 @@ ath5k_init(struct ath5k_softc *sc) | |||
2381 | */ | 2370 | */ |
2382 | ath5k_stop_locked(sc); | 2371 | ath5k_stop_locked(sc); |
2383 | 2372 | ||
2373 | /* Set PHY calibration interval */ | ||
2374 | ah->ah_cal_intval = ath5k_calinterval; | ||
2375 | |||
2384 | /* | 2376 | /* |
2385 | * The basic interface to setting the hardware in a good | 2377 | * The basic interface to setting the hardware in a good |
2386 | * state is ``reset''. On return the hardware is known to | 2378 | * state is ``reset''. On return the hardware is known to |
@@ -2408,10 +2400,6 @@ ath5k_init(struct ath5k_softc *sc) | |||
2408 | 2400 | ||
2409 | /* Set ack to be sent at low bit-rates */ | 2401 | /* Set ack to be sent at low bit-rates */ |
2410 | ath5k_hw_set_ack_bitrate_high(ah, false); | 2402 | ath5k_hw_set_ack_bitrate_high(ah, false); |
2411 | |||
2412 | /* Set PHY calibration inteval */ | ||
2413 | ah->ah_cal_intval = ath5k_calinterval; | ||
2414 | |||
2415 | ret = 0; | 2403 | ret = 0; |
2416 | done: | 2404 | done: |
2417 | mmiowb(); | 2405 | mmiowb(); |
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c index 71b84d91dcff..efc420cd42bf 100644 --- a/drivers/net/wireless/ath/ath9k/mac.c +++ b/drivers/net/wireless/ath/ath9k/mac.c | |||
@@ -186,7 +186,7 @@ bool ath9k_hw_stoptxdma(struct ath_hw *ah, u32 q) | |||
186 | wait = wait_time; | 186 | wait = wait_time; |
187 | while (ath9k_hw_numtxpending(ah, q)) { | 187 | while (ath9k_hw_numtxpending(ah, q)) { |
188 | if ((--wait) == 0) { | 188 | if ((--wait) == 0) { |
189 | ath_print(common, ATH_DBG_QUEUE, | 189 | ath_print(common, ATH_DBG_FATAL, |
190 | "Failed to stop TX DMA in 100 " | 190 | "Failed to stop TX DMA in 100 " |
191 | "msec after killing last frame\n"); | 191 | "msec after killing last frame\n"); |
192 | break; | 192 | break; |
diff --git a/drivers/net/wireless/ath/ath9k/mac.h b/drivers/net/wireless/ath/ath9k/mac.h index 0c87771383f0..e185479e295e 100644 --- a/drivers/net/wireless/ath/ath9k/mac.h +++ b/drivers/net/wireless/ath/ath9k/mac.h | |||
@@ -77,6 +77,9 @@ | |||
77 | #define ATH9K_TXERR_XTXOP 0x08 | 77 | #define ATH9K_TXERR_XTXOP 0x08 |
78 | #define ATH9K_TXERR_TIMER_EXPIRED 0x10 | 78 | #define ATH9K_TXERR_TIMER_EXPIRED 0x10 |
79 | #define ATH9K_TX_ACKED 0x20 | 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 | #define ATH9K_TX_BA 0x01 | 84 | #define ATH9K_TX_BA 0x01 |
82 | #define ATH9K_TX_PWRMGMT 0x02 | 85 | #define ATH9K_TX_PWRMGMT 0x02 |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index c48743452515..996eb90263cc 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -1973,6 +1973,9 @@ int ath_reset(struct ath_softc *sc, bool retry_tx) | |||
1973 | struct ieee80211_hw *hw = sc->hw; | 1973 | struct ieee80211_hw *hw = sc->hw; |
1974 | int r; | 1974 | int r; |
1975 | 1975 | ||
1976 | /* Stop ANI */ | ||
1977 | del_timer_sync(&common->ani.timer); | ||
1978 | |||
1976 | ath9k_hw_set_interrupts(ah, 0); | 1979 | ath9k_hw_set_interrupts(ah, 0); |
1977 | ath_drain_all_txq(sc, retry_tx); | 1980 | ath_drain_all_txq(sc, retry_tx); |
1978 | ath_stoprecv(sc); | 1981 | ath_stoprecv(sc); |
@@ -2014,6 +2017,9 @@ int ath_reset(struct ath_softc *sc, bool retry_tx) | |||
2014 | } | 2017 | } |
2015 | } | 2018 | } |
2016 | 2019 | ||
2020 | /* Start ANI */ | ||
2021 | ath_start_ani(common); | ||
2022 | |||
2017 | return r; | 2023 | return r; |
2018 | } | 2024 | } |
2019 | 2025 | ||
@@ -2508,6 +2514,9 @@ static void ath9k_stop(struct ieee80211_hw *hw) | |||
2508 | return; /* another wiphy still in use */ | 2514 | return; /* another wiphy still in use */ |
2509 | } | 2515 | } |
2510 | 2516 | ||
2517 | /* Ensure HW is awake when we try to shut it down. */ | ||
2518 | ath9k_ps_wakeup(sc); | ||
2519 | |||
2511 | if (ah->btcoex_hw.enabled) { | 2520 | if (ah->btcoex_hw.enabled) { |
2512 | ath9k_hw_btcoex_disable(ah); | 2521 | ath9k_hw_btcoex_disable(ah); |
2513 | if (ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE) | 2522 | if (ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE) |
@@ -2528,6 +2537,9 @@ static void ath9k_stop(struct ieee80211_hw *hw) | |||
2528 | /* disable HAL and put h/w to sleep */ | 2537 | /* disable HAL and put h/w to sleep */ |
2529 | ath9k_hw_disable(ah); | 2538 | ath9k_hw_disable(ah); |
2530 | ath9k_hw_configpcipowersave(ah, 1, 1); | 2539 | ath9k_hw_configpcipowersave(ah, 1, 1); |
2540 | ath9k_ps_restore(sc); | ||
2541 | |||
2542 | /* Finally, put the chip in FULL SLEEP mode */ | ||
2531 | ath9k_setpower(sc, ATH9K_PM_FULL_SLEEP); | 2543 | ath9k_setpower(sc, ATH9K_PM_FULL_SLEEP); |
2532 | 2544 | ||
2533 | sc->sc_flags |= SC_OP_INVALID; | 2545 | sc->sc_flags |= SC_OP_INVALID; |
@@ -2641,8 +2653,10 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw, | |||
2641 | if ((sc->sc_ah->opmode == NL80211_IFTYPE_AP) || | 2653 | if ((sc->sc_ah->opmode == NL80211_IFTYPE_AP) || |
2642 | (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) || | 2654 | (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) || |
2643 | (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT)) { | 2655 | (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT)) { |
2656 | ath9k_ps_wakeup(sc); | ||
2644 | ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq); | 2657 | ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq); |
2645 | ath_beacon_return(sc, avp); | 2658 | ath_beacon_return(sc, avp); |
2659 | ath9k_ps_restore(sc); | ||
2646 | } | 2660 | } |
2647 | 2661 | ||
2648 | sc->sc_flags &= ~SC_OP_BEACONS; | 2662 | sc->sc_flags &= ~SC_OP_BEACONS; |
@@ -3091,15 +3105,21 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw, | |||
3091 | case IEEE80211_AMPDU_RX_STOP: | 3105 | case IEEE80211_AMPDU_RX_STOP: |
3092 | break; | 3106 | break; |
3093 | case IEEE80211_AMPDU_TX_START: | 3107 | case IEEE80211_AMPDU_TX_START: |
3108 | ath9k_ps_wakeup(sc); | ||
3094 | ath_tx_aggr_start(sc, sta, tid, ssn); | 3109 | ath_tx_aggr_start(sc, sta, tid, ssn); |
3095 | ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); | 3110 | ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); |
3111 | ath9k_ps_restore(sc); | ||
3096 | break; | 3112 | break; |
3097 | case IEEE80211_AMPDU_TX_STOP: | 3113 | case IEEE80211_AMPDU_TX_STOP: |
3114 | ath9k_ps_wakeup(sc); | ||
3098 | ath_tx_aggr_stop(sc, sta, tid); | 3115 | ath_tx_aggr_stop(sc, sta, tid); |
3099 | ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); | 3116 | ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); |
3117 | ath9k_ps_restore(sc); | ||
3100 | break; | 3118 | break; |
3101 | case IEEE80211_AMPDU_TX_OPERATIONAL: | 3119 | case IEEE80211_AMPDU_TX_OPERATIONAL: |
3120 | ath9k_ps_wakeup(sc); | ||
3102 | ath_tx_aggr_resume(sc, sta, tid); | 3121 | ath_tx_aggr_resume(sc, sta, tid); |
3122 | ath9k_ps_restore(sc); | ||
3103 | break; | 3123 | break; |
3104 | default: | 3124 | default: |
3105 | ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_FATAL, | 3125 | ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_FATAL, |
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c index 5321f735e5a0..f7af5ea54753 100644 --- a/drivers/net/wireless/ath/ath9k/pci.c +++ b/drivers/net/wireless/ath/ath9k/pci.c | |||
@@ -96,7 +96,7 @@ static void ath_pci_bt_coex_prep(struct ath_common *common) | |||
96 | pci_write_config_byte(pdev, ATH_PCIE_CAP_LINK_CTRL, aspm); | 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 | .read_cachesize = ath_pci_read_cachesize, | 100 | .read_cachesize = ath_pci_read_cachesize, |
101 | .cleanup = ath_pci_cleanup, | 101 | .cleanup = ath_pci_cleanup, |
102 | .eeprom_read = ath_pci_eeprom_read, | 102 | .eeprom_read = ath_pci_eeprom_read, |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 2a11cc57ceea..fa12b9060b0b 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -1108,11 +1108,11 @@ void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx) | |||
1108 | if (npend) { | 1108 | if (npend) { |
1109 | int r; | 1109 | int r; |
1110 | 1110 | ||
1111 | ath_print(common, ATH_DBG_XMIT, | 1111 | ath_print(common, ATH_DBG_FATAL, |
1112 | "Unable to stop TxDMA. Reset HAL!\n"); | 1112 | "Unable to stop TxDMA. Reset HAL!\n"); |
1113 | 1113 | ||
1114 | spin_lock_bh(&sc->sc_resetlock); | 1114 | spin_lock_bh(&sc->sc_resetlock); |
1115 | r = ath9k_hw_reset(ah, sc->sc_ah->curchan, true); | 1115 | r = ath9k_hw_reset(ah, sc->sc_ah->curchan, false); |
1116 | if (r) | 1116 | if (r) |
1117 | ath_print(common, ATH_DBG_FATAL, | 1117 | ath_print(common, ATH_DBG_FATAL, |
1118 | "Unable to reset hardware; reset status %d\n", | 1118 | "Unable to reset hardware; reset status %d\n", |
@@ -1414,17 +1414,9 @@ static void assign_aggr_tid_seqno(struct sk_buff *skb, | |||
1414 | * For HT capable stations, we save tidno for later use. | 1414 | * For HT capable stations, we save tidno for later use. |
1415 | * We also override seqno set by upper layer with the one | 1415 | * We also override seqno set by upper layer with the one |
1416 | * in tx aggregation state. | 1416 | * in tx aggregation state. |
1417 | * | ||
1418 | * If fragmentation is on, the sequence number is | ||
1419 | * not overridden, since it has been | ||
1420 | * incremented by the fragmentation routine. | ||
1421 | * | ||
1422 | * FIXME: check if the fragmentation threshold exceeds | ||
1423 | * IEEE80211 max. | ||
1424 | */ | 1417 | */ |
1425 | tid = ATH_AN_2_TID(an, bf->bf_tidno); | 1418 | tid = ATH_AN_2_TID(an, bf->bf_tidno); |
1426 | hdr->seq_ctrl = cpu_to_le16(tid->seq_next << | 1419 | hdr->seq_ctrl = cpu_to_le16(tid->seq_next << IEEE80211_SEQ_SEQ_SHIFT); |
1427 | IEEE80211_SEQ_SEQ_SHIFT); | ||
1428 | bf->bf_seqno = tid->seq_next; | 1420 | bf->bf_seqno = tid->seq_next; |
1429 | INCR(tid->seq_next, IEEE80211_SEQ_MAX); | 1421 | INCR(tid->seq_next, IEEE80211_SEQ_MAX); |
1430 | } | 1422 | } |
@@ -1636,7 +1628,8 @@ static int ath_tx_setup_buffer(struct ieee80211_hw *hw, struct ath_buf *bf, | |||
1636 | bf->bf_keyix = ATH9K_TXKEYIX_INVALID; | 1628 | bf->bf_keyix = ATH9K_TXKEYIX_INVALID; |
1637 | } | 1629 | } |
1638 | 1630 | ||
1639 | if (ieee80211_is_data_qos(fc) && (sc->sc_flags & SC_OP_TXAGGR)) | 1631 | if (ieee80211_is_data_qos(fc) && bf_isht(bf) && |
1632 | (sc->sc_flags & SC_OP_TXAGGR)) | ||
1640 | assign_aggr_tid_seqno(skb, bf); | 1633 | assign_aggr_tid_seqno(skb, bf); |
1641 | 1634 | ||
1642 | bf->bf_mpdu = skb; | 1635 | bf->bf_mpdu = skb; |
@@ -1780,7 +1773,8 @@ void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1780 | struct ath_wiphy *aphy = hw->priv; | 1773 | struct ath_wiphy *aphy = hw->priv; |
1781 | struct ath_softc *sc = aphy->sc; | 1774 | struct ath_softc *sc = aphy->sc; |
1782 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 1775 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
1783 | int hdrlen, padsize; | 1776 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
1777 | int padpos, padsize; | ||
1784 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 1778 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
1785 | struct ath_tx_control txctl; | 1779 | struct ath_tx_control txctl; |
1786 | 1780 | ||
@@ -1792,7 +1786,6 @@ void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1792 | * BSSes. | 1786 | * BSSes. |
1793 | */ | 1787 | */ |
1794 | if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { | 1788 | if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { |
1795 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | ||
1796 | if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) | 1789 | if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) |
1797 | sc->tx.seq_no += 0x10; | 1790 | sc->tx.seq_no += 0x10; |
1798 | hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); | 1791 | hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); |
@@ -1800,9 +1793,9 @@ void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1800 | } | 1793 | } |
1801 | 1794 | ||
1802 | /* Add the padding after the header if this is not already done */ | 1795 | /* Add the padding after the header if this is not already done */ |
1803 | hdrlen = ieee80211_get_hdrlen_from_skb(skb); | 1796 | padpos = ath9k_cmn_padpos(hdr->frame_control); |
1804 | if (hdrlen & 3) { | 1797 | padsize = padpos & 3; |
1805 | padsize = hdrlen % 4; | 1798 | if (padsize && skb->len>padpos) { |
1806 | if (skb_headroom(skb) < padsize) { | 1799 | if (skb_headroom(skb) < padsize) { |
1807 | ath_print(common, ATH_DBG_XMIT, | 1800 | ath_print(common, ATH_DBG_XMIT, |
1808 | "TX CABQ padding failed\n"); | 1801 | "TX CABQ padding failed\n"); |
@@ -1810,7 +1803,7 @@ void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1810 | return; | 1803 | return; |
1811 | } | 1804 | } |
1812 | skb_push(skb, padsize); | 1805 | skb_push(skb, padsize); |
1813 | memmove(skb->data, skb->data + padsize, hdrlen); | 1806 | memmove(skb->data, skb->data + padsize, padpos); |
1814 | } | 1807 | } |
1815 | 1808 | ||
1816 | txctl.txq = sc->beacon.cabq; | 1809 | txctl.txq = sc->beacon.cabq; |
@@ -1838,7 +1831,8 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, | |||
1838 | struct ieee80211_hw *hw = sc->hw; | 1831 | struct ieee80211_hw *hw = sc->hw; |
1839 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | 1832 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); |
1840 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 1833 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
1841 | int hdrlen, padsize; | 1834 | struct ieee80211_hdr * hdr = (struct ieee80211_hdr *)skb->data; |
1835 | int padpos, padsize; | ||
1842 | 1836 | ||
1843 | ath_print(common, ATH_DBG_XMIT, "TX complete: skb: %p\n", skb); | 1837 | ath_print(common, ATH_DBG_XMIT, "TX complete: skb: %p\n", skb); |
1844 | 1838 | ||
@@ -1853,14 +1847,14 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, | |||
1853 | tx_info->flags |= IEEE80211_TX_STAT_ACK; | 1847 | tx_info->flags |= IEEE80211_TX_STAT_ACK; |
1854 | } | 1848 | } |
1855 | 1849 | ||
1856 | hdrlen = ieee80211_get_hdrlen_from_skb(skb); | 1850 | padpos = ath9k_cmn_padpos(hdr->frame_control); |
1857 | padsize = hdrlen & 3; | 1851 | padsize = padpos & 3; |
1858 | if (padsize && hdrlen >= 24) { | 1852 | if (padsize && skb->len>padpos+padsize) { |
1859 | /* | 1853 | /* |
1860 | * Remove MAC header padding before giving the frame back to | 1854 | * Remove MAC header padding before giving the frame back to |
1861 | * mac80211. | 1855 | * mac80211. |
1862 | */ | 1856 | */ |
1863 | memmove(skb->data + padsize, skb->data, hdrlen); | 1857 | memmove(skb->data + padsize, skb->data, padpos); |
1864 | skb_pull(skb, padsize); | 1858 | skb_pull(skb, padsize); |
1865 | } | 1859 | } |
1866 | 1860 | ||
@@ -2078,7 +2072,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) | |||
2078 | &txq->axq_q, lastbf->list.prev); | 2072 | &txq->axq_q, lastbf->list.prev); |
2079 | 2073 | ||
2080 | txq->axq_depth--; | 2074 | txq->axq_depth--; |
2081 | txok = !(ds->ds_txstat.ts_status & ATH9K_TXERR_FILT); | 2075 | txok = !(ds->ds_txstat.ts_status & ATH9K_TXERR_MASK); |
2082 | txq->axq_tx_inprogress = false; | 2076 | txq->axq_tx_inprogress = false; |
2083 | spin_unlock_bh(&txq->axq_lock); | 2077 | spin_unlock_bh(&txq->axq_lock); |
2084 | 2078 | ||
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c index 027be275e035..88d1fd02d40a 100644 --- a/drivers/net/wireless/b43/dma.c +++ b/drivers/net/wireless/b43/dma.c | |||
@@ -383,160 +383,44 @@ static inline | |||
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 | static int alloc_ringmemory(struct b43_dmaring *ring) | 386 | static int alloc_ringmemory(struct b43_dmaring *ring) |
478 | { | 387 | { |
479 | unsigned int required; | 388 | gfp_t flags = GFP_KERNEL; |
480 | void *base; | 389 | |
481 | dma_addr_t dmaaddr; | 390 | /* The specs call for 4K buffers for 30- and 32-bit DMA with 4K |
482 | 391 | * alignment and 8K buffers for 64-bit DMA with 8K alignment. Testing | |
483 | /* There are several requirements to the descriptor ring memory: | 392 | * has shown that 4K is sufficient for the latter as long as the buffer |
484 | * - The memory region needs to fit the address constraints for the | 393 | * does not cross an 8K boundary. |
485 | * device (same as for frame buffers). | 394 | * |
486 | * - For 30/32bit DMA devices, the descriptor ring must be 4k aligned. | 395 | * For unknown reasons - possibly a hardware error - the BCM4311 rev |
487 | * - For 64bit DMA devices, the descriptor ring must be 8k aligned. | 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 | if (ring->type == B43_DMA_64BIT) | 401 | if (ring->type == B43_DMA_64BIT) |
491 | required = ring->nr_slots * sizeof(struct b43_dmadesc64); | 402 | flags |= GFP_DMA; |
492 | else | 403 | ring->descbase = ssb_dma_alloc_consistent(ring->dev->dev, |
493 | required = ring->nr_slots * sizeof(struct b43_dmadesc32); | 404 | B43_DMA_RINGMEMSIZE, |
494 | if (B43_WARN_ON(required > 0x1000)) | 405 | &(ring->dmabase), flags); |
406 | if (!ring->descbase) { | ||
407 | b43err(ring->dev->wl, "DMA ringmemory allocation failed\n"); | ||
495 | return -ENOMEM; | 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 | } | ||
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 | } | 409 | } |
528 | /* Force-align it to 8k */ | 410 | memset(ring->descbase, 0, B43_DMA_RINGMEMSIZE); |
529 | ring->descbase = (void *)((u8 *)base + 0x1000); | ||
530 | ring->dmabase = dmaaddr + 0x1000; | ||
531 | B43_WARN_ON(!is_8k_aligned(ring->dmabase)); | ||
532 | 411 | ||
533 | return 0; | 412 | return 0; |
534 | } | 413 | } |
535 | 414 | ||
536 | static void free_ringmemory(struct b43_dmaring *ring) | 415 | static void free_ringmemory(struct b43_dmaring *ring) |
537 | { | 416 | { |
538 | b43_unmap_and_free_ringmem(ring, ring->alloc_descbase, | 417 | gfp_t flags = GFP_KERNEL; |
539 | ring->alloc_dmabase, ring->alloc_descsize); | 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 | /* Reset the RX DMA channel */ | 426 | /* Reset the RX DMA channel */ |
@@ -646,14 +530,29 @@ static bool b43_dma_mapping_error(struct b43_dmaring *ring, | |||
646 | if (unlikely(ssb_dma_mapping_error(ring->dev->dev, addr))) | 530 | if (unlikely(ssb_dma_mapping_error(ring->dev->dev, addr))) |
647 | return 1; | 531 | return 1; |
648 | 532 | ||
649 | if (!b43_dma_address_ok(ring, addr, buffersize)) { | 533 | switch (ring->type) { |
650 | /* We can't support this address. Unmap it again. */ | 534 | case B43_DMA_30BIT: |
651 | unmap_descbuffer(ring, addr, buffersize, dma_to_device); | 535 | if ((u64)addr + buffersize > (1ULL << 30)) |
652 | return 1; | 536 | goto address_error; |
537 | break; | ||
538 | case B43_DMA_32BIT: | ||
539 | if ((u64)addr + buffersize > (1ULL << 32)) | ||
540 | goto address_error; | ||
541 | break; | ||
542 | case B43_DMA_64BIT: | ||
543 | /* Currently we can't have addresses beyond | ||
544 | * 64bit in the kernel. */ | ||
545 | break; | ||
653 | } | 546 | } |
654 | 547 | ||
655 | /* The address is OK. */ | 548 | /* The address is OK. */ |
656 | return 0; | 549 | return 0; |
550 | |||
551 | address_error: | ||
552 | /* We can't support this address. Unmap it again. */ | ||
553 | unmap_descbuffer(ring, addr, buffersize, dma_to_device); | ||
554 | |||
555 | return 1; | ||
657 | } | 556 | } |
658 | 557 | ||
659 | static bool b43_rx_buffer_is_poisoned(struct b43_dmaring *ring, struct sk_buff *skb) | 558 | static bool b43_rx_buffer_is_poisoned(struct b43_dmaring *ring, struct sk_buff *skb) |
@@ -715,9 +614,6 @@ static int setup_rx_descbuffer(struct b43_dmaring *ring, | |||
715 | meta->dmaaddr = dmaaddr; | 614 | meta->dmaaddr = dmaaddr; |
716 | ring->ops->fill_descriptor(ring, desc, dmaaddr, | 615 | ring->ops->fill_descriptor(ring, desc, dmaaddr, |
717 | ring->rx_buffersize, 0, 0, 0); | 616 | ring->rx_buffersize, 0, 0, 0); |
718 | ssb_dma_sync_single_for_device(ring->dev->dev, | ||
719 | ring->alloc_dmabase, | ||
720 | ring->alloc_descsize, DMA_TO_DEVICE); | ||
721 | 617 | ||
722 | return 0; | 618 | return 0; |
723 | } | 619 | } |
@@ -1354,9 +1250,6 @@ static int dma_tx_fragment(struct b43_dmaring *ring, | |||
1354 | } | 1250 | } |
1355 | /* Now transfer the whole frame. */ | 1251 | /* Now transfer the whole frame. */ |
1356 | wmb(); | 1252 | wmb(); |
1357 | ssb_dma_sync_single_for_device(ring->dev->dev, | ||
1358 | ring->alloc_dmabase, | ||
1359 | ring->alloc_descsize, DMA_TO_DEVICE); | ||
1360 | ops->poke_tx(ring, next_slot(ring, slot)); | 1253 | ops->poke_tx(ring, next_slot(ring, slot)); |
1361 | return 0; | 1254 | return 0; |
1362 | 1255 | ||
diff --git a/drivers/net/wireless/b43/dma.h b/drivers/net/wireless/b43/dma.h index e607b392314c..f7ab37c4cdbc 100644 --- a/drivers/net/wireless/b43/dma.h +++ b/drivers/net/wireless/b43/dma.h | |||
@@ -157,6 +157,7 @@ struct b43_dmadesc_generic { | |||
157 | } __attribute__ ((__packed__)); | 157 | } __attribute__ ((__packed__)); |
158 | 158 | ||
159 | /* Misc DMA constants */ | 159 | /* Misc DMA constants */ |
160 | #define B43_DMA_RINGMEMSIZE PAGE_SIZE | ||
160 | #define B43_DMA0_RX_FRAMEOFFSET 30 | 161 | #define B43_DMA0_RX_FRAMEOFFSET 30 |
161 | 162 | ||
162 | /* DMA engine tuning knobs */ | 163 | /* DMA engine tuning knobs */ |
@@ -246,12 +247,6 @@ struct b43_dmaring { | |||
246 | /* The QOS priority assigned to this ring. Only used for TX rings. | 247 | /* The QOS priority assigned to this ring. Only used for TX rings. |
247 | * This is the mac80211 "queue" value. */ | 248 | * This is the mac80211 "queue" value. */ |
248 | u8 queue_prio; | 249 | u8 queue_prio; |
249 | /* Pointers and size of the originally allocated and mapped memory | ||
250 | * region for the descriptor ring. */ | ||
251 | void *alloc_descbase; | ||
252 | dma_addr_t alloc_dmabase; | ||
253 | unsigned int alloc_descsize; | ||
254 | /* Pointer to our wireless device. */ | ||
255 | struct b43_wldev *dev; | 250 | struct b43_wldev *dev; |
256 | #ifdef CONFIG_B43_DEBUG | 251 | #ifdef CONFIG_B43_DEBUG |
257 | /* Maximum number of used slots. */ | 252 | /* Maximum number of used slots. */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 7da1dab933d9..234891d8cc10 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -681,19 +681,13 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv, | |||
681 | snr = rx_stats_sig_avg / rx_stats_noise_diff; | 681 | snr = rx_stats_sig_avg / rx_stats_noise_diff; |
682 | rx_status.noise = rx_status.signal - | 682 | rx_status.noise = rx_status.signal - |
683 | iwl3945_calc_db_from_ratio(snr); | 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 | } else { | 684 | } else { |
690 | rx_status.noise = priv->last_rx_noise; | 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", | 689 | IWL_DEBUG_STATS(priv, "Rssi %d noise %d sig_avg %d noise_diff %d\n", |
696 | rx_status.signal, rx_status.noise, rx_status.qual, | 690 | rx_status.signal, rx_status.noise, |
697 | rx_stats_sig_avg, rx_stats_noise_diff); | 691 | rx_stats_sig_avg, rx_stats_noise_diff); |
698 | 692 | ||
699 | header = (struct ieee80211_hdr *)IWL_RX_DATA(pkt); | 693 | header = (struct ieee80211_hdr *)IWL_RX_DATA(pkt); |
@@ -1835,8 +1829,7 @@ static int iwl3945_send_rxon_assoc(struct iwl_priv *priv) | |||
1835 | rc = -EIO; | 1829 | rc = -EIO; |
1836 | } | 1830 | } |
1837 | 1831 | ||
1838 | priv->alloc_rxb_page--; | 1832 | iwl_free_pages(priv, cmd.reply_page); |
1839 | free_pages(cmd.reply_page, priv->hw_params.rx_page_order); | ||
1840 | 1833 | ||
1841 | return rc; | 1834 | return rc; |
1842 | } | 1835 | } |
@@ -2836,6 +2829,7 @@ static struct iwl_cfg iwl3945_bg_cfg = { | |||
2836 | .use_isr_legacy = true, | 2829 | .use_isr_legacy = true, |
2837 | .ht_greenfield_support = false, | 2830 | .ht_greenfield_support = false, |
2838 | .led_compensation = 64, | 2831 | .led_compensation = 64, |
2832 | .broken_powersave = true, | ||
2839 | }; | 2833 | }; |
2840 | 2834 | ||
2841 | static struct iwl_cfg iwl3945_abg_cfg = { | 2835 | static struct iwl_cfg iwl3945_abg_cfg = { |
@@ -2852,6 +2846,7 @@ static struct iwl_cfg iwl3945_abg_cfg = { | |||
2852 | .use_isr_legacy = true, | 2846 | .use_isr_legacy = true, |
2853 | .ht_greenfield_support = false, | 2847 | .ht_greenfield_support = false, |
2854 | .led_compensation = 64, | 2848 | .led_compensation = 64, |
2849 | .broken_powersave = true, | ||
2855 | }; | 2850 | }; |
2856 | 2851 | ||
2857 | struct pci_device_id iwl3945_hw_card_ids[] = { | 2852 | struct pci_device_id iwl3945_hw_card_ids[] = { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index ecc23ec1f6a4..531fa125f5a6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h | |||
@@ -222,7 +222,6 @@ struct iwl3945_ibss_seq { | |||
222 | * | 222 | * |
223 | *****************************************************************************/ | 223 | *****************************************************************************/ |
224 | extern int iwl3945_calc_db_from_ratio(int sig_ratio); | 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 | extern void iwl3945_rx_replenish(void *data); | 225 | extern void iwl3945_rx_replenish(void *data); |
227 | extern void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq); | 226 | extern void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq); |
228 | extern unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv, | 227 | extern unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 386513b601f5..484c5fdf7c2a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -1204,7 +1204,7 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel, | |||
1204 | iwl4965_interpolate_chan(priv, channel, &ch_eeprom_info); | 1204 | iwl4965_interpolate_chan(priv, channel, &ch_eeprom_info); |
1205 | 1205 | ||
1206 | /* calculate tx gain adjustment based on power supply voltage */ | 1206 | /* calculate tx gain adjustment based on power supply voltage */ |
1207 | voltage = priv->calib_info->voltage; | 1207 | voltage = le16_to_cpu(priv->calib_info->voltage); |
1208 | init_voltage = (s32)le32_to_cpu(priv->card_alive_init.voltage); | 1208 | init_voltage = (s32)le32_to_cpu(priv->card_alive_init.voltage); |
1209 | voltage_compensation = | 1209 | voltage_compensation = |
1210 | iwl4965_get_voltage_compensation(voltage, init_voltage); | 1210 | iwl4965_get_voltage_compensation(voltage, init_voltage); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h index 4ef6804a455a..bc056e9ab85f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h | |||
@@ -92,11 +92,15 @@ | |||
92 | 92 | ||
93 | static inline s32 iwl_temp_calib_to_offset(struct iwl_priv *priv) | 93 | static inline s32 iwl_temp_calib_to_offset(struct iwl_priv *priv) |
94 | { | 94 | { |
95 | u16 *temp_calib = (u16 *)iwl_eeprom_query_addr(priv, | 95 | u16 temperature, voltage; |
96 | EEPROM_5000_TEMPERATURE); | 96 | __le16 *temp_calib = |
97 | /* offset = temperature - voltage / coef */ | 97 | (__le16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_TEMPERATURE); |
98 | s32 offset = (s32)(temp_calib[0] - temp_calib[1] / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF); | 98 | |
99 | return offset; | 99 | temperature = le16_to_cpu(temp_calib[0]); |
100 | voltage = le16_to_cpu(temp_calib[1]); | ||
101 | |||
102 | /* offset = temp - volt / coeff */ | ||
103 | return (s32)(temperature - voltage / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF); | ||
100 | } | 104 | } |
101 | 105 | ||
102 | /* Fixed (non-configurable) rx data from phy */ | 106 | /* Fixed (non-configurable) rx data from phy */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index e2f8615c8c9b..33a5866538e7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -333,14 +333,15 @@ static void iwl5000_set_ct_threshold(struct iwl_priv *priv) | |||
333 | static int iwl5000_set_Xtal_calib(struct iwl_priv *priv) | 333 | static int iwl5000_set_Xtal_calib(struct iwl_priv *priv) |
334 | { | 334 | { |
335 | struct iwl_calib_xtal_freq_cmd cmd; | 335 | struct iwl_calib_xtal_freq_cmd cmd; |
336 | u16 *xtal_calib = (u16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_XTAL); | 336 | __le16 *xtal_calib = |
337 | (__le16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_XTAL); | ||
337 | 338 | ||
338 | cmd.hdr.op_code = IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD; | 339 | cmd.hdr.op_code = IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD; |
339 | cmd.hdr.first_group = 0; | 340 | cmd.hdr.first_group = 0; |
340 | cmd.hdr.groups_num = 1; | 341 | cmd.hdr.groups_num = 1; |
341 | cmd.hdr.data_valid = 1; | 342 | cmd.hdr.data_valid = 1; |
342 | cmd.cap_pin1 = (u8)xtal_calib[0]; | 343 | cmd.cap_pin1 = le16_to_cpu(xtal_calib[0]); |
343 | cmd.cap_pin2 = (u8)xtal_calib[1]; | 344 | cmd.cap_pin2 = le16_to_cpu(xtal_calib[1]); |
344 | return iwl_calib_set(&priv->calib_results[IWL_CALIB_XTAL], | 345 | return iwl_calib_set(&priv->calib_results[IWL_CALIB_XTAL], |
345 | (u8 *)&cmd, sizeof(cmd)); | 346 | (u8 *)&cmd, sizeof(cmd)); |
346 | } | 347 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c index fe511cbf012e..b93e49158196 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c | |||
@@ -150,7 +150,7 @@ static s32 expected_tpt_mimo3_40MHz[4][IWL_RATE_COUNT] = { | |||
150 | }; | 150 | }; |
151 | 151 | ||
152 | /* mbps, mcs */ | 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 | { "1", "BPSK DSSS"}, | 154 | { "1", "BPSK DSSS"}, |
155 | { "2", "QPSK DSSS"}, | 155 | { "2", "QPSK DSSS"}, |
156 | {"5.5", "BPSK CCK"}, | 156 | {"5.5", "BPSK CCK"}, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index b8377efb3ba7..1c9866daf815 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -1842,7 +1842,7 @@ void iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log) | |||
1842 | } | 1842 | } |
1843 | 1843 | ||
1844 | #ifdef CONFIG_IWLWIFI_DEBUG | 1844 | #ifdef CONFIG_IWLWIFI_DEBUG |
1845 | if (!(iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS)) | 1845 | if (!(iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS) && !full_log) |
1846 | size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES) | 1846 | size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES) |
1847 | ? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size; | 1847 | ? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size; |
1848 | #else | 1848 | #else |
@@ -3173,7 +3173,6 @@ static int iwl_init_drv(struct iwl_priv *priv) | |||
3173 | 3173 | ||
3174 | priv->ibss_beacon = NULL; | 3174 | priv->ibss_beacon = NULL; |
3175 | 3175 | ||
3176 | spin_lock_init(&priv->lock); | ||
3177 | spin_lock_init(&priv->sta_lock); | 3176 | spin_lock_init(&priv->sta_lock); |
3178 | spin_lock_init(&priv->hcmd_lock); | 3177 | spin_lock_init(&priv->hcmd_lock); |
3179 | 3178 | ||
@@ -3361,10 +3360,11 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3361 | (unsigned long long) pci_resource_len(pdev, 0)); | 3360 | (unsigned long long) pci_resource_len(pdev, 0)); |
3362 | IWL_DEBUG_INFO(priv, "pci_resource_base = %p\n", priv->hw_base); | 3361 | IWL_DEBUG_INFO(priv, "pci_resource_base = %p\n", priv->hw_base); |
3363 | 3362 | ||
3364 | /* this spin lock will be used in apm_ops.init and EEPROM access | 3363 | /* these spin locks will be used in apm_ops.init and EEPROM access |
3365 | * we should init now | 3364 | * we should init now |
3366 | */ | 3365 | */ |
3367 | spin_lock_init(&priv->reg_lock); | 3366 | spin_lock_init(&priv->reg_lock); |
3367 | spin_lock_init(&priv->lock); | ||
3368 | iwl_hw_detect(priv); | 3368 | iwl_hw_detect(priv); |
3369 | IWL_INFO(priv, "Detected Intel Wireless WiFi Link %s REV=0x%X\n", | 3369 | IWL_INFO(priv, "Detected Intel Wireless WiFi Link %s REV=0x%X\n", |
3370 | priv->cfg->name, priv->hw_rev); | 3370 | priv->cfg->name, priv->hw_rev); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-csr.h b/drivers/net/wireless/iwlwifi/iwl-csr.h index a7bfae01f19b..1ec8cb4d5eae 100644 --- a/drivers/net/wireless/iwlwifi/iwl-csr.h +++ b/drivers/net/wireless/iwlwifi/iwl-csr.h | |||
@@ -77,8 +77,7 @@ | |||
77 | * The MAC (uCode processor, etc.) does not need to be powered up for accessing | 77 | * The MAC (uCode processor, etc.) does not need to be powered up for accessing |
78 | * the CSR registers. | 78 | * the CSR registers. |
79 | * | 79 | * |
80 | * NOTE: Newer devices using one-time-programmable (OTP) memory | 80 | * NOTE: Device does need to be awake in order to read this memory |
81 | * require device to be awake in order to read this memory | ||
82 | * via CSR_EEPROM and CSR_OTP registers | 81 | * via CSR_EEPROM and CSR_OTP registers |
83 | */ | 82 | */ |
84 | #define CSR_BASE (0x000) | 83 | #define CSR_BASE (0x000) |
@@ -111,9 +110,8 @@ | |||
111 | /* | 110 | /* |
112 | * EEPROM and OTP (one-time-programmable) memory reads | 111 | * EEPROM and OTP (one-time-programmable) memory reads |
113 | * | 112 | * |
114 | * NOTE: For (newer) devices using OTP, device must be awake, initialized via | 113 | * NOTE: Device must be awake, initialized via apm_ops.init(), |
115 | * apm_ops.init() in order to read. Older devices (3945/4965/5000) | 114 | * in order to read. |
116 | * use EEPROM and do not require this. | ||
117 | */ | 115 | */ |
118 | #define CSR_EEPROM_REG (CSR_BASE+0x02c) | 116 | #define CSR_EEPROM_REG (CSR_BASE+0x02c) |
119 | #define CSR_EEPROM_GP (CSR_BASE+0x030) | 117 | #define CSR_EEPROM_GP (CSR_BASE+0x030) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index 2673e9a4db92..165d1f6e2dd9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -1168,7 +1168,7 @@ struct iwl_priv { | |||
1168 | u32 last_beacon_time; | 1168 | u32 last_beacon_time; |
1169 | u64 last_tsf; | 1169 | u64 last_tsf; |
1170 | 1170 | ||
1171 | /* eeprom */ | 1171 | /* eeprom -- this is in the card's little endian byte order */ |
1172 | u8 *eeprom; | 1172 | u8 *eeprom; |
1173 | int nvm_device_type; | 1173 | int nvm_device_type; |
1174 | struct iwl_eeprom_calib_info *calib_info; | 1174 | struct iwl_eeprom_calib_info *calib_info; |
@@ -1353,4 +1353,15 @@ static inline int is_channel_ibss(const struct iwl_channel_info *ch) | |||
1353 | return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0; | 1353 | return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0; |
1354 | } | 1354 | } |
1355 | 1355 | ||
1356 | static inline void __iwl_free_pages(struct iwl_priv *priv, struct page *page) | ||
1357 | { | ||
1358 | __free_pages(page, priv->hw_params.rx_page_order); | ||
1359 | priv->alloc_rxb_page--; | ||
1360 | } | ||
1361 | |||
1362 | static inline void iwl_free_pages(struct iwl_priv *priv, unsigned long page) | ||
1363 | { | ||
1364 | free_pages(page, priv->hw_params.rx_page_order); | ||
1365 | priv->alloc_rxb_page--; | ||
1366 | } | ||
1356 | #endif /* __iwl_dev_h__ */ | 1367 | #endif /* __iwl_dev_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c index 3946e5c03f81..4a30969689ff 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c | |||
@@ -370,7 +370,7 @@ static int iwl_init_otp_access(struct iwl_priv *priv) | |||
370 | return ret; | 370 | return ret; |
371 | } | 371 | } |
372 | 372 | ||
373 | static int iwl_read_otp_word(struct iwl_priv *priv, u16 addr, u16 *eeprom_data) | 373 | static int iwl_read_otp_word(struct iwl_priv *priv, u16 addr, __le16 *eeprom_data) |
374 | { | 374 | { |
375 | int ret = 0; | 375 | int ret = 0; |
376 | u32 r; | 376 | u32 r; |
@@ -404,7 +404,7 @@ static int iwl_read_otp_word(struct iwl_priv *priv, u16 addr, u16 *eeprom_data) | |||
404 | CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK); | 404 | CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK); |
405 | IWL_ERR(priv, "Correctable OTP ECC error, continue read\n"); | 405 | IWL_ERR(priv, "Correctable OTP ECC error, continue read\n"); |
406 | } | 406 | } |
407 | *eeprom_data = le16_to_cpu((__force __le16)(r >> 16)); | 407 | *eeprom_data = cpu_to_le16(r >> 16); |
408 | return 0; | 408 | return 0; |
409 | } | 409 | } |
410 | 410 | ||
@@ -413,7 +413,8 @@ static int iwl_read_otp_word(struct iwl_priv *priv, u16 addr, u16 *eeprom_data) | |||
413 | */ | 413 | */ |
414 | static bool iwl_is_otp_empty(struct iwl_priv *priv) | 414 | static bool iwl_is_otp_empty(struct iwl_priv *priv) |
415 | { | 415 | { |
416 | u16 next_link_addr = 0, link_value; | 416 | u16 next_link_addr = 0; |
417 | __le16 link_value; | ||
417 | bool is_empty = false; | 418 | bool is_empty = false; |
418 | 419 | ||
419 | /* locate the beginning of OTP link list */ | 420 | /* locate the beginning of OTP link list */ |
@@ -443,7 +444,8 @@ static bool iwl_is_otp_empty(struct iwl_priv *priv) | |||
443 | static int iwl_find_otp_image(struct iwl_priv *priv, | 444 | static int iwl_find_otp_image(struct iwl_priv *priv, |
444 | u16 *validblockaddr) | 445 | u16 *validblockaddr) |
445 | { | 446 | { |
446 | u16 next_link_addr = 0, link_value = 0, valid_addr; | 447 | u16 next_link_addr = 0, valid_addr; |
448 | __le16 link_value = 0; | ||
447 | int usedblocks = 0; | 449 | int usedblocks = 0; |
448 | 450 | ||
449 | /* set addressing mode to absolute to traverse the link list */ | 451 | /* set addressing mode to absolute to traverse the link list */ |
@@ -463,7 +465,7 @@ static int iwl_find_otp_image(struct iwl_priv *priv, | |||
463 | * check for more block on the link list | 465 | * check for more block on the link list |
464 | */ | 466 | */ |
465 | valid_addr = next_link_addr; | 467 | valid_addr = next_link_addr; |
466 | next_link_addr = link_value * sizeof(u16); | 468 | next_link_addr = le16_to_cpu(link_value) * sizeof(u16); |
467 | IWL_DEBUG_INFO(priv, "OTP blocks %d addr 0x%x\n", | 469 | IWL_DEBUG_INFO(priv, "OTP blocks %d addr 0x%x\n", |
468 | usedblocks, next_link_addr); | 470 | usedblocks, next_link_addr); |
469 | if (iwl_read_otp_word(priv, next_link_addr, &link_value)) | 471 | if (iwl_read_otp_word(priv, next_link_addr, &link_value)) |
@@ -497,7 +499,7 @@ static int iwl_find_otp_image(struct iwl_priv *priv, | |||
497 | */ | 499 | */ |
498 | int iwl_eeprom_init(struct iwl_priv *priv) | 500 | int iwl_eeprom_init(struct iwl_priv *priv) |
499 | { | 501 | { |
500 | u16 *e; | 502 | __le16 *e; |
501 | u32 gp = iwl_read32(priv, CSR_EEPROM_GP); | 503 | u32 gp = iwl_read32(priv, CSR_EEPROM_GP); |
502 | int sz; | 504 | int sz; |
503 | int ret; | 505 | int ret; |
@@ -516,12 +518,9 @@ int iwl_eeprom_init(struct iwl_priv *priv) | |||
516 | ret = -ENOMEM; | 518 | ret = -ENOMEM; |
517 | goto alloc_err; | 519 | goto alloc_err; |
518 | } | 520 | } |
519 | e = (u16 *)priv->eeprom; | 521 | e = (__le16 *)priv->eeprom; |
520 | 522 | ||
521 | if (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) { | 523 | priv->cfg->ops->lib->apm_ops.init(priv); |
522 | /* OTP reads require powered-up chip */ | ||
523 | priv->cfg->ops->lib->apm_ops.init(priv); | ||
524 | } | ||
525 | 524 | ||
526 | ret = priv->cfg->ops->lib->eeprom_ops.verify_signature(priv); | 525 | ret = priv->cfg->ops->lib->eeprom_ops.verify_signature(priv); |
527 | if (ret < 0) { | 526 | if (ret < 0) { |
@@ -562,7 +561,7 @@ int iwl_eeprom_init(struct iwl_priv *priv) | |||
562 | } | 561 | } |
563 | for (addr = validblockaddr; addr < validblockaddr + sz; | 562 | for (addr = validblockaddr; addr < validblockaddr + sz; |
564 | addr += sizeof(u16)) { | 563 | addr += sizeof(u16)) { |
565 | u16 eeprom_data; | 564 | __le16 eeprom_data; |
566 | 565 | ||
567 | ret = iwl_read_otp_word(priv, addr, &eeprom_data); | 566 | ret = iwl_read_otp_word(priv, addr, &eeprom_data); |
568 | if (ret) | 567 | if (ret) |
@@ -570,13 +569,6 @@ int iwl_eeprom_init(struct iwl_priv *priv) | |||
570 | e[cache_addr / 2] = eeprom_data; | 569 | e[cache_addr / 2] = eeprom_data; |
571 | cache_addr += sizeof(u16); | 570 | cache_addr += sizeof(u16); |
572 | } | 571 | } |
573 | |||
574 | /* | ||
575 | * Now that OTP reads are complete, reset chip to save | ||
576 | * power until we load uCode during "up". | ||
577 | */ | ||
578 | priv->cfg->ops->lib->apm_ops.stop(priv); | ||
579 | |||
580 | } else { | 572 | } else { |
581 | /* eeprom is an array of 16bit values */ | 573 | /* eeprom is an array of 16bit values */ |
582 | for (addr = 0; addr < sz; addr += sizeof(u16)) { | 574 | for (addr = 0; addr < sz; addr += sizeof(u16)) { |
@@ -594,7 +586,7 @@ int iwl_eeprom_init(struct iwl_priv *priv) | |||
594 | goto done; | 586 | goto done; |
595 | } | 587 | } |
596 | r = _iwl_read_direct32(priv, CSR_EEPROM_REG); | 588 | r = _iwl_read_direct32(priv, CSR_EEPROM_REG); |
597 | e[addr / 2] = le16_to_cpu((__force __le16)(r >> 16)); | 589 | e[addr / 2] = cpu_to_le16(r >> 16); |
598 | } | 590 | } |
599 | } | 591 | } |
600 | ret = 0; | 592 | ret = 0; |
@@ -603,6 +595,8 @@ done: | |||
603 | err: | 595 | err: |
604 | if (ret) | 596 | if (ret) |
605 | iwl_eeprom_free(priv); | 597 | iwl_eeprom_free(priv); |
598 | /* Reset chip to save power until we load uCode during "up". */ | ||
599 | priv->cfg->ops->lib->apm_ops.stop(priv); | ||
606 | alloc_err: | 600 | alloc_err: |
607 | return ret; | 601 | return ret; |
608 | } | 602 | } |
@@ -755,7 +749,8 @@ static int iwl_mod_ht40_chan_info(struct iwl_priv *priv, | |||
755 | ch_info->ht40_eeprom = *eeprom_ch; | 749 | ch_info->ht40_eeprom = *eeprom_ch; |
756 | ch_info->ht40_max_power_avg = eeprom_ch->max_power_avg; | 750 | ch_info->ht40_max_power_avg = eeprom_ch->max_power_avg; |
757 | ch_info->ht40_flags = eeprom_ch->flags; | 751 | ch_info->ht40_flags = eeprom_ch->flags; |
758 | ch_info->ht40_extension_channel &= ~clear_ht40_extension_channel; | 752 | if (eeprom_ch->flags & EEPROM_CHANNEL_VALID) |
753 | ch_info->ht40_extension_channel &= ~clear_ht40_extension_channel; | ||
759 | 754 | ||
760 | return 0; | 755 | return 0; |
761 | } | 756 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h index 5cd2b66bbe45..0cd9c02ee044 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h | |||
@@ -137,7 +137,7 @@ struct iwl_eeprom_channel { | |||
137 | * | 137 | * |
138 | */ | 138 | */ |
139 | struct iwl_eeprom_enhanced_txpwr { | 139 | struct iwl_eeprom_enhanced_txpwr { |
140 | u16 common; | 140 | __le16 common; |
141 | s8 chain_a_max; | 141 | s8 chain_a_max; |
142 | s8 chain_b_max; | 142 | s8 chain_b_max; |
143 | s8 chain_c_max; | 143 | s8 chain_c_max; |
@@ -360,7 +360,7 @@ struct iwl_eeprom_calib_subband_info { | |||
360 | struct iwl_eeprom_calib_info { | 360 | struct iwl_eeprom_calib_info { |
361 | u8 saturation_power24; /* half-dBm (e.g. "34" = 17 dBm) */ | 361 | u8 saturation_power24; /* half-dBm (e.g. "34" = 17 dBm) */ |
362 | u8 saturation_power52; /* half-dBm */ | 362 | u8 saturation_power52; /* half-dBm */ |
363 | s16 voltage; /* signed */ | 363 | __le16 voltage; /* signed */ |
364 | struct iwl_eeprom_calib_subband_info | 364 | struct iwl_eeprom_calib_subband_info |
365 | band_info[EEPROM_TX_POWER_BANDS]; | 365 | band_info[EEPROM_TX_POWER_BANDS]; |
366 | } __attribute__ ((packed)); | 366 | } __attribute__ ((packed)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-hcmd.c index a23165948202..30e9ea6d54ec 100644 --- a/drivers/net/wireless/iwlwifi/iwl-hcmd.c +++ b/drivers/net/wireless/iwlwifi/iwl-hcmd.c | |||
@@ -234,7 +234,7 @@ cancel: | |||
234 | } | 234 | } |
235 | fail: | 235 | fail: |
236 | if (cmd->reply_page) { | 236 | if (cmd->reply_page) { |
237 | free_pages(cmd->reply_page, priv->hw_params.rx_page_order); | 237 | iwl_free_pages(priv, cmd->reply_page); |
238 | cmd->reply_page = 0; | 238 | cmd->reply_page = 0; |
239 | } | 239 | } |
240 | out: | 240 | out: |
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c index 6090bc15a6d5..6f36b6e79f5e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-rx.c | |||
@@ -345,10 +345,8 @@ void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq) | |||
345 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, | 345 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, |
346 | PAGE_SIZE << priv->hw_params.rx_page_order, | 346 | PAGE_SIZE << priv->hw_params.rx_page_order, |
347 | PCI_DMA_FROMDEVICE); | 347 | PCI_DMA_FROMDEVICE); |
348 | __free_pages(rxq->pool[i].page, | 348 | __iwl_free_pages(priv, rxq->pool[i].page); |
349 | priv->hw_params.rx_page_order); | ||
350 | rxq->pool[i].page = NULL; | 349 | rxq->pool[i].page = NULL; |
351 | priv->alloc_rxb_page--; | ||
352 | } | 350 | } |
353 | } | 351 | } |
354 | 352 | ||
@@ -416,9 +414,7 @@ void iwl_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq) | |||
416 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, | 414 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, |
417 | PAGE_SIZE << priv->hw_params.rx_page_order, | 415 | PAGE_SIZE << priv->hw_params.rx_page_order, |
418 | PCI_DMA_FROMDEVICE); | 416 | PCI_DMA_FROMDEVICE); |
419 | priv->alloc_rxb_page--; | 417 | __iwl_free_pages(priv, rxq->pool[i].page); |
420 | __free_pages(rxq->pool[i].page, | ||
421 | priv->hw_params.rx_page_order); | ||
422 | rxq->pool[i].page = NULL; | 418 | rxq->pool[i].page = NULL; |
423 | } | 419 | } |
424 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); | 420 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); |
@@ -654,47 +650,6 @@ void iwl_reply_statistics(struct iwl_priv *priv, | |||
654 | } | 650 | } |
655 | EXPORT_SYMBOL(iwl_reply_statistics); | 651 | EXPORT_SYMBOL(iwl_reply_statistics); |
656 | 652 | ||
657 | #define PERFECT_RSSI (-20) /* dBm */ | ||
658 | #define WORST_RSSI (-95) /* dBm */ | ||
659 | #define RSSI_RANGE (PERFECT_RSSI - WORST_RSSI) | ||
660 | |||
661 | /* Calculate an indication of rx signal quality (a percentage, not dBm!). | ||
662 | * See http://www.ces.clemson.edu/linux/signal_quality.shtml for info | ||
663 | * about formulas used below. */ | ||
664 | static int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm) | ||
665 | { | ||
666 | int sig_qual; | ||
667 | int degradation = PERFECT_RSSI - rssi_dbm; | ||
668 | |||
669 | /* If we get a noise measurement, use signal-to-noise ratio (SNR) | ||
670 | * as indicator; formula is (signal dbm - noise dbm). | ||
671 | * SNR at or above 40 is a great signal (100%). | ||
672 | * Below that, scale to fit SNR of 0 - 40 dB within 0 - 100% indicator. | ||
673 | * Weakest usable signal is usually 10 - 15 dB SNR. */ | ||
674 | if (noise_dbm) { | ||
675 | if (rssi_dbm - noise_dbm >= 40) | ||
676 | return 100; | ||
677 | else if (rssi_dbm < noise_dbm) | ||
678 | return 0; | ||
679 | sig_qual = ((rssi_dbm - noise_dbm) * 5) / 2; | ||
680 | |||
681 | /* Else use just the signal level. | ||
682 | * This formula is a least squares fit of data points collected and | ||
683 | * compared with a reference system that had a percentage (%) display | ||
684 | * for signal quality. */ | ||
685 | } else | ||
686 | sig_qual = (100 * (RSSI_RANGE * RSSI_RANGE) - degradation * | ||
687 | (15 * RSSI_RANGE + 62 * degradation)) / | ||
688 | (RSSI_RANGE * RSSI_RANGE); | ||
689 | |||
690 | if (sig_qual > 100) | ||
691 | sig_qual = 100; | ||
692 | else if (sig_qual < 1) | ||
693 | sig_qual = 0; | ||
694 | |||
695 | return sig_qual; | ||
696 | } | ||
697 | |||
698 | /* Calc max signal level (dBm) among 3 possible receivers */ | 653 | /* Calc max signal level (dBm) among 3 possible receivers */ |
699 | static inline int iwl_calc_rssi(struct iwl_priv *priv, | 654 | static inline int iwl_calc_rssi(struct iwl_priv *priv, |
700 | struct iwl_rx_phy_res *rx_resp) | 655 | struct iwl_rx_phy_res *rx_resp) |
@@ -1105,11 +1060,8 @@ void iwl_rx_reply_rx(struct iwl_priv *priv, | |||
1105 | if (iwl_is_associated(priv) && | 1060 | if (iwl_is_associated(priv) && |
1106 | !test_bit(STATUS_SCANNING, &priv->status)) { | 1061 | !test_bit(STATUS_SCANNING, &priv->status)) { |
1107 | rx_status.noise = priv->last_rx_noise; | 1062 | rx_status.noise = priv->last_rx_noise; |
1108 | rx_status.qual = iwl_calc_sig_qual(rx_status.signal, | ||
1109 | rx_status.noise); | ||
1110 | } else { | 1063 | } else { |
1111 | rx_status.noise = IWL_NOISE_MEAS_NOT_AVAILABLE; | 1064 | rx_status.noise = IWL_NOISE_MEAS_NOT_AVAILABLE; |
1112 | rx_status.qual = iwl_calc_sig_qual(rx_status.signal, 0); | ||
1113 | } | 1065 | } |
1114 | 1066 | ||
1115 | /* Reset beacon noise level if not associated. */ | 1067 | /* Reset beacon noise level if not associated. */ |
@@ -1122,8 +1074,8 @@ void iwl_rx_reply_rx(struct iwl_priv *priv, | |||
1122 | iwl_dbg_report_frame(priv, phy_res, len, header, 1); | 1074 | iwl_dbg_report_frame(priv, phy_res, len, header, 1); |
1123 | #endif | 1075 | #endif |
1124 | iwl_dbg_log_rx_data_frame(priv, len, header); | 1076 | iwl_dbg_log_rx_data_frame(priv, len, header); |
1125 | IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, noise %d, qual %d, TSF %llu\n", | 1077 | IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, noise %d, TSF %llu\n", |
1126 | rx_status.signal, rx_status.noise, rx_status.qual, | 1078 | rx_status.signal, rx_status.noise, |
1127 | (unsigned long long)rx_status.mactime); | 1079 | (unsigned long long)rx_status.mactime); |
1128 | 1080 | ||
1129 | /* | 1081 | /* |
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c index a2b2b8315ff9..fa1c89ba6459 100644 --- a/drivers/net/wireless/iwlwifi/iwl-scan.c +++ b/drivers/net/wireless/iwlwifi/iwl-scan.c | |||
@@ -144,8 +144,7 @@ static int iwl_send_scan_abort(struct iwl_priv *priv) | |||
144 | clear_bit(STATUS_SCAN_HW, &priv->status); | 144 | clear_bit(STATUS_SCAN_HW, &priv->status); |
145 | } | 145 | } |
146 | 146 | ||
147 | priv->alloc_rxb_page--; | 147 | iwl_free_pages(priv, cmd.reply_page); |
148 | free_pages(cmd.reply_page, priv->hw_params.rx_page_order); | ||
149 | 148 | ||
150 | return ret; | 149 | return ret; |
151 | } | 150 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c index cd6a6901216e..cde09a890b73 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sta.c +++ b/drivers/net/wireless/iwlwifi/iwl-sta.c | |||
@@ -164,9 +164,7 @@ int iwl_send_add_sta(struct iwl_priv *priv, | |||
164 | break; | 164 | break; |
165 | } | 165 | } |
166 | } | 166 | } |
167 | 167 | iwl_free_pages(priv, cmd.reply_page); | |
168 | priv->alloc_rxb_page--; | ||
169 | free_pages(cmd.reply_page, priv->hw_params.rx_page_order); | ||
170 | 168 | ||
171 | return ret; | 169 | return ret; |
172 | } | 170 | } |
@@ -391,9 +389,7 @@ static int iwl_send_remove_station(struct iwl_priv *priv, const u8 *addr, | |||
391 | break; | 389 | break; |
392 | } | 390 | } |
393 | } | 391 | } |
394 | 392 | iwl_free_pages(priv, cmd.reply_page); | |
395 | priv->alloc_rxb_page--; | ||
396 | free_pages(cmd.reply_page, priv->hw_params.rx_page_order); | ||
397 | 393 | ||
398 | return ret; | 394 | return ret; |
399 | } | 395 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c index 00da5e152d46..87ce2bd292c7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c | |||
@@ -407,13 +407,14 @@ void iwl_hw_txq_ctx_free(struct iwl_priv *priv) | |||
407 | int txq_id; | 407 | int txq_id; |
408 | 408 | ||
409 | /* Tx queues */ | 409 | /* Tx queues */ |
410 | if (priv->txq) | 410 | if (priv->txq) { |
411 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; | 411 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; |
412 | txq_id++) | 412 | txq_id++) |
413 | if (txq_id == IWL_CMD_QUEUE_NUM) | 413 | if (txq_id == IWL_CMD_QUEUE_NUM) |
414 | iwl_cmd_queue_free(priv); | 414 | iwl_cmd_queue_free(priv); |
415 | else | 415 | else |
416 | iwl_tx_queue_free(priv, txq_id); | 416 | iwl_tx_queue_free(priv, txq_id); |
417 | } | ||
417 | iwl_free_dma_ptr(priv, &priv->kw); | 418 | iwl_free_dma_ptr(priv, &priv->kw); |
418 | 419 | ||
419 | iwl_free_dma_ptr(priv, &priv->scd_bc_tbls); | 420 | iwl_free_dma_ptr(priv, &priv->scd_bc_tbls); |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 2a28a1f8b1fe..f8e4e4b18d02 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -548,6 +548,9 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
548 | txq = &priv->txq[txq_id]; | 548 | txq = &priv->txq[txq_id]; |
549 | q = &txq->q; | 549 | q = &txq->q; |
550 | 550 | ||
551 | if ((iwl_queue_space(q) < q->high_mark)) | ||
552 | goto drop; | ||
553 | |||
551 | spin_lock_irqsave(&priv->lock, flags); | 554 | spin_lock_irqsave(&priv->lock, flags); |
552 | 555 | ||
553 | idx = get_cmd_index(q, q->write_ptr, 0); | 556 | idx = get_cmd_index(q, q->write_ptr, 0); |
@@ -812,7 +815,7 @@ static int iwl3945_get_measurement(struct iwl_priv *priv, | |||
812 | break; | 815 | break; |
813 | } | 816 | } |
814 | 817 | ||
815 | free_pages(cmd.reply_page, priv->hw_params.rx_page_order); | 818 | iwl_free_pages(priv, cmd.reply_page); |
816 | 819 | ||
817 | return rc; | 820 | return rc; |
818 | } | 821 | } |
@@ -1198,9 +1201,7 @@ void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq) | |||
1198 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, | 1201 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, |
1199 | PAGE_SIZE << priv->hw_params.rx_page_order, | 1202 | PAGE_SIZE << priv->hw_params.rx_page_order, |
1200 | PCI_DMA_FROMDEVICE); | 1203 | PCI_DMA_FROMDEVICE); |
1201 | priv->alloc_rxb_page--; | 1204 | __iwl_free_pages(priv, rxq->pool[i].page); |
1202 | __free_pages(rxq->pool[i].page, | ||
1203 | priv->hw_params.rx_page_order); | ||
1204 | rxq->pool[i].page = NULL; | 1205 | rxq->pool[i].page = NULL; |
1205 | } | 1206 | } |
1206 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); | 1207 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); |
@@ -1247,10 +1248,8 @@ static void iwl3945_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rx | |||
1247 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, | 1248 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, |
1248 | PAGE_SIZE << priv->hw_params.rx_page_order, | 1249 | PAGE_SIZE << priv->hw_params.rx_page_order, |
1249 | PCI_DMA_FROMDEVICE); | 1250 | PCI_DMA_FROMDEVICE); |
1250 | __free_pages(rxq->pool[i].page, | 1251 | __iwl_free_pages(priv, rxq->pool[i].page); |
1251 | priv->hw_params.rx_page_order); | ||
1252 | rxq->pool[i].page = NULL; | 1252 | rxq->pool[i].page = NULL; |
1253 | priv->alloc_rxb_page--; | ||
1254 | } | 1253 | } |
1255 | } | 1254 | } |
1256 | 1255 | ||
@@ -1300,47 +1299,6 @@ int iwl3945_calc_db_from_ratio(int sig_ratio) | |||
1300 | return (int)ratio2dB[sig_ratio]; | 1299 | return (int)ratio2dB[sig_ratio]; |
1301 | } | 1300 | } |
1302 | 1301 | ||
1303 | #define PERFECT_RSSI (-20) /* dBm */ | ||
1304 | #define WORST_RSSI (-95) /* dBm */ | ||
1305 | #define RSSI_RANGE (PERFECT_RSSI - WORST_RSSI) | ||
1306 | |||
1307 | /* Calculate an indication of rx signal quality (a percentage, not dBm!). | ||
1308 | * See http://www.ces.clemson.edu/linux/signal_quality.shtml for info | ||
1309 | * about formulas used below. */ | ||
1310 | int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm) | ||
1311 | { | ||
1312 | int sig_qual; | ||
1313 | int degradation = PERFECT_RSSI - rssi_dbm; | ||
1314 | |||
1315 | /* If we get a noise measurement, use signal-to-noise ratio (SNR) | ||
1316 | * as indicator; formula is (signal dbm - noise dbm). | ||
1317 | * SNR at or above 40 is a great signal (100%). | ||
1318 | * Below that, scale to fit SNR of 0 - 40 dB within 0 - 100% indicator. | ||
1319 | * Weakest usable signal is usually 10 - 15 dB SNR. */ | ||
1320 | if (noise_dbm) { | ||
1321 | if (rssi_dbm - noise_dbm >= 40) | ||
1322 | return 100; | ||
1323 | else if (rssi_dbm < noise_dbm) | ||
1324 | return 0; | ||
1325 | sig_qual = ((rssi_dbm - noise_dbm) * 5) / 2; | ||
1326 | |||
1327 | /* Else use just the signal level. | ||
1328 | * This formula is a least squares fit of data points collected and | ||
1329 | * compared with a reference system that had a percentage (%) display | ||
1330 | * for signal quality. */ | ||
1331 | } else | ||
1332 | sig_qual = (100 * (RSSI_RANGE * RSSI_RANGE) - degradation * | ||
1333 | (15 * RSSI_RANGE + 62 * degradation)) / | ||
1334 | (RSSI_RANGE * RSSI_RANGE); | ||
1335 | |||
1336 | if (sig_qual > 100) | ||
1337 | sig_qual = 100; | ||
1338 | else if (sig_qual < 1) | ||
1339 | sig_qual = 0; | ||
1340 | |||
1341 | return sig_qual; | ||
1342 | } | ||
1343 | |||
1344 | /** | 1302 | /** |
1345 | * iwl3945_rx_handle - Main entry function for receiving responses from uCode | 1303 | * iwl3945_rx_handle - Main entry function for receiving responses from uCode |
1346 | * | 1304 | * |
@@ -1688,7 +1646,7 @@ void iwl3945_dump_nic_event_log(struct iwl_priv *priv, bool full_log) | |||
1688 | } | 1646 | } |
1689 | 1647 | ||
1690 | #ifdef CONFIG_IWLWIFI_DEBUG | 1648 | #ifdef CONFIG_IWLWIFI_DEBUG |
1691 | if (!(iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS)) | 1649 | if (!(iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS) && !full_log) |
1692 | size = (size > DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES) | 1650 | size = (size > DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES) |
1693 | ? DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES : size; | 1651 | ? DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES : size; |
1694 | #else | 1652 | #else |
@@ -3867,7 +3825,6 @@ static int iwl3945_init_drv(struct iwl_priv *priv) | |||
3867 | priv->retry_rate = 1; | 3825 | priv->retry_rate = 1; |
3868 | priv->ibss_beacon = NULL; | 3826 | priv->ibss_beacon = NULL; |
3869 | 3827 | ||
3870 | spin_lock_init(&priv->lock); | ||
3871 | spin_lock_init(&priv->sta_lock); | 3828 | spin_lock_init(&priv->sta_lock); |
3872 | spin_lock_init(&priv->hcmd_lock); | 3829 | spin_lock_init(&priv->hcmd_lock); |
3873 | 3830 | ||
@@ -3936,9 +3893,11 @@ static int iwl3945_setup_mac(struct iwl_priv *priv) | |||
3936 | /* Tell mac80211 our characteristics */ | 3893 | /* Tell mac80211 our characteristics */ |
3937 | hw->flags = IEEE80211_HW_SIGNAL_DBM | | 3894 | hw->flags = IEEE80211_HW_SIGNAL_DBM | |
3938 | IEEE80211_HW_NOISE_DBM | | 3895 | IEEE80211_HW_NOISE_DBM | |
3939 | IEEE80211_HW_SPECTRUM_MGMT | | 3896 | IEEE80211_HW_SPECTRUM_MGMT; |
3940 | IEEE80211_HW_SUPPORTS_PS | | 3897 | |
3941 | IEEE80211_HW_SUPPORTS_DYNAMIC_PS; | 3898 | if (!priv->cfg->broken_powersave) |
3899 | hw->flags |= IEEE80211_HW_SUPPORTS_PS | | ||
3900 | IEEE80211_HW_SUPPORTS_DYNAMIC_PS; | ||
3942 | 3901 | ||
3943 | hw->wiphy->interface_modes = | 3902 | hw->wiphy->interface_modes = |
3944 | BIT(NL80211_IFTYPE_STATION) | | 3903 | BIT(NL80211_IFTYPE_STATION) | |
@@ -4057,10 +4016,11 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
4057 | * PCI Tx retries from interfering with C3 CPU state */ | 4016 | * PCI Tx retries from interfering with C3 CPU state */ |
4058 | pci_write_config_byte(pdev, 0x41, 0x00); | 4017 | pci_write_config_byte(pdev, 0x41, 0x00); |
4059 | 4018 | ||
4060 | /* this spin lock will be used in apm_ops.init and EEPROM access | 4019 | /* these spin locks will be used in apm_ops.init and EEPROM access |
4061 | * we should init now | 4020 | * we should init now |
4062 | */ | 4021 | */ |
4063 | spin_lock_init(&priv->reg_lock); | 4022 | spin_lock_init(&priv->reg_lock); |
4023 | spin_lock_init(&priv->lock); | ||
4064 | 4024 | ||
4065 | /*********************** | 4025 | /*********************** |
4066 | * 4. Read EEPROM | 4026 | * 4. Read EEPROM |
diff --git a/drivers/net/wireless/iwmc3200wifi/iwm.h b/drivers/net/wireless/iwmc3200wifi/iwm.h index 5a26bb05a33a..842811142bef 100644 --- a/drivers/net/wireless/iwmc3200wifi/iwm.h +++ b/drivers/net/wireless/iwmc3200wifi/iwm.h | |||
@@ -268,7 +268,7 @@ struct iwm_priv { | |||
268 | 268 | ||
269 | struct sk_buff_head rx_list; | 269 | struct sk_buff_head rx_list; |
270 | struct list_head rx_tickets; | 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 | struct workqueue_struct *rx_wq; | 272 | struct workqueue_struct *rx_wq; |
273 | struct work_struct rx_worker; | 273 | struct work_struct rx_worker; |
274 | 274 | ||
@@ -349,7 +349,7 @@ int iwm_up(struct iwm_priv *iwm); | |||
349 | int iwm_down(struct iwm_priv *iwm); | 349 | int iwm_down(struct iwm_priv *iwm); |
350 | 350 | ||
351 | /* TX API */ | 351 | /* TX API */ |
352 | u16 iwm_tid_to_queue(u16 tid); | 352 | int iwm_tid_to_queue(u16 tid); |
353 | void iwm_tx_credit_inc(struct iwm_priv *iwm, int id, int total_freed_pages); | 353 | void iwm_tx_credit_inc(struct iwm_priv *iwm, int id, int total_freed_pages); |
354 | void iwm_tx_worker(struct work_struct *work); | 354 | void iwm_tx_worker(struct work_struct *work); |
355 | int iwm_xmit_frame(struct sk_buff *skb, struct net_device *netdev); | 355 | int iwm_xmit_frame(struct sk_buff *skb, struct net_device *netdev); |
diff --git a/drivers/net/wireless/iwmc3200wifi/netdev.c b/drivers/net/wireless/iwmc3200wifi/netdev.c index e4f0f8705f65..c4c0d23c63ec 100644 --- a/drivers/net/wireless/iwmc3200wifi/netdev.c +++ b/drivers/net/wireless/iwmc3200wifi/netdev.c | |||
@@ -76,7 +76,7 @@ static int iwm_stop(struct net_device *ndev) | |||
76 | */ | 76 | */ |
77 | static const u16 iwm_1d_to_queue[8] = { 1, 0, 0, 1, 2, 2, 3, 3 }; | 77 | static const u16 iwm_1d_to_queue[8] = { 1, 0, 0, 1, 2, 2, 3, 3 }; |
78 | 78 | ||
79 | u16 iwm_tid_to_queue(u16 tid) | 79 | int iwm_tid_to_queue(u16 tid) |
80 | { | 80 | { |
81 | if (tid > IWM_UMAC_TID_NR - 2) | 81 | if (tid > IWM_UMAC_TID_NR - 2) |
82 | return -EINVAL; | 82 | return -EINVAL; |
diff --git a/drivers/net/wireless/iwmc3200wifi/rx.c b/drivers/net/wireless/iwmc3200wifi/rx.c index 1c57c1f72cba..6d6ed7485175 100644 --- a/drivers/net/wireless/iwmc3200wifi/rx.c +++ b/drivers/net/wireless/iwmc3200wifi/rx.c | |||
@@ -1126,7 +1126,7 @@ static int iwm_ntf_stop_resume_tx(struct iwm_priv *iwm, u8 *buf, | |||
1126 | 1126 | ||
1127 | if (!stop) { | 1127 | if (!stop) { |
1128 | struct iwm_tx_queue *txq; | 1128 | struct iwm_tx_queue *txq; |
1129 | u16 queue = iwm_tid_to_queue(bit); | 1129 | int queue = iwm_tid_to_queue(bit); |
1130 | 1130 | ||
1131 | if (queue < 0) | 1131 | if (queue < 0) |
1132 | continue; | 1132 | continue; |
diff --git a/drivers/net/wireless/libertas/mesh.c b/drivers/net/wireless/libertas/mesh.c index 2f91c9b808af..92b7a357a5e4 100644 --- a/drivers/net/wireless/libertas/mesh.c +++ b/drivers/net/wireless/libertas/mesh.c | |||
@@ -2,6 +2,7 @@ | |||
2 | #include <linux/delay.h> | 2 | #include <linux/delay.h> |
3 | #include <linux/etherdevice.h> | 3 | #include <linux/etherdevice.h> |
4 | #include <linux/netdevice.h> | 4 | #include <linux/netdevice.h> |
5 | #include <linux/if_ether.h> | ||
5 | #include <linux/if_arp.h> | 6 | #include <linux/if_arp.h> |
6 | #include <linux/kthread.h> | 7 | #include <linux/kthread.h> |
7 | #include <linux/kfifo.h> | 8 | #include <linux/kfifo.h> |
@@ -351,8 +352,7 @@ int lbs_add_mesh(struct lbs_private *priv) | |||
351 | 352 | ||
352 | mesh_dev->netdev_ops = &mesh_netdev_ops; | 353 | mesh_dev->netdev_ops = &mesh_netdev_ops; |
353 | mesh_dev->ethtool_ops = &lbs_ethtool_ops; | 354 | mesh_dev->ethtool_ops = &lbs_ethtool_ops; |
354 | memcpy(mesh_dev->dev_addr, priv->dev->dev_addr, | 355 | memcpy(mesh_dev->dev_addr, priv->dev->dev_addr, ETH_ALEN); |
355 | sizeof(priv->dev->dev_addr)); | ||
356 | 356 | ||
357 | SET_NETDEV_DEV(priv->mesh_dev, priv->dev->dev.parent); | 357 | SET_NETDEV_DEV(priv->mesh_dev, priv->dev->dev.parent); |
358 | 358 | ||
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index c6a6c042b82f..b0b1c7841500 100644 --- a/drivers/net/wireless/libertas/scan.c +++ b/drivers/net/wireless/libertas/scan.c | |||
@@ -567,11 +567,8 @@ int lbs_scan_networks(struct lbs_private *priv, int full_scan) | |||
567 | chan_count = lbs_scan_create_channel_list(priv, chan_list); | 567 | chan_count = lbs_scan_create_channel_list(priv, chan_list); |
568 | 568 | ||
569 | netif_stop_queue(priv->dev); | 569 | netif_stop_queue(priv->dev); |
570 | netif_carrier_off(priv->dev); | 570 | if (priv->mesh_dev) |
571 | if (priv->mesh_dev) { | ||
572 | netif_stop_queue(priv->mesh_dev); | 571 | netif_stop_queue(priv->mesh_dev); |
573 | netif_carrier_off(priv->mesh_dev); | ||
574 | } | ||
575 | 572 | ||
576 | /* Prepare to continue an interrupted scan */ | 573 | /* Prepare to continue an interrupted scan */ |
577 | lbs_deb_scan("chan_count %d, scan_channel %d\n", | 574 | lbs_deb_scan("chan_count %d, scan_channel %d\n", |
@@ -635,16 +632,13 @@ out2: | |||
635 | priv->scan_channel = 0; | 632 | priv->scan_channel = 0; |
636 | 633 | ||
637 | out: | 634 | out: |
638 | if (priv->connect_status == LBS_CONNECTED) { | 635 | if (priv->connect_status == LBS_CONNECTED && !priv->tx_pending_len) |
639 | netif_carrier_on(priv->dev); | 636 | netif_wake_queue(priv->dev); |
640 | if (!priv->tx_pending_len) | 637 | |
641 | netif_wake_queue(priv->dev); | 638 | if (priv->mesh_dev && (priv->mesh_connect_status == LBS_CONNECTED) && |
642 | } | 639 | !priv->tx_pending_len) |
643 | if (priv->mesh_dev && (priv->mesh_connect_status == LBS_CONNECTED)) { | 640 | netif_wake_queue(priv->mesh_dev); |
644 | netif_carrier_on(priv->mesh_dev); | 641 | |
645 | if (!priv->tx_pending_len) | ||
646 | netif_wake_queue(priv->mesh_dev); | ||
647 | } | ||
648 | kfree(chan_list); | 642 | kfree(chan_list); |
649 | 643 | ||
650 | lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret); | 644 | lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret); |
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index a8eb9e1fcf36..4b1aab593a84 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c | |||
@@ -2025,10 +2025,8 @@ static int lbs_get_essid(struct net_device *dev, struct iw_request_info *info, | |||
2025 | if (priv->connect_status == LBS_CONNECTED) { | 2025 | if (priv->connect_status == LBS_CONNECTED) { |
2026 | memcpy(extra, priv->curbssparams.ssid, | 2026 | memcpy(extra, priv->curbssparams.ssid, |
2027 | priv->curbssparams.ssid_len); | 2027 | priv->curbssparams.ssid_len); |
2028 | extra[priv->curbssparams.ssid_len] = '\0'; | ||
2029 | } else { | 2028 | } else { |
2030 | memset(extra, 0, 32); | 2029 | memset(extra, 0, 32); |
2031 | extra[priv->curbssparams.ssid_len] = '\0'; | ||
2032 | } | 2030 | } |
2033 | /* | 2031 | /* |
2034 | * If none, we may want to get the one that was set | 2032 | * If none, we may want to get the one that was set |
diff --git a/drivers/net/wireless/libertas_tf/main.c b/drivers/net/wireless/libertas_tf/main.c index 019431d2f8a9..26a1abd5bb03 100644 --- a/drivers/net/wireless/libertas_tf/main.c +++ b/drivers/net/wireless/libertas_tf/main.c | |||
@@ -495,7 +495,6 @@ int lbtf_rx(struct lbtf_private *priv, struct sk_buff *skb) | |||
495 | stats.band = IEEE80211_BAND_2GHZ; | 495 | stats.band = IEEE80211_BAND_2GHZ; |
496 | stats.signal = prxpd->snr; | 496 | stats.signal = prxpd->snr; |
497 | stats.noise = prxpd->nf; | 497 | stats.noise = prxpd->nf; |
498 | stats.qual = prxpd->snr - prxpd->nf; | ||
499 | /* Marvell rate index has a hole at value 4 */ | 498 | /* Marvell rate index has a hole at value 4 */ |
500 | if (prxpd->rx_rate > 4) | 499 | if (prxpd->rx_rate > 4) |
501 | --prxpd->rx_rate; | 500 | --prxpd->rx_rate; |
diff --git a/drivers/net/wireless/orinoco/wext.c b/drivers/net/wireless/orinoco/wext.c index 7698fdd6a3a2..31ca241f7753 100644 --- a/drivers/net/wireless/orinoco/wext.c +++ b/drivers/net/wireless/orinoco/wext.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #define MAX_RID_LEN 1024 | 23 | #define MAX_RID_LEN 1024 |
24 | 24 | ||
25 | /* Helper routine to record keys | 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 | static int orinoco_set_key(struct orinoco_private *priv, int index, | 27 | static int orinoco_set_key(struct orinoco_private *priv, int index, |
28 | enum orinoco_alg alg, const u8 *key, int key_len, | 28 | enum orinoco_alg alg, const u8 *key, int key_len, |
29 | const u8 *seq, int seq_len) | 29 | const u8 *seq, int seq_len) |
@@ -32,14 +32,14 @@ static int orinoco_set_key(struct orinoco_private *priv, int index, | |||
32 | kzfree(priv->keys[index].seq); | 32 | kzfree(priv->keys[index].seq); |
33 | 33 | ||
34 | if (key_len) { | 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 | if (!priv->keys[index].key) | 36 | if (!priv->keys[index].key) |
37 | goto nomem; | 37 | goto nomem; |
38 | } else | 38 | } else |
39 | priv->keys[index].key = NULL; | 39 | priv->keys[index].key = NULL; |
40 | 40 | ||
41 | if (seq_len) { | 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 | if (!priv->keys[index].seq) | 43 | if (!priv->keys[index].seq) |
44 | goto free_key; | 44 | goto free_key; |
45 | } else | 45 | } else |
diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h index c5fe867665e6..1a7eae357fef 100644 --- a/drivers/net/wireless/rt2x00/rt2800.h +++ b/drivers/net/wireless/rt2x00/rt2800.h | |||
@@ -1323,7 +1323,7 @@ | |||
1323 | #define PAIRWISE_KEY_ENTRY(__idx) \ | 1323 | #define PAIRWISE_KEY_ENTRY(__idx) \ |
1324 | ( PAIRWISE_KEY_TABLE_BASE + ((__idx) * sizeof(struct hw_key_entry)) ) | 1324 | ( PAIRWISE_KEY_TABLE_BASE + ((__idx) * sizeof(struct hw_key_entry)) ) |
1325 | #define MAC_IVEIV_ENTRY(__idx) \ | 1325 | #define MAC_IVEIV_ENTRY(__idx) \ |
1326 | ( MAC_IVEIV_TABLE_BASE + ((__idx) & sizeof(struct mac_iveiv_entry)) ) | 1326 | ( MAC_IVEIV_TABLE_BASE + ((__idx) * sizeof(struct mac_iveiv_entry)) ) |
1327 | #define MAC_WCID_ATTR_ENTRY(__idx) \ | 1327 | #define MAC_WCID_ATTR_ENTRY(__idx) \ |
1328 | ( MAC_WCID_ATTRIBUTE_BASE + ((__idx) * sizeof(u32)) ) | 1328 | ( MAC_WCID_ATTRIBUTE_BASE + ((__idx) * sizeof(u32)) ) |
1329 | #define SHARED_KEY_ENTRY(__idx) \ | 1329 | #define SHARED_KEY_ENTRY(__idx) \ |
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index eb1e1d00bec3..27bf887f1453 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #include <linux/module.h> | 37 | #include <linux/module.h> |
38 | 38 | ||
39 | #include "rt2x00.h" | 39 | #include "rt2x00.h" |
40 | #ifdef CONFIG_RT2800USB | 40 | #if defined(CONFIG_RT2800USB) || defined(CONFIG_RT2800USB_MODULE) |
41 | #include "rt2x00usb.h" | 41 | #include "rt2x00usb.h" |
42 | #endif | 42 | #endif |
43 | #include "rt2800lib.h" | 43 | #include "rt2800lib.h" |
@@ -1121,7 +1121,7 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) | |||
1121 | 1121 | ||
1122 | if (rt2x00_intf_is_usb(rt2x00dev)) { | 1122 | if (rt2x00_intf_is_usb(rt2x00dev)) { |
1123 | rt2800_register_write(rt2x00dev, USB_DMA_CFG, 0x00000000); | 1123 | rt2800_register_write(rt2x00dev, USB_DMA_CFG, 0x00000000); |
1124 | #ifdef CONFIG_RT2800USB | 1124 | #if defined(CONFIG_RT2800USB) || defined(CONFIG_RT2800USB_MODULE) |
1125 | rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE, 0, | 1125 | rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE, 0, |
1126 | USB_MODE_RESET, REGISTER_TIMEOUT); | 1126 | USB_MODE_RESET, REGISTER_TIMEOUT); |
1127 | #endif | 1127 | #endif |
@@ -2022,6 +2022,12 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2022 | u16 eeprom; | 2022 | u16 eeprom; |
2023 | 2023 | ||
2024 | /* | 2024 | /* |
2025 | * Disable powersaving as default on PCI devices. | ||
2026 | */ | ||
2027 | if (rt2x00_intf_is_pci(rt2x00dev)) | ||
2028 | rt2x00dev->hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; | ||
2029 | |||
2030 | /* | ||
2025 | * Initialize all hw fields. | 2031 | * Initialize all hw fields. |
2026 | */ | 2032 | */ |
2027 | rt2x00dev->hw->flags = | 2033 | rt2x00dev->hw->flags = |
@@ -2074,8 +2080,7 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2074 | IEEE80211_HT_CAP_SGI_20 | | 2080 | IEEE80211_HT_CAP_SGI_20 | |
2075 | IEEE80211_HT_CAP_SGI_40 | | 2081 | IEEE80211_HT_CAP_SGI_40 | |
2076 | IEEE80211_HT_CAP_TX_STBC | | 2082 | IEEE80211_HT_CAP_TX_STBC | |
2077 | IEEE80211_HT_CAP_RX_STBC | | 2083 | IEEE80211_HT_CAP_RX_STBC; |
2078 | IEEE80211_HT_CAP_PSMP_SUPPORT; | ||
2079 | spec->ht.ampdu_factor = 3; | 2084 | spec->ht.ampdu_factor = 3; |
2080 | spec->ht.ampdu_density = 4; | 2085 | spec->ht.ampdu_density = 4; |
2081 | spec->ht.mcs.tx_params = | 2086 | spec->ht.mcs.tx_params = |
@@ -2140,8 +2145,8 @@ static void rt2800_get_tkip_seq(struct ieee80211_hw *hw, u8 hw_key_idx, | |||
2140 | rt2800_register_multiread(rt2x00dev, offset, | 2145 | rt2800_register_multiread(rt2x00dev, offset, |
2141 | &iveiv_entry, sizeof(iveiv_entry)); | 2146 | &iveiv_entry, sizeof(iveiv_entry)); |
2142 | 2147 | ||
2143 | memcpy(&iveiv_entry.iv[0], iv16, sizeof(iv16)); | 2148 | memcpy(iv16, &iveiv_entry.iv[0], sizeof(*iv16)); |
2144 | memcpy(&iveiv_entry.iv[4], iv32, sizeof(iv32)); | 2149 | memcpy(iv32, &iveiv_entry.iv[4], sizeof(*iv32)); |
2145 | } | 2150 | } |
2146 | 2151 | ||
2147 | static int rt2800_set_rts_threshold(struct ieee80211_hw *hw, u32 value) | 2152 | static int rt2800_set_rts_threshold(struct ieee80211_hw *hw, u32 value) |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index af85d18cdbe7..ab95346cf6a3 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -922,6 +922,7 @@ static struct usb_device_id rt2800usb_device_table[] = { | |||
922 | { USB_DEVICE(0x1737, 0x0070), USB_DEVICE_DATA(&rt2800usb_ops) }, | 922 | { USB_DEVICE(0x1737, 0x0070), USB_DEVICE_DATA(&rt2800usb_ops) }, |
923 | { USB_DEVICE(0x1737, 0x0071), USB_DEVICE_DATA(&rt2800usb_ops) }, | 923 | { USB_DEVICE(0x1737, 0x0071), USB_DEVICE_DATA(&rt2800usb_ops) }, |
924 | { USB_DEVICE(0x1737, 0x0077), USB_DEVICE_DATA(&rt2800usb_ops) }, | 924 | { USB_DEVICE(0x1737, 0x0077), USB_DEVICE_DATA(&rt2800usb_ops) }, |
925 | { USB_DEVICE(0x1737, 0x0079), USB_DEVICE_DATA(&rt2800usb_ops) }, | ||
925 | /* Logitec */ | 926 | /* Logitec */ |
926 | { USB_DEVICE(0x0789, 0x0162), USB_DEVICE_DATA(&rt2800usb_ops) }, | 927 | { USB_DEVICE(0x0789, 0x0162), USB_DEVICE_DATA(&rt2800usb_ops) }, |
927 | { USB_DEVICE(0x0789, 0x0163), USB_DEVICE_DATA(&rt2800usb_ops) }, | 928 | { USB_DEVICE(0x0789, 0x0163), USB_DEVICE_DATA(&rt2800usb_ops) }, |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index 687e17dc2e9f..0ca589306d71 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -2539,6 +2539,11 @@ static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2539 | unsigned int i; | 2539 | unsigned int i; |
2540 | 2540 | ||
2541 | /* | 2541 | /* |
2542 | * Disable powersaving as default. | ||
2543 | */ | ||
2544 | rt2x00dev->hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; | ||
2545 | |||
2546 | /* | ||
2542 | * Initialize all hw fields. | 2547 | * Initialize all hw fields. |
2543 | */ | 2548 | */ |
2544 | rt2x00dev->hw->flags = | 2549 | rt2x00dev->hw->flags = |
diff --git a/drivers/net/wireless/rtl818x/rtl8180_dev.c b/drivers/net/wireless/rtl818x/rtl8180_dev.c index a1a3dd15c664..8a40a1439984 100644 --- a/drivers/net/wireless/rtl818x/rtl8180_dev.c +++ b/drivers/net/wireless/rtl818x/rtl8180_dev.c | |||
@@ -132,7 +132,6 @@ static void rtl8180_handle_rx(struct ieee80211_hw *dev) | |||
132 | 132 | ||
133 | rx_status.antenna = (flags2 >> 15) & 1; | 133 | rx_status.antenna = (flags2 >> 15) & 1; |
134 | /* TODO: improve signal/rssi reporting */ | 134 | /* TODO: improve signal/rssi reporting */ |
135 | rx_status.qual = flags2 & 0xFF; | ||
136 | rx_status.signal = (flags2 >> 8) & 0x7F; | 135 | rx_status.signal = (flags2 >> 8) & 0x7F; |
137 | /* XXX: is this correct? */ | 136 | /* XXX: is this correct? */ |
138 | rx_status.rate_idx = (flags >> 20) & 0xF; | 137 | rx_status.rate_idx = (flags >> 20) & 0xF; |
diff --git a/drivers/net/wireless/wl12xx/wl1251_boot.c b/drivers/net/wireless/wl12xx/wl1251_boot.c index 2e733e7bdfd4..28a808674080 100644 --- a/drivers/net/wireless/wl12xx/wl1251_boot.c +++ b/drivers/net/wireless/wl12xx/wl1251_boot.c | |||
@@ -256,7 +256,7 @@ int wl1251_boot_run_firmware(struct wl1251 *wl) | |||
256 | } | 256 | } |
257 | } | 257 | } |
258 | 258 | ||
259 | if (loop >= INIT_LOOP) { | 259 | if (loop > INIT_LOOP) { |
260 | wl1251_error("timeout waiting for the hardware to " | 260 | wl1251_error("timeout waiting for the hardware to " |
261 | "complete initialization"); | 261 | "complete initialization"); |
262 | return -EIO; | 262 | return -EIO; |
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c index 886a9bc39cc1..c3385b3d246c 100644 --- a/drivers/net/wireless/wl12xx/wl1271_cmd.c +++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c | |||
@@ -777,7 +777,7 @@ out: | |||
777 | return ret; | 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 | u8 index = 0; | 782 | u8 index = 0; |
783 | 783 | ||
@@ -804,7 +804,7 @@ static int wl1271_build_basic_rates(char *rates, u8 band) | |||
804 | return index; | 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 | u8 index = 0; | 809 | u8 index = 0; |
810 | 810 | ||
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c index dfa1b9bc22c8..7ca95c414fa8 100644 --- a/drivers/net/wireless/zd1211rw/zd_chip.c +++ b/drivers/net/wireless/zd1211rw/zd_chip.c | |||
@@ -1325,151 +1325,11 @@ int zd_chip_set_basic_rates(struct zd_chip *chip, u16 cr_rates) | |||
1325 | return r; | 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 | static inline u8 zd_rate_from_ofdm_plcp_header(const void *rx_frame) | 1328 | static inline u8 zd_rate_from_ofdm_plcp_header(const void *rx_frame) |
1459 | { | 1329 | { |
1460 | return ZD_OFDM | zd_ofdm_plcp_header_rate(rx_frame); | 1330 | return ZD_OFDM | zd_ofdm_plcp_header_rate(rx_frame); |
1461 | } | 1331 | } |
1462 | 1332 | ||
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 | } | ||
1472 | |||
1473 | /** | 1333 | /** |
1474 | * zd_rx_rate - report zd-rate | 1334 | * zd_rx_rate - report zd-rate |
1475 | * @rx_frame - received frame | 1335 | * @rx_frame - received frame |
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.h b/drivers/net/wireless/zd1211rw/zd_chip.h index 9fd8f3508d66..f8bbf7d302ae 100644 --- a/drivers/net/wireless/zd1211rw/zd_chip.h +++ b/drivers/net/wireless/zd1211rw/zd_chip.h | |||
@@ -929,9 +929,6 @@ static inline int zd_get_beacon_interval(struct zd_chip *chip, u32 *interval) | |||
929 | 929 | ||
930 | struct rx_status; | 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 | u8 zd_rx_rate(const void *rx_frame, const struct rx_status *status); | 932 | u8 zd_rx_rate(const void *rx_frame, const struct rx_status *status); |
936 | 933 | ||
937 | struct zd_mc_hash { | 934 | struct zd_mc_hash { |
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c index cf51e8f8174b..8ebf5c33955d 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zd1211rw/zd_mac.c | |||
@@ -828,9 +828,6 @@ int zd_mac_rx(struct ieee80211_hw *hw, const u8 *buffer, unsigned int length) | |||
828 | stats.freq = zd_channels[_zd_chip_get_channel(&mac->chip) - 1].center_freq; | 828 | stats.freq = zd_channels[_zd_chip_get_channel(&mac->chip) - 1].center_freq; |
829 | stats.band = IEEE80211_BAND_2GHZ; | 829 | stats.band = IEEE80211_BAND_2GHZ; |
830 | stats.signal = status->signal_strength; | 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 | rate = zd_rx_rate(buffer, status); | 832 | rate = zd_rx_rate(buffer, status); |
836 | 833 | ||