Re: [PATCH] mac80211_hwsim: release driver when ieee80211_register_hw fails

2014-10-28 Thread Martin Pitt
Acked-By: Martin Pitt 

Hello Junjie,

Junjie Mao [2014-10-28  9:31 +0800]:
> The driver is not released when ieee80211_register_hw fails in
> mac80211_hwsim_create_radio, leading to the access to the unregistered (and
> possibly freed) device in platform_driver_unregister:

Many thanks for fixing this! Sorry about that, I don't know these bits
very well.

Martin
-- 
Martin Pitt| http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)


signature.asc
Description: Digital signature


RE: [PATCH] staging:rtl8723au: core: Fix error reported by checkpatch.

2014-10-28 Thread Sharma, Sanjeev
-Original Message-
From: Joe Perches [mailto:j...@perches.com] 
Sent: Monday, October 27, 2014 8:23 PM
To: Jes Sorensen
Cc: Sharma, Sanjeev; larry.fin...@lwfinger.net; gre...@linuxfoundation.org; 
linux-wireless@vger.kernel.org; de...@driverdev.osuosl.org; 
linux-ker...@vger.kernel.org
Subject: Re: [PATCH] staging:rtl8723au: core: Fix error reported by checkpatch.

On Mon, 2014-10-27 at 09:43 +0100, Jes Sorensen wrote:
> Sanjeev Sharma  writes:
> > This is a patch to the rtw_cmd.c file that fixes Error reported by 
> > checkpatch.
[]
> > diff --git a/drivers/staging/rtl8723au/core/rtw_cmd.c 
> > b/drivers/staging/rtl8723au/core/rtw_cmd.c
[]
> > @@ -957,7 +957,7 @@ static void traffic_status_watchdog(struct rtw_adapter 
> > *padapter)
> > /*  check traffic for  powersaving. */
> > if (((pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod +
> >   pmlmepriv->LinkDetectInfo.NumTxOkInPeriod) > 8) ||
> > -   pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod >2)
> > +   pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod > 
> > 2)
> > bEnterPS = false;
> > else
> > bEnterPS = true;
> 
> This makes the line longer than 80 characters, that is worse than the 
> 'problem' you are fixing.

The code already has dozens of long lines already.

This is generally a problem because the variable names are pretty long so 
strict 80 column adherence generally isn't possible.

A possible way to shorten these relatively long variable name/line lengths is 
to use a temporary for

pmlmeprv->LinkDetectInfo

struct rt_link_detect *ldi = &pmlmeprv->LinkDetectInfo;

so:

I am agree on this approach but Let's wait for Jes opinion on it.

Sanjeev Sharma

 drivers/staging/rtl8723au/core/rtw_cmd.c | 46 
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_cmd.c 
b/drivers/staging/rtl8723au/core/rtw_cmd.c
index d2d7edf..1b24945 100644
--- a/drivers/staging/rtl8723au/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723au/core/rtw_cmd.c
@@ -922,34 +922,33 @@ static void traffic_status_watchdog(struct rtw_adapter 
*padapter)
u8 bHigherBusyTxTraffic = false;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
int BusyThreshold = 100;
+   struct rt_link_detect *ldi = &pmlmepriv->LinkDetectInfo;
+
/*  */
/*  Determine if our traffic is busy now */
/*  */
if (check_fwstate(pmlmepriv, _FW_LINKED)) {
if (rtl8723a_BT_coexist(padapter))
BusyThreshold = 50;
-   else if (pmlmepriv->LinkDetectInfo.bBusyTraffic)
+   else if (ldi->bBusyTraffic)
BusyThreshold = 75;
/*  if we raise bBusyTraffic in last watchdog, using
lower threshold. */
-   if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > BusyThreshold ||
-   pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > BusyThreshold) {
+   if (ldi->NumRxOkInPeriod > BusyThreshold ||
+   ldi->NumTxOkInPeriod > BusyThreshold) {
bBusyTraffic = true;
 
-   if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod >
-   pmlmepriv->LinkDetectInfo.NumTxOkInPeriod)
+   if (ldi->NumRxOkInPeriod > ldi->NumTxOkInPeriod)
bRxBusyTraffic = true;
else
bTxBusyTraffic = true;
}
 
/*  Higher Tx/Rx data. */
-   if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > 4000 ||
-   pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > 4000) {
+   if (ldi->NumRxOkInPeriod > 4000 ||
+   ldi->NumTxOkInPeriod > 4000) {
bHigherBusyTraffic = true;
-
-   if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod >
-   pmlmepriv->LinkDetectInfo.NumTxOkInPeriod)
+   if (ldi->NumRxOkInPeriod > ldi->NumTxOkInPeriod)
bHigherBusyRxTraffic = true;
else
bHigherBusyTxTraffic = true;
@@ -958,9 +957,9 @@ static void traffic_status_watchdog(struct rtw_adapter 
*padapter)
if (!rtl8723a_BT_coexist(padapter) ||
!rtl8723a_BT_using_antenna_1(padapter)) {
/*  check traffic for  powersaving. */
-   if (((pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod +
- pmlmepriv->LinkDetectInfo.NumTxOkInPeriod) > 8) ||
-   pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod >2)
+   if (((ldi->NumRxUnicastOkInPeriod +
+ ldi->NumTxOkInPeriod)

RE: [PATCH] staging:rtl8723au: core: Fix error reported by checkpatch.

2014-10-28 Thread Sharma, Sanjeev
-Original Message-
From: Jes Sorensen [mailto:jes.soren...@redhat.com] 
Sent: Monday, October 27, 2014 2:13 PM
To: Sharma, Sanjeev
Cc: larry.fin...@lwfinger.net; gre...@linuxfoundation.org; 
linux-wireless@vger.kernel.org; de...@driverdev.osuosl.org; 
linux-ker...@vger.kernel.org
Subject: Re: [PATCH] staging:rtl8723au: core: Fix error reported by checkpatch.

Sanjeev Sharma  writes:
> This is a patch to the rtw_cmd.c file that fixes Error reported by 
> checkpatch.
>
> Signed-off-by: Sanjeev Sharma 
> ---
>  drivers/staging/rtl8723au/core/rtw_cmd.c | 83 
> +++-
>  1 file changed, 40 insertions(+), 43 deletions(-)
>
> diff --git a/drivers/staging/rtl8723au/core/rtw_cmd.c 
> b/drivers/staging/rtl8723au/core/rtw_cmd.c
> index 4eaa502..c1f6254 100644
> --- a/drivers/staging/rtl8723au/core/rtw_cmd.c
> +++ b/drivers/staging/rtl8723au/core/rtw_cmd.c
> @@ -957,7 +957,7 @@ static void traffic_status_watchdog(struct rtw_adapter 
> *padapter)
>   /*  check traffic for  powersaving. */
>   if (((pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod +
> pmlmepriv->LinkDetectInfo.NumTxOkInPeriod) > 8) ||
> - pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod >2)
> + pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod > 
> 2)
>   bEnterPS = false;
>   else
>   bEnterPS = true;

This makes the line longer than 80 characters, that is worse than the 'problem' 
you are fixing.

Jes

Hello jes,

How it can be worse because checkpatch treating this as an Error and line 
longer than 80 character is warning reported by checkpatch and I could see that 
in entire staging directory,
every maintainer most of the time ignore the 80 column limit and give priority 
to Error.

Please let me know your comment .

Sanjeev Sharma 
--
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] ath10k: add tracing for tx ieee80211 header

2014-10-28 Thread Rajkumar Manoharan
On Tue, Oct 28, 2014 at 05:59:39PM +0100, Johannes Berg wrote:
> On Tue, 2014-10-28 at 22:18 +0530, Rajkumar Manoharan wrote:
> > For packet log, the transmitted frame 802.11 header alone is sufficient.
> > Recording entire packet is also consuming lot of disk space. To
> > optimize, add tracepoints for sending tx-ed 802.11 headers alone.
> 
> FWIW, in iwlwifi I made the data portion (only!) a separate tracing
> subsystem, so that you can do
> 
> trace-cmd record -e iwlwifi
> 
> to get the hdrs, and
> 
> trace-cmd record -e iwlwifi -e iwlwifi_data
> 
> to get the hdrs, and the data, and then I put the two together in
> userspace. That way, "-e iwlwifi" gets most useful stuff, and adding -e
> iwlwifi_data when needed still has no duplication.
> 
> With what you're suggesting, it will be difficult to control tracing to
> do exactly what's needed.
> 
> Anyway, I don't really care, but this just caught my eye.
> 
Thanks for your feedback. Will send updated patch.

-Rajkumar
--
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 V3.18] rtlwifi: Add check for get_btc_status callback

2014-10-28 Thread Murilo Opsfelder Araujo

On 10/23/2014 02:27 PM, Larry Finger wrote:

Drivers that do not use the get_btc_status() callback may not define a
dummy routine. The caller needs to check before making the call.

Signed-off-by: Larry Finger 
Cc: Murilo Opsfelder Araujo 
Cc: Mike Galbraith 
Cc: Thadeu Cascardo 
---

John,

This missing statement is causing kernel crashes for several of the drivers.
This patch should be applied ASAP.

Larry
---

  drivers/net/wireless/rtlwifi/pci.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/rtlwifi/pci.c 
b/drivers/net/wireless/rtlwifi/pci.c
index 667aba8..25daa87 100644
--- a/drivers/net/wireless/rtlwifi/pci.c
+++ b/drivers/net/wireless/rtlwifi/pci.c
@@ -1796,7 +1796,8 @@ static int rtl_pci_start(struct ieee80211_hw *hw)
rtl_pci_reset_trx_ring(hw);

rtlpci->driver_is_goingto_unload = false;
-   if (rtlpriv->cfg->ops->get_btc_status()) {
+   if (rtlpriv->cfg->ops->get_btc_status &&
+   rtlpriv->cfg->ops->get_btc_status()) {
rtlpriv->btcoexist.btc_ops->btc_init_variables(rtlpriv);
rtlpriv->btcoexist.btc_ops->btc_init_hal_vars(rtlpriv);
}


Hi, Larry & everyone.

This patch didn't solve and next-20141028 is still crashing on my laptop 
with rtl8192se device:


http://opsfelder.com/~murilo/lkml/next-20141028_crashing.jpg

--
Murilo
--
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 v3 11/13] ath5k: revert AHB bus support removing

2014-10-28 Thread Sergey Ryazanov
This reverts commit 093ec3c5337434f40d77c1af06c139da3e5ba6dc.

AHB bus code has been removed, since we did not have support Atheros
AR231x SoC, required for building the AHB version of ath5k. Now that
support WiSoC chips added we can restore functionality back.

Signed-off-by: Sergey Ryazanov 
Acked-by: John W. Linville 
Cc: Jiri Slaby 
Cc: Nick Kossifidis 
Cc: "Luis R. Rodriguez" 
Cc: linux-wireless@vger.kernel.org
Cc: ath5k-de...@lists.ath5k.org
---

Changes since v1:
  - fresh patch

Changes since v2:
  - fix typo in SoB line

 drivers/net/wireless/ath/ath5k/Kconfig  |  14 +-
 drivers/net/wireless/ath/ath5k/Makefile |   1 +
 drivers/net/wireless/ath/ath5k/ahb.c| 234 
 drivers/net/wireless/ath/ath5k/ath5k.h  |  28 
 drivers/net/wireless/ath/ath5k/base.c   |  14 ++
 drivers/net/wireless/ath/ath5k/led.c|   6 +
 6 files changed, 294 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath5k/ahb.c

diff --git a/drivers/net/wireless/ath/ath5k/Kconfig 
b/drivers/net/wireless/ath/ath5k/Kconfig
index 93caf8e68..c9f81a3 100644
--- a/drivers/net/wireless/ath/ath5k/Kconfig
+++ b/drivers/net/wireless/ath/ath5k/Kconfig
@@ -1,12 +1,13 @@
 config ATH5K
tristate "Atheros 5xxx wireless cards support"
-   depends on PCI && MAC80211
+   depends on (PCI || ATHEROS_AR231X) && MAC80211
select ATH_COMMON
select MAC80211_LEDS
select LEDS_CLASS
select NEW_LEDS
select AVERAGE
-   select ATH5K_PCI
+   select ATH5K_AHB if (ATHEROS_AR231X && !PCI)
+   select ATH5K_PCI if (!ATHEROS_AR231X && PCI)
---help---
  This module adds support for wireless adapters based on
  Atheros 5xxx chipset.
@@ -51,9 +52,16 @@ config ATH5K_TRACER
 
  If unsure, say N.
 
+config ATH5K_AHB
+   bool "Atheros 5xxx AHB bus support"
+   depends on (ATHEROS_AR231X && !PCI)
+   ---help---
+ This adds support for WiSoC type chipsets of the 5xxx Atheros
+ family.
+
 config ATH5K_PCI
bool "Atheros 5xxx PCI bus support"
-   depends on PCI
+   depends on (!ATHEROS_AR231X && PCI)
---help---
  This adds support for PCI type chipsets of the 5xxx Atheros
  family.
diff --git a/drivers/net/wireless/ath/ath5k/Makefile 
b/drivers/net/wireless/ath/ath5k/Makefile
index 51e2d86..1b3a34f 100644
--- a/drivers/net/wireless/ath/ath5k/Makefile
+++ b/drivers/net/wireless/ath/ath5k/Makefile
@@ -17,5 +17,6 @@ ath5k-y   += ani.o
 ath5k-y+= sysfs.o
 ath5k-y+= mac80211-ops.o
 ath5k-$(CONFIG_ATH5K_DEBUG)+= debug.o
+ath5k-$(CONFIG_ATH5K_AHB)  += ahb.o
 ath5k-$(CONFIG_ATH5K_PCI)  += pci.o
 obj-$(CONFIG_ATH5K)+= ath5k.o
diff --git a/drivers/net/wireless/ath/ath5k/ahb.c 
b/drivers/net/wireless/ath/ath5k/ahb.c
new file mode 100644
index 000..79bffe1
--- /dev/null
+++ b/drivers/net/wireless/ath/ath5k/ahb.c
@@ -0,0 +1,234 @@
+/*
+ * Copyright (c) 2008-2009 Atheros Communications Inc.
+ * Copyright (c) 2009 Gabor Juhos 
+ * Copyright (c) 2009 Imre Kaloz 
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "ath5k.h"
+#include "debug.h"
+#include "base.h"
+#include "reg.h"
+
+/* return bus cachesize in 4B word units */
+static void ath5k_ahb_read_cachesize(struct ath_common *common, int *csz)
+{
+   *csz = L1_CACHE_BYTES >> 2;
+}
+
+static bool
+ath5k_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data)
+{
+   struct ath5k_hw *ah = common->priv;
+   struct platform_device *pdev = to_platform_device(ah->dev);
+   struct ar231x_board_config *bcfg = dev_get_platdata(&pdev->dev);
+   u16 *eeprom, *eeprom_end;
+
+   eeprom = (u16 *) bcfg->radio;
+   eeprom_end = ((void *) bcfg->config) + BOARD_CONFIG_BUFSZ;
+
+   eeprom += off;
+   if (eeprom > eeprom_end)
+   return false;
+
+   *data = *eeprom;
+   return true;
+}
+
+int ath5k_hw_read_srev(struct ath5k_hw *ah)
+{
+   struct platform_device *pdev = to_platform_device(ah->dev);
+   struct ar231x_board_config *bcfg = dev_get_platdata(&pdev->dev);
+   ah->ah_mac_srev = bcfg->devid;

[PATCH v3 12/13] ath5k: update dependencies

2014-10-28 Thread Sergey Ryazanov
- Use config symbol defined in the driver instead of arch specific one for
  conditional compilation.
- Rename the ATHEROS_AR231X config symbol to ATH25.
- Fix include (ar231x_platform.h -> ath25_platform.h).
- Some of AR231x SoCs (e.g. AR2315) have PCI bus support, so remove !PCI
  dependency, which block AHB support build.

Signed-off-by: Sergey Ryazanov 
Acked-by: John W. Linville 
Cc: Jiri Slaby 
Cc: Nick Kossifidis 
Cc: "Luis R. Rodriguez" 
Cc: linux-wireless@vger.kernel.org
Cc: ath5k-de...@lists.ath5k.org
---

Changes since RFC:
  - merge together patches that update ath5k dependencies

Changes since v1:
  - rename config symbol AR231X -> ATH25
  - rename arch header ar231x_platform.h -> ath25_platform.h

 drivers/net/wireless/ath/ath5k/Kconfig | 10 +-
 drivers/net/wireless/ath/ath5k/ahb.c   |  2 +-
 drivers/net/wireless/ath/ath5k/ath5k.h |  2 +-
 drivers/net/wireless/ath/ath5k/base.c  |  4 ++--
 drivers/net/wireless/ath/ath5k/led.c   |  4 ++--
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/Kconfig 
b/drivers/net/wireless/ath/ath5k/Kconfig
index c9f81a3..2399a39 100644
--- a/drivers/net/wireless/ath/ath5k/Kconfig
+++ b/drivers/net/wireless/ath/ath5k/Kconfig
@@ -1,13 +1,13 @@
 config ATH5K
tristate "Atheros 5xxx wireless cards support"
-   depends on (PCI || ATHEROS_AR231X) && MAC80211
+   depends on (PCI || ATH25) && MAC80211
select ATH_COMMON
select MAC80211_LEDS
select LEDS_CLASS
select NEW_LEDS
select AVERAGE
-   select ATH5K_AHB if (ATHEROS_AR231X && !PCI)
-   select ATH5K_PCI if (!ATHEROS_AR231X && PCI)
+   select ATH5K_AHB if ATH25
+   select ATH5K_PCI if !ATH25
---help---
  This module adds support for wireless adapters based on
  Atheros 5xxx chipset.
@@ -54,14 +54,14 @@ config ATH5K_TRACER
 
 config ATH5K_AHB
bool "Atheros 5xxx AHB bus support"
-   depends on (ATHEROS_AR231X && !PCI)
+   depends on ATH25
---help---
  This adds support for WiSoC type chipsets of the 5xxx Atheros
  family.
 
 config ATH5K_PCI
bool "Atheros 5xxx PCI bus support"
-   depends on (!ATHEROS_AR231X && PCI)
+   depends on (!ATH25 && PCI)
---help---
  This adds support for PCI type chipsets of the 5xxx Atheros
  family.
diff --git a/drivers/net/wireless/ath/ath5k/ahb.c 
b/drivers/net/wireless/ath/ath5k/ahb.c
index 79bffe1..8f387cf 100644
--- a/drivers/net/wireless/ath/ath5k/ahb.c
+++ b/drivers/net/wireless/ath/ath5k/ahb.c
@@ -20,7 +20,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include "ath5k.h"
 #include "debug.h"
 #include "base.h"
diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h 
b/drivers/net/wireless/ath/ath5k/ath5k.h
index 85316bb..1ed7a88 100644
--- a/drivers/net/wireless/ath/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
@@ -1647,7 +1647,7 @@ static inline struct ath_regulatory 
*ath5k_hw_regulatory(struct ath5k_hw *ah)
return &(ath5k_hw_common(ah)->regulatory);
 }
 
-#ifdef CONFIG_ATHEROS_AR231X
+#ifdef CONFIG_ATH5K_AHB
 #define AR5K_AR2315_PCI_BASE   ((void __iomem *)0xb010)
 
 static inline void __iomem *ath5k_ahb_reg(struct ath5k_hw *ah, u16 reg)
diff --git a/drivers/net/wireless/ath/ath5k/base.c 
b/drivers/net/wireless/ath/ath5k/base.c
index 59a8724..bc9cb35 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -99,7 +99,7 @@ static int ath5k_reset(struct ath5k_hw *ah, struct 
ieee80211_channel *chan,
 
 /* Known SREVs */
 static const struct ath5k_srev_name srev_names[] = {
-#ifdef CONFIG_ATHEROS_AR231X
+#ifdef CONFIG_ATH5K_AHB
{ "5312",   AR5K_VERSION_MAC,   AR5K_SREV_AR5312_R2 },
{ "5312",   AR5K_VERSION_MAC,   AR5K_SREV_AR5312_R7 },
{ "2313",   AR5K_VERSION_MAC,   AR5K_SREV_AR2313_R8 },
@@ -142,7 +142,7 @@ static const struct ath5k_srev_name srev_names[] = {
{ "5413",   AR5K_VERSION_RAD,   AR5K_SREV_RAD_5413 },
{ "5424",   AR5K_VERSION_RAD,   AR5K_SREV_RAD_5424 },
{ "5133",   AR5K_VERSION_RAD,   AR5K_SREV_RAD_5133 },
-#ifdef CONFIG_ATHEROS_AR231X
+#ifdef CONFIG_ATH5K_AHB
{ "2316",   AR5K_VERSION_RAD,   AR5K_SREV_RAD_2316 },
{ "2317",   AR5K_VERSION_RAD,   AR5K_SREV_RAD_2317 },
 #endif
diff --git a/drivers/net/wireless/ath/ath5k/led.c 
b/drivers/net/wireless/ath/ath5k/led.c
index 2062d11..ca4b7cc 100644
--- a/drivers/net/wireless/ath/ath5k/led.c
+++ b/drivers/net/wireless/ath/ath5k/led.c
@@ -163,7 +163,7 @@ int ath5k_init_leds(struct ath5k_hw *ah)
 {
int ret = 0;
struct ieee80211_hw *hw = ah->hw;
-#ifndef CONFIG_ATHEROS_AR231X
+#ifndef CONFIG_ATH5K_AHB
struct pci_dev *pdev = ah->pdev;
 #endif
char name[ATH5K_LED_MAX_NAME_LEN + 1];
@@ -172,7 +172,7 @@ int ath5k_init_leds(struct ath5k_hw *ah)
if (!ah->pdev)
   

Re: 3.18-rc0: iwlegacy failed after a while

2014-10-28 Thread Pavel Machek
On Sun 2014-10-26 12:05:54, Pavel Machek wrote:
> On Sun 2014-10-26 11:33:15, Stanislaw Gruszka wrote:
> > On Sat, Oct 25, 2014 at 01:42:46PM +0200, Pavel Machek wrote:
> > > > Since 3.17 we have only 2 minor iwlegacy changes on current linus tree.
> > > > If this is a regression it's probably caused by different subsystem
> > > > changes, most likely by PCI changes. If this is not regression, such
> > > > errors could be caused by enabling PS, but that has to be done
> > > > explicitly, Pavel did you enable power_save ? 
> > > 
> > > This is running pretty standart MATE desktop, and no, I don't think I
> > > enabled that.
> > 
> > It can be checked by "iw dev wlan0 get power_save" .

So it seems I have power save on. I guess someone enabled it for me :-).

root@duo:~# iwconfig wlan0
wlan0 IEEE 802.11abg  ESSID:off/any  
  Mode:Managed  Access Point: Not-Associated   Tx-Power=15 dBm   
  Retry short limit:7   RTS thr:off   Fragment thr:off
  Encryption key:off
  Power Management:on
  
root@duo:~# iw dev wlan0 get power_save
Power save: on
root@duo:~# 

> > More important quiestions: Is this regression, did you see this error
> > before? How reproducible is this problem?
> 
> I've never seen it before, and it only happened once after update to
> 3.18-rc.

Today wifi failed, again. Will reboot. dmesg is in the attachment,
looks like same fail.

Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


delme.gz
Description: application/gzip


Re: [PATCH RESEND] net: rfkill: gpio: Add ACPI default GPIO driver mappings

2014-10-28 Thread Rafael J. Wysocki
On Tuesday, October 28, 2014 12:03:48 PM Mika Westerberg wrote:
> The driver uses devm_gpiod_get_index(..., index) so that the index refers
> directly to the GpioIo resource under the ACPI device. The problem with
> this is that if the ordering changes we get wrong GPIOs.
> 
> With ACPI 5.1 _DSD we can now use names instead to reference GPIOs
> analogous to Device Tree. However, we still have systems out there that do
> not provide _DSD at all. These systems must be supported as well.
> 
> Luckily we now have acpi_dev_add_driver_gpios() that can be used to provide
> mappings for systems where _DSD is not provided and still take advantage of
> _DSD if it exists.
> 
> This patch converts the rfkill-gpio.c driver to create default GPIO
> mappings to the two GPIOs in case we are running on ACPI system.
> 
> While there we can drop the indices completely.
> 
> Signed-off-by: Mika Westerberg 
> Reviewed-by: Johannes Berg 
> Acked-by: Johannes Berg 
> Acked-by: John W. Linville 

Applied, thanks!

> ---
> Resending with linux-acpi included. I also added ACKs from Johannes and
> John. The patch itself is intact.
> 
>  net/rfkill/rfkill-gpio.c | 18 +++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
> index 0f62326c0f5e..2a4717967502 100644
> --- a/net/rfkill/rfkill-gpio.c
> +++ b/net/rfkill/rfkill-gpio.c
> @@ -63,6 +63,15 @@ static const struct rfkill_ops rfkill_gpio_ops = {
>   .set_block = rfkill_gpio_set_power,
>  };
>  
> +static const struct acpi_gpio_params reset_gpios = { 0, 0, false };
> +static const struct acpi_gpio_params shutdown_gpios = { 1, 0, false };
> +
> +static const struct acpi_gpio_mapping acpi_rfkill_default_gpios[] = {
> + { "reset-gpios", &reset_gpios, 1 },
> + { "shutdown-gpios", &shutdown_gpios, 1 },
> + { },
> +};
> +
>  static int rfkill_gpio_acpi_probe(struct device *dev,
> struct rfkill_gpio_data *rfkill)
>  {
> @@ -75,7 +84,8 @@ static int rfkill_gpio_acpi_probe(struct device *dev,
>   rfkill->name = dev_name(dev);
>   rfkill->type = (unsigned)id->driver_data;
>  
> - return 0;
> + return acpi_dev_add_driver_gpios(ACPI_COMPANION(dev),
> +  acpi_rfkill_default_gpios);
>  }
>  
>  static int rfkill_gpio_probe(struct platform_device *pdev)
> @@ -102,7 +112,7 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
>  
>   rfkill->clk = devm_clk_get(&pdev->dev, NULL);
>  
> - gpio = devm_gpiod_get_index(&pdev->dev, "reset", 0);
> + gpio = devm_gpiod_get(&pdev->dev, "reset");
>   if (!IS_ERR(gpio)) {
>   ret = gpiod_direction_output(gpio, 0);
>   if (ret)
> @@ -110,7 +120,7 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
>   rfkill->reset_gpio = gpio;
>   }
>  
> - gpio = devm_gpiod_get_index(&pdev->dev, "shutdown", 1);
> + gpio = devm_gpiod_get(&pdev->dev, "shutdown");
>   if (!IS_ERR(gpio)) {
>   ret = gpiod_direction_output(gpio, 0);
>   if (ret)
> @@ -150,6 +160,8 @@ static int rfkill_gpio_remove(struct platform_device 
> *pdev)
>   rfkill_unregister(rfkill->rfkill_dev);
>   rfkill_destroy(rfkill->rfkill_dev);
>  
> + acpi_dev_remove_driver_gpios(ACPI_COMPANION(&pdev->dev));
> +
>   return 0;
>  }
>  
> 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
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] carl9170: Convert byte_rev_table uses to bitrev8

2014-10-28 Thread Joe Perches
Use the inline function instead of directly indexing the array.

This allows some architectures with hardware instructions
for bit reversals to eliminate the array.

Signed-off-by: Joe Perches 
---
On Sun, 2014-10-26 at 23:46 -0700, Joe Perches wrote:
> On Mon, 2014-10-27 at 14:37 +0800, Wang, Yalin wrote:
> > this change add CONFIG_HAVE_ARCH_BITREVERSE config option,
> > so that we can use arm/arm64 rbit instruction to do bitrev operation
> > by hardware.
[]
> > diff --git a/include/linux/bitrev.h b/include/linux/bitrev.h
> > index 7ffe03f..ef5b2bb 100644
> > --- a/include/linux/bitrev.h
> > +++ b/include/linux/bitrev.h
> > @@ -3,6 +3,14 @@
> >  
> >  #include 
> >  
> > +#ifdef CONFIG_HAVE_ARCH_BITREVERSE
> > +#include 
> > +
> > +#define bitrev32 __arch_bitrev32
> > +#define bitrev16 __arch_bitrev16
> > +#define bitrev8 __arch_bitrev8
> > +
> > +#else
> >  extern u8 const byte_rev_table[256];

 drivers/net/wireless/ath/carl9170/phy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/carl9170/phy.c 
b/drivers/net/wireless/ath/carl9170/phy.c
index b80b213..dca6df1 100644
--- a/drivers/net/wireless/ath/carl9170/phy.c
+++ b/drivers/net/wireless/ath/carl9170/phy.c
@@ -994,7 +994,7 @@ static int carl9170_init_rf_bank4_pwr(struct ar9170 *ar, 
bool band5ghz,
refsel0 = 0;
refsel1 = 1;
}
-   chansel = byte_rev_table[chansel];
+   chansel = bitrev8(chansel);
} else {
if (freq == 2484) {
chansel = 10 + (freq - 2274) / 5;
@@ -1002,7 +1002,7 @@ static int carl9170_init_rf_bank4_pwr(struct ar9170 *ar, 
bool band5ghz,
} else
chansel = 16 + (freq - 2272) / 5;
chansel *= 4;
-   chansel = byte_rev_table[chansel];
+   chansel = bitrev8(chansel);
}
 
d1 =chansel;


--
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: pull request: wireless 2014-10-28

2014-10-28 Thread David Miller
From: "John W. Linville" 
Date: Tue, 28 Oct 2014 15:05:19 -0400

> Please pull this batch of fixes intended for the 3.18 stream!
 ...
>   git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless.git 
> tags/master-2014-10-27

Pulled, thanks John.
--
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


pull request: wireless 2014-10-28

2014-10-28 Thread John W. Linville
Dave,

Please pull this batch of fixes intended for the 3.18 stream!

For the mac80211 bits, Johannes says:

"Here are a few fixes for the wireless stack: one fixes the
RTS rate, one for a debugfs file, one to return the correct
channel to userspace, a sanity check for a userspace value
and the remaining two are just documentation fixes."

For the iwlwifi bits, Emmanuel says:

"I revert here a patch that caused interoperability issues.
dvm gets a fix for a bug that was reported by many users.
Two minor fixes for BT Coex and platform power fix that helps
reducing latency when the PCIe link goes to low power states."

In addition...

Felix Fietkau adds a couple of ath code fixes related to regulatory
rule enforcement.

Hauke Mehrtens fixes a build break with bcma when CONFIG_OF_ADDRESS
is not set.

Karsten Wiese provides a trio of minor fixes for rtl8192cu.

Kees Cook prevents a potential information leak in rtlwifi.

Larry Finger also brings a trio of minor fixes for rtlwifi.

Rafał Miłecki adds a device ID to the bcma bus driver.

Rickard Strandqvist offers some strn* -> strl* changes in brcmfmac
to eliminate non-terminated string issues.

Sujith Manoharan avoids some ath9k stalls by enabling HW queue control
only for MCC.

Please let me know if there are problems...

John

---

The following changes since commit 61ed53deb1c6a4386d8710dbbfcee8779c381931:

  Merge tag 'ntb-3.18' of git://github.com/jonmason/ntb (2014-10-19 12:58:22 
-0700)

are available in the git repository at:


  git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless.git 
tags/master-2014-10-27

for you to fetch changes up to 99c814066e75d09e6a38574c6c395f022a04b730:

  Merge tag 'mac80211-for-john-2014-10-23' of 
git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211 (2014-10-27 
13:38:15 -0400)



Emmanuel Grumbach (6):
  iwlwifi: configure the LTR
  iwlwifi: mvm: BT Coex - update the MPLUT Boost register value
  iwlwifi: mvm: BT coex - fix BT prio for probe requests
  iwlwifi: dvm: drop non VO frames when flushing
  Revert "iwlwifi: mvm: treat EAPOLs like mgmt frames wrt rate"
  iwlwifi: pcie: fix polling in various places

Fabian Frederick (1):
  net: rfkill: kernel-doc warning fixes

Felix Fietkau (2):
  ath: use CTL region from cfg80211 if unset in EEPROM
  ath9k_common: always update value in ath9k_cmn_update_txpow

Haim Dreyfuss (1):
  iwlwifi: mvm: Add tx power condition to bss_info_changed_ap_ibss

Hauke Mehrtens (1):
  bcma: fix build when CONFIG_OF_ADDRESS is not set

John W. Linville (2):
  Merge tag 'iwlwifi-for-john-2014-10-23' of 
git://git.kernel.org/.../iwlwifi/iwlwifi-fixes
  Merge tag 'mac80211-for-john-2014-10-23' of 
git://git.kernel.org/.../jberg/mac80211

Karl Beldan (2):
  mac80211: fix typo in starting baserate for rts_cts_rate_idx
  mac80211: minstrels: fix buffer overflow in HT debugfs rc_stats

Karsten Wiese (3):
  rtl8192cu: Fix for rtlwifi's bluetooth coexist functionality
  rtl8192cu: Call ieee80211_register_hw from rtl_usb_probe
  rtl8192cu: Prevent Ooops under rtl92c_set_fw_rsvdpagepkt

Kees Cook (1):
  rtlwifi: prevent format string usage from leaking

Larry Finger (3):
  rtlwifi: rtl8192ee: Prevent log spamming for switch statements
  rtlwifi: rtl8821ae: Fix possible array overrun
  rtlwifi: Add check for get_btc_status callback

Liad Kaufman (2):
  mac80211: fix warning on htmldocs for last_tdls_pkt_time
  iwlwifi: 8000: fix string given to MODULE_FIRMWARE

Luciano Coelho (2):
  mac80211: return the vif's chandef in ieee80211_cfg_get_channel()
  nl80211: sanity check the channel switch counter value

Matti Gottlieb (1):
  iwlwifi: mvm: ROC - bug fixes around time events and locking

Rafał Miłecki (1):
  bcma: add another PCI ID of device with BCM43228

Rickard Strandqvist (1):
  brcmfmac: dhd_sdio.c: Cleaning up missing null-terminate in conjunction 
with strncpy

Sujith Manoharan (1):
  ath9k: Enable HW queue control only for MCC

 drivers/bcma/host_pci.c|  5 +-
 drivers/bcma/main.c|  2 +-
 drivers/net/wireless/ath/ath.h |  1 +
 drivers/net/wireless/ath/ath9k/common.c|  8 ++--
 drivers/net/wireless/ath/ath9k/init.c  | 55 --
 drivers/net/wireless/ath/ath9k/main.c  |  3 ++
 drivers/net/wireless/ath/ath9k/xmit.c  | 10 +++-
 drivers/net/wireless/ath/regd.c| 14 ++
 drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | 25 +-
 drivers/net/wireless/iwlwifi/dvm/mac80211.c| 24 +-
 drivers/net/wireless/iwlwifi/iwl-8000.c|  3 +-
 drivers/net/wireless/iwlwifi/iwl-trans.h   |  2 +
 drivers/net/wireless/iwlwifi/mvm/coex.c|  4 +-
 drivers/net/wireless/iwlwifi/mvm/coex_legacy.c |  4 +-
 drivers

Re: [PATCH] ath10k: add tracing for tx ieee80211 header

2014-10-28 Thread Johannes Berg
On Tue, 2014-10-28 at 22:18 +0530, Rajkumar Manoharan wrote:
> For packet log, the transmitted frame 802.11 header alone is sufficient.
> Recording entire packet is also consuming lot of disk space. To
> optimize, add tracepoints for sending tx-ed 802.11 headers alone.

FWIW, in iwlwifi I made the data portion (only!) a separate tracing
subsystem, so that you can do

trace-cmd record -e iwlwifi

to get the hdrs, and

trace-cmd record -e iwlwifi -e iwlwifi_data

to get the hdrs, and the data, and then I put the two together in
userspace. That way, "-e iwlwifi" gets most useful stuff, and adding -e
iwlwifi_data when needed still has no duplication.

With what you're suggesting, it will be difficult to control tracing to
do exactly what's needed.

Anyway, I don't really care, but this just caught my eye.

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] ath10k: add tracing for tx ieee80211 header

2014-10-28 Thread Rajkumar Manoharan
For packet log, the transmitted frame 802.11 header alone is sufficient.
Recording entire packet is also consuming lot of disk space. To
optimize, add tracepoints for sending tx-ed 802.11 headers alone.

Cc: Michal Kazior 
Signed-off-by: Rajkumar Manoharan 
---
 drivers/net/wireless/ath/ath10k/htt_tx.c |  1 +
 drivers/net/wireless/ath/ath10k/trace.h  | 16 
 drivers/net/wireless/ath/ath10k/wmi.c|  3 +++
 3 files changed, 20 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c 
b/drivers/net/wireless/ath/ath10k/htt_tx.c
index b0df470..91f8fc1 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -565,6 +565,7 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff 
*msdu)
ath10k_dbg_dump(ar, ATH10K_DBG_HTT_DUMP, NULL, "htt tx msdu: ",
msdu->data, msdu->len);
trace_ath10k_htt_tx_msdu(ar, msdu->data, msdu->len);
+   trace_ath10k_htt_tx_msdu_hdr(ar, hdr, sizeof(*hdr));
 
