2014-04-09 10:13:21

by Michal Kazior

[permalink] [raw]
Subject: [PATCH 0/3] ath10k: improve recovery speed

Hi,

Patch 1/3 is just a cleanup I wanted to keep
separate from 2/3 which actually improves recovery
speed.

With this I'm able to recover from a `hard`
simualtion crash in ~3 seconds instead of ~10.

This should decrease the chance of CQM kicking in
on connected clients (due to beacon loss) when
ath10k is acting as AP.


Michal Kazior (3):
ath10k: differentiate between target init failures
ath10k: don't wait for device init if it crashed
ath10k: skip suspending when recovering

drivers/net/wireless/ath/ath10k/core.c | 6 ++++--
drivers/net/wireless/ath/ath10k/pci.c | 17 ++++++++++++++++-
2 files changed, 20 insertions(+), 3 deletions(-)

--
1.8.5.3



2014-04-14 07:28:48

by Michal Kazior

[permalink] [raw]
Subject: [PATCHv2 2/3] ath10k: don't wait for device init if it crashed

When warm resetting it's possible for device to
crash during initialization. Instead of waiting 3
seconds just return failure as soon as
FW_IND_EVENT_PENDING is set.

This speeds up device bootup and recovery in some
cases.

Signed-off-by: Michal Kazior <[email protected]>
---
v2:
* add a comment before if() [Kalle]

drivers/net/wireless/ath/ath10k/pci.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index cd3b00c..66b1f30 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2452,6 +2452,10 @@ static int ath10k_pci_wait_for_target_init(struct ath10k *ar)
if (val == 0xffffffff)
continue;

+ /* the device has crashed so don't bother trying anymore */
+ if (val & FW_IND_EVENT_PENDING)
+ break;
+
if (val & FW_IND_INITIALIZED)
break;

@@ -2470,6 +2474,12 @@ static int ath10k_pci_wait_for_target_init(struct ath10k *ar)
goto out;
}

