linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@codeaurora.org>
To: Loic Poulain <loic.poulain@linaro.org>
Cc: linux-wireless@vger.kernel.org, wcn36xx@lists.infradead.org,
	bryan.odonoghue@linaro.org, stable@vger.kernel.org
Subject: Re: [PATCH] wcn36xx: Channel list update before hardware scan
Date: Mon, 25 Oct 2021 16:37:56 +0300	[thread overview]
Message-ID: <87mtmx9qdn.fsf@codeaurora.org> (raw)
In-Reply-To: <1634737801-26071-1-git-send-email-loic.poulain@linaro.org> (Loic Poulain's message of "Wed, 20 Oct 2021 15:50:01 +0200")

Loic Poulain <loic.poulain@linaro.org> 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@vger.kernel.org
> Fixes: 2f3bef4b247e ("wcn36xx: Add hardware scan offload support")
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

[...]

> --- 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

      reply	other threads:[~2021-10-25 13:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-20 13:50 [PATCH] wcn36xx: Channel list update before hardware scan Loic Poulain
2021-10-25 13:37 ` Kalle Valo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mtmx9qdn.fsf@codeaurora.org \
    --to=kvalo@codeaurora.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=loic.poulain@linaro.org \
    --cc=stable@vger.kernel.org \
    --cc=wcn36xx@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).