sg_items[0].transfer_id = 0;
sg_items[0].transfer_context = NULL;
diff --git a/drivers/net/wireless/ath/ath10k/trace.h 
b/drivers/net/wireless/ath/ath10k/trace.h
index b9a2ba6..368376a 100644
--- a/drivers/net/wireless/ath/ath10k/trace.h
+++ b/drivers/net/wireless/ath/ath10k/trace.h
@@ -392,6 +392,22 @@ DEFINE_EVENT(ath10k_data_event, ath10k_htt_rx_desc,
 TP_PROTO(struct ath10k *ar, void *data, size_t len),
 TP_ARGS(ar, data, len)
 );
+
+DEFINE_EVENT(ath10k_data_event, ath10k_htt_tx_msdu_hdr,
+TP_PROTO(struct ath10k *ar, void *data, size_t len),
+TP_ARGS(ar, data, len)
+);
+
+DEFINE_EVENT(ath10k_data_event, ath10k_wmi_mgmt_tx_hdr,
+TP_PROTO(struct ath10k *ar, void *data, size_t len),
+TP_ARGS(ar, data, len)
+);
+
+DEFINE_EVENT(ath10k_data_event, ath10k_wmi_bcn_tx_hdr,
+TP_PROTO(struct ath10k *ar, void *data, size_t len),
+TP_ARGS(ar, data, len)
+);
+
 #endif /* _TRACE_H_ || TRACE_HEADER_MULTI_READ*/
 
 /* we don't want to use include/trace/events */
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index ae746ce..f169ae8 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -835,6 +835,7 @@ int ath10k_wmi_mgmt_tx(struct ath10k *ar, struct sk_buff 
*skb)
   wmi_skb, wmi_skb->len, fc & IEEE80211_FCTL_FTYPE,
   fc & IEEE80211_FCTL_STYPE);
trace_ath10k_wmi_mgmt_tx(ar, skb->data, skb->len);
+   trace_ath10k_wmi_mgmt_tx_hdr(ar, hdr, sizeof(*hdr));
 
/* Send the management frame buffer to the target */
ret = ath10k_wmi_cmd_send(ar, wmi_skb, ar->wmi.cmd->mgmt_tx_cmdid);
@@ -1894,6 +1895,8 @@ static void ath10k_wmi_event_host_swba(struct ath10k *ar, 
struct sk_buff *skb)
arvif->beacon_sent = false;
 
trace_ath10k_wmi_bcn_tx(ar, bcn->data, bcn->len);
+   trace_ath10k_wmi_bcn_tx_hdr(ar, bcn->data,
+   sizeof(struct ieee80211_hdr));
ath10k_wmi_tx_beacon_nowait(arvif);
 skip:
spin_unlock_bh(&ar->data_lock);
-- 
2.1.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] wireless: rt2x00: add new rt2800usb device

2014-10-28 Thread Cyril Brulebois
0x1b75 0xa200 AirLive WN-200USB wireless 11b/g/n dongle

References: https://bugs.debian.org/766802
Reported-by: Martin Mokrejs 
Cc: sta...@vger.kernel.org
Signed-off-by: Cyril Brulebois 
---
 drivers/net/wireless/rt2x00/rt2800usb.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c 
b/drivers/net/wireless/rt2x00/rt2800usb.c
index 573897b..8444313 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -,6 +,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
/* Ovislink */
{ USB_DEVICE(0x1b75, 0x3071) },
{ USB_DEVICE(0x1b75, 0x3072) },
+   { USB_DEVICE(0x1b75, 0xa200) },
/* Para */
{ USB_DEVICE(0x20b8, 0x) },
/* Pegatron */
-- 
1.7.10.4

--
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 00/16] brcmfmac: wowl support and cleanup

2014-10-28 Thread Joe Perches
On Tue, 2014-10-28 at 14:56 +0100, Arend van Spriel wrote:
> This series has a couple of wowl patches that were too late to make
> the 3.18 merge window. Apart from those there are a number of rename
> and rework patches that get rid of the terms dhd and wl.
> 
> The series is intended for 3.19 and applies to the master branch
> of the wireless-next repository.
> 
> Arend van Spriel (3):
>   brcmfmac: show firmware error as string in debug message
>   brcmfmac: remove unused defintion
>   brcmfmac: do not use firmware error code in driver
> 
> Hante Meuleman (13):
>   brcmfmac: Add wowl support for USB devices.
>   brcmfmac: Add wowl support for SDIO devices.
>   brcmfmac: Add wowl patterns support.
>   brcmfmac: (clean) Remove usb_rdl.h as it is not needed.
>   brcmfmac: (clean) Remove packet filter configuration.
>   brcmfmac: (clean) Move tracepoint related function.
>   brcmfmac: (clean) Rename files dhd_dbg to debug
>   brcmfmac: (clean) Rename dhd_bus.h in bus.h
>   brcmfmac: (clean) Rename dhd_common.c in common.c
>   brcmfmac: (clean) Rename files wl_cfg80211 to cfg80211
>   brcmfmac: (clean) Rename sdio related files.
>   brcmfmac: (clean) Rename sdio related files.
>   brcmfmac: (clean) Move sdio related function.

Does "(clean) " add anything to these commit subjects?


--
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/5] wil6210: reset flow updates

2014-10-28 Thread Vladimir Kondratiev
As communicated with the firmware & hardware teams

Signed-off-by: Vladimir Kondratiev 
---
 drivers/net/wireless/ath/wil6210/main.c| 23 ++-
 drivers/net/wireless/ath/wil6210/wil6210.h |  6 ++
 2 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/main.c 
b/drivers/net/wireless/ath/wil6210/main.c
index 7900384..0e95557 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -400,7 +400,7 @@ static inline void wil_release_cpu(struct wil6210_priv *wil)
 static int wil_target_reset(struct wil6210_priv *wil)
 {
int delay = 0;
-   u32 hw_state;
+   u32 x;
u32 rev_id;
bool is_sparrow = (wil->board->board == WIL_BOARD_SPARROW);
 
@@ -415,9 +415,22 @@ static int wil_target_reset(struct wil6210_priv *wil)
S(RGF_USER_CLKS_CTL_SW_RST_MASK_0, BIT_CAR_PERST_RST);
 
wil_halt_cpu(wil);
-   C(RGF_USER_CLKS_CTL_0, BIT_USER_CLKS_CAR_AHB_SW_SEL); /* 40 MHz */
 
if (is_sparrow) {
+   S(RGF_CAF_OSC_CONTROL, BIT_CAF_OSC_XTAL_EN);
+   /* XTAL stabilization should take about 3ms */
+   usleep_range(5000, 7000);
+   x = R(RGF_CAF_PLL_LOCK_STATUS);
+   if (!(x & BIT_CAF_OSC_DIG_XTAL_STABLE)) {
+   wil_err(wil, "Xtal stabilization timeout\n"
+   "RGF_CAF_PLL_LOCK_STATUS = 0x%08x\n", x);
+   return -ETIME;
+   }
+   /* switch 10k to XTAL*/
+   C(RGF_USER_SPARROW_M_4, BIT_SPARROW_M_4_SEL_SLEEP_OR_REF);
+   /* 40 MHz */
+   C(RGF_USER_CLKS_CTL_0, BIT_USER_CLKS_CAR_AHB_SW_SEL);
+
W(RGF_USER_CLKS_CTL_EXT_SW_RST_VEC_0, 0x3ff81f);
W(RGF_USER_CLKS_CTL_EXT_SW_RST_VEC_1, 0xf);
}
@@ -458,13 +471,13 @@ static int wil_target_reset(struct wil6210_priv *wil)
/* wait until device ready. typical time is 200..250 msec */
do {
msleep(RST_DELAY);
-   hw_state = R(RGF_USER_HW_MACHINE_STATE);
+   x = R(RGF_USER_HW_MACHINE_STATE);
if (delay++ > RST_COUNT) {
wil_err(wil, "Reset not completed, hw_state 0x%08x\n",
-   hw_state);
+   x);
return -ETIME;
}
-   } while (hw_state != HW_MACHINE_BOOT_DONE);
+   } while (x != HW_MACHINE_BOOT_DONE);
 
