diff options
author | Jouni Malinen <j@w1.fi> | 2008-08-25 04:58:58 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-08-29 16:24:09 -0400 |
commit | 36aedc903ea11a4188de0a118d26c9f20afdd272 (patch) | |
tree | 04fbd95246c146c635ad8c36929da44237aae290 | |
parent | 7262d59366f972b898ea134639112d34bcac35b3 (diff) |
mac80211/cfg80211: HT capabilities for NEW_STA
Allow userspace (e.g., hostapd) to set HT capabilities for associated
STAs. This is based on a patch from Zhu Yi <yi.zhu@intel.com> (only
the NL80211_ATTR_HT_CAPABILITY for NEW_STA part is included here).
Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | include/linux/nl80211.h | 12 | ||||
-rw-r--r-- | include/net/cfg80211.h | 1 | ||||
-rw-r--r-- | net/mac80211/cfg.c | 5 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 10 |
4 files changed, 28 insertions, 0 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index 447c02a5190e..0c1147de3ec7 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
@@ -207,6 +207,9 @@ enum nl80211_commands { | |||
207 | * @NL80211_ATTR_BSS_SHORT_SLOT_TIME: whether short slot time enabled | 207 | * @NL80211_ATTR_BSS_SHORT_SLOT_TIME: whether short slot time enabled |
208 | * (u8, 0 or 1) | 208 | * (u8, 0 or 1) |
209 | * | 209 | * |
210 | * @NL80211_ATTR_HT_CAPABILITY: HT Capability information element (from | ||
211 | * association request when used with NL80211_CMD_NEW_STATION) | ||
212 | * | ||
210 | * @NL80211_ATTR_MAX: highest attribute number currently defined | 213 | * @NL80211_ATTR_MAX: highest attribute number currently defined |
211 | * @__NL80211_ATTR_AFTER_LAST: internal use | 214 | * @__NL80211_ATTR_AFTER_LAST: internal use |
212 | */ | 215 | */ |
@@ -254,16 +257,25 @@ enum nl80211_attrs { | |||
254 | NL80211_ATTR_BSS_SHORT_PREAMBLE, | 257 | NL80211_ATTR_BSS_SHORT_PREAMBLE, |
255 | NL80211_ATTR_BSS_SHORT_SLOT_TIME, | 258 | NL80211_ATTR_BSS_SHORT_SLOT_TIME, |
256 | 259 | ||
260 | NL80211_ATTR_HT_CAPABILITY, | ||
261 | |||
257 | /* add attributes here, update the policy in nl80211.c */ | 262 | /* add attributes here, update the policy in nl80211.c */ |
258 | 263 | ||
259 | __NL80211_ATTR_AFTER_LAST, | 264 | __NL80211_ATTR_AFTER_LAST, |
260 | NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 | 265 | NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 |
261 | }; | 266 | }; |
262 | 267 | ||
268 | /* | ||
269 | * Allow user space programs to use #ifdef on new attributes by defining them | ||
270 | * here | ||
271 | */ | ||
272 | #define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY | ||
273 | |||
263 | #define NL80211_MAX_SUPP_RATES 32 | 274 | #define NL80211_MAX_SUPP_RATES 32 |
264 | #define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0 | 275 | #define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0 |
265 | #define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16 | 276 | #define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16 |
266 | #define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24 | 277 | #define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24 |
278 | #define NL80211_HT_CAPABILITY_LEN 26 | ||
267 | 279 | ||
268 | /** | 280 | /** |
269 | * enum nl80211_iftype - (virtual) interface types | 281 | * enum nl80211_iftype - (virtual) interface types |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 7afef14d5c5b..0a72d1e3d3ab 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -152,6 +152,7 @@ struct station_parameters { | |||
152 | u16 aid; | 152 | u16 aid; |
153 | u8 supported_rates_len; | 153 | u8 supported_rates_len; |
154 | u8 plink_action; | 154 | u8 plink_action; |
155 | struct ieee80211_ht_cap *ht_capa; | ||
155 | }; | 156 | }; |
156 | 157 | ||
157 | /** | 158 | /** |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 2b19532f4c8a..928813ce08e2 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -674,6 +674,11 @@ static void sta_apply_parameters(struct ieee80211_local *local, | |||
674 | sta->supp_rates[local->oper_channel->band] = rates; | 674 | sta->supp_rates[local->oper_channel->band] = rates; |
675 | } | 675 | } |
676 | 676 | ||
677 | if (params->ht_capa) { | ||
678 | ieee80211_ht_cap_ie_to_ht_info(params->ht_capa, | ||
679 | &sta->ht_info); | ||
680 | } | ||
681 | |||
677 | if (ieee80211_vif_is_mesh(&sdata->vif) && params->plink_action) { | 682 | if (ieee80211_vif_is_mesh(&sdata->vif) && params->plink_action) { |
678 | switch (params->plink_action) { | 683 | switch (params->plink_action) { |
679 | case PLINK_ACTION_OPEN: | 684 | case PLINK_ACTION_OPEN: |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 47542ee01c57..4d6c02afd6f5 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -91,6 +91,9 @@ static struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] __read_mostly = { | |||
91 | [NL80211_ATTR_BSS_CTS_PROT] = { .type = NLA_U8 }, | 91 | [NL80211_ATTR_BSS_CTS_PROT] = { .type = NLA_U8 }, |
92 | [NL80211_ATTR_BSS_SHORT_PREAMBLE] = { .type = NLA_U8 }, | 92 | [NL80211_ATTR_BSS_SHORT_PREAMBLE] = { .type = NLA_U8 }, |
93 | [NL80211_ATTR_BSS_SHORT_SLOT_TIME] = { .type = NLA_U8 }, | 93 | [NL80211_ATTR_BSS_SHORT_SLOT_TIME] = { .type = NLA_U8 }, |
94 | |||
95 | [NL80211_ATTR_HT_CAPABILITY] = { .type = NLA_BINARY, | ||
96 | .len = NL80211_HT_CAPABILITY_LEN }, | ||
94 | }; | 97 | }; |
95 | 98 | ||
96 | /* message building helper */ | 99 | /* message building helper */ |
@@ -1129,6 +1132,10 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info) | |||
1129 | params.listen_interval = | 1132 | params.listen_interval = |
1130 | nla_get_u16(info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]); | 1133 | nla_get_u16(info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]); |
1131 | 1134 | ||
1135 | if (info->attrs[NL80211_ATTR_HT_CAPABILITY]) | ||
1136 | params.ht_capa = | ||
1137 | nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY]); | ||
1138 | |||
1132 | if (parse_station_flags(info->attrs[NL80211_ATTR_STA_FLAGS], | 1139 | if (parse_station_flags(info->attrs[NL80211_ATTR_STA_FLAGS], |
1133 | ¶ms.station_flags)) | 1140 | ¶ms.station_flags)) |
1134 | return -EINVAL; | 1141 | return -EINVAL; |
@@ -1192,6 +1199,9 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info) | |||
1192 | params.listen_interval = | 1199 | params.listen_interval = |
1193 | nla_get_u16(info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]); | 1200 | nla_get_u16(info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]); |
1194 | params.aid = nla_get_u16(info->attrs[NL80211_ATTR_STA_AID]); | 1201 | params.aid = nla_get_u16(info->attrs[NL80211_ATTR_STA_AID]); |
1202 | if (info->attrs[NL80211_ATTR_HT_CAPABILITY]) | ||
1203 | params.ht_capa = | ||
1204 | nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY]); | ||
1195 | 1205 | ||
1196 | if (parse_station_flags(info->attrs[NL80211_ATTR_STA_FLAGS], | 1206 | if (parse_station_flags(info->attrs[NL80211_ATTR_STA_FLAGS], |
1197 | ¶ms.station_flags)) | 1207 | ¶ms.station_flags)) |