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