diff mbox

[RFC,1/2] cfg80211: add VHT support for IBSS

Message ID 1421138124-7661-1-git-send-email-janusz.dziedzic@tieto.com (mailing list archive)
State RFC
Delegated to: Johannes Berg
Headers show

Commit Message

Janusz.Dziedzic@tieto.com Jan. 13, 2015, 8:35 a.m. UTC
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(-)

Comments

Johannes Berg Jan. 14, 2015, 8:52 a.m. UTC | #1
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

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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])))