2013-10-15 17:32:26

by Michal Kazior

[permalink] [raw]
Subject: [PATCH 0/7] ath10k: fixes 2013-10-15

Hi,

This is a bunch of fixes I've had queued up for
some time now. I was reluctant to send them
without some additional checks and because some of
the fixes are not ideal. At least we can get a
discussion going if anything raises any serious
concern.


Michal Kazior (7):
ath10k: prevent starting monitor without a vdev
ath10k: add sanity checks for monitor management
ath10k: fix endianess in prints
ath10k: fix NSS reporting in RX
ath10k: fix NULL deref upon early FW crash
ath10k: fix device initialization routine
ath10k: fix FW crashes on heavy TX on 10.1.389 AP FW

drivers/net/wireless/ath/ath10k/ce.c | 11 +++
drivers/net/wireless/ath/ath10k/core.c | 3 +-
drivers/net/wireless/ath/ath10k/htt_tx.c | 11 +--
drivers/net/wireless/ath/ath10k/hw.h | 7 ++
drivers/net/wireless/ath/ath10k/mac.c | 24 +++++-
drivers/net/wireless/ath/ath10k/pci.c | 130 +++++++++++++++++++------------
drivers/net/wireless/ath/ath10k/txrx.c | 2 +-
drivers/net/wireless/ath/ath10k/wmi.c | 16 ++--
8 files changed, 134 insertions(+), 70 deletions(-)

--
1.8.4.rc3



2013-10-15 17:32:32

by Michal Kazior

[permalink] [raw]
Subject: [PATCH 3/7] ath10k: fix endianess in prints

This fixes incorrect values being printed on
big-endian hosts.

Signed-off-by: Michal Kazior <[email protected]>
---
drivers/net/wireless/ath/ath10k/wmi.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index f9766fa..8e59887 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2209,7 +2209,7 @@ static int ath10k_wmi_main_cmd_init(struct ath10k *ar)
}

ath10k_dbg(ATH10K_DBG_WMI, "wmi sending %d memory chunks info.\n",
- __cpu_to_le32(ar->wmi.num_mem_chunks));
+ ar->wmi.num_mem_chunks);

cmd->num_host_mem_chunks = __cpu_to_le32(ar->wmi.num_mem_chunks);

@@ -2222,10 +2222,10 @@ static int ath10k_wmi_main_cmd_init(struct ath10k *ar)
__cpu_to_le32(ar->wmi.mem_chunks[i].req_id);

ath10k_dbg(ATH10K_DBG_WMI,
- "wmi chunk %d len %d requested, addr 0x%x\n",
+ "wmi chunk %d len %d requested, addr 0x%llx\n",
i,
- cmd->host_mem_chunks[i].size,
- cmd->host_mem_chunks[i].ptr);
+ ar->wmi.mem_chunks[i].len,
+ (unsigned long long)ar->wmi.mem_chunks[i].paddr);
}
out:
memcpy(&cmd->resource_config, &config, sizeof(config));
@@ -2300,7 +2300,7 @@ static int ath10k_wmi_10x_cmd_init(struct ath10k *ar)
}

ath10k_dbg(ATH10K_DBG_WMI, "wmi sending %d memory chunks info.\n",
- __cpu_to_le32(ar->wmi.num_mem_chunks));
+ ar->wmi.num_mem_chunks);

cmd->num_host_mem_chunks = __cpu_to_le32(ar->wmi.num_mem_chunks);

@@ -2313,10 +2313,10 @@ static int ath10k_wmi_10x_cmd_init(struct ath10k *ar)
__cpu_to_le32(ar->wmi.mem_chunks[i].req_id);

ath10k_dbg(ATH10K_DBG_WMI,
- "wmi chunk %d len %d requested, addr 0x%x\n",
+ "wmi chunk %d len %d requested, addr 0x%llx\n",
i,
- cmd->host_mem_chunks[i].size,
- cmd->host_mem_chunks[i].ptr);
+ ar->wmi.mem_chunks[i].len,
+ (unsigned long long)ar->wmi.mem_chunks[i].paddr);
}
out:
memcpy(&cmd->resource_config, &config, sizeof(config));
--
1.8.4.rc3


