diff mbox

Per chain RSSI reporting

Message ID SN1PR08MB1373BF583E9CE2AA6A0F6381B0FC0@SN1PR08MB1373.namprd08.prod.outlook.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show

Commit Message

Norik Dzhandzhapanyan May 26, 2017, 10:49 p.m. UTC
Add support for per chain RSSI reporting w/smoothing.

Signed-off-by: Norik Dzhandzhapanyan norikd@ethertronics.com


The contents of this transmission are Ethertronics Inc. Confidential and may contain proprietary or legally privileged information which may not be disclosed, copied or distributed without the express written consent of Ethertronics Inc. The information is intended to be for the use of the individual or entity named on this transmission. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. If you have received this transmission in error, please notify us by telephone immediately so that we can arrange for the retrieval of the original documents at no cost to you. Alternatively, notify the sender by replying to this transmission and delete the message without disclosing it. Thank you

Comments

Adrian Chadd May 27, 2017, 1:12 a.m. UTC | #1
[snip]

hiya,

I have something local that I've been meaning to push up to do this,
but with no smoothing. Ideally (!) smoothing is done optionally in
mac80211.

What do you think about just committing the per-chain RSSI stuff to
mac80211 so it shows up right now, and then we figure out how to
express the smoothing in mac80211 or further up the layers?

(We care about packet-to-packet RSSI values for "reasons" - mostly
bring-up and board validation, but also for runtime link checks.)


-adrian
Norik Dzhandzhapanyan May 27, 2017, 2:09 a.m. UTC | #2
Hi Adrian,

Inserting the smoothing function here is motivated by what we see as 'spikes' in rssi data under weak rssi conditions.  Figured its best to get rid of the 'bogus' data as close to the source as possible. Also to minimize the impact on the changes.

I believe the averaging  that happens at higher levels is based on EWMA macros in net/mac80211/sta_info.c which not wifi card/chipset specific. Didn't want to touch that since other cards seem to not have this spikey behavior. And, it doesnt seem to have an effect on the ath10k data anyway (iw reports the exact same values for both).

I wonder if it would be acceptable to pass a module load time parameter which would indicate an average factor with 0 (as default) to indicate no averaging?

Another option would be to add the chain_signal_avg field to the ieee80211_tx_status struct in mac80211.h to expose the average value up the stack this way? I haven't looked too deep on what this entails though and I didn't want to risk impacting anything else.

So yes.. I am OK with the per-chain RSSI changes first.

Norik


From: adrian.chadd@gmail.com <adrian.chadd@gmail.com> on behalf of Adrian Chadd <adrian@freebsd.org>
Sent: Friday, May 26, 2017 6:12 PM
To: Norik Dzhandzhapanyan
Cc: ath10k@lists.infradead.org; linux-wireless@vger.kernel.org
Subject: Re: [PATCH] Per chain RSSI reporting

[snip]

hiya,

I have something local that I've been meaning to push up to do this,
but with no smoothing. Ideally (!) smoothing is done optionally in
mac80211.

What do you think about just committing the per-chain RSSI stuff to
mac80211 so it shows up right now, and then we figure out how to
express the smoothing in mac80211 or further up the layers?

(We care about packet-to-packet RSSI values for "reasons" - mostly
bring-up and board validation, but also for runtime link checks.)


-adrian

The contents of this transmission are Ethertronics Inc. Confidential and may contain proprietary or legally privileged information which may not be disclosed, copied or distributed without the express written consent of Ethertronics Inc. The information is intended to be for the use of the individual or entity named on this transmission. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. If you have received this transmission in error, please notify us by telephone immediately so that we can arrange for the retrieval of the original documents at no cost to you. Alternatively, notify the sender by replying to this transmission and delete the message without disclosing it. Thank you
Norik Dzhandzhapanyan May 27, 2017, 8:30 a.m. UTC | #3
I've been looking at this more and I believe that smoothing/filtering anywhere other than as close as possible to where the ppdu gets unpacked will have the disadvantage of being negatively influenced by 'out of band' values since the average is not computed or averaged in the upper layers until invoked from their callers? The possibility then exists for several 'out of band' values to make their way to the upper layers if the queries happen to coincide with bad values being fed from the hardware unfiltered from ppdu unpacking.

The ath10k_htt_rx_h_channel function considers every rx event and has a 100% likelihood of successfully cleaning up the data.

Because of this, I think a reasonable approach would be to introduce a module parameter that can be set to a filter value with 0 as the default or no filter/smooth function applies.

