Mac80211 driver crash in monitor mode

2015-12-10 Thread Cedric VONCKEN
Hi, 

I'm using mac80211/ATH9K driver in monitor mode to inject some packets.

With the latest driver version my packet injector software generated a
kernel panic.

The reason of this crash is:
In mac80211/tx.c, function __ieee80211_tx:

case NL80211_IFTYPE_MONITOR:
if (sdata->u.mntr_flags & MONITOR_FLAG_ACTIVE) {
vif = >vif;
break;
}
sdata = rcu_dereference(local->monitor_sdata);
if (sdata) {
vif = >vif;
info->hw_queue =

vif->hw_queue[skb_get_queue_mapping(skb)];
} else if (ieee80211_hw_check(>hw,
QUEUE_CONTROL)) {
ieee80211_purge_tx_queue(>hw, skbs);
return true;
} else
vif = NULL;
break; 

If I don't enable the MONITOR_FLAG_ACTIVE I'm going to the line vif =
null, this function will continue and will call ieee80211_tx_frags and
this function will call ieee80211_drv_tx.

In ieee80211_drv_tx function:
 
if (pubsta) {
u8 tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK;

txq = pubsta->txq[tid];
} else if (vif) {
txq = vif->txq;
} 

In my case pubsta == null so I'm going to else statement. The line
vif->txq generate kernel pannic because the VIF pointer have been
initialized to null in __ieee80211_tx function.

Do you have any suggestion to fix this crash?

Cedric Voncken.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] rfkill: copy the name into the rfkill struct

2015-12-10 Thread Johannes Berg
From: Johannes Berg 

Some users of rfkill, like NFC and cfg80211, use a dynamic name when
allocating rfkill, in those cases dev_name(). Therefore, the pointer
passed to rfkill_alloc() might not be valid forever, I specifically
found the case that the rfkill name was quite obviously an invalid
pointer (or at least garbage) when the wiphy had been renamed.

Fix this by making a copy of the rfkill name in rfkill_alloc().

Cc: sta...@vger.kernel.org
Signed-off-by: Johannes Berg 
---
 net/rfkill/core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/rfkill/core.c b/net/rfkill/core.c
index b41e9ea2..f53bf3b6558b 100644
--- a/net/rfkill/core.c
+++ b/net/rfkill/core.c
@@ -49,7 +49,6 @@
 struct rfkill {
spinlock_t  lock;
 
-   const char  *name;
enum rfkill_typetype;
 
unsigned long   state;
@@ -73,6 +72,7 @@ struct rfkill {
struct delayed_work poll_work;
struct work_struct  uevent_work;
struct work_struct  sync_work;
+   charname[];
 };
 #define to_rfkill(d)   container_of(d, struct rfkill, dev)
 
@@ -876,14 +876,14 @@ struct rfkill * __must_check rfkill_alloc(const char 
*name,
if (WARN_ON(type == RFKILL_TYPE_ALL || type >= NUM_RFKILL_TYPES))
return NULL;
 
-   rfkill = kzalloc(sizeof(*rfkill), GFP_KERNEL);
+   rfkill = kzalloc(sizeof(*rfkill) + strlen(name) + 1, GFP_KERNEL);
if (!rfkill)
return NULL;
 
spin_lock_init(>lock);
INIT_LIST_HEAD(>node);
rfkill->type = type;
-   rfkill->name = name;
+   strcpy(rfkill->name, name);
rfkill->ops = ops;
rfkill->data = ops_data;
 
-- 
2.6.2

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] NFC: fdp: fix handling return value of fdp_nci_create_conn

2015-12-10 Thread Andrzej Hajda
The function can return negative values, so its result should
be assigned to signed variable.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107

Signed-off-by: Andrzej Hajda 
---
v2: fixed typo in goto instruction

 drivers/nfc/fdp/fdp.c | 14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/nfc/fdp/fdp.c b/drivers/nfc/fdp/fdp.c
index ccb07a1..4dfd1ef 100644
--- a/drivers/nfc/fdp/fdp.c
+++ b/drivers/nfc/fdp/fdp.c
@@ -368,11 +368,10 @@ static int fdp_nci_patch_otp(struct nci_dev *ndev)
goto out;
 
/* Patch data connection creation */
-   conn_id = fdp_nci_create_conn(ndev);
-   if (conn_id < 0) {
-   r = conn_id;
+   r = fdp_nci_create_conn(ndev);
+   if (r < 0)
goto out;
-   }
+   conn_id = r;
 
/* Send the patch over the data connection */
r = fdp_nci_send_patch(ndev, conn_id, NCI_PATCH_TYPE_OTP);
@@ -439,11 +438,10 @@ static int fdp_nci_patch_ram(struct nci_dev *ndev)
goto out;
 
/* Patch data connection creation */
-   conn_id = fdp_nci_create_conn(ndev);
-   if (conn_id < 0) {
-   r = conn_id;
+   r = fdp_nci_create_conn(ndev);
+   if (r < 0)
goto out;
-   }
+   conn_id = r;
 
/* Send the patch over the data connection */
r = fdp_nci_send_patch(ndev, conn_id, NCI_PATCH_TYPE_RAM);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] ath10k: wake up device before accessing registers

2015-12-10 Thread Rajkumar Manoharan
commit 1aaf8efba0ae ("ath10k: disable PCI PS for QCA988X
and QCA99X0") partially reverts pci soc powersave support added by
commit 77258d409ce4 ("ath10k: enable pci soc powersaving"). While
reverting the change, pci wake up function is called after accessing
pci registers instead of prior to access. The assumption is that chip
is woken up before accessing its registers.Though this change does not
fix any known issues, this might help to avoid unknown or low power
platform specific issues.

Signed-off-by: Rajkumar Manoharan 
---
 drivers/net/wireless/ath/ath10k/pci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 202c775..473a141 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -3071,9 +3071,6 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
goto err_sleep;
}
 
-   ath10k_pci_ce_deinit(ar);
-   ath10k_pci_irq_disable(ar);
-
if (ar_pci->pci_ps == 0) {
ret = ath10k_pci_force_wake(ar);
if (ret) {
@@ -3082,6 +3079,9 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
}
}
 
+   ath10k_pci_ce_deinit(ar);
+   ath10k_pci_irq_disable(ar);
+
ret = ath10k_pci_init_irq(ar);
if (ret) {
ath10k_err(ar, "failed to init irqs: %d\n", ret);
-- 
2.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] ath10k: reduce indentation by moving powersave check within function

2015-12-10 Thread Rajkumar Manoharan
For devices that does not support PCI power save, force wake up
API is used. So move powersave check inside force wakeup to reduce
one level indentation.

Signed-off-by: Rajkumar Manoharan 
---
 drivers/net/wireless/ath/ath10k/pci.c | 34 +++---
 1 file changed, 15 insertions(+), 19 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 473a141..c6aaad2 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -487,6 +487,9 @@ static int ath10k_pci_force_wake(struct ath10k *ar)
unsigned long flags;
int ret = 0;
 
+   if (ar_pci->pci_ps)
+   return ret;
+
spin_lock_irqsave(_pci->ps_lock, flags);
 
