ACS: Fix primary channel puncturing in ACS

Currently, when the ACS is updating the puncturing bitmap, the function
acs_update_puncturing_bitmap() sets the primary channel bitmap to 0.
This leads to a potential issue where the primary channel could be
punctured if ACS selects a different best channel within the same
segment.

To fix this issue, ensure that the primary channel bitmap is correctly
set by calculating the index of the primary channel based on the
frequency difference between the current channel and the best channel in
the segment, and is then passed to acs_update_puncturing_bitmap().

Fixes: af0f60e7dd ("EHT: Calculate puncturing bitmap for ACS")
Signed-off-by: Hari Naraayana Desikan Kannan <quic_hnaraaya@quicinc.com>
This commit is contained in:
Hari Naraayana Desikan Kannan 2024-04-30 15:22:32 +05:30 committed by Jouni Malinen
parent be2ac92918
commit 627b67f29b

View file

@ -834,6 +834,9 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface,
int bw320_offset = 0, ideal_bw320_offset = 0;
unsigned int k;
int secondary_channel = 1, freq_offset;
#ifdef CONFIG_IEEE80211BE
int index_primary = 0;
#endif /* CONFIG_IEEE80211BE */
if (is_24ghz_mode(mode->mode))
secondary_channel = iface->conf->secondary_channel;
@ -973,6 +976,9 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface,
best->chan, chan->chan,
chan->interference_factor,
best->interference_factor);
#ifdef CONFIG_IEEE80211BE
index_primary = (chan->freq - best->freq) / 20;
#endif /* CONFIG_IEEE80211BE */
chan = best;
}
@ -1061,7 +1067,8 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface,
if (iface->conf->ieee80211be)
acs_update_puncturing_bitmap(iface, mode, bw,
n_chans, chan,
factor, 0);
factor,
index_primary);
#endif /* CONFIG_IEEE80211BE */
}