All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vasanthakumar Thiagarajan <vasanth@atheros.com>
To: Felix Fietkau <nbd@openwrt.org>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	Luis Rodriguez <Luis.Rodriguez@Atheros.com>,
	"linville@tuxdriver.com" <linville@tuxdriver.com>
Subject: Re: [PATCH 2/4] ath9k_hw: merge codepaths that access the cycle counter registers
Date: Mon, 4 Oct 2010 12:04:46 +0530	[thread overview]
Message-ID: <20101004063446.GA16078@vasanth-laptop> (raw)
In-Reply-To: <1286125639-15137-2-git-send-email-nbd@openwrt.org>

> +	/* freeze counters */
> +	REG_WRITE(ah, AR_MIBC, AR_MIBC_FMC);
> +
> +	ah->cc.cycles = REG_READ(ah, AR_CCCNT);
> +	if (ah->cc.cycles < cc.cycles) {
> +		clear = true;
> +		goto skip;
>  	}
>  
> -	cycles = cc;
> -	rx_frame = rf;
> -	rx_clear = rc;
> -	tx_frame = tf;
> +	ah->cc.rx_clear = REG_READ(ah, AR_RCCNT);
> +	ah->cc.rx_frame = REG_READ(ah, AR_RFCNT);
> +	ah->cc.tx_frame = REG_READ(ah, AR_TFCNT);
> +
> +	/* prevent wraparound */
> +	if (ah->cc.cycles & BIT(31))
> +		clear = true;

This does not look right, previous if should take care of 
any wrap around.

> +
> +#define CC_DELTA(_field, _reg) ah->cc_delta._field += ah->cc._field - cc._field
_reg is not used.

> 
> +skip:
> +	if (clear) {
> +		REG_WRITE(ah, AR_CCCNT, 0);
> +		REG_WRITE(ah, AR_RFCNT, 0);
> +		REG_WRITE(ah, AR_RCCNT, 0);
> +		REG_WRITE(ah, AR_TFCNT, 0);

should be able to do with single write in AR_MIBC.

> +	/* unfreeze counters */
> +	REG_WRITE(ah, AR_MIBC, 0);

Please configure the relevant bit to unfreeze the counters.

Vasanth

  parent reply	other threads:[~2010-10-04  6:35 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-03 17:07 [PATCH 1/4] ath9k_hw: clean up calibration flags Felix Fietkau
2010-10-03 17:07 ` [PATCH 2/4] ath9k_hw: merge codepaths that access the cycle counter registers Felix Fietkau
2010-10-03 17:07   ` [PATCH 3/4] ath9k_hw: clean up register write buffering Felix Fietkau
2010-10-03 17:07     ` [PATCH 4/4] ath9k_hw: fix regression in ANI listen time calculation Felix Fietkau
2010-10-03 17:24       ` Luis R. Rodriguez
2010-10-03 19:08         ` Felix Fietkau
2010-10-03 19:10           ` Felix Fietkau
2010-10-04  8:56     ` [PATCH 3/4] ath9k_hw: clean up register write buffering Rajkumar Manoharan
2010-10-04 11:53       ` Felix Fietkau
2010-10-04 17:22         ` [PATCH v2 " Felix Fietkau
2010-10-05  4:38           ` Senthil Balasubramanian
2010-10-05 10:03             ` [PATCH v3 " Felix Fietkau
2010-10-06 20:32               ` John W. Linville
2010-10-04  6:34   ` Vasanthakumar Thiagarajan [this message]
2010-10-04  8:17     ` [PATCH 2/4] ath9k_hw: merge codepaths that access the cycle counter registers Adrian Chadd
2010-10-04 11:36     ` Felix Fietkau
2010-10-04 12:24       ` Vasanthakumar Thiagarajan
2010-10-04 12:51         ` Felix Fietkau
2010-10-05  9:59           ` Bruno Randolf

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=20101004063446.GA16078@vasanth-laptop \
    --to=vasanth@atheros.com \
    --cc=Luis.Rodriguez@Atheros.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=nbd@openwrt.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 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.