提交 2c7e6bc9 编写于 作者: J Johannes Berg 提交者: John W. Linville

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: NJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 d80050c4
...@@ -1399,15 +1399,25 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy, ...@@ -1399,15 +1399,25 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy,
{ {
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
int i, err = -EINVAL; int i;
u32 target_rate; u32 target_rate;
struct ieee80211_supported_band *sband; struct ieee80211_supported_band *sband;
/*
* This _could_ be supported by providing a hook for
* drivers for this function, but at this point it
* doesn't seem worth bothering.
*/
if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL)
return -EOPNOTSUPP;
sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
/* target_rate = -1, rate->fixed = 0 means auto only, so use all rates /*
* target_rate = -1, rate->fixed = 0 means auto only, so use all rates
* target_rate = X, rate->fixed = 1 means only rate X * target_rate = X, rate->fixed = 1 means only rate X
* target_rate = X, rate->fixed = 0 means all rates <= X */ * target_rate = X, rate->fixed = 0 means all rates <= X
*/
sdata->max_ratectrl_rateidx = -1; sdata->max_ratectrl_rateidx = -1;
sdata->force_unicast_rateidx = -1; sdata->force_unicast_rateidx = -1;
...@@ -1418,20 +1428,18 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy, ...@@ -1418,20 +1428,18 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy,
else else
return 0; return 0;
for (i=0; i< sband->n_bitrates; i++) { for (i = 0; i< sband->n_bitrates; i++) {
struct ieee80211_rate *brate = &sband->bitrates[i]; if (target_rate != sband->bitrates[i].bitrate)
int this_rate = brate->bitrate; continue;
if (target_rate == this_rate) { /* requested bitrate found */
sdata->max_ratectrl_rateidx = i; sdata->max_ratectrl_rateidx = i;
if (mask->fixed) if (mask->fixed)
sdata->force_unicast_rateidx = i; sdata->force_unicast_rateidx = i;
err = 0; return 0;
break;
}
} }
return err; return -EINVAL;
} }
struct cfg80211_ops mac80211_config_ops = { struct cfg80211_ops mac80211_config_ops = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册