2018-07-31 13:51:24

by Venkateswara Naralasetty

[permalink] [raw]
Subject: [PATCHv2] ath10k : Fix channel survey dump

Channel active/busy time are showing incorrect(less than previous or
sometimes zero) for successive survey dump command.

example:
Survey data from wlan0
frequency: 5180 MHz [in use]
channel active time: 54995 ms
channel busy time: 432 ms
channel receive time: 0 ms
channel transmit time: 59 ms
Survey data from wlan0
frequency: 5180 MHz [in use]
channel active time: 32592 ms
channel busy time: 254 ms
channel receive time: 0 ms
channel transmit time: 0 ms

This patch fix this issue by assigning 'wmi_bss_survey_req_type'
as 'WMI_BSS_SURVEY_REQ_TYPE_READ' which accumulate survey data in
FW and send survey data to driver upon the driver request. Wrap around
is taken care by FW.

hardware used : QCA9984
firmware ver : ver 10.4-3.5.3-00057

Signed-off-by: Venkateswara Naralasetty <[email protected]>
---
v2:
* updated commit log.

drivers/net/wireless/ath/ath10k/mac.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index f068e2b..db93ab1 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -6837,7 +6837,7 @@ ath10k_mac_update_bss_chan_survey(struct ath10k *ar,
struct ieee80211_channel *channel)
{
int ret;
- enum wmi_bss_survey_req_type type = WMI_BSS_SURVEY_REQ_TYPE_READ_CLEAR;
+ enum wmi_bss_survey_req_type type = WMI_BSS_SURVEY_REQ_TYPE_READ;

lockdep_assert_held(&ar->conf_mutex);

--
2.7.4


2018-07-31 19:19:22

by Ben Greear

[permalink] [raw]
Subject: Re: [PATCHv2] ath10k : Fix channel survey dump

On 07/31/2018 05:11 AM, Venkateswara Naralasetty wrote:
> Channel active/busy time are showing incorrect(less than previous or
> sometimes zero) for successive survey dump command.
>
> example:
> Survey data from wlan0
> frequency: 5180 MHz [in use]
> channel active time: 54995 ms
> channel busy time: 432 ms
> channel receive time: 0 ms
> channel transmit time: 59 ms
> Survey data from wlan0
> frequency: 5180 MHz [in use]
> channel active time: 32592 ms
> channel busy time: 254 ms
> channel receive time: 0 ms
> channel transmit time: 0 ms
>
> This patch fix this issue by assigning 'wmi_bss_survey_req_type'
> as 'WMI_BSS_SURVEY_REQ_TYPE_READ' which accumulate survey data in
> FW and send survey data to driver upon the driver request. Wrap around
> is taken care by FW.
>
> hardware used : QCA9984
> firmware ver : ver 10.4-3.5.3-00057

Have you tested this on other firmwares? I am pretty sure that at least
some of them, probably 10.2, will have issues.

Maybe you could make this change specific to certain firmware that
is known to work with the change?

Thanks,
Ben

>
> Signed-off-by: Venkateswara Naralasetty <[email protected]>
> ---
> v2:
> * updated commit log.
>
> drivers/net/wireless/ath/ath10k/mac.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
> index f068e2b..db93ab1 100644
> --- a/drivers/net/wireless/ath/ath10k/mac.c
> +++ b/drivers/net/wireless/ath/ath10k/mac.c
> @@ -6837,7 +6837,7 @@ ath10k_mac_update_bss_chan_survey(struct ath10k *ar,
> struct ieee80211_channel *channel)
> {
> int ret;
> - enum wmi_bss_survey_req_type type = WMI_BSS_SURVEY_REQ_TYPE_READ_CLEAR;
> + enum wmi_bss_survey_req_type type = WMI_BSS_SURVEY_REQ_TYPE_READ;
>
> lockdep_assert_held(&ar->conf_mutex);
>
>


--
Ben Greear <[email protected]>
Candela Technologies Inc http://www.candelatech.com

2018-07-31 20:15:39

by Jasmine Strong

[permalink] [raw]
Subject: Re: [PATCHv2] ath10k : Fix channel survey dump

On Tue, Jul 31, 2018 at 10:38 AM Ben Greear <[email protected]> wrote:

> On 07/31/2018 05:11 AM, Venkateswara Naralasetty wrote:
> > Channel active/busy time are showing incorrect(less than previous or
> > sometimes zero) for successive survey dump command.
> >
> > example:
> > Survey data from wlan0
> > frequency: 5180 MHz [in use]
> > channel active time: 54995 ms
> > channel busy time: 432 ms
> > channel receive time: 0 ms
> > channel transmit time: 59 ms
> > Survey data from wlan0
> > frequency: 5180 MHz [in use]
> > channel active time: 32592 ms
> > channel busy time: 254 ms
> > channel receive time: 0 ms
> > channel transmit time: 0 ms
> >
> > This patch fix this issue by assigning 'wmi_bss_survey_req_type'
> > as 'WMI_BSS_SURVEY_REQ_TYPE_READ' which accumulate survey data in
> > FW and send survey data to driver upon the driver request. Wrap around
> > is taken care by FW.
> >
> > hardware used : QCA9984
> > firmware ver : ver 10.4-3.5.3-00057
>
> Have you tested this on other firmwares? I am pretty sure that at least
> some of them, probably 10.2, will have issues.
>
> Maybe you could make this change specific to certain firmware that
> is known to work with the change?
>
>
There are bigger problems with it than that; even with firmwares that
behave correctly,
this changes the behavior that a lot of upper-layer software depends upon,
and will likely
make anything that actually uses the channel survey data misbehave.

It is therefore a breaking change for any device that actually implements
ACS.

-J.

2018-08-09 21:12:49

by Peter Oh

[permalink] [raw]
Subject: Re: [PATCHv2] ath10k : Fix channel survey dump



On 08/08/2018 11:35 PM, Venkateswara Naralasetty wrote:
> On 2018-08-01 00:03, Jasmine Strong wrote:
>> On Tue, Jul 31, 2018 at 10:38 AM Ben Greear <[email protected]>
>> wrote:
>>
>>> On 07/31/2018 05:11 AM, Venkateswara Naralasetty wrote:
>>>> Channel active/busy time are showing incorrect(less than previous
>>> or
>>>> sometimes zero) for successive survey dump command.
>>>>
>>>> example:
>>>> Survey data from wlan0
>>>> frequency: 5180 MHz [in use]
>>>> channel active time: 54995 ms
>>>> channel busy time: 432 ms
>>>> channel receive time: 0 ms
>>>> channel transmit time: 59 ms
>>>> Survey data from wlan0
>>>> frequency: 5180 MHz [in use]
>>>> channel active time: 32592 ms
>>>> channel busy time: 254 ms
>>>> channel receive time: 0 ms
>>>> channel transmit time: 0 ms
>>>>
>>>> This patch fix this issue by assigning 'wmi_bss_survey_req_type'
>>>> as 'WMI_BSS_SURVEY_REQ_TYPE_READ' which accumulate survey data in
>>>> FW and send survey data to driver upon the driver request. Wrap
>>> around
>>>> is taken care by FW.
>>>>
>>>> hardware used : QCA9984
>>>> firmware ver : ver 10.4-3.5.3-00057
>>>
>>> Have you tested this on other firmwares? I am pretty sure that at
>>> least
>>> some of them, probably 10.2, will have issues.
>>>
>>> Maybe you could make this change specific to certain firmware that
>>> is known to work with the change?
>>
>> There are bigger problems with it than that; even with firmwares that
>> behave correctly,
>> this changes the behavior that a lot of upper-layer software depends
>> upon, and will likely
>> make anything that actually uses the channel survey data misbehave.
>>
>> It is therefore a breaking change for any device that actually
>> implements ACS.
>>
>> -J.
>
> In ath9k driver also survey data being accumulated in driver and send
> survey data to user space is accumulated one. same thing we are
> implementing in FW(with WMI request type WMI_BSS_SURVEY_REQ_TYPE_READ)
> instead of doing it in driver.
It seems you're changing the behavior, not fixing a bug.
WMI_BSS_SURVEY_REQ_TYPE_READ_CLEAR is handled differently from
WMI_BSS_SURVEY_REQ_TYPE_READ and as Jasmine addressed, userspace apps
that's counting on WMI_BSS_SURVEY_REQ_TYPE_READ_CLEAR behavior will be
broken their functions with your change.
This means this patch will break backward compatibility.

Thanks,
Peter

2018-08-09 08:58:43

by Venkateswara Naralasetty

[permalink] [raw]
Subject: Re: [PATCHv2] ath10k : Fix channel survey dump

On 2018-08-01 00:03, Jasmine Strong wrote:
> On Tue, Jul 31, 2018 at 10:38 AM Ben Greear <[email protected]>
> wrote:
>
>> On 07/31/2018 05:11 AM, Venkateswara Naralasetty wrote:
>>> Channel active/busy time are showing incorrect(less than previous
>> or
>>> sometimes zero) for successive survey dump command.
>>>
>>> example:
>>> Survey data from wlan0
>>> frequency: 5180 MHz [in use]
>>> channel active time: 54995 ms
>>> channel busy time: 432 ms
>>> channel receive time: 0 ms
>>> channel transmit time: 59 ms
>>> Survey data from wlan0
>>> frequency: 5180 MHz [in use]
>>> channel active time: 32592 ms
>>> channel busy time: 254 ms
>>> channel receive time: 0 ms
>>> channel transmit time: 0 ms
>>>
>>> This patch fix this issue by assigning 'wmi_bss_survey_req_type'
>>> as 'WMI_BSS_SURVEY_REQ_TYPE_READ' which accumulate survey data in
>>> FW and send survey data to driver upon the driver request. Wrap
>> around
>>> is taken care by FW.
>>>
>>> hardware used : QCA9984
>>> firmware ver : ver 10.4-3.5.3-00057
>>
>> Have you tested this on other firmwares? I am pretty sure that at
>> least
>> some of them, probably 10.2, will have issues.
>>
>> Maybe you could make this change specific to certain firmware that
>> is known to work with the change?
>
> There are bigger problems with it than that; even with firmwares that
> behave correctly,
> this changes the behavior that a lot of upper-layer software depends
> upon, and will likely
> make anything that actually uses the channel survey data misbehave.
>
> It is therefore a breaking change for any device that actually
> implements ACS.
>
> -J.

In ath9k driver also survey data being accumulated in driver and send
survey data to user space is accumulated one. same thing we are
implementing in FW(with WMI request type WMI_BSS_SURVEY_REQ_TYPE_READ)
instead of doing it in driver.

Thanks,
Venkatesh.

2018-08-10 00:53:47

by Sven Eckelmann

[permalink] [raw]
Subject: Re: [PATCHv2] ath10k : Fix channel survey dump

On Donnerstag, 9. August 2018 20:46:26 CEST Peter Oh wrote:
> > In ath9k driver also survey data being accumulated in driver and send
> > survey data to user space is accumulated one. same thing we are
> > implementing in FW(with WMI request type WMI_BSS_SURVEY_REQ_TYPE_READ)
> > instead of doing it in driver.
> It seems you're changing the behavior, not fixing a bug.
> WMI_BSS_SURVEY_REQ_TYPE_READ_CLEAR is handled differently from
> WMI_BSS_SURVEY_REQ_TYPE_READ and as Jasmine addressed, userspace apps
> that's counting on WMI_BSS_SURVEY_REQ_TYPE_READ_CLEAR behavior will be
> broken their functions with your change.
> This means this patch will break backward compatibility.

Sounds to me like a bug when there is a driver independent API but two
incompatible implementations:

* one driver using accumulated values over time
* one driver using non-accumulated values which are reset after each read to 0

Especially because there is already software which expects the accumulated
values and which has no way to find out whether the just received data is now
accumulated or not. And it is also quite bad to have non-accumulated (ath10k's
read+clear) data when multiple programs need to gather this data at the same
time.

@Felix, @Johannes: Should &struct ieee80211_ops->get_survey/
NL80211_CMD_GET_SURVEY return "accumulated" channel utilizations values or
clear the counters on each read? Might have missed the relevant phrase in
include/uapi/linux/nl80211.h, include/net/cfg80211.h or
include/net/mac80211.h - so feel free to just point me to the already
existing documentation.


Btw. the same author also tried to implement the "accumulated data" behavior
for get_survey in cfg80211 when a driver only supports read+clear:
https://patchwork.kernel.org/patch/10417673/

And here the earlier attempt (changing it from read_clear to read):
https://patchwork.kernel.org/patch/9701459/ - the answer from Felix suggests
that the accumulated values would be correct for the channel utilization
related info in struct survey_info.

Kind regards,
Sven


Attachments:
signature.asc (833.00 B)
This is a digitally signed message part.

2018-08-01 10:39:25

by Venkateswara Naralasetty

[permalink] [raw]
Subject: RE: [PATCHv2] ath10k : Fix channel survey dump



> -----Original Message-----
> From: ath10k <[email protected]> On Behalf Of Ben
> Greear
> Sent: Tuesday, July 31, 2018 11:08 PM
> To: Venkateswara Naralasetty <[email protected]>;
> [email protected]
> Cc: [email protected]
> Subject: Re: [PATCHv2] ath10k : Fix channel survey dump
>=20
> On 07/31/2018 05:11 AM, Venkateswara Naralasetty wrote:
> > Channel active/busy time are showing incorrect(less than previous or
> > sometimes zero) for successive survey dump command.
> >
> > example:
> > Survey data from wlan0
> > frequency: 5180 MHz [in use]
> > channel active time: 54995 ms
> > channel busy time: 432 ms
> > channel receive time: 0 ms
> > channel transmit time: 59 ms
> > Survey data from wlan0
> > frequency: 5180 MHz [in use]
> > channel active time: 32592 ms
> > channel busy time: 254 ms
> > channel receive time: 0 ms
> > channel transmit time: 0 ms
> >
> > This patch fix this issue by assigning 'wmi_bss_survey_req_type'
> > as 'WMI_BSS_SURVEY_REQ_TYPE_READ' which accumulate survey data in
> FW
> > and send survey data to driver upon the driver request. Wrap around is
> > taken care by FW.
> >
> > hardware used : QCA9984
> > firmware ver : ver 10.4-3.5.3-00057
>=20
> Have you tested this on other firmwares? I am pretty sure that at least =
some
> of them, probably 10.2, will have issues.
>=20
I have tested this change with firmware version 10.2.4-1.0-00036 (hw used Q=
CA988x) as well it's working fine for me without any issues.
=20
> Maybe you could make this change specific to certain firmware that is kno=
wn
> to work with the change?
>=20
> Thanks,
> Ben
>=20
> >
> > Signed-off-by: Venkateswara Naralasetty <[email protected]>
> > ---
> > v2:
> > * updated commit log.
> >
> > drivers/net/wireless/ath/ath10k/mac.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/wireless/ath/ath10k/mac.c
> > b/drivers/net/wireless/ath/ath10k/mac.c
> > index f068e2b..db93ab1 100644
> > --- a/drivers/net/wireless/ath/ath10k/mac.c
> > +++ b/drivers/net/wireless/ath/ath10k/mac.c
> > @@ -6837,7 +6837,7 @@ ath10k_mac_update_bss_chan_survey(struct
> ath10k *ar,
> > struct ieee80211_channel *channel) {
> > int ret;
> > - enum wmi_bss_survey_req_type type =3D
> WMI_BSS_SURVEY_REQ_TYPE_READ_CLEAR;
> > + enum wmi_bss_survey_req_type type =3D
> WMI_BSS_SURVEY_REQ_TYPE_READ;
> >
> > lockdep_assert_held(&ar->conf_mutex);
> >
> >
>=20
>=20
> --
> Ben Greear <[email protected]>
> Candela Technologies Inc http://www.candelatech.com
>=20
>=20
> _______________________________________________
> ath10k mailing list
> [email protected]
> http://lists.infradead.org/mailman/listinfo/ath10k