diff mbox series

mac80211: adjust the replace_state of ieee80211_find_chanctx()

Message ID 40aabb3e10302f1d7da92b7a4eb46577d5ed8e05.1647641256.git.ryder.lee@mediatek.com
State New
Headers show
Series mac80211: adjust the replace_state of ieee80211_find_chanctx() | expand

Commit Message

Ryder Lee March 18, 2022, 10:18 p.m. UTC
We observe that the condition of chanctx could not be back to
IEEE80211_CHANCTX_REPLACE_NONE occasionally while STA connection.

In this case the state could be IEEE80211_CHANCTX_REPLACE_OTHER, which
fails the check and then creates another chanctx that leads to the next
round of chan_switch failure in cfg80211_check_combinations().

So, modify state to just rule out IEEE80211_CHANCTX_WILL_BE_REPLACED.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
---
 net/mac80211/chan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Johannes Berg March 23, 2022, 1:10 p.m. UTC | #1
On Sat, 2022-03-19 at 06:18 +0800, Ryder Lee wrote:
> We observe that the condition of chanctx could not be back to
> IEEE80211_CHANCTX_REPLACE_NONE occasionally while STA connection.

Not sure I parse this correctly, can you elaborate?

> In this case the state could be IEEE80211_CHANCTX_REPLACE_OTHER, which
> fails the check and then creates another chanctx that leads to the next
> round of chan_switch failure in cfg80211_check_combinations().

But if it's REPLACES_OTHER (note your typo), then it's not yet
registered properly or anything.

> So, modify state to just rule out IEEE80211_CHANCTX_WILL_BE_REPLACED.

Therefore, that really doesn't seem right.

A chanctx with IEEE80211_CHANCTX_REPLACES_OTHER needs to get used via
ieee80211_vif_use_reserved_switch().

johannes
diff mbox series

Patch

diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index e26d42de14ec..604095ff7a5b 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -477,7 +477,7 @@  ieee80211_find_chanctx(struct ieee80211_local *local,
 	list_for_each_entry(ctx, &local->chanctx_list, list) {
 		const struct cfg80211_chan_def *compat;
 
-		if (ctx->replace_state != IEEE80211_CHANCTX_REPLACE_NONE)
+		if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED)
 			continue;
 
 		if (ctx->mode == IEEE80211_CHANCTX_EXCLUSIVE)