Re: QCA9880 driver crash with FW 10.2.4-1.0-00029

2018-03-23 Thread Rosen Penev
On Thu, Mar 22, 2018 at 1:30 PM, Hauke Mehrtens  wrote:
> Hi,
>
> I am using a BT home Hub 5A (Lantiq VR9 MIPS BE SoC). The wifi provided
> by the QCA9880 chip is unstable with OpenWrt master from 26. Feb 2018.
>
> With FW 10.2.4-1.0-00033 and 10.2.4-1.0-00037 the wifi stops working
> after about 1 to 3 days and I do not get any error message. With FW
> 10.2.4-1.0-00029 I got this error message. FW 10.2.4.70.54 crashes
> immediately.
>
> The 2.4 GHz wifi provided by ath9k is very stable.
>
> The wireless drivers shipped in OpenWrt master, which I am suing, are
> based on backports with a snapshot of wireless testing from 1. November
> 2017, and I am running kernel 4.9.85.
It also seems that enabling PMF (802.11w) causes issues as well. This
is not related to PSK-SHA256 as I have that disabled (OpenWrt
unconditionally enables PSK-SHA256 upon enabling PMF).
>
> .
> [   11.198963] Loading modules backported from Linux version
> wt-2017-11-01-0-gfe248fc2c180
> [   11.205607] Backport generated by backports.git v4.14-rc2-1-31-g86cf0e5d
> 
> [   11.684780] PCI: Enabling device :01:00.0 ( -> 0002)
> [   11.689195] PCI: Enabling device :02:00.0 ( -> 0002)
> [   11.695034] ath10k_pci :02:00.0: pci irq legacy oper_irq_mode 1
> irq_mode 0 reset_mode 0
> [   11.951059] ath10k_pci :02:00.0: Direct firmware load for
> ath10k/pre-cal-pci-:02:00.0.bin failed with error -2
> [   11.960430] ath10k_pci :02:00.0: Falling back to user helper
> [   12.364711] firmware ath10k!pre-cal-pci-:02:00.0.bin:
> firmware_loading_store: map pages failed
> [   12.375000] ath10k_pci :02:00.0: Direct firmware load for
> ath10k/QCA988X/hw2.0/firmware-6.bin failed with error -2
> [   12.384405] ath10k_pci :02:00.0: Falling back to user helper
> [   12.635750] firmware ath10k!QCA988X!hw2.0!firmware-6.bin:
> firmware_loading_store: map pages failed
> [   12.714150] ath10k_pci :02:00.0: qca988x hw2.0 target 0x4100016c
> chip_id 0x043202ff sub :
> [   12.722030] ath10k_pci :02:00.0: kconfig debug 0 debugfs 1
> tracing 0 dfs 1 testmode 1
> [   12.741364] ath10k_pci :02:00.0: firmware ver 10.2.4-1.0-00029
> api 5 features no-p2p,raw-mode,mfp,allows-mesh-bcast crc32 88595bb8
> [   12.785020] ath10k_pci :02:00.0: Direct firmware load for
> ath10k/QCA988X/hw2.0/board-2.bin failed with error -2
> [   12.794137] ath10k_pci :02:00.0: Falling back to user helper
> [   12.959872] firmware ath10k!QCA988X!hw2.0!board-2.bin:
> firmware_loading_store: map pages failed
> [   13.005579] ath10k_pci :02:00.0: board_file api 1 bmi_id N/A
> crc32 bebc7c08
> [   14.046516] ath10k_pci :02:00.0: htt-ver 2.1 wmi-op 5 htt-op 2
> cal file max-sta 128 raw 0 hwcrypto 1
> [   14.157074] ath: EEPROM regdomain: 0x833a
> [   14.157085] ath: EEPROM indicates we should expect a country code
> [   14.157100] ath: doing EEPROM country->regdmn map search
> [   14.157108] ath: country maps to regdmn code: 0x37
> [   14.157115] ath: Country alpha2 being used: GB
> [   14.157120] ath: Regpair used: 0x37
> [   14.221263] PCI: Enabling device :00:0e.0 ( -> 0002)
> [   14.231888] ath: phy1: Ignoring endianness difference in EEPROM magic
> bytes.
> [   14.239421] ath: EEPROM regdomain: 0x833a
> [   14.239434] ath: EEPROM indicates we should expect a country code
> [   14.239455] ath: doing EEPROM country->regdmn map search
> [   14.239468] ath: country maps to regdmn code: 0x37
> [   14.239478] ath: Country alpha2 being used: GB
> [   14.239487] ath: Regpair used: 0x37
> [   14.259234] ieee80211 phy1: Selected rate control algorithm 'minstrel_ht'
> [   14.265204] ieee80211 phy1: Atheros AR9287 Rev:2 mem=0xb800, irq=30
> [   14.273585] kmodloader: done loading kernel modules from /etc/modules.d/*
> [   21.011304] random: crng init done
> [   24.650023] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
> [   24.662381] device eth0 entered promiscuous mode
> [   24.669727] br-lan: port 1(eth0.1) entered blocking state
> [   24.673834] br-lan: port 1(eth0.1) entered disabled state
> [   24.680262] device eth0.1 entered promiscuous mode
> [   24.689370] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
> [   27.109825] ath: EEPROM regdomain: 0x8114
> [   27.112539] ath: EEPROM indicates we should expect a country code
> [   27.118694] ath: doing EEPROM country->regdmn map search
> [   27.123893] ath: country maps to regdmn code: 0x37
> [   27.128691] ath: Country alpha2 being used: DE
> [   27.133122] ath: Regpair used: 0x37
> [   27.136621] ath: regdomain 0x8114 dynamically updated by user
> [   27.142570] ath: EEPROM regdomain: 0x8114
> [   27.146372] ath: EEPROM indicates we should expect a country code
> [   27.152457] ath: doing EEPROM country->regdmn map search
> [   27.157747] ath: country maps to regdmn code: 0x37
> [   27.162550] ath: Country alpha2 being used: DE
> [   27.167023] ath: Regpair used: 0x37
> [   27.170494] ath: regdomain 0x8114 dynamically updated by 

Re: [ath10k throughput] low throughput in multi-user mode

2018-03-23 Thread Ben Greear

On 03/22/2018 08:21 PM, gary wrote:


Hi Ben,

Thank you for your reply.
My wireless driver is compat-wireless_2017-10-6, and kernel is 4.9.58.

The test result with your firmware:
Get throughput 1.13Gbps with 16 users.
And get almost 0 with 32 users.


Can you try an older kernel w/out backports, maybe my 4.13 or 4.9, or
some stock kernel that is a bit older?

https://github.com/greearb/linux-ct-4.9

Thanks,
Ben



By my observation, in one try, ath10k_htt_rx_tx_mode_switch_ind is invoked
only twice.
As a result, the ath10k driver can't get the latest num_push_allowed(always
zero).

Do you have any idea of it?

-Original Message-
From: ath10k [mailto:ath10k-boun...@lists.infradead.org] On Behalf Of Ben
Greear
Sent: 2018年3月22日 0:31
To: gary; linux-wirel...@vger.kernel.org; ath10k@lists.infradead.org
Subject: Re: [ath10k throughput] low throughput in multi-user mode


On 03/20/2018 06:44 PM, gary wrote:


Hi all,
I have run the throughput test on veriwave.(from Ethernet to wireless)
My AP suports 4*4, 11ac, mu-mimo.,wireless chip is QCA9984.
At first, the throughput is about 80Mbps only with 16 users, so I
force to return true in function ath10k_mac_tx_can_push().
As a result, when the user number is 1~16, the udp throughput is about
1.2Gbps ~1.4Gbps.
But when the user number is 32, the udp throughput is only 520Mbps.

So I try to substitute ath10k-firmware.
With firmware 10.4-3.4-0082 and above, the throughput is around 520Mbps.
But with firmware 10.4-3.4-0072, the throughput gets 1.1Gbps.

Do I miss something in configuration?
Any comment is appreciated.


What kernel version (or backports, if you are using that?) are you using?

And, I'd be curious how the latest ath10k-CT (beta) firmware compares if you
have time to try that:

http://www.candelatech.com/ath10k-10.4.php

At least in upload testing, we get better throughput with lots of virtual
stations if we tune the number of tx descriptors to be larger as that will
generate larger AMPDUs on air.

You might also check your rate-ctrl logic to make sure all of your stations
are using higher MCS rates.

Thanks,
Ben

--
Ben Greear 
Candela Technologies Inc  http://www.candelatech.com


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k




___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k




--
Ben Greear 
Candela Technologies Inc  http://www.candelatech.com


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH] ath10k: Implement get_expected_throughput callback

2018-03-23 Thread akolli


On 2018-03-23 19:14, Johannes Berg wrote:

On Fri, 2018-03-23 at 19:11 +0530, ako...@codeaurora.org wrote:


> > +
> > +   sinfo->expected_throughput =
> > +
> > ewma_sta_txrate_read(>ave_sta_txrate);
> > +   sinfo->filled |=
> > BIT(NL80211_STA_INFO_EXPECTED_THROUGHPUT);
> > +}



Yes. This looks redundant, I will remove this line,
  sinfo->filled |= BIT(NL80211_STA_INFO_EXPECTED_THROUGHPUT);


You don't need any of the changes here in ath10k_sta_statistics().


Hi Jaohannes,

Yes. I removed this in ath10k driver and sent a v2 patch.

Thanks,
Anil.

___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v2] ath10k: Implement get_expected_throughput callback

2018-03-23 Thread Anilkumar Kolli
Enable support for 'drv_get_expected_throughput' callback.
Export expected throughput if available to cfg80211/nl80211.

Signed-off-by: Anilkumar Kolli 
Signed-off-by: Tamizh chelvam 
---
v2:
  - update the avg for all the transmitted frames(Sven)
  - remove the unnecessary NL80211_STA_INFO_EXPECTED_THROUGHPUT update(Sven)

 drivers/net/wireless/ath/ath10k/core.h   |5 +
 drivers/net/wireless/ath/ath10k/htt_rx.c |4 
 drivers/net/wireless/ath/ath10k/mac.c|9 +
 3 files changed, 18 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index fe6b30356d3b..8e10f7d83a79 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2005-2011 Atheros Communications Inc.
  * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -37,6 +38,7 @@
 #include "thermal.h"
 #include "wow.h"
 #include "swap.h"
+#include 
 
 #define MS(_v, _f) (((_v) & _f##_MASK) >> _f##_LSB)
 #define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK)
@@ -354,6 +356,8 @@ struct ath10k_txq {
unsigned long num_push_allowed;
 };
 
+DECLARE_EWMA(sta_txrate, 4, 16)
+
 struct ath10k_sta {
struct ath10k_vif *arvif;
 
@@ -367,6 +371,7 @@ struct ath10k_sta {
 
struct work_struct update_wk;
u64 rx_duration;
+   struct ewma_sta_txrate ave_sta_txrate;
 
 #ifdef CONFIG_MAC80211_DEBUGFS
/* protected by conf_mutex */
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 6d96f9560950..9fd8b22552c6 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -2449,6 +2449,7 @@ static inline bool is_valid_legacy_rate(u8 rate)
struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv;
u8 rate = 0, sgi;
struct rate_info txrate;
+   u32 tx_bitrate;
 
