From: Arend van Spriel <arend.vanspriel@broadcom.com>
To: Wright Feng <wright.feng@cypress.com>,
franky.lin@broadcom.com, hante.meuleman@broadcom.com,
kvalo@codeaurora.org, chi-hsien.lin@cypress.com
Cc: linux-wireless@vger.kernel.org,
brcm80211-dev-list.pdl@broadcom.com,
Chung-Hsien Hsu <stanley.hsu@cypress.com>
Subject: Re: [PATCH v4] brcmfmac: add CLM download support
Date: Mon, 28 Aug 2017 12:27:38 +0200 [thread overview]
Message-ID: <59A3F01A.5030403@broadcom.com> (raw)
In-Reply-To: <1503912332-4275-1-git-send-email-wright.feng@cypress.com>
On 8/28/2017 11:25 AM, Wright Feng wrote:
> From: Chung-Hsien Hsu <stanley.hsu@cypress.com>
>
> The firmware for brcmfmac devices includes information regarding
> regulatory constraints. For certain devices this information is kept
> separately in a binary form that needs to be downloaded to the device.
> This patch adds support to download this so-called CLM blob file. It
> uses the same naming scheme as the other firmware files with extension
> of .clm_blob.
>
> The CLM blob file is optional. If the file does not exist, the download
> process will be bypassed. It will not affect the driver loading.
>
> Signed-off-by: Chung-Hsien Hsu <stanley.hsu@cypress.com>
> ---
> v2: Revise commit message to describe in more detail
> v3: Add error handling in brcmf_c_get_clm_name function
> v4: Correct the length of dload_buf in brcmf_c_download function
> ---
> .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 10 ++
> .../wireless/broadcom/brcm80211/brcmfmac/common.c | 161 +++++++++++++++++++++
> .../wireless/broadcom/brcm80211/brcmfmac/core.c | 2 +
> .../wireless/broadcom/brcm80211/brcmfmac/core.h | 2 +
> .../broadcom/brcm80211/brcmfmac/fwil_types.h | 31 ++++
> .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 19 +++
> .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 19 +++
> .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 18 +++
> 8 files changed, 262 insertions(+)
>
[...]
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
> index 7a2b495..d09922b 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
[...]
> @@ -104,12 +106,139 @@ void brcmf_c_set_joinpref_default(struct brcmf_if *ifp)
> brcmf_err("Set join_pref error (%d)\n", err);
> }
>
> +static int brcmf_c_download(struct brcmf_if *ifp, u16 flag,
> + struct brcmf_dload_data_le *dload_buf,
> + u32 len)
> +{
> + s32 err;
> +
> + flag |= (DLOAD_HANDLER_VER << DLOAD_FLAG_VER_SHIFT);
> + dload_buf->flag = cpu_to_le16(flag);
> + dload_buf->dload_type = cpu_to_le16(DL_TYPE_CLM);
> + dload_buf->len = cpu_to_le32(len);
> + dload_buf->crc = cpu_to_le32(0);
> + len = sizeof(*dload_buf) + len - 1;
> + len = len + 8 - (len % 8);
In case len is 8 this will result in 16. So better use roundup() macro
from include/linux/kernel.h [1]. However, this means
brcmf_fil_iovar_data_set() will read after the allocated buffer space.
By the way, where does the alignment requirement come from?
> +
> + err = brcmf_fil_iovar_data_set(ifp, "clmload", (void *)dload_buf, len);
The cast is not necessary so please remove.
Regards,
Arend
[1]
http://elixir.free-electrons.com/linux/latest/source/include/linux/kernel.h#L90
next prev parent reply other threads:[~2017-08-28 10:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-28 9:25 [PATCH v4] brcmfmac: add CLM download support Wright Feng
2017-08-28 10:27 ` Arend van Spriel [this message]
2017-08-28 13:29 ` Chung-Hsien Hsu
2017-08-28 14:52 ` Steve deRosier
2017-08-28 17:15 ` Arend van Spriel
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=59A3F01A.5030403@broadcom.com \
--to=arend.vanspriel@broadcom.com \
--cc=brcm80211-dev-list.pdl@broadcom.com \
--cc=chi-hsien.lin@cypress.com \
--cc=franky.lin@broadcom.com \
--cc=hante.meuleman@broadcom.com \
--cc=kvalo@codeaurora.org \
--cc=linux-wireless@vger.kernel.org \
--cc=stanley.hsu@cypress.com \
--cc=wright.feng@cypress.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.