> -----Original Message----- > From: Johannes Berg <johannes@xxxxxxxxxxxxxxxx> > Sent: Thursday, November 9, 2023 7:31 AM > To: linux-wireless@xxxxxxxxxxxxxxx > Cc: Johannes Berg <johannes.berg@xxxxxxxxx> > Subject: [RFC PATCH 1/2] wifi: mac80211: simplify non-chanctx drivers > > From: Johannes Berg <johannes.berg@xxxxxxxxx> > > There are still surprisingly many non-chanctx drivers, but in > mac80211 that code is a bit awkward. Simplify this by having > those drivers assign 'emulated' ops, so that the mac80211 code > can be more unified between non-chanctx/chanctx drivers. This > cuts the number of places caring about it by about 15, which > are scattered across - now they're fewer and no longer in the > channel context handling. > > Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx> > --- Because old firmware can't support chanctx, rtw89 and mt76 could fall back to remove chanctx ops. I think we need to add below changes along with this patch. (I did 'drivers/net/wireless$ git grep add_chanctx | grep NULL' to find them) diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_core.c b/drivers/net/wireless/mediatek/mt76/mt792x_core.c index 502be22dbe36..0a98a1627b64 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x_core.c +++ b/drivers/net/wireless/mediatek/mt76/mt792x_core.c @@ -684,9 +684,9 @@ mt792x_get_mac80211_ops(struct device *dev, if (!(*fw_features & MT792x_FW_CAP_CNM)) { ops->remain_on_channel = NULL; ops->cancel_remain_on_channel = NULL; - ops->add_chanctx = NULL; - ops->remove_chanctx = NULL; - ops->change_chanctx = NULL; + ops->add_chanctx = ieee80211_emulate_add_chanctx; + ops->remove_chanctx = ieee80211_emulate_remove_chanctx; + ops->change_chanctx = ieee80211_emulate_change_chanctx; ops->assign_vif_chanctx = NULL; ops->unassign_vif_chanctx = NULL; ops->mgd_prepare_tx = NULL; diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c index c689fc2b2d49..390956622181 100644 --- a/drivers/net/wireless/realtek/rtw89/core.c +++ b/drivers/net/wireless/realtek/rtw89/core.c @@ -4452,9 +4452,9 @@ struct rtw89_dev *rtw89_alloc_ieee80211_hw(struct device *device, !RTW89_CHK_FW_FEATURE(BEACON_FILTER, &early_fw); if (no_chanctx) { - ops->add_chanctx = NULL; - ops->remove_chanctx = NULL; - ops->change_chanctx = NULL; + ops->add_chanctx = ieee80211_emulate_add_chanctx; + ops->remove_chanctx = ieee80211_emulate_remove_chanctx; + ops->change_chanctx = ieee80211_emulate_change_chanctx; ops->assign_vif_chanctx = NULL; ops->unassign_vif_chanctx = NULL; ops->remain_on_channel = NULL; Ping-Ke