linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 0/3] Add support to configure beacon tx mode
@ 2022-03-25  5:59 Maharaja Kennadyrajan
  2022-03-25  5:59 ` [PATCH v6 1/3] nl80211: Add support for " Maharaja Kennadyrajan
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Maharaja Kennadyrajan @ 2022-03-25  5:59 UTC (permalink / raw)
  To: ath11k, linux-wireless; +Cc: Maharaja Kennadyrajan

Add support to configure the beacon tx mode as STAGGERED
or BURST mode via hostapd configuration during the AP
bring-up or via wpa_suppplicant configuration during MESH
bring-up.

Beacons can be sent out in burst(continuously in a single shot
one after another) or staggered (equally spread out over beacon
interval) mode.

V6: Addressed Jeff's comment on v5.

V5: Addressed Johannes's and Felix's comment on v4.

V4: Rebased on latest ath.git TOT.

V3: Addressed Johnson's comment on v2 patch.

V2: Addressed Johannes's comment on v1 patch.

Maharaja Kennadyrajan (3):
  nl80211: Add support for beacon tx mode
  mac80211: Add support for beacon tx mode
  ath11k: Add support for beacon tx mode

 drivers/net/wireless/ath/ath11k/mac.c | 10 +++++++---
 include/net/cfg80211.h                |  4 ++++
 include/net/mac80211.h                |  2 ++
 include/uapi/linux/nl80211.h          | 21 +++++++++++++++++++++
 net/mac80211/cfg.c                    |  2 ++
 net/wireless/nl80211.c                | 11 +++++++++++
 6 files changed, 47 insertions(+), 3 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v6 1/3] nl80211: Add support for beacon tx mode
  2022-03-25  5:59 [PATCH v6 0/3] Add support to configure beacon tx mode Maharaja Kennadyrajan
@ 2022-03-25  5:59 ` Maharaja Kennadyrajan
  2022-03-25  7:48   ` Sven Eckelmann
  2022-03-25 19:18   ` Jeff Johnson
  2022-03-25  5:59 ` [PATCH v6 2/3] mac80211: " Maharaja Kennadyrajan
  2022-03-25  5:59 ` [PATCH v6 3/3] ath11k: " Maharaja Kennadyrajan
  2 siblings, 2 replies; 7+ messages in thread
From: Maharaja Kennadyrajan @ 2022-03-25  5:59 UTC (permalink / raw)
  To: ath11k, linux-wireless; +Cc: Maharaja Kennadyrajan

User can configure the below beacon tx mode
1. Staggered mode and 2. Burst mode while bring-up the AP
or MESH.

Beacons can be sent out in burst(continuously in a single shot
one after another) or staggered (equally spread out over beacon
interval) mode.

Set the beacon_tx_mode as 1 for Staggered mode and 2 for
burst mode.

Hence, added the support in the nl80211/cfg80211
layer to honour the beacon tx mode configuration and pass
this value to the driver.

Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-00630-QCAHKSWPL_SILICONZ-2

Signed-off-by: Maharaja Kennadyrajan <quic_mkenna@quicinc.com>
---
V6: Addressed Jeff's comment on v5 patch.

V5: Addressed Johannes's & Felix's comments on v4 patch.

V4: Rebases on latest ath.git TOT.

V3: Addressed Johnson's comment on v2 patch.

