diff mbox

[v2] nl80211: add Guard Interval support for set_bitrate_mask

Message ID 1387653268-2685-1-git-send-email-janusz.dziedzic@tieto.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Janusz.Dziedzic@tieto.com Dec. 21, 2013, 7:14 p.m. UTC
Allow to force SGI, LGI.
Mainly for test purpose.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
*V2 - fix line over 80 characters

 include/net/cfg80211.h       |    1 +
 include/uapi/linux/nl80211.h |    8 ++++++++
 net/wireless/nl80211.c       |    4 ++++
 3 files changed, 13 insertions(+)

Comments

Johannes Berg Jan. 7, 2014, 4:07 p.m. UTC | #1
On Sat, 2013-12-21 at 20:14 +0100, Janusz Dziedzic wrote:

> @@ -7474,6 +7475,9 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
>  					mask.control[band].vht_mcs))
>  				return -EINVAL;
>  		}
> +		if (tb[NL80211_TXRATE_GI])
> +			mask.control[band].gi =
> +				nla_get_u8(tb[NL80211_TXRATE_GI]);

I think you need to sanity check the value, otherwise userspace can set
it to 42 and things would get rather confusing in the kernel.

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 80a1021..514c612 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1768,6 +1768,7 @@  struct cfg80211_bitrate_mask {
 		u32 legacy;
 		u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
 		u16 vht_mcs[NL80211_VHT_NSS_MAX];
+		enum nl80211_txrate_gi gi;
 	} control[IEEE80211_NUM_BANDS];
 };
 /**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index e130790..a7a8aa2 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -3114,6 +3114,7 @@  enum nl80211_key_attributes {
  *	in an array of MCS numbers.
  * @NL80211_TXRATE_VHT: VHT rates allowed for TX rate selection,
  *	see &struct nl80211_txrate_vht
+ * @NL80211_TXRATE_GI: configure GI, see &enum nl80211_txrate_gi
  * @__NL80211_TXRATE_AFTER_LAST: internal
  * @NL80211_TXRATE_MAX: highest TX rate attribute
  */
@@ -3122,6 +3123,7 @@  enum nl80211_tx_rate_attributes {
 	NL80211_TXRATE_LEGACY,
 	NL80211_TXRATE_HT,
 	NL80211_TXRATE_VHT,
+	NL80211_TXRATE_GI,
 
 	/* keep last */
 	__NL80211_TXRATE_AFTER_LAST,
@@ -3139,6 +3141,12 @@  struct nl80211_txrate_vht {
 	__u16 mcs[NL80211_VHT_NSS_MAX];
 };
 
+enum nl80211_txrate_gi {
+	NL80211_TXRATE_DEFAULT_GI,
+	NL80211_TXRATE_FORCE_SGI,
+	NL80211_TXRATE_FORCE_LGI,
+};
+
 /**
  * enum nl80211_band - Frequency band
  * @NL80211_BAND_2GHZ: 2.4 GHz ISM band
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 04681a4..f7aaed2 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -7394,6 +7394,7 @@  static const struct nla_policy nl80211_txattr_policy[NL80211_TXRATE_MAX + 1] = {
 	[NL80211_TXRATE_HT] = { .type = NLA_BINARY,
 				.len = NL80211_MAX_SUPP_HT_RATES },
 	[NL80211_TXRATE_VHT] = { .len = sizeof(struct nl80211_txrate_vht)},
+	[NL80211_TXRATE_GI] = { .type = NLA_U8 },
 };
 
 static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
@@ -7474,6 +7475,9 @@  static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
 					mask.control[band].vht_mcs))
 				return -EINVAL;
 		}
+		if (tb[NL80211_TXRATE_GI])
+			mask.control[band].gi =
+				nla_get_u8(tb[NL80211_TXRATE_GI]);
 
 		if (mask.control[band].legacy == 0) {
 			/* don't allow empty legacy rates if HT or VHT