diff options
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/debugfs_sta.c | 26 | ||||
-rw-r--r-- | net/mac80211/driver-ops.h | 14 | ||||
-rw-r--r-- | net/mac80211/driver-trace.h | 15 | ||||
-rw-r--r-- | net/mac80211/ibss.c | 22 | ||||
-rw-r--r-- | net/mac80211/ieee80211_i.h | 1 | ||||
-rw-r--r-- | net/mac80211/iface.c | 6 | ||||
-rw-r--r-- | net/mac80211/mlme.c | 27 | ||||
-rw-r--r-- | net/mac80211/rate.h | 4 | ||||
-rw-r--r-- | net/mac80211/rc80211_pid_algo.c | 8 | ||||
-rw-r--r-- | net/mac80211/rx.c | 45 | ||||
-rw-r--r-- | net/mac80211/scan.c | 4 | ||||
-rw-r--r-- | net/mac80211/status.c | 35 | ||||
-rw-r--r-- | net/mac80211/tkip.c | 23 | ||||
-rw-r--r-- | net/mac80211/tx.c | 50 | ||||
-rw-r--r-- | net/mac80211/wep.c | 17 | ||||
-rw-r--r-- | net/mac80211/work.c | 19 | ||||
-rw-r--r-- | net/mac80211/wpa.c | 57 |
17 files changed, 201 insertions, 172 deletions
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c index 0d4a759ba72c..d92800bb2d2f 100644 --- a/net/mac80211/debugfs_sta.c +++ b/net/mac80211/debugfs_sta.c | |||
@@ -120,36 +120,38 @@ STA_OPS(last_seq_ctrl); | |||
120 | static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf, | 120 | static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf, |
121 | size_t count, loff_t *ppos) | 121 | size_t count, loff_t *ppos) |
122 | { | 122 | { |
123 | char buf[30 + STA_TID_NUM * 70], *p = buf; | 123 | char buf[64 + STA_TID_NUM * 40], *p = buf; |
124 | int i; | 124 | int i; |
125 | struct sta_info *sta = file->private_data; | 125 | struct sta_info *sta = file->private_data; |
126 | 126 | ||
127 | spin_lock_bh(&sta->lock); | 127 | spin_lock_bh(&sta->lock); |
128 | p += scnprintf(p, sizeof(buf)+buf-p, "next dialog_token is %#02x\n", | 128 | p += scnprintf(p, sizeof(buf) + buf - p, "next dialog_token: %#02x\n", |
129 | sta->ampdu_mlme.dialog_token_allocator + 1); | 129 | sta->ampdu_mlme.dialog_token_allocator + 1); |
130 | p += scnprintf(p, sizeof(buf) + buf - p, | ||
131 | "TID\t\tRX\tDTKN\tSSN\t\tTX\tDTKN\tSSN\tpending\n"); | ||
130 | for (i = 0; i < STA_TID_NUM; i++) { | 132 | for (i = 0; i < STA_TID_NUM; i++) { |
131 | p += scnprintf(p, sizeof(buf)+buf-p, "TID %02d:", i); | 133 | p += scnprintf(p, sizeof(buf) + buf - p, "%02d", i); |
132 | p += scnprintf(p, sizeof(buf)+buf-p, " RX=%x", | 134 | p += scnprintf(p, sizeof(buf) + buf - p, "\t\t%x", |
133 | sta->ampdu_mlme.tid_state_rx[i]); | 135 | sta->ampdu_mlme.tid_state_rx[i]); |
134 | p += scnprintf(p, sizeof(buf)+buf-p, "/DTKN=%#.2x", | 136 | p += scnprintf(p, sizeof(buf) + buf - p, "\t%#.2x", |
135 | sta->ampdu_mlme.tid_state_rx[i] ? | 137 | sta->ampdu_mlme.tid_state_rx[i] ? |
136 | sta->ampdu_mlme.tid_rx[i]->dialog_token : 0); | 138 | sta->ampdu_mlme.tid_rx[i]->dialog_token : 0); |
137 | p += scnprintf(p, sizeof(buf)+buf-p, "/SSN=%#.3x", | 139 | p += scnprintf(p, sizeof(buf) + buf - p, "\t%#.3x", |
138 | sta->ampdu_mlme.tid_state_rx[i] ? | 140 | sta->ampdu_mlme.tid_state_rx[i] ? |
139 | sta->ampdu_mlme.tid_rx[i]->ssn : 0); | 141 | sta->ampdu_mlme.tid_rx[i]->ssn : 0); |
140 | 142 | ||
141 | p += scnprintf(p, sizeof(buf)+buf-p, " TX=%x", | 143 | p += scnprintf(p, sizeof(buf) + buf - p, "\t\t%x", |
142 | sta->ampdu_mlme.tid_state_tx[i]); | 144 | sta->ampdu_mlme.tid_state_tx[i]); |
143 | p += scnprintf(p, sizeof(buf)+buf-p, "/DTKN=%#.2x", | 145 | p += scnprintf(p, sizeof(buf) + buf - p, "\t%#.2x", |
144 | sta->ampdu_mlme.tid_state_tx[i] ? | 146 | sta->ampdu_mlme.tid_state_tx[i] ? |
145 | sta->ampdu_mlme.tid_tx[i]->dialog_token : 0); | 147 | sta->ampdu_mlme.tid_tx[i]->dialog_token : 0); |
146 | p += scnprintf(p, sizeof(buf)+buf-p, "/SSN=%#.3x", | 148 | p += scnprintf(p, sizeof(buf) + buf - p, "\t%#.3x", |
147 | sta->ampdu_mlme.tid_state_tx[i] ? | 149 | sta->ampdu_mlme.tid_state_tx[i] ? |
148 | sta->ampdu_mlme.tid_tx[i]->ssn : 0); | 150 | sta->ampdu_mlme.tid_tx[i]->ssn : 0); |
149 | p += scnprintf(p, sizeof(buf)+buf-p, "/pending=%03d", | 151 | p += scnprintf(p, sizeof(buf) + buf - p, "\t%03d", |
150 | sta->ampdu_mlme.tid_state_tx[i] ? | 152 | sta->ampdu_mlme.tid_state_tx[i] ? |
151 | skb_queue_len(&sta->ampdu_mlme.tid_tx[i]->pending) : 0); | 153 | skb_queue_len(&sta->ampdu_mlme.tid_tx[i]->pending) : 0); |
152 | p += scnprintf(p, sizeof(buf)+buf-p, "\n"); | 154 | p += scnprintf(p, sizeof(buf) + buf - p, "\n"); |
153 | } | 155 | } |
154 | spin_unlock_bh(&sta->lock); | 156 | spin_unlock_bh(&sta->lock); |
155 | 157 | ||
@@ -165,7 +167,7 @@ static ssize_t sta_ht_capa_read(struct file *file, char __user *userbuf, | |||
165 | if (_cond) \ | 167 | if (_cond) \ |
166 | p += scnprintf(p, sizeof(buf)+buf-p, "\t" _str "\n"); \ | 168 | p += scnprintf(p, sizeof(buf)+buf-p, "\t" _str "\n"); \ |
167 | } while (0) | 169 | } while (0) |
168 | char buf[1024], *p = buf; | 170 | char buf[512], *p = buf; |
169 | int i; | 171 | int i; |
170 | struct sta_info *sta = file->private_data; | 172 | struct sta_info *sta = file->private_data; |
171 | struct ieee80211_sta_ht_cap *htc = &sta->sta.ht_cap; | 173 | struct ieee80211_sta_ht_cap *htc = &sta->sta.ht_cap; |
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index de91d39e0276..6c31f38ac7f5 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h | |||
@@ -137,16 +137,20 @@ static inline int drv_set_key(struct ieee80211_local *local, | |||
137 | } | 137 | } |
138 | 138 | ||
139 | static inline void drv_update_tkip_key(struct ieee80211_local *local, | 139 | static inline void drv_update_tkip_key(struct ieee80211_local *local, |
140 | struct ieee80211_sub_if_data *sdata, | ||
140 | struct ieee80211_key_conf *conf, | 141 | struct ieee80211_key_conf *conf, |
141 | const u8 *address, u32 iv32, | 142 | struct sta_info *sta, u32 iv32, |
142 | u16 *phase1key) | 143 | u16 *phase1key) |
143 | { | 144 | { |
144 | might_sleep(); | 145 | struct ieee80211_sta *ista = NULL; |
146 | |||
147 | if (sta) | ||
148 | ista = &sta->sta; | ||
145 | 149 | ||
146 | if (local->ops->update_tkip_key) | 150 | if (local->ops->update_tkip_key) |
147 | local->ops->update_tkip_key(&local->hw, conf, address, | 151 | local->ops->update_tkip_key(&local->hw, &sdata->vif, conf, |
148 | iv32, phase1key); | 152 | ista, iv32, phase1key); |
149 | trace_drv_update_tkip_key(local, conf, address, iv32); | 153 | trace_drv_update_tkip_key(local, sdata, conf, ista, iv32); |
150 | } | 154 | } |
151 | 155 | ||
152 | static inline int drv_hw_scan(struct ieee80211_local *local, | 156 | static inline int drv_hw_scan(struct ieee80211_local *local, |
diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h index d6bd9f517401..502424b2538a 100644 --- a/net/mac80211/driver-trace.h +++ b/net/mac80211/driver-trace.h | |||
@@ -331,26 +331,29 @@ TRACE_EVENT(drv_set_key, | |||
331 | 331 | ||
332 | TRACE_EVENT(drv_update_tkip_key, | 332 | TRACE_EVENT(drv_update_tkip_key, |
333 | TP_PROTO(struct ieee80211_local *local, | 333 | TP_PROTO(struct ieee80211_local *local, |
334 | struct ieee80211_sub_if_data *sdata, | ||
334 | struct ieee80211_key_conf *conf, | 335 | struct ieee80211_key_conf *conf, |
335 | const u8 *address, u32 iv32), | 336 | struct ieee80211_sta *sta, u32 iv32), |
336 | 337 | ||
337 | TP_ARGS(local, conf, address, iv32), | 338 | TP_ARGS(local, sdata, conf, sta, iv32), |
338 | 339 | ||
339 | TP_STRUCT__entry( | 340 | TP_STRUCT__entry( |
340 | LOCAL_ENTRY | 341 | LOCAL_ENTRY |
341 | __array(u8, addr, 6) | 342 | VIF_ENTRY |
343 | STA_ENTRY | ||
342 | __field(u32, iv32) | 344 | __field(u32, iv32) |
343 | ), | 345 | ), |
344 | 346 | ||
345 | TP_fast_assign( | 347 | TP_fast_assign( |
346 | LOCAL_ASSIGN; | 348 | LOCAL_ASSIGN; |
347 | memcpy(__entry->addr, address, 6); | 349 | VIF_ASSIGN; |
350 | STA_ASSIGN; | ||
348 | __entry->iv32 = iv32; | 351 | __entry->iv32 = iv32; |
349 | ), | 352 | ), |
350 | 353 | ||
351 | TP_printk( | 354 | TP_printk( |
352 | LOCAL_PR_FMT " addr:%pM iv32:%#x", | 355 | LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " iv32:%#x", |
353 | LOCAL_PR_ARG, __entry->addr, __entry->iv32 | 356 | LOCAL_PR_ARG,VIF_PR_ARG,STA_PR_ARG, __entry->iv32 |
354 | ) | 357 | ) |
355 | ); | 358 | ); |
356 | 359 | ||
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 5bcde4c3fba1..f95750b423e3 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
@@ -293,12 +293,8 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
293 | 293 | ||
294 | /* check if we need to merge IBSS */ | 294 | /* check if we need to merge IBSS */ |
295 | 295 | ||
296 | /* merge only on beacons (???) */ | ||
297 | if (!beacon) | ||
298 | goto put_bss; | ||
299 | |||
300 | /* we use a fixed BSSID */ | 296 | /* we use a fixed BSSID */ |
301 | if (sdata->u.ibss.bssid) | 297 | if (sdata->u.ibss.fixed_bssid) |
302 | goto put_bss; | 298 | goto put_bss; |
303 | 299 | ||
304 | /* not an IBSS */ | 300 | /* not an IBSS */ |
@@ -454,6 +450,9 @@ static int ieee80211_sta_active_ibss(struct ieee80211_sub_if_data *sdata) | |||
454 | return active; | 450 | return active; |
455 | } | 451 | } |
456 | 452 | ||
453 | /* | ||
454 | * This function is called with state == IEEE80211_IBSS_MLME_JOINED | ||
455 | */ | ||
457 | 456 | ||
458 | static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata) | 457 | static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata) |
459 | { | 458 | { |
@@ -519,6 +518,10 @@ static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata) | |||
519 | capability, 0); | 518 | capability, 0); |
520 | } | 519 | } |
521 | 520 | ||
521 | /* | ||
522 | * This function is called with state == IEEE80211_IBSS_MLME_SEARCH | ||
523 | */ | ||
524 | |||
522 | static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) | 525 | static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) |
523 | { | 526 | { |
524 | struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; | 527 | struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; |
@@ -575,18 +578,14 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) | |||
575 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 578 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
576 | 579 | ||
577 | /* Selected IBSS not found in current scan results - try to scan */ | 580 | /* Selected IBSS not found in current scan results - try to scan */ |
578 | if (ifibss->state == IEEE80211_IBSS_MLME_JOINED && | 581 | if (time_after(jiffies, ifibss->last_scan_completed + |
579 | !ieee80211_sta_active_ibss(sdata)) { | ||
580 | mod_timer(&ifibss->timer, | ||
581 | round_jiffies(jiffies + IEEE80211_IBSS_MERGE_INTERVAL)); | ||
582 | } else if (time_after(jiffies, ifibss->last_scan_completed + | ||
583 | IEEE80211_SCAN_INTERVAL)) { | 582 | IEEE80211_SCAN_INTERVAL)) { |
584 | printk(KERN_DEBUG "%s: Trigger new scan to find an IBSS to " | 583 | printk(KERN_DEBUG "%s: Trigger new scan to find an IBSS to " |
585 | "join\n", sdata->name); | 584 | "join\n", sdata->name); |
586 | 585 | ||
587 | ieee80211_request_internal_scan(sdata, ifibss->ssid, | 586 | ieee80211_request_internal_scan(sdata, ifibss->ssid, |
588 | ifibss->ssid_len); | 587 | ifibss->ssid_len); |
589 | } else if (ifibss->state != IEEE80211_IBSS_MLME_JOINED) { | 588 | } else { |
590 | int interval = IEEE80211_SCAN_INTERVAL; | 589 | int interval = IEEE80211_SCAN_INTERVAL; |
591 | 590 | ||
592 | if (time_after(jiffies, ifibss->ibss_join_req + | 591 | if (time_after(jiffies, ifibss->ibss_join_req + |
@@ -604,7 +603,6 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) | |||
604 | interval = IEEE80211_SCAN_INTERVAL_SLOW; | 603 | interval = IEEE80211_SCAN_INTERVAL_SLOW; |
605 | } | 604 | } |
606 | 605 | ||
607 | ifibss->state = IEEE80211_IBSS_MLME_SEARCH; | ||
608 | mod_timer(&ifibss->timer, | 606 | mod_timer(&ifibss->timer, |
609 | round_jiffies(jiffies + interval)); | 607 | round_jiffies(jiffies + interval)); |
610 | } | 608 | } |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index c18f576f1848..3067fbd69d63 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -299,7 +299,6 @@ struct ieee80211_work { | |||
299 | } assoc; | 299 | } assoc; |
300 | struct { | 300 | struct { |
301 | u32 duration; | 301 | u32 duration; |
302 | bool started; | ||
303 | } remain; | 302 | } remain; |
304 | }; | 303 | }; |
305 | 304 | ||
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index edf21cebeee8..09fff4662e80 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -695,10 +695,14 @@ static u16 ieee80211_monitor_select_queue(struct net_device *dev, | |||
695 | 695 | ||
696 | hdr = (void *)((u8 *)skb->data + le16_to_cpu(rtap->it_len)); | 696 | hdr = (void *)((u8 *)skb->data + le16_to_cpu(rtap->it_len)); |
697 | 697 | ||
698 | if (!ieee80211_is_data_qos(hdr->frame_control)) { | 698 | if (!ieee80211_is_data(hdr->frame_control)) { |
699 | skb->priority = 7; | 699 | skb->priority = 7; |
700 | return ieee802_1d_to_ac[skb->priority]; | 700 | return ieee802_1d_to_ac[skb->priority]; |
701 | } | 701 | } |
702 | if (!ieee80211_is_data_qos(hdr->frame_control)) { | ||
703 | skb->priority = 0; | ||
704 | return ieee802_1d_to_ac[skb->priority]; | ||
705 | } | ||
702 | 706 | ||
703 | p = ieee80211_get_qos_ctl(hdr); | 707 | p = ieee80211_get_qos_ctl(hdr); |
704 | skb->priority = *p & IEEE80211_QOS_CTL_TAG1D_MASK; | 708 | skb->priority = *p & IEEE80211_QOS_CTL_TAG1D_MASK; |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 1e1d16c55ee5..86c6ad1b058d 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -484,6 +484,7 @@ void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency) | |||
484 | 484 | ||
485 | if (count == 1 && found->u.mgd.powersave && | 485 | if (count == 1 && found->u.mgd.powersave && |
486 | found->u.mgd.associated && | 486 | found->u.mgd.associated && |
487 | found->u.mgd.associated->beacon_ies && | ||
487 | !(found->u.mgd.flags & (IEEE80211_STA_BEACON_POLL | | 488 | !(found->u.mgd.flags & (IEEE80211_STA_BEACON_POLL | |
488 | IEEE80211_STA_CONNECTION_POLL))) { | 489 | IEEE80211_STA_CONNECTION_POLL))) { |
489 | s32 beaconint_us; | 490 | s32 beaconint_us; |
@@ -497,14 +498,22 @@ void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency) | |||
497 | if (beaconint_us > latency) { | 498 | if (beaconint_us > latency) { |
498 | local->ps_sdata = NULL; | 499 | local->ps_sdata = NULL; |
499 | } else { | 500 | } else { |
500 | u8 dtimper = found->vif.bss_conf.dtim_period; | 501 | struct ieee80211_bss *bss; |
501 | int maxslp = 1; | 502 | int maxslp = 1; |
503 | u8 dtimper; | ||
502 | 504 | ||
503 | if (dtimper > 1) | 505 | bss = (void *)found->u.mgd.associated->priv; |
506 | dtimper = bss->dtim_period; | ||
507 | |||
508 | /* If the TIM IE is invalid, pretend the value is 1 */ | ||
509 | if (!dtimper) | ||
510 | dtimper = 1; | ||
511 | else if (dtimper > 1) | ||
504 | maxslp = min_t(int, dtimper, | 512 | maxslp = min_t(int, dtimper, |
505 | latency / beaconint_us); | 513 | latency / beaconint_us); |
506 | 514 | ||
507 | local->hw.conf.max_sleep_period = maxslp; | 515 | local->hw.conf.max_sleep_period = maxslp; |
516 | local->hw.conf.ps_dtim_period = dtimper; | ||
508 | local->ps_sdata = found; | 517 | local->ps_sdata = found; |
509 | } | 518 | } |
510 | } else { | 519 | } else { |
@@ -702,7 +711,6 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, | |||
702 | /* set timing information */ | 711 | /* set timing information */ |
703 | sdata->vif.bss_conf.beacon_int = cbss->beacon_interval; | 712 | sdata->vif.bss_conf.beacon_int = cbss->beacon_interval; |
704 | sdata->vif.bss_conf.timestamp = cbss->tsf; | 713 | sdata->vif.bss_conf.timestamp = cbss->tsf; |
705 | sdata->vif.bss_conf.dtim_period = bss->dtim_period; | ||
706 | 714 | ||
707 | bss_info_changed |= BSS_CHANGED_BEACON_INT; | 715 | bss_info_changed |= BSS_CHANGED_BEACON_INT; |
708 | bss_info_changed |= ieee80211_handle_bss_capability(sdata, | 716 | bss_info_changed |= ieee80211_handle_bss_capability(sdata, |
@@ -1168,6 +1176,13 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
1168 | int freq; | 1176 | int freq; |
1169 | struct ieee80211_bss *bss; | 1177 | struct ieee80211_bss *bss; |
1170 | struct ieee80211_channel *channel; | 1178 | struct ieee80211_channel *channel; |
1179 | bool need_ps = false; | ||
1180 | |||
1181 | if (sdata->u.mgd.associated) { | ||
1182 | bss = (void *)sdata->u.mgd.associated->priv; | ||
1183 | /* not previously set so we may need to recalc */ | ||
1184 | need_ps = !bss->dtim_period; | ||
1185 | } | ||
1171 | 1186 | ||
1172 | if (elems->ds_params && elems->ds_params_len == 1) | 1187 | if (elems->ds_params && elems->ds_params_len == 1) |
1173 | freq = ieee80211_channel_to_frequency(elems->ds_params[0]); | 1188 | freq = ieee80211_channel_to_frequency(elems->ds_params[0]); |
@@ -1187,6 +1202,12 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
1187 | if (!sdata->u.mgd.associated) | 1202 | if (!sdata->u.mgd.associated) |
1188 | return; | 1203 | return; |
1189 | 1204 | ||
1205 | if (need_ps) { | ||
1206 | mutex_lock(&local->iflist_mtx); | ||
1207 | ieee80211_recalc_ps(local, -1); | ||
1208 | mutex_unlock(&local->iflist_mtx); | ||
1209 | } | ||
1210 | |||
1190 | if (elems->ch_switch_elem && (elems->ch_switch_elem_len == 3) && | 1211 | if (elems->ch_switch_elem && (elems->ch_switch_elem_len == 3) && |
1191 | (memcmp(mgmt->bssid, sdata->u.mgd.associated->bssid, | 1212 | (memcmp(mgmt->bssid, sdata->u.mgd.associated->bssid, |
1192 | ETH_ALEN) == 0)) { | 1213 | ETH_ALEN) == 0)) { |
diff --git a/net/mac80211/rate.h b/net/mac80211/rate.h index 669dddd40521..998cf7a935b6 100644 --- a/net/mac80211/rate.h +++ b/net/mac80211/rate.h | |||
@@ -44,6 +44,10 @@ static inline void rate_control_tx_status(struct ieee80211_local *local, | |||
44 | struct rate_control_ref *ref = local->rate_ctrl; | 44 | struct rate_control_ref *ref = local->rate_ctrl; |
45 | struct ieee80211_sta *ista = &sta->sta; | 45 | struct ieee80211_sta *ista = &sta->sta; |
46 | void *priv_sta = sta->rate_ctrl_priv; | 46 | void *priv_sta = sta->rate_ctrl_priv; |
47 | |||
48 | if (!ref) | ||
49 | return; | ||
50 | |||
47 | ref->ops->tx_status(ref->priv, sband, ista, priv_sta, skb); | 51 | ref->ops->tx_status(ref->priv, sband, ista, priv_sta, skb); |
48 | } | 52 | } |
49 | 53 | ||
diff --git a/net/mac80211/rc80211_pid_algo.c b/net/mac80211/rc80211_pid_algo.c index 29bc4c516238..2652a374974e 100644 --- a/net/mac80211/rc80211_pid_algo.c +++ b/net/mac80211/rc80211_pid_algo.c | |||
@@ -157,9 +157,7 @@ static void rate_control_pid_sample(struct rc_pid_info *pinfo, | |||
157 | 157 | ||
158 | /* In case nothing happened during the previous control interval, turn | 158 | /* In case nothing happened during the previous control interval, turn |
159 | * the sharpening factor on. */ | 159 | * the sharpening factor on. */ |
160 | period = (HZ * pinfo->sampling_period + 500) / 1000; | 160 | period = msecs_to_jiffies(pinfo->sampling_period); |
161 | if (!period) | ||
162 | period = 1; | ||
163 | if (jiffies - spinfo->last_sample > 2 * period) | 161 | if (jiffies - spinfo->last_sample > 2 * period) |
164 | spinfo->sharp_cnt = pinfo->sharpen_duration; | 162 | spinfo->sharp_cnt = pinfo->sharpen_duration; |
165 | 163 | ||
@@ -252,9 +250,7 @@ static void rate_control_pid_tx_status(void *priv, struct ieee80211_supported_ba | |||
252 | } | 250 | } |
253 | 251 | ||
254 | /* Update PID controller state. */ | 252 | /* Update PID controller state. */ |
255 | period = (HZ * pinfo->sampling_period + 500) / 1000; | 253 | period = msecs_to_jiffies(pinfo->sampling_period); |
256 | if (!period) | ||
257 | period = 1; | ||
258 | if (time_after(jiffies, spinfo->last_sample + period)) | 254 | if (time_after(jiffies, spinfo->last_sample + period)) |
259 | rate_control_pid_sample(pinfo, sband, sta, spinfo); | 255 | rate_control_pid_sample(pinfo, sband, sta, spinfo); |
260 | } | 256 | } |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index a8e15b84c05b..5709307fcb9b 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -2348,22 +2348,6 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, | |||
2348 | sdata->vif.type == NL80211_IFTYPE_AP_VLAN) | 2348 | sdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
2349 | continue; | 2349 | continue; |
2350 | 2350 | ||
2351 | rx.sta = sta_info_get(sdata, hdr->addr2); | ||
2352 | |||
2353 | rx.flags |= IEEE80211_RX_RA_MATCH; | ||
2354 | prepares = prepare_for_handlers(sdata, &rx, hdr); | ||
2355 | |||
2356 | if (!prepares) | ||
2357 | continue; | ||
2358 | |||
2359 | if (status->flag & RX_FLAG_MMIC_ERROR) { | ||
2360 | rx.sdata = sdata; | ||
2361 | if (rx.flags & IEEE80211_RX_RA_MATCH) | ||
2362 | ieee80211_rx_michael_mic_report(hdr, | ||
2363 | &rx); | ||
2364 | continue; | ||
2365 | } | ||
2366 | |||
2367 | /* | 2351 | /* |
2368 | * frame is destined for this interface, but if it's | 2352 | * frame is destined for this interface, but if it's |
2369 | * not also for the previous one we handle that after | 2353 | * not also for the previous one we handle that after |
@@ -2375,6 +2359,22 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, | |||
2375 | continue; | 2359 | continue; |
2376 | } | 2360 | } |
2377 | 2361 | ||
2362 | rx.sta = sta_info_get_bss(prev, hdr->addr2); | ||
2363 | |||
2364 | rx.flags |= IEEE80211_RX_RA_MATCH; | ||
2365 | prepares = prepare_for_handlers(prev, &rx, hdr); | ||
2366 | |||
2367 | if (!prepares) | ||
2368 | goto next; | ||
2369 | |||
2370 | if (status->flag & RX_FLAG_MMIC_ERROR) { | ||
2371 | rx.sdata = prev; | ||
2372 | if (rx.flags & IEEE80211_RX_RA_MATCH) | ||
2373 | ieee80211_rx_michael_mic_report(hdr, | ||
2374 | &rx); | ||
2375 | goto next; | ||
2376 | } | ||
2377 | |||
2378 | /* | 2378 | /* |
2379 | * frame was destined for the previous interface | 2379 | * frame was destined for the previous interface |
2380 | * so invoke RX handlers for it | 2380 | * so invoke RX handlers for it |
@@ -2387,11 +2387,22 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, | |||
2387 | "multicast frame for %s\n", | 2387 | "multicast frame for %s\n", |
2388 | wiphy_name(local->hw.wiphy), | 2388 | wiphy_name(local->hw.wiphy), |
2389 | prev->name); | 2389 | prev->name); |
2390 | continue; | 2390 | goto next; |
2391 | } | 2391 | } |
2392 | ieee80211_invoke_rx_handlers(prev, &rx, skb_new, rate); | 2392 | ieee80211_invoke_rx_handlers(prev, &rx, skb_new, rate); |
2393 | next: | ||
2393 | prev = sdata; | 2394 | prev = sdata; |
2394 | } | 2395 | } |
2396 | |||
2397 | if (prev) { | ||
2398 | rx.sta = sta_info_get_bss(prev, hdr->addr2); | ||
2399 | |||
2400 | rx.flags |= IEEE80211_RX_RA_MATCH; | ||
2401 | prepares = prepare_for_handlers(prev, &rx, hdr); | ||
2402 | |||
2403 | if (!prepares) | ||
2404 | prev = NULL; | ||
2405 | } | ||
2395 | } | 2406 | } |
2396 | if (prev) | 2407 | if (prev) |
2397 | ieee80211_invoke_rx_handlers(prev, &rx, skb, rate); | 2408 | ieee80211_invoke_rx_handlers(prev, &rx, skb, rate); |
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index 9afe2f9885dc..bc061f629674 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c | |||
@@ -111,10 +111,6 @@ ieee80211_bss_info_update(struct ieee80211_local *local, | |||
111 | bss->dtim_period = tim_ie->dtim_period; | 111 | bss->dtim_period = tim_ie->dtim_period; |
112 | } | 112 | } |
113 | 113 | ||
114 | /* set default value for buggy AP/no TIM element */ | ||
115 | if (bss->dtim_period == 0) | ||
116 | bss->dtim_period = 1; | ||
117 | |||
118 | bss->supp_rates_len = 0; | 114 | bss->supp_rates_len = 0; |
119 | if (elems->supp_rates) { | 115 | if (elems->supp_rates) { |
120 | clen = IEEE80211_MAX_SUPP_RATES - bss->supp_rates_len; | 116 | clen = IEEE80211_MAX_SUPP_RATES - bss->supp_rates_len; |
diff --git a/net/mac80211/status.c b/net/mac80211/status.c index 0ebcdda24200..e57ad6b1d7ea 100644 --- a/net/mac80211/status.c +++ b/net/mac80211/status.c | |||
@@ -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, " |
diff --git a/net/mac80211/tkip.c b/net/mac80211/tkip.c index b73454a507f9..7ef491e9d66d 100644 --- a/net/mac80211/tkip.c +++ b/net/mac80211/tkip.c | |||
@@ -195,11 +195,13 @@ void ieee80211_get_tkip_key(struct ieee80211_key_conf *keyconf, | |||
195 | } | 195 | } |
196 | EXPORT_SYMBOL(ieee80211_get_tkip_key); | 196 | EXPORT_SYMBOL(ieee80211_get_tkip_key); |
197 | 197 | ||
198 | /* Encrypt packet payload with TKIP using @key. @pos is a pointer to the | 198 | /* |
199 | * Encrypt packet payload with TKIP using @key. @pos is a pointer to the | ||
199 | * beginning of the buffer containing payload. This payload must include | 200 | * beginning of the buffer containing payload. This payload must include |
200 | * headroom of eight octets for IV and Ext. IV and taildroom of four octets | 201 | * the IV/Ext.IV and space for (taildroom) four octets for ICV. |
201 | * for ICV. @payload_len is the length of payload (_not_ including extra | 202 | * @payload_len is the length of payload (_not_ including IV/ICV length). |
202 | * headroom and tailroom). @ta is the transmitter addresses. */ | 203 | * @ta is the transmitter addresses. |
204 | */ | ||
203 | void ieee80211_tkip_encrypt_data(struct crypto_blkcipher *tfm, | 205 | void ieee80211_tkip_encrypt_data(struct crypto_blkcipher *tfm, |
204 | struct ieee80211_key *key, | 206 | struct ieee80211_key *key, |
205 | u8 *pos, size_t payload_len, u8 *ta) | 207 | u8 *pos, size_t payload_len, u8 *ta) |
@@ -214,7 +216,6 @@ void ieee80211_tkip_encrypt_data(struct crypto_blkcipher *tfm, | |||
214 | 216 | ||
215 | tkip_mixing_phase2(tk, ctx, ctx->iv16, rc4key); | 217 | tkip_mixing_phase2(tk, ctx, ctx->iv16, rc4key); |
216 | 218 | ||
217 | pos = ieee80211_tkip_add_iv(pos, key, key->u.tkip.tx.iv16); | ||
218 | ieee80211_wep_encrypt_data(tfm, rc4key, 16, pos, payload_len); | 219 | ieee80211_wep_encrypt_data(tfm, rc4key, 16, pos, payload_len); |
219 | } | 220 | } |
220 | 221 | ||
@@ -303,14 +304,12 @@ int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm, | |||
303 | if (key->local->ops->update_tkip_key && | 304 | if (key->local->ops->update_tkip_key && |
304 | key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE && | 305 | key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE && |
305 | key->u.tkip.rx[queue].state != TKIP_STATE_PHASE1_HW_UPLOADED) { | 306 | key->u.tkip.rx[queue].state != TKIP_STATE_PHASE1_HW_UPLOADED) { |
306 | static const u8 bcast[ETH_ALEN] = | 307 | struct ieee80211_sub_if_data *sdata = key->sdata; |
307 | {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; | ||
308 | const u8 *sta_addr = key->sta->sta.addr; | ||
309 | |||
310 | if (is_multicast_ether_addr(ra)) | ||
311 | sta_addr = bcast; | ||
312 | 308 | ||
313 | drv_update_tkip_key(key->local, &key->conf, sta_addr, | 309 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
310 | sdata = container_of(key->sdata->bss, | ||
311 | struct ieee80211_sub_if_data, u.ap); | ||
312 | drv_update_tkip_key(key->local, sdata, &key->conf, key->sta, | ||
314 | iv32, key->u.tkip.rx[queue].p1k); | 313 | iv32, key->u.tkip.rx[queue].p1k); |
315 | key->u.tkip.rx[queue].state = TKIP_STATE_PHASE1_HW_UPLOADED; | 314 | key->u.tkip.rx[queue].state = TKIP_STATE_PHASE1_HW_UPLOADED; |
316 | } | 315 | } |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index daf81048c1f7..85e382aa894e 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -529,6 +529,8 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) | |||
529 | tx->key = NULL; | 529 | tx->key = NULL; |
530 | 530 | ||
531 | if (tx->key) { | 531 | if (tx->key) { |
532 | bool skip_hw = false; | ||
533 | |||
532 | tx->key->tx_rx_count++; | 534 | tx->key->tx_rx_count++; |
533 | /* TODO: add threshold stuff again */ | 535 | /* TODO: add threshold stuff again */ |
534 | 536 | ||
@@ -545,16 +547,32 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) | |||
545 | !ieee80211_use_mfp(hdr->frame_control, tx->sta, | 547 | !ieee80211_use_mfp(hdr->frame_control, tx->sta, |
546 | tx->skb)) | 548 | tx->skb)) |
547 | tx->key = NULL; | 549 | tx->key = NULL; |
550 | else | ||
551 | skip_hw = (tx->key->conf.flags & | ||
552 | IEEE80211_KEY_FLAG_SW_MGMT) && | ||
553 | ieee80211_is_mgmt(hdr->frame_control); | ||
548 | break; | 554 | break; |
549 | case ALG_AES_CMAC: | 555 | case ALG_AES_CMAC: |
550 | if (!ieee80211_is_mgmt(hdr->frame_control)) | 556 | if (!ieee80211_is_mgmt(hdr->frame_control)) |
551 | tx->key = NULL; | 557 | tx->key = NULL; |
552 | break; | 558 | break; |
553 | } | 559 | } |
560 | |||
561 | if (!skip_hw && tx->key && | ||
562 | tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) | ||
563 | info->control.hw_key = &tx->key->conf; | ||
554 | } | 564 | } |
555 | 565 | ||
556 | if (!tx->key || !(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) | 566 | return TX_CONTINUE; |
557 | info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; | 567 | } |
568 | |||
569 | static ieee80211_tx_result debug_noinline | ||
570 | ieee80211_tx_h_sta(struct ieee80211_tx_data *tx) | ||
571 | { | ||
572 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | ||
573 | |||
574 | if (tx->sta) | ||
575 | info->control.sta = &tx->sta->sta; | ||
558 | 576 | ||
559 | return TX_CONTINUE; | 577 | return TX_CONTINUE; |
560 | } | 578 | } |
@@ -734,17 +752,6 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx) | |||
734 | } | 752 | } |
735 | 753 | ||
736 | static ieee80211_tx_result debug_noinline | 754 | static ieee80211_tx_result debug_noinline |
737 | ieee80211_tx_h_misc(struct ieee80211_tx_data *tx) | ||
738 | { | ||
739 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | ||
740 | |||
741 | if (tx->sta) | ||
742 | info->control.sta = &tx->sta->sta; | ||
743 | |||
744 | return TX_CONTINUE; | ||
745 | } | ||
746 | |||
747 | static ieee80211_tx_result debug_noinline | ||
748 | ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx) | 755 | ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx) |
749 | { | 756 | { |
750 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | 757 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); |
@@ -1101,7 +1108,7 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata, | |||
1101 | tx->flags |= IEEE80211_TX_FRAGMENTED; | 1108 | tx->flags |= IEEE80211_TX_FRAGMENTED; |
1102 | 1109 | ||
1103 | /* process and remove the injection radiotap header */ | 1110 | /* process and remove the injection radiotap header */ |
1104 | if (unlikely(info->flags & IEEE80211_TX_CTL_INJECTED)) { | 1111 | if (unlikely(info->flags & IEEE80211_TX_INTFL_HAS_RADIOTAP)) { |
1105 | if (!__ieee80211_parse_tx_radiotap(tx, skb)) | 1112 | if (!__ieee80211_parse_tx_radiotap(tx, skb)) |
1106 | return TX_DROP; | 1113 | return TX_DROP; |
1107 | 1114 | ||
@@ -1110,6 +1117,7 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata, | |||
1110 | * the radiotap header that was present and pre-filled | 1117 | * the radiotap header that was present and pre-filled |
1111 | * 'tx' with tx control information. | 1118 | * 'tx' with tx control information. |
1112 | */ | 1119 | */ |
1120 | info->flags &= ~IEEE80211_TX_INTFL_HAS_RADIOTAP; | ||
1113 | } | 1121 | } |
1114 | 1122 | ||
1115 | /* | 1123 | /* |
@@ -1125,6 +1133,8 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata, | |||
1125 | tx->sta = rcu_dereference(sdata->u.vlan.sta); | 1133 | tx->sta = rcu_dereference(sdata->u.vlan.sta); |
1126 | if (!tx->sta && sdata->dev->ieee80211_ptr->use_4addr) | 1134 | if (!tx->sta && sdata->dev->ieee80211_ptr->use_4addr) |
1127 | return TX_DROP; | 1135 | return TX_DROP; |
1136 | } else if (info->flags & IEEE80211_TX_CTL_INJECTED) { | ||
1137 | tx->sta = sta_info_get_bss(sdata, hdr->addr1); | ||
1128 | } | 1138 | } |
1129 | if (!tx->sta) | 1139 | if (!tx->sta) |
1130 | tx->sta = sta_info_get(sdata, hdr->addr1); | 1140 | tx->sta = sta_info_get(sdata, hdr->addr1); |
@@ -1279,6 +1289,7 @@ static int __ieee80211_tx(struct ieee80211_local *local, | |||
1279 | static int invoke_tx_handlers(struct ieee80211_tx_data *tx) | 1289 | static int invoke_tx_handlers(struct ieee80211_tx_data *tx) |
1280 | { | 1290 | { |
1281 | struct sk_buff *skb = tx->skb; | 1291 | struct sk_buff *skb = tx->skb; |
1292 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | ||
1282 | ieee80211_tx_result res = TX_DROP; | 1293 | ieee80211_tx_result res = TX_DROP; |
1283 | 1294 | ||
1284 | #define CALL_TXH(txh) \ | 1295 | #define CALL_TXH(txh) \ |
@@ -1292,10 +1303,14 @@ static int invoke_tx_handlers(struct ieee80211_tx_data *tx) | |||
1292 | CALL_TXH(ieee80211_tx_h_check_assoc); | 1303 | CALL_TXH(ieee80211_tx_h_check_assoc); |
1293 | CALL_TXH(ieee80211_tx_h_ps_buf); | 1304 | CALL_TXH(ieee80211_tx_h_ps_buf); |
1294 | CALL_TXH(ieee80211_tx_h_select_key); | 1305 | CALL_TXH(ieee80211_tx_h_select_key); |
1295 | CALL_TXH(ieee80211_tx_h_michael_mic_add); | 1306 | CALL_TXH(ieee80211_tx_h_sta); |
1296 | if (!(tx->local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL)) | 1307 | if (!(tx->local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL)) |
1297 | CALL_TXH(ieee80211_tx_h_rate_ctrl); | 1308 | CALL_TXH(ieee80211_tx_h_rate_ctrl); |
1298 | CALL_TXH(ieee80211_tx_h_misc); | 1309 | |
1310 | if (unlikely(info->flags & IEEE80211_TX_INTFL_RETRANSMISSION)) | ||
1311 | goto txh_done; | ||
1312 | |||
1313 | CALL_TXH(ieee80211_tx_h_michael_mic_add); | ||
1299 | CALL_TXH(ieee80211_tx_h_sequence); | 1314 | CALL_TXH(ieee80211_tx_h_sequence); |
1300 | CALL_TXH(ieee80211_tx_h_fragment); | 1315 | CALL_TXH(ieee80211_tx_h_fragment); |
1301 | /* handlers after fragment must be aware of tx info fragmentation! */ | 1316 | /* handlers after fragment must be aware of tx info fragmentation! */ |
@@ -1487,7 +1502,8 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, | |||
1487 | int hdrlen; | 1502 | int hdrlen; |
1488 | u16 len_rthdr; | 1503 | u16 len_rthdr; |
1489 | 1504 | ||
1490 | info->flags |= IEEE80211_TX_CTL_INJECTED; | 1505 | info->flags |= IEEE80211_TX_CTL_INJECTED | |
1506 | IEEE80211_TX_INTFL_HAS_RADIOTAP; | ||
1491 | 1507 | ||
1492 | len_rthdr = ieee80211_get_radiotap_len(skb->data); | 1508 | len_rthdr = ieee80211_get_radiotap_len(skb->data); |
1493 | hdr = (struct ieee80211_hdr *)(skb->data + len_rthdr); | 1509 | hdr = (struct ieee80211_hdr *)(skb->data + len_rthdr); |
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c index 247123fe1a7a..5d745f2d7236 100644 --- a/net/mac80211/wep.c +++ b/net/mac80211/wep.c | |||
@@ -305,20 +305,19 @@ static int wep_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) | |||
305 | { | 305 | { |
306 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 306 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
307 | 307 | ||
308 | if (!(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) { | 308 | if (!info->control.hw_key) { |
309 | if (ieee80211_wep_encrypt(tx->local, skb, tx->key->conf.key, | 309 | if (ieee80211_wep_encrypt(tx->local, skb, tx->key->conf.key, |
310 | tx->key->conf.keylen, | 310 | tx->key->conf.keylen, |
311 | tx->key->conf.keyidx)) | 311 | tx->key->conf.keyidx)) |
312 | return -1; | 312 | return -1; |
313 | } else { | 313 | } else if (info->control.hw_key->flags & |
314 | info->control.hw_key = &tx->key->conf; | 314 | IEEE80211_KEY_FLAG_GENERATE_IV) { |
315 | if (tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) { | 315 | if (!ieee80211_wep_add_iv(tx->local, skb, |
316 | if (!ieee80211_wep_add_iv(tx->local, skb, | 316 | tx->key->conf.keylen, |
317 | tx->key->conf.keylen, | 317 | tx->key->conf.keyidx)) |
318 | tx->key->conf.keyidx)) | 318 | return -1; |
319 | return -1; | ||
320 | } | ||
321 | } | 319 | } |
320 | |||
322 | return 0; | 321 | return 0; |
323 | } | 322 | } |
324 | 323 | ||
diff --git a/net/mac80211/work.c b/net/mac80211/work.c index 81bd5d592bb4..7e708d5c88b4 100644 --- a/net/mac80211/work.c +++ b/net/mac80211/work.c | |||
@@ -535,8 +535,7 @@ ieee80211_remain_on_channel_timeout(struct ieee80211_work *wk) | |||
535 | * First time we run, do nothing -- the generic code will | 535 | * First time we run, do nothing -- the generic code will |
536 | * have switched to the right channel etc. | 536 | * have switched to the right channel etc. |
537 | */ | 537 | */ |
538 | if (!wk->remain.started) { | 538 | if (!wk->started) { |
539 | wk->remain.started = true; | ||
540 | wk->timeout = jiffies + msecs_to_jiffies(wk->remain.duration); | 539 | wk->timeout = jiffies + msecs_to_jiffies(wk->remain.duration); |
541 | 540 | ||
542 | cfg80211_ready_on_channel(wk->sdata->dev, (unsigned long) wk, | 541 | cfg80211_ready_on_channel(wk->sdata->dev, (unsigned long) wk, |
@@ -821,15 +820,17 @@ static void ieee80211_work_work(struct work_struct *work) | |||
821 | mutex_lock(&local->work_mtx); | 820 | mutex_lock(&local->work_mtx); |
822 | 821 | ||
823 | list_for_each_entry_safe(wk, tmp, &local->work_list, list) { | 822 | list_for_each_entry_safe(wk, tmp, &local->work_list, list) { |
823 | bool started = wk->started; | ||
824 | |||
824 | /* mark work as started if it's on the current off-channel */ | 825 | /* mark work as started if it's on the current off-channel */ |
825 | if (!wk->started && local->tmp_channel && | 826 | if (!started && local->tmp_channel && |
826 | wk->chan == local->tmp_channel && | 827 | wk->chan == local->tmp_channel && |
827 | wk->chan_type == local->tmp_channel_type) { | 828 | wk->chan_type == local->tmp_channel_type) { |
828 | wk->started = true; | 829 | started = true; |
829 | wk->timeout = jiffies; | 830 | wk->timeout = jiffies; |
830 | } | 831 | } |
831 | 832 | ||
832 | if (!wk->started && !local->tmp_channel) { | 833 | if (!started && !local->tmp_channel) { |
833 | /* | 834 | /* |
834 | * TODO: could optimize this by leaving the | 835 | * TODO: could optimize this by leaving the |
835 | * station vifs in awake mode if they | 836 | * station vifs in awake mode if they |
@@ -842,12 +843,12 @@ static void ieee80211_work_work(struct work_struct *work) | |||
842 | local->tmp_channel = wk->chan; | 843 | local->tmp_channel = wk->chan; |
843 | local->tmp_channel_type = wk->chan_type; | 844 | local->tmp_channel_type = wk->chan_type; |
844 | ieee80211_hw_config(local, 0); | 845 | ieee80211_hw_config(local, 0); |
845 | wk->started = true; | 846 | started = true; |
846 | wk->timeout = jiffies; | 847 | wk->timeout = jiffies; |
847 | } | 848 | } |
848 | 849 | ||
849 | /* don't try to work with items that aren't started */ | 850 | /* don't try to work with items that aren't started */ |
850 | if (!wk->started) | 851 | if (!started) |
851 | continue; | 852 | continue; |
852 | 853 | ||
853 | if (time_is_after_jiffies(wk->timeout)) { | 854 | if (time_is_after_jiffies(wk->timeout)) { |
@@ -882,6 +883,8 @@ static void ieee80211_work_work(struct work_struct *work) | |||
882 | break; | 883 | break; |
883 | } | 884 | } |
884 | 885 | ||
886 | wk->started = started; | ||
887 | |||
885 | switch (rma) { | 888 | switch (rma) { |
886 | case WORK_ACT_NONE: | 889 | case WORK_ACT_NONE: |
887 | /* might have changed the timeout */ | 890 | /* might have changed the timeout */ |
@@ -1022,8 +1025,6 @@ ieee80211_rx_result ieee80211_work_rx_mgmt(struct ieee80211_sub_if_data *sdata, | |||
1022 | case IEEE80211_STYPE_PROBE_RESP: | 1025 | case IEEE80211_STYPE_PROBE_RESP: |
1023 | case IEEE80211_STYPE_ASSOC_RESP: | 1026 | case IEEE80211_STYPE_ASSOC_RESP: |
1024 | case IEEE80211_STYPE_REASSOC_RESP: | 1027 | case IEEE80211_STYPE_REASSOC_RESP: |
1025 | case IEEE80211_STYPE_DEAUTH: | ||
1026 | case IEEE80211_STYPE_DISASSOC: | ||
1027 | skb_queue_tail(&local->work_skb_queue, skb); | 1028 | skb_queue_tail(&local->work_skb_queue, skb); |
1028 | ieee80211_queue_work(&local->hw, &local->work_work); | 1029 | ieee80211_queue_work(&local->hw, &local->work_work); |
1029 | return RX_QUEUED; | 1030 | return RX_QUEUED; |
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c index 5332014cb229..f4971cd45c64 100644 --- a/net/mac80211/wpa.c +++ b/net/mac80211/wpa.c | |||
@@ -31,8 +31,8 @@ ieee80211_tx_h_michael_mic_add(struct ieee80211_tx_data *tx) | |||
31 | unsigned int hdrlen; | 31 | unsigned int hdrlen; |
32 | struct ieee80211_hdr *hdr; | 32 | struct ieee80211_hdr *hdr; |
33 | struct sk_buff *skb = tx->skb; | 33 | struct sk_buff *skb = tx->skb; |
34 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | ||
34 | int authenticator; | 35 | int authenticator; |
35 | int wpa_test = 0; | ||
36 | int tail; | 36 | int tail; |
37 | 37 | ||
38 | hdr = (struct ieee80211_hdr *)skb->data; | 38 | hdr = (struct ieee80211_hdr *)skb->data; |
@@ -47,16 +47,15 @@ ieee80211_tx_h_michael_mic_add(struct ieee80211_tx_data *tx) | |||
47 | data = skb->data + hdrlen; | 47 | data = skb->data + hdrlen; |
48 | data_len = skb->len - hdrlen; | 48 | data_len = skb->len - hdrlen; |
49 | 49 | ||
50 | if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) && | 50 | if (info->control.hw_key && |
51 | !(tx->flags & IEEE80211_TX_FRAGMENTED) && | 51 | !(tx->flags & IEEE80211_TX_FRAGMENTED) && |
52 | !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) && | 52 | !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) { |
53 | !wpa_test) { | 53 | /* hwaccel - with no need for SW-generated MMIC */ |
54 | /* hwaccel - with no need for preallocated room for MMIC */ | ||
55 | return TX_CONTINUE; | 54 | return TX_CONTINUE; |
56 | } | 55 | } |
57 | 56 | ||
58 | tail = MICHAEL_MIC_LEN; | 57 | tail = MICHAEL_MIC_LEN; |
59 | if (!(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) | 58 | if (!info->control.hw_key) |
60 | tail += TKIP_ICV_LEN; | 59 | tail += TKIP_ICV_LEN; |
61 | 60 | ||
62 | if (WARN_ON(skb_tailroom(skb) < tail || | 61 | if (WARN_ON(skb_tailroom(skb) < tail || |
@@ -147,17 +146,16 @@ static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) | |||
147 | int len, tail; | 146 | int len, tail; |
148 | u8 *pos; | 147 | u8 *pos; |
149 | 148 | ||
150 | if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) && | 149 | if (info->control.hw_key && |
151 | !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) { | 150 | !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV)) { |
152 | /* hwaccel - with no need for preallocated room for IV/ICV */ | 151 | /* hwaccel - with no need for software-generated IV */ |
153 | info->control.hw_key = &tx->key->conf; | ||
154 | return 0; | 152 | return 0; |
155 | } | 153 | } |
156 | 154 | ||
157 | hdrlen = ieee80211_hdrlen(hdr->frame_control); | 155 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
158 | len = skb->len - hdrlen; | 156 | len = skb->len - hdrlen; |
159 | 157 | ||
160 | if (tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) | 158 | if (info->control.hw_key) |
161 | tail = 0; | 159 | tail = 0; |
162 | else | 160 | else |
163 | tail = TKIP_ICV_LEN; | 161 | tail = TKIP_ICV_LEN; |
@@ -175,13 +173,11 @@ static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) | |||
175 | if (key->u.tkip.tx.iv16 == 0) | 173 | if (key->u.tkip.tx.iv16 == 0) |
176 | key->u.tkip.tx.iv32++; | 174 | key->u.tkip.tx.iv32++; |
177 | 175 | ||
178 | if (tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) { | 176 | pos = ieee80211_tkip_add_iv(pos, key, key->u.tkip.tx.iv16); |
179 | /* hwaccel - with preallocated room for IV */ | ||
180 | ieee80211_tkip_add_iv(pos, key, key->u.tkip.tx.iv16); | ||
181 | 177 | ||
182 | info->control.hw_key = &tx->key->conf; | 178 | /* hwaccel - with software IV */ |
179 | if (info->control.hw_key) | ||
183 | return 0; | 180 | return 0; |
184 | } | ||
185 | 181 | ||
186 | /* Add room for ICV */ | 182 | /* Add room for ICV */ |
187 | skb_put(skb, TKIP_ICV_LEN); | 183 | skb_put(skb, TKIP_ICV_LEN); |
@@ -363,24 +359,20 @@ static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) | |||
363 | int hdrlen, len, tail; | 359 | int hdrlen, len, tail; |
364 | u8 *pos, *pn; | 360 | u8 *pos, *pn; |
365 | int i; | 361 | int i; |
366 | bool skip_hw; | ||
367 | |||
368 | skip_hw = (tx->key->conf.flags & IEEE80211_KEY_FLAG_SW_MGMT) && | ||
369 | ieee80211_is_mgmt(hdr->frame_control); | ||
370 | 362 | ||
371 | if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) && | 363 | if (info->control.hw_key && |
372 | !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) && | 364 | !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV)) { |
373 | !skip_hw) { | 365 | /* |
374 | /* hwaccel - with no need for preallocated room for CCMP | 366 | * hwaccel has no need for preallocated room for CCMP |
375 | * header or MIC fields */ | 367 | * header or MIC fields |
376 | info->control.hw_key = &tx->key->conf; | 368 | */ |
377 | return 0; | 369 | return 0; |
378 | } | 370 | } |
379 | 371 | ||
380 | hdrlen = ieee80211_hdrlen(hdr->frame_control); | 372 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
381 | len = skb->len - hdrlen; | 373 | len = skb->len - hdrlen; |
382 | 374 | ||
383 | if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) | 375 | if (info->control.hw_key) |
384 | tail = 0; | 376 | tail = 0; |
385 | else | 377 | else |
386 | tail = CCMP_MIC_LEN; | 378 | tail = CCMP_MIC_LEN; |
@@ -405,11 +397,9 @@ static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) | |||
405 | 397 | ||
406 | ccmp_pn2hdr(pos, pn, key->conf.keyidx); | 398 | ccmp_pn2hdr(pos, pn, key->conf.keyidx); |
407 | 399 | ||
408 | if ((key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) && !skip_hw) { | 400 | /* hwaccel - with software CCMP header */ |
409 | /* hwaccel - with preallocated room for CCMP header */ | 401 | if (info->control.hw_key) |
410 | info->control.hw_key = &tx->key->conf; | ||
411 | return 0; | 402 | return 0; |
412 | } | ||
413 | 403 | ||
414 | pos += CCMP_HDR_LEN; | 404 | pos += CCMP_HDR_LEN; |
415 | ccmp_special_blocks(skb, pn, key->u.ccmp.tx_crypto_buf, 0); | 405 | ccmp_special_blocks(skb, pn, key->u.ccmp.tx_crypto_buf, 0); |
@@ -525,11 +515,8 @@ ieee80211_crypto_aes_cmac_encrypt(struct ieee80211_tx_data *tx) | |||
525 | u8 *pn, aad[20]; | 515 | u8 *pn, aad[20]; |
526 | int i; | 516 | int i; |
527 | 517 | ||
528 | if (tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) { | 518 | if (info->control.hw_key) |
529 | /* hwaccel */ | ||
530 | info->control.hw_key = &tx->key->conf; | ||
531 | return 0; | 519 | return 0; |
532 | } | ||
533 | 520 | ||
534 | if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie))) | 521 | if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie))) |
535 | return TX_DROP; | 522 | return TX_DROP; |