Re: [PATCH] wcn36xx: Remove unnecessary rcu_read_unlock in wcn36xx_bss_info_changed

2017-10-10 Thread Bjorn Andersson
On Sun 08 Oct 06:06 PDT 2017, Jia-Ju Bai wrote:

> No rcu_read_lock is called, but rcu_read_unlock is still called.
> Thus rcu_read_unlock should be removed.
> 

Thanks, not sure how I could miss that one. Kalle can you please include
this in a v4.14-rc pull request?


:

Fixes: 39efc7cc7ccf ("wcn36xx: Introduce mutual exclusion of fw configuration")

> Signed-off-by: Jia-Ju Bai 

Acked-by: Bjorn Andersson 

Regards,
Bjorn

> ---
>  drivers/net/wireless/ath/wcn36xx/main.c |1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
> b/drivers/net/wireless/ath/wcn36xx/main.c
> index 35bd50b..b83f01d 100644
> --- a/drivers/net/wireless/ath/wcn36xx/main.c
> +++ b/drivers/net/wireless/ath/wcn36xx/main.c
> @@ -812,7 +812,6 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw 
> *hw,
>   if (!sta) {
>   wcn36xx_err("sta %pM is not found\n",
> bss_conf->bssid);
> - rcu_read_unlock();
>   goto out;
>   }
>   sta_priv = wcn36xx_sta_to_priv(sta);
> -- 
> 1.7.9.5
> 
> 
> 
> ___
> wcn36xx mailing list
> wcn3...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/wcn36xx


[PATCH v3] mac80211: aead api to reduce redundancy

2017-10-10 Thread Xiang Gao
Currently, the aes_ccm.c and aes_gcm.c are almost line by line copy of
each other. This patch reduce code redundancy by moving the code in these
two files to crypto/aead_api.c to make it a higher level aead api. The
file aes_ccm.c and aes_gcm.c are removed and all the functions there are
now implemented in their headers using the newly added aead api.

Signed-off-by: Xiang Gao 
---
 net/mac80211/Makefile  |   3 +-
 net/mac80211/{aes_ccm.c => aead_api.c} |  40 ++--
 net/mac80211/aead_api.h|  27 
 net/mac80211/aes_ccm.h |  42 +
 net/mac80211/aes_gcm.c | 109 -
 net/mac80211/aes_gcm.h |  38 +---
 net/mac80211/wpa.c |   4 +-
 7 files changed, 111 insertions(+), 152 deletions(-)
 rename net/mac80211/{aes_ccm.c => aead_api.c} (67%)
 create mode 100644 net/mac80211/aead_api.h
 delete mode 100644 net/mac80211/aes_gcm.c

