diff mbox series

[wireless-next,04/15] wifi: cfg80211: allow AP operations in 20 MHz configuration

Message ID 20250306124057.a7b909d23df2.I8a8f79e1c9eb74936929463960ee2a324712fe51@changeid (mailing list archive)
State Changes Requested
Delegated to: Johannes Berg
Headers show
Series wifi: mac80211/cfg80211: updates - 2025-03-06 | expand

Checks

Context Check Description
wifibot/fixes_present success Fixes tag not required for -next series
wifibot/series_format success Posting correctly formatted
wifibot/tree_selection success Clearly marked for wireless-next
wifibot/ynl success Generated files up to date; no warnings/errors; no diff in generated;
wifibot/build_clang success Errors and warnings before: 7 this patch: 7
wifibot/build_clang_rust success No Rust files in patch. Skipping build
wifibot/build_tools success Errors and warnings before: 68 (+0) this patch: 68 (+0)
wifibot/check_selftest success No net selftest shell script
wifibot/deprecated_api success None detected
wifibot/header_inline success No static functions without inline keyword in header files
wifibot/source_inline success Was 0 now: 0
wifibot/verify_fixes success No Fixes tag
wifibot/build_allmodconfig_warn success Errors and warnings before: 5 this patch: 5
wifibot/checkpatch warning WARNING: From:/Signed-off-by: email name mismatch: 'From: Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>' != 'Signed-off-by: Pagadala Yesu Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>'
wifibot/kdoc success Errors and warnings before: 0 this patch: 0
wifibot/build_32bit success Errors and warnings before: 2 this patch: 2
wifibot/verify_signedoff success Signed-off-by tag matches author and committer

Commit Message

Miri Korenblit March 6, 2025, 10:43 a.m. UTC
From: Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>

Implemented configuration option for channel properties to allow
soft AP/active scan operations exclusively to 20 MHz bandwidth.
While on it, fixed indentation and kernel doc for
enum nl80211_reg_rule_flags.

Signed-off-by: Pagadala Yesu Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Signed-off-by: Somashekhar Puttagangaiah <somashekhar.puttagangaiah@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
---
 include/net/cfg80211.h       |  4 +++
 include/uapi/linux/nl80211.h | 52 ++++++++++++++++++++----------------
 net/wireless/chan.c          |  8 +++++-
 net/wireless/nl80211.c       |  4 +++
 net/wireless/reg.c           |  4 ++-
 5 files changed, 47 insertions(+), 25 deletions(-)

Comments

Jeff Johnson March 6, 2025, 3:27 p.m. UTC | #1
On 3/6/2025 2:43 AM, Miri Korenblit wrote:
> From: Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
> 
> Implemented configuration option for channel properties to allow
> soft AP/active scan operations exclusively to 20 MHz bandwidth.

why "soft"? is this not applicable to "regular" APs? P2P GO?

would be better to first describe the actual problem, and then describe the
solution. and use imperative voice.

> While on it, fixed indentation and kernel doc for
> enum nl80211_reg_rule_flags.
> 
> Signed-off-by: Pagadala Yesu Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>

doesn't match "From:"

> Signed-off-by: Somashekhar Puttagangaiah <somashekhar.puttagangaiah@intel.com>
> Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>

...

