All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: linux-wireless@vger.kernel.org
Cc: quic_vikram@quicinc.com, quic_alokad@quicinc.com,
	quic_jiad@quicinc.com, quic_periyasa@quicinc.com,
	quic_msinada@quicinc.com, quic_srirrama@quicinc.com,
	ilan.peer@intel.com
Subject: [PATCH v2 11/19] cfg80211: Support configuration of station EHT capabilities
Date: Thu, 10 Feb 2022 20:20:00 +0100	[thread overview]
Message-ID: <20220210201853.e899619c8855.Icb4a5f2ec7b41d9008ac4cfc16c59baeb84793d3@changeid> (raw)
In-Reply-To: <20220210192008.188166-1-johannes@sipsolutions.net>

From: Ilan Peer <ilan.peer@intel.com>

Add attributes and some code bits to support userspace passing
in EHT capabilities of stations.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 include/net/cfg80211.h       |  4 ++++
 include/uapi/linux/nl80211.h | 10 +++++++++-
 net/wireless/nl80211.c       | 33 +++++++++++++++++++++++++++++----
 3 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 5cfc483dece1..68713388b617 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1487,6 +1487,8 @@ struct sta_txpwr {
  * @airtime_weight: airtime scheduler weight for this station
  * @txpwr: transmit power for an associated station
  * @he_6ghz_capa: HE 6 GHz Band capabilities of station
+ * @eht_capa: EHT capabilities of station
+ * @eht_capa_len: the length of the EHT capabilities
  */
 struct station_parameters {
 	const u8 *supported_rates;
@@ -1520,6 +1522,8 @@ struct station_parameters {
 	u16 airtime_weight;
 	struct sta_txpwr txpwr;
 	const struct ieee80211_he_6ghz_capa *he_6ghz_capa;
+	const struct ieee80211_eht_cap_elem *eht_capa;
+	u8 eht_capa_len;
 };
 
 /**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index baf6433c0119..98ed52663d6b 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -11,7 +11,7 @@
  * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com>
  * Copyright 2008 Colin McCabe <colin@cozybit.com>
  * Copyright 2015-2017	Intel Deutschland GmbH
- * Copyright (C) 2018-2021 Intel Corporation
+ * Copyright (C) 2018-2022 Intel Corporation
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -2659,6 +2659,10 @@ enum nl80211_commands {
  *	enumerated in &enum nl80211_ap_settings_flags. This attribute shall be
  *	used with %NL80211_CMD_START_AP request.
  *
+ * @NL80211_ATTR_EHT_CAPABILITY: EHT Capability information element (from
+ *	association request when used with NL80211_CMD_NEW_STATION). Can be set
+ *	only if %NL80211_STA_FLAG_WME is set.
+ *
  * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3169,6 +3173,8 @@ enum nl80211_attrs {
 
 	NL80211_ATTR_AP_SETTINGS_FLAGS,
 
+	NL80211_ATTR_EHT_CAPABILITY,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
@@ -3224,6 +3230,8 @@ enum nl80211_attrs {
 #define NL80211_HE_MAX_CAPABILITY_LEN           54
 #define NL80211_MAX_NR_CIPHER_SUITES		5
 #define NL80211_MAX_NR_AKM_SUITES		2
+#define NL80211_EHT_MIN_CAPABILITY_LEN          13
+#define NL80211_EHT_MAX_CAPABILITY_LEN          51
 
 #define NL80211_MIN_REMAIN_ON_CHANNEL_TIME	10
 
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 1214dbccbb10..228f0088aea5 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -5,7 +5,7 @@
  * Copyright 2006-2010	Johannes Berg <johannes@sipsolutions.net>
  * Copyright 2013-2014  Intel Mobile Communications GmbH
  * Copyright 2015-2017	Intel Deutschland GmbH
- * Copyright (C) 2018-2021 Intel Corporation
+ * Copyright (C) 2018-2022 Intel Corporation
  */
 
 #include <linux/if.h>
@@ -778,6 +778,10 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
 	[NL80211_ATTR_MBSSID_ELEMS] = { .type = NLA_NESTED },
 	[NL80211_ATTR_RADAR_BACKGROUND] = { .type = NLA_FLAG },
 	[NL80211_ATTR_AP_SETTINGS_FLAGS] = { .type = NLA_U32 },
+	[NL80211_ATTR_EHT_CAPABILITY] =
+		NLA_POLICY_RANGE(NLA_BINARY,
+				 NL80211_EHT_MIN_CAPABILITY_LEN,
+				 NL80211_EHT_MAX_CAPABILITY_LEN),
 };
 
 /* policy for the key attributes */
@@ -6365,6 +6369,12 @@ int cfg80211_check_station_change(struct wiphy *wiphy,
 				       params->he_capa_len))
 		return -EINVAL;
 
+	if (params->eht_capa &&
+	    !ieee80211_eht_capa_size_ok((const void *)params->he_capa,
+					(const void *)params->eht_capa,
+					params->eht_capa_len))
+		return -EINVAL;
+
 	/* When you run into this, adjust the code below for the new flag */
 	BUILD_BUG_ON(NL80211_STA_FLAG_MAX != 7);
 
@@ -6422,7 +6432,7 @@ int cfg80211_check_station_change(struct wiphy *wiphy,
 		if (params->supported_rates)
 			return -EINVAL;
 		if (params->ext_capab || params->ht_capa || params->vht_capa ||
-		    params->he_capa)
+		    params->he_capa || params->eht_capa)
 			return -EINVAL;
 	}
 