lockdep_assert_held(>data_lock);
 
@@ -2500,6 +2501,9 @@ static inline bool is_valid_legacy_rate(u8 rate)
 
arsta->txrate.nss = txrate.nss;
arsta->txrate.bw = txrate.bw + RATE_INFO_BW_20;
+
+   tx_bitrate = cfg80211_calculate_bitrate(>txrate);
+   ewma_sta_txrate_add(>ave_sta_txrate, tx_bitrate);
 }
 
 static void ath10k_htt_fetch_peer_stats(struct ath10k *ar,
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 7e02ca02b28e..33e790cf5c42 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -7688,6 +7688,14 @@ static void ath10k_sta_statistics(struct ieee80211_hw 
*hw,
sinfo->filled |= 1ULL << NL80211_STA_INFO_TX_BITRATE;
 }
 
+static u32 ath10k_get_expected_throughput(struct ieee80211_hw *hw,
+ struct ieee80211_sta *sta)
+{
+   struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv;
+
+   return ewma_sta_txrate_read(>ave_sta_txrate);
+}
+
 static const struct ieee80211_ops ath10k_ops = {
.tx = ath10k_mac_op_tx,
.wake_tx_queue  = ath10k_mac_op_wake_tx_queue,
@@ -7730,6 +7738,7 @@ static void ath10k_sta_statistics(struct ieee80211_hw *hw,
.switch_vif_chanctx = ath10k_mac_op_switch_vif_chanctx,
.sta_pre_rcu_remove = ath10k_mac_op_sta_pre_rcu_remove,
.sta_statistics = ath10k_sta_statistics,
+   .get_expected_throughput= ath10k_get_expected_throughput,
 
CFG80211_TESTMODE_CMD(ath10k_tm_cmd)
 
-- 
1.7.9.5


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH] ath10k: Implement get_expected_throughput callback

2018-03-23 Thread Johannes Berg
On Fri, 2018-03-23 at 19:11 +0530, ako...@codeaurora.org wrote:
> 
> > > +
> > > +   sinfo->expected_throughput =
> > > +   
> > > ewma_sta_txrate_read(>ave_sta_txrate);
> > > +   sinfo->filled |=
> > > BIT(NL80211_STA_INFO_EXPECTED_THROUGHPUT);
> > > +}

> Yes. This looks redundant, I will remove this line,
>   sinfo->filled |= BIT(NL80211_STA_INFO_EXPECTED_THROUGHPUT);

You don't need any of the changes here in ath10k_sta_statistics().

johannes

___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH] ath10k: Implement get_expected_throughput callback