>  enum nl80211_reg_rule_flags {
> -	NL80211_RRF_NO_OFDM		= 1<<0,
> -	NL80211_RRF_NO_CCK		= 1<<1,
> -	NL80211_RRF_NO_INDOOR		= 1<<2,
> -	NL80211_RRF_NO_OUTDOOR		= 1<<3,
> -	NL80211_RRF_DFS			= 1<<4,
> -	NL80211_RRF_PTP_ONLY		= 1<<5,
> -	NL80211_RRF_PTMP_ONLY		= 1<<6,
> -	NL80211_RRF_NO_IR		= 1<<7,
> -	__NL80211_RRF_NO_IBSS		= 1<<8,
> -	NL80211_RRF_AUTO_BW		= 1<<11,
> -	NL80211_RRF_IR_CONCURRENT	= 1<<12,
> -	NL80211_RRF_NO_HT40MINUS	= 1<<13,
> -	NL80211_RRF_NO_HT40PLUS		= 1<<14,
> -	NL80211_RRF_NO_80MHZ		= 1<<15,
> -	NL80211_RRF_NO_160MHZ		= 1<<16,
> -	NL80211_RRF_NO_HE		= 1<<17,
> -	NL80211_RRF_NO_320MHZ		= 1<<18,
> -	NL80211_RRF_NO_EHT		= 1<<19,
> -	NL80211_RRF_PSD			= 1<<20,
> -	NL80211_RRF_DFS_CONCURRENT	= 1<<21,
> -	NL80211_RRF_NO_6GHZ_VLP_CLIENT	= 1<<22,
> -	NL80211_RRF_NO_6GHZ_AFC_CLIENT	= 1<<23,
> -	NL80211_RRF_ALLOW_6GHZ_VLP_AP	= 1<<24,
> +	NL80211_RRF_NO_OFDM                 = 1 << 0,
> +	NL80211_RRF_NO_CCK                  = 1 << 1,
> +	NL80211_RRF_NO_INDOOR               = 1 << 2,
> +	NL80211_RRF_NO_OUTDOOR              = 1 << 3,
> +	NL80211_RRF_DFS                     = 1 << 4,
> +	NL80211_RRF_PTP_ONLY                = 1 << 5,
> +	NL80211_RRF_PTMP_ONLY               = 1 << 6,
> +	NL80211_RRF_NO_IR                   = 1 << 7,
> +	__NL80211_RRF_NO_IBSS               = 1 << 8,
> +	NL80211_RRF_AUTO_BW                 = 1 << 11,
> +	NL80211_RRF_IR_CONCURRENT           = 1 << 12,
> +	NL80211_RRF_NO_HT40MINUS            = 1 << 13,
> +	NL80211_RRF_NO_HT40PLUS             = 1 << 14,
> +	NL80211_RRF_NO_80MHZ                = 1 << 15,
> +	NL80211_RRF_NO_160MHZ               = 1 << 16,
> +	NL80211_RRF_NO_HE                   = 1 << 17,
> +	NL80211_RRF_NO_320MHZ               = 1 << 18,
> +	NL80211_RRF_NO_EHT                  = 1 << 19,
> +	NL80211_RRF_PSD                     = 1 << 20,
> +	NL80211_RRF_DFS_CONCURRENT          = 1 << 21,
> +	NL80211_RRF_NO_6GHZ_VLP_CLIENT      = 1 << 22,
> +	NL80211_RRF_NO_6GHZ_AFC_CLIENT      = 1 << 23,
> +	NL80211_RRF_ALLOW_6GHZ_VLP_AP       = 1 << 24,
> +	NL80211_RRF_ALLOW_20MHZ_ACTIVITY    = 1 << 25,

if you are modifying, why not use BIT()
Miri Korenblit March 6, 2025, 9:46 p.m. UTC | #2
> -----Original Message-----
> From: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
> Sent: Thursday, 6 March 2025 17:27
> To: Korenblit, Miriam Rachel <miriam.rachel.korenblit@intel.com>;
> johannes@sipsolutions.net
> Cc: linux-wireless@vger.kernel.org; Anjaneyulu, Pagadala Yesu
> <pagadala.yesu.anjaneyulu@intel.com>; Puttagangaiah, Somashekhar
> <somashekhar.puttagangaiah@intel.com>
> Subject: Re: [PATCH wireless-next 04/15] wifi: cfg80211: allow AP operations in
> 20 MHz configuration
> 
> > +	NL80211_RRF_ALLOW_6GHZ_VLP_AP       = 1 << 24,
> > +	NL80211_RRF_ALLOW_20MHZ_ACTIVITY    = 1 << 25,
> 
> if you are modifying, why not use BIT()
> 
It is a different change. This one is just fixing cosmetics.
Johannes Berg March 7, 2025, 7:29 a.m. UTC | #3
On Thu, 2025-03-06 at 07:27 -0800, Jeff Johnson wrote:
> 
> > +	NL80211_RRF_ALLOW_6GHZ_VLP_AP       = 1 << 24,
> > +	NL80211_RRF_ALLOW_20MHZ_ACTIVITY    = 1 << 25,
> 
> if you are modifying, why not use BIT()

Can we even do that in uapi/ ?

I see that there *are* users of BIT() there, but I don't actually see
that it's *defined* anywhere, and I don't think it's really macro that
the standard library *must* provide?

johannes
Jeff Johnson March 10, 2025, 4:53 p.m. UTC | #4
On 3/6/2025 11:29 PM, Johannes Berg wrote:
> On Thu, 2025-03-06 at 07:27 -0800, Jeff Johnson wrote:
>>
>>> +	NL80211_RRF_ALLOW_6GHZ_VLP_AP       = 1 << 24,
>>> +	NL80211_RRF_ALLOW_20MHZ_ACTIVITY    = 1 << 25,
>>
>> if you are modifying, why not use BIT()
> 
> Can we even do that in uapi/ ?
> 
> I see that there *are* users of BIT() there, but I don't actually see
> that it's *defined* anywhere, and I don't think it's really macro that
> the standard library *must* provide?

fair enough
diff mbox series

Patch

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 29b9cf0fe6c8..9a4a5c20b568 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -127,6 +127,9 @@  struct wiphy;
  *	even if it is otherwise disabled.
  * @IEEE80211_CHAN_ALLOW_6GHZ_VLP_AP: Allow using this channel for AP operation
  *	with very low power (VLP), even if otherwise set to NO_IR.
+ * @IEEE80211_CHAN_ALLOW_20MHZ_ACTIVITY: Allow using this channel for
+ *	soft AP operations and active scan in 20 MHz bandwidth,
+ *	even if otherwise set to NO_IR.
  */
 enum ieee80211_channel_flags {
 	IEEE80211_CHAN_DISABLED			= BIT(0),
@@ -155,6 +158,7 @@  enum ieee80211_channel_flags {
 	IEEE80211_CHAN_NO_6GHZ_AFC_CLIENT	= BIT(23),
 	IEEE80211_CHAN_CAN_MONITOR		= BIT(24),
 	IEEE80211_CHAN_ALLOW_6GHZ_VLP_AP	= BIT(25),
+	IEEE80211_CHAN_ALLOW_20MHZ_ACTIVITY     = BIT(26),
 };
 
 #define IEEE80211_CHAN_NO_HT40 \
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index c59075acdb10..1cf52bc17ef3 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -4335,6 +4335,8 @@  enum nl80211_wmm_rule {
  *	otherwise completely disabled.
  * @NL80211_FREQUENCY_ATTR_ALLOW_6GHZ_VLP_AP: This channel can be used for a
  *	very low power (VLP) AP, despite being NO_IR.
+ * @NL80211_FREQUENCY_ATTR_ALLOW_20MHZ_ACTIVITY: This channel can be used for
+ *	soft AP operations in 20MHz bandwidth, despite being NO_IR.
  * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number
  *	currently defined
  * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use
@@ -4379,6 +4381,7 @@  enum nl80211_frequency_attr {
 	NL80211_FREQUENCY_ATTR_NO_6GHZ_AFC_CLIENT,
 	NL80211_FREQUENCY_ATTR_CAN_MONITOR,
 	NL80211_FREQUENCY_ATTR_ALLOW_6GHZ_VLP_AP,
+	NL80211_FREQUENCY_ATTR_ALLOW_20MHZ_ACTIVITY,
 
 	/* keep last */
 	__NL80211_FREQUENCY_ATTR_AFTER_LAST,
@@ -4590,31 +4593,34 @@  enum nl80211_sched_scan_match_attr {
  * @NL80211_RRF_NO_6GHZ_AFC_CLIENT: Client connection to AFC AP not allowed
  * @NL80211_RRF_ALLOW_6GHZ_VLP_AP: Very low power (VLP) AP can be permitted
  *	despite NO_IR configuration.
+ * @NL80211_RRF_ALLOW_20MHZ_ACTIVITY: Allow soft AP operations in
+ *	20MHz bandwidth, despite NO_IR configuration.
  */
 enum nl80211_reg_rule_flags {
-	NL80211_RRF_NO_OFDM		= 1<<0,
-	NL80211_RRF_NO_CCK		= 1<<1,
-	NL80211_RRF_NO_INDOOR		= 1<<2,
-	NL80211_RRF_NO_OUTDOOR		= 1<<3,
-	NL80211_RRF_DFS			= 1<<4,
-	NL80211_RRF_PTP_ONLY		= 1<<5,
-	NL80211_RRF_PTMP_ONLY		= 1<<6,
-	NL80211_RRF_NO_IR		= 1<<7,
-	__NL80211_RRF_NO_IBSS		= 1<<8,
-	NL80211_RRF_AUTO_BW		= 1<<11,
-	NL80211_RRF_IR_CONCURRENT	= 1<<12,
-	NL80211_RRF_NO_HT40MINUS	= 1<<13,
-	NL80211_RRF_NO_HT40PLUS		= 1<<14,
-	NL80211_RRF_NO_80MHZ		= 1<<15,
-	NL80211_RRF_NO_160MHZ		= 1<<16,
-	NL80211_RRF_NO_HE		= 1<<17,
-	NL80211_RRF_NO_320MHZ		= 1<<18,
-	NL80211_RRF_NO_EHT		= 1<<19,
-	NL80211_RRF_PSD			= 1<<20,
-	NL80211_RRF_DFS_CONCURRENT	= 1<<21,
-	NL80211_RRF_NO_6GHZ_VLP_CLIENT	= 1<<22,
-	NL80211_RRF_NO_6GHZ_AFC_CLIENT	= 1<<23,
-	NL80211_RRF_ALLOW_6GHZ_VLP_AP	= 1<<24,
+	NL80211_RRF_NO_OFDM                 = 1 << 0,
+	NL80211_RRF_NO_CCK                  = 1 << 1,
+	NL80211_RRF_NO_INDOOR               = 1 << 2,
+	NL80211_RRF_NO_OUTDOOR              = 1 << 3,
+	NL80211_RRF_DFS                     = 1 << 4,
+	NL80211_RRF_PTP_ONLY                = 1 << 5,
+	NL80211_RRF_PTMP_ONLY               = 1 << 6,
+	NL80211_RRF_NO_IR                   = 1 << 7,
+	__NL80211_RRF_NO_IBSS               = 1 << 8,
+	NL80211_RRF_AUTO_BW                 = 1 << 11,
+	NL80211_RRF_IR_CONCURRENT           = 1 << 12,
+	NL80211_RRF_NO_HT40MINUS            = 1 << 13,
+	NL80211_RRF_NO_HT40PLUS             = 1 << 14,
+	NL80211_RRF_NO_80MHZ                = 1 << 15,
+	NL80211_RRF_NO_160MHZ               = 1 << 16,
+	NL80211_RRF_NO_HE                   = 1 << 17,
+	NL80211_RRF_NO_320MHZ               = 1 << 18,
+	NL80211_RRF_NO_EHT                  = 1 << 19,
+	NL80211_RRF_PSD                     = 1 << 20,
+	NL80211_RRF_DFS_CONCURRENT          = 1 << 21,
+	NL80211_RRF_NO_6GHZ_VLP_CLIENT      = 1 << 22,
+	NL80211_RRF_NO_6GHZ_AFC_CLIENT      = 1 << 23,
+	NL80211_RRF_ALLOW_6GHZ_VLP_AP       = 1 << 24,
+	NL80211_RRF_ALLOW_20MHZ_ACTIVITY    = 1 << 25,
 };
 
 #define NL80211_RRF_PASSIVE_SCAN	NL80211_RRF_NO_IR
diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index 9f918b77b40e..4cdb74a3f38c 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -6,7 +6,7 @@ 
  *
  * Copyright 2009	Johannes Berg <johannes@sipsolutions.net>
  * Copyright 2013-2014  Intel Mobile Communications GmbH
- * Copyright 2018-2024	Intel Corporation
+ * Copyright 2018-2025	Intel Corporation
  */
 
 #include <linux/export.h>
@@ -1497,6 +1497,12 @@  bool cfg80211_reg_check_beaconing(struct wiphy *wiphy,
 	if (cfg->reg_power == IEEE80211_REG_VLP_AP)
 		permitting_flags |= IEEE80211_CHAN_ALLOW_6GHZ_VLP_AP;
 
+	if ((cfg->iftype == NL80211_IFTYPE_P2P_GO ||
+	     cfg->iftype == NL80211_IFTYPE_AP) &&
+	    (chandef->width == NL80211_CHAN_WIDTH_20_NOHT ||
+	     chandef->width == NL80211_CHAN_WIDTH_20))
+		permitting_flags |= IEEE80211_CHAN_ALLOW_20MHZ_ACTIVITY;
+
 	return _cfg80211_reg_can_beacon(wiphy, chandef, cfg->iftype,
 					check_no_ir ? IEEE80211_CHAN_NO_IR : 0,
 					permitting_flags);
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index e2e8c368fbbf..aee49d43cf86 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -1235,6 +1235,10 @@  static int nl80211_msg_put_channel(struct sk_buff *msg, struct wiphy *wiphy,
 		if ((chan->flags & IEEE80211_CHAN_ALLOW_6GHZ_VLP_AP) &&
 		    nla_put_flag(msg, NL80211_FREQUENCY_ATTR_ALLOW_6GHZ_VLP_AP))
 			goto nla_put_failure;
+		if ((chan->flags & IEEE80211_CHAN_ALLOW_20MHZ_ACTIVITY) &&
+		    nla_put_flag(msg,
+				 NL80211_FREQUENCY_ATTR_ALLOW_20MHZ_ACTIVITY))
+			goto nla_put_failure;
 	}
 
 	if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER,
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 2dd0533e7660..9314f7fcd54b 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -5,7 +5,7 @@ 
  * Copyright 2008-2011	Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
  * Copyright 2013-2014  Intel Mobile Communications GmbH
  * Copyright      2017  Intel Deutschland GmbH
- * Copyright (C) 2018 - 2024 Intel Corporation
+ * Copyright (C) 2018 - 2025 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
@@ -1602,6 +1602,8 @@  static u32 map_regdom_flags(u32 rd_flags)
 		channel_flags |= IEEE80211_CHAN_PSD;
 	if (rd_flags & NL80211_RRF_ALLOW_6GHZ_VLP_AP)
 		channel_flags |= IEEE80211_CHAN_ALLOW_6GHZ_VLP_AP;
+	if (rd_flags & NL80211_RRF_ALLOW_20MHZ_ACTIVITY)
+		channel_flags |= IEEE80211_CHAN_ALLOW_20MHZ_ACTIVITY;
 	return channel_flags;
 }