diff --git a/net/mac80211/Makefile b/net/mac80211/Makefile
index 282912245938..80f25ff2f24b 100644
--- a/net/mac80211/Makefile
+++ b/net/mac80211/Makefile
@@ -6,6 +6,7 @@ mac80211-y := \
driver-ops.o \
sta_info.o \
wep.o \
+   aead_api.o \
wpa.o \
scan.o offchannel.o \
ht.o agg-tx.o agg-rx.o \
@@ -15,8 +16,6 @@ mac80211-y := \
rate.o \
michael.o \
tkip.o \
-   aes_ccm.o \
-   aes_gcm.o \
aes_cmac.o \
aes_gmac.o \
fils_aead.o \
diff --git a/net/mac80211/aes_ccm.c b/net/mac80211/aead_api.c
similarity index 67%
rename from net/mac80211/aes_ccm.c
rename to net/mac80211/aead_api.c
index a4e0d59a40dd..cc48675ba742 100644
--- a/net/mac80211/aes_ccm.c
+++ b/net/mac80211/aead_api.c
@@ -1,4 +1,5 @@
 /*
+ * Copyright 2014-2015, Qualcomm Atheros, Inc.
  * Copyright 2003-2004, Instant802 Networks, Inc.
  * Copyright 2005-2006, Devicescape Software, Inc.
  *
@@ -12,30 +13,29 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
-#include 
-#include "key.h"
-#include "aes_ccm.h"
+#include "aead_api.h"
 
-int ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
- u8 *data, size_t data_len, u8 *mic,
- size_t mic_len)
+int aead_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad, size_t aad_len,
+u8 *data, size_t data_len, u8 *mic)
 {
+   size_t mic_len = tfm->authsize;
struct scatterlist sg[3];
struct aead_request *aead_req;
int reqsize = sizeof(*aead_req) + crypto_aead_reqsize(tfm);
u8 *__aad;
 
-   aead_req = kzalloc(reqsize + CCM_AAD_LEN, GFP_ATOMIC);
+   aead_req = kzalloc(reqsize + aad_len, GFP_ATOMIC);
if (!aead_req)
return -ENOMEM;
 
__aad = (u8 *)aead_req + reqsize;
-   memcpy(__aad, aad, CCM_AAD_LEN);
+   memcpy(__aad, aad, aad_len);
 
sg_init_table(sg, 3);
-   sg_set_buf(&sg[0], &__aad[2], be16_to_cpup((__be16 *)__aad));
+   sg_set_buf(&sg[0], __aad, aad_len);
sg_set_buf(&sg[1], data, data_len);
sg_set_buf(&sg[2], mic, mic_len);
 
@@ -49,10 +49,10 @@ int ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 
*b_0, u8 *aad,
return 0;
 }
 
-int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
- u8 *data, size_t data_len, u8 *mic,
- size_t mic_len)
+int aead_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad, size_t aad_len,
+u8 *data, size_t data_len, u8 *mic)
 {
+   size_t mic_len = tfm->authsize;
struct scatterlist sg[3];
struct aead_request *aead_req;
int reqsize = sizeof(*aead_req) + crypto_aead_reqsize(tfm);
@@ -62,15 +62,15 @@ int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 
*b_0, u8 *aad,
if (data_len == 0)
return -EINVAL;
 
-   aead_req = kzalloc(reqsize + CCM_AAD_LEN, GFP_ATOMIC);
+   aead_req = kzalloc(reqsize + aad_len, GFP_ATOMIC);
if (!aead_req)
return -ENOMEM;
 
__aad = (u8 *)aead_req + reqsize;
-   memcpy(__aad, aad, CCM_AAD_LEN);
+   memcpy(__aad, aad, aad_len);
 
sg_init_table(sg, 3);
-   sg_set_buf(&sg[0], &__aad[2], be16_to_cpup((__be16 *)__aad));
+   sg_set_buf(&sg[0], __aad, aad_len);
sg_set_buf(&sg[1], data, data_len);
sg_set_buf(&sg[2], mic, mic_len);
 
@@ -84,14 +84,14 @@ int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 
*b_0, u8 *aad,
return err;
 }
 
-struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
-   size_t key_len,
-   size_t mic_len)
+struct crypto_aead *
+aead_key_setup_encrypt(const char *alg, const u8 key[],
+  size_t key_len, size_t mic_len)
 {
struct crypto_aead *tfm;
int err;
 
-   tfm = cryp

Re: [PATCH] mac80211: aead api to reduce redundancy

2017-10-10 Thread Xiang Gao
2017-10-09 3:09 GMT-04:00 Johannes Berg :
> On Sun, 2017-10-08 at 01:43 -0400, Xiang Gao wrote:
>>
>> By the way, I'm still struggling on how to run unit tests. It might
>> take time for me to make it run on my machine.
>
> I can run it easily, so don't worry about it too much. Running it is of
> course much appreciated, but I don't really want to go and require that
> right now, it takes a long time to run.
>
> If you do want to set it up, I suggest the vm scripts (hostap
> repository in tests/hwsim/vm/ - you can use the kernel .config there as
> a base to compile a kernel and then just kick it off from there, but it
> can take a while to run.

Thanks for your help on this. This information is actually very helpful to me.

Since the unit test is not required, I will put working on this patch
higher priority than unit tests. I will send out patches without
running unit tests for now before I can make it run on my computer.
But I'm still interested in trying to run it on my computer after I
finish this patch.

I will send PATCH v3 soon.

Thanks

>
>> Hmm... good question. The reason is, aes_ccm.c and aes_gcm.c was
>> almost exact copy of each other. But they have different copyright
>> information.
>> The copyright of aes_ccm.c was:
>>
>> Copyright 2006, Devicescape Software, Inc.
>> Copyright 2003-2004, Instant802 Networks, Inc.
>>
>> and the copyright of aes_gcm.c was:
>>
>> Copyright 2014-2015, Qualcomm Atheros, Inc.
>>
>> I just don't know how to write the copyright for the new aead_api.c,
>> so I does not put anything there.
>
> Heh, good point. Well, I guess we can pretend it wasn't already copied
> before and just "keep" both.
>
> johannes


Re: Contributing to Linux-wireless drivers.

2017-10-10 Thread James Cameron
On Tue, Oct 10, 2017 at 05:14:02PM +0530, Himanshu Jha wrote:
> Hello everyone,
> 
> Apologies for that forwarded email which I hurriedly sent without
> editing here!
> 
> I am an undergraduate student in ECE(3rd year) and wish to contribute to 
> linux-wireless
> drivers. I am familiar with the kernel development process and have many
> patches accepted in the past 2 months with variety of tools used such as
> coccinelle, Kasan, smatch, sparse and checkpatch.
> 
> My past contributions can be found here:
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/log/?qt=grep&q=Himanshu+Jha
> 
> Also, James Cameron suggested me to *not self promot* and other useful
> stuff. But I'm not self promoting and the purpose is to avoid the
> initial steps that you generally recommend to a newbie like reading the
> conding guideline, submitting patches, learn Git etc.

Last time I'll try that privately.  Now I'm publically outed for it.
I keep making this mistake.

For completeness, what I had said was;

> > Self promotion is not often acceptable.  For background on
> > culture, see http://www.catb.org/esr/faqs/hacker-howto.html

and Himanshu said they wanted to avoid being told the initial steps
again, to which I replied;

> > Good point.  However even as a grey beard, I can still get told
> > these things; it reflects more on them than me.
> >
> > An alternate method would be to say what you have done without
> > using any words that measure or evaluate what you have done.

However, I am curious to know if there will be a GSoC engagement by
Linux Foundation in the linux-wireless scope.  It would be fun to
watch and learn.

-- 
James Cameron
http://quozl.netrek.org/


Re: [PATCH] rtl8xxxu: mark expected switch fall-throughs

2017-10-10 Thread Florian Fainelli
On 10/10/2017 12:35 PM, Jes Sorensen wrote:
> On 10/10/2017 03:30 PM, Gustavo A. R. Silva wrote:
>> In preparation to enabling -Wimplicit-fallthrough, mark switch cases
>> where we are expecting to fall through.
> 
> While this isn't harmful, to me this looks like pointless patch churn
> for zero gain and it's just ugly.

That is the canonical way to tell static analyzers and compilers that
fall throughs are wanted and not accidental mistakes in the code. For
people that deal with these kinds of errors, it's quite helpful, unless
you suggest disabling that particular GCC warning specific for that
file/directory?

> 
> Jes
> 
> 
>> Cc: Jes Sorensen 
>> Cc: Kalle Valo 
>> Cc: linux-wireless@vger.kernel.org
>> Cc: net...@vger.kernel.org
>> Signed-off-by: Gustavo A. R. Silva 
>> ---
>>   drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 5 +
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
>> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
>> index 7806a4d..e66be05 100644
>> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
>> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
>> @@ -1153,6 +1153,7 @@ void rtl8xxxu_gen1_config_channel(struct
>> ieee80211_hw *hw)
>>   switch (hw->conf.chandef.width) {
>>   case NL80211_CHAN_WIDTH_20_NOHT:
>>   ht = false;
>> +/* fall through */
>>   case NL80211_CHAN_WIDTH_20:
>>   opmode |= BW_OPMODE_20MHZ;
>>   rtl8xxxu_write8(priv, REG_BW_OPMODE, opmode);
>> @@ -1280,6 +1281,7 @@ void rtl8xxxu_gen2_config_channel(struct
>> ieee80211_hw *hw)
>>   switch (hw->conf.chandef.width) {
>>   case NL80211_CHAN_WIDTH_20_NOHT:
>>   ht = false;
>> +/* fall through */
>>   case NL80211_CHAN_WIDTH_20:
>>   rf_mode_bw |= WMAC_TRXPTCL_CTL_BW_20;
>>   subchannel = 0;
>> @@ -1748,9 +1750,11 @@ static int rtl8xxxu_identify_chip(struct
>> rtl8xxxu_priv *priv)
>>   case 3:
>>   priv->ep_tx_low_queue = 1;
>>   priv->ep_tx_count++;
>> +/* fall through */
>>   case 2:
>>   priv->ep_tx_normal_queue = 1;
>>   priv->ep_tx_count++;
>> +/* fall through */
>>   case 1:
>>   priv->ep_tx_high_queue = 1;
>>   priv->ep_tx_count++;
>> @@ -5691,6 +5695,7 @@ static int rtl8xxxu_set_key(struct ieee80211_hw
>> *hw, enum set_key_cmd cmd,
>>   break;
>>   case WLAN_CIPHER_SUITE_TKIP:
>>   key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
>> +/* fall through */
>>   default:
>>   return -EOPNOTSUPP;
>>   }
>>
> 


-- 
Florian


Setting single rate in ath10k broken by "reject/clear user rate mask if not usable"

2017-10-10 Thread Ben Greear

At one point, you could set a single rate using 'iw' and
ath10k would convert that to a special firmware API that
fixed all data traffic to a particular rate set.  (Management
frames and broadcast will not be affected by setting the rates
when using ath10k).

But, with the commit below, a command like this will fail:

#iw dev vap206 set bitrates legacy-5 ht-mcs-5 0 vht-mcs-5
command failed: Invalid argument (-22)

But, it actually *does* successfully set the rate in the driver first, which
is confusing at best.

So, I think we should relax this check, at least for ath10k.

commit e8e4f5280ddd0a7b43a795f90a0758e3c99df6a6
Author: Johannes Berg 
Date:   Wed Mar 8 11:12:10 2017 +0100

mac80211: reject/clear user rate mask if not usable

If the user rate mask results in no (basic) rates being usable,
clear it. Also, if we're already operating when it's set, reject
it instead.

Technically, selecting basic rates as the criterion is a bit too
restrictive, but calculating the usable rates over all stations
(e.g. in AP mode) is harder, and all stations must support the
basic rates. Similarly, in client mode, the basic rates will be
used anyway for control frames.

This fixes the "no supported rates (...) in rate_mask ..." warning
that occurs on TX when you've selected a rate mask that's not
compatible with the connection (e.g. an AP that enables only the
rates 36, 48, 54 and you've selected only 6, 9, 12.)

Reported-by: Kirtika Ruchandani 
Signed-off-by: Johannes Berg 

Thanks,
Ben

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



[PATCH] rtl8xxxu: mark expected switch fall-throughs

2017-10-10 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Cc: Jes Sorensen 
Cc: Kalle Valo 
Cc: linux-wireless@vger.kernel.org
Cc: net...@vger.kernel.org
Signed-off-by: Gustavo A. R. Silva 
---
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c 
b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index 7806a4d..e66be05 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -1153,6 +1153,7 @@ void rtl8xxxu_gen1_config_channel(struct ieee80211_hw *hw)
switch (hw->conf.chandef.width) {
case NL80211_CHAN_WIDTH_20_NOHT:
ht = false;
+   /* fall through */
case NL80211_CHAN_WIDTH_20:
opmode |= BW_OPMODE_20MHZ;
rtl8xxxu_write8(priv, REG_BW_OPMODE, opmode);
@@ -1280,6 +1281,7 @@ void rtl8xxxu_gen2_config_channel(struct ieee80211_hw *hw)
switch (hw->conf.chandef.width) {
case NL80211_CHAN_WIDTH_20_NOHT:
ht = false;
+   /* fall through */
case NL80211_CHAN_WIDTH_20:
rf_mode_bw |= WMAC_TRXPTCL_CTL_BW_20;
subchannel = 0;
@@ -1748,9 +1750,11 @@ static int rtl8xxxu_identify_chip(struct rtl8xxxu_priv 
*priv)
case 3:
priv->ep_tx_low_queue = 1;
priv->ep_tx_count++;
+   /* fall through */
case 2:
priv->ep_tx_normal_queue = 1;
priv->ep_tx_count++;
+   /* fall through */
case 1:
priv->ep_tx_high_queue = 1;
priv->ep_tx_count++;
@@ -5691,6 +5695,7 @@ static int rtl8xxxu_set_key(struct ieee80211_hw *hw, enum 
set_key_cmd cmd,
break;
case WLAN_CIPHER_SUITE_TKIP:
key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
+   /* fall through */
default:
return -EOPNOTSUPP;
}
-- 
2.7.4



Re: ath10k hang on rmmod after fw crash in 4.13.3+ hacks

2017-10-10 Thread Ben Greear

On 10/10/2017 12:07 PM, Ben Greear wrote:

I loaded a crashing firmware (it crashes early since it ran OOM), and
then tried to rmmod it.  rmmod hangs, with this stack:


Looks like this is a hang related to napi, and I had a patch from an
older kernel that is probably not needed anymore...maybe it causes the
issue.  I'll test with that removed...

Thanks,
Ben



[root@ben-ota-2 ~]# cat /proc/32491/stack
[] flush_work+0x1fd/0x2d0
[] __cancel_work_timer+0x111/0x190
[] cancel_work_sync+0xb/0x10
[] ath10k_core_unregister+0x14/0xa0 [ath10k_core]
[] ath10k_pci_remove+0x2d/0x70 [ath10k_pci]
[] pci_device_remove+0x34/0xb0
[] device_release_driver_internal+0x158/0x210
[] driver_detach+0x3b/0x80
[] bus_remove_driver+0x53/0xd0
[] driver_unregister+0x27/0x40
[] pci_unregister_driver+0x24/0x90
[] ath10k_pci_exit+0x10/0x6ee [ath10k_pci]
[] SyS_delete_module+0x1e1/0x2a0
[] do_syscall_64+0x64/0x140
[] entry_SYSCALL64_slow_path+0x25/0x25
[] 0x




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



Re: [PATCH] rtl8xxxu: mark expected switch fall-throughs

2017-10-10 Thread Jes Sorensen

On 10/10/2017 03:30 PM, Gustavo A. R. Silva wrote:

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.


While this isn't harmful, to me this looks like pointless patch churn 
for zero gain and it's just ugly.


Jes



Cc: Jes Sorensen 
Cc: Kalle Valo 
Cc: linux-wireless@vger.kernel.org
Cc: net...@vger.kernel.org
Signed-off-by: Gustavo A. R. Silva 
---
  drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 5 +
  1 file changed, 5 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c 
b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index 7806a4d..e66be05 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -1153,6 +1153,7 @@ void rtl8xxxu_gen1_config_channel(struct ieee80211_hw *hw)
switch (hw->conf.chandef.width) {
case NL80211_CHAN_WIDTH_20_NOHT:
ht = false;
+   /* fall through */
case NL80211_CHAN_WIDTH_20:
opmode |= BW_OPMODE_20MHZ;
rtl8xxxu_write8(priv, REG_BW_OPMODE, opmode);
@@ -1280,6 +1281,7 @@ void rtl8xxxu_gen2_config_channel(struct ieee80211_hw *hw)
switch (hw->conf.chandef.width) {
case NL80211_CHAN_WIDTH_20_NOHT:
ht = false;
+   /* fall through */
case NL80211_CHAN_WIDTH_20:
rf_mode_bw |= WMAC_TRXPTCL_CTL_BW_20;
subchannel = 0;
@@ -1748,9 +1750,11 @@ static int rtl8xxxu_identify_chip(struct rtl8xxxu_priv 
*priv)
case 3:
priv->ep_tx_low_queue = 1;
priv->ep_tx_count++;
+   /* fall through */
case 2:
priv->ep_tx_normal_queue = 1;
priv->ep_tx_count++;
+   /* fall through */
case 1:
priv->ep_tx_high_queue = 1;
priv->ep_tx_count++;
@@ -5691,6 +5695,7 @@ static int rtl8xxxu_set_key(struct ieee80211_hw *hw, enum 
set_key_cmd cmd,
break;
case WLAN_CIPHER_SUITE_TKIP:
key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
+   /* fall through */
default:
return -EOPNOTSUPP;
}





Re: What should setting rate on 'AP' interface mean?

2017-10-10 Thread Ben Greear

On 10/10/2017 12:09 PM, Adrian Chadd wrote:

Hi,

IIRC, I think it's the drivers job to determine per-peer fixed rate.


From poking at the 10.1 firmware source, seems that setting fixed RC on the vdev
should over-ride all of the stations, but it did not appear to be working
as expected...

While trying to debug that, I hit a kernel lockup on rmmod ...it is hard
to make progress some days!

Thanks,
Ben





-adrian


On 10 October 2017 at 11:34, Ben Greear  wrote:

I was trying to use 'iw' to set rates on an AP interface, hoping it would
set tx-rates on all of the stations (peers) to the same thing.

It appears that the ath10k driver will set ratesets on all stations if
we specify more than one rate, but if we specify a single rate, it does
not iterate through all stations, and just sets the 'vdev' fixed rate.

So, should the driver somehow attempt to set single rate on all the stations
when
using a single rate?

Or, do we need an API to force rates for individual stations (peers) and
leave
the driver in the current configuration?

Or is it the firmware's responsibility to set the rate for all peers when
we set the vdev fixed rate on an AP vdev?

Thanks,
Ben

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






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



Re: What should setting rate on 'AP' interface mean?

2017-10-10 Thread Adrian Chadd
Hi,

IIRC, I think it's the drivers job to determine per-peer fixed rate.



-adrian


On 10 October 2017 at 11:34, Ben Greear  wrote:
> I was trying to use 'iw' to set rates on an AP interface, hoping it would
> set tx-rates on all of the stations (peers) to the same thing.
>
> It appears that the ath10k driver will set ratesets on all stations if
> we specify more than one rate, but if we specify a single rate, it does
> not iterate through all stations, and just sets the 'vdev' fixed rate.
>
> So, should the driver somehow attempt to set single rate on all the stations
> when
> using a single rate?
>
> Or, do we need an API to force rates for individual stations (peers) and
> leave
> the driver in the current configuration?
>
> Or is it the firmware's responsibility to set the rate for all peers when
> we set the vdev fixed rate on an AP vdev?
>
> Thanks,
> Ben
>
> --
> Ben Greear 
> Candela Technologies Inc  http://www.candelatech.com
>


What should setting rate on 'AP' interface mean?

2017-10-10 Thread Ben Greear

I was trying to use 'iw' to set rates on an AP interface, hoping it would
set tx-rates on all of the stations (peers) to the same thing.

It appears that the ath10k driver will set ratesets on all stations if
we specify more than one rate, but if we specify a single rate, it does
not iterate through all stations, and just sets the 'vdev' fixed rate.

So, should the driver somehow attempt to set single rate on all the stations 
when
using a single rate?

Or, do we need an API to force rates for individual stations (peers) and leave
the driver in the current configuration?

Or is it the firmware's responsibility to set the rate for all peers when
we set the vdev fixed rate on an AP vdev?

Thanks,
Ben

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



Re: [RFC 1/3] mac80211: Add TXQ scheduling API

2017-10-10 Thread Toke Høiland-Jørgensen
Johannes Berg  writes:

>> In particular, I'm not sure what the right thing to do in regards to
>> PS wakeup is...
>
> Can you explain what you were _trying_ to do?
>
> I don't like calling this "driver_buffered" because that's already a
> term for frames that are buffered in the driver ... :-)

Well I was trying to do The Right Thing(tm), obviously ;)

The driver_buffered field comes from the previous behaviour of ath9k: It
would basically set the station_buffered flag if there was something in
the retry queue at the time it goes to sleep. And on wakeup, it will
reschedule the txq if it has anything in the retry queue. And, well, it
just seemed odd that there was this duplicated logic in the driver and
mac80211, if the driver could just signal to mac80211 to reschedule for
it...

But I guess I was really just getting ahead of myself there; so the
right thing to do for now is to keep the old behaviour, and then fix it
properly afterwards?

> PS is complicated, we basically transmit, in the following order:
>  * filtered frames (tx_filtered)
>  * buffered frames (ps_tx_buf)
>  * regular frames
>
> This is when we _leave_ powersave. When we deliver frames while the
> station is sleeping (PS-Poll or U-APSD), they don't even go through the
> TXQ. They still come from this place, but currently go directly to the
> ->tx() method, which to me is actually pretty weird but that's what it
> is now.
>
> As I think I said in my other thread, we should probably eventually
> just get rid of ps_tx_buf entirely, instead just keeping the frames on
> the TXQ. Then, filtered can just be pushed onto txqi->frags [*], and we
> get rid of having that separately as well.
>
> Then, we've completely solved the wakeup scenario, we just start
> scheduling that TXQ normally again.

Yes, this makes sense. Each sleep period is pretty short, right? I.e.,
we don't need to deal with interactions between CoDel and the queue
being stopped for a long period of time?

> For the deliver-while-sleeping (PS-Poll/U-APSD) scenario, I think the
> driver should still pull frames, after calling something like
> drv_release_buffered_frames(). We want this to be scheduled pretty much
> immediately, so we shouldn't just put the TXQ into the normal rotation,
> but otherwise it should work similarly - except limited to a certain
> number of frames [**].
> In this case the driver probably needs to pull the frames using a
> different function so that we can
>  a) tag the packets properly (more-data, EOSP)
>  b) generate nulldata as EOSP container where needed
> Thus, it seems likely that we'll want a separate function, "pull for PS
> delivery" rather than the normal ieee80211_tx_dequeue().

I was envisioning that next_txq() could also make those kinds of
decisions (i.e., preempt the normal scheduling algorithm when a
"special" TXQ needs to be scheduled immediately). But not sure if that
is enough for this case?

-Toke


Re: [RFC 1/3] mac80211: Add TXQ scheduling API

2017-10-10 Thread Toke Høiland-Jørgensen
Johannes Berg  writes:

> On Tue, 2017-10-10 at 16:02 +0200, Toke Høiland-Jørgensen wrote:
>
>> +++ b/net/mac80211/agg-tx.c
>> @@ -226,9 +226,11 @@ ieee80211_agg_start_txq(struct sta_info *sta,
>> int tid, bool enable)
>>  clear_bit(IEEE80211_TXQ_AMPDU, &txqi->flags);
>>  
>>  clear_bit(IEEE80211_TXQ_STOP, &txqi->flags);
>> +ieee80211_schedule_txq(&sta->sdata->local->hw, txq);
>> +
>>  local_bh_disable();
>>  rcu_read_lock();
>> -drv_wake_tx_queue(sta->sdata->local, txqi);
>> +drv_wake_tx_queue(sta->sdata->local);
>>  rcu_read_unlock();
>>  local_bh_enable();
>
> It seems like there could be some sort of TX batching here - maybe
> only call the driver if the queue was actually scheduled?

Yeah, I guess that should be doable.

>> @@ -1121,6 +1122,9 @@ struct ieee80211_local {
>>  struct codel_vars *cvars;
>>  struct codel_params cparams;
>>  
>> +struct list_head active_txqs;
>> +spinlock_t active_txq_lock;
>
> Is there much point in having a separate lock? We probably need the fq
> lock in most places related to this anyway?

Well, once the scheduler gets a bit smarter it may be necessary to much
with the order of TXQs on there without touching any of the queues
(e.g., when calculating airtime usage on TX and RX completion). Not sure
if that is enough to warrant a separate lock, though; I hadn't thought
about just grabbing fq->lock...

>> +void ieee80211_schedule_txq(struct ieee80211_hw *hw,
>> + struct ieee80211_txq *txq)
>> +{
>> +struct ieee80211_local *local = hw_to_local(hw);
>> +struct txq_info *txqi = to_txq_info(txq);
>> +
>> +spin_lock_bh(&local->active_txq_lock);
>> +
>> +if (!list_empty(&txqi->schedule_order))
>> +list_add_tail(&txqi->schedule_order, &local-
>> >active_txqs);
>
> What's with the !list_empty()? Seems inverted to me? You need to add
> it if it's empty?

Yeah, nice catch. This started out as an "unschedule" function before I
decided this way was better. Guess I forgot to switch the logic :)

> Also maybe you should only do that if the TXQ isn't *empty*, so the
> driver could call this unconditionally?

There can be cases where the driver wants the queue to be scheduled even
though it looks empty from mac80211's point of view. For ath9k, the
driver keeps its retry queue in the drv_priv part of the txq structure,
so it will check if that is empty before deciding to call the schedule
function.

This is also related to the PS behaviour, so guess this could be changed
once that is all TXQ-based...

-Toke


Re: [RFC 1/3] mac80211: Add TXQ scheduling API

2017-10-10 Thread Johannes Berg

> In particular, I'm not sure what the right thing to do in regards to
> PS wakeup is...

Can you explain what you were _trying_ to do?

I don't like calling this "driver_buffered" because that's already a
term for frames that are buffered in the driver ... :-)

PS is complicated, we basically transmit, in the following order:
 * filtered frames (tx_filtered)
 * buffered frames (ps_tx_buf)
 * regular frames

This is when we _leave_ powersave. When we deliver frames while the
station is sleeping (PS-Poll or U-APSD), they don't even go through the
TXQ. They still come from this place, but currently go directly to the
->tx() method, which to me is actually pretty weird but that's what it
is now.

As I think I said in my other thread, we should probably eventually
just get rid of ps_tx_buf entirely, instead just keeping the frames on
the TXQ. Then, filtered can just be pushed onto txqi->frags [*], and we
get rid of having that separately as well.

Then, we've completely solved the wakeup scenario, we just start
scheduling that TXQ normally again.

For the deliver-while-sleeping (PS-Poll/U-APSD) scenario, I think the
driver should still pull frames, after calling something like
drv_release_buffered_frames(). We want this to be scheduled pretty much
immediately, so we shouldn't just put the TXQ into the normal rotation,
but otherwise it should work similarly - except limited to a certain
number of frames [**].
In this case the driver probably needs to pull the frames using a
different function so that we can
 a) tag the packets properly (more-data, EOSP)
 b) generate nulldata as EOSP container where needed