2018-03-23 Thread akolli

Hi Sven,

Thanks for the review.

On 2018-03-23 13:39, Sven Eckelmann wrote:

On Freitag, 23. März 2018 13:07:00 CET Anilkumar Kolli wrote:
[...]

+static u32 ath10k_get_expected_throughput(struct ieee80211_hw *hw,
+ struct ieee80211_sta *sta)
+{
+   struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv;
+   u32 tx_bitrate;
+
+   tx_bitrate = cfg80211_calculate_bitrate(>txrate);
+   ewma_sta_txrate_add(>ave_sta_txrate, tx_bitrate);
+
+   return ewma_sta_txrate_read(>ave_sta_txrate);
 }


Antonio and Felix, please correct me when this statement is incorrect.

The expected_throughput as initially implemented for minstrel(_ht) is 
not
about the raw physical bitrate but about the throughput which is 
expected for

things running on top of the wifi link. See
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cca674d47e59665630f3005291b61bb883015fc5
for more details

when I interpret your change correctly then your it doesn't get the
information about packet loss or aggregation and doesn't do anything 
convert
from raw physical rate to something the user could get see. It will 
just
overestimate the throughput for ath10k links and thus give wrong 
information
to routing algorithms. This could for example cause them to prefer 
links over

ath10k based hw when mt76 would actually provide a significant better
throughput.

