* [RFC 1/2] cfg80211: add VHT support for IBSS @ 2015-01-13 8:35 Janusz Dziedzic 2015-01-13 8:35 ` [RFC 2/2] mac80211: " Janusz Dziedzic 2015-01-14 8:52 ` [RFC 1/2] cfg80211: " Johannes Berg 0 siblings, 2 replies; 4+ messages in thread From: Janusz Dziedzic @ 2015-01-13 8:35 UTC (permalink / raw) To: linux-wireless; +Cc: johannes, Janusz Dziedzic Add VHT support for IBSS. Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com> --- include/net/cfg80211.h | 17 +++++++++++++++++ include/uapi/linux/nl80211.h | 2 ++ net/wireless/nl80211.c | 34 ++++++++++++++++++++++++++++++++-- 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 1977357..d16ce05 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -1712,6 +1712,17 @@ struct cfg80211_disassoc_request { }; /** + * enum cfg80211_ibss_params_flags - Over-ride default IBSS behaviour. + * + * @IBSS_PARAMS_DISABLE_HT: Disable HT (802.11n) + * @IBSS_PARAMS_DISABLE_VHT: Disable VHT + */ +enum cfg80211_ibss_params_flags { + IBSS_PARAMS_DISABLE_HT = BIT(0), + IBSS_PARAMS_DISABLE_VHT = BIT(1), +}; + +/** * struct cfg80211_ibss_params - IBSS parameters * * This structure defines the IBSS parameters for the join_ibss() @@ -1738,9 +1749,12 @@ struct cfg80211_disassoc_request { * to operate on DFS channels. * @basic_rates: bitmap of basic rates to use when creating the IBSS * @mcast_rate: per-band multicast rate index + 1 (0: disabled) + * @flags See &enum cfg80211_ibss_params_flags * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask * will be used in ht_capa. Un-supported values will be ignored. * @ht_capa_mask: The bits of ht_capa which are to be used. + * @vht_capa: VHT Capability overrides + * @vht_capa_mask: The bits of vht_capa which are to be used. */ struct cfg80211_ibss_params { const u8 *ssid; @@ -1755,8 +1769,11 @@ struct cfg80211_ibss_params { bool control_port; bool userspace_handles_dfs; int mcast_rate[IEEE80211_NUM_BANDS]; + u32 flags; struct ieee80211_ht_cap ht_capa; struct ieee80211_ht_cap ht_capa_mask; + struct ieee80211_vht_cap vht_capa; + struct ieee80211_vht_cap vht_capa_mask; }; /** diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index a963d48..d78030fe 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -4306,11 +4306,13 @@ enum nl80211_feature_flags { /** * enum nl80211_ext_feature_index - bit index of extended features. + * @NL80211_FEATURE_VHT_IBSS: This driver supports IBSS with VHT datarates. * * @NUM_NL80211_EXT_FEATURES: number of extended features. * @MAX_NL80211_EXT_FEATURES: highest extended feature index. */ enum nl80211_ext_feature_index { + NL80211_FEATURE_VHT_IBSS, /* add new features before the definition below */ NUM_NL80211_EXT_FEATURES, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 7c2ce26..15f638a 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -7235,8 +7235,18 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info) break; case NL80211_CHAN_WIDTH_20: case NL80211_CHAN_WIDTH_40: - if (rdev->wiphy.features & NL80211_FEATURE_HT_IBSS) - break; + if (!(rdev->wiphy.features & NL80211_FEATURE_HT_IBSS)) + return -EINVAL; + break; + case NL80211_CHAN_WIDTH_80: + case NL80211_CHAN_WIDTH_80P80: + case NL80211_CHAN_WIDTH_160: + if (!(rdev->wiphy.features & NL80211_FEATURE_HT_IBSS)) + return -EINVAL; + if (!wiphy_ext_feature_isset(&rdev->wiphy, + NL80211_FEATURE_VHT_IBSS)) + return -EINVAL; + break; default: return -EINVAL; } @@ -7258,6 +7268,9 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info) return err; } + if (nla_get_flag(info->attrs[NL80211_ATTR_DISABLE_HT])) + ibss.flags |= IBSS_PARAMS_DISABLE_HT; + if (info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK]) memcpy(&ibss.ht_capa_mask, nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK]), @@ -7271,6 +7284,23 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info) sizeof(ibss.ht_capa)); } + if (nla_get_flag(info->attrs[NL80211_ATTR_DISABLE_VHT])) + ibss.flags |= IBSS_PARAMS_DISABLE_VHT; + + if (info->attrs[NL80211_ATTR_VHT_CAPABILITY_MASK]) + memcpy(&ibss.vht_capa_mask, + nla_data(info->attrs[NL80211_ATTR_VHT_CAPABILITY_MASK]), + sizeof(ibss.vht_capa_mask)); + + if (info->attrs[NL80211_ATTR_VHT_CAPABILITY]) { + if (!info->attrs[NL80211_ATTR_VHT_CAPABILITY_MASK]) + return -EINVAL; + memcpy(&ibss.vht_capa, + nla_data(info->attrs[NL80211_ATTR_VHT_CAPABILITY]), + sizeof(ibss.vht_capa)); + } + + if (info->attrs[NL80211_ATTR_MCAST_RATE] && !nl80211_parse_mcast_rate(rdev, ibss.mcast_rate, nla_get_u32(info->attrs[NL80211_ATTR_MCAST_RATE]))) -- 1.9.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [RFC 2/2] mac80211: add VHT support for IBSS 2015-01-13 8:35 [RFC 1/2] cfg80211: add VHT support for IBSS Janusz Dziedzic @ 2015-01-13 8:35 ` Janusz Dziedzic 2015-01-14 8:54 ` Johannes Berg 2015-01-14 8:52 ` [RFC 1/2] cfg80211: " Johannes Berg 1 sibling, 1 reply; 4+ messages in thread From: Janusz Dziedzic @ 2015-01-13 8:35 UTC (permalink / raw) To: linux-wireless; +Cc: johannes, Janusz Dziedzic Add VHT support for IBSS. Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com> --- net/mac80211/ibss.c | 29 +++++++++++++++++++++++++++++ net/mac80211/ieee80211_i.h | 11 +++++++++++ net/mac80211/main.c | 1 + net/mac80211/util.c | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 76 insertions(+) diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index b606b53..c3811f5 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c @@ -174,6 +174,7 @@ ieee80211_ibss_build_presp(struct ieee80211_sub_if_data *sdata, if (chandef->width != NL80211_CHAN_WIDTH_20_NOHT && chandef->width != NL80211_CHAN_WIDTH_5 && chandef->width != NL80211_CHAN_WIDTH_10 && + !(sdata->u.ibss.flags & IEEE80211_IBSS_DISABLE_HT) && sband->ht_cap.ht_supported) { struct ieee80211_sta_ht_cap ht_cap; @@ -188,6 +189,21 @@ ieee80211_ibss_build_presp(struct ieee80211_sub_if_data *sdata, */ pos = ieee80211_ie_build_ht_oper(pos, &sband->ht_cap, chandef, 0); + + if (chandef->width != NL80211_CHAN_WIDTH_20 && + chandef->width != NL80211_CHAN_WIDTH_40 && + !(sdata->u.ibss.flags & IEEE80211_IBSS_DISABLE_VHT) && + sband->vht_cap.vht_supported) { + struct ieee80211_sta_vht_cap vht_cap; + + memcpy(&vht_cap, &sband->vht_cap, sizeof(vht_cap)); + ieee80211_apply_vhtcap_overrides(sdata, &vht_cap); + + pos = ieee80211_ie_build_vht_cap(pos, &vht_cap, + vht_cap.cap); + pos = ieee80211_ie_build_vht_oper(pos, &sband->vht_cap, + chandef); + } } if (local->hw.queues >= IEEE80211_NUM_ACS) @@ -1711,6 +1727,19 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata, memcpy(&sdata->u.ibss.ht_capa_mask, ¶ms->ht_capa_mask, sizeof(sdata->u.ibss.ht_capa_mask)); + memcpy(&sdata->u.ibss.vht_capa, ¶ms->vht_capa, + sizeof(sdata->u.ibss.vht_capa)); + memcpy(&sdata->u.ibss.vht_capa_mask, ¶ms->vht_capa_mask, + sizeof(sdata->u.ibss.vht_capa_mask)); + + if (params->flags & IBSS_PARAMS_DISABLE_HT) { + sdata->u.ibss.flags |= IEEE80211_IBSS_DISABLE_HT; + sdata->u.ibss.flags |= IEEE80211_IBSS_DISABLE_VHT; + } + + if (params->flags & IBSS_PARAMS_DISABLE_VHT) + sdata->u.ibss.flags |= IEEE80211_IBSS_DISABLE_VHT; + /* * 802.11n-2009 9.13.3.1: In an IBSS, the HT Protection field is * reserved, but an HT STA shall protect HT transmissions as though diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 4f45cab..beac103 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -544,6 +544,11 @@ struct ieee80211_if_managed { struct delayed_work tx_tspec_wk; }; +enum ieee80211_ibss_flags { + IEEE80211_IBSS_DISABLE_HT = BIT(0), + IEEE80211_IBSS_DISABLE_VHT = BIT(1), +}; + struct ieee80211_if_ibss { struct timer_list timer; struct work_struct csa_connection_drop_work; @@ -569,8 +574,12 @@ struct ieee80211_if_ibss { /* probe response/beacon for IBSS */ struct beacon_data __rcu *presp; + unsigned int flags; + struct ieee80211_ht_cap ht_capa; /* configured ht-cap over-rides */ struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */ + struct ieee80211_vht_cap vht_capa; /* configured VHT overrides */ + struct ieee80211_vht_cap vht_capa_mask; /* Valid parts of vht_capa */ spinlock_t incomplete_lock; struct list_head incomplete_stations; @@ -1937,6 +1946,8 @@ u8 *ieee80211_ie_build_ht_oper(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap, u16 prot_mode); u8 *ieee80211_ie_build_vht_cap(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap, u32 cap); +u8 *ieee80211_ie_build_vht_oper(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap, + const struct cfg80211_chan_def *chandef); int ieee80211_parse_bitrates(struct cfg80211_chan_def *chandef, const struct ieee80211_supported_band *sband, const u8 *srates, int srates_len, u32 *rates); diff --git a/net/mac80211/main.c b/net/mac80211/main.c index d9ce336..1f7457b 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c @@ -549,6 +549,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len, wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN | NL80211_FEATURE_AP_SCAN; + wiphy_ext_feature_set(wiphy, NL80211_FEATURE_VHT_IBSS); if (!ops->set_key) wiphy->flags |= WIPHY_FLAG_IBSS_RSN; diff --git a/net/mac80211/util.c b/net/mac80211/util.c index ad8cb4f..89ca38c 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -2329,6 +2329,41 @@ u8 *ieee80211_ie_build_ht_oper(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap, return pos + sizeof(struct ieee80211_ht_operation); } +u8 *ieee80211_ie_build_vht_oper(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap, + const struct cfg80211_chan_def *chandef) +{ + struct ieee80211_vht_operation *vht_oper; + + /* Build VHT Operation */ + *pos++ = WLAN_EID_VHT_OPERATION; + *pos++ = sizeof(struct ieee80211_vht_operation); + + vht_oper = (struct ieee80211_vht_operation *)pos; + + vht_oper->center_freq_seg1_idx = + ieee80211_frequency_to_channel(chandef->center_freq1); + vht_oper->center_freq_seg2_idx = 0; + vht_oper->basic_mcs_set = vht_cap->vht_mcs.rx_mcs_map; + + switch (chandef->width) { + case NL80211_CHAN_WIDTH_80: + vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80MHZ; + break; + case NL80211_CHAN_WIDTH_80P80: + vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80P80MHZ; + vht_oper->center_freq_seg2_idx = + ieee80211_frequency_to_channel(chandef->center_freq2); + break; + case NL80211_CHAN_WIDTH_160: + vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_160MHZ; + break; + default: + return pos; + } + + return pos + sizeof(struct ieee80211_vht_operation); +} + void ieee80211_ht_oper_to_chandef(struct ieee80211_channel *control_chan, const struct ieee80211_ht_operation *ht_oper, struct cfg80211_chan_def *chandef) -- 1.9.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [RFC 2/2] mac80211: add VHT support for IBSS 2015-01-13 8:35 ` [RFC 2/2] mac80211: " Janusz Dziedzic @ 2015-01-14 8:54 ` Johannes Berg 0 siblings, 0 replies; 4+ messages in thread From: Johannes Berg @ 2015-01-14 8:54 UTC (permalink / raw) To: Janusz Dziedzic; +Cc: linux-wireless On Tue, 2015-01-13 at 09:35 +0100, Janusz Dziedzic wrote: > +++ b/net/mac80211/main.c > @@ -549,6 +549,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len, > wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN | > NL80211_FEATURE_AP_SCAN; > > + wiphy_ext_feature_set(wiphy, NL80211_FEATURE_VHT_IBSS); Maybe we should leave this to the driver? And it should certainly depend on actual VHT capability, I'd say? Seems confusing if we ended up with a driver that doesn't have VHT but says it has VHT_IBSS :) > +++ b/net/mac80211/util.c > @@ -2329,6 +2329,41 @@ u8 *ieee80211_ie_build_ht_oper(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap, > return pos + sizeof(struct ieee80211_ht_operation); > } > > +u8 *ieee80211_ie_build_vht_oper(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap, > + const struct cfg80211_chan_def *chandef) For now that'll only be used by IBSS (perhaps mesh in the future?), but maybe it should just be in ibss.c until it's used more? johannes ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC 1/2] cfg80211: add VHT support for IBSS 2015-01-13 8:35 [RFC 1/2] cfg80211: add VHT support for IBSS Janusz Dziedzic 2015-01-13 8:35 ` [RFC 2/2] mac80211: " Janusz Dziedzic @ 2015-01-14 8:52 ` Johannes Berg 1 sibling, 0 replies; 4+ messages in thread From: Johannes Berg @ 2015-01-14 8:52 UTC (permalink / raw) To: Janusz Dziedzic; +Cc: linux-wireless On Tue, 2015-01-13 at 09:35 +0100, Janusz Dziedzic wrote: > + * @IBSS_PARAMS_DISABLE_HT: Disable HT (802.11n) > + * @IBSS_PARAMS_DISABLE_VHT: Disable VHT If you list 11n (don't think you need to) maybe also ist 11ac? :) Or just remove 11n. > + * @flags See &enum cfg80211_ibss_params_flags missing : > * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask > * will be used in ht_capa. Un-supported values will be ignored. > * @ht_capa_mask: The bits of ht_capa which are to be used. > + * @vht_capa: VHT Capability overrides why two spaces? :) > /** > * enum nl80211_ext_feature_index - bit index of extended features. > + * @NL80211_FEATURE_VHT_IBSS: This driver supports IBSS with VHT datarates. > * > * @NUM_NL80211_EXT_FEATURES: number of extended features. > * @MAX_NL80211_EXT_FEATURES: highest extended feature index. > */ > enum nl80211_ext_feature_index { > + NL80211_FEATURE_VHT_IBSS, Yay, first bit :) > @@ -7258,6 +7268,9 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info) > return err; > } > > + if (nla_get_flag(info->attrs[NL80211_ATTR_DISABLE_HT])) > + ibss.flags |= IBSS_PARAMS_DISABLE_HT; That should perhaps be a separate patch? Also - it seems you need to check somewhere that people aren't configuring 80 MHz with disable-VHT? And similar for HT actually - is this new? johannes ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-01-14 8:54 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-01-13 8:35 [RFC 1/2] cfg80211: add VHT support for IBSS Janusz Dziedzic 2015-01-13 8:35 ` [RFC 2/2] mac80211: " Janusz Dziedzic 2015-01-14 8:54 ` Johannes Berg 2015-01-14 8:52 ` [RFC 1/2] cfg80211: " Johannes Berg
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).