Thus, it seems likely that we'll want a separate function, "pull for PS
delivery" rather than the normal ieee80211_tx_dequeue().

johannes

[*] ok not exactly, if there are frags there already things get messy.
but we can probably solve that somehow without needing more special
cases



Re: [RFC 2/3] ath9k: Move to mac80211 TXQ scheduling API

2017-10-10 Thread Johannes Berg
On Tue, 2017-10-10 at 16:02 +0200, Toke Høiland-Jørgensen wrote:
> This removes TXQ scheduling from ath9k and changes it to use the
> mac80211 TXQ scheduling API introduced in the previous patch.

I can't really comment on this, but I'll note that the patches need to
be all combined into a single one eventually, so that it compiles.

johannes


Re: [RFC 1/3] mac80211: Add TXQ scheduling API

2017-10-10 Thread Johannes Berg
On Tue, 2017-10-10 at 16:02 +0200, Toke Høiland-Jørgensen wrote:

> +++ b/net/mac80211/agg-tx.c
> @@ -226,9 +226,11 @@ ieee80211_agg_start_txq(struct sta_info *sta,
> int tid, bool enable)
>   clear_bit(IEEE80211_TXQ_AMPDU, &txqi->flags);
>  
>   clear_bit(IEEE80211_TXQ_STOP, &txqi->flags);
> + ieee80211_schedule_txq(&sta->sdata->local->hw, txq);
> +
>   local_bh_disable();
>   rcu_read_lock();
> - drv_wake_tx_queue(sta->sdata->local, txqi);
> + drv_wake_tx_queue(sta->sdata->local);
>   rcu_read_unlock();
>   local_bh_enable();

It seems like there could be some sort of TX batching here - maybe only
call the driver if the queue was actually scheduled?

Return true/false from ieee80211_schedule_txq() depending on whether it
was added or not, and then call the driver only if it was added just
now? That way, we can save a bunch of driver calls, batching the TX.
 
> @@ -1121,6 +1122,9 @@ struct ieee80211_local {
>   struct codel_vars *cvars;
>   struct codel_params cparams;
>  
> + struct list_head active_txqs;
> + spinlock_t active_txq_lock;

Is there much point in having a separate lock? We probably need the fq
lock in most places related to this anyway?

> +++ b/net/mac80211/sta_info.c
> @@ -1250,8 +1250,9 @@ void ieee80211_sta_ps_deliver_wakeup(struct
> sta_info *sta)
>   if (!txq_has_queue(sta->sta.txq[i]))
>   continue;
>  
> - drv_wake_tx_queue(local, to_txq_info(sta-
> >sta.txq[i]));
> + ieee80211_schedule_txq(&local->hw, sta-
> >sta.txq[i]);
>   }
> + drv_wake_tx_queue(local);

Again, calling the driver could be conditional on having done any
interesting work.

> @@ -1524,7 +1526,8 @@ static bool ieee80211_queue_skb(struct
> ieee80211_local *local,
>   ieee80211_txq_enqueue(local, txqi, skb);
>   spin_unlock_bh(&fq->lock);
>  
> - drv_wake_tx_queue(local, txqi);
> + ieee80211_schedule_txq(&local->hw, &txqi->txq);
> + drv_wake_tx_queue(local);

ditto

> +void ieee80211_schedule_txq(struct ieee80211_hw *hw,
> +  struct ieee80211_txq *txq)
> +{
> + struct ieee80211_local *local = hw_to_local(hw);
> + struct txq_info *txqi = to_txq_info(txq);
> +
> + spin_lock_bh(&local->active_txq_lock);
> +
> + if (!list_empty(&txqi->schedule_order))
> + list_add_tail(&txqi->schedule_order, &local-
> >active_txqs);

What's with the !list_empty()? Seems inverted to me? You need to add it
if it's empty?

Also maybe you should only do that if the TXQ isn't *empty*, so the
driver could call this unconditionally?

> +struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw)
> +{
> + struct ieee80211_local *local = hw_to_local(hw);
> + struct txq_info *txqi = NULL;
> +
> + spin_lock_bh(&local->active_txq_lock);
> +
> + if (list_empty(&local->active_txqs))
> + goto out;
> +
> + txqi = list_first_entry(&local->active_txqs, struct
> txq_info, schedule_order);
> + list_del_init(&txqi->schedule_order);
> +
> +out:
> + spin_unlock_bh(&local->active_txq_lock);
> +
> + return &txqi->txq;

You forgot
if (!txqi)
return NULL;

johannes


Re: net/wireless/ray_cs: Convert timers to use

2017-10-10 Thread Kees Cook
On Tue, Oct 10, 2017 at 1:26 AM, Kalle Valo  wrote:
> Kees Cook  wrote:
>
>> In preparation for unconditionally passing the struct timer_list pointer to
>> all timer callbacks, switch to using the new timer_setup() and from_timer()
>> to pass the timer pointer explicitly.
>>
>> Cc: Kalle Valo 
>> Cc: linux-wireless@vger.kernel.org
>> Cc: net...@vger.kernel.org
>> Cc: Thomas Gleixner 
>> Signed-off-by: Kees Cook 
>
> I'll apply this once I have fast forwarded wireless-drivers-next to
> -rc3. I'll also fix the title, what was it supposed to say?

It was truncated from "net/wireless/ray_cs: Convert timers to use
timer_setup()"; I've fixed that glitch in my workflow now.

> Patch set to Awaiting Upstream.

Thanks!

-Kees

-- 
Kees Cook
Pixel Security


[PATCH] staging: wilc1000: replace redundant computations with 0

2017-10-10 Thread Colin King
From: Colin Ian King 

Shifting and masking strHostIfSetMulti->enabled is redundant since
enabled is a bool and so all the shifted and masked values will be
zero. Replace them with zero to simplify the code.

Detected by CoverityScan, CID#1339458 ("Bad shift operation") and
CID#1339506 ("Operands don't affect result").

Signed-off-by: Colin Ian King 
---
 drivers/staging/wilc1000/host_interface.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 7b620658ec38..94477dd08c85 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -2417,9 +2417,9 @@ static void Handle_SetMulticastFilter(struct wilc_vif 
*vif,
 
pu8CurrByte = wid.val;
*pu8CurrByte++ = (strHostIfSetMulti->enabled & 0xFF);
-   *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 8) & 0xFF);
-   *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 16) & 0xFF);
-   *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 24) & 0xFF);
+   *pu8CurrByte++ = 0;
+   *pu8CurrByte++ = 0;
+   *pu8CurrByte++ = 0;
 
