Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

wifi: mac80211: refactor BW limitation check for CSA parsing

Refactor the BW limitation check to a more general format when
parsing CSA. Also, the original BW check did not account for BW
less than 160 MHz.

Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
Link: https://patch.msgid.link/20241009121812.2419-1-michael-cy.lee@mediatek.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Michael-CY Lee and committed by
Johannes Berg
2d63e653 f92e0cf1

+2 -7
+2 -7
net/mac80211/spectmgmt.c
··· 377 377 /* capture the AP chandef before (potential) downgrading */ 378 378 csa_ie->chanreq.ap = new_chandef; 379 379 380 - if (conn->bw_limit < IEEE80211_CONN_BW_LIMIT_320 && 381 - new_chandef.width == NL80211_CHAN_WIDTH_320) 382 - ieee80211_chandef_downgrade(&new_chandef, NULL); 383 - 384 - if (conn->bw_limit < IEEE80211_CONN_BW_LIMIT_160 && 385 - (new_chandef.width == NL80211_CHAN_WIDTH_80P80 || 386 - new_chandef.width == NL80211_CHAN_WIDTH_160)) 380 + while (conn->bw_limit < 381 + ieee80211_min_bw_limit_from_chandef(&new_chandef)) 387 382 ieee80211_chandef_downgrade(&new_chandef, NULL); 388 383 389 384 if (!cfg80211_chandef_compatible(&new_chandef,