V2: Addressed Johannes's comment on v1 patch.

 include/net/cfg80211.h       |  4 ++++
 include/uapi/linux/nl80211.h | 21 +++++++++++++++++++++
 net/wireless/nl80211.c       | 11 +++++++++++
 3 files changed, 36 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 68713388b617..4f4839ebcce6 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1297,6 +1297,7 @@ struct cfg80211_unsol_bcast_probe_resp {
  * @fils_discovery: FILS discovery transmission parameters
  * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters
  * @mbssid_config: AP settings for multiple bssid
+ * @beacon_tx_mode: Beacon Tx Mode setting
  */
 struct cfg80211_ap_settings {
 	struct cfg80211_chan_def chandef;
@@ -1330,6 +1331,7 @@ struct cfg80211_ap_settings {
 	struct cfg80211_fils_discovery fils_discovery;
 	struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;
 	struct cfg80211_mbssid_config mbssid_config;
+	enum nl80211_beacon_tx_mode beacon_tx_mode;
 };
 
 /**
@@ -2211,6 +2213,7 @@ struct mesh_config {
  *	to operate on DFS channels.
  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
  *	port frames over NL80211 instead of the network interface.
+ * @beacon_tx_mode: Beacon Tx Mode setting.
  *
  * These parameters are fixed when the mesh is created.
  */
@@ -2234,6 +2237,7 @@ struct mesh_setup {
 	struct cfg80211_bitrate_mask beacon_rate;
 	bool userspace_handles_dfs;
 	bool control_port_over_nl80211;
+	enum nl80211_beacon_tx_mode beacon_tx_mode;
 };
 
 /**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 0568a79097b8..42712ffc6d16 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2663,6 +2663,13 @@ enum nl80211_commands {
  *	association request when used with NL80211_CMD_NEW_STATION). Can be set
  *	only if %NL80211_STA_FLAG_WME is set.
  *
+ * @NL80211_ATTR_BEACON_TX_MODE: used to configure the beacon tx mode (u32),
+ *	as specified in the &enum nl80211_beacon_tx_mode. The user-space
+ *	can use this attribute to configure the tx mode of beacons.
+ *	Beacons can be sent out in burst(continuously in a single shot
+ *	one after another) or staggered (equally spread out over beacon
+ *	interval) mode.
+ *
  * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3175,6 +3182,8 @@ enum nl80211_attrs {
 
 	NL80211_ATTR_EHT_CAPABILITY,
 
+	NL80211_ATTR_BEACON_TX_MODE,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
@@ -7600,4 +7609,16 @@ enum nl80211_ap_settings_flags {
 	NL80211_AP_SETTINGS_SA_QUERY_OFFLOAD_SUPPORT	= 1 << 1,
 };
 
+/**
+ * enum nl80211_beacon_tx_mode - Beacon Tx Mode enum.
+ * @NL80211_BEACON_STAGGERED_MODE: Used to configure beacon tx mode as
+ *	staggered mode. This is the default beacon tx mode.
+ * @NL80211_BEACON_BURST_MODE: Used to configure beacon tx mode as burst mode.
+ */
+enum nl80211_beacon_tx_mode {
+	NL80211_BEACON_DEFAULT_MODE = 0,
+	NL80211_BEACON_STAGGERED_MODE = 1,
+	NL80211_BEACON_BURST_MODE = 2,
+};
+
 #endif /* __LINUX_NL80211_H */
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index ee1c2b6b6971..ccb4b486da1e 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -790,6 +790,9 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
 		NLA_POLICY_RANGE(NLA_BINARY,
 				 NL80211_EHT_MIN_CAPABILITY_LEN,
 				 NL80211_EHT_MAX_CAPABILITY_LEN),
+	[NL80211_ATTR_BEACON_TX_MODE] =
+		NLA_POLICY_RANGE(NLA_U32, NL80211_BEACON_STAGGERED_MODE,
+				 NL80211_BEACON_BURST_MODE),
 };
 
 /* policy for the key attributes */
@@ -5555,6 +5558,10 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
 	params->dtim_period =
 		nla_get_u32(info->attrs[NL80211_ATTR_DTIM_PERIOD]);
 
+	if (info->attrs[NL80211_ATTR_BEACON_TX_MODE])
+		params->beacon_tx_mode =
+			nla_get_u32(info->attrs[NL80211_ATTR_BEACON_TX_MODE]);
+
 	err = cfg80211_validate_beacon_int(rdev, dev->ieee80211_ptr->iftype,
 					   params->beacon_interval);
 	if (err)
@@ -12235,6 +12242,10 @@ static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info)
 			return -EINVAL;
 	}
 
