2023-02-01 06:57:28

by Rameshkumar Sundaram

[permalink] [raw]
Subject: [PATCH v3 0/3] wifi: Add support to enable/disable bss color collision detection

This patchset adds configuration option to Enable/Disable 802.11ax BSS
color collision detection.

Changes since v2:
- Updated wifi prefix

Changes since v1:
- Split nl80211 patch(patch 1/2 on v1) to two patches.

Rameshkumar Sundaram (3):
wifi: cfg80211: add support to enable/disable bss color collision
detection
wifi: mac80211: Avoid BSS color collision detection if its disabled
wifi: ath11k: add support to enable/disable BSS color collision
detection

drivers/net/wireless/ath/ath11k/mac.c | 5 ++++-
include/net/cfg80211.h | 2 ++
include/uapi/linux/nl80211.h | 3 +++
net/mac80211/rx.c | 3 ++-
net/wireless/nl80211.c | 3 +++
5 files changed, 14 insertions(+), 2 deletions(-)


base-commit: 4ca69027691a0039279b64cfa0aa511d9c9fde59
--
2.17.1



2023-02-01 06:57:33

by Rameshkumar Sundaram

[permalink] [raw]
Subject: [PATCH v3 1/3] wifi: cfg80211: add support to enable/disable bss color collision detection

As per 802.11ax-2021, STAs shall process BSS Color Change Announcement
(BCCA) from AP and switch to new color, but some STAs aren't processing
BCCA from AP and not doing color switch, causing them to drop data
frames from AP post color change.

Provide an option to disable color collision detection and therefore
not to do BCCA to mitigate the same from AP. If it's required in case
where STA supports BCCA handling, then it can enabled in AP using this
option.