Does something like this seem reasonable?

** in core.h
int ath10k_chain_rssi_avg;

** in core.c
module_param(ath10k_rssi_chain_avg,int,0644);
MODULE_PARAM_DESC(ath10k_chain_rssi_avg, "Running average/filter of immediate per chain rssi value");

** in htt_rx.c
allocate space based on ath10k_chain_rssi_avg, do the average and cleanup


Norik


On 05/26/2017 07:09 PM, Norik Dzhandzhapanyan wrote:
> Hi Adrian,
>
> Inserting the smoothing function here is motivated by what we see as 'spikes' in rssi data under weak rssi conditions. Figured its best to get rid of the 'bogus' data as close to the source as possible. Also to minimize the impact on the changes.
>
> I believe the averaging  that happens at higher levels is based on EWMA macros in net/mac80211/sta_info.c which not wifi card/chipset specific. Didn't want to touch that since other cards seem to not have this spikey behavior. And, it doesnt seem to have an effect on the ath10k data anyway (iw reports the exact same values for both).
>
> I wonder if it would be acceptable to pass a module load time parameter which would indicate an average factor with 0 (as default) to indicate no averaging?
>
> Another option would be to add the chain_signal_avg field to the ieee80211_tx_status struct in mac80211.h to expose the average value up the stack this way? I haven't looked too deep on what this entails though and I didn't want to risk impacting anything else.
>
> So yes.. I am OK with the per-chain RSSI changes first.
>
> Norik
>
>
> From: adrian.chadd@gmail.com <adrian.chadd@gmail.com> on behalf of Adrian Chadd <adrian@freebsd.org>
> Sent: Friday, May 26, 2017 6:12 PM
> To: Norik Dzhandzhapanyan
> Cc: ath10k@lists.infradead.org; linux-wireless@vger.kernel.org
> Subject: Re: [PATCH] Per chain RSSI reporting
>
> [snip]
>
> hiya,
>
> I have something local that I've been meaning to push up to do this,
> but with no smoothing. Ideally (!) smoothing is done optionally in
> mac80211.
>
> What do you think about just committing the per-chain RSSI stuff to
> mac80211 so it shows up right now, and then we figure out how to
> express the smoothing in mac80211 or further up the layers?
>
> (We care about packet-to-packet RSSI values for "reasons" - mostly
> bring-up and board validation, but also for runtime link checks.)
>
>
> -adrian

The contents of this transmission are Ethertronics Inc. Confidential and may contain proprietary or legally privileged information which may not be disclosed, copied or distributed without the express written consent of Ethertronics Inc. The information is intended to be for the use of the individual or entity named on this transmission. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. If you have received this transmission in error, please notify us by telephone immediately so that we can arrange for the retrieval of the original documents at no cost to you. Alternatively, notify the sender by replying to this transmission and delete the message without disclosing it. Thank you
Ben Greear May 27, 2017, 4:07 p.m. UTC | #4
At low encoding rates, especially if it switches to a single-chain encoding,
maybe the on-air signal really is stronger?

Have you verified in some other manner than the signals reported by ath10k are
wrong?

Thanks,
Ben


