util.c (e7d9facf0bab6d919342fea17c8cc0f65f8a0fe9) util.c (55de908ab292c03f1eb280f51170ddb9c6b57e31)
1/*
2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2005-2006, Devicescape Software, Inc.
4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
5 * Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
6 *
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

--- 818 unchanged lines hidden (view full) ---

827 ieee802_11_parse_elems_crc(start, len, elems, 0, 0);
828}
829
830void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata,
831 bool bss_notify)
832{
833 struct ieee80211_local *local = sdata->local;
834 struct ieee80211_tx_queue_params qparam;
1/*
2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2005-2006, Devicescape Software, Inc.
4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
5 * Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
6 *
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

--- 818 unchanged lines hidden (view full) ---

827 ieee802_11_parse_elems_crc(start, len, elems, 0, 0);
828}
829
830void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata,
831 bool bss_notify)
832{
833 struct ieee80211_local *local = sdata->local;
834 struct ieee80211_tx_queue_params qparam;
835 struct ieee80211_chanctx_conf *chanctx_conf;
835 int ac;
836 bool use_11b, enable_qos;
837 int aCWmin, aCWmax;
838
839 if (!local->ops->conf_tx)
840 return;
841
842 if (local->hw.queues < IEEE80211_NUM_ACS)
843 return;
844
845 memset(&qparam, 0, sizeof(qparam));
846
836 int ac;
837 bool use_11b, enable_qos;
838 int aCWmin, aCWmax;
839
840 if (!local->ops->conf_tx)
841 return;
842
843 if (local->hw.queues < IEEE80211_NUM_ACS)
844 return;
845
846 memset(&qparam, 0, sizeof(qparam));
847
847 use_11b = (local->oper_channel->band == IEEE80211_BAND_2GHZ) &&
848 rcu_read_lock();
849 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
850 use_11b = (chanctx_conf &&
851 chanctx_conf->channel->band == IEEE80211_BAND_2GHZ) &&
848 !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE);
852 !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE);
853 rcu_read_unlock();
849
850 /*
851 * By default disable QoS in STA mode for old access points, which do
852 * not support 802.11e. New APs will provide proper queue parameters,
853 * that we will configure later.
854 */
855 enable_qos = (sdata->vif.type != NL80211_IFTYPE_STATION);
856

--- 62 unchanged lines hidden (view full) ---

