diff mbox series

[v5,2/2] mac80211: disable BSS color collision detection in case of no free colors

Message ID 1649867295-7204-3-git-send-email-quic_ramess@quicinc.com
State New
Headers show
Series Disable BSS color collision detection in case of no free colors | expand

Commit Message

Rameshkumar Sundaram April 13, 2022, 4:28 p.m. UTC
From: Lavanya Suresh <lavaks@codeaurora.org>

AP may run out of BSS color after color collision
detection event from driver.

Disable BSS color collision detection if no free colors are
available based on bss color disabled bit sent as a part of
NL80211_ATTR_HE_BSS_COLOR attribute sent in
NL80211_CMD_SET_BEACON.

It can be reenabled once new color is available.

Signed-off-by: Lavanya Suresh <lavaks@codeaurora.org>
Signed-off-by: Rameshkumar Sundaram <quic_ramess@quicinc.com>
---
 net/mac80211/cfg.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 87a2080..789bc62 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1132,9 +1132,9 @@  static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
 			le32_get_bits(params->he_oper->he_oper_params,
 			      IEEE80211_HE_OPERATION_RTS_THRESHOLD_MASK);
 		changed |= BSS_CHANGED_HE_OBSS_PD;
-
-		if (params->he_bss_color.enabled)
-			changed |= BSS_CHANGED_HE_BSS_COLOR;
+		if (params->beacon.he_bss_color_valid)
+			if (params->beacon.he_bss_color.enabled)
+				changed |= BSS_CHANGED_HE_BSS_COLOR;
 	}
 
 	if (sdata->vif.type == NL80211_IFTYPE_AP &&
@@ -1190,7 +1190,8 @@  static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
 	sdata->vif.bss_conf.allow_p2p_go_ps = sdata->vif.p2p;
 	sdata->vif.bss_conf.twt_responder = params->twt_responder;
 	sdata->vif.bss_conf.he_obss_pd = params->he_obss_pd;
-	sdata->vif.bss_conf.he_bss_color = params->he_bss_color;
+	if (params->beacon.he_bss_color_valid)
+		sdata->vif.bss_conf.he_bss_color = params->beacon.he_bss_color;
 	sdata->vif.bss_conf.s1g = params->chandef.chan->band ==
 				  NL80211_BAND_S1GHZ;
 
@@ -1275,6 +1276,7 @@  static int ieee80211_change_beacon(struct wiphy *wiphy, struct net_device *dev,
 				   struct cfg80211_beacon_data *params)
 {
 	struct ieee80211_sub_if_data *sdata;
+	struct ieee80211_bss_conf *bss_conf;
 	struct beacon_data *old;
 	int err;
 
@@ -1294,6 +1296,13 @@  static int ieee80211_change_beacon(struct wiphy *wiphy, struct net_device *dev,
 	err = ieee80211_assign_beacon(sdata, params, NULL, NULL);
 	if (err < 0)
 		return err;
+
+	bss_conf = &sdata->vif.bss_conf;
+	if (params->he_bss_color_valid &&
+	    params->he_bss_color.enabled != bss_conf->he_bss_color.enabled) {
+		bss_conf->he_bss_color.enabled = params->he_bss_color.enabled;
+		err |= BSS_CHANGED_HE_BSS_COLOR;
+	}
 	ieee80211_bss_info_change_notify(sdata, err);
 	return 0;
 }