diff options
Diffstat (limited to 'net/mac80211/status.c')
| -rw-r--r-- | net/mac80211/status.c | 107 |
1 files changed, 77 insertions, 30 deletions
diff --git a/net/mac80211/status.c b/net/mac80211/status.c index d78f36c64c7b..56d5b9a6ec5b 100644 --- a/net/mac80211/status.c +++ b/net/mac80211/status.c | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * Copyright 2002-2005, Instant802 Networks, Inc. | 2 | * Copyright 2002-2005, Instant802 Networks, Inc. |
| 3 | * Copyright 2005-2006, Devicescape Software, Inc. | 3 | * Copyright 2005-2006, Devicescape Software, Inc. |
| 4 | * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> | 4 | * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> |
| 5 | * Copyright 2008-2009 Johannes Berg <johannes@sipsolutions.net> | 5 | * Copyright 2008-2010 Johannes Berg <johannes@sipsolutions.net> |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as | 8 | * it under the terms of the GNU General Public License version 2 as |
| @@ -45,29 +45,19 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local, | |||
| 45 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 45 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
| 46 | 46 | ||
| 47 | /* | 47 | /* |
| 48 | * XXX: This is temporary! | 48 | * This skb 'survived' a round-trip through the driver, and |
| 49 | * | 49 | * hopefully the driver didn't mangle it too badly. However, |
| 50 | * The problem here is that when we get here, the driver will | 50 | * we can definitely not rely on the the control information |
| 51 | * quite likely have pretty much overwritten info->control by | 51 | * being correct. Clear it so we don't get junk there, and |
| 52 | * using info->driver_data or info->rate_driver_data. Thus, | 52 | * indicate that it needs new processing, but must not be |
| 53 | * when passing out the frame to the driver again, we would be | 53 | * modified/encrypted again. |
| 54 | * passing completely bogus data since the driver would then | ||
| 55 | * expect a properly filled info->control. In mac80211 itself | ||
| 56 | * the same problem occurs, since we need info->control.vif | ||
| 57 | * internally. | ||
| 58 | * | ||
| 59 | * To fix this, we should send the frame through TX processing | ||
| 60 | * again. However, it's not that simple, since the frame will | ||
| 61 | * have been software-encrypted (if applicable) already, and | ||
| 62 | * encrypting it again doesn't do much good. So to properly do | ||
| 63 | * that, we not only have to skip the actual 'raw' encryption | ||
| 64 | * (key selection etc. still has to be done!) but also the | ||
| 65 | * sequence number assignment since that impacts the crypto | ||
| 66 | * encapsulation, of course. | ||
| 67 | * | ||
| 68 | * Hence, for now, fix the bug by just dropping the frame. | ||
| 69 | */ | 54 | */ |
| 70 | goto drop; | 55 | memset(&info->control, 0, sizeof(info->control)); |
| 56 | |||
| 57 | info->control.jiffies = jiffies; | ||
| 58 | info->control.vif = &sta->sdata->vif; | ||
| 59 | info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING | | ||
| 60 | IEEE80211_TX_INTFL_RETRANSMISSION; | ||
| 71 | 61 | ||
| 72 | sta->tx_filtered_count++; | 62 | sta->tx_filtered_count++; |
| 73 | 63 | ||
| @@ -122,7 +112,6 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local, | |||
| 122 | return; | 112 | return; |
| 123 | } | 113 | } |
| 124 | 114 | ||
| 125 | drop: | ||
| 126 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 115 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
| 127 | if (net_ratelimit()) | 116 | if (net_ratelimit()) |
| 128 | printk(KERN_DEBUG "%s: dropped TX filtered frame, " | 117 | printk(KERN_DEBUG "%s: dropped TX filtered frame, " |
| @@ -134,6 +123,40 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local, | |||
| 134 | dev_kfree_skb(skb); | 123 | dev_kfree_skb(skb); |
| 135 | } | 124 | } |
| 136 | 125 | ||
| 126 | static void ieee80211_frame_acked(struct sta_info *sta, struct sk_buff *skb) | ||
| 127 | { | ||
| 128 | struct ieee80211_mgmt *mgmt = (void *) skb->data; | ||
| 129 | struct ieee80211_local *local = sta->local; | ||
| 130 | struct ieee80211_sub_if_data *sdata = sta->sdata; | ||
| 131 | |||
| 132 | if (ieee80211_is_action(mgmt->frame_control) && | ||
| 133 | sdata->vif.type == NL80211_IFTYPE_STATION && | ||
| 134 | mgmt->u.action.category == WLAN_CATEGORY_HT && | ||
| 135 | mgmt->u.action.u.ht_smps.action == WLAN_HT_ACTION_SMPS) { | ||
| 136 | /* | ||
| 137 | * This update looks racy, but isn't -- if we come | ||
| 138 | * here we've definitely got a station that we're | ||
| 139 | * talking to, and on a managed interface that can | ||
| 140 | * only be the AP. And the only other place updating | ||
| 141 | * this variable is before we're associated. | ||
| 142 | */ | ||
| 143 | switch (mgmt->u.action.u.ht_smps.smps_control) { | ||
| 144 | case WLAN_HT_SMPS_CONTROL_DYNAMIC: | ||
| 145 | sta->sdata->u.mgd.ap_smps = IEEE80211_SMPS_DYNAMIC; | ||
| 146 | break; | ||
| 147 | case WLAN_HT_SMPS_CONTROL_STATIC: | ||
| 148 | sta->sdata->u.mgd.ap_smps = IEEE80211_SMPS_STATIC; | ||
| 149 | break; | ||
| 150 | case WLAN_HT_SMPS_CONTROL_DISABLED: | ||
| 151 | default: /* shouldn't happen since we don't send that */ | ||
| 152 | sta->sdata->u.mgd.ap_smps = IEEE80211_SMPS_OFF; | ||
| 153 | break; | ||
| 154 | } | ||
| 155 | |||
| 156 | ieee80211_queue_work(&local->hw, &local->recalc_smps); | ||
| 157 | } | ||
| 158 | } | ||
| 159 | |||
| 137 | void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) | 160 | void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) |
| 138 | { | 161 | { |
| 139 | struct sk_buff *skb2; | 162 | struct sk_buff *skb2; |
| @@ -146,7 +169,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
| 146 | struct ieee80211_tx_status_rtap_hdr *rthdr; | 169 | struct ieee80211_tx_status_rtap_hdr *rthdr; |
| 147 | struct ieee80211_sub_if_data *sdata; | 170 | struct ieee80211_sub_if_data *sdata; |
| 148 | struct net_device *prev_dev = NULL; | 171 | struct net_device *prev_dev = NULL; |
| 149 | struct sta_info *sta; | 172 | struct sta_info *sta, *tmp; |
| 150 | int retry_count = -1, i; | 173 | int retry_count = -1, i; |
| 151 | bool injected; | 174 | bool injected; |
| 152 | 175 | ||
| @@ -165,10 +188,13 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
| 165 | rcu_read_lock(); | 188 | rcu_read_lock(); |
| 166 | 189 | ||
| 167 | sband = local->hw.wiphy->bands[info->band]; | 190 | sband = local->hw.wiphy->bands[info->band]; |
| 191 | fc = hdr->frame_control; | ||
| 168 | 192 | ||
| 169 | sta = sta_info_get(local, hdr->addr1); | 193 | for_each_sta_info(local, hdr->addr1, sta, tmp) { |
| 194 | /* skip wrong virtual interface */ | ||
| 195 | if (memcmp(hdr->addr2, sta->sdata->vif.addr, ETH_ALEN)) | ||
| 196 | continue; | ||
| 170 | 197 | ||
| 171 | if (sta) { | ||
| 172 | if (!(info->flags & IEEE80211_TX_STAT_ACK) && | 198 | if (!(info->flags & IEEE80211_TX_STAT_ACK) && |
| 173 | test_sta_flags(sta, WLAN_STA_PS_STA)) { | 199 | test_sta_flags(sta, WLAN_STA_PS_STA)) { |
| 174 | /* | 200 | /* |
| @@ -180,8 +206,6 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
| 180 | return; | 206 | return; |
| 181 | } | 207 | } |
| 182 | 208 | ||
| 183 | fc = hdr->frame_control; | ||
| 184 | |||
| 185 | if ((info->flags & IEEE80211_TX_STAT_AMPDU_NO_BACK) && | 209 | if ((info->flags & IEEE80211_TX_STAT_AMPDU_NO_BACK) && |
| 186 | (ieee80211_is_data_qos(fc))) { | 210 | (ieee80211_is_data_qos(fc))) { |
| 187 | u16 tid, ssn; | 211 | u16 tid, ssn; |
| @@ -208,6 +232,10 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
| 208 | rate_control_tx_status(local, sband, sta, skb); | 232 | rate_control_tx_status(local, sband, sta, skb); |
| 209 | if (ieee80211_vif_is_mesh(&sta->sdata->vif)) | 233 | if (ieee80211_vif_is_mesh(&sta->sdata->vif)) |
| 210 | ieee80211s_update_metric(local, sta, skb); | 234 | ieee80211s_update_metric(local, sta, skb); |
| 235 | |||
| 236 | if (!(info->flags & IEEE80211_TX_CTL_INJECTED) && | ||
| 237 | (info->flags & IEEE80211_TX_STAT_ACK)) | ||
| 238 | ieee80211_frame_acked(sta, skb); | ||
| 211 | } | 239 | } |
| 212 | 240 | ||
| 213 | rcu_read_unlock(); | 241 | rcu_read_unlock(); |
| @@ -246,6 +274,25 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
| 246 | local->dot11FailedCount++; | 274 | local->dot11FailedCount++; |
| 247 | } | 275 | } |
| 248 | 276 | ||
| 277 | if (ieee80211_is_nullfunc(fc) && ieee80211_has_pm(fc) && | ||
| 278 | (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) && | ||
| 279 | !(info->flags & IEEE80211_TX_CTL_INJECTED) && | ||
| 280 | local->ps_sdata && !(local->scanning)) { | ||
| 281 | if (info->flags & IEEE80211_TX_STAT_ACK) { | ||
| 282 | local->ps_sdata->u.mgd.flags |= | ||
| 283 | IEEE80211_STA_NULLFUNC_ACKED; | ||
| 284 | ieee80211_queue_work(&local->hw, | ||
| 285 | &local->dynamic_ps_enable_work); | ||
| 286 | } else | ||
| 287 | mod_timer(&local->dynamic_ps_timer, jiffies + | ||
| 288 | msecs_to_jiffies(10)); | ||
| 289 | } | ||
| 290 | |||
| 291 | if (info->flags & IEEE80211_TX_INTFL_NL80211_FRAME_TX) | ||
| 292 | cfg80211_action_tx_status( | ||
| 293 | skb->dev, (unsigned long) skb, skb->data, skb->len, | ||
| 294 | !!(info->flags & IEEE80211_TX_STAT_ACK), GFP_ATOMIC); | ||
| 295 | |||
| 249 | /* this was a transmitted frame, but now we want to reuse it */ | 296 | /* this was a transmitted frame, but now we want to reuse it */ |
| 250 | skb_orphan(skb); | 297 | skb_orphan(skb); |
| 251 | 298 | ||
| @@ -311,7 +358,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
| 311 | rcu_read_lock(); | 358 | rcu_read_lock(); |
| 312 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { | 359 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { |
| 313 | if (sdata->vif.type == NL80211_IFTYPE_MONITOR) { | 360 | if (sdata->vif.type == NL80211_IFTYPE_MONITOR) { |
| 314 | if (!netif_running(sdata->dev)) | 361 | if (!ieee80211_sdata_running(sdata)) |
| 315 | continue; | 362 | continue; |
| 316 | 363 | ||
| 317 | if ((sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) && | 364 | if ((sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) && |