On 05/26/2017 07:09 PM, Norik Dzhandzhapanyan wrote:
> Hi Adrian,
>
> Inserting the smoothing function here is motivated by what we see as 'spikes' in rssi data under weak rssi conditions.  Figured its best to get rid of the 'bogus' data as close to the source as possible. Also to minimize the impact on the changes.
>
> I believe the averaging  that happens at higher levels is based on EWMA macros in net/mac80211/sta_info.c which not wifi card/chipset specific. Didn't want to touch that since other cards seem to not have this spikey behavior. And, it doesnt seem to have an effect on the ath10k data anyway (iw reports the exact same values for both).
>
> I wonder if it would be acceptable to pass a module load time parameter which would indicate an average factor with 0 (as default) to indicate no averaging?
>
> Another option would be to add the chain_signal_avg field to the ieee80211_tx_status struct in mac80211.h to expose the average value up the stack this way? I haven't looked too deep on what this entails though and I didn't want to risk impacting anything else.
>
> So yes.. I am OK with the per-chain RSSI changes first.
>
> Norik
>
>
> From: adrian.chadd@gmail.com <adrian.chadd@gmail.com> on behalf of Adrian Chadd <adrian@freebsd.org>
> Sent: Friday, May 26, 2017 6:12 PM
> To: Norik Dzhandzhapanyan
> Cc: ath10k@lists.infradead.org; linux-wireless@vger.kernel.org
> Subject: Re: [PATCH] Per chain RSSI reporting
>
> [snip]
>
> hiya,
>
> I have something local that I've been meaning to push up to do this,
> but with no smoothing. Ideally (!) smoothing is done optionally in
> mac80211.
>
> What do you think about just committing the per-chain RSSI stuff to
> mac80211 so it shows up right now, and then we figure out how to
> express the smoothing in mac80211 or further up the layers?
>
> (We care about packet-to-packet RSSI values for "reasons" - mostly
> bring-up and board validation, but also for runtime link checks.)
>
>
> -adrian
>
> The contents of this transmission are Ethertronics Inc. Confidential and may contain proprietary or legally privileged information which may not be disclosed, copied or distributed without the express written consent of Ethertronics Inc. The information is intended to be for the use of the individual or entity named on this transmission. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. If you have received this transmission in error, please notify us by telephone immediately so that we can arrange for the retrieval of the original documents at no cost to you. Alternatively, notify the sender by replying to this transmission and delete the message without disclosing it. Thank you
>
Adrian Chadd May 27, 2017, 4:39 p.m. UTC | #5
On 27 May 2017 at 09:07, Ben Greear <greearb@candelatech.com> wrote:
> At low encoding rates, especially if it switches to a single-chain encoding,
> maybe the on-air signal really is stronger?
>
> Have you verified in some other manner than the signals reported by ath10k
> are
> wrong?

Hiya,

So yeah, multipath, higher TX rates == weaker TX signal, TPC, etc are
all interesting to know about at the receiver. it's hard to separate
that out from the noise sometimes, but in some controlled deployments
its really obvious.



-adrian
Michael Ney May 27, 2017, 5:56 p.m. UTC | #6
The submitted code also doesn't appear to handle RSSI per-peer which would be needed for any use when configured as an access point.

> On May 27, 2017, at 12:39 PM, Adrian Chadd <adrian@freebsd.org> wrote:
> 
> On 27 May 2017 at 09:07, Ben Greear <greearb@candelatech.com> wrote:
>> At low encoding rates, especially if it switches to a single-chain encoding,
>> maybe the on-air signal really is stronger?
>> 
>> Have you verified in some other manner than the signals reported by ath10k
>> are
>> wrong?
> 
> Hiya,
> 
> So yeah, multipath, higher TX rates == weaker TX signal, TPC, etc are
> all interesting to know about at the receiver. it's hard to separate
> that out from the noise sometimes, but in some controlled deployments
> its really obvious.
> 
> 
> 
> -adrian
> 
> _______________________________________________
> ath10k mailing list
> ath10k@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/ath10k
Norik Dzhandzhapanyan May 27, 2017, 7:25 p.m. UTC | #7
We see this inconsistent/incorrect reporting in our RF chamber.

Norik

On 05/27/2017 09:39 AM, Adrian Chadd wrote:
> On 27 May 2017 at 09:07, Ben Greear <greearb@candelatech.com> wrote:
>> At low encoding rates, especially if it switches to a single-chain encoding,
>> maybe the on-air signal really is stronger?
>>
>> Have you verified in some other manner than the signals reported by ath10k
>> are
>> wrong?
> Hiya,
>
> So yeah, multipath, higher TX rates == weaker TX signal, TPC, etc are
> all interesting to know about at the receiver. it's hard to separate
> that out from the noise sometimes, but in some controlled deployments
> its really obvious.
>
>
>
> -adrian
>
>


The contents of this transmission are Ethertronics Inc. Confidential and may contain proprietary or legally privileged information which may not be disclosed, copied or distributed without the express written consent of Ethertronics Inc. The information is intended to be for the use of the individual or entity named on this transmission. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. If you have received this transmission in error, please notify us by telephone immediately so that we can arrange for the retrieval of the original documents at no cost to you. Alternatively, notify the sender by replying to this transmission and delete the message without disclosing it. Thank you
Norik Dzhandzhapanyan May 27, 2017, 7:30 p.m. UTC | #8
Is there an enhanced or conflicting patch pending?


