linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@kernel.org>
To: Venkateswara Naralasetty <quic_vnaralas@quicinc.com>
Cc: <ath11k@lists.infradead.org>, <linux-wireless@vger.kernel.org>
Subject: Re: [PATCHv2 2/2] ath11k: add spectral/CFR buffer validation support
Date: Tue, 07 Dec 2021 18:55:46 +0200	[thread overview]
Message-ID: <87y24wmk19.fsf@codeaurora.org> (raw)
In-Reply-To: <1637312901-10279-2-git-send-email-quic_vnaralas@quicinc.com> (Venkateswara Naralasetty's message of "Fri, 19 Nov 2021 14:38:21 +0530")

Venkateswara Naralasetty <quic_vnaralas@quicinc.com> writes:

> Currently there is no validation on the spectral/CFR report
> over the db ring buffers from the hardware. Improper/incomplete
> DMA by the target can result in invalid data received by host.
> Due to this we may populate incorrect data to user space.
>
> This buffer validation support fix this issues by filling some
> magic value in the buffer during buffer replenish and check for
> the magic value in the buffer received by the target. If host
> detect magic value in the received buffer it will drop the buffer.
>
> Tested-on: IPQ8074 WLAN.HK.2.4.0.1-01467-QCAHKSWPL_SILICONZ-1
>
> Signed-off-by: Venkateswara Naralasetty <quic_vnaralas@quicinc.com>
> ---
> v2:
>  * Rebased on TOT
>
>  drivers/net/wireless/ath/ath11k/dbring.c   | 32 ++++++++++++++++++++++++++++++
>  drivers/net/wireless/ath/ath11k/dbring.h   |  1 +
>  drivers/net/wireless/ath/ath11k/spectral.c | 10 ++++++++++
>  3 files changed, 43 insertions(+)
>
> diff --git a/drivers/net/wireless/ath/ath11k/dbring.c b/drivers/net/wireless/ath/ath11k/dbring.c
> index 31cf7ac..5c07442 100644
> --- a/drivers/net/wireless/ath/ath11k/dbring.c
> +++ b/drivers/net/wireless/ath/ath11k/dbring.c
> @@ -6,6 +6,37 @@
>  #include "core.h"
>  #include "debug.h"
>  
> +#define ATH11K_DB_MAGIC_VALUE 0xdeadbeaf
> +
> +int ath11k_dbring_validate_buffer(struct ath11k *ar, void *buffer, u32 size)
> +{
> +	u32 *temp;
> +	int idx;
> +
> +	size = size >> 2;
> +
> +	for (idx = 0, temp = buffer; idx < size; idx++, temp++) {
> +		if (*temp == ATH11K_DB_MAGIC_VALUE) {
> +			ath11k_warn(ar->ab, "found magic value in the buffer\n");

I moved the warning message to the callers to make it easier to identify
where the corruption is happening and also added the word "dropping" to
make the message clearer for the user.

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=6c90df4c7aca225c4c486f31ca956ae6c08abe59

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

  reply	other threads:[~2021-12-07 16:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-19  9:08 [PATCHv2 1/2] ath11k: add dbring debug support Venkateswara Naralasetty
2021-11-19  9:08 ` [PATCHv2 2/2] ath11k: add spectral/CFR buffer validation support Venkateswara Naralasetty
2021-12-07 16:55   ` Kalle Valo [this message]
2021-12-09  8:14   ` Kalle Valo
2021-12-07 16:39 ` [PATCHv2 1/2] ath11k: add dbring debug support Kalle Valo
2021-12-14 13:39   ` Venkateswara Naralasetty (QUIC)

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=87y24wmk19.fsf@codeaurora.org \
    --to=kvalo@kernel.org \
    --cc=ath11k@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=quic_vnaralas@quicinc.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 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).