diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-07-01 15:26:59 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-07-10 15:01:52 -0400 |
commit | 9930380f0bd8405fa6a51d644f3de88c30666519 (patch) | |
tree | 71cd68830b11b648d6b79f1575dc9960631a2ab2 /net/mac80211/cfg.c | |
parent | ab737a4f7dbe57b12b73f482a7b973bf00b41942 (diff) |
cfg80211: implement IWRATE
For now, let's implement that using a very hackish way:
simply mirror the wext API in the cfg80211 API. This
will have to be changed later when we implement proper
bitrate API.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r-- | net/mac80211/cfg.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 2cf5bf6378e4..028f6430879d 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -1423,6 +1423,48 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, | |||
1423 | return 0; | 1423 | return 0; |
1424 | } | 1424 | } |
1425 | 1425 | ||
1426 | static int ieee80211_set_bitrate_mask(struct wiphy *wiphy, | ||
1427 | struct net_device *dev, | ||
1428 | const u8 *addr, | ||
1429 | const struct cfg80211_bitrate_mask *mask) | ||
1430 | { | ||
1431 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
1432 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
1433 | int i, err = -EINVAL; | ||
1434 | u32 target_rate; | ||
1435 | struct ieee80211_supported_band *sband; | ||
1436 | |||
1437 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
1438 | |||
1439 | /* target_rate = -1, rate->fixed = 0 means auto only, so use all rates | ||
1440 | * target_rate = X, rate->fixed = 1 means only rate X | ||
1441 | * target_rate = X, rate->fixed = 0 means all rates <= X */ | ||
1442 | sdata->max_ratectrl_rateidx = -1; | ||
1443 | sdata->force_unicast_rateidx = -1; | ||
1444 | |||
1445 | if (mask->fixed) | ||
1446 | target_rate = mask->fixed / 100; | ||
1447 | else if (mask->maxrate) | ||
1448 | target_rate = mask->maxrate / 100; | ||
1449 | else | ||
1450 | return 0; | ||
1451 | |||
1452 | for (i=0; i< sband->n_bitrates; i++) { | ||
1453 | struct ieee80211_rate *brate = &sband->bitrates[i]; | ||
1454 | int this_rate = brate->bitrate; | ||
1455 | |||
1456 | if (target_rate == this_rate) { | ||
1457 | sdata->max_ratectrl_rateidx = i; | ||
1458 | if (mask->fixed) | ||
1459 | sdata->force_unicast_rateidx = i; | ||
1460 | err = 0; | ||
1461 | break; | ||
1462 | } | ||
1463 | } | ||
1464 | |||
1465 | return err; | ||
1466 | } | ||
1467 | |||
1426 | struct cfg80211_ops mac80211_config_ops = { | 1468 | struct cfg80211_ops mac80211_config_ops = { |
1427 | .add_virtual_intf = ieee80211_add_iface, | 1469 | .add_virtual_intf = ieee80211_add_iface, |
1428 | .del_virtual_intf = ieee80211_del_iface, | 1470 | .del_virtual_intf = ieee80211_del_iface, |
@@ -1468,4 +1510,5 @@ struct cfg80211_ops mac80211_config_ops = { | |||
1468 | .rfkill_poll = ieee80211_rfkill_poll, | 1510 | .rfkill_poll = ieee80211_rfkill_poll, |
1469 | CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd) | 1511 | CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd) |
1470 | .set_power_mgmt = ieee80211_set_power_mgmt, | 1512 | .set_power_mgmt = ieee80211_set_power_mgmt, |
1513 | .set_bitrate_mask = ieee80211_set_bitrate_mask, | ||
1471 | }; | 1514 | }; |