On 05/27/2017 10:56 AM, Michael Ney wrote:
> The submitted code also doesn't appear to handle RSSI per-peer which would be needed for any use when configured as an access point.
>
>> On May 27, 2017, at 12:39 PM, Adrian Chadd <adrian@freebsd.org> wrote:
>>
>> On 27 May 2017 at 09:07, Ben Greear <greearb@candelatech.com> wrote:
>>> At low encoding rates, especially if it switches to a single-chain encoding,
>>> maybe the on-air signal really is stronger?
>>>
>>> Have you verified in some other manner than the signals reported by ath10k
>>> are
>>> wrong?
>> Hiya,
>>
>> So yeah, multipath, higher TX rates == weaker TX signal, TPC, etc are
>> all interesting to know about at the receiver. it's hard to separate
>> that out from the noise sometimes, but in some controlled deployments
>> its really obvious.
>>
>>
>>
>> -adrian
>>
>> _______________________________________________
>> ath10k mailing list
>> ath10k@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/ath10k

The contents of this transmission are Ethertronics Inc. Confidential and may contain proprietary or legally privileged information which may not be disclosed, copied or distributed without the express written consent of Ethertronics Inc. The information is intended to be for the use of the individual or entity named on this transmission. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. If you have received this transmission in error, please notify us by telephone immediately so that we can arrange for the retrieval of the original documents at no cost to you. Alternatively, notify the sender by replying to this transmission and delete the message without disclosing it. Thank you
Norik Dzhandzhapanyan May 27, 2017, 7:31 p.m. UTC | #9
Is there an enhanced or conflicting patch pending?


On 05/27/2017 10:56 AM, Michael Ney wrote:
> The submitted code also doesn't appear to handle RSSI per-peer which would be needed for any use when configured as an access point.
>
>> On May 27, 2017, at 12:39 PM, Adrian Chadd <adrian@freebsd.org> wrote:
>>
>> On 27 May 2017 at 09:07, Ben Greear <greearb@candelatech.com> wrote:
>>> At low encoding rates, especially if it switches to a single-chain encoding,
>>> maybe the on-air signal really is stronger?
>>>
>>> Have you verified in some other manner than the signals reported by ath10k
>>> are
>>> wrong?
>> Hiya,
>>
>> So yeah, multipath, higher TX rates == weaker TX signal, TPC, etc are
>> all interesting to know about at the receiver. it's hard to separate
>> that out from the noise sometimes, but in some controlled deployments
>> its really obvious.
>>
>>
>>
>> -adrian
>>
>> _______________________________________________
>> ath10k mailing list
>> ath10k@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/ath10k

The contents of this transmission are Ethertronics Inc. Confidential and may contain proprietary or legally privileged information which may not be disclosed, copied or distributed without the express written consent of Ethertronics Inc. The information is intended to be for the use of the individual or entity named on this transmission. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. If you have received this transmission in error, please notify us by telephone immediately so that we can arrange for the retrieval of the original documents at no cost to you. Alternatively, notify the sender by replying to this transmission and delete the message without disclosing it. Thank you
Ben Greear May 27, 2017, 9:38 p.m. UTC | #10
On 05/27/2017 12:25 PM, Norik Dzhandzhapanyan wrote:
> We see this inconsistent/incorrect reporting in our RF chamber.

How different are the values, and did you sniff with a third-party device
to see if it sees the same spikes in RSSI?

Thanks,
Ben

>
> Norik
>
> On 05/27/2017 09:39 AM, Adrian Chadd wrote:
>> On 27 May 2017 at 09:07, Ben Greear <greearb@candelatech.com> wrote:
>>> At low encoding rates, especially if it switches to a single-chain encoding,
>>> maybe the on-air signal really is stronger?
>>>
>>> Have you verified in some other manner than the signals reported by ath10k
>>> are
>>> wrong?
>> Hiya,
>>
>> So yeah, multipath, higher TX rates == weaker TX signal, TPC, etc are
>> all interesting to know about at the receiver. it's hard to separate
>> that out from the noise sometimes, but in some controlled deployments
>> its really obvious.
>>
>>
>>
>> -adrian
>>
>>
>
>
> The contents of this transmission are Ethertronics Inc. Confidential and may contain proprietary or legally privileged information which may not be disclosed, copied or distributed without the express written consent of Ethertronics Inc. The information is intended to be for the use of the individual or entity named on this transmission. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. If you have received this transmission in error, please notify us by telephone immediately so that we can arrange for the retrieval of the original documents at no cost to you. Alternatively, notify the sender by replying to this transmission and delete the message without disclosing it. Thank you
>
Ben Greear May 27, 2017, 9:49 p.m. UTC | #11
On 05/27/2017 02:41 PM, Norik Dzhandzhapanyan wrote:
> Yes ~6dB

