[ANN] wireless-regdb: master-2015-01-30

2015-01-30 Thread Seth Forshee
A new release of wireless-regdb (master-2015-01-30) is available at:

https://www.kernel.org/pub/software/network/wireless-regdb/wireless-regdb-2015.01.30.tar.gz

Note that this is the first release signed with my key. As of yet there
is no release of CRDA which by default trusts a regulatory.bin signed
with my key, but in most cases it will still trust regulatory.bin by
virtue of having the corresponding public key installed in e.g.
/lib/crda/pubkeys.

The short log of changes included since the 2014-11-18 release is below.

Seth

---

Daiwei Li (1):
  wireless-regdb: Add back regulatory rules for US

Jouni Malinen (4):
  wireless-regdb: Disable VHT80 where 40/80 MHz on 5 GHz is not allowed
  wireless-regdb: Add regulatory rules for Nigeria (NG)
  wireless-regdb: Add regulatory rules for Samoa (WS)
  wireless-regdb: Add regulatory rules for Tanzania (TZ)

Seth Forshee (2):
  wireless-regdb: Update keys and maintainer information
  wireless-regdb: update regulatory.bin based on preceding changes

--
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 5/6] rtlwifi: btcoexist: Add routines for RTL8812AE kernel socket communications

2015-01-30 Thread Larry Finger

On 01/30/2015 03:57 AM, Marcel Holtmann wrote:

Marcel,


Hi Kalle,


I'm adding bluetooth list to the discussion. Full patch is available
here:

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

Larry Finger larry.fin...@lwfinger.net writes:


From: Troy Tan troy_...@realsil.com.cn

This patch adds the routines used to communicate between the RTL8812AE (wifi)
device and the RTL8761AU (bluetooth) device that are part of the same chip.
Unlike other similar dual-function devices, this chip does not contain special
hardware that lets the firmware pass coexistence info from one part to the
other. As a result, this driver implements such communication as a kernel
socket.

Signed-off-by: Troy Tan troy_...@realsil.com.cn
Signed-off-by: Larry Finger larry.fin...@lwfinger.net
---
V2 - Add comments explaining the routine that sends a message via the
socket.


The commit log is not still explaining that much about the actual
functionality, so I investigated on my own:


+static u8 rtl_btcoex_create_kernel_socket(struct rtl_priv *rtlpriv,
+ u8 is_invite)
+{
+   struct bt_coex_info *pcoex_info = rtlpriv-coex_info;
+   s8 kernel_socket_err;
+
+   BTC_PRINT(BTC_MSG_SOCKET, SOCKET_CRITICAL,
+ %s CONNECT_PORT %d\n, __func__, CONNECT_PORT);
+
+   if (!pcoex_info) {
+   BTC_PRINT(BTC_MSG_SOCKET, SOCKET_CRITICAL, coex_info: NULL\n);
+   return _FAIL;
+   }
+
+   kernel_socket_err = sock_create(PF_INET, SOCK_DGRAM, 0,
+   pcoex_info-udpsock);
+   BTC_PRINT(BTC_MSG_SOCKET, SOCKET_CRITICAL,
+ binding socket, err = %d\n, kernel_socket_err);
+
+   if (kernel_socket_err  0) {
+   BTC_PRINT(BTC_MSG_SOCKET, SOCKET_CRITICAL,
+ Error during creation of socket error:%d\n,
+ kernel_socket_err);
+   return _FAIL;
+   }
+   memset(pcoex_info-sin, 0, sizeof(pcoex_info-sin));
+   pcoex_info-sin.sin_family = AF_INET;
+   pcoex_info-sin.sin_port = htons(CONNECT_PORT);
+   pcoex_info-sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+
+   memset(pcoex_info-bt_addr, 0, sizeof(pcoex_info-bt_addr));
+   pcoex_info-bt_addr.sin_family = AF_INET;
+   pcoex_info-bt_addr.sin_port = htons(CONNECT_PORT_BT);
+   pcoex_info-bt_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+
+   pcoex_info-sk_store = NULL;
+
+   kernel_socket_err =
+  pcoex_info-udpsock-ops-bind(pcoex_info-udpsock,
+ (struct sockaddr *)pcoex_info-sin,
+ sizeof(pcoex_info-sin));
+   if (kernel_socket_err == 0) {
+   BTC_PRINT(BTC_MSG_SOCKET, SOCKET_CRITICAL,
+ binding socket success\n);
+   pcoex_info-udpsock-sk-sk_data_ready =
+   rtl_btcoex_recvmsg_int;
+   pcoex_info-sock_open |=  KERNEL_SOCKET_OK;
+   pcoex_info-bt_attend = false;
+   BTC_PRINT(BTC_MSG_SOCKET, SOCKET_CRITICAL,
+ WIFI sending attend_req\n);
+   rtl_btcoex_sendmsgbysocket(rtlpriv, attend_req,
+  sizeof(attend_req), true);
+   return _SUCCESS;


So the wireless driver communicates with the bluetooth driver (which is
not in upstream) via a localhost UDP connection?


I think the first order of business should be to get the Bluetooth driver 
upstream. Until that has happened this is all kinda pointless discussion.


I agree with this; however, the last time I tried to submit a BT driver for 
Realtek, I was told that this driver should use some (as yet included) feature. 
I have watched the driver development, and if that feature was ever included, it 
was in a form that I did not recognize. I'm sorry that this is vague, but this 
happened a long time ago.


--snip--


I know there's a general need for something similar like this, but it
needs to properly discussed and designed.


This is just insane. Clear NAK.

Two kernel modules will not use UDP ports over the loopback interface to 
communicate with each other.


I will work on combining the latest BT drivers from Realtek with btusb to see if 
I can achieve a patch that will both work with the Realtek hardware, and get 
approval from the reviewers.


What would be an approved method of communicating between two kernel modules? Is 
there some example in the kernel that I could study?


Larry


--
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 4/7] rtlwifi: Remove unused RTL_SUPPORTED_CTRL_FILTER define

2015-01-30 Thread Larry Finger

On 01/27/2015 12:49 AM, Priit Laes wrote:

Signed-off-by: Priit Laes pl...@plaes.org
---
  drivers/net/wireless/rtlwifi/core.h | 2 --
  1 file changed, 2 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/core.h 
b/drivers/net/wireless/rtlwifi/core.h
index 624e1dc..3b37557 100644
--- a/drivers/net/wireless/rtlwifi/core.h
+++ b/drivers/net/wireless/rtlwifi/core.h
@@ -33,8 +33,6 @@
FIF_FCSFAIL | \
FIF_BCN_PRBRESP_PROMISC)

-#define RTL_SUPPORTED_CTRL_FILTER  0xFF
-
  extern const struct ieee80211_ops rtl_ops;
  void rtl_fw_cb(const struct firmware *firmware, void *context);
  void rtl_addr_delay(u32 addr);


Priit,

I have a couple of points to make. First, when you submit a series of patches 
like this, it is customary to use the cover letter feature of git to generate a 
0/X patch in which to explain the set of patches. In this case, the cover letter 
is not necessary, but it is a good habit to cultivate.


The second point is more important. I'm not sure what source you used to 
generate your patches, but it was clearly not wireless-drivers-next. Commit 
6f8214b69057 (rtlwifi: Create new routine to initialize the DM tables) moved a 
lot of stuff from the individual drivers into the core. Some of the new stuff 
was included right after the definition of RTL_SUPPORTED_CTRL_FILTER, thus your 
patch fails to apply.


Once you fix this problem, and resubmit V2 of the series, I will approve them. 
FYI, Kalle prefers that all patches be resubmitted, not just the one that changes.



Larry


--
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/4] bcma: support bringing up bus hosted on PCIe Gen 2

2015-01-30 Thread Rafał Miłecki
Signed-off-by: Rafał Miłecki zaj...@gmail.com
---
 drivers/bcma/bcma_private.h|  3 +++
 drivers/bcma/driver_pcie2.c| 24 ++--
 drivers/bcma/host_pci.c|  2 +-
 include/linux/bcma/bcma_driver_pcie2.h |  2 ++
 4 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/drivers/bcma/bcma_private.h b/drivers/bcma/bcma_private.h
index 351f4af..3692912 100644
--- a/drivers/bcma/bcma_private.h
+++ b/drivers/bcma/bcma_private.h
@@ -104,6 +104,9 @@ u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address);
 void bcma_core_pci_up(struct bcma_drv_pci *pc);
 void bcma_core_pci_down(struct bcma_drv_pci *pc);
 
+/* driver_pcie2.c */
+void bcma_core_pcie2_up(struct bcma_drv_pcie2 *pcie2);
+
 extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc);
 
 #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE
diff --git a/drivers/bcma/driver_pcie2.c b/drivers/bcma/driver_pcie2.c
index e4be537..c8913bc 100644
--- a/drivers/bcma/driver_pcie2.c
+++ b/drivers/bcma/driver_pcie2.c
@@ -156,14 +156,20 @@ static void pciedev_reg_pm_clk_period(struct 
bcma_drv_pcie2 *pcie2)
 
 void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2)
 {
-   struct bcma_chipinfo *ci = pcie2-core-bus-chipinfo;
+   struct bcma_bus *bus = pcie2-core-bus;
+   struct bcma_chipinfo *ci = bus-chipinfo;
u32 tmp;
 
tmp = pcie2_read32(pcie2, BCMA_CORE_PCIE2_SPROM(54));
if ((tmp  0xe)  1 == 2)
bcma_core_pcie2_cfg_write(pcie2, 0x4e0, 0x17);
 
-   /* TODO: Do we need pcie_reqsize? */
+   switch (bus-chipinfo.id) {
+   case BCMA_CHIP_ID_BCM4360:
+   case BCMA_CHIP_ID_BCM4352:
+   pcie2-reqsize = 0x3000; /* TODO: PCI_EXP_DEVCTL_READRQ_1024B */
+   break;
+   }
 
if (ci-id == BCMA_CHIP_ID_BCM4360  ci-rev  3)
bcma_core_pcie2_war_delay_perst_enab(pcie2, true);
@@ -173,3 +179,17 @@ void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2)
pciedev_crwlpciegen2_180(pcie2);
pciedev_crwlpciegen2_182(pcie2);
 }
+
+/**
+ * Runtime ops.
+ **/
+
+void bcma_core_pcie2_up(struct bcma_drv_pcie2 *pcie2)
+{
+   struct bcma_bus *bus = pcie2-core-bus;
+   struct pci_dev *dev = bus-host_pci;
+
+   pcie_capability_clear_and_set_word(dev, PCI_EXP_DEVCTL,
+  PCI_EXP_DEVCTL_READRQ,
+  pcie2-reqsize);
+}
diff --git a/drivers/bcma/host_pci.c b/drivers/bcma/host_pci.c
index 8dd37dc..5fb87a8 100644
--- a/drivers/bcma/host_pci.c
+++ b/drivers/bcma/host_pci.c
@@ -322,7 +322,7 @@ void bcma_host_pci_up(struct bcma_bus *bus)
return;
 
if (bus-host_is_pcie2)
-   pr_warn(Bringing up bus with PCIe Gen 2 host is unsupported 
yet\n);
+   bcma_core_pcie2_up(bus-drv_pcie2);
else
bcma_core_pci_up(bus-drv_pci[0]);
 }
diff --git a/include/linux/bcma/bcma_driver_pcie2.h 
b/include/linux/bcma/bcma_driver_pcie2.h
index 5988b05..d8c4329 100644
--- a/include/linux/bcma/bcma_driver_pcie2.h
+++ b/include/linux/bcma/bcma_driver_pcie2.h
@@ -143,6 +143,8 @@
 
 struct bcma_drv_pcie2 {
struct bcma_device *core;
+
+   u16 reqsize;
 };
 
 #define pcie2_read16(pcie2, offset)bcma_read16((pcie2)-core, 
offset)
-- 
1.8.4.5

--
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/4] bcma: change IRQ control function to accept bus as an argument

2015-01-30 Thread Rafał Miłecki
It doesn't operate on PCI core, but PCI host device, so there is no
point of passing core related struct.

Signed-off-by: Rafał Miłecki zaj...@gmail.com
---
 drivers/bcma/driver_pci.c  | 6 +++---
 drivers/net/wireless/b43/main.c| 2 +-
 drivers/net/wireless/brcm80211/brcmsmac/main.c | 2 +-
 include/linux/bcma/bcma_driver_pci.h   | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/bcma/driver_pci.c b/drivers/bcma/driver_pci.c
index cf92bfa..cfd35bc 100644
--- a/drivers/bcma/driver_pci.c
+++ b/drivers/bcma/driver_pci.c
@@ -282,21 +282,21 @@ void bcma_core_pci_power_save(struct bcma_bus *bus, bool 
up)
 }
 EXPORT_SYMBOL_GPL(bcma_core_pci_power_save);
 
-int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, struct bcma_device *core,
+int bcma_core_pci_irq_ctl(struct bcma_bus *bus, struct bcma_device *core,
  bool enable)
 {
struct pci_dev *pdev;
u32 coremask, tmp;
int err = 0;
 
-   if (!pc || core-bus-hosttype != BCMA_HOSTTYPE_PCI) {
+   if (bus-hosttype != BCMA_HOSTTYPE_PCI) {
/* This bcma device is not on a PCI host-bus. So the IRQs are
 * not routed through the PCI core.
 * So we must not enable routing through the PCI core. */
goto out;
}
 
-   pdev = pc-core-bus-host_pci;
+   pdev = bus-host_pci;
 
err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, tmp);
if (err)
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index e129b4c..44794d2 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -4866,7 +4866,7 @@ static int b43_wireless_core_init(struct b43_wldev *dev)
switch (dev-dev-bus_type) {
 #ifdef CONFIG_B43_BCMA
case B43_BUS_BCMA:
-   bcma_core_pci_irq_ctl(dev-dev-bdev-bus-drv_pci[0],
+   bcma_core_pci_irq_ctl(dev-dev-bdev-bus,
  dev-dev-bdev, true);
bcma_host_pci_up(dev-dev-bdev-bus);
break;
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c 
b/drivers/net/wireless/brcm80211/brcmsmac/main.c
index bcbfc6e..c84af1d 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -4959,7 +4959,7 @@ static int brcms_b_up_prep(struct brcms_hardware *wlc_hw)
 * Configure pci/pcmcia here instead of in brcms_c_attach()
 * to allow mfg hotswap:  down, hotswap (chip power cycle), up.
 */
-   bcma_core_pci_irq_ctl(wlc_hw-d11core-bus-drv_pci[0], 
wlc_hw-d11core,
+   bcma_core_pci_irq_ctl(wlc_hw-d11core-bus, wlc_hw-d11core,
  true);
 
/*
diff --git a/include/linux/bcma/bcma_driver_pci.h 
b/include/linux/bcma/bcma_driver_pci.h
index 23af893..6b8bca6 100644
--- a/include/linux/bcma/bcma_driver_pci.h
+++ b/include/linux/bcma/bcma_driver_pci.h
@@ -240,7 +240,7 @@ struct bcma_drv_pci {
 
 extern void bcma_core_pci_early_init(struct bcma_drv_pci *pc);
 extern void bcma_core_pci_init(struct bcma_drv_pci *pc);
-extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc,
+extern int bcma_core_pci_irq_ctl(struct bcma_bus *bus,
 struct bcma_device *core, bool enable);
 extern void bcma_core_pci_power_save(struct bcma_bus *bus, bool up);
 
-- 
1.8.4.5

--
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 4/4] bcma: enable support for PCIe Gen 2 host devices

2015-01-30 Thread Rafał Miłecki
Signed-off-by: Rafał Miłecki zaj...@gmail.com
---
 drivers/bcma/bcma_private.h |  1 +
 drivers/bcma/host_pci.c | 15 ++-
 drivers/bcma/main.c |  2 +-
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/bcma/bcma_private.h b/drivers/bcma/bcma_private.h
index 3692912..29565e3 100644
--- a/drivers/bcma/bcma_private.h
+++ b/drivers/bcma/bcma_private.h
@@ -26,6 +26,7 @@ bool bcma_wait_value(struct bcma_device *core, u16 reg, u32 
mask, u32 value,
 int timeout);
 void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core);
 void bcma_init_bus(struct bcma_bus *bus);
+void bcma_unregister_cores(struct bcma_bus *bus);
 int bcma_bus_register(struct bcma_bus *bus);
 void bcma_bus_unregister(struct bcma_bus *bus);
 int __init bcma_bus_early_register(struct bcma_bus *bus);
diff --git a/drivers/bcma/host_pci.c b/drivers/bcma/host_pci.c
index 5fb87a8..a62a2f9 100644
--- a/drivers/bcma/host_pci.c
+++ b/drivers/bcma/host_pci.c
@@ -213,16 +213,26 @@ static int bcma_host_pci_probe(struct pci_dev *dev,
/* Initialize struct, detect chip */
bcma_init_bus(bus);
 
+   /* Scan bus to find out generation of PCIe core */
+   err = bcma_bus_scan(bus);
+   if (err)
+   goto err_pci_unmap_mmio;
+
+   if (bcma_find_core(bus, BCMA_CORE_PCIE2))
+   bus-host_is_pcie2 = true;
+
/* Register */
err = bcma_bus_register(bus);
if (err)
-   goto err_pci_unmap_mmio;
+   goto err_unregister_cores;
 
pci_set_drvdata(dev, bus);
 
 out:
return err;
 
+err_unregister_cores:
+   bcma_unregister_cores(bus);
 err_pci_unmap_mmio:
pci_iounmap(dev, bus-mmio);
 err_pci_release_regions:
@@ -283,9 +293,12 @@ static const struct pci_device_id bcma_pci_bridge_tbl[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4357) },
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4358) },
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4359) },
+   { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4360) },
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4365) },
+   { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a0) },
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a9) },
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) },
+   { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43b1) },
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) },
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43227) },  /* 0xa8db, BCM43217 
(sic!) */
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43228) },  /* 0xa8dc */
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
index 38bde6e..9635f10 100644
--- a/drivers/bcma/main.c
+++ b/drivers/bcma/main.c
@@ -363,7 +363,7 @@ static int bcma_register_devices(struct bcma_bus *bus)
return 0;
 }
 
-static void bcma_unregister_cores(struct bcma_bus *bus)
+void bcma_unregister_cores(struct bcma_bus *bus)
 {
struct bcma_device *core, *tmp;
 
-- 
1.8.4.5

--
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/4] bcma: add helpers bringing PCIe hosted bus up / down

2015-01-30 Thread Rafał Miłecki
Bringing PCIe hosted bus up requires operating on host-related core.
Since we plan to support PCIe Gen 2 devices we should provide a helper
picking the correct one (PCIE or PCIE2).

Signed-off-by: Rafał Miłecki zaj...@gmail.com
---
 drivers/bcma/bcma_private.h|  2 ++
 drivers/bcma/driver_pci.c  | 20 ++
 drivers/bcma/host_pci.c| 28 ++
 drivers/net/wireless/b43/main.c|  4 ++--
 drivers/net/wireless/brcm80211/brcmsmac/main.c |  8 
 include/linux/bcma/bcma.h  |  3 +++
 include/linux/bcma/bcma_driver_pci.h   |  2 --
 7 files changed, 41 insertions(+), 26 deletions(-)

diff --git a/drivers/bcma/bcma_private.h b/drivers/bcma/bcma_private.h
index ac6c5fc..351f4af 100644
--- a/drivers/bcma/bcma_private.h
+++ b/drivers/bcma/bcma_private.h
@@ -101,6 +101,8 @@ static inline void __exit 
bcma_host_soc_unregister_driver(void)
 
 /* driver_pci.c */
 u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address);
+void bcma_core_pci_up(struct bcma_drv_pci *pc);
+void bcma_core_pci_down(struct bcma_drv_pci *pc);
 
 extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc);
 
diff --git a/drivers/bcma/driver_pci.c b/drivers/bcma/driver_pci.c
index 784..cf92bfa 100644
--- a/drivers/bcma/driver_pci.c
+++ b/drivers/bcma/driver_pci.c
@@ -328,28 +328,12 @@ static void bcma_core_pci_extend_L1timer(struct 
bcma_drv_pci *pc, bool extend)
bcma_pcie_read(pc, BCMA_CORE_PCI_DLLP_PMTHRESHREG);
 }
 
-void bcma_core_pci_up(struct bcma_bus *bus)
+void bcma_core_pci_up(struct bcma_drv_pci *pc)
 {
-   struct bcma_drv_pci *pc;
-
-   if (bus-hosttype != BCMA_HOSTTYPE_PCI)
-   return;
-
-   pc = bus-drv_pci[0];
-
bcma_core_pci_extend_L1timer(pc, true);
 }
-EXPORT_SYMBOL_GPL(bcma_core_pci_up);
 
-void bcma_core_pci_down(struct bcma_bus *bus)
+void bcma_core_pci_down(struct bcma_drv_pci *pc)
 {
-   struct bcma_drv_pci *pc;
-
-   if (bus-hosttype != BCMA_HOSTTYPE_PCI)
-   return;
-
-   pc = bus-drv_pci[0];
-
bcma_core_pci_extend_L1timer(pc, false);
 }
-EXPORT_SYMBOL_GPL(bcma_core_pci_down);
diff --git a/drivers/bcma/host_pci.c b/drivers/bcma/host_pci.c
index 53c6a8a..8dd37dc 100644
--- a/drivers/bcma/host_pci.c
+++ b/drivers/bcma/host_pci.c
@@ -310,3 +310,31 @@ void __exit bcma_host_pci_exit(void)
 {
pci_unregister_driver(bcma_pci_bridge_driver);
 }
+
+/**
+ * Runtime ops for drivers.
+ **/
+
+/* See also pcicore_up */
+void bcma_host_pci_up(struct bcma_bus *bus)
+{
+   if (bus-hosttype != BCMA_HOSTTYPE_PCI)
+   return;
+
+   if (bus-host_is_pcie2)
+   pr_warn(Bringing up bus with PCIe Gen 2 host is unsupported 
yet\n);
+   else
+   bcma_core_pci_up(bus-drv_pci[0]);
+}
+EXPORT_SYMBOL_GPL(bcma_host_pci_up);
+
+/* See also pcicore_down */
+void bcma_host_pci_down(struct bcma_bus *bus)
+{
+   if (bus-hosttype != BCMA_HOSTTYPE_PCI)
+   return;
+
+   if (!bus-host_is_pcie2)
+   bcma_core_pci_down(bus-drv_pci[0]);
+}
+EXPORT_SYMBOL_GPL(bcma_host_pci_down);
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 2c90886..e129b4c 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -4819,7 +4819,7 @@ static void b43_wireless_core_exit(struct b43_wldev *dev)
switch (dev-dev-bus_type) {
 #ifdef CONFIG_B43_BCMA
case B43_BUS_BCMA:
-   bcma_core_pci_down(dev-dev-bdev-bus);
+   bcma_host_pci_down(dev-dev-bdev-bus);
break;
 #endif
 #ifdef CONFIG_B43_SSB
@@ -4868,7 +4868,7 @@ static int b43_wireless_core_init(struct b43_wldev *dev)
case B43_BUS_BCMA:
bcma_core_pci_irq_ctl(dev-dev-bdev-bus-drv_pci[0],
  dev-dev-bdev, true);
-   bcma_core_pci_up(dev-dev-bdev-bus);
+   bcma_host_pci_up(dev-dev-bdev-bus);
break;
 #endif
 #ifdef CONFIG_B43_SSB
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c 
b/drivers/net/wireless/brcm80211/brcmsmac/main.c
index eb8584a..bcbfc6e 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -4668,7 +4668,7 @@ static int brcms_b_attach(struct brcms_c_info *wlc, 
struct bcma_device *core,
brcms_c_coredisable(wlc_hw);
 
/* Match driver down state */
-   bcma_core_pci_down(wlc_hw-d11core-bus);
+   bcma_host_pci_down(wlc_hw-d11core-bus);
 
/* turn off pll and xtal to match driver down state */
brcms_b_xtal(wlc_hw, OFF);
@@ -4969,12 +4969,12 @@ static int brcms_b_up_prep(struct brcms_hardware 
*wlc_hw)
 */
if (brcms_b_radio_read_hwdisabled(wlc_hw)) {
/* put SB PCI in down state 

Re: brcmfmac: brcmf_sdio_htclk: HT Avail timeout on Thinkpad Tablet 10

2015-01-30 Thread Sebastien Bourdeauducq

On Friday, January 30, 2015 10:40 PM, Arend van Spriel wrote:

I'm running kernel 3.18.4, my brcmfmac43241b4-sdio.bin is identical to
the one in the linux-firmware repository, and I have attached the
brcmfmac43241b4-sdio.txt that I have extracted from the EFI variables.


When you say your firmware is identical what does that mean.


It is exactly this file (diff reports same content):

https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/plain/brcm/brcmfmac43241b4-sdio.bin

Sebastien
--
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 3/4] bcma: support bringing up bus hosted on PCIe Gen 2

2015-01-30 Thread Hauke Mehrtens


On 01/30/2015 06:22 PM, Rafał Miłecki wrote:
 Signed-off-by: Rafał Miłecki zaj...@gmail.com
 ---
  drivers/bcma/bcma_private.h|  3 +++
  drivers/bcma/driver_pcie2.c| 24 ++--
  drivers/bcma/host_pci.c|  2 +-
  include/linux/bcma/bcma_driver_pcie2.h |  2 ++
  4 files changed, 28 insertions(+), 3 deletions(-)
 
 diff --git a/drivers/bcma/bcma_private.h b/drivers/bcma/bcma_private.h
 index 351f4af..3692912 100644
 --- a/drivers/bcma/bcma_private.h
 +++ b/drivers/bcma/bcma_private.h
 @@ -104,6 +104,9 @@ u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address);
  void bcma_core_pci_up(struct bcma_drv_pci *pc);
  void bcma_core_pci_down(struct bcma_drv_pci *pc);
  
 +/* driver_pcie2.c */
 +void bcma_core_pcie2_up(struct bcma_drv_pcie2 *pcie2);
 +
  extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc);
  
  #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE
 diff --git a/drivers/bcma/driver_pcie2.c b/drivers/bcma/driver_pcie2.c
 index e4be537..c8913bc 100644
 --- a/drivers/bcma/driver_pcie2.c
 +++ b/drivers/bcma/driver_pcie2.c
 @@ -156,14 +156,20 @@ static void pciedev_reg_pm_clk_period(struct 
 bcma_drv_pcie2 *pcie2)
  
  void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2)
  {
 - struct bcma_chipinfo *ci = pcie2-core-bus-chipinfo;
 + struct bcma_bus *bus = pcie2-core-bus;
 + struct bcma_chipinfo *ci = bus-chipinfo;
   u32 tmp;
  
   tmp = pcie2_read32(pcie2, BCMA_CORE_PCIE2_SPROM(54));
   if ((tmp  0xe)  1 == 2)
   bcma_core_pcie2_cfg_write(pcie2, 0x4e0, 0x17);
  
 - /* TODO: Do we need pcie_reqsize? */
 + switch (bus-chipinfo.id) {
 + case BCMA_CHIP_ID_BCM4360:
 + case BCMA_CHIP_ID_BCM4352:
 + pcie2-reqsize = 0x3000; /* TODO: PCI_EXP_DEVCTL_READRQ_1024B */
 + break;
 + }

In the PCIe controller used in the BCM4706 there was a bug, so that it
did not support a request size bigger than 128 bytes. Broadcom fixed
that in the PCIe device driver code by decreasing the value, but we
fixed that in the PCIe controller code, see:

commit f4a83e578e0011ddcfdbe1c62d0916dadb4802aa
Author: Hauke Mehrtens ha...@hauke-m.de
Date:   Fri Aug 23 23:22:29 2013 +0200

bcma: change max PCI read request size to 128

It could be that the PCIe controller used on ARM SoCs has similar
problems but supports bigger sizes now, but not so big ones.

This is just an assumption.

What is the default value for pcie2-reqsize?

  
   if (ci-id == BCMA_CHIP_ID_BCM4360  ci-rev  3)
   bcma_core_pcie2_war_delay_perst_enab(pcie2, true);
 @@ -173,3 +179,17 @@ void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2)
   pciedev_crwlpciegen2_180(pcie2);
   pciedev_crwlpciegen2_182(pcie2);
  }
 +
 +/**
 + * Runtime ops.
 + **/
 +
 +void bcma_core_pcie2_up(struct bcma_drv_pcie2 *pcie2)
 +{
 + struct bcma_bus *bus = pcie2-core-bus;
 + struct pci_dev *dev = bus-host_pci;
 +
 + pcie_capability_clear_and_set_word(dev, PCI_EXP_DEVCTL,
 +PCI_EXP_DEVCTL_READRQ,
 +pcie2-reqsize);

Use pcie_set_readrq() if it is needed.

 +}
 diff --git a/drivers/bcma/host_pci.c b/drivers/bcma/host_pci.c
 index 8dd37dc..5fb87a8 100644
 --- a/drivers/bcma/host_pci.c
 +++ b/drivers/bcma/host_pci.c
 @@ -322,7 +322,7 @@ void bcma_host_pci_up(struct bcma_bus *bus)
   return;
  
   if (bus-host_is_pcie2)
 - pr_warn(Bringing up bus with PCIe Gen 2 host is unsupported 
 yet\n);
 + bcma_core_pcie2_up(bus-drv_pcie2);
   else
   bcma_core_pci_up(bus-drv_pci[0]);
  }
 diff --git a/include/linux/bcma/bcma_driver_pcie2.h 
 b/include/linux/bcma/bcma_driver_pcie2.h
 index 5988b05..d8c4329 100644
 --- a/include/linux/bcma/bcma_driver_pcie2.h
 +++ b/include/linux/bcma/bcma_driver_pcie2.h
 @@ -143,6 +143,8 @@
  
  struct bcma_drv_pcie2 {
   struct bcma_device *core;
 +
 + u16 reqsize;
  };
  
  #define pcie2_read16(pcie2, offset)  bcma_read16((pcie2)-core, 
 offset)
 
--
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: Replace ioread with wmb for data sync

2015-01-30 Thread Peter Oh

Hi,

On 01/27/2015 11:37 PM, Johannes Berg wrote:

On Tue, 2015-01-27 at 21:39 -0800, Peter Oh wrote:


