aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2008-10-30 10:59:22 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-11-10 15:17:39 -0500
commit90c97a040d6b08cc4890328aa262fdc37336ab01 (patch)
treed152a2edcb55d2d7b0428721341f7b271ffe39f8
parentfe63bfa3669dbdd4985ed35d9a0ed08881f62516 (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>
-rw-r--r--include/linux/nl80211.h6
-rw-r--r--include/net/cfg80211.h5
-rw-r--r--net/mac80211/cfg.c18
-rw-r--r--net/wireless/nl80211.c8
4 files changed, 37 insertions, 0 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index e4cc7869b22f..5009809588c0 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -243,6 +243,9 @@ enum nl80211_commands {
243 * (u8, 0 or 1) 243 * (u8, 0 or 1)
244 * @NL80211_ATTR_BSS_SHORT_SLOT_TIME: whether short slot time enabled 244 * @NL80211_ATTR_BSS_SHORT_SLOT_TIME: whether short slot time enabled
245 * (u8, 0 or 1) 245 * (u8, 0 or 1)
246 * @NL80211_ATTR_BSS_BASIC_RATES: basic rates, array of basic
247 * rates in format defined by IEEE 802.11 7.3.2.2 but without the length
248 * restriction (at most %NL80211_MAX_SUPP_RATES).
246 * 249 *
247 * @NL80211_ATTR_HT_CAPABILITY: HT Capability information element (from 250 * @NL80211_ATTR_HT_CAPABILITY: HT Capability information element (from
248 * association request when used with NL80211_CMD_NEW_STATION) 251 * association request when used with NL80211_CMD_NEW_STATION)
@@ -307,6 +310,8 @@ enum nl80211_attrs {
307 310
308 NL80211_ATTR_MESH_PARAMS, 311 NL80211_ATTR_MESH_PARAMS,
309 312
313 NL80211_ATTR_BSS_BASIC_RATES,
314
310 /* add attributes here, update the policy in nl80211.c */ 315 /* add attributes here, update the policy in nl80211.c */
311 316
312 __NL80211_ATTR_AFTER_LAST, 317 __NL80211_ATTR_AFTER_LAST,
@@ -318,6 +323,7 @@ enum nl80211_attrs {
318 * here 323 * here
319 */ 324 */
320#define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY 325#define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY
326#define NL80211_ATTR_BSS_BASIC_RATES NL80211_ATTR_BSS_BASIC_RATES
321 327
322#define NL80211_MAX_SUPP_RATES 32 328#define NL80211_MAX_SUPP_RATES 32
323#define NL80211_MAX_SUPP_REG_RULES 32 329#define NL80211_MAX_SUPP_REG_RULES 32
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 03e1e88c6a09..7caf3c76a12f 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -280,11 +280,16 @@ struct mpath_info {
280 * (0 = no, 1 = yes, -1 = do not change) 280 * (0 = no, 1 = yes, -1 = do not change)
281 * @use_short_slot_time: Whether the use of short slot time is allowed 281 * @use_short_slot_time: Whether the use of short slot time is allowed
282 * (0 = no, 1 = yes, -1 = do not change) 282 * (0 = no, 1 = yes, -1 = do not change)
283 * @basic_rates: basic rates in IEEE 802.11 format
284 * (or NULL for no change)
285 * @basic_rates_len: number of basic rates
283 */ 286 */
284struct bss_parameters { 287struct bss_parameters {
285 int use_cts_prot; 288 int use_cts_prot;
286 int use_short_preamble; 289 int use_short_preamble;
287 int use_short_slot_time; 290 int use_short_slot_time;
291 u8 *basic_rates;
292 u8 basic_rates_len;
288}; 293};
289 294
290/** 295/**
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)