aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl3945-base.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c42
1 files changed, 26 insertions, 16 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index a1d2716556be..83019d1d7ccc 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -1747,21 +1747,22 @@ static void iwl_unset_hw_setting(struct iwl_priv *priv)
1747 * return : set the bit for each supported rate insert in ie 1747 * return : set the bit for each supported rate insert in ie
1748 */ 1748 */
1749static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate, 1749static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate,
1750 u16 basic_rate, int max_count) 1750 u16 basic_rate, int *left)
1751{ 1751{
1752 u16 ret_rates = 0, bit; 1752 u16 ret_rates = 0, bit;
1753 int i; 1753 int i;
1754 u8 *rates; 1754 u8 *cnt = ie;
1755 1755 u8 *rates = ie + 1;
1756 rates = &(ie[1]);
1757 1756
1758 for (bit = 1, i = 0; i < IWL_RATE_COUNT; i++, bit <<= 1) { 1757 for (bit = 1, i = 0; i < IWL_RATE_COUNT; i++, bit <<= 1) {
1759 if (bit & supported_rate) { 1758 if (bit & supported_rate) {
1760 ret_rates |= bit; 1759 ret_rates |= bit;
1761 rates[*ie] = iwl_rates[i].ieee | 1760 rates[*cnt] = iwl_rates[i].ieee |
1762 ((bit & basic_rate) ? 0x80 : 0x00); 1761 ((bit & basic_rate) ? 0x80 : 0x00);
1763 *ie = *ie + 1; 1762 (*cnt)++;
1764 if (*ie >= max_count) 1763 (*left)--;
1764 if ((*left <= 0) ||
1765 (*cnt >= IWL_SUPPORTED_RATES_IE_LEN))
1765 break; 1766 break;
1766 } 1767 }
1767 } 1768 }
@@ -1778,7 +1779,7 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv,
1778{ 1779{
1779 int len = 0; 1780 int len = 0;
1780 u8 *pos = NULL; 1781 u8 *pos = NULL;
1781 u16 ret_rates; 1782 u16 active_rates, ret_rates, cck_rates;
1782 1783
1783 /* Make sure there is enough space for the probe request, 1784 /* Make sure there is enough space for the probe request,
1784 * two mandatory IEs and the data */ 1785 * two mandatory IEs and the data */
@@ -1823,19 +1824,27 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv,
1823 left -= 2; 1824 left -= 2;
1824 if (left < 0) 1825 if (left < 0)
1825 return 0; 1826 return 0;
1827
1826 /* ... fill it in... */ 1828 /* ... fill it in... */
1827 *pos++ = WLAN_EID_SUPP_RATES; 1829 *pos++ = WLAN_EID_SUPP_RATES;
1828 *pos = 0; 1830 *pos = 0;
1829 ret_rates = priv->active_rate = priv->rates_mask; 1831
1832 priv->active_rate = priv->rates_mask;
1833 active_rates = priv->active_rate;
1830 priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK; 1834 priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK;
1831 1835
1832 iwl_supported_rate_to_ie(pos, priv->active_rate, 1836 cck_rates = IWL_CCK_RATES_MASK & active_rates;
1833 priv->active_rate_basic, left); 1837 ret_rates = iwl_supported_rate_to_ie(pos, cck_rates,
1838 priv->active_rate_basic, &left);
1839 active_rates &= ~ret_rates;
1840
1841 ret_rates = iwl_supported_rate_to_ie(pos, active_rates,
1842 priv->active_rate_basic, &left);
1843 active_rates &= ~ret_rates;
1844
1834 len += 2 + *pos; 1845 len += 2 + *pos;
1835 pos += (*pos) + 1; 1846 pos += (*pos) + 1;
1836 ret_rates = ~ret_rates & priv->active_rate; 1847 if (active_rates == 0)
1837
1838 if (ret_rates == 0)
1839 goto fill_end; 1848 goto fill_end;
1840 1849
1841 /* fill in supported extended rate */ 1850 /* fill in supported extended rate */
@@ -1846,7 +1855,8 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv,
1846 /* ... fill it in... */ 1855 /* ... fill it in... */
1847 *pos++ = WLAN_EID_EXT_SUPP_RATES; 1856 *pos++ = WLAN_EID_EXT_SUPP_RATES;
1848 *pos = 0; 1857 *pos = 0;
1849 iwl_supported_rate_to_ie(pos, ret_rates, priv->active_rate_basic, left); 1858 iwl_supported_rate_to_ie(pos, active_rates,
1859 priv->active_rate_basic, &left);
1850 if (*pos > 0) 1860 if (*pos > 0)
1851 len += 2 + *pos; 1861 len += 2 + *pos;
1852 1862