If a packet is sent on 1 chain with ath10k firmware (9880 hardware, specifically, but probably
others as well), it will be around 6db higher on that particular chain
than if the rate-control sends it on all three chains.

Are you measuring on a single chain, or on all of the chains at once and adding
the power?

I think we would need more detailed reporting using a good third-party device before
smoothing and RSSI.

Thanks,
Ben

>
>
> From: Ben Greear
> Sent: Saturday, May 27, 2:38 PM
> Subject: Re: [PATCH] Per chain RSSI reporting
> To: Norik Dzhandzhapanyan, Adrian Chadd
> Cc: ath10k@lists.infradead.org, linux-wireless@vger.kernel.org
>
>
> On 05/27/2017 12:25 PM, Norik Dzhandzhapanyan wrote: > We see this inconsistent/incorrect reporting in our RF chamber. How different are the values, and did you sniff with a third-party device to see if it sees the same spikes in RSSI? Thanks, Ben > > Norik > > On 05/27/2017 09:39 AM, Adrian Chadd wrote: >> On 27 May 2017 at 09:07, Ben Greear wrote: >>> At low encoding rates, especially if it switches to a single-chain encoding, >>> maybe the on-air signal really is stronger? >>> >>> Have you verified in some other manner than the signals reported by ath10k >>> are >>> wrong? >> Hiya, >> >> So yeah, multipath, higher TX rates == weaker TX signal, TPC, etc are >> all interesting to know about at the receiver. it's hard to separate >> that out from the noise sometimes, but in some controlled deployments >> its really obvious. >> >> >> >> -adrian >> >> > > > The contents of this transmission are Ethertronics Inc. Confidential and may contain proprietary or legally privileged
> information which may not be disclosed, copied or distributed without the express written consent of Ethertronics Inc. The information is intended to be for the use of the individual or entity named on this transmission. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. If you have received this transmission in error, please notify us by telephone immediately so that we can arrange for the retrieval of the original documents at no cost to you. Alternatively, notify the sender by replying to this transmission and delete the message without disclosing it. Thank you > -- Ben Greear Candela Technologies Inc http://www.candelatech.com
>
Michael Ney May 27, 2017, 10:10 p.m. UTC | #12
What I'm referring to is the real world case of an access point communicating with multiple stations.

Take for example. an AP that has four stations attached to it with different average RSSIs:

 - Station 1: -45
 - Station 2: -70
 - Station 3: -50
 - Station 4: -30

Now for argument's sake let us assume that all four stations are transmitting at equal amounts and for every 16 frames transmitted each station sends 4 frames. 

Since the moving average you are proposing averages all frames received by the driver, that works out to a moving average that will always be around -48.75 for this example.  For station 2, this will result in a 21.25 error from its actual average RSSI.

This example also doesn't take into account other frames that aren't from stations that are processed through to the driver, such as Beacon frames, which even will affect managed mode and not just Access Points. The only way an average RSSI could be calculated accurately is that for every unique MAC address identified a structure has to be created to store the moving average RSSI data for that peer. This becomes extremely bulky memory-wise. Alternatively, it could be implemented such that it only applies to managed mode and only when the peer identified is the currently connected BSSID.


> On May 27, 2017, at 3:30 PM, Norik Dzhandzhapanyan <norikd@ethertronics.com> wrote:
> 
> Is there an enhanced or conflicting patch pending?
> 
> 
> On 05/27/2017 10:56 AM, Michael Ney wrote:
>> The submitted code also doesn't appear to handle RSSI per-peer which would be needed for any use when configured as an access point.
>> 
>>> On May 27, 2017, at 12:39 PM, Adrian Chadd <adrian@freebsd.org> wrote:
>>> 
>>> On 27 May 2017 at 09:07, Ben Greear <greearb@candelatech.com> wrote:
>>>> At low encoding rates, especially if it switches to a single-chain encoding,
>>>> maybe the on-air signal really is stronger?
>>>> 
>>>> Have you verified in some other manner than the signals reported by ath10k
>>>> are
>>>> wrong?
>>> Hiya,
>>> 
>>> So yeah, multipath, higher TX rates == weaker TX signal, TPC, etc are
>>> all interesting to know about at the receiver. it's hard to separate
>>> that out from the noise sometimes, but in some controlled deployments
>>> its really obvious.
>>> 
>>> 
>>> 
>>> -adrian
>>> 
>>> _______________________________________________
>>> ath10k mailing list
>>> ath10k@lists.infradead.org
>>> http://lists.infradead.org/mailman/listinfo/ath10k
> 
> The contents of this transmission are Ethertronics Inc. Confidential and may contain proprietary or legally privileged information which may not be disclosed, copied or distributed without the express written consent of Ethertronics Inc. The information is intended to be for the use of the individual or entity named on this transmission. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. If you have received this transmission in error, please notify us by telephone immediately so that we can arrange for the retrieval of the original documents at no cost to you. Alternatively, notify the sender by replying to this transmission and delete the message without disclosing it. Thank you
> 
> _______________________________________________
> ath10k mailing list
> ath10k@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/ath10k
Norik Dzhandzhapanyan May 28, 2017, 1:22 a.m. UTC | #13
Thanks Michael for the explanation. It makes complete sense.