Beside that - why is the ave_sta_txrate only filled when with new 
information

when someone requests the current expected_throughput via
get_expected_throughput. I would have expected that it is filled 
everytime you

get new information about the current rate from the firmware
(ath10k_sta_statistics).


Yes. ideally it should be doing the rate avg. of all the sent packets.

@@ -7686,6 +7686,22 @@ static void ath10k_sta_statistics(struct 
ieee80211_hw *hw,

}
sinfo->txrate.flags = arsta->txrate.flags;
sinfo->filled |= 1ULL << NL80211_STA_INFO_TX_BITRATE;
+
+   sinfo->expected_throughput =
+   
ewma_sta_txrate_read(>ave_sta_txrate);

+   sinfo->filled |= BIT(NL80211_STA_INFO_EXPECTED_THROUGHPUT);
+}


This brings me directly to the next point. Why are you changing these 
values
here? Isn't sta_set_sinfo is expected to do that? This is at least what 
we

expect how it works when we call cfg80211_get_station() in batman-adv.



Yes. This looks redundant, I will remove this line,
 sinfo->filled |= BIT(NL80211_STA_INFO_EXPECTED_THROUGHPUT);

I will make these changes and send v2.

Thanks,
Anil.

___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH 01/13] ath10k: platform driver for WCN3990 SNOC WLAN module