if (!ar_pci->ps_awake) {
@@ -2480,12 +2483,10 @@ static int ath10k_pci_hif_resume(struct ath10k *ar)
u32 val;
int ret = 0;
 
-   if (ar_pci->pci_ps == 0) {
-   ret = ath10k_pci_force_wake(ar);
-   if (ret) {
-   ath10k_err(ar, "failed to wake up target: %d\n", ret);
-   return ret;
-   }
+   ret = ath10k_pci_force_wake(ar);
+   if (ret) {
+   ath10k_err(ar, "failed to wake up target: %d\n", ret);
+   return ret;
}
 
/* Suspend/Resume resets the PCI configuration space, so we have to
@@ -2592,13 +2593,10 @@ static irqreturn_t ath10k_pci_interrupt_handler(int 
irq, void *arg)
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
int ret;
 
-   if (ar_pci->pci_ps == 0) {
-   ret = ath10k_pci_force_wake(ar);
-   if (ret) {
-   ath10k_warn(ar, "failed to wake device up on irq: %d\n",
-   ret);
-   return IRQ_NONE;
-   }
+   ret = ath10k_pci_force_wake(ar);
+   if (ret) {
+   ath10k_warn(ar, "failed to wake device up on irq: %d\n", ret);
+   return IRQ_NONE;
}
 
if (ar_pci->num_msi_intrs == 0) {
@@ -3071,12 +3069,10 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
goto err_sleep;
}
 
-   if (ar_pci->pci_ps == 0) {
-   ret = ath10k_pci_force_wake(ar);
-   if (ret) {
-   ath10k_warn(ar, "failed to wake up device : %d\n", ret);
-   goto err_free_pipes;
-   }
+   ret = ath10k_pci_force_wake(ar);
+   if (ret) {
+   ath10k_warn(ar, "failed to wake up device : %d\n", ret);
+   goto err_free_pipes;
}
 
ath10k_pci_ce_deinit(ar);
-- 
2.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Mac80211 driver crash in monitor mode

2015-12-10 Thread Johannes Berg
On Thu, 2015-12-10 at 10:21 +0100, Cedric VONCKEN wrote:
> 
> In ieee80211_drv_tx function:
>  
>   if (pubsta) {
>   u8 tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK;
> 
>   txq = pubsta->txq[tid];
>   } else if (vif) {
>   txq = vif->txq;
>   } 
> 
> In my case pubsta == null so I'm going to else statement. The line
> vif->txq generate kernel pannic because the VIF pointer have been
> initialized to null in __ieee80211_tx function.
> 

Clearly you must be missing something, since the code is "else if
(vif)"

johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/01] staging: wilc1000: add missing address space specifier

2015-12-10 Thread Anatoly Stepanov
This fixes the following sparse warnings:
1. warning: incorrect type in argument 2 (different address spaces)
2. warning: incorrect type in initializer (incompatible argument 2 (different 
address spaces))

Signed-off-by: Anatoly Stepanov 
---
 drivers/staging/wilc1000/wilc_debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_debugfs.c 
b/drivers/staging/wilc1000/wilc_debugfs.c
index ae11186..877659f 100644
--- a/drivers/staging/wilc1000/wilc_debugfs.c
+++ b/drivers/staging/wilc1000/wilc_debugfs.c
@@ -87,7 +87,7 @@ static ssize_t wilc_debug_region_read(struct file *file, char 
__user *userbuf, s
return simple_read_from_buffer(userbuf, count, ppos, buf, res);
 }
 
-static ssize_t wilc_debug_region_write(struct file *filp, const char *buf, 
size_t count, loff_t *ppos)
+static ssize_t wilc_debug_region_write(struct file *filp, const char __user 
*buf, size_t count, loff_t *ppos)
 {
char buffer[128] = {};
int flag;
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 00/01] staging: wilc1000: fix sparse issue

2015-12-10 Thread Anatoly Stepanov
Greetings!

This patch fixes sparse static analyzer issue in wilc1000 driver.

Anatoly Stepanov (1):
  staging: wilc1000: add missing address space specifier

 drivers/staging/wilc1000/wilc_debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Cannot unsubscribe

2015-12-10 Thread Mário Lopes

Hello all.

Our institution DNS as changed due to legal requirments, but old is  
kept active with redirection to new one.
So, when I send a e-mail, it is sent with new DNS. Also I'm receiving  
e-mails that are sent to older (probably as with this one from  
mailling list) due to redirection.
Basically I'm receiving messages from mailing list and when I do  
unsubscribe, I receive e-mail like " [...] is not a member of list  
'linux-wireless'".
I've also contacted linux-wireless-approval@... about this issue as  
told on that response, but no reply so far.

So, how can I unsubscribe?

Thanks.


BR,
Mário Lopes




This message was sent using IMP, the Internet Messaging Program.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 01/13] brcmfmac: Simplify scan timing configuration.

2015-12-10 Thread Arend van Spriel
On 09-12-15 14:06, Kalle Valo wrote:
> Arend van Spriel  writes:
> 
>> From: Hante Meuleman 
>>
> 
> Please, no empty commit logs. For a patch like this it takes like 30
> seconds to write a short log describing why and how you are simplifying
> the code. Next year I'm thinking of start rejecting patches without a
> commit log.

Time to consider new year resolutions, heh ;-) Anyway, it is noted and
will see if I can gatekeep this better.

> This is a minor nitpick but it's not that common to the commit title
> with a period.

Have to agree to the nitpicking part :-p Can keep it in mind though.

>> Reviewed-by: Arend Van Spriel 
>> Reviewed-by: Pieter-Paul Giesberts 
>> Signed-off-by: Hante Meuleman 
>> Change-Id: Ie179527eb29f2ed8b7869dac24591e2513775393
>> Reviewed-on: http://hnd-swgit.sj.broadcom.com:8080/5445
>> Reviewed-by: brcm80211 ci 
>> Signed-off-by: Arend van Spriel 
> 
> Forgot to clean the tags? :)

*sigh* Obviously. Should not try to multitask when preparing patch series.

Gr. AvS

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 01/13] brcmfmac: Simplify scan timing configuration.

2015-12-10 Thread Arend van Spriel
On 10-12-15 11:24, Arend van Spriel wrote:
> On 09-12-15 14:06, Kalle Valo wrote:
>> Arend van Spriel  writes:
>>
>>> From: Hante Meuleman 
>>>
>>
>> Please, no empty commit logs. For a patch like this it takes like 30
>> seconds to write a short log describing why and how you are simplifying
>> the code. Next year I'm thinking of start rejecting patches without a
>> commit log.
> 
> Time to consider new year resolutions, heh ;-) Anyway, it is noted and
> will see if I can gatekeep this better.
> 
>> This is a minor nitpick but it's not that common to the commit title
>> with a period.
> 
> Have to agree to the nitpicking part :-p Can keep it in mind though.

Had to check ;-) In 4.4 merge window there 297 commits ending with
period. With 13220 commits in total that can not be called common indeed.

Gr. AvS
>>> Reviewed-by: Arend Van Spriel 
>>> Reviewed-by: Pieter-Paul Giesberts 
>>> Signed-off-by: Hante Meuleman 
>>> Change-Id: Ie179527eb29f2ed8b7869dac24591e2513775393
>>> Reviewed-on: http://hnd-swgit.sj.broadcom.com:8080/5445
>>> Reviewed-by: brcm80211 ci 
>>> Signed-off-by: Arend van Spriel 
>>
>> Forgot to clean the tags? :)
> 
> *sigh* Obviously. Should not try to multitask when preparing patch series.
> 
> Gr. AvS
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 01/13] brcmfmac: Simplify scan timing configuration.

2015-12-10 Thread Arend van Spriel

On 12/10/2015 11:24 AM, Arend van Spriel wrote:

On 09-12-15 14:06, Kalle Valo wrote:

Arend van Spriel  writes:


From: Hante Meuleman 



Please, no empty commit logs. For a patch like this it takes like 30
seconds to write a short log describing why and how you are simplifying
the code. Next year I'm thinking of start rejecting patches without a
commit log.


Time to consider new year resolutions, heh ;-) Anyway, it is noted and
will see if I can gatekeep this better.


This is a minor nitpick but it's not that common to the commit title
with a period.


Have to agree to the nitpicking part :-p Can keep it in mind though.


Reviewed-by: Arend Van Spriel 
Reviewed-by: Pieter-Paul Giesberts 
Signed-off-by: Hante Meuleman 
Change-Id: Ie179527eb29f2ed8b7869dac24591e2513775393
Reviewed-on: http://hnd-swgit.sj.broadcom.com:8080/5445
Reviewed-by: brcm80211 ci 
Signed-off-by: Arend van Spriel 


Forgot to clean the tags? :)


*sigh* Obviously. Should not try to multitask when preparing patch series.


Do you want me to resend after cleaning it up?

Gr. AvS


Gr. AvS



--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] iwlegacy: mark il_adjust_beacon_interval as noinline

2015-12-10 Thread Stanislaw Gruszka
On Wed, Dec 09, 2015 at 05:42:41PM +0100, Arnd Bergmann wrote:
> With the new optimized do_div() code, some versions of gcc
> produce obviously incorrect code that leads to a link error
> in iwlegacy/common.o:
> 
> drivers/built-in.o: In function `il_send_rxon_timing':
> :(.text+0xa6b4d4): undefined reference to `ilog2_NaN'
> :(.text+0xa6b4f0): undefined reference to `__aeabi_uldivmod'
> 
> In a few thousand randconfig builds, I have seen this problem
> a couple of times in this file, but never anywhere else in the
> kernel, so we can try to work around this in the only file
> that shows the behavior, by marking the il_adjust_beacon_interval
> function as noinline, which convinces gcc to use the unoptimized
> do_div() all the time.

I don't think this is good way to "fix" the issue, but also have
nothing against to this particular change.

Acked-by: Stanislaw Gruszka 
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 01/13] brcmfmac: Simplify scan timing configuration.

2015-12-10 Thread Kalle Valo
Arend van Spriel  writes:

> On 12/10/2015 11:24 AM, Arend van Spriel wrote:
>> On 09-12-15 14:06, Kalle Valo wrote:
>>> Arend van Spriel  writes:
>>>
 Reviewed-by: Arend Van Spriel 
 Reviewed-by: Pieter-Paul Giesberts 
 Signed-off-by: Hante Meuleman 
 Change-Id: Ie179527eb29f2ed8b7869dac24591e2513775393
 Reviewed-on: http://hnd-swgit.sj.broadcom.com:8080/5445
 Reviewed-by: brcm80211 ci 
 Signed-off-by: Arend van Spriel 
>>>
>>> Forgot to clean the tags? :)
>>
>> *sigh* Obviously. Should not try to multitask when preparing patch series.
>
> Do you want me to resend after cleaning it up?

Yeah, that would be the best.

-- 
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Cannot unsubscribe

2015-12-10 Thread Kalle Valo
Mário Lopes  writes:

> Our institution DNS as changed due to legal requirments, but old is
> kept active with redirection to new one. So, when I send a e-mail, it
> is sent with new DNS. Also I'm receiving e-mails that are sent to
> older (probably as with this one from mailling list) due to
> redirection. Basically I'm receiving messages from mailing list and
> when I do unsubscribe, I receive e-mail like " [...] is not a member
> of list 'linux-wireless'". I've also contacted
> linux-wireless-approval@... about this issue as told on that response,
> but no reply so far. So, how can I unsubscribe?

For the unsubcribe mail just change the From address to use your old
address, that should be easy to. And based on [1] make sure that Sender
and Reply-To headers also match.

[1] http://vger.kernel.org/majordomo-info.html

-- 
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v7] Add new mac80211 driver mwlwifi.

2015-12-10 Thread Kalle Valo
David Lin  writes:

>> > +#define MWL_DRV_NAME KBUILD_MODNAME
>> > +#define MWL_DRV_VERSION    "10.3.0.14"
>> 
>> versions like that are generally fairly useless since you don't update them 
>> for
>> every commit ...
>> 
>
> We still need version information for formal release.

Then use git commit ids for tracking the driver version. Using manual
version strings for drivers don't work, it has been tried multiple times
and they are always out of sync.

-- 
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2 10/13] brcmfmac: add 43242 device id for LG dongle

2015-12-10 Thread Arend van Spriel
Got a hint on IRC that a 43242 dongle for LG smart TV's works with
brcmfmac:

> Hello - I recently got a LG AN-WF500 wireless dongle for LG's SmartTVs.
> From the information I gathered it uses a Broadcom chipset BCM43242.
> The device should have been supported by brcmfmac kernel driver if it used
> USB IDs 0a5c:bd1f.
> My device however identifies itself as "ID 043e:3101 LG Electronics USA, 
> Inc.".
> I then tried adding the USB ID to the driver with
> "echo "043e 3101" > /sys/bus/usb/drivers/brcmfmac/new_id" and it just works.
> The kernel provides the following information.
> [15958.851291] usb 3-1.1.3: new high-speed USB device number 53 using ehci-pci
> [15958.946723] usb 3-1.1.3: New USB device found, idVendor=043e, 
> idProduct=3101
> [15958.946728] usb 3-1.1.3: New USB device strings: Mfr=1, Product=4, 
> SerialNumber=3
> [15958.946731] usb 3-1.1.3: Product: Composite Wireless Adapter
> [15958.946733] usb 3-1.1.3: Manufacturer: Broadcom
> [15958.946735] usb 3-1.1.3: SerialNumber: 28458

Reported-by: Johannes Berg 
Reviewed-by: Pieter-Paul Giesberts 
Reviewed-by: Hante Meuleman 
Signed-off-by: Arend van Spriel 
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c| 1 +
 drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
index 23eaf0f..66c26a9 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
@@ -1452,6 +1452,7 @@ static struct usb_device_id brcmf_usb_devid_table[] = {
BRCMF_USB_DEVICE(BRCM_USB_43236_DEVICE_ID),
BRCMF_USB_DEVICE(BRCM_USB_43242_DEVICE_ID),
BRCMF_USB_DEVICE(BRCM_USB_43569_DEVICE_ID),
+   { USB_DEVICE(BRCM_USB_VENDOR_ID_LG, BRCM_USB_43242_LG_DEVICE_ID) },
/* special entry for device with firmware loaded and running */
BRCMF_USB_DEVICE(BRCM_USB_BCMFW_DEVICE_ID),
{ /* end: all zeroes */ }
diff --git a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h 
b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
index 4092d27..699f2c2 100644
--- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
+++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
@@ -21,6 +21,7 @@
 #include 
 
 #define BRCM_USB_VENDOR_ID_BROADCOM0x0a5c
+#define BRCM_USB_VENDOR_ID_LG  0x043e
 #define BRCM_PCIE_VENDOR_ID_BROADCOM   PCI_VENDOR_ID_BROADCOM
 
 /* Chipcommon Core Chip IDs */
@@ -57,6 +58,7 @@
 #define BRCM_USB_43143_DEVICE_ID   0xbd1e
 #define BRCM_USB_43236_DEVICE_ID   0xbd17
 #define BRCM_USB_43242_DEVICE_ID   0xbd1f
+#define BRCM_USB_43242_LG_DEVICE_ID0x3101
 #define BRCM_USB_43569_DEVICE_ID   0xbd27
 #define BRCM_USB_BCMFW_DEVICE_ID   0x0bdc
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2 04/13] brcmfmac: Cleanup pmksa cache handling code

2015-12-10 Thread Arend van Spriel
From: Hante Meuleman 

Reviewed-by: Arend Van Spriel 
Reviewed-by: Pieter-Paul Giesberts 
Signed-off-by: Hante Meuleman 
Signed-off-by: Arend van Spriel 
---
 .../broadcom/brcm80211/brcmfmac/cfg80211.c | 131 +
 .../broadcom/brcm80211/brcmfmac/cfg80211.h |   9 +-
 .../broadcom/brcm80211/brcmfmac/fwil_types.h   |  24 
 .../broadcom/brcm80211/include/brcmu_wifi.h|  23 
 4 files changed, 82 insertions(+), 105 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 5432c46..564e533 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -3223,26 +3223,22 @@ exit:
 }
 
 static __used s32