2013-10-15 17:32:36

by Michal Kazior

[permalink] [raw]
Subject: [PATCH 5/7] ath10k: fix NULL deref upon early FW crash

If firmware crashes during FW probing it would try
to perform FW recovery which uses mac80211
workqueue before registering to mac80211.

Using internal workqueue solves the problem.

Signed-off-by: Michal Kazior <[email protected]>
---
drivers/net/wireless/ath/ath10k/core.c | 3 ++-
drivers/net/wireless/ath/ath10k/pci.c | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index c5561a9..3f6cbe7 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -664,7 +664,8 @@ static void ath10k_core_restart(struct work_struct *work)
ieee80211_restart_hw(ar->hw);
break;
case ATH10K_STATE_OFF:
- /* this can happen if driver is being unloaded */
+ /* this can happen if driver is being unloaded
+ * or if the crash happens during FW probing */
ath10k_warn("cannot restart a device that hasn't been started\n");
break;
case ATH10K_STATE_RESTARTING:
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index f8d59c7..d09f8a2 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -777,7 +777,7 @@ static void ath10k_pci_hif_dump_area(struct ath10k *ar)
reg_dump_values[i + 2],
reg_dump_values[i + 3]);

- ieee80211_queue_work(ar->hw, &ar->restart_work);
+ queue_work(ar->workqueue, &ar->restart_work);
}