*pu8CurrByte++ = (strHostIfSetMulti->cnt & 0xFF);
*pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 8) & 0xFF);
-- 
2.14.1



[RFC 2/3] ath9k: Move to mac80211 TXQ scheduling API

2017-10-10 Thread Toke Høiland-Jørgensen
This removes TXQ scheduling from ath9k and changes it to use the mac80211 TXQ
scheduling API introduced in the previous patch.

Signed-off-by: Toke Høiland-Jørgensen 
---
 drivers/net/wireless/ath/ath9k/ath9k.h   |   7 +-
 drivers/net/wireless/ath/ath9k/channel.c |   2 -
 drivers/net/wireless/ath/ath9k/main.c|   3 +-
 drivers/net/wireless/ath/ath9k/xmit.c| 181 +++
 4 files changed, 40 insertions(+), 153 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h 
b/drivers/net/wireless/ath/ath9k/ath9k.h
index cf076719c27e..cb8f64864199 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -246,7 +246,6 @@ struct ath_atx_tid {
s8 bar_index;
bool active;
bool clear_ps_filter;
-   bool has_queued;
 };
 
 void __ath_tx_queue_tid(struct ath_softc *sc, struct ath_atx_tid *tid);
@@ -591,8 +590,7 @@ bool ath_drain_all_txq(struct ath_softc *sc);
 void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq);
 void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an);
 void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an);
-void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq);
-void ath_txq_schedule_all(struct ath_softc *sc);
+void ath_txq_schedule(struct ath_softc *sc);
 int ath_tx_init(struct ath_softc *sc, int nbufs);
 int ath_txq_update(struct ath_softc *sc, int qnum,
   struct ath9k_tx_queue_info *q);
@@ -610,7 +608,6 @@ int ath_tx_aggr_start(struct ath_softc *sc, struct 
ieee80211_sta *sta,
  u16 tid, u16 *ssn);
 void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 
tid);
 
-void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an);
 void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc,
   struct ath_node *an);
 void ath9k_release_buffered_frames(struct ieee80211_hw *hw,
@@ -618,7 +615,7 @@ void ath9k_release_buffered_frames(struct ieee80211_hw *hw,
   u16 tids, int nframes,
   enum ieee80211_frame_release_type reason,
   bool more_data);
-void ath9k_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *queue);
+void ath9k_wake_tx_queue(struct ieee80211_hw *hw);
 
 //
 /* VIFs */
diff --git a/drivers/net/wireless/ath/ath9k/channel.c 
b/drivers/net/wireless/ath/ath9k/channel.c
index f0439f2d566b..6dc60fd53a8b 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -1595,8 +1595,6 @@ void ath9k_p2p_ps_timer(void *priv)
an->sleeping = avp->noa.absent;
if (an->sleeping)
ath_tx_aggr_sleep(sta, sc, an);
-   else
-   ath_tx_aggr_wakeup(sc, an);
 
 out:
rcu_read_unlock();
diff --git a/drivers/net/wireless/ath/ath9k/main.c 
b/drivers/net/wireless/ath/ath9k/main.c
index 8b4ac7f0a09b..1601dd11e460 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -265,7 +265,7 @@ static bool ath_complete_reset(struct ath_softc *sc, bool 
start)
}
work:
ath_restart_work(sc);
-   ath_txq_schedule_all(sc);
+   ath_txq_schedule(sc);
}
 
sc->gtt_cnt = 0;
@@ -1619,7 +1619,6 @@ static void ath9k_sta_notify(struct ieee80211_hw *hw,
case STA_NOTIFY_AWAKE:
ath9k_sta_set_tx_filter(sc->sc_ah, an, false);
an->sleeping = false;
-   ath_tx_aggr_wakeup(sc, an);
break;
}
 }
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c 
b/drivers/net/wireless/ath/ath9k/xmit.c
index 396bf05c6bf6..609f209a2278 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -150,24 +150,11 @@ void ath_tx_queue_tid(struct ath_softc *sc, struct 
ath_atx_tid *tid)
 }
 
 
-void ath9k_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *queue)
+void ath9k_wake_tx_queue(struct ieee80211_hw *hw)
 {
struct ath_softc *sc = hw->priv;
-   struct ath_common *common = ath9k_hw_common(sc->sc_ah);
-   struct ath_atx_tid *tid = (struct ath_atx_tid *) queue->drv_priv;
-   struct ath_txq *txq = tid->txq;
-
-   ath_dbg(common, QUEUE, "Waking TX queue: %pM (%d)\n",
-   queue->sta ? queue->sta->addr : queue->vif->addr,
-   tid->tidno);
-
-   ath_txq_lock(sc, txq);
-
-   tid->has_queued = true;
-   ath_tx_queue_tid(sc, tid);
-   ath_txq_schedule(sc, txq);
 
-   ath_txq_unlock(sc, txq);
+   ath_txq_schedule(sc);
 }
 
 static struct ath_frame_info *get_frame_info(struct sk_buff *skb)
@@ -230,14 +217,11 @@ ath_tid_pull(struct ath_atx_tid *tid)
struct ath_frame_info *fi;
int q;
 
-   if (!tid->has_queued)
-   return NULL;
+   txq->drv_buffered = false;
 
skb = ieee80211_tx_dequeue

[RFC 1/3] mac80211: Add TXQ scheduling API

2017-10-10 Thread Toke Høiland-Jørgensen
This adds an API to mac80211 to handle scheduling of TXQs and changes the
interface between driver and mac80211 for TXQ handling as follows:

- The wake_tx_queue callback interface no longer includes the TXQ. Instead, the
  driver is expected to retrieve that from ieee80211_next_txq()

- Two new mac80211 functions are added: ieee80211_next_txq() and
  ieee80211_schedule_txq(). The former returns the next TXQ that should be
  scheduled, and is how the driver gets a queue to pull packets from. The latter
  is called internally by mac80211 to start scheduling a queue, and the driver
  is supposed to call it to re-schedule the TXQ after it is finished pulling
  packets from it (unless the queue emptied).

- A drv_buffered flag is added to struct ieee80211_txq which the driver can set
  to request mac80211 to re-schedule the TXQ at PS wakeup.

Signed-off-by: Toke Høiland-Jørgensen 
---
This version of the scheduler is pretty dumb and just does round-robin
scheduling (pretty much identical to what ath10k does today). In the
future, this will be extended to do airtime fairness scheduling for
drivers that provide airtime information.

I have only compile tested this series; will runtime test it later this
week, but for now comments on the API would be appreciated. In
particular, I'm not sure what the right thing to do in regards to PS
wakeup is...

 include/net/mac80211.h | 34 +-
 net/mac80211/agg-tx.c  |  4 +++-
 net/mac80211/driver-ops.h  | 12 +++-
 net/mac80211/ieee80211_i.h |  7 ++-
 net/mac80211/main.c|  3 +++
 net/mac80211/sta_info.c|  3 ++-
 net/mac80211/trace.h   | 21 -
 net/mac80211/tx.c  | 40 +++-
 8 files changed, 89 insertions(+), 35 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index cc9073e45be9..80a80efa06b1 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -105,9 +105,12 @@
  * The driver is expected to initialize its private per-queue data for stations
  * and interfaces in the .add_interface and .sta_add ops.
  *
- * The driver can't access the queue directly. To dequeue a frame, it calls
- * ieee80211_tx_dequeue(). Whenever mac80211 adds a new frame to a queue, it
- * calls the .wake_tx_queue driver op.
+ * The driver can't access the queue directly. To obtain the next queue to pull
+ * frames from, the driver calls ieee80211_next_txq(). To dequeue a frame from 
a
+ * txq, it calls ieee80211_tx_dequeue(). Whenever mac80211 adds a new frame to 
a
+ * queue, it calls the .wake_tx_queue driver op. The driver is expected to
+ * re-schedule the txq using ieee80211_schedule_txq() if it is still active
+ * after the driver has finished pulling packets from it.
  *
  * For AP powersave TIM handling, the driver only needs to indicate if it has
  * buffered packets in the driver specific data structures by calling
@@ -1870,6 +1873,7 @@ struct ieee80211_txq {
u8 tid;
u8 ac;
 
+   bool drv_buffered;
/* must be last */
u8 drv_priv[0] __aligned(sizeof(void *));
 };
@@ -3723,8 +3727,7 @@ struct ieee80211_ops {
 struct ieee80211_vif *vif,
 struct ieee80211_tdls_ch_sw_params 
*params);
 
-   void (*wake_tx_queue)(struct ieee80211_hw *hw,
- struct ieee80211_txq *txq);
+   void (*wake_tx_queue)(struct ieee80211_hw *hw);
void (*sync_rx_queues)(struct ieee80211_hw *hw);
 
int (*start_nan)(struct ieee80211_hw *hw,
@@ -5876,6 +5879,27 @@ void ieee80211_unreserve_tid(struct ieee80211_sta *sta, 
u8 tid);
 struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
 struct ieee80211_txq *txq);
 
+/**
+ * ieee80211_schedule_txq - add txq to scheduling loop
+ *
+ * @hw: pointer as obtained from ieee80211_alloc_hw()
+ * @txq: pointer obtained from station or virtual interface
+ *
+ */
+void ieee80211_schedule_txq(struct ieee80211_hw *hw,
+   struct ieee80211_txq *txq);
+
+/**
+ * ieee80211_next_txq - get next tx queue to pull packets from
+ *
+ * @hw: pointer as obtained from ieee80211_alloc_hw()
+ *
+ * Returns the next txq if successful, %NULL if no queue is eligible. If a txq
+ * is returned, it will have been removed from the scheduler queue and needs to
+ * be re-scheduled with ieee80211_schedule_txq() to continue to be active.
+ */
+struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw);
+
 /**
  * ieee80211_txq_get_depth - get pending frame/byte count of given txq
  *
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
index bef516ec47f9..77bd0ff90677 100644
--- a/net/mac80211/agg-tx.c
+++ b/net/mac80211/agg-tx.c
@@ -226,9 +226,11 @@ ieee80211_agg_start_txq(struct sta_info *sta, int tid, 
bool enable)
clear_bit(IEEE80211_TXQ_AMPDU, &txqi->flags);
 
clear_bit(IEEE80211_TXQ_ST

[RFC 3/3] ath10k: Move to mac80211 TXQ scheduling API

2017-10-10 Thread Toke Høiland-Jørgensen
This removes TXQ scheduling from ath10k and changes it to use the mac80211 TXQ
scheduling API introduced in the previous patch.

Signed-off-by: Toke Høiland-Jørgensen 
---
 drivers/net/wireless/ath/ath10k/core.c |  2 --
 drivers/net/wireless/ath/ath10k/core.h |  3 ---
 drivers/net/wireless/ath/ath10k/mac.c  | 46 +++---
 3 files changed, 9 insertions(+), 42 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index a4f635820f35..759df3297d48 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -2561,9 +2561,7 @@ struct ath10k *ath10k_core_create(size_t priv_size, 
struct device *dev,
 
mutex_init(&ar->conf_mutex);
spin_lock_init(&ar->data_lock);
-   spin_lock_init(&ar->txqs_lock);
 
-   INIT_LIST_HEAD(&ar->txqs);
INIT_LIST_HEAD(&ar->peers);
init_waitqueue_head(&ar->peer_mapping_wq);
init_waitqueue_head(&ar->htt.empty_tx_wq);
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 949ebb3e967b..e7fc241addf6 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -892,10 +892,7 @@ struct ath10k {
 
/* protects shared structure data */
spinlock_t data_lock;
-   /* protects: ar->txqs, artxq->list */
-   spinlock_t txqs_lock;
 
