diff options
author | Johannes Berg <johannes.berg@intel.com> | 2012-03-05 14:24:37 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-03-06 15:16:12 -0500 |
commit | 2c6ab7ff8fa9af22a2a616656da6e5a0567da285 (patch) | |
tree | 17efee9f66384e3fd718f015cd9f5c7c91e12f11 | |
parent | 15b86bff995525a38126eb44a951765a57ea2f4c (diff) |
iwlwifi: use ieee80211_tx_status
We currently use the _irqsafe version, but that
isn't recommended together with ieee80211_rx()
as it can cause races. If the device reports
a TX-status and RX in that order then with the
current combination mac80211 might process them
in the other order, which can cause issues with
powersaving clients.
Use ieee80211_tx_status() to avoid this race.
Since we don't want to call it with locks held,
process the frame queues later -- this is fine
as they are on the stack.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-tx.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c index e5ebc36a14c..1914bee1891 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c | |||
@@ -1007,6 +1007,8 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb, | |||
1007 | if (is_agg) | 1007 | if (is_agg) |
1008 | iwl_rx_reply_tx_agg(priv, tx_resp); | 1008 | iwl_rx_reply_tx_agg(priv, tx_resp); |
1009 | 1009 | ||
1010 | __skb_queue_head_init(&skbs); | ||
1011 | |||
1010 | if (tx_resp->frame_count == 1) { | 1012 | if (tx_resp->frame_count == 1) { |
1011 | u16 next_reclaimed = le16_to_cpu(tx_resp->seq_ctl); | 1013 | u16 next_reclaimed = le16_to_cpu(tx_resp->seq_ctl); |
1012 | next_reclaimed = SEQ_TO_SN(next_reclaimed + 0x10); | 1014 | next_reclaimed = SEQ_TO_SN(next_reclaimed + 0x10); |
@@ -1026,8 +1028,6 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb, | |||
1026 | next_reclaimed = ssn; | 1028 | next_reclaimed = ssn; |
1027 | } | 1029 | } |
1028 | 1030 | ||
1029 | __skb_queue_head_init(&skbs); | ||
1030 | |||
1031 | if (tid != IWL_TID_NON_QOS) { | 1031 | if (tid != IWL_TID_NON_QOS) { |
1032 | priv->tid_data[sta_id][tid].next_reclaimed = | 1032 | priv->tid_data[sta_id][tid].next_reclaimed = |
1033 | next_reclaimed; | 1033 | next_reclaimed; |
@@ -1040,8 +1040,9 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb, | |||
1040 | ssn, status, &skbs)); | 1040 | ssn, status, &skbs)); |
1041 | iwlagn_check_ratid_empty(priv, sta_id, tid); | 1041 | iwlagn_check_ratid_empty(priv, sta_id, tid); |
1042 | freed = 0; | 1042 | freed = 0; |
1043 | while (!skb_queue_empty(&skbs)) { | 1043 | |
1044 | skb = __skb_dequeue(&skbs); | 1044 | /* process frames */ |
1045 | skb_queue_walk(&skbs, skb) { | ||
1045 | hdr = (struct ieee80211_hdr *)skb->data; | 1046 | hdr = (struct ieee80211_hdr *)skb->data; |
1046 | 1047 | ||
1047 | if (!ieee80211_is_data_qos(hdr->frame_control)) | 1048 | if (!ieee80211_is_data_qos(hdr->frame_control)) |
@@ -1083,8 +1084,6 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb, | |||
1083 | if (!is_agg) | 1084 | if (!is_agg) |
1084 | iwlagn_non_agg_tx_status(priv, ctx, hdr->addr1); | 1085 | iwlagn_non_agg_tx_status(priv, ctx, hdr->addr1); |
1085 | 1086 | ||
1086 | ieee80211_tx_status_irqsafe(priv->hw, skb); | ||
1087 | |||
1088 | freed++; | 1087 | freed++; |
1089 | } | 1088 | } |
1090 | 1089 | ||
@@ -1093,6 +1092,12 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb, | |||
1093 | 1092 | ||
1094 | iwl_check_abort_status(priv, tx_resp->frame_count, status); | 1093 | iwl_check_abort_status(priv, tx_resp->frame_count, status); |
1095 | spin_unlock(&priv->sta_lock); | 1094 | spin_unlock(&priv->sta_lock); |
1095 | |||
1096 | while (!skb_queue_empty(&skbs)) { | ||
1097 | skb = __skb_dequeue(&skbs); | ||
1098 | ieee80211_tx_status(priv->hw, skb); | ||
1099 | } | ||
1100 | |||
1096 | return 0; | 1101 | return 0; |
1097 | } | 1102 | } |
1098 | 1103 | ||
@@ -1186,9 +1191,8 @@ int iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv, | |||
1186 | 1191 | ||
1187 | iwlagn_check_ratid_empty(priv, sta_id, tid); | 1192 | iwlagn_check_ratid_empty(priv, sta_id, tid); |
1188 | freed = 0; | 1193 | freed = 0; |
1189 | while (!skb_queue_empty(&reclaimed_skbs)) { | ||
1190 | 1194 | ||
1191 | skb = __skb_dequeue(&reclaimed_skbs); | 1195 | skb_queue_walk(&reclaimed_skbs, skb) { |
1192 | hdr = (struct ieee80211_hdr *)skb->data; | 1196 | hdr = (struct ieee80211_hdr *)skb->data; |
1193 | 1197 | ||
1194 | if (ieee80211_is_data_qos(hdr->frame_control)) | 1198 | if (ieee80211_is_data_qos(hdr->frame_control)) |
@@ -1211,10 +1215,14 @@ int iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv, | |||
1211 | iwlagn_hwrate_to_tx_control(priv, agg->rate_n_flags, | 1215 | iwlagn_hwrate_to_tx_control(priv, agg->rate_n_flags, |
1212 | info); | 1216 | info); |
1213 | } | 1217 | } |
1214 | |||
1215 | ieee80211_tx_status_irqsafe(priv->hw, skb); | ||
1216 | } | 1218 | } |
1217 | 1219 | ||
1218 | spin_unlock(&priv->sta_lock); | 1220 | spin_unlock(&priv->sta_lock); |
1221 | |||
1222 | while (!skb_queue_empty(&reclaimed_skbs)) { | ||
1223 | skb = __skb_dequeue(&reclaimed_skbs); | ||
1224 | ieee80211_tx_status(priv->hw, skb); | ||
1225 | } | ||
1226 | |||
1219 | return 0; | 1227 | return 0; |
1220 | } | 1228 | } |