Loic Poulain <loic.poulain@xxxxxxxxxx> writes: > The channel scan list must be updated before triggering a hardware scan > so that firmware takes into account the regulatory info for each single > channel such as active/passive config, power, DFS, etc... Without this > the firmware uses its own internal default channel configuration, which > is not aligned with mac80211 regulatory rules, and misses several > channels (e.g. 144). > > Cc: stable@xxxxxxxxxxxxxxx > Fixes: 2f3bef4b247e ("wcn36xx: Add hardware scan offload support") > Signed-off-by: Loic Poulain <loic.poulain@xxxxxxxxxx> [...] > --- a/drivers/net/wireless/ath/wcn36xx/smd.c > +++ b/drivers/net/wireless/ath/wcn36xx/smd.c > @@ -928,6 +928,103 @@ int wcn36xx_smd_stop_hw_scan(struct wcn36xx *wcn) > return ret; > } > > +static void wcn36xx_channel_set_max_power(struct wcn36xx_hal_channel_param *p, u32 max) > +{ > + u32 min = WCN36XX_HAL_DEFAULT_MIN_POWER; > + > + if (min > max) > + min = max; > + > + p->reg_info_1 &= 0xffff0000; > + p->reg_info_1 |= (min & 0xff) + ((max & 0xff) << 8); > +} > + > +static void wcn36xx_channel_set_reg_power(struct wcn36xx_hal_channel_param *p, u32 power) > +{ > + p->reg_info_1 &= 0xff00ffff; > + p->reg_info_1 |= (power & 0xff) << 16; > +} > + > +static void wcn36xx_channel_set_class_id(struct wcn36xx_hal_channel_param *p, u32 id) > +{ > + p->reg_info_1 &= 0x00ffffff; > + p->reg_info_1 |= (id & 0xff) << 24; > +} Please use u32_replace_bits() family of functions with proper defines for bitfields in hal.h. I suspect then you don't then even need these helper functions and makes the code readable. -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches