mt76: fix association failure on kernels without wiphy->n_radio - #22
Open
antonionesta wants to merge 1 commit into
Open
mt76: fix association failure on kernels without wiphy->n_radio#22antonionesta wants to merge 1 commit into
antonionesta wants to merge 1 commit into
Conversation
Commit fe503c3 ("mt7902e: Backport down to 6.6") wrapped the n_radio == 0 fast path in mt76_vif_phy() in a version guard, because wiphy->n_radio does not exist on older kernels. The guard removed the fast path instead of preserving its behaviour, so on any kernel below the guarded version mt76_vif_phy() falls through to the chanctx lookup. That lookup is never valid for mt792x. The MT7902 firmware does not advertise MT792x_FW_CAP_CNM, so mt792x_get_mac80211_ops() clears ops->assign_vif_chanctx and mlink->ctx stays NULL forever. mt76_vif_phy() therefore returns NULL, mt76_sta_state() bails out with -EINVAL, and every association attempt fails with: wlan0: failed to insert STA entry for the AP (error -22) mt76_get_txpower() is broken by the same path and stops reporting TX power. Even with a CNM-capable firmware the fall-through would be wrong: mt792x sets hw->chanctx_data_size to sizeof(struct mt792x_chanctx), whose first member is a struct mt792x_bss_conf pointer, so the struct mt76_chanctx cast would be a type confusion. This driver never registers more than one radio, so the n_radio == 0 fast path always applies. Return hw->priv unconditionally on kernels lacking wiphy->n_radio, mirroring the #else pattern already used for mt76_get_survey() in the same commit. Tested on 6.12.100+deb13-amd64: association completes and the link reaches HE-MCS 11 rates. Fixes: fe503c3 ("mt7902e: Backport down to 6.6") Signed-off-by: Antonio Nesta <antodj94@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Commit fe503c3 ("mt7902e: Backport down to 6.6") wrapped the n_radio == 0 fast path in mt76_vif_phy() in a version guard, because wiphy->n_radio does not exist on older kernels. The guard removed the fast path instead of preserving its behaviour, so on any kernel below the guarded version mt76_vif_phy() falls through to the chanctx lookup.
That lookup is never valid for mt792x. The MT7902 firmware does not advertise MT792x_FW_CAP_CNM, so mt792x_get_mac80211_ops() clears ops->assign_vif_chanctx and mlink->ctx stays NULL forever. mt76_vif_phy() therefore returns NULL, mt76_sta_state() bails out with -EINVAL, and every association attempt fails with:
wlan0: failed to insert STA entry for the AP (error -22)
mt76_get_txpower() is broken by the same path and stops reporting TX power.
Even with a CNM-capable firmware the fall-through would be wrong: mt792x sets hw->chanctx_data_size to sizeof(struct mt792x_chanctx), whose first member is a struct mt792x_bss_conf pointer, so the struct mt76_chanctx cast would be a type confusion.
This driver never registers more than one radio, so the n_radio == 0 fast path always applies. Return hw->priv unconditionally on kernels lacking wiphy->n_radio, mirroring the #else pattern already used for mt76_get_survey() in the same commit.
Tested on 6.12.100+deb13-amd64: association completes and the link reaches HE-MCS 11 rates.
Fixes: fe503c3 ("mt7902e: Backport down to 6.6")