diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index b1a6e39f7821..5e1279263b22 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -48,8 +48,6 @@ | |||
48 | #include <linux/netdevice.h> | 48 | #include <linux/netdevice.h> |
49 | #include <linux/wireless.h> | 49 | #include <linux/wireless.h> |
50 | #include <linux/firmware.h> | 50 | #include <linux/firmware.h> |
51 | #include <linux/skbuff.h> | ||
52 | #include <linux/netdevice.h> | ||
53 | #include <linux/etherdevice.h> | 51 | #include <linux/etherdevice.h> |
54 | #include <linux/if_arp.h> | 52 | #include <linux/if_arp.h> |
55 | 53 | ||
@@ -1802,21 +1800,22 @@ static void iwl_unset_hw_setting(struct iwl_priv *priv) | |||
1802 | * return : set the bit for each supported rate insert in ie | 1800 | * return : set the bit for each supported rate insert in ie |
1803 | */ | 1801 | */ |
1804 | static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate, | 1802 | static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate, |
1805 | u16 basic_rate, int max_count) | 1803 | u16 basic_rate, int *left) |
1806 | { | 1804 | { |
1807 | u16 ret_rates = 0, bit; | 1805 | u16 ret_rates = 0, bit; |
1808 | int i; | 1806 | int i; |
1809 | u8 *rates; | 1807 | u8 *cnt = ie; |
1810 | 1808 | u8 *rates = ie + 1; | |
1811 | rates = &(ie[1]); | ||
1812 | 1809 | ||
1813 | for (bit = 1, i = 0; i < IWL_RATE_COUNT; i++, bit <<= 1) { | 1810 | for (bit = 1, i = 0; i < IWL_RATE_COUNT; i++, bit <<= 1) { |
1814 | if (bit & supported_rate) { | 1811 | if (bit & supported_rate) { |
1815 | ret_rates |= bit; | 1812 | ret_rates |= bit; |
1816 | rates[*ie] = iwl_rates[i].ieee | | 1813 | rates[*cnt] = iwl_rates[i].ieee | |
1817 | ((bit & basic_rate) ? 0x80 : 0x00); | 1814 | ((bit & basic_rate) ? 0x80 : 0x00); |
1818 | *ie = *ie + 1; | 1815 | (*cnt)++; |
1819 | if (*ie >= max_count) | 1816 | (*left)--; |
1817 | if ((*left <= 0) || | ||
1818 | (*cnt >= IWL_SUPPORTED_RATES_IE_LEN)) | ||
1820 | break; | 1819 | break; |
1821 | } | 1820 | } |
1822 | } | 1821 | } |
@@ -1839,7 +1838,7 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, | |||
1839 | { | 1838 | { |
1840 | int len = 0; | 1839 | int len = 0; |
1841 | u8 *pos = NULL; | 1840 | u8 *pos = NULL; |
1842 | u16 ret_rates; | 1841 | u16 active_rates, ret_rates, cck_rates; |
1843 | 1842 | ||
1844 | /* Make sure there is enough space for the probe request, | 1843 | /* Make sure there is enough space for the probe request, |
1845 | * two mandatory IEs and the data */ | 1844 | * two mandatory IEs and the data */ |
@@ -1884,19 +1883,27 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, | |||
1884 | left -= 2; | 1883 | left -= 2; |
1885 | if (left < 0) | 1884 | if (left < 0) |
1886 | return 0; | 1885 | return 0; |
1886 | |||
1887 | /* ... fill it in... */ | 1887 | /* ... fill it in... */ |
1888 | *pos++ = WLAN_EID_SUPP_RATES; | 1888 | *pos++ = WLAN_EID_SUPP_RATES; |
1889 | *pos = 0; | 1889 | *pos = 0; |
1890 | ret_rates = priv->active_rate = priv->rates_mask; | 1890 | |
1891 | priv->active_rate = priv->rates_mask; | ||
1892 | active_rates = priv->active_rate; | ||
1891 | priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK; | 1893 | priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK; |
1892 | 1894 | ||
1893 | iwl_supported_rate_to_ie(pos, priv->active_rate, | 1895 | cck_rates = IWL_CCK_RATES_MASK & active_rates; |
1894 | priv->active_rate_basic, left); | 1896 | ret_rates = iwl_supported_rate_to_ie(pos, cck_rates, |
1897 | priv->active_rate_basic, &left); | ||
1898 | active_rates &= ~ret_rates; | ||
1899 | |||
1900 | ret_rates = iwl_supported_rate_to_ie(pos, active_rates, | ||
1901 | priv->active_rate_basic, &left); | ||
1902 | active_rates &= ~ret_rates; | ||
1903 | |||
1895 | len += 2 + *pos; | 1904 | len += 2 + *pos; |
1896 | pos += (*pos) + 1; | 1905 | pos += (*pos) + 1; |
1897 | ret_rates = ~ret_rates & priv->active_rate; | 1906 | if (active_rates == 0) |
1898 | |||
1899 | if (ret_rates == 0) | ||
1900 | goto fill_end; | 1907 | goto fill_end; |
1901 | 1908 | ||
1902 | /* fill in supported extended rate */ | 1909 | /* fill in supported extended rate */ |
@@ -1907,7 +1914,8 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, | |||
1907 | /* ... fill it in... */ | 1914 | /* ... fill it in... */ |
1908 | *pos++ = WLAN_EID_EXT_SUPP_RATES; | 1915 | *pos++ = WLAN_EID_EXT_SUPP_RATES; |
1909 | *pos = 0; | 1916 | *pos = 0; |
1910 | iwl_supported_rate_to_ie(pos, ret_rates, priv->active_rate_basic, left); | 1917 | iwl_supported_rate_to_ie(pos, active_rates, |
1918 | priv->active_rate_basic, &left); | ||
1911 | if (*pos > 0) | 1919 | if (*pos > 0) |
1912 | len += 2 + *pos; | 1920 | len += 2 + *pos; |
1913 | 1921 | ||
@@ -4494,13 +4502,13 @@ static u8 ratio2dB[100] = { | |||
4494 | * Conversion assumes that levels are voltages (20*log), not powers (10*log). */ | 4502 | * Conversion assumes that levels are voltages (20*log), not powers (10*log). */ |
4495 | int iwl_calc_db_from_ratio(int sig_ratio) | 4503 | int iwl_calc_db_from_ratio(int sig_ratio) |
4496 | { | 4504 | { |
4497 | /* Anything above 1000:1 just report as 60 dB */ | 4505 | /* 1000:1 or higher just report as 60 dB */ |
4498 | if (sig_ratio > 1000) | 4506 | if (sig_ratio >= 1000) |
4499 | return 60; | 4507 | return 60; |
4500 | 4508 | ||
4501 | /* Above 100:1, divide by 10 and use table, | 4509 | /* 100:1 or higher, divide by 10 and use table, |
4502 | * add 20 dB to make up for divide by 10 */ | 4510 | * add 20 dB to make up for divide by 10 */ |
4503 | if (sig_ratio > 100) | 4511 | if (sig_ratio >= 100) |
4504 | return (20 + (int)ratio2dB[sig_ratio/10]); | 4512 | return (20 + (int)ratio2dB[sig_ratio/10]); |
4505 | 4513 | ||
4506 | /* We shouldn't see this */ | 4514 | /* We shouldn't see this */ |