Signed-off-by: Rameshkumar Sundaram <[email protected]>
---
include/net/cfg80211.h | 2 ++
include/uapi/linux/nl80211.h | 3 +++
net/wireless/nl80211.c | 3 +++
3 files changed, 8 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 54a77d906b2d..c4c84ccf8e20 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -304,11 +304,13 @@ struct ieee80211_he_obss_pd {
* @color: the current color.
* @enabled: HE BSS color is used
* @partial: define the AID equation.
+ * @collision_detection_enabled: HE BSS color collision detection is enabled.
*/
struct cfg80211_he_bss_color {
u8 color;
bool enabled;
bool partial;
+ bool collision_detection_enabled;
};

/**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 8ecb0fbee721..a6068cdabf25 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -7442,6 +7442,8 @@ enum nl80211_obss_pd_attributes {
* @NL80211_HE_BSS_COLOR_ATTR_COLOR: the current BSS Color.
* @NL80211_HE_BSS_COLOR_ATTR_DISABLED: is BSS coloring disabled.
* @NL80211_HE_BSS_COLOR_ATTR_PARTIAL: the AID equation to be used..
+ * @NL80211_HE_BSS_COLOR_ATTR_COLLISION_DETECTION_DISABLED: is BSS
+ * color collision detection disabled.
*
* @__NL80211_HE_BSS_COLOR_ATTR_LAST: Internal
* @NL80211_HE_BSS_COLOR_ATTR_MAX: highest BSS Color attribute.
@@ -7452,6 +7454,7 @@ enum nl80211_bss_color_attributes {
NL80211_HE_BSS_COLOR_ATTR_COLOR,
NL80211_HE_BSS_COLOR_ATTR_DISABLED,
NL80211_HE_BSS_COLOR_ATTR_PARTIAL,
+ NL80211_HE_BSS_COLOR_ATTR_COLLISION_DETECTION_DISABLED,

/* keep last */
__NL80211_HE_BSS_COLOR_ATTR_LAST,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 64cf6110ce9d..ed344731e80e 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -377,6 +377,7 @@ he_bss_color_policy[NL80211_HE_BSS_COLOR_ATTR_MAX + 1] = {
[NL80211_HE_BSS_COLOR_ATTR_COLOR] = NLA_POLICY_RANGE(NLA_U8, 1, 63),
[NL80211_HE_BSS_COLOR_ATTR_DISABLED] = { .type = NLA_FLAG },
[NL80211_HE_BSS_COLOR_ATTR_PARTIAL] = { .type = NLA_FLAG },
+ [NL80211_HE_BSS_COLOR_ATTR_COLLISION_DETECTION_DISABLED] = { .type = NLA_FLAG },
};

static const struct nla_policy nl80211_txattr_policy[NL80211_TXRATE_MAX + 1] = {
@@ -5414,6 +5415,8 @@ static int nl80211_parse_he_bss_color(struct nlattr *attrs,
!nla_get_flag(tb[NL80211_HE_BSS_COLOR_ATTR_DISABLED]);
he_bss_color->partial =
nla_get_flag(tb[NL80211_HE_BSS_COLOR_ATTR_PARTIAL]);
+ he_bss_color->collision_detection_enabled =
+ !nla_get_flag(tb[NL80211_HE_BSS_COLOR_ATTR_COLLISION_DETECTION_DISABLED]);

return 0;
}
--
2.17.1


2023-02-01 06:57:35

by Rameshkumar Sundaram

[permalink] [raw]
Subject: [PATCH v3 2/3] wifi: mac80211: Avoid BSS color collision detection if its disabled

Don't detect BSS color collision and send collision events
to userspace if it is disabled.

Signed-off-by: Rameshkumar Sundaram <[email protected]>
---
net/mac80211/rx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index e284897ba5e9..5588067b2af2 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -3195,7 +3195,8 @@ ieee80211_rx_check_bss_color_collision(struct ieee80211_rx_data *rx)
if (ieee80211_hw_check(&rx->local->hw, DETECTS_COLOR_COLLISION))
return;

- if (rx->sdata->vif.bss_conf.csa_active)
+ if (rx->sdata->vif.bss_conf.csa_active ||
+ rx->sdata->vif.bss_conf.he_bss_color.collision_detection_enabled)
return;

baselen = mgmt->u.beacon.variable - rx->skb->data;
--
2.17.1


2023-02-01 06:57:36

by Rameshkumar Sundaram

[permalink] [raw]
Subject: [PATCH v3 3/3] wifi: ath11k: add support to enable/disable BSS color collision detection

Enable/Disable BSS color collision detection based on user
configuration of collision detection and BSS color feature
itself.

Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.1.0.1-01228-QCAHKSWPL_SILICONZ-1

Signed-off-by: Rameshkumar Sundaram <[email protected]>
---
drivers/net/wireless/ath/ath11k/mac.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 9e923ecb0891..6d5290996d9f 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -3112,6 +3112,7 @@ static void ath11k_mac_op_bss_info_changed(struct ieee80211_hw *hw,
u8 rateidx;
u32 rate;
u32 ipv4_cnt;
+ bool color_collision_detect;

mutex_lock(&ar->conf_mutex);

@@ -3370,10 +3371,12 @@ static void ath11k_mac_op_bss_info_changed(struct ieee80211_hw *hw,

if (changed & BSS_CHANGED_HE_BSS_COLOR) {
if (vif->type == NL80211_IFTYPE_AP) {
+ color_collision_detect = (info->he_bss_color.enabled &&
+ info->he_bss_color.collision_detection_enabled);
ret = ath11k_wmi_send_obss_color_collision_cfg_cmd(
ar, arvif->vdev_id, info->he_bss_color.color,
ATH11K_BSS_COLOR_COLLISION_DETECTION_AP_PERIOD_MS,
- info->he_bss_color.enabled);
+ color_collision_detect);
if (ret)
ath11k_warn(ar->ab, "failed to set bss color collision on vdev %i: %d\n",
arvif->vdev_id, ret);
--
2.17.1


2023-02-15 17:35:09

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] wifi: cfg80211: add support to enable/disable bss color collision detection

On Wed, 2023-02-01 at 12:26 +0530, Rameshkumar Sundaram wrote:
> As per 802.11ax-2021, STAs shall process BSS Color Change Announcement
> (BCCA) from AP and switch to new color, but some STAs aren't processing
> BCCA from AP and not doing color switch, causing them to drop data
> frames from AP post color change.

Hmm. We had this bug in EHT. Should we really allow this? It's a station
bug, why bother?

> Provide an option to disable color collision detection and therefore
> not to do BCCA to mitigate the same from AP. If it's required in case
> where STA supports BCCA handling, then it can enabled in AP using this
> option.

This could be rewritten a bit, not entirely clear to me. "enabled" is
more like "disabled"? Or no? Confusing.

> + * @NL80211_HE_BSS_COLOR_ATTR_COLLISION_DETECTION_DISABLED: is BSS
> + * color collision detection disabled.

please use a tab to indent the second line like elsewhere

> + he_bss_color->collision_detection_enabled =
> + !nla_get_flag(tb[NL80211_HE_BSS_COLOR_ATTR_COLLISION_DETECTION_DISABLED]);

Is it really worth to have one side say "enabled" and the other
"disabled"?

johannes

2023-02-15 17:35:56

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH v3 2/3] wifi: mac80211: Avoid BSS color collision detection if its disabled

On Wed, 2023-02-01 at 12:26 +0530, Rameshkumar Sundaram wrote:
> Don't detect BSS color collision and send collision events
> to userspace if it is disabled.
>
> Signed-off-by: Rameshkumar Sundaram <[email protected]>
> ---
> net/mac80211/rx.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
> index e284897ba5e9..5588067b2af2 100644
> --- a/net/mac80211/rx.c
> +++ b/net/mac80211/rx.c
> @@ -3195,7 +3195,8 @@ ieee80211_rx_check_bss_color_collision(struct ieee80211_rx_data *rx)
> if (ieee80211_hw_check(&rx->local->hw, DETECTS_COLOR_COLLISION))
> return;
>
> - if (rx->sdata->vif.bss_conf.csa_active)
> + if (rx->sdata->vif.bss_conf.csa_active ||
> + rx->sdata->vif.bss_conf.he_bss_color.collision_detection_enabled)
> return;

And this kind of answers my question on the previous patch ...

???

johannes

2023-02-15 17:37:17

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH v3 2/3] wifi: mac80211: Avoid BSS color collision detection if its disabled

On Wed, 2023-02-01 at 12:26 +0530, Rameshkumar Sundaram wrote:
> Don't detect BSS color collision and send collision events
> to userspace if it is disabled.
>
> Signed-off-by: Rameshkumar Sundaram <[email protected]>
> ---
> net/mac80211/rx.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
> index e284897ba5e9..5588067b2af2 100644
> --- a/net/mac80211/rx.c
> +++ b/net/mac80211/rx.c
> @@ -3195,7 +3195,8 @@ ieee80211_rx_check_bss_color_collision(struct ieee80211_rx_data *rx)
> if (ieee80211_hw_check(&rx->local->hw, DETECTS_COLOR_COLLISION))
> return;

Also, given this, it seems you should pass this setting down to the
hardware, bss change flag, etc.?

> - if (rx->sdata->vif.bss_conf.csa_active)
> + if (rx->sdata->vif.bss_conf.csa_active ||
> + rx->sdata->vif.bss_conf.he_bss_color.collision_detection_enabled)
> return;

and now that I read this again - clearly that's adding a multi-link
problem. I'd rather not add more of those.

johannes

2023-02-15 17:38:00

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH v3 3/3] wifi: ath11k: add support to enable/disable BSS color collision detection

On Wed, 2023-02-01 at 12:26 +0530, Rameshkumar Sundaram wrote:
> Enable/Disable BSS color collision detection based on user
> configuration of collision detection and BSS color feature
> itself.
>
> Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.1.0.1-01228-QCAHKSWPL_SILICONZ-1
>
> Signed-off-by: Rameshkumar Sundaram <[email protected]>
> ---
> drivers/net/wireless/ath/ath11k/mac.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
> index 9e923ecb0891..6d5290996d9f 100644
> --- a/drivers/net/wireless/ath/ath11k/mac.c
> +++ b/drivers/net/wireless/ath/ath11k/mac.c
> @@ -3112,6 +3112,7 @@ static void ath11k_mac_op_bss_info_changed(struct ieee80211_hw *hw,
> u8 rateidx;
> u32 rate;
> u32 ipv4_cnt;
> + bool color_collision_detect;
>
> mutex_lock(&ar->conf_mutex);
>
> @@ -3370,10 +3371,12 @@ static void ath11k_mac_op_bss_info_changed(struct ieee80211_hw *hw,
>
> if (changed & BSS_CHANGED_HE_BSS_COLOR) {

You never set this flag in the prior change, and it also doesn't even
*mean* the BSS color _detection_ changed ..??

johannes