-   struct list_head txqs;
struct list_head arvifs;
struct list_head peers;
struct ath10k_peer *peer_map[ATH10K_MAX_NUM_PEER_IDS];
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 5683f1a5330e..086d7602fc4a 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -3825,7 +3825,6 @@ static void ath10k_mac_txq_init(struct ieee80211_txq *txq)
 
 static void ath10k_mac_txq_unref(struct ath10k *ar, struct ieee80211_txq *txq)
 {
-   struct ath10k_txq *artxq;
struct ath10k_skb_cb *cb;
struct sk_buff *msdu;
int msdu_id;
@@ -3833,12 +3832,6 @@ static void ath10k_mac_txq_unref(struct ath10k *ar, 
struct ieee80211_txq *txq)
if (!txq)
return;
 
-   artxq = (void *)txq->drv_priv;
-   spin_lock_bh(&ar->txqs_lock);
-   if (!list_empty(&artxq->list))
-   list_del_init(&artxq->list);
-   spin_unlock_bh(&ar->txqs_lock);
-
spin_lock_bh(&ar->htt.tx_lock);
idr_for_each_entry(&ar->htt.pending_tx, msdu, msdu_id) {
cb = ATH10K_SKB_CB(msdu);
@@ -3969,22 +3962,15 @@ void ath10k_mac_tx_push_pending(struct ath10k *ar)
 {
struct ieee80211_hw *hw = ar->hw;
struct ieee80211_txq *txq;
-   struct ath10k_txq *artxq;
-   struct ath10k_txq *last;
int ret;
int max;
 
if (ar->htt.num_pending_tx >= (ar->htt.max_num_pending_tx / 2))
return;
 
-   spin_lock_bh(&ar->txqs_lock);
rcu_read_lock();
 
-   last = list_last_entry(&ar->txqs, struct ath10k_txq, list);
-   while (!list_empty(&ar->txqs)) {
-   artxq = list_first_entry(&ar->txqs, struct ath10k_txq, list);
-   txq = container_of((void *)artxq, struct ieee80211_txq,
-  drv_priv);
+   while ((txq = ieee80211_next_txq(hw))) {
 
/* Prevent aggressive sta/tid taking over tx queue */
max = 16;
@@ -3995,18 +3981,16 @@ void ath10k_mac_tx_push_pending(struct ath10k *ar)
break;
}
 
-   list_del_init(&artxq->list);
if (ret != -ENOENT)
-   list_add_tail(&artxq->list, &ar->txqs);
+   ieee80211_schedule_txq(hw, txq);
 
ath10k_htt_tx_txq_update(hw, txq);
 
-   if (artxq == last || (ret < 0 && ret != -ENOENT))
+   if (ret < 0 && ret != -ENOENT)
break;
}
 
rcu_read_unlock();
-   spin_unlock_bh(&ar->txqs_lock);
 }
 
 //
@@ -4240,34 +4224,22 @@ static void ath10k_mac_op_tx(struct ieee80211_hw *hw,
}
 }
 
-static void ath10k_mac_op_wake_tx_queue(struct ieee80211_hw *hw,
-   struct ieee80211_txq *txq)
+static void ath10k_mac_op_wake_tx_queue(struct ieee80211_hw *hw)
 {
-   struct ath10k *ar = hw->priv;
-   struct ath10k_txq *artxq = (void *)txq->drv_priv;
-   struct ieee80211_txq *f_txq;
-   struct ath10k_txq *f_artxq;
+   struct ieee80211_txq *txq;
int ret = 0;
int max = 16;
 
-   spin_lock_bh(&ar->txqs_lock);
-   if (list_empty(&artxq->list))
-   list_add_tail(&artxq->list, &ar->txqs);
-
-   f_artxq = list_first_entry(&ar->txqs, struct ath10k_txq, list);
-   f_txq = container_of((void *)f_artxq, struct ieee80211_txq, drv_priv);
-   list_del_init(&f_artxq->list);
+   txq = ieee80211_next_txq

Re: [PATCH v2] mac80211: fix STA_SLOW_THRESHOLD htmldocs failure

2017-10-10 Thread Johannes Berg
On Tue, 2017-10-10 at 15:41 +0200, Stanislaw Gruszka wrote:
> On Tue, Sep 26, 2017 at 01:48:05PM +0200, Stanislaw Gruszka wrote:
> > Patch fixes htmldocs build problem:
> > 
> > Error(.//net/mac80211/sta_info.h:416): cannot understand prototype:
> > 'STA_SLOW_THRESHOLD 6000  '
> > 
> > Signed-off-by: Stanislaw Gruszka 
> > ---
> > v1 -> v2: just fix documentation build, do not move the code.
> 
> Johannes, would you apply this? I think patch is safe to apply :-)

I already did :)

johannes


Re: [PATCH v2] mac80211: fix STA_SLOW_THRESHOLD htmldocs failure

2017-10-10 Thread Stanislaw Gruszka
On Tue, Sep 26, 2017 at 01:48:05PM +0200, Stanislaw Gruszka wrote:
> Patch fixes htmldocs build problem:
> 
> Error(.//net/mac80211/sta_info.h:416): cannot understand prototype: 
> 'STA_SLOW_THRESHOLD 6000  '
> 
> Signed-off-by: Stanislaw Gruszka 
> ---
> v1 -> v2: just fix documentation build, do not move the code.

Johannes, would you apply this? I think patch is safe to apply :-)

>  net/mac80211/sta_info.h |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
> index 3acbdfa..a35c964 100644
> --- a/net/mac80211/sta_info.h
> +++ b/net/mac80211/sta_info.h
> @@ -398,7 +398,7 @@ struct ieee80211_sta_rx_stats {
>   u64 msdu[IEEE80211_NUM_TIDS + 1];
>  };
>  
> -/**
> +/*
>   * The bandwidth threshold below which the per-station CoDel parameters will 
> be
>   * scaled to be more lenient (to prevent starvation of slow stations). This
>   * value will be scaled by the number of active stations when it is being
> -- 
> 1.7.1
> 


Contributing to Linux-wireless drivers.

2017-10-10 Thread Himanshu Jha
Hello everyone,

Apologies for that forwarded email which I hurriedly sent without
editing here!

I am an undergraduate student in ECE(3rd year) and wish to contribute to 
linux-wireless
drivers. I am familiar with the kernel development process and have many
patches accepted in the past 2 months with variety of tools used such as
coccinelle, Kasan, smatch, sparse and checkpatch.

My past contributions can be found here:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/log/?qt=grep&q=Himanshu+Jha

Also, James Cameron suggested me to *not self promot* and other useful
stuff. But I'm not self promoting and the purpose is to avoid the
initial steps that you generally recommend to a newbie like reading the
conding guideline, submitting patches, learn Git etc.

I have basic knowledge of Linux kernel internals and competent C skills,
also planning to learn Device Drivers in future. 

Also, since I am beginner is there any small project that I could work on
to enhance my knowledge. 
For eg:
https://wireless.wiki.kernel.org/en/developers/gsoc/2010/wifi-test-nl80211
It is an excellent page for a beginner like me that states what should
you follow and what documenation to read and other useful stuffs.

Please share any links to Documentation/tutorials which I can follow and
help the community.

Lastly, I will next year surely apply for GSoC under Linux-wireless and
I don't seem to find any participation since 2012. Could someone please
explain ? Also, will Linux-wireless participate next year ?

Basically, I want to be prepared beforehand so that I could contribute
successfully! 


Thanks 
Eagerly awaiting your response,
Himanshu Jha



Re: net/wireless/ray_cs: Convert timers to use

2017-10-10 Thread Kalle Valo
Kees Cook  wrote:

> In preparation for unconditionally passing the struct timer_list pointer to
> all timer callbacks, switch to using the new timer_setup() and from_timer()
> to pass the timer pointer explicitly.
> 
> Cc: Kalle Valo 
> Cc: linux-wireless@vger.kernel.org
> Cc: net...@vger.kernel.org
> Cc: Thomas Gleixner 
> Signed-off-by: Kees Cook 

I'll apply this once I have fast forwarded wireless-drivers-next to
-rc3. I'll also fix the title, what was it supposed to say?

Patch set to Awaiting Upstream.

-- 
https://patchwork.kernel.org/patch/9986253/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: mwifiex: Random MAC address during scanning

2017-10-10 Thread Kalle Valo
Ganapathi Bhat  wrote:

> From: Karthik Ananthapadmanabha 
> 
> Driver will advertise RANDOM_MAC support only if the device
> supports this feature.
> 
> Signed-off-by: Karthik Ananthapadmanabha 
> Signed-off-by: Ganapathi Bhat 

Patch applied to wireless-drivers-next.git, thanks.

073a435d55a6 mwifiex: Random MAC address during scanning

-- 
https://patchwork.kernel.org/patch/9977525/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [2/2] rtlwifi: silence underflow warning

2017-10-10 Thread Kalle Valo
Dan Carpenter  wrote:

> My static checker complains that we have an upper bound but no lower
> bound.  I suspect neither are really required but it doesn't hurt to add
> a check for negatives.
> 
> Signed-off-by: Dan Carpenter 
> 
> diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c 
> b/drivers/net/wireless/realtek/rtlwifi/core.c
> index c53cbf3d52bd..294a6b43d1bc 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/core.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/core.c
> @@ -453,7 +453,8 @@ static void _rtl_add_wowlan_patterns(struct ieee80211_hw 
> *hw,
>   for (i = 0; i < wow->n_patterns; i++) {
>   memset(&rtl_pattern, 0, sizeof(struct rtl_wow_pattern));
>   memset(mask, 0, MAX_WOL_BIT_MASK_SIZE);
> - if (patterns[i].pattern_len > MAX_WOL_PATTERN_SIZE) {
> + if (patterns[i].pattern_len < 0 ||
> + patterns[i].pattern_len > MAX_WOL_PATTERN_SIZE) {
>   RT_TRACE(rtlpriv, COMP_POWER, DBG_WARNING,
>"Pattern[%d] is too long\n", i);
>   continue;

Patch applied to wireless-drivers-next.git, thanks.

64e79426c204 rtlwifi: silence underflow warning

-- 
https://patchwork.kernel.org/patch/9977201/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [v2] p54: don't unregister leds when they are not initialized

2017-10-10 Thread Kalle Valo
Andrey Konovalov  wrote:

> ieee80211_register_hw() in p54_register_common() may fail and leds won't
> get initialized. Currently p54_unregister_common() doesn't check that and
> always calls p54_unregister_leds(). The fix is to check priv->registered
> flag before calling p54_unregister_leds().
> 
> Found by syzkaller.
> 
> INFO: trying to register non-static key.
> the code is fine but needs lockdep annotation.
> turning off the locking correctness validator.
> CPU: 1 PID: 1404 Comm: kworker/1:1 Not tainted
> 4.14.0-rc1-42251-gebb2c2437d80-dirty #205
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
> Workqueue: usb_hub_wq hub_event
> Call Trace:
>  __dump_stack lib/dump_stack.c:16
>  dump_stack+0x292/0x395 lib/dump_stack.c:52
>  register_lock_class+0x6c4/0x1a00 kernel/locking/lockdep.c:769
>  __lock_acquire+0x27e/0x4550 kernel/locking/lockdep.c:3385
>  lock_acquire+0x259/0x620 kernel/locking/lockdep.c:4002
>  flush_work+0xf0/0x8c0 kernel/workqueue.c:2886
>  __cancel_work_timer+0x51d/0x870 kernel/workqueue.c:2961
>  cancel_delayed_work_sync+0x1f/0x30 kernel/workqueue.c:3081
>  p54_unregister_leds+0x6c/0xc0 drivers/net/wireless/intersil/p54/led.c:160
>  p54_unregister_common+0x3d/0xb0 drivers/net/wireless/intersil/p54/main.c:856
>  p54u_disconnect+0x86/0x120 drivers/net/wireless/intersil/p54/p54usb.c:1073
>  usb_unbind_interface+0x21c/0xa90 drivers/usb/core/driver.c:423
>  __device_release_driver drivers/base/dd.c:861
>  device_release_driver_internal+0x4f4/0x5c0 drivers/base/dd.c:893
>  device_release_driver+0x1e/0x30 drivers/base/dd.c:918
>  bus_remove_device+0x2f4/0x4b0 drivers/base/bus.c:565
>  device_del+0x5c4/0xab0 drivers/base/core.c:1985
>  usb_disable_device+0x1e9/0x680 drivers/usb/core/message.c:1170
>  usb_disconnect+0x260/0x7a0 drivers/usb/core/hub.c:2124
>  hub_port_connect drivers/usb/core/hub.c:4754
>  hub_port_connect_change drivers/usb/core/hub.c:5009
>  port_event drivers/usb/core/hub.c:5115
>  hub_event+0x1318/0x3740 drivers/usb/core/hub.c:5195
>  process_one_work+0xc7f/0x1db0 kernel/workqueue.c:2119
>  process_scheduled_works kernel/workqueue.c:2179
>  worker_thread+0xb2b/0x1850 kernel/workqueue.c:2255
>  kthread+0x3a1/0x470 kernel/kthread.c:231
>  ret_from_fork+0x2a/0x40 arch/x86/entry/entry_64.S:431
> 
> Cc: sta...@vger.kernel.org
> Signed-off-by: Andrey Konovalov 
> Acked-by: Christian Lamparter 

Patch applied to wireless-drivers-next.git, thanks.

fc09785de0a3 p54: don't unregister leds when they are not initialized

-- 
https://patchwork.kernel.org/patch/9972281/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



[PATCH V5 5/5] ath10k: Fix TDLS peer TX data failure issue on encryped AP

2017-10-10 Thread yintang
From: Yingying Tang 

For WPA encryption, QCA6174 firmware(version: WLAN.RM.4.4) will unblock
data when M4 was sent successfully. For other encryption which didn't need
4-way handshake firmware will unblock the data when peer authorized. Since
TDLS is 3-way handshake host need send authorize cmd to firmware to unblock
data.

Signed-off-by: Yingying Tang 
---
 drivers/net/wireless/ath/ath10k/mac.c |4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index f6702cb..d2530f7 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -5841,6 +5841,10 @@ static int ath10k_set_key(struct ieee80211_hw *hw, enum 
set_key_cmd cmd,
ath10k_warn(ar, "Peer %pM disappeared!\n", peer_addr);
spin_unlock_bh(&ar->data_lock);
 
+   if (sta && sta->tdls)
+   ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr,
+ WMI_PEER_AUTHORIZE, 1);
+
 exit:
mutex_unlock(&ar->conf_mutex);
return ret;
-- 
1.7.9.5



[PATCH V5 3/5] ath10k: Enable TDLS peer inactivity detection

2017-10-10 Thread yintang
From: Yingying Tang 

Enable TDLS peer inactivity detetion feature.
QCA6174 firmware(version: WLAN.RM.4.4) support TDLS link inactivity detecting.
Set related parameters in TDLS WMI command to enable this feature.

Signed-off-by: Yingying Tang 
---
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |   52 +
 drivers/net/wireless/ath/ath10k/wmi-tlv.h |   23 +
 drivers/net/wireless/ath/ath10k/wmi.h |1 +
 3 files changed, 76 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index f60b46e..63bb2c4 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -412,6 +412,49 @@ static int ath10k_wmi_tlv_event_tx_pause(struct ath10k *ar,
return 0;
 }
 
+void ath10k_wmi_event_tdls_peer(struct ath10k *ar, struct sk_buff *skb)
+{
+   struct ieee80211_sta *station;
+   const struct wmi_tlv_tdls_peer_event *ev;
+   const void **tb;
+   struct ath10k_vif *arvif;
+
+   tb = ath10k_wmi_tlv_parse_alloc(ar, skb->data, skb->len, GFP_ATOMIC);
+   if (IS_ERR(tb)) {
+   ath10k_warn(ar, "tdls peer failed to parse tlv");
+   return;
+   }
+   ev = tb[WMI_TLV_TAG_STRUCT_TDLS_PEER_EVENT];
+   if (!ev) {
+   kfree(tb);
+   ath10k_warn(ar, "tdls peer NULL event");
+   return;
+   }
+
+   switch (ev->peer_reason) {
+   case WMI_TDLS_TEARDOWN_REASON_TX:
+   case WMI_TDLS_TEARDOWN_REASON_RSSI:
+   case WMI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT:
+   station = ieee80211_find_sta_by_ifaddr(ar->hw,
+  ev->peer_macaddr.addr,
+  NULL);
+   if (!station) {
+   ath10k_warn(ar, "did not find station from tdls peer 
event");
+   kfree(tb);
+   return;
+   }
+   arvif = ath10k_get_arvif(ar, ev->vdev_id);
+   ieee80211_tdls_oper_request(
+   arvif->vif, station->addr,
+   NL80211_TDLS_TEARDOWN,
+   WLAN_REASON_TDLS_TEARDOWN_UNREACHABLE,
+   GFP_ATOMIC
+   );
+   break;
+   }
+   kfree(tb);
+}
+
 /***/
 /* TLV ops */
 /***/
@@ -552,6 +595,9 @@ static void ath10k_wmi_tlv_op_rx(struct ath10k *ar, struct 
sk_buff *skb)
case WMI_TLV_TX_PAUSE_EVENTID:
ath10k_wmi_tlv_event_tx_pause(ar, skb);
break;
+   case WMI_TLV_TDLS_PEER_EVENTID:
+   ath10k_wmi_event_tdls_peer(ar, skb);
+   break;
default:
ath10k_warn(ar, "Unknown eventid: %d\n", id);
break;
@@ -2750,6 +2796,12 @@ static void *ath10k_wmi_tlv_put_wmm(void *ptr,
if (test_bit(WMI_SERVICE_TDLS_UAPSD_BUFFER_STA, ar->wmi.svc_map))
options |=  WMI_TLV_TDLS_BUFFER_STA_EN;
 
+   /* WMI_TDLS_ENABLE_ACTIVE_EXTERNAL_CONTROL means firm will handle TDLS
+* link inactivity detecting logic.
+*/
+   if (state == WMI_TDLS_ENABLE_ACTIVE)
+   state = WMI_TDLS_ENABLE_ACTIVE_EXTERNAL_CONTROL;
+
len = sizeof(*tlv) + sizeof(*cmd);
skb = ath10k_wmi_alloc_skb(ar, len);
if (!skb)
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.h 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
index 22cf011..00d68c5 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
@@ -1641,6 +1641,29 @@ struct wmi_tlv_tx_pause_ev {
__le32 tid_map;
 } __packed;
 
+struct wmi_tlv_tdls_peer_event {
+   struct wmi_mac_addrpeer_macaddr;
+   __le32 peer_status;
+   __le32 peer_reason;
+   __le32 vdev_id;
+} __packed;
+
+enum wmi_tdls_peer_reason {
+   WMI_TDLS_TEARDOWN_REASON_TX,
+   WMI_TDLS_TEARDOWN_REASON_RSSI,
+   WMI_TDLS_TEARDOWN_REASON_SCAN,
+   WMI_TDLS_DISCONNECTED_REASON_PEER_DELETE,
+   WMI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT,
+   WMI_TDLS_TEARDOWN_REASON_BAD_PTR,
+   WMI_TDLS_TEARDOWN_REASON_NO_RESPONSE,
+   WMI_TDLS_ENTER_BUF_STA,
+   WMI_TDLS_EXIT_BUF_STA,
+   WMI_TDLS_ENTER_BT_BUSY_MODE,
+   WMI_TDLS_EXIT_BT_BUSY_MODE,
+   WMI_TDLS_SCAN_STARTED_EVENT,
+   WMI_TDLS_SCAN_COMPLETED_EVENT,
+};
+
 void ath10k_wmi_tlv_attach(struct ath10k *ar);
 
 #endif
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index 7a3606d..74a6c78 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -6720,6 +6720,7 @@ enum wmi_tdls_state {
WMI_TDLS_DISABLE,
WMI_TDLS_ENABLE_PASSIVE,
WMI_TDLS_ENABLE_ACTIVE,
+   WMI_TDLS_ENABLE_ACTIVE_EXTERNAL_CONTROL,
 };

[PATCH V5 1/5] mac80211: Enable TDLS peer buffer STA feature

2017-10-10 Thread yintang
From: Yingying Tang 

Enable TDLS peer buffer STA feature.
Set extended capability bit to enable buffer STA when driver
support it.

Signed-off-by: Yingying Tang 
---
 include/net/cfg80211.h |3 +++
 net/mac80211/tdls.c|5 -
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index f12fa52..edefc25 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -3249,6 +3249,8 @@ struct cfg80211_ops {
  * beaconing mode (AP, IBSS, Mesh, ...).
  * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation
  * before connection.
+ * @WIPHY_FLAG_SUPPORT_TDLS_BUFFER_ST: Device support buffer STA when TDLS is
+ * established.
  */
 enum wiphy_flags {
/* use hole at 0 */
@@ -3275,6 +3277,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_SUPPORT_TDLS_BUFFER_STA  = BIT(25),
 };
 
 /**
diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c
index 91093d4..f99e379 100644
--- a/net/mac80211/tdls.c
+++ b/net/mac80211/tdls.c
@@ -49,6 +49,8 @@ static void ieee80211_tdls_add_ext_capab(struct 
ieee80211_sub_if_data *sdata,
  !ifmgd->tdls_wider_bw_prohibited;
struct ieee80211_supported_band *sband = ieee80211_get_sband(sdata);
bool vht = sband && sband->vht_cap.vht_supported;
+   bool buffer_sta =
+   local->hw.wiphy->flags & WIPHY_FLAG_SUPPORT_TDLS_BUFFER_STA;
u8 *pos = skb_put(skb, 10);
 
*pos++ = WLAN_EID_EXT_CAPABILITY;
@@ -56,7 +58,8 @@ static void ieee80211_tdls_add_ext_capab(struct 
ieee80211_sub_if_data *sdata,
*pos++ = 0x0;
*pos++ = 0x0;
*pos++ = 0x0;
-   *pos++ = chan_switch ? WLAN_EXT_CAPA4_TDLS_CHAN_SWITCH : 0;
+   *pos++ = (chan_switch ? WLAN_EXT_CAPA4_TDLS_CHAN_SWITCH : 0) |
+(buffer_sta ? WLAN_EXT_CAPA4_TDLS_BUFFER_STA : 0);
*pos++ = WLAN_EXT_CAPA5_TDLS_ENABLED;
*pos++ = 0;
*pos++ = 0;
-- 
1.7.9.5



[PATCH V5 0/5] Add TDLS feature for ath10k

2017-10-10 Thread yintang
From: Yingying Tang 

This patchset is for Rome PCIE chip, it will not affect other hardware

Yingying Tang (5):
  mac80211: Enable TDLS peer buffer STA feature
  ath10k: Enable TDLS peer buffer STA feature
  ath10k: Enable TDLS peer inactivity detection
  ath10k: Avoid to set WEP key for TDLS peer
  ath10k: Fix TDLS peer TX data failure issue on encryped AP

 drivers/net/wireless/ath/ath10k/mac.c |9 -
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |   55 +
 drivers/net/wireless/ath/ath10k/wmi-tlv.h |   23 
 drivers/net/wireless/ath/ath10k/wmi.h |1 +
 include/net/cfg80211.h|3 ++
 net/mac80211/tdls.c   |5 ++-
 6 files changed, 94 insertions(+), 2 deletions(-)

-- 
1.7.9.5



[PATCH V5 2/5] ath10k: Enable TDLS peer buffer STA feature

2017-10-10 Thread yintang
From: Yingying Tang 

Enable TDLS peer buffer STA feature.
QCA6174 firmware(version: WLAN.RM.4.4) support TDLS peer buffer STA,
it reports this capability through wmi service map in wmi service ready
event. Set related parameter in TDLS WMI command to enable this feature.

Signed-off-by: Yingying Tang 
---
 drivers/net/wireless/ath/ath10k/mac.c |3 +++
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |3 +++
 2 files changed, 6 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 5683f1a..399f9ba 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -8204,6 +8204,9 @@ int ath10k_mac_register(struct ath10k *ar)
ieee80211_hw_set(ar->hw, TDLS_WIDER_BW);
}
 
+   if (test_bit(WMI_SERVICE_TDLS_UAPSD_BUFFER_STA, ar->wmi.svc_map))
+   ar->hw->wiphy->flags |= WIPHY_FLAG_SUPPORT_TDLS_BUFFER_STA;
+
ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH;
ar->hw->wiphy->max_remain_on_channel_duration = 5000;
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index 7616c1c..f60b46e 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -2747,6 +2747,9 @@ static void *ath10k_wmi_tlv_put_wmm(void *ptr,
 */
u32 options = 0;
 
+   if (test_bit(WMI_SERVICE_TDLS_UAPSD_BUFFER_STA, ar->wmi.svc_map))
+   options |=  WMI_TLV_TDLS_BUFFER_STA_EN;
+
len = sizeof(*tlv) + sizeof(*cmd);
skb = ath10k_wmi_alloc_skb(ar, len);
if (!skb)
-- 
1.7.9.5



[PATCH V5 4/5] ath10k: Avoid to set WEP key for TDLS peer

2017-10-10 Thread yintang
From: Yingying Tang 

TDLS peer do not need WEP key. Setting WEP key will lead
to TDLS setup failure. Add fix to avoid setting WEP key
for TDLS peer.

Signed-off-by: Yingying Tang 
---
 drivers/net/wireless/ath/ath10k/mac.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 399f9ba..f6702cb 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2966,7 +2966,7 @@ static int ath10k_station_assoc(struct ath10k *ar,
}
 
/* Plumb cached keys only for static WEP */
-   if (arvif->def_wep_key_idx != -1) {
+   if ((arvif->def_wep_key_idx != -1) && (!sta->tdls)) {
ret = ath10k_install_peer_wep_keys(arvif, sta->addr);
if (ret) {
ath10k_warn(ar, "failed to install peer wep 
keys for vdev %i: %d\n",
-- 
1.7.9.5



[PATCH 5/5] ath10k: Fix TDLS peer TX data failure issue on encryped AP

2017-10-10 Thread yintang
From: Yingying Tang 

For WPA encryption, QCA6174 firmware(version: WLAN.RM.4.4) will unblock
data when M4 was sent successfully. For other encryption which didn't need
4-way handshake firmware will unblock the data when peer authorized. Since
TDLS is 3-way handshake host need send authorize cmd to firmware to unblock
data.

Signed-off-by: Yingying Tang 
---
 drivers/net/wireless/ath/ath10k/mac.c |4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index f6702cb..d2530f7 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -5841,6 +5841,10 @@ static int ath10k_set_key(struct ieee80211_hw *hw, enum 
set_key_cmd cmd,
ath10k_warn(ar, "Peer %pM disappeared!\n", peer_addr);
spin_unlock_bh(&ar->data_lock);
 
+   if (sta && sta->tdls)
+   ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr,
+ WMI_PEER_AUTHORIZE, 1);
+
 exit:
mutex_unlock(&ar->conf_mutex);
return ret;
-- 
1.7.9.5



[PATCH 4/5] ath10k: Avoid to set WEP key for TDLS peer

2017-10-10 Thread yintang
From: Yingying Tang 

TDLS peer do not need WEP key. Setting WEP key will lead
to TDLS setup failure. Add fix to avoid setting WEP key
for TDLS peer.

Signed-off-by: Yingying Tang 
---
 drivers/net/wireless/ath/ath10k/mac.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 399f9ba..f6702cb 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2966,7 +2966,7 @@ static int ath10k_station_assoc(struct ath10k *ar,
}
 
/* Plumb cached keys only for static WEP */
-   if (arvif->def_wep_key_idx != -1) {
+   if ((arvif->def_wep_key_idx != -1) && (!sta->tdls)) {
ret = ath10k_install_peer_wep_keys(arvif, sta->addr);
if (ret) {
ath10k_warn(ar, "failed to install peer wep 
keys for vdev %i: %d\n",
-- 
1.7.9.5



[PATCH 0/5] Add TDLS feature for ath10k

2017-10-10 Thread yintang
From: Yingying Tang 

This patchset is for Rome PCIE chip, it will not affect other hardware

Yingying Tang (5):
  mac80211: Enable TDLS peer buffer STA feature
  ath10k: Enable TDLS peer buffer STA feature
  ath10k: Enable TDLS peer inactivity detection
  ath10k: Avoid to set WEP key for TDLS peer
  ath10k: Fix TDLS peer TX data failure issue on encryped AP

 drivers/net/wireless/ath/ath10k/mac.c |9 -
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |   55 +
 drivers/net/wireless/ath/ath10k/wmi-tlv.h |   23 
 drivers/net/wireless/ath/ath10k/wmi.h |1 +
 include/net/cfg80211.h|3 ++
 net/mac80211/tdls.c   |5 ++-
 6 files changed, 94 insertions(+), 2 deletions(-)

-- 
1.7.9.5



[PATCH] MAINTAINERS: update Johannes Berg's entries

2017-10-10 Thread Johannes Berg
From: Johannes Berg 

Update my MAINTAINERS file entries to list all the right files.
Since I'm also the de-facto wireless extensions maintainer,
there's little point in excluding those.

Signed-off-by: Johannes Berg 
---
 MAINTAINERS | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index f0c37be4e04a..e90cdecd7b5d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3329,17 +3329,22 @@ S:  Maintained
 F: drivers/auxdisplay/cfag12864bfb.c
 F: include/linux/cfag12864b.h
 
-CFG80211 and NL80211
+802.11 (including CFG80211/NL80211)
 M: Johannes Berg 
 L: linux-wireless@vger.kernel.org
 W: http://wireless.kernel.org/
 T: git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git
 T: git 
git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git
 S: Maintained
+F: net/wireless/
 F: include/uapi/linux/nl80211.h
+F: include/linux/ieee80211.h
+F: include/net/wext.h
 F: include/net/cfg80211.h
-F: net/wireless/*
-X: net/wireless/wext*
+F: include/net/iw_handler.h
+F: include/net/ieee80211_radiotap.h
+F: Documentation/driver-api/80211/cfg80211.rst
+F: Documentation/networking/regulatory.txt
 
 CHAR and MISC DRIVERS
 M: Arnd Bergmann 
@@ -8207,6 +8212,7 @@ F:Documentation/networking/mac80211-injection.txt
 F: include/net/mac80211.h
 F: net/mac80211/
 F: drivers/net/wireless/mac80211_hwsim.[ch]
+F: Documentation/networking/mac80211_hwsim/README
 
 MAILBOX API
 M: Jassi Brar 
@@ -11491,6 +11497,7 @@ T:  git 
git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git
 T: git 
git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git
 S: Maintained
 F: Documentation/rfkill.txt
+F: Documentation/ABI/stable/sysfs-class-rfkill
 F: net/rfkill/
 
 RHASHTABLE
-- 
2.14.2



[PATCH 0/5] Add TDLS feature for ath10k

2017-10-10 Thread yintang
From: Yingying Tang 

This patchset is for Rome PCIE chip, it will not affect other hardware

Yingying Tang (5):
  mac80211: Enable TDLS peer buffer STA feature
  ath10k: Enable TDLS peer buffer STA feature
  ath10k: Enable TDLS peer inactivity detection
  ath10k: Avoid to set WEP key for TDLS peer
  ath10k: Fix TDLS peer TX data failure issue on encryped AP

 drivers/net/wireless/ath/ath10k/mac.c |9 -
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |   55 +
 drivers/net/wireless/ath/ath10k/wmi-tlv.h |   23 
 drivers/net/wireless/ath/ath10k/wmi.h |1 +
 include/net/cfg80211.h|3 ++
 net/mac80211/tdls.c   |5 ++-
 6 files changed, 94 insertions(+), 2 deletions(-)

-- 
1.7.9.5



[PATCH 1/5] mac80211: Enable TDLS peer buffer STA feature

2017-10-10 Thread yintang
From: Yingying Tang 

Enable TDLS peer buffer STA feature.
Set extended capability bit to enable buffer STA when driver
support it.

Signed-off-by: Yingying Tang 
---
 include/net/cfg80211.h |3 +++
 net/mac80211/tdls.c|5 -
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index f12fa52..edefc25 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -3249,6 +3249,8 @@ struct cfg80211_ops {
  * beaconing mode (AP, IBSS, Mesh, ...).
  * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation
  * before connection.
+ * @WIPHY_FLAG_SUPPORT_TDLS_BUFFER_ST: Device support buffer STA when TDLS is
+ * established.
  */
 enum wiphy_flags {
/* use hole at 0 */
@@ -3275,6 +3277,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_SUPPORT_TDLS_BUFFER_STA  = BIT(25),
 };
 
 /**
diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c
index 91093d4..f99e379 100644
--- a/net/mac80211/tdls.c
+++ b/net/mac80211/tdls.c
@@ -49,6 +49,8 @@ static void ieee80211_tdls_add_ext_capab(struct 
ieee80211_sub_if_data *sdata,
  !ifmgd->tdls_wider_bw_prohibited;
struct ieee80211_supported_band *sband = ieee80211_get_sband(sdata);
bool vht = sband && sband->vht_cap.vht_supported;
+   bool buffer_sta =
+   local->hw.wiphy->flags & WIPHY_FLAG_SUPPORT_TDLS_BUFFER_STA;
u8 *pos = skb_put(skb, 10);
 
*pos++ = WLAN_EID_EXT_CAPABILITY;
@@ -56,7 +58,8 @@ static void ieee80211_tdls_add_ext_capab(struct 
ieee80211_sub_if_data *sdata,
*pos++ = 0x0;
*pos++ = 0x0;
*pos++ = 0x0;
-   *pos++ = chan_switch ? WLAN_EXT_CAPA4_TDLS_CHAN_SWITCH : 0;
+   *pos++ = (chan_switch ? WLAN_EXT_CAPA4_TDLS_CHAN_SWITCH : 0) |
+(buffer_sta ? WLAN_EXT_CAPA4_TDLS_BUFFER_STA : 0);
*pos++ = WLAN_EXT_CAPA5_TDLS_ENABLED;
*pos++ = 0;
*pos++ = 0;
-- 
1.7.9.5



[PATCH 2/5] ath10k: Enable TDLS peer buffer STA feature

2017-10-10 Thread yintang
From: Yingying Tang 

Enable TDLS peer buffer STA feature.
QCA6174 firmware(version: WLAN.RM.4.4) support TDLS peer buffer STA,
it reports this capability through wmi service map in wmi service ready
event. Set related parameter in TDLS WMI command to enable this feature.

Signed-off-by: Yingying Tang 
---
 drivers/net/wireless/ath/ath10k/mac.c |3 +++
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |3 +++
 2 files changed, 6 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 5683f1a..399f9ba 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -8204,6 +8204,9 @@ int ath10k_mac_register(struct ath10k *ar)
ieee80211_hw_set(ar->hw, TDLS_WIDER_BW);
}
 
+   if (test_bit(WMI_SERVICE_TDLS_UAPSD_BUFFER_STA, ar->wmi.svc_map))
+   ar->hw->wiphy->flags |= WIPHY_FLAG_SUPPORT_TDLS_BUFFER_STA;
+
ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH;
ar->hw->wiphy->max_remain_on_channel_duration = 5000;
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index 7616c1c..f60b46e 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -2747,6 +2747,9 @@ static void *ath10k_wmi_tlv_put_wmm(void *ptr,
 */
u32 options = 0;
 
+   if (test_bit(WMI_SERVICE_TDLS_UAPSD_BUFFER_STA, ar->wmi.svc_map))
+   options |=  WMI_TLV_TDLS_BUFFER_STA_EN;
+
len = sizeof(*tlv) + sizeof(*cmd);
skb = ath10k_wmi_alloc_skb(ar, len);
if (!skb)
-- 
1.7.9.5



[PATCH 0/5] Add TDLS feature for ath10k

2017-10-10 Thread yintang
From: Yingying Tang 

This patchset is for Rome PCIE chip, it will not affect other hardware

Yingying Tang (5):
  mac80211: Enable TDLS peer buffer STA feature
  ath10k: Enable TDLS peer buffer STA feature
  ath10k: Enable TDLS peer inactivity detection
  ath10k: Avoid to set WEP key for TDLS peer
  ath10k: Fix TDLS peer TX data failure issue on encryped AP

 drivers/net/wireless/ath/ath10k/mac.c |9 -
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |   55 +
 drivers/net/wireless/ath/ath10k/wmi-tlv.h |   23 
 drivers/net/wireless/ath/ath10k/wmi.h |1 +
 include/net/cfg80211.h|3 ++
 net/mac80211/tdls.c   |5 ++-
 6 files changed, 94 insertions(+), 2 deletions(-)

-- 
1.7.9.5



[PATCH 3/5] ath10k: Enable TDLS peer inactivity detection

2017-10-10 Thread yintang
From: Yingying Tang 

Enable TDLS peer inactivity detetion feature.
QCA6174 firmware(version: WLAN.RM.4.4) support TDLS link inactivity detecting.
Set related parameters in TDLS WMI command to enable this feature.

Signed-off-by: Yingying Tang 
---
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |   52 +
 drivers/net/wireless/ath/ath10k/wmi-tlv.h |   23 +
 drivers/net/wireless/ath/ath10k/wmi.h |1 +
 3 files changed, 76 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index f60b46e..63bb2c4 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -412,6 +412,49 @@ static int ath10k_wmi_tlv_event_tx_pause(struct ath10k *ar,
return 0;
 }
 
+void ath10k_wmi_event_tdls_peer(struct ath10k *ar, struct sk_buff *skb)
+{
+   struct ieee80211_sta *station;
+   const struct wmi_tlv_tdls_peer_event *ev;
+   const void **tb;
+   struct ath10k_vif *arvif;
+
+   tb = ath10k_wmi_tlv_parse_alloc(ar, skb->data, skb->len, GFP_ATOMIC);
+   if (IS_ERR(tb)) {
+   ath10k_warn(ar, "tdls peer failed to parse tlv");
+   return;
+   }
+   ev = tb[WMI_TLV_TAG_STRUCT_TDLS_PEER_EVENT];
+   if (!ev) {
+   kfree(tb);
+   ath10k_warn(ar, "tdls peer NULL event");
+   return;
+   }
+
+   switch (ev->peer_reason) {
+   case WMI_TDLS_TEARDOWN_REASON_TX:
+   case WMI_TDLS_TEARDOWN_REASON_RSSI:
+   case WMI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT:
+   station = ieee80211_find_sta_by_ifaddr(ar->hw,
+  ev->peer_macaddr.addr,
+  NULL);
+   if (!station) {
+   ath10k_warn(ar, "did not find station from tdls peer 
event");
+   kfree(tb);
+   return;
+   }
+   arvif = ath10k_get_arvif(ar, ev->vdev_id);
+   ieee80211_tdls_oper_request(
+   arvif->vif, station->addr,
+   NL80211_TDLS_TEARDOWN,
+   WLAN_REASON_TDLS_TEARDOWN_UNREACHABLE,
+   GFP_ATOMIC
+   );
+   break;
+   }
+   kfree(tb);
+}
+
 /***/
 /* TLV ops */
 /***/
@@ -552,6 +595,9 @@ static void ath10k_wmi_tlv_op_rx(struct ath10k *ar, struct 
sk_buff *skb)
case WMI_TLV_TX_PAUSE_EVENTID:
ath10k_wmi_tlv_event_tx_pause(ar, skb);
break;
+   case WMI_TLV_TDLS_PEER_EVENTID:
+   ath10k_wmi_event_tdls_peer(ar, skb);
+   break;
default:
ath10k_warn(ar, "Unknown eventid: %d\n", id);
break;
@@ -2750,6 +2796,12 @@ static void *ath10k_wmi_tlv_put_wmm(void *ptr,
if (test_bit(WMI_SERVICE_TDLS_UAPSD_BUFFER_STA, ar->wmi.svc_map))
options |=  WMI_TLV_TDLS_BUFFER_STA_EN;
 
+   /* WMI_TDLS_ENABLE_ACTIVE_EXTERNAL_CONTROL means firm will handle TDLS
+* link inactivity detecting logic.
+*/
+   if (state == WMI_TDLS_ENABLE_ACTIVE)
+   state = WMI_TDLS_ENABLE_ACTIVE_EXTERNAL_CONTROL;
+
len = sizeof(*tlv) + sizeof(*cmd);
skb = ath10k_wmi_alloc_skb(ar, len);
if (!skb)
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.h 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
index 22cf011..00d68c5 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
@@ -1641,6 +1641,29 @@ struct wmi_tlv_tx_pause_ev {
__le32 tid_map;
 } __packed;
 
+struct wmi_tlv_tdls_peer_event {
+   struct wmi_mac_addrpeer_macaddr;
+   __le32 peer_status;
+   __le32 peer_reason;
+   __le32 vdev_id;
+} __packed;
+
+enum wmi_tdls_peer_reason {
+   WMI_TDLS_TEARDOWN_REASON_TX,
+   WMI_TDLS_TEARDOWN_REASON_RSSI,
+   WMI_TDLS_TEARDOWN_REASON_SCAN,
+   WMI_TDLS_DISCONNECTED_REASON_PEER_DELETE,
+   WMI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT,
+   WMI_TDLS_TEARDOWN_REASON_BAD_PTR,
+   WMI_TDLS_TEARDOWN_REASON_NO_RESPONSE,
+   WMI_TDLS_ENTER_BUF_STA,
+   WMI_TDLS_EXIT_BUF_STA,
+   WMI_TDLS_ENTER_BT_BUSY_MODE,
+   WMI_TDLS_EXIT_BT_BUSY_MODE,
+   WMI_TDLS_SCAN_STARTED_EVENT,
+   WMI_TDLS_SCAN_COMPLETED_EVENT,
+};
+
 void ath10k_wmi_tlv_attach(struct ath10k *ar);
 
 #endif
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index 7a3606d..74a6c78 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -6720,6 +6720,7 @@ enum wmi_tdls_state {
WMI_TDLS_DISABLE,
WMI_TDLS_ENABLE_PASSIVE,
WMI_TDLS_ENABLE_ACTIVE,
+   WMI_TDLS_ENABLE_ACTIVE_EXTERNAL_CONTROL,
 };

Re: Contributing to Linux-wireless drivers.

2017-10-10 Thread Johannes Berg
On Tue, 2017-10-10 at 11:35 +0530, Himanshu Jha wrote:
> 
> The wiki page https://wireless.wiki.kernel.org/ is not working
> correctly, for every page it shows 
> 
> "This topic does not exist yet
> You've followed a link to a topic that doesn't exist yet. If
> permissions
> allow, you may create it by clicking on “Create this page”.
> Earlier I used to visit this without any issues, don't know what is
> the problem now ?

FWIW, I fixed this - some idiot deleted almost all pages on the wiki.

johannes


4.14.0-rc3 iwlwifi: Hardware became unavailable during restart

2017-10-10 Thread Seraphime Kirkovski
Hello,

I've got this splat after a couple of suspend-resume cycles on my
HP-laptop. I haven't had the time to bisect or test other rcs for now.
Pasting some logs before the actual WARN_ON, as they may be relevant.
Just after the splat the connection is successfully reestablished.

[14293.758404] iwlwifi :24:00.0: Error sending REPLY_SCAN_ABORT_CMD: 
time out after 2000ms.
[14293.758429] iwlwifi :24:00.0: Current CMD queue read_ptr 67 write_ptr 68
[14293.758518] iwlwifi :24:00.0: Loaded firmware version: 18.168.6.1
[14293.758734] iwlwifi :24:00.0: 0x | OK  
[14293.758740] iwlwifi :24:00.0: 0x | uPc
[14293.758746] iwlwifi :24:00.0: 0x | branchlink1
[14293.758750] iwlwifi :24:00.0: 0x | branchlink2
[14293.758756] iwlwifi :24:00.0: 0x | interruptlink1
[14293.758762] iwlwifi :24:00.0: 0x | interruptlink2
[14293.758767] iwlwifi :24:00.0: 0x | data1
[14293.758773] iwlwifi :24:00.0: 0x | data2
[14293.758778] iwlwifi :24:00.0: 0x | line
[14293.758784] iwlwifi :24:00.0: 0x | beacon time
[14293.758789] iwlwifi :24:00.0: 0x | tsf low
[14293.758795] iwlwifi :24:00.0: 0x | tsf hi
[14293.758800] iwlwifi :24:00.0: 0x | time gp1
[14293.758805] iwlwifi :24:00.0: 0x | time gp2
[14293.758810] iwlwifi :24:00.0: 0x | time gp3
[14293.758816] iwlwifi :24:00.0: 0x | uCode version
[14293.758821] iwlwifi :24:00.0: 0x | hw version
[14293.758827] iwlwifi :24:00.0: 0x | board version
[14293.758833] iwlwifi :24:00.0: 0x | hcmd
[14293.758838] iwlwifi :24:00.0: 0x | isr0
[14293.758844] iwlwifi :24:00.0: 0x | isr1
[14293.758850] iwlwifi :24:00.0: 0x | isr2
[14293.758855] iwlwifi :24:00.0: 0x | isr3
[14293.758861] iwlwifi :24:00.0: 0x | isr4
[14293.758866] iwlwifi :24:00.0: 0x | isr_pref
[14293.758872] iwlwifi :24:00.0: 0x | wait_event
[14293.758877] iwlwifi :24:00.0: 0x | l2p_control
[14293.758882] iwlwifi :24:00.0: 0x | l2p_duration
[14293.75] iwlwifi :24:00.0: 0x | l2p_mhvalid
[14293.758894] iwlwifi :24:00.0: 0x | l2p_addr_match
[14293.758899] iwlwifi :24:00.0: 0x | lmpm_pmg_sel
[14293.758905] iwlwifi :24:00.0: 0x | timestamp
[14293.758911] iwlwifi :24:00.0: 0x | flow_handler
[14293.759009] iwlwifi :24:00.0: Start IWL Event Log Dump: nothing in log
[14293.759028] iwlwifi :24:00.0: Command REPLY_RXON failed: FW Error
[14293.759034] iwlwifi :24:00.0: Error clearing ASSOC_MSK on BSS (-5)
[14293.771378] ieee80211 phy0: Hardware restart was requested
[14293.777841] iwlwifi :24:00.0: Radio type=0x1-0x2-0x0
[14294.082086] iwlwifi :24:00.0: Radio type=0x1-0x2-0x0
[14294.184741] IPv6: ADDRCONF(NETDEV_UP): wlo1: link is not ready
[14294.191364] iwlwifi :24:00.0: Radio type=0x1-0x2-0x0
[14299.198235] iwlwifi :24:00.0: Failed to load firmware chunk!
[14299.198255] iwlwifi :24:00.0: Could not load the [0] uCode section
[14299.210483] iwlwifi :24:00.0: Failed to run INIT ucode: -110
[14299.210534] iwlwifi :24:00.0: Unable to initialize device.
[14299.210537] Hardware became unavailable during restart.
[14299.210582] [ cut here ]
[14299.210639] WARNING: CPU: 2 PID: 13367 at net/mac80211/util.c:1866 
ieee80211_reconfig+0x415/0x1f50 [mac80211]
[14299.210640] Modules linked in: bridge stp llc cuse vhost_net tun vhost tap 
fuse btrfs xor zstd_decompress zstd_compress xxhash zlib_deflate raid6_pq 
ipt_MASQUERADE nf_nat_masquerade_ipv4 xt_addrtype iptable_nat nf_nat_ipv4 
nf_nat uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 
x86_pkg_temp_thermal kvm_intel videobuf2_core kvm irqbypass iwldvm crc32_pclmul 
mac80211 iwlwifi input_leds cfg80211 rfkill i915 button ext4 mbcache jbd2 
fscrypto ahci libahci libata ehci_pci ehci_hcd
[14299.210678] CPU: 2 PID: 13367 Comm: kworker/2:1 Not tainted 4.14.0-rc3+ #2
[14299.210680] Hardware name: Hewlett-Packard HP EliteBook 2560p/162B, BIOS 
68SSU Ver. F.02 07/26/2011
[14299.210717] Workqueue: events_freezable ieee80211_restart_work [mac80211]
[14299.210720] task: 8801f0ece740 task.stack: 8801f1d78000
[14299.210757] RIP: 0010:ieee80211_reconfig+0x415/0x1f50 [mac80211]
[14299.210759] RSP: 0018:8801f1d7fc78 EFLAGS: 00010282
[14299.210761] RAX: 002b RBX: 8801f2c28c16 RCX: 
[14299.210763] RDX: 002b RSI: dc00 RDI: ed003e3aff85
[14299.210765] RBP: 8801f1d7fda8 R08: fbfff05924fb R09: 82c927d7
[14299.210767] R10: 8801f2c2a632 R11: fbfff05924fb R12: 8801f2c28fb8
[14299.210768] R13: 8801f2c293d8 R14: 8801f2c28780 R15: 8801f2c28780
[14299.210770] FS:  () GS:8801f5c8() 
knlGS:00