static void ath10k_pci_hif_send_complete_check(struct ath10k *ar, u8 pipe,
--
1.8.4.rc3


2013-10-15 17:32:38

by Michal Kazior

[permalink] [raw]
Subject: [PATCH 6/7] ath10k: fix device initialization routine

Hardware revision 2 does not support cold reset
correctly. As such it would sometimes lead to host
machine freeze or data bus errors.

The patch introduces warm reset function which is
used instead of the cold reset one. It also moves
the reset before interrupts are being set up to
prevent any kind of spurious interrupts from being
handled.

Signed-off-by: Michal Kazior <[email protected]>
---
drivers/net/wireless/ath/ath10k/hw.h | 7 ++
drivers/net/wireless/ath/ath10k/pci.c | 128 +++++++++++++++++++++-------------
2 files changed, 85 insertions(+), 50 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h
index 8aeb46d..2032737 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -204,8 +204,11 @@ enum ath10k_mcast2ucast_mode {
#define WLAN_ANALOG_INTF_PCIE_BASE_ADDRESS 0x0006c000
#define PCIE_LOCAL_BASE_ADDRESS 0x00080000

+#define SOC_RESET_CONTROL_ADDRESS 0x00000000
#define SOC_RESET_CONTROL_OFFSET 0x00000000
#define SOC_RESET_CONTROL_SI0_RST_MASK 0x00000001
+#define SOC_RESET_CONTROL_CE_RST_MASK 0x00040000
+#define SOC_RESET_CONTROL_CPU_WARM_RST_MASK 0x00000040
#define SOC_CPU_CLOCK_OFFSET 0x00000020
#define SOC_CPU_CLOCK_STANDARD_LSB 0
#define SOC_CPU_CLOCK_STANDARD_MASK 0x00000003
@@ -215,6 +218,8 @@ enum ath10k_mcast2ucast_mode {
#define SOC_LPO_CAL_OFFSET 0x000000e0
#define SOC_LPO_CAL_ENABLE_LSB 20
#define SOC_LPO_CAL_ENABLE_MASK 0x00100000
+#define SOC_LF_TIMER_CONTROL0_ADDRESS 0x00000050
+#define SOC_LF_TIMER_CONTROL0_ENABLE_MASK 0x00000004

#define SOC_CHIP_ID_ADDRESS 0x000000ec
#define SOC_CHIP_ID_REV_LSB 8
@@ -269,8 +274,10 @@ enum ath10k_mcast2ucast_mode {
#define CORE_CTRL_CPU_INTR_MASK 0x00002000
#define CORE_CTRL_ADDRESS 0x0000
#define PCIE_INTR_ENABLE_ADDRESS 0x0008
+#define PCIE_INTR_CAUSE_ADDRESS 0x000c
#define PCIE_INTR_CLR_ADDRESS 0x0014
#define SCRATCH_3_ADDRESS 0x0030
+#define CPU_INTR_ADDRESS 0x0010

/* Firmware indications to the Host via SCRATCH_3 register. */
#define FW_INDICATOR_ADDRESS (SOC_CORE_BASE_ADDRESS + SCRATCH_3_ADDRESS)
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index d09f8a2..14fcfe7 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -52,7 +52,6 @@ static int ath10k_pci_post_rx_pipe(struct ath10k_pci_pipe *pipe_info,
int num);
static void ath10k_pci_rx_pipe_cleanup(struct ath10k_pci_pipe *pipe_info);
static void ath10k_pci_stop_ce(struct ath10k *ar);
-static void ath10k_pci_device_reset(struct ath10k *ar);
static int ath10k_pci_reset_target(struct ath10k *ar);
static int ath10k_pci_start_intr(struct ath10k *ar);
static void ath10k_pci_stop_intr(struct ath10k *ar);
@@ -1825,17 +1824,77 @@ static void ath10k_pci_fw_interrupt_handler(struct ath10k *ar)
ath10k_pci_sleep(ar);
}

+static int ath10k_pci_warm_reset(struct ath10k *ar)
+{
+ struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+ void __iomem *addr;
+ int ret = 0;
+ u32 val;
+
+ ath10k_dbg(ATH10K_DBG_BOOT, "performing warm chip reset\n");
+
+ ret = ath10k_do_pci_wake(ar);
+ if (ret)
+ return ret;
+
+ /* debug */
+ addr = ar_pci->mem + SOC_CORE_BASE_ADDRESS + PCIE_INTR_CAUSE_ADDRESS;
+ ath10k_dbg(ATH10K_DBG_BOOT, "host CPU intr cause: 0x%x\n", ioread32(addr));
+ addr = ar_pci->mem + SOC_CORE_BASE_ADDRESS + CPU_INTR_ADDRESS;
+ ath10k_dbg(ATH10K_DBG_BOOT, "target CPU intr cause: 0x%x\n", ioread32(addr));
+
+ /* disable pending irqs */
+ iowrite32(0, ar_pci->mem + SOC_CORE_BASE_ADDRESS + PCIE_INTR_ENABLE_ADDRESS);
+ iowrite32(~0, ar_pci->mem + SOC_CORE_BASE_ADDRESS + PCIE_INTR_CLR_ADDRESS);
+
+ msleep(100);
+
+ /* clear fw indicator */
+ iowrite32(0, ar_pci->mem + ar_pci->fw_indicator_address);
+
+ /* clear target LF timer interrupts */
+ addr = ar_pci->mem + RTC_SOC_BASE_ADDRESS + SOC_LF_TIMER_CONTROL0_ADDRESS;
+ iowrite32(ioread32(addr) & ~SOC_LF_TIMER_CONTROL0_ENABLE_MASK, addr);
+
+ /* reset CE */
+ addr = ar_pci->mem + RTC_SOC_BASE_ADDRESS + SOC_RESET_CONTROL_ADDRESS;
+ val = ioread32(addr);
+ val |= SOC_RESET_CONTROL_CE_RST_MASK;
+ iowrite32(val, addr);
+ val = ioread32(addr);
+ msleep(10);
+
+ /* unreset CE */
+ val &= ~SOC_RESET_CONTROL_CE_RST_MASK, addr;
+ iowrite32(val, addr);
+ val = ioread32(addr);
+ msleep(10);
+
+ /* debug */
+ addr = ar_pci->mem + SOC_CORE_BASE_ADDRESS + PCIE_INTR_CAUSE_ADDRESS;
+ ath10k_dbg(ATH10K_DBG_BOOT, "host CPU intr cause: 0x%x\n", ioread32(addr));
+ addr = ar_pci->mem + SOC_CORE_BASE_ADDRESS + CPU_INTR_ADDRESS;
+ ath10k_dbg(ATH10K_DBG_BOOT, "target CPU intr cause: 0x%x\n", ioread32(addr));
+
+ /* CPU warm reset */
+ addr = ar_pci->mem + RTC_SOC_BASE_ADDRESS + SOC_RESET_CONTROL_ADDRESS;
+ iowrite32(ioread32(addr) | SOC_RESET_CONTROL_CPU_WARM_RST_MASK, addr);
+
+ ath10k_dbg(ATH10K_DBG_BOOT, "target reset state: 0x%x\n", ioread32(addr));
+
+ msleep(100);
+
+ ath10k_dbg(ATH10K_DBG_BOOT, "warm reset complete\n");
+
+ ath10k_do_pci_sleep(ar);
+ return ret;
+}
+
static int ath10k_pci_hif_power_up(struct ath10k *ar)
{
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
int ret;

- ret = ath10k_pci_start_intr(ar);
- if (ret) {
- ath10k_err("could not start interrupt handling (%d)\n", ret);
- goto err;
- }
-
/*
* Bring the target up cleanly.
*
@@ -1845,8 +1904,19 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar)
* (aux) powered and running. On a subsequent driver load, the Target
* is in an unexpected state. We try to catch that here in order to
* reset the Target and retry the probe.
+ *
+ * Only HW v2 supports warm reset. Since ath10k does not support v1
+ * anymore just forget about cold reset which is broken on v2 for now.
*/
- ath10k_pci_device_reset(ar);
+ ret = ath10k_pci_warm_reset(ar);
+ if (ret)
+ goto err;
+
+ ret = ath10k_pci_start_intr(ar);
+ if (ret) {
+ ath10k_err("could not start interrupt handling (%d)\n", ret);
+ goto err;
+ }

ret = ath10k_pci_reset_target(ar);
if (ret)
@@ -2278,48 +2348,6 @@ static int ath10k_pci_reset_target(struct ath10k *ar)
return 0;
}

-static void ath10k_pci_device_reset(struct ath10k *ar)
-{
- int i;
- u32 val;
-
- if (!SOC_GLOBAL_RESET_ADDRESS)
- return;
-
- ath10k_pci_reg_write32(ar, PCIE_SOC_WAKE_ADDRESS,
- PCIE_SOC_WAKE_V_MASK);
- for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
- if (ath10k_pci_target_is_awake(ar))
- break;
- msleep(1);
- }
-
- /* Put Target, including PCIe, into RESET. */
- val = ath10k_pci_reg_read32(ar, SOC_GLOBAL_RESET_ADDRESS);
- val |= 1;
- ath10k_pci_reg_write32(ar, SOC_GLOBAL_RESET_ADDRESS, val);
-
- for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
- if (ath10k_pci_reg_read32(ar, RTC_STATE_ADDRESS) &
- RTC_STATE_COLD_RESET_MASK)
- break;
- msleep(1);
- }
-
- /* Pull Target, including PCIe, out of RESET. */
- val &= ~1;
- ath10k_pci_reg_write32(ar, SOC_GLOBAL_RESET_ADDRESS, val);
-
- for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
- if (!(ath10k_pci_reg_read32(ar, RTC_STATE_ADDRESS) &
- RTC_STATE_COLD_RESET_MASK))
- break;
- msleep(1);
- }
-
- ath10k_pci_reg_write32(ar, PCIE_SOC_WAKE_ADDRESS, PCIE_SOC_WAKE_RESET);
-}
-
static void ath10k_pci_dump_features(struct ath10k_pci *ar_pci)
{
int i;
--
1.8.4.rc3


2013-10-15 18:55:58

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 0/7] ath10k: fixes 2013-10-15

