From f99354a45a72e124252e96b1f746fa8c83a8f597 Mon Sep 17 00:00:00 2001 From: Aloka Dixit Date: Thu, 31 Mar 2022 17:19:22 -0700 Subject: [PATCH 3/3] acs: validate the RU puncturing bitmap Validate generated RU puncturing bitmap against non-OFDMA patterns. Also consider OFDMA patterns if ru_punct_ofdma option is set. Signed-off-by: Aloka Dixit --- src/ap/acs.c | 22 ++++++++-- src/common/hw_features_common.c | 75 +++++++++++++++++++++++++++++++++ src/common/hw_features_common.h | 2 +- 3 files changed, 94 insertions(+), 5 deletions(-) --- a/src/ap/acs.c +++ b/src/ap/acs.c @@ -652,7 +652,7 @@ static void acs_update_puncturing_bitmap long double factor, int index_primary) { - struct hostapd_channel_data *adj_chan = NULL; + struct hostapd_channel_data *adj_chan = NULL, *first_chan = chan; int i; struct hostapd_config *conf = iface->conf; long double threshold = factor * conf->ru_punct_acs_threshold / 100; @@ -682,10 +682,18 @@ static void acs_update_puncturing_bitmap if (!adj_chan) break; + else if (i == 0) + first_chan = adj_chan; if (adj_chan->interference_factor > threshold) chan->ru_punct_bitmap |= BIT(i); } + + if (!is_ru_punct_bitmap_valid(bw, + (chan->freq - first_chan->freq) / 20, + chan->ru_punct_bitmap, + conf->ru_punct_ofdma)) + chan->ru_punct_bitmap = 0; } static void