-brcmf_update_pmklist(struct net_device *ndev,
-struct brcmf_cfg80211_pmk_list *pmk_list, s32 err)
+brcmf_update_pmklist(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp)
 {
-   int i, j;
-   u32 pmkid_len;
+   struct brcmf_pmk_list_le *pmk_list;
+   int i;
+   u32 npmk;
+   s32 err;
 
-   pmkid_len = le32_to_cpu(pmk_list->pmkids.npmkid);
+   pmk_list = >pmk_list;
+   npmk = le32_to_cpu(pmk_list->npmk);
 
-   brcmf_dbg(CONN, "No of elements %d\n", pmkid_len);
-   for (i = 0; i < pmkid_len; i++) {
-   brcmf_dbg(CONN, "PMKID[%d]: %pM =\n", i,
- _list->pmkids.pmkid[i].BSSID);
-   for (j = 0; j < WLAN_PMKID_LEN; j++)
-   brcmf_dbg(CONN, "%02x\n",
- pmk_list->pmkids.pmkid[i].PMKID[j]);
-   }
+   brcmf_dbg(CONN, "No of elements %d\n", npmk);
+   for (i = 0; i < npmk; i++)
+   brcmf_dbg(CONN, "PMK[%d]: %pM\n", i, _list->pmk[i].bssid);
 
-   if (!err)
-   brcmf_fil_iovar_data_set(netdev_priv(ndev), "pmkid_info",
-(char *)pmk_list, sizeof(*pmk_list));
+   err = brcmf_fil_iovar_data_set(ifp, "pmkid_info", pmk_list,
+  sizeof(*pmk_list));
 
return err;
 }
