Can't parse chan info event return from firmware 10.2.4-1.0-00043

2019-02-21 Thread Steve Brown
I get "ath10k_pci :03:00.0: failed to parse chan info event: -71"
when scanning.

After some instrumentation, the return is 7 words and the event
structure size is 13 words. This causes the error.

As only the first 6 words are recovered, it's not clear if the problem
is the size of the event structure or the test.

The kernel was built from kvalo/ath.git
7ce94a62264be94dc1c41ff5d0c8a19c7f0d3143.

Samples below.

Steve


Feb 21 05:50:16 w7 kernel: [39829.224813] ath10k_pci :03:00.0: scan event 
foreign channel type 8 reason 3 freq 2412 req_id 40961 scan_id 40960 vdev_id 0 
state running (2)
Feb 21 05:50:16 w7 kernel: [39829.224816] ath10k_wmi_op_pull_ch_info_ev: 
skb->len:28 sizeof(ev):52
Feb 21 05:50:16 w7 kernel: [39829.224819] ath10k_pci :03:00.0: wmi chan 
info: : 00 00 00 00 6c 09 00 00 00 00 00 00 00 00 00 00  
l...
Feb 21 05:50:16 w7 kernel: [39829.224822] ath10k_pci :03:00.0: wmi chan 
info: 0010: 81 2c fa 01 8c 8d 7b 33 3c da 39 00  .,{3<.9.
Feb 21 05:50:16 w7 kernel: [39829.224823] ath10k_wmi_event_chan_info: ret:-71
Feb 21 05:50:16 w7 kernel: [39829.224825] ath10k_pci :03:00.0: failed to 
parse chan info event: -71
Feb 21 05:50:16 w7 kernel: [39829.267441] ath10k_pci :03:00.0: scan event 
bss channel type 4 reason 3 freq 2412 req_id 40961 scan_id 40960 vdev_id 0 
state running (2)
Feb 21 05:50:16 w7 kernel: [39829.267445] ath10k_wmi_op_pull_ch_info_ev: 
skb->len:28 sizeof(ev):52
Feb 21 05:50:16 w7 kernel: [39829.267448] ath10k_pci :03:00.0: wmi chan 
info: : 00 00 00 00 6c 09 00 00 01 00 00 00 af ff ff ff  
l...
Feb 21 05:50:16 w7 kernel: [39829.267451] ath10k_pci :03:00.0: wmi chan 
info: 0010: 14 ee fa 01 17 c7 b4 33 2a dd 39 00  ...3*.9.
Feb 21 05:50:16 w7 kernel: [39829.267452] ath10k_wmi_event_chan_info: ret:-71
Feb 21 05:50:16 w7 kernel: [39829.267454] ath10k_pci :03:00.0: failed to 
parse chan info event: -71



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


Re: [PATCH v2 2/2] ath10k: Set sk_pacing_shift to 6 for 11AC WiFi chips

2019-02-21 Thread Ben Greear

On 2/21/19 8:37 AM, Toke Høiland-Jørgensen wrote:

Ben Greear  writes:


On 2/21/19 8:10 AM, Kalle Valo wrote:

Toke Høiland-Jørgensen  writes:


Grant Grundler  writes:


On Thu, Sep 6, 2018 at 3:18 AM Toke Høiland-Jørgensen  wrote:


Grant Grundler  writes:


And, well, Grant's data is from a single test in a noisy
environment where the time series graph shows that throughput is all over
the place for the duration of the test; so it's hard to draw solid
conclusions from (for instance, for the 5-stream test, the average
throughput for 6 is 331 and 379 Mbps for the two repetitions, and for 7
it's 326 and 371 Mbps) . Unfortunately I don't have the same hardware
used in this test, so I can't go verify it myself; so the only thing I
can do is grumble about it here... :)


It's a fair complaint and I agree with it. My counter argument is the
opposite is true too: most ideal benchmarks don't measure what most
users see. While the data wgong provided are way more noisy than I
like, my overall "confidence" in the "conclusion" I offered is still
positive.


Right. I guess I would just prefer a slightly more comprehensive
evaluation to base a 4x increase in buffer size on...


Kalle, is this why you didn't accept this patch? Other reasons?

Toke, what else would you like to see evaluated?

I generally want to see three things measured when "benchmarking"
technologies: throughput, latency, cpu utilization
We've covered those three I think "reasonably".


Hmm, going back and looking at this (I'd completely forgotten about this
patch), I think I had two main concerns:

1. What happens in a degraded signal situation, where the throughput is
 limited by the signal conditions, or by contention with other devices.
 Both of these happen regularly, and I worry that latency will be
 badly affected under those conditions.

2. What happens with old hardware that has worse buffer management in
 the driver->firmware path (especially drivers without push/pull mode
 support)? For these, the lower-level queueing structure is less
 effective at controlling queueing latency.


Do note that this patch changes behaviour _only_ for QCA6174 and QCA9377
PCI devices, which IIRC do not even support push/pull mode. All the
rest, including QCA988X and QCA9984 are unaffected.


Just as a note, at least kernels such as 4.14.whatever perform poorly when
running ath10k on 9984 when acting as TCP endpoints.  This makes them not
really usable for stuff like serving video to lots of clients.

Tweaking TCP (I do it a bit differently, but either way) can significantly
improve performance.


Differently how? Did you have to do more than fiddle with the pacing_shift?


This one, or a slightly tweaked version that applies to different kernels:

https://github.com/greearb/linux-ct-4.16/commit/3e14e8491a5b31ce994fb2752347145e6ab7eaf5


Recently I helped a user that could get barely 70 stations streaming
at 1Mbps on stock kernel (using one wave1 on 2.4, one wave-2 on 5Ghz),
and we got 110 working with a tweaked TCP stack. These were /n
stations too.

I think it is lame that it _still_ requires out of tree patches to
make TCP work well on ath10k...even if you want to default to current
behaviour, you should allow users to tweak it to work with their use
case.


Well if TCP is broken to the point of being unusable I do think we
should fix it; but I think "just provide a configuration knob" should be
the last resort...


So, it has been broken for years, and waiting for a perfect solution has not
gotten the problem fixed.

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


Re: [PATCH v2 2/2] ath10k: Set sk_pacing_shift to 6 for 11AC WiFi chips

2019-02-21 Thread Toke Høiland-Jørgensen
Ben Greear  writes:

> On 2/21/19 8:37 AM, Toke Høiland-Jørgensen wrote:
>> Ben Greear  writes:
>> 
>>> On 2/21/19 8:10 AM, Kalle Valo wrote:
 Toke Høiland-Jørgensen  writes:

> Grant Grundler  writes:
>
>> On Thu, Sep 6, 2018 at 3:18 AM Toke Høiland-Jørgensen  
>> wrote:
>>>
>>> Grant Grundler  writes:
>>>
> And, well, Grant's data is from a single test in a noisy
> environment where the time series graph shows that throughput is all 
> over
> the place for the duration of the test; so it's hard to draw solid
> conclusions from (for instance, for the 5-stream test, the average
> throughput for 6 is 331 and 379 Mbps for the two repetitions, and for 
> 7
> it's 326 and 371 Mbps) . Unfortunately I don't have the same hardware
> used in this test, so I can't go verify it myself; so the only thing I
> can do is grumble about it here... :)

 It's a fair complaint and I agree with it. My counter argument is the
 opposite is true too: most ideal benchmarks don't measure what most
 users see. While the data wgong provided are way more noisy than I
 like, my overall "confidence" in the "conclusion" I offered is still
 positive.
>>>
>>> Right. I guess I would just prefer a slightly more comprehensive
>>> evaluation to base a 4x increase in buffer size on...
>>
>> Kalle, is this why you didn't accept this patch? Other reasons?
>>
>> Toke, what else would you like to see evaluated?
>>
>> I generally want to see three things measured when "benchmarking"
>> technologies: throughput, latency, cpu utilization
>> We've covered those three I think "reasonably".
>
> Hmm, going back and looking at this (I'd completely forgotten about this
> patch), I think I had two main concerns:
>
> 1. What happens in a degraded signal situation, where the throughput is
>  limited by the signal conditions, or by contention with other 
> devices.
>  Both of these happen regularly, and I worry that latency will be
>  badly affected under those conditions.
>
> 2. What happens with old hardware that has worse buffer management in
>  the driver->firmware path (especially drivers without push/pull mode
>  support)? For these, the lower-level queueing structure is less
>  effective at controlling queueing latency.

 Do note that this patch changes behaviour _only_ for QCA6174 and QCA9377
 PCI devices, which IIRC do not even support push/pull mode. All the
 rest, including QCA988X and QCA9984 are unaffected.
>>>
>>> Just as a note, at least kernels such as 4.14.whatever perform poorly when
>>> running ath10k on 9984 when acting as TCP endpoints.  This makes them not
>>> really usable for stuff like serving video to lots of clients.
>>>
>>> Tweaking TCP (I do it a bit differently, but either way) can significantly
>>> improve performance.
>> 
>> Differently how? Did you have to do more than fiddle with the pacing_shift?
>
> This one, or a slightly tweaked version that applies to different kernels:
>
> https://github.com/greearb/linux-ct-4.16/commit/3e14e8491a5b31ce994fb2752347145e6ab7eaf5

Right; but the current mac80211 default (pacing shift 8) corresponds to
setting your sysctl to 4...

>>> Recently I helped a user that could get barely 70 stations streaming
>>> at 1Mbps on stock kernel (using one wave1 on 2.4, one wave-2 on 5Ghz),
>>> and we got 110 working with a tweaked TCP stack. These were /n
>>> stations too.
>>>
>>> I think it is lame that it _still_ requires out of tree patches to
>>> make TCP work well on ath10k...even if you want to default to current
>>> behaviour, you should allow users to tweak it to work with their use
>>> case.
>> 
>> Well if TCP is broken to the point of being unusable I do think we
>> should fix it; but I think "just provide a configuration knob" should be
>> the last resort...
>
> So, it has been broken for years, and waiting for a perfect solution
> has not gotten the problem fixed.

Well, the current default should at least be closer to something that
works well.

I do think I may have erred on the wrong side of the optimum when I
submitted the original patch to set the default to 8; that should
probably have been 7 (i.e., 8 ms; the optimum in the evaluation we did
was around 6 ms, which is sadly not a power of two). Maybe changing that
default is actually better than having to redo the testing for all the
different devices as we're discussing in the context of this patch.
Maybe I should just send a patch to do that...

-Toke

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


[PATCH 4/4] ath10k: don't report unset rssi values to mac80211

2019-02-21 Thread Kalle Valo
From: Alagu Sankar 

The SDIO firmware does not provide RSSI value to the host, it's only set to
zero. In that case don't report the value to mac80211. One risk here is that
value zero might be a valid value with other firmware, currently there's no way
to detect that.

Without the fix, the rssi value indicated by iw changes between the actual
value and -95.

Tested with QCA6174 SDIO with firmware WLAN.RMH.4.4.1-5-QCARMSWP-1.

Co-developed-by: Wen Gong 
Signed-off-by: Alagu Sankar 
Signed-off-by: Wen Gong 
Signed-off-by: Kalle Valo 
---
 drivers/net/wireless/ath/ath10k/htt_rx.c | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 4fc885617de1..62479b037210 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -2119,9 +2119,15 @@ static bool ath10k_htt_rx_proc_rx_ind_hl(struct 
ath10k_htt *htt,
hdr = (struct ieee80211_hdr *)skb->data;
rx_status = IEEE80211_SKB_RXCB(skb);
rx_status->chains |= BIT(0);
-   rx_status->signal = ATH10K_DEFAULT_NOISE_FLOOR +
-   rx->ppdu.combined_rssi;
-   rx_status->flag &= ~RX_FLAG_NO_SIGNAL_VAL;
+   if (rx->ppdu.combined_rssi == 0) {
+   /* SDIO firmware does not provide signal */
+   rx_status->signal = 0;
+   rx_status->flag |= RX_FLAG_NO_SIGNAL_VAL;
+   } else {
+   rx_status->signal = ATH10K_DEFAULT_NOISE_FLOOR +
+   rx->ppdu.combined_rssi;
+   rx_status->flag &= ~RX_FLAG_NO_SIGNAL_VAL;
+   }
 
spin_lock_bh(>data_lock);
ch = ar->scan_channel;
-- 
2.7.4


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


[PATCH 3/4] ath10k: sdio: reset chip on power_down()

2019-02-21 Thread Kalle Valo
From: Wen Gong 

The target device needs to be reset during power_down(), otherwise only the
first power_up() will work. And as ath10k calls power_up() during driver
initialisation the driver would be otherwise unusable.

Tested with QCA6174 SDIO with firmware WLAN.RMH.4.4.1-5-QCARMSWP-1.

Signed-off-by: Wen Gong 
Signed-off-by: Kalle Valo 
---
 drivers/net/wireless/ath/ath10k/sdio.c | 24 
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/sdio.c 
b/drivers/net/wireless/ath/ath10k/sdio.c
index d62502f386f2..fae56c67766f 100644
--- a/drivers/net/wireless/ath/ath10k/sdio.c
+++ b/drivers/net/wireless/ath/ath10k/sdio.c
@@ -1382,6 +1382,12 @@ static int ath10k_sdio_hif_power_up(struct ath10k *ar,
 
ath10k_dbg(ar, ATH10K_DBG_BOOT, "sdio power on\n");
 
+   ret = ath10k_sdio_config(ar);
+   if (ret) {
+   ath10k_err(ar, "failed to config sdio: %d\n", ret);
+   return ret;
+   }
+
sdio_claim_host(func);
 
ret = sdio_enable_func(func);
@@ -1419,11 +1425,19 @@ static void ath10k_sdio_hif_power_down(struct ath10k 
*ar)
 
/* Disable the card */
sdio_claim_host(ar_sdio->func);
+
ret = sdio_disable_func(ar_sdio->func);
-   sdio_release_host(ar_sdio->func);
+   if (ret) {
+   ath10k_warn(ar, "unable to disable sdio function: %d\n", ret);
+   sdio_release_host(ar_sdio->func);
+   return;
+   }
 
+   ret = mmc_hw_reset(ar_sdio->func->card->host);
if (ret)
-   ath10k_warn(ar, "unable to disable sdio function: %d\n", ret);
+   ath10k_warn(ar, "unable to reset sdio: %d\n", ret);
+
+   sdio_release_host(ar_sdio->func);
 
ar_sdio->is_disabled = true;
 }
@@ -2028,12 +2042,6 @@ static int ath10k_sdio_probe(struct sdio_func *func,
 
ath10k_sdio_set_mbox_info(ar);
 
-   ret = ath10k_sdio_config(ar);
-   if (ret) {
-   ath10k_err(ar, "failed to config sdio: %d\n", ret);
-   goto err_free_wq;
-   }
-
bus_params.dev_type = ATH10K_DEV_TYPE_HL;
/* TODO: don't know yet how to get chip_id with SDIO */
bus_params.chip_id = 0;
-- 
2.7.4


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


[PATCH 2/4] ath10k: sdio: disable fwlog prints

2019-02-21 Thread Kalle Valo
From: Alagu Sankar 

The SDIO firmware may turn it on based on scratch registers so disable the
firmware log to avoid that.

Co-developed-by: Wen Gong 
Signed-off-by: Alagu Sankar 
Signed-off-by: Wen Gong 
Signed-off-by: Kalle Valo 
---
 drivers/net/wireless/ath/ath10k/core.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 0c62a61b5eac..7ccd6741c5b0 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -648,6 +648,13 @@ static void ath10k_init_sdio(struct ath10k *ar)
param &= ~HI_ACS_FLAGS_ALT_DATA_CREDIT_SIZE;
param |= HI_ACS_FLAGS_SDIO_SWAP_MAILBOX_SET;
ath10k_bmi_write32(ar, hi_acs_flags, param);
+
+   /* Explicitly set fwlog prints to zero as target may turn it on
+* based on scratch registers.
+*/
+   ath10k_bmi_read32(ar, hi_option_flag, );
+   param |= HI_OPTION_DISABLE_DBGLOG;
+   ath10k_bmi_write32(ar, hi_option_flag, param);
 }
 
 static int ath10k_init_configure_target(struct ath10k *ar)
-- 
2.7.4


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


[PATCH 1/4] ath10k: sdio: set hi_acs_flags

2019-02-21 Thread Kalle Valo
From: Alagu Sankar 

The SDIO firmware does not allow transmitting packets with the
reduced tx completion HI_ACS option. SDIO firmware uses 1544 as
alternate credit size, which is not big enough for the maximum sized
mac80211 frames. Disable both these HI_ACS flags for SDIO.

Co-developed-by: Wen Gong 
Signed-off-by: Alagu Sankar 
Signed-off-by: Wen Gong 
Signed-off-by: Kalle Valo 
---
 drivers/net/wireless/ath/ath10k/core.c | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index ac2cf3f1c7b4..0c62a61b5eac 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -637,10 +637,16 @@ static void ath10k_init_sdio(struct ath10k *ar)
ath10k_bmi_write32(ar, hi_mbox_isr_yield_limit, 99);
ath10k_bmi_read32(ar, hi_acs_flags, );
 
-   param |= (HI_ACS_FLAGS_SDIO_SWAP_MAILBOX_SET |
- HI_ACS_FLAGS_SDIO_REDUCE_TX_COMPL_SET |
- HI_ACS_FLAGS_ALT_DATA_CREDIT_SIZE);
+   /* Data transfer is not initiated, when reduced Tx completion
+* is used for SDIO. disable it until fixed
+*/
+   param &= ~HI_ACS_FLAGS_SDIO_REDUCE_TX_COMPL_SET;
 
+   /* Alternate credit size of 1544 as used by SDIO firmware is
+* not big enough for mac80211 / native wifi frames. disable it
+*/
+   param &= ~HI_ACS_FLAGS_ALT_DATA_CREDIT_SIZE;
+   param |= HI_ACS_FLAGS_SDIO_SWAP_MAILBOX_SET;
ath10k_bmi_write32(ar, hi_acs_flags, param);
 }
 
-- 
2.7.4


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


Re: [PATCH v2 2/2] ath10k: Set sk_pacing_shift to 6 for 11AC WiFi chips

2019-02-21 Thread Ben Greear

On 2/21/19 8:10 AM, Kalle Valo wrote:

Toke Høiland-Jørgensen  writes:


Grant Grundler  writes:


On Thu, Sep 6, 2018 at 3:18 AM Toke Høiland-Jørgensen  wrote:


Grant Grundler  writes:


And, well, Grant's data is from a single test in a noisy
environment where the time series graph shows that throughput is all over
the place for the duration of the test; so it's hard to draw solid
conclusions from (for instance, for the 5-stream test, the average
throughput for 6 is 331 and 379 Mbps for the two repetitions, and for 7
it's 326 and 371 Mbps) . Unfortunately I don't have the same hardware
used in this test, so I can't go verify it myself; so the only thing I
can do is grumble about it here... :)


It's a fair complaint and I agree with it. My counter argument is the
opposite is true too: most ideal benchmarks don't measure what most
users see. While the data wgong provided are way more noisy than I
like, my overall "confidence" in the "conclusion" I offered is still
positive.


Right. I guess I would just prefer a slightly more comprehensive
evaluation to base a 4x increase in buffer size on...


Kalle, is this why you didn't accept this patch? Other reasons?

Toke, what else would you like to see evaluated?

I generally want to see three things measured when "benchmarking"
technologies: throughput, latency, cpu utilization
We've covered those three I think "reasonably".


Hmm, going back and looking at this (I'd completely forgotten about this
patch), I think I had two main concerns:

1. What happens in a degraded signal situation, where the throughput is
limited by the signal conditions, or by contention with other devices.
Both of these happen regularly, and I worry that latency will be
badly affected under those conditions.

2. What happens with old hardware that has worse buffer management in
the driver->firmware path (especially drivers without push/pull mode
support)? For these, the lower-level queueing structure is less
effective at controlling queueing latency.


Do note that this patch changes behaviour _only_ for QCA6174 and QCA9377
PCI devices, which IIRC do not even support push/pull mode. All the
rest, including QCA988X and QCA9984 are unaffected.


Just as a note, at least kernels such as 4.14.whatever perform poorly when
running ath10k on 9984 when acting as TCP endpoints.  This makes them not
really usable for stuff like serving video to lots of clients.

Tweaking TCP (I do it a bit differently, but either way) can significantly
improve performance.

Recently I helped a user that could get barely 70 stations streaming at 1Mbps
on stock kernel (using one wave1 on 2.4, one wave-2 on 5Ghz),
and we got 110 working with a tweaked TCP stack.  These were /n stations too.

I think it is lame that it _still_ requires out of tree patches to make TCP work
well on ath10k...even if you want to default to current behaviour, you should
allow users to tweak it to work with their use case.

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


[PATCH 0/4] ath10k: small fixes for SDIO support

2019-02-21 Thread Kalle Valo
Wen has refactored some of the Alagu's fixes and wrote one of his own. I then
cleaned up the commit logs.

Alagu Sankar (3):
  ath10k: sdio: set hi_acs_flags
  ath10k: sdio: disable fwlog prints
  ath10k: don't report unset rssi values to mac80211

Wen Gong (1):
  ath10k: sdio: reset chip on power_down()

 drivers/net/wireless/ath/ath10k/core.c   | 19 ---
 drivers/net/wireless/ath/ath10k/htt_rx.c | 12 +---
 drivers/net/wireless/ath/ath10k/sdio.c   | 24 
 3 files changed, 41 insertions(+), 14 deletions(-)

-- 
2.7.4


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


[PATCH] mac80211: Change default tx_sk_pacing_shift to 7

2019-02-21 Thread Toke Høiland-Jørgensen
When we did the original tests for the optimal value of sk_pacing_shift, we
came up with 6 ms of buffering as the default. Sadly, 6 is not a power of
two, so when picking the shift value I erred on the size of less buffering
and picked 4 ms instead of 8. This was probably wrong; those 2 ms of extra
buffering makes a larger difference than I thought.

So, change the default pacing shift to 7, which corresponds to 8 ms of
buffering. The point of diminishing returns really kicks in after 8 ms, and
so having this as a default should cut down on the need for extensive
per-device testing and overrides needed in the drivers.

Signed-off-by: Toke Høiland-Jørgensen 
---
 net/mac80211/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 5055aeba5c5a..800e67615e2a 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -617,13 +617,13 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t 
priv_data_len,
 * We need a bit of data queued to build aggregates properly, so
 * instruct the TCP stack to allow more than a single ms of data
 * to be queued in the stack. The value is a bit-shift of 1
-* second, so 8 is ~4ms of queued data. Only affects local TCP
+* second, so 7 is ~8ms of queued data. Only affects local TCP
 * sockets.
 * This is the default, anyhow - drivers may need to override it
 * for local reasons (longer buffers, longer completion time, or
 * similar).
 */
-   local->hw.tx_sk_pacing_shift = 8;
+   local->hw.tx_sk_pacing_shift = 7;
 
/* set up some defaults */
local->hw.queues = 1;
-- 
2.20.1


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


RE: [BUG] ath10k firmware crash 100% recreated this way

2019-02-21 Thread Chaoxing Lin
Hello ath10k firmware maintainers,

What I describe is just a definite way to crash ath10k firmware.
It does NOT mean that the firmware crash only happens in such scenario.
I saw firmware crash once a while.

Is there a plan to fix the firmware crash issue? If not, is it possible to get 
ath10k firmware source code? We can sign any NDA if needed. We will contribute 
back if we have a fix for this firmware crash.

Thanks,

Chaoxing

-Original Message-
From: Chaoxing Lin 
Sent: Friday, February 15, 2019 10:46 AM
To: ath10k@lists.infradead.org; linux-wirel...@vger.kernel.org
Subject: [BUG] ath10k firmware crash 100% recreated this way

Hello ath10k firmware maintainers,

I saw ath10k firmware crash very often (~170 times in 20hours) on our wireless 
AP/bridge environment below:
arm64 board  
kernel 4.14.16 
hostapd-2.6 run in 4-address mode
Qualcomm Atheros QCA986x/988x 802.11ac Wireless Network Adapter
ath10k_core.ko in software crypto mode
running RSTP (Rapid Spanning Tree Protocol)

I also consistently recreated this firmware crash on Linux PC acting as AP as 
follows. Please take a look.

"must" conditions:

1. ath10k_core.ko MUST be in software crypto mode 
   ("modprobe ath10k_core cryptmode=1")

2. MUST run our proprietary RSTP bridge module 3ebridge.ko 
   (I can provide binary complied for kernel 4.14.16 on X86_64 PC)

3. STP must be on. 
   ("brctl stp brg0 on", by default 3ebridge.ko would turn STP on. Just a note 
that if STP is turned off, you won't see firmware crash)

4. hostapd-2.6 MUST be configured in 4-address mode 
   (put "wds_sta=1" in hostapd.conf) 

5. Linux PC wireless client must be in 4-address mode. 
   (run "iw wlan0 set 4addr on" before starting wpa_supplicant)
   To 100% recreate this firmware crash RIGHT AWAY, use the following WiFi 
   client.

root@Dell-D620:~# lspci
0c:00.0 Network controller: Intel Corporation PRO/Wireless 
3945ABG 
[Golan] Network Connection (rev 02)
You can find such radio card in very old (~15 years old) laptop.
 I can send you this radio card if you cannot find it.

ath10k firmware crashes right away when this 4-address client associates with 
the PC acting as AP.

FYI: What's known special about this wireless client? 
 Our experiments show this client does not really work in 4 address mode. 
 It successfully associates with AP but no traffic is possible in 
 4-address mode.
 Packets sniffed in the air show that this client (when in 4 address mode) 
 does NOT send ACK packets to AP on receiving from AP packet whose RA is 
 client MAC and DA is multicast MAC (e.g. BPDU)
 NOTE: Don't be distracted by what I saw about this wireless client. 
   It may not be related to the firmware crash. 


The following are DONT-CARE in re-creating the firmware crash.

1. WiFi encryption: 
   The firmare crash happens even in bypass/no-encryption mode, although 
   ath10k_core.ko MUST be put in software crypto mode to see the crash.

2. ath10k firmware version: 
   As long as it supports software crypto mode (i.e. support raw mode), 
   the above procedure can crash it. I tried various firmware versions from 
   the initial version that supports raw mode to the latest 
   firmware-5.bin_10.2.4.70.69 dated 18-Dec-2018. They all crashed.

3. Linux wireless client distribution/OS is a don't care.
   As long as the WiFi adapter is "Intel Corporation PRO/Wireless 3945AB"  
   Tried distributions below. They both make firmare crash right away on 
   PC AP side
Slackware 14.2 (kernel 4.4.14-smp)
Ubuntu 18.04.01 live (kernel 4.15.0-29-generic)

4. Radio channel setting is a don't care.
   Tried with/without 11n/11ac/ and different channel width. 
   They all crash firmware.


I can provide all configurations/binary as below.
hostapd.conf  [see later in this message]
wpa_supplicant.conf  [see later in this message]
3ebridge.ko (RSTP bridge binary compiled for 
 mainline kernel 4.14.16 X86_64. 
 Please "modprobe -r bridge" before "insmod 3ebridge.ko")


Below is the syslog/messages related to the ath10k firmware crash.
For easier reading, Timestamps are removed. line edited just to wrap around at 
80char 


/var/log/messages 
---
ath10k_pci :03:00.0: pci irq msi oper_irq_mode 2 irq_mode 0 reset_mode 0
ath10k_pci :03:00.0: qca988x hw2.0 target 0x4100016c chip_id 0x043202ff 
 sub :
ath10k_pci :03:00.0: kconfig debug 0 debugfs 1 tracing 0 dfs 0 testmode 0
ath10k_pci :03:00.0: firmware ver 10.2.4.70.69 api 5 features no-p2p,
 raw-mode,mfp,allows-mesh-bcast crc32 edfb196a
ath10k_pci :03:00.0: board_file api 1 bmi_id N/A crc32 bebc7c08
ath10k_pci :03:00.0: htt-ver 2.1 wmi-op 5 htt-op 2 

Re: [PATCH v2 2/2] ath10k: Set sk_pacing_shift to 6 for 11AC WiFi chips

2019-02-21 Thread Toke Høiland-Jørgensen
Ben Greear  writes:

> On 2/21/19 8:10 AM, Kalle Valo wrote:
>> Toke Høiland-Jørgensen  writes:
>> 
>>> Grant Grundler  writes:
>>>
 On Thu, Sep 6, 2018 at 3:18 AM Toke Høiland-Jørgensen  wrote:
>
> Grant Grundler  writes:
>
>>> And, well, Grant's data is from a single test in a noisy
>>> environment where the time series graph shows that throughput is all 
>>> over
>>> the place for the duration of the test; so it's hard to draw solid
>>> conclusions from (for instance, for the 5-stream test, the average
>>> throughput for 6 is 331 and 379 Mbps for the two repetitions, and for 7
>>> it's 326 and 371 Mbps) . Unfortunately I don't have the same hardware
>>> used in this test, so I can't go verify it myself; so the only thing I
>>> can do is grumble about it here... :)
>>
>> It's a fair complaint and I agree with it. My counter argument is the
>> opposite is true too: most ideal benchmarks don't measure what most
>> users see. While the data wgong provided are way more noisy than I
>> like, my overall "confidence" in the "conclusion" I offered is still
>> positive.
>
> Right. I guess I would just prefer a slightly more comprehensive
> evaluation to base a 4x increase in buffer size on...

 Kalle, is this why you didn't accept this patch? Other reasons?

 Toke, what else would you like to see evaluated?

 I generally want to see three things measured when "benchmarking"
 technologies: throughput, latency, cpu utilization
 We've covered those three I think "reasonably".
>>>
>>> Hmm, going back and looking at this (I'd completely forgotten about this
>>> patch), I think I had two main concerns:
>>>
>>> 1. What happens in a degraded signal situation, where the throughput is
>>> limited by the signal conditions, or by contention with other devices.
>>> Both of these happen regularly, and I worry that latency will be
>>> badly affected under those conditions.
>>>
>>> 2. What happens with old hardware that has worse buffer management in
>>> the driver->firmware path (especially drivers without push/pull mode
>>> support)? For these, the lower-level queueing structure is less
>>> effective at controlling queueing latency.
>> 
>> Do note that this patch changes behaviour _only_ for QCA6174 and QCA9377
>> PCI devices, which IIRC do not even support push/pull mode. All the
>> rest, including QCA988X and QCA9984 are unaffected.
>
> Just as a note, at least kernels such as 4.14.whatever perform poorly when
> running ath10k on 9984 when acting as TCP endpoints.  This makes them not
> really usable for stuff like serving video to lots of clients.
>
> Tweaking TCP (I do it a bit differently, but either way) can significantly
> improve performance.

Differently how? Did you have to do more than fiddle with the pacing_shift?

> Recently I helped a user that could get barely 70 stations streaming
> at 1Mbps on stock kernel (using one wave1 on 2.4, one wave-2 on 5Ghz),
> and we got 110 working with a tweaked TCP stack. These were /n
> stations too.
>
> I think it is lame that it _still_ requires out of tree patches to
> make TCP work well on ath10k...even if you want to default to current
> behaviour, you should allow users to tweak it to work with their use
> case.

Well if TCP is broken to the point of being unusable I do think we
should fix it; but I think "just provide a configuration knob" should be
the last resort...

-Toke

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


Re: [PATCH v2 2/2] ath10k: Set sk_pacing_shift to 6 for 11AC WiFi chips

2019-02-21 Thread Toke Høiland-Jørgensen
Grant Grundler  writes:

> On Thu, Sep 6, 2018 at 3:18 AM Toke Høiland-Jørgensen  wrote:
>>
>> Grant Grundler  writes:
>>
>> >> And, well, Grant's data is from a single test in a noisy
>> >> environment where the time series graph shows that throughput is all over
>> >> the place for the duration of the test; so it's hard to draw solid
>> >> conclusions from (for instance, for the 5-stream test, the average
>> >> throughput for 6 is 331 and 379 Mbps for the two repetitions, and for 7
>> >> it's 326 and 371 Mbps) . Unfortunately I don't have the same hardware
>> >> used in this test, so I can't go verify it myself; so the only thing I
>> >> can do is grumble about it here... :)
>> >
>> > It's a fair complaint and I agree with it. My counter argument is the
>> > opposite is true too: most ideal benchmarks don't measure what most
>> > users see. While the data wgong provided are way more noisy than I
>> > like, my overall "confidence" in the "conclusion" I offered is still
>> > positive.
>>
>> Right. I guess I would just prefer a slightly more comprehensive
>> evaluation to base a 4x increase in buffer size on...
>
> Kalle, is this why you didn't accept this patch? Other reasons?
>
> Toke, what else would you like to see evaluated?
>
> I generally want to see three things measured when "benchmarking"
> technologies: throughput, latency, cpu utilization
> We've covered those three I think "reasonably".

Hmm, going back and looking at this (I'd completely forgotten about this
patch), I think I had two main concerns:

1. What happens in a degraded signal situation, where the throughput is
   limited by the signal conditions, or by contention with other devices.
   Both of these happen regularly, and I worry that latency will be
   badly affected under those conditions.

2. What happens with old hardware that has worse buffer management in
   the driver->firmware path (especially drivers without push/pull mode
   support)? For these, the lower-level queueing structure is less
   effective at controlling queueing latency.

Getting the queue size limit patches from ChromeOS ported would
alleviate point 2. I do believe Kan said he'd look into that once the
airtime patches were merged. So Kan, any progress on that front? :)

> What does a "4x increase in memory" mean here? Wen, how much more
> memory does this cause ath10k to use?

I didn't say "memory", I said "buffer size"... :)
I.e., it's the latency impact of the increased buffering I'm worried
about (see above), not the system memory usage.

-Toke

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


Re: [PATCH v2 2/2] ath10k: Set sk_pacing_shift to 6 for 11AC WiFi chips

2019-02-21 Thread Kalle Valo
Toke Høiland-Jørgensen  writes:

> Grant Grundler  writes:
>
>> On Thu, Sep 6, 2018 at 3:18 AM Toke Høiland-Jørgensen  wrote:
>>>
>>> Grant Grundler  writes:
>>>
>>> >> And, well, Grant's data is from a single test in a noisy
>>> >> environment where the time series graph shows that throughput is all over
>>> >> the place for the duration of the test; so it's hard to draw solid
>>> >> conclusions from (for instance, for the 5-stream test, the average
>>> >> throughput for 6 is 331 and 379 Mbps for the two repetitions, and for 7
>>> >> it's 326 and 371 Mbps) . Unfortunately I don't have the same hardware
>>> >> used in this test, so I can't go verify it myself; so the only thing I
>>> >> can do is grumble about it here... :)
>>> >
>>> > It's a fair complaint and I agree with it. My counter argument is the
>>> > opposite is true too: most ideal benchmarks don't measure what most
>>> > users see. While the data wgong provided are way more noisy than I
>>> > like, my overall "confidence" in the "conclusion" I offered is still
>>> > positive.
>>>
>>> Right. I guess I would just prefer a slightly more comprehensive
>>> evaluation to base a 4x increase in buffer size on...
>>
>> Kalle, is this why you didn't accept this patch? Other reasons?
>>
>> Toke, what else would you like to see evaluated?
>>
>> I generally want to see three things measured when "benchmarking"
>> technologies: throughput, latency, cpu utilization
>> We've covered those three I think "reasonably".
>
> Hmm, going back and looking at this (I'd completely forgotten about this
> patch), I think I had two main concerns:
>
> 1. What happens in a degraded signal situation, where the throughput is
>limited by the signal conditions, or by contention with other devices.
>Both of these happen regularly, and I worry that latency will be
>badly affected under those conditions.
>
> 2. What happens with old hardware that has worse buffer management in
>the driver->firmware path (especially drivers without push/pull mode
>support)? For these, the lower-level queueing structure is less
>effective at controlling queueing latency.

Do note that this patch changes behaviour _only_ for QCA6174 and QCA9377
PCI devices, which IIRC do not even support push/pull mode. All the
rest, including QCA988X and QCA9984 are unaffected.

-- 
Kalle Valo

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


[PATCH 4/4] ath10k: Fix the wrong calculation ht_idx and idx of rate table for tx_stats

2019-02-21 Thread Surabhi Vishnoi
ht_idx (ht rate index) and idx (rate table index) are calculated based on
mcs index. This mcs index used in the above calculation should be 0-9 for
getting the correct ht_idx and idx.

Currently the mcs index used for the above calculations is mcs index which
can be 0-31 (in case of HT), leading to incorrect rate index and ht index
values.

Fix the issue by obtaining mcs value from the ratecode reported by firmware
and use it for calculating ht_idx and idx (rate-table index).

Tested HW: WCN3990
Tested FW: WLAN.HL.3.1-00784-QCAHLSWMTPLZ-1

Fixes: e88975ca37d1 ("ath10k: dump tx stats in rate table format")
Signed-off-by: Surabhi Vishnoi 
---
 drivers/net/wireless/ath/ath10k/htt_rx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 5b1dd58..b504c4f 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -2931,11 +2931,11 @@ static inline s8 ath10k_get_legacy_rate_idx(struct 
ath10k *ar, u8 rate)
 
tx_stats = arsta->tx_stats;
gi = test_bit(ATH10K_RATE_INFO_FLAGS_SGI_BIT, );
-   ht_idx = txrate->mcs + txrate->nss * 8;
-   mcs = txrate->mcs;
+   mcs = ATH10K_HW_MCS_RATE(pstats->ratecode);
bw = txrate->bw;
nss = txrate->nss;
-   idx = mcs * 8 + 8 * 10 * nss;
+   ht_idx = mcs + (nss - 1) * 8;
+   idx = mcs * 8 + 8 * 10 * (nss - 1);
idx += bw * 2 + gi;
 
 #define STATS_OP_FMT(name) tx_stats->stats[ATH10K_STATS_TYPE_##name]
-- 
1.9.1


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


[PATCH 3/4] ath10k: Fix the wrong updation of SGI in tx_stats debugfs

2019-02-21 Thread Surabhi Vishnoi
The SGI is updated wrongly in tx stats table in debugfs per sta
entry. To know whether the packets/bytes are sent with SHORT GI,
test whether the SGI bit(ATH10K_RATE_INFO_FLAGS_SGI_BIT) is set or
not in the txrate flags.

Tested HW: WCN3990
Tested FW: WLAN.HL.3.1-00784-QCAHLSWMTPLZ-1

Fixes: a904417fc876 ("ath10k: add extended per sta tx statistics support")
Signed-off-by: Surabhi Vishnoi 
---
 drivers/net/wireless/ath/ath10k/htt_rx.c | 3 ++-
 drivers/net/wireless/ath/ath10k/wmi.h| 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 3a02a76..5b1dd58 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -2924,12 +2924,13 @@ static inline s8 ath10k_get_legacy_rate_idx(struct 
ath10k *ar, u8 rate)
struct rate_info *txrate = >txrate;
struct ath10k_htt_tx_stats *tx_stats;
int idx, ht_idx, gi, mcs, bw, nss;
+   unsigned long flags;
 
if (!arsta->tx_stats)
return;
 
tx_stats = arsta->tx_stats;
-   gi = (arsta->txrate.flags & RATE_INFO_FLAGS_SHORT_GI);
+   gi = test_bit(ATH10K_RATE_INFO_FLAGS_SGI_BIT, );
ht_idx = txrate->mcs + txrate->nss * 8;
mcs = txrate->mcs;
bw = txrate->bw;
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index 7053db4..b727232 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -5062,6 +5062,7 @@ enum wmi_rate_preamble {
 #define ATH10K_GI_NUM  2
 #define ATH10K_HT_MCS_NUM  32
 #define ATH10K_RATE_TABLE_NUM  320
+#define ATH10K_RATE_INFO_FLAGS_SGI_BIT 2
 
 /* Value to disable fixed rate setting */
 #define WMI_FIXED_RATE_NONE(0xff)
-- 
1.9.1


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


[PATCH 2/4] ath10k: Fix the wrong updation of BW in tx_stats debugfs entry

2019-02-21 Thread Surabhi Vishnoi
Currently, the bandwidth is updated wrongly in BW table in tx_stats
debugfs per sta as there is difference in number of bandwidth type
in mac80211 and driver stats table. This leads to bandwidth getting
updated at wrong index in bandwidth table in tx_stats.

Fix this index mismatch between mac80211 and driver stats table (BW table)
by making the number of bandwidth type in driver compatible with mac80211.

Tested HW: WCN3990
Tested FW: WLAN.HL.3.1-00784-QCAHLSWMTPLZ-1

Fixes: a904417fc876 ("ath10k: add extended per sta tx statistics support")
Signed-off-by: Surabhi Vishnoi 
---
 drivers/net/wireless/ath/ath10k/debugfs_sta.c | 8 +---
 drivers/net/wireless/ath/ath10k/wmi.h | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/debugfs_sta.c 
b/drivers/net/wireless/ath/ath10k/debugfs_sta.c
index 4778a45..645ba9c 100644
--- a/drivers/net/wireless/ath/ath10k/debugfs_sta.c
+++ b/drivers/net/wireless/ath/ath10k/debugfs_sta.c
@@ -696,11 +696,13 @@ static ssize_t ath10k_dbg_sta_dump_tx_stats(struct file 
*file,
 "  %llu ", stats->ht[j][i]);
len += scnprintf(buf + len, size - len, "\n");
len += scnprintf(buf + len, size - len,
-   " BW %s (20,40,80,160 MHz)\n", str[j]);
+   " BW %s (20,5,10,40,80,160 MHz)\n",
+   str[j]);
len += scnprintf(buf + len, size - len,
-"  %llu %llu %llu %llu\n",
+"  %llu %llu %llu %llu %llu %llu\n",
 stats->bw[j][0], stats->bw[j][1],
-stats->bw[j][2], stats->bw[j][3]);
+stats->bw[j][2], stats->bw[j][3],
+stats->bw[j][4], stats->bw[j][5]);
len += scnprintf(buf + len, size - len,
 " NSS %s (1x1,2x2,3x3,4x4)\n", str[j]);