2018-03-23 Thread govinds

On 2018-03-10 14:41, Kalle Valo wrote:

 writes:


>> Kbuild bot found an odd problem with this patch:
>>
>>  include/linux/dynamic_debug.h:77:14: error: 'KBUILD_MODNAME'
>>  undeclared (first use in this function); did you mean
'KBUILD_BASENAME'?
>>
>> Full report:
>>
>>
http://lists.infradead.org/pipermail/ath10k/2018-February/010907.html
>>
>> Any ideas? Is this is some unrelated issue or what? This patch is not
>> even touching hif.h or ce.c.
>
> I didn't encountered this issue as in my defconfig only
> CONFIG_ATH10K_SNOC was defined. This problem is coming when we define
> CONFIG_ATH10K_SNOC and CONFIG_ATH10K_PCI simultaneously in defconfig
> and this is known issue when multiple modules share objects(in this
> case ce.o). I saw similar reported problem and found
> https://patchwork.kernel.org/patch/10060825/.
>
> After picking the below change issue is not seen.

Let's ask the kbuild maintainer. Masahiro, any chances of getting 
this

patch applied anytime soon:

kbuild: define KBUILD_MODNAME even if multiple modules share objects

https://patchwork.kernel.org/patch/10060825/

In ath10k we would need it as otherwise we are not able to link ce.o
both to ath10k_pci.ko and ath10k_snoc.ko. What do you think?

Full discussion and the ath10k patch here:

https://patchwork.kernel.org/patch/10220657/



I plan to submit v2, but even if the undefined KBUILD_MODNAME is 
fixed,

I expect another problem from this patch.

If both CONFIG_ATH10K_PCI and CONFIG_ATH10_SNOC are 'y'
two instances of ce.o would be linked into vmliux,
then causes multiple definition error.


Oh, I didn't realise this. Thanks for pointing it out. Govind is 
looking

at other ways to fix this.


https://patchwork.kernel.org/patch/10298659/ is raised to address this 
problem.


Thanks,
Govind

___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH] ath10k: Implement get_expected_throughput callback

2018-03-23 Thread Sven Eckelmann
On Freitag, 23. März 2018 13:07:00 CET Anilkumar Kolli wrote:
[...]
> +static u32 ath10k_get_expected_throughput(struct ieee80211_hw *hw,
> + struct ieee80211_sta *sta)
> +{
> +   struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv;
> +   u32 tx_bitrate;
> +
> +   tx_bitrate = cfg80211_calculate_bitrate(>txrate);
> +   ewma_sta_txrate_add(>ave_sta_txrate, tx_bitrate);
> +
> +   return ewma_sta_txrate_read(>ave_sta_txrate);
>  }

Antonio and Felix, please correct me when this statement is incorrect.

The expected_throughput as initially implemented for minstrel(_ht) is not 
about the raw physical bitrate but about the throughput which is expected for 
things running on top of the wifi link. See 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cca674d47e59665630f3005291b61bb883015fc5
 
for more details

when I interpret your change correctly then your it doesn't get the 
information about packet loss or aggregation and doesn't do anything convert
from raw physical rate to something the user could get see. It will just 
overestimate the throughput for ath10k links and thus give wrong information 
to routing algorithms. This could for example cause them to prefer links over 
ath10k based hw when mt76 would actually provide a significant better 
throughput.