Michal Kazior <[email protected]> writes:

> This is a bunch of fixes I've had queued up for
> some time now. I was reluctant to send them
> without some additional checks and because some of
> the fixes are not ideal. At least we can get a
> discussion going if anything raises any serious
> concern.
>
>
> Michal Kazior (7):
> ath10k: prevent starting monitor without a vdev
> ath10k: add sanity checks for monitor management
> ath10k: fix endianess in prints
> ath10k: fix NSS reporting in RX
> ath10k: fix NULL deref upon early FW crash
> ath10k: fix device initialization routine
> ath10k: fix FW crashes on heavy TX on 10.1.389 AP FW

I get few long line warnings:

drivers/net/wireless/ath/ath10k/pci.c:1842: WARNING: line over 80 characters
drivers/net/wireless/ath/ath10k/pci.c:1844: WARNING: line over 80 characters
drivers/net/wireless/ath/ath10k/pci.c:1847: WARNING: line over 80 characters
drivers/net/wireless/ath/ath10k/pci.c:1848: WARNING: line over 80 characters
drivers/net/wireless/ath/ath10k/pci.c:1856: WARNING: line over 80 characters
drivers/net/wireless/ath/ath10k/pci.c:1875: WARNING: line over 80 characters
drivers/net/wireless/ath/ath10k/pci.c:1877: WARNING: line over 80 characters
drivers/net/wireless/ath/ath10k/pci.c:1883: WARNING: line over 80 characters
drivers/net/wireless/ath/ath10k/mac.c:2284: WARNING: line over 80 characters