len += scnprintf(buf + len, size - len,
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index 0e27878..7053db4 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -5056,7 +5056,7 @@ enum wmi_rate_preamble {
 #define ATH10K_FW_SKIPPED_RATE_CTRL(flags) (((flags) >> 6) & 0x1)
 
 #define ATH10K_VHT_MCS_NUM 10
-#define ATH10K_BW_NUM  4
+#define ATH10K_BW_NUM  6
 #define ATH10K_NSS_NUM 4
 #define ATH10K_LEGACY_NUM  12
 #define ATH10K_GI_NUM  2
-- 
1.9.1


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


[PATCH 1/4] ath10k: Fix the incorrect updation of NSS data in tx stats

2019-02-21 Thread Surabhi Vishnoi
The NSS data is updated incorrectly in the tx stats as the array
indexing starts from zero.

Fix the incorrect updation of NSS data in tx_stats by taking into
consideration the array index starting from zero.

Tested HW: WCN3990
Tested FW: WLAN.HL.3.1-00784-QCAHLSWMTPLZ-1

Fixes: a904417fc876 ("ath10k: add extended per sta tx statistics support")
Signed-off-by: Surabhi Vishnoi 
---
 drivers/net/wireless/ath/ath10k/htt_rx.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
b/drivers/net/wireless/ath/ath10k/htt_rx.c
index d5c666c..3a02a76 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -2980,7 +2980,7 @@ static inline s8 ath10k_get_legacy_rate_idx(struct ath10k 
*ar, u8 rate)
}
STATS_OP_FMT(AMPDU).bw[0][bw] +=
pstats->succ_bytes + pstats->retry_bytes;
-   STATS_OP_FMT(AMPDU).nss[0][nss] +=
+   STATS_OP_FMT(AMPDU).nss[0][nss - 1] +=
pstats->succ_bytes + pstats->retry_bytes;
STATS_OP_FMT(AMPDU).gi[0][gi] +=
pstats->succ_bytes + pstats->retry_bytes;
@@ -2988,7 +2988,7 @@ static inline s8 ath10k_get_legacy_rate_idx(struct ath10k 
*ar, u8 rate)
pstats->succ_bytes + pstats->retry_bytes;
STATS_OP_FMT(AMPDU).bw[1][bw] +=
pstats->succ_pkts + pstats->retry_pkts;
-   STATS_OP_FMT(AMPDU).nss[1][nss] +=
+   STATS_OP_FMT(AMPDU).nss[1][nss - 1] +=
pstats->succ_pkts + pstats->retry_pkts;
STATS_OP_FMT(AMPDU).gi[1][gi] +=
pstats->succ_pkts + pstats->retry_pkts;
@@ -3000,27 +3000,27 @@ static inline s8 ath10k_get_legacy_rate_idx(struct 
ath10k *ar, u8 rate)
}
 
