diff options
author | Patrick McHardy <kaber@trash.net> | 2009-06-11 10:00:49 -0400 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2009-06-11 10:00:49 -0400 |
commit | 36432dae73cf2c90a59b39c8df9fd8219272b005 (patch) | |
tree | 660b9104305a809ec4fdeb295ca13d6e90790ecc /net/mac80211/cfg.c | |
parent | 440f0d588555892601cfe511728a0fc0c8204063 (diff) | |
parent | bb400801c2f40bbd9a688818323ad09abfc4e581 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r-- | net/mac80211/cfg.c | 69 |
1 files changed, 60 insertions, 9 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 77e9ff5ec4f3..3f47276caeb8 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -664,18 +664,19 @@ static void sta_apply_parameters(struct ieee80211_local *local, | |||
664 | spin_unlock_bh(&sta->lock); | 664 | spin_unlock_bh(&sta->lock); |
665 | 665 | ||
666 | /* | 666 | /* |
667 | * cfg80211 validates this (1-2007) and allows setting the AID | ||
668 | * only when creating a new station entry | ||
669 | */ | ||
670 | if (params->aid) | ||
671 | sta->sta.aid = params->aid; | ||
672 | |||
673 | /* | ||
667 | * FIXME: updating the following information is racy when this | 674 | * FIXME: updating the following information is racy when this |
668 | * function is called from ieee80211_change_station(). | 675 | * function is called from ieee80211_change_station(). |
669 | * However, all this information should be static so | 676 | * However, all this information should be static so |
670 | * maybe we should just reject attemps to change it. | 677 | * maybe we should just reject attemps to change it. |
671 | */ | 678 | */ |
672 | 679 | ||
673 | if (params->aid) { | ||
674 | sta->sta.aid = params->aid; | ||
675 | if (sta->sta.aid > IEEE80211_MAX_AID) | ||
676 | sta->sta.aid = 0; /* XXX: should this be an error? */ | ||
677 | } | ||
678 | |||
679 | if (params->listen_interval >= 0) | 680 | if (params->listen_interval >= 0) |
680 | sta->listen_interval = params->listen_interval; | 681 | sta->listen_interval = params->listen_interval; |
681 | 682 | ||
@@ -1121,8 +1122,8 @@ static int ieee80211_set_txq_params(struct wiphy *wiphy, | |||
1121 | p.txop = params->txop; | 1122 | p.txop = params->txop; |
1122 | if (drv_conf_tx(local, params->queue, &p)) { | 1123 | if (drv_conf_tx(local, params->queue, &p)) { |
1123 | printk(KERN_DEBUG "%s: failed to set TX queue " | 1124 | printk(KERN_DEBUG "%s: failed to set TX queue " |
1124 | "parameters for queue %d\n", local->mdev->name, | 1125 | "parameters for queue %d\n", |
1125 | params->queue); | 1126 | wiphy_name(local->hw.wiphy), params->queue); |
1126 | return -EINVAL; | 1127 | return -EINVAL; |
1127 | } | 1128 | } |
1128 | 1129 | ||
@@ -1255,7 +1256,7 @@ static int ieee80211_assoc(struct wiphy *wiphy, struct net_device *dev, | |||
1255 | sdata->u.mgd.flags |= IEEE80211_STA_AUTO_SSID_SEL; | 1256 | sdata->u.mgd.flags |= IEEE80211_STA_AUTO_SSID_SEL; |
1256 | 1257 | ||
1257 | ret = ieee80211_sta_set_extra_ie(sdata, req->ie, req->ie_len); | 1258 | ret = ieee80211_sta_set_extra_ie(sdata, req->ie, req->ie_len); |
1258 | if (ret) | 1259 | if (ret && ret != -EALREADY) |
1259 | return ret; | 1260 | return ret; |
1260 | 1261 | ||
1261 | if (req->use_mfp) { | 1262 | if (req->use_mfp) { |
@@ -1333,6 +1334,53 @@ static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) | |||
1333 | return 0; | 1334 | return 0; |
1334 | } | 1335 | } |
1335 | 1336 | ||
1337 | static int ieee80211_set_tx_power(struct wiphy *wiphy, | ||
1338 | enum tx_power_setting type, int dbm) | ||
1339 | { | ||
1340 | struct ieee80211_local *local = wiphy_priv(wiphy); | ||
1341 | struct ieee80211_channel *chan = local->hw.conf.channel; | ||
1342 | u32 changes = 0; | ||
1343 | |||
1344 | switch (type) { | ||
1345 | case TX_POWER_AUTOMATIC: | ||
1346 | local->user_power_level = -1; | ||
1347 | break; | ||
1348 | case TX_POWER_LIMITED: | ||
1349 | if (dbm < 0) | ||
1350 | return -EINVAL; | ||
1351 | local->user_power_level = dbm; | ||
1352 | break; | ||
1353 | case TX_POWER_FIXED: | ||
1354 | if (dbm < 0) | ||
1355 | return -EINVAL; | ||
1356 | /* TODO: move to cfg80211 when it knows the channel */ | ||
1357 | if (dbm > chan->max_power) | ||
1358 | return -EINVAL; | ||
1359 | local->user_power_level = dbm; | ||
1360 | break; | ||
1361 | } | ||
1362 | |||
1363 | ieee80211_hw_config(local, changes); | ||
1364 | |||
1365 | return 0; | ||
1366 | } | ||
1367 | |||
1368 | static int ieee80211_get_tx_power(struct wiphy *wiphy, int *dbm) | ||
1369 | { | ||
1370 | struct ieee80211_local *local = wiphy_priv(wiphy); | ||
1371 | |||
1372 | *dbm = local->hw.conf.power_level; | ||
1373 | |||
1374 | return 0; | ||
1375 | } | ||
1376 | |||
1377 | static void ieee80211_rfkill_poll(struct wiphy *wiphy) | ||
1378 | { | ||
1379 | struct ieee80211_local *local = wiphy_priv(wiphy); | ||
1380 | |||
1381 | drv_rfkill_poll(local); | ||
1382 | } | ||
1383 | |||
1336 | struct cfg80211_ops mac80211_config_ops = { | 1384 | struct cfg80211_ops mac80211_config_ops = { |
1337 | .add_virtual_intf = ieee80211_add_iface, | 1385 | .add_virtual_intf = ieee80211_add_iface, |
1338 | .del_virtual_intf = ieee80211_del_iface, | 1386 | .del_virtual_intf = ieee80211_del_iface, |
@@ -1372,4 +1420,7 @@ struct cfg80211_ops mac80211_config_ops = { | |||
1372 | .join_ibss = ieee80211_join_ibss, | 1420 | .join_ibss = ieee80211_join_ibss, |
1373 | .leave_ibss = ieee80211_leave_ibss, | 1421 | .leave_ibss = ieee80211_leave_ibss, |
1374 | .set_wiphy_params = ieee80211_set_wiphy_params, | 1422 | .set_wiphy_params = ieee80211_set_wiphy_params, |
1423 | .set_tx_power = ieee80211_set_tx_power, | ||
1424 | .get_tx_power = ieee80211_get_tx_power, | ||
1425 | .rfkill_poll = ieee80211_rfkill_poll, | ||
1375 | }; | 1426 | }; |