Does the same concern then also apply to the existing functionality of the driver's assignment of the combined rssi to the status->signal variable?

The submitted patch breaks nothing in the driver and adds the per chain feature which currently does not exist. I agree the averaging component  could be factored for a more generic application, but at the same time the change impact would be larger and this is what I wanted to avoid. The averaging function can be qualified by a module parameter which will make the patch impact benign to others that are looking for per chain rssi reporting functionality.

Norik


On 05/27/2017 03:10 PM, Michael Ney wrote:
> What I'm referring to is the real world case of an access point communicating with multiple stations.
>
> Take for example. an AP that has four stations attached to it with different average RSSIs:
>
>   - Station 1: -45
>   - Station 2: -70
>   - Station 3: -50
>   - Station 4: -30
>
> Now for argument's sake let us assume that all four stations are transmitting at equal amounts and for every 16 frames transmitted each station sends 4 frames.
>
> Since the moving average you are proposing averages all frames received by the driver, that works out to a moving average that will always be around -48.75 for this example.  For station 2, this will result in a 21.25 error from its actual average RSSI.
>
> This example also doesn't take into account other frames that aren't from stations that are processed through to the driver, such as Beacon frames, which even will affect managed mode and not just Access Points. The only way an average RSSI could be calculated accurately is that for every unique MAC address identified a structure has to be created to store the moving average RSSI data for that peer. This becomes extremely bulky memory-wise. Alternatively, it could be implemented such that it only applies to managed mode and only when the peer identified is the currently connected BSSID.
>
>
>> On May 27, 2017, at 3:30 PM, Norik Dzhandzhapanyan <norikd@ethertronics.com> wrote:
>>
>> Is there an enhanced or conflicting patch pending?
>>
>>
>> On 05/27/2017 10:56 AM, Michael Ney wrote:
>>> The submitted code also doesn't appear to handle RSSI per-peer which would be needed for any use when configured as an access point.
>>>
>>>> On May 27, 2017, at 12:39 PM, Adrian Chadd <adrian@freebsd.org> wrote:
>>>>
>>>> On 27 May 2017 at 09:07, Ben Greear <greearb@candelatech.com> wrote:
>>>>> At low encoding rates, especially if it switches to a single-chain encoding,
>>>>> maybe the on-air signal really is stronger?
>>>>>
>>>>> Have you verified in some other manner than the signals reported by ath10k
>>>>> are
>>>>> wrong?
>>>> Hiya,
>>>>
>>>> So yeah, multipath, higher TX rates == weaker TX signal, TPC, etc are
>>>> all interesting to know about at the receiver. it's hard to separate
>>>> that out from the noise sometimes, but in some controlled deployments
>>>> its really obvious.
>>>>
>>>>
>>>>
>>>> -adrian
>>>>
>>>> _______________________________________________
>>>> ath10k mailing list
>>>> ath10k@lists.infradead.org
>>>> http://lists.infradead.org/mailman/listinfo/ath10k
>> The contents of this transmission are Ethertronics Inc. Confidential and may contain proprietary or legally privileged information which may not be disclosed, copied or distributed without the express written consent of Ethertronics Inc. The information is intended to be for the use of the individual or entity named on this transmission. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. If you have received this transmission in error, please notify us by telephone immediately so that we can arrange for the retrieval of the original documents at no cost to you. Alternatively, notify the sender by replying to this transmission and delete the message without disclosing it. Thank you
>>
>> _______________________________________________
>> ath10k mailing list
>> ath10k@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/ath10k
Matthias May May 30, 2017, 1:23 p.m. UTC | #14
On 27/05/17 23:49, Ben Greear wrote:
> On 05/27/2017 02:41 PM, Norik Dzhandzhapanyan wrote:
>> Yes ~6dB
> 
> If a packet is sent on 1 chain with ath10k firmware (9880 hardware, specifically, but probably
> others as well), it will be around 6db higher on that particular chain
> than if the rate-control sends it on all three chains.
> 
> Are you measuring on a single chain, or on all of the chains at once and adding
> the power?
> 
> I think we would need more detailed reporting using a good third-party device before
> smoothing and RSSI.
> 
> Thanks,
> Ben
> 
>>