919 BSS_CHANGED_QOS);
920 }
921}
922
923void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata,
924 const size_t supp_rates_len,
925 const u8 *supp_rates)
926{
854
855 /*
856 * By default disable QoS in STA mode for old access points, which do
857 * not support 802.11e. New APs will provide proper queue parameters,
858 * that we will configure later.
859 */
860 enable_qos = (sdata->vif.type != NL80211_IFTYPE_STATION);
861

--- 62 unchanged lines hidden (view full) ---

924 BSS_CHANGED_QOS);
925 }
926}
927
928void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata,
929 const size_t supp_rates_len,
930 const u8 *supp_rates)
931{
927 struct ieee80211_local *local = sdata->local;
932 struct ieee80211_chanctx_conf *chanctx_conf;
928 int i, have_higher_than_11mbit = 0;
929
930 /* cf. IEEE 802.11 9.2.12 */
931 for (i = 0; i < supp_rates_len; i++)
932 if ((supp_rates[i] & 0x7f) * 5 > 110)
933 have_higher_than_11mbit = 1;
934
933 int i, have_higher_than_11mbit = 0;
934
935 /* cf. IEEE 802.11 9.2.12 */
936 for (i = 0; i < supp_rates_len; i++)
937 if ((supp_rates[i] & 0x7f) * 5 > 110)
938 have_higher_than_11mbit = 1;
939
935 if (local->oper_channel->band == IEEE80211_BAND_2GHZ &&
940 rcu_read_lock();
941 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
942
943 if (chanctx_conf &&
944 chanctx_conf->channel->band == IEEE80211_BAND_2GHZ &&
936 have_higher_than_11mbit)
937 sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE;
938 else
939 sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE;
945 have_higher_than_11mbit)
946 sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE;
947 else
948 sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE;
949 rcu_read_unlock();
940
941 ieee80211_set_wmm_default(sdata, true);
942}
943
944u32 ieee80211_mandatory_rates(struct ieee80211_local *local,
945 enum ieee80211_band band)
946{
947 struct ieee80211_supported_band *sband;

--- 253 unchanged lines hidden (view full) ---

1201
1202 return skb;
1203}
1204
1205void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
1206 const u8 *ssid, size_t ssid_len,
1207 const u8 *ie, size_t ie_len,
1208 u32 ratemask, bool directed, bool no_cck,
950
951 ieee80211_set_wmm_default(sdata, true);
952}
953
954u32 ieee80211_mandatory_rates(struct ieee80211_local *local,
955 enum ieee80211_band band)
956{
957 struct ieee80211_supported_band *sband;

--- 253 unchanged lines hidden (view full) ---

1211
1212 return skb;
1213}
1214
1215void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
1216 const u8 *ssid, size_t ssid_len,
1217 const u8 *ie, size_t ie_len,
1218 u32 ratemask, bool directed, bool no_cck,
1209 struct ieee80211_channel *channel)
1219 struct ieee80211_channel *channel, bool scan)
1210{
1211 struct sk_buff *skb;
1212
1213 skb = ieee80211_build_probe_req(sdata, dst, ratemask, channel,
1214 ssid, ssid_len,
1215 ie, ie_len, directed);
1216 if (skb) {
1217 if (no_cck)
1218 IEEE80211_SKB_CB(skb)->flags |=
1219 IEEE80211_TX_CTL_NO_CCK_RATE;
1220{
1221 struct sk_buff *skb;
1222
1223 skb = ieee80211_build_probe_req(sdata, dst, ratemask, channel,
1224 ssid, ssid_len,
1225 ie, ie_len, directed);
1226 if (skb) {
1227 if (no_cck)
1228 IEEE80211_SKB_CB(skb)->flags |=
1229 IEEE80211_TX_CTL_NO_CCK_RATE;
1220 ieee80211_tx_skb(sdata, skb);
1230 if (scan)
1231 ieee80211_tx_skb_tid_band(sdata, skb, 7, channel->band);
1232 else
1233 ieee80211_tx_skb(sdata, skb);
1221 }
1222}
1223
1224u32 ieee80211_sta_get_rates(struct ieee80211_local *local,
1225 struct ieee802_11_elems *elems,
1226 enum ieee80211_band band, u32 *basic_rates)
1227{
1228 struct ieee80211_supported_band *sband;

--- 46 unchanged lines hidden (view full) ---

1275 flush_workqueue(local->workqueue);
1276 drv_stop(local);
1277}
1278
1279int ieee80211_reconfig(struct ieee80211_local *local)
1280{
1281 struct ieee80211_hw *hw = &local->hw;
1282 struct ieee80211_sub_if_data *sdata;
1234 }
1235}
1236
1237u32 ieee80211_sta_get_rates(struct ieee80211_local *local,
1238 struct ieee802_11_elems *elems,
1239 enum ieee80211_band band, u32 *basic_rates)
1240{
1241 struct ieee80211_supported_band *sband;

--- 46 unchanged lines hidden (view full) ---

1288 flush_workqueue(local->workqueue);
1289 drv_stop(local);
1290}
1291
1292int ieee80211_reconfig(struct ieee80211_local *local)
1293{
1294 struct ieee80211_hw *hw = &local->hw;
1295 struct ieee80211_sub_if_data *sdata;
1296 struct ieee80211_chanctx *ctx;
1283 struct sta_info *sta;
1284 int res, i;
1285
1286#ifdef CONFIG_PM
1287 if (local->suspended)
1288 local->resuming = true;
1289
1290 if (local->wowlan) {

--- 56 unchanged lines hidden (view full) ---

1347
1348 list_for_each_entry(sdata, &local->interfaces, list) {
1349 if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
1350 sdata->vif.type != NL80211_IFTYPE_MONITOR &&
1351 ieee80211_sdata_running(sdata))
1352 res = drv_add_interface(local, sdata);
1353 }
1354
1297 struct sta_info *sta;
1298 int res, i;
1299
1300#ifdef CONFIG_PM
1301 if (local->suspended)
1302 local->resuming = true;
1303
1304 if (local->wowlan) {

--- 56 unchanged lines hidden (view full) ---

1361
1362 list_for_each_entry(sdata, &local->interfaces, list) {
1363 if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
1364 sdata->vif.type != NL80211_IFTYPE_MONITOR &&
1365 ieee80211_sdata_running(sdata))
1366 res = drv_add_interface(local, sdata);
1367 }
1368
1369 /* add channel contexts */
1370 mutex_lock(&local->chanctx_mtx);
1371 list_for_each_entry(ctx, &local->chanctx_list, list)
1372 WARN_ON(drv_add_chanctx(local, ctx));
1373 mutex_unlock(&local->chanctx_mtx);
1374
1355 /* add STAs back */
1356 mutex_lock(&local->sta_mtx);
1357 list_for_each_entry(sta, &local->sta_list, list) {
1358 enum ieee80211_sta_state state;
1359
1360 if (!sta->uploaded)
1361 continue;
1362

--- 24 unchanged lines hidden (view full) ---

1387
1388 /* reconfigure hardware */
1389 ieee80211_hw_config(local, ~0);
1390
1391 ieee80211_configure_filter(local);
1392
1393 /* Finally also reconfigure all the BSS information */
1394 list_for_each_entry(sdata, &local->interfaces, list) {
1375 /* add STAs back */
1376 mutex_lock(&local->sta_mtx);
1377 list_for_each_entry(sta, &local->sta_list, list) {
1378 enum ieee80211_sta_state state;
1379
1380 if (!sta->uploaded)
1381 continue;
1382

--- 24 unchanged lines hidden (view full) ---

1407
1408 /* reconfigure hardware */
1409 ieee80211_hw_config(local, ~0);
1410
1411 ieee80211_configure_filter(local);
1412
1413 /* Finally also reconfigure all the BSS information */
1414 list_for_each_entry(sdata, &local->interfaces, list) {
1415 struct ieee80211_chanctx_conf *ctx_conf;
1395 u32 changed;
1396
1397 if (!ieee80211_sdata_running(sdata))
1398 continue;
1399
1416 u32 changed;
1417
1418 if (!ieee80211_sdata_running(sdata))
1419 continue;
1420
1421 mutex_lock(&local->chanctx_mtx);
1422 ctx_conf = rcu_dereference_protected(sdata->vif.chanctx_conf,
1423 lockdep_is_held(&local->chanctx_mtx));
1424 if (ctx_conf) {
1425 ctx = container_of(ctx_conf, struct ieee80211_chanctx,
1426 conf);
1427 drv_assign_vif_chanctx(local, sdata, ctx);
1428 }
1429 mutex_unlock(&local->chanctx_mtx);
1430
1400 /* common change flags for all interface types */
1401 changed = BSS_CHANGED_ERP_CTS_PROT |
1402 BSS_CHANGED_ERP_PREAMBLE |
1403 BSS_CHANGED_ERP_SLOT |
1404 BSS_CHANGED_HT |
1405 BSS_CHANGED_BASIC_RATES |
1406 BSS_CHANGED_BEACON_INT |
1407 BSS_CHANGED_BSSID |

--- 542 unchanged lines hidden ---
1431 /* common change flags for all interface types */
1432 changed = BSS_CHANGED_ERP_CTS_PROT |
1433 BSS_CHANGED_ERP_PREAMBLE |
1434 BSS_CHANGED_ERP_SLOT |
1435 BSS_CHANGED_HT |
1436 BSS_CHANGED_BASIC_RATES |
1437 BSS_CHANGED_BEACON_INT |
1438 BSS_CHANGED_BSSID |

--- 542 unchanged lines hidden ---