[PATCH 1/9] wifi: mac80211: allow enabling chanctx until hw registration

sean.wang at mediatek.com sean.wang at mediatek.com
Mon Aug 15 17:03:39 PDT 2022


From: Sean Wang <sean.wang at mediatek.com>

MT7921 device can be supported with the channel context depending on
the newer firmware so that we need a way to enable the chanctx related
methods until hw is being registered.

Signed-off-by: Sean Wang <sean.wang at mediatek.com>
---
 net/mac80211/main.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 5b1c47ed0cc0..98d05ed1a081 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -1011,6 +1011,14 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
 		return -EINVAL;
 #endif
 
+	/* check all or no channel context operations exist */
+	i = !!local->ops->add_chanctx + !!local->ops->remove_chanctx +
+	    !!local->ops->change_chanctx + !!local->ops->assign_vif_chanctx +
+	    !!local->ops->unassign_vif_chanctx;
+	if (WARN_ON(i != 0 && i != 5))
+		return -EINVAL;
+	local->use_chanctx = i == 5;
+
 	if (!local->use_chanctx) {
 		for (i = 0; i < local->hw.wiphy->n_iface_combinations; i++) {
 			const struct ieee80211_iface_combination *comb;
-- 
2.25.1




More information about the Linux-mediatek mailing list