+	if (info->attrs[NL80211_ATTR_BEACON_TX_MODE])
+		setup.beacon_tx_mode =
+			nla_get_u32(info->attrs[NL80211_ATTR_BEACON_TX_MODE]);
+
 	if (info->attrs[NL80211_ATTR_MESH_SETUP]) {
 		/* parse additional setup parameters if given */
 		err = nl80211_parse_mesh_setup(info, &setup);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v6 2/3] mac80211: Add support for beacon tx mode
  2022-03-25  5:59 [PATCH v6 0/3] Add support to configure beacon tx mode Maharaja Kennadyrajan
  2022-03-25  5:59 ` [PATCH v6 1/3] nl80211: Add support for " Maharaja Kennadyrajan
@ 2022-03-25  5:59 ` Maharaja Kennadyrajan
  2022-03-25  5:59 ` [PATCH v6 3/3] ath11k: " Maharaja Kennadyrajan
  2 siblings, 0 replies; 7+ messages in thread
From: Maharaja Kennadyrajan @ 2022-03-25  5:59 UTC (permalink / raw)
  To: ath11k, linux-wireless; +Cc: Maharaja Kennadyrajan

Pass the beacon tx mode value from the nl80211/cfg80211
layer to the driver via ieee80211_ops and driver ops.

Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-00480-QCAHKSWPL_SILICONZ-1

Signed-off-by: Maharaja Kennadyrajan <quic_mkenna@quicinc.com>
---
 include/net/mac80211.h | 2 ++
 net/mac80211/cfg.c     | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 382ebb862ea8..de6bce88f4fb 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -637,6 +637,7 @@ struct ieee80211_fils_discovery {
  * @tx_pwr_env_num: number of @tx_pwr_env.
  * @pwr_reduction: power constraint of BSS.
  * @eht_support: does this BSS support EHT
+ * @beacon_tx_mode: Beacon Tx Mode setting.
  */
 struct ieee80211_bss_conf {
 	const u8 *bssid;
@@ -712,6 +713,7 @@ struct ieee80211_bss_conf {
 	u8 tx_pwr_env_num;
 	u8 pwr_reduction;
 	bool eht_support;
+	enum nl80211_beacon_tx_mode beacon_tx_mode;
 };
 
 /**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index ba752539d1d9..522bf71db850 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1162,6 +1162,7 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
 
 	prev_beacon_int = sdata->vif.bss_conf.beacon_int;
 	sdata->vif.bss_conf.beacon_int = params->beacon_interval;
+	sdata->vif.bss_conf.beacon_tx_mode = params->beacon_tx_mode;
 
 	if (params->he_cap && params->he_oper) {
 		sdata->vif.bss_conf.he_support = true;
@@ -2237,6 +2238,7 @@ static int copy_mesh_setup(struct ieee80211_if_mesh *ifmsh,
 
 	sdata->vif.bss_conf.beacon_int = setup->beacon_interval;
 	sdata->vif.bss_conf.dtim_period = setup->dtim_period;
+	sdata->vif.bss_conf.beacon_tx_mode = setup->beacon_tx_mode;
 
 	sdata->beacon_rate_set = false;
 	if (wiphy_ext_feature_isset(sdata->local->hw.wiphy,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v6 3/3] ath11k: Add support for beacon tx mode
  2022-03-25  5:59 [PATCH v6 0/3] Add support to configure beacon tx mode Maharaja Kennadyrajan
  2022-03-25  5:59 ` [PATCH v6 1/3] nl80211: Add support for " Maharaja Kennadyrajan
  2022-03-25  5:59 ` [PATCH v6 2/3] mac80211: " Maharaja Kennadyrajan
@ 2022-03-25  5:59 ` Maharaja Kennadyrajan
  2 siblings, 0 replies; 7+ messages in thread
