aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWey-Yi Guy <wey-yi.w.guy@intel.com>2010-09-04 12:00:14 -0400
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2010-09-11 11:52:23 -0400
commit743e015dcbb428bf8454cf7d78272b4a76dd3c4b (patch)
tree08a112aa0c2fc14d78bf814fdad12cec5dd2c6a7
parent8f1d968721f9b3d4ff364bef0f33eb9697a6a7ee (diff)
iwlwifi: remove code repetition
Move the duplicated code into single static function. Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-lib.c60
1 files changed, 28 insertions, 32 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index a8f2adfd799e..ec99a72edb76 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -46,6 +46,28 @@ static inline u32 iwlagn_get_scd_ssn(struct iwl5000_tx_resp *tx_resp)
46 tx_resp->frame_count) & MAX_SN; 46 tx_resp->frame_count) & MAX_SN;
47} 47}
48 48
49static void iwlagn_set_tx_status(struct iwl_priv *priv,
50 struct ieee80211_tx_info *info,
51 struct iwl5000_tx_resp *tx_resp,
52 int txq_id, bool is_agg)
53{
54 u16 status = le16_to_cpu(tx_resp->status.status);
55
56 info->status.rates[0].count = tx_resp->failure_frame + 1;
57 if (is_agg)
58 info->flags &= ~IEEE80211_TX_CTL_AMPDU;
59 info->flags |= iwl_tx_status_to_mac80211(status);
60 iwlagn_hwrate_to_tx_control(priv, le32_to_cpu(tx_resp->rate_n_flags),
61 info);
62
63 IWL_DEBUG_TX_REPLY(priv, "TXQ %d status %s (0x%08x) rate_n_flags "
64 "0x%x retries %d\n",
65 txq_id,
66 iwl_get_tx_fail_reason(status), status,
67 le32_to_cpu(tx_resp->rate_n_flags),
68 tx_resp->failure_frame);
69}
70
49static int iwlagn_tx_status_reply_tx(struct iwl_priv *priv, 71static int iwlagn_tx_status_reply_tx(struct iwl_priv *priv,
50 struct iwl_ht_agg *agg, 72 struct iwl_ht_agg *agg,
51 struct iwl5000_tx_resp *tx_resp, 73 struct iwl5000_tx_resp *tx_resp,
@@ -53,9 +75,7 @@ static int iwlagn_tx_status_reply_tx(struct iwl_priv *priv,
53{ 75{
54 u16 status; 76 u16 status;
55 struct agg_tx_status *frame_status = &tx_resp->status; 77 struct agg_tx_status *frame_status = &tx_resp->status;
56 struct ieee80211_tx_info *info = NULL;
57 struct ieee80211_hdr *hdr = NULL; 78 struct ieee80211_hdr *hdr = NULL;
58 u32 rate_n_flags = le32_to_cpu(tx_resp->rate_n_flags);
59 int i, sh, idx; 79 int i, sh, idx;
60 u16 seq; 80 u16 seq;
61 81
@@ -64,31 +84,20 @@ static int iwlagn_tx_status_reply_tx(struct iwl_priv *priv,
64 84
65 agg->frame_count = tx_resp->frame_count; 85 agg->frame_count = tx_resp->frame_count;
66 agg->start_idx = start_idx; 86 agg->start_idx = start_idx;
67 agg->rate_n_flags = rate_n_flags; 87 agg->rate_n_flags = le32_to_cpu(tx_resp->rate_n_flags);
68 agg->bitmap = 0; 88 agg->bitmap = 0;
69 89
70 /* # frames attempted by Tx command */ 90 /* # frames attempted by Tx command */
71 if (agg->frame_count == 1) { 91 if (agg->frame_count == 1) {
72 /* Only one frame was attempted; no block-ack will arrive */ 92 /* Only one frame was attempted; no block-ack will arrive */
73 status = le16_to_cpu(frame_status[0].status);
74 idx = start_idx; 93 idx = start_idx;
75 94
76 /* FIXME: code repetition */
77 IWL_DEBUG_TX_REPLY(priv, "FrameCnt = %d, StartIdx=%d idx=%d\n", 95 IWL_DEBUG_TX_REPLY(priv, "FrameCnt = %d, StartIdx=%d idx=%d\n",
78 agg->frame_count, agg->start_idx, idx); 96 agg->frame_count, agg->start_idx, idx);
79 97 iwlagn_set_tx_status(priv,
80 info = IEEE80211_SKB_CB(priv->txq[txq_id].txb[idx].skb); 98 IEEE80211_SKB_CB(
81 info->status.rates[0].count = tx_resp->failure_frame + 1; 99 priv->txq[txq_id].txb[idx].skb),
82 info->flags &= ~IEEE80211_TX_CTL_AMPDU; 100 tx_resp, txq_id, true);
83 info->flags |= iwl_tx_status_to_mac80211(status);
84 iwlagn_hwrate_to_tx_control(priv, rate_n_flags, info);
85
86 /* FIXME: code repetition end */
87
88 IWL_DEBUG_TX_REPLY(priv, "1 Frame 0x%x failure :%d\n",
89 status & 0xff, tx_resp->failure_frame);
90 IWL_DEBUG_TX_REPLY(priv, "Rate Info rate_n_flags=%x\n", rate_n_flags);
91
92 agg->wait_for_ba = 0; 101 agg->wait_for_ba = 0;
93 } else { 102 } else {
94 /* Two or more frames were attempted; expect block-ack */ 103 /* Two or more frames were attempted; expect block-ack */
@@ -281,20 +290,7 @@ static void iwlagn_rx_reply_tx(struct iwl_priv *priv,
281 } 290 }
282 } else { 291 } else {
283 BUG_ON(txq_id != txq->swq_id); 292 BUG_ON(txq_id != txq->swq_id);
284 293 iwlagn_set_tx_status(priv, info, tx_resp, txq_id, false);
285 info->status.rates[0].count = tx_resp->failure_frame + 1;
286 info->flags |= iwl_tx_status_to_mac80211(status);
287 iwlagn_hwrate_to_tx_control(priv,
288 le32_to_cpu(tx_resp->rate_n_flags),
289 info);
290
291 IWL_DEBUG_TX_REPLY(priv, "TXQ %d status %s (0x%08x) rate_n_flags "
292 "0x%x retries %d\n",
293 txq_id,
294 iwl_get_tx_fail_reason(status), status,
295 le32_to_cpu(tx_resp->rate_n_flags),
296 tx_resp->failure_frame);
297
298 freed = iwlagn_tx_queue_reclaim(priv, txq_id, index); 294 freed = iwlagn_tx_queue_reclaim(priv, txq_id, index);
299 iwl_free_tfds_in_queue(priv, sta_id, tid, freed); 295 iwl_free_tfds_in_queue(priv, sta_id, tid, freed);
300 296