Also noteworthy is that if you measure in a cabled environment and add the signal from multiple chains with a combiner
you will probably measure the power wrong.
The reason for this is that the cyclic shift diversity doesn't work well in a 2 dimensional environment (cable) compared
to the 3 dimensional environment (air).

BR
Matthias

>>
>> From: Ben Greear
>> Sent: Saturday, May 27, 2:38 PM
>> Subject: Re: [PATCH] Per chain RSSI reporting
>> To: Norik Dzhandzhapanyan, Adrian Chadd
>> Cc: ath10k@lists.infradead.org, linux-wireless@vger.kernel.org
>>
>>
>> On 05/27/2017 12:25 PM, Norik Dzhandzhapanyan wrote: > We see this inconsistent/incorrect reporting in our RF chamber.
>> How different are the values, and did you sniff with a third-party device to see if it sees the same spikes in RSSI?
>> Thanks, Ben > > Norik > > On 05/27/2017 09:39 AM, Adrian Chadd wrote: >> On 27 May 2017 at 09:07, Ben Greear wrote:
>> >>> At low encoding rates, especially if it switches to a single-chain encoding, >>> maybe the on-air signal really is
>> stronger? >>> >>> Have you verified in some other manner than the signals reported by ath10k >>> are >>> wrong? >>
>> Hiya, >> >> So yeah, multipath, higher TX rates == weaker TX signal, TPC, etc are >> all interesting to know about at
>> the receiver. it's hard to separate >> that out from the noise sometimes, but in some controlled deployments >> its
>> really obvious. >> >> >> >> -adrian >> >> > > > The contents of this transmission are Ethertronics Inc. Confidential
>> and may contain proprietary or legally privileged
>> information which may not be disclosed, copied or distributed without the express written consent of Ethertronics Inc.
>> The information is intended to be for the use of the individual or entity named on this transmission. If you are not
>> the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this information
>> is prohibited. If you have received this transmission in error, please notify us by telephone immediately so that we
>> can arrange for the retrieval of the original documents at no cost to you. Alternatively, notify the sender by
>> replying to this transmission and delete the message without disclosing it. Thank you > -- Ben Greear Candela
>> Technologies Inc http://www.candelatech.com
>>
>
Kalle Valo May 31, 2017, 12:52 p.m. UTC | #15
Norik Dzhandzhapanyan <norikd@ethertronics.com> writes:

> Add support for per chain RSSI reporting w/smoothing.
>
> Signed-off-by: Norik Dzhandzhapanyan norikd@ethertronics.com
>
>
> --- htt_rx.c.orig  2017-05-26 15:26:37.918504255 -0700
> +++ htt_rx.c        2017-05-26 12:10:33.139809025 -0700
> @@ -825,14 +825,71 @@ static bool ath10k_htt_rx_h_channel(stru
>               return true;
> }

The patch formatting is broken and I can't apply this. Please use git
send-email, more info here:

https://wireless.wiki.kernel.org/en/users/drivers/ath10k/submittingpatches

But more importantly:

> The contents of this transmission are Ethertronics Inc. Confidential
> and may contain proprietary or legally privileged information which
> may not be disclosed, copied or distributed without the express
> written consent of Ethertronics Inc. The information is intended to be
> for the use of the individual or entity named on this transmission. If
> you are not the intended recipient, be aware that any disclosure,
> copying, distribution or use of the contents of this information is
> prohibited. If you have received this transmission in error, please
> notify us by telephone immediately so that we can arrange for the
> retrieval of the original documents at no cost to you. Alternatively,
> notify the sender by replying to this transmission and delete the
> message without disclosing it. Thank you

I will never apply a patch which has this kind of disclaimer. The
patches must follow the Developer's Certificate of Origin[1] and not
have any other disclaimer.