Ok, sure, but I/O ordering two different writes, and ensuring device
has seen a posted write, are related but different things, no?

yes, they are different and wmb guarantees both.

No, wmb() doesn't. I'd be very surprised if it had any side effect on
the PCI bus even on ARM. Read Documentation/memory-barriers.txt.

And to understand (PCI) posted writes, wikipedia helps:
http://en.wikipedia.org/wiki/Posted_write
I admit that I/O ordering and posted write are looked different in 
theory and at glance since posted write could be related cache invalidate.

But wmb are still related to both.
As I addressed wmb uses dsb (in arm arch) and here is the description of 
arm architecture.


* DSB drains write buffer.
* DSB is architecturally defined to include all cache, TLB and branch 
prediction maintenance operations as well as explicit memory operations


These are the reasons why I mentioned wmb does both.

* captured from ARMv7 Architecture Manual
--- Notes ---
Historically, this operation was referred to as Drain Write Buffer or 
Data Write Barrier (DWB). From ARMv6, these
names and the use of DWB were deprecated in favor of the new Data 
Synchronization Barrier name and DSB
abbreviation. DSB better reflects the functionality provided from ARMv6, 
because DSB is architecturally defined
to include all cache, TLB and branch prediction maintenance operations 
as well as explicit memory operations


--- A DSB completes when: ---
? all explicit memory accesses that are observed by Pe before the DSB is 
executed, are of the required access
types, and are from observers in the same required shareability domain 
as Pe, are complete for the set of

observers in the required shareability domain.
? if the required accesses types of the DSB is reads and writes, all 
cache and branch predictor maintenance
operations issued by Pe before the DSB are complete for the required 
shareability domain.
? if the required accesses types of the DSB is reads and writes, all TLB 
maintenance operations issued by Pe

before the DSB are complete for the required shareability domain.
--

Furthermore this is the comparison of the compiled assembly code between 
ath10k_pci_read32 and wmb.


ath10k_pci_read32()
 bac:e5932008 ldrr2, [r3, #8]
 bb0:f57ff04f dsbsy
 bb4:e2883d52 addr3, r8, #5248; 0x1480
 bb8:e283303c addr3, r3, #60; 0x3c
 bbc:e593300c ldrr3, [r3, #12]
 bc0:e2833a09 addr3, r3, #36864; 0x9000

wmb();
 b9c:f57ff04e dsbst

ath10k_pci_read32 does register operation except dsb and there is no 
cache invalidate related commands.


So that if wmb is not enough for the purpose then ath10k_pci_read32 is 
also not enough for that.


Also refer the section ACQUIRES VS I/O ACCESSES in memory-barriers.txt.

It gives an example with PCI bridge and introduces readl as an 
alternative method to mmiowb which weaker form of wmb.


Please give your opinion.

johannes


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

Regards,
Peter
--
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 3/4] bcma: support bringing up bus hosted on PCIe Gen 2

2015-01-30 Thread Rafał Miłecki
On 30 January 2015 at 20:59, Hauke Mehrtens ha...@hauke-m.de wrote:
 On 01/30/2015 06:22 PM, Rafał Miłecki wrote:
 Signed-off-by: Rafał Miłecki zaj...@gmail.com
 ---
  drivers/bcma/bcma_private.h|  3 +++
  drivers/bcma/driver_pcie2.c| 24 ++--
  drivers/bcma/host_pci.c|  2 +-
  include/linux/bcma/bcma_driver_pcie2.h |  2 ++
  4 files changed, 28 insertions(+), 3 deletions(-)

 diff --git a/drivers/bcma/bcma_private.h b/drivers/bcma/bcma_private.h
 index 351f4af..3692912 100644
 --- a/drivers/bcma/bcma_private.h
 +++ b/drivers/bcma/bcma_private.h
 @@ -104,6 +104,9 @@ u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address);
  void bcma_core_pci_up(struct bcma_drv_pci *pc);
  void bcma_core_pci_down(struct bcma_drv_pci *pc);

 +/* driver_pcie2.c */
 +void bcma_core_pcie2_up(struct bcma_drv_pcie2 *pcie2);
 +
  extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc);

  #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE
 diff --git a/drivers/bcma/driver_pcie2.c b/drivers/bcma/driver_pcie2.c
 index e4be537..c8913bc 100644
 --- a/drivers/bcma/driver_pcie2.c
 +++ b/drivers/bcma/driver_pcie2.c
 @@ -156,14 +156,20 @@ static void pciedev_reg_pm_clk_period(struct 
 bcma_drv_pcie2 *pcie2)

  void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2)
  {
 - struct bcma_chipinfo *ci = pcie2-core-bus-chipinfo;
 + struct bcma_bus *bus = pcie2-core-bus;
 + struct bcma_chipinfo *ci = bus-chipinfo;
   u32 tmp;

   tmp = pcie2_read32(pcie2, BCMA_CORE_PCIE2_SPROM(54));
   if ((tmp  0xe)  1 == 2)
   bcma_core_pcie2_cfg_write(pcie2, 0x4e0, 0x17);

 - /* TODO: Do we need pcie_reqsize? */
 + switch (bus-chipinfo.id) {
 + case BCMA_CHIP_ID_BCM4360:
 + case BCMA_CHIP_ID_BCM4352:
 + pcie2-reqsize = 0x3000; /* TODO: PCI_EXP_DEVCTL_READRQ_1024B 
 */
 + break;
 + }

 In the PCIe controller used in the BCM4706 there was a bug, so that it
 did not support a request size bigger than 128 bytes. Broadcom fixed
 that in the PCIe device driver code by decreasing the value, but we
 fixed that in the PCIe controller code, see:

 commit f4a83e578e0011ddcfdbe1c62d0916dadb4802aa
 Author: Hauke Mehrtens ha...@hauke-m.de
 Date:   Fri Aug 23 23:22:29 2013 +0200

 bcma: change max PCI read request size to 128

 It could be that the PCIe controller used on ARM SoCs has similar
 problems but supports bigger sizes now, but not so big ones.

Thanks for your comment! It seems indeed that Broadcom's shared code
provides function called si_pcie_set_request_size
My guess is that wl.ko has to contain something like
if (BCM4331)
si_pcie_set_request_size(sih, 128);

So the question is: does wl.ko contain similar code for
BCM4352/BCM4360. It appears that wl.ko (at least for x86_64) uses
system calls for PCI R/W. So I've put debugging messages and there is
what I got:
[  235.036193] [pci_bus_read_config_dword]  pos:180 data:0x00102C10
[  235.036195] [pci_bus_write_config_dword] pos:180 value:0x00103C10
[  235.036199] [pci_bus_read_config_dword]  pos:180 data:0x00103C10
As you can see PCI_EXP_DEVCTL_READRQ has been changed from
boot-default 512B to default 1024B. It appears that wl.ko didn't call
si_pcie_set_request_size for my 14e4:43b1 BCM4352.

Of course it may be different for non x86_64 architectures, but I
can't say it at this point.

So the proposed code seems OK to me, we may need to modify it in the
future for some SoCs, but we can't say that right now.


 What is the default value for pcie2-reqsize?

0x which is 128B.


 +void bcma_core_pcie2_up(struct bcma_drv_pcie2 *pcie2)
 +{
 + struct bcma_bus *bus = pcie2-core-bus;
 + struct pci_dev *dev = bus-host_pci;
 +
 + pcie_capability_clear_and_set_word(dev, PCI_EXP_DEVCTL,
 +PCI_EXP_DEVCTL_READRQ,
 +pcie2-reqsize);

 Use pcie_set_readrq() if it is needed.

What do you mean by if needed? Is there anything wrong?

-- 
Rafał
--
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: cfg80211: Unknown symbol get_net_ns_by_fd (err 0)

2015-01-30 Thread Arend van Spriel

On 01/26/15 21:44, Arend van Spriel wrote:

Hi Hauke,

The commit below causes the error mentioned in the Subject: field. I
would like to fix this, but could use a bit of help here how to do this
type of things.

commit 4b681c82d2f9bef121c912ffcaac89a004af3f2c
Author: Vadim Kochan vadi...@gmail.com
Date: Mon Jan 12 16:34:05 2015 +0200

nl80211: Allow set network namespace by fd


Hi Hauke,

I looked into my issue a bit more. So my target kernel is 
3.11.1-200.fc19.x86_64 and checking lxr found that 3.11 has this 
function, but it does not have EXPORT_SYMBOL(). That was added by the 
same commit above. Any clues how to fix this?


Regards,
Arend


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


Re: cfg80211: Unknown symbol get_net_ns_by_fd (err 0)

2015-01-30 Thread Hauke Mehrtens


On 01/30/2015 07:18 PM, Arend van Spriel wrote:
 On 01/26/15 21:44, Arend van Spriel wrote:
 Hi Hauke,

 The commit below causes the error mentioned in the Subject: field. I
 would like to fix this, but could use a bit of help here how to do this
 type of things.

 commit 4b681c82d2f9bef121c912ffcaac89a004af3f2c
 Author: Vadim Kochan vadi...@gmail.com
 Date: Mon Jan 12 16:34:05 2015 +0200

 nl80211: Allow set network namespace by fd
 
 Hi Hauke,
 
 I looked into my issue a bit more. So my target kernel is
 3.11.1-200.fc19.x86_64 and checking lxr found that 3.11 has this
 function, but it does not have EXPORT_SYMBOL(). That was added by the
 same commit above. Any clues how to fix this?

Hi Arend

As Johannes said it is probably not possible to backport
get_net_ns_by_fd() correctly. You can not access any symbols which are
not exported in a kernel. To backport it we have to access
netns_operations which is also not exported.

We could  copy this function it into backports and remove this check
from the original function:
if (ei-ns_ops == netns_operations)
..


Or we just backport this version every time:

struct net *get_net_ns_by_fd(int fd)
{
return ERR_PTR(-EINVAL);
}

Hauke
--
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] backports: update genl-const patch for nl80211

2015-01-30 Thread Johannes Berg
From: Johannes Berg johannes.b...@intel.com

The current wireless tree changes the surrounding code to
use the exported string constants, so adjust the patch to
make it apply again.

Signed-off-by: Johannes Berg johannes.b...@intel.com
---
 patches/collateral-evolutions/network/0027-genl-const/nl80211.patch | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/patches/collateral-evolutions/network/0027-genl-const/nl80211.patch 
b/patches/collateral-evolutions/network/0027-genl-const/nl80211.patch
index d8d67bb99577..21c2a86eda58 100644
--- a/patches/collateral-evolutions/network/0027-genl-const/nl80211.patch
+++ b/patches/collateral-evolutions/network/0027-genl-const/nl80211.patch
@@ -18,9 +18,9 @@
  
 -static const struct genl_multicast_group nl80211_mcgrps[] = {
 +static __genl_const struct genl_multicast_group nl80211_mcgrps[] = {
-   [NL80211_MCGRP_CONFIG] = { .name = config, },
-   [NL80211_MCGRP_SCAN] = { .name = scan, },
-   [NL80211_MCGRP_REGULATORY] = { .name = regulatory, },
+   [NL80211_MCGRP_CONFIG] = { .name = NL80211_MULTICAST_GROUP_CONFIG },
+   [NL80211_MCGRP_SCAN] = { .name = NL80211_MULTICAST_GROUP_SCAN },
+   [NL80211_MCGRP_REGULATORY] = { .name = NL80211_MULTICAST_GROUP_REG },
 @@ -9938,7 +9938,7 @@ static int nl80211_tdls_cancel_channel_s
 NL80211_FLAG_CHECK_NETDEV_UP)
  #define NL80211_FLAG_CLEAR_SKB0x20
-- 
2.1.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 V2 5/6] rtlwifi: btcoexist: Add routines for RTL8812AE kernel socket communications

2015-01-30 Thread Marcel Holtmann
Hi Larry,

 I'm adding bluetooth list to the discussion. Full patch is available
 here:
 
 https://patchwork.kernel.org/patch/5712591/

snip

 So the wireless driver communicates with the bluetooth driver (which is
 not in upstream) via a localhost UDP connection?
 
 I think the first order of business should be to get the Bluetooth driver 
 upstream. Until that has happened this is all kinda pointless discussion.
 
 I agree with this; however, the last time I tried to submit a BT driver for 
 Realtek, I was told that this driver should use some (as yet included) 
 feature. I have watched the driver development, and if that feature was ever 
 included, it was in a form that I did not recognize. I'm sorry that this is 
 vague, but this happened a long time ago.

if the Bluetooth side is running over USB, then it should be driven from the 
existing btusb.ko module with a vendor specific -setup() callback. However 
nothing materialized that I could merge it.

 I know there's a general need for something similar like this, but it
 needs to properly discussed and designed.
 
 This is just insane. Clear NAK.
 
 Two kernel modules will not use UDP ports over the loopback interface to 
 communicate with each other.
 
 I will work on combining the latest BT drivers from Realtek with btusb to see 
 if I can achieve a patch that will both work with the Realtek hardware, and 
 get approval from the reviewers.
 
 What would be an approved method of communicating between two kernel modules? 
 Is there some example in the kernel that I could study?

We need a btcoex subsystem that both WiFi and Bluetooth can register to and 
communicate with.

Regards

Marcel

--
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: Hello

2015-01-30 Thread Dr. Raymond Atu


Good Day am Dr. Raymond Atu I have very important issue to discuss  
with you Please kindly get back to me urgently .E-mail :  
raymon...@hotmail.com  raymno...@gmail.com



== =
Disclosure: This e-mail is intended only for the above addressee. It  
may contain privileged information. If you are not the addressee you  
must not copy, distribute, disclose or use any of the information in  
it. If you have received it in error please delete it and immediately  
notify the sender.

== =
--




== =
Disclosure: This e-mail is intended only for the above addressee. It  
may contain privileged information. If you are not the addressee you  
must not copy, distribute, disclose or use any of the information in  
it. If you have received it in error please delete it and immediately  
notify the sender.

== =



--
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


[ANN] crda-3.18 released

2015-01-30 Thread Luis R. Rodriguez
A new release of CRDA has been released, this might be the last since
we have some ideas of how to just shift this functionality directly
into the kernel and in the future may not need any userspace tool
other than to help debug stuff perhaps. The major thing here is
trusting Seth's new key as he is now the maintainer of the
wireless-regdb. Other than this it also add AUTO-BW rule support,
parse/print of CAC on db2rd, and fixes a compile error. This release
goes signed with my new PGP key.

Thanks to all who have contributed. There release page for CRDA:

http://drvbp1.linux-foundation.org/~mcgrof/rel-html/crda/

The v3.18 release:

http://kernel.org/pub/software/network/crda/crda-3.18.tar.xz

The wireless-regdb release page:

http://drvbp1.linux-foundation.org/~mcgrof/rel-html/wireless-regdb/

As announced by Seth, the new wireless-regdb is:

http://kernel.org/pub/software/network/wireless-regdb/wireless-regdb-2015.01.30.tar.xz

The shortlog of this CRDA v3.18 release:

mcgrof@garbanzo ~/devel/crda (git::master)$ git shortlog v3.13..v3.18
Janusz Dziedzic (4):
  crda: sync with latest nl80211.h
  crda: add AUTO-BW rule flag support
  crda: simplify text parsing for country/rules
  crda: db2rd, parse/print CAC time

John W. Linville (1):
  crda: Add DESTDIR support in install-libreg* rules in Makefile

Krishna Chaitanya (1):
  crda: Fix the linking order to avoid compilation error

Luis R. Rodriguez (1):
  crda: document contribution process using the DCO

Seth Forshee (1):
  crda: Trust regulatory.bin from Seth Forshee
--
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: cfg80211: Unknown symbol get_net_ns_by_fd (err 0)

2015-01-30 Thread Arend van Spriel

On 01/30/15 19:32, Hauke Mehrtens wrote:

Or we just backport this version every time:

struct net *get_net_ns_by_fd(int fd)
{
return ERR_PTR(-EINVAL);
}



I was going for the easy way out over here. Either way is fine by me, 
but is net namespace support can not be properly backported I would say 
got for the version above.


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


Re: [PATCH] backports: update genl-const patch for nl80211

2015-01-30 Thread Johannes Berg
On Fri, 2015-01-30 at 18:35 +0100, Johannes Berg wrote:
 From: Johannes Berg johannes.b...@intel.com
 
 The current wireless tree changes the surrounding code to
 use the exported string constants, so adjust the patch to
 make it apply again.

Wrong list, and Arend sent the same patch already anyway... stupid me.

Sorry for the noise.

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


Re: cfg80211: Unknown symbol get_net_ns_by_fd (err 0)

2015-01-30 Thread Johannes Berg
On Fri, 2015-01-30 at 19:38 +0100, Arend van Spriel wrote:
 On 01/30/15 19:32, Hauke Mehrtens wrote:
  Or we just backport this version every time:
 
  struct net *get_net_ns_by_fd(int fd)
  {
  return ERR_PTR(-EINVAL);
  }
 
 
 I was going for the easy way out over here. Either way is fine by me, 
 but is net namespace support can not be properly backported I would say 
 got for the version above.

I agree, I think we should go for the always-fail one.

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


[IWLMVM] Firmware restart issue with 3.19-rc6-wl with AC 3160, REV=0x164

2015-01-30 Thread Christian Lamparter
Hello,

since upgrading to 3.19-rc6-wl (3.19-rc5-wl is working fine). I can no
longer use the IWL 3160 in my laptop. As soon as the link goes up (the
modules load fine, just ip/ifconfig up), I get this:

[5.960381] iwlwifi :01:00.0: L1 Enabled - LTR Disabled
[5.960722] iwlwifi :01:00.0: L1 Enabled - LTR Disabled
[6.256941] iwlwifi :01:00.0: L1 Enabled - LTR Disabled
[6.257392] iwlwifi :01:00.0: L1 Enabled - LTR Disabled
[6.272858] iwlwifi :01:00.0: Microcode SW error detected.
Restarting 0x8200.
[6.272875] iwlwifi :01:00.0: CSR values:
[6.272886] iwlwifi :01:00.0: (2nd byte of CSR_INT_COALESCING
is CSR_INT_PERIODIC_REG)
[6.272937] iwlwifi :01:00.0:CSR_HW_IF_CONFIG_REG: 0X00c89204
[6.272985] iwlwifi :01:00.0:  CSR_INT_COALESCING: 0X8000ff40
[6.273033] iwlwifi :01:00.0: CSR_INT: 0X
[6.273080] iwlwifi :01:00.0:CSR_INT_MASK: 0X
[6.273127] iwlwifi :01:00.0:   CSR_FH_INT_STATUS: 0X
[6.273173] iwlwifi :01:00.0: CSR_GPIO_IN: 0X
[6.273220] iwlwifi :01:00.0:   CSR_RESET: 0X
[6.273266] iwlwifi :01:00.0:CSR_GP_CNTRL: 0X080403cd
[6.273313] iwlwifi :01:00.0:  CSR_HW_REV: 0X0164
[6.273359] iwlwifi :01:00.0:  CSR_EEPROM_REG: 0X
[6.273406] iwlwifi :01:00.0:   CSR_EEPROM_GP: 0X8000
[6.273452] iwlwifi :01:00.0:  CSR_OTP_GP_REG: 0X803a
[6.273499] iwlwifi :01:00.0: CSR_GIO_REG: 0X00080042
[6.273545] iwlwifi :01:00.0:CSR_GP_UCODE_REG: 0X
[6.273591] iwlwifi :01:00.0:   CSR_GP_DRIVER_REG: 0X
[6.273637] iwlwifi :01:00.0:   CSR_UCODE_DRV_GP1: 0X
[6.273684] iwlwifi :01:00.0:   CSR_UCODE_DRV_GP2: 0X
[6.273730] iwlwifi :01:00.0: CSR_LED_REG: 0X0018
[6.273777] iwlwifi :01:00.0:CSR_DRAM_INT_TBL_REG: 0X880beb28
[6.273823] iwlwifi :01:00.0:CSR_GIO_CHICKEN_BITS: 0X27800200
[6.273869] iwlwifi :01:00.0: CSR_ANA_PLL_CFG: 0Xd5d5
[6.273916] iwlwifi :01:00.0:  CSR_MONITOR_STATUS_REG: 0Xdbb7fff7
[6.273962] iwlwifi :01:00.0:   CSR_HW_REV_WA_REG: 0X0001001a
[6.274009] iwlwifi :01:00.0:CSR_DBG_HPET_MEM_REG: 0X
[6.274018] iwlwifi :01:00.0: FH register values:
[6.274067] iwlwifi :01:00.0:
FH_RSCSR_CHNL0_STTS_WPTR_REG: 0X2921bc00
[6.274114] iwlwifi :01:00.0:
FH_RSCSR_CHNL0_RBDCB_BASE_REG: 0X02921bd0
[6.274161] iwlwifi :01:00.0:
FH_RSCSR_CHNL0_WPTR: 0X0010
[6.274209] iwlwifi :01:00.0:
FH_MEM_RCSR_CHNL0_CONFIG_REG: 0X80801114
[6.274256] iwlwifi :01:00.0:
FH_MEM_RSSR_SHARED_CTRL_REG: 0X00fc
[6.274304] iwlwifi :01:00.0:
FH_MEM_RSSR_RX_STATUS_REG: 0X0703
[6.274351] iwlwifi :01:00.0:
FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV: 0X
[6.274398] iwlwifi :01:00.0:
FH_TSSR_TX_STATUS_REG: 0X07ff0001
[6.274446] iwlwifi :01:00.0:
FH_TSSR_TX_ERROR_REG: 0X
[6.274594] iwlwifi :01:00.0: Start IWL Error Log Dump:
[6.274605] iwlwifi :01:00.0: Status: 0x, count: 6
[6.274614] iwlwifi :01:00.0: Loaded firmware version: 23.11.10.0
[6.274625] iwlwifi :01:00.0: 0x0038 | BAD_COMMAND
[6.274637] iwlwifi :01:00.0: 0x02F0 | uPc
[6.274647] iwlwifi :01:00.0: 0x | branchlink1
[6.274657] iwlwifi :01:00.0: 0x0B3C | branchlink2
[6.274667] iwlwifi :01:00.0: 0x00014960 | interruptlink1
[6.274676] iwlwifi :01:00.0: 0x00060117 | interruptlink2
[6.274685] iwlwifi :01:00.0: 0x0915001D | data1
[6.274695] iwlwifi :01:00.0: 0xDEADBEEF | data2
[6.274704] iwlwifi :01:00.0: 0xDEADBEEF | data3
[6.274713] iwlwifi :01:00.0: 0x003FE973 | beacon time
[6.274722] iwlwifi :01:00.0: 0x168C | tsf low
[6.274731] iwlwifi :01:00.0: 0x | tsf hi
[6.274740] iwlwifi :01:00.0: 0x | time gp1
[6.274749] iwlwifi :01:00.0: 0x168C | time gp2
[6.274758] iwlwifi :01:00.0: 0x | time gp3
[6.274767] iwlwifi :01:00.0: 0x0004170B | uCode version
[6.274776] iwlwifi :01:00.0: 0x0164 | hw version
[6.274785] iwlwifi :01:00.0: 0x00C89204 | board version
[6.274794] iwlwifi :01:00.0: 0x0915001D | hcmd
[6.274803] iwlwifi :01:00.0: 0x00022080 | isr0
[6.274812] iwlwifi :01:00.0: 0x | isr1
[6.274821] iwlwifi :01:00.0: 0x0002 | isr2
[6.274829] iwlwifi :01:00.0: 0x004000C0 | isr3
[6.274838] iwlwifi :01:00.0: 0x | isr4
[6.274847] iwlwifi :01:00.0: 0x01000112 | isr_pref
[6.274856] iwlwifi :01:00.0: 0x | 

Re: [IWLMVM] Firmware restart issue with 3.19-rc6-wl with AC 3160, REV=0x164

2015-01-30 Thread Johannes Berg
On Fri, 2015-01-30 at 21:23 +0100, Christian Lamparter wrote:

 [6.274625] iwlwifi :01:00.0: 0x0038 | BAD_COMMAND

 [6.275034] iwlwifi :01:00.0: FW error in SYNC CMD SCD_QUEUE_CFG

WTF. How did the firmware even announce support for this command??

Perhaps I missed it in the log, but which firmware are you using? Any
chance you also upgraded that? Because I can't imagine this code is new
in the tree...

Anyway, make this change:

diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h 
b/drivers/net/wireless/iwlwifi/mvm/mvm.h
index 979ac23522f2..5b8c969f457e 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h
@@ -874,7 +874,7 @@ static inline bool iwl_mvm_is_d0i3_supported(struct iwl_mvm 
*mvm)
 
 static inline bool iwl_mvm_is_scd_cfg_supported(struct iwl_mvm *mvm)
 {
-   return mvm-fw-ucode_capa.capa[0]  IWL_UCODE_TLV_API_SCD_CFG;
+   return false;
 }
 
 extern const u8 iwl_mvm_ac_to_tx_fifo[];

I guess Emmanuel will look at it on Sunday :)

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


Re: [PATCH] ath10k: Replace ioread with wmb for data sync

2015-01-30 Thread Peter Oh


On 01/30/2015 05:16 PM, Sujith Manoharan wrote:

Peter Oh wrote:

As I addressed wmb uses dsb (in arm arch) and here is the description of
arm architecture.

What about other architectures ?

Please refer the email thread that I mentioned about other architectures.
(dsb is for ARM and other platforms have the equivalent instruction such 
as sfence, sync, mf, and dcs).

Also the patch is updated with 2nd patch set replacing wmb to mb.

Sujith

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


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


[PATCH v2] ath10k: Replace ioread with mb to drain write buffer

2015-01-30 Thread Peter Oh
Using ioread() to perform draining write buffer is excessive.
Use compact API, mb(), that intended to be used for the case.
It reduces total 14 CPU clocks per interrupt.

Signed-off-by: Peter Oh p...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/pci.c | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index e6972b0..f1e6980 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -353,10 +353,8 @@ static void ath10k_pci_disable_and_clear_legacy_irq(struct 
ath10k *ar)
ath10k_pci_write32(ar, SOC_CORE_BASE_ADDRESS + PCIE_INTR_CLR_ADDRESS,
   PCIE_INTR_FIRMWARE_MASK | PCIE_INTR_CE_MASK_ALL);
 
-   /* IMPORTANT: this extra read transaction is required to
-* flush the posted write buffer. */
-   (void)ath10k_pci_read32(ar, SOC_CORE_BASE_ADDRESS +
-   PCIE_INTR_ENABLE_ADDRESS);
+   /* drain write buffer */
+   mb();
 }
 
 static void ath10k_pci_enable_legacy_irq(struct ath10k *ar)
@@ -365,10 +363,8 @@ static void ath10k_pci_enable_legacy_irq(struct ath10k *ar)
   PCIE_INTR_ENABLE_ADDRESS,
   PCIE_INTR_FIRMWARE_MASK | PCIE_INTR_CE_MASK_ALL);
 
-   /* IMPORTANT: this extra read transaction is required to
-* flush the posted write buffer. */
-   (void)ath10k_pci_read32(ar, SOC_CORE_BASE_ADDRESS +
-   PCIE_INTR_ENABLE_ADDRESS);
+   /* drain write buffer */
+   mb();
 }
 
 static inline const char *ath10k_pci_get_irq_method(struct ath10k *ar)
-- 
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] ath10k: Replace ioread with wmb for data sync

2015-01-30 Thread Sujith Manoharan
Peter Oh wrote:
 Please refer the email thread that I mentioned about other architectures.
 (dsb is for ARM and other platforms have the equivalent instruction such 
 as sfence, sync, mf, and dcs).

Ok.

 Also the patch is updated with 2nd patch set replacing wmb to mb.

Would be good to test this on a MIPS platform...

Sujith
--
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: Replace ioread with wmb for data sync

2015-01-30 Thread Sujith Manoharan
Peter Oh wrote:
 As I addressed wmb uses dsb (in arm arch) and here is the description of 
 arm architecture.

What about other architectures ?

Sujith
--
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


Realtek RTL8812AE 802.11ac

2015-01-30 Thread poma

Salutem


Is the combination with Bluetooth only essential difference between RTL8821AE 
and RTL8812AE?

*If* the undermentioned two devices are based on RTL8812AE chipset,
whether they supported via 'rtl8821ae.ko'  'rtl8821aefw.bin'?

PCIe RTL8812AE 802.11abgn+ac 2x2:2


Amped Wireless PCI20E (FCC ID: ZTT-PCI20E) 
  https://wikidevi.com/wiki/Amped_Wireless_PCI20E

- High Power AC1200 Wi-Fi PCI-E Adapter 
  PCI20E
  http://www.ampedwireless.com/products/pci20e.html

- http://www.amazon.com/Amped-Wireless-AC1200-Adapter-PCI20E/dp/B00I9AS1JA


D-Link DWA-582 rev A1 (FCC ID: KA2WA582A1) 
  https://wikidevi.com/wiki/D-Link_DWA-582_rev_A1

- Wireless AC1200 Dual Band PCIe Desktop Adapter
  DWA-582
  
http://www.dlink.com.au/home-solutions/wireless-ac1200-dual-band-pcie-desktop-adapter

- http://www.amazon.com/WIRELESS-AC1200-EXPRESS-ADAPTER-DUAL/dp/B00PHVQV14


/usr/src/kernels/3.18.3-201.fc21.x86_64/drivers/net/wireless/rtlwifi/Kconfig
...
config RTL8821AE
tristate Realtek RTL8821AE/RTL8812AE Wireless Network Adapter
depends on PCI
select RTLWIFI
select RTLWIFI_PCI
select RTLBTCOEXIST
---help---
This is the driver for Realtek RTL8i821AE/RTL8812AE 802.11av PCIe
wireless network adapters.

If you choose to build it as a module, it will be called rtl8821ae
...


$ modinfo rtl8821ae
filename:   
/lib/modules/3.18.3-201.fc21.x86_64/kernel/drivers/net/wireless/rtlwifi/rtl8821ae/rtl8821ae.ko.xz
firmware:   rtlwifi/rtl8821aefw.bin
description:Realtek 8821ae 802.11ac PCI wireless
license:GPL
author: Realtek WlanFAE wlan...@realtek.com
alias:  pci:v10ECd8821sv*sd*bc*sc*i*
alias:  pci:v10ECd8812sv*sd*bc*sc*i*
depends:rtlwifi,rtl_pci,btcoexist,mac80211
...