/* TODO: Erez check rev_id != 1 */
if (!is_sparrow && (rev_id != 1))
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h 
b/drivers/net/wireless/ath/wil6210/wil6210.h
index 7ffaf2f..18f8729 100644
--- a/drivers/net/wireless/ath/wil6210/wil6210.h
+++ b/drivers/net/wireless/ath/wil6210/wil6210.h
@@ -117,6 +117,8 @@ struct RGF_ICR {
#define BIT_USER_USER_ICR_SW_INT_2  BIT(18)
 #define RGF_USER_CLKS_CTL_EXT_SW_RST_VEC_0 (0x880c18)
 #define RGF_USER_CLKS_CTL_EXT_SW_RST_VEC_1 (0x880c2c)
+#define RGF_USER_SPARROW_M_4   (0x880c50) /* Sparrow */
+   #define BIT_SPARROW_M_4_SEL_SLEEP_OR_REFBIT(2)
 
 #define RGF_DMA_EP_TX_ICR  (0x881bb4) /* struct RGF_ICR */
#define BIT_DMA_EP_TX_ICR_TX_DONE   BIT(0)
@@ -152,6 +154,10 @@ struct RGF_ICR {
 #define RGF_MAC_MTRL_COUNTER_0 (0x886aa8)
 
 #define RGF_CAF_ICR(0x88946c) /* struct RGF_ICR */
+#define RGF_CAF_OSC_CONTROL(0x88afa4)
+   #define BIT_CAF_OSC_XTAL_EN BIT(0)
+#define RGF_CAF_PLL_LOCK_STATUS(0x88afec)
+   #define BIT_CAF_OSC_DIG_XTAL_STABLE BIT(0)
 
 /* popular locations */
 #define HOST_MBOX   HOSTADDR(RGF_USER_USER_SCRATCH_PAD)
-- 
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 5/5] wil6210: Add support for large packets

2014-10-28 Thread Vladimir Kondratiev
It is possible to configure driver using mtu_max module parameter
by setting it to value in range of 68..7920 inclusive.
This is sub-optimal performance-wise in case packet is larger than 1 page.
mtu_max default value is 2228.

Signed-off-by: Vladimir Kondratiev 
---
 drivers/net/wireless/ath/wil6210/main.c| 29 +
 drivers/net/wireless/ath/wil6210/netdev.c  |  2 +-
 drivers/net/wireless/ath/wil6210/txrx.c|  7 ---
 drivers/net/wireless/ath/wil6210/txrx.h|  4 ++--
 drivers/net/wireless/ath/wil6210/wil6210.h |  1 +
 drivers/net/wireless/ath/wil6210/wmi.c |  2 +-
 6 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/main.c 
b/drivers/net/wireless/ath/wil6210/main.c
index 92705c0..6212983 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -38,6 +38,35 @@ static unsigned int itr_trsh = WIL6210_ITR_TRSH_DEFAULT;
 module_param(itr_trsh, uint, S_IRUGO);
 MODULE_PARM_DESC(itr_trsh, " Interrupt moderation threshold, usecs.");
 
+/* We allow allocation of more than 1 page buffers to support large packets.
+ * It is suboptimal behavior performance wise in case MTU above page size.
+ */
+unsigned int mtu_max = TXRX_BUF_LEN_DEFAULT - ETH_HLEN;
+static int mtu_max_set(const char *val, const struct kernel_param *kp)
+{
+   int ret;
+
+   /* sets mtu_max directly. no need to restore it in case of
+* illegal value since we assume this will fail insmod
+*/
+   ret = param_set_uint(val, kp);
+   if (ret)
+   return ret;
+
+   if (mtu_max < 68 || mtu_max > IEEE80211_MAX_DATA_LEN_DMG)
+   ret = -EINVAL;
+
+   return ret;
+}
+
+static struct kernel_param_ops mtu_max_ops = {
+   .set = mtu_max_set,
+   .get = param_get_uint,
+};
+
+module_param_cb(mtu_max, &mtu_max_ops, &mtu_max, S_IRUGO);
+MODULE_PARM_DESC(mtu_max, " Max MTU value.");
+
 #define RST_DELAY (20) /* msec, for loop in @wil_target_reset */
 #define RST_COUNT (1 + 1000/RST_DELAY) /* round up to be above 1 sec total */
 
diff --git a/drivers/net/wireless/ath/wil6210/netdev.c 
b/drivers/net/wireless/ath/wil6210/netdev.c
index 2399651..e81703c 100644
--- a/drivers/net/wireless/ath/wil6210/netdev.c
+++ b/drivers/net/wireless/ath/wil6210/netdev.c
@@ -41,7 +41,7 @@ static int wil_change_mtu(struct net_device *ndev, int 
new_mtu)
 {
struct wil6210_priv *wil = ndev_to_wil(ndev);
 
-   if (new_mtu < 68 || new_mtu > (TX_BUF_LEN - ETH_HLEN)) {
+   if (new_mtu < 68 || new_mtu > mtu_max) {
wil_err(wil, "invalid MTU %d\n", new_mtu);
return -EINVAL;
}
diff --git a/drivers/net/wireless/ath/wil6210/txrx.c 
b/drivers/net/wireless/ath/wil6210/txrx.c
index 2936ef0..c680906 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.c
+++ b/drivers/net/wireless/ath/wil6210/txrx.c
@@ -206,7 +206,7 @@ static int wil_vring_alloc_skb(struct wil6210_priv *wil, 
struct vring *vring,
   u32 i, int headroom)
 {
struct device *dev = wil_to_dev(wil);
-   unsigned int sz = RX_BUF_LEN;
+   unsigned int sz = mtu_max + ETH_HLEN;
struct vring_rx_desc dd, *d = ⅆ
volatile struct vring_rx_desc *_d = &vring->va[i].rx;
dma_addr_t pa;
@@ -385,7 +385,7 @@ static struct sk_buff *wil_vring_reap_rx(struct 
wil6210_priv *wil,
struct vring_rx_desc *d;
struct sk_buff *skb;
dma_addr_t pa;
-   unsigned int sz = RX_BUF_LEN;
+   unsigned int sz = mtu_max + ETH_HLEN;
u16 dmalen;
u8 ftype;
u8 ds_bits;
@@ -646,7 +646,8 @@ int wil_vring_init_tx(struct wil6210_priv *wil, int id, int 
size,
.action = cpu_to_le32(WMI_VRING_CMD_ADD),
.vring_cfg = {
.tx_sw_ring = {
-   .max_mpdu_size = cpu_to_le16(TX_BUF_LEN),
+   .max_mpdu_size =
+   cpu_to_le16(mtu_max + ETH_HLEN),
.ring_size = cpu_to_le16(size),
},
.ringid = id,
diff --git a/drivers/net/wireless/ath/wil6210/txrx.h 
b/drivers/net/wireless/ath/wil6210/txrx.h
index de04671..630aeb5 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.h
+++ b/drivers/net/wireless/ath/wil6210/txrx.h
@@ -21,8 +21,8 @@
 #define BUF_HW_OWNED(0)
 
 /* size of max. Tx/Rx buffers, as supported by FW */
-#define RX_BUF_LEN  (2242)
-#define TX_BUF_LEN  (2242)
+#define TXRX_BUF_LEN_DEFAULT (2242)
+
 /* how many bytes to reserve for rtap header? */
 #define WIL6210_RTAP_SIZE (128)
 
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h 
b/drivers/net/wireless/ath/wil6210/wil6210.h
index 3674e27..95d3a06 100644
--- a/drivers/net/wireless/ath/wil6210/wil6210.h
+++ b/drivers/net/wireless/ath/wil6210/wil6210.h
@@ -24,6 +24,7 @@
 #include "wil_platform.h"
 
 extern bool no_fw_recovery;
+extern unsign

[PATCH 4/5] wil6210: improve dmesg for fw error handling

2014-10-28 Thread Vladimir Kondratiev
In case of FW error, make it clear (in dmesg) what branch is taken
in the error recovery code.

Signed-off-by: Vladimir Kondratiev 
---
 drivers/net/wireless/ath/wil6210/main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/wireless/ath/wil6210/main.c 
b/drivers/net/wireless/ath/wil6210/main.c
index b3a84ae..92705c0 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -267,9 +267,12 @@ static void wil_fw_error_worker(struct work_struct *work)
break;
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_P2P_GO:
+   wil_info(wil, "No recovery for AP-like interface\n");
/* recovery in these modes is done by upper layers */
break;
default:
+   wil_err(wil, "No recovery - unknown interface type %d\n",
+   wdev->iftype);
break;
}
mutex_unlock(&wil->mutex);
-- 
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 0/5] wil6210 updates

2014-10-28 Thread Vladimir Kondratiev
minor fixes, except for the last patch that adds support
for the maximum MTU up to 7920, as by the 802.11ad spec

Vladimir Kondratiev (5):
  wil6210: do not attempt FW recovery if interface is down
  wil6210: reset flow updates
  wil6210: prevent double disconnect command issuing
  wil6210: improve dmesg for fw error handling
  wil6210: Add support for large packets

 drivers/net/wireless/ath/wil6210/cfg80211.c |  2 +-
 drivers/net/wireless/ath/wil6210/main.c | 95 -
 drivers/net/wireless/ath/wil6210/netdev.c   |  2 +-
 drivers/net/wireless/ath/wil6210/txrx.c |  7 ++-
 drivers/net/wireless/ath/wil6210/txrx.h |  4 +-
 drivers/net/wireless/ath/wil6210/wil6210.h  | 10 ++-
 drivers/net/wireless/ath/wil6210/wmi.c  |  4 +-
 7 files changed, 99 insertions(+), 25 deletions(-)

-- 
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 3/5] wil6210: prevent double disconnect command issuing

2014-10-28 Thread Vladimir Kondratiev
Disconnect flow may be invoked either from upper layer request,
or from event reported by the firmware.

In case of firmware event, driver need to release resources for the station but
not send another disconnect WMI command.

In case of upper layer request, WMI_DISCONNECT_STA_CMDID command need to
be issued for the firmware to perform disconnect on the MAC layer. Eventually,
event is expected to confirm MAC disconnect, but it is better to not wait for
firmware event and release station resources immediately. FW may fail to
report disconnect for various reasons, so one could not rely on event always 
reported.

Introduce parameter to distinguish 2 cases above to prevent double WMI command
issuing.

Signed-off-by: Vladimir Kondratiev 
---
 drivers/net/wireless/ath/wil6210/cfg80211.c |  2 +-
 drivers/net/wireless/ath/wil6210/main.c | 35 -
 drivers/net/wireless/ath/wil6210/wil6210.h  |  3 ++-
 drivers/net/wireless/ath/wil6210/wmi.c  |  2 +-
 4 files changed, 29 insertions(+), 13 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c 
b/drivers/net/wireless/ath/wil6210/cfg80211.c
index d9f4b30..4248fb3 100644
--- a/drivers/net/wireless/ath/wil6210/cfg80211.c
+++ b/drivers/net/wireless/ath/wil6210/cfg80211.c
@@ -797,7 +797,7 @@ static int wil_cfg80211_del_station(struct wiphy *wiphy,
struct wil6210_priv *wil = wiphy_to_wil(wiphy);
 
mutex_lock(&wil->mutex);
-   wil6210_disconnect(wil, mac);
+   wil6210_disconnect(wil, mac, false);
mutex_unlock(&wil->mutex);
 
return 0;
diff --git a/drivers/net/wireless/ath/wil6210/main.c 
b/drivers/net/wireless/ath/wil6210/main.c
index 0e95557..b3a84ae 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -74,7 +74,8 @@ void wil_memcpy_toio_32(volatile void __iomem *dst, const 
void *src,
__raw_writel(*s++, d++);
 }
 
-static void wil_disconnect_cid(struct wil6210_priv *wil, int cid)
+static void wil_disconnect_cid(struct wil6210_priv *wil, int cid,
+  bool from_event)
 {
uint i;
struct net_device *ndev = wil_to_ndev(wil);
@@ -86,7 +87,10 @@ static void wil_disconnect_cid(struct wil6210_priv *wil, int 
cid)
 
sta->data_port_open = false;
if (sta->status != wil_sta_unused) {
-   wmi_disconnect_sta(wil, sta->addr, WLAN_REASON_DEAUTH_LEAVING);
+   if (!from_event)
+   wmi_disconnect_sta(wil, sta->addr,
+  WLAN_REASON_DEAUTH_LEAVING);
+
switch (wdev->iftype) {
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_P2P_GO:
@@ -118,7 +122,8 @@ static void wil_disconnect_cid(struct wil6210_priv *wil, 
int cid)
memset(&sta->stats, 0, sizeof(sta->stats));
 }
 
-static void _wil6210_disconnect(struct wil6210_priv *wil, const u8 *bssid)
+static void _wil6210_disconnect(struct wil6210_priv *wil, const u8 *bssid,
+   bool from_event)
 {
int cid = -ENOENT;
struct net_device *ndev = wil_to_ndev(wil);
@@ -133,10 +138,10 @@ static void _wil6210_disconnect(struct wil6210_priv *wil, 
const u8 *bssid)
}
 
if (cid >= 0) /* disconnect 1 peer */
-   wil_disconnect_cid(wil, cid);
+   wil_disconnect_cid(wil, cid, from_event);
else /* disconnect all */
for (cid = 0; cid < WIL6210_MAX_CID; cid++)
-   wil_disconnect_cid(wil, cid);
+   wil_disconnect_cid(wil, cid, from_event);
 
/* link state */
switch (wdev->iftype) {
@@ -166,7 +171,7 @@ static void wil_disconnect_worker(struct work_struct *work)
struct wil6210_priv, disconnect_worker);
 
mutex_lock(&wil->mutex);
-   _wil6210_disconnect(wil, NULL);
+   _wil6210_disconnect(wil, NULL, false);
mutex_unlock(&wil->mutex);
 }
 
@@ -351,12 +356,22 @@ int wil_priv_init(struct wil6210_priv *wil)
return 0;
 }
 
-void wil6210_disconnect(struct wil6210_priv *wil, const u8 *bssid)
+/**
+ * wil6210_disconnect - disconnect one connection
+ * @wil: driver context
+ * @bssid: peer to disconnect, NULL to disconnect all
+ * @from_event: whether is invoked from FW event handler
+ *
+ * Disconnect and release associated resources. If invoked not from the
+ * FW event handler, issue WMI command(s) to trigger MAC disconnect.
+ */
+void wil6210_disconnect(struct wil6210_priv *wil, const u8 *bssid,
+   bool from_event)
 {
wil_dbg_misc(wil, "%s()\n", __func__);
 
del_timer_sync(&wil->connect_timer);
-   _wil6210_disconnect(wil, bssid);
+   _wil6210_disconnect(wil, bssid, from_event);
 }
 
 void wil_priv_deinit(struct wil6210_priv *wil)
@@ -368,7 +383,7 @@ void wil_priv_deinit(struct wil6210_priv *wil)
cancel_work_sync(&wil->disconnect_worker);
cancel_work_sync(&wil->f

[PATCH 1/5] wil6210: do not attempt FW recovery if interface is down

2014-10-28 Thread Vladimir Kondratiev
When interface is down, recovery flow should not be attempted.
Next ndo_open() will trigger target reset, that is FW recovery.

Doing recovery while interface is down cause internal "up", leaving
internal driver state in conflict with network stack. Then, when network
stack will call ndo_open(), kernel oops will be triggered.

Signed-off-by: Vladimir Kondratiev 
---
 drivers/net/wireless/ath/wil6210/main.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/wireless/ath/wil6210/main.c 
b/drivers/net/wireless/ath/wil6210/main.c
index 6500caf..7900384 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -223,6 +223,11 @@ static void wil_fw_error_worker(struct work_struct *work)
 
wil_dbg_misc(wil, "fw error worker\n");
 
+   if (!netif_running(wil_to_ndev(wil))) {
+   wil_info(wil, "No recovery - interface is down\n");
+   return;
+   }
+
/* increment @recovery_count if less then WIL6210_FW_RECOVERY_TO
 * passed since last recovery attempt
 */
-- 
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


Re: MediaTek WiFi hardware support in upstream kernel

2014-10-28 Thread Oleksij Rempel
Am 28.10.2014 um 15:06 schrieb Arend van Spriel:
> On 28-10-14 14:46, John W. Linville wrote:
>> On Mon, Oct 27, 2014 at 07:19:32PM +0100, Oleksij Rempel wrote:
>>> Am 27.10.2014 um 16:20 schrieb John W. Linville:
 On Mon, Oct 27, 2014 at 11:02:00AM +0800, Etna wrote:
> I am not a developer, but I stumbled upon this just a couple of days ago 
> in
> the OpenWRT forums:
>
> https://forum.openwrt.org/viewtopic.php?id=53215
>
> In short, MediaTek is looking for volunteers to help get their drivers
> mainlined in the upstream kernels; this includes drivers for their USB and
> PCI wifi hardware under both the MediaTek and Ralink brands. They are
> willing to provide "chip info, reference driver, dev board, etc" and even
> some degree of sponsorship, apparently subject to their management's
> approval.
>
> In exchange, they require that the volunteers fulfill the following
> requirements:
> - skilled in wifi driver development
> - provide a suitable schedule / roadmap
> - be able to get the code mainlined in the official linux kernel.
>
> Those who are keen on taking up the task can contact the original poster 
> at
> hua.shao[AT]mediatek.com
>
> **Disclaimer: I am in no way related to, or under the employ of MediaTek 
> or
> Ralink. I am only posting this here because I have a handful of MT wifi
> chips which I hope to see being supported in the upstream kernel so that I
> can actually use them under Linux,

 Well, this is mostly good to see.  I hope there is someone that wants
 to take-up the cause!

 If someone is interested in working-on the project above but for
 whatever reason doesn't want to deal with MediaTek on their own,
 feel free to contact me.  I'll try to be helpful however I can.

 Thanks,

 John
>>>
>>>
>>> Sounds interesting and as perfect possibility to learn. I would like to
>>> do it, but i have two concerns:
>>> - i never wrote an wifi driver from scratch.
>>
>> FWIW, I think MediaTek already has some form of drivers.  With that
>> said, it might be easier to write new mac80211-based ones than to
>> adapt the existing ones.
>>
>>> - i'm seeking for a job. It means if i will find one, this project will
>>> get lower priority.
>>
>> No one can ask anything more.
>>
>>> If nobody has problems with this two points, then i'm ok.
>>
>> It sounds like we have a volunteer!  Let me know if you need any
>> specific help or guidance.
> 
> During LPC Felix mentioned GPLed mediatek driver for their 11ac
> chipset(s?). It is on github:
> 
> https://github.com/openwrt/mtk-wifi-gpl

What is the next step?

-- 
Regards,
Oleksij



signature.asc
Description: OpenPGP digital signature


Re: MediaTek WiFi hardware support in upstream kernel

2014-10-28 Thread Arend van Spriel
On 28-10-14 14:46, John W. Linville wrote:
> On Mon, Oct 27, 2014 at 07:19:32PM +0100, Oleksij Rempel wrote:
>> Am 27.10.2014 um 16:20 schrieb John W. Linville:
>>> On Mon, Oct 27, 2014 at 11:02:00AM +0800, Etna wrote:
 I am not a developer, but I stumbled upon this just a couple of days ago in
 the OpenWRT forums:

 https://forum.openwrt.org/viewtopic.php?id=53215

 In short, MediaTek is looking for volunteers to help get their drivers
 mainlined in the upstream kernels; this includes drivers for their USB and
 PCI wifi hardware under both the MediaTek and Ralink brands. They are
 willing to provide "chip info, reference driver, dev board, etc" and even
 some degree of sponsorship, apparently subject to their management's
 approval.

 In exchange, they require that the volunteers fulfill the following
 requirements:
 - skilled in wifi driver development
 - provide a suitable schedule / roadmap
 - be able to get the code mainlined in the official linux kernel.

 Those who are keen on taking up the task can contact the original poster at
 hua.shao[AT]mediatek.com

 **Disclaimer: I am in no way related to, or under the employ of MediaTek or
 Ralink. I am only posting this here because I have a handful of MT wifi
 chips which I hope to see being supported in the upstream kernel so that I
 can actually use them under Linux,
>>>
>>> Well, this is mostly good to see.  I hope there is someone that wants
>>> to take-up the cause!
>>>
>>> If someone is interested in working-on the project above but for
>>> whatever reason doesn't want to deal with MediaTek on their own,
>>> feel free to contact me.  I'll try to be helpful however I can.
>>>
>>> Thanks,
>>>
>>> John
>>
>>
>> Sounds interesting and as perfect possibility to learn. I would like to
>> do it, but i have two concerns:
>> - i never wrote an wifi driver from scratch.
> 
> FWIW, I think MediaTek already has some form of drivers.  With that
> said, it might be easier to write new mac80211-based ones than to
> adapt the existing ones.
> 
>> - i'm seeking for a job. It means if i will find one, this project will
>> get lower priority.
> 
> No one can ask anything more.
> 
>> If nobody has problems with this two points, then i'm ok.
> 
> It sounds like we have a volunteer!  Let me know if you need any
> specific help or guidance.

During LPC Felix mentioned GPLed mediatek driver for their 11ac
chipset(s?). It is on github:

https://github.com/openwrt/mtk-wifi-gpl

Regards,
Arend

--
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 15/16] brcmfmac: (clean) Rename sdio related files.

2014-10-28 Thread Arend van Spriel
From: Hante Meuleman 

Rename sdio_host.h to sdio.h and dhd_sdio.c to sdio.c.

Reviewed-by: Arend Van Spriel 
Reviewed-by: Pieter-Paul Giesberts 
Signed-off-by: Hante Meuleman 
Signed-off-by: Arend van Spriel 
---
 drivers/net/wireless/brcm80211/brcmfmac/Makefile| 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/bcdc.c  | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/btcoex.c| 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c  | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/common.c| 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/commonring.c| 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/{dhd_linux.c => core.c} | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/{dhd.h => core.h}   | 6 +++---
 drivers/net/wireless/brcm80211/brcmfmac/debug.c | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/feature.c   | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/flowring.c  | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/fweh.c  | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/fwil.c  | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c  | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c| 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/p2p.c   | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/proto.c | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/vendor.c| 2 +-
 18 files changed, 20 insertions(+), 20 deletions(-)
 rename drivers/net/wireless/brcm80211/brcmfmac/{dhd_linux.c => core.c} (99%)
 rename drivers/net/wireless/brcm80211/brcmfmac/{dhd.h => core.h} (98%)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/Makefile 
b/drivers/net/wireless/brcm80211/brcmfmac/Makefile
index 40ba46b..dc4c750 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/Makefile
+++ b/drivers/net/wireless/brcm80211/brcmfmac/Makefile
@@ -31,7 +31,7 @@ brcmfmac-objs += \
p2p.o \
proto.o \
common.o \
-   dhd_linux.o \
+   core.o \
firmware.o \
feature.o \
btcoex.o \
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c 
b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
index d5a2d94..8e0e91c 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
@@ -25,7 +25,7 @@
 #include 
 #include 
 
-#include "dhd.h"
+#include "core.h"
 #include "bus.h"
 #include "fwsignal.h"
 #include "debug.h"
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c 
b/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
index e324414..0445163 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
@@ -20,7 +20,7 @@
 #include 
 #include 
 #include 
-#include 
+#include "core.h"
 #include "debug.h"
 #include "fwil.h"
 #include "fwil_types.h"
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c 
b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
index 0390e57..8822f2b 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
@@ -26,7 +26,7 @@
 #include 
 #include 
 #include 
-#include "dhd.h"
+#include "core.h"
 #include "debug.h"
 #include "tracepoint.h"
 #include "fwil_types.h"
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/common.c 
b/drivers/net/wireless/brcm80211/brcmfmac/common.c
index 75642e4..183cec9 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/common.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/common.c
@@ -19,7 +19,7 @@
 #include 
 #include 
 #include 
-#include "dhd.h"
+#include "core.h"
 #include "bus.h"
 #include "debug.h"
 #include "fwil.h"
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/commonring.c 
b/drivers/net/wireless/brcm80211/brcmfmac/commonring.c
index c6d65b8..77656c7 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/commonring.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/commonring.c
@@ -19,7 +19,7 @@
 #include 
 #include 
 
-#include "dhd.h"
+#include "core.h"
 #include "commonring.h"
 
 
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c 
b/drivers/net/wireless/brcm80211/brcmfmac/core.c
similarity index 99%
rename from drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
rename to drivers/net/wireless/brcm80211/brcmfmac/core.c
index 53650b9..f407665 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
@@ -22,7 +22,7 @@
 #include 
 #include 
 
-#include "dhd.h"
+#include "core.h"
 #include "bus.h"
 #include "debug.h"
 #include "fwil_types.h"
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd.h 
b/drivers/net/wireless/brcm80211/brcmfmac/core.h
similarity index 98%
rename from drivers/net/wireless/brcm80211/brcmfmac/dhd.h
rename to drivers/net/wireless/brcm80211/brcmfmac/core.h
index 5

[PATCH 14/16] brcmfmac: (clean) Rename sdio related files.

2014-10-28 Thread Arend van Spriel
From: Hante Meuleman 

Rename sdio_host.h to sdio.h and dhd_sdio.c to sdio.c.

Reviewed-by: Arend Van Spriel 
Reviewed-by: Pieter-Paul Giesberts 
Signed-off-by: Hante Meuleman 
Signed-off-by: Arend van Spriel 
---
 drivers/net/wireless/brcm80211/brcmfmac/Makefile| 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c| 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/of.c| 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/{dhd_sdio.c => sdio.c}  | 4 ++--
 drivers/net/wireless/brcm80211/brcmfmac/{sdio_host.h => sdio.h} | 6 +++---
 5 files changed, 8 insertions(+), 8 deletions(-)
 rename drivers/net/wireless/brcm80211/brcmfmac/{dhd_sdio.c => sdio.c} (99%)
 rename drivers/net/wireless/brcm80211/brcmfmac/{sdio_host.h => sdio.h} (99%)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/Makefile 
b/drivers/net/wireless/brcm80211/brcmfmac/Makefile
index 35b680550..40ba46b 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/Makefile
+++ b/drivers/net/wireless/brcm80211/brcmfmac/Makefile
@@ -43,7 +43,7 @@ brcmfmac-$(CONFIG_BRCMFMAC_PROTO_MSGBUF) += \
flowring.o \
msgbuf.o
 brcmfmac-$(CONFIG_BRCMFMAC_SDIO) += \
-   dhd_sdio.o \
+   sdio.o \
bcmsdh.o
 brcmfmac-$(CONFIG_BRCMFMAC_USB) += \
usb.o
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c 
b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
index 969bdd6..f754ffc 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
@@ -43,7 +43,7 @@
 #include "chip.h"
 #include "bus.h"
 #include "debug.h"
-#include "sdio_host.h"
+#include "sdio.h"
 #include "of.h"
 
 #define SDIOH_API_ACCESS_RETRY_LIMIT   2
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/of.c 
b/drivers/net/wireless/brcm80211/brcmfmac/of.c
index 875060c..eb3fce82 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/of.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/of.c
@@ -22,7 +22,7 @@
 
 #include 
 #include "debug.h"
-#include "sdio_host.h"
+#include "sdio.h"
 
 void brcmf_of_probe(struct brcmf_sdio_dev *sdiodev)
 {
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c 
b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
similarity index 99%
rename from drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
rename to drivers/net/wireless/brcm80211/brcmfmac/sdio.c
index 224e922..73ac0c3 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
@@ -40,7 +40,7 @@
 #include 
 #include 
 #include 
-#include "sdio_host.h"
+#include "sdio.h"
 #include "chip.h"
 #include "firmware.h"
 
@@ -4076,7 +4076,7 @@ struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev 
*sdiodev)
 
/* platform specific configuration:
 *   alignments must be at least 4 bytes for ADMA
- */
+*/
bus->head_align = ALIGNMENT;
bus->sgentry_align = ALIGNMENT;
if (sdiodev->pdata) {
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h 
b/drivers/net/wireless/brcm80211/brcmfmac/sdio.h
similarity index 99%
rename from drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h
rename to drivers/net/wireless/brcm80211/brcmfmac/sdio.h
index 262aedf..8eb4262 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.h
@@ -14,8 +14,8 @@
  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#ifndef_BRCM_SDH_H_
-#define_BRCM_SDH_H_
+#ifndefBRCMFMAC_SDIO_H
+#defineBRCMFMAC_SDIO_H
 
 #include 
 #include 
@@ -337,4 +337,4 @@ void brcmf_sdio_isr(struct brcmf_sdio *bus);
 void brcmf_sdio_wd_timer(struct brcmf_sdio *bus, uint wdtick);
 void brcmf_sdio_wowl_config(struct device *dev, bool enabled);
 
-#endif /* _BRCM_SDH_H_ */
+#endif /* BRCMFMAC_SDIO_H */
-- 
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 16/16] brcmfmac: (clean) Move sdio related function.

2014-10-28 Thread Arend van Spriel
From: Hante Meuleman 

prec_enq is a sdio specific function. Move it to sdio.c.

Reviewed-by: Arend Van Spriel 
Reviewed-by: Pieter-Paul Giesberts 
Signed-off-by: Hante Meuleman 
Signed-off-by: Arend van Spriel 
---
 drivers/net/wireless/brcm80211/brcmfmac/common.c | 51 
 drivers/net/wireless/brcm80211/brcmfmac/core.h   |  1 -
 drivers/net/wireless/brcm80211/brcmfmac/sdio.c   | 46 -
 3 files changed, 44 insertions(+), 54 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/common.c 
b/drivers/net/wireless/brcm80211/brcmfmac/common.c
index 183cec9..1861a13 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/common.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/common.c
@@ -33,57 +33,6 @@
 /* boost value for RSSI_DELTA in preferred join selection */
 #define BRCMF_JOIN_PREF_RSSI_BOOST 8
 
-
-bool brcmf_c_prec_enq(struct device *dev, struct pktq *q,
- struct sk_buff *pkt, int prec)
-{
-   struct sk_buff *p;
-   int eprec = -1; /* precedence to evict from */
-   bool discard_oldest;
-   struct brcmf_bus *bus_if = dev_get_drvdata(dev);
-   struct brcmf_pub *drvr = bus_if->drvr;
-
-   /* Fast case, precedence queue is not full and we are also not
-* exceeding total queue length
-*/
-   if (!pktq_pfull(q, prec) && !pktq_full(q)) {
-   brcmu_pktq_penq(q, prec, pkt);
-   return true;
-   }
-
-   /* Determine precedence from which to evict packet, if any */
-   if (pktq_pfull(q, prec)) {
-   eprec = prec;
-   } else if (pktq_full(q)) {
-   p = brcmu_pktq_peek_tail(q, &eprec);
-   if (eprec > prec)
-   return false;
-   }
-
-   /* Evict if needed */
-   if (eprec >= 0) {
-   /* Detect queueing to unconfigured precedence */
-   discard_oldest = ac_bitmap_tst(drvr->wme_dp, eprec);
-   if (eprec == prec && !discard_oldest)
-   return false;   /* refuse newer (incoming) packet */
-   /* Evict packet according to discard policy */
-   p = discard_oldest ? brcmu_pktq_pdeq(q, eprec) :
-   brcmu_pktq_pdeq_tail(q, eprec);
-   if (p == NULL)
-   brcmf_err("brcmu_pktq_penq() failed, oldest %d\n",
- discard_oldest);
-
-   brcmu_pkt_buf_free_skb(p);
-   }
-
-   /* Enqueue */
-   p = brcmu_pktq_penq(q, prec, pkt);
-   if (p == NULL)
-   brcmf_err("brcmu_pktq_penq() failed\n");
-
-   return p != NULL;
-}
-
 int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
 {
s8 eventmask[BRCMF_EVENTING_MASK_LEN];
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/core.h 
b/drivers/net/wireless/brcm80211/brcmfmac/core.h
index 7df22bd..98228e9 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
@@ -83,7 +83,6 @@ struct brcmf_pub {
/* Internal brcmf items */
uint hdrlen;/* Total BRCMF header length (proto + bus) */
uint rxsz;  /* Rx buffer size bus module should use */
-   u8 wme_dp;  /* wme discard priority */
 
/* Dongle media info */
char fwver[BRCMF_DRIVER_FIRMWARE_VERSION_LEN];
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c 
b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
index 73ac0c3..72e87b5 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
@@ -2763,6 +2763,48 @@ static struct pktq *brcmf_sdio_bus_gettxq(struct device 
*dev)
return &bus->txq;
 }
 
+static bool brcmf_sdio_prec_enq(struct pktq *q, struct sk_buff *pkt, int prec)
+{
+   struct sk_buff *p;
+   int eprec = -1; /* precedence to evict from */
+
+   /* Fast case, precedence queue is not full and we are also not
+* exceeding total queue length
+*/
+   if (!pktq_pfull(q, prec) && !pktq_full(q)) {
+   brcmu_pktq_penq(q, prec, pkt);
+   return true;
+   }
+
+   /* Determine precedence from which to evict packet, if any */
+   if (pktq_pfull(q, prec)) {
+   eprec = prec;
+   } else if (pktq_full(q)) {
+   p = brcmu_pktq_peek_tail(q, &eprec);
+   if (eprec > prec)
+   return false;
+   }
+
+   /* Evict if needed */
+   if (eprec >= 0) {
+   /* Detect queueing to unconfigured precedence */
+   if (eprec == prec)
+   return false;   /* refuse newer (incoming) packet */
+   /* Evict packet according to discard policy */
+   p = brcmu_pktq_pdeq_tail(q, eprec);
+   if (p == NULL)
+   brcmf_err("brcmu_pktq_pdeq_tail() failed\n");
+   brcmu_pkt_buf_free_skb(p);
+   

Re: MediaTek WiFi hardware support in upstream kernel

2014-10-28 Thread John W. Linville
On Mon, Oct 27, 2014 at 07:19:32PM +0100, Oleksij Rempel wrote:
> Am 27.10.2014 um 16:20 schrieb John W. Linville:
> > On Mon, Oct 27, 2014 at 11:02:00AM +0800, Etna wrote:
> >> I am not a developer, but I stumbled upon this just a couple of days ago in
> >> the OpenWRT forums:
> >>
> >> https://forum.openwrt.org/viewtopic.php?id=53215
> >>
> >> In short, MediaTek is looking for volunteers to help get their drivers
> >> mainlined in the upstream kernels; this includes drivers for their USB and
> >> PCI wifi hardware under both the MediaTek and Ralink brands. They are
> >> willing to provide "chip info, reference driver, dev board, etc" and even
> >> some degree of sponsorship, apparently subject to their management's
> >> approval.
> >>
> >> In exchange, they require that the volunteers fulfill the following
> >> requirements:
> >> - skilled in wifi driver development
> >> - provide a suitable schedule / roadmap
> >> - be able to get the code mainlined in the official linux kernel.
> >>
> >> Those who are keen on taking up the task can contact the original poster at
> >> hua.shao[AT]mediatek.com
> >>
> >> **Disclaimer: I am in no way related to, or under the employ of MediaTek or
> >> Ralink. I am only posting this here because I have a handful of MT wifi
> >> chips which I hope to see being supported in the upstream kernel so that I
> >> can actually use them under Linux,
> > 
> > Well, this is mostly good to see.  I hope there is someone that wants
> > to take-up the cause!
> > 
> > If someone is interested in working-on the project above but for
> > whatever reason doesn't want to deal with MediaTek on their own,
> > feel free to contact me.  I'll try to be helpful however I can.
> > 
> > Thanks,
> > 
> > John
> 
> 
> Sounds interesting and as perfect possibility to learn. I would like to
> do it, but i have two concerns:
> - i never wrote an wifi driver from scratch.

FWIW, I think MediaTek already has some form of drivers.  With that
said, it might be easier to write new mac80211-based ones than to
adapt the existing ones.

> - i'm seeking for a job. It means if i will find one, this project will
> get lower priority.

No one can ask anything more.

> If nobody has problems with this two points, then i'm ok.

It sounds like we have a volunteer!  Let me know if you need any
specific help or guidance.

John
-- 
John W. LinvilleSomeday the world will need a hero, and you
linvi...@tuxdriver.com  might be all we have.  Be ready.
--
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 11/16] brcmfmac: (clean) Rename dhd_bus.h in bus.h

2014-10-28 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/brcm80211/brcmfmac/bcdc.c   | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/{dhd_bus.h => bus.h} | 9 -
 drivers/net/wireless/brcm80211/brcmfmac/debug.c  | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c  | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c   | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/feature.c| 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/flowring.c   | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/fwil.c   | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c   | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/pcie.c   | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/proto.c  | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/usb.c| 3 +--
 drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c| 2 +-
 16 files changed, 19 insertions(+), 21 deletions(-)
 rename drivers/net/wireless/brcm80211/brcmfmac/{dhd_bus.h => bus.h} (98%)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c 
b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
index 11d3dfa..d5a2d94 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
@@ -26,7 +26,7 @@
 #include 
 
 #include "dhd.h"
-#include "dhd_bus.h"
+#include "bus.h"
 #include "fwsignal.h"
 #include "debug.h"
 #include "tracepoint.h"
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c 
b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
index 8c0dfea..969bdd6 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
@@ -41,7 +41,7 @@
 #include 
 #include 
 #include "chip.h"
-#include "dhd_bus.h"
+#include "bus.h"
 #include "debug.h"
 #include "sdio_host.h"
 #include "of.h"
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h 
b/drivers/net/wireless/brcm80211/brcmfmac/bus.h
similarity index 98%
rename from drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h
rename to drivers/net/wireless/brcm80211/brcmfmac/bus.h
index 0421cfe..ef344e4 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bus.h
@@ -14,8 +14,8 @@
  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#ifndef _BRCMF_BUS_H_
-#define _BRCMF_BUS_H_
+#ifndef BRCMFMAC_BUS_H
+#define BRCMFMAC_BUS_H
 
 #include "debug.h"
 
@@ -227,8 +227,7 @@ void brcmf_txflowblock(struct device *dev, bool state);
 void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success);
 
 int brcmf_bus_start(struct device *dev);
-s32 brcmf_iovar_data_set(struct device *dev, char *name, void *data,
-   u32 len);
+s32 brcmf_iovar_data_set(struct device *dev, char *name, void *data, u32 len);
 void brcmf_bus_add_txhdrlen(struct device *dev, uint len);
 
 #ifdef CONFIG_BRCMFMAC_SDIO
@@ -241,4 +240,4 @@ void brcmf_usb_exit(void);
 void brcmf_usb_register(void);
 #endif
 
-#endif /* _BRCMF_BUS_H_ */
+#endif /* BRCMFMAC_BUS_H */
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/debug.c 
b/drivers/net/wireless/brcm80211/brcmfmac/debug.c
index 27e5108..340b104 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/debug.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.c
@@ -20,7 +20,7 @@
 #include 
 #include 
 #include "dhd.h"
-#include "dhd_bus.h"
+#include "bus.h"
 #include "debug.h"
 
 static struct dentry *root_folder;
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c 
b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
index 78ada88..7723994 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
@@ -20,7 +20,7 @@
 #include 
 #include 
 #include "dhd.h"
-#include "dhd_bus.h"
+#include "bus.h"
 #include "debug.h"
 #include "fwil.h"
 #include "fwil_types.h"
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c 
b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
index 2522e68..8dbf2c1 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
@@ -23,7 +23,7 @@
 #include 
 
 #include "dhd.h"
-#include "dhd_bus.h"
+#include "bus.h"
 #include "debug.h"
 #include "fwil_types.h"
 #include "p2p.h"
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c 
b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
index 4fc2f52..224e922 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
@@ -96,7 +96,7 @@ st

[PATCH 13/16] brcmfmac: (clean) Rename files wl_cfg80211 to cfg80211

2014-10-28 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/brcm80211/brcmfmac/Makefile | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/btcoex.c | 2 +-
 .../wireless/brcm80211/brcmfmac/{wl_cfg80211.c => cfg80211.c}| 5 +++--
 .../wireless/brcm80211/brcmfmac/{wl_cfg80211.h => cfg80211.h}| 9 +
 drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c  | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c   | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/p2p.c| 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/vendor.c | 2 +-
 8 files changed, 14 insertions(+), 12 deletions(-)
 rename drivers/net/wireless/brcm80211/brcmfmac/{wl_cfg80211.c => cfg80211.c} 
(99%)
 rename drivers/net/wireless/brcm80211/brcmfmac/{wl_cfg80211.h => cfg80211.h} 
(98%)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/Makefile 
b/drivers/net/wireless/brcm80211/brcmfmac/Makefile
index f6e35c9..35b680550 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/Makefile
+++ b/drivers/net/wireless/brcm80211/brcmfmac/Makefile
@@ -23,7 +23,7 @@ ccflags-y += -D__CHECK_ENDIAN__
 
 obj-$(CONFIG_BRCMFMAC) += brcmfmac.o
 brcmfmac-objs += \
-   wl_cfg80211.o \
+   cfg80211.o \
chip.o \
fwil.o \
fweh.o \
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c 
b/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
index a2f7e2c..e324414 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
@@ -26,7 +26,7 @@
 #include "fwil_types.h"
 #include "btcoex.h"
 #include "p2p.h"
-#include "wl_cfg80211.h"
+#include "cfg80211.h"
 
 /* T1 start SCO/eSCO priority suppression */
 #define BRCMF_BTCOEX_OPPR_WIN_TIME   2000
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c 
b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
similarity index 99%
rename from drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
rename to drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
index 2560dff..0390e57 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
@@ -32,7 +32,7 @@
 #include "fwil_types.h"
 #include "p2p.h"
 #include "btcoex.h"
-#include "wl_cfg80211.h"
+#include "cfg80211.h"
 #include "feature.h"
 #include "fwil.h"
 #include "proto.h"
@@ -5657,7 +5657,8 @@ enum nl80211_iftype brcmf_cfg80211_get_iftype(struct 
brcmf_if *ifp)
return wdev->iftype;
 }
 
-bool brcmf_get_vif_state_any(struct brcmf_cfg80211_info *cfg, unsigned long 
state)
+bool brcmf_get_vif_state_any(struct brcmf_cfg80211_info *cfg,
+unsigned long state)
 {
struct brcmf_cfg80211_vif *vif;
 
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h 
b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
similarity index 98%
rename from drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h
rename to drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
index 6abf94e..2a5b22c 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
@@ -14,8 +14,8 @@
  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#ifndef _wl_cfg80211_h_
-#define _wl_cfg80211_h_
+#ifndef BRCMFMAC_CFG80211_H
+#define BRCMFMAC_CFG80211_H
 
 /* for brcmu_d11inf */
 #include 
@@ -480,7 +480,8 @@ const struct brcmf_tlv *
 brcmf_parse_tlvs(const void *buf, int buflen, uint key);
 u16 channel_to_chanspec(struct brcmu_d11inf *d11inf,
struct ieee80211_channel *ch);
-bool brcmf_get_vif_state_any(struct brcmf_cfg80211_info *cfg, unsigned long 
state);
+bool brcmf_get_vif_state_any(struct brcmf_cfg80211_info *cfg,
+unsigned long state);
 void brcmf_cfg80211_arm_vif_event(struct brcmf_cfg80211_info *cfg,
  struct brcmf_cfg80211_vif *vif);
 bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg);
@@ -493,4 +494,4 @@ void brcmf_set_mpc(struct brcmf_if *ndev, int mpc);
 void brcmf_abort_scanning(struct brcmf_cfg80211_info *cfg);
 void brcmf_cfg80211_free_netdev(struct net_device *ndev);
 
-#endif /* _wl_cfg80211_h_ */
+#endif /* BRCMFMAC_CFG80211_H */
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c 
b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
index 8dbf2c1..53650b9 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
@@ -27,7 +27,7 @@
 #include "debug.h"
 #include "fwil_types.h"
 #include "p2p.h"
-#include "wl_cfg80211.h"
+#include "cfg80211.h"
 #include "fwil.h"
 #include "fwsignal.h"
 #include "feature.h"
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c

[PATCH 12/16] brcmfmac: (clean) Rename dhd_common.c in common.c

2014-10-28 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/brcm80211/brcmfmac/Makefile   | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/{dhd_common.c => common.c} | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
 rename drivers/net/wireless/brcm80211/brcmfmac/{dhd_common.c => common.c} (99%)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/Makefile 
b/drivers/net/wireless/brcm80211/brcmfmac/Makefile
index 1da9042..f6e35c9 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/Makefile
+++ b/drivers/net/wireless/brcm80211/brcmfmac/Makefile
@@ -30,7 +30,7 @@ brcmfmac-objs += \
fwsignal.o \
p2p.o \
proto.o \
-   dhd_common.o \
+   common.o \
dhd_linux.o \
firmware.o \
feature.o \
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c 
b/drivers/net/wireless/brcm80211/brcmfmac/common.c
similarity index 99%
rename from drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
rename to drivers/net/wireless/brcm80211/brcmfmac/common.c
index 7723994..75642e4 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/common.c
@@ -52,9 +52,9 @@ bool brcmf_c_prec_enq(struct device *dev, struct pktq *q,
}
 
/* Determine precedence from which to evict packet, if any */
-   if (pktq_pfull(q, prec))
+   if (pktq_pfull(q, prec)) {
eprec = prec;
-   else if (pktq_full(q)) {
+   } else if (pktq_full(q)) {
p = brcmu_pktq_peek_tail(q, &eprec);
if (eprec > prec)
return false;
-- 
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 v2 11/13] ath5k: revert AHB bus support removing

2014-10-28 Thread John W. Linville
On Tue, Oct 28, 2014 at 11:08:04AM +0400, Sergey Ryazanov wrote:
> 2014-10-27 21:04 GMT+03:00 John W. Linville :
> > On Wed, Oct 22, 2014 at 03:03:49AM +0400, Sergey Ryazanov wrote:
> >> This reverts commit 093ec3c5337434f40d77c1af06c139da3e5ba6dc.
> >>
> >> AHB bus code has been removed, since we did not have support Atheros
> >> AR231x SoC, required for building the AHB version of ath5k. Now that
> >> support WiSoC chips added we can restore functionality back.
> >>
> >> Singed-off-by: Sergey Ryazanov 
> >> Cc: Jiri Slaby 
> >> Cc: Nick Kossifidis 
> >> Cc: "Luis R. Rodriguez" 
> >> Cc: linux-wireless@vger.kernel.org
> >> Cc: ath5k-de...@lists.ath5k.org
> >
> > Acked-by: John W. Linville 
> >
> John, should I include these two patches in v3 or you already merge
> them in your tree?

I was intending to indicate to Ralf that I'm OK with him merging them
as part of the larger series in his tree.  I have not merged them.

John
-- 
John W. LinvilleSomeday the world will need a hero, and you
linvi...@tuxdriver.com  might be all we have.  Be ready.
--
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 10/16] brcmfmac: (clean) Rename files dhd_dbg to debug

2014-10-28 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/brcm80211/brcmfmac/Makefile   | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/bcdc.c | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c   | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/btcoex.c   | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/chip.c | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/{dhd_dbg.c => debug.c} | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/{dhd_dbg.h => debug.h} | 6 +++---
 drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h  | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c   | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c| 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/feature.c  | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/firmware.c | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/flowring.c | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/fweh.c | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/fwil.c | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c   | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/of.c   | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/p2p.c  | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/pcie.c | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/proto.c| 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/usb.c  | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/vendor.c   | 2 +-
 drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c  | 2 +-
 25 files changed, 27 insertions(+), 27 deletions(-)
 rename drivers/net/wireless/brcm80211/brcmfmac/{dhd_dbg.c => debug.c} (99%)
 rename drivers/net/wireless/brcm80211/brcmfmac/{dhd_dbg.h => debug.h} (98%)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/Makefile 
b/drivers/net/wireless/brcm80211/brcmfmac/Makefile
index 90a977f..1da9042 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/Makefile
+++ b/drivers/net/wireless/brcm80211/brcmfmac/Makefile
@@ -50,7 +50,7 @@ brcmfmac-$(CONFIG_BRCMFMAC_USB) += \
 brcmfmac-$(CONFIG_BRCMFMAC_PCIE) += \
pcie.o
 brcmfmac-$(CONFIG_BRCMDBG) += \
-   dhd_dbg.o
+   debug.o
 brcmfmac-$(CONFIG_BRCM_TRACING) += \
tracepoint.o
 brcmfmac-$(CONFIG_OF) += \
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c 
b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
index a159ff3..11d3dfa 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
@@ -28,7 +28,7 @@
 #include "dhd.h"
 #include "dhd_bus.h"
 #include "fwsignal.h"
-#include "dhd_dbg.h"
+#include "debug.h"
 #include "tracepoint.h"
 #include "proto.h"
 #include "bcdc.h"
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c 
b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
index 79b2c7e..8c0dfea 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
@@ -42,7 +42,7 @@
 #include 
 #include "chip.h"
 #include "dhd_bus.h"
-#include "dhd_dbg.h"
+#include "debug.h"
 #include "sdio_host.h"
 #include "of.h"
 
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c 
b/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
index a29ac49..a2f7e2c 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
@@ -21,7 +21,7 @@
 #include 
 #include 
 #include 
-#include 
+#include "debug.h"
 #include "fwil.h"
 #include "fwil_types.h"
 #include "btcoex.h"
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/chip.c 
b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
index 95efde8..ddae0b5 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
@@ -25,7 +25,7 @@
 #include 
 #include 
 #include 
-#include "dhd_dbg.h"
+#include "debug.h"
 #include "chip.h"
 
 /* SOC Interconnect types (aka chip types) */
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c 
b/drivers/net/wireless/brcm80211/brcmfmac/debug.c
similarity index 99%
rename from drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c
rename to drivers/net/wireless/brcm80211/brcmfmac/debug.c
index be9f4f8..27e5108 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.c
@@ -21,7 +21,7 @@
 #include 
 #include "dhd.h"
 #include "dhd_bus.h"
-#include "dhd_dbg.h"
+#include "debug.h"
 
 static struct dentry *root_folder;
 
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.h 
b/drivers/net/wireless/brcm80211/brcmfmac/deb

[PATCH 09/16] brcmfmac: (clean) Move tracepoint related function.

2014-10-28 Thread Arend van Spriel
From: Hante Meuleman 

__brcmf_err is a tracepoint specific function. Move it to
tracepoint.c.

Reviewed-by: Arend Van Spriel 
Reviewed-by: Pieter-Paul Giesberts 
Signed-off-by: Hante Meuleman 
Signed-off-by: Arend van Spriel 
---
 drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c | 15 ---
 drivers/net/wireless/brcm80211/brcmfmac/tracepoint.c | 16 
 2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c 
b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
index 6028fc4..98bc222 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
@@ -201,21 +201,6 @@ done:
return err;
 }
 
-#ifdef CONFIG_BRCM_TRACING
-void __brcmf_err(const char *func, const char *fmt, ...)
-{
-   struct va_format vaf = {
-   .fmt = fmt,
-   };
-   va_list args;
-
-   va_start(args, fmt);
-   vaf.va = &args;
-   pr_err("%s: %pV", func, &vaf);
-   trace_brcmf_err(func, &vaf);
-   va_end(args);
-}
-#endif
 #if defined(CONFIG_BRCM_TRACING) || defined(CONFIG_BRCMDBG)
 void __brcmf_dbg(u32 level, const char *func, const char *fmt, ...)
 {
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/tracepoint.c 
b/drivers/net/wireless/brcm80211/brcmfmac/tracepoint.c
index b505db4..b4cdccd 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/tracepoint.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/tracepoint.c
@@ -19,4 +19,20 @@
 #ifndef __CHECKER__
 #define CREATE_TRACE_POINTS
 #include "tracepoint.h"
+
+void __brcmf_err(const char *func, const char *fmt, ...)
+{
+   struct va_format vaf = {
+   .fmt = fmt,
+   };
+   va_list args;
+
+   va_start(args, fmt);
+   vaf.va = &args;
+   pr_err("%s: %pV", func, &vaf);
+   trace_brcmf_err(func, &vaf);
+   va_end(args);
+}
+
 #endif
+
-- 
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 07/16] brcmfmac: (clean) Remove usb_rdl.h as it is not needed.

2014-10-28 Thread Arend van Spriel
From: Hante Meuleman 

Reviewed-by: Arend Van Spriel 
Reviewed-by: Franky (Zhenhui) Lin 
Reviewed-by: Pieter-Paul Giesberts 
Reviewed-by: Daniel (Deognyoun) Kim 
Signed-off-by: Hante Meuleman 
Signed-off-by: Arend van Spriel 
---
 drivers/net/wireless/brcm80211/brcmfmac/usb.c | 88 ++-
 drivers/net/wireless/brcm80211/brcmfmac/usb_rdl.h | 75 ---
 2 files changed, 69 insertions(+), 94 deletions(-)
 delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/usb_rdl.h

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c 
b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
index e533000..3f12b60 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
@@ -27,9 +27,9 @@
 #include 
 
 #include "firmware.h"
-#include "usb_rdl.h"
 #include "usb.h"
 
+
 #define IOCTL_RESP_TIMEOUT 2000
 
 #define BRCMF_USB_RESET_GETVER_SPINWAIT100 /* in unit of ms */
@@ -49,6 +49,71 @@
 #define BRCMF_USB_43242_FW_NAME"brcm/brcmfmac43242a.bin"
 #define BRCMF_USB_43569_FW_NAME"brcm/brcmfmac43569.bin"
 
+#define TRX_MAGIC  0x30524448  /* "HDR0" */
+#define TRX_MAX_OFFSET 3   /* Max number of file offsets */
+#define TRX_UNCOMP_IMAGE   0x20/* Trx holds uncompressed img */
+#define TRX_RDL_CHUNK  1500/* size of each dl transfer */
+#define TRX_OFFSETS_DLFWLEN_IDX0
+
+/* Control messages: bRequest values */
+#define DL_GETSTATE0   /* returns the rdl_state_t struct */
+#define DL_CHECK_CRC   1   /* currently unused */
+#define DL_GO  2   /* execute downloaded image */
+#define DL_START   3   /* initialize dl state */
+#define DL_REBOOT  4   /* reboot the device in 2 seconds */
+#define DL_GETVER  5   /* returns the bootrom_id_t struct */
+#define DL_GO_PROTECTED6   /* execute the downloaded code and set 
reset
+* event to occur in 2 seconds.  It is the
+* responsibility of the downloaded code to
+* clear this event
+*/
+#define DL_EXEC7   /* jump to a supplied address */
+#define DL_RESETCFG8   /* To support single enum on dongle
+* - Not used by bootloader
+*/
+#define DL_DEFER_RESP_OK 9 /* Potentially defer the response to setup
+* if resp unavailable
+*/
+
+/* states */
+#define DL_WAITING 0   /* waiting to rx first pkt */
+#define DL_READY   1   /* hdr was good, waiting for more of the
+* compressed image
+*/
+#define DL_BAD_HDR 2   /* hdr was corrupted */
+#define DL_BAD_CRC 3   /* compressed image was corrupted */
+#define DL_RUNNABLE4   /* download was successful,waiting for go cmd */
+#define DL_START_FAIL  5   /* failed to initialize correctly */
+#define DL_NVRAM_TOOBIG6   /* host specified nvram data exceeds 
DL_NVRAM
+* value
+*/
+#define DL_IMAGE_TOOBIG7   /* firmware image too big */
+
+
+struct trx_header_le {
+   __le32 magic;   /* "HDR0" */
+   __le32 len; /* Length of file including header */
+   __le32 crc32;   /* CRC from flag_version to end of file */
+   __le32 flag_version;/* 0:15 flags, 16:31 version */
+   __le32 offsets[TRX_MAX_OFFSET]; /* Offsets of partitions from start of
+* header
+*/
+};
+
+struct rdl_state_le {
+   __le32 state;
+   __le32 bytes;
+};
+
+struct bootrom_id_le {
+   __le32 chip;/* Chip id */
+   __le32 chiprev; /* Chip rev */
+   __le32 ramsize; /* Size of  RAM */
+   __le32 remapbase;   /* Current remap base address */
+   __le32 boardtype;   /* Type of board */
+   __le32 boardrev;/* Board revision */
+};
+
 struct brcmf_usb_image {
struct list_head list;
s8 *fwname;
@@ -788,7 +853,7 @@ brcmf_usb_dl_writeimage(struct brcmf_usbdev_info *devinfo, 
u8 *fw, int fwlen)
 
brcmf_dbg(USB, "Enter, fw %p, len %d\n", fw, fwlen);
 
-   bulkchunk = kmalloc(RDL_CHUNK, GFP_ATOMIC);
+   bulkchunk = kmalloc(TRX_RDL_CHUNK, GFP_ATOMIC);
if (bulkchunk == NULL) {
err = -ENOMEM;
goto fail;
@@ -815,10 +880,10 @@ brcmf_usb_dl_writeimage(struct brcmf_usbdev_info 
*devinfo, u8 *fw, int fwlen)
/* Wait until the usb device reports it received all
 * the bytes we sent */
if ((rdlbytes == sent) && (rdlbytes != dllen)) {
-   

[PATCH 08/16] brcmfmac: (clean) Remove packet filter configuration.

2014-10-28 Thread Arend van Spriel
From: Hante Meuleman 

Packet filters got configured but never used.

Reviewed-by: Franky Lin 
Reviewed-by: Arend Van Spriel 
Reviewed-by: Pieter-Paul Giesberts 
Signed-off-by: Hante Meuleman 
Signed-off-by: Arend van Spriel 
---
 .../net/wireless/brcm80211/brcmfmac/dhd_common.c   | 166 -
 1 file changed, 166 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c 
b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
index d991f8e..6028fc4 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
@@ -26,11 +26,9 @@
 #include "fwil_types.h"
 #include "tracepoint.h"
 
-#define PKTFILTER_BUF_SIZE 128
 #define BRCMF_DEFAULT_BCN_TIMEOUT  3
 #define BRCMF_DEFAULT_SCAN_CHANNEL_TIME40
 #define BRCMF_DEFAULT_SCAN_UNASSOC_TIME40
-#define BRCMF_DEFAULT_PACKET_FILTER"100 0 0 0 0x01 0x00"
 
 /* boost value for RSSI_DELTA in preferred join selection */
 #define BRCMF_JOIN_PREF_RSSI_BOOST 8
@@ -86,165 +84,6 @@ bool brcmf_c_prec_enq(struct device *dev, struct pktq *q,
return p != NULL;
 }
 
-/* Convert user's input in hex pattern to byte-size mask */
-static int brcmf_c_pattern_atoh(char *src, char *dst)
-{
-   int i;
-   if (strncmp(src, "0x", 2) != 0 && strncmp(src, "0X", 2) != 0) {
-   brcmf_err("Mask invalid format. Needs to start with 0x\n");
-   return -EINVAL;
-   }
-   src = src + 2;  /* Skip past 0x */
-   if (strlen(src) % 2 != 0) {
-   brcmf_err("Mask invalid format. Length must be even.\n");
-   return -EINVAL;
-   }
-   for (i = 0; *src != '\0'; i++) {
-   unsigned long res;
-   char num[3];
-   strncpy(num, src, 2);
-   num[2] = '\0';
-   if (kstrtoul(num, 16, &res))
-   return -EINVAL;
-   dst[i] = (u8)res;
-   src += 2;
-   }
-   return i;
-}
-
-static void
-brcmf_c_pktfilter_offload_enable(struct brcmf_if *ifp, char *arg, int enable,
-int master_mode)
-{
-   unsigned long res;
-   char *argv;
-   char *arg_save = NULL, *arg_org = NULL;
-   s32 err;
-   struct brcmf_pkt_filter_enable_le enable_parm;
-
-   arg_save = kstrdup(arg, GFP_ATOMIC);
-   if (!arg_save)
-   goto fail;
-
-   arg_org = arg_save;
-
-   argv = strsep(&arg_save, " ");
-
-   if (argv == NULL) {
-   brcmf_err("No args provided\n");
-   goto fail;
-   }
-
-   /* Parse packet filter id. */
-   enable_parm.id = 0;
-   if (!kstrtoul(argv, 0, &res))
-   enable_parm.id = cpu_to_le32((u32)res);
-
-   /* Enable/disable the specified filter. */
-   enable_parm.enable = cpu_to_le32(enable);
-
-   err = brcmf_fil_iovar_data_set(ifp, "pkt_filter_enable", &enable_parm,
-  sizeof(enable_parm));
-   if (err)
-   brcmf_err("Set pkt_filter_enable error (%d)\n", err);
-
-   /* Control the master mode */
-   err = brcmf_fil_iovar_int_set(ifp, "pkt_filter_mode", master_mode);
-   if (err)
-   brcmf_err("Set pkt_filter_mode error (%d)\n", err);
-
-fail:
-   kfree(arg_org);
-}
-
-static void brcmf_c_pktfilter_offload_set(struct brcmf_if *ifp, char *arg)
-{
-   struct brcmf_pkt_filter_le *pkt_filter;
-   unsigned long res;
-   int buf_len;
-   s32 err;
-   u32 mask_size;
-   u32 pattern_size;
-   char *argv[8], *buf = NULL;
-   int i = 0;
-   char *arg_save = NULL, *arg_org = NULL;
-
-   arg_save = kstrdup(arg, GFP_ATOMIC);
-   if (!arg_save)
-   goto fail;
-
-   arg_org = arg_save;
-
-   buf = kmalloc(PKTFILTER_BUF_SIZE, GFP_ATOMIC);
-   if (!buf)
-   goto fail;
-
-   argv[i] = strsep(&arg_save, " ");
-   while (argv[i]) {
-   i++;
-   if (i >= 8) {
-   brcmf_err("Too many parameters\n");
-   goto fail;
-   }
-   argv[i] = strsep(&arg_save, " ");
-   }
-
-   if (i != 6) {
-   brcmf_err("Not enough args provided %d\n", i);
-   goto fail;
-   }
-
-   pkt_filter = (struct brcmf_pkt_filter_le *)buf;
-
-   /* Parse packet filter id. */
-   pkt_filter->id = 0;
-   if (!kstrtoul(argv[0], 0, &res))
-   pkt_filter->id = cpu_to_le32((u32)res);
-
-   /* Parse filter polarity. */
-   pkt_filter->negate_match = 0;
-   if (!kstrtoul(argv[1], 0, &res))
-   pkt_filter->negate_match = cpu_to_le32((u32)res);
-
-   /* Parse filter type. */
-   pkt_filter->type = 0;
-   if (!kstrtoul(argv[2], 0, &res))
-   pkt_filter->type = cpu_to_le32((u32)res);
-
-   /* Parse pattern filter offset. */
-   pkt_filter->u.pattern.off

[PATCH 06/16] brcmfmac: do not use firmware error code in driver

2014-10-28 Thread Arend van Spriel
Passing the firmware error codes up the driver may be mapped to
linux error numbers which may impact proper fault analysis. So
better pass up a generic failure code, ie. -EBADE and only show
firmware error code in FIL debug message.

Reviewed-by: Franky (Zhenhui) Lin 
Reviewed-by: Hante Meuleman 
Reviewed-by: Daniel (Deognyoun) Kim 
Reviewed-by: Pieter-Paul Giesberts 
Signed-off-by: Arend van Spriel 
---
 drivers/net/wireless/brcm80211/brcmfmac/fwil.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwil.c 
b/drivers/net/wireless/brcm80211/brcmfmac/fwil.c
index 42da73e..dccbdc1 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/fwil.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil.c
@@ -122,12 +122,11 @@ brcmf_fil_cmd_data(struct brcmf_if *ifp, u32 cmd, void 
*data, u32 len, bool set)
err = brcmf_proto_query_dcmd(drvr, ifp->ifidx, cmd, data, len);
 
if (err >= 0)
-   err = 0;
-   else
-   brcmf_dbg(FIL, "Failed: %s (%d)\n",
- brcmf_fil_get_errstr((u32)(-err)), err);
+   return 0;
 
-   return err;
+   brcmf_dbg(FIL, "Failed: %s (%d)\n",
+ brcmf_fil_get_errstr((u32)(-err)), err);
+   return -EBADE;
 }
 
 s32
-- 
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 05/16] brcmfmac: remove unused defintion

2014-10-28 Thread Arend van Spriel
The define EBRCMF_UNSUPPORTED is not used in the source file so this
patch removes it.

Reviewed-by: Franky (Zhenhui) Lin 
Reviewed-by: Hante Meuleman 
Reviewed-by: Daniel (Deognyoun) Kim 
Reviewed-by: Pieter-Paul Giesberts 
Signed-off-by: Arend van Spriel 
---
 drivers/net/wireless/brcm80211/brcmfmac/feature.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/feature.c 
b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
index aed53ac..4eb6a41 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
@@ -24,11 +24,6 @@
 #include "feature.h"
 
 /*
- * firmware error code received if iovar is unsupported.
- */
-#define EBRCMF_FEAT_UNSUPPORTED23
-
-/*
  * expand feature list to array of feature strings.
  */
 #define BRCMF_FEAT_DEF(_f) \
-- 
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 04/16] brcmfmac: show firmware error as string in debug message

2014-10-28 Thread Arend van Spriel
Showing the firmware error allows to quickly give a clue what
went wrong and directly look in the firmware code that gave us
back the error.

Reviewed-by: Franky (Zhenhui) Lin 
Reviewed-by: Hante Meuleman 
Reviewed-by: Daniel (Deognyoun) Kim 
Reviewed-by: Pieter-Paul Giesberts 
Signed-off-by: Arend van Spriel 
---
 drivers/net/wireless/brcm80211/brcmfmac/fwil.c | 73 +-
 1 file changed, 72 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwil.c 
b/drivers/net/wireless/brcm80211/brcmfmac/fwil.c
index ded328f..42da73e 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/fwil.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil.c
@@ -32,6 +32,76 @@
 
 #define MAX_HEX_DUMP_LEN   64
 
+#ifdef DEBUG
+static const char * const brcmf_fil_errstr[] = {
+   "BCME_OK",
+   "BCME_ERROR",
+   "BCME_BADARG",
+   "BCME_BADOPTION",
+   "BCME_NOTUP",
+   "BCME_NOTDOWN",
+   "BCME_NOTAP",
+   "BCME_NOTSTA",
+   "BCME_BADKEYIDX",
+   "BCME_RADIOOFF",
+   "BCME_NOTBANDLOCKED",
+   "BCME_NOCLK",
+   "BCME_BADRATESET",
+   "BCME_BADBAND",
+   "BCME_BUFTOOSHORT",
+   "BCME_BUFTOOLONG",
+   "BCME_BUSY",
+   "BCME_NOTASSOCIATED",
+   "BCME_BADSSIDLEN",
+   "BCME_OUTOFRANGECHAN",
+   "BCME_BADCHAN",
+   "BCME_BADADDR",
+   "BCME_NORESOURCE",
+   "BCME_UNSUPPORTED",
+   "BCME_BADLEN",
+   "BCME_NOTREADY",
+   "BCME_EPERM",
+   "BCME_NOMEM",
+   "BCME_ASSOCIATED",
+   "BCME_RANGE",
+   "BCME_NOTFOUND",
+   "BCME_WME_NOT_ENABLED",
+   "BCME_TSPEC_NOTFOUND",
+   "BCME_ACM_NOTSUPPORTED",
+   "BCME_NOT_WME_ASSOCIATION",
+   "BCME_SDIO_ERROR",
+   "BCME_DONGLE_DOWN",
+   "BCME_VERSION",
+   "BCME_TXFAIL",
+   "BCME_RXFAIL",
+   "BCME_NODEVICE",
+   "BCME_NMODE_DISABLED",
+   "BCME_NONRESIDENT",
+   "BCME_SCANREJECT",
+   "BCME_USAGE_ERROR",
+   "BCME_IOCTL_ERROR",
+   "BCME_SERIAL_PORT_ERR",
+   "BCME_DISABLED",
+   "BCME_DECERR",
+   "BCME_ENCERR",
+   "BCME_MICERR",
+   "BCME_REPLAY",
+   "BCME_IE_NOTFOUND",
+};
+
+static const char *brcmf_fil_get_errstr(u32 err)
+{
+   if (err >= ARRAY_SIZE(brcmf_fil_errstr))
+   return "(unknown)";
+
+   return brcmf_fil_errstr[err];
+}
+#else
+static const char *brcmf_fil_get_errstr(u32 err)
+{
+   return "";
+}
+#endif /* DEBUG */
 
 static s32
 brcmf_fil_cmd_data(struct brcmf_if *ifp, u32 cmd, void *data, u32 len, bool 
set)
@@ -54,7 +124,8 @@ brcmf_fil_cmd_data(struct brcmf_if *ifp, u32 cmd, void 
*data, u32 len, bool set)
if (err >= 0)
err = 0;
else
-   brcmf_dbg(FIL, "Failed err=%d\n", err);
+   brcmf_dbg(FIL, "Failed: %s (%d)\n",
+ brcmf_fil_get_errstr((u32)(-err)), err);
 
return err;
 }
-- 
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 03/16] brcmfmac: Add wowl patterns support.

2014-10-28 Thread Arend van Spriel
From: Hante Meuleman 

Reviewed-by: Arend Van Spriel 
Reviewed-by: Franky (Zhenhui) Lin 
Reviewed-by: Pieter-Paul Giesberts 
Reviewed-by: Daniel (Deognyoun) Kim 
Signed-off-by: Hante Meuleman 
Signed-off-by: Arend van Spriel 
---
 .../net/wireless/brcm80211/brcmfmac/fwil_types.h   | 89 +++---
 .../net/wireless/brcm80211/brcmfmac/wl_cfg80211.c  | 66 ++--
 2 files changed, 120 insertions(+), 35 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h 
b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
index 5ff5cd0..ba64b29 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
@@ -55,59 +55,63 @@
 
 /* WOWL bits */
 /* Wakeup on Magic packet: */
-#define WL_WOWL_MAGIC  (1 << 0)
+#define BRCMF_WOWL_MAGIC   (1 << 0)
 /* Wakeup on Netpattern */
-#define WL_WOWL_NET(1 << 1)
+#define BRCMF_WOWL_NET (1 << 1)
 /* Wakeup on loss-of-link due to Disassoc/Deauth: */
-#define WL_WOWL_DIS(1 << 2)
+#define BRCMF_WOWL_DIS (1 << 2)
 /* Wakeup on retrograde TSF: */
-#define WL_WOWL_RETR   (1 << 3)
+#define BRCMF_WOWL_RETR(1 << 3)
 /* Wakeup on loss of beacon: */
-#define WL_WOWL_BCN(1 << 4)
+#define BRCMF_WOWL_BCN (1 << 4)
 /* Wakeup after test: */
-#define WL_WOWL_TST(1 << 5)
+#define BRCMF_WOWL_TST (1 << 5)
 /* Wakeup after PTK refresh: */
-#define WL_WOWL_M1 (1 << 6)
+#define BRCMF_WOWL_M1  (1 << 6)
 /* Wakeup after receipt of EAP-Identity Req: */
-#define WL_WOWL_EAPID  (1 << 7)
+#define BRCMF_WOWL_EAPID   (1 << 7)
 /* Wakeind via PME(0) or GPIO(1): */
-#define WL_WOWL_PME_GPIO   (1 << 8)
+#define BRCMF_WOWL_PME_GPIO(1 << 8)
 /* need tkip phase 1 key to be updated by the driver: */
-#define WL_WOWL_NEEDTKIP1  (1 << 9)
+#define BRCMF_WOWL_NEEDTKIP1   (1 << 9)
 /* enable wakeup if GTK fails: */
-#define WL_WOWL_GTK_FAILURE(1 << 10)
+#define BRCMF_WOWL_GTK_FAILURE (1 << 10)
 /* support extended magic packets: */
-#define WL_WOWL_EXTMAGPAT  (1 << 11)
+#define BRCMF_WOWL_EXTMAGPAT   (1 << 11)
 /* support ARP/NS/keepalive offloading: */
-#define WL_WOWL_ARPOFFLOAD (1 << 12)
+#define BRCMF_WOWL_ARPOFFLOAD  (1 << 12)
 /* read protocol version for EAPOL frames: */
-#define WL_WOWL_WPA2   (1 << 13)
+#define BRCMF_WOWL_WPA2(1 << 13)
 /* If the bit is set, use key rotaton: */
-#define WL_WOWL_KEYROT (1 << 14)
+#define BRCMF_WOWL_KEYROT  (1 << 14)
 /* If the bit is set, frm received was bcast frame: */
-#define WL_WOWL_BCAST  (1 << 15)
+#define BRCMF_WOWL_BCAST   (1 << 15)
 /* If the bit is set, scan offload is enabled: */
-#define WL_WOWL_SCANOL (1 << 16)
+#define BRCMF_WOWL_SCANOL  (1 << 16)
 /* Wakeup on tcpkeep alive timeout: */
-#define WL_WOWL_TCPKEEP_TIME   (1 << 17)
+#define BRCMF_WOWL_TCPKEEP_TIME(1 << 17)
 /* Wakeup on mDNS Conflict Resolution: */
-#define WL_WOWL_MDNS_CONFLICT  (1 << 18)
+#define BRCMF_WOWL_MDNS_CONFLICT   (1 << 18)
 /* Wakeup on mDNS Service Connect: */
-#define WL_WOWL_MDNS_SERVICE   (1 << 19)
+#define BRCMF_WOWL_MDNS_SERVICE(1 << 19)
 /* tcp keepalive got data: */
-#define WL_WOWL_TCPKEEP_DATA   (1 << 20)
+#define BRCMF_WOWL_TCPKEEP_DATA(1 << 20)
 /* Firmware died in wowl mode: */
-#define WL_WOWL_FW_HALT(1 << 21)
+#define BRCMF_WOWL_FW_HALT (1 << 21)
 /* Enable detection of radio button changes: */
-#define WL_WOWL_ENAB_HWRADIO   (1 << 22)
+#define BRCMF_WOWL_ENAB_HWRADIO(1 << 22)
 /* Offloads detected MIC failure(s): */
-#define WL_WOWL_MIC_FAIL   (1 << 23)
+#define BRCMF_WOWL_MIC_FAIL(1 << 23)
 /* Wakeup in Unassociated state (Net/Magic Pattern): */
-#define WL_WOWL_UNASSOC(1 << 24)
+#define BRCMF_WOWL_UNASSOC (1 << 24)
 /* Wakeup if received matched secured pattern: */
-#define WL_WOWL_SECURE (1 << 25)
+#define BRCMF_WOWL_SECURE  (1 << 25)
 /* Link Down indication in WoWL mode: */
-#define WL_WOWL_LINKDOWN   (1 << 31)
+#define BRCMF_WOWL_LINKDOWN(1 << 31)
+
+#define BRCMF_WOWL_MAXPATTERNS 8
+#define BRCMF_WOWL_MAXPATTERNSIZE  128
+
 
 /* join preference types for join_pref iovar */
 enum brcmf_join_pref_types {
@@ -124,6 +128,12 @@ enum brcmf_fil_p2p_if_types {
BRCMF_FIL_P2P_IF_DEV,
 };
 
+enum brcmf_wowl_pattern_type {
+   BRCMF_WOWL_PATTERN_TYPE_BITMAP = 0,
+   BRCMF_WOWL_PATTERN_TYPE_ARP,
+   BRC

[PATCH 02/16] brcmfmac: Add wowl support for SDIO devices.

2014-10-28 Thread Arend van Spriel
From: Hante Meuleman 

This patch adds wowl support for SDIO bus devices. This feature
requires FW which has support for wowl built in.

Reviewed-by: Arend Van Spriel 
Reviewed-by: Franky (Zhenhui) Lin 
Reviewed-by: Pieter-Paul Giesberts 
Signed-off-by: Hante Meuleman 
Signed-off-by: Arend van Spriel 
---
 drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c   | 45 +++---
 drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c |  1 +
 .../net/wireless/brcm80211/brcmfmac/sdio_host.h|  2 +
 3 files changed, 34 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c 
b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
index 8dbd5db..79b2c7e 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
@@ -1064,6 +1064,16 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,
if (!sdiodev->pdata)
brcmf_of_probe(sdiodev);
 
+#ifdef CONFIG_PM_SLEEP
+   /* wowl can be supported when KEEP_POWER is true and (WAKE_SDIO_IRQ
+* is true or when platform data OOB irq is true).
+*/
+   if ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_KEEP_POWER) &&
+   ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_WAKE_SDIO_IRQ) ||
+(sdiodev->pdata->oob_irq_supported)))
+   bus_if->wowl_supported = true;
+#endif
+
atomic_set(&sdiodev->suspend, false);
init_waitqueue_head(&sdiodev->request_word_wait);
init_waitqueue_head(&sdiodev->request_buffer_wait);
@@ -1116,34 +1126,39 @@ static void brcmf_ops_sdio_remove(struct sdio_func 
*func)
brcmf_dbg(SDIO, "Exit\n");
 }
 
