linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@openwrt.org>
To: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"linville@tuxdriver.com" <linville@tuxdriver.com>,
	Luis Rodriguez <Luis.Rodriguez@Atheros.com>
Subject: Re: [PATCH 2/4] ath9k: fix stopping tx dma on reset
Date: Thu, 10 Mar 2011 13:47:45 +0100	[thread overview]
Message-ID: <4D78C871.2040901@openwrt.org> (raw)
In-Reply-To: <20110310085847.GB28100@vasanth-laptop>

On 2011-03-10 9:58 AM, Vasanthakumar Thiagarajan wrote:
> On Thu, Mar 10, 2011 at 06:05:01AM +0530, Felix Fietkau wrote:
>> +bool ath9k_hw_abort_tx_dma(struct ath_hw *ah)
>> +{
>> +	int i, q;
>> +
>> +	REG_WRITE(ah, AR_Q_TXD, AR_Q_TXD_M);
>> +
>> +	REG_SET_BIT(ah, AR_PCU_MISC, AR_PCU_FORCE_QUIET_COLL | AR_PCU_CLEAR_VMF);
>> +	REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_FORCE_CH_IDLE_HIGH);
>> +	REG_SET_BIT(ah, AR_D_GBL_IFS_MISC, AR_D_GBL_IFS_MISC_IGNORE_BACKOFF);
>> +
>> +	for (q = 0; q < AR_NUM_QCU; q++) {
>> +		for (i = 1000; i > 0; i--) {
>> +			if (!ath9k_hw_numtxpending(ah, q))
>> +				break;
>> +
>> +			udelay(5);
>> +		}
>> +	}
>> +	if (!i)
>> +		return false;
> 
> Here the assumption looks like a reset would follow to configure
> those registers back, may be some comment will be useful.
> 
>> diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
>> index e16136d..bb1d29e 100644
>> --- a/drivers/net/wireless/ath/ath9k/xmit.c
>> +++ b/drivers/net/wireless/ath/ath9k/xmit.c
>> @@ -1194,16 +1194,14 @@ bool ath_drain_all_txq(struct ath_softc *sc, bool retry_tx)
>>  	if (sc->sc_flags & SC_OP_INVALID)
>>  		return true;
>>  
>> -	/* Stop beacon queue */
>> -	ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
>> +	ath9k_hw_abort_tx_dma(ah);
>>  
>> -	/* Stop data queues */
>> +	/* Check if any queue remains active */
>>  	for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
>> -		if (ATH_TXQ_SETUP(sc, i)) {
>> -			txq = &sc->tx.txq[i];
>> -			ath9k_hw_stoptxdma(ah, txq->axq_qnum);
>> -			npend += ath9k_hw_numtxpending(ah, txq->axq_qnum);
>> -		}
>> +		if (!ATH_TXQ_SETUP(sc, i))
>> +			continue;
>> +
>> +		npend += ath9k_hw_numtxpending(ah, sc->tx.txq[i].axq_qnum);
> 
> This can be moved to ath9k_hw_abort_tx_dma() and make it return
> npend as the current return value is unused anyway.
I think I'll drop the return code of ath9k_hw_abort_tx_dma. Since it
checks the queues individually, queues that hit a timeout at first might
recover later, so it would be useful if the caller checks them properly
after the abort has been issued completely.

- Felix

  parent reply	other threads:[~2011-03-10 12:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-10  0:35 [PATCH 1/4] ath9k_hw: fix REG_SET_BIT and REG_CLR_BIT for multiple bits Felix Fietkau
2011-03-10  0:35 ` [PATCH 2/4] ath9k: fix stopping tx dma on reset Felix Fietkau
2011-03-10  0:35   ` [PATCH 3/4] ath9k: fix the .flush driver op implementation Felix Fietkau
2011-03-10  0:35     ` [PATCH 4/4] ath9k: improve reliability of beacon transmission and stuck beacon handling Felix Fietkau
2011-03-10  9:46       ` Vasanthakumar Thiagarajan
2011-03-10 13:04         ` Felix Fietkau
2011-03-10 13:15           ` Felix Fietkau
2011-03-10  9:25     ` [PATCH 3/4] ath9k: fix the .flush driver op implementation Vasanthakumar Thiagarajan
2011-03-10 13:03       ` Felix Fietkau
2011-03-10  8:58   ` [PATCH 2/4] ath9k: fix stopping tx dma on reset Vasanthakumar Thiagarajan
2011-03-10  9:32     ` Vasanthakumar Thiagarajan
2011-03-10 12:47     ` Felix Fietkau [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-03-10  4:21 Mark Mentovai
2011-03-10 13:20 ` Felix Fietkau

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