aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/mlme.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-05-15 03:52:37 -0400
committerDavid S. Miller <davem@davemloft.net>2008-05-15 03:52:37 -0400
commitf42a44494bcdf03fc851c03d438464d59c0ceaf5 (patch)
tree986ea7b54e9fc79a64863fd7e92eabd99ffd37a3 /net/mac80211/mlme.c
parent63fe46da9c380b3f2bbdf3765044649517cc717c (diff)
parentef85ad541f9a6ccd3f89ec73f92b2d6f45a9d3e8 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6
Diffstat (limited to 'net/mac80211/mlme.c')
-rw-r--r--net/mac80211/mlme.c71
1 files changed, 39 insertions, 32 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 5d7719f44bea..7877d3b3f4cb 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -272,6 +272,12 @@ static void ieee80211_sta_wmm_params(struct net_device *dev,
272 int count; 272 int count;
273 u8 *pos; 273 u8 *pos;
274 274
275 if (!(ifsta->flags & IEEE80211_STA_WMM_ENABLED))
276 return;
277
278 if (!wmm_param)
279 return;
280
275 if (wmm_param_len < 8 || wmm_param[5] /* version */ != 1) 281 if (wmm_param_len < 8 || wmm_param[5] /* version */ != 1)
276 return; 282 return;
277 count = wmm_param[6] & 0x0f; 283 count = wmm_param[6] & 0x0f;
@@ -799,8 +805,10 @@ static void ieee80211_send_assoc(struct net_device *dev,
799 *pos++ = 1; /* WME ver */ 805 *pos++ = 1; /* WME ver */
800 *pos++ = 0; 806 *pos++ = 0;
801 } 807 }
808
802 /* wmm support is a must to HT */ 809 /* wmm support is a must to HT */
803 if (wmm && sband->ht_info.ht_supported) { 810 if (wmm && (ifsta->flags & IEEE80211_STA_WMM_ENABLED) &&
811 sband->ht_info.ht_supported) {
804 __le16 tmp = cpu_to_le16(sband->ht_info.cap); 812 __le16 tmp = cpu_to_le16(sband->ht_info.cap);
805 pos = skb_put(skb, sizeof(struct ieee80211_ht_cap)+2); 813 pos = skb_put(skb, sizeof(struct ieee80211_ht_cap)+2);
806 *pos++ = WLAN_EID_HT_CAPABILITY; 814 *pos++ = WLAN_EID_HT_CAPABILITY;
@@ -1269,7 +1277,7 @@ static void ieee80211_sta_process_addba_request(struct net_device *dev,
1269 1277
1270 1278
1271 /* examine state machine */ 1279 /* examine state machine */
1272 spin_lock_bh(&sta->ampdu_mlme.ampdu_rx); 1280 spin_lock_bh(&sta->lock);
1273 1281
1274 if (sta->ampdu_mlme.tid_state_rx[tid] != HT_AGG_STATE_IDLE) { 1282 if (sta->ampdu_mlme.tid_state_rx[tid] != HT_AGG_STATE_IDLE) {
1275#ifdef CONFIG_MAC80211_HT_DEBUG 1283#ifdef CONFIG_MAC80211_HT_DEBUG
@@ -1336,7 +1344,7 @@ static void ieee80211_sta_process_addba_request(struct net_device *dev,
1336 tid_agg_rx->stored_mpdu_num = 0; 1344 tid_agg_rx->stored_mpdu_num = 0;
1337 status = WLAN_STATUS_SUCCESS; 1345 status = WLAN_STATUS_SUCCESS;
1338end: 1346end:
1339 spin_unlock_bh(&sta->ampdu_mlme.ampdu_rx); 1347 spin_unlock_bh(&sta->lock);
1340 1348
1341end_no_lock: 1349end_no_lock:
1342 ieee80211_send_addba_resp(sta->sdata->dev, sta->addr, tid, 1350 ieee80211_send_addba_resp(sta->sdata->dev, sta->addr, tid,
@@ -1368,10 +1376,10 @@ static void ieee80211_sta_process_addba_resp(struct net_device *dev,
1368 1376
1369 state = &sta->ampdu_mlme.tid_state_tx[tid]; 1377 state = &sta->ampdu_mlme.tid_state_tx[tid];
1370 1378
1371 spin_lock_bh(&sta->ampdu_mlme.ampdu_tx); 1379 spin_lock_bh(&sta->lock);
1372 1380
1373 if (!(*state & HT_ADDBA_REQUESTED_MSK)) { 1381 if (!(*state & HT_ADDBA_REQUESTED_MSK)) {
1374 spin_unlock_bh(&sta->ampdu_mlme.ampdu_tx); 1382 spin_unlock_bh(&sta->lock);
1375 printk(KERN_DEBUG "state not HT_ADDBA_REQUESTED_MSK:" 1383 printk(KERN_DEBUG "state not HT_ADDBA_REQUESTED_MSK:"
1376 "%d\n", *state); 1384 "%d\n", *state);
1377 goto addba_resp_exit; 1385 goto addba_resp_exit;
@@ -1379,7 +1387,7 @@ static void ieee80211_sta_process_addba_resp(struct net_device *dev,
1379 1387
1380 if (mgmt->u.action.u.addba_resp.dialog_token != 1388 if (mgmt->u.action.u.addba_resp.dialog_token !=
1381 sta->ampdu_mlme.tid_tx[tid]->dialog_token) { 1389 sta->ampdu_mlme.tid_tx[tid]->dialog_token) {
1382 spin_unlock_bh(&sta->ampdu_mlme.ampdu_tx); 1390 spin_unlock_bh(&sta->lock);
1383#ifdef CONFIG_MAC80211_HT_DEBUG 1391#ifdef CONFIG_MAC80211_HT_DEBUG
1384 printk(KERN_DEBUG "wrong addBA response token, tid %d\n", tid); 1392 printk(KERN_DEBUG "wrong addBA response token, tid %d\n", tid);
1385#endif /* CONFIG_MAC80211_HT_DEBUG */ 1393#endif /* CONFIG_MAC80211_HT_DEBUG */
@@ -1403,7 +1411,7 @@ static void ieee80211_sta_process_addba_resp(struct net_device *dev,
1403 ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]); 1411 ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]);
1404 } 1412 }
1405 1413
1406 spin_unlock_bh(&sta->ampdu_mlme.ampdu_tx); 1414 spin_unlock_bh(&sta->lock);
1407 printk(KERN_DEBUG "recipient accepted agg: tid %d \n", tid); 1415 printk(KERN_DEBUG "recipient accepted agg: tid %d \n", tid);
1408 } else { 1416 } else {
1409 printk(KERN_DEBUG "recipient rejected agg: tid %d \n", tid); 1417 printk(KERN_DEBUG "recipient rejected agg: tid %d \n", tid);
@@ -1411,7 +1419,7 @@ static void ieee80211_sta_process_addba_resp(struct net_device *dev,
1411 sta->ampdu_mlme.addba_req_num[tid]++; 1419 sta->ampdu_mlme.addba_req_num[tid]++;
1412 /* this will allow the state check in stop_BA_session */ 1420 /* this will allow the state check in stop_BA_session */
1413 *state = HT_AGG_STATE_OPERATIONAL; 1421 *state = HT_AGG_STATE_OPERATIONAL;
1414 spin_unlock_bh(&sta->ampdu_mlme.ampdu_tx); 1422 spin_unlock_bh(&sta->lock);
1415 ieee80211_stop_tx_ba_session(hw, sta->addr, tid, 1423 ieee80211_stop_tx_ba_session(hw, sta->addr, tid,
1416 WLAN_BACK_INITIATOR); 1424 WLAN_BACK_INITIATOR);
1417 } 1425 }
@@ -1481,17 +1489,17 @@ void ieee80211_sta_stop_rx_ba_session(struct net_device *dev, u8 *ra, u16 tid,
1481 } 1489 }
1482 1490
1483 /* check if TID is in operational state */ 1491 /* check if TID is in operational state */
1484 spin_lock_bh(&sta->ampdu_mlme.ampdu_rx); 1492 spin_lock_bh(&sta->lock);
1485 if (sta->ampdu_mlme.tid_state_rx[tid] 1493 if (sta->ampdu_mlme.tid_state_rx[tid]
1486 != HT_AGG_STATE_OPERATIONAL) { 1494 != HT_AGG_STATE_OPERATIONAL) {
1487 spin_unlock_bh(&sta->ampdu_mlme.ampdu_rx); 1495 spin_unlock_bh(&sta->lock);
1488 rcu_read_unlock(); 1496 rcu_read_unlock();
1489 return; 1497 return;
1490 } 1498 }
1491 sta->ampdu_mlme.tid_state_rx[tid] = 1499 sta->ampdu_mlme.tid_state_rx[tid] =
1492 HT_AGG_STATE_REQ_STOP_BA_MSK | 1500 HT_AGG_STATE_REQ_STOP_BA_MSK |
1493 (initiator << HT_AGG_STATE_INITIATOR_SHIFT); 1501 (initiator << HT_AGG_STATE_INITIATOR_SHIFT);
1494 spin_unlock_bh(&sta->ampdu_mlme.ampdu_rx); 1502 spin_unlock_bh(&sta->lock);
1495 1503
1496 /* stop HW Rx aggregation. ampdu_action existence 1504 /* stop HW Rx aggregation. ampdu_action existence
1497 * already verified in session init so we add the BUG_ON */ 1505 * already verified in session init so we add the BUG_ON */
@@ -1568,10 +1576,10 @@ static void ieee80211_sta_process_delba(struct net_device *dev,
1568 ieee80211_sta_stop_rx_ba_session(dev, sta->addr, tid, 1576 ieee80211_sta_stop_rx_ba_session(dev, sta->addr, tid,
1569 WLAN_BACK_INITIATOR, 0); 1577 WLAN_BACK_INITIATOR, 0);
1570 else { /* WLAN_BACK_RECIPIENT */ 1578 else { /* WLAN_BACK_RECIPIENT */
1571 spin_lock_bh(&sta->ampdu_mlme.ampdu_tx); 1579 spin_lock_bh(&sta->lock);
1572 sta->ampdu_mlme.tid_state_tx[tid] = 1580 sta->ampdu_mlme.tid_state_tx[tid] =
1573 HT_AGG_STATE_OPERATIONAL; 1581 HT_AGG_STATE_OPERATIONAL;
1574 spin_unlock_bh(&sta->ampdu_mlme.ampdu_tx); 1582 spin_unlock_bh(&sta->lock);
1575 ieee80211_stop_tx_ba_session(&local->hw, sta->addr, tid, 1583 ieee80211_stop_tx_ba_session(&local->hw, sta->addr, tid,
1576 WLAN_BACK_RECIPIENT); 1584 WLAN_BACK_RECIPIENT);
1577 } 1585 }
@@ -1608,9 +1616,9 @@ void sta_addba_resp_timer_expired(unsigned long data)
1608 1616
1609 state = &sta->ampdu_mlme.tid_state_tx[tid]; 1617 state = &sta->ampdu_mlme.tid_state_tx[tid];
1610 /* check if the TID waits for addBA response */ 1618 /* check if the TID waits for addBA response */
1611 spin_lock_bh(&sta->ampdu_mlme.ampdu_tx); 1619 spin_lock_bh(&sta->lock);
1612 if (!(*state & HT_ADDBA_REQUESTED_MSK)) { 1620 if (!(*state & HT_ADDBA_REQUESTED_MSK)) {
1613 spin_unlock_bh(&sta->ampdu_mlme.ampdu_tx); 1621 spin_unlock_bh(&sta->lock);
1614 *state = HT_AGG_STATE_IDLE; 1622 *state = HT_AGG_STATE_IDLE;
1615 printk(KERN_DEBUG "timer expired on tid %d but we are not " 1623 printk(KERN_DEBUG "timer expired on tid %d but we are not "
1616 "expecting addBA response there", tid); 1624 "expecting addBA response there", tid);
@@ -1621,7 +1629,7 @@ void sta_addba_resp_timer_expired(unsigned long data)
1621 1629
1622 /* go through the state check in stop_BA_session */ 1630 /* go through the state check in stop_BA_session */
1623 *state = HT_AGG_STATE_OPERATIONAL; 1631 *state = HT_AGG_STATE_OPERATIONAL;
1624 spin_unlock_bh(&sta->ampdu_mlme.ampdu_tx); 1632 spin_unlock_bh(&sta->lock);
1625 ieee80211_stop_tx_ba_session(hw, temp_sta->addr, tid, 1633 ieee80211_stop_tx_ba_session(hw, temp_sta->addr, tid,
1626 WLAN_BACK_INITIATOR); 1634 WLAN_BACK_INITIATOR);
1627 1635
@@ -1987,8 +1995,8 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
1987 local->hw.conf.channel->center_freq, 1995 local->hw.conf.channel->center_freq,
1988 ifsta->ssid, ifsta->ssid_len); 1996 ifsta->ssid, ifsta->ssid_len);
1989 if (bss) { 1997 if (bss) {
1990 sta->last_rssi = bss->rssi;
1991 sta->last_signal = bss->signal; 1998 sta->last_signal = bss->signal;
1999 sta->last_qual = bss->qual;
1992 sta->last_noise = bss->noise; 2000 sta->last_noise = bss->noise;
1993 ieee80211_rx_bss_put(dev, bss); 2001 ieee80211_rx_bss_put(dev, bss);
1994 } 2002 }
@@ -2012,8 +2020,8 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
2012 * to between the sta_info_alloc() and sta_info_insert() above. 2020 * to between the sta_info_alloc() and sta_info_insert() above.
2013 */ 2021 */
2014 2022
2015 sta->flags |= WLAN_STA_AUTH | WLAN_STA_ASSOC | WLAN_STA_ASSOC_AP | 2023 set_sta_flags(sta, WLAN_STA_AUTH | WLAN_STA_ASSOC | WLAN_STA_ASSOC_AP |
2016 WLAN_STA_AUTHORIZED; 2024 WLAN_STA_AUTHORIZED);
2017 2025
2018 rates = 0; 2026 rates = 0;
2019 basic_rates = 0; 2027 basic_rates = 0;
@@ -2057,7 +2065,8 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
2057 else 2065 else
2058 sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE; 2066 sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE;
2059 2067
2060 if (elems.ht_cap_elem && elems.ht_info_elem && elems.wmm_param) { 2068 if (elems.ht_cap_elem && elems.ht_info_elem && elems.wmm_param &&
2069 (ifsta->flags & IEEE80211_STA_WMM_ENABLED)) {
2061 struct ieee80211_ht_bss_info bss_info; 2070 struct ieee80211_ht_bss_info bss_info;
2062 ieee80211_ht_cap_ie_to_ht_info( 2071 ieee80211_ht_cap_ie_to_ht_info(
2063 (struct ieee80211_ht_cap *) 2072 (struct ieee80211_ht_cap *)
@@ -2070,8 +2079,8 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
2070 2079
2071 rate_control_rate_init(sta, local); 2080 rate_control_rate_init(sta, local);
2072 2081
2073 if (elems.wmm_param && (ifsta->flags & IEEE80211_STA_WMM_ENABLED)) { 2082 if (elems.wmm_param) {
2074 sta->flags |= WLAN_STA_WME; 2083 set_sta_flags(sta, WLAN_STA_WME);
2075 rcu_read_unlock(); 2084 rcu_read_unlock();
2076 ieee80211_sta_wmm_params(dev, ifsta, elems.wmm_param, 2085 ieee80211_sta_wmm_params(dev, ifsta, elems.wmm_param,
2077 elems.wmm_param_len); 2086 elems.wmm_param_len);
@@ -2656,9 +2665,9 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
2656 2665
2657 bss->timestamp = beacon_timestamp; 2666 bss->timestamp = beacon_timestamp;
2658 bss->last_update = jiffies; 2667 bss->last_update = jiffies;
2659 bss->rssi = rx_status->ssi;
2660 bss->signal = rx_status->signal; 2668 bss->signal = rx_status->signal;
2661 bss->noise = rx_status->noise; 2669 bss->noise = rx_status->noise;
2670 bss->qual = rx_status->qual;
2662 if (!beacon && !bss->probe_resp) 2671 if (!beacon && !bss->probe_resp)
2663 bss->probe_resp = true; 2672 bss->probe_resp = true;
2664 2673
@@ -2853,10 +2862,8 @@ static void ieee80211_rx_mgmt_beacon(struct net_device *dev,
2853 2862
2854 ieee802_11_parse_elems(mgmt->u.beacon.variable, len - baselen, &elems); 2863 ieee802_11_parse_elems(mgmt->u.beacon.variable, len - baselen, &elems);
2855 2864
2856 if (elems.wmm_param && (ifsta->flags & IEEE80211_STA_WMM_ENABLED)) { 2865 ieee80211_sta_wmm_params(dev, ifsta, elems.wmm_param,
2857 ieee80211_sta_wmm_params(dev, ifsta, elems.wmm_param, 2866 elems.wmm_param_len);
2858 elems.wmm_param_len);
2859 }
2860 2867
2861 /* Do not send changes to driver if we are scanning. This removes 2868 /* Do not send changes to driver if we are scanning. This removes
2862 * requirement that driver's bss_info_changed function needs to be 2869 * requirement that driver's bss_info_changed function needs to be
@@ -3456,9 +3463,9 @@ static int ieee80211_sta_config_auth(struct net_device *dev,
3456 !ieee80211_sta_match_ssid(ifsta, bss->ssid, bss->ssid_len)) 3463 !ieee80211_sta_match_ssid(ifsta, bss->ssid, bss->ssid_len))
3457 continue; 3464 continue;
3458 3465
3459 if (!selected || top_rssi < bss->rssi) { 3466 if (!selected || top_rssi < bss->signal) {
3460 selected = bss; 3467 selected = bss;
3461 top_rssi = bss->rssi; 3468 top_rssi = bss->signal;
3462 } 3469 }
3463 } 3470 }
3464 if (selected) 3471 if (selected)
@@ -4089,8 +4096,8 @@ ieee80211_sta_scan_result(struct net_device *dev,
4089 4096
4090 memset(&iwe, 0, sizeof(iwe)); 4097 memset(&iwe, 0, sizeof(iwe));
4091 iwe.cmd = IWEVQUAL; 4098 iwe.cmd = IWEVQUAL;
4092 iwe.u.qual.qual = bss->signal; 4099 iwe.u.qual.qual = bss->qual;
4093 iwe.u.qual.level = bss->rssi; 4100 iwe.u.qual.level = bss->signal;
4094 iwe.u.qual.noise = bss->noise; 4101 iwe.u.qual.noise = bss->noise;
4095 iwe.u.qual.updated = local->wstats_flags; 4102 iwe.u.qual.updated = local->wstats_flags;
4096 current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, 4103 current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe,
@@ -4266,7 +4273,7 @@ struct sta_info *ieee80211_ibss_add_sta(struct net_device *dev,
4266 if (!sta) 4273 if (!sta)
4267 return NULL; 4274 return NULL;
4268 4275
4269 sta->flags |= WLAN_STA_AUTHORIZED; 4276 set_sta_flags(sta, WLAN_STA_AUTHORIZED);
4270 4277
4271 sta->supp_rates[local->hw.conf.channel->band] = 4278 sta->supp_rates[local->hw.conf.channel->band] =
4272 sdata->u.sta.supp_rates_bits[local->hw.conf.channel->band]; 4279 sdata->u.sta.supp_rates_bits[local->hw.conf.channel->band];