+void brcmf_sdio_wowl_config(struct device *dev, bool enabled)
+{
+   struct brcmf_bus *bus_if = dev_get_drvdata(dev);
+   struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
+
+   brcmf_dbg(SDIO, "Configuring WOWL, enabled=%d\n", enabled);
+   sdiodev->wowl_enabled = enabled;
+}
+
 #ifdef CONFIG_PM_SLEEP
 static int brcmf_ops_sdio_suspend(struct device *dev)
 {
-   mmc_pm_flag_t sdio_flags;
struct brcmf_bus *bus_if = dev_get_drvdata(dev);
struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
-   int ret = 0;
+   mmc_pm_flag_t sdio_flags;
 
brcmf_dbg(SDIO, "Enter\n");
 
-   sdio_flags = sdio_get_host_pm_caps(sdiodev->func[1]);
-   if (!(sdio_flags & MMC_PM_KEEP_POWER)) {
-   brcmf_err("Host can't keep power while suspended\n");
-   return -EINVAL;
-   }
-
atomic_set(&sdiodev->suspend, true);
 
-   ret = sdio_set_host_pm_flags(sdiodev->func[1], MMC_PM_KEEP_POWER);
-   if (ret) {
-   brcmf_err("Failed to set pm_flags\n");
-   atomic_set(&sdiodev->suspend, false);
-   return ret;
+   if (sdiodev->wowl_enabled) {
+   sdio_flags = MMC_PM_KEEP_POWER;
+   if (sdiodev->pdata->oob_irq_supported)
+   enable_irq_wake(sdiodev->pdata->oob_irq_nr);
+   else
+   sdio_flags = MMC_PM_WAKE_SDIO_IRQ;
+   if (sdio_set_host_pm_flags(sdiodev->func[1], sdio_flags))
+   brcmf_err("Failed to set pm_flags %x\n", sdio_flags);
}
 
brcmf_sdio_wd_timer(sdiodev->bus, 0);
 
-   return ret;
+   return 0;
 }
 
 static int brcmf_ops_sdio_resume(struct device *dev)
@@ -1152,6 +1167,8 @@ static int brcmf_ops_sdio_resume(struct device *dev)
struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
 
brcmf_dbg(SDIO, "Enter\n");
+   if (sdiodev->pdata->oob_irq_supported)
+   disable_irq_wake(sdiodev->pdata->oob_irq_nr);
brcmf_sdio_wd_timer(sdiodev->bus, BRCMF_WD_POLL_MS);
atomic_set(&sdiodev->suspend, false);
return 0;
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c 
b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
index f55f625..079187c 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
@@ -3949,6 +3949,7 @@ static struct brcmf_bus_ops brcmf_sdio_bus_ops = {
.txctl = brcmf_sdio_bus_txctl,
.rxctl = brcmf_sdio_bus_rxctl,
.gettxq = brcmf_sdio_bus_gettxq,
+   .wowl_config = brcmf_sdio_wowl_config
 };
 
 static void brcmf_sdio_firmware_callback(struct device *dev,
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h 
b/drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h
index f2d06ca..262aedf 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h
@@ -186,6 +186,7 @@ struct brcmf_sdio_dev {
struct sg_table sgtable;
char fw_name[BRCMF_FW_PATH_LEN + BRCMF_FW_NAME_LEN];
char nvram_name[BRCMF_FW_PATH_LEN + BRCMF_FW_NAME_LEN];
+   bool wowl_enabled;
 };
 
 /* sdio core registers */
@@ -334,5 +335,6 @@ void brcmf_sdio_remove(struct brcmf_sdio *bus);
 

[PATCH 01/16] brcmfmac: Add wowl support for USB devices.

2014-10-28 Thread Arend van Spriel
From: Hante Meuleman 

This patch adds wowl support for USB bus devices. This feature
requires FW which has support for wowl built in.

Reviewed-by: Arend Van Spriel 
Reviewed-by: Franky (Zhenhui) Lin 
Reviewed-by: Pieter-Paul Giesberts 
Reviewed-by: Daniel (Deognyoun) Kim 
Signed-off-by: Hante Meuleman 
Signed-off-by: Arend van Spriel 
---
 drivers/net/wireless/brcm80211/brcmfmac/usb.c | 49 +--
 1 file changed, 39 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c 
b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
index dc13591..e533000 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
@@ -93,6 +93,8 @@ struct brcmf_usbdev_info {
u8 ifnum;
 
struct urb *bulk_urb; /* used for FW download */
+
+   bool wowl_enabled;
 };
 
 static void brcmf_usb_rx_refill(struct brcmf_usbdev_info *devinfo,
@@ -600,6 +602,16 @@ static int brcmf_usb_up(struct device *dev)
return 0;
 }
 
+static void brcmf_cancel_all_urbs(struct brcmf_usbdev_info *devinfo)
+{
+   if (devinfo->ctl_urb)
+   usb_kill_urb(devinfo->ctl_urb);
+   if (devinfo->bulk_urb)
+   usb_kill_urb(devinfo->bulk_urb);
+   brcmf_usb_free_q(&devinfo->tx_postq, true);
+   brcmf_usb_free_q(&devinfo->rx_postq, true);
+}
+
 static void brcmf_usb_down(struct device *dev)
 {
struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(dev);
@@ -613,14 +625,7 @@ static void brcmf_usb_down(struct device *dev)
 
brcmf_usb_state_change(devinfo, BRCMFMAC_USB_STATE_DOWN);
 
-   if (devinfo->ctl_urb)
-   usb_kill_urb(devinfo->ctl_urb);
-
-   if (devinfo->bulk_urb)
-   usb_kill_urb(devinfo->bulk_urb);
-   brcmf_usb_free_q(&devinfo->tx_postq, true);
-
-   brcmf_usb_free_q(&devinfo->rx_postq, true);
+   brcmf_cancel_all_urbs(devinfo);
 }
 
 static void
@@ -1094,11 +1099,24 @@ error:
return NULL;
 }
 
+static void brcmf_usb_wowl_config(struct device *dev, bool enabled)
+{
+   struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(dev);
+
+   brcmf_dbg(USB, "Configuring WOWL, enabled=%d\n", enabled);
+   devinfo->wowl_enabled = enabled;
+   if (enabled)
+   device_set_wakeup_enable(devinfo->dev, true);
+   else
+   device_set_wakeup_enable(devinfo->dev, false);
+}
+
 static struct brcmf_bus_ops brcmf_usb_bus_ops = {
.txdata = brcmf_usb_tx,
.stop = brcmf_usb_down,
.txctl = brcmf_usb_tx_ctlpkt,
.rxctl = brcmf_usb_rx_ctlpkt,
+   .wowl_config = brcmf_usb_wowl_config,
 };
 
 static int brcmf_usb_bus_setup(struct brcmf_usbdev_info *devinfo)
@@ -1186,6 +1204,9 @@ static int brcmf_usb_probe_cb(struct brcmf_usbdev_info 
*devinfo)
bus->ops = &brcmf_usb_bus_ops;
bus->proto_type = BRCMF_PROTO_BCDC;
bus->always_use_fws_queue = true;
+#ifdef CONFIG_PM
+   bus->wowl_supported = true;
+#endif
 
if (!brcmf_usb_dlneeded(devinfo)) {
ret = brcmf_usb_bus_setup(devinfo);
@@ -1339,7 +1360,10 @@ static int brcmf_usb_suspend(struct usb_interface *intf, 
pm_message_t state)
 
brcmf_dbg(USB, "Enter\n");
devinfo->bus_pub.state = BRCMFMAC_USB_STATE_SLEEP;
-   brcmf_detach(&usb->dev);
+   if (devinfo->wowl_enabled)
+   brcmf_cancel_all_urbs(devinfo);
+   else
+   brcmf_detach(&usb->dev);
return 0;
 }
 
@@ -1352,7 +1376,12 @@ static int brcmf_usb_resume(struct usb_interface *intf)
struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(&usb->dev);
 
brcmf_dbg(USB, "Enter\n");
-   return brcmf_usb_bus_setup(devinfo);
+   if (!devinfo->wowl_enabled)
+   return brcmf_usb_bus_setup(devinfo);
+
+   devinfo->bus_pub.state = BRCMFMAC_USB_STATE_UP;
+   brcmf_usb_rx_fill_all(devinfo);
+   return 0;
 }
 
 static int brcmf_usb_reset_resume(struct usb_interface *intf)