@@ -3253,34 +3249,37 @@ brcmf_cfg80211_set_pmksa(struct wiphy *wiphy, struct 
net_device *ndev,
 {
struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
struct brcmf_if *ifp = netdev_priv(ndev);
-   struct pmkid_list *pmkids = >pmk_list->pmkids;
-   s32 err = 0;
-   u32 pmkid_len, i;
+   struct brcmf_pmksa *pmk = >pmk_list.pmk[0];
+   s32 err;
+   u32 npmk, i;
 
brcmf_dbg(TRACE, "Enter\n");
if (!check_vif_up(ifp->vif))
return -EIO;
 
-   pmkid_len = le32_to_cpu(pmkids->npmkid);
-   for (i = 0; i < pmkid_len; i++)
-   if (!memcmp(pmksa->bssid, pmkids->pmkid[i].BSSID, ETH_ALEN))
+   npmk = le32_to_cpu(cfg->pmk_list.npmk);
+   for (i = 0; i < npmk; i++)
+   if (!memcmp(pmksa->bssid, pmk[i].bssid, ETH_ALEN))
break;
-   if (i < WL_NUM_PMKIDS_MAX) {
-   memcpy(pmkids->pmkid[i].BSSID, pmksa->bssid, ETH_ALEN);
-   memcpy(pmkids->pmkid[i].PMKID, pmksa->pmkid, WLAN_PMKID_LEN);
-   if (i == pmkid_len) {
-   pmkid_len++;
-   pmkids->npmkid = cpu_to_le32(pmkid_len);
+   if (i < BRCMF_MAXPMKID) {
+   memcpy(pmk[i].bssid, pmksa->bssid, ETH_ALEN);
+   memcpy(pmk[i].pmkid, pmksa->pmkid, WLAN_PMKID_LEN);
+   if (i == npmk) {
+   npmk++;
+   cfg->pmk_list.npmk = cpu_to_le32(npmk);
}
-   } else
-   err = -EINVAL;
+   } else {
+   brcmf_err("Too many PMKSA entries cached %d\n", npmk);
+   return -EINVAL;
+   }
 
-   brcmf_dbg(CONN, "set_pmksa,IW_PMKSA_ADD - PMKID: %pM =\n",
- pmkids->pmkid[pmkid_len].BSSID);
-   for (i = 0; i < WLAN_PMKID_LEN; i++)
-   brcmf_dbg(CONN, "%02x\n", pmkids->pmkid[pmkid_len].PMKID[i]);
+   brcmf_dbg(CONN, "set_pmksa - PMK bssid: %pM =\n", pmk[npmk].bssid);
+   for (i = 0; i < WLAN_PMKID_LEN; i += 4)
+   brcmf_dbg(CONN, "%02x %02x %02x %02x\n", pmk[npmk].pmkid[i],
+ pmk[npmk].pmkid[i + 1], pmk[npmk].pmkid[i + 2],
+ pmk[npmk].pmkid[i + 3]);
 
-   err = brcmf_update_pmklist(ndev, cfg->pmk_list, err);
+   err = brcmf_update_pmklist(cfg, ifp);
 
brcmf_dbg(TRACE, "Exit\n");
return err;
@@ -3288,50 +3287,39 @@ brcmf_cfg80211_set_pmksa(struct wiphy *wiphy, struct 
net_device *ndev,
 
 static s32
 brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev,
- struct cfg80211_pmksa *pmksa)
+struct cfg80211_pmksa *pmksa)
 {

[PATCH V2 09/13] brcmfmac: fix waitqueue_active without memory barrier in brcmfmac driver

2015-12-10 Thread Arend van Spriel
From: Kosuke Tatsukawa 

brcmf_msgbuf_ioctl_resp_wake() seems to be missing a memory barrier
which might cause the waker to not notice the waiter and miss sending a
wake_up as in the following figure.

  brcmf_msgbuf_ioctl_resp_wake  brcmf_msgbuf_ioctl_resp_wait

if (waitqueue_active(>ioctl_resp_wait))
/* The CPU might reorder the test for
   the waitqueue up here, before
   prior writes complete */
   /* wait_event_timeout */
/* __wait_event_timeout */
 /* ___wait_event */
 prepare_to_wait_event(, &__wait,
   state);
 if (msgbuf->ctl_completed)
 ...
msgbuf->ctl_completed = true;
 schedule_timeout(__ret))


There are three other place in drivers/net/wireless/brcm80211/brcmfmac/
which have similar code.  The attached patch removes the call to
waitqueue_active() leaving just wake_up() behind.  This fixes the
problem because the call to spin_lock_irqsave() in wake_up() will be an
ACQUIRE operation.

I found this issue when I was looking through the linux source code
for places calling waitqueue_active() before wake_up*(), but without
preceding memory barriers, after sending a patch to fix a similar
issue in drivers/tty/n_tty.c  (Details about the original issue can be
found here: https://lkml.org/lkml/2015/9/28/849).

Reviewed-by: Hante Meuleman 
Reviewed-by: Franky (Zhenhui) Lin 
Reviewed-by: Pieter-Paul Giesberts 
Signed-off-by: Kosuke Tatsukawa 
Signed-off-by: Arend van Spriel 
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 3 +--
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c   | 6 ++
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c| 3 +--
 3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
index 44e618f..5df9138 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
@@ -473,8 +473,7 @@ static int brcmf_msgbuf_ioctl_resp_wait(struct brcmf_msgbuf 
*msgbuf)
 static void brcmf_msgbuf_ioctl_resp_wake(struct brcmf_msgbuf *msgbuf)
 {
msgbuf->ctl_completed = true;
-   if (waitqueue_active(>ioctl_resp_wait))
-   wake_up(>ioctl_resp_wait);
+   wake_up(>ioctl_resp_wait);
 }
 
 
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
index 9fa3a3a..ceb2a75 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -1678,8 +1678,7 @@ static int brcmf_sdio_dcmd_resp_wait(struct brcmf_sdio 
*bus, uint *condition,
 
 static int brcmf_sdio_dcmd_resp_wake(struct brcmf_sdio *bus)
 {
-   if (waitqueue_active(>dcmd_resp_wait))
-   wake_up_interruptible(>dcmd_resp_wait);
+   wake_up_interruptible(>dcmd_resp_wait);
 
return 0;
 }
@@ -2003,8 +2002,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, 
uint maxframes)
 static void
 brcmf_sdio_wait_event_wakeup(struct brcmf_sdio *bus)
 {
-   if (waitqueue_active(>ctrl_wait))
-   wake_up_interruptible(>ctrl_wait);
+   wake_up_interruptible(>ctrl_wait);
return;
 }
 
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
index ccde559..23eaf0f 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
@@ -196,8 +196,7 @@ static int brcmf_usb_ioctl_resp_wait(struct 
brcmf_usbdev_info *devinfo)
 
 static void brcmf_usb_ioctl_resp_wake(struct brcmf_usbdev_info *devinfo)
 {
-   if (waitqueue_active(>ioctl_resp_wait))
-   wake_up(>ioctl_resp_wait);
+   wake_up(>ioctl_resp_wait);
 }
 
 static void
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2 03/13] brcmfmac: Remove some redundant cfg80211 data

2015-12-10 Thread Arend van Spriel
From: Hante Meuleman 

Reviewed-by: Arend Van Spriel 
Reviewed-by: Pieter-Paul Giesberts 
Signed-off-by: Hante Meuleman 
Signed-off-by: Arend van Spriel 
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |  1 -
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h | 10 --
 2 files changed, 11 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index b7b60f52..5432c46 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -5203,7 +5203,6 @@ static void brcmf_init_conf(struct brcmf_cfg80211_conf 
*conf)
conf->rts_threshold = (u32)-1;
conf->retry_short = (u32)-1;
conf->retry_long = (u32)-1;
-   conf->tx_power = -1;
 }
 
 static void brcmf_register_event_handlers(struct brcmf_cfg80211_info *cfg)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
index e77f137..ec8d1f8 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
@@ -95,14 +95,6 @@ struct brcmf_cfg80211_conf {
u32 rts_threshold;
u32 retry_short;
u32 retry_long;
-   s32 tx_power;
-   struct ieee80211_channel channel;
-};
-
-/* basic structure of information element */
-struct brcmf_cfg80211_ie {
-   u16 offset;
-   u8 buf[WL_TLV_INFO_MAX];
 };
 
 /* security information with currently associated ap */
@@ -333,7 +325,6 @@ struct brcmf_cfg80211_vif_event {
  * @usr_sync: mainly for dongle up/down synchronization.
  * @bss_list: bss_list holding scanned ap information.
  * @bss_info: bss information for cfg80211 layer.
- * @ie: information element object for internal purpose.
  * @conn_info: association info.
  * @pmk_list: wpa2 pmk list.
  * @scan_status: scan activity on the dongle.
@@ -367,7 +358,6 @@ struct brcmf_cfg80211_info {
struct cfg80211_scan_request *scan_request;
struct mutex usr_sync;
struct wl_cfg80211_bss_info *bss_info;
-   struct brcmf_cfg80211_ie ie;
struct brcmf_cfg80211_connect_info conn_info;
struct brcmf_cfg80211_pmk_list *pmk_list;
unsigned long scan_status;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2 05/13] brcmfmac: Make TDLS a detectable feature

2015-12-10 Thread Arend van Spriel
From: Hante Meuleman 

Reviewed-by: Arend Van Spriel 
Reviewed-by: Pieter-Paul Giesberts 
Signed-off-by: Hante Meuleman 
Signed-off-by: Arend van Spriel 
---
 .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 21 -
 .../wireless/broadcom/brcm80211/brcmfmac/feature.c  |  1 +
 .../wireless/broadcom/brcm80211/brcmfmac/feature.h  |  4 +++-
 3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 564e533..8557566 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -5983,8 +5983,9 @@ static int brcmf_setup_wiphy(struct wiphy *wiphy, struct 
brcmf_if *ifp)
wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT |
WIPHY_FLAG_OFFCHAN_TX |
-   WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
-   WIPHY_FLAG_SUPPORTS_TDLS;
+   WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
+   if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_TDLS))
+   wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS;
if (!brcmf_roamoff)
wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM;
wiphy->mgmt_stypes = brcmf_txrx_stypes;
@@ -6376,13 +6377,15 @@ struct brcmf_cfg80211_info 
*brcmf_cfg80211_attach(struct brcmf_pub *drvr,
goto wiphy_unreg_out;
}
 
-   err = brcmf_fil_iovar_int_set(ifp, "tdls_enable", 1);
-   if (err) {
-   brcmf_dbg(INFO, "TDLS not enabled (%d)\n", err);
-   wiphy->flags &= ~WIPHY_FLAG_SUPPORTS_TDLS;
-   } else {
-   brcmf_fweh_register(cfg->pub, BRCMF_E_TDLS_PEER_EVENT,
-   brcmf_notify_tdls_peer_event);
+   if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_TDLS)) {
+   err = brcmf_fil_iovar_int_set(ifp, "tdls_enable", 1);
+   if (err) {
+   brcmf_dbg(INFO, "TDLS not enabled (%d)\n", err);
+   wiphy->flags &= ~WIPHY_FLAG_SUPPORTS_TDLS;
+   } else {
+   brcmf_fweh_register(cfg->pub, BRCMF_E_TDLS_PEER_EVENT,
+   brcmf_notify_tdls_peer_event);
+   }
}
 
/* (re-) activate FWEH event handling */
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
index ba52494..d9d1ca4 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
@@ -138,6 +138,7 @@ void brcmf_feat_attach(struct brcmf_pub *drvr)
brcmf_feat_iovar_int_set(ifp, BRCMF_FEAT_MBSS, "mbss", 0);
brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_P2P, "p2p");
brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_RSDB, "rsdb_mode");
+   brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_TDLS, "tdls_enable");
 
