diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-3945.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945.c | 86 |
1 files changed, 48 insertions, 38 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 8ccfcd08218d..5d09686c3389 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -245,7 +245,7 @@ int iwl3945_rs_next_rate(struct iwl_priv *priv, int rate) | |||
245 | break; | 245 | break; |
246 | case IEEE80211_BAND_2GHZ: | 246 | case IEEE80211_BAND_2GHZ: |
247 | if (!(priv->_3945.sta_supp_rates & IWL_OFDM_RATES_MASK) && | 247 | if (!(priv->_3945.sta_supp_rates & IWL_OFDM_RATES_MASK) && |
248 | iwl_is_associated(priv)) { | 248 | iwl_is_associated(priv, IWL_RXON_CTX_BSS)) { |
249 | if (rate == IWL_RATE_11M_INDEX) | 249 | if (rate == IWL_RATE_11M_INDEX) |
250 | next_rate = IWL_RATE_5M_INDEX; | 250 | next_rate = IWL_RATE_5M_INDEX; |
251 | } | 251 | } |
@@ -273,7 +273,7 @@ static void iwl3945_tx_queue_reclaim(struct iwl_priv *priv, | |||
273 | struct iwl_queue *q = &txq->q; | 273 | struct iwl_queue *q = &txq->q; |
274 | struct iwl_tx_info *tx_info; | 274 | struct iwl_tx_info *tx_info; |
275 | 275 | ||
276 | BUG_ON(txq_id == IWL_CMD_QUEUE_NUM); | 276 | BUG_ON(txq_id == IWL39_CMD_QUEUE_NUM); |
277 | 277 | ||
278 | for (index = iwl_queue_inc_wrap(index, q->n_bd); q->read_ptr != index; | 278 | for (index = iwl_queue_inc_wrap(index, q->n_bd); q->read_ptr != index; |
279 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { | 279 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { |
@@ -285,7 +285,7 @@ static void iwl3945_tx_queue_reclaim(struct iwl_priv *priv, | |||
285 | } | 285 | } |
286 | 286 | ||
287 | if (iwl_queue_space(q) > q->low_mark && (txq_id >= 0) && | 287 | if (iwl_queue_space(q) > q->low_mark && (txq_id >= 0) && |
288 | (txq_id != IWL_CMD_QUEUE_NUM) && | 288 | (txq_id != IWL39_CMD_QUEUE_NUM) && |
289 | priv->mac80211_registered) | 289 | priv->mac80211_registered) |
290 | iwl_wake_queue(priv, txq_id); | 290 | iwl_wake_queue(priv, txq_id); |
291 | } | 291 | } |
@@ -760,7 +760,7 @@ void iwl3945_hw_build_tx_cmd_rate(struct iwl_priv *priv, | |||
760 | data_retry_limit = IWL_DEFAULT_TX_RETRY; | 760 | data_retry_limit = IWL_DEFAULT_TX_RETRY; |
761 | tx_cmd->data_retry_limit = data_retry_limit; | 761 | tx_cmd->data_retry_limit = data_retry_limit; |
762 | 762 | ||
763 | if (tx_id >= IWL_CMD_QUEUE_NUM) | 763 | if (tx_id >= IWL39_CMD_QUEUE_NUM) |
764 | rts_retry_limit = 3; | 764 | rts_retry_limit = 3; |
765 | else | 765 | else |
766 | rts_retry_limit = 7; | 766 | rts_retry_limit = 7; |
@@ -909,7 +909,7 @@ static int iwl3945_txq_ctx_reset(struct iwl_priv *priv) | |||
909 | 909 | ||
910 | /* Tx queue(s) */ | 910 | /* Tx queue(s) */ |
911 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { | 911 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { |
912 | slots_num = (txq_id == IWL_CMD_QUEUE_NUM) ? | 912 | slots_num = (txq_id == IWL39_CMD_QUEUE_NUM) ? |
913 | TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; | 913 | TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; |
914 | rc = iwl_tx_queue_init(priv, &priv->txq[txq_id], slots_num, | 914 | rc = iwl_tx_queue_init(priv, &priv->txq[txq_id], slots_num, |
915 | txq_id); | 915 | txq_id); |
@@ -1072,7 +1072,7 @@ void iwl3945_hw_txq_ctx_free(struct iwl_priv *priv) | |||
1072 | if (priv->txq) | 1072 | if (priv->txq) |
1073 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; | 1073 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; |
1074 | txq_id++) | 1074 | txq_id++) |
1075 | if (txq_id == IWL_CMD_QUEUE_NUM) | 1075 | if (txq_id == IWL39_CMD_QUEUE_NUM) |
1076 | iwl_cmd_queue_free(priv); | 1076 | iwl_cmd_queue_free(priv); |
1077 | else | 1077 | else |
1078 | iwl_tx_queue_free(priv, txq_id); | 1078 | iwl_tx_queue_free(priv, txq_id); |
@@ -1439,17 +1439,18 @@ static int iwl3945_send_tx_power(struct iwl_priv *priv) | |||
1439 | int rate_idx, i; | 1439 | int rate_idx, i; |
1440 | const struct iwl_channel_info *ch_info = NULL; | 1440 | const struct iwl_channel_info *ch_info = NULL; |
1441 | struct iwl3945_txpowertable_cmd txpower = { | 1441 | struct iwl3945_txpowertable_cmd txpower = { |
1442 | .channel = priv->active_rxon.channel, | 1442 | .channel = priv->contexts[IWL_RXON_CTX_BSS].active.channel, |
1443 | }; | 1443 | }; |
1444 | u16 chan; | ||
1445 | |||
1446 | chan = le16_to_cpu(priv->contexts[IWL_RXON_CTX_BSS].active.channel); | ||
1444 | 1447 | ||
1445 | txpower.band = (priv->band == IEEE80211_BAND_5GHZ) ? 0 : 1; | 1448 | txpower.band = (priv->band == IEEE80211_BAND_5GHZ) ? 0 : 1; |
1446 | ch_info = iwl_get_channel_info(priv, | 1449 | ch_info = iwl_get_channel_info(priv, priv->band, chan); |
1447 | priv->band, | ||
1448 | le16_to_cpu(priv->active_rxon.channel)); | ||
1449 | if (!ch_info) { | 1450 | if (!ch_info) { |
1450 | IWL_ERR(priv, | 1451 | IWL_ERR(priv, |
1451 | "Failed to get channel info for channel %d [%d]\n", | 1452 | "Failed to get channel info for channel %d [%d]\n", |
1452 | le16_to_cpu(priv->active_rxon.channel), priv->band); | 1453 | chan, priv->band); |
1453 | return -EINVAL; | 1454 | return -EINVAL; |
1454 | } | 1455 | } |
1455 | 1456 | ||
@@ -1710,7 +1711,8 @@ int iwl3945_hw_reg_set_txpower(struct iwl_priv *priv, s8 power) | |||
1710 | return 0; | 1711 | return 0; |
1711 | } | 1712 | } |
1712 | 1713 | ||
1713 | static int iwl3945_send_rxon_assoc(struct iwl_priv *priv) | 1714 | static int iwl3945_send_rxon_assoc(struct iwl_priv *priv, |
1715 | struct iwl_rxon_context *ctx) | ||
1714 | { | 1716 | { |
1715 | int rc = 0; | 1717 | int rc = 0; |
1716 | struct iwl_rx_packet *pkt; | 1718 | struct iwl_rx_packet *pkt; |
@@ -1721,8 +1723,8 @@ static int iwl3945_send_rxon_assoc(struct iwl_priv *priv) | |||
1721 | .flags = CMD_WANT_SKB, | 1723 | .flags = CMD_WANT_SKB, |
1722 | .data = &rxon_assoc, | 1724 | .data = &rxon_assoc, |
1723 | }; | 1725 | }; |
1724 | const struct iwl_rxon_cmd *rxon1 = &priv->staging_rxon; | 1726 | const struct iwl_rxon_cmd *rxon1 = &ctx->staging; |
1725 | const struct iwl_rxon_cmd *rxon2 = &priv->active_rxon; | 1727 | const struct iwl_rxon_cmd *rxon2 = &ctx->active; |
1726 | 1728 | ||
1727 | if ((rxon1->flags == rxon2->flags) && | 1729 | if ((rxon1->flags == rxon2->flags) && |
1728 | (rxon1->filter_flags == rxon2->filter_flags) && | 1730 | (rxon1->filter_flags == rxon2->filter_flags) && |
@@ -1732,10 +1734,10 @@ static int iwl3945_send_rxon_assoc(struct iwl_priv *priv) | |||
1732 | return 0; | 1734 | return 0; |
1733 | } | 1735 | } |
1734 | 1736 | ||
1735 | rxon_assoc.flags = priv->staging_rxon.flags; | 1737 | rxon_assoc.flags = ctx->staging.flags; |
1736 | rxon_assoc.filter_flags = priv->staging_rxon.filter_flags; | 1738 | rxon_assoc.filter_flags = ctx->staging.filter_flags; |
1737 | rxon_assoc.ofdm_basic_rates = priv->staging_rxon.ofdm_basic_rates; | 1739 | rxon_assoc.ofdm_basic_rates = ctx->staging.ofdm_basic_rates; |
1738 | rxon_assoc.cck_basic_rates = priv->staging_rxon.cck_basic_rates; | 1740 | rxon_assoc.cck_basic_rates = ctx->staging.cck_basic_rates; |
1739 | rxon_assoc.reserved = 0; | 1741 | rxon_assoc.reserved = 0; |
1740 | 1742 | ||
1741 | rc = iwl_send_cmd_sync(priv, &cmd); | 1743 | rc = iwl_send_cmd_sync(priv, &cmd); |
@@ -1761,14 +1763,14 @@ static int iwl3945_send_rxon_assoc(struct iwl_priv *priv) | |||
1761 | * function correctly transitions out of the RXON_ASSOC_MSK state if | 1763 | * function correctly transitions out of the RXON_ASSOC_MSK state if |
1762 | * a HW tune is required based on the RXON structure changes. | 1764 | * a HW tune is required based on the RXON structure changes. |
1763 | */ | 1765 | */ |
1764 | static int iwl3945_commit_rxon(struct iwl_priv *priv) | 1766 | static int iwl3945_commit_rxon(struct iwl_priv *priv, |
1767 | struct iwl_rxon_context *ctx) | ||
1765 | { | 1768 | { |
1766 | /* cast away the const for active_rxon in this function */ | 1769 | /* cast away the const for active_rxon in this function */ |
1767 | struct iwl3945_rxon_cmd *active_rxon = (void *)&priv->active_rxon; | 1770 | struct iwl3945_rxon_cmd *active_rxon = (void *)&ctx->active; |
1768 | struct iwl3945_rxon_cmd *staging_rxon = (void *)&priv->staging_rxon; | 1771 | struct iwl3945_rxon_cmd *staging_rxon = (void *)&ctx->staging; |
1769 | int rc = 0; | 1772 | int rc = 0; |
1770 | bool new_assoc = | 1773 | bool new_assoc = !!(staging_rxon->filter_flags & RXON_FILTER_ASSOC_MSK); |
1771 | !!(priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK); | ||
1772 | 1774 | ||
1773 | if (!iwl_is_alive(priv)) | 1775 | if (!iwl_is_alive(priv)) |
1774 | return -1; | 1776 | return -1; |
@@ -1781,7 +1783,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv) | |||
1781 | ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK); | 1783 | ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK); |
1782 | staging_rxon->flags |= iwl3945_get_antenna_flags(priv); | 1784 | staging_rxon->flags |= iwl3945_get_antenna_flags(priv); |
1783 | 1785 | ||
1784 | rc = iwl_check_rxon_cmd(priv); | 1786 | rc = iwl_check_rxon_cmd(priv, ctx); |
1785 | if (rc) { | 1787 | if (rc) { |
1786 | IWL_ERR(priv, "Invalid RXON configuration. Not committing.\n"); | 1788 | IWL_ERR(priv, "Invalid RXON configuration. Not committing.\n"); |
1787 | return -EINVAL; | 1789 | return -EINVAL; |
@@ -1790,8 +1792,9 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv) | |||
1790 | /* If we don't need to send a full RXON, we can use | 1792 | /* If we don't need to send a full RXON, we can use |
1791 | * iwl3945_rxon_assoc_cmd which is used to reconfigure filter | 1793 | * iwl3945_rxon_assoc_cmd which is used to reconfigure filter |
1792 | * and other flags for the current radio configuration. */ | 1794 | * and other flags for the current radio configuration. */ |
1793 | if (!iwl_full_rxon_required(priv)) { | 1795 | if (!iwl_full_rxon_required(priv, &priv->contexts[IWL_RXON_CTX_BSS])) { |
1794 | rc = iwl_send_rxon_assoc(priv); | 1796 | rc = iwl_send_rxon_assoc(priv, |
1797 | &priv->contexts[IWL_RXON_CTX_BSS]); | ||
1795 | if (rc) { | 1798 | if (rc) { |
1796 | IWL_ERR(priv, "Error setting RXON_ASSOC " | 1799 | IWL_ERR(priv, "Error setting RXON_ASSOC " |
1797 | "configuration (%d).\n", rc); | 1800 | "configuration (%d).\n", rc); |
@@ -1807,7 +1810,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv) | |||
1807 | * an RXON_ASSOC and the new config wants the associated mask enabled, | 1810 | * an RXON_ASSOC and the new config wants the associated mask enabled, |
1808 | * we must clear the associated from the active configuration | 1811 | * we must clear the associated from the active configuration |
1809 | * before we apply the new config */ | 1812 | * before we apply the new config */ |
1810 | if (iwl_is_associated(priv) && new_assoc) { | 1813 | if (iwl_is_associated(priv, IWL_RXON_CTX_BSS) && new_assoc) { |
1811 | IWL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n"); | 1814 | IWL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n"); |
1812 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 1815 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
1813 | 1816 | ||
@@ -1819,7 +1822,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv) | |||
1819 | active_rxon->reserved5 = 0; | 1822 | active_rxon->reserved5 = 0; |
1820 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON, | 1823 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON, |
1821 | sizeof(struct iwl3945_rxon_cmd), | 1824 | sizeof(struct iwl3945_rxon_cmd), |
1822 | &priv->active_rxon); | 1825 | &priv->contexts[IWL_RXON_CTX_BSS].active); |
1823 | 1826 | ||
1824 | /* If the mask clearing failed then we set | 1827 | /* If the mask clearing failed then we set |
1825 | * active_rxon back to what it was previously */ | 1828 | * active_rxon back to what it was previously */ |
@@ -1829,8 +1832,9 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv) | |||
1829 | "configuration (%d).\n", rc); | 1832 | "configuration (%d).\n", rc); |
1830 | return rc; | 1833 | return rc; |
1831 | } | 1834 | } |
1832 | iwl_clear_ucode_stations(priv); | 1835 | iwl_clear_ucode_stations(priv, |
1833 | iwl_restore_stations(priv); | 1836 | &priv->contexts[IWL_RXON_CTX_BSS]); |
1837 | iwl_restore_stations(priv, &priv->contexts[IWL_RXON_CTX_BSS]); | ||
1834 | } | 1838 | } |
1835 | 1839 | ||
1836 | IWL_DEBUG_INFO(priv, "Sending RXON\n" | 1840 | IWL_DEBUG_INFO(priv, "Sending RXON\n" |
@@ -1848,7 +1852,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv) | |||
1848 | staging_rxon->reserved4 = 0; | 1852 | staging_rxon->reserved4 = 0; |
1849 | staging_rxon->reserved5 = 0; | 1853 | staging_rxon->reserved5 = 0; |
1850 | 1854 | ||
1851 | iwl_set_rxon_hwcrypto(priv, !iwl3945_mod_params.sw_crypto); | 1855 | iwl_set_rxon_hwcrypto(priv, ctx, !iwl3945_mod_params.sw_crypto); |
1852 | 1856 | ||
1853 | /* Apply the new configuration */ | 1857 | /* Apply the new configuration */ |
1854 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON, | 1858 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON, |
@@ -1862,8 +1866,9 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv) | |||
1862 | memcpy(active_rxon, staging_rxon, sizeof(*active_rxon)); | 1866 | memcpy(active_rxon, staging_rxon, sizeof(*active_rxon)); |
1863 | 1867 | ||
1864 | if (!new_assoc) { | 1868 | if (!new_assoc) { |
1865 | iwl_clear_ucode_stations(priv); | 1869 | iwl_clear_ucode_stations(priv, |
1866 | iwl_restore_stations(priv); | 1870 | &priv->contexts[IWL_RXON_CTX_BSS]); |
1871 | iwl_restore_stations(priv, &priv->contexts[IWL_RXON_CTX_BSS]); | ||
1867 | } | 1872 | } |
1868 | 1873 | ||
1869 | /* If we issue a new RXON command which required a tune then we must | 1874 | /* If we issue a new RXON command which required a tune then we must |
@@ -2302,8 +2307,10 @@ static int iwl3945_manage_ibss_station(struct iwl_priv *priv, | |||
2302 | int ret; | 2307 | int ret; |
2303 | 2308 | ||
2304 | if (add) { | 2309 | if (add) { |
2305 | ret = iwl_add_bssid_station(priv, vif->bss_conf.bssid, false, | 2310 | ret = iwl_add_bssid_station( |
2306 | &vif_priv->ibss_bssid_sta_id); | 2311 | priv, &priv->contexts[IWL_RXON_CTX_BSS], |
2312 | vif->bss_conf.bssid, false, | ||
2313 | &vif_priv->ibss_bssid_sta_id); | ||
2307 | if (ret) | 2314 | if (ret) |
2308 | return ret; | 2315 | return ret; |
2309 | 2316 | ||
@@ -2366,7 +2373,7 @@ int iwl3945_init_hw_rate_table(struct iwl_priv *priv) | |||
2366 | * 1M CCK rates */ | 2373 | * 1M CCK rates */ |
2367 | 2374 | ||
2368 | if (!(priv->_3945.sta_supp_rates & IWL_OFDM_RATES_MASK) && | 2375 | if (!(priv->_3945.sta_supp_rates & IWL_OFDM_RATES_MASK) && |
2369 | iwl_is_associated(priv)) { | 2376 | iwl_is_associated(priv, IWL_RXON_CTX_BSS)) { |
2370 | 2377 | ||
2371 | index = IWL_FIRST_CCK_RATE; | 2378 | index = IWL_FIRST_CCK_RATE; |
2372 | for (i = IWL_RATE_6M_INDEX_TABLE; | 2379 | for (i = IWL_RATE_6M_INDEX_TABLE; |
@@ -2421,7 +2428,9 @@ int iwl3945_hw_set_hw_params(struct iwl_priv *priv) | |||
2421 | priv->hw_params.max_rxq_size = RX_QUEUE_SIZE; | 2428 | priv->hw_params.max_rxq_size = RX_QUEUE_SIZE; |
2422 | priv->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG; | 2429 | priv->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG; |
2423 | priv->hw_params.max_stations = IWL3945_STATION_COUNT; | 2430 | priv->hw_params.max_stations = IWL3945_STATION_COUNT; |
2424 | priv->hw_params.bcast_sta_id = IWL3945_BROADCAST_ID; | 2431 | priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWL3945_BROADCAST_ID; |
2432 | |||
2433 | priv->sta_key_max_num = STA_KEY_MAX_NUM; | ||
2425 | 2434 | ||
2426 | priv->hw_params.rx_wrt_ptr_reg = FH39_RSCSR_CHNL0_WPTR; | 2435 | priv->hw_params.rx_wrt_ptr_reg = FH39_RSCSR_CHNL0_WPTR; |
2427 | priv->hw_params.max_beacon_itrvl = IWL39_MAX_UCODE_BEACON_INTERVAL; | 2436 | priv->hw_params.max_beacon_itrvl = IWL39_MAX_UCODE_BEACON_INTERVAL; |
@@ -2439,7 +2448,8 @@ unsigned int iwl3945_hw_get_beacon_cmd(struct iwl_priv *priv, | |||
2439 | tx_beacon_cmd = (struct iwl3945_tx_beacon_cmd *)&frame->u; | 2448 | tx_beacon_cmd = (struct iwl3945_tx_beacon_cmd *)&frame->u; |
2440 | memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); | 2449 | memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); |
2441 | 2450 | ||
2442 | tx_beacon_cmd->tx.sta_id = priv->hw_params.bcast_sta_id; | 2451 | tx_beacon_cmd->tx.sta_id = |
2452 | priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id; | ||
2443 | tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; | 2453 | tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; |
2444 | 2454 | ||
2445 | frame_size = iwl3945_fill_beacon_frame(priv, | 2455 | frame_size = iwl3945_fill_beacon_frame(priv, |