+ if (val & FW_IND_EVENT_PENDING) {
+ ath10k_warn("device has crashed during init\n");
+ ret = -ECOMM;
+ goto out;
+ }
+
if (!(val & FW_IND_INITIALIZED)) {
ath10k_err("failed to receive initialized event from target: %08x\n",
val);
--
1.8.5.3


2014-04-09 10:13:24

by Michal Kazior

[permalink] [raw]
Subject: [PATCH 3/3] ath10k: skip suspending when recovering

It doesn't make much sense to even try suspending
the device when recovering. Recovering means the
device is unresponsive and waiting for suspend
procedure means taking a 3 second timeout waiting
for tx credits.

This speeds up firmware recovery significantly.

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

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 6abde37..75b3dfb 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -680,8 +680,8 @@ static void ath10k_core_restart(struct work_struct *work)

switch (ar->state) {
case ATH10K_STATE_ON:
- ath10k_halt(ar);
ar->state = ATH10K_STATE_RESTARTING;
+ ath10k_halt(ar);
ieee80211_restart_hw(ar->hw);
break;
case ATH10K_STATE_OFF:
@@ -908,7 +908,9 @@ void ath10k_core_stop(struct ath10k *ar)
lockdep_assert_held(&ar->conf_mutex);

/* try to suspend target */
- ath10k_wait_for_suspend(ar, WMI_PDEV_SUSPEND_AND_DISABLE_INTR);
+ if (ar->state != ATH10K_STATE_RESTARTING)
+ ath10k_wait_for_suspend(ar, WMI_PDEV_SUSPEND_AND_DISABLE_INTR);
+
ath10k_debug_stop(ar);
ath10k_htc_stop(&ar->htc);
ath10k_htt_detach(&ar->htt);
--
1.8.5.3


2014-04-09 10:13:24

by Michal Kazior

[permalink] [raw]
Subject: [PATCH 2/3] ath10k: don't wait for device init if it crashed

When warm resetting it's possible for device to
crash during initialization. Instead of waiting 3
seconds just return failure as soon as
FW_IND_EVENT_PENDING is set.

This speeds up device bootup and recovery in some
cases.

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

diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index cd3b00c..8337608 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2452,6 +2452,9 @@ static int ath10k_pci_wait_for_target_init(struct ath10k *ar)
if (val == 0xffffffff)
continue;

+ if (val & FW_IND_EVENT_PENDING)
+ break;
+
if (val & FW_IND_INITIALIZED)
break;

@@ -2470,6 +2473,12 @@ static int ath10k_pci_wait_for_target_init(struct ath10k *ar)
goto out;
}

+ if (val & FW_IND_EVENT_PENDING) {
+ ath10k_warn("device has crashed during init\n");
+ ret = -ECOMM;
+ goto out;
+ }
+
if (!(val & FW_IND_INITIALIZED)) {
ath10k_err("failed to receive initialized event from target: %08x\n",
val);
--
1.8.5.3


2014-04-14 07:28:49

by Michal Kazior

[permalink] [raw]
Subject: [PATCHv2 3/3] ath10k: skip suspending when recovering

It doesn't make much sense to even try suspending
the device when recovering. Recovering means the
device is unresponsive and waiting for suspend
procedure means taking a 3 second timeout waiting
for tx credits.

This speeds up firmware recovery significantly.

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

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 6abde37..75b3dfb 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -680,8 +680,8 @@ static void ath10k_core_restart(struct work_struct *work)

switch (ar->state) {
case ATH10K_STATE_ON:
- ath10k_halt(ar);
ar->state = ATH10K_STATE_RESTARTING;
+ ath10k_halt(ar);
ieee80211_restart_hw(ar->hw);
break;
case ATH10K_STATE_OFF:
@@ -908,7 +908,9 @@ void ath10k_core_stop(struct ath10k *ar)
lockdep_assert_held(&ar->conf_mutex);

/* try to suspend target */
- ath10k_wait_for_suspend(ar, WMI_PDEV_SUSPEND_AND_DISABLE_INTR);
+ if (ar->state != ATH10K_STATE_RESTARTING)
+ ath10k_wait_for_suspend(ar, WMI_PDEV_SUSPEND_AND_DISABLE_INTR);
+
ath10k_debug_stop(ar);
ath10k_htc_stop(&ar->htc);
ath10k_htt_detach(&ar->htt);
--
1.8.5.3


2014-04-14 07:28:47

by Michal Kazior

[permalink] [raw]
Subject: [PATCHv2 1/3] ath10k: differentiate between target init failures

This just makes it easier to tell apart different
kinds of bringup failure.

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

diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index bf1083d..cd3b00c 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2464,7 +2464,13 @@ static int ath10k_pci_wait_for_target_init(struct ath10k *ar)
mdelay(10);
} while (time_before(jiffies, timeout));

- if (val == 0xffffffff || !(val & FW_IND_INITIALIZED)) {
+ if (val == 0xffffffff) {
+ ath10k_err("failed to read device register, device is gone\n");
+ ret = -EIO;
+ goto out;
+ }
+
+ if (!(val & FW_IND_INITIALIZED)) {
ath10k_err("failed to receive initialized event from target: %08x\n",
val);
ret = -ETIMEDOUT;
--
1.8.5.3


2014-04-10 06:11:10

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 2/3] ath10k: don't wait for device init if it crashed

Michal Kazior <[email protected]> writes:

> When warm resetting it's possible for device to
> crash during initialization. Instead of waiting 3
> seconds just return failure as soon as
> FW_IND_EVENT_PENDING is set.
>
> This speeds up device bootup and recovery in some
> cases.
>
> Signed-off-by: Michal Kazior <[email protected]>

[...]

> --- a/drivers/net/wireless/ath/ath10k/pci.c
> +++ b/drivers/net/wireless/ath/ath10k/pci.c
> @@ -2452,6 +2452,9 @@ static int ath10k_pci_wait_for_target_init(struct ath10k *ar)
> if (val == 0xffffffff)
> continue;
>
> + if (val & FW_IND_EVENT_PENDING)
> + break;

Can you add a small comment here explaining why we do this? "device has
most probably crashed" or something like that.

--
Kalle Valo

2014-04-09 10:13:22

by Michal Kazior

[permalink] [raw]
Subject: [PATCH 1/3] ath10k: differentiate between target init failures

This just makes it easier to tell apart different
kinds of bringup failure.

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

diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index bf1083d..cd3b00c 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2464,7 +2464,13 @@ static int ath10k_pci_wait_for_target_init(struct ath10k *ar)
mdelay(10);
} while (time_before(jiffies, timeout));

- if (val == 0xffffffff || !(val & FW_IND_INITIALIZED)) {
+ if (val == 0xffffffff) {
+ ath10k_err("failed to read device register, device is gone\n");
+ ret = -EIO;
+ goto out;
+ }
+
+ if (!(val & FW_IND_INITIALIZED)) {
ath10k_err("failed to receive initialized event from target: %08x\n",
val);
ret = -ETIMEDOUT;
--
1.8.5.3


2014-04-14 07:28:46

by Michal Kazior

[permalink] [raw]
Subject: [PATCHv2 0/3] ath10k: improve recovery speed

Hi,

Patch 1/3 is just a cleanup I wanted to keep
separate from 2/3 which actually improves recovery
speed.

With this I'm able to recover from a `hard`
simualtion crash in ~3 seconds instead of ~10.

This should decrease the chance of CQM kicking in
on connected clients (due to beacon loss) when
ath10k is acting as AP.

v2:
* add a comment in the code


Michal Kazior (3):
ath10k: differentiate between target init failures
ath10k: don't wait for device init if it crashed
ath10k: skip suspending when recovering

drivers/net/wireless/ath/ath10k/core.c | 6 ++++--
drivers/net/wireless/ath/ath10k/pci.c | 18 +++++++++++++++++-
2 files changed, 21 insertions(+), 3 deletions(-)

--
1.8.5.3


2014-04-24 06:21:41

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCHv2 0/3] ath10k: improve recovery speed

Michal Kazior <[email protected]> writes:

> Hi,
>
> Patch 1/3 is just a cleanup I wanted to keep
> separate from 2/3 which actually improves recovery
> speed.
>
> With this I'm able to recover from a `hard`
> simualtion crash in ~3 seconds instead of ~10.
>
> This should decrease the chance of CQM kicking in
> on connected clients (due to beacon loss) when
> ath10k is acting as AP.
>
> v2:
> * add a comment in the code
>
>
> Michal Kazior (3):
> ath10k: differentiate between target init failures
> ath10k: don't wait for device init if it crashed
> ath10k: skip suspending when recovering

Thanks, all patches applied.

--
Kalle Valo