linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
To: Kalle Valo <kvalo@qca.qualcomm.com>
Cc: <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH 4/4] ath6kl: read fwlog from firmware ring buffer
Date: Wed, 31 Aug 2011 11:47:44 +0530	[thread overview]
Message-ID: <20110831061743.GA1234@vasanth-laptop> (raw)
In-Reply-To: <20110830134458.21543.74829.stgit@localhost6.localdomain6>

On Tue, Aug 30, 2011 at 04:44:58PM +0300, Kalle Valo wrote:
> Firmare sends the logs only when it's internal ring buffer is full. But
> if firmware crashes we need to retrieve the latest logs through diagnose
> window. This is now done everytime the debugfs file is read.
> 
> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
> ---
>  drivers/net/wireless/ath/ath6kl/core.h   |   15 ++++++
>  drivers/net/wireless/ath/ath6kl/debug.c  |    3 +
>  drivers/net/wireless/ath/ath6kl/init.c   |   13 -----
>  drivers/net/wireless/ath/ath6kl/main.c   |   75 ++++++++++++++++++++++++++++++
>  drivers/net/wireless/ath/ath6kl/target.h |   14 ++++++
>  5 files changed, 107 insertions(+), 13 deletions(-)
> 
> +int ath6kl_read_fwlogs(struct ath6kl *ar)
> +{
> +	struct ath6kl_dbglog_hdr debug_hdr;
> +	struct ath6kl_dbglog_buf debug_buf;
> +	u32 address, length, dropped, firstbuf, debug_hdr_addr;
> +	int ret = 0, loop;
> +	u8 *buf;
> +
> +	buf = kmalloc(ATH6KL_FWLOG_PAYLOAD_SIZE, GFP_KERNEL);
> +	if (!buf)
> +		return -ENOMEM;
> +
> +	address = TARG_VTOP(ar->target_type,
> +			    ath6kl_get_hi_item_addr(ar,
> +						    HI_ITEM(hi_dbglog_hdr)));
> +
> +	ret = ath6kl_diag_read32(ar, address, &debug_hdr_addr);
> +	if (ret)
> +		goto out;
> +
> +	/* Get the contents of the ring buffer */
> +	if (debug_hdr_addr == 0) {
> +		ath6kl_warn("Invalid address for debug_hdr_addr\n");
> +		ret = -EINVAL;
> +		goto out;
> +	}
> +
> +	address = TARG_VTOP(ar->target_type, debug_hdr_addr);
> +	ath6kl_diag_read(ar, address, &debug_hdr, sizeof(debug_hdr));
> +
> +	address = TARG_VTOP(ar->target_type,
> +			    le32_to_cpu(debug_hdr.dbuf_addr));
> +	firstbuf = address;
> +	dropped = le32_to_cpu(debug_hdr.dropped);
> +	ath6kl_diag_read(ar, address, &debug_buf, sizeof(debug_buf));
> +
> +	loop = 100;
> +
> +	do {
> +		address = TARG_VTOP(ar->target_type,
> +				    le32_to_cpu(debug_buf.buffer_addr));
> +		length = le32_to_cpu(debug_buf.length);
> +
> +		if (length != 0 && (le32_to_cpu(debug_buf.length) <=
> +				    le32_to_cpu(debug_buf.bufsize))) {
> +			length = ALIGN(length, 4);
> +
> +			ret = ath6kl_diag_read(ar, address,
> +					       buf, length);
> +			if (ret)
> +				goto out;
> +
> +			ath6kl_debug_fwlog_event(ar, buf, length);
> +		}
> +
> +		address = TARG_VTOP(ar->target_type,
> +				    le32_to_cpu(debug_buf.next));
> +		ath6kl_diag_read(ar, address, &debug_buf, sizeof(debug_buf));

Address passed to ath6kl_diag_read32() and ath6kl_diag_read() does
not seem to be endian safe. This is not just present in your patch,
it has been already there other places as well. I'll fix this up.

Vasanth

      reply	other threads:[~2011-08-31  6:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-30 13:44 [PATCH 1/4] ath6kl: add firmware log support Kalle Valo
2011-08-30 13:44 ` [PATCH 2/4] ath6kl: implement support to set firmware log parameters Kalle Valo
2011-08-30 13:44 ` [PATCH 3/4] ath6kl: cleanup diagnose window read and write functions Kalle Valo
2011-08-30 15:00   ` Vasanthakumar Thiagarajan
2011-08-31 11:05     ` Kalle Valo
2011-08-30 13:44 ` [PATCH 4/4] ath6kl: read fwlog from firmware ring buffer Kalle Valo
2011-08-31  6:17   ` Vasanthakumar Thiagarajan [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=20110831061743.GA1234@vasanth-laptop \
    --to=vthiagar@qca.qualcomm.com \
    --cc=kvalo@qca.qualcomm.com \
    --cc=linux-wireless@vger.kernel.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).