@@ -6625,6 +6635,13 @@ static int nl80211_set_station_tdls(struct genl_info *info,
 			nla_data(info->attrs[NL80211_ATTR_HE_CAPABILITY]);
 		params->he_capa_len =
 			nla_len(info->attrs[NL80211_ATTR_HE_CAPABILITY]);
+
+		if (info->attrs[NL80211_ATTR_EHT_CAPABILITY]) {
+			params->eht_capa =
+				nla_data(info->attrs[NL80211_ATTR_EHT_CAPABILITY]);
+			params->eht_capa_len =
+				nla_len(info->attrs[NL80211_ATTR_EHT_CAPABILITY]);
+		}
 	}
 
 	err = nl80211_parse_sta_channel_info(info, params);
@@ -6882,6 +6899,13 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
 			nla_data(info->attrs[NL80211_ATTR_HE_CAPABILITY]);
 		params.he_capa_len =
 			nla_len(info->attrs[NL80211_ATTR_HE_CAPABILITY]);
+
+		if (info->attrs[NL80211_ATTR_EHT_CAPABILITY]) {
+			params.eht_capa =
+				nla_data(info->attrs[NL80211_ATTR_EHT_CAPABILITY]);
+			params.eht_capa_len =
+				nla_len(info->attrs[NL80211_ATTR_EHT_CAPABILITY]);
+		}
 	}
 
 	if (info->attrs[NL80211_ATTR_HE_6GHZ_CAPABILITY])
@@ -6931,8 +6955,9 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
 		params.ht_capa = NULL;
 		params.vht_capa = NULL;
 
-		/* HE requires WME */
-		if (params.he_capa_len || params.he_6ghz_capa)
+		/* HE and EHT require WME */
+		if (params.he_capa_len || params.he_6ghz_capa ||
+		    params.eht_capa_len)
 			return -EINVAL;
 	}
 
-- 
2.34.1


  parent reply	other threads:[~2022-02-10 19:20 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-10 19:19 [PATCH v2 00/19] initial EHT support Johannes Berg
2022-02-10 19:19 ` [PATCH v2 01/19] mac80211_hwsim: check TX and STA bandwidth Johannes Berg
2022-02-10 19:19 ` [PATCH v2 02/19] mac80211_hwsim: don't shadow a global variable Johannes Berg
2022-02-10 19:19 ` [PATCH v2 03/19] mac80211_hwsim: Add custom regulatory for 6GHz Johannes Berg
2022-02-10 19:19 ` [PATCH v2 04/19] ieee80211: Add EHT (802.11be) definitions Johannes Berg
2022-02-10 20:08   ` Johannes Berg
2022-02-10 19:19 ` [PATCH v2 05/19] ieee80211: add EHT 1K aggregation definitions Johannes Berg
2022-02-10 19:19 ` [PATCH v2 06/19] cfg80211: Add data structures to capture EHT capabilities Johannes Berg
2022-02-11 17:37   ` Aloka Dixit (QUIC)
2022-02-11 19:03     ` Johannes Berg
2022-02-14 15:55       ` Aloka Dixit (QUIC)
2022-02-15  7:28         ` Kalle Valo
2022-02-10 19:19 ` [PATCH v2 07/19] cfg80211: Add support for EHT 320 MHz channel width Johannes Berg
2022-02-10 19:19 ` [PATCH v2 08/19] nl80211: add EHT MCS support Johannes Berg
2022-02-10 19:19 ` [PATCH v2 09/19] nl80211: add support for 320MHz channel limitation Johannes Berg
2022-02-10 19:19 ` [PATCH v2 10/19] cfg80211: add NO-EHT flag to regulatory Johannes Berg
2022-02-10 19:20 ` Johannes Berg [this message]
2022-02-10 19:20 ` [PATCH v2 12/19] mac80211: Support parsing EHT elements Johannes Berg
2022-02-10 19:20 ` [PATCH v2 13/19] mac80211: Add initial support for EHT and 320 MHz channels Johannes Berg
2022-02-10 19:20 ` [PATCH v2 14/19] mac80211: Add EHT capabilities to association/probe request Johannes Berg
2022-02-10 19:20 ` [PATCH v2 15/19] mac80211: Handle station association response with EHT Johannes Berg
2022-02-10 19:20 ` [PATCH v2 16/19] mac80211: Add support for storing station EHT capabilities Johannes Berg
2022-02-10 19:20 ` [PATCH v2 17/19] mac80211: calculate max RX NSS for EHT mode Johannes Berg
2022-02-10 19:20 ` [PATCH v2 18/19] mac80211: parse AddBA request with extended AddBA element Johannes Berg
2022-02-10 19:20 ` [PATCH v2 19/19] mac80211_hwsim: Advertise support for EHT capabilities Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220210201853.e899619c8855.Icb4a5f2ec7b41d9008ac4cfc16c59baeb84793d3@changeid \
    --to=johannes@sipsolutions.net \
    --cc=ilan.peer@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=quic_alokad@quicinc.com \
    --cc=quic_jiad@quicinc.com \
    --cc=quic_msinada@quicinc.com \
    --cc=quic_periyasa@quicinc.com \
    --cc=quic_srirrama@quicinc.com \
    --cc=quic_vikram@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.