-- 
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 00/16] brcmfmac: wowl support and cleanup

2014-10-28 Thread Arend van Spriel
This series has a couple of wowl patches that were too late to make
the 3.18 merge window. Apart from those there are a number of rename
and rework patches that get rid of the terms dhd and wl.

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

Arend van Spriel (3):
  brcmfmac: show firmware error as string in debug message
  brcmfmac: remove unused defintion
  brcmfmac: do not use firmware error code in driver

Hante Meuleman (13):
  brcmfmac: Add wowl support for USB devices.
  brcmfmac: Add wowl support for SDIO devices.
  brcmfmac: Add wowl patterns support.
  brcmfmac: (clean) Remove usb_rdl.h as it is not needed.
  brcmfmac: (clean) Remove packet filter configuration.
  brcmfmac: (clean) Move tracepoint related function.
  brcmfmac: (clean) Rename files dhd_dbg to debug
  brcmfmac: (clean) Rename dhd_bus.h in bus.h
  brcmfmac: (clean) Rename dhd_common.c in common.c
  brcmfmac: (clean) Rename files wl_cfg80211 to cfg80211
  brcmfmac: (clean) Rename sdio related files.
  brcmfmac: (clean) Rename sdio related files.
  brcmfmac: (clean) Move sdio related function.

 drivers/net/wireless/brcm80211/brcmfmac/Makefile   |  10 +-
 drivers/net/wireless/brcm80211/brcmfmac/bcdc.c |   6 +-
 drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c   |  51 ++-
 drivers/net/wireless/brcm80211/brcmfmac/btcoex.c   |   6 +-
 .../brcm80211/brcmfmac/{dhd_bus.h => bus.h}|  11 +-
 .../brcmfmac/{wl_cfg80211.c => cfg80211.c} |  77 +++-
 .../brcmfmac/{wl_cfg80211.h => cfg80211.h} |   9 +-
 drivers/net/wireless/brcm80211/brcmfmac/chip.c |   2 +-
 drivers/net/wireless/brcm80211/brcmfmac/common.c   | 168 +
 .../net/wireless/brcm80211/brcmfmac/commonring.c   |   2 +-
 .../brcm80211/brcmfmac/{dhd_linux.c => core.c} |   8 +-
 .../wireless/brcm80211/brcmfmac/{dhd.h => core.h}  |   7 +-
 .../brcm80211/brcmfmac/{dhd_dbg.c => debug.c}  |   6 +-
 .../brcm80211/brcmfmac/{dhd_dbg.h => debug.h}  |   6 +-
 .../net/wireless/brcm80211/brcmfmac/dhd_common.c   | 400 -
 drivers/net/wireless/brcm80211/brcmfmac/feature.c  |  11 +-
 drivers/net/wireless/brcm80211/brcmfmac/firmware.c |   2 +-
 drivers/net/wireless/brcm80211/brcmfmac/flowring.c |   6 +-
 drivers/net/wireless/brcm80211/brcmfmac/fweh.c |   4 +-
 drivers/net/wireless/brcm80211/brcmfmac/fwil.c |  84 -
 .../net/wireless/brcm80211/brcmfmac/fwil_types.h   |  89 +++--
 drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c |   8 +-
 drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c   |   6 +-
 drivers/net/wireless/brcm80211/brcmfmac/of.c   |   4 +-
 drivers/net/wireless/brcm80211/brcmfmac/p2p.c  |   6 +-
 drivers/net/wireless/brcm80211/brcmfmac/pcie.c |   4 +-
 drivers/net/wireless/brcm80211/brcmfmac/proto.c|   6 +-
 .../brcm80211/brcmfmac/{dhd_sdio.c => sdio.c}  |  55 ++-
 .../brcm80211/brcmfmac/{sdio_host.h => sdio.h} |   8 +-
 .../net/wireless/brcm80211/brcmfmac/tracepoint.c   |  16 +
 drivers/net/wireless/brcm80211/brcmfmac/usb.c  | 142 ++--
 drivers/net/wireless/brcm80211/brcmfmac/usb_rdl.h  |  75 
 drivers/net/wireless/brcm80211/brcmfmac/vendor.c   |   6 +-
 33 files changed, 650 insertions(+), 651 deletions(-)
 rename drivers/net/wireless/brcm80211/brcmfmac/{dhd_bus.h => bus.h} (98%)
 rename drivers/net/wireless/brcm80211/brcmfmac/{wl_cfg80211.c => cfg80211.c} 
(98%)
 rename drivers/net/wireless/brcm80211/brcmfmac/{wl_cfg80211.h => cfg80211.h} 
(98%)
 create mode 100644 drivers/net/wireless/brcm80211/brcmfmac/common.c
 rename drivers/net/wireless/brcm80211/brcmfmac/{dhd_linux.c => core.c} (99%)
 rename drivers/net/wireless/brcm80211/brcmfmac/{dhd.h => core.h} (98%)
 rename drivers/net/wireless/brcm80211/brcmfmac/{dhd_dbg.c => debug.c} (98%)
 rename drivers/net/wireless/brcm80211/brcmfmac/{dhd_dbg.h => debug.h} (98%)
 delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
 rename drivers/net/wireless/brcm80211/brcmfmac/{dhd_sdio.c => sdio.c} (98%)
 rename drivers/net/wireless/brcm80211/brcmfmac/{sdio_host.h => sdio.h} (98%)
 delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/usb_rdl.h

-- 
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 0/2] mac80211: fix HT+ to HT- (and vice-versa) CSA

2014-10-28 Thread Luca Coelho
(fixed Johannes' email address)

Both these bugs go far back, so IMHO they should go to 3.8 and stable.

1/2 goes back to 3.13
2/2 goes back to 2.6.30 (though the affected code changed somewhat
 since then)

--
Luca.

On Tue, 2014-10-28 at 13:33 +0200, Luca Coelho wrote:
> From: Luciano Coelho 
> 
> These two patches fix a bug that Jouni found when running his hostap
> hwsim test scripts (ap_ht40_csa).  The failure was caused by two
> different bugs which are fixed in this patchset.
> 
> The first bug was that we were not using the secondary channel offset
> IE of beacons for the switch, but the offset of the current channel,
> which cause us to use the same offset. 
> 
> The second bug was that we were trying to switch at the exact time of
> the switch on the station side, which, because of the processing time,
> was causing us to be too late.
> 
> Luciano Coelho (2):
>   mac80211: use secondary channel offset IE also beacons during CSA
>   mac80211: schedule the actual switch of the station before CSA count 0
> 
>  net/mac80211/ibss.c|  2 +-
>  net/mac80211/ieee80211_i.h |  3 +--
>  net/mac80211/mesh.c|  2 +-
>  net/mac80211/mlme.c|  5 +++--
>  net/mac80211/spectmgmt.c   | 18 ++
>  5 files changed, 12 insertions(+), 18 deletions(-)
> 


--
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: mwifiex_usb_submit_rx_urb: dev_alloc_skb failed when conected to 5GHz

2014-10-28 Thread Belisko Marek
Hi Amitkumar,

On Thu, Oct 23, 2014 at 2:40 PM, Amitkumar Karwar  wrote:
> Hi Marek,
>
>>> I tried to capture logs but when enable DYNAMIC_DEBUG I cannot
>>> reproduce issue (running test > 30 minutes without allocation
>>> failure).
>
> Thanks for the testing. Yes. Sometimes timing issues won't get reproduced 
> with debug messages enabled.
>
>>Any update on this? Should I provide some other logs?
>
> What's the size of Rx data packets? Is the Rx data AMSDU aggregated?(You can 
> check if "if (rx_pkt_type == PKT_TYPE_AMSDU)" check is passed in mwifiex 
> code) If so, disable AMSDU option in AP and try to reproduce the issue.
Size of Rx data packets are : pkt type == 2, size - 1574bytes + BAR
pkt type, size - 34bytes. AMSDU isn't enabled on AP (verified by
adding debug message in mwifiex_process_sta_rx_packet()).
>
> As you suspected earlier, we might have missed to free skbs allocated for Rx 
> data which leads to SKB allocation failure. There is very less probability 
> for this. But we can try below experiment.
>
> 1) I observed that debug variable "adapter->rx_pending" doesn;t get 
> decremented when packet is submitted to kernel. Add below code change(valid 
> only for AMSDU disabled case. Because multiple packets are submitted to 
> kernel when AMSDU is enabled)
>
> --
> --- a/drivers/net/wireless/mwifiex/util.c
> +++ b/drivers/net/wireless/mwifiex/util.c
> @@ -218,6 +218,7 @@ int mwifiex_recv_packet(struct mwifiex_private *priv, 
> struct sk_buff *skb)
>
> priv->stats.rx_bytes += skb->len;
> priv->stats.rx_packets++;
> +   atomic_dec(&priv->adapter->rx_pending);
> if (in_interrupt())
> netif_rx(skb);
> --
OK, patch applied.
>
> 2) Add BUG_ON when first time SKB allocation is failed and print 
> "rx_pending". If it's a huge number, we have missed freeing allocated SKB.
[  167.624452] usb 1-1: mwifiex_usb_submit_rx_urb: dev_alloc_skb
failed, rx_pending:26893
[  167.632885] [ cut here ]
[  167.637743] Kernel BUG at bf8a22ae [verbose debug info unavailable]
so number seems to be huge and we seems miss free allocated skb.

I did some hacks to code which shows how many packets are received
between 2 BAR packets + I print every 500ms rx_pending packets (when
packet is received) and
also when packet is send to kernel. I also update counter how many
packets after reordering are sent to kernel. Log:
[   71.973800] usb 1-1: rx_pending:11
[   72.077308] usb 1-1: rx_pending kernel:10
[   72.477546] usb 1-1: rx_pending:868
[   72.587877] usb 1-1: rx_pending kernel:1096
[   72.818041] usb 1-1: Received between 2 BAR:6275
[   72.823127] usb 1-1: Networking send size:6271
[   72.987375] usb 1-1: rx_pending:1940
[   73.097504] usb 1-1: rx_pending kernel:2159
[   73.431973] usb 1-1: Received between 2 BAR:1602
[   73.437106] usb 1-1: Networking send size:1608
[   73.497381] usb 1-1: rx_pending:2983
[   73.608315] usb 1-1: rx_pending kernel:3091
[   74.007379] usb 1-1: rx_pending:3767
[   74.117879] usb 1-1: rx_pending kernel:3998
[   74.517375] usb 1-1: rx_pending:4854
[   74.543168] usb 1-1: Received between 2 BAR:3152
[   74.548371] usb 1-1: Networking send size:3152
[   74.627509] usb 1-1: rx_pending kernel:5062
[   74.743362] usb 1-1: Received between 2 BAR:495
[   74.748483] usb 1-1: Networking send size:494
[   75.027523] usb 1-1: rx_pending:5872
[   75.137961] usb 1-1: rx_pending kernel:6106
[   75.537485] usb 1-1: rx_pending:6959
[   75.647934] usb 1-1: rx_pending kernel:7188
[   75.656273] usb 1-1: Received between 2 BAR:2383
[   75.661528] usb 1-1: Networking send size:2382
[   76.047441] usb 1-1: rx_pending:8004
[   76.157712] usb 1-1: rx_pending kernel:8240
[   76.557547] usb 1-1: rx_pending:9095
[   76.667991] usb 1-1: rx_pending kernel:9326
[   76.769662] usb 1-1: Received between 2 BAR:2918
[   76.775047] usb 1-1: Networking send size:2914
[   77.067491] usb 1-1: rx_pending:10155
[   77.177524] usb 1-1: rx_pending kernel:10383
[   77.577547] usb 1-1: rx_pending:11237
[   77.687859] usb 1-1: rx_pending kernel:11461
[   78.087401] usb 1-1: rx_pending:12304
[   78.197992] usb 1-1: rx_pending kernel:12539
[   78.597442] usb 1-1: rx_pending:13391
[   78.707786] usb 1-1: rx_pending kernel:13628
[   79.107487] usb 1-1: rx_pending:14469
[   79.217812] usb 1-1: rx_pending kernel:14704
[   79.617528] usb 1-1: rx_pending:1
[   79.727734] usb 1-1: rx_pending kernel:15781
[   80.127486] usb 1-1: rx_pending:16624
[   80.237756] usb 1-1: rx_pending kernel:16855
[   80.637423] usb 1-1: rx_pending:17699
[   80.747868] usb 1-1: rx_pending kernel:17926
[   81.147446] usb 1-1: rx_pending:18769
[   81.257800] usb 1-1: rx_pending kernel:18995
[   81.657399] usb 1-1: rx_pending:19851
[   81.767785] usb 1-1: rx_pending kernel:20083
[   82.167341] usb 1-1: rx_pending:20938
[   82.278005] usb 1-1: rx_pending kernel:21174
[   82.677527] usb 1-1: rx_pending:22025
[   82.787508] usb 1-1: rx_pending kernel:22246
[   83.187390] usb 1-1: rx_pending

[PATCH 2/3] ath: use seq_file api for ath9k debugfs files

2014-10-28 Thread Arend van Spriel
The debugfs files that are defined in debug.c which are read-only
and using a simple_open as .open file operation have been modified
to use the single_open seq_file API. This simplifies the read
functions defining the file contents.

Signed-off-by: Arend van Spriel 
---
 drivers/net/wireless/ath/ath9k/debug.c | 425 +
 drivers/net/wireless/ath/ath9k/debug.h |   3 +-
 2 files changed, 173 insertions(+), 255 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/debug.c 
b/drivers/net/wireless/ath/ath9k/debug.c
index 46f20a3..1d6bfda 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -401,22 +401,14 @@ static const struct file_operations 
fops_antenna_diversity = {
.llseek = default_llseek,
 };
 