poma

--
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 2/7] ath10k: implement chanctx API

2015-01-30 Thread Michal Kazior
On 30 January 2015 at 14:31, Johannes Berg johan...@sipsolutions.net wrote:
 On Fri, 2015-01-30 at 14:22 +0100, Michal Kazior wrote:

 You'd probably have to add quite a few mutex_lock(iflist_mtx) around
 drv_*() calls (not directly but somewhere at their call trees) to
 guarantee driver can use lock-free iterate() version (which doesn't
 exist yet). This could be tricky.

 Well, I was thinking you'd only use it in some places now - but it does
 seem a bit difficult to maintain.

 We've not typically had to worry about using the synchronous versions
 much since we mostly just need a single interface so we just pass it out
 and use it there, or so.

I'm not sure if you refer to iwlwifi or mac80211 now? If it's the
latter: even if you have an ops with, e.g. vif pointer, driver may
still need to iterate over interfaces in order to propagate some
side-effect changes or aggregate some values/recalculate.


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


Re: [PATCH v2 2/7] ath10k: implement chanctx API

2015-01-30 Thread Michal Kazior
On 30 January 2015 at 14:10, Johannes Berg johan...@sipsolutions.net wrote:
 On Fri, 2015-01-30 at 14:06 +0100, Michal Kazior wrote:

 I'm a bit reluctant to freely use mac80211 owned structures out of
 mac80211_ops callback context, i.e. from a tasklet fearing
 inconsistencies. Or am I worrying unnecessarily? If so I guess I'll
 redo this and use mac80211's structures directly :-)

 Yeah that's a concern, we were just looking at something similar.
 However, I think at least with channel contexts you should be fine since
 mac80211 never really modifies them much, except for the width and # of
 chains needed?

With `width` you'll change `center_freq1` in many cases. Reading a
pair of old-and-new of each may not necessarily be fatal but may
introduce subtle bugs that are hard to debug. Even if the current code
doesn't really use these values out of mac80211 callback context now
it may become a problem later.

I don't know. I'll think about this a bit more. You *do* have a point.


 We've recently seen a similar issue with vif-bss_conf, and I'm
 considering making that an RCU-protected pointer rather than the
 embedded sub-struct, that way mac80211 can replace it atomically when
 needed. I've yet to see if that's practical though.

It'd be lovely if I could freely read mac80211 structures from
whatever context I want without any worries but I think you'd have to
introduce explicit locking between mac80211 and drivers or go ham with
RCU :-)


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


Re: [PATCH v2 2/7] ath10k: implement chanctx API

2015-01-30 Thread Johannes Berg
On Fri, 2015-01-30 at 15:01 +0100, Michal Kazior wrote:

 With `width` you'll change `center_freq1` in many cases. Reading a
 pair of old-and-new of each may not necessarily be fatal but may
 introduce subtle bugs that are hard to debug. Even if the current code
 doesn't really use these values out of mac80211 callback context now
 it may become a problem later.

Yes, this is a good point. Like I said (below), we had a similar issue
with the bss_conf, in our case that was two timestamps there that need
to be read together. Right now we're the only ones using those and only
within the context of the callback, so we can just document that they're
only valid together in such a context, but it's a more general issue.

  We've recently seen a similar issue with vif-bss_conf, and I'm
  considering making that an RCU-protected pointer rather than the
  embedded sub-struct, that way mac80211 can replace it atomically when
  needed. I've yet to see if that's practical though.
 
 It'd be lovely if I could freely read mac80211 structures from
 whatever context I want without any worries but I think you'd have to
 introduce explicit locking between mac80211 and drivers or go ham with
 RCU :-)

Yeah, locking there would perhaps not be such a bad idea? Either that or
RCU. Though we need RCU already in many contexts (like a tasklet
iterating the list of interfaces) but perhaps configuration accesses
could be contained to mutex-capable contexts? I don't know.

We did have a similar problem between cfg80211 and mac80211 and decided
to move the cfg80211 mutex to the public part so that mac80211 (or other
cfg80211 drivers, of course) could use it - and in fact the cfg80211 API
requires that now in some places - but we haven't really considered this
so much in the context of drivers.

I think this would make a good discussion topic for the wireless
workshop :)

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


Re: Throughput regression with `tcp: refine TSO autosizing`

2015-01-30 Thread Eric Dumazet
On Fri, 2015-01-30 at 14:47 +0100, Arend van Spriel wrote:

 Indeed and that is what we would like to address in our wireless 
 drivers. I will setup some experiments using the fraction sizing and 
 post my findings. Again sorry if I offended you.

You did not, but I had no feedback about my suggestions.

Michal sent it now.

Thanks


--
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: Throughput regression with `tcp: refine TSO autosizing`

2015-01-30 Thread Eric Dumazet
On Fri, 2015-01-30 at 14:39 +0100, Michal Kazior wrote:

 I've briefly tried playing with this knob to no avail unfortunately. I
 tried 256K, 1M - it didn't improve TCP performance. When I tried to
 make it smaller (e.g. 16K) the traffic dropped even more so it does
 have an effect. It seems there's some other limiting factor in this
 case.

Interesting.

Could you take some tcpdump/pcap with various tcp_limit_output_bytes
values ?

echo 131072 /proc/sys/net/ipv4/tcp_limit_output_bytes
tcpdump -p -i wlanX -s 128 -c 2 -w 128k.pcap

echo 262144 /proc/sys/net/ipv4/tcp_limit_output_bytes
tcpdump -p -i wlanX -s 128 -c 2 -w 256k.pcap

...

Thanks !


--
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 2/7] ath10k: implement chanctx API

2015-01-30 Thread Johannes Berg
On Fri, 2015-01-30 at 14:47 +0100, Michal Kazior wrote:

 I'm not sure if you refer to iwlwifi or mac80211 now? If it's the
 latter: even if you have an ops with, e.g. vif pointer, driver may
 still need to iterate over interfaces in order to propagate some
 side-effect changes or aggregate some values/recalculate.

I was referring mostly to iwlwifi :)

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


Re: brcmfmac: brcmf_sdio_htclk: HT Avail timeout on Thinkpad Tablet 10

2015-01-30 Thread Arend van Spriel

On 01/28/15 08:15, Sébastien Bourdeauducq wrote:

Hi,

The Lenovo Thinkpad Tablet 10 is a complete disaster under Linux, and
among many problems the SDIO brcmfmac wifi does not work.

I get the following messages in the kernel log:
brcmfmac: brcmf_sdio_drivestrengthinit: No SDIO Drive strength init done
for chip 4324 rev 6 pmurev 17
brcmfmac: brcmf_sdio_htclk: HT Avail timeout (100): clkctl 0x50
[repeated]

and the network interface is never created.

I'm running kernel 3.18.4, my brcmfmac43241b4-sdio.bin is identical to
the one in the linux-firmware repository, and I have attached the
brcmfmac43241b4-sdio.txt that I have extracted from the EFI variables.


When you say your firmware is identical what does that mean. Did you do 
a diff? Can you do 'hexdump -C brcmfmac43241b4-sdio.bin | tail -30'? I 
will be getting a laptop with 43241 integrated soonish (monday?). 
Hopefully it has same chip revision.


Regards,
Arend

Any help would be appreciated.

Sébastien


--
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 rules for Nigeria (NG)

2015-01-30 Thread Seth Forshee
On Fri, Jan 23, 2015 at 01:51:58PM +0200, Jouni Malinen wrote:
 Source is QCA's regulatory team's efforts.
 
 Signed-off-by: Jouni Malinen jo...@qca.qualcomm.com

Applied all three (this one plus Samoa and Tanzania), thanks.
--
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


NetDev 0.1 Preliminary schedule posted

2015-01-30 Thread Jamal Hadi Salim

Fellow netheads:

Yours truly posting on behalf of rgb.

The preliminary schedule was published late yesterday.
https://www.netdev01.org/schedule

We wanted to get something out quickly while we make it pretty
afterwards. There will be some minor changes later on.
Talks are all on Mon/Tuesday and Tutorials/BoFs/Workshops are
Sat/Sunday.

There will be a click-able version of the schedule later, for now
please correlate the schedule against the sessions at:
https://www.netdev01.org/sessions

We appologize for the inconvinience (all volunteers are hard at
work to make this a fantastic conference for you).

If you have been waiting for the schedule to register, now is the
time:
https://onlineregistrations.ca/netdev01/

Hotel update:

The hotel has agreed, on a best effort basis to extend the
netdev01 rate of $159.00 or $179.00 (depending on the type of room
required).  Please dont procastinate and book now.  We are competing
against a few tourist activities for hotel rooms going on around the
area at the same time (example:
http://www.ottawafestivals.ca/events/winterlude-2/).

Avoid disappointment and do your reservations at:
https://www.starwoodmeeting.com/StarGroupsWeb/res?id=1412035802key=1AC9C1F8

If you dont succeed getting the reservation, send us email at
info at netdev01.org; we will try to bat for you but we cant guarantee
results. We are also putting effort into talking to other local hotels.

Sponsors:
=
NetDev 0.1 would like to gratefully acknowledge all our sponsors:
https://netdev01.org/sponsors
CENGN   http://www.cengn.ca/
Google  https://www.google.ca
Qualcommhttps://www.qualcomm.com/
Verizon http://www.verizon.com/
Cumulus Networkshttp://cumulusnetworks.com/
Mojatatu Networks   https://mojatatu.com/


Important Dates:
==
December 2, 2014Call for Papers opens
December 10, 2014   Registration opens
January 23, 2015Hotel discount rates deadline
January 24, 2015Call for sessions deadline
February 12, 2015   On-line registration closes
February 14-17, 2015Conference days

---
THE Technical Conference on Linux Networking, February 14-17, 2015, 
Ottawa, Canada

https://netdev01.org/

Contact:info@x
Main site:  https://www.netdev01.org/
Announcement:   https://www.netdev01.org/announce
CFP:https://www.netdev01.org/cfp
Travel/hotel/weather/clothing:  https://www.netdev01.org/travel
RSS feed:   https://netdev01.org/atom
Follow us on Twitter: @netdev01 https://twitter.com/netdev01

cheers,
jamal (on behalf of Richard Guy Briggs)
--
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 5/6] rtlwifi: btcoexist: Add routines for RTL8812AE kernel socket communications

2015-01-30 Thread Kalle Valo
Hi,

I'm adding bluetooth list to the discussion. Full patch is available
here:

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

Larry Finger larry.fin...@lwfinger.net writes:

 From: Troy Tan troy_...@realsil.com.cn

 This patch adds the routines used to communicate between the RTL8812AE (wifi)
 device and the RTL8761AU (bluetooth) device that are part of the same chip.
 Unlike other similar dual-function devices, this chip does not contain special
 hardware that lets the firmware pass coexistence info from one part to the
 other. As a result, this driver implements such communication as a kernel
 socket.

 Signed-off-by: Troy Tan troy_...@realsil.com.cn
 Signed-off-by: Larry Finger larry.fin...@lwfinger.net
 ---
 V2 - Add comments explaining the routine that sends a message via the
 socket.