if (brcmf_feature_disable) {
brcmf_dbg(INFO, "Features: 0x%02x, disable: 0x%02x\n",
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
index 5381758..1390656 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
@@ -25,6 +25,7 @@
  * WOWL: Wake-On-WLAN.
  * P2P: peer-to-peer
  * RSDB: Real Simultaneous Dual Band
+ * TDLS: Tunneled Direct Link Setup
  */
 #define BRCMF_FEAT_LIST \
BRCMF_FEAT_DEF(MBSS) \
@@ -32,7 +33,8 @@
BRCMF_FEAT_DEF(PNO) \
BRCMF_FEAT_DEF(WOWL) \
BRCMF_FEAT_DEF(P2P) \
-   BRCMF_FEAT_DEF(RSDB)
+   BRCMF_FEAT_DEF(RSDB) \
+   BRCMF_FEAT_DEF(TDLS)
 
 /*
  * Quirks:
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2 00/13] brcmfmac: IBSS fix and cleanup

2015-12-10 Thread Arend van Spriel
This series provides following:
* fix IBSS which got broken over time.
* new USB id for bcm43242 dongle.
* arp offload configuration through inet notifier.

The series is intended for 4.5 kernel and applies to master branch
of the wireless-drivers-next repository.

Arend van Spriel (2):
  brcmfmac: no interface combination check for single interface
  brcmfmac: add 43242 device id for LG dongle

Franky Lin (1):
  brcmfmac: add arp offload ip address table configuration support

Hante Meuleman (9):
  brcmfmac: Simplify scan timing configuration.
  brcmfmac: Use local storage for ssid iovar.
  brcmfmac: Remove some redundant cfg80211 data.
  brcmfmac: Cleanup pmksa cache handling code.
  brcmfmac: Make TDLS a detectable feature.
  brcmfmac: Add support for PCIE 4350 revision 5 device.
  brcmfmac: Fix IBSS setup.
  brcmfmac: Change error print in debug print.
  brcmfmac: Move scheduled scan related interface layer structs.

Kosuke Tatsukawa (1):
  brcmfmac: fix waitqueue_active without memory barrier in brcmfmac
driver

 .../broadcom/brcm80211/brcmfmac/cfg80211.c | 233 ++---
 .../broadcom/brcm80211/brcmfmac/cfg80211.h | 111 +-
 .../wireless/broadcom/brcm80211/brcmfmac/core.c| 108 ++
 .../wireless/broadcom/brcm80211/brcmfmac/core.h|   2 +
 .../wireless/broadcom/brcm80211/brcmfmac/feature.c |   1 +
 .../wireless/broadcom/brcm80211/brcmfmac/feature.h |   4 +-
 .../broadcom/brcm80211/brcmfmac/fwil_types.h   | 105 ++
 .../wireless/broadcom/brcm80211/brcmfmac/msgbuf.c  |   3 +-
 .../wireless/broadcom/brcm80211/brcmfmac/pcie.c|   8 +-
 .../wireless/broadcom/brcm80211/brcmfmac/sdio.c|   6 +-
 .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c |   4 +-
 .../broadcom/brcm80211/include/brcm_hw_ids.h   |   2 +
 .../broadcom/brcm80211/include/brcmu_wifi.h|  23 --
 13 files changed, 342 insertions(+), 268 deletions(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2 11/13] brcmfmac: Change error print in debug print

2015-12-10 Thread Arend van Spriel
From: Hante Meuleman 

The pcie suspend and resume routines contain some error prints,
which should have been debug prints.

Reviewed-by: Arend Van Spriel 
Reviewed-by: Pieter-Paul Giesberts 
Signed-off-by: Hante Meuleman 
Change-Id: Ibafe5d38301ee8f5e86889259ddeaea4dcae4cee
Reviewed-on: http://hnd-swgit.sj.broadcom.com:8080/5581
Reviewed-by: brcm80211 ci 
Signed-off-by: Arend van Spriel 
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
index 4ebc53c..3d2d790 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
@@ -1875,7 +1875,7 @@ static int brcmf_pcie_pm_enter_D3(struct device *dev)
struct brcmf_pciedev_info *devinfo;
struct brcmf_bus *bus;
 
-   brcmf_err("Enter\n");
+   brcmf_dbg(PCIE, "Enter\n");
 
bus = dev_get_drvdata(dev);
devinfo = bus->bus_priv.pcie->devinfo;
@@ -1906,7 +1906,7 @@ static int brcmf_pcie_pm_leave_D3(struct device *dev)
struct pci_dev *pdev;
int err;
 
-   brcmf_err("Enter\n");
+   brcmf_dbg(PCIE, "Enter\n");
 
bus = dev_get_drvdata(dev);
devinfo = bus->bus_priv.pcie->devinfo;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2 01/13] brcmfmac: Simplify scan timing configuration

2015-12-10 Thread Arend van Spriel
From: Hante Meuleman 

No need to pass timing configuration in local functions as they are
static anyway.

Reviewed-by: Arend Van Spriel 
Reviewed-by: Pieter-Paul Giesberts 
Signed-off-by: Hante Meuleman 
Signed-off-by: Arend van Spriel 
---
 .../broadcom/brcm80211/brcmfmac/cfg80211.c | 31 +-
 .../broadcom/brcm80211/brcmfmac/cfg80211.h |  4 ---
 2 files changed, 12 insertions(+), 23 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 771c581..4aebb2a 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -91,6 +91,10 @@
 #define BRCMF_SCAN_JOIN_PASSIVE_DWELL_TIME_MS  400
 #define BRCMF_SCAN_JOIN_PROBE_INTERVAL_MS  20
 
+#define BRCMF_SCAN_CHANNEL_TIME40
+#define BRCMF_SCAN_UNASSOC_TIME40
+#define BRCMF_SCAN_PASSIVE_TIME120
+
 #define BRCMF_ASSOC_PARAMS_FIXED_SIZE \
(sizeof(struct brcmf_assoc_params_le) - sizeof(u16))
 
@@ -5357,37 +5361,27 @@ roam_setup_done:
 }
 
 static s32
-brcmf_dongle_scantime(struct brcmf_if *ifp, s32 scan_assoc_time,
- s32 scan_unassoc_time, s32 scan_passive_time)
+brcmf_dongle_scantime(struct brcmf_if *ifp)
 {
s32 err = 0;
 
err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME,
-   scan_assoc_time);
+   BRCMF_SCAN_CHANNEL_TIME);
if (err) {
-   if (err == -EOPNOTSUPP)
-   brcmf_dbg(INFO, "Scan assoc time is not supported\n");
-   else
-   brcmf_err("Scan assoc time error (%d)\n", err);
+   brcmf_err("Scan assoc time error (%d)\n", err);
goto dongle_scantime_out;
}
err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME,
-   scan_unassoc_time);
+   BRCMF_SCAN_UNASSOC_TIME);
if (err) {
-   if (err == -EOPNOTSUPP)
-   brcmf_dbg(INFO, "Scan unassoc time is not supported\n");
-   else
-   brcmf_err("Scan unassoc time error (%d)\n", err);
+   brcmf_err("Scan unassoc time error (%d)\n", err);
goto dongle_scantime_out;
}
 
err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_PASSIVE_TIME,
-   scan_passive_time);
+   BRCMF_SCAN_PASSIVE_TIME);
if (err) {
-   if (err == -EOPNOTSUPP)
-   brcmf_dbg(INFO, "Scan passive time is not supported\n");
-   else
-   brcmf_err("Scan passive time error (%d)\n", err);
+   brcmf_err("Scan passive time error (%d)\n", err);
goto dongle_scantime_out;
}
 
@@ -6089,8 +6083,7 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_info 
*cfg)
/* make sure RF is ready for work */
brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 0);
 
-   brcmf_dongle_scantime(ifp, WL_SCAN_CHANNEL_TIME,
- WL_SCAN_UNASSOC_TIME, WL_SCAN_PASSIVE_TIME);
+   brcmf_dongle_scantime(ifp);
 
power_mode = cfg->pwr_save ? PM_FAST : PM_OFF;
err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, power_mode);
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
index d492163..cf7a93d 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
@@ -29,10 +29,6 @@
 #define WL_ROAM_TRIGGER_LEVEL  -75
 #define WL_ROAM_DELTA  20
 
-#define WL_SCAN_CHANNEL_TIME   40
-#define WL_SCAN_UNASSOC_TIME   40
-#define WL_SCAN_PASSIVE_TIME   120
-
 #define WL_ESCAN_BUF_SIZE  (1024 * 64)
 #define WL_ESCAN_TIMER_INTERVAL_MS 1 /* E-Scan timeout */
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2 12/13] brcmfmac: Move scheduled scan related interface layer structs

2015-12-10 Thread Arend van Spriel
From: Hante Meuleman 

All interface layer related to scheduled scan are moved in
fwil_types.h

Reviewed-by: Arend Van Spriel 
Reviewed-by: Pieter-Paul Giesberts 
Signed-off-by: Hante Meuleman 
Signed-off-by: Arend van Spriel 
---
 .../broadcom/brcm80211/brcmfmac/cfg80211.h | 81 --
 .../broadcom/brcm80211/brcmfmac/fwil_types.h   | 81 ++
 2 files changed, 81 insertions(+), 81 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
