| Message ID | 20260817101959.3616482-1-peddolla.reddy@oss.qualcomm.com |
|---|---|
| State | New |
| Headers | show |
| Series | [v3] PR: Prefer higher band when selecting best channel at equal bandwidth | expand |
On 8/17/26 03:19, Peddolla Harshavardhan Reddy wrote: > Currently pr_choose_best_channel() picks the first channel it finds > with the highest bandwidth, with no tiebreaker when two op classes > offer the same bandwidth on different bands. > > Add pr_op_class_band_priority() as a tiebreaker so that among op > classes with equal bandwidth a higher-band channel is preferred > (6 GHz > 5 GHz > 2.4 GHz). Higher bands usually provide higher > throughput due to less congestion and interference compared to the > 2.4 GHz band. Among these, 6 GHz is preferred because it supports > wider channel widths and, as a newer band with more available > spectrum and fewer deployed devices, is less congested than 5 GHz. Your patch claims it is for when bandwidths are the same, so that higher bands can offer more bandwidth (but does not, in this case), seems misleading. And higher bands have more propagation loss. There are ways for the AP to advertise the channel utilization. Can you take that into account as well? And check RSSI to make sure that the higher band has good signal in case they are near the edge of good perfomance (better to have 5ghz at -65 RSSI than 6ghz at -75 most likely?) Thanks, Ben > > Signed-off-by: Peddolla Harshavardhan Reddy <peddolla.reddy@oss.qualcomm.com> > --- > src/common/proximity_ranging.c | 24 ++++++++++++++++++++++-- > 1 file changed, 22 insertions(+), 2 deletions(-) > > diff --git a/src/common/proximity_ranging.c b/src/common/proximity_ranging.c > index a230043f5..106e5e55a 100644 > --- a/src/common/proximity_ranging.c > +++ b/src/common/proximity_ranging.c > @@ -1363,11 +1363,29 @@ static void pr_process_op_mode(const u8 *caps, size_t caps_len, > } > > > +/* pr_op_class_band_priority - Return band preference for channel selection > + * > + * Higher value means higher preference when bandwidth is equal: > + * 0 = 2.4 GHz > + * 1 = 5 GHz > + * 2 = 6 GHz > + */ > +static int pr_op_class_band_priority(const struct oper_class_map *map) > +{ > + if (is_6ghz_op_class(map->op_class)) > + return 2; > + if (map->mode == HOSTAPD_MODE_IEEE80211A) > + return 1; > + return 0; > +} > + > + > static void pr_choose_best_channel(struct pr_channels *common_channel, > u8 *op_class, u8 *op_channel) > { > - int bw; > + int bw, band; > int max_bw = 0; > + int max_band = -1; > const struct oper_class_map *map; > size_t i; > > @@ -1386,10 +1404,12 @@ static void pr_choose_best_channel(struct pr_channels *common_channel, > if (!map) > continue; > bw = oper_class_bw_to_int(map); > - if (bw > max_bw) { > + band = pr_op_class_band_priority(map); > + if (bw > max_bw || (bw == max_bw && band > max_band)) { > *op_class = common_channel->op_class[i].op_class; > *op_channel = common_channel->op_class[i].channel[0]; > max_bw = bw; > + max_band = band; > } > } > > > base-commit: 7533e0a806cccf7cd3d0b1ddbc77ed85682d8586
diff --git a/src/common/proximity_ranging.c b/src/common/proximity_ranging.c index a230043f5..106e5e55a 100644 --- a/src/common/proximity_ranging.c +++ b/src/common/proximity_ranging.c @@ -1363,11 +1363,29 @@ static void pr_process_op_mode(const u8 *caps, size_t caps_len, } +/* pr_op_class_band_priority - Return band preference for channel selection + * + * Higher value means higher preference when bandwidth is equal: + * 0 = 2.4 GHz + * 1 = 5 GHz + * 2 = 6 GHz + */ +static int pr_op_class_band_priority(const struct oper_class_map *map) +{ + if (is_6ghz_op_class(map->op_class)) + return 2; + if (map->mode == HOSTAPD_MODE_IEEE80211A) + return 1; + return 0; +} + + static void pr_choose_best_channel(struct pr_channels *common_channel, u8 *op_class, u8 *op_channel) { - int bw; + int bw, band; int max_bw = 0; + int max_band = -1; const struct oper_class_map *map; size_t i; @@ -1386,10 +1404,12 @@ static void pr_choose_best_channel(struct pr_channels *common_channel, if (!map) continue; bw = oper_class_bw_to_int(map); - if (bw > max_bw) { + band = pr_op_class_band_priority(map); + if (bw > max_bw || (bw == max_bw && band > max_band)) { *op_class = common_channel->op_class[i].op_class; *op_channel = common_channel->op_class[i].channel[0]; max_bw = bw; + max_band = band; } }
Currently pr_choose_best_channel() picks the first channel it finds with the highest bandwidth, with no tiebreaker when two op classes offer the same bandwidth on different bands. Add pr_op_class_band_priority() as a tiebreaker so that among op classes with equal bandwidth a higher-band channel is preferred (6 GHz > 5 GHz > 2.4 GHz). Higher bands usually provide higher throughput due to less congestion and interference compared to the 2.4 GHz band. Among these, 6 GHz is preferred because it supports wider channel widths and, as a newer band with more available spectrum and fewer deployed devices, is less congested than 5 GHz. Signed-off-by: Peddolla Harshavardhan Reddy <peddolla.reddy@oss.qualcomm.com> --- src/common/proximity_ranging.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) base-commit: 7533e0a806cccf7cd3d0b1ddbc77ed85682d8586