From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
Felix Fietkau <nbd@openwrt.org>,
Kyungwan Nam <Kyungwan.Nam@Atheros.com>,
"John W. Linville" <linville@tuxdriver.com>
Subject: [01/55] ath9k_hw: fix stopping rx DMA during resets
Date: Fri, 29 Apr 2011 11:55:24 -0700 [thread overview]
Message-ID: <20110429185652.677904385@clark.kroah.org> (raw)
In-Reply-To: <20110429185706.GA12824@kroah.com>
2.6.38-stable review patch. If anyone has any objections, please let us know.
------------------
From: Felix Fietkau <nbd@openwrt.org>
commit 5882da02e9d9089b7e8c739f3e774aaeeff8b7ba upstream.
During PHY errors, the MAC can sometimes fail to enter an idle state on older
hardware (before AR9380) after an rx stop has been requested.
This typically shows up in the kernel log with messages like these:
ath: Could not stop RX, we could be confusing the DMA engine when we start RX up
------------[ cut here ]------------
WARNING: at drivers/net/wireless/ath/ath9k/recv.c:504 ath_stoprecv+0xcc/0xf0 [ath9k]()
Call Trace:
[<8023f0e8>] dump_stack+0x8/0x34
[<80075050>] warn_slowpath_common+0x78/0xa4
[<80075094>] warn_slowpath_null+0x18/0x24
[<80d66d60>] ath_stoprecv+0xcc/0xf0 [ath9k]
[<80d642cc>] ath_set_channel+0xbc/0x270 [ath9k]
[<80d65254>] ath_radio_disable+0x4a4/0x7fc [ath9k]
When this happens, the state that the MAC enters is easy to identify and
does not result in bogus DMA traffic, however to ensure a working state
after a channel change, the hardware should still be reset.
This patch adds detection for this specific MAC state, after which the above
warnings completely disappear in my tests.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Cc: Kyungwan Nam <Kyungwan.Nam@Atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/net/wireless/ath/ath9k/hw.c | 9 ---------
drivers/net/wireless/ath/ath9k/mac.c | 25 ++++++++++++++++++++++---
drivers/net/wireless/ath/ath9k/mac.h | 2 +-
drivers/net/wireless/ath/ath9k/recv.c | 6 +++---
4 files changed, 26 insertions(+), 16 deletions(-)
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1218,15 +1218,6 @@ int ath9k_hw_reset(struct ath_hw *ah, st
ah->txchainmask = common->tx_chainmask;
ah->rxchainmask = common->rx_chainmask;
- if ((common->bus_ops->ath_bus_type != ATH_USB) && !ah->chip_fullsleep) {
- ath9k_hw_abortpcurecv(ah);
- if (!ath9k_hw_stopdmarecv(ah)) {
- ath_dbg(common, ATH_DBG_XMIT,
- "Failed to stop receive dma\n");
- bChannelChange = false;
- }
- }
-
if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE))
return -EIO;
--- a/drivers/net/wireless/ath/ath9k/mac.c
+++ b/drivers/net/wireless/ath/ath9k/mac.c
@@ -770,28 +770,47 @@ void ath9k_hw_abortpcurecv(struct ath_hw
}
EXPORT_SYMBOL(ath9k_hw_abortpcurecv);
-bool ath9k_hw_stopdmarecv(struct ath_hw *ah)
+bool ath9k_hw_stopdmarecv(struct ath_hw *ah, bool *reset)
{
#define AH_RX_STOP_DMA_TIMEOUT 10000 /* usec */
#define AH_RX_TIME_QUANTUM 100 /* usec */
struct ath_common *common = ath9k_hw_common(ah);
+ u32 mac_status, last_mac_status = 0;
int i;
+ /* Enable access to the DMA observation bus */
+ REG_WRITE(ah, AR_MACMISC,
+ ((AR_MACMISC_DMA_OBS_LINE_8 << AR_MACMISC_DMA_OBS_S) |
+ (AR_MACMISC_MISC_OBS_BUS_1 <<
+ AR_MACMISC_MISC_OBS_BUS_MSB_S)));
+
REG_WRITE(ah, AR_CR, AR_CR_RXD);
/* Wait for rx enable bit to go low */
for (i = AH_RX_STOP_DMA_TIMEOUT / AH_TIME_QUANTUM; i != 0; i--) {
if ((REG_READ(ah, AR_CR) & AR_CR_RXE) == 0)
break;
+
+ if (!AR_SREV_9300_20_OR_LATER(ah)) {
+ mac_status = REG_READ(ah, AR_DMADBG_7) & 0x7f0;
+ if (mac_status == 0x1c0 && mac_status == last_mac_status) {
+ *reset = true;
+ break;
+ }
+
+ last_mac_status = mac_status;
+ }
+
udelay(AH_TIME_QUANTUM);
}
if (i == 0) {
ath_err(common,
- "DMA failed to stop in %d ms AR_CR=0x%08x AR_DIAG_SW=0x%08x\n",
+ "DMA failed to stop in %d ms AR_CR=0x%08x AR_DIAG_SW=0x%08x DMADBG_7=0x%08x\n",
AH_RX_STOP_DMA_TIMEOUT / 1000,
REG_READ(ah, AR_CR),
- REG_READ(ah, AR_DIAG_SW));
+ REG_READ(ah, AR_DIAG_SW),
+ REG_READ(ah, AR_DMADBG_7));
return false;
} else {
return true;
--- a/drivers/net/wireless/ath/ath9k/mac.h
+++ b/drivers/net/wireless/ath/ath9k/mac.h
@@ -692,7 +692,7 @@ bool ath9k_hw_setrxabort(struct ath_hw *
void ath9k_hw_putrxbuf(struct ath_hw *ah, u32 rxdp);
void ath9k_hw_startpcureceive(struct ath_hw *ah, bool is_scanning);
void ath9k_hw_abortpcurecv(struct ath_hw *ah);
-bool ath9k_hw_stopdmarecv(struct ath_hw *ah);
+bool ath9k_hw_stopdmarecv(struct ath_hw *ah, bool *reset);
int ath9k_hw_beaconq_setup(struct ath_hw *ah);
/* Interrupt Handling */
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -513,12 +513,12 @@ start_recv:
bool ath_stoprecv(struct ath_softc *sc)
{
struct ath_hw *ah = sc->sc_ah;
- bool stopped;
+ bool stopped, reset = false;
spin_lock_bh(&sc->rx.rxbuflock);
ath9k_hw_abortpcurecv(ah);
ath9k_hw_setrxfilter(ah, 0);
- stopped = ath9k_hw_stopdmarecv(ah);
+ stopped = ath9k_hw_stopdmarecv(ah, &reset);
if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
ath_edma_stop_recv(sc);
@@ -533,7 +533,7 @@ bool ath_stoprecv(struct ath_softc *sc)
"confusing the DMA engine when we start RX up\n");
ATH_DBG_WARN_ON_ONCE(!stopped);
}
- return stopped;
+ return stopped || reset;
}
void ath_flushrecv(struct ath_softc *sc)
next prev parent reply other threads:[~2011-04-29 18:58 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-29 18:57 [00/55] 2.6.38.5-stable review Greg KH
2011-04-29 18:55 ` Greg KH [this message]
2011-04-29 18:55 ` [02/55] netxen: limit skb frags for non tso packet Greg KH
2011-04-29 18:55 ` [03/55] ath: add missing regdomain pair 0x5c mapping Greg KH
2011-04-29 18:55 ` [04/55] block, blk-sysfs: Fix an err return path in blk_register_queue() Greg KH
2011-04-29 18:55 ` [05/55] p54: Initialize extra_len in p54_tx_80211 Greg KH
2011-04-29 18:55 ` [06/55] qlcnic: limit skb frags for non tso packet Greg KH
2011-04-29 18:55 ` [07/55] nfsd4: fix struct file leak on delegation Greg KH
2011-04-29 18:55 ` [08/55] nfsd4: Fix filp leak Greg KH
2011-04-29 18:55 ` [09/55] virtio: Decrement avail idx on buffer detach Greg KH
2011-04-29 18:55 ` [10/55] x86, gart: Set DISTLBWALKPRB bit always Greg KH
2011-04-29 18:55 ` [11/55] x86, gart: Make sure GART does not map physmem above 1TB Greg KH
2011-04-29 18:55 ` [12/55] intel-iommu: Fix use after release during device attach Greg KH
2011-04-29 18:55 ` [13/55] intel-iommu: Unlink domain from iommu Greg KH
2011-04-29 18:55 ` [14/55] intel-iommu: Fix get_domain_for_dev() error path Greg KH
2011-04-29 18:55 ` [15/55] drm/radeon/kms: pll tweaks for r7xx Greg KH
2011-04-29 18:55 ` [16/55] drm/nouveau: fix notifier memory corruption bug Greg KH
2011-04-29 18:55 ` [17/55] drm/radeon/kms: fix bad shift in atom iio table parser Greg KH
2011-04-29 18:55 ` [18/55] drm/i915: Sanitize the output registers after resume Greg KH
2011-04-29 18:55 ` [19/55] drm/i915/tv: Remember the detected TV type Greg KH
2011-04-29 18:55 ` [20/55] tty/n_gsm: fix bug in CRC calculation for gsm1 mode Greg KH
2011-04-29 18:55 ` [21/55] serial/imx: read cts state only after acking cts change irq Greg KH
2011-04-29 18:55 ` [22/55] ASoC: Fix output PGA enabling in wm_hubs CODECs Greg KH
2011-04-29 18:55 ` [23/55] ASoC: codecs: JZ4740: Fix OOPS Greg KH
2011-04-29 18:55 ` [24/55] ALSA: hda - Add a fix-up for Acer dmic with ALC271x codec Greg KH
2011-04-29 18:55 ` [25/55] ahci: dont enable port irq before handler is registered Greg KH
2011-04-29 18:55 ` [26/55] libata: Implement ATA_FLAG_NO_DIPM and apply it to mcp65 Greg KH
2011-04-29 18:55 ` [27/55] kconfig: Avoid buffer underrun in choice input Greg KH
2011-04-29 18:55 ` [28/55] UBIFS: fix master node recovery Greg KH
2011-04-29 18:55 ` [29/55] ideapad: read brightness setting on brightness key notify Greg KH
2011-04-29 18:55 ` [30/55] ACPI battery: fribble sysfs files from a resume notifier Greg KH
2011-04-29 18:55 ` [31/55] ath9k_hw: partially revert "fix dma descriptor rx error bit parsing" Greg KH
2011-04-29 18:55 ` [32/55] UBIFS: fix false space checking failure Greg KH
2011-04-29 18:55 ` [33/55] [S390] kvm-390: Let kernel exit SIE instruction on work Greg KH
2011-04-29 18:55 ` [34/55] [S390] pfault: fix token handling Greg KH
2011-04-29 18:55 ` [35/55] ACPI / PM: Avoid infinite recurrence while registering power resources Greg KH
2011-04-29 18:55 ` [36/55] [PARISC] slub: fix panic with DISCONTIGMEM Greg KH
2011-05-02 20:04 ` [Stable-review] " Ben Hutchings
2011-05-02 21:44 ` Michael Schmitz
2011-05-03 22:46 ` David Rientjes
2011-05-03 23:17 ` Ben Hutchings
2011-05-03 23:20 ` James Bottomley
2011-05-03 23:57 ` David Rientjes
2011-04-29 18:56 ` [37/55] [PARISC] set memory ranges in N_NORMAL_MEMORY when onlined Greg KH
2011-04-29 18:56 ` [38/55] [media] FLEXCOP-PCI: fix __xlate_proc_name-warning for flexcop-pci Greg KH
2011-04-29 18:56 ` [39/55] virtio: console: Enable call to hvc_remove() on console port remove Greg KH
2011-04-29 18:56 ` [40/55] oom: use pte pages in OOM score Greg KH
2011-04-29 18:56 ` [41/55] mm: check if PTE is already allocated during page fault Greg KH
2011-04-29 18:56 ` [42/55] mm: thp: fix /dev/zero MAP_PRIVATE and vm_flags cleanups Greg KH
2011-04-29 18:56 ` [43/55] m68k/mm: Set all online nodes in N_NORMAL_MEMORY Greg KH
2011-04-29 18:56 ` [44/55] vfs: avoid large kmalloc()s for the fdtable Greg KH
2011-04-29 18:56 ` [45/55] nfs: dont lose MS_SYNCHRONOUS on remount of noac mount Greg KH
2011-04-29 18:56 ` [46/55] NFSv4.1: Ensure state manager thread dies on last umount Greg KH
2011-04-29 18:56 ` [47/55] um: mdd support for 64 bit atomic operations Greg KH
2011-04-29 18:56 ` [48/55] drm: select FRAMEBUFFER_CONSOLE_PRIMARY if we have FRAMEBUFFER_CONSOLE Greg KH
2011-04-29 18:56 ` [49/55] agp: fix arbitrary kernel memory writes Greg KH
2011-04-29 18:56 ` [50/55] agp: fix OOM and buffer overflow Greg KH
2011-04-29 18:56 ` [51/55] iwlwifi: do not set tx power when channel is changing Greg KH
2011-04-29 18:56 ` [52/55] iwl3945: do not deprecate software scan Greg KH
2011-04-29 18:56 ` [53/55] iwl3945: disable hw scan by default Greg KH
2011-04-29 18:56 ` [54/55] iwlegacy: fix tx_power initialization Greg KH
2011-04-29 18:56 ` [55/55] Input: xen-kbdfront - fix mouse getting stuck after save/restore Greg KH
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=20110429185652.677904385@clark.kroah.org \
--to=gregkh@suse.de \
--cc=Kyungwan.Nam@Atheros.com \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=nbd@openwrt.org \
--cc=stable-review@kernel.org \
--cc=stable@kernel.org \
--cc=torvalds@linux-foundation.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
all inboxes | Powered by JetHome®