index 397d41b..c17b6d5 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
@@ -211,87 +211,6 @@ struct escan_info {
 };
 
 /**
- * struct brcmf_pno_param_le - PNO scan configuration parameters
- *
- * @version: PNO parameters version.
- * @scan_freq: scan frequency.
- * @lost_network_timeout: #sec. to declare discovered network as lost.
- * @flags: Bit field to control features of PFN such as sort criteria auto
- * enable switch and background scan.
- * @rssi_margin: Margin to avoid jitter for choosing a PFN based on RSSI sort
- * criteria.
- * @bestn: number of best networks in each scan.
- * @mscan: number of scans recorded.
- * @repeat: minimum number of scan intervals before scan frequency changes
- * in adaptive scan.
- * @exp: exponent of 2 for maximum scan interval.
- * @slow_freq: slow scan period.
- */
-struct brcmf_pno_param_le {
-   __le32 version;
-   __le32 scan_freq;
-   __le32 lost_network_timeout;
-   __le16 flags;
-   __le16 rssi_margin;
-   u8 bestn;
-   u8 mscan;
-   u8 repeat;
-   u8 exp;
-   __le32 slow_freq;
-};
-
-/**
- * struct brcmf_pno_net_param_le - scan parameters per preferred network.
- *
- * @ssid: ssid name and its length.
- * @flags: bit2: hidden.
- * @infra: BSS vs IBSS.
- * @auth: Open vs Closed.
- * @wpa_auth: WPA type.
- * @wsec: wsec value.
- */
-struct brcmf_pno_net_param_le {
-   struct brcmf_ssid_le ssid;
-   __le32 flags;
-   __le32 infra;
-   __le32 auth;
-   __le32 wpa_auth;
-   __le32 wsec;
-};
-
-/**
- * struct brcmf_pno_net_info_le - information per found network.
- *
- * @bssid: BSS network identifier.
- * @channel: channel number only.
- * @SSID_len: length of ssid.
- * @SSID: ssid characters.
- * @RSSI: receive signal strength (in dBm).
- * @timestamp: age in seconds.
- */
-struct brcmf_pno_net_info_le {
-   u8 bssid[ETH_ALEN];
-   u8 channel;
-   u8 SSID_len;
-   u8 SSID[32];
-   __le16  RSSI;
-   __le16  timestamp;
-};
-
-/**
- * struct brcmf_pno_scanresults_le - result returned in PNO NET FOUND event.
- *
- * @version: PNO version identifier.
- * @status: indicates completion status of PNO scan.
- * @count: amount of brcmf_pno_net_info_le entries appended.
- */
-struct brcmf_pno_scanresults_le {
-   __le32 version;
-   __le32 status;
-   __le32 count;
-};
-
-/**
  * struct brcmf_cfg80211_vif_event - virtual interface event information.
  *
  * @vif_wq: waitqueue awaiting interface event from firmware.
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
index e56eabc..94d34ad 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
@@ -670,4 +670,85 @@ struct brcmf_pmk_list_le {
struct brcmf_pmksa pmk[BRCMF_MAXPMKID];
 };
 
+/**
+ * struct brcmf_pno_param_le - PNO scan configuration parameters
+ *
+ * @version: PNO parameters version.
+ * @scan_freq: scan frequency.
+ * @lost_network_timeout: #sec. to declare discovered network as lost.
+ * @flags: Bit field to control features of PFN such as sort criteria auto
+ * enable switch and background scan.
+ * @rssi_margin: Margin to avoid jitter for choosing a PFN based on RSSI sort
+ * criteria.
+ * @bestn: number of best networks in each scan.
+ * @mscan: number of scans recorded.
+ * @repeat: minimum number of scan intervals before scan frequency changes
+ * in adaptive scan.
+ * @exp: exponent of 2 for maximum scan interval.
+ * @slow_freq: slow scan period.
+ */
+struct brcmf_pno_param_le {
+   __le32 version;
+   __le32 scan_freq;
+   __le32 lost_network_timeout;
+   __le16 flags;
+   __le16 rssi_margin;
+   u8 bestn;
+   u8 mscan;
+   u8 repeat;
+   u8 exp;
+   __le32 slow_freq;
+};
+
+/**
+ * struct brcmf_pno_net_param_le - scan parameters per preferred network.
+ *
+ * @ssid: ssid name and its length.
+ * @flags: bit2: hidden.
+ * @infra: BSS vs IBSS.
+ * @auth: Open vs Closed.
+ * @wpa_auth: WPA type.
+ * @wsec: wsec value.
+ */
+struct brcmf_pno_net_param_le {
+   struct brcmf_ssid_le ssid;
+

[PATCH V2 02/13] brcmfmac: Use local storage for ssid iovar

2015-12-10 Thread Arend van Spriel
From: Hante Meuleman 

Reviewed-by: Arend Van Spriel 
Reviewed-by: Pieter-Paul Giesberts 
Signed-off-by: Hante Meuleman 
Signed-off-by: Arend van Spriel 
---
 .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c| 18 +-
 .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.h|  7 ---
 2 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 4aebb2a..b7b60f52 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -1031,11 +1031,11 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct 
brcmf_cfg80211_vif *vif,
struct brcmf_if *ifp = vif->ifp;
struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
struct cfg80211_ssid *ssids;
-   struct brcmf_cfg80211_scan_req *sr = >scan_req_int;
u32 passive_scan;
bool escan_req;
bool spec_scan;
s32 err;
+   struct brcmf_ssid_le ssid_le;
u32 SSID_len;
 
brcmf_dbg(SCAN, "START ESCAN\n");
@@ -1088,13 +1088,13 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct 
brcmf_cfg80211_vif *vif,
} else {
brcmf_dbg(SCAN, "ssid \"%s\", ssid_len (%d)\n",
  ssids->ssid, ssids->ssid_len);
-   memset(>ssid_le, 0, sizeof(sr->ssid_le));
-   SSID_len = min_t(u8, sizeof(sr->ssid_le.SSID), ssids->ssid_len);
-   sr->ssid_le.SSID_len = cpu_to_le32(0);
+   memset(_le, 0, sizeof(ssid_le));
+   SSID_len = min_t(u8, sizeof(ssid_le.SSID), ssids->ssid_len);
+   ssid_le.SSID_len = cpu_to_le32(0);
spec_scan = false;
if (SSID_len) {
-   memcpy(sr->ssid_le.SSID, ssids->ssid, SSID_len);
-   sr->ssid_le.SSID_len = cpu_to_le32(SSID_len);
+   memcpy(ssid_le.SSID, ssids->ssid, SSID_len);
+   ssid_le.SSID_len = cpu_to_le32(SSID_len);
spec_scan = true;
} else
brcmf_dbg(SCAN, "Broadcast scan\n");
@@ -1107,12 +1107,12 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct 
brcmf_cfg80211_vif *vif,
goto scan_out;
}
brcmf_scan_config_mpc(ifp, 0);
-   err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCAN,
->ssid_le, sizeof(sr->ssid_le));
+   err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCAN, _le,
+sizeof(ssid_le));
if (err) {
if (err == -EBUSY)
brcmf_dbg(INFO, "BUSY: scan for \"%s\" 
canceled\n",
- sr->ssid_le.SSID);
+ ssid_le.SSID);
else
brcmf_err("WLC_SCAN error (%d)\n", err);
 
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
index cf7a93d..e77f137 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
@@ -99,11 +99,6 @@ struct brcmf_cfg80211_conf {
struct ieee80211_channel channel;
 };
 
-/* basic structure of scan request */
-struct brcmf_cfg80211_scan_req {
-   struct brcmf_ssid_le ssid_le;
-};
-
 /* basic structure of information element */
 struct brcmf_cfg80211_ie {
u16 offset;
@@ -337,7 +332,6 @@ struct brcmf_cfg80211_vif_event {
  * @scan_request: cfg80211 scan request object.
  * @usr_sync: mainly for dongle up/down synchronization.
  * @bss_list: bss_list holding scanned ap information.
- * @scan_req_int: internal scan request object.
  * @bss_info: bss information for cfg80211 layer.
  * @ie: information element object for internal purpose.
  * @conn_info: association info.
@@ -372,7 +366,6 @@ struct brcmf_cfg80211_info {
struct brcmf_btcoex_info *btcoex;
struct cfg80211_scan_request *scan_request;
struct mutex usr_sync;
-   struct brcmf_cfg80211_scan_req scan_req_int;
struct wl_cfg80211_bss_info *bss_info;
struct brcmf_cfg80211_ie ie;
struct brcmf_cfg80211_connect_info conn_info;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2 06/13] brcmfmac: Add support for PCIE 4350 revision 5 device

2015-12-10 Thread Arend van Spriel
From: Hante Meuleman 

Reviewed-by: Arend Van Spriel 
Reviewed-by: Pieter-Paul Giesberts 
Signed-off-by: Hante Meuleman 
Change-Id: I72b519ec6a7ff0d36f076df06d042f0c5894142c
Reviewed-on: http://hnd-swgit.sj.broadcom.com:8080/5513
Signed-off-by: Arend van Spriel 
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
index b5a4247..4ebc53c 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
@@ -46,6 +46,7 @@ enum brcmf_pcie_state {
 
 BRCMF_FW_NVRAM_DEF(43602, "brcmfmac43602-pcie.bin", "brcmfmac43602-pcie.txt");
 BRCMF_FW_NVRAM_DEF(4350, "brcmfmac4350-pcie.bin", "brcmfmac4350-pcie.txt");
+BRCMF_FW_NVRAM_DEF(4350C, "brcmfmac4350c2-pcie.bin", 
"brcmfmac4350c2-pcie.txt");
 BRCMF_FW_NVRAM_DEF(4356, "brcmfmac4356-pcie.bin", "brcmfmac4356-pcie.txt");
 BRCMF_FW_NVRAM_DEF(43570, "brcmfmac43570-pcie.bin", "brcmfmac43570-pcie.txt");
 BRCMF_FW_NVRAM_DEF(4358, "brcmfmac4358-pcie.bin", "brcmfmac4358-pcie.txt");
@@ -56,7 +57,8 @@ BRCMF_FW_NVRAM_DEF(4371, "brcmfmac4371-pcie.bin", 
"brcmfmac4371-pcie.txt");
 
 static struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = {
BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43602_CHIP_ID, 0x, 43602),
-   BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4350_CHIP_ID, 0x, 4350),
+   BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4350_CHIP_ID, 0x00FF, 4350C),
+   BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4350_CHIP_ID, 0xFF00, 4350),
BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4356_CHIP_ID, 0x, 4356),
BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43567_CHIP_ID, 0x, 43570),
BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43569_CHIP_ID, 0x, 43570),
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2 13/13] brcmfmac: add arp offload ip address table configuration support

2015-12-10 Thread Arend van Spriel
From: Franky Lin 

Obtain ipv4 address through inetaddr notification for ARP offload host
ip table configuration.

Signed-off-by: Franky Lin 
Signed-off-by: Arend van Spriel 
---
 .../wireless/broadcom/brcm80211/brcmfmac/core.c| 108 +
 .../wireless/broadcom/brcm80211/brcmfmac/core.h|   2 +
 2 files changed, 110 insertions(+)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
index 3a39192..2631f6f 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -620,6 +621,8 @@ static int brcmf_netdev_stop(struct net_device *ndev)
 
brcmf_cfg80211_down(ndev);
 
+   brcmf_fil_iovar_data_set(ifp, "arp_hostip_clear", NULL, 0);
+
brcmf_net_setcarrier(ifp, false);
 
return 0;
@@ -940,6 +943,98 @@ int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr)
return available ? bsscfgidx : -ENOMEM;
 }
 