-static ssize_t read_file_dma(struct file *file, char __user *user_buf,
-size_t count, loff_t *ppos)
+static int read_file_dma(struct seq_file *file, void *data)
 {
-   struct ath_softc *sc = file->private_data;
+   struct ath_softc *sc = file->private;
struct ath_hw *ah = sc->sc_ah;
-   char *buf;
-   int retval;
-   unsigned int len = 0;
u32 val[ATH9K_NUM_DMA_DEBUG_REGS];
int i, qcuOffset = 0, dcuOffset = 0;
u32 *qcuBase = &val[0], *dcuBase = &val[4];
 
-   buf = kmalloc(DMA_BUF_LEN, GFP_KERNEL);
-   if (!buf)
-   return -ENOMEM;
-
ath9k_ps_wakeup(sc);
 
REG_WRITE_D(ah, AR_MACMISC,
@@ -424,21 +416,18 @@ static ssize_t read_file_dma(struct file *file, char 
__user *user_buf,
   (AR_MACMISC_MISC_OBS_BUS_1 <<
AR_MACMISC_MISC_OBS_BUS_MSB_S)));
 
-   len += scnprintf(buf + len, DMA_BUF_LEN - len,
-"Raw DMA Debug values:\n");
+   seq_printf(file, "Raw DMA Debug values:\n");
 
for (i = 0; i < ATH9K_NUM_DMA_DEBUG_REGS; i++) {
if (i % 4 == 0)
-   len += scnprintf(buf + len, DMA_BUF_LEN - len, "\n");
+   seq_printf(file, "\n");
 
val[i] = REG_READ_D(ah, AR_DMADBG_0 + (i * sizeof(u32)));
-   len += scnprintf(buf + len, DMA_BUF_LEN - len, "%d: %08x ",
-i, val[i]);
+   seq_printf(file, "%d: %08x ", i, val[i]);
}
 
-   len += scnprintf(buf + len, DMA_BUF_LEN - len, "\n\n");
-   len += scnprintf(buf + len, DMA_BUF_LEN - len,
-"Num QCU: chain_st fsp_ok fsp_st DCU: chain_st\n");
+   seq_printf(file, "\n\n");
+   seq_printf(file, "Num QCU: chain_st fsp_ok fsp_st DCU: chain_st\n");
 
for (i = 0; i < ATH9K_NUM_QUEUES; i++, qcuOffset += 4, dcuOffset += 5) {
if (i == 8) {
@@ -451,55 +440,47 @@ static ssize_t read_file_dma(struct file *file, char 
__user *user_buf,
dcuBase++;
}
 
-   len += scnprintf(buf + len, DMA_BUF_LEN - len,
-"%2d  %2x  %1x %2x   %2x\n",
+   seq_printf(file, "%2d  %2x  %1x %2x   
%2x\n",
 i, (*qcuBase & (0x7 << qcuOffset)) >> qcuOffset,
 (*qcuBase & (0x8 << qcuOffset)) >> (qcuOffset + 3),
 val[2] & (0x7 << (i * 3)) >> (i * 3),
 (*dcuBase & (0x1f << dcuOffset)) >> dcuOffset);
}
 
-   len += scnprintf(buf + len, DMA_BUF_LEN - len, "\n");
+   seq_printf(file, "\n");
 
-   len += scnprintf(buf + len, DMA_BUF_LEN - len,
-   "qcu_stitch state:   %2xqcu_fetch state:%2x\n",
+   seq_printf(file, "qcu_stitch state:   %2xqcu_fetch state:
%2x\n",
(val[3] & 0x003c) >> 18, (val[3] & 0x03c0) >> 22);
-   len += scnprintf(buf + len, DMA_BUF_LEN - len,
-   "qcu_complete state: %2xdcu_complete state: %2x\n",
+   seq_printf(file, "qcu_complete state: %2xdcu_complete state: 
%2x\n",
(val[3] & 0x1c00) >> 26, (val[6] & 0x3));
-   len += scnprintf(buf + len, DMA_BUF_LEN - len,
-   "dcu_arb state:  %2xdcu_fp state:   %2x\n",
+   seq_printf(file, "dcu_arb state:  %2xdcu_fp state:   
%2x\n",
(val[5] & 0x0600) >> 25, (val[5] & 0x3800) >> 27);
-   len += scnprintf(buf + len, DMA_BUF_LEN - len,
-   "chan_idle_dur: %3dchan_idle_dur_valid: %1d\n",
+   seq_printf(file, "chan_idle_dur: %3dchan_idle_dur_valid: 
%1d\n",
(val[6] & 0x03fc) >> 2, (val[6] & 0x0400) >> 10);
-   len += scnprintf(buf + len, DMA_BUF_LEN - len,
-   "txfifo_valid_0:  %1dtxfifo_valid_1:  %1d\n",
+   seq_printf(file, "txfifo_valid_0:  %1dtxfifo_valid_1:  
%1d\n",
(val[6] & 0x0800) >> 11, (val[6] & 0x1000) >> 12);
-   len

[PATCH 3/3] ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries

2014-10-28 Thread Arend van Spriel
Use the helper to get rid of the file operations per debugfs file. The
struct ath9k_softc pointer is set as device driver data to be obtained
in the seq_file read operation.

Signed-off-by: Arend van Spriel 
---
 drivers/net/wireless/ath/ath9k/ahb.c   |   1 +
 drivers/net/wireless/ath/ath9k/debug.c | 122 ++---
 drivers/net/wireless/ath/ath9k/pci.c   |   1 +
 3 files changed, 24 insertions(+), 100 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ahb.c 
b/drivers/net/wireless/ath/ath9k/ahb.c
index 4173838..74b009b 100644
--- a/drivers/net/wireless/ath/ath9k/ahb.c
+++ b/drivers/net/wireless/ath/ath9k/ahb.c
@@ -126,6 +126,7 @@ static int ath_ahb_probe(struct platform_device *pdev)
sc = hw->priv;
sc->hw = hw;
sc->dev = &pdev->dev;
+   dev_set_drvdata(sc->dev, sc);
sc->mem = mem;
sc->irq = irq;
 
diff --git a/drivers/net/wireless/ath/ath9k/debug.c 
b/drivers/net/wireless/ath/ath9k/debug.c
index 1d6bfda..62d8a09 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -403,7 +403,7 @@ static const struct file_operations fops_antenna_diversity 
= {
 
 static int read_file_dma(struct seq_file *file, void *data)
 {
-   struct ath_softc *sc = file->private;
+   struct ath_softc *sc = dev_get_drvdata(file->private);
struct ath_hw *ah = sc->sc_ah;
u32 val[ATH9K_NUM_DMA_DEBUG_REGS];
int i, qcuOffset = 0, dcuOffset = 0;
@@ -470,20 +470,6 @@ static int read_file_dma(struct seq_file *file, void *data)
return 0;
 }
 
-static int open_file_dma(struct inode *inode, struct file *f)
-{
-   return single_open(f, read_file_dma, inode->i_private);
-}
-
-static const struct file_operations fops_dma = {
-   .open = open_file_dma,
-   .read = seq_read,
-   .owner = THIS_MODULE,
-   .llseek = seq_lseek,
-   .release = single_release,
-};
-
-
 void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status)
 {
if (status)
@@ -539,7 +525,7 @@ void ath_debug_stat_interrupt(struct ath_softc *sc, enum 
ath9k_int status)
 
 static int read_file_interrupt(struct seq_file *file, void *data)
 {
-   struct ath_softc *sc = file->private;
+   struct ath_softc *sc = dev_get_drvdata(file->private);
 
 #define PR_IS(a, s)\
do {\
@@ -600,22 +586,9 @@ static int read_file_interrupt(struct seq_file *file, void 
*data)
return 0;
 }
 
-static int open_file_interrupt(struct inode *inode, struct file *f)
-{
-   return single_open(f, read_file_interrupt, inode->i_private);
-}
-
-static const struct file_operations fops_interrupt = {
-   .read = seq_read,
-   .open = open_file_interrupt,
-   .owner = THIS_MODULE,
-   .llseek = seq_lseek,
-   .release = single_release,
-};
-
 static int read_file_xmit(struct seq_file *file, void *data)
 {
-   struct ath_softc *sc = file->private;
+   struct ath_softc *sc = dev_get_drvdata(file->private);
 
seq_printf(file, "%30s %10s%10s%10s\n\n", "BE", "BK", "VI", "VO");
 
@@ -661,7 +634,7 @@ static void print_queue(struct ath_softc *sc, struct 
ath_txq *txq,
 
 static int read_file_queues(struct seq_file *file, void *data)
 {
-   struct ath_softc *sc = file->private;
+   struct ath_softc *sc = dev_get_drvdata(file->private);
struct ath_txq *txq;
int i;
static const char *qname[4] = {
@@ -682,7 +655,7 @@ static int read_file_queues(struct seq_file *file, void 
*data)
 
 static int read_file_misc(struct seq_file *file, void *data)
 {
-   struct ath_softc *sc = file->private;
+   struct ath_softc *sc = dev_get_drvdata(file->private);
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ath9k_vif_iter_data iter_data;
struct ath_chanctx *ctx;
@@ -772,7 +745,7 @@ static int read_file_misc(struct seq_file *file, void *data)
 
 static int read_file_reset(struct seq_file *file, void *data)
 {
-   struct ath_softc *sc = file->private;
+   struct ath_softc *sc = dev_get_drvdata(file->private);
 
seq_printf(file, "%17s: %2d\n", "Baseband Hang",
   sc->debug.stats.reset[RESET_TYPE_BB_HANG]);
@@ -833,58 +806,6 @@ void ath_debug_stat_tx(struct ath_softc *sc, struct 
ath_buf *bf,
TX_STAT_INC(qnum, delim_underrun);
 }
 
-static int open_file_xmit(struct inode *inode, struct file *f)
-{
-   return single_open(f, read_file_xmit, inode->i_private);
-}
-
-static const struct file_operations fops_xmit = {
-   .read = seq_read,
-   .open = open_file_xmit,
-   .owner = THIS_MODULE,
-   .llseek = seq_lseek,
-   .release = single_release,
-};
-
-static int open_file_queues(struct inode *inode, struct file *f)
-{
-   return single_open(f, read_file_queues, inode->i_private);
-}
-
-static const struct file_operations fops_queues = {
-   .rea

[PATCH 1/3] debugfs: add helper function to create device related seq_file

2014-10-28 Thread Arend van Spriel
This patch adds a helper function that simplifies adding a
so-called single_open sequence file for device drivers. The
calling device driver needs to provide a read function and
a device pointer. The field struct seq_file::private will
reference the device pointer upon call to the read function
so the driver can obtain his data from it and do its task
of providing the file content using seq_printf() calls and
alike. Using this helper function also gets rid of the need
to specify file operations per debugfs file.

Signed-off-by: Arend van Spriel 
---
 fs/debugfs/file.c   | 54 +
 include/linux/debugfs.h | 16 ++-
 2 files changed, 69 insertions(+), 1 deletion(-)

diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index 76c08c2..088b3fc 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 
 static ssize_t default_read_file(struct file *file, char __user *buf,
 size_t count, loff_t *ppos)
@@ -761,3 +762,56 @@ struct dentry *debugfs_create_regset32(const char *name, 
umode_t mode,
 EXPORT_SYMBOL_GPL(debugfs_create_regset32);
 
 #endif /* CONFIG_HAS_IOMEM */
+
+struct debugfs_devm_entry {
+   int (*read)(struct seq_file *seq, void *data);
+   struct device *dev;
+};
+
+static int debugfs_devm_entry_open(struct inode *inode, struct file *f)
+{
+   struct debugfs_devm_entry *entry = inode->i_private;
+
+   return single_open(f, entry->read, entry->dev);
+}
+
+static const struct file_operations debugfs_devm_entry_ops = {
+   .owner = THIS_MODULE,
+   .open = debugfs_devm_entry_open,
+   .release = single_release,
+   .read = seq_read,
+   .llseek = seq_lseek
+};
+
+/**
+ * debugfs_create_devm_seqfile - create a debugfs file that is bound to device.
+ *
+ * @dev: device related to this debugfs file.
+ * @name: name of the debugfs file.
+ * @parent: a pointer to the parent dentry for this file.  This should be a
+ * directory dentry if set.  If this parameter is %NULL, then the
+ * file will be created in the root of the debugfs filesystem.
+ * @read_fn: function pointer called to print the seq_file content.
+ */
+struct dentry *debugfs_create_devm_seqfile(struct device *dev, const char 
*name,
+  struct dentry *parent,
+  int (*read_fn)(struct seq_file *s,
+ void *data))
+{
+   struct debugfs_devm_entry *entry;
+
+   if (IS_ERR(parent))
+   return ERR_PTR(-ENOENT);
+
+   entry = devm_kzalloc(dev, sizeof(*entry), GFP_KERNEL);
+   if (!entry)
+   return ERR_PTR(-ENOMEM);
+
+   entry->read = read_fn;
+   entry->dev = dev;
+
+   return debugfs_create_file(name, S_IRUGO, parent, entry,
+  &debugfs_devm_entry_ops);
+}
+EXPORT_SYMBOL_GPL(debugfs_create_devm_seqfile);
+
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index 4d0b4d1..f8c0db4 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -99,13 +99,18 @@ struct dentry *debugfs_create_u32_array(const char *name, 
umode_t mode,
struct dentry *parent,
u32 *array, u32 elements);
 
+struct dentry *debugfs_create_devm_seqfile(struct device *dev, const char 
*name,
+  struct dentry *parent,
+  int (*read_fn)(struct seq_file *s,
+ void *data));
+
 bool debugfs_initialized(void);
 
 #else
 
 #include 
 
-/* 
+/*
  * We do not return NULL from these functions if CONFIG_DEBUG_FS is not enabled
  * so users have a chance to detect if there was a real error or not.  We don't
  * want to duplicate the design decision mistakes of procfs and devfs again.
@@ -251,6 +256,15 @@ static inline struct dentry 
*debugfs_create_u32_array(const char *name, umode_t
return ERR_PTR(-ENODEV);
 }
 
+static inline struct dentry *debugfs_create_devm_seqfile(struct device *dev,
+const char *name,
+struct dentry *parent,
+  int (*read_fn)(struct seq_file *s,
+ void *data))
+{
+   return ERR_PTR(-ENODEV);
+}
+
 #endif
 
 #endif
-- 
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 0/3] debugfs: adding helper for single seq_file

2014-10-28 Thread Arend van Spriel
The first patch was already posted earlier:

Message-ID: <1413043315-22332-1-git-send-email-ar...@broadcom.com>

This series include changes in driver code to investigate potential
code savings. As example used the ath9k driver as it has a fair
amount of debugfs files. In this series it changes 7 debugfs entries
to use seq_file and the helper function. Below the output of the
size utility:

   textdata bss dec hex filename
 1159681225  28  117221   1c9e5 original/ath9k.o
 1132241225  28  114477   1bf2d seq_file/ath9k.o
 1110241225  28  112277   1b695 helper/ath9k.o

This series is for 3.19 kernel and applies to the driver-core-next
branch of the driver-core repository. If needed the ath9k patches
may be dropped for now and I will resubmit them to wireless-next
once the debugfs patch has made it into linux-next.

Arend van Spriel (3):
  debugfs: add helper function to create device related seq_file
  ath: use seq_file api for ath9k debugfs files
  ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file
entries

 drivers/net/wireless/ath/ath9k/ahb.c   |   1 +
 drivers/net/wireless/ath/ath9k/debug.c | 429 +++--
 drivers/net/wireless/ath/ath9k/debug.h |   3 +-
 drivers/net/wireless/ath/ath9k/pci.c   |   1 +
 fs/debugfs/file.c  |  54 +
 include/linux/debugfs.h|  16 +-
 6 files changed, 207 insertions(+), 297 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] ath9k: set pulse_rssi threshold to 15

2014-10-28 Thread Lorenzo Bianconi
Reduce pulse_rssi threshold to 15 in order to improve radar pattern detection
probability on ext channel

Signed-off-by: Lorenzo Bianconi 
---
 drivers/net/wireless/ath/ath9k/ar5008_phy.c | 2 +-
 drivers/net/wireless/ath/ath9k/ar9003_phy.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c 
b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
index ba3d788..5829074 100644
--- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
@@ -1228,7 +1228,7 @@ static void ar5008_hw_set_radar_conf(struct ath_hw *ah)
conf->fir_power = -33;
conf->radar_rssi = 20;
conf->pulse_height = 10;
-   conf->pulse_rssi = 24;
+   conf->pulse_rssi = 15;
conf->pulse_inband = 15;
conf->pulse_maxlen = 255;
conf->pulse_inband_step = 12;
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c 
b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
index 30b2f95..9bdaa0a 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
@@ -1391,7 +1391,7 @@ static void ar9003_hw_set_radar_conf(struct ath_hw *ah)
conf->fir_power = -28;
conf->radar_rssi = 0;
conf->pulse_height = 10;
-   conf->pulse_rssi = 24;
+   conf->pulse_rssi = 15;
conf->pulse_inband = 8;
conf->pulse_maxlen = 255;
conf->pulse_inband_step = 12;
-- 
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


Re: [PATCH 7/7] ath10k: implement wmi-tlv backend

2014-10-28 Thread Michal Kazior
On 20 October 2014 14:58, Michal Kazior  wrote:
> Latest firmware revision introduced a new WMI ABI
> called wmi-tlv. It is not a tlv strictly speaking
> but something that resembles it because it is
> ordered and may have duplicate id entries.
>
> This will be used by new hardware eventually.
>
> Signed-off-by: Michal Kazior 
> ---
[...]
> +static struct sk_buff *
> +ath10k_wmi_tlv_op_gen_pdev_set_wmm(struct ath10k *ar,
> +  const struct wmi_pdev_set_wmm_params_arg 
> *arg)
> +{
[...]
> +   ptr = ath10k_wmi_tlv_put_wmm(ptr, &arg->ac_be);
> +   ptr = ath10k_wmi_tlv_put_wmm(ptr, &arg->ac_be);
> +   ptr = ath10k_wmi_tlv_put_wmm(ptr, &arg->ac_be);
> +   ptr = ath10k_wmi_tlv_put_wmm(ptr, &arg->ac_be);

Oops, this should use called for be, bk, vi, vo.


Michał
--
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] mac80211: schedule the actual switch of the station before CSA count 0

2014-10-28 Thread Luca Coelho
From: Luciano Coelho 

Due to the time it takes to process the beacon that started the CSA
process, we may be late for the switch if we try to reach exactly
beacon 0.  To avoid that, use count - 1 when calculating the switch time.

Reported-by: Jouni Malinen 
Signed-off-by: Luciano Coelho 
---
 net/mac80211/mlme.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index ae9f3bd..284ddda 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1195,7 +1195,8 @@ ieee80211_sta_process_chanswitch(struct 
ieee80211_sub_if_data *sdata,
ieee80211_queue_work(&local->hw, &ifmgd->chswitch_work);
else
mod_timer(&ifmgd->chswitch_timer,
- TU_TO_EXP_TIME(csa_ie.count * cbss->beacon_interval));
+ TU_TO_EXP_TIME((csa_ie.count - 1) *
+cbss->beacon_interval));
 }
 
 static bool
-- 
2.1.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 0/2] mac80211: fix HT+ to HT- (and vice-versa) CSA

2014-10-28 Thread Luca Coelho
From: Luciano Coelho 

These two patches fix a bug that Jouni found when running his hostap
hwsim test scripts (ap_ht40_csa).  The failure was caused by two
different bugs which are fixed in this patchset.

The first bug was that we were not using the secondary channel offset
IE of beacons for the switch, but the offset of the current channel,
which cause us to use the same offset. 

The second bug was that we were trying to switch at the exact time of
the switch on the station side, which, because of the processing time,
was causing us to be too late.

Luciano Coelho (2):
  mac80211: use secondary channel offset IE also beacons during CSA
  mac80211: schedule the actual switch of the station before CSA count 0

 net/mac80211/ibss.c|  2 +-
 net/mac80211/ieee80211_i.h |  3 +--
 net/mac80211/mesh.c|  2 +-
 net/mac80211/mlme.c|  5 +++--
 net/mac80211/spectmgmt.c   | 18 ++
 5 files changed, 12 insertions(+), 18 deletions(-)

-- 
2.1.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] mac80211: use secondary channel offset IE also beacons during CSA

2014-10-28 Thread Luca Coelho
From: Luciano Coelho 

If we are switching from an HT40+ to an HT40- channel (or vice-versa),
we need the secondary channel offset IE to specify what is the
post-CSA offset to be used.  This applies both to beacons and to probe
responses.

In ieee80211_parse_ch_switch_ie() we were ignoring this IE from
beacons and using the *current* HT information IE instead.  This was
causing us to use the same offset as before the switch.

Fix that by using the secondary channel offset IE also for beacons and
don't ever use the pre-switch offset.  Additionally, remove the
"beacon" argument from ieee80211_parse_ch_switch_ie(), since it's not
needed anymore.

Reported-by: Jouni Malinen 
Signed-off-by: Luciano Coelho 
---
 net/mac80211/ibss.c|  2 +-
 net/mac80211/ieee80211_i.h |  3 +--
 net/mac80211/mesh.c|  2 +-
 net/mac80211/mlme.c|  2 +-
 net/mac80211/spectmgmt.c   | 18 ++
 5 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 56b5357..509bc15 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -805,7 +805,7 @@ ieee80211_ibss_process_chanswitch(struct 
ieee80211_sub_if_data *sdata,
 
memset(¶ms, 0, sizeof(params));
memset(&csa_ie, 0, sizeof(csa_ie));
-   err = ieee80211_parse_ch_switch_ie(sdata, elems, beacon,
+   err = ieee80211_parse_ch_switch_ie(sdata, elems,
   ifibss->chandef.chan->band,
   sta_flags, ifibss->bssid, &csa_ie);
/* can't switch to destination channel, fail */
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 146a818..96074df 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1676,7 +1676,6 @@ void ieee80211_process_measurement_req(struct 
ieee80211_sub_if_data *sdata,
  * ieee80211_parse_ch_switch_ie - parses channel switch IEs
  * @sdata: the sdata of the interface which has received the frame
  * @elems: parsed 802.11 elements received with the frame
- * @beacon: indicates if the frame was a beacon or probe response
  * @current_band: indicates the current band
  * @sta_flags: contains information about own capabilities and restrictions
  * to decide which channel switch announcements can be accepted. Only the
@@ -1690,7 +1689,7 @@ void ieee80211_process_measurement_req(struct 
ieee80211_sub_if_data *sdata,
  * Return: 0 on success, <0 on error and >0 if there is nothing to parse.
  */
 int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,
-struct ieee802_11_elems *elems, bool beacon,
+struct ieee802_11_elems *elems,
 enum ieee80211_band current_band,
 u32 sta_flags, u8 *bssid,
 struct ieee80211_csa_ie *csa_ie);
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index e9f99c1..0c8b2a7 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -874,7 +874,7 @@ ieee80211_mesh_process_chnswitch(struct 
ieee80211_sub_if_data *sdata,
 
memset(¶ms, 0, sizeof(params));
memset(&csa_ie, 0, sizeof(csa_ie));
-   err = ieee80211_parse_ch_switch_ie(sdata, elems, beacon, band,
+   err = ieee80211_parse_ch_switch_ie(sdata, elems, band,
   sta_flags, sdata->vif.addr,
   &csa_ie);
if (err < 0)
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index c078cd3..ae9f3bd 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1096,7 +1096,7 @@ ieee80211_sta_process_chanswitch(struct 
ieee80211_sub_if_data *sdata,
 
current_band = cbss->channel->band;
memset(&csa_ie, 0, sizeof(csa_ie));
-   res = ieee80211_parse_ch_switch_ie(sdata, elems, beacon, current_band,
+   res = ieee80211_parse_ch_switch_ie(sdata, elems, current_band,
   ifmgd->flags,
   ifmgd->associated->bssid, &csa_ie);
if (res < 0)
diff --git a/net/mac80211/spectmgmt.c b/net/mac80211/spectmgmt.c
index 6ab0090..efeba56 100644
--- a/net/mac80211/spectmgmt.c
+++ b/net/mac80211/spectmgmt.c
@@ -22,7 +22,7 @@
 #include "wme.h"
 
 int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,
-struct ieee802_11_elems *elems, bool beacon,
+struct ieee802_11_elems *elems,
 enum ieee80211_band current_band,
 u32 sta_flags, u8 *bssid,
 struct ieee80211_csa_ie *csa_ie)
@@ -91,19 +91,13 @@ int ieee80211_parse_ch_switch_ie(struct 
ieee80211_sub_if_data *sdata,
return -EINVAL;
}
 
-   if (!beacon && sec_chan_offs) {
+   if (sec_chan_offs) {
secondary_channel_offset = sec_chan_offs->s

Re: [PATCH] wireless-regdb: add regulatory rule for ETSI members on 60GHz band

2014-10-28 Thread Xose Vazquez Perez
On 10/28/2014 09:19 AM, Vladimir Kondratiev wrote:
> On Monday, October 27, 2014 01:26:37 PM John W. Linville wrote:
>>> On Tuesday, October 14, 2014 02:28:58 PM Xose Vazquez Perez wrote:
>>
 "(57240 - 65880 @ 2160), (40), NO-OUTDOOR" should(must) be replaced by:
 "(57000 - 66000 @ 2160), (40)"
>>
>> Would someone like to post a patch to that effect?
>>
> See below
> 
> 
>>From 6bccae032be4c9f99cddfdf55ff781316cabe20d Mon Sep 17 00:00:00 2001
> From: Vladimir Kondratiev 
> Date: Tue, 28 Oct 2014 10:17:30 +0200
> Subject: [PATCH] wireless-regdb: update 60GHz rules for EU
> 
> Comply to final document: Etsi En 302 567
> 
> Signed-off-by: Vladimir Kondratiev 

Acked-by: Xose Vazquez Perez 

> ---
>  db.txt | 76 
> +-
>  1 file changed, 38 insertions(+), 38 deletions(-)
> 
> diff --git a/db.txt b/db.txt
> index 8e83e0c..aef6d06 100644
> --- a/db.txt
> +++ b/db.txt
> @@ -19,7 +19,7 @@ country 00:
>  
>  country AD:
>   # 60 gHz band channels 1-4, ref: Etsi En 302 567
> - (57240 - 65880 @ 2160), (40), NO-OUTDOOR
> + (57000 - 66000 @ 2160), (40)
>  
>  country AE: DFS-FCC
>   (2402 - 2482 @ 40), (20)
> @@ -58,7 +58,7 @@ country AT: DFS-ETSI
>   (5250 - 5330 @ 80), (20), DFS
>   (5490 - 5710 @ 80), (27), DFS
>   # 60 gHz band channels 1-4, ref: Etsi En 302 567
> - (57240 - 65880 @ 2160), (40), NO-OUTDOOR
> + (57000 - 66000 @ 2160), (40)
>  
>  country AU:
>   (2402 - 2482 @ 40), (20)
> @@ -84,7 +84,7 @@ country BA: DFS-ETSI
>   (5250 - 5330 @ 80), (20), DFS
>   (5490 - 5710 @ 80), (27), DFS
>   # 60 gHz band channels 1-4, ref: Etsi En 302 567
> - (57240 - 65880 @ 2160), (40), NO-OUTDOOR
> + (57000 - 66000 @ 2160), (40)
>  
>  country BB: DFS-FCC
>   (2402 - 2482 @ 40), (20)
> @@ -102,14 +102,14 @@ country BE: DFS-ETSI
>   (5250 - 5330 @ 80), (20), DFS
>   (5490 - 5710 @ 80), (27), DFS
>   # 60 gHz band channels 1-4, ref: Etsi En 302 567
> - (57240 - 65880 @ 2160), (40), NO-OUTDOOR
> + (57000 - 66000 @ 2160), (40)
>  
>  country BG: DFS-ETSI
>   (2402 - 2482 @ 40), (20)
>   (5170 - 5250 @ 80), (20)
>   (5250 - 5330 @ 80), (20), DFS
>   # 60 gHz band channels 1-4, ref: Etsi En 302 567
> - (57240 - 65880 @ 2160), (40), NO-OUTDOOR
> + (57000 - 66000 @ 2160), (40)
>  
>  country BH: DFS-JP
>   (2402 - 2482 @ 40), (20)
> @@ -162,7 +162,7 @@ country CH: DFS-ETSI
>   (5250 - 5330 @ 80), (20), DFS
>   (5490 - 5710 @ 80), (27), DFS
>   # 60 gHz band channels 1-4, ref: Etsi En 302 567
> - (57240 - 65880 @ 2160), (40), NO-OUTDOOR
> + (57000 - 66000 @ 2160), (40)
>  
>  country CL: DFS-JP
>   (2402 - 2482 @ 40), (20)
> @@ -201,7 +201,7 @@ country CY: DFS-ETSI
>   (5250 - 5330 @ 80), (20), DFS
>   (5490 - 5710 @ 80), (27), DFS
>   # 60 gHz band channels 1-4, ref: Etsi En 302 567
> - (57240 - 65880 @ 2160), (40), NO-OUTDOOR
> + (57000 - 66000 @ 2160), (40)
>  
>  # Data from http://www.ctu.eu/164/download/VOR/VOR-12-08-2005-34.pdf
>  # and http://www.ctu.eu/164/download/VOR/VOR-12-05-2007-6-AN.pdf
> @@ -213,7 +213,7 @@ country CZ: DFS-ETSI
>   (5250 - 5350 @ 80), (100 mW), NO-OUTDOOR, DFS
>   (5470 - 5725 @ 80), (500 mW), DFS
>   # 60 gHz band channels 1-4, ref: Etsi En 302 567
> - (57240 - 65880 @ 2160), (40), NO-OUTDOOR
> + (57000 - 66000 @ 2160), (40)
>  
>  # Data from "Frequenznutzungsplan" (as published in April 2008), downloaded 
> from
>  # 
> http://www.bundesnetzagentur.de/cae/servlet/contentblob/38448/publicationFile/2659/Frequenznutzungsplan2008_Id17448pdf.pdf
> @@ -237,7 +237,7 @@ country DE: DFS-ETSI
>   # entries 308002, 309001 and 310003
>   (5470 - 5725 @ 80), (500 mW), DFS
>   # 60 gHz band channels 1-4, ref: Etsi En 302 567
> - (57240 - 65880 @ 2160), (40), NO-OUTDOOR
> + (57000 - 66000 @ 2160), (40)
>  
>  country DK: DFS-ETSI
>   (2402 - 2482 @ 40), (20)
> @@ -245,7 +245,7 @@ country DK: DFS-ETSI
>   (5250 - 5330 @ 80), (20), DFS
>   (5490 - 5710 @ 80), (27), DFS
>   # 60 gHz band channels 1-4, ref: Etsi En 302 567
> - (57240 - 65880 @ 2160), (40), NO-OUTDOOR
> + (57000 - 66000 @ 2160), (40)
>  
>  country DO: DFS-FCC
>   (2402 - 2472 @ 40), (30)
> @@ -272,7 +272,7 @@ country EE: DFS-ETSI
>   (5250 - 5330 @ 80), (20), DFS
>   (5490 - 5710 @ 80), (27), DFS
>   # 60 gHz band channels 1-4, ref: Etsi En 302 567
> - (57240 - 65880 @ 2160), (40), NO-OUTDOOR
> + (57000 - 66000 @ 2160), (40)
>  
>  country EG: DFS-ETSI
>   (2402 - 2482 @ 40), (20)
> @@ -285,7 +285,7 @@ country ES: DFS-ETSI
>   (5250 - 5350 @ 80), (100 mW), NO-OUTDOOR, DFS
>   (5470 - 5725 @ 80), (500 mW), DFS
>   # 60 gHz band channels 1-4, ref: Etsi En 302 567
> - (57240 - 65880 @ 2160), (40), NO-OUTDOOR
> + (57000 - 66000 @ 2160), (40)
>  
>  country FI: DFS-ETSI
>   (2402 - 2482 @ 40), (20)
> @@ -293,7 +293,7

[PATCH 17/21] wireless-regdb: Add regulatory rules for Reunion (RE)

2014-10-28 Thread Jouni Malinen
Source is QCA's regulatory team's efforts.

Signed-off-by: Jouni Malinen 
---
 db.txt | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/db.txt b/db.txt
index 7e14d24..e2981a2 100644
--- a/db.txt
+++ b/db.txt
@@ -945,6 +945,12 @@ country QA: DFS-JP
(2402 - 2482 @ 40), (20)
(5735 - 5835 @ 80), (30)
 
+country RE: DFS-ETSI
+   (2402 - 2482 @ 40), (20)
+   (5170 - 5250 @ 80), (20), AUTO-BW
+   (5250 - 5330 @ 80), (20), DFS, AUTO-BW
+   (5490 - 5710 @ 160), (27), DFS
+
 country RO: DFS-ETSI
(2402 - 2482 @ 40), (20)
(5170 - 5250 @ 80), (20), AUTO-BW
-- 
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 20/21] wireless-regdb: Add regulatory rules for U.S. Virgin Islands (VI)

2014-10-28 Thread Jouni Malinen
Source is QCA's regulatory team's efforts.

Signed-off-by: Jouni Malinen 
---
 db.txt | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/db.txt b/db.txt
index 95a750f..292dbac 100644
--- a/db.txt
+++ b/db.txt
@@ -1163,6 +1163,13 @@ country VE: DFS-FCC
(5250 - 5330 @ 80), (23), DFS
(5735 - 5835 @ 80), (30)
 
+country VI: DFS-FCC
+   (2402 - 2472 @ 40), (30)
+   (5170 - 5250 @ 80), (24), AUTO-BW
+   (5250 - 5330 @ 80), (24), DFS, AUTO-BW
+   (5490 - 5730 @ 160), (24), DFS
+   (5735 - 5835 @ 80), (30)
+
 country VN: DFS-FCC
(2402 - 2482 @ 40), (20)
(5170 - 5250 @ 80), (17)
-- 
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 19/21] wireless-regdb: Add regulatory rules for Uganda (UG)

2014-10-28 Thread Jouni Malinen
Source is QCA's regulatory team's efforts.

Signed-off-by: Jouni Malinen 
---
 db.txt | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/db.txt b/db.txt
index 8d56c92..95a750f 100644
--- a/db.txt
+++ b/db.txt
@@ -1114,6 +1114,13 @@ country UA: DFS-ETSI
# 60 gHz band channels 1-4, ref: Etsi En 302 567
(57240 - 65880 @ 2160), (40), NO-OUTDOOR
 
+country UG: DFS-FCC
+   (2402 - 2482 @ 40), (20)
+   (5170 - 5250 @ 80), (24), AUTO-BW
+   (5250 - 5330 @ 80), (24), DFS, AUTO-BW
+   (5490 - 5730 @ 160), (24), DFS
+   (5735 - 5835 @ 80), (30)
+
 country US: DFS-FCC
(2402 - 2472 @ 40), (30)
(5170 - 5250 @ 80), (17), AUTO-BW
-- 
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 16/21] wireless-regdb: Add regulatory rules for Paraguay (PY)

2014-10-28 Thread Jouni Malinen
Source is QCA's regulatory team's efforts.

Signed-off-by: Jouni Malinen 
---
 db.txt | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/db.txt b/db.txt
index 640d2a7..7e14d24 100644
--- a/db.txt
+++ b/db.txt
@@ -934,6 +934,13 @@ country PW: DFS-FCC
(5490 - 5730 @ 160), (24), DFS
(5735 - 5835 @ 80), (30)
 
+country PY: DFS-FCC
+   (2402 - 2482 @ 40), (20)
+   (5170 - 5250 @ 80), (24), AUTO-BW
+   (5250 - 5330 @ 80), (24), DFS, AUTO-BW
+   (5490 - 5730 @ 160), (24), DFS
+   (5735 - 5835 @ 80), (30)
+
 country QA: DFS-JP
(2402 - 2482 @ 40), (20)
(5735 - 5835 @ 80), (30)
-- 
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 18/21] wireless-regdb: Add regulatory rules for Suriname (SR)

2014-10-28 Thread Jouni Malinen
Source is QCA's regulatory team's efforts.

Signed-off-by: Jouni Malinen 
---
 db.txt | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/db.txt b/db.txt
index e2981a2..8d56c92 100644
--- a/db.txt
+++ b/db.txt
@@ -1029,6 +1029,12 @@ country SN: DFS-FCC
(5490 - 5730 @ 160), (24), DFS
(5735 - 5835 @ 80), (30)
 
+country SR: DFS-ETSI
+   (2402 - 2482 @ 40), (20)
+   (5170 - 5250 @ 80), (20), AUTO-BW
+   (5250 - 5330 @ 80), (20), DFS, AUTO-BW
+   (5490 - 5710 @ 160), (27), DFS
+
 country SV: DFS-FCC
(2402 - 2482 @ 40), (20)
(5170 - 5250 @ 80), (17)
-- 
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 21/21] wireless-regdb: Add regulatory rules for Mayotte (YT)

2014-10-28 Thread Jouni Malinen
Source is QCA's regulatory team's efforts.

Signed-off-by: Jouni Malinen 
---
 db.txt | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/db.txt b/db.txt
index 292dbac..2a54da8 100644
--- a/db.txt
+++ b/db.txt
@@ -1195,6 +1195,12 @@ country WF: DFS-ETSI
 country YE:
(2402 - 2482 @ 40), (20)
 
+country YT: DFS-ETSI
+   (2402 - 2482 @ 40), (20)
+   (5170 - 5250 @ 80), (20), AUTO-BW
+   (5250 - 5330 @ 80), (20), DFS, AUTO-BW
+   (5490 - 5710 @ 160), (27), DFS
+
 country ZA: DFS-ETSI
(2402 - 2482 @ 40), (20)
(5170 - 5250 @ 80), (20), AUTO-BW
-- 
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 15/21] wireless-regdb: Add regulatory rules for French Polynesia (PF)

2014-10-28 Thread Jouni Malinen
Source is QCA's regulatory team's efforts.

Signed-off-by: Jouni Malinen 
---
 db.txt | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/db.txt b/db.txt
index 1c9e307..640d2a7 100644
--- a/db.txt
+++ b/db.txt
@@ -874,6 +874,12 @@ country PE: DFS-FCC
(5490 - 5730 @ 160), (24), DFS
(5735 - 5835 @ 80), (30)
 
+country PF: DFS-ETSI
+   (2402 - 2482 @ 40), (20)
+   (5170 - 5250 @ 80), (20), AUTO-BW
+   (5250 - 5330 @ 80), (20), DFS, AUTO-BW
+   (5490 - 5710 @ 160), (27), DFS
+
 country PG: DFS-FCC
(2402 - 2482 @ 40), (20)
(5170 - 5250 @ 80), (17), AUTO-BW
-- 
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 14/21] wireless-regdb: Add regulatory rules for Nicaragua (NI)

2014-10-28 Thread Jouni Malinen
Source is QCA's regulatory team's efforts.

Signed-off-by: Jouni Malinen 
---
 db.txt | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/db.txt b/db.txt
index 7319579..1c9e307 100644
--- a/db.txt
+++ b/db.txt
@@ -812,6 +812,13 @@ country MX: DFS-FCC
(5490 - 5730 @ 160), (24), DFS
(5735 - 5835 @ 80), (30)
 
+country NI: DFS-FCC
+   (2402 - 2472 @ 40), (30)
+   (5170 - 5250 @ 80), (24), AUTO-BW
+   (5250 - 5330 @ 80), (24), DFS, AUTO-BW
+   (5490 - 5730 @ 160), (24), DFS
+   (5735 - 5835 @ 80), (30)
+
 country NL: DFS-ETSI
(2402 - 2482 @ 40), (20)
(5170 - 5250 @ 80), (20), NO-OUTDOOR, AUTO-BW
-- 
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 13/21] wireless-regdb: Add regulatory rules for Malawi (MW)

2014-10-28 Thread Jouni Malinen
Source is QCA's regulatory team's efforts.

Signed-off-by: Jouni Malinen 
---
 db.txt | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/db.txt b/db.txt
index 5869b96..7319579 100644
--- a/db.txt
+++ b/db.txt
@@ -793,6 +793,12 @@ country MU: DFS-FCC
(5490 - 5730 @ 160), (24), DFS
(5735 - 5835 @ 80), (30)
 
+country MW: DFS-ETSI
+   (2402 - 2482 @ 40), (20)
+   (5170 - 5250 @ 80), (20), AUTO-BW
+   (5250 - 5330 @ 80), (20), DFS, AUTO-BW
+   (5490 - 5710 @ 160), (27), DFS
+
 country MY: DFS-FCC
(2402 - 2482 @ 40), (20)
(5170 - 5250 @ 80), (17)
-- 
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 12/21] wireless-regdb: Add regulatory rules for Mauritius (MU)

2014-10-28 Thread Jouni Malinen
Source is QCA's regulatory team's efforts.

Signed-off-by: Jouni Malinen 
---
 db.txt | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/db.txt b/db.txt
index 0a507d6..5869b96 100644
--- a/db.txt
+++ b/db.txt
@@ -786,6 +786,13 @@ country MT: DFS-ETSI
# 60 gHz band channels 1-4, ref: Etsi En 302 567
(57240 - 65880 @ 2160), (40), NO-OUTDOOR
 
+country MU: DFS-FCC
+   (2402 - 2482 @ 40), (20)
+   (5170 - 5250 @ 80), (24), AUTO-BW
+   (5250 - 5330 @ 80), (24), DFS, AUTO-BW
+   (5490 - 5730 @ 160), (24), DFS
+   (5735 - 5835 @ 80), (30)
+
 country MY: DFS-FCC
(2402 - 2482 @ 40), (20)
(5170 - 5250 @ 80), (17)
-- 
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 10/21] wireless-regdb: Add regulatory rules for Northern Mariana Islands (MP)

2014-10-28 Thread Jouni Malinen
Source is QCA's regulatory team's efforts.

Signed-off-by: Jouni Malinen 
---
 db.txt | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/db.txt b/db.txt
index 04614fe..bbc7f8c 100644
--- a/db.txt
+++ b/db.txt
@@ -757,6 +757,13 @@ country MN: DFS-FCC
(5490 - 5730 @ 160), (24), DFS
(5735 - 5835 @ 80), (30)
 
+country MP: DFS-FCC
+   (2402 - 2472 @ 40), (30)
+   (5170 - 5250 @ 80), (24), AUTO-BW
+   (5250 - 5330 @ 80), (24), DFS, AUTO-BW
+   (5490 - 5730 @ 160), (24), DFS
+   (5735 - 5835 @ 80), (30)
+
 # Source:
 # http://www.are.mr/pdfs/telec_freq_TNAbf_2010.pdf
 country MR: DFS-ETSI
-- 
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 11/21] wireless-regdb: Add regulatory rules for Martinique (MQ)

2014-10-28 Thread Jouni Malinen
Source is QCA's regulatory team's efforts.

Signed-off-by: Jouni Malinen 
---
 db.txt | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/db.txt b/db.txt
index bbc7f8c..0a507d6 100644
--- a/db.txt
+++ b/db.txt
@@ -764,6 +764,12 @@ country MP: DFS-FCC
(5490 - 5730 @ 160), (24), DFS
(5735 - 5835 @ 80), (30)
 
+country MQ: DFS-ETSI
+   (2402 - 2482 @ 40), (20)
+   (5170 - 5250 @ 80), (20), AUTO-BW
+   (5250 - 5330 @ 80), (20), DFS, AUTO-BW
+   (5490 - 5710 @ 160), (27), DFS
+
 # Source:
 # http://www.are.mr/pdfs/telec_freq_TNAbf_2010.pdf
 country MR: DFS-ETSI
-- 
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 09/21] wireless-regdb: Add regulatory rules for Mongolia (MN)

2014-10-28 Thread Jouni Malinen
Source is QCA's regulatory team's efforts.

Signed-off-by: Jouni Malinen 
---
 db.txt | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/db.txt b/db.txt
index 6d8abd1..04614fe 100644
--- a/db.txt
+++ b/db.txt
@@ -750,6 +750,13 @@ country MK: DFS-ETSI
# 60 gHz band channels 1-4, ref: Etsi En 302 567
(57240 - 65880 @ 2160), (40), NO-OUTDOOR
 
+country MN: DFS-FCC
+   (2402 - 2482 @ 40), (20)
+   (5170 - 5250 @ 80), (24), AUTO-BW
+   (5250 - 5330 @ 80), (24), DFS, AUTO-BW
+   (5490 - 5730 @ 160), (24), DFS
+   (5735 - 5835 @ 80), (30)
+
 # Source:
 # http://www.are.mr/pdfs/telec_freq_TNAbf_2010.pdf
 country MR: DFS-ETSI
-- 
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 08/21] wireless-regdb: Add regulatory rules for Cayman Islands (KY)

2014-10-28 Thread Jouni Malinen
Source is QCA's regulatory team's efforts.

Signed-off-by: Jouni Malinen 
---
 db.txt | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/db.txt b/db.txt
index 4ecfcf3..6d8abd1 100644
--- a/db.txt
+++ b/db.txt
@@ -625,6 +625,13 @@ country KW: DFS-ETSI
(5170 - 5250 @ 80), (20), AUTO-BW
(5250 - 5330 @ 80), (20), DFS, AUTO-BW
 
+country KY: DFS-FCC
+   (2402 - 2482 @ 40), (20)
+   (5170 - 5250 @ 80), (24), AUTO-BW
+   (5250 - 5330 @ 80), (24), DFS, AUTO-BW
+   (5490 - 5730 @ 160), (24), DFS
+   (5735 - 5835 @ 80), (30)
+
 country KZ:
(2402 - 2482 @ 40), (20)
 
-- 
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 07/21] wireless-regdb: Add regulatory rules for Guadeloupe (GP)

2014-10-28 Thread Jouni Malinen
Source is QCA's regulatory team's efforts.

Signed-off-by: Jouni Malinen 
---
 db.txt | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/db.txt b/db.txt
index 07e56d0..4ecfcf3 100644
--- a/db.txt
+++ b/db.txt
@@ -446,6 +446,12 @@ country GH: DFS-FCC
(5490 - 5730 @ 160), (24), DFS
(5735 - 5835 @ 80), (30)
 
+country GP: DFS-ETSI
+   (2402 - 2482 @ 40), (20)
+   (5170 - 5250 @ 80), (20), AUTO-BW
+   (5250 - 5330 @ 80), (20), DFS, AUTO-BW
+   (5490 - 5710 @ 160), (27), DFS
+
 country GR: DFS-ETSI
(2402 - 2482 @ 40), (20)
(5170 - 5250 @ 80), (20), AUTO-BW
-- 
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 06/21] wireless-regdb: Add regulatory rules for French Guiana (GF)

2014-10-28 Thread Jouni Malinen
Source is QCA's regulatory team's efforts.

Signed-off-by: Jouni Malinen 
---
 db.txt | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/db.txt b/db.txt
index 024b424..07e56d0 100644
--- a/db.txt
+++ b/db.txt
@@ -418,6 +418,12 @@ country GE: DFS-ETSI
# 60 gHz band channels 1-4, ref: Etsi En 302 567
(57240 - 65880 @ 2160), (40), NO-OUTDOOR
 
+country GF: DFS-ETSI
+   (2402 - 2482 @ 40), (20)
+   (5170 - 5250 @ 80), (20), AUTO-BW
+   (5250 - 5330 @ 80), (20), DFS, AUTO-BW
+   (5490 - 5710 @ 160), (27), DFS
+
 country GB: DFS-ETSI
(2402 - 2482 @ 40), (20)
(5170 - 5250 @ 80), (20), AUTO-BW
-- 
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 04/21] wireless-regdb: Add regulatory rules for Christmas Island (CX)

2014-10-28 Thread Jouni Malinen
Source is QCA's regulatory team's efforts.

Signed-off-by: Jouni Malinen 
---
 db.txt | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/db.txt b/db.txt
index 11c8716..40ef0e8 100644
--- a/db.txt
+++ b/db.txt
@@ -268,6 +268,13 @@ country CR: DFS-FCC
(5490 - 5730 @ 80), (24), DFS
(5735 - 5835 @ 80), (30)
 
+country CX: DFS-FCC
+   (2402 - 2482 @ 40), (20)
+   (5170 - 5250 @ 80), (24), AUTO-BW
+   (5250 - 5330 @ 80), (24), DFS, AUTO-BW
+   (5490 - 5730 @ 160), (24), DFS
+   (5735 - 5835 @ 80), (30)
+
 country CY: DFS-ETSI
(2402 - 2482 @ 40), (20)
(5170 - 5250 @ 80), (20), AUTO-BW
-- 
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 05/21] wireless-regdb: Add regulatory rules for Ethiopia (ET)

2014-10-28 Thread Jouni Malinen
Source is QCA's regulatory team's efforts.

Signed-off-by: Jouni Malinen 
---
 db.txt | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/db.txt b/db.txt
index 40ef0e8..024b424 100644
--- a/db.txt
+++ b/db.txt
@@ -382,6 +382,12 @@ country ES: DFS-ETSI
# 60 gHz band channels 1-4, ref: Etsi En 302 567
(57240 - 65880 @ 2160), (40), NO-OUTDOOR
 
+country ET: DFS-ETSI
+   (2402 - 2482 @ 40), (20)
+   (5170 - 5250 @ 80), (20), AUTO-BW
+   (5250 - 5330 @ 80), (20), DFS, AUTO-BW
+   (5490 - 5710 @ 160), (27), DFS
+
 country FI: DFS-ETSI
(2402 - 2482 @ 40), (20)
(5170 - 5250 @ 80), (20), AUTO-BW
-- 
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 03/21] wireless-regdb: Add regulatory rules for The Bahamas (BS)

2014-10-28 Thread Jouni Malinen
Source is QCA's regulatory team's efforts.

Signed-off-by: Jouni Malinen 
---
 db.txt | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/db.txt b/db.txt
index 7a0b0dc..11c8716 100644
--- a/db.txt
+++ b/db.txt
@@ -181,6 +181,13 @@ country BR: DFS-FCC
(5490 - 5730 @ 160), (24), DFS
(5735 - 5835 @ 80), (30)
 
+country BS: DFS-FCC
+   (2402 - 2482 @ 40), (20)
+   (5170 - 5250 @ 80), (24), AUTO-BW
+   (5250 - 5330 @ 80), (24), DFS, AUTO-BW
+   (5490 - 5730 @ 160), (24), DFS
+   (5735 - 5835 @ 80), (30)
+
 # Source:
 # http://www.bicma.gov.bt/paper/publication/nrrpart4.pdf
 country BT: DFS-ETSI
-- 
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 02/21] wireless-regdb: Add regulatory rules for Bermuda (BM)

2014-10-28 Thread Jouni Malinen
Source is QCA's regulatory team's efforts.

Signed-off-by: Jouni Malinen 
---
 db.txt | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/db.txt b/db.txt
index be24c73..7a0b0dc 100644
--- a/db.txt
+++ b/db.txt
@@ -156,6 +156,13 @@ country BL: DFS-ETSI
(5250 - 5330 @ 80), (20), DFS, AUTO-BW
(5490 - 5710 @ 160), (27), DFS
 
+country BM: DFS-FCC
+   (2402 - 2472 @ 40), (30)
+   (5170 - 5250 @ 80), (24), AUTO-BW
+   (5250 - 5330 @ 80), (24), DFS, AUTO-BW
+   (5490 - 5730 @ 160), (24), DFS
+   (5735 - 5835 @ 80), (30)
+
 country BN: DFS-JP
(2402 - 2482 @ 40), (20)
(5170 - 5250 @ 80), (20), AUTO-BW
-- 
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 01/21] wireless-regdb: Add regulatory rules for American Samoa (AS)

2014-10-28 Thread Jouni Malinen
Source is QCA's regulatory team's efforts.

Signed-off-by: Jouni Malinen 
---
 db.txt | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/db.txt b/db.txt
index 43afa5c..be24c73 100644
--- a/db.txt
+++ b/db.txt
@@ -70,6 +70,13 @@ country AR: DFS-FCC
(5490 - 5730 @ 160), (24), DFS
(5735 - 5835 @ 80), (30)
 
+country AS: DFS-FCC
+   (2402 - 2472 @ 40), (30)
+   (5170 - 5250 @ 80), (24), AUTO-BW
+   (5250 - 5330 @ 80), (24), DFS, AUTO-BW
+   (5490 - 5730 @ 160), (24), DFS
+   (5735 - 5835 @ 80), (30)
+
 country AT: DFS-ETSI
(2402 - 2482 @ 40), (20)
(5170 - 5250 @ 80), (20), AUTO-BW
-- 
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: [rt2x00-users] MediaTek Inc. MT7601U Wireless Adapter

2014-10-28 Thread Stanislaw Gruszka
On Tue, Oct 28, 2014 at 08:47:29AM +0100, poma wrote:
> On 08.10.2014 11:53, Stanislaw Gruszka wrote:
> > On Tue, Oct 07, 2014 at 05:12:47PM +0200, poma wrote:
> >> BTW, pán Gruszka, when will these devices be supported as a part of the 
> >> upstream Linux kernel?
> > 
> > I'm not an oracle :-)
> > 
> > Larry declared to work on some mt76xx chip support, I'm cc him.
> > 
> > I can also work on new chips for rt2x00, but wanted to finish some
> > other work before.
> > 
> > Stanislaw 
> > 
> 
> Even better pán Gruszka, MediaTek has spoken. :)
> I hope that they really support further development here.

Me too.

Stanislaw
--
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 RESEND] net: rfkill: gpio: Add ACPI default GPIO driver mappings

2014-10-28 Thread Mika Westerberg
The driver uses devm_gpiod_get_index(..., index) so that the index refers
directly to the GpioIo resource under the ACPI device. The problem with
this is that if the ordering changes we get wrong GPIOs.

With ACPI 5.1 _DSD we can now use names instead to reference GPIOs
analogous to Device Tree. However, we still have systems out there that do
not provide _DSD at all. These systems must be supported as well.

Luckily we now have acpi_dev_add_driver_gpios() that can be used to provide
mappings for systems where _DSD is not provided and still take advantage of
_DSD if it exists.

This patch converts the rfkill-gpio.c driver to create default GPIO
mappings to the two GPIOs in case we are running on ACPI system.

While there we can drop the indices completely.

Signed-off-by: Mika Westerberg 
Reviewed-by: Johannes Berg 
Acked-by: Johannes Berg 
Acked-by: John W. Linville 
---
Resending with linux-acpi included. I also added ACKs from Johannes and
John. The patch itself is intact.

 net/rfkill/rfkill-gpio.c | 18 +++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
index 0f62326c0f5e..2a4717967502 100644
--- a/net/rfkill/rfkill-gpio.c
+++ b/net/rfkill/rfkill-gpio.c
@@ -63,6 +63,15 @@ static const struct rfkill_ops rfkill_gpio_ops = {
.set_block = rfkill_gpio_set_power,
 };
 
+static const struct acpi_gpio_params reset_gpios = { 0, 0, false };
+static const struct acpi_gpio_params shutdown_gpios = { 1, 0, false };
+
+static const struct acpi_gpio_mapping acpi_rfkill_default_gpios[] = {
+   { "reset-gpios", &reset_gpios, 1 },
+   { "shutdown-gpios", &shutdown_gpios, 1 },
+   { },
+};
+
 static int rfkill_gpio_acpi_probe(struct device *dev,
  struct rfkill_gpio_data *rfkill)
 {
@@ -75,7 +84,8 @@ static int rfkill_gpio_acpi_probe(struct device *dev,
rfkill->name = dev_name(dev);
rfkill->type = (unsigned)id->driver_data;
 
-   return 0;
+   return acpi_dev_add_driver_gpios(ACPI_COMPANION(dev),
+acpi_rfkill_default_gpios);
 }
 
 static int rfkill_gpio_probe(struct platform_device *pdev)
@@ -102,7 +112,7 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
 
rfkill->clk = devm_clk_get(&pdev->dev, NULL);
 
-   gpio = devm_gpiod_get_index(&pdev->dev, "reset", 0);
+   gpio = devm_gpiod_get(&pdev->dev, "reset");
if (!IS_ERR(gpio)) {
ret = gpiod_direction_output(gpio, 0);
if (ret)
@@ -110,7 +120,7 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
rfkill->reset_gpio = gpio;
}
 
-   gpio = devm_gpiod_get_index(&pdev->dev, "shutdown", 1);
+   gpio = devm_gpiod_get(&pdev->dev, "shutdown");
if (!IS_ERR(gpio)) {
ret = gpiod_direction_output(gpio, 0);
if (ret)
@@ -150,6 +160,8 @@ static int rfkill_gpio_remove(struct platform_device *pdev)
rfkill_unregister(rfkill->rfkill_dev);
rfkill_destroy(rfkill->rfkill_dev);
 
+   acpi_dev_remove_driver_gpios(ACPI_COMPANION(&pdev->dev));
+
return 0;
 }
 
-- 
2.1.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 v3 0/3] ath10k: speed up recovery

2014-10-28 Thread Michal Kazior
Patch #1 fixes a bug I've found while testing
patches #2 and #3. It's safe to cherry-pick it in
case patches #2 and/or #3 aren't accepted or need
a re-spin.

I've mainly used patch #2 to test reset and
recovery. It's pretty handy for (stress-)testing.

Patch #3 should improve recovery speed in some
cases. Notably when there's a long chain of WMI
commands involved which take a painfully long time
to timeout/complete if firmware crashes mid-way.

Note: Patches #2 and #3 depend on `ath10k: pci
related fixes 2014-10-09`. Without the patchset
patches #2 and #3 must not be applied. Patch #1 is
fine though.

v3:
 * skip shadow ring cleanup in #1

Michal Kazior (3):
  ath10k: fix possible bmi crash
  ath10k: expose hw restart via debugfs
  ath10k: speed up hw recovery

 drivers/net/wireless/ath/ath10k/ce.c |  7 +++
 drivers/net/wireless/ath/ath10k/core.c   | 23 +++
 drivers/net/wireless/ath/ath10k/core.h   |  5 +
 drivers/net/wireless/ath/ath10k/debug.c  |  7 ++-
 drivers/net/wireless/ath/ath10k/htt_tx.c |  1 -
 drivers/net/wireless/ath/ath10k/mac.c| 14 --
 drivers/net/wireless/ath/ath10k/mac.h|  1 +
 drivers/net/wireless/ath/ath10k/pci.c|  3 +++
 drivers/net/wireless/ath/ath10k/txrx.c   |  3 ++-
 drivers/net/wireless/ath/ath10k/wmi.c|  5 -
 10 files changed, 63 insertions(+), 6 deletions(-)

-- 
1.8.5.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 v3 3/3] ath10k: speed up hw recovery

2014-10-28 Thread Michal Kazior
In some cases hw recovery was taking an absurdly
long time due to ath10k waiting for things that
would never really complete.

Instead of waiting for inevitable timeouts poke
all completions and wakequeues and check if it's
still worth waiting.

Reading/writing ar->state requires conf_mutex.
Since waiters might be holding it introduce a new
flag CRASH_FLUSH so it's possible to tell waiters
to abort whatever they were waiting for.

Signed-off-by: Michal Kazior 
---

Notes:
v2:
 * comment use of barrier() [Kalle]
 * comment CRASH_FLUSH vs ar->state in commit log [Kalle]
 * fix crash on too early use of waitqueues [Janusz]

 drivers/net/wireless/ath/ath10k/core.c   | 23 +++
 drivers/net/wireless/ath/ath10k/core.h   |  5 +
 drivers/net/wireless/ath/ath10k/htt_tx.c |  1 -
 drivers/net/wireless/ath/ath10k/mac.c| 14 --
 drivers/net/wireless/ath/ath10k/mac.h|  1 +
 drivers/net/wireless/ath/ath10k/txrx.c   |  3 ++-
 drivers/net/wireless/ath/ath10k/wmi.c|  5 -
 7 files changed, 47 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 5c23d00..6f2c459 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -744,6 +744,25 @@ static void ath10k_core_restart(struct work_struct *work)
 {
struct ath10k *ar = container_of(work, struct ath10k, restart_work);
 
+   set_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags);
+
+   /* Place a barrier to make sure the compiler doesn't reorder
+* CRASH_FLUSH and calling other functions.
+*/
+   barrier();
+
+   ieee80211_stop_queues(ar->hw);
+   ath10k_drain_tx(ar);
+   complete_all(&ar->scan.started);
+   complete_all(&ar->scan.completed);
+   complete_all(&ar->scan.on_channel);
+   complete_all(&ar->offchan_tx_completed);
+   complete_all(&ar->install_key_done);
+   complete_all(&ar->vdev_setup_done);
+   wake_up(&ar->htt.empty_tx_wq);
+   wake_up(&ar->wmi.tx_credits_wq);
+   wake_up(&ar->peer_mapping_wq);
+
mutex_lock(&ar->conf_mutex);
 
switch (ar->state) {
@@ -781,6 +800,8 @@ int ath10k_core_start(struct ath10k *ar, enum 
ath10k_firmware_mode mode)
 
lockdep_assert_held(&ar->conf_mutex);
 
+   clear_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags);
+
ath10k_bmi_start(ar);
 
if (ath10k_init_configure_target(ar)) {
@@ -1185,6 +1206,8 @@ struct ath10k *ath10k_core_create(size_t priv_size, 
struct device *dev,
 
INIT_LIST_HEAD(&ar->peers);
init_waitqueue_head(&ar->peer_mapping_wq);
+   init_waitqueue_head(&ar->htt.empty_tx_wq);
+   init_waitqueue_head(&ar->wmi.tx_credits_wq);
 
init_completion(&ar->offchan_tx_completed);
INIT_WORK(&ar->offchan_tx_work, ath10k_offchan_tx_work);
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 1e3fd10..114bac0 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -386,6 +386,11 @@ enum ath10k_dev_flags {
/* Indicates that ath10k device is during CAC phase of DFS */
ATH10K_CAC_RUNNING,
ATH10K_FLAG_CORE_REGISTERED,
+
+   /* Device has crashed and needs to restart. This indicates any pending
+* waiters should immediately cancel instead of waiting for a time out.
+*/
+   ATH10K_FLAG_CRASH_FLUSH,
 };
 
 enum ath10k_cal_mode {
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c 
b/drivers/net/wireless/ath/ath10k/htt_tx.c
index b0df470..1702c97 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -92,7 +92,6 @@ int ath10k_htt_tx_alloc(struct ath10k_htt *htt)
struct ath10k *ar = htt->ar;
 
spin_lock_init(&htt->tx_lock);
-   init_waitqueue_head(&htt->empty_tx_wq);
 
if (test_bit(ATH10K_FW_FEATURE_WMI_10X, htt->ar->fw_features))
htt->max_num_pending_tx = TARGET_10X_NUM_MSDU_DESC;
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index a726107..b2edfb4 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -519,6 +519,9 @@ static inline int ath10k_vdev_setup_sync(struct ath10k *ar)
 
lockdep_assert_held(&ar->conf_mutex);
 
+   if (test_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags))
+   return -ESHUTDOWN;
+
ret = wait_for_completion_timeout(&ar->vdev_setup_done,
  ATH10K_VDEV_SETUP_TIMEOUT_HZ);
if (ret == 0)
@@ -551,6 +554,8 @@ static int ath10k_monitor_vdev_start(struct ath10k *ar, int 
vdev_id)
arg.channel.max_reg_power = channel->max_reg_power * 2;
arg.channel.max_antenna_gain = channel->max_antenna_gain * 2;
 
+   reinit_completion(&ar->vdev_setup_done);
+
ret = ath10k_wmi_vdev_start(ar, &arg);
 

[PATCH v3 2/3] ath10k: expose hw restart via debugfs

2014-10-28 Thread Michal Kazior
Until now it was possible to simulate soft and
hard fw crashes but it wasn't possible to trigger
an immediately hw restart itself (without the fw
crash).

This can be useful when stress testing hw
restarting stability, e.g. during heavy tx/rx
traffic.

Signed-off-by: Michal Kazior 
---

Notes:
v2:
 * s/request/hw-restart/ [Kalle]

 drivers/net/wireless/ath/ath10k/debug.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index 9147dd3..a8f5a72 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -695,7 +695,8 @@ static ssize_t ath10k_read_simulate_fw_crash(struct file 
*file,
"To simulate firmware crash write one of the keywords to this 
file:\n"
"`soft` - this will send WMI_FORCE_FW_HANG_ASSERT to firmware 
if FW supports that command.\n"
"`hard` - this will send to firmware command with illegal 
parameters causing firmware crash.\n"
-   "`assert` - this will send special illegal parameter to 
firmware to cause assert failure and crash.\n";
+   "`assert` - this will send special illegal parameter to 
firmware to cause assert failure and crash.\n"
+   "`hw-restart` - this will simply queue hw restart without fw/hw 
actually crashing.\n";
 
return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));
 }
@@ -748,6 +749,10 @@ static ssize_t ath10k_write_simulate_fw_crash(struct file 
*file,
} else if (!strcmp(buf, "assert")) {
ath10k_info(ar, "simulating firmware assert crash\n");
ret = ath10k_debug_fw_assert(ar);
+   } else if (!strcmp(buf, "hw-restart")) {
+   ath10k_info(ar, "user requested hw restart\n");
+   queue_work(ar->workqueue, &ar->restart_work);
+   ret = 0;
} else {
ret = -EINVAL;
goto exit;
-- 
1.8.5.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 v3 1/3] ath10k: fix possible bmi crash

2014-10-28 Thread Michal Kazior
While testing other things I've found that CE
items aren't cleared properly. This could lead to
null dereferences in BMI.

To prevent that make sure CE revoking clears the
nbytes value (which is used as a buffer completion
indication) and memset the entire CE ring data
shared between host and target when
(re)initializing.

Also make sure to check BMI xfer pointer and print
a splat instead of crashing the kernel.

Signed-off-by: Michal Kazior 
---

Notes:
v3:
 * dont reset shadow desc - its used for cleanup in hif_stop()

 drivers/net/wireless/ath/ath10k/ce.c  | 7 +++
 drivers/net/wireless/ath/ath10k/pci.c | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/ce.c 
b/drivers/net/wireless/ath/ath10k/ce.c
index 878e1ec..a156e6e 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -558,6 +558,7 @@ int ath10k_ce_revoke_recv_next(struct ath10k_ce_pipe 
*ce_state,
 
/* sanity */
dest_ring->per_transfer_context[sw_index] = NULL;
+   desc->nbytes = 0;
 
/* Update sw_index */
sw_index = CE_RING_IDX_INCR(nentries_mask, sw_index);
@@ -835,6 +836,9 @@ static int ath10k_ce_init_src_ring(struct ath10k *ar,
 
nentries = roundup_pow_of_two(attr->src_nentries);
 
+   memset(src_ring->base_addr_owner_space, 0,
+  nentries * sizeof(struct ce_desc));
+
src_ring->sw_index = ath10k_ce_src_ring_read_index_get(ar, ctrl_addr);
src_ring->sw_index &= src_ring->nentries_mask;
src_ring->hw_index = src_ring->sw_index;
@@ -869,6 +873,9 @@ static int ath10k_ce_init_dest_ring(struct ath10k *ar,
 
nentries = roundup_pow_of_two(attr->dest_nentries);
 
+   memset(dest_ring->base_addr_owner_space, 0,
+  nentries * sizeof(struct ce_desc));
+
dest_ring->sw_index = ath10k_ce_dest_ring_read_index_get(ar, ctrl_addr);
dest_ring->sw_index &= dest_ring->nentries_mask;
dest_ring->write_index =
diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 63f374ed..f5e426e 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -1442,6 +1442,9 @@ static void ath10k_pci_bmi_recv_data(struct 
ath10k_ce_pipe *ce_state)
  &nbytes, &transfer_id, &flags))
return;
 
+   if (WARN_ON_ONCE(!xfer))
+   return;
+
if (!xfer->wait_for_resp) {
ath10k_warn(ar, "unexpected: BMI data received; ignoring\n");
return;
-- 
1.8.5.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 v3 2/4] ath10k: make warm reset a bit safer and faster

2014-10-28 Thread Michal Kazior
One of the problems with warm reset I've found is
that it must be guaranteed that copy engine
registers are not being accessed while being
reset. Otherwise in worst case scenario the host
may lock up.

Instead of using sleeps and hoping the device is
operational in some arbitrary timeframes use
firmware indication register.

As a side effect this makes driver
boot/stop/recovery faster.

Signed-off-by: Michal Kazior 
---

Notes:
v2:
 * fix kernel panic on early fw crash due to CE not being fully initialized 
[Janusz]

 drivers/net/wireless/ath/ath10k/pci.c | 110 +++---
 1 file changed, 48 insertions(+), 62 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index a8a3e1b..af36730 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -1717,89 +1717,75 @@ static void ath10k_pci_warm_reset_si0(struct ath10k *ar)
msleep(10);
 }
 
-static int ath10k_pci_warm_reset(struct ath10k *ar)
+static void ath10k_pci_warm_reset_cpu(struct ath10k *ar)
 {
u32 val;
 
-   ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot warm reset\n");
-
-   spin_lock_bh(&ar->data_lock);
-
-   ar->stats.fw_warm_reset_counter++;
-
-   spin_unlock_bh(&ar->data_lock);
-
-   /* debug */
-   val = ath10k_pci_read32(ar, SOC_CORE_BASE_ADDRESS +
-   PCIE_INTR_CAUSE_ADDRESS);
-   ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot host cpu intr cause: 0x%08x\n",
-  val);
-
-   val = ath10k_pci_read32(ar, SOC_CORE_BASE_ADDRESS +
-   CPU_INTR_ADDRESS);
-   ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot target cpu intr cause: 0x%08x\n",
-  val);
-
-   /* disable pending irqs */
-   ath10k_pci_write32(ar, SOC_CORE_BASE_ADDRESS +
-  PCIE_INTR_ENABLE_ADDRESS, 0);
-
-   ath10k_pci_write32(ar, SOC_CORE_BASE_ADDRESS +
-  PCIE_INTR_CLR_ADDRESS, ~0);
-
-   msleep(100);
-
-   /* clear fw indicator */
ath10k_pci_write32(ar, FW_INDICATOR_ADDRESS, 0);
 
-   /* clear target LF timer interrupts */
val = ath10k_pci_read32(ar, RTC_SOC_BASE_ADDRESS +
-   SOC_LF_TIMER_CONTROL0_ADDRESS);
-   ath10k_pci_write32(ar, RTC_SOC_BASE_ADDRESS +
-  SOC_LF_TIMER_CONTROL0_ADDRESS,
-  val & ~SOC_LF_TIMER_CONTROL0_ENABLE_MASK);
+   SOC_RESET_CONTROL_ADDRESS);
+   ath10k_pci_write32(ar, RTC_SOC_BASE_ADDRESS + SOC_RESET_CONTROL_ADDRESS,
+  val | SOC_RESET_CONTROL_CPU_WARM_RST_MASK);
+}
+
+static void ath10k_pci_warm_reset_ce(struct ath10k *ar)
+{
+   u32 val;
 
-   /* reset CE */
val = ath10k_pci_read32(ar, RTC_SOC_BASE_ADDRESS +
SOC_RESET_CONTROL_ADDRESS);
+
ath10k_pci_write32(ar, RTC_SOC_BASE_ADDRESS + SOC_RESET_CONTROL_ADDRESS,
   val | SOC_RESET_CONTROL_CE_RST_MASK);
-   val = ath10k_pci_read32(ar, RTC_SOC_BASE_ADDRESS +
-   SOC_RESET_CONTROL_ADDRESS);
msleep(10);
-
-   /* unreset CE */
ath10k_pci_write32(ar, RTC_SOC_BASE_ADDRESS + SOC_RESET_CONTROL_ADDRESS,
   val & ~SOC_RESET_CONTROL_CE_RST_MASK);
+}
+
+static void ath10k_pci_warm_reset_clear_lf(struct ath10k *ar)
+{
+   u32 val;
+
val = ath10k_pci_read32(ar, RTC_SOC_BASE_ADDRESS +
-   SOC_RESET_CONTROL_ADDRESS);
-   msleep(10);
+   SOC_LF_TIMER_CONTROL0_ADDRESS);
+   ath10k_pci_write32(ar, RTC_SOC_BASE_ADDRESS +
+  SOC_LF_TIMER_CONTROL0_ADDRESS,
+  val & ~SOC_LF_TIMER_CONTROL0_ENABLE_MASK);
+}
 
-   ath10k_pci_warm_reset_si0(ar);
+static int ath10k_pci_warm_reset(struct ath10k *ar)
+{
+   int ret;
+
+   ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot warm reset\n");
 
-   /* debug */
-   val = ath10k_pci_read32(ar, SOC_CORE_BASE_ADDRESS +
-   PCIE_INTR_CAUSE_ADDRESS);
-   ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot host cpu intr cause: 0x%08x\n",
-  val);
+   spin_lock_bh(&ar->data_lock);
+   ar->stats.fw_warm_reset_counter++;
+   spin_unlock_bh(&ar->data_lock);
 
-   val = ath10k_pci_read32(ar, SOC_CORE_BASE_ADDRESS +
-   CPU_INTR_ADDRESS);
-   ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot target cpu intr cause: 0x%08x\n",
-  val);
+   ath10k_pci_irq_disable(ar);
 
-   /* CPU warm reset */
-   val = ath10k_pci_read32(ar, RTC_SOC_BASE_ADDRESS +
-   SOC_RESET_CONTROL_ADDRESS);
-   ath10k_pci_write32(ar, RTC_SOC_BASE_ADDRESS + SOC_RESET_CONTROL_ADDRESS,
-  val | SOC_RESET_CONTROL_CPU_WARM_RST_MASK);
+   /* Make sure the target 

[PATCH v3 4/4] ath10k: don't reset chip on power_down

2014-10-28 Thread Michal Kazior
Currently hif_power_up performs effectively a
reset and hif_stop resets the chip as well so
there's no point in resetting here.

Signed-off-by: Michal Kazior 
---

Notes:
v2:
 * this patch replaces `replace power up/down with reset callback` [Kalle]

 drivers/net/wireless/ath/ath10k/pci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 117e14d..63f374ed 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -1919,7 +1919,9 @@ static void ath10k_pci_hif_power_down(struct ath10k *ar)
 {
ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot hif power down\n");
 
-   ath10k_pci_warm_reset(ar);
+   /* Currently hif_power_up performs effectively a reset and hif_stop
+* resets the chip as well so there's no point in resetting here.
+*/
 }
 
 #ifdef CONFIG_PM
-- 
1.8.5.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 v3 3/4] ath10k: split reset logic from power up

2014-10-28 Thread Michal Kazior
The power up procedure was overly complex due to
warm/cold reset workarounds and issues.

Signed-off-by: Michal Kazior 
---

Notes:
v2:
 * fix indentation [Kalle]

 drivers/net/wireless/ath/ath10k/pci.c | 151 ++
 1 file changed, 80 insertions(+), 71 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index af36730..117e14d 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -1792,10 +1792,86 @@ static int ath10k_pci_warm_reset(struct ath10k *ar)
return 0;
 }
 
-static int __ath10k_pci_hif_power_up(struct ath10k *ar, bool cold_reset)
+static int ath10k_pci_chip_reset(struct ath10k *ar)
+{
+   int i, ret;
+   u32 val;
+
+   ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot chip reset\n");
+
+   /* Some hardware revisions (e.g. CUS223v2) has issues with cold reset.
+* It is thus preferred to use warm reset which is safer but may not be
+* able to recover the device from all possible fail scenarios.
+*
+* Warm reset doesn't always work on first try so attempt it a few
+* times before giving up.
+*/
+   for (i = 0; i < ATH10K_PCI_NUM_WARM_RESET_ATTEMPTS; i++) {
+   ret = ath10k_pci_warm_reset(ar);
+   if (ret) {
+   ath10k_warn(ar, "failed to warm reset attempt %d of %d: 
%d\n",
+   i + 1, ATH10K_PCI_NUM_WARM_RESET_ATTEMPTS,
+   ret);
+   continue;
+   }
+
+   /* FIXME: Sometimes copy engine doesn't recover after warm
+* reset. In most cases this needs cold reset. In some of these
+* cases the device is in such a state that a cold reset may
+* lock up the host.
+*
+* Reading any host interest register via copy engine is
+* sufficient to verify if device is capable of booting
+* firmware blob.
+*/
+   ret = ath10k_pci_init_pipes(ar);
+   if (ret) {
+   ath10k_warn(ar, "failed to init copy engine: %d\n",
+   ret);
+   continue;
+   }
+
+   ret = ath10k_pci_diag_read32(ar, QCA988X_HOST_INTEREST_ADDRESS,
+&val);
+   if (ret) {
+   ath10k_warn(ar, "failed to poke copy engine: %d\n",
+   ret);
+   continue;
+   }
+
+   ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot chip reset complete 
(warm)\n");
+   return 0;
+   }
+
+   if (ath10k_pci_reset_mode == ATH10K_PCI_RESET_WARM_ONLY) {
+   ath10k_warn(ar, "refusing cold reset as requested\n");
+   return -EPERM;
+   }
+
+   ret = ath10k_pci_cold_reset(ar);
+   if (ret) {
+   ath10k_warn(ar, "failed to cold reset: %d\n", ret);
+   return ret;
+   }
+
+   ret = ath10k_pci_wait_for_target_init(ar);
+   if (ret) {
+   ath10k_warn(ar, "failed to wait for target after cold reset: 
%d\n",
+   ret);
+   return ret;
+   }
+
+   ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot chip reset complete (cold)\n");
+
+   return 0;
+}
+
+static int ath10k_pci_hif_power_up(struct ath10k *ar)
 {
int ret;
 
+   ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot hif power up\n");
+
/*
 * Bring the target up cleanly.
 *
@@ -1806,13 +1882,9 @@ static int __ath10k_pci_hif_power_up(struct ath10k *ar, 
bool cold_reset)
 * is in an unexpected state. We try to catch that here in order to
 * reset the Target and retry the probe.
 */
-   if (cold_reset)
-   ret = ath10k_pci_cold_reset(ar);
-   else
-   ret = ath10k_pci_warm_reset(ar);
-
+   ret = ath10k_pci_chip_reset(ar);
if (ret) {
-   ath10k_err(ar, "failed to reset target: %d\n", ret);
+   ath10k_err(ar, "failed to reset chip: %d\n", ret);
goto err;
}
 
@@ -1822,12 +1894,6 @@ static int __ath10k_pci_hif_power_up(struct ath10k *ar, 
bool cold_reset)
goto err;
}
 
-   ret = ath10k_pci_wait_for_target_init(ar);
-   if (ret) {
-   ath10k_err(ar, "failed to wait for target to init: %d\n", ret);
-   goto err_ce;
-   }
-
ret = ath10k_pci_init_config(ar);
if (ret) {
ath10k_err(ar, "failed to setup init config: %d\n", ret);
@@ -1844,68 +1910,11 @@ static int __ath10k_pci_hif_power_up(struct ath10k *ar, 
bool cold_reset)
 
 err_ce:
ath10k_pci_ce_deinit(ar);
-   ath10k_pci_warm_reset(ar);
-err:
-   return ret;
-}
-
-static int ath10k_pci_hif_powe

[PATCH v3 1/4] ath10k: change ce ring cleanup logic

2014-10-28 Thread Michal Kazior
Make ath10k_pci_init_pipes() effectively only
alter shared target-host data.

The per_transfer_context is a host-only thing.
It is necessary to preserve it's contents for a
more robust ring cleanup.

This is required for future warm reset fixes.

Signed-off-by: Michal Kazior 
---

Notes:
v3:
 * introduced to fix memleak - warm reset will
   reinit rings/pipes in the future so it was
   necessary to rework how clean up of CE rings is
   performed

 drivers/net/wireless/ath/ath10k/ce.c  |  6 ---
 drivers/net/wireless/ath/ath10k/pci.c | 82 ---
 2 files changed, 46 insertions(+), 42 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.c 
b/drivers/net/wireless/ath/ath10k/ce.c
index 9b89ac1..878e1ec 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -835,9 +835,6 @@ static int ath10k_ce_init_src_ring(struct ath10k *ar,
 
nentries = roundup_pow_of_two(attr->src_nentries);
 
-   memset(src_ring->per_transfer_context, 0,
-  nentries * sizeof(*src_ring->per_transfer_context));
-
src_ring->sw_index = ath10k_ce_src_ring_read_index_get(ar, ctrl_addr);
src_ring->sw_index &= src_ring->nentries_mask;
src_ring->hw_index = src_ring->sw_index;
@@ -872,9 +869,6 @@ static int ath10k_ce_init_dest_ring(struct ath10k *ar,
 
nentries = roundup_pow_of_two(attr->dest_nentries);
 
-   memset(dest_ring->per_transfer_context, 0,
-  nentries * sizeof(*dest_ring->per_transfer_context));
-
dest_ring->sw_index = ath10k_ce_dest_ring_read_index_get(ar, ctrl_addr);
dest_ring->sw_index &= dest_ring->nentries_mask;
dest_ring->write_index =
diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 4a4740b..a8a3e1b 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -1196,64 +1196,74 @@ static int ath10k_pci_hif_start(struct ath10k *ar)
return 0;
 }
 
-static void ath10k_pci_rx_pipe_cleanup(struct ath10k_pci_pipe *pipe_info)
+static void ath10k_pci_rx_pipe_cleanup(struct ath10k_pci_pipe *pci_pipe)
 {
struct ath10k *ar;
-   struct ath10k_pci *ar_pci;
-   struct ath10k_ce_pipe *ce_hdl;
-   u32 buf_sz;
-   struct sk_buff *netbuf;
-   u32 ce_data;
+   struct ath10k_ce_pipe *ce_pipe;
+   struct ath10k_ce_ring *ce_ring;
+   struct sk_buff *skb;
+   int i;
 
-   buf_sz = pipe_info->buf_sz;
+   ar = pci_pipe->hif_ce_state;
+   ce_pipe = pci_pipe->ce_hdl;
+   ce_ring = ce_pipe->dest_ring;
 
-   /* Unused Copy Engine */
-   if (buf_sz == 0)
+   if (!ce_ring)
return;
 
-   ar = pipe_info->hif_ce_state;
-   ar_pci = ath10k_pci_priv(ar);
-   ce_hdl = pipe_info->ce_hdl;
+   if (!pci_pipe->buf_sz)
+   return;
 
-   while (ath10k_ce_revoke_recv_next(ce_hdl, (void **)&netbuf,
- &ce_data) == 0) {
-   dma_unmap_single(ar->dev, ATH10K_SKB_CB(netbuf)->paddr,
-netbuf->len + skb_tailroom(netbuf),
+   for (i = 0; i < ce_ring->nentries; i++) {
+   skb = ce_ring->per_transfer_context[i];
+   if (!skb)
+   continue;
+
+   ce_ring->per_transfer_context[i] = NULL;
+
+   dma_unmap_single(ar->dev, ATH10K_SKB_CB(skb)->paddr,
+skb->len + skb_tailroom(skb),
 DMA_FROM_DEVICE);
-   dev_kfree_skb_any(netbuf);
+   dev_kfree_skb_any(skb);
}
 }
 
-static void ath10k_pci_tx_pipe_cleanup(struct ath10k_pci_pipe *pipe_info)
+static void ath10k_pci_tx_pipe_cleanup(struct ath10k_pci_pipe *pci_pipe)
 {
struct ath10k *ar;
struct ath10k_pci *ar_pci;
-   struct ath10k_ce_pipe *ce_hdl;
-   struct sk_buff *netbuf;
-   u32 ce_data;
-   unsigned int nbytes;
+   struct ath10k_ce_pipe *ce_pipe;
+   struct ath10k_ce_ring *ce_ring;
+   struct ce_desc *ce_desc;
+   struct sk_buff *skb;
unsigned int id;
-   u32 buf_sz;
+   int i;
 
-   buf_sz = pipe_info->buf_sz;
+   ar = pci_pipe->hif_ce_state;
+   ar_pci = ath10k_pci_priv(ar);
+   ce_pipe = pci_pipe->ce_hdl;
+   ce_ring = ce_pipe->src_ring;
 
-   /* Unused Copy Engine */
-   if (buf_sz == 0)
+   if (!ce_ring)
return;
 
-   ar = pipe_info->hif_ce_state;
-   ar_pci = ath10k_pci_priv(ar);
-   ce_hdl = pipe_info->ce_hdl;
+   if (!pci_pipe->buf_sz)
+   return;
 
-   while (ath10k_ce_cancel_send_next(ce_hdl, (void **)&netbuf,
- &ce_data, &nbytes, &id) == 0) {
-   /* no need to call tx completion for NULL pointers */
-   if (!netbuf)
+   ce_desc = ce_ring->shadow_base;
+   if (WARN_ON(!ce_des

[PATCH v3 0/4] ath10k: pci related fixes 2014-10-09

2014-10-28 Thread Michal Kazior
Hi,

This is a partial re-spin which includes the
not-yet-applied patches that fix/change warm
reset.

v3:
 * change CE ring cleanup (new patch #1)


Michal Kazior (4):
  ath10k: change ce ring cleanup logic
  ath10k: make warm reset a bit safer and faster
  ath10k: split reset logic from power up
  ath10k: don't reset chip on power_down

 drivers/net/wireless/ath/ath10k/ce.c  |   6 -
 drivers/net/wireless/ath/ath10k/pci.c | 345 +-
 2 files changed, 176 insertions(+), 175 deletions(-)

-- 
1.8.5.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] ath10k: avoid possible deadlock with scan timeout

2014-10-28 Thread Michal Kazior
This should prevent deadlock predicted by the
following splat:

 ==
 [ INFO: possible circular locking dependency detected ]
 3.17.0-wl-ath+ #67 Not tainted
 ---
 kworker/u32:1/7230 is trying to acquire lock:
  (&ar->conf_mutex){+.+.+.}, at: [] 
ath10k_scan_timeout_work+0x2d/0x50 [ath10k_core]

 but task is already holding lock:
  ((&(&ar->scan.timeout)->work)){+.+...}, at: [] 
process_one_work+0x151/0x470

 which lock already depends on the new lock.

 the existing dependency chain (in reverse order) is:

 -> #1 ((&(&ar->scan.timeout)->work)){+.+...}:
[] lock_acquire+0x85/0x100
[] flush_work+0x3d/0x270
[] __cancel_work_timer+0x7d/0x110
[] cancel_delayed_work_sync+0x13/0x20
[] ath10k_cancel_remain_on_channel+0x36/0x60 
[ath10k_core]
[] ieee80211_cancel_roc+0x1cc/0x2f0 [mac80211]
[] ieee80211_mgmt_tx_cancel_wait+0x22/0x30 [mac80211]
[] nl80211_tx_mgmt_cancel_wait+0xa8/0x130 [cfg80211]
[] genl_family_rcv_msg+0x1a5/0x3c0
[] genl_rcv_msg+0x89/0xc0
[] netlink_rcv_skb+0xb1/0xc0
[] genl_rcv+0x2c/0x40
[] netlink_unicast+0x18d/0x200
[] netlink_sendmsg+0x31d/0x430
[] sock_sendmsg+0x9c/0xd0
[] ___sys_sendmsg+0x389/0x3a0
[] __sys_sendmsg+0x49/0x90
[] SyS_sendmsg+0x12/0x20
[] system_call_fastpath+0x1a/0x1f

 -> #0 (&ar->conf_mutex){+.+.+.}:
[] __lock_acquire+0x1b6e/0x1ce0
[] lock_acquire+0x85/0x100
[] mutex_lock_nested+0x4b/0x370
[] ath10k_scan_timeout_work+0x2d/0x50 [ath10k_core]
[] process_one_work+0x1b1/0x470
[] worker_thread+0x123/0x460
[] kthread+0xe4/0x100
[] ret_from_fork+0x7c/0xb0

 other info that might help us debug this:

  Possible unsafe locking scenario:

CPU0CPU1

   lock((&(&ar->scan.timeout)->work));
lock(&ar->conf_mutex);
lock((&(&ar->scan.timeout)->work));
   lock(&ar->conf_mutex);

  *** DEADLOCK ***

Reported-by: Marek Puzyniak 
Signed-off-by: Michal Kazior 
---
 drivers/net/wireless/ath/ath10k/mac.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index a726107..a7236ea 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -3307,9 +3307,10 @@ static void ath10k_cancel_hw_scan(struct ieee80211_hw 
*hw,
struct ath10k *ar = hw->priv;
 
mutex_lock(&ar->conf_mutex);
-   cancel_delayed_work_sync(&ar->scan.timeout);
ath10k_scan_abort(ar);
mutex_unlock(&ar->conf_mutex);
+
+   cancel_delayed_work_sync(&ar->scan.timeout);
 }
 
 static void ath10k_set_key_h_def_keyidx(struct ath10k *ar,
@@ -3826,10 +3827,11 @@ static int ath10k_cancel_remain_on_channel(struct 
ieee80211_hw *hw)
struct ath10k *ar = hw->priv;
 
mutex_lock(&ar->conf_mutex);
-   cancel_delayed_work_sync(&ar->scan.timeout);
ath10k_scan_abort(ar);
mutex_unlock(&ar->conf_mutex);
 
+   cancel_delayed_work_sync(&ar->scan.timeout);
+
return 0;
 }
 
-- 
1.8.5.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: [patch] ipw2x00: shift wrap bugs setting ->rt_tsf

2014-10-28 Thread Stanislav Yakovlev
Hello, Joe,

On 24 October 2014 02:43, Joe Perches  wrote:
>
> struct ipw_rt_hdr {
> struct ieee80211_radiotap_header rt_hdr;
> u64 rt_tsf;  /* TSF */  /* XXX */
> u8 rt_flags;/* radiotap packet flags *
> u8 rt_rate; /* rate in 500kb/s */
> __le16 rt_channel;  /* channel in mhz */
> __le16 rt_chbitmask;/* channel bitfield */
> s8 rt_dbmsignal;/* signal in dbM, kluged to signed */
> s8 rt_dbmnoise;
> u8 rt_antenna;  /* antenna number */
> u8 payload[0];  /* payload... */
> } __packed;
>
> Maybe rt_tsf (which is otherwise unused in this code),
> should be __le64 so maybe use (u32) ?
>

Yes, you are right, the field definition should be __le64 as you
suggest. All values in radiotap header are specified in little endian
byte order according to the documentation at www.radiotap.org.

> ipw_rt->rt_txf = cpu_to_le64((u32)(frame->parent_tsf[3] << 24 |
>frame->parent_tsf[2] << 16 |
>frame->parent_tsf[1] << 8  |
>frame->parent_tsf[0]));
>

That looks fine for me. Will you send a patch?

Stanislav.
--
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] wireless-regdb: add regulatory rule for ETSI members on 60GHz band

2014-10-28 Thread Vladimir Kondratiev
On Monday, October 27, 2014 01:26:37 PM John W. Linville wrote:
> > On Tuesday, October 14, 2014 02:28:58 PM Xose Vazquez Perez wrote:
> 
> > > "(57240 - 65880 @ 2160), (40), NO-OUTDOOR" should(must) be replaced by:
> > > "(57000 - 66000 @ 2160), (40)"
> 
> Would someone like to post a patch to that effect?
> 
See below


>From 6bccae032be4c9f99cddfdf55ff781316cabe20d Mon Sep 17 00:00:00 2001
From: Vladimir Kondratiev 
Date: Tue, 28 Oct 2014 10:17:30 +0200
Subject: [PATCH] wireless-regdb: update 60GHz rules for EU

Comply to final document: Etsi En 302 567

Signed-off-by: Vladimir Kondratiev 
---
 db.txt | 76 +-
 1 file changed, 38 insertions(+), 38 deletions(-)

diff --git a/db.txt b/db.txt
index 8e83e0c..aef6d06 100644
--- a/db.txt
+++ b/db.txt
@@ -19,7 +19,7 @@ country 00:
 
 country AD:
# 60 gHz band channels 1-4, ref: Etsi En 302 567
-   (57240 - 65880 @ 2160), (40), NO-OUTDOOR
+   (57000 - 66000 @ 2160), (40)
 
 country AE: DFS-FCC
(2402 - 2482 @ 40), (20)
@@ -58,7 +58,7 @@ country AT: DFS-ETSI
(5250 - 5330 @ 80), (20), DFS
(5490 - 5710 @ 80), (27), DFS
# 60 gHz band channels 1-4, ref: Etsi En 302 567
-   (57240 - 65880 @ 2160), (40), NO-OUTDOOR
+   (57000 - 66000 @ 2160), (40)
 
 country AU:
(2402 - 2482 @ 40), (20)
@@ -84,7 +84,7 @@ country BA: DFS-ETSI
(5250 - 5330 @ 80), (20), DFS
(5490 - 5710 @ 80), (27), DFS
# 60 gHz band channels 1-4, ref: Etsi En 302 567
-   (57240 - 65880 @ 2160), (40), NO-OUTDOOR
+   (57000 - 66000 @ 2160), (40)
 
 country BB: DFS-FCC
(2402 - 2482 @ 40), (20)
@@ -102,14 +102,14 @@ country BE: DFS-ETSI
(5250 - 5330 @ 80), (20), DFS
(5490 - 5710 @ 80), (27), DFS
# 60 gHz band channels 1-4, ref: Etsi En 302 567
-   (57240 - 65880 @ 2160), (40), NO-OUTDOOR
+   (57000 - 66000 @ 2160), (40)
 
 country BG: DFS-ETSI
(2402 - 2482 @ 40), (20)
(5170 - 5250 @ 80), (20)
(5250 - 5330 @ 80), (20), DFS
# 60 gHz band channels 1-4, ref: Etsi En 302 567
-   (57240 - 65880 @ 2160), (40), NO-OUTDOOR
+   (57000 - 66000 @ 2160), (40)
 
 country BH: DFS-JP
(2402 - 2482 @ 40), (20)
@@ -162,7 +162,7 @@ country CH: DFS-ETSI
(5250 - 5330 @ 80), (20), DFS
(5490 - 5710 @ 80), (27), DFS
# 60 gHz band channels 1-4, ref: Etsi En 302 567
-   (57240 - 65880 @ 2160), (40), NO-OUTDOOR
+   (57000 - 66000 @ 2160), (40)
 
 country CL: DFS-JP
(2402 - 2482 @ 40), (20)
@@ -201,7 +201,7 @@ country CY: DFS-ETSI
(5250 - 5330 @ 80), (20), DFS
(5490 - 5710 @ 80), (27), DFS
# 60 gHz band channels 1-4, ref: Etsi En 302 567
-   (57240 - 65880 @ 2160), (40), NO-OUTDOOR
+   (57000 - 66000 @ 2160), (40)
 
 # Data from http://www.ctu.eu/164/download/VOR/VOR-12-08-2005-34.pdf
 # and http://www.ctu.eu/164/download/VOR/VOR-12-05-2007-6-AN.pdf
@@ -213,7 +213,7 @@ country CZ: DFS-ETSI
(5250 - 5350 @ 80), (100 mW), NO-OUTDOOR, DFS
(5470 - 5725 @ 80), (500 mW), DFS
# 60 gHz band channels 1-4, ref: Etsi En 302 567
-   (57240 - 65880 @ 2160), (40), NO-OUTDOOR
+   (57000 - 66000 @ 2160), (40)
 
 # Data from "Frequenznutzungsplan" (as published in April 2008), downloaded 
from
 # 
http://www.bundesnetzagentur.de/cae/servlet/contentblob/38448/publicationFile/2659/Frequenznutzungsplan2008_Id17448pdf.pdf
@@ -237,7 +237,7 @@ country DE: DFS-ETSI
# entries 308002, 309001 and 310003
(5470 - 5725 @ 80), (500 mW), DFS
# 60 gHz band channels 1-4, ref: Etsi En 302 567
-   (57240 - 65880 @ 2160), (40), NO-OUTDOOR
+   (57000 - 66000 @ 2160), (40)
 
 country DK: DFS-ETSI
(2402 - 2482 @ 40), (20)
@@ -245,7 +245,7 @@ country DK: DFS-ETSI
(5250 - 5330 @ 80), (20), DFS
(5490 - 5710 @ 80), (27), DFS
# 60 gHz band channels 1-4, ref: Etsi En 302 567
-   (57240 - 65880 @ 2160), (40), NO-OUTDOOR
+   (57000 - 66000 @ 2160), (40)
 
 country DO: DFS-FCC
(2402 - 2472 @ 40), (30)
@@ -272,7 +272,7 @@ country EE: DFS-ETSI
(5250 - 5330 @ 80), (20), DFS
(5490 - 5710 @ 80), (27), DFS
# 60 gHz band channels 1-4, ref: Etsi En 302 567
-   (57240 - 65880 @ 2160), (40), NO-OUTDOOR
+   (57000 - 66000 @ 2160), (40)
 
 country EG: DFS-ETSI
(2402 - 2482 @ 40), (20)
@@ -285,7 +285,7 @@ country ES: DFS-ETSI
(5250 - 5350 @ 80), (100 mW), NO-OUTDOOR, DFS
(5470 - 5725 @ 80), (500 mW), DFS
# 60 gHz band channels 1-4, ref: Etsi En 302 567
-   (57240 - 65880 @ 2160), (40), NO-OUTDOOR
+   (57000 - 66000 @ 2160), (40)
 
 country FI: DFS-ETSI
(2402 - 2482 @ 40), (20)
@@ -293,7 +293,7 @@ country FI: DFS-ETSI
(5250 - 5330 @ 80), (20), DFS
(5490 - 5710 @ 80), (27), DFS
# 60 gHz band channels 1-4, ref: Etsi En 302 567
-   (57240 - 65880 @ 2160), (40), NO-OUTDOOR
+

Re: [rt2x00-users] MediaTek Inc. MT7601U Wireless Adapter

2014-10-28 Thread poma
On 08.10.2014 11:53, Stanislaw Gruszka wrote:
> On Tue, Oct 07, 2014 at 05:12:47PM +0200, poma wrote:
>> BTW, pán Gruszka, when will these devices be supported as a part of the 
>> upstream Linux kernel?
> 
> I'm not an oracle :-)
> 
> Larry declared to work on some mt76xx chip support, I'm cc him.
> 
> I can also work on new chips for rt2x00, but wanted to finish some
> other work before.
> 
> Stanislaw 
> 

Even better pán Gruszka, MediaTek has spoken. :)
I hope that they really support further development here.


Toodooloo


--
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 v2 11/13] ath5k: revert AHB bus support removing

2014-10-28 Thread Sergey Ryazanov
2014-10-27 21:04 GMT+03:00 John W. Linville :
> On Wed, Oct 22, 2014 at 03:03:49AM +0400, Sergey Ryazanov wrote:
>> This reverts commit 093ec3c5337434f40d77c1af06c139da3e5ba6dc.
>>
>> AHB bus code has been removed, since we did not have support Atheros
>> AR231x SoC, required for building the AHB version of ath5k. Now that
>> support WiSoC chips added we can restore functionality back.
>>
>> Singed-off-by: Sergey Ryazanov 
>> Cc: Jiri Slaby 
>> Cc: Nick Kossifidis 
>> Cc: "Luis R. Rodriguez" 
>> Cc: linux-wireless@vger.kernel.org
>> Cc: ath5k-de...@lists.ath5k.org
>
> Acked-by: John W. Linville 
>
John, should I include these two patches in v3 or you already merge
them in your tree?

-- 
BR,
Sergey
--
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