[1] https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin
Kalle Valo May 31, 2017, 12:53 p.m. UTC | #16
Adrian Chadd <adrian@freebsd.org> writes:

> I have something local that I've been meaning to push up to do this,
> but with no smoothing. Ideally (!) smoothing is done optionally in
> mac80211.
>
> What do you think about just committing the per-chain RSSI stuff to
> mac80211 so it shows up right now, and then we figure out how to
> express the smoothing in mac80211 or further up the layers?

I think this is a good approach.
Kalle Valo May 31, 2017, 1:05 p.m. UTC | #17
Norik Dzhandzhapanyan <norikd@ethertronics.com> writes:

> Inserting the smoothing function here is motivated by what we see as
> 'spikes' in rssi data under weak rssi conditions. Figured its best to
> get rid of the 'bogus' data as close to the source as possible. Also
> to minimize the impact on the changes.
>
> I believe the averaging that happens at higher levels is based on EWMA
> macros in net/mac80211/sta_info.c which not wifi card/chipset
> specific. Didn't want to touch that since other cards seem to not have
> this spikey behavior. And, it doesnt seem to have an effect on the
> ath10k data anyway (iw reports the exact same values for both).
>
> I wonder if it would be acceptable to pass a module load time
> parameter which would indicate an average factor with 0 (as default)
> to indicate no averaging?

I don't know what Johannes thinks, but in my opinion this kind of
smoothing should be in mac80211 and not in drivers. The driver should be
as simple as possible.
diff mbox

Patch

--- htt_rx.c.orig  2017-05-26 15:26:37.918504255 -0700
+++ htt_rx.c        2017-05-26 12:10:33.139809025 -0700
@@ -825,14 +825,71 @@  static bool ath10k_htt_rx_h_channel(stru
              return true;
}

+/*
+ * Signal data is somewhat glitchy. We smooth it out here with
+ * a 16 point moving average by storing samples in a buffer.
+ * As new samples come in, remove the oldest and add the newest
+ * to the running sum.  Avoids changes/impact to other generic averaging.
+ */
+
+/* Moving average buffer */
+#define MA_SAMPLES (16)
+
+struct ma_buffer
+{
+             int count;
+             int head;
+             int tail;
+             int sum;
+             int samps[MA_SAMPLES];
+};
+
+struct ma_buffer ma_buffers[IEEE80211_MAX_CHAINS] = {{ 0 }};
+
+static int ath_cb_moving_average(struct ma_buffer *mb, int8_t samp)
+{
+             if (mb->count < MA_SAMPLES) {
+                            mb->count++;
+                            mb->sum += samp;
+                            mb->tail = 0;
+             } else {
+                            int oldest = mb->samps[mb->tail];
+                            mb->tail = (mb->head == MA_SAMPLES - 1) ? 0 : mb->head + 1;
+                            mb->sum = mb->sum - oldest + samp;
+             }
+
+             mb->samps[mb->head] = samp;
+             mb->head = (mb->head == MA_SAMPLES - 1) ? 0 : mb->head + 1;
+
+             return (mb->sum / mb->count);
+}
+
static void ath10k_htt_rx_h_signal(struct ath10k *ar,
                                                              struct ieee80211_rx_status *status,
                                                              struct htt_rx_desc *rxd)
{
-              /* FIXME: Get real NF */
-              status->signal = ATH10K_DEFAULT_NOISE_FLOOR +
-                                            rxd->ppdu_start.rssi_comb;
-              status->flag &= ~RX_FLAG_NO_SIGNAL_VAL;
+    int i;
+
+    for(i=0;i<IEEE80211_MAX_CHAINS;i++)
+    {
+        status->chains &= ~BIT(i);
+
+        if (rxd->ppdu_start.rssi_chains[i].pri20_mhz != 0x80)
+        {
+            int8_t rssi = ATH10K_DEFAULT_NOISE_FLOOR +
+                rxd->ppdu_start.rssi_chains[i].pri20_mhz;
+
+            status->chains |= BIT(i);
+
+            /* Compute the moving average of rssi */
+                                status->chain_signal[i] = ath_cb_moving_average(&ma_buffers[i], rssi);
+        }
+    }
+
+    /* FIXME: Get real NF */
+    status->signal = ATH10K_DEFAULT_NOISE_FLOOR +
+        rxd->ppdu_start.rssi_comb;
+    status->flag &= ~RX_FLAG_NO_SIGNAL_VAL;
}

 static void ath10k_htt_rx_h_mactime(struct ath10k *ar,