Beside that - why is the ave_sta_txrate only filled when with new information 
when someone requests the current expected_throughput via 
get_expected_throughput. I would have expected that it is filled everytime you 
get new information about the current rate from the firmware 
(ath10k_sta_statistics).

> @@ -7686,6 +7686,22 @@ static void ath10k_sta_statistics(struct ieee80211_hw 
> *hw,
> }
> sinfo->txrate.flags = arsta->txrate.flags;
> sinfo->filled |= 1ULL << NL80211_STA_INFO_TX_BITRATE;
> +
> +   sinfo->expected_throughput =
> +   ewma_sta_txrate_read(>ave_sta_txrate);
> +   sinfo->filled |= BIT(NL80211_STA_INFO_EXPECTED_THROUGHPUT);
> +}

This brings me directly to the next point. Why are you changing these values 
here? Isn't sta_set_sinfo is expected to do that? This is at least what we
expect how it works when we call cfg80211_get_station() in batman-adv.

Kind regards,
Sven

signature.asc
Description: This is a digitally signed message part.
___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH] ath10k: Implement get_expected_throughput callback

2018-03-23 Thread Anilkumar Kolli
Enable support for 'drv_get_expected_throughput' callback.
Export expected throughput if available to cfg80211/nl80211.

Signed-off-by: Anilkumar Kolli 
Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/core.h |5 +
 drivers/net/wireless/ath/ath10k/mac.c  |   17 +
 2 files changed, 22 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index fe6b30356d3b..8e10f7d83a79 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2005-2011 Atheros Communications Inc.
  * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -37,6 +38,7 @@
 #include "thermal.h"
 #include "wow.h"
 #include "swap.h"
+#include 
 
 #define MS(_v, _f) (((_v) & _f##_MASK) >> _f##_LSB)
 #define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK)
@@ -354,6 +356,8 @@ struct ath10k_txq {
unsigned long num_push_allowed;
 };
 
+DECLARE_EWMA(sta_txrate, 4, 16)
+
 struct ath10k_sta {
struct ath10k_vif *arvif;
 
@@ -367,6 +371,7 @@ struct ath10k_sta {
 
struct work_struct update_wk;
u64 rx_duration;
+   struct ewma_sta_txrate ave_sta_txrate;
 
 #ifdef CONFIG_MAC80211_DEBUGFS
/* protected by conf_mutex */
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 7e02ca02b28e..e04fbe9ccfee 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -7686,6 +7686,22 @@ static void ath10k_sta_statistics(struct ieee80211_hw 
*hw,
}
sinfo->txrate.flags = arsta->txrate.flags;
sinfo->filled |= 1ULL << NL80211_STA_INFO_TX_BITRATE;
+
+   sinfo->expected_throughput =
+   ewma_sta_txrate_read(>ave_sta_txrate);
+   sinfo->filled |= BIT(NL80211_STA_INFO_EXPECTED_THROUGHPUT);
+}
+
+static u32 ath10k_get_expected_throughput(struct ieee80211_hw *hw,
+ struct ieee80211_sta *sta)
+{
+   struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv;
+   u32 tx_bitrate;
+
+   tx_bitrate = cfg80211_calculate_bitrate(>txrate);
+   ewma_sta_txrate_add(>ave_sta_txrate, tx_bitrate);
+
+   return ewma_sta_txrate_read(>ave_sta_txrate);
 }
 
 static const struct ieee80211_ops ath10k_ops = {
@@ -7730,6 +7746,7 @@ static void ath10k_sta_statistics(struct ieee80211_hw *hw,
.switch_vif_chanctx = ath10k_mac_op_switch_vif_chanctx,
.sta_pre_rcu_remove = ath10k_mac_op_sta_pre_rcu_remove,
.sta_statistics = ath10k_sta_statistics,
+   .get_expected_throughput= ath10k_get_expected_throughput,
 
CFG80211_TESTMODE_CMD(ath10k_tm_cmd)
 
-- 
1.7.9.5


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k