From: Maharaja Kennadyrajan @ 2022-03-25  5:59 UTC (permalink / raw)
  To: ath11k, linux-wireless; +Cc: Maharaja Kennadyrajan

Add support to configure the beacon tx mode in
the driver.

Beacons can be sent out in burst(continuously in a single shot
one after another) or staggered (equally spread out over beacon
interval) mode.

Use the below configuration in the hostapd/wpa_supplicant
for AP/MESH mode to configure the beacon tx mode.

"beacon_tx_mode=N", where N = 1 for STAGGERED beacon mode
and N = 2 for BURST beacon mode.

Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-00480-QCAHKSWPL_SILICONZ-1

Signed-off-by: Maharaja Kennadyrajan <quic_mkenna@quicinc.com>
---
 drivers/net/wireless/ath/ath11k/mac.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 34a62933ccd2..46b8220a4e80 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -3125,7 +3125,10 @@ static void ath11k_mac_op_bss_info_changed(struct ieee80211_hw *hw,
 
 	if (changed & BSS_CHANGED_BEACON) {
 		param_id = WMI_PDEV_PARAM_BEACON_TX_MODE;
-		param_value = WMI_BEACON_STAGGERED_MODE;
+		if (info->beacon_tx_mode == NL80211_BEACON_BURST_MODE)
+			param_value = WMI_BEACON_BURST_MODE;
+		else
+			param_value = WMI_BEACON_STAGGERED_MODE;
 		ret = ath11k_wmi_pdev_set_param(ar, param_id,
 						param_value, ar->pdev->pdev_id);
 		if (ret)
@@ -3133,8 +3136,9 @@ static void ath11k_mac_op_bss_info_changed(struct ieee80211_hw *hw,
 				    arvif->vdev_id);
 		else
 			ath11k_dbg(ar->ab, ATH11K_DBG_MAC,
-				   "Set staggered beacon mode for VDEV: %d\n",
-				   arvif->vdev_id);
+				   "Set %s beacon mode for VDEV: %d mode: %d\n",
+				   (param_value == WMI_BEACON_BURST_MODE) ? "burst" : "staggered",
+				   arvif->vdev_id, param_value);
 
 		if (!arvif->do_not_send_tmpl || !arvif->bcca_zero_sent) {
 			ret = ath11k_mac_setup_bcn_tmpl(arvif);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v6 1/3] nl80211: Add support for beacon tx mode
  2022-03-25  5:59 ` [PATCH v6 1/3] nl80211: Add support for " Maharaja Kennadyrajan
@ 2022-03-25  7:48   ` Sven Eckelmann
  2022-03-25 19:18   ` Jeff Johnson
  1 sibling, 0 replies; 7+ messages in thread
From: Sven Eckelmann @ 2022-03-25  7:48 UTC (permalink / raw)
  To: ath11k, linux-wireless; +Cc: Maharaja Kennadyrajan, Felix Fietkau

[-- Attachment #1: Type: text/plain, Size: 1401 bytes --]

On Friday, 25 March 2022 06:59:47 CET Maharaja Kennadyrajan wrote:
> @@ -5555,6 +5558,10 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
>         params->dtim_period =
>                 nla_get_u32(info->attrs[NL80211_ATTR_DTIM_PERIOD]);
>  
> +       if (info->attrs[NL80211_ATTR_BEACON_TX_MODE])
> +               params->beacon_tx_mode =
> +                       nla_get_u32(info->attrs[NL80211_ATTR_BEACON_TX_MODE]);
> +
>         err = cfg80211_validate_beacon_int(rdev, dev->ieee80211_ptr->iftype,
>                                            params->beacon_interval);
>         if (err)

But why are you setting it by vif when it is actually a PHY setting? [1]


And there is also the open question from Felix [2]:

On Tuesday, 10 August 2021 16:33:41 CET Felix Fietkau wrote:
> It still seems to me like something that the driver should detect and
> handle internally without user configuration, based on number of VAPs
> and maybe multicast/beacon rate (since the packet duration issue will be
> worse with CCK rates).

Kind regards,
        Sven

[1] https://lore.kernel.org/all/2718995.X0rUDs3ZmB@ripper/
    https://lore.kernel.org/all/4581459.tLtf2NohVe@ripper/
    https://lore.kernel.org/all/6210385.n8AMQ0p90U@ripper/
    https://lore.kernel.org/all/4594028.WNQrFERZ9z@ripper/
[2] https://lore.kernel.org/all/92b48724-277c-fc48-a922-6b1d49cd6a71@nbd.name/

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v6 1/3] nl80211: Add support for beacon tx mode
  2022-03-25  5:59 ` [PATCH v6 1/3] nl80211: Add support for " Maharaja Kennadyrajan
  2022-03-25  7:48   ` Sven Eckelmann
@ 2022-03-25 19:18   ` Jeff Johnson
  2022-03-26  8:48     ` Kalle Valo
  1 sibling, 1 reply; 7+ messages in thread
From: Jeff Johnson @ 2022-03-25 19:18 UTC (permalink / raw)
  To: Maharaja Kennadyrajan, ath11k, linux-wireless

On 3/24/2022 10:59 PM, Maharaja Kennadyrajan wrote:
[...snip...]

> +/**
> + * enum nl80211_beacon_tx_mode - Beacon Tx Mode enum.
> + * @NL80211_BEACON_STAGGERED_MODE: Used to configure beacon tx mode as
> + *	staggered mode. This is the default beacon tx mode.

Documentation doesn't match the code. There is now a default mode, and 
that is, well, the default mode

> + * @NL80211_BEACON_BURST_MODE: Used to configure beacon tx mode as burst mode.
> + */
> +enum nl80211_beacon_tx_mode {
> +	NL80211_BEACON_DEFAULT_MODE = 0,
> +	NL80211_BEACON_STAGGERED_MODE = 1,
> +	NL80211_BEACON_BURST_MODE = 2,
> +};
> +

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v6 1/3] nl80211: Add support for beacon tx mode
  2022-03-25 19:18   ` Jeff Johnson
@ 2022-03-26  8:48     ` Kalle Valo
  0 siblings, 0 replies; 7+ messages in thread
From: Kalle Valo @ 2022-03-26  8:48 UTC (permalink / raw)
  To: Jeff Johnson; +Cc: Maharaja Kennadyrajan, ath11k, linux-wireless

Jeff Johnson <quic_jjohnson@quicinc.com> writes:

> On 3/24/2022 10:59 PM, Maharaja Kennadyrajan wrote:
> [...snip...]
>
>> +/**
>> + * enum nl80211_beacon_tx_mode - Beacon Tx Mode enum.
>> + * @NL80211_BEACON_STAGGERED_MODE: Used to configure beacon tx mode as
>> + *	staggered mode. This is the default beacon tx mode.
>
> Documentation doesn't match the code. There is now a default mode, and
> that is, well, the default mode

But what does the default mode mean in this case? :) Please document in
detail what the driver is supposed to do in this mode.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-03-26  8:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-25  5:59 [PATCH v6 0/3] Add support to configure beacon tx mode Maharaja Kennadyrajan
2022-03-25  5:59 ` [PATCH v6 1/3] nl80211: Add support for " Maharaja Kennadyrajan
2022-03-25  7:48   ` Sven Eckelmann
2022-03-25 19:18   ` Jeff Johnson
2022-03-26  8:48     ` Kalle Valo
2022-03-25  5:59 ` [PATCH v6 2/3] mac80211: " Maharaja Kennadyrajan
2022-03-25  5:59 ` [PATCH v6 3/3] ath11k: " Maharaja Kennadyrajan

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