The commit log is not still explaining that much about the actual
functionality, so I investigated on my own:

 +static u8 rtl_btcoex_create_kernel_socket(struct rtl_priv *rtlpriv,
 +   u8 is_invite)
 +{
 + struct bt_coex_info *pcoex_info = rtlpriv-coex_info;
 + s8 kernel_socket_err;
 +
 + BTC_PRINT(BTC_MSG_SOCKET, SOCKET_CRITICAL,
 +   %s CONNECT_PORT %d\n, __func__, CONNECT_PORT);
 +
 + if (!pcoex_info) {
 + BTC_PRINT(BTC_MSG_SOCKET, SOCKET_CRITICAL, coex_info: NULL\n);
 + return _FAIL;
 + }
 +
 + kernel_socket_err = sock_create(PF_INET, SOCK_DGRAM, 0,
 + pcoex_info-udpsock);
 + BTC_PRINT(BTC_MSG_SOCKET, SOCKET_CRITICAL,
 +   binding socket, err = %d\n, kernel_socket_err);
 +
 + if (kernel_socket_err  0) {
 + BTC_PRINT(BTC_MSG_SOCKET, SOCKET_CRITICAL,
 +   Error during creation of socket error:%d\n,
 +   kernel_socket_err);
 + return _FAIL;
 + }
 + memset(pcoex_info-sin, 0, sizeof(pcoex_info-sin));
 + pcoex_info-sin.sin_family = AF_INET;
 + pcoex_info-sin.sin_port = htons(CONNECT_PORT);
 + pcoex_info-sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
 +
 + memset(pcoex_info-bt_addr, 0, sizeof(pcoex_info-bt_addr));
 + pcoex_info-bt_addr.sin_family = AF_INET;
 + pcoex_info-bt_addr.sin_port = htons(CONNECT_PORT_BT);
 + pcoex_info-bt_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
 +
 + pcoex_info-sk_store = NULL;
 +
 + kernel_socket_err =
 +pcoex_info-udpsock-ops-bind(pcoex_info-udpsock,
 +   (struct sockaddr *)pcoex_info-sin,
 +   sizeof(pcoex_info-sin));
 + if (kernel_socket_err == 0) {
 + BTC_PRINT(BTC_MSG_SOCKET, SOCKET_CRITICAL,
 +   binding socket success\n);
 + pcoex_info-udpsock-sk-sk_data_ready =
 + rtl_btcoex_recvmsg_int;
 + pcoex_info-sock_open |=  KERNEL_SOCKET_OK;
 + pcoex_info-bt_attend = false;
 + BTC_PRINT(BTC_MSG_SOCKET, SOCKET_CRITICAL,
 +   WIFI sending attend_req\n);
 + rtl_btcoex_sendmsgbysocket(rtlpriv, attend_req,
 +sizeof(attend_req), true);
 + return _SUCCESS;

So the wireless driver communicates with the bluetooth driver (which is
not in upstream) via a localhost UDP connection?

 +#define CONNECT_PORT 3
 +#define CONNECT_PORT_BT 30001

And these are the UDP ports used.

 +struct hci_link_info {
 + u16 connect_handle;
 + u8  incoming_traffic_mode;
 + u8  outgoing_traffic_mode;
 + u8  bt_profile;
 + u8  bt_corespec;
 + s8  bt_RSSI;
 + u8  traffic_profile;
 + u8  link_role;
 +};
 +
 +#define  MAX_BT_ACL_LINK_NUM 8
 +
 +struct hci_ext_config {
 + struct hci_link_infoacl_link[MAX_BT_ACL_LINK_NUM];
 + u8  bt_operation_code;
 + u16 current_connect_handle;
 + u8  current_incoming_traffic_mode;
 + u8  current_outgoing_traffic_mode;
 +
 + u8  number_of_acl;
 + u8  number_of_sco;
 + u8  current_bt_status;
 + u16 hci_ext_ver;
 + boolenable_wifi_scan_notify;
 +};

[...]

 +enum HCI_STATUS {
 + /* Success */
 + HCI_STATUS_SUCCESS  = 0x00,
 + /* Unknown HCI Command */
 + HCI_STATUS_UNKNOW_HCI_CMD   = 0x01,
 + /* Unknown Connection Identifier */
 + HCI_STATUS_UNKNOW_CONNECT_ID= 0X02,
 + /* Hardware Failure */
 + HCI_STATUS_HW_FAIL  = 0X03,
 + /* Page Timeout */
 + HCI_STATUS_PAGE_TIMEOUT = 0X04,
 + /* Authentication Failure */
 + HCI_STATUS_AUTH_FAIL= 0X05,
 + /* PIN or Key Missing */
 + HCI_STATUS_PIN_OR_KEY_MISSING   = 0X06,
 + /* Memory Capacity 

[PATCH] Repair soft lockup with monitor mode of ath9k_htc card

2015-01-30 Thread yuweizheng
From: Yuwei Zheng yuweizh...@139.com

In the environment with heavy wifi traffic, set the ar9271 into monitor mode, 
will
trigger a deadloop panic.
 
The ath9k_hif_usb_rx_cb function excute on  the interrupt context, and 
ath9k_rx_tasklet excute
on the soft irq context. In other words, the ath9k_hif_usb_rx_cb have more 
chance to excute than
ath9k_rx_tasklet.  So in the worst condition,  the rx.rxbuf receive list is 
always full,
and the do {}while(true) loop will not be break. The kernel get a soft lockup 
panic. 
 
[59011.007210] BUG: soft lockup - CPU#0 stuck for 23s!
[kworker/0:0:30609]
[59011.030560] BUG: scheduling while atomic: kworker/0:0/30609/0x40010100
[59013.804486] BUG: scheduling while atomic: kworker/0:0/30609/0x40010100
[59013.858522] Kernel panic - not syncing: softlockup: hung tasks
 
[59014.038891] Exception stack(0xdf4bbc38 to 0xdf4bbc80)
[59014.046834] bc20:   
de57b950 6113
[59014.059579] bc40:  bb32bb32 6113 de57b948 de57b500 dc7bb440 
df4bbcd0 
[59014.072337] bc60: de57b950 6113 df4bbcd0 df4bbc80 c04c259d c04c25a0 
6133 
[59014.085233] [c04c28db] (__irq_svc+0x3b/0x5c) from [c04c25a0] 
(_raw_spin_unlock_irqrestore+0xc/0x10)
[59014.100437] [c04c25a0] (_raw_spin_unlock_irqrestore+0xc/0x10) from 
[bf9c2089] (ath9k_rx_tasklet+0x290/0x490 [ath9k_htc])
[59014.118267] [bf9c2089] (ath9k_rx_tasklet+0x290/0x490 [ath9k_htc]) from 
[c0036d23] (tasklet_action+0x3b/0x98)
[59014.134132] [c0036d23] (tasklet_action+0x3b/0x98) from [c0036709] 
(__do_softirq+0x99/0x16c)
[59014.147784] [c0036709] (__do_softirq+0x99/0x16c) from [c00369f7] 
(irq_exit+0x5b/0x5c)
[59014.160653] [c00369f7] (irq_exit+0x5b/0x5c) from [c000cfc3] 
(handle_IRQ+0x37/0x78)
[59014.173124] [c000cfc3] (handle_IRQ+0x37/0x78) from [c00085df] 
(omap3_intc_handle_irq+0x5f/0x68)
[59014.187225] [c00085df] (omap3_intc_handle_irq+0x5f/0x68) from 
[c04c28db](__irq_svc+0x3b/0x5c)
 
This bug can be see with low performance board, such as uniprocessor beagle 
bone board.
 
 
Signed-off-by: Yuwei Zheng zhengyu...@360.cn
Signed-off-by: Yuwei Zheng yuweizh...@139.com


---
 drivers/net/wireless/ath/ath9k/hif_usb.c   | 58 ++
 drivers/net/wireless/ath/ath9k/hif_usb.h   |  5 +++
 drivers/net/wireless/ath/ath9k/htc.h   | 13 ++
 drivers/net/wireless/ath/ath9k/htc_drv_debug.c | 49 ++
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c  | 26 
 5 files changed, 144 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c 
b/drivers/net/wireless/ath/ath9k/hif_usb.c
index 8e7153b..18c6f0e 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -658,7 +658,6 @@ static void ath9k_hif_usb_rx_cb(struct urb *urb)
default:
goto resubmit;
}
-
if (likely(urb-actual_length != 0)) {
skb_put(skb, urb-actual_length);
ath9k_hif_usb_rx_stream(hif_dev, skb);
@@ -667,12 +666,18 @@ static void ath9k_hif_usb_rx_cb(struct urb *urb)
 resubmit:
skb_reset_tail_pointer(skb);
skb_trim(skb, 0);
-
-   usb_anchor_urb(urb, hif_dev-rx_submitted);
-   ret = usb_submit_urb(urb, GFP_ATOMIC);
-   if (ret) {
-   usb_unanchor_urb(urb);
-   goto free;
+   if (atomic_read(hif_dev-rx_urb_submit_delay)  0) {
+   usb_anchor_urb(urb, hif_dev-rx_delayed_submitted);
+   ret = tasklet_hrtimer_start(hif_dev-rx_submit_timer,
+   ktime_set(0, 
atomic_read(hif_dev-rx_urb_submit_delay)*1000),
+   HRTIMER_MODE_REL);
+   } else {
+   usb_anchor_urb(urb, hif_dev-rx_submitted);
+   ret = usb_submit_urb(urb, GFP_ATOMIC);
+   if (ret) {
+   usb_unanchor_urb(urb);
+   goto free;
+   }
}
 
return;
@@ -818,9 +823,39 @@ err:
return -ENOMEM;
 }
 
+static enum hrtimer_restart rx_urb_submit_timer_handler(struct hrtimer *me)
+{
+   struct tasklet_hrtimer *thr =
+   container_of(me, struct tasklet_hrtimer, timer);
+   struct  hif_device_usb *hif_dev =
+   container_of(thr, struct hif_device_usb, rx_submit_timer);
+   struct urb *urb = NULL;
+   struct sk_buff *skb = NULL;
+   int ret;
+
+   while (true) {
+   urb = usb_get_from_anchor(hif_dev-rx_delayed_submitted);
+   if (urb != NULL) {
+   skb = (struct sk_buff *)urb-context;
+   ret = usb_submit_urb(urb, GFP_ATOMIC);
+   if (ret != -EBUSY) {
+   usb_unanchor_urb(urb);
+   dev_kfree_skb_any(skb);
+   urb-context = NULL;
+   }
+   } else {
+   

Re: [PATCH] iw: print human readable radar events

2015-01-30 Thread Joe Perches
On Fri, 2015-01-30 at 10:42 +0100, Helmut Schaa wrote:
 diff --git a/event.c b/event.c
[]
 @@ -565,6 +565,31 @@ static int print_event(struct nl_msg *msg, void *arg)
  nla_data(tb[NL80211_ATTR_VENDOR_DATA]),
  nla_len(tb[NL80211_ATTR_VENDOR_DATA]));
   break;
 + case NL80211_CMD_RADAR_DETECT:
 + printf(radar event );
 + if (tb[NL80211_ATTR_RADAR_EVENT]) {
 + switch (nla_get_u32(tb[NL80211_ATTR_RADAR_EVENT])) {
 + case NL80211_RADAR_DETECTED:
 + printf((radar detected));
 + break;
 + case NL80211_RADAR_CAC_FINISHED:
 + printf((cac finished));
 + break;
 + case NL80211_RADAR_CAC_ABORTED:
 + printf((cac aborted));
 + break;
 + case NL80211_RADAR_NOP_FINISHED:
 + printf((nop finished));
 + break;
 + default:
 + printf((unknown));
 + break;
 + };
 + } else {
 + printf((unknown));
 + }
 + printf(\n);
 + break;

Might be better with a const char * use

case NL80211_CMD_RADAR_DETECT: {
const char *type = unknown;

if (tb[NL80211_ATTR_RADAR_EVENT]) {
switch (nla_get_u32(tb[NL80211_ATTR_RADAR_EVENT])) {
case NL80211_RADAR_DETECTED:
type = radar detected;
break;
case NL80211_RADAR_CAC_FINISHED:
type = cac finished;
break;
case NL80211_RADAR_CAC_ABORTED:
type = cac aborted;
break;
case NL80211_RADAR_NOP_FINISHED:
type = nop finished;
break;
}
}
printf(radar event: (%s)\n, type);
}


--
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 5/6] rtlwifi: btcoexist: Add routines for RTL8812AE kernel socket communications

2015-01-30 Thread Marcel Holtmann
Hi Kalle,

 I'm adding bluetooth list to the discussion. Full patch is available
 here:
 
 https://patchwork.kernel.org/patch/5712591/
 
 Larry Finger larry.fin...@lwfinger.net writes:
 
 From: Troy Tan troy_...@realsil.com.cn
 
 This patch adds the routines used to communicate between the RTL8812AE (wifi)
 device and the RTL8761AU (bluetooth) device that are part of the same chip.
 Unlike other similar dual-function devices, this chip does not contain 
 special
 hardware that lets the firmware pass coexistence info from one part to the
 other. As a result, this driver implements such communication as a kernel
 socket.
 
 Signed-off-by: Troy Tan troy_...@realsil.com.cn
 Signed-off-by: Larry Finger larry.fin...@lwfinger.net
 ---
 V2 - Add comments explaining the routine that sends a message via the
 socket.
 
 The commit log is not still explaining that much about the actual
 functionality, so I investigated on my own:
 
 +static u8 rtl_btcoex_create_kernel_socket(struct rtl_priv *rtlpriv,
 +  u8 is_invite)
 +{
 +struct bt_coex_info *pcoex_info = rtlpriv-coex_info;
 +s8 kernel_socket_err;
 +
 +BTC_PRINT(BTC_MSG_SOCKET, SOCKET_CRITICAL,
 +  %s CONNECT_PORT %d\n, __func__, CONNECT_PORT);
 +
 +if (!pcoex_info) {
 +BTC_PRINT(BTC_MSG_SOCKET, SOCKET_CRITICAL, coex_info: NULL\n);
 +return _FAIL;
 +}
 +
 +kernel_socket_err = sock_create(PF_INET, SOCK_DGRAM, 0,
 +pcoex_info-udpsock);
 +BTC_PRINT(BTC_MSG_SOCKET, SOCKET_CRITICAL,
 +  binding socket, err = %d\n, kernel_socket_err);
 +
 +if (kernel_socket_err  0) {
 +BTC_PRINT(BTC_MSG_SOCKET, SOCKET_CRITICAL,
 +  Error during creation of socket error:%d\n,
 +  kernel_socket_err);
 +return _FAIL;
 +}
 +memset(pcoex_info-sin, 0, sizeof(pcoex_info-sin));
 +pcoex_info-sin.sin_family = AF_INET;
 +pcoex_info-sin.sin_port = htons(CONNECT_PORT);
 +pcoex_info-sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
 +
 +memset(pcoex_info-bt_addr, 0, sizeof(pcoex_info-bt_addr));
 +pcoex_info-bt_addr.sin_family = AF_INET;
 +pcoex_info-bt_addr.sin_port = htons(CONNECT_PORT_BT);
 +pcoex_info-bt_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
 +
 +pcoex_info-sk_store = NULL;
 +
 +kernel_socket_err =
 +   pcoex_info-udpsock-ops-bind(pcoex_info-udpsock,
 +  (struct sockaddr *)pcoex_info-sin,
 +  sizeof(pcoex_info-sin));
 +if (kernel_socket_err == 0) {
 +BTC_PRINT(BTC_MSG_SOCKET, SOCKET_CRITICAL,
 +  binding socket success\n);
 +pcoex_info-udpsock-sk-sk_data_ready =
 +rtl_btcoex_recvmsg_int;
 +pcoex_info-sock_open |=  KERNEL_SOCKET_OK;
 +pcoex_info-bt_attend = false;
 +BTC_PRINT(BTC_MSG_SOCKET, SOCKET_CRITICAL,
 +  WIFI sending attend_req\n);
 +rtl_btcoex_sendmsgbysocket(rtlpriv, attend_req,
 +   sizeof(attend_req), true);
 +return _SUCCESS;
 
 So the wireless driver communicates with the bluetooth driver (which is
 not in upstream) via a localhost UDP connection?

I think the first order of business should be to get the Bluetooth driver 
upstream. Until that has happened this is all kinda pointless discussion.

 +#define CONNECT_PORT 3
 +#define CONNECT_PORT_BT 30001
 
 And these are the UDP ports used.
 
 +struct hci_link_info {
 +u16 connect_handle;
 +u8  incoming_traffic_mode;
 +u8  outgoing_traffic_mode;
 +u8  bt_profile;
 +u8  bt_corespec;
 +s8  bt_RSSI;
 +u8  traffic_profile;
 +u8  link_role;
 +};
 +
 +#define MAX_BT_ACL_LINK_NUM 8
 +
 +struct hci_ext_config {
 +struct hci_link_infoacl_link[MAX_BT_ACL_LINK_NUM];
 +u8  bt_operation_code;
 +u16 current_connect_handle;
 +u8  current_incoming_traffic_mode;
 +u8  current_outgoing_traffic_mode;
 +
 +u8  number_of_acl;
 +u8  number_of_sco;
 +u8  current_bt_status;
 +u16 hci_ext_ver;
 +boolenable_wifi_scan_notify;
 +};
 
 [...]
 
 +enum HCI_STATUS {
 +/* Success */
 +HCI_STATUS_SUCCESS  = 0x00,
 +/* Unknown HCI Command */
 +HCI_STATUS_UNKNOW_HCI_CMD   = 0x01,
 +/* Unknown Connection Identifier */
 +HCI_STATUS_UNKNOW_CONNECT_ID= 0X02,
 +/* Hardware Failure */
 +HCI_STATUS_HW_FAIL  = 0X03,
 +/* Page Timeout */
 +HCI_STATUS_PAGE_TIMEOUT = 0X04,
 +/* Authentication Failure */
 +HCI_STATUS_AUTH_FAIL= 0X05,
 +/* PIN or Key 

答复: [ath9k-devel] [PATCH] Repair soft lockup with monitor mode of ath9k_htc card

2015-01-30 Thread 郑玉伟
Sorry, the patch ruined by the mail editor, I will send the patch with another 
mail account witch support smtp. 

I use tasklet_hrtimer_start for delayed submit, and the hrtimer callback 
function is excuted in the lower priority than normal tasklet. (TASKLET_SOFTIRQ 
5, HRTIMER_SOFTIRQ 7 )

The hrtimer mode has been tested several weeks.  So I select this way currently.


-邮件原件-
发件人: Oleksij Rempel [mailto:li...@rempel-privat.de] 
发送时间: 2015年1月29日 18:52
收件人: 郑玉伟; linux-ker...@vger.kernel.org; ath9k-de...@venema.h4ckr.net; 
linux-wireless@vger.kernel.org; kv...@codeaurora.org; 
ath9k-de...@qca.qualcomm.com
抄送: net...@vger.kernel.org
主题: Re: [ath9k-devel] [PATCH] Repair soft lockup with monitor mode of ath9k_htc 
card

Am 29.01.2015 um 05:09 schrieb zhengyu...@360.cn:
 From: Yuwei Zheng zhengyu...@360.cn
 
 In the environment with heavy wifi traffic, set the ar9271 into 
 monitor mode, will trigger a deadloop panic.
 
 The ath9k_hif_usb_rx_cb function excute on  the interrupt context, and 
 ath9k_rx_tasklet excute on the soft irq context. In other words, the 
 ath9k_hif_usb_rx_cb have more chance to excute than ath9k_rx_tasklet.  
 So in the worst condition,  the rx.rxbuf receive list is always full, and the 
 do {}while(true) loop will not be break. The kernel get a soft lockup panic.
   
 [59011.007210] BUG: soft lockup - CPU#0 stuck for 23s! 
 [kworker/0:0:30609]
 [59011.030560] BUG: scheduling while atomic: 
 kworker/0:0/30609/0x40010100 [59013.804486] BUG: scheduling while 
 atomic: kworker/0:0/30609/0x40010100 [59013.858522] Kernel panic - not 
 syncing: softlockup: hung tasks
 
 [59014.038891] Exception stack(0xdf4bbc38 to 0xdf4bbc80)
 [59014.046834] bc20:   
 de57b950 6113
 [59014.059579] bc40:  bb32bb32 6113 de57b948 de57b500 
 dc7bb440 df4bbcd0  [59014.072337] bc60: de57b950 6113 
 df4bbcd0 df4bbc80 c04c259d c04c25a0 6133  [59014.085233] 
 [c04c28db] (__irq_svc+0x3b/0x5c) from [c04c25a0] 
 (_raw_spin_unlock_irqrestore+0xc/0x10)
 [59014.100437] [c04c25a0] (_raw_spin_unlock_irqrestore+0xc/0x10) 
 from [bf9c2089] (ath9k_rx_tasklet+0x290/0x490 [ath9k_htc]) 
 [59014.118267] [bf9c2089] (ath9k_rx_tasklet+0x290/0x490 [ath9k_htc]) 
 from [c0036d23] (tasklet_action+0x3b/0x98) [59014.134132] 
 [c0036d23] (tasklet_action+0x3b/0x98) from [c0036709] 
 (__do_softirq+0x99/0x16c) [59014.147784] [c0036709] 
 (__do_softirq+0x99/0x16c) from [c00369f7] (irq_exit+0x5b/0x5c) 
 [59014.160653] [c00369f7] (irq_exit+0x5b/0x5c) from [c000cfc3] 
 (handle_IRQ+0x37/0x78) [59014.173124] [c000cfc3] 
 (handle_IRQ+0x37/0x78) from [c00085df] 
 (omap3_intc_handle_irq+0x5f/0x68) [59014.187225] [c00085df] 
 (omap3_intc_handle_irq+0x5f/0x68) from 
 [c04c28db](__irq_svc+0x3b/0x5c)
 
 This bug can be see with low performance board, such as uniprocessor beagle 
 bone board.
 Signed-off-by: Yuwei Zheng zhengyu...@360.cn
 
 ---
  drivers/net/wireless/ath/ath9k/hif_usb.c   | 53 
 ++
  drivers/net/wireless/ath/ath9k/hif_usb.h   |  5 +++
  drivers/net/wireless/ath/ath9k/htc.h   | 13 +++
  drivers/net/wireless/ath/ath9k/htc_drv_debug.c | 49 
   
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c  | 26 +
  5 files changed, 139 insertions(+), 7 deletions(-)

First of all, thank you for you work! :D

Please run ./scripts/checkpatch.pl yourpatch_path i get:
total: 139 errors, 12 warnings, 2 checks, 231 lines checked

You use tasklet_hrtimer_start. So far i know, there is no this kind of hrtimer 
which is actually hidden behind this word on this SoC.
Especially if requested value is any way in 1 millisecond range you probably 
can and should use normal priority tasklet. (correct me if i'm
wrong)

 diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c 
 b/drivers/net/wireless/ath/ath9k/hif_usb.c
 index 8e7153b..febea5e 100644
 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c
 +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
 @@ -658,7 +658,6 @@ static void ath9k_hif_usb_rx_cb(struct urb *urb)
   default:
   goto resubmit;
   }
 -
   if (likely(urb-actual_length != 0)) {
   skb_put(skb, urb-actual_length);
   ath9k_hif_usb_rx_stream(hif_dev, skb); @@ -667,12 +666,18 @@ 
 static 
 void ath9k_hif_usb_rx_cb(struct urb *urb)
  resubmit:
   skb_reset_tail_pointer(skb);
   skb_trim(skb, 0);
 -
 - usb_anchor_urb(urb, hif_dev-rx_submitted);
 - ret = usb_submit_urb(urb, GFP_ATOMIC);
 - if (ret) {
 - usb_unanchor_urb(urb);
 - goto free;
 + if (atomic_read(hif_dev-rx_urb_submit_delay)  0) {
 + usb_anchor_urb(urb, hif_dev-rx_delayed_submitted);
 + ret = tasklet_hrtimer_start(hif_dev-rx_submit_timer,
 + ktime_set(0, 
 atomic_read(hif_dev-rx_urb_submit_delay)*1000),
 + HRTIMER_MODE_REL);
 + } 

Re: cfg80211_ops: deauthentication disassociation

2015-01-30 Thread Johannes Berg
On Fri, 2015-01-30 at 09:17 +0100, Rafał Miłecki wrote:

  In hostapd, there is a routine that monitors such netlink messages,
  process_global_event, which eventually parses the CMD_DEL_STATION event in
  nl80211_del_station_event, where a call is made to drv_event_disassoc if the
  current device is indeed in AP mode.
  So eventually, it is the hostapd that triggers the transmission of the
  disassociation packet.
 
 I indeed missed the way cfg80211_del_sta works and hostapd's event
 handler for this. That explains a lot.
 
 I've checked ath6kl, brcmfmac and mwifiex and they don't seem to call
 cfg80211_del_sta. AFAIU it's because they handle sending
 disassoc/deauth packet on their own (and the don't want e.g. hostapd
 to do this), is that correct?

There are two ways - AP SME in firmware, and AP SME in hostapd.

They work differently - in the former case (firmware) the AP station is
added there and hostapd gets notifications about it.

In the latter case, hostapd adds/removes all the stations.

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] iw: print human readable radar events

2015-01-30 Thread Helmut Schaa
Signed-off-by: Helmut Schaa helmut.sc...@googlemail.com
---
 event.c | 25 +
 1 file changed, 25 insertions(+)

diff --git a/event.c b/event.c
index c175c66..71ab7f7 100644
--- a/event.c
+++ b/event.c
@@ -565,6 +565,31 @@ static int print_event(struct nl_msg *msg, void *arg)
   nla_data(tb[NL80211_ATTR_VENDOR_DATA]),
   nla_len(tb[NL80211_ATTR_VENDOR_DATA]));
break;
+   case NL80211_CMD_RADAR_DETECT:
+   printf(radar event );
+   if (tb[NL80211_ATTR_RADAR_EVENT]) {
+   switch (nla_get_u32(tb[NL80211_ATTR_RADAR_EVENT])) {
+   case NL80211_RADAR_DETECTED:
+   printf((radar detected));
+   break;
+   case NL80211_RADAR_CAC_FINISHED:
+   printf((cac finished));
+   break;
+   case NL80211_RADAR_CAC_ABORTED:
+   printf((cac aborted));
+   break;
+   case NL80211_RADAR_NOP_FINISHED:
+   printf((nop finished));
+   break;
+   default:
+   printf((unknown));
+   break;
+   };
+   } else {
+   printf((unknown));
+   }
+   printf(\n);
+   break;
default:
printf(unknown event %d (%s)\n,
   gnlh-cmd, command_name(gnlh-cmd));
-- 
1.8.4.5

--
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 4/4] ath10k: implement fw stats for wmi-tlv

2015-01-30 Thread Michal Kazior
This processes and pushes fw stats to the debug
module (if enabled).

Changing the generic ath10k_wmi_requests_stats()
call to use more stat bits has no effect on older
firmware binaries.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/debug.c   |   5 +-
 drivers/net/wireless/ath/ath10k/wmi-tlv.c | 112 +-
 drivers/net/wireless/ath/ath10k/wmi-tlv.h |   9 +++
 3 files changed, 122 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index 33f36ee..518d21c 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -395,7 +395,10 @@ static int ath10k_debug_fw_stats_request(struct ath10k *ar)
 
reinit_completion(ar-debug.fw_stats_complete);
 
-   ret = ath10k_wmi_request_stats(ar, WMI_STAT_PEER);
+   ret = ath10k_wmi_request_stats(ar,
+  WMI_STAT_PDEV |
+  WMI_STAT_VDEV |
+  WMI_STAT_PEER);
if (ret) {
ath10k_warn(ar, could not request stats (%d)\n, ret);
return ret;
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index 8264f2e..737f747 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -869,16 +869,57 @@ static int ath10k_wmi_tlv_op_pull_rdy_ev(struct ath10k 
*ar,
return 0;
 }
 
+static void ath10k_wmi_tlv_pull_vdev_stats(const struct wmi_tlv_vdev_stats 
*src,
+  struct ath10k_fw_stats_vdev *dst)
+{
+   int i;
+
+   dst-vdev_id = __le32_to_cpu(src-vdev_id);
+   dst-beacon_snr = __le32_to_cpu(src-beacon_snr);
+   dst-data_snr = __le32_to_cpu(src-data_snr);
+   dst-num_rx_frames = __le32_to_cpu(src-num_rx_frames);
+   dst-num_rts_fail = __le32_to_cpu(src-num_rts_fail);
+   dst-num_rts_success = __le32_to_cpu(src-num_rts_success);
+   dst-num_rx_err = __le32_to_cpu(src-num_rx_err);
+   dst-num_rx_discard = __le32_to_cpu(src-num_rx_discard);
+   dst-num_tx_not_acked = __le32_to_cpu(src-num_tx_not_acked);
+
+   for (i = 0; i  ARRAY_SIZE(src-num_tx_frames); i++)
+   dst-num_tx_frames[i] =
+   __le32_to_cpu(src-num_tx_frames[i]);
+
+   for (i = 0; i  ARRAY_SIZE(src-num_tx_frames_retries); i++)
+   dst-num_tx_frames_retries[i] =
+   __le32_to_cpu(src-num_tx_frames_retries[i]);
+
+   for (i = 0; i  ARRAY_SIZE(src-num_tx_frames_failures); i++)
+   dst-num_tx_frames_failures[i] =
+   __le32_to_cpu(src-num_tx_frames_failures[i]);
+
+   for (i = 0; i  ARRAY_SIZE(src-tx_rate_history); i++)
+   dst-tx_rate_history[i] =
+   __le32_to_cpu(src-tx_rate_history[i]);
+
+   for (i = 0; i  ARRAY_SIZE(src-beacon_rssi_history); i++)
+   dst-beacon_rssi_history[i] =
+   __le32_to_cpu(src-beacon_rssi_history[i]);
+}
+
 static int ath10k_wmi_tlv_op_pull_fw_stats(struct ath10k *ar,
   struct sk_buff *skb,
   struct ath10k_fw_stats *stats)
 {
const void **tb;
-   const struct wmi_stats_event *ev;
+   const struct wmi_tlv_stats_ev *ev;
const void *data;
-   u32 num_pdev_stats, num_vdev_stats, num_peer_stats;
+   u32 num_pdev_stats;
+   u32 num_vdev_stats;
+   u32 num_peer_stats;
+   u32 num_bcnflt_stats;
+   u32 num_chan_stats;
size_t data_len;
int ret;
+   int i;
 
tb = ath10k_wmi_tlv_parse_alloc(ar, skb-data, skb-len, GFP_ATOMIC);
if (IS_ERR(tb)) {
@@ -899,8 +940,73 @@ static int ath10k_wmi_tlv_op_pull_fw_stats(struct ath10k 
*ar,
num_pdev_stats = __le32_to_cpu(ev-num_pdev_stats);
num_vdev_stats = __le32_to_cpu(ev-num_vdev_stats);
num_peer_stats = __le32_to_cpu(ev-num_peer_stats);
+   num_bcnflt_stats = __le32_to_cpu(ev-num_bcnflt_stats);
+   num_chan_stats = __le32_to_cpu(ev-num_chan_stats);
 
-   WARN_ON(1); /* FIXME: not implemented yet */
+   ath10k_dbg(ar, ATH10K_DBG_WMI,
+  wmi tlv stats update pdev %i vdev %i peer %i bcnflt %i chan 
%i\n,
+  num_pdev_stats, num_vdev_stats, num_peer_stats,
+  num_bcnflt_stats, num_chan_stats);
+
+   for (i = 0; i  num_pdev_stats; i++) {
+   const struct wmi_pdev_stats *src;
+   struct ath10k_fw_stats_pdev *dst;
+
+   src = data;
+   if (data_len  sizeof(*src))
+   return -EPROTO;
+
+   data += sizeof(*src);
+   data_len -= sizeof(*src);
+
+   dst = 

[PATCH 3/4] ath10k: add more wmi fw stat defines

2015-01-30 Thread Michal Kazior
New qca6174 wmi-tlv firmware revisions support
more stat event bits.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/debug.c |  2 +-
 drivers/net/wireless/ath/ath10k/wmi.h   | 10 +++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index f0a6b93..33f36ee 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -395,7 +395,7 @@ static int ath10k_debug_fw_stats_request(struct ath10k *ar)
 
reinit_completion(ar-debug.fw_stats_complete);
 
-   ret = ath10k_wmi_request_stats(ar, WMI_REQUEST_PEER_STAT);
+   ret = ath10k_wmi_request_stats(ar, WMI_STAT_PEER);
if (ret) {
ath10k_warn(ar, could not request stats (%d)\n, ret);
return ret;
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index 20ce360..0eb0959 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -3057,8 +3057,12 @@ struct wmi_pdev_stats_peer {
 } __packed;
 
 enum wmi_stats_id {
-   WMI_REQUEST_PEER_STAT   = 0x01,
-   WMI_REQUEST_AP_STAT = 0x02
+   WMI_STAT_PEER = BIT(0),
+   WMI_STAT_AP = BIT(1),
+   WMI_STAT_PDEV = BIT(2),
+   WMI_STAT_VDEV = BIT(3),
+   WMI_STAT_BCNFLT = BIT(4),
+   WMI_STAT_VDEV_RATE = BIT(5),
 };
 
 struct wlan_inst_rssi_args {
@@ -3093,7 +3097,7 @@ struct wmi_pdev_suspend_cmd {
 } __packed;
 
 struct wmi_stats_event {
-   __le32 stats_id; /* %WMI_REQUEST_ */
+   __le32 stats_id; /* WMI_STAT_ */
/*
 * number of pdev stats event structures
 * (wmi_pdev_stats) 0 or 1
-- 
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 1/4] ath10k: add vdev stats processing

2015-01-30 Thread Michal Kazior
New qca6174 wmi-tlv firmware supports vdev stats.
This patch adds support for it in the debug
frontend.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/core.h  | 20 +++
 drivers/net/wireless/ath/ath10k/debug.c | 96 +
 2 files changed, 116 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index abb3203..dbc6c51 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -159,6 +159,25 @@ struct ath10k_fw_stats_peer {
u32 peer_rx_rate; /* 10x only */
 };
 
+struct ath10k_fw_stats_vdev {
+   struct list_head list;
+
+   u32 vdev_id;
+   u32 beacon_snr;
+   u32 data_snr;
+   u32 num_tx_frames[4];
+   u32 num_rx_frames;
+   u32 num_tx_frames_retries[4];
+   u32 num_tx_frames_failures[4];
+   u32 num_rts_fail;
+   u32 num_rts_success;
+   u32 num_rx_err;
+   u32 num_rx_discard;
+   u32 num_tx_not_acked;
+   u32 tx_rate_history[10];
+   u32 beacon_rssi_history[10];
+};
+
 struct ath10k_fw_stats_pdev {
struct list_head list;
 
@@ -220,6 +239,7 @@ struct ath10k_fw_stats_pdev {
 
 struct ath10k_fw_stats {
struct list_head pdevs;
+   struct list_head vdevs;
struct list_head peers;
 };
 
diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index 42b2e49..f0a6b93 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -243,6 +243,16 @@ static void ath10k_debug_fw_stats_pdevs_free(struct 
list_head *head)
}
 }
 
+static void ath10k_debug_fw_stats_vdevs_free(struct list_head *head)
+{
+   struct ath10k_fw_stats_vdev *i, *tmp;
+
+   list_for_each_entry_safe(i, tmp, head, list) {
+   list_del(i-list);
+   kfree(i);
+   }
+}
+
 static void ath10k_debug_fw_stats_peers_free(struct list_head *head)
 {
struct ath10k_fw_stats_peer *i, *tmp;
@@ -258,6 +268,7 @@ static void ath10k_debug_fw_stats_reset(struct ath10k *ar)
spin_lock_bh(ar-data_lock);
ar-debug.fw_stats_done = false;
ath10k_debug_fw_stats_pdevs_free(ar-debug.fw_stats.pdevs);
+   ath10k_debug_fw_stats_vdevs_free(ar-debug.fw_stats.vdevs);
ath10k_debug_fw_stats_peers_free(ar-debug.fw_stats.peers);
spin_unlock_bh(ar-data_lock);
 }
@@ -273,14 +284,27 @@ static size_t ath10k_debug_fw_stats_num_peers(struct 
list_head *head)
return num;
 }
 
+static size_t ath10k_debug_fw_stats_num_vdevs(struct list_head *head)
+{
+   struct ath10k_fw_stats_vdev *i;
+   size_t num = 0;
+
+   list_for_each_entry(i, head, list)
+   ++num;
+
+   return num;
+}
+
 void ath10k_debug_fw_stats_process(struct ath10k *ar, struct sk_buff *skb)
 {
struct ath10k_fw_stats stats = {};
bool is_start, is_started, is_end;
size_t num_peers;
+   size_t num_vdevs;
int ret;
 
INIT_LIST_HEAD(stats.pdevs);
+   INIT_LIST_HEAD(stats.vdevs);
INIT_LIST_HEAD(stats.peers);
 
spin_lock_bh(ar-data_lock);
@@ -308,6 +332,7 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, 
struct sk_buff *skb)
}
 
num_peers = ath10k_debug_fw_stats_num_peers(ar-debug.fw_stats.peers);
+   num_vdevs = ath10k_debug_fw_stats_num_vdevs(ar-debug.fw_stats.vdevs);
is_start = (list_empty(ar-debug.fw_stats.pdevs) 
!list_empty(stats.pdevs));
is_end = (!list_empty(ar-debug.fw_stats.pdevs) 
@@ -330,7 +355,13 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, 
struct sk_buff *skb)
goto free;
}
 
+   if (num_vdevs = BITS_PER_LONG) {
+   ath10k_warn(ar, dropping fw vdev stats\n);
+   goto free;
+   }
+
list_splice_tail_init(stats.peers, ar-debug.fw_stats.peers);
+   list_splice_tail_init(stats.vdevs, ar-debug.fw_stats.vdevs);
}
 
complete(ar-debug.fw_stats_complete);
@@ -340,6 +371,7 @@ free:
 * resources if that is not the case.
 */
ath10k_debug_fw_stats_pdevs_free(stats.pdevs);
+   ath10k_debug_fw_stats_vdevs_free(stats.vdevs);
ath10k_debug_fw_stats_peers_free(stats.peers);
 
 unlock:
@@ -395,8 +427,11 @@ static void ath10k_fw_stats_fill(struct ath10k *ar,
unsigned int len = 0;
unsigned int buf_len = ATH10K_FW_STATS_BUF_SIZE;
const struct ath10k_fw_stats_pdev *pdev;
+   const struct ath10k_fw_stats_vdev *vdev;
const struct ath10k_fw_stats_peer *peer;
size_t num_peers;
+   size_t num_vdevs;
+   int i;
 
spin_lock_bh(ar-data_lock);
 
@@ -408,6 +443,7 @@ static void ath10k_fw_stats_fill(struct ath10k *ar,
}
 
num_peers = ath10k_debug_fw_stats_num_peers(fw_stats-peers);
+   num_vdevs 

[PATCH 2/4] ath10k: change request stats command prototype

2015-01-30 Thread Michal Kazior
The expected parameter is not a single value but a
mask of values.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/wmi-ops.h | 7 +++
 drivers/net/wireless/ath/ath10k/wmi-tlv.c | 5 ++---
 drivers/net/wireless/ath/ath10k/wmi.c | 7 ---
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi-ops.h 
b/drivers/net/wireless/ath/ath10k/wmi-ops.h
index 058f88b..ec8e156 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-ops.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h
@@ -107,8 +107,7 @@ struct wmi_ops {
struct sk_buff *(*gen_beacon_dma)(struct ath10k_vif *arvif);
struct sk_buff *(*gen_pdev_set_wmm)(struct ath10k *ar,
const struct wmi_wmm_params_all_arg 
*arg);
-   struct sk_buff *(*gen_request_stats)(struct ath10k *ar,
-enum wmi_stats_id stats_id);
+   struct sk_buff *(*gen_request_stats)(struct ath10k *ar, u32 stats_mask);
struct sk_buff *(*gen_force_fw_hang)(struct ath10k *ar,
 enum wmi_force_fw_hang_type type,
 u32 delay_ms);
@@ -809,14 +808,14 @@ ath10k_wmi_pdev_set_wmm_params(struct ath10k *ar,
 }
 
 static inline int
-ath10k_wmi_request_stats(struct ath10k *ar, enum wmi_stats_id stats_id)
+ath10k_wmi_request_stats(struct ath10k *ar, u32 stats_mask)
 {
struct sk_buff *skb;
 
if (!ar-wmi.ops-gen_request_stats)
return -EOPNOTSUPP;
 
-   skb = ar-wmi.ops-gen_request_stats(ar, stats_id);
+   skb = ar-wmi.ops-gen_request_stats(ar, stats_mask);
if (IS_ERR(skb))
return PTR_ERR(skb);
 
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index be32db9..8264f2e 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -2078,8 +2078,7 @@ ath10k_wmi_tlv_op_gen_pdev_set_wmm(struct ath10k *ar,
 }
 
 static struct sk_buff *
-ath10k_wmi_tlv_op_gen_request_stats(struct ath10k *ar,
-   enum wmi_stats_id stats_id)
+ath10k_wmi_tlv_op_gen_request_stats(struct ath10k *ar, u32 stats_mask)
 {
struct wmi_request_stats_cmd *cmd;
struct wmi_tlv *tlv;
@@ -2093,7 +2092,7 @@ ath10k_wmi_tlv_op_gen_request_stats(struct ath10k *ar,
tlv-tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_REQUEST_STATS_CMD);
tlv-len = __cpu_to_le16(sizeof(*cmd));
cmd = (void *)tlv-value;
-   cmd-stats_id = __cpu_to_le32(stats_id);
+   cmd-stats_id = __cpu_to_le32(stats_mask);
 
ath10k_dbg(ar, ATH10K_DBG_WMI, wmi tlv request stats\n);
return skb;
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index ce6f0c7..27e0c18 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -4923,7 +4923,7 @@ ath10k_wmi_op_gen_pdev_set_wmm(struct ath10k *ar,
 }
 
 static struct sk_buff *
-ath10k_wmi_op_gen_request_stats(struct ath10k *ar, enum wmi_stats_id stats_id)
+ath10k_wmi_op_gen_request_stats(struct ath10k *ar, u32 stats_mask)
 {
struct wmi_request_stats_cmd *cmd;
struct sk_buff *skb;
@@ -4933,9 +4933,10 @@ ath10k_wmi_op_gen_request_stats(struct ath10k *ar, enum 
wmi_stats_id stats_id)
return ERR_PTR(-ENOMEM);
 
cmd = (struct wmi_request_stats_cmd *)skb-data;
-   cmd-stats_id = __cpu_to_le32(stats_id);
+   cmd-stats_id = __cpu_to_le32(stats_mask);
 
-   ath10k_dbg(ar, ATH10K_DBG_WMI, wmi request stats %d\n, (int)stats_id);
+   ath10k_dbg(ar, ATH10K_DBG_WMI, wmi request stats 0x%08x\n,
+  stats_mask);
return skb;
 }
 
-- 
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 0/4] ath10k: implement fw stats for wmi-tlv

2015-01-30 Thread Michal Kazior
There are some slight differences in fw stats
(sic) in wmi-tlv.

Firmware has changed the querying scheme and no
longer requires the ping-pong to get all stats.
The patchset doesn't change this behaviour so with
wmi-tlv it's possible to see the following
warnings when reading fw stats:

 ath10k_pci :00:06.0: received unsolicited stats update event

The logic in ath10k still produces correct results
so this is harmless.

I wonder how to deal with this in a sane way. An
`if (op_ver == WMI_TLV)` is a little bad but
having a new ar-fw_feature flag just for a debug
facility like this is a bit silly. Or we can just
drop the warning and leave a comment. Ideas?


Michal Kazior (4):
  ath10k: add vdev stats processing
  ath10k: change request stats command prototype
  ath10k: add more wmi fw stat defines
  ath10k: implement fw stats for wmi-tlv

 drivers/net/wireless/ath/ath10k/core.h|  20 +
 drivers/net/wireless/ath/ath10k/debug.c   | 101 +-
 drivers/net/wireless/ath/ath10k/wmi-ops.h |   7 +-
 drivers/net/wireless/ath/ath10k/wmi-tlv.c | 117 --
 drivers/net/wireless/ath/ath10k/wmi-tlv.h |   9 +++
 drivers/net/wireless/ath/ath10k/wmi.c |   7 +-
 drivers/net/wireless/ath/ath10k/wmi.h |  10 ++-
 7 files changed, 254 insertions(+), 17 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: add TxBF support

2015-01-30 Thread Michal Kazior
If firmware advertises support for TxBF then the
driver has to instruct the firmware accordingly
during runtime. Without this patch connecting to
an AP with beamformer support would yield abysmal
Rx performance.

This has been tested with wmi-tlv and qca6174
while acting as a STA beamformee only.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/mac.c | 79 +++
 drivers/net/wireless/ath/ath10k/wmi.h |  5 +++
 2 files changed, 84 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 15e47f4..81455dc 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1764,6 +1764,68 @@ static int ath10k_setup_peer_smps(struct ath10k *ar, 
struct ath10k_vif *arvif,
 ath10k_smps_map[smps]);
 }
 
+static int ath10k_mac_vif_recalc_txbf(struct ath10k *ar,
+ struct ieee80211_vif *vif,
+ struct ieee80211_sta_vht_cap vht_cap)
+{
+   struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
+   int ret;
+   u32 param;
+   u32 value;
+
+   if (!(ar-vht_cap_info 
+ (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE |
+  IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE |
+  IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE |
+  IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE)))
+   return 0;
+
+   param = ar-wmi.vdev_param-txbf;
+   value = 0;
+
+   if (WARN_ON(param == WMI_VDEV_PARAM_UNSUPPORTED))
+   return 0;
+
+   /* The following logic is correct. If a remote STA advertises support
+* for being a beamformer then we should enable us being a beamformee.
+*/
+
+   if (ar-vht_cap_info 
+   (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE |
+IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE)) {
+   if (vht_cap.cap  IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE)
+   value |= WMI_VDEV_PARAM_TXBF_SU_TX_BFEE;
+
+   if (vht_cap.cap  IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE)
+   value |= WMI_VDEV_PARAM_TXBF_MU_TX_BFEE;
+   }
+
+   if (ar-vht_cap_info 
+   (IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE |
+IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE)) {
+   if (vht_cap.cap  IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE)
+   value |= WMI_VDEV_PARAM_TXBF_SU_TX_BFER;
+
+   if (vht_cap.cap  IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE)
+   value |= WMI_VDEV_PARAM_TXBF_MU_TX_BFER;
+   }
+
+   if (value  WMI_VDEV_PARAM_TXBF_MU_TX_BFEE)
+   value |= WMI_VDEV_PARAM_TXBF_SU_TX_BFEE;
+
+   if (value  WMI_VDEV_PARAM_TXBF_MU_TX_BFER)
+   value |= WMI_VDEV_PARAM_TXBF_SU_TX_BFER;
+
+   ret = ath10k_wmi_vdev_set_param(ar, arvif-vdev_id, param, value);
+   if (ret) {
+   ath10k_warn(ar, failed to submit vdev param txbf 0x%x: %d\n,
+   value, ret);
+   return ret;
+   }
+
+   return 0;
+}
+
 /* can be called only in mac80211 callbacks due to `key_count` usage */
 static void ath10k_bss_assoc(struct ieee80211_hw *hw,
 struct ieee80211_vif *vif,
@@ -1772,6 +1834,7 @@ static void ath10k_bss_assoc(struct ieee80211_hw *hw,
struct ath10k *ar = hw-priv;
struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
struct ieee80211_sta_ht_cap ht_cap;
+   struct ieee80211_sta_vht_cap vht_cap;
struct wmi_peer_assoc_complete_arg peer_arg;
struct ieee80211_sta *ap_sta;
int ret;
@@ -1794,6 +1857,7 @@ static void ath10k_bss_assoc(struct ieee80211_hw *hw,
/* ap_sta must be accessed only within rcu section which must be left
 * before calling ath10k_setup_peer_smps() which might sleep. */
ht_cap = ap_sta-ht_cap;
+   vht_cap = ap_sta-vht_cap;
 
ret = ath10k_peer_assoc_prepare(ar, vif, ap_sta, peer_arg);
if (ret) {
@@ -1819,6 +1883,13 @@ static void ath10k_bss_assoc(struct ieee80211_hw *hw,
return;
}
 
+   ret = ath10k_mac_vif_recalc_txbf(ar, vif, vht_cap);
+   if (ret) {
+   ath10k_warn(ar, failed to recalc txbf for vdev %i on bss %pM: 
%d\n,
+   arvif-vdev_id, bss_conf-bssid, ret);
+   return;
+   }
+
ath10k_dbg(ar, ATH10K_DBG_MAC,
   mac vdev %d up (associated) bssid %pM aid %d\n,
   arvif-vdev_id, bss_conf-bssid, bss_conf-aid);
@@ -1843,6 +1914,7 @@ static void ath10k_bss_disassoc(struct ieee80211_hw *hw,
 {
struct ath10k *ar = hw-priv;
struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
+   struct ieee80211_sta_vht_cap vht_cap = {};
int ret;
 
lockdep_assert_held(ar-conf_mutex);
@@ -1855,6 +1927,13 @@ 

Re: Throughput regression with `tcp: refine TSO autosizing`

2015-01-30 Thread Arend van Spriel

On 01/29/15 14:14, Eric Dumazet wrote:

On Thu, 2015-01-29 at 12:48 +0100, Michal Kazior wrote:

Hi,

I'm not subscribed to netdev list and I can't find the message-id so I
can't reply directly to the original thread `BW regression after tcp:
refine TSO autosizing`.

I've noticed a big TCP performance drop with ath10k
(drivers/net/wireless/ath/ath10k) on 3.19-rc5. Instead of 500mbps I
get 250mbps in my testbed.

After bisecting I ended up at `tcp: refine TSO autosizing`. Reverting
`tcp: refine TSO autosizing` and `tcp: Do not apply TSO segment limit
to non-TSO packets` (for conflict free reverts) fixes the problem.

My testing setup is as follows:

  a) ath10k AP, github.com/kvalo/ath/tree/master 3.19-rc5, w/ reverts
  b) ath10k STA connected to (a), github.com/kvalo/ath/tree/master
3.19-rc5, w/ reverts
  c) (b) w/o reverts

Devices are 3x3 (AP) and 2x2 (Client) and are RF cabled. 11ac@80MHz
2x2 has 866mbps modulation rate. In practice this should deliver
~700mbps of real UDP traffic.

Here are some numbers:

UDP: (b) -  (a): 672mbps
UDP: (a) -  (b): 687mbps
TCP: (b) -  (a): 526mbps
TCP: (a) -  (b): 500mbps

UDP: (c) -  (a): 669mbps*
UDP: (a) -  (c): 689mbps*
TCP: (c) -  (a): 240mbps**
TCP: (a) -  (c): 490mbps*

* no changes/within error margin
** the performance drop

I'm using iperf:
   UDP: iperf -i1 -s -u vs iperf -i1 -c XX -u -B 200M -P5 -t 20
   TCP: iperf -i1 -s vs iperf -i1 -c XX -P5 -t 20

Result values were obtained at the receiver side.

Iperf reports a few frames lost and out-of-order at each UDP test
start (during first second) but later has no packet loss and no
out-of-order. This shouldn't have any effect on a TCP session, right?

The device delivers batched up tx/rx completions (no way to change
that). I suppose this could be an issue for timing sensitive
algorithms. Also keep in mind 802.11n and 802.11ac devices have frame
aggregation windows so there's an inherent extra (and non-uniform)
latency when compared to, e.g. ethernet devices.

The driver doesn't have GRO. I have an internal patch which implements
it. It improves overall TCP traffic (more stable, up to 600mbps TCP
which is ~100mbps more than without GRO) but the TCP: (c) -  (a)
performance drop remains unaffected regardless.

I've tried applying stretch ACK patchset (v2) on both machines and
re-run the above tests. I got no measurable difference in performance.

I've also run these tests with iwlwifi 7260 (also a 2x2) as (b) and
(c). It didn't seem to be affected by the TSO patch at all (it runs at
~360mbps of TCP regardless of the TSO patch).

Any hints/ideas?



Hi Michal

This patch restored original TSQ behavior, because the 1ms worth of data
per flow had totally destroyed TSQ intent.

vi +630 Documentation/networking/ip-sysctl.txt

tcp_limit_output_bytes - INTEGER
 Controls TCP Small Queue limit per tcp socket.
 TCP bulk sender tends to increase packets in flight until it
 gets losses notifications. With SNDBUF autotuning, this can
 result in a large amount of packets queued in qdisc/device
 on the local machine, hurting latency of other flows, for
 typical pfifo_fast qdiscs.
 tcp_limit_output_bytes limits the number of bytes on qdisc
 or device to reduce artificial RTT/cwnd and reduce bufferbloat.
 Default: 131072

This is why I suggested to Eyal Perry to change the TX interrupt
mitigation parameters as in :

ethtool -C eth0 tx-frames 4 rx-frames 4

With this change and the stretch ack fixes, I got 37Gbps of throughput
on a single flow, on a 40Gbit NIC (mlx4)

If a driver needs to buffer more than tcp_limit_output_bytes=131072 to
get line rate, I suggest that you either :

1) tweak tcp_limit_output_bytes, but its not practical from a driver.

2) change the driver, knowing what are its exact requirements, by
removing a fraction of skb-truesize at ndo_start_xmit() time as in :

if ((skb-destructor == sock_wfree ||
  skb-restuctor == tcp_wfree)
 skb-sk) {
 u32 fraction = skb-truesize / 2;

 skb-truesize -= fraction;
 atomic_sub(fraction,skb-sk-sk_wmem_alloc);
}


Hi Eric,

Your suggestions are still based on the fact that you consider wireless 
networking to be similar to ethernet, but as Michal indicated there are 
some fundamental differences starting with CSMA/CD versus CSMA/CA. Also 
the medium conditions are far from comparable. There is no shielding so 
it needs to deal with interference and dynamically drops the link rate 
so transmission of packets can take several milliseconds. Then with 11n 
they came up with aggregation with sends up to 64 packets in a single 
transmit over the air at worst case 6.5 Mbps (if I am not mistaken). The 
parameter value for tcp_limit_output_bytes of 131072 means that it 
allows queuing for about 1ms on a 1Gbps link, but I hope you can see 
this is not realistic for dealing with all variances of the wireless 
medium/standard. I suggested this as topic for the wireless workshop in 
Otawa [1], but 

Re: [PATCH 2/7] ath10k: implement chanctx API

2015-01-30 Thread Michal Kazior
On 30 January 2015 at 09:41, Michal Kazior michal.kaz...@tieto.com wrote:
 The chanctx API will allow ath10k to support
 multi-channel operation.
[...]

Oh snap. I just rebased to latest master and Yanbo's patch for 2G VHT
makes this patch null deref on assoc. I'll respin a v2 later.


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


Re: moving the wiki

2015-01-30 Thread Johannes Berg
On Fri, 2015-01-30 at 07:15 +0100, Rafał Miłecki wrote:
 On 29 January 2015 at 15:58, Johannes Berg johan...@sipsolutions.net wrote:
  Obviously, another consequence is that the wiki markup will change
  somewhat. Moin and Mediawiki aren't too far from each other (except for
  table syntax), but there are some things that are different that you'll
  have to get used to when editing.
 
  Again, dokuwiki - slightly different from moinmoin.
 
 Tables using colspans were not moved correctly, see e.g.:
 https://wireless.wiki.kernel.org/en/users/Drivers/b43/soc
 
 It displays –colspan=3–Chip in a table cell.

I thought I fixed colspan/rowspan in my conversion, but I guess I didn't
get that right...

Actually some of them there do seem to have it right? Anyway - we'll
have to fix that up by hand.

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


Re: moving the wiki

2015-01-30 Thread Johannes Berg
On Fri, 2015-01-30 at 07:19 +0100, Rafał Miłecki wrote:
 On 29 January 2015 at 15:58, Johannes Berg johan...@sipsolutions.net wrote:
  It's actually at http://linuxwireless.sipsolutions.net/ and is just a
  static dump of the old wiki contents. Please don't copy content I
  removed from the new wiki to the old one - we didn't get permission for
  that content to be licensed under the new wiki's license.
 
 Is this expected that in such cases whole pages were dropped? E.g.:
 https://wireless.wiki.kernel.org/en/users/drivers/b43
 
 It doesn't contain anything, not even texts e.g. from me.

Sadly, yes. I couldn't really track who wrote what, and that page had a
few contributors, among the more prolific ones Stefano, whom I couldn't
contact to get permission to relicense.

If you know exactly what *you* wrote, you can obviously copy that from
the old site - but I couldn't preserve all of it.

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 2/4] mwifiex: fix memory leak in mwifiex_send_processed_packet()

2015-01-30 Thread Amitkumar Karwar
Memory is leaked after downloading already processed packet. This
patch fixes the problem by freeing returned skb. Other transmit
paths don't have this problem.

Signed-off-by: Amitkumar Karwar akar...@marvell.com
Signed-off-by: Cathy Luo c...@marvell.com
---
 drivers/net/wireless/mwifiex/wmm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/wireless/mwifiex/wmm.c 
b/drivers/net/wireless/mwifiex/wmm.c
index d2c..ef717ac 100644
--- a/drivers/net/wireless/mwifiex/wmm.c
+++ b/drivers/net/wireless/mwifiex/wmm.c
@@ -1228,6 +1228,9 @@ mwifiex_send_processed_packet(struct mwifiex_private 
*priv,
case -EINPROGRESS:
if (adapter-iface_type != MWIFIEX_PCIE)
adapter-data_sent = false;
+   break;
+   case 0:
+   mwifiex_write_data_complete(adapter, skb, 0, ret);
default:
break;
}
-- 
1.8.1.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


[PATCH 1/4] mwifiex: correction in wakeup timer handling

2015-01-30 Thread Amitkumar Karwar
Wakeup timer is in sync with 'pm_wakeup_fw_try' flag. It
has been started instead of cancelling at one place. This
patch corrects it.

Signed-off-by: Amitkumar Karwar akar...@marvell.com
Signed-off-by: Cathy Luo c...@marvell.com
---
 drivers/net/wireless/mwifiex/sta_event.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/sta_event.c 
b/drivers/net/wireless/mwifiex/sta_event.c
index c03b82c..80ffe741 100644
--- a/drivers/net/wireless/mwifiex/sta_event.c
+++ b/drivers/net/wireless/mwifiex/sta_event.c
@@ -312,8 +312,7 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)
adapter-ps_state = PS_STATE_AWAKE;
adapter-pm_wakeup_card_req = false;
adapter-pm_wakeup_fw_try = false;
-   mod_timer(adapter-wakeup_timer,
- jiffies + (HZ*3));
+   del_timer_sync(adapter-wakeup_timer);
break;
}
if (!mwifiex_send_null_packet
-- 
1.8.1.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


[PATCH 4/4] mwifiex: disable UAPSD mode when AP starts

2015-01-30 Thread Amitkumar Karwar
When AP is started, firmware exits power save mode. This
means power save manager of AP takes priority over station.
Firmware stop sending periodic AWAKE events to host.

We may have UAPSD enabled on station which buffers data
packets until AWAKE event from firmware. Data path is
unnecessarily blocked in this case. This patch disables
UAPSD mode to reenable transmit data path.

Signed-off-by: Amitkumar Karwar akar...@marvell.com
Signed-off-by: Cathy Luo c...@marvell.com
---
 drivers/net/wireless/mwifiex/sta_cmdresp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/wireless/mwifiex/sta_cmdresp.c 
b/drivers/net/wireless/mwifiex/sta_cmdresp.c
index 39f3176..5f8da59 100644
--- a/drivers/net/wireless/mwifiex/sta_cmdresp.c
+++ b/drivers/net/wireless/mwifiex/sta_cmdresp.c
@@ -1105,6 +1105,9 @@ int mwifiex_process_sta_cmdresp(struct mwifiex_private 
*priv, u16 cmdresp_no,
case HostCmd_CMD_UAP_SYS_CONFIG:
break;
case HostCmd_CMD_UAP_BSS_START:
+   adapter-tx_lock_flag = false;
+   adapter-pps_uapsd_mode = false;
+   adapter-delay_null_pkt = false;
priv-bss_started = 1;
break;
case HostCmd_CMD_UAP_BSS_STOP:
-- 
1.8.1.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


[PATCH 6/7] ath10k: implement tx pause wmi event

2015-01-30 Thread Michal Kazior
qca6174 wmi-tlv firmware defines a new wmi event
for host tx pausing (i.e. stop/wake tx queues).

Map these events to ath10k/mac80211 tx queue
control.

This is important for multi-channel thourghput
performance.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/mac.c | 12 +
 drivers/net/wireless/ath/ath10k/wmi-tlv.c | 86 +++
 drivers/net/wireless/ath/ath10k/wmi-tlv.h | 42 +++
 3 files changed, 140 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index f84ffc9..eea6b95 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -3482,6 +3482,14 @@ err:
return ret;
 }
 
+static void ath10k_mac_vif_tx_unlock_all(struct ath10k_vif *arvif)
+{
+   int i;
+
+   for (i = 0; i  BITS_PER_LONG; i++)
+   ath10k_mac_vif_tx_unlock(arvif, i);
+}
+
 static void ath10k_remove_interface(struct ieee80211_hw *hw,
struct ieee80211_vif *vif)
 {
@@ -3534,6 +3542,10 @@ static void ath10k_remove_interface(struct ieee80211_hw 
*hw,
ath10k_warn(ar, failed to recalc monitor: %d\n, ret);
}
 
+   spin_lock_bh(ar-htt.tx_lock);
+   ath10k_mac_vif_tx_unlock_all(arvif);
+   spin_unlock_bh(ar-htt.tx_lock);
+
mutex_unlock(ar-conf_mutex);
 }
 
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index 0e36b34..3763359 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -16,6 +16,7 @@
  */
 #include core.h
 #include debug.h
+#include mac.h
 #include hw.h
 #include wmi.h
 #include wmi-ops.h
@@ -62,6 +63,8 @@ static const struct wmi_tlv_policy wmi_tlv_policies[] = {
= { .min_len = sizeof(struct wmi_tlv_bcn_tx_status_ev) },
[WMI_TLV_TAG_STRUCT_DIAG_DATA_CONTAINER_EVENT]
= { .min_len = sizeof(struct wmi_tlv_diag_data_ev) },
+   [WMI_TLV_TAG_STRUCT_TX_PAUSE_EVENT]
+   = { .min_len = sizeof(struct wmi_tlv_tx_pause_ev) },
 };
 
 static int
@@ -296,6 +299,86 @@ static int ath10k_wmi_tlv_event_diag(struct ath10k *ar,
return 0;
 }
 
+static int ath10k_wmi_tlv_event_tx_pause(struct ath10k *ar,
+struct sk_buff *skb)
+{
+   const void **tb;
+   const struct wmi_tlv_tx_pause_ev *ev;
+   int ret, vdev_id;
+   u32 pause_id, action, vdev_map, peer_id, tid_map;
+   struct ath10k_vif *arvif;
+
+   tb = ath10k_wmi_tlv_parse_alloc(ar, skb-data, skb-len, GFP_ATOMIC);
+   if (IS_ERR(tb)) {
+   ret = PTR_ERR(tb);
+   ath10k_warn(ar, failed to parse tlv: %d\n, ret);
+   return ret;
+   }
+
+   ev = tb[WMI_TLV_TAG_STRUCT_TX_PAUSE_EVENT];
+   if (!ev) {
+   kfree(tb);
+   return -EPROTO;
+   }
+
+   pause_id = __le32_to_cpu(ev-pause_id);
+   action = __le32_to_cpu(ev-action);
+   vdev_map = __le32_to_cpu(ev-vdev_map);
+   peer_id = __le32_to_cpu(ev-peer_id);
+   tid_map = __le32_to_cpu(ev-tid_map);
+
+   ath10k_dbg(ar, ATH10K_DBG_WMI,
+  wmi tlv tx pause pause_id %u action %u vdev_map 0x%08x 
peer_id %u tid_map 0x%08x\n,
+  pause_id, action, vdev_map, peer_id, tid_map);
+
+   for (vdev_id = 0; vdev_map; vdev_id++) {
+   if (!(vdev_map  BIT(vdev_id)))
+   continue;
+
+   vdev_map = ~BIT(vdev_id);
+
+   spin_lock_bh(ar-htt.tx_lock);
+   spin_lock_bh(ar-data_lock);
+
+   arvif = ath10k_get_arvif(ar, vdev_id);
+   if (!arvif) {
+   ath10k_warn(ar, failed to find arvif for vdev %i for 
tx pause event\n,
+   vdev_id);
+   spin_unlock_bh(ar-data_lock);
+   spin_unlock_bh(ar-htt.tx_lock);
+   continue;
+   }
+
+   /* FIXME: Some pause_id aren't vdev orinted. Instead they are
+* peer_id oriented (mostly for AP mode scenarios).
+*/
+   if (pause_id == WMI_TLV_TX_PAUSE_ID_MCC ||
+   pause_id == WMI_TLV_TX_PAUSE_ID_P2P_CLI_NOA ||
+   pause_id == WMI_TLV_TX_PAUSE_ID_P2P_GO_PS ||
+   pause_id == WMI_TLV_TX_PAUSE_ID_AP_PS ||
+   pause_id == WMI_TLV_TX_PAUSE_ID_IBSS_PS) {
+   switch (action) {
+   case WMI_TLV_TX_PAUSE_ACTION_STOP:
+   ath10k_mac_vif_tx_lock(arvif, pause_id);
+   break;
+   case WMI_TLV_TX_PAUSE_ACTION_WAKE:
+   ath10k_mac_vif_tx_unlock(arvif, pause_id);
+   break;
+   default:
+  

[PATCH 0/7] ath10k: add multi-channel support

2015-01-30 Thread Michal Kazior
New qca6174 with wmi-tlv firmware supports
multi-channel operation. To make use of it
ath10k needs a few changes: implement mac80211's
chanctx API and rework tx queue control a bit.

There are still rough edges (involving seldom
beacon reports from firmware causing beacon loss
in some cases, etc). Hopefully this will be fixed
either in driver or firmware eventually.


Changes since RFC:
 * I've sent `ath10k: defer AP self-peer removal
   wait` separately now because it's not really 
   required for multi-channel per se


Michal Kazior (7):
  ath10k: allow empty ssid vdev config
  ath10k: implement chanctx API
  ath10k: implement adaptive qcs command
  ath10k: protect ar-arvifs linking with data_lock
  ath10k: rework tx queue locking
  ath10k: implement tx pause wmi event
  ath10k: enable multi-channel on supported devices

 drivers/net/wireless/ath/ath10k/core.c|   1 +
 drivers/net/wireless/ath/ath10k/core.h|  16 +
 drivers/net/wireless/ath/ath10k/htt_rx.c  |  87 +++-
 drivers/net/wireless/ath/ath10k/htt_tx.c  |  11 +-
 drivers/net/wireless/ath/ath10k/mac.c | 672 ++
 drivers/net/wireless/ath/ath10k/mac.h |  57 +++
 drivers/net/wireless/ath/ath10k/wmi-ops.h |  16 +
 drivers/net/wireless/ath/ath10k/wmi-tlv.c | 118 +-
 drivers/net/wireless/ath/ath10k/wmi-tlv.h |  46 ++
 drivers/net/wireless/ath/ath10k/wmi.c |  18 +-
 drivers/net/wireless/ath/ath10k/wmi.h |   1 +
 11 files changed, 958 insertions(+), 85 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 2/7] ath10k: implement chanctx API

2015-01-30 Thread Michal Kazior
The chanctx API will allow ath10k to support
multi-channel operation.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/core.c   |   1 +
 drivers/net/wireless/ath/ath10k/core.h   |   8 +
 drivers/net/wireless/ath/ath10k/htt_rx.c |  87 -
 drivers/net/wireless/ath/ath10k/mac.c| 551 +++
 drivers/net/wireless/ath/ath10k/wmi.c|  13 +-
 5 files changed, 584 insertions(+), 76 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 5e9e1a6..57f70327 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1116,6 +1116,7 @@ int ath10k_core_start(struct ath10k *ar, enum 
ath10k_firmware_mode mode)
 
ar-free_vdev_map = (1LL  ar-max_num_vdevs) - 1;
 
+   INIT_LIST_HEAD(ar-arctxs);
INIT_LIST_HEAD(ar-arvifs);
 
return 0;
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index abb3203..cf7963d 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -260,6 +260,11 @@ struct ath10k_sta {
 #endif
 };
 
+struct ath10k_chanctx {
+   struct list_head list;
+   struct ieee80211_chanctx_conf conf;
+};
+
 #define ATH10K_VDEV_SETUP_TIMEOUT_HZ (5*HZ)
 
 struct ath10k_vif {
@@ -277,6 +282,7 @@ struct ath10k_vif {
dma_addr_t beacon_paddr;
 
struct ath10k *ar;
+   struct ath10k_chanctx *arctx;
struct ieee80211_vif *vif;
 
bool is_started;
@@ -561,6 +567,7 @@ struct ath10k {
struct cfg80211_chan_def chandef;
 
unsigned long long free_vdev_map;
+   struct ath10k_vif *monitor_arvif;
bool monitor;
int monitor_vdev_id;
bool monitor_started;
@@ -590,6 +597,7 @@ struct ath10k {
/* protects shared structure data */
spinlock_t data_lock;
 
+   struct list_head arctxs;
struct list_head arvifs;
struct list_head peers;
wait_queue_head_t peer_mapping_wq;
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
b/drivers/net/wireless/ath/ath10k/htt_rx.c
index c1da44f..b18aa8e 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -773,8 +773,74 @@ static void ath10k_htt_rx_h_rates(struct ath10k *ar,
}
 }
 
+static struct ieee80211_channel *
+ath10k_htt_rx_h_peer_channel(struct ath10k *ar, struct htt_rx_desc *rxd)
+{
+   struct ath10k_peer *peer;
+   struct ath10k_vif *arvif;
+   u16 peer_id;
+
+   lockdep_assert_held(ar-data_lock);
+
+   if (!rxd)
+   return NULL;
+
+   if (rxd-attention.flags 
+   __cpu_to_le32(RX_ATTENTION_FLAGS_PEER_IDX_INVALID))
+   return NULL;
+
+   if (!(rxd-msdu_end.info0 
+ __cpu_to_le32(RX_MSDU_END_INFO0_FIRST_MSDU)))
+   return NULL;
+
+   peer_id = MS(__le32_to_cpu(rxd-mpdu_start.info0),
+RX_MPDU_START_INFO0_PEER_IDX);
+
+   peer = ath10k_peer_find_by_id(ar, peer_id);
+   if (!peer)
+   return NULL;
+
+   arvif = ath10k_get_arvif(ar, peer-vdev_id);
+   if (WARN_ON_ONCE(!arvif-arctx))
+   return NULL;
+
+   if (WARN_ON_ONCE(!arvif-arctx))
+   return NULL;
+
+   return arvif-arctx-conf.def.chan;
+}
+
+static struct ieee80211_channel *
+ath10k_htt_rx_h_vdev_channel(struct ath10k *ar, u32 vdev_id)
+{
+   struct ath10k_vif *arvif;
+
+   lockdep_assert_held(ar-data_lock);
+
+   list_for_each_entry(arvif, ar-arvifs, list)
+   if (arvif-vdev_id == vdev_id  arvif-arctx)
+   return arvif-arctx-conf.def.chan;
+
+   return NULL;
+}
+
+static struct ieee80211_channel *
+ath10k_htt_rx_h_any_channel(struct ath10k *ar)
+{
+   struct ath10k_chanctx *arctx;
+
+   lockdep_assert_held(ar-data_lock);
+
+   list_for_each_entry(arctx, ar-arctxs, list)
+   return arctx-conf.def.chan;
+
+   return NULL;
+}
+
 static bool ath10k_htt_rx_h_channel(struct ath10k *ar,
-   struct ieee80211_rx_status *status)
+   struct ieee80211_rx_status *status,
+   struct htt_rx_desc *rxd,
+   u32 vdev_id)
 {
struct ieee80211_channel *ch;
 
@@ -782,6 +848,12 @@ static bool ath10k_htt_rx_h_channel(struct ath10k *ar,
ch = ar-scan_channel;
if (!ch)
ch = ar-rx_channel;
+   if (!ch)
+   ch = ath10k_htt_rx_h_peer_channel(ar, rxd);
+   if (!ch)
+   ch = ath10k_htt_rx_h_vdev_channel(ar, vdev_id);
+   if (!ch)
+   ch = ath10k_htt_rx_h_any_channel(ar);
spin_unlock_bh(ar-data_lock);
 
if (!ch)
@@ -819,7 +891,8 @@ static void ath10k_htt_rx_h_mactime(struct ath10k *ar,
 
 static void ath10k_htt_rx_h_ppdu(struct ath10k *ar,
  

[PATCH 3/4] mwifiex: fix NULL packet downloading issues

2015-01-30 Thread Amitkumar Karwar
This patch makes sure that skb is freed after downloading
NULL packet in error cases. Also, USB chipsets return
-EINPROGRESS after downloading packets, they are freed in
USB completion handler later. We will add missing change
to set tx_lock_flag for USB which blocks further packets.

Signed-off-by: Amitkumar Karwar akar...@marvell.com
Signed-off-by: Cathy Luo c...@marvell.com
---
 drivers/net/wireless/mwifiex/sta_tx.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/sta_tx.c 
b/drivers/net/wireless/mwifiex/sta_tx.c
index 1debe76..5ce2d9a 100644
--- a/drivers/net/wireless/mwifiex/sta_tx.c
+++ b/drivers/net/wireless/mwifiex/sta_tx.c
@@ -183,9 +183,13 @@ int mwifiex_send_null_packet(struct mwifiex_private *priv, 
u8 flags)
}
switch (ret) {
case -EBUSY:
-   adapter-data_sent = true;
-   /* Fall through FAILURE handling */
+   dev_kfree_skb_any(skb);
+   dev_err(adapter-dev, %s: host_to_card failed: ret=%d\n,
+   __func__, ret);
+   adapter-dbg.num_tx_host_to_card_failure++;
+   break;
case -1:
+   adapter-data_sent = false;
dev_kfree_skb_any(skb);
dev_err(adapter-dev, %s: host_to_card failed: ret=%d\n,
__func__, ret);
@@ -198,6 +202,7 @@ int mwifiex_send_null_packet(struct mwifiex_private *priv, 
u8 flags)
adapter-tx_lock_flag = true;
break;
case -EINPROGRESS:
+   adapter-tx_lock_flag = true;
break;
default:
break;
-- 
1.8.1.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


[PATCH 5/7] ath10k: rework tx queue locking

2015-01-30 Thread Michal Kazior
Tx queue locking was very simple until now.
Multi-channel support will require a more flexible
and fine grained control.

This introduces a per-hw and per-vif (each with a
bitmask of reasons) tx queue locking.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/core.h   |  8 +
 drivers/net/wireless/ath/ath10k/htt_tx.c | 11 --
 drivers/net/wireless/ath/ath10k/mac.c| 20 ++-
 drivers/net/wireless/ath/ath10k/mac.h| 57 
 4 files changed, 92 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index cf7963d..68df646 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -280,6 +280,7 @@ struct ath10k_vif {
bool beacon_sent;
void *beacon_buf;
dma_addr_t beacon_paddr;
+   unsigned long tx_paused; /* arbitrary values defined by target */
 
struct ath10k *ar;
struct ath10k_chanctx *arctx;
@@ -472,6 +473,11 @@ static inline const char *ath10k_scan_state_str(enum 
ath10k_scan_state state)
return unknown;
 }
 
+enum ath10k_tx_pause_reason {
+   ATH10K_TX_PAUSE_Q_FULL,
+   ATH10K_TX_PAUSE_MAX,
+};
+
 struct ath10k {
struct ath_common ath_common;
struct ieee80211_hw *hw;
@@ -631,6 +637,8 @@ struct ath10k {
 
struct dfs_pattern_detector *dfs_detector;
 
+   unsigned long tx_paused; /* see ATH10K_TX_PAUSE_ */
+
 #ifdef CONFIG_ATH10K_DEBUGFS
struct ath10k_debug debug;
 #endif
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c 
b/drivers/net/wireless/ath/ath10k/htt_tx.c
index c1961e7..fcc52c1 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -24,9 +24,14 @@
 
 void __ath10k_htt_tx_dec_pending(struct ath10k_htt *htt)
 {
+   struct ath10k *ar = htt-ar;
+
htt-num_pending_tx--;
-   if (htt-num_pending_tx == htt-max_num_pending_tx - 1)
-   ieee80211_wake_queues(htt-ar-hw);
+   if (htt-num_pending_tx == htt-max_num_pending_tx - 1) {
+   spin_lock_bh(ar-data_lock);
+   ath10k_mac_tx_unlock(htt-ar, ATH10K_TX_PAUSE_Q_FULL);
+   spin_unlock_bh(ar-data_lock);
+   }
 }
 
 static void ath10k_htt_tx_dec_pending(struct ath10k_htt *htt)
@@ -49,7 +54,7 @@ static int ath10k_htt_tx_inc_pending(struct ath10k_htt *htt)
 
htt-num_pending_tx++;
if (htt-num_pending_tx == htt-max_num_pending_tx)
-   ieee80211_stop_queues(htt-ar-hw);
+   ath10k_mac_tx_lock(htt-ar, ATH10K_TX_PAUSE_Q_FULL);
 
 exit:
spin_unlock_bh(htt-tx_lock);
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 721b2ce..f84ffc9 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2805,6 +2805,7 @@ void ath10k_halt(struct ath10k *ar)
ath10k_monitor_stop(ar);
 
ar-monitor_started = false;
+   ar-tx_paused = 0;
 
ath10k_scan_finish(ar);
ath10k_peer_cleanup_all(ar);
@@ -3227,6 +3228,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
int ret = 0;
u32 value;
int bit;
+   int i;
u32 vdev_param;
 
vif-driver_flags |= IEEE80211_VIF_SUPPORTS_UAPSD;
@@ -3282,6 +3284,15 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
break;
}
 
+   /* Using vdev_id as queue number will make it very easy to do per-vif
+* tx queue locking. This shouldn't wrap due to interface combinations
+* but do a modulo for correctness sake and prevent using offchannel tx
+* queues for regular vif tx.
+*/
+   vif-cab_queue = arvif-vdev_id % (IEEE80211_MAX_QUEUES - 1);
+   for (i = 0; i  ARRAY_SIZE(vif-hw_queue); i++)
+   vif-hw_queue[i] = arvif-vdev_id % (IEEE80211_MAX_QUEUES - 1);
+
/* Some firmware revisions don't wait for beacon tx completion before
 * sending another SWBA event. This could lead to hardware using old
 * (freed) beacon data in some cases, e.g. tx credit starvation
@@ -5779,6 +5790,7 @@ int ath10k_mac_register(struct ath10k *ar)
IEEE80211_HW_HAS_RATE_CONTROL |
IEEE80211_HW_AP_LINK_PS |
IEEE80211_HW_WANT_MONITOR_VIF |
+   IEEE80211_HW_QUEUE_CONTROL |
IEEE80211_HW_SPECTRUM_MGMT;
 
ar-hw-wiphy-features |= NL80211_FEATURE_STATIC_SMPS;
@@ -5824,7 +5836,13 @@ int ath10k_mac_register(struct ath10k *ar)
 * on LL hardware queues are managed entirely by the FW
 * so we only advertise to mac we can do the queues thing
 */
-   ar-hw-queues = 4;
+   ar-hw-queues = IEEE80211_MAX_QUEUES;
+
+   /* vdev_ids are used as hw queue numbers. Make sure offchan tx queue is
+* something that 

[PATCH 7/7] ath10k: enable multi-channel on supported devices

2015-01-30 Thread Michal Kazior
This effectively enables multi-channel operation
on qca6174 WLAN.RM.2.0-00073 (and possibly any
newer firmware release for qca6174).

This adds appopriate interface combinations and
initializes firmware channel scheduler.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/mac.c | 81 ++-
 1 file changed, 80 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index eea6b95..55b73bd 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2953,6 +2953,15 @@ static int ath10k_start(struct ieee80211_hw *hw)
goto err_core_stop;
}
 
+   if (test_bit(WMI_SERVICE_ADAPTIVE_OCS, ar-wmi.svc_map)) {
+   ret = ath10k_wmi_adaptive_qcs(ar, true);
+   if (ret) {
+   ath10k_warn(ar, failed to enable adaptive qcs: %d\n,
+   ret);
+   goto err_core_stop;
+   }
+   }
+
if (ar-cfg_tx_chainmask)
__ath10k_set_antenna(ar, ar-cfg_tx_chainmask,
 ar-cfg_rx_chainmask);
@@ -5608,6 +5617,64 @@ static const struct ieee80211_iface_combination 
ath10k_10x_if_comb[] = {
},
 };
 
+static const struct ieee80211_iface_limit ath10k_tlv_if_limit[] = {
+   {
+   .max = 2,
+   .types = BIT(NL80211_IFTYPE_STATION) |
+BIT(NL80211_IFTYPE_AP) |
+BIT(NL80211_IFTYPE_P2P_CLIENT) |
+BIT(NL80211_IFTYPE_P2P_GO),
+   },
+   {
+   .max = 1,
+   .types = BIT(NL80211_IFTYPE_P2P_DEVICE),
+   },
+};
+
+static const struct ieee80211_iface_limit ath10k_tlv_if_limit_ibss[] = {
+   {
+   .max = 1,
+   .types = BIT(NL80211_IFTYPE_STATION),
+   },
+   {
+   .max = 1,
+   .types = BIT(NL80211_IFTYPE_ADHOC),
+   },
+};
+
+/* FIXME: This is not thouroughly tested. These combinations may over- or
+ * underestimate hw/fw capabilities.
+ */
+static struct ieee80211_iface_combination ath10k_tlv_if_comb[] = {
+   {
+   .limits = ath10k_tlv_if_limit,
+   .num_different_channels = 1,
+   .max_interfaces = 2,
+   .n_limits = ARRAY_SIZE(ath10k_tlv_if_limit),
+   },
+   {
+   .limits = ath10k_tlv_if_limit_ibss,
+   .num_different_channels = 1,
+   .max_interfaces = 2,
+   .n_limits = ARRAY_SIZE(ath10k_tlv_if_limit_ibss),
+   },
+};
+
+static struct ieee80211_iface_combination ath10k_tlv_qcs_if_comb[] = {
+   {
+   .limits = ath10k_tlv_if_limit,
+   .num_different_channels = 2,
+   .max_interfaces = 2,
+   .n_limits = ARRAY_SIZE(ath10k_tlv_if_limit),
+   },
+   {
+   .limits = ath10k_tlv_if_limit_ibss,
+   .num_different_channels = 1,
+   .max_interfaces = 2,
+   .n_limits = ARRAY_SIZE(ath10k_tlv_if_limit_ibss),
+   },
+};
+
 static struct ieee80211_sta_vht_cap ath10k_create_vht_cap(struct ath10k *ar)
 {
struct ieee80211_sta_vht_cap vht_cap = {0};
@@ -5858,12 +5925,24 @@ int ath10k_mac_register(struct ath10k *ar)
 
switch (ar-wmi.op_version) {
case ATH10K_FW_WMI_OP_VERSION_MAIN:
-   case ATH10K_FW_WMI_OP_VERSION_TLV:
ar-hw-wiphy-iface_combinations = ath10k_if_comb;
ar-hw-wiphy-n_iface_combinations =
ARRAY_SIZE(ath10k_if_comb);
ar-hw-wiphy-interface_modes |= BIT(NL80211_IFTYPE_ADHOC);
break;
+   case ATH10K_FW_WMI_OP_VERSION_TLV:
+   if (test_bit(WMI_SERVICE_ADAPTIVE_OCS, ar-wmi.svc_map)) {
+   ar-hw-wiphy-iface_combinations =
+   ath10k_tlv_qcs_if_comb;
+   ar-hw-wiphy-n_iface_combinations =
+   ARRAY_SIZE(ath10k_tlv_qcs_if_comb);
+   } else {
+   ar-hw-wiphy-iface_combinations = ath10k_tlv_if_comb;
+   ar-hw-wiphy-n_iface_combinations =
+   ARRAY_SIZE(ath10k_tlv_if_comb);
+   }
+   ar-hw-wiphy-interface_modes |= BIT(NL80211_IFTYPE_ADHOC);
+   break;
case ATH10K_FW_WMI_OP_VERSION_10_1:
case ATH10K_FW_WMI_OP_VERSION_10_2:
case ATH10K_FW_WMI_OP_VERSION_10_2_4:
-- 
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 1/7] ath10k: allow empty ssid vdev config

2015-01-30 Thread Michal Kazior
It doesn't make much sense to reject a valid
firmware configuration combination.

Since SSID isn't known early on it might make
sense to allow driver to start vdev without SSID
and restart it later.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/wmi-tlv.c | 2 --
 drivers/net/wireless/ath/ath10k/wmi.c | 2 --
 2 files changed, 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index be32db9..ccafb69 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -1302,8 +1302,6 @@ ath10k_wmi_tlv_op_gen_vdev_start(struct ath10k *ar,
void *ptr;
u32 flags = 0;
 
-   if (WARN_ON(arg-ssid  arg-ssid_len == 0))
-   return ERR_PTR(-EINVAL);
if (WARN_ON(arg-hidden_ssid  !arg-ssid))
return ERR_PTR(-EINVAL);
if (WARN_ON(arg-ssid_len  sizeof(cmd-ssid.ssid)))
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index ce6f0c7..97ee2e9 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -4264,8 +4264,6 @@ ath10k_wmi_op_gen_vdev_start(struct ath10k *ar,
const char *cmdname;
u32 flags = 0;
 
-   if (WARN_ON(arg-ssid  arg-ssid_len == 0))
-   return ERR_PTR(-EINVAL);
if (WARN_ON(arg-hidden_ssid  !arg-ssid))
return ERR_PTR(-EINVAL);
if (WARN_ON(arg-ssid_len  sizeof(cmd-ssid.ssid)))
-- 
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 3/7] ath10k: implement adaptive qcs command

2015-01-30 Thread Michal Kazior
This command will be used to configure
multi-channel scheduler in firmware.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/wmi-ops.h | 16 
 drivers/net/wireless/ath/ath10k/wmi-tlv.c | 30 ++
 drivers/net/wireless/ath/ath10k/wmi-tlv.h |  4 
 drivers/net/wireless/ath/ath10k/wmi.c |  3 +++
 drivers/net/wireless/ath/ath10k/wmi.h |  1 +
 5 files changed, 54 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi-ops.h 
b/drivers/net/wireless/ath/ath10k/wmi-ops.h
index 058f88b..cf9d34f 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-ops.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h
@@ -145,6 +145,7 @@ struct wmi_ops {
  u32 num_ac);
struct sk_buff *(*gen_sta_keepalive)(struct ath10k *ar,
 const struct wmi_sta_keepalive_arg 
*arg);
+   struct sk_buff *(*gen_adaptive_qcs)(struct ath10k *ar, bool enable);
 };
 
 int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id);
@@ -1054,4 +1055,19 @@ ath10k_wmi_sta_keepalive(struct ath10k *ar,
return ath10k_wmi_cmd_send(ar, skb, cmd_id);
 }
 
+static inline int
+ath10k_wmi_adaptive_qcs(struct ath10k *ar, bool enable)
+{
+   struct sk_buff *skb;
+
+   if (!ar-wmi.ops-gen_adaptive_qcs)
+   return -EOPNOTSUPP;
+
+   skb = ar-wmi.ops-gen_adaptive_qcs(ar, enable);
+   if (IS_ERR(skb))
+   return PTR_ERR(skb);
+
+   return ath10k_wmi_cmd_send(ar, skb, ar-wmi.cmd-adaptive_qcs_cmdid);
+}
+
 #endif
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index ccafb69..0e36b34 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -2381,6 +2381,34 @@ ath10k_wmi_tlv_op_gen_p2p_go_bcn_ie(struct ath10k *ar, 
u32 vdev_id,
return skb;
 }
 
+static struct sk_buff *
+ath10k_wmi_tlv_op_gen_adaptive_qcs(struct ath10k *ar, bool enable)
+{
+   struct wmi_tlv_adaptive_qcs *cmd;
+   struct wmi_tlv *tlv;
+   struct sk_buff *skb;
+   void *ptr;
+   size_t len;
+
+   len = sizeof(*tlv) + sizeof(*cmd);
+   skb = ath10k_wmi_alloc_skb(ar, len);
+   if (!skb)
+   return ERR_PTR(-ENOMEM);
+
+   ptr = (void *)skb-data;
+   tlv = ptr;
+   tlv-tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_RESMGR_ADAPTIVE_OCS_CMD);
+   tlv-len = __cpu_to_le16(sizeof(*cmd));
+   cmd = (void *)tlv-value;
+   cmd-enable = __cpu_to_le32(enable ? 1 : 0);
+
+   ptr += sizeof(*tlv);
+   ptr += sizeof(*cmd);
+
+   ath10k_dbg(ar, ATH10K_DBG_WMI, wmi tlv adaptive qcs %d\n, enable);
+   return skb;
+}
+
 //
 /* TLV mappings */
 //
@@ -2505,6 +2533,7 @@ static struct wmi_cmd_map wmi_tlv_cmd_map = {
.gpio_output_cmdid = WMI_TLV_GPIO_OUTPUT_CMDID,
.pdev_get_temperature_cmdid = WMI_TLV_CMD_UNSUPPORTED,
.vdev_set_wmm_params_cmdid = WMI_TLV_VDEV_SET_WMM_PARAMS_CMDID,
+   .adaptive_qcs_cmdid = WMI_TLV_RESMGR_ADAPTIVE_OCS_CMDID,
 };
 
 static struct wmi_pdev_param_map wmi_tlv_pdev_param_map = {
@@ -2677,6 +2706,7 @@ static const struct wmi_ops wmi_tlv_ops = {
.gen_p2p_go_bcn_ie = ath10k_wmi_tlv_op_gen_p2p_go_bcn_ie,
.gen_vdev_sta_uapsd = ath10k_wmi_tlv_op_gen_vdev_sta_uapsd,
.gen_sta_keepalive = ath10k_wmi_tlv_op_gen_sta_keepalive,
+   .gen_adaptive_qcs = ath10k_wmi_tlv_op_gen_adaptive_qcs,
 };
 
 //
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.h 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
index de68fe7..a05952a 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
@@ -1439,6 +1439,10 @@ struct wmi_tlv_sta_keepalive_cmd {
__le32 interval; /* in seconds */
 } __packed;
 
+struct wmi_tlv_adaptive_qcs {
+   __le32 enable;
+} __packed;
+
 void ath10k_wmi_tlv_attach(struct ath10k *ar);
 
 #endif
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 0b49ec4..8966848 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -5224,6 +5224,7 @@ static const struct wmi_ops wmi_ops = {
/* .gen_bcn_tmpl not implemented */
/* .gen_prb_tmpl not implemented */
/* .gen_p2p_go_bcn_ie not implemented */
+   /* .gen_adaptive_qcs not implemented */
 };
 
 static const struct wmi_ops wmi_10_1_ops = {
@@ -5286,6 +5287,7 @@ static const struct wmi_ops wmi_10_1_ops = {
/* .gen_bcn_tmpl not implemented */
/* .gen_prb_tmpl not implemented */
/* .gen_p2p_go_bcn_ie not implemented */
+   /* .gen_adaptive_qcs not implemented */
 };
 
 static const struct wmi_ops wmi_10_2_ops = {
@@ -5408,6 +5410,7 @@ static const struct wmi_ops wmi_10_2_4_ops = {
/* .gen_bcn_tmpl not implemented */
/* 

[PATCH 4/7] ath10k: protect ar-arvifs linking with data_lock

2015-01-30 Thread Michal Kazior
This will make it possible to iterate over
interface list while in an atomic context,
i.e. tasklet.

Caller should still be careful with accessing
arvif structures though.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/mac.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 16fddc7..721b2ce 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -3325,7 +3325,10 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
}
 
ar-free_vdev_map = ~(1LL  arvif-vdev_id);
+
+   spin_lock_bh(ar-data_lock);
list_add(arvif-list, ar-arvifs);
+   spin_unlock_bh(ar-data_lock);
 
/* It makes no sense to have firmware do keepalives. mac80211 already
 * takes care of this with idle connection polling.
@@ -3452,7 +3455,9 @@ err_peer_delete:
 err_vdev_delete:
ath10k_wmi_vdev_delete(ar, arvif-vdev_id);
ar-free_vdev_map |= 1LL  arvif-vdev_id;
+   spin_lock_bh(ar-data_lock);
list_del(arvif-list);
+   spin_unlock_bh(ar-data_lock);
 
 err:
if (arvif-beacon_buf) {
@@ -3487,7 +3492,10 @@ static void ath10k_remove_interface(struct ieee80211_hw 
*hw,
arvif-vdev_id, ret);
 
ar-free_vdev_map |= 1LL  arvif-vdev_id;
+
+   spin_lock_bh(ar-data_lock);
list_del(arvif-list);
+   spin_unlock_bh(ar-data_lock);
 
if (arvif-vdev_type == WMI_VDEV_TYPE_AP) {
ret = ath10k_peer_delete(arvif-ar, arvif-vdev_id, vif-addr);
-- 
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] Repair soft lockup with monitor mode of ath9k_htc card

2015-01-30 Thread Kalle Valo
yuweizh...@139.com writes:

 From: Yuwei Zheng yuweizh...@139.com

 In the environment with heavy wifi traffic, set the ar9271 into
 monitor mode, will trigger a deadloop panic.
  
 The ath9k_hif_usb_rx_cb function excute on  the interrupt context, and 
 ath9k_rx_tasklet excute
 on the soft irq context. In other words, the ath9k_hif_usb_rx_cb have more 
 chance to excute than
 ath9k_rx_tasklet.  So in the worst condition,  the rx.rxbuf receive list is 
 always full,
 and the do {}while(true) loop will not be break. The kernel get a soft lockup 
 panic. 

Word wrapping is too long and please prefix the title with ath9k_htc: .

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


Re: [PATCH v2 2/7] ath10k: implement chanctx API

2015-01-30 Thread Johannes Berg
On Fri, 2015-01-30 at 13:31 +0100, Michal Kazior wrote:

 + INIT_LIST_HEAD(ar-arctxs);
   INIT_LIST_HEAD(ar-arvifs);

I'm not sure why you have an interface list, but I'd say you don't need
either since you have enumeration APIs:

ieee80211_iterate_active_interfaces[_atomic,...]

and

ieee80211_iter_chan_contexts_atomic

:)

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


Re: [PATCH v2 2/7] ath10k: implement chanctx API

2015-01-30 Thread Johannes Berg
On Fri, 2015-01-30 at 14:02 +0100, Michal Kazior wrote:

 I recall that at least there's one case where using these helpers is
 impossible: drv_config() which can be called while mac80211 is already
 holding iflist_mtx. ath10k needs to iterate over vifs and issue
 blocking commands sometimes so it can't use atomic/rcu versions
 either.

If you wanted to use it, I wouldn't be averse to adding a locked version
that can only be used inside a few of such callbacks. With appropriate
lockdep warnings that would be safe enough, I think.

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 00/17] ath9k patches

2015-01-30 Thread Sujith Manoharan
From: Sujith Manoharan c_man...@qca.qualcomm.com

ath9k patches for -next.

Sujith Manoharan (17):
  ath9k: Remove ATH9K_HW_WOW_DEVICE_CAPABLE
  ath9k: Return early for error conditions
  ath9k: Remove redundant device_can_wakeup() check
  ath9k: Check early for multi-vif/STA conditions
  ath9k: Check multi-channel context for WOW
  ath9k: Fix wow init/deinit
  ath9k: Check WOW triggers properly
  ath9k: Remove unused BMISS processing
  ath9k: Remove ath9k_hw_wow_event_to_string
  ath9k: Add a debugfs file for WOW
  ath9k: Simplify user pattern configuration
  ath9k: Add a HW structure for WOW
  ath9k: Register max WOW patterns
  ath9k: Move WOW registers to reg_wow.h
  ath9k: Remove incorrect register macros
  ath9k: Cleanup reg_wow.h
  ath9k: Fix max pattern check

 drivers/net/wireless/ath/ath.h  |   1 +
 drivers/net/wireless/ath/ath9k/ar9003_wow.c |  38 ++---
 drivers/net/wireless/ath/ath9k/ath9k.h  |  13 +-
 drivers/net/wireless/ath/ath9k/debug.c  |  68 +
 drivers/net/wireless/ath/ath9k/hw.c |  10 +-
 drivers/net/wireless/ath/ath9k/hw.h |  34 ++---
 drivers/net/wireless/ath/ath9k/init.c   |   1 +
 drivers/net/wireless/ath/ath9k/main.c   |   9 --
 drivers/net/wireless/ath/ath9k/pci.c|   5 +-
 drivers/net/wireless/ath/ath9k/reg.h| 120 
 drivers/net/wireless/ath/ath9k/reg_wow.h|  93 
 drivers/net/wireless/ath/ath9k/wow.c| 212 
 12 files changed, 301 insertions(+), 303 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath9k/reg_wow.h

-- 
2.2.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 14/17] ath9k: Move WOW registers to reg_wow.h

2015-01-30 Thread Sujith Manoharan
From: Sujith Manoharan c_man...@qca.qualcomm.com

Signed-off-by: Sujith Manoharan c_man...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath9k/ar9003_wow.c |   1 +
 drivers/net/wireless/ath/ath9k/reg.h| 120 
 drivers/net/wireless/ath/ath9k/reg_wow.h| 136 
 3 files changed, 137 insertions(+), 120 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath9k/reg_wow.h

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_wow.c 
b/drivers/net/wireless/ath/ath9k/ar9003_wow.c
index bb61417..6681a7b 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_wow.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_wow.c
@@ -17,6 +17,7 @@
 #include linux/export.h
 #include ath9k.h
 #include reg.h
+#include reg_wow.h
 #include hw-ops.h
 
 static void ath9k_hw_set_powermode_wow_sleep(struct ath_hw *ah)
diff --git a/drivers/net/wireless/ath/ath9k/reg.h 
b/drivers/net/wireless/ath/ath9k/reg.h
index 3c0b180..b1b803d 100644
--- a/drivers/net/wireless/ath/ath9k/reg.h
+++ b/drivers/net/wireless/ath/ath9k/reg.h
@@ -2010,126 +2010,6 @@ enum {
 
 #define AR_WOW_BEACON_TIMO_MAX 0x
 
-/*
- * MAC WoW Registers
- */
-
-#define AR_WOW_PATTERN 0x825C
-#define AR_WOW_COUNT   0x8260
-#define AR_WOW_BCN_EN  0x8270
-#define AR_WOW_BCN_TIMO0x8274
-#define AR_WOW_KEEP_ALIVE_TIMO 0x8278
-#define AR_WOW_KEEP_ALIVE  0x827c
-#define AR_WOW_US_SCALAR   0x8284
-#define AR_WOW_KEEP_ALIVE_DELAY0x8288
-#define AR_WOW_PATTERN_MATCH   0x828c
-#define AR_WOW_PATTERN_OFF10x8290  /* pattern bytes 0 - 3 */
-#define AR_WOW_PATTERN_OFF20x8294  /* pattern bytes 4 - 7 */
-
-/* for AR9285 or later version of chips */
-#define AR_WOW_EXACT   0x829c
-#define AR_WOW_LENGTH1 0x8360
-#define AR_WOW_LENGTH2 0X8364
-/* register to enable match for less than 256 bytes packets */
-#define AR_WOW_PATTERN_MATCH_LT_256B   0x8368
-
-#define AR_SW_WOW_CONTROL  0x20018
-#define AR_SW_WOW_ENABLE   0x1
-#define AR_SWITCH_TO_REFCLK0x2
-#define AR_RESET_CONTROL   0x4
-#define AR_RESET_VALUE_MASK0x8
-#define AR_HW_WOW_DISABLE  0x10
-#define AR_CLR_MAC_INTERRUPT   0x20
-#define AR_CLR_KA_INTERRUPT0x40
-
-/* AR_WOW_PATTERN register values */
-#define AR_WOW_BACK_OFF_SHIFT(x)   ((x  0xf)  28) /* in usecs */
-#define AR_WOW_MAC_INTR_EN 0x0004
-#define AR_WOW_MAGIC_EN0x0001
-#define AR_WOW_PATTERN_EN(x)   (x  0xff)
-#define AR_WOW_PAT_FOUND_SHIFT 8
-#define AR_WOW_PATTERN_FOUND(x)(x  (0xff  
AR_WOW_PAT_FOUND_SHIFT))
-#define AR_WOW_PATTERN_FOUND_MASK  ((0xff)  AR_WOW_PAT_FOUND_SHIFT)
-#define AR_WOW_MAGIC_PAT_FOUND 0x0002
-#define AR_WOW_MAC_INTR0x0008
-#define AR_WOW_KEEP_ALIVE_FAIL 0x0010
-#define AR_WOW_BEACON_FAIL 0x0020
-
-#define AR_WOW_STATUS(x)   (x  (AR_WOW_PATTERN_FOUND_MASK | \
- AR_WOW_MAGIC_PAT_FOUND| \
- AR_WOW_KEEP_ALIVE_FAIL| \
- AR_WOW_BEACON_FAIL))
-#define AR_WOW_CLEAR_EVENTS(x) (x  ~(AR_WOW_PATTERN_EN(0xff) | \
-  AR_WOW_MAGIC_EN | \
-  AR_WOW_MAC_INTR_EN | \
-  AR_WOW_BEACON_FAIL | \
-  AR_WOW_KEEP_ALIVE_FAIL))
-
-/* AR_WOW_COUNT register values */
-#define AR_WOW_AIFS_CNT(x) (x  0xff)
-#define AR_WOW_SLOT_CNT(x) ((x  0xff)  8)
-#define AR_WOW_KEEP_ALIVE_CNT(x)   ((x  0xff)  16)
-
-/* AR_WOW_BCN_EN register */
-#define AR_WOW_BEACON_FAIL_EN  0x0001
-
-/* AR_WOW_BCN_TIMO rgister */
-#define AR_WOW_BEACON_TIMO 0x4000 /* valid if BCN_EN is set */
-
-/* AR_WOW_KEEP_ALIVE_TIMO register */
-#define AR_WOW_KEEP_ALIVE_TIMO_VALUE
-#define AR_WOW_KEEP_ALIVE_NEVER0x
-
-/* AR_WOW_KEEP_ALIVE register  */
-#define AR_WOW_KEEP_ALIVE_AUTO_DIS 0x0001
-#define AR_WOW_KEEP_ALIVE_FAIL_DIS 0x0002
-
-/* AR_WOW_KEEP_ALIVE_DELAY register */
-#define AR_WOW_KEEP_ALIVE_DELAY_VALUE  0x03e8 /* 1 msec */
-
-
-/*
- * keep it long for beacon workaround - ensure no false alarm
- */
-#define AR_WOW_BMISSTHRESHOLD  0x20
-
-/* AR_WOW_PATTERN_MATCH register */
-#define AR_WOW_PAT_END_OF_PKT(x)   (x  0xf)
-#define AR_WOW_PAT_OFF_MATCH(x)((x  0xf)  8)
-
-/*
- * default values for Wow Configuration for backoff, aifs, slot, keep-alive
- * to be programmed into various registers.
- */
-#define AR_WOW_PAT_BACKOFF 0x0004 /* AR_WOW_PATTERN_REG */

[PATCH 03/17] ath9k: Remove redundant device_can_wakeup() check

2015-01-30 Thread Sujith Manoharan
From: Sujith Manoharan c_man...@qca.qualcomm.com

WOW capability is registered with mac80211 only when
the device has the ability to wakeup, so there is no
need to check in the suspend() routine.

Signed-off-by: Sujith Manoharan c_man...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath9k/wow.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/wow.c 
b/drivers/net/wireless/ath/ath9k/wow.c
index 1d5cd88..272c05c 100644
--- a/drivers/net/wireless/ath/ath9k/wow.c
+++ b/drivers/net/wireless/ath/ath9k/wow.c
@@ -212,12 +212,6 @@ int ath9k_suspend(struct ieee80211_hw *hw,
ath_cancel_work(sc);
ath_stop_ani(sc);
 
-   if (!device_can_wakeup(sc-dev)) {
-   ath_dbg(common, WOW, device_can_wakeup failed, WoW is not 
enabled\n);
-   ret = 1;
-   goto fail_wow;
-   }
-
/*
 * none of the sta vifs are associated
 * and we are not currently handling multivif
-- 
2.2.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 06/17] ath9k: Fix wow init/deinit

2015-01-30 Thread Sujith Manoharan
From: Sujith Manoharan c_man...@qca.qualcomm.com

Registering the card as a wakeup source needs to
be done once, during initialization. When the WOW
configuration changes, the card's status as wakeup
source needs to be changed too and this is done
via the set_wakeup() callback. Also, make sure
the device is removed properly using ath9k_deinit_wow().

Signed-off-by: Sujith Manoharan c_man...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath9k/ath9k.h |  4 
 drivers/net/wireless/ath/ath9k/init.c  |  1 +
 drivers/net/wireless/ath/ath9k/wow.c   | 22 ++
 3 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h 
b/drivers/net/wireless/ath/ath9k/ath9k.h
index e84b576..4209d7b 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -838,6 +838,7 @@ struct ath9k_wow_pattern {
 
 #ifdef CONFIG_ATH9K_WOW
 void ath9k_init_wow(struct ieee80211_hw *hw);
+void ath9k_deinit_wow(struct ieee80211_hw *hw);
 int ath9k_suspend(struct ieee80211_hw *hw,
  struct cfg80211_wowlan *wowlan);
 int ath9k_resume(struct ieee80211_hw *hw);
@@ -846,6 +847,9 @@ void ath9k_set_wakeup(struct ieee80211_hw *hw, bool 
enabled);
 static inline void ath9k_init_wow(struct ieee80211_hw *hw)
 {
 }
+static inline void ath9k_deinit_wow(struct ieee80211_hw *hw)
+{
+}
 static inline int ath9k_suspend(struct ieee80211_hw *hw,
struct cfg80211_wowlan *wowlan)
 {
diff --git a/drivers/net/wireless/ath/ath9k/init.c 
b/drivers/net/wireless/ath/ath9k/init.c
index 2aef14e..6c6e884 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -996,6 +996,7 @@ void ath9k_deinit_device(struct ath_softc *sc)
ath9k_ps_restore(sc);
 
ath9k_deinit_debug(sc);
+   ath9k_deinit_wow(hw);
ieee80211_unregister_hw(hw);
ath_rx_cleanup(sc);
ath9k_deinit_softc(sc);
diff --git a/drivers/net/wireless/ath/ath9k/wow.c 
b/drivers/net/wireless/ath/ath9k/wow.c
index 1b005c6..8bcbaa9 100644
--- a/drivers/net/wireless/ath/ath9k/wow.c
+++ b/drivers/net/wireless/ath/ath9k/wow.c
@@ -336,20 +336,34 @@ int ath9k_resume(struct ieee80211_hw *hw)
 void ath9k_set_wakeup(struct ieee80211_hw *hw, bool enabled)
 {
struct ath_softc *sc = hw-priv;
+   struct ath_common *common = ath9k_hw_common(sc-sc_ah);
 
mutex_lock(sc-mutex);
-   device_init_wakeup(sc-dev, 1);
device_set_wakeup_enable(sc-dev, enabled);
mutex_unlock(sc-mutex);
+
+   ath_dbg(common, WOW, WoW wakeup source is %s\n,
+   (enabled) ? enabled : disabled);
 }
 
 void ath9k_init_wow(struct ieee80211_hw *hw)
 {
struct ath_softc *sc = hw-priv;
 
-   if ((sc-driver_data  ATH9K_PCI_WOW)  device_can_wakeup(sc-dev))
+   if (sc-driver_data  ATH9K_PCI_WOW) {
hw-wiphy-wowlan = ath9k_wowlan_support;
 
-   atomic_set(sc-wow_sleep_proc_intr, -1);
-   atomic_set(sc-wow_got_bmiss_intr, -1);
+   atomic_set(sc-wow_sleep_proc_intr, -1);
+   atomic_set(sc-wow_got_bmiss_intr, -1);
+
+   device_init_wakeup(sc-dev, 1);
+   }
+}
+
+void ath9k_deinit_wow(struct ieee80211_hw *hw)
+{
+   struct ath_softc *sc = hw-priv;
+
+   if (sc-driver_data  ATH9K_PCI_WOW)
+   device_init_wakeup(sc-dev, 0);
 }
-- 
2.2.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 11/17] ath9k: Simplify user pattern configuration

2015-01-30 Thread Sujith Manoharan
From: Sujith Manoharan c_man...@qca.qualcomm.com

There is no need to allocate a new structure and
free it for every user pattern, instead use local
variables.

Signed-off-by: Sujith Manoharan c_man...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath9k/ath9k.h |  6 -
 drivers/net/wireless/ath/ath9k/wow.c   | 49 +-
 2 files changed, 12 insertions(+), 43 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h 
b/drivers/net/wireless/ath/ath9k/ath9k.h
index 20216c5..0f8e946 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -830,12 +830,6 @@ static inline void ath_fill_led_pin(struct ath_softc *sc)
 /* Wake on Wireless LAN */
 //
 
-struct ath9k_wow_pattern {
-   u8 pattern_bytes[MAX_PATTERN_SIZE];
-   u8 mask_bytes[MAX_PATTERN_SIZE];
-   u32 pattern_len;
-};
-
 #ifdef CONFIG_ATH9K_WOW
 void ath9k_init_wow(struct ieee80211_hw *hw);
 void ath9k_deinit_wow(struct ieee80211_hw *hw);
diff --git a/drivers/net/wireless/ath/ath9k/wow.c 
b/drivers/net/wireless/ath/ath9k/wow.c
index 4b3b565..da52b1f 100644
--- a/drivers/net/wireless/ath/ath9k/wow.c
+++ b/drivers/net/wireless/ath/ath9k/wow.c
@@ -128,50 +128,25 @@ static void ath9k_wow_add_pattern(struct ath_softc *sc,
  struct cfg80211_wowlan *wowlan)
 {
struct ath_hw *ah = sc-sc_ah;
-   struct ath9k_wow_pattern *wow_pattern = NULL;
struct cfg80211_pkt_pattern *patterns = wowlan-patterns;
+   u8 wow_pattern[MAX_PATTERN_SIZE];
+   u8 wow_mask[MAX_PATTERN_SIZE];
int mask_len;
s8 i = 0;
 
-   if (!wowlan-n_patterns)
-   return;
-
-   /*
-* Add the new user configured patterns
-*/
for (i = 0; i  wowlan-n_patterns; i++) {
-
-   wow_pattern = kzalloc(sizeof(*wow_pattern), GFP_KERNEL);
-
-   if (!wow_pattern)
-   return;
-
-   /*
-* TODO: convert the generic user space pattern to
-* appropriate chip specific/802.11 pattern.
-*/
-
-   mask_len = DIV_ROUND_UP(wowlan-patterns[i].pattern_len, 8);
-   memset(wow_pattern-pattern_bytes, 0, MAX_PATTERN_SIZE);
-   memset(wow_pattern-mask_bytes, 0, MAX_PATTERN_SIZE);
-   memcpy(wow_pattern-pattern_bytes, patterns[i].pattern,
-  patterns[i].pattern_len);
-   memcpy(wow_pattern-mask_bytes, patterns[i].mask, mask_len);
-   wow_pattern-pattern_len = patterns[i].pattern_len;
-
-   /*
-* just need to take care of deauth and disssoc pattern,
-* make sure we don't overwrite them.
-*/
-
-   ath9k_hw_wow_apply_pattern(ah, wow_pattern-pattern_bytes,
-  wow_pattern-mask_bytes,
+   mask_len = DIV_ROUND_UP(patterns[i].pattern_len, 8);
+   memset(wow_pattern, 0, MAX_PATTERN_SIZE);
+   memset(wow_mask, 0, MAX_PATTERN_SIZE);
+   memcpy(wow_pattern, patterns[i].pattern, 
patterns[i].pattern_len);
+   memcpy(wow_mask, patterns[i].mask, mask_len);
+
+   ath9k_hw_wow_apply_pattern(ah,
+  wow_pattern,
+  wow_mask,
   i + 2,
-  wow_pattern-pattern_len);
-   kfree(wow_pattern);
-
+  patterns[i].pattern_len);
}
-
 }
 
 int ath9k_suspend(struct ieee80211_hw *hw,
-- 
2.2.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 13/17] ath9k: Register max WOW patterns

2015-01-30 Thread Sujith Manoharan
From: Sujith Manoharan c_man...@qca.qualcomm.com

Since the number of patterns that can be configured in
the HW is higher for newer chips, store the chip-specific
value in ath9k_hw_wow.

Signed-off-by: Sujith Manoharan c_man...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath9k/hw.c | 7 +++
 drivers/net/wireless/ath/ath9k/hw.h | 4 +++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/hw.c 
b/drivers/net/wireless/ath/ath9k/hw.c
index 8c2f9e2..60aa8d7 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2548,6 +2548,13 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah)
ah-eep_ops-get_eeprom(ah, EEP_PAPRD))
pCap-hw_caps |= ATH9K_HW_CAP_PAPRD;
 
+#ifdef CONFIG_ATH9K_WOW
+   if (AR_SREV_9462_20_OR_LATER(ah) || AR_SREV_9565_11_OR_LATER(ah))
+   ah-wow.max_patterns = MAX_NUM_PATTERN;
+   else
+   ah-wow.max_patterns = MAX_NUM_PATTERN_LEGACY;
+#endif
+
return 0;
 }
 
diff --git a/drivers/net/wireless/ath/ath9k/hw.h 
b/drivers/net/wireless/ath/ath9k/hw.h
index d36210a..e1801c9 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -204,7 +204,8 @@
 
 #define MAX_PATTERN_SIZE   256
 #define MAX_PATTERN_MASK_SIZE  32
-#define MAX_NUM_PATTERN8
+#define MAX_NUM_PATTERN16
+#define MAX_NUM_PATTERN_LEGACY 8
 #define MAX_NUM_USER_PATTERN   6 /*  deducting the disassociate and
  deauthenticate packets */
 
@@ -272,6 +273,7 @@ enum ath9k_hw_caps {
 
 struct ath9k_hw_wow {
u32 wow_event_mask;
+   u8 max_patterns;
 };
 
 struct ath9k_hw_capabilities {
-- 
2.2.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 16/17] ath9k: Cleanup reg_wow.h

2015-01-30 Thread Sujith Manoharan
From: Sujith Manoharan c_man...@qca.qualcomm.com

* Remove unnecessary comments.
* Remove unused macros.
* Indent the macros.

Signed-off-by: Sujith Manoharan c_man...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath9k/reg_wow.h | 68 +++-
 1 file changed, 15 insertions(+), 53 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/reg_wow.h 
b/drivers/net/wireless/ath/ath9k/reg_wow.h
index 780553a..e6de4a3 100644
--- a/drivers/net/wireless/ath/ath9k/reg_wow.h
+++ b/drivers/net/wireless/ath/ath9k/reg_wow.h
@@ -25,10 +25,8 @@
 #define AR_WOW_KEEP_ALIVE   0x827c
 #define AR_WOW_KEEP_ALIVE_DELAY 0x8288
 #define AR_WOW_PATTERN_MATCH0x828c
-
 #define AR_WOW_LENGTH1  0x8360
 #define AR_WOW_LENGTH2  0X8364
-/* register to enable match for less than 256 bytes packets */
 #define AR_WOW_PATTERN_MATCH_LT_256B0x8368
 
 #define AR_SW_WOW_CONTROL   0x20018
@@ -40,7 +38,6 @@
 #define AR_CLR_MAC_INTERRUPT0x20
 #define AR_CLR_KA_INTERRUPT 0x40
 
-/* AR_WOW_PATTERN register values */
 #define AR_WOW_BACK_OFF_SHIFT(x)((x  0xf)  28) /* in usecs */
 #define AR_WOW_MAC_INTR_EN  0x0004
 #define AR_WOW_MAGIC_EN 0x0001
@@ -63,69 +60,34 @@
AR_WOW_BEACON_FAIL |\
AR_WOW_KEEP_ALIVE_FAIL))
 
-/* AR_WOW_COUNT register values */
 #define AR_WOW_AIFS_CNT(x)  (x  0xff)
 #define AR_WOW_SLOT_CNT(x)  ((x  0xff)  8)
 #define AR_WOW_KEEP_ALIVE_CNT(x)((x  0xff)  16)
 
-/* AR_WOW_BCN_EN register */
 #define AR_WOW_BEACON_FAIL_EN   0x0001
-
-/* AR_WOW_BCN_TIMO rgister */
-#define AR_WOW_BEACON_TIMO  0x4000 /* valid if BCN_EN is set */
-
-/* AR_WOW_KEEP_ALIVE_TIMO register */
-#define AR_WOW_KEEP_ALIVE_TIMO_VALUE
+#define AR_WOW_BEACON_TIMO  0x4000
 #define AR_WOW_KEEP_ALIVE_NEVER 0x
-
-/* AR_WOW_KEEP_ALIVE register  */
 #define AR_WOW_KEEP_ALIVE_AUTO_DIS  0x0001
 #define AR_WOW_KEEP_ALIVE_FAIL_DIS  0x0002
-
-/* AR_WOW_KEEP_ALIVE_DELAY register */
 #define AR_WOW_KEEP_ALIVE_DELAY_VALUE   0x03e8 /* 1 msec */
-
-
-/*
- * keep it long for beacon workaround - ensure no false alarm
- */
 #define AR_WOW_BMISSTHRESHOLD   0x20
-
-/* AR_WOW_PATTERN_MATCH register */
 #define AR_WOW_PAT_END_OF_PKT(x)(x  0xf)
 #define AR_WOW_PAT_OFF_MATCH(x) ((x  0xf)  8)
-
-/*
- * default values for Wow Configuration for backoff, aifs, slot, keep-alive
- * to be programmed into various registers.
- */
-#define AR_WOW_PAT_BACKOFF  0x0004 /* AR_WOW_PATTERN_REG */
-#define AR_WOW_CNT_AIFS_CNT 0x0022 /* AR_WOW_COUNT_REG */
-#define AR_WOW_CNT_SLOT_CNT 0x0009 /* AR_WOW_COUNT_REG */
-/*
- * Keepalive count applicable for AR9280 2.0 and above.
- */
-#define AR_WOW_CNT_KA_CNT 0x0008/* AR_WOW_COUNT register */
-
-/* WoW - Transmit buffer for keep alive frames */
-#define AR_WOW_TRANSMIT_BUFFER  0xe000 /* E000 - EFFC */
-
-#define AR_WOW_TXBUF(i) (AR_WOW_TRANSMIT_BUFFER + ((i)  2))
-
-#define AR_WOW_KA_DESC_WORD20xe000
-
-#define AR_WOW_KA_DATA_WORD00xe030
-
-/* WoW Transmit Buffer for patterns */
-#define AR_WOW_TB_PATTERN(i)(0xe100 + (i  8))
-#define AR_WOW_TB_MASK(i)   (0xec00 + (i  5))
-
-/* Currently Pattern 0-7 are supported - so bit 0-7 are set */
+#define AR_WOW_PAT_BACKOFF  0x0004
+#define AR_WOW_CNT_AIFS_CNT 0x0022
+#define AR_WOW_CNT_SLOT_CNT 0x0009
+#define AR_WOW_CNT_KA_CNT   0x0008
+
+#define AR_WOW_TRANSMIT_BUFFER  0xe000
+#define AR_WOW_TXBUF(i) (AR_WOW_TRANSMIT_BUFFER + ((i)  2))
+#define AR_WOW_KA_DESC_WORD20xe000
+#define AR_WOW_TB_PATTERN(i)(0xe100 + (i  8))
+#define AR_WOW_TB_MASK(i)   (0xec00 + (i  5))
 #define AR_WOW_PATTERN_SUPPORTED0xff
 #define AR_WOW_LENGTH_MAX   0xff
-#define AR_WOW_LEN1_SHIFT(_i)   ((0x3 - ((_i)  0x3))  0x3)
-#define AR_WOW_LENGTH1_MASK(_i) (AR_WOW_LENGTH_MAX  AR_WOW_LEN1_SHIFT(_i))
-#define AR_WOW_LEN2_SHIFT(_i)   ((0x7 - ((_i)  0x7))  0x3)
-#define AR_WOW_LENGTH2_MASK(_i) (AR_WOW_LENGTH_MAX  AR_WOW_LEN2_SHIFT(_i))
+#define AR_WOW_LEN1_SHIFT(_i)   ((0x3 - ((_i)  0x3))  0x3)
+#define AR_WOW_LENGTH1_MASK(_i) (AR_WOW_LENGTH_MAX  
AR_WOW_LEN1_SHIFT(_i))
+#define AR_WOW_LEN2_SHIFT(_i)   ((0x7 - ((_i)  0x7))  0x3)
+#define AR_WOW_LENGTH2_MASK(_i) (AR_WOW_LENGTH_MAX  
AR_WOW_LEN2_SHIFT(_i))
 
 #endif /* REG_WOW_H */
-- 
2.2.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 10/17] ath9k: Add a debugfs file for WOW

2015-01-30 Thread Sujith Manoharan
From: Sujith Manoharan c_man...@qca.qualcomm.com

This can be used to force WOW for cards that
are not present in the supported PCI ID list.

Signed-off-by: Sujith Manoharan c_man...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath9k/ath9k.h |  1 +
 drivers/net/wireless/ath/ath9k/debug.c | 68 ++
 drivers/net/wireless/ath/ath9k/wow.c   |  4 +-
 3 files changed, 71 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h 
b/drivers/net/wireless/ath/ath9k/ath9k.h
index 803a7d4..20216c5 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -1044,6 +1044,7 @@ struct ath_softc {
 
 #ifdef CONFIG_ATH9K_WOW
u32 wow_intr_before_sleep;
+   bool force_wow;
 #endif
 };
 
diff --git a/drivers/net/wireless/ath/ath9k/debug.c 
b/drivers/net/wireless/ath/ath9k/debug.c
index dd5d391..50a2e0a 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -1043,6 +1043,69 @@ static const struct file_operations fops_ackto = {
 };
 #endif
 
+#ifdef CONFIG_ATH9K_WOW
+
+static ssize_t read_file_wow(struct file *file, char __user *user_buf,
+size_t count, loff_t *ppos)
+{
+   struct ath_softc *sc = file-private_data;
+   unsigned int len = 0, size = 32;
+   ssize_t retval;
+   char *buf;
+
+   buf = kzalloc(size, GFP_KERNEL);
+   if (!buf)
+   return -ENOMEM;
+
+   len += scnprintf(buf + len, size - len, WOW: %s\n,
+sc-force_wow ? ENABLED : DISABLED);
+
+   if (len  size)
+   len = size;
+
+   retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
+   kfree(buf);
+
+   return retval;
+}
+
+static ssize_t write_file_wow(struct file *file, const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+   struct ath_softc *sc = file-private_data;
+   unsigned long val;
+   char buf[32];
+   ssize_t len;
+
+   len = min(count, sizeof(buf) - 1);
+   if (copy_from_user(buf, user_buf, len))
+   return -EFAULT;
+
+   buf[len] = '\0';
+   if (kstrtoul(buf, 0, val))
+   return -EINVAL;
+
+   if (val != 1)
+   return -EINVAL;
+
+   if (!sc-force_wow) {
+   sc-force_wow = true;
+   ath9k_init_wow(sc-hw);
+   }
+
+   return count;
+}
+
+static const struct file_operations fops_wow = {
+   .read = read_file_wow,
+   .write = write_file_wow,
+   .open = simple_open,
+   .owner = THIS_MODULE,
+   .llseek = default_llseek,
+};
+
+#endif
+
 static ssize_t read_file_tpc(struct file *file, char __user *user_buf,
 size_t count, loff_t *ppos)
 {
@@ -1313,6 +1376,11 @@ int ath9k_init_debug(struct ath_hw *ah)
fops_btcoex);
 #endif
 
+#ifdef CONFIG_ATH9K_WOW
+   debugfs_create_file(wow, S_IRUSR | S_IWUSR,
+   sc-debug.debugfs_phy, sc, fops_wow);
+#endif
+
 #ifdef CONFIG_ATH9K_DYNACK
debugfs_create_file(ack_to, S_IRUSR | S_IWUSR, sc-debug.debugfs_phy,
sc, fops_ackto);
diff --git a/drivers/net/wireless/ath/ath9k/wow.c 
b/drivers/net/wireless/ath/ath9k/wow.c
index d4cfbc3..4b3b565 100644
--- a/drivers/net/wireless/ath/ath9k/wow.c
+++ b/drivers/net/wireless/ath/ath9k/wow.c
@@ -327,7 +327,7 @@ void ath9k_init_wow(struct ieee80211_hw *hw)
 {
struct ath_softc *sc = hw-priv;
 
-   if (sc-driver_data  ATH9K_PCI_WOW) {
+   if ((sc-driver_data  ATH9K_PCI_WOW) || sc-force_wow) {
hw-wiphy-wowlan = ath9k_wowlan_support;
device_init_wakeup(sc-dev, 1);
}
@@ -337,6 +337,6 @@ void ath9k_deinit_wow(struct ieee80211_hw *hw)
 {
struct ath_softc *sc = hw-priv;
 
-   if (sc-driver_data  ATH9K_PCI_WOW)
+   if ((sc-driver_data  ATH9K_PCI_WOW) || sc-force_wow)
device_init_wakeup(sc-dev, 0);
 }
-- 
2.2.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 05/17] ath9k: Check multi-channel context for WOW

2015-01-30 Thread Sujith Manoharan
From: Sujith Manoharan c_man...@qca.qualcomm.com

If CONFIG_ATH9K_CHANNEL_CONTEXT is enabled, check whether
multiple contexts are active and if so, return 1 without
enabling WOW since we don't support it in this case.

Signed-off-by: Sujith Manoharan c_man...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath9k/wow.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/wow.c 
b/drivers/net/wireless/ath/ath9k/wow.c
index 1799a1d..1b005c6 100644
--- a/drivers/net/wireless/ath/ath9k/wow.c
+++ b/drivers/net/wireless/ath/ath9k/wow.c
@@ -215,6 +215,15 @@ int ath9k_suspend(struct ieee80211_hw *hw,
goto fail_wow;
}
 
+   if (ath9k_is_chanctx_enabled()) {
+   if (test_bit(ATH_OP_MULTI_CHANNEL, common-op_flags)) {
+   ath_dbg(common, WOW,
+   Multi-channel WOW is not supported\n);
+   ret = 1;
+   goto fail_wow;
+   }
+   }
+
if (!test_bit(ATH_OP_PRIM_STA_VIF, common-op_flags)) {
ath_dbg(common, WOW, None of the STA vifs are associated\n);
ret = 1;
-- 
2.2.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 04/17] ath9k: Check early for multi-vif/STA conditions

2015-01-30 Thread Sujith Manoharan
From: Sujith Manoharan c_man...@qca.qualcomm.com

If multiple interfaces are active or there is no
associated station interface, bail out early and
return 1 so that mac80211 can proceed with the normal
suspend routine.

Signed-off-by: Sujith Manoharan c_man...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath9k/wow.c | 22 +++---
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/wow.c 
b/drivers/net/wireless/ath/ath9k/wow.c
index 272c05c..1799a1d 100644
--- a/drivers/net/wireless/ath/ath9k/wow.c
+++ b/drivers/net/wireless/ath/ath9k/wow.c
@@ -209,29 +209,21 @@ int ath9k_suspend(struct ieee80211_hw *hw,
goto fail_wow;
}
 
-   ath_cancel_work(sc);
-   ath_stop_ani(sc);
-
-   /*
-* none of the sta vifs are associated
-* and we are not currently handling multivif
-* cases, for instance we have to seperately
-* configure 'keep alive frame' for each
-* STA.
-*/
-
-   if (!test_bit(ATH_OP_PRIM_STA_VIF, common-op_flags)) {
-   ath_dbg(common, WOW, None of the STA vifs are associated\n);
+   if (sc-cur_chan-nvifs  1) {
+   ath_dbg(common, WOW, WoW for multivif is not yet supported\n);
ret = 1;
goto fail_wow;
}
 
-   if (sc-cur_chan-nvifs  1) {
-   ath_dbg(common, WOW, WoW for multivif is not yet supported\n);
+   if (!test_bit(ATH_OP_PRIM_STA_VIF, common-op_flags)) {
+   ath_dbg(common, WOW, None of the STA vifs are associated\n);
ret = 1;
goto fail_wow;
}
 
+   ath_cancel_work(sc);
+   ath_stop_ani(sc);
+
ath9k_wow_map_triggers(sc, wowlan, wow_triggers_enabled);
 
ath_dbg(common, WOW, WoW triggers enabled 0x%x\n,
-- 
2.2.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 12/17] ath9k: Add a HW structure for WOW

2015-01-30 Thread Sujith Manoharan
From: Sujith Manoharan c_man...@qca.qualcomm.com

This can be used to hold the WOW state in
ath9k_hw.

Signed-off-by: Sujith Manoharan c_man...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath9k/ar9003_wow.c | 10 +-
 drivers/net/wireless/ath/ath9k/hw.h |  6 +-
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_wow.c 
b/drivers/net/wireless/ath/ath9k/ar9003_wow.c
index 3abc907..bb61417 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_wow.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_wow.c
@@ -137,7 +137,7 @@ void ath9k_hw_wow_apply_pattern(struct ath_hw *ah, u8 
*user_pattern,
 * other fields
 */
 
-   ah-wow_event_mask |= BIT(pattern_count + AR_WOW_PAT_FOUND_SHIFT);
+   ah-wow.wow_event_mask |= BIT(pattern_count + AR_WOW_PAT_FOUND_SHIFT);
 
if (pattern_count  4) {
/* Pattern 0-3 uses AR_WOW_LENGTH1 register */
@@ -174,7 +174,7 @@ u32 ath9k_hw_wow_wakeup(struct ath_hw *ah)
 * register. This mask will clean it up.
 */
 
-   val = ah-wow_event_mask;
+   val = ah-wow.wow_event_mask;
 
if (val) {
if (val  AR_WOW_MAGIC_PAT_FOUND)
@@ -218,7 +218,7 @@ u32 ath9k_hw_wow_wakeup(struct ath_hw *ah)
if (ah-is_pciexpress)
ath9k_hw_configpcipowersave(ah, false);
 
-   ah-wow_event_mask = 0;
+   ah-wow.wow_event_mask = 0;
 
return wow_status;
 }
@@ -235,7 +235,7 @@ void ath9k_hw_wow_enable(struct ath_hw *ah, u32 
pattern_enable)
 * are from the 'pattern_enable' in this function and
 * 'pattern_count' of ath9k_hw_wow_apply_pattern()
 */
-   wow_event_mask = ah-wow_event_mask;
+   wow_event_mask = ah-wow.wow_event_mask;
 
/*
 * Untie Power-on-Reset from the PCI-E-Reset. When we are in
@@ -402,6 +402,6 @@ void ath9k_hw_wow_enable(struct ath_hw *ah, u32 
pattern_enable)
REG_CLR_BIT(ah, AR_PCU_MISC_MODE3, clr);
 
ath9k_hw_set_powermode_wow_sleep(ah);
-   ah-wow_event_mask = wow_event_mask;
+   ah-wow.wow_event_mask = wow_event_mask;
 }
 EXPORT_SYMBOL(ath9k_hw_wow_enable);
diff --git a/drivers/net/wireless/ath/ath9k/hw.h 
b/drivers/net/wireless/ath/ath9k/hw.h
index 22b0422..d36210a 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -270,6 +270,10 @@ enum ath9k_hw_caps {
  * of those types.
  */
 
+struct ath9k_hw_wow {
+   u32 wow_event_mask;
+};
+
 struct ath9k_hw_capabilities {
u32 hw_caps; /* ATH9K_HW_CAP_* from ath9k_hw_caps */
u16 rts_aggr_limit;
@@ -928,7 +932,7 @@ struct ath_hw {
u32 ent_mode;
 
 #ifdef CONFIG_ATH9K_WOW
-   u32 wow_event_mask;
+   struct ath9k_hw_wow wow;
 #endif
bool is_clk_25mhz;
int (*get_mac_revision)(void);
-- 
2.2.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


Re: [PATCH v2 2/7] ath10k: implement chanctx API

2015-01-30 Thread Johannes Berg

 +++ b/drivers/net/wireless/ath/ath10k/core.h

 @@ -277,6 +282,7 @@ struct ath10k_vif {
   dma_addr_t beacon_paddr;
  
   struct ath10k *ar;
 + struct ath10k_chanctx *arctx;

you also have vif-chanctx_conf pointer, which you could use

ultimately it's a software architecture decision - personally I wouldn't
want to duplicate all that data and the lists etc. in the driver when
mac80211 has them, but that's just my opinion. :)

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


Re: [PATCH v2 2/7] ath10k: implement chanctx API

2015-01-30 Thread Michal Kazior
On 30 January 2015 at 13:45, Johannes Berg johan...@sipsolutions.net wrote:
 On Fri, 2015-01-30 at 13:31 +0100, Michal Kazior wrote:

 + INIT_LIST_HEAD(ar-arctxs);
   INIT_LIST_HEAD(ar-arvifs);

 I'm not sure why you have an interface list, but I'd say you don't need
 either since you have enumeration APIs:

 ieee80211_iterate_active_interfaces[_atomic,...]

 and

 ieee80211_iter_chan_contexts_atomic

 :)

I recall that at least there's one case where using these helpers is
impossible: drv_config() which can be called while mac80211 is already
holding iflist_mtx. ath10k needs to iterate over vifs and issue
blocking commands sometimes so it can't use atomic/rcu versions
either.


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


Re: [PATCH v2 2/7] ath10k: implement chanctx API

2015-01-30 Thread Michal Kazior
On 30 January 2015 at 13:58, Johannes Berg johan...@sipsolutions.net wrote:

 +++ b/drivers/net/wireless/ath/ath10k/core.h

 @@ -277,6 +282,7 @@ struct ath10k_vif {
   dma_addr_t beacon_paddr;

   struct ath10k *ar;
 + struct ath10k_chanctx *arctx;

 you also have vif-chanctx_conf pointer, which you could use

 ultimately it's a software architecture decision - personally I wouldn't
 want to duplicate all that data and the lists etc. in the driver when
 mac80211 has them, but that's just my opinion. :)

I'm a bit reluctant to freely use mac80211 owned structures out of
mac80211_ops callback context, i.e. from a tasklet fearing
inconsistencies. Or am I worrying unnecessarily? If so I guess I'll
redo this and use mac80211's structures directly :-)


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


Re: [PATCH v2 2/7] ath10k: implement chanctx API

2015-01-30 Thread Johannes Berg
On Fri, 2015-01-30 at 14:06 +0100, Michal Kazior wrote:

 I'm a bit reluctant to freely use mac80211 owned structures out of
 mac80211_ops callback context, i.e. from a tasklet fearing
 inconsistencies. Or am I worrying unnecessarily? If so I guess I'll
 redo this and use mac80211's structures directly :-)

Yeah that's a concern, we were just looking at something similar.
However, I think at least with channel contexts you should be fine since
mac80211 never really modifies them much, except for the width and # of
chains needed?

We've recently seen a similar issue with vif-bss_conf, and I'm
considering making that an RCU-protected pointer rather than the
embedded sub-struct, that way mac80211 can replace it atomically when
needed. I've yet to see if that's practical though.

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


Re: [PATCH v2 2/7] ath10k: implement chanctx API

2015-01-30 Thread Michal Kazior
On 30 January 2015 at 14:04, Johannes Berg johan...@sipsolutions.net wrote:
 On Fri, 2015-01-30 at 14:02 +0100, Michal Kazior wrote:

 I recall that at least there's one case where using these helpers is
 impossible: drv_config() which can be called while mac80211 is already
 holding iflist_mtx. ath10k needs to iterate over vifs and issue
 blocking commands sometimes so it can't use atomic/rcu versions
 either.

 If you wanted to use it, I wouldn't be averse to adding a locked version
 that can only be used inside a few of such callbacks. With appropriate
 lockdep warnings that would be safe enough, I think.

You'd probably have to add quite a few mutex_lock(iflist_mtx) around
drv_*() calls (not directly but somewhere at their call trees) to
guarantee driver can use lock-free iterate() version (which doesn't
exist yet). This could be tricky.


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


Re: [PATCH v2 2/7] ath10k: implement chanctx API

2015-01-30 Thread Johannes Berg
On Fri, 2015-01-30 at 14:22 +0100, Michal Kazior wrote:

 You'd probably have to add quite a few mutex_lock(iflist_mtx) around
 drv_*() calls (not directly but somewhere at their call trees) to
 guarantee driver can use lock-free iterate() version (which doesn't
 exist yet). This could be tricky.

Well, I was thinking you'd only use it in some places now - but it does
seem a bit difficult to maintain.

We've not typically had to worry about using the synchronous versions
much since we mostly just need a single interface so we just pass it out
and use it there, or so.

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 08/17] ath9k: Remove unused BMISS processing

2015-01-30 Thread Sujith Manoharan
From: Sujith Manoharan c_man...@qca.qualcomm.com

The various variables tracking bmiss interrupts
are not really used anywhere except in a debug
message. Remove them since they have no functional
purpose.

Signed-off-by: Sujith Manoharan c_man...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath9k/ath9k.h |  2 --
 drivers/net/wireless/ath/ath9k/main.c  |  9 -
 drivers/net/wireless/ath/ath9k/wow.c   | 18 --
 3 files changed, 29 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h 
b/drivers/net/wireless/ath/ath9k/ath9k.h
index 4209d7b..803a7d4 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -1043,8 +1043,6 @@ struct ath_softc {
s16 tx99_power;
 
 #ifdef CONFIG_ATH9K_WOW
-   atomic_t wow_got_bmiss_intr;
-   atomic_t wow_sleep_proc_intr; /* in the middle of WoW sleep ? */
u32 wow_intr_before_sleep;
 #endif
 };
diff --git a/drivers/net/wireless/ath/ath9k/main.c 
b/drivers/net/wireless/ath/ath9k/main.c
index 62b0bf4..9ede991 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -555,15 +555,6 @@ irqreturn_t ath_isr(int irq, void *dev)
(status  ATH9K_INT_BB_WATCHDOG))
goto chip_reset;
 
-#ifdef CONFIG_ATH9K_WOW
-   if (status  ATH9K_INT_BMISS) {
-   if (atomic_read(sc-wow_sleep_proc_intr) == 0) {
-   atomic_inc(sc-wow_got_bmiss_intr);
-   atomic_dec(sc-wow_sleep_proc_intr);
-   }
-   }
-#endif
-
if (status  ATH9K_INT_SWBA)
tasklet_schedule(sc-bcon_tasklet);
 
diff --git a/drivers/net/wireless/ath/ath9k/wow.c 
b/drivers/net/wireless/ath/ath9k/wow.c
index c0c564d..fa60dbb 100644
--- a/drivers/net/wireless/ath/ath9k/wow.c
+++ b/drivers/net/wireless/ath/ath9k/wow.c
@@ -269,7 +269,6 @@ int ath9k_suspend(struct ieee80211_hw *hw,
 
ath9k_ps_restore(sc);
ath_dbg(common, WOW, Suspend with WoW triggers: 0x%x\n, triggers);
-   atomic_inc(sc-wow_sleep_proc_intr);
 
set_bit(ATH_OP_WOW_ENABLED, common-op_flags);
 fail_wow:
@@ -299,19 +298,6 @@ int ath9k_resume(struct ieee80211_hw *hw)
 
wow_status = ath9k_hw_wow_wakeup(ah);
 
-   if (atomic_read(sc-wow_got_bmiss_intr) == 0) {
-   /*
-* some devices may not pick beacon miss
-* as the reason they woke up so we add
-* that here for that shortcoming.
-*/
-   wow_status |= AH_WOW_BEACON_MISS;
-   atomic_dec(sc-wow_got_bmiss_intr);
-   ath_dbg(common, ANY, Beacon miss interrupt picked up during 
WoW sleep\n);
-   }
-
-   atomic_dec(sc-wow_sleep_proc_intr);
-
if (wow_status) {
ath_dbg(common, ANY, Waking up due to WoW triggers %s with WoW 
status = %x\n,
ath9k_hw_wow_event_to_string(wow_status), wow_status);
@@ -347,10 +333,6 @@ void ath9k_init_wow(struct ieee80211_hw *hw)
 
if (sc-driver_data  ATH9K_PCI_WOW) {
hw-wiphy-wowlan = ath9k_wowlan_support;
-
-   atomic_set(sc-wow_sleep_proc_intr, -1);
-   atomic_set(sc-wow_got_bmiss_intr, -1);
-
device_init_wakeup(sc-dev, 1);
}
 }
-- 
2.2.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 09/17] ath9k: Remove ath9k_hw_wow_event_to_string

2015-01-30 Thread Sujith Manoharan
From: Sujith Manoharan c_man...@qca.qualcomm.com

Printing the value of the wakeup status is sufficient.

Signed-off-by: Sujith Manoharan c_man...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath9k/ar9003_wow.c | 15 ---
 drivers/net/wireless/ath/ath9k/hw.h |  5 -
 drivers/net/wireless/ath/ath9k/wow.c| 10 +++---
 3 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_wow.c 
b/drivers/net/wireless/ath/ath9k/ar9003_wow.c
index 81c88dd..3abc907 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_wow.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_wow.c
@@ -19,21 +19,6 @@
 #include reg.h
 #include hw-ops.h
 
-const char *ath9k_hw_wow_event_to_string(u32 wow_event)
-{
-   if (wow_event  AH_WOW_MAGIC_PATTERN_EN)
-   return Magic pattern;
-   if (wow_event  AH_WOW_USER_PATTERN_EN)
-   return User pattern;
-   if (wow_event  AH_WOW_LINK_CHANGE)
-   return Link change;
-   if (wow_event  AH_WOW_BEACON_MISS)
-   return Beacon miss;
-
-   return  unknown reason;
-}
-EXPORT_SYMBOL(ath9k_hw_wow_event_to_string);
-
 static void ath9k_hw_set_powermode_wow_sleep(struct ath_hw *ah)
 {
struct ath_common *common = ath9k_hw_common(ah);
diff --git a/drivers/net/wireless/ath/ath9k/hw.h 
b/drivers/net/wireless/ath/ath9k/hw.h
index dabc94e..22b0422 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -1146,17 +1146,12 @@ ath9k_hw_get_btcoex_scheme(struct ath_hw *ah)
 
 
 #ifdef CONFIG_ATH9K_WOW
-const char *ath9k_hw_wow_event_to_string(u32 wow_event);
 void ath9k_hw_wow_apply_pattern(struct ath_hw *ah, u8 *user_pattern,
u8 *user_mask, int pattern_count,
int pattern_len);
 u32 ath9k_hw_wow_wakeup(struct ath_hw *ah);
 void ath9k_hw_wow_enable(struct ath_hw *ah, u32 pattern_enable);
 #else
-static inline const char *ath9k_hw_wow_event_to_string(u32 wow_event)
-{
-   return NULL;
-}
 static inline void ath9k_hw_wow_apply_pattern(struct ath_hw *ah,
  u8 *user_pattern,
  u8 *user_mask,
diff --git a/drivers/net/wireless/ath/ath9k/wow.c 
b/drivers/net/wireless/ath/ath9k/wow.c
index fa60dbb..d4cfbc3 100644
--- a/drivers/net/wireless/ath/ath9k/wow.c
+++ b/drivers/net/wireless/ath/ath9k/wow.c
@@ -281,7 +281,7 @@ int ath9k_resume(struct ieee80211_hw *hw)
struct ath_softc *sc = hw-priv;
struct ath_hw *ah = sc-sc_ah;
struct ath_common *common = ath9k_hw_common(ah);
-   u32 wow_status;
+   u8 status;
 
mutex_lock(sc-mutex);
 
@@ -296,12 +296,8 @@ int ath9k_resume(struct ieee80211_hw *hw)
 
spin_unlock_bh(sc-sc_pcu_lock);
 
-   wow_status = ath9k_hw_wow_wakeup(ah);
-
-   if (wow_status) {
-   ath_dbg(common, ANY, Waking up due to WoW triggers %s with WoW 
status = %x\n,
-   ath9k_hw_wow_event_to_string(wow_status), wow_status);
-   }
+   status = ath9k_hw_wow_wakeup(ah);
+   ath_dbg(common, WOW, Resume with WoW status: 0x%x\n, status);
 
ath_restart_work(sc);
ath9k_start_btcoex(sc);
-- 
2.2.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


Re: [PATCH] Repair soft lockup with monitor mode of ath9k_htc card

2015-01-30 Thread Oleksij Rempel
Am 29.01.2015 um 00:14 schrieb yuweizh...@139.com:
 From: Yuwei Zheng yuweizh...@139.com
 
 In the environment with heavy wifi traffic, set the ar9271 into monitor mode, 
 will
 trigger a deadloop panic.
  
 The ath9k_hif_usb_rx_cb function excute on  the interrupt context, and 
 ath9k_rx_tasklet excute
 on the soft irq context. In other words, the ath9k_hif_usb_rx_cb have more 
 chance to excute than
 ath9k_rx_tasklet.  So in the worst condition,  the rx.rxbuf receive list is 
 always full,
 and the do {}while(true) loop will not be break. The kernel get a soft lockup 
 panic. 

Please note, ath9k_htc is also used on HW where real hrtimer actually
exist. It should behave differently and produce different load on the
system. The overhead of setting up the hrtimers *may* not be worth it.
Depending on the load, it may provide lots of avoidable interrupts.
Did you tried to use simple tasklet_start?

 [59011.007210] BUG: soft lockup - CPU#0 stuck for 23s!
 [kworker/0:0:30609]
 [59011.030560] BUG: scheduling while atomic: kworker/0:0/30609/0x40010100
 [59013.804486] BUG: scheduling while atomic: kworker/0:0/30609/0x40010100
 [59013.858522] Kernel panic - not syncing: softlockup: hung tasks
  
 [59014.038891] Exception stack(0xdf4bbc38 to 0xdf4bbc80)
 [59014.046834] bc20:   
 de57b950 6113
 [59014.059579] bc40:  bb32bb32 6113 de57b948 de57b500 dc7bb440 
 df4bbcd0 
 [59014.072337] bc60: de57b950 6113 df4bbcd0 df4bbc80 c04c259d c04c25a0 
 6133 
 [59014.085233] [c04c28db] (__irq_svc+0x3b/0x5c) from [c04c25a0] 
 (_raw_spin_unlock_irqrestore+0xc/0x10)
 [59014.100437] [c04c25a0] (_raw_spin_unlock_irqrestore+0xc/0x10) from 
 [bf9c2089] (ath9k_rx_tasklet+0x290/0x490 [ath9k_htc])
 [59014.118267] [bf9c2089] (ath9k_rx_tasklet+0x290/0x490 [ath9k_htc]) from 
 [c0036d23] (tasklet_action+0x3b/0x98)
 [59014.134132] [c0036d23] (tasklet_action+0x3b/0x98) from [c0036709] 
 (__do_softirq+0x99/0x16c)
 [59014.147784] [c0036709] (__do_softirq+0x99/0x16c) from [c00369f7] 
 (irq_exit+0x5b/0x5c)
 [59014.160653] [c00369f7] (irq_exit+0x5b/0x5c) from [c000cfc3] 
 (handle_IRQ+0x37/0x78)
 [59014.173124] [c000cfc3] (handle_IRQ+0x37/0x78) from [c00085df] 
 (omap3_intc_handle_irq+0x5f/0x68)
 [59014.187225] [c00085df] (omap3_intc_handle_irq+0x5f/0x68) from 
 [c04c28db](__irq_svc+0x3b/0x5c)
  
 This bug can be see with low performance board, such as uniprocessor beagle 
 bone board.
  
  
 Signed-off-by: Yuwei Zheng zhengyu...@360.cn
 Signed-off-by: Yuwei Zheng yuweizh...@139.com
 
 
 ---
  drivers/net/wireless/ath/ath9k/hif_usb.c   | 58 
 ++
  drivers/net/wireless/ath/ath9k/hif_usb.h   |  5 +++
  drivers/net/wireless/ath/ath9k/htc.h   | 13 ++
  drivers/net/wireless/ath/ath9k/htc_drv_debug.c | 49 ++
  drivers/net/wireless/ath/ath9k/htc_drv_txrx.c  | 26 
  5 files changed, 144 insertions(+), 7 deletions(-)
 
 diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c 
 b/drivers/net/wireless/ath/ath9k/hif_usb.c
 index 8e7153b..18c6f0e 100644
 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c
 +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
 @@ -658,7 +658,6 @@ static void ath9k_hif_usb_rx_cb(struct urb *urb)
   default:
   goto resubmit;
   }
 -
   if (likely(urb-actual_length != 0)) {
   skb_put(skb, urb-actual_length);
   ath9k_hif_usb_rx_stream(hif_dev, skb);
 @@ -667,12 +666,18 @@ static void ath9k_hif_usb_rx_cb(struct urb *urb)
  resubmit:
   skb_reset_tail_pointer(skb);
   skb_trim(skb, 0);
 -
 - usb_anchor_urb(urb, hif_dev-rx_submitted);
 - ret = usb_submit_urb(urb, GFP_ATOMIC);
 - if (ret) {
 - usb_unanchor_urb(urb);
 - goto free;
 + if (atomic_read(hif_dev-rx_urb_submit_delay)  0) {
 + usb_anchor_urb(urb, hif_dev-rx_delayed_submitted);
 + ret = tasklet_hrtimer_start(hif_dev-rx_submit_timer,
 + ktime_set(0, 
 atomic_read(hif_dev-rx_urb_submit_delay)*1000),
 + HRTIMER_MODE_REL);
 + } else {
 + usb_anchor_urb(urb, hif_dev-rx_submitted);
 + ret = usb_submit_urb(urb, GFP_ATOMIC);
 + if (ret) {
 + usb_unanchor_urb(urb);
 + goto free;
 + }
   }
  
   return;
 @@ -818,9 +823,39 @@ err:
   return -ENOMEM;
  }
  
 +static enum hrtimer_restart rx_urb_submit_timer_handler(struct hrtimer *me)
 +{
 + struct tasklet_hrtimer *thr =
 + container_of(me, struct tasklet_hrtimer, timer);
 + struct  hif_device_usb *hif_dev =
 + container_of(thr, struct hif_device_usb, rx_submit_timer);
 + struct urb *urb = NULL;
 + struct sk_buff *skb = NULL;
 + int ret;
 +
 + while (true) {
 + urb = usb_get_from_anchor(hif_dev-rx_delayed_submitted);
 +

[PATCH v2 2/7] ath10k: implement chanctx API

2015-01-30 Thread Michal Kazior
The chanctx API will allow ath10k to support
multi-channel operation.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---

Notes:
v2:
 * prevent null deref in ath10k_peer_assoc_h_vht()
   after rebasing to latest master branch

 drivers/net/wireless/ath/ath10k/core.c   |   1 +
 drivers/net/wireless/ath/ath10k/core.h   |   8 +
 drivers/net/wireless/ath/ath10k/htt_rx.c |  87 -
 drivers/net/wireless/ath/ath10k/mac.c| 561 +++
 drivers/net/wireless/ath/ath10k/wmi.c|  13 +-
 5 files changed, 592 insertions(+), 78 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 5e9e1a6..57f70327 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1116,6 +1116,7 @@ int ath10k_core_start(struct ath10k *ar, enum 
ath10k_firmware_mode mode)
 
ar-free_vdev_map = (1LL  ar-max_num_vdevs) - 1;
 
+   INIT_LIST_HEAD(ar-arctxs);
INIT_LIST_HEAD(ar-arvifs);
 
return 0;
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index abb3203..cf7963d 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -260,6 +260,11 @@ struct ath10k_sta {
 #endif
 };
 
+struct ath10k_chanctx {
+   struct list_head list;
+   struct ieee80211_chanctx_conf conf;
+};
+
 #define ATH10K_VDEV_SETUP_TIMEOUT_HZ (5*HZ)
 
 struct ath10k_vif {
@@ -277,6 +282,7 @@ struct ath10k_vif {
dma_addr_t beacon_paddr;
 
struct ath10k *ar;
+   struct ath10k_chanctx *arctx;
struct ieee80211_vif *vif;
 
bool is_started;
@@ -561,6 +567,7 @@ struct ath10k {
struct cfg80211_chan_def chandef;
 
unsigned long long free_vdev_map;
+   struct ath10k_vif *monitor_arvif;
bool monitor;
int monitor_vdev_id;
bool monitor_started;
@@ -590,6 +597,7 @@ struct ath10k {
/* protects shared structure data */
spinlock_t data_lock;
 
+   struct list_head arctxs;
struct list_head arvifs;
struct list_head peers;
wait_queue_head_t peer_mapping_wq;
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
b/drivers/net/wireless/ath/ath10k/htt_rx.c
index c1da44f..b18aa8e 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -773,8 +773,74 @@ static void ath10k_htt_rx_h_rates(struct ath10k *ar,
}
 }
 
+static struct ieee80211_channel *
+ath10k_htt_rx_h_peer_channel(struct ath10k *ar, struct htt_rx_desc *rxd)
+{
+   struct ath10k_peer *peer;
+   struct ath10k_vif *arvif;
+   u16 peer_id;
+
+   lockdep_assert_held(ar-data_lock);
+
+   if (!rxd)
+   return NULL;
+
+   if (rxd-attention.flags 
+   __cpu_to_le32(RX_ATTENTION_FLAGS_PEER_IDX_INVALID))
+   return NULL;
+
+   if (!(rxd-msdu_end.info0 
+ __cpu_to_le32(RX_MSDU_END_INFO0_FIRST_MSDU)))
+   return NULL;
+
+   peer_id = MS(__le32_to_cpu(rxd-mpdu_start.info0),
+RX_MPDU_START_INFO0_PEER_IDX);
+
+   peer = ath10k_peer_find_by_id(ar, peer_id);
+   if (!peer)
+   return NULL;
+
+   arvif = ath10k_get_arvif(ar, peer-vdev_id);
+   if (WARN_ON_ONCE(!arvif-arctx))
+   return NULL;
+
+   if (WARN_ON_ONCE(!arvif-arctx))
+   return NULL;
+
+   return arvif-arctx-conf.def.chan;
+}
+
+static struct ieee80211_channel *
+ath10k_htt_rx_h_vdev_channel(struct ath10k *ar, u32 vdev_id)
+{
+   struct ath10k_vif *arvif;
+
+   lockdep_assert_held(ar-data_lock);
+
+   list_for_each_entry(arvif, ar-arvifs, list)
+   if (arvif-vdev_id == vdev_id  arvif-arctx)
+   return arvif-arctx-conf.def.chan;
+
+   return NULL;
+}
+
+static struct ieee80211_channel *
+ath10k_htt_rx_h_any_channel(struct ath10k *ar)
+{
+   struct ath10k_chanctx *arctx;
+
+   lockdep_assert_held(ar-data_lock);
+
+   list_for_each_entry(arctx, ar-arctxs, list)
+   return arctx-conf.def.chan;
+
+   return NULL;
+}
+
 static bool ath10k_htt_rx_h_channel(struct ath10k *ar,
-   struct ieee80211_rx_status *status)
+   struct ieee80211_rx_status *status,
+   struct htt_rx_desc *rxd,
+   u32 vdev_id)
 {
struct ieee80211_channel *ch;
 
@@ -782,6 +848,12 @@ static bool ath10k_htt_rx_h_channel(struct ath10k *ar,
ch = ar-scan_channel;
if (!ch)
ch = ar-rx_channel;
+   if (!ch)
+   ch = ath10k_htt_rx_h_peer_channel(ar, rxd);
+   if (!ch)
+   ch = ath10k_htt_rx_h_vdev_channel(ar, vdev_id);
+   if (!ch)
+   ch = ath10k_htt_rx_h_any_channel(ar);
spin_unlock_bh(ar-data_lock);
 
if (!ch)
@@ -819,7 +891,8 @@ 

[PATCH v2 5/7] ath10k: rework tx queue locking

2015-01-30 Thread Michal Kazior
Tx queue locking was very simple until now.
Multi-channel support will require a more flexible
and fine grained control.

This introduces a per-hw and per-vif (each with a
bitmask of reasons) tx queue locking.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/core.h   |  8 +
 drivers/net/wireless/ath/ath10k/htt_tx.c | 11 --
 drivers/net/wireless/ath/ath10k/mac.c| 20 ++-
 drivers/net/wireless/ath/ath10k/mac.h| 57 
 4 files changed, 92 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index cf7963d..68df646 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -280,6 +280,7 @@ struct ath10k_vif {
bool beacon_sent;
void *beacon_buf;
dma_addr_t beacon_paddr;
+   unsigned long tx_paused; /* arbitrary values defined by target */
 
struct ath10k *ar;
struct ath10k_chanctx *arctx;
@@ -472,6 +473,11 @@ static inline const char *ath10k_scan_state_str(enum 
ath10k_scan_state state)
return unknown;
 }
 
+enum ath10k_tx_pause_reason {
+   ATH10K_TX_PAUSE_Q_FULL,
+   ATH10K_TX_PAUSE_MAX,
+};
+
 struct ath10k {
struct ath_common ath_common;
struct ieee80211_hw *hw;
@@ -631,6 +637,8 @@ struct ath10k {
 
struct dfs_pattern_detector *dfs_detector;
 
+   unsigned long tx_paused; /* see ATH10K_TX_PAUSE_ */
+
 #ifdef CONFIG_ATH10K_DEBUGFS
struct ath10k_debug debug;
 #endif
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c 
b/drivers/net/wireless/ath/ath10k/htt_tx.c
index c1961e7..fcc52c1 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -24,9 +24,14 @@
 
 void __ath10k_htt_tx_dec_pending(struct ath10k_htt *htt)
 {
+   struct ath10k *ar = htt-ar;
+
htt-num_pending_tx--;
-   if (htt-num_pending_tx == htt-max_num_pending_tx - 1)
-   ieee80211_wake_queues(htt-ar-hw);
+   if (htt-num_pending_tx == htt-max_num_pending_tx - 1) {
+   spin_lock_bh(ar-data_lock);
+   ath10k_mac_tx_unlock(htt-ar, ATH10K_TX_PAUSE_Q_FULL);
+   spin_unlock_bh(ar-data_lock);
+   }
 }
 
 static void ath10k_htt_tx_dec_pending(struct ath10k_htt *htt)
@@ -49,7 +54,7 @@ static int ath10k_htt_tx_inc_pending(struct ath10k_htt *htt)
 
htt-num_pending_tx++;
if (htt-num_pending_tx == htt-max_num_pending_tx)
-   ieee80211_stop_queues(htt-ar-hw);
+   ath10k_mac_tx_lock(htt-ar, ATH10K_TX_PAUSE_Q_FULL);
 
 exit:
spin_unlock_bh(htt-tx_lock);
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index ba66a67..92355f1 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2811,6 +2811,7 @@ void ath10k_halt(struct ath10k *ar)
ath10k_monitor_stop(ar);
 
ar-monitor_started = false;
+   ar-tx_paused = 0;
 
ath10k_scan_finish(ar);
ath10k_peer_cleanup_all(ar);
@@ -3233,6 +3234,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
int ret = 0;
u32 value;
int bit;
+   int i;
u32 vdev_param;
 
vif-driver_flags |= IEEE80211_VIF_SUPPORTS_UAPSD;
@@ -3288,6 +3290,15 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
break;
}
 
+   /* Using vdev_id as queue number will make it very easy to do per-vif
+* tx queue locking. This shouldn't wrap due to interface combinations
+* but do a modulo for correctness sake and prevent using offchannel tx
+* queues for regular vif tx.
+*/
+   vif-cab_queue = arvif-vdev_id % (IEEE80211_MAX_QUEUES - 1);
+   for (i = 0; i  ARRAY_SIZE(vif-hw_queue); i++)
+   vif-hw_queue[i] = arvif-vdev_id % (IEEE80211_MAX_QUEUES - 1);
+
/* Some firmware revisions don't wait for beacon tx completion before
 * sending another SWBA event. This could lead to hardware using old
 * (freed) beacon data in some cases, e.g. tx credit starvation
@@ -5785,6 +5796,7 @@ int ath10k_mac_register(struct ath10k *ar)
IEEE80211_HW_HAS_RATE_CONTROL |
IEEE80211_HW_AP_LINK_PS |
IEEE80211_HW_WANT_MONITOR_VIF |
+   IEEE80211_HW_QUEUE_CONTROL |
IEEE80211_HW_SPECTRUM_MGMT;
 
ar-hw-wiphy-features |= NL80211_FEATURE_STATIC_SMPS;
@@ -5830,7 +5842,13 @@ int ath10k_mac_register(struct ath10k *ar)
 * on LL hardware queues are managed entirely by the FW
 * so we only advertise to mac we can do the queues thing
 */
-   ar-hw-queues = 4;
+   ar-hw-queues = IEEE80211_MAX_QUEUES;
+
+   /* vdev_ids are used as hw queue numbers. Make sure offchan tx queue is
+* something that 

[PATCH v2 7/7] ath10k: enable multi-channel on supported devices

2015-01-30 Thread Michal Kazior
This effectively enables multi-channel operation
on qca6174 WLAN.RM.2.0-00073 (and possibly any
newer firmware release for qca6174).

This adds appopriate interface combinations and
initializes firmware channel scheduler.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/mac.c | 81 ++-
 1 file changed, 80 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 9dab8cb..dc845e2 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2959,6 +2959,15 @@ static int ath10k_start(struct ieee80211_hw *hw)
goto err_core_stop;
}
 
+   if (test_bit(WMI_SERVICE_ADAPTIVE_OCS, ar-wmi.svc_map)) {
+   ret = ath10k_wmi_adaptive_qcs(ar, true);
+   if (ret) {
+   ath10k_warn(ar, failed to enable adaptive qcs: %d\n,
+   ret);
+   goto err_core_stop;
+   }
+   }
+
if (ar-cfg_tx_chainmask)
__ath10k_set_antenna(ar, ar-cfg_tx_chainmask,
 ar-cfg_rx_chainmask);
@@ -5614,6 +5623,64 @@ static const struct ieee80211_iface_combination 
ath10k_10x_if_comb[] = {
},
 };
 
+static const struct ieee80211_iface_limit ath10k_tlv_if_limit[] = {
+   {
+   .max = 2,
+   .types = BIT(NL80211_IFTYPE_STATION) |
+BIT(NL80211_IFTYPE_AP) |
+BIT(NL80211_IFTYPE_P2P_CLIENT) |
+BIT(NL80211_IFTYPE_P2P_GO),
+   },
+   {
+   .max = 1,
+   .types = BIT(NL80211_IFTYPE_P2P_DEVICE),
+   },
+};
+
+static const struct ieee80211_iface_limit ath10k_tlv_if_limit_ibss[] = {
+   {
+   .max = 1,
+   .types = BIT(NL80211_IFTYPE_STATION),
+   },
+   {
+   .max = 1,
+   .types = BIT(NL80211_IFTYPE_ADHOC),
+   },
+};
+
+/* FIXME: This is not thouroughly tested. These combinations may over- or
+ * underestimate hw/fw capabilities.
+ */
+static struct ieee80211_iface_combination ath10k_tlv_if_comb[] = {
+   {
+   .limits = ath10k_tlv_if_limit,
+   .num_different_channels = 1,
+   .max_interfaces = 2,
+   .n_limits = ARRAY_SIZE(ath10k_tlv_if_limit),
+   },
+   {
+   .limits = ath10k_tlv_if_limit_ibss,
+   .num_different_channels = 1,
+   .max_interfaces = 2,
+   .n_limits = ARRAY_SIZE(ath10k_tlv_if_limit_ibss),
+   },
+};
+
+static struct ieee80211_iface_combination ath10k_tlv_qcs_if_comb[] = {
+   {
+   .limits = ath10k_tlv_if_limit,
+   .num_different_channels = 2,
+   .max_interfaces = 2,
+   .n_limits = ARRAY_SIZE(ath10k_tlv_if_limit),
+   },
+   {
+   .limits = ath10k_tlv_if_limit_ibss,
+   .num_different_channels = 1,
+   .max_interfaces = 2,
+   .n_limits = ARRAY_SIZE(ath10k_tlv_if_limit_ibss),
+   },
+};
+
 static struct ieee80211_sta_vht_cap ath10k_create_vht_cap(struct ath10k *ar)
 {
struct ieee80211_sta_vht_cap vht_cap = {0};
@@ -5864,12 +5931,24 @@ int ath10k_mac_register(struct ath10k *ar)
 
switch (ar-wmi.op_version) {
case ATH10K_FW_WMI_OP_VERSION_MAIN:
-   case ATH10K_FW_WMI_OP_VERSION_TLV:
ar-hw-wiphy-iface_combinations = ath10k_if_comb;
ar-hw-wiphy-n_iface_combinations =
ARRAY_SIZE(ath10k_if_comb);
ar-hw-wiphy-interface_modes |= BIT(NL80211_IFTYPE_ADHOC);
break;
+   case ATH10K_FW_WMI_OP_VERSION_TLV:
+   if (test_bit(WMI_SERVICE_ADAPTIVE_OCS, ar-wmi.svc_map)) {
+   ar-hw-wiphy-iface_combinations =
+   ath10k_tlv_qcs_if_comb;
+   ar-hw-wiphy-n_iface_combinations =
+   ARRAY_SIZE(ath10k_tlv_qcs_if_comb);
+   } else {
+   ar-hw-wiphy-iface_combinations = ath10k_tlv_if_comb;
+   ar-hw-wiphy-n_iface_combinations =
+   ARRAY_SIZE(ath10k_tlv_if_comb);
+   }
+   ar-hw-wiphy-interface_modes |= BIT(NL80211_IFTYPE_ADHOC);
+   break;
case ATH10K_FW_WMI_OP_VERSION_10_1:
case ATH10K_FW_WMI_OP_VERSION_10_2:
case ATH10K_FW_WMI_OP_VERSION_10_2_4:
-- 
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 v2 1/7] ath10k: allow empty ssid vdev config

2015-01-30 Thread Michal Kazior
It doesn't make much sense to reject a valid
firmware configuration combination.

Since SSID isn't known early on it might make
sense to allow driver to start vdev without SSID
and restart it later.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/wmi-tlv.c | 2 --
 drivers/net/wireless/ath/ath10k/wmi.c | 2 --
 2 files changed, 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index be32db9..ccafb69 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -1302,8 +1302,6 @@ ath10k_wmi_tlv_op_gen_vdev_start(struct ath10k *ar,
void *ptr;
u32 flags = 0;
 
-   if (WARN_ON(arg-ssid  arg-ssid_len == 0))
-   return ERR_PTR(-EINVAL);
if (WARN_ON(arg-hidden_ssid  !arg-ssid))
return ERR_PTR(-EINVAL);
if (WARN_ON(arg-ssid_len  sizeof(cmd-ssid.ssid)))
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index ce6f0c7..97ee2e9 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -4264,8 +4264,6 @@ ath10k_wmi_op_gen_vdev_start(struct ath10k *ar,
const char *cmdname;
u32 flags = 0;
 
-   if (WARN_ON(arg-ssid  arg-ssid_len == 0))
-   return ERR_PTR(-EINVAL);
if (WARN_ON(arg-hidden_ssid  !arg-ssid))
return ERR_PTR(-EINVAL);
if (WARN_ON(arg-ssid_len  sizeof(cmd-ssid.ssid)))
-- 
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 v2 0/7] ath10k: add multi-channel support

2015-01-30 Thread Michal Kazior
New qca6174 with wmi-tlv firmware supports
multi-channel operation. To make use of it
ath10k needs a few changes: implement mac80211's
chanctx API and rework tx queue control a bit.

There are still rough edges (involving seldom
beacon reports from firmware causing beacon loss
in some cases, etc). Hopefully this will be fixed
either in driver or firmware eventually.


Changes since RFC:
 * I've sent `ath10k: defer AP self-peer removal
   wait` separately now because it's not really
   required for multi-channel per se

v2:
 * fix null deref after rebasing
 * fix commit log typo

Michal Kazior (7):
  ath10k: allow empty ssid vdev config
  ath10k: implement chanctx API
  ath10k: implement adaptive qcs command
  ath10k: protect ar-arvifs linking with data_lock
  ath10k: rework tx queue locking
  ath10k: implement tx pause wmi event
  ath10k: enable multi-channel on supported devices

 drivers/net/wireless/ath/ath10k/core.c|   1 +
 drivers/net/wireless/ath/ath10k/core.h|  16 +
 drivers/net/wireless/ath/ath10k/htt_rx.c  |  87 +++-
 drivers/net/wireless/ath/ath10k/htt_tx.c  |  11 +-
 drivers/net/wireless/ath/ath10k/mac.c | 682 ++
 drivers/net/wireless/ath/ath10k/mac.h |  57 +++
 drivers/net/wireless/ath/ath10k/wmi-ops.h |  16 +
 drivers/net/wireless/ath/ath10k/wmi-tlv.c | 118 +-
 drivers/net/wireless/ath/ath10k/wmi-tlv.h |  46 ++
 drivers/net/wireless/ath/ath10k/wmi.c |  18 +-
 drivers/net/wireless/ath/ath10k/wmi.h |   1 +
 11 files changed, 966 insertions(+), 87 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