[PATCH 11/16] PR: Use preferred frequency for channel selection in PASN ranging
Jouni Malinen
j at w1.fi
Mon Jul 27 14:12:54 PDT 2026
On Mon, Jul 13, 2026 at 11:59:59AM +0530, Peddolla Harshavardhan Reddy wrote:
> diff --git a/src/common/proximity_ranging.c b/src/common/proximity_ranging.c
> +static bool pr_get_preferred_channel(int preferred_freq,
> + const struct pr_channels *common_chan,
> + u8 *op_class, u8 *op_channel)
> + /* Resolve freq to a base channel number via the 20 MHz op_class */
> + hw_mode = ieee80211_freq_to_channel_ext(preferred_freq, 0, 0,
> + &base_op_class, &channel);
This channel number is specific to a single operating class (that
base_op_class).
> +
> + /* Among all op_classes in common_chan that contain this channel,
> + * pick the one with the highest bandwidth.
> + */
> + for (i = 0; i < common_chan->op_classes; i++) {
> + for (j = 0; j < common_chan->op_class[i].channels; j++) {
> + if (common_chan->op_class[i].channel[j] != channel)
> + continue;
But this is comparing that operating class specific channel number to a
channel number in another operating class.
> + *op_class = best_op_class;
> + *op_channel = channel;
And this is returning the channel number that might not match the
channel in another operating class when base_op_class != best_op_class.
Maybe this should compare frequencies instead? Or some kind of range
comparison that would accept all matching channels that include the
preferred_freq.
--
Jouni Malinen PGP id EFC895FA
More information about the Hostap
mailing list