--
Kalle Valo

2013-10-16 09:19:15

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 2/7] ath10k: add sanity checks for monitor management

Michal Kazior <[email protected]> writes:

> Add a few checks and warnings to make it easier to
> track any kind of monitor vdev mismanagement.
>
> Signed-off-by: Michal Kazior <[email protected]>

[...]

> + if (!ar->monitor_present) {
> + ath10k_warn("mac montor stop -- monitor is not present\n");
> + return -EINVAL;
> + }

[...]

> + if (!ar->monitor_present) {
> + ath10k_warn("mac montor stop -- monitor is not present\n");
> + return -EINVAL;
> + }
> +
> + if (!ar->monitor_enabled) {
> + ath10k_warn("mac montor stop -- monitor is not enabled\n");
> + return -EINVAL;
> + }

s/montor/monitor/

--
Kalle Valo

2013-10-15 17:32:34

by Michal Kazior

[permalink] [raw]
Subject: [PATCH 4/7] ath10k: fix NSS reporting in RX

NSTS values reported in the VHT-SIG-A1 are 0
through 7 but they actually describe number of
streams 1 through 8.

1SS frames were dropped. This patch fixes this.

Signed-off-by: Michal Kazior <[email protected]>
---
drivers/net/wireless/ath/ath10k/txrx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c
index 5ae373a..c511f91 100644
--- a/drivers/net/wireless/ath/ath10k/txrx.c
+++ b/drivers/net/wireless/ath/ath10k/txrx.c
@@ -183,7 +183,7 @@ static void process_rx_rates(struct ath10k *ar, struct htt_rx_info *info,
/* VHT-SIG-A1 in info 1, VHT-SIG-A2 in info2
TODO check this */
mcs = (info2 >> 4) & 0x0F;
- nss = (info1 >> 10) & 0x07;
+ nss = ((info1 >> 10) & 0x07) + 1;
bw = info1 & 3;
sgi = info2 & 1;

--
1.8.4.rc3


2013-10-15 17:32:29

by Michal Kazior

[permalink] [raw]
Subject: [PATCH 1/7] ath10k: prevent starting monitor without a vdev

This fixes issue with interface bridging.

Linux bridging sets promiscuous mode for all
interfaces that are in a bridge. This translates
to configure_filter() being called in a mac80211
driver.

Before the patch operational interface would be
started and upped again when promiscuous mode was
enabled causing all sorts of strange issues:

* no HTT RX happening (i.e. no traffic)
* FW crash upon driver reload/unload

Signed-off-by: Michal Kazior <[email protected]>
---
drivers/net/wireless/ath/ath10k/mac.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 049eca2..9f26fcf 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2205,8 +2205,13 @@ static void ath10k_configure_filter(struct ieee80211_hw *hw,
*total_flags &= SUPPORTED_FILTERS;
ar->filter_flags = *total_flags;

+ /* Monitor must not be started if it wasn't created first. Promiscuous
+ * mode may be started on a non-monitor interface - in such case the monitor
+ * vdev is not created so starting the monitor makes no sense. Since
+ * ath10k uses no special RX filters (only BSS filter in STA mode)
+ * there's no need for any special action here. */
if ((ar->filter_flags & FIF_PROMISC_IN_BSS) &&
- !ar->monitor_enabled) {
+ !ar->monitor_enabled && ar->monitor_present) {
ath10k_dbg(ATH10K_DBG_MAC, "mac monitor %d start\n",
ar->monitor_vdev_id);

@@ -2214,7 +2219,7 @@ static void ath10k_configure_filter(struct ieee80211_hw *hw,
if (ret)
ath10k_warn("Unable to start monitor mode\n");
} else if (!(ar->filter_flags & FIF_PROMISC_IN_BSS) &&
- ar->monitor_enabled) {
+ ar->monitor_enabled && ar->monitor_present) {
ath10k_dbg(ATH10K_DBG_MAC, "mac monitor %d stop\n",
ar->monitor_vdev_id);

--
1.8.4.rc3


2013-10-16 14:18:21

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 0/7] ath10k: fixes 2013-10-15

Michal Kazior <[email protected]> writes:

> On 16 October 2013 05:56, Kalle Valo <[email protected]> wrote:
>> Kalle Valo <[email protected]> writes:
>>
>> Michal, if it's ok for you I'll submit v2 of this patchset. I'll fix the
>> long line warnings and also I do small cleanup to the warm reset code.
>
> I am totally okay with this. Thank you for your trouble.

As you can see, I changed the warm reset code quite a lot. If you have
time, please review that carefully.

--
Kalle Valo

2013-10-16 12:56:27

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 0/7] ath10k: fixes 2013-10-15

Kalle Valo <[email protected]> writes:

> Michal Kazior <[email protected]> writes:
>
>> This is a bunch of fixes I've had queued up for
>> some time now. I was reluctant to send them
>> without some additional checks and because some of
>> the fixes are not ideal. At least we can get a
>> discussion going if anything raises any serious
>> concern.
>>
>>
>> Michal Kazior (7):
>> ath10k: prevent starting monitor without a vdev
>> ath10k: add sanity checks for monitor management
>> ath10k: fix endianess in prints
>> ath10k: fix NSS reporting in RX
>> ath10k: fix NULL deref upon early FW crash
>> ath10k: fix device initialization routine
>> ath10k: fix FW crashes on heavy TX on 10.1.389 AP FW
>
> I get few long line warnings:
>
> drivers/net/wireless/ath/ath10k/pci.c:1842: WARNING: line over 80 characters
> drivers/net/wireless/ath/ath10k/pci.c:1844: WARNING: line over 80 characters
> drivers/net/wireless/ath/ath10k/pci.c:1847: WARNING: line over 80 characters
> drivers/net/wireless/ath/ath10k/pci.c:1848: WARNING: line over 80 characters
> drivers/net/wireless/ath/ath10k/pci.c:1856: WARNING: line over 80 characters
> drivers/net/wireless/ath/ath10k/pci.c:1875: WARNING: line over 80 characters
> drivers/net/wireless/ath/ath10k/pci.c:1877: WARNING: line over 80 characters
> drivers/net/wireless/ath/ath10k/pci.c:1883: WARNING: line over 80 characters
> drivers/net/wireless/ath/ath10k/mac.c:2284: WARNING: line over 80 characters

Michal, if it's ok for you I'll submit v2 of this patchset. I'll fix the
long line warnings and also I do small cleanup to the warm reset code.

--
Kalle Valo

2013-10-16 14:05:58

by Michal Kazior

[permalink] [raw]
Subject: Re: [PATCH 0/7] ath10k: fixes 2013-10-15

On 16 October 2013 05:56, Kalle Valo <[email protected]> wrote:
> Kalle Valo <[email protected]> writes:
>
>> Michal Kazior <[email protected]> writes:
>>
>>> This is a bunch of fixes I've had queued up for
>>> some time now. I was reluctant to send them
>>> without some additional checks and because some of
>>> the fixes are not ideal. At least we can get a
>>> discussion going if anything raises any serious
>>> concern.
>>>
>>>
>>> Michal Kazior (7):
>>> ath10k: prevent starting monitor without a vdev
>>> ath10k: add sanity checks for monitor management
>>> ath10k: fix endianess in prints
>>> ath10k: fix NSS reporting in RX
>>> ath10k: fix NULL deref upon early FW crash
>>> ath10k: fix device initialization routine
>>> ath10k: fix FW crashes on heavy TX on 10.1.389 AP FW
>>
>> I get few long line warnings:
>>
>> drivers/net/wireless/ath/ath10k/pci.c:1842: WARNING: line over 80 characters
>> drivers/net/wireless/ath/ath10k/pci.c:1844: WARNING: line over 80 characters
>> drivers/net/wireless/ath/ath10k/pci.c:1847: WARNING: line over 80 characters
>> drivers/net/wireless/ath/ath10k/pci.c:1848: WARNING: line over 80 characters
>> drivers/net/wireless/ath/ath10k/pci.c:1856: WARNING: line over 80 characters
>> drivers/net/wireless/ath/ath10k/pci.c:1875: WARNING: line over 80 characters
>> drivers/net/wireless/ath/ath10k/pci.c:1877: WARNING: line over 80 characters
>> drivers/net/wireless/ath/ath10k/pci.c:1883: WARNING: line over 80 characters
>> drivers/net/wireless/ath/ath10k/mac.c:2284: WARNING: line over 80 characters
>
> Michal, if it's ok for you I'll submit v2 of this patchset. I'll fix the
> long line warnings and also I do small cleanup to the warm reset code.

I am totally okay with this. Thank you for your trouble.


MicaƂ

2013-10-15 17:32:30

by Michal Kazior

[permalink] [raw]
Subject: [PATCH 2/7] ath10k: add sanity checks for monitor management

Add a few checks and warnings to make it easier to
track any kind of monitor vdev mismanagement.

Signed-off-by: Michal Kazior <[email protected]>
---
drivers/net/wireless/ath/ath10k/mac.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 9f26fcf..1878e8f 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -516,6 +516,11 @@ static int ath10k_monitor_start(struct ath10k *ar, int vdev_id)

lockdep_assert_held(&ar->conf_mutex);

+ if (!ar->monitor_present) {
+ ath10k_warn("mac montor stop -- monitor is not present\n");
+ return -EINVAL;
+ }
+
arg.vdev_id = vdev_id;
arg.channel.freq = channel->center_freq;
arg.channel.band_center_freq1 = ar->hw->conf.chandef.center_freq1;
@@ -566,6 +571,16 @@ static int ath10k_monitor_stop(struct ath10k *ar)

lockdep_assert_held(&ar->conf_mutex);

+ if (!ar->monitor_present) {
+ ath10k_warn("mac montor stop -- monitor is not present\n");
+ return -EINVAL;
+ }
+
+ if (!ar->monitor_enabled) {
+ ath10k_warn("mac montor stop -- monitor is not enabled\n");
+ return -EINVAL;
+ }
+
ret = ath10k_wmi_vdev_down(ar, ar->monitor_vdev_id);
if (ret)
ath10k_warn("Monitor vdev down failed: %d\n", ret);
--
1.8.4.rc3


2013-10-16 13:31:48

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 6/7] ath10k: fix device initialization routine

Michal Kazior <[email protected]> writes:

> Hardware revision 2 does not support cold reset
> correctly. As such it would sometimes lead to host
> machine freeze or data bus errors.
>
> The patch introduces warm reset function which is
> used instead of the cold reset one. It also moves
> the reset before interrupts are being set up to
> prevent any kind of spurious interrupts from being
> handled.
>
> Signed-off-by: Michal Kazior <[email protected]>

[...]

> + /* reset CE */
> + addr = ar_pci->mem + RTC_SOC_BASE_ADDRESS + SOC_RESET_CONTROL_ADDRESS;
> + val = ioread32(addr);
> + val |= SOC_RESET_CONTROL_CE_RST_MASK;
> + iowrite32(val, addr);
> + val = ioread32(addr);
> + msleep(10);
> +
> + /* unreset CE */
> + val &= ~SOC_RESET_CONTROL_CE_RST_MASK, addr;
> + iowrite32(val, addr);

This looks wrong, I assume it was supposed to be this:

val &= ~SOC_RESET_CONTROL_CE_RST_MASK;

--
Kalle Valo

2013-10-15 17:32:39

by Michal Kazior

[permalink] [raw]
Subject: [PATCH 7/7] ath10k: fix FW crashes on heavy TX on 10.1.389 AP FW

10.1.389 firmware has some differences in
calculation of number of outstanding HTT TX
completions. This led to FW crashes of 10.1.389
while main firmware branch was unnaffected.

The patch makes sure ath10k doesn't queue up more
MSDUs than it should.

Signed-off-by: Michal Kazior <[email protected]>
---
drivers/net/wireless/ath/ath10k/ce.c | 11 +++++++++++
drivers/net/wireless/ath/ath10k/htt_tx.c | 11 ++++-------
2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c
index e46951b..d243f28 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -1050,6 +1050,17 @@ struct ath10k_ce_pipe *ath10k_ce_init(struct ath10k *ar,
u32 ctrl_addr = ath10k_ce_base_address(ce_id);
int ret;

+ /*
+ * Make sure there's enough CE ringbuffer entries for HTT TX to avoid
+ * additional TX locking checks.
+ *
+ * For the lack of a better place do the check here.
+ */
+ BUILD_BUG_ON(TARGET_NUM_MSDU_DESC >
+ (CE_HTT_H2T_MSG_SRC_NENTRIES - 1));
+ BUILD_BUG_ON(TARGET_10X_NUM_MSDU_DESC >
+ (CE_HTT_H2T_MSG_SRC_NENTRIES - 1));
+
ret = ath10k_pci_wake(ar);
if (ret)
return NULL;
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c
index d9335e9..f1d36d2 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -85,16 +85,13 @@ void ath10k_htt_tx_free_msdu_id(struct ath10k_htt *htt, u16 msdu_id)

int ath10k_htt_tx_attach(struct ath10k_htt *htt)
{
- u8 pipe;
-
spin_lock_init(&htt->tx_lock);
init_waitqueue_head(&htt->empty_tx_wq);

- /* At the beginning free queue number should hint us the maximum
- * queue length */
- pipe = htt->ar->htc.endpoint[htt->eid].ul_pipe_id;
- htt->max_num_pending_tx = ath10k_hif_get_free_queue_number(htt->ar,
- pipe);
+ if (test_bit(ATH10K_FW_FEATURE_WMI_10X, htt->ar->fw_features))
+ htt->max_num_pending_tx = TARGET_10X_NUM_MSDU_DESC;
+ else
+ htt->max_num_pending_tx = TARGET_NUM_MSDU_DESC;

ath10k_dbg(ATH10K_DBG_BOOT, "htt tx max num pending tx %d\n",
htt->max_num_pending_tx);
--
1.8.4.rc3