+#ifdef CONFIG_INET
+#define ARPOL_MAX_ENTRIES  8
+static int brcmf_inetaddr_changed(struct notifier_block *nb,
+ unsigned long action, void *data)
+{
+   struct brcmf_pub *drvr = container_of(nb, struct brcmf_pub,
+ inetaddr_notifier);
+   struct in_ifaddr *ifa = data;
+   struct net_device *ndev = ifa->ifa_dev->dev;
+   struct brcmf_if *ifp;
+   int idx, i, ret;
+   u32 val;
+   u32 addr_table[ARPOL_MAX_ENTRIES] = {0};
+
+   /* Find out if the notification is meant for us */
+   for (idx = 0; idx < BRCMF_MAX_IFS; idx++) {
+   ifp = drvr->iflist[idx];
+   if (ifp && ifp->ndev == ndev)
+   break;
+   if (idx == BRCMF_MAX_IFS - 1)
+   return NOTIFY_DONE;
+   }
+
+   /* check if arp offload is supported */
+   ret = brcmf_fil_iovar_int_get(ifp, "arpoe", );
+   if (ret)
+   return NOTIFY_OK;
+
+   /* old version only support primary index */
+   ret = brcmf_fil_iovar_int_get(ifp, "arp_version", );
+   if (ret)
+   val = 1;
+   if (val == 1)
+   ifp = drvr->iflist[0];
+
+   /* retrieve the table from firmware */
+   ret = brcmf_fil_iovar_data_get(ifp, "arp_hostip", addr_table,
+  sizeof(addr_table));
+   if (ret) {
+   brcmf_err("fail to get arp ip table err:%d\n", ret);
+   return NOTIFY_OK;
+   }
+
+   for (i = 0; i < ARPOL_MAX_ENTRIES; i++)
+   if (ifa->ifa_address == addr_table[i])
+   break;
+
+   switch (action) {
+   case NETDEV_UP:
+   if (i == ARPOL_MAX_ENTRIES) {
+   brcmf_dbg(TRACE, "add %pI4 to arp table\n",
+ >ifa_address);
+   /* set it directly */
+   ret = brcmf_fil_iovar_int_set(ifp, "arp_hostip",
+ ifa->ifa_address);
+   if (ret)
+   brcmf_err("add arp ip err %d\n", ret);
+   }
+   break;
+   case NETDEV_DOWN:
+   if (i < ARPOL_MAX_ENTRIES) {
+   addr_table[i] = 0;
+   brcmf_dbg(TRACE, "remove %pI4 from arp table\n",
+ >ifa_address);
+   /* clear the table in firmware */
+   ret = brcmf_fil_iovar_data_set(ifp, "arp_hostip_clear",
+  NULL, 0);
+   if (ret) {
+   brcmf_err("fail to clear arp ip table err:%d\n",
+ ret);
+   return NOTIFY_OK;
+   }
+   for (i = 0; i < ARPOL_MAX_ENTRIES; i++) {
+   if (addr_table[i] != 0) {
+   brcmf_fil_iovar_int_set(ifp,
+   "arp_hostip",
+   addr_table[i]);
+   if (ret)
+   brcmf_err("add arp ip err %d\n",
+ ret);
+   }
+   }
+   }
+   break;
+   default:
+   break;
+   }
+
+   return NOTIFY_OK;
+}
+#endif
+
 int brcmf_attach(struct device *dev)
 {
struct brcmf_pub *drvr = NULL;
@@ -1068,6 +1163,15 @@ int brcmf_bus_start(struct device *dev)
if 

[PATCH V2 08/13] brcmfmac: Fix IBSS setup

2015-12-10 Thread Arend van Spriel
From: Hante Meuleman 

IBSS got broken over time. Disconnect events should not be given
for IBSS mode and connect events for IBSS need to have channel
information.

Reviewed-by: Arend Van Spriel 
Reviewed-by: Pieter-Paul Giesberts 
Signed-off-by: Hante Meuleman 
Signed-off-by: Arend van Spriel 
---
 .../net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 3ac5cf7..17658b3 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -1273,17 +1273,17 @@ static void brcmf_link_down(struct brcmf_cfg80211_vif 
*vif, u16 reason)
 
brcmf_dbg(TRACE, "Enter\n");
 
-   if (test_bit(BRCMF_VIF_STATUS_CONNECTED, >sme_state)) {
+   if (test_and_clear_bit(BRCMF_VIF_STATUS_CONNECTED, >sme_state)) {
brcmf_dbg(INFO, "Call WLC_DISASSOC to stop excess roaming\n ");
err = brcmf_fil_cmd_data_set(vif->ifp,
 BRCMF_C_DISASSOC, NULL, 0);
if (err) {
brcmf_err("WLC_DISASSOC failed (%d)\n", err);
}
-   clear_bit(BRCMF_VIF_STATUS_CONNECTED, >sme_state);
-   cfg80211_disconnected(vif->wdev.netdev, reason, NULL, 0,
- true, GFP_KERNEL);
-
+   if ((vif->wdev.iftype == NL80211_IFTYPE_STATION) ||
+   (vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT))
+   cfg80211_disconnected(vif->wdev.netdev, reason, NULL, 0,
+ true, GFP_KERNEL);
}
clear_bit(BRCMF_VIF_STATUS_CONNECTING, >sme_state);
clear_bit(BRCMF_SCAN_STATUS_SUPPRESS, >scan_status);
@@ -2697,8 +2697,8 @@ static s32 brcmf_inform_bss(struct brcmf_cfg80211_info 
*cfg)
return err;
 }
 
-static s32 wl_inform_ibss(struct brcmf_cfg80211_info *cfg,
- struct net_device *ndev, const u8 *bssid)
+static s32 brcmf_inform_ibss(struct brcmf_cfg80211_info *cfg,
+struct net_device *ndev, const u8 *bssid)
 {
struct wiphy *wiphy = cfg_to_wiphy(cfg);
struct ieee80211_channel *notify_channel;
@@ -2743,6 +2743,7 @@ static s32 wl_inform_ibss(struct brcmf_cfg80211_info *cfg,
band = wiphy->bands[IEEE80211_BAND_5GHZ];
 
freq = ieee80211_channel_to_frequency(ch.chnum, band->band);
+   cfg->channel = freq;
notify_channel = ieee80211_get_channel(wiphy, freq);
 
notify_capability = le16_to_cpu(bi->capability);
@@ -5071,9 +5072,9 @@ brcmf_notify_connect_status(struct brcmf_if *ifp,
} else if (brcmf_is_linkup(e)) {
brcmf_dbg(CONN, "Linkup\n");
if (brcmf_is_ibssmode(ifp->vif)) {
+   brcmf_inform_ibss(cfg, ndev, e->addr);
chan = ieee80211_get_channel(cfg->wiphy, cfg->channel);
memcpy(profile->bssid, e->addr, ETH_ALEN);
-   wl_inform_ibss(cfg, ndev, e->addr);
cfg80211_ibss_joined(ndev, e->addr, chan, GFP_KERNEL);
clear_bit(BRCMF_VIF_STATUS_CONNECTING,
  >vif->sme_state);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] wlcore/wl12xx: spi: fix oops on firmware load

2015-12-10 Thread Uri Mashiach
The maximum chunks used by the function is
(SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE + 1).
The original commands array had space for
(SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE) commands.
When the last chunk is used (len > 4 * WSPI_MAX_CHUNK_SIZE), the last
command is stored outside the bounds of the commands array.

Oops 5 (page fault) is generated during current wl1271 firmware load
attempt:

root@debian-armhf:~# ifconfig wlan0 up
[  294.312399] Unable to handle kernel paging request at virtual address
00203fc4
[  294.320173] pgd = de528000
[  294.323028] [00203fc4] *pgd=
[  294.326916] Internal error: Oops: 5 [#1] SMP ARM
[  294.331789] Modules linked in: bnep rfcomm bluetooth ipv6 arc4 wl12xx
wlcore mac80211 musb_dsps cfg80211 musb_hdrc usbcore usb_common
wlcore_spi omap_rng rng_core musb_am335x omap_wdt cpufreq_dt thermal_sys
hwmon
[  294.351838] CPU: 0 PID: 1827 Comm: ifconfig Not tainted
4.2.0-2-g3e9ad27-dirty #78
[  294.360154] Hardware name: Generic AM33XX (Flattened Device Tree)
[  294.366557] task: dc9d6d40 ti: de55 task.ti: de55
[  294.372236] PC is at __spi_validate+0xa8/0x2ac
[  294.376902] LR is at __spi_sync+0x78/0x210
[  294.381200] pc : []lr : []psr: 6013
[  294.381200] sp : de551998  ip : de5519d8  fp : 0020
[  294.393242] r10: de551c8c  r9 : de5519d8  r8 : de3a9000
[  294.398730] r7 : de3a9258  r6 : de3a9400  r5 : de551a48  r4 :
00203fbc
[  294.405577] r3 :   r2 :   r1 :   r0 :
de3a9000
[  294.412420] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM
Segment user
[  294.419918] Control: 10c5387d  Table: 9e528019  DAC: 0015
[  294.425954] Process ifconfig (pid: 1827, stack limit = 0xde550218)
[  294.432437] Stack: (0xde551998 to 0xde552000)

...

[  294.883613] [] (__spi_validate) from []
(__spi_sync+0x78/0x210)
[  294.891670] [] (__spi_sync) from []
(wl12xx_spi_raw_write+0xfc/0x148 [wlcore_spi])
[  294.901661] [] (wl12xx_spi_raw_write [wlcore_spi]) from
[] (wlcore_boot_upload_firmware+0x1ec/0x458 [wlcore])
[  294.914038] [] (wlcore_boot_upload_firmware [wlcore]) from
[] (wl12xx_boot+0xc10/0xfac [wl12xx])
[  294.925161] [] (wl12xx_boot [wl12xx]) from []
(wl1271_op_add_interface+0x5b0/0x910 [wlcore])
[  294.936364] [] (wl1271_op_add_interface [wlcore]) from
[] (ieee80211_do_open+0x44c/0xf7c [mac80211])
[  294.947963] [] (ieee80211_do_open [mac80211]) from
[] (__dev_open+0xa8/0x110)
[  294.957307] [] (__dev_open) from []
(__dev_change_flags+0x88/0x148)
[  294.965713] [] (__dev_change_flags) from []
(dev_change_flags+0x18/0x48)
[  294.974576] [] (dev_change_flags) from []
(devinet_ioctl+0x6b4/0x7d0)
[  294.983191] [] (devinet_ioctl) from []
(sock_ioctl+0x1e4/0x2bc)
[  294.991244] [] (sock_ioctl) from []
(do_vfs_ioctl+0x420/0x6b0)
[  294.999208] [] (do_vfs_ioctl) from []
(SyS_ioctl+0x6c/0x7c)
[  295.006880] [] (SyS_ioctl) from []
(ret_fast_syscall+0x0/0x54)
[  295.014835] Code: e1550004 e2444034 0a7d e5953018 (e5942008)
[  295.021544] ---[ end trace 66ed188198f4e24e ]---

Signed-off-by: Uri Mashiach 
Acked-by: Igor Grinberg 
Cc: sta...@vger.kernel.org
---
v1 -> v2: Stable tag v3.9+

 drivers/net/wireless/ti/wlcore/spi.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/spi.c 
b/drivers/net/wireless/ti/wlcore/spi.c
index f1ac283..720e4e4 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -73,7 +73,10 @@
  */
 #define SPI_AGGR_BUFFER_SIZE (4 * PAGE_SIZE)
 
-#define WSPI_MAX_NUM_OF_CHUNKS (SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE)
+/* Maximum number of SPI write chunks */
+#define WSPI_MAX_NUM_OF_CHUNKS \
+   ((SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE) + 1)
+
 
 struct wl12xx_spi_glue {
struct device *dev;
@@ -268,9 +271,10 @@ static int __must_check wl12xx_spi_raw_write(struct device 
*child, int addr,
 void *buf, size_t len, bool fixed)
 {
struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent);
-   struct spi_transfer t[2 * (WSPI_MAX_NUM_OF_CHUNKS + 1)];
+   /* SPI write buffers - 2 for each chunk */
+   struct spi_transfer t[2 * WSPI_MAX_NUM_OF_CHUNKS];
struct spi_message m;
-   u32 commands[WSPI_MAX_NUM_OF_CHUNKS];
+   u32 commands[WSPI_MAX_NUM_OF_CHUNKS]; /* 1 command per chunk */
u32 *cmd;
u32 chunk_len;
int i;
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2 07/13] brcmfmac: no interface combination check for single interface

2015-12-10 Thread Arend van Spriel
The interface combinations are intended for use-case in which the driver
handles multiple interface concurrently. This means that the combinations
do not need to be checked when there is only a single interface active.

Reviewed-by: Hante Meuleman 
Reviewed-by: Pieter-Paul Giesberts 
Signed-off-by: Arend van Spriel 
---
 .../net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c| 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 8557566..3ac5cf7 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -396,15 +396,23 @@ static int brcmf_vif_change_validate(struct 
brcmf_cfg80211_info *cfg,
 {
int iftype_num[NUM_NL80211_IFTYPES];
struct brcmf_cfg80211_vif *pos;
+   bool check_combos = false;
+   int ret = 0;
 
memset(_num[0], 0, sizeof(iftype_num));
list_for_each_entry(pos, >vif_list, list)
-   if (pos == vif)
+   if (pos == vif) {
iftype_num[new_type]++;
-   else
+   } else {
+   /* concurrent interfaces so need check combinations */
+   check_combos = true;
iftype_num[pos->wdev.iftype]++;
+   }
 
-   return cfg80211_check_combinations(cfg->wiphy, 1, 0, iftype_num);
+   if (check_combos)
+   ret = cfg80211_check_combinations(cfg->wiphy, 1, 0, iftype_num);
+
+   return ret;
 }
 
 static int brcmf_vif_add_validate(struct brcmf_cfg80211_info *cfg,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v7] Add new mac80211 driver mwlwifi.

2015-12-10 Thread Kalle Valo
David Lin  writes:

> This patch provides the mwlwifi driver for Marvell 8863, 8864 and 8897
> chipsets.
> This driver was developed as part of the openwrt.org project to support
> Linksys WRT1900AC and is maintained on https://github.com/kaloz/mwlwifi.
>
> The mwlwifi driver differs from existing mwifiex driver:
> o mwlwifi is a "softmac driver" using the kernel? mac802.11 subsystem
> to provide full AP/Wireless Bridge functionality (routers).
> o mwifiex is a "fullmac driver" which provides a comprehensive set of
> client functions (laptops/embedded devices)
> o only mwlwifi supports Marvell AP chip 886X series
>
> NOTE: Users with Marvell 88W8897 chipsets currently should enable
> (CONFIG=Y or M) either CONFIG_MWIFIEX or CONFIG_MWLWIFI, NOT BOTH.
>
> mwlwifi driver leveraged code from existing MWL8K driver in the
> following areas:
> - 802.11n setting for mac80211
> - Functions needed to hook up to mac80211
> - Interactions with mac80211 to establish BA streams
> - Partial firmware APIs, some data fields
> - Method to pass Rx packets to mac80211 except 11ac rates
>
> In addition, mwlwifi driver supports:
> - future scalability and future development (refactored source code)
> - Marvell 802.11ac chipsets, including combo BT devices
> - 802.11ac related settings and functions
> - concurrent AP+STA functionalities with single firmware per chip
> - firmware APIs for the supported chipset
> - communicating new mac80211 settings to firmware
> - Different TX/RX datapath where applicable
> - A-MSDU and A-MPDU
> - mac80211-based MESH (work in progress)
> - Refined the code to establish BA streams
>
> NOTE: MWLWIFI will be organized under new vendor specific folder/marvell,
> as per request of the gate keeper and community.
>
> Signed-off-by: David Lin 

I don't see any changelog, please always provide one. Makes review a lot
easier.

Also I hope you are not adding new features anymore. It's better to
freeze the driver and focus on getting the driver accepted. Once that is
done you can submit new features as separate patches. Otherwise we go
back to square one after every review.

-- 
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v7] Add new mac80211 driver mwlwifi.

2015-12-10 Thread Kalle Valo
David Lin  writes:

> This patch provides the mwlwifi driver for Marvell 8863, 8864 and 8897
> chipsets.
> This driver was developed as part of the openwrt.org project to support
> Linksys WRT1900AC and is maintained on https://github.com/kaloz/mwlwifi.
>
> The mwlwifi driver differs from existing mwifiex driver:
> o mwlwifi is a "softmac driver" using the kernel? mac802.11 subsystem
> to provide full AP/Wireless Bridge functionality (routers).
> o mwifiex is a "fullmac driver" which provides a comprehensive set of
> client functions (laptops/embedded devices)
> o only mwlwifi supports Marvell AP chip 886X series
>
> NOTE: Users with Marvell 88W8897 chipsets currently should enable
> (CONFIG=Y or M) either CONFIG_MWIFIEX or CONFIG_MWLWIFI, NOT BOTH.
>
> mwlwifi driver leveraged code from existing MWL8K driver in the
> following areas:
> - 802.11n setting for mac80211
> - Functions needed to hook up to mac80211
> - Interactions with mac80211 to establish BA streams
> - Partial firmware APIs, some data fields
> - Method to pass Rx packets to mac80211 except 11ac rates
>
> In addition, mwlwifi driver supports:
> - future scalability and future development (refactored source code)
> - Marvell 802.11ac chipsets, including combo BT devices
> - 802.11ac related settings and functions
> - concurrent AP+STA functionalities with single firmware per chip
> - firmware APIs for the supported chipset
> - communicating new mac80211 settings to firmware
> - Different TX/RX datapath where applicable
> - A-MSDU and A-MPDU
> - mac80211-based MESH (work in progress)
> - Refined the code to establish BA streams
>
> NOTE: MWLWIFI will be organized under new vendor specific folder/marvell,
> as per request of the gate keeper and community.
>
> Signed-off-by: David Lin 

This seems to use base64 encoding, how did you submit this? 'git
send-email' tool is strongly preferred.

Content-Transfer-Encoding: base64

I applied this to pending branch and saw few easy conflicts with Kconfig
files and Makefiles, I guess you submitted this patch before I added the
vendor directories. Let's see what kbuild finds but I already saw two
warnings:

drivers/net/wireless/marvell/mwlwifi/main.c:160:20: warning: incorrect type in 
argument 1 (different address spaces)
drivers/net/wireless/marvell/mwlwifi/main.c:160:20:expected void const *ptr
drivers/net/wireless/marvell/mwlwifi/main.c:160:20:got void [noderef] 
*[assigned] addr
drivers/net/wireless/marvell/mwlwifi/main.c:171:20: warning: incorrect type in 
argument 1 (different address spaces)
drivers/net/wireless/marvell/mwlwifi/main.c:171:20:expected void const *ptr
drivers/net/wireless/marvell/mwlwifi/main.c:171:20:got void [noderef] 
*[assigned] addr

-- 
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v7] Add new mac80211 driver mwlwifi.

2015-12-10 Thread Kalle Valo
David Lin  writes:

> On November 26, 2015 5:40 PM, Johannes Berg wrote:
>> On Thu, 2015-11-26 at 08:27 +, David Lin wrote:
>> 
>> > > > +#ifdef CONFIG_SUPPORT_MFG
>> > >
>> > > This Kconfig variable doesn't exist.
>> > >
>> >
>> > The compile variable is used privately by Marvell and our customers in
>> > production line.
>> 
>> Yeah, still. Make it a proper Kconfig variable, defaulting to off and hidden
>> under something, or remove it. It's extremely misleading to have something
>> called CONFIG_* when it's not a Kconfig variable.
>> 
>
> I will change this compile variable from "CONFIG_SUPPORT_MFG" to
> "SUPPORT_MFG".

Then it's still dead code which won't ever get compiled in upstream.
Please follow what Johannes suggested.

-- 
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html