2015-03-31 11:07:49

by Michal Kazior

[permalink] [raw]
Subject: [PATCH 1/2] ath10k: fix hw roc expiration

It is not guaranteed firmware will switch to
foreign channel immediately after starting scan
sequence. To account for that don't use duration
parameter for scan time. Instead request insanely
long scan and use timeout worker to cancel it from
driver.

This should improve P2P reliability a bit.

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

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 9206b109e1ce..cb5d253e87d9 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -5029,6 +5029,7 @@ static int ath10k_remain_on_channel(struct ieee80211_hw *hw,
struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
struct wmi_start_scan_arg arg;
int ret = 0;
+ u32 scan_time_msec;

mutex_lock(&ar->conf_mutex);

@@ -5055,7 +5056,7 @@ static int ath10k_remain_on_channel(struct ieee80211_hw *hw,
if (ret)
goto exit;

- duration = max(duration, WMI_SCAN_CHAN_MIN_TIME_MSEC);
+ scan_time_msec = ar->hw->wiphy->max_remain_on_channel_duration * 2;

memset(&arg, 0, sizeof(arg));
ath10k_wmi_start_scan_init(ar, &arg);
@@ -5063,9 +5064,9 @@ static int ath10k_remain_on_channel(struct ieee80211_hw *hw,
arg.scan_id = ATH10K_SCAN_ID;
arg.n_channels = 1;
arg.channels[0] = chan->center_freq;
- arg.dwell_time_active = duration;
- arg.dwell_time_passive = duration;
- arg.max_scan_time = 2 * duration;
+ arg.dwell_time_active = scan_time_msec;
+ arg.dwell_time_passive = scan_time_msec;
+ arg.max_scan_time = scan_time_msec;
arg.scan_ctrl_flags |= WMI_SCAN_FLAG_PASSIVE;
arg.scan_ctrl_flags |= WMI_SCAN_FILTER_PROBE_REQ;

@@ -5090,6 +5091,9 @@ static int ath10k_remain_on_channel(struct ieee80211_hw *hw,
goto exit;
}

+ ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout,
+ msecs_to_jiffies(duration));
+
ret = 0;
exit:
mutex_unlock(&ar->conf_mutex);
--
2.1.4



2015-03-31 11:07:50

by Michal Kazior

[permalink] [raw]
Subject: [PATCH 2/2] ath10k: use scan burst for hw roc

This improves chances of getting onto a foreign
channel and thus makes P2P a bit more reliable.

Without scan burst it was possible for firmware to
not switch to foreign channel resulting in "failed
to switch to channel for roc scan" warning. This
would also effectively fail some offchan tx
requests and lead to P2P find/connect taking
longer. This could be observed when other vifs
were running/busy, e.g. with P2P GO.

Signed-off-by: Michal Kazior <[email protected]>
---
drivers/net/wireless/ath/ath10k/mac.c | 1 +
drivers/net/wireless/ath/ath10k/wmi-tlv.c | 2 +-
drivers/net/wireless/ath/ath10k/wmi.h | 1 +
3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index cb5d253e87d9..1d48eaafe42b 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -5069,6 +5069,7 @@ static int ath10k_remain_on_channel(struct ieee80211_hw *hw,
arg.max_scan_time = scan_time_msec;
arg.scan_ctrl_flags |= WMI_SCAN_FLAG_PASSIVE;
arg.scan_ctrl_flags |= WMI_SCAN_FILTER_PROBE_REQ;
+ arg.burst_duration_ms = duration;

ret = ath10k_start_scan(ar, &arg);
if (ret) {
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index 7bfb45492027..8a6f6fdf4bdc 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -1358,7 +1358,7 @@ ath10k_wmi_tlv_op_gen_start_scan(struct ath10k *ar,
cmd = (void *)tlv->value;

ath10k_wmi_put_start_scan_common(&cmd->common, arg);
- cmd->burst_duration_ms = __cpu_to_le32(0);
+ cmd->burst_duration_ms = __cpu_to_le32(arg->burst_duration_ms);
cmd->num_channels = __cpu_to_le32(arg->n_channels);
cmd->num_ssids = __cpu_to_le32(arg->n_ssids);
cmd->num_bssids = __cpu_to_le32(arg->n_bssids);
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 00b5799c5cdb..ef47ab5c4c9f 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -2168,6 +2168,7 @@ struct wmi_start_scan_arg {
u32 max_scan_time;
u32 probe_delay;
u32 scan_ctrl_flags;
+ u32 burst_duration_ms;

u32 ie_len;
u32 n_channels;
--
2.1.4


2015-04-15 12:08:35

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 1/2] ath10k: fix hw roc expiration

Michal Kazior <[email protected]> writes:

> It is not guaranteed firmware will switch to
> foreign channel immediately after starting scan
> sequence. To account for that don't use duration
> parameter for scan time. Instead request insanely
> long scan and use timeout worker to cancel it from
> driver.
>
> This should improve P2P reliability a bit.
>
> Signed-off-by: Michal Kazior <[email protected]>

Thanks, applied.

--
Kalle Valo