STATS_OP_FMT(SUCC).bw[0][bw] += pstats->succ_bytes;
-   STATS_OP_FMT(SUCC).nss[0][nss] += pstats->succ_bytes;
+   STATS_OP_FMT(SUCC).nss[0][nss - 1] += pstats->succ_bytes;
STATS_OP_FMT(SUCC).gi[0][gi] += pstats->succ_bytes;
 
STATS_OP_FMT(SUCC).bw[1][bw] += pstats->succ_pkts;
-   STATS_OP_FMT(SUCC).nss[1][nss] += pstats->succ_pkts;
+   STATS_OP_FMT(SUCC).nss[1][nss - 1] += pstats->succ_pkts;
STATS_OP_FMT(SUCC).gi[1][gi] += pstats->succ_pkts;
 
STATS_OP_FMT(FAIL).bw[0][bw] += pstats->failed_bytes;
-   STATS_OP_FMT(FAIL).nss[0][nss] += pstats->failed_bytes;
+   STATS_OP_FMT(FAIL).nss[0][nss - 1] += pstats->failed_bytes;
STATS_OP_FMT(FAIL).gi[0][gi] += pstats->failed_bytes;
 
STATS_OP_FMT(FAIL).bw[1][bw] += pstats->failed_pkts;
-   STATS_OP_FMT(FAIL).nss[1][nss] += pstats->failed_pkts;
+   STATS_OP_FMT(FAIL).nss[1][nss - 1] += pstats->failed_pkts;
STATS_OP_FMT(FAIL).gi[1][gi] += pstats->failed_pkts;
 
STATS_OP_FMT(RETRY).bw[0][bw] += pstats->retry_bytes;
-   STATS_OP_FMT(RETRY).nss[0][nss] += pstats->retry_bytes;
+   STATS_OP_FMT(RETRY).nss[0][nss - 1] += pstats->retry_bytes;
STATS_OP_FMT(RETRY).gi[0][gi] += pstats->retry_bytes;
 
STATS_OP_FMT(RETRY).bw[1][bw] += pstats->retry_pkts;
-   STATS_OP_FMT(RETRY).nss[1][nss] += pstats->retry_pkts;
+   STATS_OP_FMT(RETRY).nss[1][nss - 1] += pstats->retry_pkts;
STATS_OP_FMT(RETRY).gi[1][gi] += pstats->retry_pkts;
 
