diff options
author | Jouni Malinen <jouni.malinen@atheros.com> | 2010-01-06 06:09:08 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-01-12 13:50:11 -0500 |
commit | 37eb0b164cf9fa9f70c8500926f5cde7c652f48e (patch) | |
tree | 9260e7045f32268c8c4ded718677711d371cd5ed /net/mac80211/cfg.c | |
parent | e00cfce0cb2a397859607bf515c6de9ce064b64a (diff) |
cfg80211/mac80211: Use more generic bitrate mask for rate control
Extend struct cfg80211_bitrate_mask to actually use a bitfield mask
instead of just a single fixed or maximum rate index. This change
itself does not modify the behavior (except for debugfs files), but it
prepares cfg80211 and mac80211 for a new nl80211 command for setting
which rates can be used in TX rate control.
Since frames are now going through the rate control algorithm
unconditionally, the internal IEEE80211_TX_INTFL_RCALGO flag can now
be removed. The RC implementations can use the rate_idx_mask value to
optimize their behavior if only a single rate is enabled.
The old max_rate_idx in struct ieee80211_tx_rate_control is maintained
(but commented as deprecated) for backwards compatibility with existing
RC implementations. Once these implementations have been updated to
use the more generic rate_idx_mask, the max_rate_idx value can be
removed.
Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r-- | net/mac80211/cfg.c | 32 |
1 files changed, 3 insertions, 29 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 976014c5e742..e5dda6fb8dff 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -1406,8 +1406,6 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy, | |||
1406 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 1406 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
1407 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1407 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
1408 | int i; | 1408 | int i; |
1409 | u32 target_rate; | ||
1410 | struct ieee80211_supported_band *sband; | ||
1411 | 1409 | ||
1412 | /* | 1410 | /* |
1413 | * This _could_ be supported by providing a hook for | 1411 | * This _could_ be supported by providing a hook for |
@@ -1417,35 +1415,11 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy, | |||
1417 | if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) | 1415 | if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) |
1418 | return -EOPNOTSUPP; | 1416 | return -EOPNOTSUPP; |
1419 | 1417 | ||
1420 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
1421 | |||
1422 | /* | ||
1423 | * target_rate = -1, rate->fixed = 0 means auto only, so use all rates | ||
1424 | * target_rate = X, rate->fixed = 1 means only rate X | ||
1425 | * target_rate = X, rate->fixed = 0 means all rates <= X | ||
1426 | */ | ||
1427 | sdata->max_ratectrl_rateidx = -1; | ||
1428 | sdata->force_unicast_rateidx = -1; | ||
1429 | 1418 | ||
1430 | if (mask->fixed) | 1419 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
1431 | target_rate = mask->fixed / 100; | 1420 | sdata->rc_rateidx_mask[i] = mask->control[i].legacy; |
1432 | else if (mask->maxrate) | ||
1433 | target_rate = mask->maxrate / 100; | ||
1434 | else | ||
1435 | return 0; | ||
1436 | 1421 | ||
1437 | for (i = 0; i< sband->n_bitrates; i++) { | 1422 | return 0; |
1438 | if (target_rate != sband->bitrates[i].bitrate) | ||
1439 | continue; | ||
1440 | |||
1441 | /* requested bitrate found */ | ||
1442 | sdata->max_ratectrl_rateidx = i; | ||
1443 | if (mask->fixed) | ||
1444 | sdata->force_unicast_rateidx = i; | ||
1445 | return 0; | ||
1446 | } | ||
1447 | |||
1448 | return -EINVAL; | ||
1449 | } | 1423 | } |
1450 | 1424 | ||
1451 | static int ieee80211_remain_on_channel(struct wiphy *wiphy, | 1425 | static int ieee80211_remain_on_channel(struct wiphy *wiphy, |