diff options
author | Jouni Malinen <j@w1.fi> | 2008-10-30 10:59:22 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-11-10 15:17:39 -0500 |
commit | 90c97a040d6b08cc4890328aa262fdc37336ab01 (patch) | |
tree | d152a2edcb55d2d7b0428721341f7b271ffe39f8 /net | |
parent | fe63bfa3669dbdd4985ed35d9a0ed08881f62516 (diff) |
nl80211: Add basic rate configuration for AP mode
Add a new attribute, NL80211_ATTR_BSS_BASIC_RATES, that can be used with
NL80211_CMD_SET_BSS for userspace (e.g., hostapd) to set which rates are
in the basic rate set.
Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/cfg.c | 18 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 8 |
2 files changed, 26 insertions, 0 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 91f56a48e2b4..442a4d7b1808 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -1046,6 +1046,24 @@ static int ieee80211_change_bss(struct wiphy *wiphy, | |||
1046 | changed |= BSS_CHANGED_ERP_SLOT; | 1046 | changed |= BSS_CHANGED_ERP_SLOT; |
1047 | } | 1047 | } |
1048 | 1048 | ||
1049 | if (params->basic_rates) { | ||
1050 | int i, j; | ||
1051 | u32 rates = 0; | ||
1052 | struct ieee80211_local *local = wiphy_priv(wiphy); | ||
1053 | struct ieee80211_supported_band *sband = | ||
1054 | wiphy->bands[local->oper_channel->band]; | ||
1055 | |||
1056 | for (i = 0; i < params->basic_rates_len; i++) { | ||
1057 | int rate = (params->basic_rates[i] & 0x7f) * 5; | ||
1058 | for (j = 0; j < sband->n_bitrates; j++) { | ||
1059 | if (sband->bitrates[j].bitrate == rate) | ||
1060 | rates |= BIT(j); | ||
1061 | } | ||
1062 | } | ||
1063 | sdata->vif.bss_conf.basic_rates = rates; | ||
1064 | changed |= BSS_CHANGED_BASIC_RATES; | ||
1065 | } | ||
1066 | |||
1049 | ieee80211_bss_info_change_notify(sdata, changed); | 1067 | ieee80211_bss_info_change_notify(sdata, changed); |
1050 | 1068 | ||
1051 | return 0; | 1069 | return 0; |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 5e1d658a8b5a..1ea5e3fd3931 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -95,6 +95,8 @@ static struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] __read_mostly = { | |||
95 | [NL80211_ATTR_BSS_CTS_PROT] = { .type = NLA_U8 }, | 95 | [NL80211_ATTR_BSS_CTS_PROT] = { .type = NLA_U8 }, |
96 | [NL80211_ATTR_BSS_SHORT_PREAMBLE] = { .type = NLA_U8 }, | 96 | [NL80211_ATTR_BSS_SHORT_PREAMBLE] = { .type = NLA_U8 }, |
97 | [NL80211_ATTR_BSS_SHORT_SLOT_TIME] = { .type = NLA_U8 }, | 97 | [NL80211_ATTR_BSS_SHORT_SLOT_TIME] = { .type = NLA_U8 }, |
98 | [NL80211_ATTR_BSS_BASIC_RATES] = { .type = NLA_BINARY, | ||
99 | .len = NL80211_MAX_SUPP_RATES }, | ||
98 | 100 | ||
99 | [NL80211_ATTR_MESH_PARAMS] = { .type = NLA_NESTED }, | 101 | [NL80211_ATTR_MESH_PARAMS] = { .type = NLA_NESTED }, |
100 | 102 | ||
@@ -1613,6 +1615,12 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info) | |||
1613 | if (info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME]) | 1615 | if (info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME]) |
1614 | params.use_short_slot_time = | 1616 | params.use_short_slot_time = |
1615 | nla_get_u8(info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME]); | 1617 | nla_get_u8(info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME]); |
1618 | if (info->attrs[NL80211_ATTR_BSS_BASIC_RATES]) { | ||
1619 | params.basic_rates = | ||
1620 | nla_data(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]); | ||
1621 | params.basic_rates_len = | ||
1622 | nla_len(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]); | ||
1623 | } | ||
1616 | 1624 | ||
1617 | err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev); | 1625 | err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev); |
1618 | if (err) | 1626 | if (err) |