if (txrate->flags >= RATE_INFO_FLAGS_MCS) {
-- 
1.9.1


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


[PATCH 0/4] Fix inconsistencies observed in population of tx_stats in debugfs

2019-02-21 Thread Surabhi Vishnoi
There are some inconsistencies observed while filling various peer tx stats in 
tx_stats
debugfs entry per sta.

This patchset fixes the wrong updation of NSS, SGI, Bandwidth and rate_table in 
tx_stats
debugfs entry per sta.

Surabhi Vishnoi (4):
  ath10k: Fix the incorrect updation of NSS data in tx stats
  ath10k: Fix the wrong updation of BW in tx_stats debugfs entry
  ath10k: Fix the wrong updation of SGI in tx_stats debugfs
  ath10k: Fix the wrong calculation ht_idx and idx of rate table for
tx_stats

 drivers/net/wireless/ath/ath10k/debugfs_sta.c |  8 +---
 drivers/net/wireless/ath/ath10k/htt_rx.c  | 25 +
 drivers/net/wireless/ath/ath10k/wmi.h |  3 ++-
 3 files changed, 20 insertions(+), 16 deletions(-)

-- 
1.9.1


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


[PATCH v3] iw: Add support for controlling tx power for per station

2019-02-21 Thread Balaji Pothunoori
From: Ashok Raj Nagarajan 

This patch allows userspace to set transmit power,
in dBm units, to a station associated to the AP.

To set a limit tx power of 20 dBm:
iw wlan0 station set  txpwr limit 20

To revert the user defined tx power for a station:
iw wlan0 station set  txpwr auto

Co-developed-by: Balaji Pothunoori 
Signed-off-by: Ashok Raj Nagarajan 
Signed-off-by: Balaji Pothunoori 
---
v2: modified user configured units to dBm from mBm
v3: no changes, rebased

 station.c | 71 +++
 1 file changed, 71 insertions(+)

diff --git a/station.c b/station.c
index e1477ef..8e0e852 100644
--- a/station.c
+++ b/station.c
@@ -651,6 +651,7 @@ COMMAND(station, del, " [subtype ] 
[reason-code ]",
 static const struct cmd *station_set_plink;
 static const struct cmd *station_set_vlan;
 static const struct cmd *station_set_mesh_power_mode;
+static const struct cmd *station_set_txpwr;
 
 static const struct cmd *select_station_cmd(int argc, char **argv)
 {
@@ -662,6 +663,8 @@ static const struct cmd *select_station_cmd(int argc, char 
**argv)
return station_set_vlan;
if (strcmp(argv[1], "mesh_power_mode") == 0)
return station_set_mesh_power_mode;
+   if (strcmp(argv[1], "txpwr") == 0)
+   return station_set_txpwr;
return NULL;
 }
 
@@ -813,6 +816,74 @@ COMMAND_ALIAS(station, set, " mesh_power_mode 
"
"Set link-specific mesh power mode for this station",
select_station_cmd, station_set_mesh_power_mode);
 
+static int handle_station_set_txpwr(struct nl80211_state *state,
+   struct nl_msg *msg,
+   int argc, char **argv,
+   enum id_input id)
+{
+   enum nl80211_tx_power_setting type;
+   unsigned char mac_addr[ETH_ALEN];
+   int sta_txpwr = 0;
+   char *err = NULL;
+
+   if (argc != 3 && argc != 4)
+   return 1;
+
+   if (mac_addr_a2n(mac_addr, argv[0])) {
+   fprintf(stderr, "invalid mac address\n");
+   return 2;
+   }
+
+   NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr);
+   argc--;
+   argv++;
+
+   if (strcmp("txpwr", argv[0]) != 0)
+   return 1;
+   argc--;
+   argv++;
+
+   if (!strcmp(argv[0], "auto"))
+   type = NL80211_TX_POWER_AUTOMATIC;
+   else if (!strcmp(argv[0], "limit"))
+   type = NL80211_TX_POWER_LIMITED;
+   else {
+   printf("Invalid parameter: %s\n", argv[0]);
+   return 2;
+   }
+
+   NLA_PUT_U8(msg, NL80211_ATTR_STA_TX_POWER_SETTING, type);
+
+   if (type != NL80211_TX_POWER_AUTOMATIC) {
+   if (argc != 2) {
+   printf("Missing TX power level argument.\n");
+   return 2;
+   }
+
+   argc--;
+   argv++;
+
+   sta_txpwr = strtoul(argv[0], , 0);
+
+   if (sta_txpwr)
+   NLA_PUT_U16(msg, NL80211_ATTR_STA_TX_POWER, sta_txpwr);
+   }
+
+   argc--;
+   argv++;
+
+   if (argc)
+   return 1;
+
+   return 0;
+ nla_put_failure:
+   return -ENOBUFS;
+}
+COMMAND_ALIAS(station, set, " txpwr  []",
+   NL80211_CMD_SET_STATION, 0, CIB_NETDEV, handle_station_set_txpwr,
+   "Set Tx power for this station.",
+   select_station_cmd, station_set_txpwr);
+
 static int handle_station_dump(struct nl80211_state *state,
   struct nl_msg *msg,
   int argc, char **argv,
-- 
2.7.4


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


[PATCH v3 3/3] ath10k: add support for controlling tx power to a station

2019-02-21 Thread Balaji Pothunoori
From: Ashok Raj Nagarajan 

This patch will add the support to control the transmit power for traffic
to a station associated with the AP.

Underlying firmware will enforce that the maximum tx power will be based
on the regulatory requirements. If the user given transmit power is greater
than the allowed tx power in the given channel, then the firmware will use
the maximum tx power in the same channel.

When 0 is sent to the firmware as tx power, it will revert to the default
tx power for the station.

Tested Hardware : QCA9984
Tested Firmware : 10.4-3.9.0.1-00013

Co-developed-by: Balaji Pothunoori 
Signed-off-by: Ashok Raj Nagarajan 
Signed-off-by: Balaji Pothunoori 
---
v2: removed mBm to dBm conversion
v3: rebased wmi.h changes

 drivers/net/wireless/ath/ath10k/debug.h |  3 +++
 drivers/net/wireless/ath/ath10k/mac.c   | 39 +
 drivers/net/wireless/ath/ath10k/wmi.h   |  6 +
 3 files changed, 48 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/debug.h 
b/drivers/net/wireless/ath/ath10k/debug.h
index db78e85..2e43d8d 100644
--- a/drivers/net/wireless/ath/ath10k/debug.h
+++ b/drivers/net/wireless/ath/ath10k/debug.h
@@ -71,6 +71,9 @@ struct ath10k_pktlog_hdr {
 /* FIXME: How to calculate the buffer size sanely? */
 #define ATH10K_FW_STATS_BUF_SIZE (1024 * 1024)
 
+#define ATH10K_TX_POWER_MAX_VAL 70
+#define ATH10K_TX_POWER_MIN_VAL 0
+
 extern unsigned int ath10k_debug_mask;
 
 __printf(2, 3) void ath10k_info(struct ath10k *ar, const char *fmt, ...);
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index b73c23d..d6ed452 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -6350,6 +6350,41 @@ static void ath10k_mac_dec_num_stations(struct 
ath10k_vif *arvif,
ar->num_stations--;
 }
 
+static int ath10k_sta_set_txpwr(struct ieee80211_hw *hw,
+   struct ieee80211_vif *vif,
+   struct ieee80211_sta *sta)
+{
+   struct ath10k *ar = hw->priv;
+   struct ath10k_vif *arvif = (void *)vif->drv_priv;
+   int ret = 0;
+   s16 txpwr;
+
+   if (sta->txpwr.type == NL80211_TX_POWER_AUTOMATIC) {
+   txpwr = 0;
+   } else {
+   txpwr = sta->txpwr.power;
+   if (!txpwr)
+   return -EINVAL;
+   }
+
+   if (txpwr > ATH10K_TX_POWER_MAX_VAL || txpwr < ATH10K_TX_POWER_MIN_VAL)
+   return -EINVAL;
+
+   mutex_lock(>conf_mutex);
+
+   ret = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr,
+   WMI_PEER_USE_FIXED_PWR, txpwr);
+   if (ret) {
+   ath10k_warn(ar, "failed to set tx power for station ret: %d\n",
+   ret);
+   goto out;
+   }
+
+out:
+   mutex_unlock(>conf_mutex);
+   return ret;
+}
+
 static int ath10k_sta_state(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
@@ -8007,6 +8042,7 @@ static const struct ieee80211_ops ath10k_ops = {
.set_key= ath10k_set_key,
.set_default_unicast_key= ath10k_set_default_unicast_key,
.sta_state  = ath10k_sta_state,
+   .sta_set_txpwr  = ath10k_sta_set_txpwr,
.conf_tx= ath10k_conf_tx,
.remain_on_channel  = ath10k_remain_on_channel,
.cancel_remain_on_channel   = ath10k_cancel_remain_on_channel,
@@ -8695,6 +8731,9 @@ int ath10k_mac_register(struct ath10k *ar)
wiphy_ext_feature_set(ar->hw->wiphy,
  NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER);
 
+   if (test_bit(WMI_SERVICE_TX_PWR_PER_PEER, ar->wmi.svc_map))
+   wiphy_ext_feature_set(ar->hw->wiphy,
+ NL80211_EXT_FEATURE_STA_TX_PWR);
/*
 * on LL hardware queues are managed entirely by the FW
 * so we only advertise to mac we can do the queues thing
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index d9b646f..1557253 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -200,6 +200,7 @@ enum wmi_service {
WMI_SERVICE_RTT_RESPONDER_ROLE,
WMI_SERVICE_PER_PACKET_SW_ENCRYPT,
WMI_SERVICE_REPORT_AIRTIME,
+   WMI_SERVICE_TX_PWR_PER_PEER,
 
/* Remember to add the new value to wmi_service_name()! */
 
@@ -367,6 +368,7 @@ enum wmi_10_4_service {
WMI_10_4_SERVICE_RTT_RESPONDER_ROLE,
WMI_10_4_SERVICE_EXT_PEER_TID_CONFIGS_SUPPORT,
WMI_10_4_SERVICE_REPORT_AIRTIME,
+   WMI_10_4_SERVICE_TX_PWR_PER_PEER,
 };
 
 static inline char *wmi_service_name(enum wmi_service service_id)
@@ -491,6 +493,7 @@ static inline char *wmi_service_name(enum 

[PATCH v3 1/3] cfg80211: Add support to set tx power for a station associated

2019-02-21 Thread Balaji Pothunoori
From: Ashok Raj Nagarajan 

This patch adds support to set transmit power setting type and transmit
power level attributes to NL80211_CMD_SET_STATION in order to facilitate
adjusting the transmit power level of a station associated to the AP.

The added attributes allow selection of automatic and limited transmit
power level, with the level defined in dBm format.

Co-developed-by: Balaji Pothunoori 
Signed-off-by: Ashok Raj Nagarajan 
Signed-off-by: Balaji Pothunoori 
---
 v2: add txpwr structure
replaced nla_get_u32 with nla_get_u8/s16
added NLA_POLICY_RANGE check
 v3: updated kernel-doc for sta_txpwr
 structure and rebased

 include/net/cfg80211.h   | 22 ++
 include/uapi/linux/nl80211.h | 14 ++
 net/wireless/nl80211.c   | 38 ++
 3 files changed, 74 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index f81677f..410867a 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -973,6 +973,27 @@ enum station_parameters_apply_mask {
STATION_PARAM_APPLY_UAPSD = BIT(0),
STATION_PARAM_APPLY_CAPABILITY = BIT(1),
STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
+   STATION_PARAM_APPLY_STA_TXPOWER = BIT(3),
+};
+
+/**
+ * struct sta_txpwr - station txpower configuration
+ *
+ * Used to configure txpower for station.
+ *
+ * @power: tx power (in dBm) to be used for sending data traffic. If tx power
+ * is not provided, the default per-interface tx power setting will be
+ * overriding. Driver should be picking up the lowest tx power, either tx
+ * power per-interface or per-station.
+ * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
+ * will be less than or equal to specified from userspace, whereas if TPC
+ * %type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
+ * NL80211_TX_POWER_FIXED is not a valid configuration option for
+ * per peer TPC.
+ */
+struct sta_txpwr {
+   s16 power;
+   enum nl80211_tx_power_setting type;
 };
 
 /**
@@ -1047,6 +1068,7 @@ struct station_parameters {
const struct ieee80211_he_cap_elem *he_capa;
u8 he_capa_len;
u16 airtime_weight;
+   struct sta_txpwr txpwr;
 };
 
 /**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index dd4f86e..83040c6 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2308,6 +2308,15 @@ enum nl80211_commands {
  * @NL80211_ATTR_AIRTIME_WEIGHT: Station's weight when scheduled by the airtime
  * scheduler.
  *
+ * @NL80211_ATTR_STA_TX_POWER_SETTING: Transmit power setting type (u8) for
+ * station associated with the AP. See  nl80211_tx_power_setting for
+ * possible values.
+ * @NL80211_ATTR_STA_TX_POWER: Transmit power level (s16) in dBm units. This
+ * allows to set Tx power for a station. If this attribute is not included,
+ * the default per-interface tx power setting will be overriding. Driver
+ * should be picking up the lowest tx power, either tx power per-interface
+ * or per-station.
+ *
  * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2758,6 +2767,8 @@ enum nl80211_attrs {
NL80211_ATTR_PEER_MEASUREMENTS,
 
NL80211_ATTR_AIRTIME_WEIGHT,
+   NL80211_ATTR_STA_TX_POWER_SETTING,
+   NL80211_ATTR_STA_TX_POWER,
 
/* add attributes here, update the policy in nl80211.c */
 
@@ -5343,6 +5354,8 @@ enum nl80211_feature_flags {
  * @NL80211_EXT_FEATURE_AP_PMKSA_CACHING: Driver/device supports PMKSA caching
  * (set/del PMKSA operations) in AP mode.
  *
+ * @NL80211_EXT_FEATURE_STA_TX_PWR: This driver supports controlling tx power
+ 8 to a station.
  * @NUM_NL80211_EXT_FEATURES: number of extended features.
  * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
  */
@@ -5384,6 +5397,7 @@ enum nl80211_ext_feature_index {
NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER,
NL80211_EXT_FEATURE_AIRTIME_FAIRNESS,
NL80211_EXT_FEATURE_AP_PMKSA_CACHING,
+   NL80211_EXT_FEATURE_STA_TX_PWR,
 
/* add new features before the definition below */
NUM_NL80211_EXT_FEATURES,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 80878b4..f7bf282 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -331,6 +331,11 @@ const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = 
{
   .len = NL80211_MAX_SUPP_RATES },
[NL80211_ATTR_STA_PLINK_ACTION] =
NLA_POLICY_MAX(NLA_U8, NUM_NL80211_PLINK_ACTIONS - 1),
+   [NL80211_ATTR_STA_TX_POWER_SETTING] =
+   NLA_POLICY_RANGE(NLA_U8,
+NL80211_TX_POWER_AUTOMATIC,
+NL80211_TX_POWER_FIXED),
+   [NL80211_ATTR_STA_TX_POWER] = { .type = 

[PATCH v3 2/3] mac80211: store tx power value from user to station

2019-02-21 Thread Balaji Pothunoori
From: Ashok Raj Nagarajan 

This patch introduce a new driver callback drv_sta_set_txpwr. This API will
copy the transmit power value passed from user space and call the driver
callback to set the tx power for the station.

Co-developed-by: Balaji Pothunoori 
Signed-off-by: Ashok Raj Nagarajan 
Signed-off-by: Balaji Pothunoori 
---
v2: add txpwr structure
added tx power set type in trace event
v3: updated kernel-doc for ieee80211_sta_txpwr
structure and rebased

 include/net/mac80211.h| 22 ++
 net/mac80211/cfg.c|  9 +
 net/mac80211/driver-ops.c | 21 +
 net/mac80211/driver-ops.h |  5 +
 net/mac80211/trace.h  | 30 ++
 5 files changed, 87 insertions(+)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 97aed7b..74aad69 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1884,6 +1884,24 @@ struct ieee80211_sta_rates {
 };
 
 /**
+ * struct ieee80211_sta_txpwr - station txpower configuration
+ *
+ * Used to configure txpower for station.
+ *
+ * @power: indicates the tx power, in dBm, to be used when sending data frames
+ * to the STA.
+ * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
+ * will be less than or equal to specified from userspace, whereas if TPC
+ * %type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
+ * NL80211_TX_POWER_FIXED is not a valid configuration option for
+ * per peer TPC.
+ */
+struct ieee80211_sta_txpwr {
+   s16 power;
+   enum nl80211_tx_power_setting type;
+};
+
+/**
  * struct ieee80211_sta - station table entry
  *
  * A station table entry represents a station we are possibly
@@ -1969,6 +1987,7 @@ struct ieee80211_sta {
bool support_p2p_ps;
u16 max_rc_amsdu_len;
u16 max_tid_amsdu_len[IEEE80211_NUM_TIDS];
+   struct ieee80211_sta_txpwr txpwr;
 
struct ieee80211_txq *txq[IEEE80211_NUM_TIDS + 1];
 
@@ -3785,6 +3804,9 @@ struct ieee80211_ops {
 #endif
void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
enum sta_notify_cmd, struct ieee80211_sta *sta);
+   int (*sta_set_txpwr)(struct ieee80211_hw *hw,
+struct ieee80211_vif *vif,
+struct ieee80211_sta *sta);
int (*sta_state)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 struct ieee80211_sta *sta,
 enum ieee80211_sta_state old_state,
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index d65aa01..6a8b4a4 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1417,6 +1417,15 @@ static int sta_apply_parameters(struct ieee80211_local 
*local,
if (params->listen_interval >= 0)
sta->listen_interval = params->listen_interval;
 
+   if (params->sta_modify_mask & STATION_PARAM_APPLY_STA_TXPOWER) {
+   sta->sta.txpwr.type = params->txpwr.type;
+   if (params->txpwr.type == NL80211_TX_POWER_LIMITED)
+   sta->sta.txpwr.power = params->txpwr.power;
+   ret = drv_sta_set_txpwr(local, sdata, sta);
+   if (ret)
+   return ret;
+   }
+
if (params->supported_rates) {
ieee80211_parse_bitrates(>vif.bss_conf.chandef,
 sband, params->supported_rates,
diff --git a/net/mac80211/driver-ops.c b/net/mac80211/driver-ops.c
index bb886e7..839c002 100644
--- a/net/mac80211/driver-ops.c
+++ b/net/mac80211/driver-ops.c
@@ -138,6 +138,27 @@ int drv_sta_state(struct ieee80211_local *local,
return ret;
 }
 
+__must_check
+int drv_sta_set_txpwr(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct sta_info *sta)
+{
+   int ret = -EOPNOTSUPP;
+
+   might_sleep();
+
+   sdata = get_bss_sdata(sdata);
+   if (!check_sdata_in_driver(sdata))
+   return -EIO;
+
+   trace_drv_sta_set_txpwr(local, sdata, >sta);
+   if (local->ops->sta_set_txpwr)
+   ret = local->ops->sta_set_txpwr(>hw, >vif,
+   >sta);
+   trace_drv_return_int(local, ret);
+   return ret;
+}
+
 void drv_sta_rc_update(struct ieee80211_local *local,
   struct ieee80211_sub_if_data *sdata,
   struct ieee80211_sta *sta, u32 changed)
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index ba3c07b..2cc5bb2 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -529,6 +529,11 @@ int drv_sta_state(struct ieee80211_local *local,
  enum ieee80211_sta_state old_state,
  enum ieee80211_sta_state new_state);
 
+__must_check
+int drv_sta_set_txpwr(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data 

Re: ACS scans not returning noise floor

2019-02-21 Thread Justin Capella
My apologies,
I left out the important bit of the debug logs
[ 1265.917324] ath10k_warn: 61 callbacks suppressed
[ 1265.917330] ath10k_pci :01:00.0: failed to parse chan info event: -71

Possibly also relevant, i'm using country "US" I am aware that the fcc
crda/regdom wasn't supported, but without the 802.11h option
condigured in hostapd it had been working with older firmware.

7ce94a62264be94dc1c41ff5d0c8a19c7f0d3143 is the head of the master
branch I'm using

On Thu, Feb 21, 2019 at 4:39 PM Justin Capella  wrote:
>
> I'm using the firmware from ~2 days ago, and ath10k_wmi_pull_ch_info
> seems to be returning -EPROTO. I have no idea what I'm doing, but I
> notice there is a default noise floor in one of the headers, perhaps
> this could be used somewhere? I'm encountering this becuase hostapd is
> complaining that the ACS survey does not contain enough info.
>
> [ 1261.111452] ath10k_pci :01:00.0: pci rx ce pipe 5 len 28
> [ 1261.111457] ath10k_pci :01:00.0: pci rx: : 01 00 14 00
> 00 05 00 00 0f 00 00 00 50 14 00 00  P...
> [ 1261.111460] ath10k_pci :01:00.0: pci rx: 0010: 50 14 00 00
> 00 00 00 00 00 00 00 00  P...
> [ 1261.111464] ath10k_pci :01:00.0: htt rx, msg_type: 0xF
> [ 1261.111469] ath10k_pci :01:00.0: htt chan change freq 5200 phymode 11a
> [ 1261.115411] ath10k_pci :01:00.0: pci rx ce pipe 2 len 36
> [ 1261.115419] ath10k_pci :01:00.0: pci rx: : 02 00 1c 00
> 00 06 00 00 00 90 00 00 08 00 00 00  
> [ 1261.115424] ath10k_pci :01:00.0: pci rx: 0010: 03 00 00 00
> 50 14 00 00 01 a0 00 00 00 a0 00 00  P...
> [ 1261.115427] ath10k_pci :01:00.0: pci rx: 0020: 00 00 00 00
> 
> [ 1261.115432] ath10k_pci :01:00.0: htc rx completion ep 2 skb
> 63dc45b6
> [ 1261.115439] ath10k_pci :01:00.0: scan event foreign channel
> type 8 reason 3 freq 5200 req_id 40961 scan_id 40960 vdev_id 0 state
> running (2)
> [ 1261.115448] ath10k_pci :01:00.0: pci rx ce pipe 2 len 40
> [ 1261.115452] ath10k_pci :01:00.0: pci rx: : 02 00 20 00
> 00 07 00 00 0c 90 00 00 00 00 00 00  .. .
> [ 1261.115456] ath10k_pci :01:00.0: pci rx: 0010: 50 14 00 00
> 00 00 00 00 00 00 00 00 a3 43 33 00  PC3.
> [ 1261.115459] ath10k_pci :01:00.0: pci rx: 0020: c8 67 4a 01
> e8 90 16 00  .gJ.
> [ 1261.115463] ath10k_pci :01:00.0: htc rx completion ep 2 skb
> b2b31359

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


[PATCHv2 6/9] mac80211: Add api to support configuring TID specific configuration

2019-02-21 Thread Tamizh chelvam
Implement drv_set_tid_config api to allow TID specific
configuration. This per-TID configuration
will be applied for all the connected stations when MAC is NULL.

Signed-off-by: Tamizh chelvam 
---
 include/net/mac80211.h| 35 +++
 net/mac80211/cfg.c| 28 
 net/mac80211/driver-ops.h | 15 +++
 3 files changed, 78 insertions(+)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 97aed7b..dda30e9a 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1552,6 +1552,8 @@ enum ieee80211_vif_flags {
IEEE80211_VIF_GET_NOA_UPDATE= BIT(3),
 };
 
+#define IEEE80211_TID_MAX  8
+
 /**
  * struct ieee80211_vif - per-interface data
  *
@@ -1589,6 +1591,11 @@ enum ieee80211_vif_flags {
  * @txq: the multicast data TX queue (if driver uses the TXQ abstraction)
  * @txqs_stopped: per AC flag to indicate that intermediate TXQs are stopped,
  * protected by fq->lock.
+ * @noack: per-TID noack policy.
+ * @retry_short: per-TID retry count.
+ * @retry_long: per-TID count.
+ * @ampdu: per-TID Aggregation-MPDU.
+ * @tx_rate_mask: per-TID tx rate value.
  */
 struct ieee80211_vif {
enum nl80211_iftype type;
@@ -1615,6 +1622,14 @@ struct ieee80211_vif {
 
bool txqs_stopped[IEEE80211_NUM_ACS];
 
+   u8 noack[IEEE80211_TID_MAX];
+   int retry_short[IEEE80211_TID_MAX];
+   int retry_long[IEEE80211_TID_MAX];
+   u8 ampdu[IEEE80211_TID_MAX];
+   u8 rate_ctrl[IEEE80211_TID_MAX];
+   u32 rate_code[IEEE80211_TID_MAX];
+   u8 rtscts[IEEE80211_TID_MAX];
+
/* must be last */
u8 drv_priv[0] __aligned(sizeof(void *));
 };
@@ -1929,6 +1944,11 @@ struct ieee80211_sta_rates {
  * @max_tid_amsdu_len: Maximum A-MSDU size in bytes for this TID
  * @txq: per-TID data TX queues (if driver uses the TXQ abstraction); note that
  * the last entry (%IEEE80211_NUM_TIDS) is used for non-data frames
+ * @noack: per-TID noack policy.
+ * @retry_short: per-TID retry count.
+ * @retry_long: per-TID count.
+ * @ampdu: per-TID Aggregation-MPDU.
+ * @tx_rate_mask: per-TID tx rate value.
  */
 struct ieee80211_sta {
u32 supp_rates[NUM_NL80211_BANDS];
@@ -1972,6 +1992,13 @@ struct ieee80211_sta {
 
struct ieee80211_txq *txq[IEEE80211_NUM_TIDS + 1];
 
+   u8 noack[IEEE80211_TID_MAX];
+   int retry_short[IEEE80211_TID_MAX];
+   int retry_long[IEEE80211_TID_MAX];
+   u8 ampdu[IEEE80211_TID_MAX];
+   u8 rate_ctrl[IEEE80211_TID_MAX];
+   u8 rtscts[IEEE80211_TID_MAX];
+
/* must be last */
u8 drv_priv[0] __aligned(sizeof(void *));
 };
@@ -3698,6 +3725,10 @@ enum ieee80211_reconfig_type {
  *
  * @start_pmsr: start peer measurement (e.g. FTM) (this call can sleep)
  * @abort_pmsr: abort peer measurement (this call can sleep)
+ * @set_tid_config: TID specific configurations will be applied for a 
particular
+ * station when @sta is non-NULL. When @sta is NULL, then the configuration
+ * will be for all the connected clients in the vif.
+ * This callback may sleep.
  */
 struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw,
@@ -3990,6 +4021,10 @@ struct ieee80211_ops {
  struct cfg80211_pmsr_request *request);
void (*abort_pmsr)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
   struct cfg80211_pmsr_request *request);
+   int (*set_tid_config)(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta,
+ struct ieee80211_tid_config *tid_conf);
 };
 
 /**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 09dd1c2..7d9c44d 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3893,6 +3893,33 @@ static int ieee80211_get_txq_stats(struct wiphy *wiphy,
return drv_abort_pmsr(local, sdata, request);
 }
 
+static int ieee80211_set_tid_config(struct wiphy *wiphy,
+   struct net_device *dev,
+   struct ieee80211_tid_config *tid_conf)
+{
+   struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+   struct sta_info *sta;
+   int ret;
+
+   if (!sdata->local->ops->set_tid_config)
+   return -EOPNOTSUPP;
+
+   if (!tid_conf->peer)
+   return drv_set_tid_config(sdata->local, sdata, NULL, tid_conf);
+
+   mutex_lock(>local->sta_mtx);
+
+   sta = sta_info_get_bss(sdata, tid_conf->peer);
+   if (!sta) {
+   mutex_unlock(>local->sta_mtx);
+   return -ENOENT;
+   }
+
+   ret = drv_set_tid_config(sdata->local, sdata, >sta, tid_conf);
+   mutex_unlock(>local->sta_mtx);
+   return ret;
+}
+
 const struct cfg80211_ops mac80211_config_ops = {
.add_virtual_intf = ieee80211_add_iface,
.del_virtual_intf = ieee80211_del_iface,
@@ -3990,4 +4017,5 @@ 

[PATCHv2 9/9] ath10k: Add extended TID configuration support

2019-02-21 Thread Tamizh chelvam
This patch extend TID configuration support to configure
RTS_CTS control and TX rate limit. Tx rate limit is
similar to auto rate but it will be limited to the user
configured rate mask rather than the station's highest
supported rate mask. Here ext_tid_cfg_bitmap added
to notify the target which extended configuration
parameter has modified(here RTS_CTS).

WMI_10_4_SERVICE_EXT_PEER_TID_CONFIGS_SUPPORT service flag
introduced to advertise this support.

Testing:
* Tested HW: QCA9984
* Tested FW: 10.4-3.9.0.2-00021

Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/core.c |  4 +++
 drivers/net/wireless/ath/ath10k/mac.c  | 48 ++
 drivers/net/wireless/ath/ath10k/wmi.c  |  7 ++---
 drivers/net/wireless/ath/ath10k/wmi.h  | 20 ++
 4 files changed, 76 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index ac2cf3f..248709d 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -2623,6 +2623,10 @@ int ath10k_core_start(struct ath10k *ar, enum 
ath10k_firmware_mode mode,
if (test_bit(WMI_SERVICE_REPORT_AIRTIME, ar->wmi.svc_map))
val |= WMI_10_4_REPORT_AIRTIME;
 
+   if (test_bit(WMI_SERVICE_EXT_PEER_TID_CONFIGS_SUPPORT,
+ar->wmi.svc_map))
+   val |= WMI_10_4_EXT_PEER_TID_CONFIGS_SUPPORT;
+
status = ath10k_mac_ext_resource_config(ar, val);
if (status) {
ath10k_err(ar,
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 5ba399f..eccda87 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2950,6 +2950,12 @@ static int ath10k_new_peer_tid_config(struct ath10k *ar,
arg.aggr_control = vif->ampdu[i];
arg.rate_ctrl = vif->rate_ctrl[i];
arg.rcode_flags = vif->rate_code[i];
+   if (vif->rtscts[i])
+   arg.ext_tid_cfg_bitmap =
+   WMI_EXT_TID_RTS_CTS_CONFIG;
+   else
+   arg.ext_tid_cfg_bitmap = 0;
+   arg.rtscts_ctrl = vif->rtscts[i];
}
 
if (vif->noack[i]) {
@@ -6559,6 +6565,10 @@ static int ath10k_mac_validate_rate_mask(struct ath10k 
*ar,
 
if (txrate_type == NL80211_TX_RATE_FIXED)
*rate_ctrl = WMI_TID_CONFIG_RATE_CONTROL_FIXED_RATE;
+   else if (txrate_type == NL80211_TX_RATE_LIMITED &&
+(test_bit(WMI_SERVICE_EXT_PEER_TID_CONFIGS_SUPPORT,
+  ar->wmi.svc_map)))
+   *rate_ctrl = WMI_PEER_TID_CONFIG_RATE_UPPER_CAP;
else
return -EOPNOTSUPP;
return 0;
@@ -6625,6 +6635,14 @@ static int ath10k_mac_validate_rate_mask(struct ath10k 
*ar,
arg->rate_ctrl = 0;
}
}
+
+   if (changed & IEEE80211_TID_CONF_RTSCTS) {
+   if (tid_conf->rtscts)
+   arg->rtscts_ctrl = tid_conf->rtscts - 1;
+   else
+   arg->rtscts_ctrl = WMI_TID_CONFIG_RTSCTS_CONTROL_ENABLE;
+   arg->ext_tid_cfg_bitmap = WMI_EXT_TID_RTS_CTS_CONFIG;
+   }
 }
 
 static void ath10k_sta_tid_cfg_wk(struct work_struct *wk)
@@ -6699,6 +6717,18 @@ static void ath10k_sta_tid_cfg_wk(struct work_struct *wk)
}
}
 
+   if (changed & IEEE80211_TID_CONF_RTSCTS) {
+   if (sta->rtscts[i]) {
+   arg.rtscts_ctrl = 0;
+   arg.ext_tid_cfg_bitmap = 0;
+   } else {
+   arg.rtscts_ctrl = vif->rtscts[i] - 1;
+   arg.ext_tid_cfg_bitmap =
+   WMI_EXT_TID_RTS_CTS_CONFIG;
+   config_apply = true;
+   }
+   }
+
arg.tid = i;
 
if (config_apply) {
@@ -8375,6 +8405,13 @@ static int ath10k_mac_op_set_tid_config(struct 
ieee80211_hw *hw,
arg.rate_ctrl = 0;
arg.rcode_flags = 0;
}
+
+   if (changed & IEEE80211_TID_CONF_RTSCTS) {
+   sta->rtscts[arg.tid] =
+   tid_config->tid_conf[i].rtscts;
+   arg.rtscts_ctrl = 0;
+   arg.ext_tid_cfg_bitmap = 0;
+   }
} else {
arvif->tid_conf_changed[arg.tid] |= changed;
 
@@ -8391,6 +8428,10 @@ static int 

[PATCHv2 7/9] ath10k: Add wmi command support for station specific TID config

2019-02-21 Thread Tamizh chelvam
This patch adds WMI interface to configure station specific
TID configuration . Host needs to send station's MAC address
along with TID number and its configuration to target through
WMI_10_4_PER_PEER_PER_TID_CONFIG_CMDID.

WMI_SERVICE_PEER_TID_CONFIGS_SUPPORT flag is added to advertise
this support.

Testing:
   * Tested HW: QCA9888
   * Tested FW: 10.4-3.5.1-00052

Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/wmi-ops.h | 19 +++
 drivers/net/wireless/ath/ath10k/wmi.c | 32 +++
 drivers/net/wireless/ath/ath10k/wmi.h | 52 +++
 3 files changed, 103 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi-ops.h 
b/drivers/net/wireless/ath/ath10k/wmi-ops.h
index 1491c25..796badf 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-ops.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h
@@ -216,6 +216,8 @@ struct wmi_ops {
struct sk_buff *(*gen_bb_timing)
(struct ath10k *ar,
 const struct wmi_bb_timing_cfg_arg *arg);
+   struct sk_buff *(*gen_per_peer_per_tid_cfg)(struct ath10k *ar,
+   const struct wmi_per_peer_per_tid_cfg_arg *arg);
 
 };
 
@@ -1616,4 +1618,21 @@ struct wmi_ops {
return ath10k_wmi_cmd_send(ar, skb,
   ar->wmi.cmd->set_bb_timing_cmdid);
 }
+
+static inline int
+ath10k_wmi_set_per_peer_per_tid_cfg(struct ath10k *ar,
+   const struct wmi_per_peer_per_tid_cfg_arg *arg)
+{
+   struct sk_buff *skb;
+
+   if (!ar->wmi.ops->gen_per_peer_per_tid_cfg)
+   return -EOPNOTSUPP;
+
+   skb = ar->wmi.ops->gen_per_peer_per_tid_cfg(ar, arg);
+   if (IS_ERR(skb))
+   return PTR_ERR(skb);
+
+   return ath10k_wmi_cmd_send(ar, skb,
+  ar->wmi.cmd->per_peer_per_tid_config_cmdid);
+}
 #endif
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 97e5b2e..44b66f2 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -740,6 +740,7 @@
.tdls_peer_update_cmdid = WMI_10_4_TDLS_PEER_UPDATE_CMDID,
.tdls_set_offchan_mode_cmdid = WMI_10_4_TDLS_SET_OFFCHAN_MODE_CMDID,
.radar_found_cmdid = WMI_10_4_RADAR_FOUND_CMDID,
+   .per_peer_per_tid_config_cmdid = WMI_10_4_PER_PEER_PER_TID_CONFIG_CMDID,
 };
 
 /* MAIN WMI VDEV param map */
@@ -8862,6 +8863,36 @@ static u32 ath10k_wmi_prepare_peer_qos(u8 uapsd_queues, 
u8 sp)
 }
 
 static struct sk_buff *
+ath10k_wmi_10_4_gen_per_peer_per_tid_cfg(struct ath10k *ar,
+   const struct wmi_per_peer_per_tid_cfg_arg *arg)
+{
+   struct wmi_peer_per_tid_cfg_cmd *cmd;
+   struct sk_buff *skb;
+
+   skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
+   if (!skb)
+   return ERR_PTR(-ENOMEM);
+
+   memset(skb->data, 0, sizeof(*cmd));
+
+   cmd = (struct wmi_peer_per_tid_cfg_cmd *)skb->data;
+   cmd->vdev_id = cpu_to_le32(arg->vdev_id);
+   ether_addr_copy(cmd->peer_macaddr.addr, arg->peer_macaddr.addr);
+   cmd->tid = cpu_to_le32(arg->tid);
+   cmd->ack_policy = cpu_to_le32(arg->ack_policy);
+   cmd->aggr_control = cpu_to_le32(arg->aggr_control);
+   cmd->rate_control = cpu_to_le32(arg->rate_ctrl);
+   cmd->retry_count = cpu_to_le32(arg->retry_count);
+   cmd->rcode_flags = cpu_to_le32(arg->rcode_flags);
+
+   ath10k_dbg(ar, ATH10K_DBG_WMI,
+  "wmi noack tid %d vdev id %d ack_policy %d aggr %u rate_ctrl 
%u rcflag %u retry_count %d mac_addr %pM\n",
+  arg->tid, arg->vdev_id, arg->ack_policy, arg->aggr_control, 
arg->rate_ctrl,
+  arg->rcode_flags, arg->retry_count, arg->peer_macaddr.addr);
+   return skb;
+}
+
+static struct sk_buff *
 ath10k_wmi_op_gen_echo(struct ath10k *ar, u32 value)
 {
struct wmi_echo_cmd *cmd;
@@ -9270,6 +9301,7 @@ static u32 ath10k_wmi_prepare_peer_qos(u8 uapsd_queues, 
u8 sp)
.gen_pdev_get_tpc_table_cmdid =
ath10k_wmi_10_4_op_gen_pdev_get_tpc_table_cmdid,
.gen_radar_found = ath10k_wmi_10_4_gen_radar_found,
+   .gen_per_peer_per_tid_cfg = ath10k_wmi_10_4_gen_per_peer_per_tid_cfg,
 
/* shared with 10.2 */
.pull_echo_ev = ath10k_wmi_op_pull_echo_ev,
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index d9b646f..187c13e 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -200,6 +200,7 @@ enum wmi_service {
WMI_SERVICE_RTT_RESPONDER_ROLE,
WMI_SERVICE_PER_PACKET_SW_ENCRYPT,
WMI_SERVICE_REPORT_AIRTIME,
+   WMI_SERVICE_PEER_TID_CONFIGS_SUPPORT,
 
/* Remember to add the new value to wmi_service_name()! */
 
@@ -491,6 +492,7 @@ static inline char *wmi_service_name(enum wmi_service 
service_id)

[PATCHv2 3/9] nl80211: Add netlink attribute for AMPDU aggregation enable/disable

2019-02-21 Thread Tamizh chelvam
Introduce NL80211_ATTR_TID_CONFIG_AMPDU_CTRL in nl80211_attr_tid_config
to accept TID specific AMPDU aggregation enable/disable configuration
through NL80211_CMD_SET_TID_CONFIG command. TID for which the
aggregation control configuration is to be applied is passed in
NL80211_ATTR_TID_CONFIG_TID attribute. When the user-space wants this
configuration peer specific rather than being applied for all the
connected stations, MAC address of the peer can be passed in
NL80211_ATTR_MAC attribute.

Driver supporting this feature should advertise
NL80211_EXT_FEATURE_PER_TID_AMPDU_CTRL and supporting per-STA data TID
ampdu configuration should advertise NL80211_EXT_FEATURE_PER_STA_AMPDU_CTRL.

Signed-off-by: Tamizh chelvam 
---
 include/net/cfg80211.h   |  3 +++
 include/uapi/linux/nl80211.h | 22 ++
 net/wireless/nl80211.c   | 15 +++
 3 files changed, 40 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 55c4ddf..fcf33c9 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -512,6 +512,7 @@ struct cfg80211_chan_def {
 enum ieee80211_tid_conf_mask {
IEEE80211_TID_CONF_NOACK= BIT(0),
IEEE80211_TID_CONF_RETRY= BIT(1),
+   IEEE80211_TID_CONF_AMPDU= BIT(2),
 };
 
 /**
@@ -522,6 +523,7 @@ enum ieee80211_tid_conf_mask {
  * @noack: noack configuration value for the TID
  * @retry_long: retry count value
  * @retry_short: retry count value
+ * @ampdu: Enable/Disable aggregation
  */
 struct ieee80211_tid_cfg {
u8 tid;
@@ -529,6 +531,7 @@ struct ieee80211_tid_cfg {
u8 noack;
int retry_long;
int retry_short;
+   u8 ampdu;
 };
 
 /**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index f2ce845..f94651d 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -4615,6 +4615,21 @@ enum nl80211_tid_config {
  * the max value should be advertised by the driver through
  * max_data_retry_count. when this attribute is not present, the driver
  * would use the default configuration.
+ * @NL80211_ATTR_TID_CONFIG_AMPDU_CTRL: Enable/Disable aggregation for the TID
+ * specified in %%NL80211_ATTR_TID_CONFIG_TID. Its type is u8,
+ * if the peer MAC address is passed in %NL80211_ATTR_MAC, the aggregation
+ * configuration is applied
+ * to the data frame for the tid to that connected station.
+ * Station specific aggregation configuration is valid only for STA's
+ * current connection. i.e. the configuration will be reset to default when
+ * the station connects back after disconnection/roaming.
+ * when user-space does not include %NL80211_ATTR_MAC, this configuration
+ * should be treated as per-netdev configuration. This configuration will
+ * be cleared when the interface goes down and on the disconnection from a
+ * BSS. Driver supporting this feature should advertise
+ * NL80211_EXT_FEATURE_PER_TID_AMPDU_CTRL and supporting per station
+ * aggregation configuration should advertise
+ * NL80211_EXT_FEATURE_PER_STA_AMPDU_CTRL.
  */
 enum nl80211_attr_tid_config {
__NL80211_ATTR_TID_INVALID,
@@ -4623,6 +4638,7 @@ enum nl80211_attr_tid_config {
NL80211_ATTR_TID_CONFIG_RETRY,
NL80211_ATTR_TID_CONFIG_RETRY_SHORT,
NL80211_ATTR_TID_CONFIG_RETRY_LONG,
+   NL80211_ATTR_TID_CONFIG_AMPDU_CTRL,
 
/* keep last */
__NL80211_ATTR_TID_CONFIG_AFTER_LAST,
@@ -5437,6 +5453,10 @@ enum nl80211_feature_flags {
  * count functionality.
  * @NL80211_EXT_FEATURE_PER_STA_RETRY_CONFIG: Driver supports STA specific
  * data retry count functionality.
+ * @NL80211_EXT_FEATURE_PER_TID_AMPDU_CTRL: Driver supports TID specific
+ * aggregation control(enable/disable).
+ * @NL80211_EXT_FEATURE_PER_STA_AMPDU_CTRL: Driver supports per STA
+ * specific TID aggregation control(enable/disable).
  *
  * @NUM_NL80211_EXT_FEATURES: number of extended features.
  * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
@@ -5483,6 +5503,8 @@ enum nl80211_ext_feature_index {
NL80211_EXT_FEATURE_PER_STA_NOACK_CONFIG,
NL80211_EXT_FEATURE_PER_TID_RETRY_CONFIG,
NL80211_EXT_FEATURE_PER_STA_RETRY_CONFIG,
+   NL80211_EXT_FEATURE_PER_TID_AMPDU_CTRL,
+   NL80211_EXT_FEATURE_PER_STA_AMPDU_CTRL,
 
/* add new features before the definition below */
NUM_NL80211_EXT_FEATURES,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 998c9dc..d4a88fa 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -288,6 +288,8 @@ static int validate_ie_attr(const struct nlattr *attr,
[NL80211_ATTR_TID_CONFIG_RETRY] = { .type = NLA_FLAG },
[NL80211_ATTR_TID_CONFIG_RETRY_SHORT] = NLA_POLICY_MIN(NLA_U8, 1),
[NL80211_ATTR_TID_CONFIG_RETRY_LONG] = NLA_POLICY_MIN(NLA_U8, 1),
+   [NL80211_ATTR_TID_CONFIG_AMPDU_CTRL] =
+   NLA_POLICY_MAX(NLA_U8, 

[PATCHv2 2/9] nl80211: Add new netlink attribute for TID speicific retry count

2019-02-21 Thread Tamizh chelvam
This patch introduced below NL attributes to add support for
configuring data TID specific retry count

NL80211_ATTR_TID_CONFIG_RETRY
NL80211_ATTR_TID_CONFIG_RETRY_LONG
NL80211_ATTR_TID_CONFIG_RETRY_SHORT

These attributes are added in NL80211_ATTR_TID_CONFIG nested attribute.
This will be useful for the driver which supports data TID specific retry
count configuration rather using phy level retry configuration.
This TID specific retry configuration will have more precedence than
phy level configuration. This configuration can be applied for a
specific peer. To apply this configuration specific to a peer
rather than being applied for all the connected stations,
MAC address of the peer can be passed in NL80211_ATTR_MAC attribute.

Driver should advertise WIPHY_FLAG_HAS_MAX_DATA_RETRY_COUNT and
max_data_retry_count value to notify user space to avoid of passing
greater than the allowed limit.

Driver supporting TID specific retry configuration should advertise
NL80211_EXT_FEATURE_PER_TID_RETRY_CONFIG and per STA specific
data TID retry configuration should advertise
NL80211_EXT_FEATURE_PER_STA_RETRY_CONFIG.

Signed-off-by: Tamizh chelvam 
---
 include/net/cfg80211.h   | 11 ++
 include/uapi/linux/nl80211.h | 48 
 net/wireless/nl80211.c   | 34 +++
 3 files changed, 93 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 07eb2de..55c4ddf 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -511,6 +511,7 @@ struct cfg80211_chan_def {
 
 enum ieee80211_tid_conf_mask {
IEEE80211_TID_CONF_NOACK= BIT(0),
+   IEEE80211_TID_CONF_RETRY= BIT(1),
 };
 
 /**
@@ -519,11 +520,15 @@ enum ieee80211_tid_conf_mask {
  * @tid_conf_mask: bitmap indicating which parameter changed
  * see %enum ieee80211_tid_conf_mask
  * @noack: noack configuration value for the TID
+ * @retry_long: retry count value
+ * @retry_short: retry count value
  */
 struct ieee80211_tid_cfg {
u8 tid;
enum ieee80211_tid_conf_mask tid_conf_mask;
u8 noack;
+   int retry_long;
+   int retry_short;
 };
 
 /**
@@ -3832,6 +3837,7 @@ struct cfg80211_ops {
  * beaconing mode (AP, IBSS, Mesh, ...).
  * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation
  * before connection.
+ * @WIPHY_FLAG_HAS_MAX_DATA_RETRY_COUNT: Device supports data retry count call.
  */
 enum wiphy_flags {
/* use hole at 0 */
@@ -3858,6 +3864,7 @@ enum wiphy_flags {
WIPHY_FLAG_SUPPORTS_5_10_MHZ= BIT(22),
WIPHY_FLAG_HAS_CHANNEL_SWITCH   = BIT(23),
WIPHY_FLAG_HAS_STATIC_WEP   = BIT(24),
+   WIPHY_FLAG_HAS_MAX_DATA_RETRY_COUNT = BIT(25),
 };
 
 /**
@@ -4365,6 +4372,8 @@ struct cfg80211_pmsr_capabilities {
  * @support_mbssid must be set for this to have any effect.
  *
  * @pmsr_capa: peer measurement capabilities
+ * @max_data_retry_count: Maximum limit can be configured as retry count
+ * for a TID.
  */
 struct wiphy {
/* assign these fields before you register the wiphy */
@@ -4509,6 +4518,8 @@ struct wiphy {
 
const struct cfg80211_pmsr_capabilities *pmsr_capa;
 
+   u8 max_data_retry_count;
+
char priv[0] __aligned(NETDEV_ALIGN);
 };
 
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index c901a48..f2ce845 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2316,6 +2316,8 @@ enum nl80211_commands {
  *
  * @NL80211_ATTR_TID_CONFIG: TID specific configuration in a
  * nested attribute with %NL80211_ATTR_TID_* sub-attributes.
+ * @NL80211_ATTR_MAX_RETRY_COUNT: The upper limit for the retry count
+ * configuration that the driver can accept.
  *
  * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
@@ -2769,6 +2771,7 @@ enum nl80211_attrs {
NL80211_ATTR_AIRTIME_WEIGHT,
 
NL80211_ATTR_TID_CONFIG,
+   NL80211_ATTR_MAX_RETRY_COUNT,
 
/* add attributes here, update the policy in nl80211.c */
 
@@ -4576,11 +4579,50 @@ enum nl80211_tid_config {
  * advertise NL80211_EXT_FEATURE_PER_TID_NOACK_CONFIG and
  * NL80211_EXT_FEATURE_PER_STA_NOACK_CONFIG for supporting  per sta
  * configuration.
+ * @NL80211_ATTR_TID_CONFIG_RETRY: Data TID retry count should be applied
+ * with the value passed through %NL80211_ATTR_TID_CONFIG_RETRY_LONG
+ * and/or %NL80211_ATTR_TID_CONFIG_RETRY_SHORT. This configuration
+ * is per-TID, and the TID is specified with %NL80211_ATTR_TID_CONFIG_TID.
+ * If the peer MAC address is passed in %NL80211_ATTR_MAC, the retry
+ * configuration is applied to the data frame for the tid to that
+ * connected station.
+ * This attribute will be useful to notfiy the driver to apply default
+ * retry values for the connected station (%NL80211_ATTR_MAC), 

[PATCHv2 0/9] cfg80211/mac80211: Add support for TID specific configuration

2019-02-21 Thread Tamizh chelvam
Add infrastructure to support per TID configurations like noack policy,
retry count, AMPDU control(disable/enable), RTSCTS control(enable/disable)
and TX rate mask configurations.
This will be useful for the driver which can supports data TID
specific configuration rather than phy level configurations.
Here NL80211_CMD_SET_TID_CONFIG added to support this operation by
accepting TID configuration.
This command can accept STA mac addreess to make the configuration
station specific rather than applying to all the connected stations
to the netdev.
And this nested command configuration can accept multiple number of
data TID specific configuration in a single command,
enum ieee80211_tid_conf_mask used to notify the driver that which
configuration got modified for the TID.

Tamizh chelvam (9):
  nl80211: New netlink command for TID specific configuration
  nl80211: Add new netlink attribute for TID speicific retry count
  nl80211: Add netlink attribute for AMPDU aggregation enable/disable
  nl80211: Add netlink attribute to enable/disable RTS_CTS
  nl80211: Add netlink attribute to configure TID specific tx rate
  mac80211: Add api to support configuring TID specific configuration
  ath10k: Add wmi command support for station specific TID config
  ath10k: Add new api to support TID specific configuration
  ath10k: Add extended TID configuration support

v2:
  * Added support to accept multiple TID configuration
  * Added support to configure TX rate and RTSCTS control

 drivers/net/wireless/ath/ath10k/core.c|   4 +
 drivers/net/wireless/ath/ath10k/core.h|   7 +
 drivers/net/wireless/ath/ath10k/mac.c | 650 ++
 drivers/net/wireless/ath/ath10k/wmi-ops.h |  19 +
 drivers/net/wireless/ath/ath10k/wmi.c |  33 ++
 drivers/net/wireless/ath/ath10k/wmi.h |  72 
 include/net/cfg80211.h|  57 +++
 include/net/mac80211.h|  35 ++
 include/uapi/linux/nl80211.h  | 181 +
 net/mac80211/cfg.c|  28 ++
 net/mac80211/driver-ops.h |  15 +
 net/wireless/nl80211.c| 205 ++
 net/wireless/rdev-ops.h   |  11 +
 net/wireless/trace.h  |  18 +
 14 files changed, 1255 insertions(+), 80 deletions(-)

-- 
1.9.1


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


[PATCHv2 8/9] ath10k: Add new api to support TID specific configuration

2019-02-21 Thread Tamizh chelvam
This patch add ops for set_tid_config to support TID
specific configuration. STA information along with the
TID config change mask to notify driver that which configuration
needs to be applied for this current command.
If the STA info not available in the command then the
configuration will be applied for all connected stations
in the vif. TID specific noack configuration requires
aggregation disabled and rate for the data TID packets
should be basic rates. So, if the TID already configured
with noack policy then driver will ignore the aggregation
or TX rate related configuration for the same data TID.
In TX rate configuration should be applied with highest
preamble configuration(HT rates should not be applied
for the station which supports vht rates).

Vif specific TID configuration will be applied for all
the connected stations except for the station which
already applied with the same configuration for the TID
through station specific command. Newly connecting stations
will be applied with vif TID configuration which will be stored
in ieee80211_vif.

Testing:
* Tested HW: QCA9888
* Tested FW: 10.4-3.5.1-00052

Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/core.h |   7 +
 drivers/net/wireless/ath/ath10k/mac.c  | 602 -
 2 files changed, 529 insertions(+), 80 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 27ec555..c25c426 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -82,6 +82,9 @@
 /* Default Airtime weight multipler (Tuned for multiclient performance) */
 #define ATH10K_AIRTIME_WEIGHT_MULTIPLIER  4
 
+#define ATH10K_MAX_RETRY_COUNT 30
+#define ATH10K_MAX_TIDS8
+
 struct ath10k;
 
 static inline const char *ath10k_bus_str(enum ath10k_bus bus)
@@ -504,6 +507,7 @@ struct ath10k_sta {
 #endif
/* Protected with ar->data_lock */
u32 peer_ps_state;
+   struct work_struct tid_config_wk;
 };
 
 #define ATH10K_VDEV_SETUP_TIMEOUT_HZ (5 * HZ)
@@ -571,6 +575,9 @@ struct ath10k_vif {
struct work_struct ap_csa_work;
struct delayed_work connection_loss_work;
struct cfg80211_bitrate_mask bitrate_mask;
+   u32 tid_conf_changed[ATH10K_MAX_TIDS];
+
+   struct ieee80211_tid_config *tid_config;
 };
 
 struct ath10k_vif_iter {
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index b73c23d..5ba399f 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2930,6 +2930,58 @@ static void ath10k_bss_disassoc(struct ieee80211_hw *hw,
cancel_delayed_work_sync(>connection_loss_work);
 }
 
+static int ath10k_new_peer_tid_config(struct ath10k *ar,
+ struct ieee80211_sta *sta,
+ struct ath10k_vif *arvif)
+{
+   struct wmi_per_peer_per_tid_cfg_arg arg = {};
+   struct ieee80211_vif *vif = arvif->vif;
+   bool config_apply;
+   int ret, i;
+
+   for (i = 0; i < ATH10K_MAX_TIDS; i++) {
+   config_apply = false;
+   if (vif->retry_long[i] || vif->ampdu[i] ||
+   vif->rate_code[i]) {
+   config_apply = true;
+   arg.tid = i;
+   arg.vdev_id = arvif->vdev_id;
+   arg.retry_count = vif->retry_long[i];
+   arg.aggr_control = vif->ampdu[i];
+   arg.rate_ctrl = vif->rate_ctrl[i];
+   arg.rcode_flags = vif->rate_code[i];
+   }
+
+   if (vif->noack[i]) {
+   arg.ack_policy  = vif->noack[i];
+   arg.rate_ctrl =
+   WMI_TID_CONFIG_RATE_CONTROL_DEFAULT_LOWEST_RATE;
+   arg.aggr_control = WMI_TID_CONFIG_AGGR_CONTROL_DISABLE;
+   config_apply = true;
+   }
+
+   /* Assign default value(-1) to newly connected station.
+* This is to identify station specific tid configuration not
+* configured for the station.
+*/
+   sta->retry_long[i] = -1;
+   sta->noack[i] = -1;
+
+   if (!config_apply)
+   continue;
+
+   ether_addr_copy(arg.peer_macaddr.addr, sta->addr);
+   ret = ath10k_wmi_set_per_peer_per_tid_cfg(ar, );
+   if (ret) {
+   ath10k_warn(ar, "failed to set per tid retry/aggr 
config for sta %pM: %d\n",
+   sta->addr, ret);
+   return ret;
+   }
+   memset(, 0, sizeof(arg));
+   }
+   return 0;
+}
+
 static int ath10k_station_assoc(struct ath10k *ar,
struct ieee80211_vif *vif,
struct 

[PATCHv2 4/9] nl80211: Add netlink attribute to enable/disable RTS_CTS

2019-02-21 Thread Tamizh chelvam
Introduce NL80211_ATTR_TID_CONFIG_RTSCTS_CTRL in nl80211_attr_tid_config
to accept TID specific RTS_CTS enable/disable configuration
through NL80211_CMD_SET_TID_CONFIG command. TID for which the
RTS_CTS control configuration is to be applied is passed in
NL80211_ATTR_TID_CONFIG_TID attribute. When the user-space wants this
configuration peer specific rather than being applied for all the
connected stations, MAC address of the peer can be passed in
NL80211_ATTR_MAC attribute.

Driver supporting this feature should advertise
NL80211_EXT_FEATURE_PER_TID_RTSCTS_CTRL and supporting per-STA data TID
RTS_CTS configuration should advertise NL80211_EXT_FEATURE_PER_STA_RTSCTS_CTRL.

Signed-off-by: Tamizh chelvam 
---
 include/net/cfg80211.h   |  3 +++
 include/uapi/linux/nl80211.h | 22 ++
 net/wireless/nl80211.c   | 17 +
 3 files changed, 42 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index fcf33c9..cf4a3f0 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -513,6 +513,7 @@ enum ieee80211_tid_conf_mask {
IEEE80211_TID_CONF_NOACK= BIT(0),
IEEE80211_TID_CONF_RETRY= BIT(1),
IEEE80211_TID_CONF_AMPDU= BIT(2),
+   IEEE80211_TID_CONF_RTSCTS   = BIT(3),
 };
 
 /**
@@ -524,6 +525,7 @@ enum ieee80211_tid_conf_mask {
  * @retry_long: retry count value
  * @retry_short: retry count value
  * @ampdu: Enable/Disable aggregation
+ * @rtscts: Enable/Disable RTS/CTS
  */
 struct ieee80211_tid_cfg {
u8 tid;
@@ -532,6 +534,7 @@ struct ieee80211_tid_cfg {
int retry_long;
int retry_short;
u8 ampdu;
+   u8 rtscts;
 };
 
 /**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index f94651d..996b4d4 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -4630,6 +4630,21 @@ enum nl80211_tid_config {
  * NL80211_EXT_FEATURE_PER_TID_AMPDU_CTRL and supporting per station
  * aggregation configuration should advertise
  * NL80211_EXT_FEATURE_PER_STA_AMPDU_CTRL.
+ * @NL80211_ATTR_TID_CONFIG_RTSCTS_CTRL: Enable/Disable RTS_CTS for the TID
+ * specified in %%NL80211_ATTR_TID_CONFIG_TID. It is u8 type, if the
+ * peer MAC address is passed in %NL80211_ATTR_MAC, then this
+ * configuration is applied to the data frame for the tid to that
+ * connected station.
+ * Station specific RTS_CTS configuration is valid only for STA's
+ * current connection. i.e. the configuration will be reset to default when
+ * the station connects back after disconnection/roaming.
+ * when user-space does not include %NL80211_ATTR_MAC, this configuration
+ * should be treated as per-netdev configuration. This configuration will
+ * be cleared when the interface goes down and on the disconnection from a
+ * BSS. Driver supporting this feature should advertise
+ * NL80211_EXT_FEATURE_PER_TID_RTSCTS_CTRL and supporting per station
+ * RTS_CTS configuration should advertise
+ * NL80211_EXT_FEATURE_PER_STA_RTSCTS_CTRL.
  */
 enum nl80211_attr_tid_config {
__NL80211_ATTR_TID_INVALID,
@@ -4639,6 +4654,7 @@ enum nl80211_attr_tid_config {
NL80211_ATTR_TID_CONFIG_RETRY_SHORT,
NL80211_ATTR_TID_CONFIG_RETRY_LONG,
NL80211_ATTR_TID_CONFIG_AMPDU_CTRL,
+   NL80211_ATTR_TID_CONFIG_RTSCTS_CTRL,
 
/* keep last */
__NL80211_ATTR_TID_CONFIG_AFTER_LAST,
@@ -5457,6 +5473,10 @@ enum nl80211_feature_flags {
  * aggregation control(enable/disable).
  * @NL80211_EXT_FEATURE_PER_STA_AMPDU_CTRL: Driver supports per STA
  * specific TID aggregation control(enable/disable).
+ * @NL80211_EXT_FEATURE_PER_TID_RTSCTS_CTRL: Driver supports TID specific
+ * RTS_CTS control(enable/disable).
+ * @NL80211_EXT_FEATURE_PER_STA_RTSCTS_CTRL: Driver supports STA specific
+ * RTS_CTS control(enable/disable).
  *
  * @NUM_NL80211_EXT_FEATURES: number of extended features.
  * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
@@ -5505,6 +5525,8 @@ enum nl80211_ext_feature_index {
NL80211_EXT_FEATURE_PER_STA_RETRY_CONFIG,
NL80211_EXT_FEATURE_PER_TID_AMPDU_CTRL,
NL80211_EXT_FEATURE_PER_STA_AMPDU_CTRL,
+   NL80211_EXT_FEATURE_PER_TID_RTSCTS_CTRL,
+   NL80211_EXT_FEATURE_PER_STA_RTSCTS_CTRL,
 
/* add new features before the definition below */
NUM_NL80211_EXT_FEATURES,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index d4a88fa..cd1e1e8 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -290,6 +290,8 @@ static int validate_ie_attr(const struct nlattr *attr,
[NL80211_ATTR_TID_CONFIG_RETRY_LONG] = NLA_POLICY_MIN(NLA_U8, 1),
[NL80211_ATTR_TID_CONFIG_AMPDU_CTRL] =
NLA_POLICY_MAX(NLA_U8, NL80211_TID_CONFIG_DISABLE),
+   [NL80211_ATTR_TID_CONFIG_RTSCTS_CTRL] =
+   NLA_POLICY_MAX(NLA_U8, NL80211_TID_CONFIG_DISABLE),
 

[PATCHv2 5/9] nl80211: Add netlink attribute to configure TID specific tx rate

2019-02-21 Thread Tamizh chelvam
Introduce NL80211_ATTR_TID_CONFIG_TX_RATES in nl80211_attr_tid_config
to accept data TID specific TX bitrate configuration
through NL80211_CMD_SET_TID_CONFIG command. TID for which the
this configuration is to be applied is passed in
NL80211_ATTR_TID_CONFIG_TID attribute. TX bitrate mask values passed
in NL80211_ATTR_TX_RATES attribute and NL80211_ATTR_TID_CONFIG_TX_RATES
attribute will have types of the TX rate should be applied.
When the user-space wants this configuration peer specific
rather than being applied for all the connected stations,
MAC address of the peer can be passed in NL80211_ATTR_MAC attribute.
NL80211_ATTR_TX_RATES attribute can hold single value at a time, so the
TX bitrate configuration can be set one TID at a time.

Driver supporting this feature should advertise
NL80211_EXT_FEATURE_PER_TID_TX_BITRATE_MASK and supporting per-STA data TID
TX bitrate configuration should advertise
NL80211_EXT_FEATURE_PER_STA_TX_BITRATE_MASK.

Signed-off-by: Tamizh chelvam 
---
 include/net/cfg80211.h   |  5 +
 include/uapi/linux/nl80211.h | 38 ++
 net/wireless/nl80211.c   | 41 +++--
 3 files changed, 82 insertions(+), 2 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index cf4a3f0..713de1e 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -514,6 +514,7 @@ enum ieee80211_tid_conf_mask {
IEEE80211_TID_CONF_RETRY= BIT(1),
IEEE80211_TID_CONF_AMPDU= BIT(2),
IEEE80211_TID_CONF_RTSCTS   = BIT(3),
+   IEEE80211_TID_CONF_TX_BITRATE   = BIT(4),
 };
 
 /**
@@ -526,6 +527,8 @@ enum ieee80211_tid_conf_mask {
  * @retry_short: retry count value
  * @ampdu: Enable/Disable aggregation
  * @rtscts: Enable/Disable RTS/CTS
+ * @txrate_type: TX bitrate mask type
+ * @mask: bitrate to be applied for the TID
  */
 struct ieee80211_tid_cfg {
u8 tid;
@@ -535,6 +538,8 @@ struct ieee80211_tid_cfg {
int retry_short;
u8 ampdu;
u8 rtscts;
+   enum nl80211_tx_rate_setting txrate_type;
+   struct cfg80211_bitrate_mask *mask;
 };
 
 /**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 996b4d4..9a6f63e 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -4557,6 +4557,18 @@ enum nl80211_tx_power_setting {
NL80211_TX_POWER_FIXED,
 };
 
+/**
+ * enum nl80211_tx_rate_setting - TX rate configuration type
+ * @NL80211_TX_RATE_AUTOMATIC: automatically determine TX rate
+ * @NL80211_TX_RATE_LIMITED: limit the TX rate by the TX rate parameter
+ * @NL80211_TX_RATE_FIXED: fix TX rate to the TX rate parameter
+ */
+enum nl80211_tx_rate_setting {
+   NL80211_TX_RATE_AUTOMATIC,
+   NL80211_TX_RATE_LIMITED,
+   NL80211_TX_RATE_FIXED,
+};
+
 enum nl80211_tid_config {
NL80211_TID_CONFIG_DEFAULT,
NL80211_TID_CONFIG_ENABLE,
@@ -4645,6 +4657,25 @@ enum nl80211_tid_config {
  * NL80211_EXT_FEATURE_PER_TID_RTSCTS_CTRL and supporting per station
  * RTS_CTS configuration should advertise
  * NL80211_EXT_FEATURE_PER_STA_RTSCTS_CTRL.
+ * @NL80211_ATTR_TID_CONFIG_TX_RATES: Data frame TX rate mask should be applied
+ * with the parameters passed through %NL80211_ATTR_TX_RATES. This
+ * configuration is per TID, TID is specified with
+ * %NL80211_ATTR_TID_CONFIG_TID.
+ * If the peer MAC address is passed in %NL80211_ATTR_MAC, then this
+ * configuration is applied to the data frame for the tid to that connected
+ * station. This attribute will be useful to notfiy the driver that what
+ * type of txrate should be applied(%enum enum nl80211_tx_rate_setting)
+ * for the connected station (%NL80211_ATTR_MAC),
+ * Station specific retry configuration is valid only for STA's
+ * current connection. i.e. the configuration will be reset to default when
+ * the station connects back after disconnection/roaming.
+ * when user-space does not include %NL80211_ATTR_MAC, this configuration
+ * should be treated as per-netdev configuration. This configuration will
+ * be cleared when the interface goes down and on the disconnection from a
+ * BSS. Driver supporting this feature should advertise
+ * NL80211_EXT_FEATURE_PER_TID_TX_BITRATE_MASK and supporting per station
+ * TX bitrate configuration should advertise
+ * NL80211_EXT_FEATURE_PER_STA_TX_BITRATE_MASK.
  */
 enum nl80211_attr_tid_config {
__NL80211_ATTR_TID_INVALID,
@@ -4655,6 +4686,7 @@ enum nl80211_attr_tid_config {
NL80211_ATTR_TID_CONFIG_RETRY_LONG,
NL80211_ATTR_TID_CONFIG_AMPDU_CTRL,
NL80211_ATTR_TID_CONFIG_RTSCTS_CTRL,
+   NL80211_ATTR_TID_CONFIG_TX_RATES,
 
/* keep last */
__NL80211_ATTR_TID_CONFIG_AFTER_LAST,
@@ -5477,6 +5509,10 @@ enum nl80211_feature_flags {
  * RTS_CTS control(enable/disable).
  * @NL80211_EXT_FEATURE_PER_STA_RTSCTS_CTRL: Driver supports STA 

[PATCHv2 1/9] nl80211: New netlink command for TID specific configuration

2019-02-21 Thread Tamizh chelvam
Add a new NL command, NL80211_CMD_SET_TID_CONFIG to support
data TID specific configuration. This per TID configurations
are passed in NL80211_ATTR_TID_CONFIG which is a nested
attribute. This patch adds support to configure per TID
noack policy through NL80211_ATTR_TID_CONFIG_NOACK attribute.
Data TID value for this configuration will be passed through
NL80211_ATTR_TID_CONFIG_TID attribute. When the user-space wants
this configuration peer specific rather than being applied for
all the connected stations, MAC address of the peer can be passed
in NL80211_ATTR_MAC attribute. This patch introduced
enum ieee80211_tid_conf_mask to notify the driver that which
configuration modified.
Driver supporting data TID specific noack policy configuration
should be advertise through NL80211_EXT_FEATURE_PER_TID_NOACK_CONFIG
and supporting per STA data TID noack policy configuration
should be advertise through NL80211_EXT_FEATURE_PER_STA_NOACK_CONFIG

Signed-off-by: Tamizh chelvam 
---
 include/net/cfg80211.h   |  35 +++
 include/uapi/linux/nl80211.h |  51 ++
 net/wireless/nl80211.c   | 102 +++
 net/wireless/rdev-ops.h  |  11 +
 net/wireless/trace.h |  18 
 5 files changed, 217 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index f81677f..07eb2de 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -509,6 +509,35 @@ struct cfg80211_chan_def {
u32 center_freq2;
 };
 
+enum ieee80211_tid_conf_mask {
+   IEEE80211_TID_CONF_NOACK= BIT(0),
+};
+
+/**
+ * struct ieee80211_tid_cfg - TID specific configuration
+ * @tid: TID number
+ * @tid_conf_mask: bitmap indicating which parameter changed
+ * see %enum ieee80211_tid_conf_mask
+ * @noack: noack configuration value for the TID
+ */
+struct ieee80211_tid_cfg {
+   u8 tid;
+   enum ieee80211_tid_conf_mask tid_conf_mask;
+   u8 noack;
+};
+
+/**
+ * struct ieee80211_tid_config - TID configuration
+ * @peer: Station's MAC address
+ * @n_tid_conf: Number of TID specific configurations to be applied
+ * @tid_conf: Configuration change info
+ */
+struct ieee80211_tid_config {
+   const u8 *peer;
+   u32 n_tid_conf;
+   struct ieee80211_tid_cfg tid_conf[];
+};
+
 /**
  * cfg80211_get_chandef_type - return old channel type from chandef
  * @chandef: the channel definition
@@ -3436,6 +3465,10 @@ struct cfg80211_pmsr_request {
  * Statistics should be cumulative, currently no way to reset is provided.
  * @start_pmsr: start peer measurement (e.g. FTM)
  * @abort_pmsr: abort peer measurement
+ * @set_tid_config: TID specific configuration. Apply this configuration for
+ * all the connected stations in the BSS if peer is NULL. Otherwise
+ * apply this configuration to the specific station.
+ * This callback may sleep.
  */
 struct cfg80211_ops {
int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -3750,6 +3783,8 @@ struct cfg80211_ops {
  struct cfg80211_pmsr_request *request);
void(*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
  struct cfg80211_pmsr_request *request);
+   int (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev,
+ struct ieee80211_tid_config *tid_conf);
 };
 
 /*
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index dd4f86e..c901a48 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -1065,6 +1065,10 @@
  * indicated by %NL80211_ATTR_WIPHY_FREQ and other attributes
  * determining the width and type.
  *
+ * @NL80211_CMD_SET_TID_CONFIG: Data frame TID specific configuration
+ * is passed through this command using %NL80211_ATTR_TID_CONFIG
+ * nested attributes.
+ *
  * @NL80211_CMD_MAX: highest used command number
  * @__NL80211_CMD_AFTER_LAST: internal use
  */
@@ -1285,6 +1289,8 @@ enum nl80211_commands {
 
NL80211_CMD_NOTIFY_RADAR,
 
+   NL80211_CMD_SET_TID_CONFIG,
+
/* add new commands above here */
 
/* used to define NL80211_CMD_MAX below */
@@ -2308,6 +2314,9 @@ enum nl80211_commands {
  * @NL80211_ATTR_AIRTIME_WEIGHT: Station's weight when scheduled by the airtime
  * scheduler.
  *
+ * @NL80211_ATTR_TID_CONFIG: TID specific configuration in a
+ * nested attribute with %NL80211_ATTR_TID_* sub-attributes.
+ *
  * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2759,6 +2768,8 @@ enum nl80211_attrs {
 
NL80211_ATTR_AIRTIME_WEIGHT,
 
+   NL80211_ATTR_TID_CONFIG,
+
/* add attributes here, update the policy in nl80211.c */
 
__NL80211_ATTR_AFTER_LAST,
@@ -4543,6 +4554,39 @@ enum nl80211_tx_power_setting {
NL80211_TX_POWER_FIXED,
 };
 
+enum 

Re: [PATCH v2 2/2] ath10k: Set sk_pacing_shift to 6 for 11AC WiFi chips

2019-02-21 Thread Toke Høiland-Jørgensen
Ben Greear  writes:

> On 2/21/19 9:15 AM, Toke Høiland-Jørgensen wrote:
>> Ben Greear  writes:
>> 
>>> On 2/21/19 8:37 AM, Toke Høiland-Jørgensen wrote:
 Ben Greear  writes:

> On 2/21/19 8:10 AM, Kalle Valo wrote:
>> Toke Høiland-Jørgensen  writes:
>>
>>> Grant Grundler  writes:
>>>
 On Thu, Sep 6, 2018 at 3:18 AM Toke Høiland-Jørgensen  
 wrote:
>
> Grant Grundler  writes:
>
>>> And, well, Grant's data is from a single test in a noisy
>>> environment where the time series graph shows that throughput is 
>>> all over
>>> the place for the duration of the test; so it's hard to draw solid
>>> conclusions from (for instance, for the 5-stream test, the average
>>> throughput for 6 is 331 and 379 Mbps for the two repetitions, and 
>>> for 7
>>> it's 326 and 371 Mbps) . Unfortunately I don't have the same 
>>> hardware
>>> used in this test, so I can't go verify it myself; so the only 
>>> thing I
>>> can do is grumble about it here... :)
>>
>> It's a fair complaint and I agree with it. My counter argument is the
>> opposite is true too: most ideal benchmarks don't measure what most
>> users see. While the data wgong provided are way more noisy than I
>> like, my overall "confidence" in the "conclusion" I offered is still
>> positive.
>
> Right. I guess I would just prefer a slightly more comprehensive
> evaluation to base a 4x increase in buffer size on...

 Kalle, is this why you didn't accept this patch? Other reasons?

 Toke, what else would you like to see evaluated?

 I generally want to see three things measured when "benchmarking"
 technologies: throughput, latency, cpu utilization
 We've covered those three I think "reasonably".
>>>
>>> Hmm, going back and looking at this (I'd completely forgotten about this
>>> patch), I think I had two main concerns:
>>>
>>> 1. What happens in a degraded signal situation, where the throughput is
>>>   limited by the signal conditions, or by contention with other 
>>> devices.
>>>   Both of these happen regularly, and I worry that latency will be
>>>   badly affected under those conditions.
>>>
>>> 2. What happens with old hardware that has worse buffer management in
>>>   the driver->firmware path (especially drivers without push/pull 
>>> mode
>>>   support)? For these, the lower-level queueing structure is less
>>>   effective at controlling queueing latency.
>>
>> Do note that this patch changes behaviour _only_ for QCA6174 and QCA9377
>> PCI devices, which IIRC do not even support push/pull mode. All the
>> rest, including QCA988X and QCA9984 are unaffected.
>
> Just as a note, at least kernels such as 4.14.whatever perform poorly when
> running ath10k on 9984 when acting as TCP endpoints.  This makes them not
> really usable for stuff like serving video to lots of clients.
>
> Tweaking TCP (I do it a bit differently, but either way) can significantly
> improve performance.

 Differently how? Did you have to do more than fiddle with the pacing_shift?
>>>
>>> This one, or a slightly tweaked version that applies to different kernels:
>>>
>>> https://github.com/greearb/linux-ct-4.16/commit/3e14e8491a5b31ce994fb2752347145e6ab7eaf5
>> 
>> Right; but the current mac80211 default (pacing shift 8) corresponds to
>> setting your sysctl to 4...
>> 
> Recently I helped a user that could get barely 70 stations streaming
> at 1Mbps on stock kernel (using one wave1 on 2.4, one wave-2 on 5Ghz),
> and we got 110 working with a tweaked TCP stack. These were /n
> stations too.
>
> I think it is lame that it _still_ requires out of tree patches to
> make TCP work well on ath10k...even if you want to default to current
> behaviour, you should allow users to tweak it to work with their use
> case.

 Well if TCP is broken to the point of being unusable I do think we
 should fix it; but I think "just provide a configuration knob" should be
 the last resort...
>>>
>>> So, it has been broken for years, and waiting for a perfect solution
>>> has not gotten the problem fixed.
>> 
>> Well, the current default should at least be closer to something that
>> works well.
>> 
>> I do think I may have erred on the wrong side of the optimum when I
>> submitted the original patch to set the default to 8; that should
>> probably have been 7 (i.e., 8 ms; the optimum in the evaluation we did
>> was around 6 ms, which is sadly not a power of two). Maybe changing that
>> default is actually better than having to redo the testing for all the
>> different devices as we're discussing in the context of this patch.
>> Maybe I 

ACS scans not returning noise floor

2019-02-21 Thread Justin Capella
I'm using the firmware from ~2 days ago, and ath10k_wmi_pull_ch_info
seems to be returning -EPROTO. I have no idea what I'm doing, but I
notice there is a default noise floor in one of the headers, perhaps
this could be used somewhere? I'm encountering this becuase hostapd is
complaining that the ACS survey does not contain enough info.

[ 1261.111452] ath10k_pci :01:00.0: pci rx ce pipe 5 len 28
[ 1261.111457] ath10k_pci :01:00.0: pci rx: : 01 00 14 00
00 05 00 00 0f 00 00 00 50 14 00 00  P...
[ 1261.111460] ath10k_pci :01:00.0: pci rx: 0010: 50 14 00 00
00 00 00 00 00 00 00 00  P...
[ 1261.111464] ath10k_pci :01:00.0: htt rx, msg_type: 0xF
[ 1261.111469] ath10k_pci :01:00.0: htt chan change freq 5200 phymode 11a
[ 1261.115411] ath10k_pci :01:00.0: pci rx ce pipe 2 len 36
[ 1261.115419] ath10k_pci :01:00.0: pci rx: : 02 00 1c 00
00 06 00 00 00 90 00 00 08 00 00 00  
[ 1261.115424] ath10k_pci :01:00.0: pci rx: 0010: 03 00 00 00
50 14 00 00 01 a0 00 00 00 a0 00 00  P...
[ 1261.115427] ath10k_pci :01:00.0: pci rx: 0020: 00 00 00 00

[ 1261.115432] ath10k_pci :01:00.0: htc rx completion ep 2 skb
63dc45b6
[ 1261.115439] ath10k_pci :01:00.0: scan event foreign channel
type 8 reason 3 freq 5200 req_id 40961 scan_id 40960 vdev_id 0 state
running (2)
[ 1261.115448] ath10k_pci :01:00.0: pci rx ce pipe 2 len 40
[ 1261.115452] ath10k_pci :01:00.0: pci rx: : 02 00 20 00
00 07 00 00 0c 90 00 00 00 00 00 00  .. .
[ 1261.115456] ath10k_pci :01:00.0: pci rx: 0010: 50 14 00 00
00 00 00 00 00 00 00 00 a3 43 33 00  PC3.
[ 1261.115459] ath10k_pci :01:00.0: pci rx: 0020: c8 67 4a 01
e8 90 16 00  .gJ.
[ 1261.115463] ath10k_pci :01:00.0: htc rx completion ep 2 skb
b2b31359

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