aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-4965.c
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2008-01-14 20:46:16 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:09:55 -0500
commit87e4f7dfe56dbaa5470e047d991c077f8e479d21 (patch)
tree6530bc77e065ef1fa281c3f675406d56fe3e21cb /drivers/net/wireless/iwlwifi/iwl-4965.c
parent6a218f6f3b1679c3f12c487131f0be5b2841bfbe (diff)
iwlwifi: remove iwl4965_tx_cmd
This patch removes iwl4965_tx_cmd function and splits its content to iwl4965_hw_build_tx_cmd_rate, iwl4965_build_tx_cmd_basic, and iwl4965_tl_get_stats function. The latest one will be deprecated when traffic load will move to rate scale module. Signed-off-by: Tomas Winkler <tomas.winkler@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-4965.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c112
1 files changed, 36 insertions, 76 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index a94578889e17..e6a0397266fc 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -2673,19 +2673,23 @@ void iwl4965_hw_build_tx_cmd_rate(struct iwl4965_priv *priv,
2673 struct ieee80211_hdr *hdr, int sta_id, 2673 struct ieee80211_hdr *hdr, int sta_id,
2674 int is_hcca) 2674 int is_hcca)
2675{ 2675{
2676 u8 rate; 2676 struct iwl4965_tx_cmd *tx = &cmd->cmd.tx;
2677 u8 rts_retry_limit = 0; 2677 u8 rts_retry_limit = 0;
2678 u8 data_retry_limit = 0; 2678 u8 data_retry_limit = 0;
2679 __le32 tx_flags;
2680 u16 fc = le16_to_cpu(hdr->frame_control); 2679 u16 fc = le16_to_cpu(hdr->frame_control);
2680 u8 rate_plcp;
2681 u16 rate_flags = 0;
2682 int rate_idx = min(ctrl->tx_rate & 0xffff, IWL_RATE_COUNT - 1);
2681 2683
2682 tx_flags = cmd->cmd.tx.tx_flags; 2684 rate_plcp = iwl4965_rates[rate_idx].plcp;
2683
2684 rate = iwl4965_rates[ctrl->tx_rate].plcp;
2685 2685
2686 rts_retry_limit = (is_hcca) ? 2686 rts_retry_limit = (is_hcca) ?
2687 RTS_HCCA_RETRY_LIMIT : RTS_DFAULT_RETRY_LIMIT; 2687 RTS_HCCA_RETRY_LIMIT : RTS_DFAULT_RETRY_LIMIT;
2688 2688
2689 if ((rate_idx >= IWL_FIRST_CCK_RATE) && (rate_idx <= IWL_LAST_CCK_RATE))
2690 rate_flags |= RATE_MCS_CCK_MSK;
2691
2692
2689 if (ieee80211_is_probe_response(fc)) { 2693 if (ieee80211_is_probe_response(fc)) {
2690 data_retry_limit = 3; 2694 data_retry_limit = 3;
2691 if (data_retry_limit < rts_retry_limit) 2695 if (data_retry_limit < rts_retry_limit)
@@ -2696,26 +2700,38 @@ void iwl4965_hw_build_tx_cmd_rate(struct iwl4965_priv *priv,
2696 if (priv->data_retry_limit != -1) 2700 if (priv->data_retry_limit != -1)
2697 data_retry_limit = priv->data_retry_limit; 2701 data_retry_limit = priv->data_retry_limit;
2698 2702
2699 if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) { 2703
2704 if (ieee80211_is_data(fc)) {
2705 tx->initial_rate_index = 0;
2706 tx->tx_flags |= TX_CMD_FLG_STA_RATE_MSK;
2707 } else {
2700 switch (fc & IEEE80211_FCTL_STYPE) { 2708 switch (fc & IEEE80211_FCTL_STYPE) {
2701 case IEEE80211_STYPE_AUTH: 2709 case IEEE80211_STYPE_AUTH:
2702 case IEEE80211_STYPE_DEAUTH: 2710 case IEEE80211_STYPE_DEAUTH:
2703 case IEEE80211_STYPE_ASSOC_REQ: 2711 case IEEE80211_STYPE_ASSOC_REQ:
2704 case IEEE80211_STYPE_REASSOC_REQ: 2712 case IEEE80211_STYPE_REASSOC_REQ:
2705 if (tx_flags & TX_CMD_FLG_RTS_MSK) { 2713 if (tx->tx_flags & TX_CMD_FLG_RTS_MSK) {
2706 tx_flags &= ~TX_CMD_FLG_RTS_MSK; 2714 tx->tx_flags &= ~TX_CMD_FLG_RTS_MSK;
2707 tx_flags |= TX_CMD_FLG_CTS_MSK; 2715 tx->tx_flags |= TX_CMD_FLG_CTS_MSK;
2708 } 2716 }
2709 break; 2717 break;
2710 default: 2718 default:
2711 break; 2719 break;
2712 } 2720 }
2721
2722 /* Alternate between antenna A and B for successive frames */
2723 if (priv->use_ant_b_for_management_frame) {
2724 priv->use_ant_b_for_management_frame = 0;
2725 rate_flags |= RATE_MCS_ANT_B_MSK;
2726 } else {
2727 priv->use_ant_b_for_management_frame = 1;
2728 rate_flags |= RATE_MCS_ANT_A_MSK;
2729 }
2713 } 2730 }
2714 2731
2715 cmd->cmd.tx.rts_retry_limit = rts_retry_limit; 2732 tx->rts_retry_limit = rts_retry_limit;
2716 cmd->cmd.tx.data_retry_limit = data_retry_limit; 2733 tx->data_retry_limit = data_retry_limit;
2717 cmd->cmd.tx.rate_n_flags = iwl4965_hw_set_rate_n_flags(rate, 0); 2734 tx->rate_n_flags = iwl4965_hw_set_rate_n_flags(rate_plcp, rate_flags);
2718 cmd->cmd.tx.tx_flags = tx_flags;
2719} 2735}
2720 2736
2721int iwl4965_hw_get_rx_read(struct iwl4965_priv *priv) 2737int iwl4965_hw_get_rx_read(struct iwl4965_priv *priv)
@@ -3254,69 +3270,13 @@ static void iwl4965_bg_agg_work(struct work_struct *work)
3254 spin_unlock_irqrestore(&priv->lq_mngr.lock, flags); 3270 spin_unlock_irqrestore(&priv->lq_mngr.lock, flags);
3255 return; 3271 return;
3256} 3272}
3257#endif /*CONFIG_IWL4965_HT_AGG */
3258#endif /* CONFIG_IWL4965_HT */
3259 3273
3260int iwl4965_tx_cmd(struct iwl4965_priv *priv, struct iwl4965_cmd *out_cmd, 3274/* TODO: move this functionality to rate scaling */
3261 u8 sta_id, dma_addr_t txcmd_phys, 3275void iwl4965_tl_get_stats(struct iwl4965_priv *priv,
3262 struct ieee80211_hdr *hdr, u8 hdr_len, 3276 struct ieee80211_hdr *hdr)
3263 struct ieee80211_tx_control *ctrl, void *sta_in)
3264{ 3277{
3265 struct iwl4965_tx_cmd *tx = &out_cmd->cmd.tx; 3278 __le16 *qc = ieee80211_get_qos_ctrl(hdr);
3266 dma_addr_t scratch_phys;
3267 u8 unicast = 0;
3268 u8 is_data = 1;
3269 u16 fc;
3270 u16 rate_flags;
3271 int rate_index = min(ctrl->tx_rate & 0xffff, IWL_RATE_COUNT - 1);
3272#ifdef CONFIG_IWL4965_HT
3273#ifdef CONFIG_IWL4965_HT_AGG
3274 __le16 *qc;
3275#endif /*CONFIG_IWL4965_HT_AGG */
3276#endif /* CONFIG_IWL4965_HT */
3277
3278 unicast = !is_multicast_ether_addr(hdr->addr1);
3279
3280 fc = le16_to_cpu(hdr->frame_control);
3281 if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA)
3282 is_data = 0;
3283 3279
3284 scratch_phys = txcmd_phys + sizeof(struct iwl4965_cmd_header) +
3285 offsetof(struct iwl4965_tx_cmd, scratch);
3286 tx->dram_lsb_ptr = cpu_to_le32(scratch_phys);
3287 tx->dram_msb_ptr = iwl_get_dma_hi_address(scratch_phys);
3288
3289 /* Hard coded to start at the highest retry fallback position
3290 * until the 4965 specific rate control algorithm is tied in */
3291 tx->initial_rate_index = LINK_QUAL_MAX_RETRY_NUM - 1;
3292
3293 /* Alternate between antenna A and B for successive frames */
3294 if (priv->use_ant_b_for_management_frame) {
3295 priv->use_ant_b_for_management_frame = 0;
3296 rate_flags = RATE_MCS_ANT_B_MSK;
3297 } else {
3298 priv->use_ant_b_for_management_frame = 1;
3299 rate_flags = RATE_MCS_ANT_A_MSK;
3300 }
3301
3302 if (!unicast || !is_data) {
3303 if ((rate_index >= IWL_FIRST_CCK_RATE) &&
3304 (rate_index <= IWL_LAST_CCK_RATE))
3305 rate_flags |= RATE_MCS_CCK_MSK;
3306 } else {
3307 tx->initial_rate_index = 0;
3308 tx->tx_flags |= TX_CMD_FLG_STA_RATE_MSK;
3309 }
3310
3311 tx->rate_n_flags = iwl4965_hw_set_rate_n_flags(iwl4965_rates[rate_index].plcp,
3312 rate_flags);
3313
3314 if (ieee80211_is_back_request(fc))
3315 tx->tx_flags |= TX_CMD_FLG_ACK_MSK |
3316 TX_CMD_FLG_IMM_BA_RSP_MASK;
3317#ifdef CONFIG_IWL4965_HT
3318#ifdef CONFIG_IWL4965_HT_AGG
3319 qc = ieee80211_get_qos_ctrl(hdr);
3320 if (qc && 3280 if (qc &&
3321 (priv->iw_mode != IEEE80211_IF_TYPE_IBSS)) { 3281 (priv->iw_mode != IEEE80211_IF_TYPE_IBSS)) {
3322 u8 tid = 0; 3282 u8 tid = 0;
@@ -3334,11 +3294,11 @@ int iwl4965_tx_cmd(struct iwl4965_priv *priv, struct iwl4965_cmd *out_cmd,
3334 spin_unlock_irqrestore(&priv->lq_mngr.lock, flags); 3294 spin_unlock_irqrestore(&priv->lq_mngr.lock, flags);
3335 schedule_work(&priv->agg_work); 3295 schedule_work(&priv->agg_work);
3336 } 3296 }
3337#endif
3338#endif
3339 return 0;
3340} 3297}
3341 3298
3299#endif /*CONFIG_IWL4965_HT_AGG */
3300#endif /* CONFIG_IWL4965_HT */
3301
3342/** 3302/**
3343 * sign_extend - Sign extend a value using specified bit as sign-bit 3303 * sign_extend - Sign extend a value using specified bit as sign-bit
3344 * 3304 *