aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-3945.c
diff options
context:
space:
mode:
authorMohamed Abbas <mabbas@linux.intel.com>2007-11-11 22:37:42 -0500
committerJohn W. Linville <linville@tuxdriver.com>2007-11-14 21:16:46 -0500
commit14577f239fe5193d556ef1471c8667dabd556418 (patch)
tree1b6c69370bcb0f3b83d492c304471e7d80a921c0 /drivers/net/wireless/iwlwifi/iwl-3945.c
parenta0af5f14542a2e0687f95e093a33ea7301fe8cc5 (diff)
iwl3945: place CCK rates in front of OFDM for supported rates
The patch fixes association failure (reason = 18) bug by arranging CCK rates before OFDM rates. This patch will register with mac80211 the modified rate arrangement with CCK rate first. Change rate scale algorithm also to deal with rate change. Fix Txpower and rate Table commands to be constructed correctly after rearrangement. Signed-off-by: Mohamed Abbas <mabbas@linux.intel.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-3945.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c126
1 files changed, 69 insertions, 57 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 19bcb01e2784..3a45fe99a83e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -54,7 +54,9 @@
54 IWL_RATE_##rp##M_INDEX, \ 54 IWL_RATE_##rp##M_INDEX, \
55 IWL_RATE_##rn##M_INDEX, \ 55 IWL_RATE_##rn##M_INDEX, \
56 IWL_RATE_##pp##M_INDEX, \ 56 IWL_RATE_##pp##M_INDEX, \
57 IWL_RATE_##np##M_INDEX } 57 IWL_RATE_##np##M_INDEX, \
58 IWL_RATE_##r##M_INDEX_TABLE, \
59 IWL_RATE_##ip##M_INDEX_TABLE }
58 60
59/* 61/*
60 * Parameter order: 62 * Parameter order:
@@ -65,6 +67,10 @@
65 * 67 *
66 */ 68 */
67const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT] = { 69const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT] = {
70 IWL_DECLARE_RATE_INFO(1, INV, 2, INV, 2, INV, 2), /* 1mbps */
71 IWL_DECLARE_RATE_INFO(2, 1, 5, 1, 5, 1, 5), /* 2mbps */
72 IWL_DECLARE_RATE_INFO(5, 2, 6, 2, 11, 2, 11), /*5.5mbps */
73 IWL_DECLARE_RATE_INFO(11, 9, 12, 5, 12, 5, 18), /* 11mbps */
68 IWL_DECLARE_RATE_INFO(6, 5, 9, 5, 11, 5, 11), /* 6mbps */ 74 IWL_DECLARE_RATE_INFO(6, 5, 9, 5, 11, 5, 11), /* 6mbps */
69 IWL_DECLARE_RATE_INFO(9, 6, 11, 5, 11, 5, 11), /* 9mbps */ 75 IWL_DECLARE_RATE_INFO(9, 6, 11, 5, 11, 5, 11), /* 9mbps */
70 IWL_DECLARE_RATE_INFO(12, 11, 18, 11, 18, 11, 18), /* 12mbps */ 76 IWL_DECLARE_RATE_INFO(12, 11, 18, 11, 18, 11, 18), /* 12mbps */
@@ -73,10 +79,6 @@ const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT] = {
73 IWL_DECLARE_RATE_INFO(36, 24, 48, 24, 48, 24, 48), /* 36mbps */ 79 IWL_DECLARE_RATE_INFO(36, 24, 48, 24, 48, 24, 48), /* 36mbps */
74 IWL_DECLARE_RATE_INFO(48, 36, 54, 36, 54, 36, 54), /* 48mbps */ 80 IWL_DECLARE_RATE_INFO(48, 36, 54, 36, 54, 36, 54), /* 48mbps */
75 IWL_DECLARE_RATE_INFO(54, 48, INV, 48, INV, 48, INV),/* 54mbps */ 81 IWL_DECLARE_RATE_INFO(54, 48, INV, 48, INV, 48, INV),/* 54mbps */
76 IWL_DECLARE_RATE_INFO(1, INV, 2, INV, 2, INV, 2), /* 1mbps */
77 IWL_DECLARE_RATE_INFO(2, 1, 5, 1, 5, 1, 5), /* 2mbps */
78 IWL_DECLARE_RATE_INFO(5, 2, 6, 2, 11, 2, 11), /*5.5mbps */
79 IWL_DECLARE_RATE_INFO(11, 9, 12, 5, 12, 5, 18), /* 11mbps */
80}; 82};
81 83
82/* 1 = enable the iwl_disable_events() function */ 84/* 1 = enable the iwl_disable_events() function */
@@ -662,10 +664,11 @@ void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv,
662 cmd->cmd.tx.tx_flags = tx_flags; 664 cmd->cmd.tx.tx_flags = tx_flags;
663 665
664 /* OFDM */ 666 /* OFDM */
665 cmd->cmd.tx.supp_rates[0] = rate_mask & IWL_OFDM_RATES_MASK; 667 cmd->cmd.tx.supp_rates[0] =
668 ((rate_mask & IWL_OFDM_RATES_MASK) >> IWL_FIRST_OFDM_RATE) & 0xFF;
666 669
667 /* CCK */ 670 /* CCK */
668 cmd->cmd.tx.supp_rates[1] = (rate_mask >> 8) & 0xF; 671 cmd->cmd.tx.supp_rates[1] = (rate_mask & 0xF);
669 672
670 IWL_DEBUG_RATE("Tx sta id: %d, rate: %d (plcp), flags: 0x%4X " 673 IWL_DEBUG_RATE("Tx sta id: %d, rate: %d (plcp), flags: 0x%4X "
671 "cck/ofdm mask: 0x%x/0x%x\n", sta_id, 674 "cck/ofdm mask: 0x%x/0x%x\n", sta_id,
@@ -1432,7 +1435,7 @@ static void iwl_hw_reg_set_scan_power(struct iwl_priv *priv, u32 scan_tbl_index,
1432 /* use this channel group's 6Mbit clipping/saturation pwr, 1435 /* use this channel group's 6Mbit clipping/saturation pwr,
1433 * but cap at regulatory scan power restriction (set during init 1436 * but cap at regulatory scan power restriction (set during init
1434 * based on eeprom channel data) for this channel. */ 1437 * based on eeprom channel data) for this channel. */
1435 power = min(ch_info->scan_power, clip_pwrs[IWL_RATE_6M_INDEX]); 1438 power = min(ch_info->scan_power, clip_pwrs[IWL_RATE_6M_INDEX_TABLE]);
1436 1439
1437 /* further limit to user's max power preference. 1440 /* further limit to user's max power preference.
1438 * FIXME: Other spectrum management power limitations do not 1441 * FIXME: Other spectrum management power limitations do not
@@ -1447,7 +1450,7 @@ static void iwl_hw_reg_set_scan_power(struct iwl_priv *priv, u32 scan_tbl_index,
1447 * *index*. */ 1450 * *index*. */
1448 power_index = ch_info->power_info[rate_index].power_table_index 1451 power_index = ch_info->power_info[rate_index].power_table_index
1449 - (power - ch_info->power_info 1452 - (power - ch_info->power_info
1450 [IWL_RATE_6M_INDEX].requested_power) * 2; 1453 [IWL_RATE_6M_INDEX_TABLE].requested_power) * 2;
1451 1454
1452 /* store reference index that we use when adjusting *all* scan 1455 /* store reference index that we use when adjusting *all* scan
1453 * powers. So we can accommodate user (all channel) or spectrum 1456 * powers. So we can accommodate user (all channel) or spectrum
@@ -1476,7 +1479,7 @@ static void iwl_hw_reg_set_scan_power(struct iwl_priv *priv, u32 scan_tbl_index,
1476 */ 1479 */
1477int iwl_hw_reg_send_txpower(struct iwl_priv *priv) 1480int iwl_hw_reg_send_txpower(struct iwl_priv *priv)
1478{ 1481{
1479 int rate_idx; 1482 int rate_idx, i;
1480 const struct iwl_channel_info *ch_info = NULL; 1483 const struct iwl_channel_info *ch_info = NULL;
1481 struct iwl_txpowertable_cmd txpower = { 1484 struct iwl_txpowertable_cmd txpower = {
1482 .channel = priv->active_rxon.channel, 1485 .channel = priv->active_rxon.channel,
@@ -1500,20 +1503,36 @@ int iwl_hw_reg_send_txpower(struct iwl_priv *priv)
1500 } 1503 }
1501 1504
1502 /* fill cmd with power settings for all rates for current channel */ 1505 /* fill cmd with power settings for all rates for current channel */
1503 for (rate_idx = 0; rate_idx < IWL_RATE_COUNT; rate_idx++) { 1506 /* Fill OFDM rate */
1504 txpower.power[rate_idx].tpc = ch_info->power_info[rate_idx].tpc; 1507 for (rate_idx = IWL_FIRST_OFDM_RATE, i = 0;
1505 txpower.power[rate_idx].rate = iwl_rates[rate_idx].plcp; 1508 rate_idx <= IWL_LAST_OFDM_RATE; rate_idx++, i++) {
1509
1510 txpower.power[i].tpc = ch_info->power_info[i].tpc;
1511 txpower.power[i].rate = iwl_rates[rate_idx].plcp;
1506 1512
1507 IWL_DEBUG_POWER("ch %d:%d rf %d dsp %3d rate code 0x%02x\n", 1513 IWL_DEBUG_POWER("ch %d:%d rf %d dsp %3d rate code 0x%02x\n",
1508 le16_to_cpu(txpower.channel), 1514 le16_to_cpu(txpower.channel),
1509 txpower.band, 1515 txpower.band,
1510 txpower.power[rate_idx].tpc.tx_gain, 1516 txpower.power[i].tpc.tx_gain,
1511 txpower.power[rate_idx].tpc.dsp_atten, 1517 txpower.power[i].tpc.dsp_atten,
1512 txpower.power[rate_idx].rate); 1518 txpower.power[i].rate);
1519 }
1520 /* Fill CCK rates */
1521 for (rate_idx = IWL_FIRST_CCK_RATE;
1522 rate_idx <= IWL_LAST_CCK_RATE; rate_idx++, i++) {
1523 txpower.power[i].tpc = ch_info->power_info[i].tpc;
1524 txpower.power[i].rate = iwl_rates[rate_idx].plcp;
1525
1526 IWL_DEBUG_POWER("ch %d:%d rf %d dsp %3d rate code 0x%02x\n",
1527 le16_to_cpu(txpower.channel),
1528 txpower.band,
1529 txpower.power[i].tpc.tx_gain,
1530 txpower.power[i].tpc.dsp_atten,
1531 txpower.power[i].rate);
1513 } 1532 }
1514 1533
1515 return iwl_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD, 1534 return iwl_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD,
1516 sizeof(struct iwl_txpowertable_cmd), &txpower); 1535 sizeof(struct iwl_txpowertable_cmd), &txpower);
1517 1536
1518} 1537}
1519 1538
@@ -1549,7 +1568,7 @@ static int iwl_hw_reg_set_new_power(struct iwl_priv *priv,
1549 power_info = ch_info->power_info; 1568 power_info = ch_info->power_info;
1550 1569
1551 /* update OFDM Txpower settings */ 1570 /* update OFDM Txpower settings */
1552 for (i = IWL_FIRST_OFDM_RATE; i <= IWL_LAST_OFDM_RATE; 1571 for (i = IWL_RATE_6M_INDEX_TABLE; i <= IWL_RATE_54M_INDEX_TABLE;
1553 i++, ++power_info) { 1572 i++, ++power_info) {
1554 int delta_idx; 1573 int delta_idx;
1555 1574
@@ -1573,14 +1592,14 @@ static int iwl_hw_reg_set_new_power(struct iwl_priv *priv,
1573 * ... all CCK power settings for a given channel are the *same*. */ 1592 * ... all CCK power settings for a given channel are the *same*. */
1574 if (power_changed) { 1593 if (power_changed) {
1575 power = 1594 power =
1576 ch_info->power_info[IWL_RATE_12M_INDEX]. 1595 ch_info->power_info[IWL_RATE_12M_INDEX_TABLE].
1577 requested_power + IWL_CCK_FROM_OFDM_POWER_DIFF; 1596 requested_power + IWL_CCK_FROM_OFDM_POWER_DIFF;
1578 1597
1579 /* do all CCK rates' iwl_channel_power_info structures */ 1598 /* do all CCK rates' iwl_channel_power_info structures */
1580 for (i = IWL_FIRST_CCK_RATE; i <= IWL_LAST_CCK_RATE; i++) { 1599 for (i = IWL_RATE_1M_INDEX_TABLE; i <= IWL_RATE_11M_INDEX_TABLE; i++) {
1581 power_info->requested_power = power; 1600 power_info->requested_power = power;
1582 power_info->base_power_index = 1601 power_info->base_power_index =
1583 ch_info->power_info[IWL_RATE_12M_INDEX]. 1602 ch_info->power_info[IWL_RATE_12M_INDEX_TABLE].
1584 base_power_index + IWL_CCK_FROM_OFDM_INDEX_DIFF; 1603 base_power_index + IWL_CCK_FROM_OFDM_INDEX_DIFF;
1585 ++power_info; 1604 ++power_info;
1586 } 1605 }
@@ -1674,7 +1693,7 @@ static int iwl_hw_reg_comp_txpower_temp(struct iwl_priv *priv)
1674 for (scan_tbl_index = 0; 1693 for (scan_tbl_index = 0;
1675 scan_tbl_index < IWL_NUM_SCAN_RATES; scan_tbl_index++) { 1694 scan_tbl_index < IWL_NUM_SCAN_RATES; scan_tbl_index++) {
1676 s32 actual_index = (scan_tbl_index == 0) ? 1695 s32 actual_index = (scan_tbl_index == 0) ?
1677 IWL_RATE_1M_INDEX : IWL_RATE_6M_INDEX; 1696 IWL_RATE_1M_INDEX_TABLE : IWL_RATE_6M_INDEX_TABLE;
1678 iwl_hw_reg_set_scan_power(priv, scan_tbl_index, 1697 iwl_hw_reg_set_scan_power(priv, scan_tbl_index,
1679 actual_index, clip_pwrs, 1698 actual_index, clip_pwrs,
1680 ch_info, a_band); 1699 ch_info, a_band);
@@ -1905,19 +1924,19 @@ static void iwl_hw_reg_init_channel_groups(struct iwl_priv *priv)
1905 for (rate_index = 0; 1924 for (rate_index = 0;
1906 rate_index < IWL_RATE_COUNT; rate_index++, clip_pwrs++) { 1925 rate_index < IWL_RATE_COUNT; rate_index++, clip_pwrs++) {
1907 switch (rate_index) { 1926 switch (rate_index) {
1908 case IWL_RATE_36M_INDEX: 1927 case IWL_RATE_36M_INDEX_TABLE:
1909 if (i == 0) /* B/G */ 1928 if (i == 0) /* B/G */
1910 *clip_pwrs = satur_pwr; 1929 *clip_pwrs = satur_pwr;
1911 else /* A */ 1930 else /* A */
1912 *clip_pwrs = satur_pwr - 5; 1931 *clip_pwrs = satur_pwr - 5;
1913 break; 1932 break;
1914 case IWL_RATE_48M_INDEX: 1933 case IWL_RATE_48M_INDEX_TABLE:
1915 if (i == 0) 1934 if (i == 0)
1916 *clip_pwrs = satur_pwr - 7; 1935 *clip_pwrs = satur_pwr - 7;
1917 else 1936 else
1918 *clip_pwrs = satur_pwr - 10; 1937 *clip_pwrs = satur_pwr - 10;
1919 break; 1938 break;
1920 case IWL_RATE_54M_INDEX: 1939 case IWL_RATE_54M_INDEX_TABLE:
1921 if (i == 0) 1940 if (i == 0)
1922 *clip_pwrs = satur_pwr - 9; 1941 *clip_pwrs = satur_pwr - 9;
1923 else 1942 else
@@ -2031,7 +2050,7 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv)
2031 } 2050 }
2032 2051
2033 /* set tx power for CCK rates, based on OFDM 12 Mbit settings*/ 2052 /* set tx power for CCK rates, based on OFDM 12 Mbit settings*/
2034 pwr_info = &ch_info->power_info[IWL_RATE_12M_INDEX]; 2053 pwr_info = &ch_info->power_info[IWL_RATE_12M_INDEX_TABLE];
2035 power = pwr_info->requested_power + 2054 power = pwr_info->requested_power +
2036 IWL_CCK_FROM_OFDM_POWER_DIFF; 2055 IWL_CCK_FROM_OFDM_POWER_DIFF;
2037 pwr_index = pwr_info->power_table_index + 2056 pwr_index = pwr_info->power_table_index +
@@ -2047,9 +2066,9 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv)
2047 /* fill each CCK rate's iwl_channel_power_info structure 2066 /* fill each CCK rate's iwl_channel_power_info structure
2048 * NOTE: All CCK-rate Txpwrs are the same for a given chnl! 2067 * NOTE: All CCK-rate Txpwrs are the same for a given chnl!
2049 * NOTE: CCK rates start at end of OFDM rates! */ 2068 * NOTE: CCK rates start at end of OFDM rates! */
2050 for (rate_index = IWL_OFDM_RATES; 2069 for (rate_index = 0;
2051 rate_index < IWL_RATE_COUNT; rate_index++) { 2070 rate_index < IWL_CCK_RATES; rate_index++) {
2052 pwr_info = &ch_info->power_info[rate_index]; 2071 pwr_info = &ch_info->power_info[rate_index+IWL_OFDM_RATES];
2053 pwr_info->requested_power = power; 2072 pwr_info->requested_power = power;
2054 pwr_info->power_table_index = pwr_index; 2073 pwr_info->power_table_index = pwr_index;
2055 pwr_info->base_power_index = base_pwr_index; 2074 pwr_info->base_power_index = base_pwr_index;
@@ -2061,7 +2080,7 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv)
2061 for (scan_tbl_index = 0; 2080 for (scan_tbl_index = 0;
2062 scan_tbl_index < IWL_NUM_SCAN_RATES; scan_tbl_index++) { 2081 scan_tbl_index < IWL_NUM_SCAN_RATES; scan_tbl_index++) {
2063 s32 actual_index = (scan_tbl_index == 0) ? 2082 s32 actual_index = (scan_tbl_index == 0) ?
2064 IWL_RATE_1M_INDEX : IWL_RATE_6M_INDEX; 2083 IWL_RATE_1M_INDEX_TABLE : IWL_RATE_6M_INDEX_TABLE;
2065 iwl_hw_reg_set_scan_power(priv, scan_tbl_index, 2084 iwl_hw_reg_set_scan_power(priv, scan_tbl_index,
2066 actual_index, clip_pwrs, ch_info, a_band); 2085 actual_index, clip_pwrs, ch_info, a_band);
2067 } 2086 }
@@ -2139,17 +2158,20 @@ int iwl_hw_get_rx_read(struct iwl_priv *priv)
2139 */ 2158 */
2140int iwl3945_init_hw_rate_table(struct iwl_priv *priv) 2159int iwl3945_init_hw_rate_table(struct iwl_priv *priv)
2141{ 2160{
2142 int rc, i; 2161 int rc, i, index, prev_index;
2143 struct iwl_rate_scaling_cmd rate_cmd = { 2162 struct iwl_rate_scaling_cmd rate_cmd = {
2144 .reserved = {0, 0, 0}, 2163 .reserved = {0, 0, 0},
2145 }; 2164 };
2146 struct iwl_rate_scaling_info *table = rate_cmd.table; 2165 struct iwl_rate_scaling_info *table = rate_cmd.table;
2147 2166
2148 for (i = 0; i < ARRAY_SIZE(iwl_rates); i++) { 2167 for (i = 0; i < ARRAY_SIZE(iwl_rates); i++) {
2149 table[i].rate_n_flags = 2168 index = iwl_rates[i].table_rs_index;
2169
2170 table[index].rate_n_flags =
2150 iwl_hw_set_rate_n_flags(iwl_rates[i].plcp, 0); 2171 iwl_hw_set_rate_n_flags(iwl_rates[i].plcp, 0);
2151 table[i].try_cnt = priv->retry_rate; 2172 table[index].try_cnt = priv->retry_rate;
2152 table[i].next_rate_index = iwl_get_prev_ieee_rate(i); 2173 prev_index = iwl_get_prev_ieee_rate(i);
2174 table[index].next_rate_index = iwl_rates[prev_index].table_rs_index;
2153 } 2175 }
2154 2176
2155 switch (priv->phymode) { 2177 switch (priv->phymode) {
@@ -2157,26 +2179,26 @@ int iwl3945_init_hw_rate_table(struct iwl_priv *priv)
2157 IWL_DEBUG_RATE("Select A mode rate scale\n"); 2179 IWL_DEBUG_RATE("Select A mode rate scale\n");
2158 /* If one of the following CCK rates is used, 2180 /* If one of the following CCK rates is used,
2159 * have it fall back to the 6M OFDM rate */ 2181 * have it fall back to the 6M OFDM rate */
2160 for (i = IWL_FIRST_CCK_RATE; i <= IWL_LAST_CCK_RATE; i++) 2182 for (i = IWL_RATE_1M_INDEX_TABLE; i <= IWL_RATE_11M_INDEX_TABLE; i++)
2161 table[i].next_rate_index = IWL_FIRST_OFDM_RATE; 2183 table[i].next_rate_index = iwl_rates[IWL_FIRST_OFDM_RATE].table_rs_index;
2162 2184
2163 /* Don't fall back to CCK rates */ 2185 /* Don't fall back to CCK rates */
2164 table[IWL_RATE_12M_INDEX].next_rate_index = IWL_RATE_9M_INDEX; 2186 table[IWL_RATE_12M_INDEX_TABLE].next_rate_index = IWL_RATE_9M_INDEX_TABLE;
2165 2187
2166 /* Don't drop out of OFDM rates */ 2188 /* Don't drop out of OFDM rates */
2167 table[IWL_FIRST_OFDM_RATE].next_rate_index = 2189 table[IWL_RATE_6M_INDEX_TABLE].next_rate_index =
2168 IWL_FIRST_OFDM_RATE; 2190 iwl_rates[IWL_FIRST_OFDM_RATE].table_rs_index;
2169 break; 2191 break;
2170 2192
2171 case MODE_IEEE80211B: 2193 case MODE_IEEE80211B:
2172 IWL_DEBUG_RATE("Select B mode rate scale\n"); 2194 IWL_DEBUG_RATE("Select B mode rate scale\n");
2173 /* If an OFDM rate is used, have it fall back to the 2195 /* If an OFDM rate is used, have it fall back to the
2174 * 1M CCK rates */ 2196 * 1M CCK rates */
2175 for (i = IWL_FIRST_OFDM_RATE; i <= IWL_LAST_OFDM_RATE; i++) 2197 for (i = IWL_RATE_6M_INDEX_TABLE; i <= IWL_RATE_54M_INDEX_TABLE; i++)
2176 table[i].next_rate_index = IWL_FIRST_CCK_RATE; 2198 table[i].next_rate_index = iwl_rates[IWL_FIRST_CCK_RATE].table_rs_index;
2177 2199
2178 /* CCK shouldn't fall back to OFDM... */ 2200 /* CCK shouldn't fall back to OFDM... */
2179 table[IWL_RATE_11M_INDEX].next_rate_index = IWL_RATE_5M_INDEX; 2201 table[IWL_RATE_11M_INDEX_TABLE].next_rate_index = IWL_RATE_5M_INDEX_TABLE;
2180 break; 2202 break;
2181 2203
2182 default: 2204 default:
@@ -2248,22 +2270,12 @@ unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv,
2248 tx_beacon_cmd->tx.tx_flags = (TX_CMD_FLG_SEQ_CTL_MSK | 2270 tx_beacon_cmd->tx.tx_flags = (TX_CMD_FLG_SEQ_CTL_MSK |
2249 TX_CMD_FLG_TSF_MSK); 2271 TX_CMD_FLG_TSF_MSK);
2250 2272
2251 /* supp_rates[0] == OFDM */ 2273 /* supp_rates[0] == OFDM start at IWL_FIRST_OFDM_RATE*/
2252 tx_beacon_cmd->tx.supp_rates[0] = IWL_OFDM_BASIC_RATES_MASK; 2274 tx_beacon_cmd->tx.supp_rates[0] =
2253 2275 (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF;
2254 /* supp_rates[1] == CCK 2276
2255 *
2256 * NOTE: IWL_*_RATES_MASK are not in the order that supp_rates
2257 * expects so we have to shift them around.
2258 *
2259 * supp_rates expects:
2260 * CCK rates are bit0..3
2261 *
2262 * However IWL_*_RATES_MASK has:
2263 * CCK rates are bit8..11
2264 */
2265 tx_beacon_cmd->tx.supp_rates[1] = 2277 tx_beacon_cmd->tx.supp_rates[1] =
2266 (IWL_CCK_BASIC_RATES_MASK >> 8) & 0xF; 2278 (IWL_CCK_BASIC_RATES_MASK & 0xF);
2267 2279
2268 return (sizeof(struct iwl_tx_beacon_cmd) + frame_size); 2280 return (sizeof(struct iwl_tx_beacon_cmd) + frame_size);
2269} 2281}