aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/cfg.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-12-04 03:26:38 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-12-22 13:46:28 -0500
commit2c7e6bc9ac7cb518cf037495932d80f71a1596f2 (patch)
tree99a83d89eccb9dc9d1f3cf2d2e628812f83b7671 /net/mac80211/cfg.c
parentd80050c4c321a74cea28c6ef9695d8427a928417 (diff)
mac80211: disallow fixing bitrates with hw rate control
When hw rate control is used, these parameters have no meaning because the hardware cannot get at them right now, so disallow setting them. Also clean up the function a bit. 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.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 8c35418d1c96..f07c4abefe56 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1399,15 +1399,25 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy,
1399{ 1399{
1400 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1400 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1401 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1401 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
1402 int i, err = -EINVAL; 1402 int i;
1403 u32 target_rate; 1403 u32 target_rate;
1404 struct ieee80211_supported_band *sband; 1404 struct ieee80211_supported_band *sband;
1405 1405
1406 /*
1407 * This _could_ be supported by providing a hook for
1408 * drivers for this function, but at this point it
1409 * doesn't seem worth bothering.
1410 */
1411 if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL)
1412 return -EOPNOTSUPP;
1413
1406 sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; 1414 sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
1407 1415
1408 /* target_rate = -1, rate->fixed = 0 means auto only, so use all rates 1416 /*
1417 * target_rate = -1, rate->fixed = 0 means auto only, so use all rates
1409 * target_rate = X, rate->fixed = 1 means only rate X 1418 * target_rate = X, rate->fixed = 1 means only rate X
1410 * target_rate = X, rate->fixed = 0 means all rates <= X */ 1419 * target_rate = X, rate->fixed = 0 means all rates <= X
1420 */
1411 sdata->max_ratectrl_rateidx = -1; 1421 sdata->max_ratectrl_rateidx = -1;
1412 sdata->force_unicast_rateidx = -1; 1422 sdata->force_unicast_rateidx = -1;
1413 1423
@@ -1418,20 +1428,18 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy,
1418 else 1428 else
1419 return 0; 1429 return 0;
1420 1430
1421 for (i=0; i< sband->n_bitrates; i++) { 1431 for (i = 0; i< sband->n_bitrates; i++) {
1422 struct ieee80211_rate *brate = &sband->bitrates[i]; 1432 if (target_rate != sband->bitrates[i].bitrate)
1423 int this_rate = brate->bitrate; 1433 continue;
1424 1434
1425 if (target_rate == this_rate) { 1435 /* requested bitrate found */
1426 sdata->max_ratectrl_rateidx = i; 1436 sdata->max_ratectrl_rateidx = i;
1427 if (mask->fixed) 1437 if (mask->fixed)
1428 sdata->force_unicast_rateidx = i; 1438 sdata->force_unicast_rateidx = i;
1429 err = 0; 1439 return 0;
1430 break;
1431 }
1432 } 1440 }
1433 1441
1434 return err; 1442 return -EINVAL;
1435} 1443}
1436 1444
1437struct cfg80211_ops mac80211_config_ops = { 1445struct cfg80211_ops mac80211_config_ops = {