[PATCH 03/12] ath10k: pull reusable code from pci probe and remove for ahb

2016-01-27 Thread Raja Mani
Some of the code present in ath10k_pci_{probe|remove} are reusable
in ahb case too. To avoid code duplication, move reusable code to
new functions. Later, those new functions can be called from ahb
module's probe and exit functions.

Signed-off-by: Raja Mani 
---
 drivers/net/wireless/ath/ath10k/pci.c | 64 +++
 drivers/net/wireless/ath/ath10k/pci.h |  2 ++
 2 files changed, 44 insertions(+), 22 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index c5f6604..6ef878c 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -3009,6 +3009,37 @@ static bool ath10k_pci_chip_is_supported(u32 dev_id, u32 
chip_id)
return false;
 }
 
+int ath10k_pci_setup_resource(struct ath10k *ar)
+{
+   struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+   int ret;
+
+   spin_lock_init(&ar_pci->ce_lock);
+   spin_lock_init(&ar_pci->ps_lock);
+
+   setup_timer(&ar_pci->rx_post_retry, ath10k_pci_rx_replenish_retry,
+   (unsigned long)ar);
+
+   if (QCA_REV_6174(ar))
+   ath10k_pci_override_ce_config(ar);
+
+   ret = ath10k_pci_alloc_pipes(ar);
+   if (ret) {
+   ath10k_err(ar, "failed to allocate copy engine pipes: %d\n",
+  ret);
+   return ret;
+   }
+
+   return 0;
+}
+
+void ath10k_pci_release_resource(struct ath10k *ar)
+{
+   ath10k_pci_kill_tasklet(ar);
+   ath10k_pci_ce_deinit(ar);
+   ath10k_pci_free_pipes(ar);
+}
+
 static const struct ath10k_bus_ops ath10k_pci_bus_ops = {
.read32 = ath10k_bus_pci_read32,
.write32= ath10k_bus_pci_write32,
@@ -3072,34 +3103,25 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
ar->id.subsystem_vendor = pdev->subsystem_vendor;
ar->id.subsystem_device = pdev->subsystem_device;
 
-   spin_lock_init(&ar_pci->ce_lock);
-   spin_lock_init(&ar_pci->ps_lock);
-
-   setup_timer(&ar_pci->rx_post_retry, ath10k_pci_rx_replenish_retry,
-   (unsigned long)ar);
setup_timer(&ar_pci->ps_timer, ath10k_pci_ps_timer,
(unsigned long)ar);
 
-   ret = ath10k_pci_claim(ar);
+   ret = ath10k_pci_setup_resource(ar);
if (ret) {
-   ath10k_err(ar, "failed to claim device: %d\n", ret);
+   ath10k_err(ar, "failed to setup resource: %d\n", ret);
goto err_core_destroy;
}
 
-   if (QCA_REV_6174(ar))
-   ath10k_pci_override_ce_config(ar);
-
-   ret = ath10k_pci_alloc_pipes(ar);
+   ret = ath10k_pci_claim(ar);
if (ret) {
-   ath10k_err(ar, "failed to allocate copy engine pipes: %d\n",
-  ret);
-   goto err_sleep;
+   ath10k_err(ar, "failed to claim device: %d\n", ret);
+   goto err_free_pipes;
}
 
ret = ath10k_pci_force_wake(ar);
if (ret) {
ath10k_warn(ar, "failed to wake up device : %d\n", ret);
-   goto err_free_pipes;
+   goto err_sleep;
}
 
ath10k_pci_ce_deinit(ar);
@@ -3108,7 +3130,7 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
ret = ath10k_pci_init_irq(ar);
if (ret) {
ath10k_err(ar, "failed to init irqs: %d\n", ret);
-   goto err_free_pipes;
+   goto err_sleep;
}
 
ath10k_info(ar, "pci irq %s interrupts %d irq_mode %d reset_mode %d\n",
@@ -3154,13 +3176,13 @@ err_free_irq:
 err_deinit_irq:
ath10k_pci_deinit_irq(ar);
 
-err_free_pipes:
-   ath10k_pci_free_pipes(ar);
-
 err_sleep:
ath10k_pci_sleep_sync(ar);
ath10k_pci_release(ar);
 
+err_free_pipes:
+   ath10k_pci_free_pipes(ar);
+
 err_core_destroy:
ath10k_core_destroy(ar);
 
@@ -3184,10 +3206,8 @@ static void ath10k_pci_remove(struct pci_dev *pdev)
 
ath10k_core_unregister(ar);
ath10k_pci_free_irq(ar);
-   ath10k_pci_kill_tasklet(ar);
ath10k_pci_deinit_irq(ar);
-   ath10k_pci_ce_deinit(ar);
-   ath10k_pci_free_pipes(ar);
+   ath10k_pci_release_resource(ar);
ath10k_pci_sleep_sync(ar);
ath10k_pci_release(ar);
ath10k_core_destroy(ar);
diff --git a/drivers/net/wireless/ath/ath10k/pci.h 
b/drivers/net/wireless/ath/ath10k/pci.h
index 41f3fac..fcfdbca 100644
--- a/drivers/net/wireless/ath/ath10k/pci.h
+++ b/drivers/net/wireless/ath/ath10k/pci.h
@@ -292,6 +292,8 @@ void ath10k_pci_enable_legacy_irq(struct ath10k *ar);
 bool ath10k_pci_irq_pending(struct ath10k *ar);
 void ath10k_pci_disable_and_clear_legacy_irq(struct ath10k *ar);
 int ath10k_pci_wait_for_target_init(struct ath10k *ar);
+int ath10k_pci_setup_resource(struct ath10k *ar);
+void ath10k_pci_release_resource(struct ath10k *ar);
 
 /* QCA6174 is known to have Tx/Rx issues when SOC_WAKE register is poked too
  * frequently. To 

[PATCH 02/12] ath10k: make ath10k_pci_read32/write32() ops more generic

2016-01-27 Thread Raja Mani
ath10k_pci_read32/write32() does work more specific to
PCI by ensuring pci wake/sleep for every read and write.
There is a plan to use most of stuff available in pci.c
(irq stuff, copy engine, etc) for AHB case. Such kind
of pci wake/sleep for every read/write is not required
in AHB case (qca4019). All those reusable areas in pci.c
and ce.c calls ath10k_pci_read32/write32() for low level
read and write.

In fact, ath10k_pci_read32/write32() should do what it does
today for PCI case. But for AHB, it has to do differently.
To make ath10k_pci_read32/write32() more generic, new function
pointers are added in ar_pci for the function which does
operation more close to the bus. Later, corresponding bus
specific read and write function will be mapped to that.

ath10k_pci_read32/write32() are changed to call directly
those function pointers without worrying which bus underlying
to it. Also, the function to get number of bank is changed
in the same way.

Signed-off-by: Raja Mani 
---
 drivers/net/wireless/ath/ath10k/pci.c | 34 +++---
 drivers/net/wireless/ath/ath10k/pci.h |  8 
 2 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 956e548..c5f6604 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -619,7 +619,7 @@ static void ath10k_pci_sleep_sync(struct ath10k *ar)
spin_unlock_irqrestore(&ar_pci->ps_lock, flags);
 }
 
-void ath10k_pci_write32(struct ath10k *ar, u32 offset, u32 value)
+static void ath10k_bus_pci_write32(struct ath10k *ar, u32 offset, u32 value)
 {
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
int ret;
@@ -641,7 +641,7 @@ void ath10k_pci_write32(struct ath10k *ar, u32 offset, u32 
value)
ath10k_pci_sleep(ar);
 }
 
-u32 ath10k_pci_read32(struct ath10k *ar, u32 offset)
+static u32 ath10k_bus_pci_read32(struct ath10k *ar, u32 offset)
 {
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
u32 val;
@@ -666,6 +666,20 @@ u32 ath10k_pci_read32(struct ath10k *ar, u32 offset)
return val;
 }
 
+inline void ath10k_pci_write32(struct ath10k *ar, u32 offset, u32 value)
+{
+   struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+
+   ar_pci->bus_ops->write32(ar, offset, value);
+}
+
+inline u32 ath10k_pci_read32(struct ath10k *ar, u32 offset)
+{
+   struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+
+   return ar_pci->bus_ops->read32(ar, offset);
+}
+
 u32 ath10k_pci_soc_read32(struct ath10k *ar, u32 addr)
 {
return ath10k_pci_read32(ar, RTC_SOC_BASE_ADDRESS + addr);
@@ -1906,6 +1920,13 @@ static int ath10k_pci_get_num_banks(struct ath10k *ar)
return 1;
 }
 
+static int ath10k_bus_get_num_banks(struct ath10k *ar)
+{
+   struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+
+   return ar_pci->bus_ops->get_num_banks(ar);
+}
+
 int ath10k_pci_init_config(struct ath10k *ar)
 {
u32 interconnect_targ_addr;
@@ -2017,7 +2038,7 @@ int ath10k_pci_init_config(struct ath10k *ar)
/* first bank is switched to IRAM */
ealloc_value |= ((HI_EARLY_ALLOC_MAGIC << HI_EARLY_ALLOC_MAGIC_SHIFT) &
 HI_EARLY_ALLOC_MAGIC_MASK);
-   ealloc_value |= ((ath10k_pci_get_num_banks(ar) <<
+   ealloc_value |= ((ath10k_bus_get_num_banks(ar) <<
  HI_EARLY_ALLOC_IRAM_BANKS_SHIFT) &
 HI_EARLY_ALLOC_IRAM_BANKS_MASK);
 
@@ -2988,6 +3009,12 @@ static bool ath10k_pci_chip_is_supported(u32 dev_id, u32 
chip_id)
return false;
 }
 
+static const struct ath10k_bus_ops ath10k_pci_bus_ops = {
+   .read32 = ath10k_bus_pci_read32,
+   .write32= ath10k_bus_pci_write32,
+   .get_num_banks  = ath10k_pci_get_num_banks,
+};
+
 static int ath10k_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *pci_dev)
 {
@@ -3038,6 +3065,7 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
ar_pci->ar = ar;
ar->dev_id = pci_dev->device;
ar_pci->pci_ps = pci_ps;
+   ar_pci->bus_ops = &ath10k_pci_bus_ops;
 
ar->id.vendor = pdev->vendor;
ar->id.device = pdev->device;
diff --git a/drivers/net/wireless/ath/ath10k/pci.h 
b/drivers/net/wireless/ath/ath10k/pci.h
index ae76131..41f3fac 100644
--- a/drivers/net/wireless/ath/ath10k/pci.h
+++ b/drivers/net/wireless/ath/ath10k/pci.h
@@ -157,6 +157,12 @@ struct ath10k_pci_supp_chip {
u32 rev_id;
 };
 
+struct ath10k_bus_ops {
+   u32 (*read32)(struct ath10k *ar, u32 offset);
+   void (*write32)(struct ath10k *ar, u32 offset, u32 value);
+   int (*get_num_banks)(struct ath10k *ar);
+};
+
 struct ath10k_pci {
struct pci_dev *pdev;
struct device *dev;
@@ -225,6 +231,8 @@ struct ath10k_pci {
 * on MMIO read/write.
 */
bool pci_ps;
+
+   const struct ath10k_bus_ops *bus_ops;
 };
 
 static inline struct ath10k

[PATCH v2] wireless-regdb: add 2.4GHz regulatory rules for Cuba (CU)

2016-01-27 Thread Xose Vazquez Perez
Resolución 127, 2011 - Reglamento Banda 2,4 GHz.:
http://www.mincom.gob.cu/sites/default/files/marcoregulatorio/R%20127-11%20Reglamento%20banda%202,4%20GHz.pdf

Cc: Seth Forshee 
Cc: linux-wireless@vger.kernel.org
Cc: wireless-re...@lists.infradead.org
Signed-off-by: Xose Vazquez Perez 
---
 db.txt | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/db.txt b/db.txt
index 13cc7ad..e9ba21a 100644
--- a/db.txt
+++ b/db.txt
@@ -275,6 +275,12 @@ country CR: DFS-FCC
(5490 - 5730 @ 20), (24), DFS
(5735 - 5835 @ 20), (30)
 
+# http://www.mincom.gob.cu/?q=marcoregulatorio
+# - Redes Informáticas
+# Resolución 127, 2011 - Reglamento Banda 2,4 GHz.
+country CU: DFS-FCC
+   (2400 - 2483.5 @ 40), (200 mW)
+
 country CX: DFS-FCC
(2402 - 2482 @ 40), (20)
(5170 - 5250 @ 80), (24), AUTO-BW
-- 
2.5.0

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


[PATCH 04/12] ath10k: add basic skeleton to support ahb

2016-01-27 Thread Raja Mani
qca4019 uses ahb instead of pci where it slightly differs in device
enumeration, clock control, reset control, etc. Good thing is that
ahb also uses copy engine for the data transaction. So, the most of
the stuff implemented in pci.c/ce.c are reusable in ahb case too.

Device enumeration in ahb case comes through platform driver/device
model. All resource details like irq, memory map, clocks, etc for
qca4019 can be fetched from of_node of platform device.

Simply flow would look like,

 device tree => platform device (kernel) => platform driver (ath10k)

Device tree entry will have all qca4019 resource details and the same
info will be passed to kernel. Kernel will prepare new platform device
for that entry and expose DT info to of_node in platform device.
Later, ath10k would register platform driver with unique compatible name
and then kernels binds to corresponding compatible entry & calls ath10k
ahb probe functions. From there onwards, ath10k will take control of it
and move forward.

New bool flag CONFIG_ATH10K_AHB is added in Kconfig to conditionally
enable ahb support in ath10k. On enabling this flag, ath10k_pci.ko
will have ahb support. This patch adds only basic skeleton and few
macros to support ahb in the context of qca4019.

Signed-off-by: Raja Mani 
---
 drivers/net/wireless/ath/ath10k/Kconfig  |  6 +++
 drivers/net/wireless/ath/ath10k/Makefile |  2 +
 drivers/net/wireless/ath/ath10k/ahb.c| 67 
 drivers/net/wireless/ath/ath10k/ahb.h| 41 +++
 drivers/net/wireless/ath/ath10k/core.h   |  3 ++
 drivers/net/wireless/ath/ath10k/debug.h  |  1 +
 drivers/net/wireless/ath/ath10k/hw.h |  2 +
 drivers/net/wireless/ath/ath10k/pci.c|  8 
 drivers/net/wireless/ath/ath10k/pci.h|  1 +
 9 files changed, 131 insertions(+)
 create mode 100644 drivers/net/wireless/ath/ath10k/ahb.c
 create mode 100644 drivers/net/wireless/ath/ath10k/ahb.h

diff --git a/drivers/net/wireless/ath/ath10k/Kconfig 
b/drivers/net/wireless/ath/ath10k/Kconfig
index 03aa35f..d7f207a 100644
--- a/drivers/net/wireless/ath/ath10k/Kconfig
+++ b/drivers/net/wireless/ath/ath10k/Kconfig
@@ -15,6 +15,12 @@ config ATH10K_PCI
---help---
  This module adds support for PCIE bus
 
+config ATH10K_AHB
+   bool "Atheros ath10k AHB support"
+   depends on ATH10K_PCI && OF
+   ---help---
+ This module adds support for AHB bus
+
 config ATH10K_DEBUG
bool "Atheros ath10k debugging"
depends on ATH10K
diff --git a/drivers/net/wireless/ath/ath10k/Makefile 
b/drivers/net/wireless/ath/ath10k/Makefile
index c04fb00..930fadd 100644
--- a/drivers/net/wireless/ath/ath10k/Makefile
+++ b/drivers/net/wireless/ath/ath10k/Makefile
@@ -25,5 +25,7 @@ obj-$(CONFIG_ATH10K_PCI) += ath10k_pci.o
 ath10k_pci-y += pci.o \
ce.o
 
+ath10k_pci-$(CONFIG_ATH10K_AHB) += ahb.o
+
 # for tracing framework to find trace.h
 CFLAGS_trace.o := -I$(src)
diff --git a/drivers/net/wireless/ath/ath10k/ahb.c 
b/drivers/net/wireless/ath/ath10k/ahb.c
new file mode 100644
index 000..129f4f4
--- /dev/null
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2016 Qualcomm Atheros, Inc. All rights reserved.
+ * Copyright (c) 2015 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#include 
+#include "core.h"
+#include "debug.h"
+#include "ahb.h"
+
+static const struct of_device_id ath10k_ahb_of_match[] = {
+   /* TODO: enable this entry once everything in place.
+* { .compatible = "qcom,ipq4019-wifi",
+*   .data = (void *)ATH10K_HW_QCA4019 },
+*/
+   { }
+};
+
+MODULE_DEVICE_TABLE(of, ath10k_ahb_of_match);
+
+static int ath10k_ahb_probe(struct platform_device *pdev)
+{
+   return 0;
+}
+
+static int ath10k_ahb_remove(struct platform_device *pdev)
+{
+   return 0;
+}
+
+static struct platform_driver ath10k_ahb_driver = {
+   .driver = {
+   .name   = "ath10k_ahb",
+   .of_match_table = ath10k_ahb_of_match,
+   },
+   .probe  = ath10k_ahb_probe,
+   .remove = ath10k_ahb_remove,
+};
+
+int ath10k_ahb_init(void)
+{
+   int ret;
+
+   printk(KERN_ERR "AHB support is still work in progress\n");
+
+   ret = platform_dr

[PATCH 07/12] ath10k: add clock ctrl related functions in ahb

2016-01-27 Thread Raja Mani
pre qca4019 chipsets has/uses internal clock generator for
the operation. But, qca4019 uses external clocks supplied from
outside of target (ie, outside of wifi core). Three different clocks
(cmd clock, ref clock, rtc clock) comes into picture in qca4019.
All those clocks needs to configured with help of global clock
controller (gcc) to make qca4019 functioning.

Add functions for clock init/deinit, clock enable/disable in ahb.
This is just a preparation, functions added in this patch will be
used in later patches.

Signed-off-by: Raja Mani 
---
 drivers/net/wireless/ath/ath10k/ahb.c | 123 ++
 drivers/net/wireless/ath/ath10k/ahb.h |   4 ++
 2 files changed, 127 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/ahb.c 
b/drivers/net/wireless/ath/ath10k/ahb.c
index eab4b47..11185c0 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.c
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -15,6 +15,7 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include 
+#include 
 #include "core.h"
 #include "debug.h"
 #include "pci.h"
@@ -84,6 +85,128 @@ static int ath10k_ahb_get_num_banks(struct ath10k *ar)
return 1;
 }
 
+static int ath10k_ahb_clock_init(struct ath10k *ar)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+   struct device *dev;
+   int ret;
+
+   dev = &ar_ahb->pdev->dev;
+
+   ar_ahb->cmd_clk = clk_get(dev, "wifi_wcss_cmd");
+   if (IS_ERR_OR_NULL(ar_ahb->cmd_clk)) {
+   ath10k_err(ar, "failed to get cmd clk: %ld\n",
+  PTR_ERR(ar_ahb->cmd_clk));
+   ret = ar_ahb->cmd_clk ? PTR_ERR(ar_ahb->cmd_clk) : -ENODEV;
+   goto out;
+   }
+
+   ar_ahb->ref_clk = clk_get(dev, "wifi_wcss_ref");
+   if (IS_ERR_OR_NULL(ar_ahb->ref_clk)) {
+   ath10k_err(ar, "failed to get ref clk: %ld\n",
+  PTR_ERR(ar_ahb->ref_clk));
+   ret = ar_ahb->ref_clk ? PTR_ERR(ar_ahb->ref_clk) : -ENODEV;
+   goto err_cmd_clk_put;
+   }
+
+   ar_ahb->rtc_clk = clk_get(dev, "wifi_wcss_rtc");
+   if (IS_ERR_OR_NULL(ar_ahb->rtc_clk)) {
+   ath10k_err(ar, "failed to get rtc clk: %ld\n",
+  PTR_ERR(ar_ahb->rtc_clk));
+   ret = ar_ahb->rtc_clk ? PTR_ERR(ar_ahb->rtc_clk) : -ENODEV;
+   goto err_ref_clk_put;
+   }
+
+   return 0;
+
+err_ref_clk_put:
+   clk_put(ar_ahb->ref_clk);
+
+err_cmd_clk_put:
+   clk_put(ar_ahb->cmd_clk);
+
+out:
+   return ret;
+}
+
+static void ath10k_ahb_clock_deinit(struct ath10k *ar)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+
+   if (!IS_ERR_OR_NULL(ar_ahb->cmd_clk))
+   clk_put(ar_ahb->cmd_clk);
+
+   if (!IS_ERR_OR_NULL(ar_ahb->ref_clk))
+   clk_put(ar_ahb->ref_clk);
+
+   if (!IS_ERR_OR_NULL(ar_ahb->rtc_clk))
+   clk_put(ar_ahb->rtc_clk);
+
+   ar_ahb->cmd_clk = NULL;
+   ar_ahb->ref_clk = NULL;
+   ar_ahb->rtc_clk = NULL;
+}
+
+static int ath10k_ahb_clock_enable(struct ath10k *ar)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+   struct device *dev;
+   int ret;
+
+   dev = &ar_ahb->pdev->dev;
+
+   if (IS_ERR_OR_NULL(ar_ahb->cmd_clk) ||
+   IS_ERR_OR_NULL(ar_ahb->ref_clk) ||
+   IS_ERR_OR_NULL(ar_ahb->rtc_clk)) {
+   ath10k_err(ar, "clock(s) is/are not initialized\n");
+   ret = -EIO;
+   goto out;
+   }
+
+   ret = clk_prepare_enable(ar_ahb->cmd_clk);
+   if (ret) {
+   ath10k_err(ar, "failed to enable cmd clk: %d\n", ret);
+   goto out;
+   }
+
+   ret = clk_prepare_enable(ar_ahb->ref_clk);
+   if (ret) {
+   ath10k_err(ar, "failed to enable ref clk: %d\n", ret);
+   goto err_cmd_clk_disable;
+   }
+
+   ret = clk_prepare_enable(ar_ahb->rtc_clk);
+   if (ret) {
+   ath10k_err(ar, "failed to enable rtc clk: %d\n", ret);
+   goto err_ref_clk_disable;
+   }
+
+   return 0;
+
+err_ref_clk_disable:
+   clk_disable_unprepare(ar_ahb->ref_clk);
+
+err_cmd_clk_disable:
+   clk_disable_unprepare(ar_ahb->cmd_clk);
+
+out:
+   return ret;
+}
+
+static void ath10k_ahb_clock_disable(struct ath10k *ar)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+
+   if (!IS_ERR_OR_NULL(ar_ahb->cmd_clk))
+   clk_disable_unprepare(ar_ahb->cmd_clk);
+
+   if (!IS_ERR_OR_NULL(ar_ahb->ref_clk))
+   clk_disable_unprepare(ar_ahb->ref_clk);
+
+   if (!IS_ERR_OR_NULL(ar_ahb->rtc_clk))
+   clk_disable_unprepare(ar_ahb->rtc_clk);
+}
+
 static int ath10k_ahb_probe(struct platform_device *pdev)
 {
return 0;
diff --git a/drivers/net/wireless/ath/ath10k/ahb.h 
b/drivers/net/wireless/ath/ath10k/ahb.h
index 77d15af..753b433 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.h
+++ b/drivers/

[PATCH 01/12] ath10k: make some of ath10k_pci_* func reusable

2016-01-27 Thread Raja Mani
Some of static functions present in pci.c file are reusable
in ahb (qca4019) case. Remove static word for those reusable
functions and have those function prototype declaration in
pci.h file. So that, pci.h header file can be included in
ahb module and reused. There is no functionality changes done
in this patch.

Signed-off-by: Raja Mani 
---
 drivers/net/wireless/ath/ath10k/pci.c | 63 +--
 drivers/net/wireless/ath/ath10k/pci.h | 32 ++
 2 files changed, 63 insertions(+), 32 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index ee925c6..956e548 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -94,7 +94,6 @@ static const struct ath10k_pci_supp_chip 
ath10k_pci_supp_chips[] = {
 static void ath10k_pci_buffer_cleanup(struct ath10k *ar);
 static int ath10k_pci_cold_reset(struct ath10k *ar);
 static int ath10k_pci_safe_chip_reset(struct ath10k *ar);
-static int ath10k_pci_wait_for_target_init(struct ath10k *ar);
 static int ath10k_pci_init_irq(struct ath10k *ar);
 static int ath10k_pci_deinit_irq(struct ath10k *ar);
 static int ath10k_pci_request_irq(struct ath10k *ar);
@@ -687,7 +686,7 @@ void ath10k_pci_reg_write32(struct ath10k *ar, u32 addr, 
u32 val)
ath10k_pci_write32(ar, PCIE_LOCAL_BASE_ADDRESS + addr, val);
 }
 
-static bool ath10k_pci_irq_pending(struct ath10k *ar)
+bool ath10k_pci_irq_pending(struct ath10k *ar)
 {
u32 cause;
 
@@ -700,7 +699,7 @@ static bool ath10k_pci_irq_pending(struct ath10k *ar)
return false;
 }
 
-static void ath10k_pci_disable_and_clear_legacy_irq(struct ath10k *ar)
+void ath10k_pci_disable_and_clear_legacy_irq(struct ath10k *ar)
 {
/* IMPORTANT: INTR_CLR register has to be set after
 * INTR_ENABLE is set to 0, otherwise interrupt can not be
@@ -716,7 +715,7 @@ static void ath10k_pci_disable_and_clear_legacy_irq(struct 
ath10k *ar)
PCIE_INTR_ENABLE_ADDRESS);
 }
 
-static void ath10k_pci_enable_legacy_irq(struct ath10k *ar)
+void ath10k_pci_enable_legacy_irq(struct ath10k *ar)
 {
ath10k_pci_write32(ar, SOC_CORE_BASE_ADDRESS +
   PCIE_INTR_ENABLE_ADDRESS,
@@ -809,7 +808,7 @@ static void ath10k_pci_rx_post_pipe(struct ath10k_pci_pipe 
*pipe)
}
 }
 
-static void ath10k_pci_rx_post(struct ath10k *ar)
+void ath10k_pci_rx_post(struct ath10k *ar)
 {
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
int i;
@@ -818,7 +817,7 @@ static void ath10k_pci_rx_post(struct ath10k *ar)
ath10k_pci_rx_post_pipe(&ar_pci->pipe_info[i]);
 }
 
-static void ath10k_pci_rx_replenish_retry(unsigned long ptr)
+void ath10k_pci_rx_replenish_retry(unsigned long ptr)
 {
struct ath10k *ar = (void *)ptr;
 
@@ -1007,8 +1006,8 @@ static int __ath10k_pci_diag_read_hi(struct ath10k *ar, 
void *dest,
 #define ath10k_pci_diag_read_hi(ar, dest, src, len)\
__ath10k_pci_diag_read_hi(ar, dest, HI_ITEM(src), len)
 
-static int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,
-const void *data, int nbytes)
+int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,
+ const void *data, int nbytes)
 {
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
int ret = 0;
@@ -1263,8 +1262,8 @@ static void ath10k_pci_htt_rx_cb(struct ath10k_ce_pipe 
*ce_state)
ath10k_pci_process_rx_cb(ce_state, ath10k_pci_htt_rx_deliver);
 }
 
-static int ath10k_pci_hif_tx_sg(struct ath10k *ar, u8 pipe_id,
-   struct ath10k_hif_sg_item *items, int n_items)
+int ath10k_pci_hif_tx_sg(struct ath10k *ar, u8 pipe_id,
+struct ath10k_hif_sg_item *items, int n_items)
 {
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
struct ath10k_pci_pipe *pci_pipe = &ar_pci->pipe_info[pipe_id];
@@ -1332,13 +1331,13 @@ err:
return err;
 }
 
-static int ath10k_pci_hif_diag_read(struct ath10k *ar, u32 address, void *buf,
-   size_t buf_len)
+int ath10k_pci_hif_diag_read(struct ath10k *ar, u32 address, void *buf,
+size_t buf_len)
 {
return ath10k_pci_diag_read_mem(ar, address, buf, buf_len);
 }
 
-static u16 ath10k_pci_hif_get_free_queue_number(struct ath10k *ar, u8 pipe)
+u16 ath10k_pci_hif_get_free_queue_number(struct ath10k *ar, u8 pipe)
 {
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
 
@@ -1406,8 +1405,8 @@ static void ath10k_pci_fw_crashed_dump(struct ath10k *ar)
queue_work(ar->workqueue, &ar->restart_work);
 }
 
-static void ath10k_pci_hif_send_complete_check(struct ath10k *ar, u8 pipe,
-  int force)
+void ath10k_pci_hif_send_complete_check(struct ath10k *ar, u8 pipe,
+   int force)
 {
ath10k_dbg(ar, ATH10K_DBG

[PATCH 05/12] ath10k: include qca4019 register map table

2016-01-27 Thread Raja Mani
New register table is added for qca4019 to tell about it's
register mapping details.

Nothing much other than this.

Signed-off-by: Raja Mani 
---
 drivers/net/wireless/ath/ath10k/core.c |  4 
 drivers/net/wireless/ath/ath10k/hw.c   | 39 ++
 drivers/net/wireless/ath/ath10k/hw.h   |  2 ++
 3 files changed, 45 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index b41eb3f..5c684e0 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1979,6 +1979,10 @@ struct ath10k *ath10k_core_create(size_t priv_size, 
struct device *dev,
ar->regs = &qca99x0_regs;
ar->hw_values = &qca99x0_values;
break;
+   case ATH10K_HW_QCA4019:
+   ar->regs = &qca4019_regs;
+   ar->hw_values = &qca4019_values;
+   break;
default:
ath10k_err(ar, "unsupported core hardware revision %d\n",
   hw_rev);
diff --git a/drivers/net/wireless/ath/ath10k/hw.c 
b/drivers/net/wireless/ath/ath10k/hw.c
index 7b84d08..f544d48 100644
--- a/drivers/net/wireless/ath/ath10k/hw.c
+++ b/drivers/net/wireless/ath/ath10k/hw.c
@@ -109,6 +109,38 @@ const struct ath10k_hw_regs qca99x0_regs = {
.pcie_intr_clr_address  = 0x0010,
 };
 
+const struct ath10k_hw_regs qca4019_regs = {
+   .rtc_soc_base_address   = 0x0008,
+   .soc_core_base_address  = 0x00082000,
+   .ce_wrapper_base_address= 0x0004d000,
+   .ce0_base_address   = 0x0004a000,
+   .ce1_base_address   = 0x0004a400,
+   .ce2_base_address   = 0x0004a800,
+   .ce3_base_address   = 0x0004ac00,
+   .ce4_base_address   = 0x0004b000,
+   .ce5_base_address   = 0x0004b400,
+   .ce6_base_address   = 0x0004b800,
+   .ce7_base_address   = 0x0004bc00,
+   /* qca4019 supports upto 12 copy engines. Since base address
+* of ce8 to ce11 are not directly referred in the code,
+* no need have them in separate members in this table.
+*  Copy Engine Address
+*  CE8 0x0004c000
+*  CE9 0x0004c400
+*  CE100x0004c800
+*  CE110x0004cc00
+*/
+   .soc_reset_control_si0_rst_mask = 0x0001,
+   .soc_reset_control_ce_rst_mask  = 0x0100,
+   .soc_chip_id_address= 0x00ec,
+   .fw_indicator_address   = 0x0004f00c,
+   .ce_wrap_intr_sum_host_msi_lsb  = 0x000c,
+   .ce_wrap_intr_sum_host_msi_mask = 0x00fff000,
+   .pcie_intr_fw_mask  = 0x0010,
+   .pcie_intr_ce_mask_all  = 0x000fff00,
+   .pcie_intr_clr_address  = 0x0010,
+};
+
 const struct ath10k_hw_values qca988x_values = {
.rtc_state_val_on   = 3,
.ce_count   = 8,
@@ -136,6 +168,13 @@ const struct ath10k_hw_values qca99x0_values = {
.ce_desc_meta_data_lsb  = 4,
 };
 
+const struct ath10k_hw_values qca4019_values = {
+   .ce_count   = 12,
+   .num_target_ce_config_wlan  = 10,
+   .ce_desc_meta_data_mask = 0xFFF0,
+   .ce_desc_meta_data_lsb  = 4,
+};
+
 void ath10k_hw_fill_survey_time(struct ath10k *ar, struct survey_info *survey,
u32 cc, u32 rcc, u32 cc_prev, u32 rcc_prev)
 {
diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
b/drivers/net/wireless/ath/ath10k/hw.h
index f885015..f57a37b 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -233,6 +233,7 @@ struct ath10k_hw_regs {
 extern const struct ath10k_hw_regs qca988x_regs;
 extern const struct ath10k_hw_regs qca6174_regs;
 extern const struct ath10k_hw_regs qca99x0_regs;
+extern const struct ath10k_hw_regs qca4019_regs;
 
 struct ath10k_hw_values {
u32 rtc_state_val_on;
@@ -246,6 +247,7 @@ struct ath10k_hw_values {
 extern const struct ath10k_hw_values qca988x_values;
 extern const struct ath10k_hw_values qca6174_values;
 extern const struct ath10k_hw_values qca99x0_values;
+extern const struct ath10k_hw_values qca4019_values;
 
 void ath10k_hw_fill_survey_time(struct ath10k *ar, struct survey_info *survey,
u32 cc, u32 rcc, u32 cc_prev, u32 rcc_prev);
-- 
1.8.1.2

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


[PATCH 06/12] ath10k: add helper functions in ahb.c for reg rd/wr

2016-01-27 Thread Raja Mani
qca4019 deals with below register memory region to control the clock,
reset, etc.

- Memory to control wifi core
- gcc (outside of wifi)
- tcsr (outside of wifi)

Add new helper functions to perform read/write in above registers
spaces. Actual ioremap for above registers are done in later patch.
Struct ath10k_ahb is introduced to maintain ahb specific info and
memory this struct will be allocated in the continuation of struct
ath10k_pci (again, memory ath10k_ahb is allocated in the later patch).

Signed-off-by: Raja Mani 
---
 drivers/net/wireless/ath/ath10k/ahb.c | 55 +++
 drivers/net/wireless/ath/ath10k/ahb.h |  7 +
 drivers/net/wireless/ath/ath10k/pci.h |  6 
 3 files changed, 68 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/ahb.c 
b/drivers/net/wireless/ath/ath10k/ahb.c
index 129f4f4..eab4b47 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.c
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -17,6 +17,7 @@
 #include 
 #include "core.h"
 #include "debug.h"
+#include "pci.h"
 #include "ahb.h"
 
 static const struct of_device_id ath10k_ahb_of_match[] = {
@@ -29,6 +30,60 @@ static const struct of_device_id ath10k_ahb_of_match[] = {
 
 MODULE_DEVICE_TABLE(of, ath10k_ahb_of_match);
 
+static inline struct ath10k_ahb *ath10k_ahb_priv(struct ath10k *ar)
+{
+   return &((struct ath10k_pci *)ar->drv_priv)->ahb[0];
+}
+
+static void ath10k_ahb_write32(struct ath10k *ar, u32 offset, u32 value)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+
+   iowrite32(value, ar_ahb->mem + offset);
+}
+
+static u32 ath10k_ahb_read32(struct ath10k *ar, u32 offset)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+
+   return ioread32(ar_ahb->mem + offset);
+}
+
+static u32 ath10k_ahb_gcc_read32(struct ath10k *ar, u32 offset)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+
+   return ioread32(ar_ahb->gcc_mem + offset);
+}
+
+static void ath10k_ahb_tcsr_write32(struct ath10k *ar, u32 offset, u32 value)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+
+   iowrite32(value, ar_ahb->tcsr_mem + offset);
+}
+
+static u32 ath10k_ahb_tcsr_read32(struct ath10k *ar, u32 offset)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+
+   return ioread32(ar_ahb->tcsr_mem + offset);
+}
+
+static u32 ath10k_ahb_soc_read32(struct ath10k *ar, u32 addr)
+{
+   return ath10k_ahb_read32(ar, RTC_SOC_BASE_ADDRESS + addr);
+}
+
+static int ath10k_ahb_get_num_banks(struct ath10k *ar)
+{
+   if (ar->hw_rev == ATH10K_HW_QCA4019)
+   return 1;
+
+   ath10k_warn(ar, "unknown number of banks, assuming 1\n");
+   return 1;
+}
+
 static int ath10k_ahb_probe(struct platform_device *pdev)
 {
return 0;
diff --git a/drivers/net/wireless/ath/ath10k/ahb.h 
b/drivers/net/wireless/ath/ath10k/ahb.h
index d1afe93..77d15af 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.h
+++ b/drivers/net/wireless/ath/ath10k/ahb.h
@@ -20,6 +20,13 @@
 
 #include 
 
+struct ath10k_ahb {
+   struct platform_device *pdev;
+   void __iomem *mem;
+   void __iomem *gcc_mem;
+   void __iomem *tcsr_mem;
+};
+
 #ifdef CONFIG_ATH10K_AHB
 
 int ath10k_ahb_init(void);
diff --git a/drivers/net/wireless/ath/ath10k/pci.h 
b/drivers/net/wireless/ath/ath10k/pci.h
index c2d4a79..249c73a 100644
--- a/drivers/net/wireless/ath/ath10k/pci.h
+++ b/drivers/net/wireless/ath/ath10k/pci.h
@@ -234,6 +234,12 @@ struct ath10k_pci {
bool pci_ps;
 
const struct ath10k_bus_ops *bus_ops;
+
+   /* Keep this entry in the last, memory for struct ath10k_ahb is
+* allocated (ahb support enabled case) in the continuation of
+* this struct.
+*/
+   struct ath10k_ahb ahb[0];
 };
 
 static inline struct ath10k_pci *ath10k_pci_priv(struct ath10k *ar)
-- 
1.8.1.2

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


Re: [PATCH] wireless-regdb: add 2.4GHz regulatory rules for Cuba (CU)

2016-01-27 Thread Xose Vazquez Perez
On 09/08/2015 04:22 PM, Seth Forshee wrote:
> On Tue, Sep 08, 2015 at 03:59:38PM +0200, Xose Vazquez Perez wrote:
>> On 08/13/2015 04:31 PM, Seth Forshee wrote:
>>
>>> On Tue, Aug 11, 2015 at 03:29:55PM +0200, Xose Vazquez Perez wrote:
 Resolución 127, 2011 - Reglamento Banda 2,4 GHz.:
 http://www.mincom.gob.cu/sites/default/files/marcoregulatorio/R%20127-11%20Reglamento%20banda%202,4%20GHz.pdf

 Cc: Seth Forshee 
 Cc: linux-wireless@vger.kernel.org
 Cc: wireless-re...@lists.infradead.org
 Signed-off-by: Xose Vazquez Perez 
 ---
  db.txt | 7 +++
  1 file changed, 7 insertions(+)

 diff --git a/db.txt b/db.txt
 index 982db34..2edbf90 100644
 --- a/db.txt
 +++ b/db.txt
 @@ -275,6 +275,13 @@ country CR: DFS-FCC
(5490 - 5730 @ 20), (24), DFS
(5735 - 5835 @ 20), (30)
  
 +# http://www.mincom.gob.cu/?q=marcoregulatorio
 +# - Redes Informáticas
 +# Resolución 127, 2011 - Reglamento Banda 2,4 GHz.
 +country CU: DFS-FCC
 +  (2400 - 2456 @ 40), (200 mW)
 +  (2456 - 2483.5 @ 40), (200 mW)
 +
>>>
>>> Based on the Google translation of the document you linked to, I don't
>>> see anything which would prevent merging these rules into one rule. Am I
>>> missing something?
>>
>> from 
>> http://www.mincom.gob.cu/sites/default/files/marcoregulatorio/R%20127-11%20Reglamento%20banda%202,4%20GHz.pdf
>> page 7:
>>
>> Artículo 4: Disposiciones de carácter técnico
>> [..]
>> 4.3.- No obstante lo anterior, los equipos que operen en las frecuencias 
>> entre 2456 y
>> 2483,5 MHz pueden emplear valores de p.i.r.e superiores, cuando ello se 
>> justifique en
>> beneficio de objetivos de interés nacional [...]
>> 4.4.- Para estos casos es necesario obtener una autorización expresa de la 
>> Agencia
>> [...]
>>
>> If you grant an authorization, for 2456-2483.5 pire can be increased.
> 
> Okay, but for the purposes of this database that provision isn't going
> to apply, and it seems you agree since you've listed both as having the
> exact same power limit. So I'd still prefer that we make it a single
> rule.

OK. Done in v2.

-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


[PATCH 00/12] add ahb (qca4019) support

2016-01-27 Thread Raja Mani
This patch series attempts to add ahb support (qca4019) in ath10k.
All ahb related ops are grouped and kept in new file called ahb.c/ahb.h 
and will get compiled/linked to ath10k_pci.ko based on kernel config flag
CONFIG_ATH10K_AHB flag. Most of function in pci.c file are reusable and
called as it's without changing function name (ath10k_pci_*) in ahb.c.

Still, some more work needs to be done in ath10k driver to make ahb
functional (qca4019). Hence, i disabled device probing in ahb module
for the time being. I'll post follow patch soon to enable it along
with missing patches.

The patch to update device tree bindings document with list of DT node
attributes referred in this patch series is already committed in ath.git,

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

Raja Mani (12):
  ath10k: make some of ath10k_pci_* func reusable
  ath10k: make ath10k_pci_read32/write32() ops more generic
  ath10k: pull reusable code from pci probe and remove for ahb
  ath10k: add basic skeleton to support ahb
  ath10k: include qca4019 register map table
  ath10k: add helper functions in ahb.c for reg rd/wr
  ath10k: add clock ctrl related functions in ahb
  ath10k: add reset ctrl related functions in ahb
  ath10k: add chip and bus halt logic in ahb
  ath10k: include irq related functions in ahb
  ath10k: add resource init and deinit in ahb
  ath10k: expose hif ops for ahb

 drivers/net/wireless/ath/ath10k/Kconfig  |   6 +
 drivers/net/wireless/ath/ath10k/Makefile |   2 +
 drivers/net/wireless/ath/ath10k/ahb.c| 933 +++
 drivers/net/wireless/ath/ath10k/ahb.h|  87 +++
 drivers/net/wireless/ath/ath10k/core.c   |   4 +
 drivers/net/wireless/ath/ath10k/core.h   |   3 +
 drivers/net/wireless/ath/ath10k/debug.h  |   1 +
 drivers/net/wireless/ath/ath10k/hw.c |  39 ++
 drivers/net/wireless/ath/ath10k/hw.h |   5 +
 drivers/net/wireless/ath/ath10k/pci.c| 169 --
 drivers/net/wireless/ath/ath10k/pci.h|  49 ++
 11 files changed, 1241 insertions(+), 57 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath10k/ahb.c
 create mode 100644 drivers/net/wireless/ath/ath10k/ahb.h

-- 
1.8.1.2

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


[PATCH 08/12] ath10k: add reset ctrl related functions in ahb

2016-01-27 Thread Raja Mani
To perform reset on qca4019 wifi, multiple reset lines needs
to be toggled in a sequence with help of reset controller support
in the kernel. This patch adds functions to reset control init/deinit
and release reset.

Signed-off-by: Raja Mani 
---
 drivers/net/wireless/ath/ath10k/Kconfig |   2 +-
 drivers/net/wireless/ath/ath10k/ahb.c   | 138 
 drivers/net/wireless/ath/ath10k/ahb.h   |   6 ++
 3 files changed, 145 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/Kconfig 
b/drivers/net/wireless/ath/ath10k/Kconfig
index d7f207a..db1ca62 100644
--- a/drivers/net/wireless/ath/ath10k/Kconfig
+++ b/drivers/net/wireless/ath/ath10k/Kconfig
@@ -17,7 +17,7 @@ config ATH10K_PCI
 
 config ATH10K_AHB
bool "Atheros ath10k AHB support"
-   depends on ATH10K_PCI && OF
+   depends on ATH10K_PCI && OF && RESET_CONTROLLER
---help---
  This module adds support for AHB bus
 
diff --git a/drivers/net/wireless/ath/ath10k/ahb.c 
b/drivers/net/wireless/ath/ath10k/ahb.c
index 11185c0..d1f1972 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.c
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -16,6 +16,7 @@
  */
 #include 
 #include 
+#include 
 #include "core.h"
 #include "debug.h"
 #include "pci.h"
@@ -207,6 +208,143 @@ static void ath10k_ahb_clock_disable(struct ath10k *ar)
clk_disable_unprepare(ar_ahb->rtc_clk);
 }
 
+static int ath10k_ahb_rst_ctrl_init(struct ath10k *ar)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+   struct device *dev;
+   int ret;
+
+   dev = &ar_ahb->pdev->dev;
+
+   ar_ahb->core_cold_rst = reset_control_get(dev, "wifi_core_cold");
+   if (IS_ERR_OR_NULL(ar_ahb->core_cold_rst)) {
+   ath10k_err(ar, "failed to get core cold rst ctrl: %ld\n",
+  PTR_ERR(ar_ahb->core_cold_rst));
+   ret = ar_ahb->core_cold_rst ?
+   PTR_ERR(ar_ahb->core_cold_rst) : -ENODEV;
+   goto out;
+   }
+
+   ar_ahb->radio_cold_rst = reset_control_get(dev, "wifi_radio_cold");
+   if (IS_ERR_OR_NULL(ar_ahb->radio_cold_rst)) {
+   ath10k_err(ar, "failed to get radio cold rst ctrl: %ld\n",
+  PTR_ERR(ar_ahb->radio_cold_rst));
+   ret = ar_ahb->radio_cold_rst ?
+   PTR_ERR(ar_ahb->radio_cold_rst) : -ENODEV;
+   goto err_core_cold_rst_put;
+   }
+
+   ar_ahb->radio_warm_rst = reset_control_get(dev, "wifi_radio_warm");
+   if (IS_ERR_OR_NULL(ar_ahb->radio_warm_rst)) {
+   ath10k_err(ar, "failed to get radio warm rst ctrl: %ld\n",
+  PTR_ERR(ar_ahb->radio_warm_rst));
+   ret = ar_ahb->radio_warm_rst ?
+   PTR_ERR(ar_ahb->radio_warm_rst) : -ENODEV;
+   goto err_radio_cold_rst_put;
+   }
+
+   ar_ahb->radio_srif_rst = reset_control_get(dev, "wifi_radio_srif");
+   if (IS_ERR_OR_NULL(ar_ahb->radio_srif_rst)) {
+   ath10k_err(ar, "failed to get radio srif rst ctrl: %ld\n",
+  PTR_ERR(ar_ahb->radio_srif_rst));
+   ret = ar_ahb->radio_srif_rst ?
+   PTR_ERR(ar_ahb->radio_srif_rst) : -ENODEV;
+   goto err_radio_warm_rst_put;
+   }
+
+   ar_ahb->cpu_init_rst = reset_control_get(dev, "wifi_cpu_init");
+   if (IS_ERR_OR_NULL(ar_ahb->cpu_init_rst)) {
+   ath10k_err(ar, "failed to get cpu init rst ctrl: %ld\n",
+  PTR_ERR(ar_ahb->cpu_init_rst));
+   ret = ar_ahb->cpu_init_rst ?
+   PTR_ERR(ar_ahb->cpu_init_rst) : -ENODEV;
+   goto err_radio_srif_rst_put;
+   }
+
+   return 0;
+
+err_radio_srif_rst_put:
+   reset_control_put(ar_ahb->radio_srif_rst);
+
+err_radio_warm_rst_put:
+   reset_control_put(ar_ahb->radio_warm_rst);
+
+err_radio_cold_rst_put:
+   reset_control_put(ar_ahb->radio_cold_rst);
+
+err_core_cold_rst_put:
+   reset_control_put(ar_ahb->core_cold_rst);
+
+out:
+   return ret;
+}
+
+static void ath10k_ahb_rst_ctrl_deinit(struct ath10k *ar)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+
+   if (!IS_ERR_OR_NULL(ar_ahb->core_cold_rst))
+   reset_control_put(ar_ahb->core_cold_rst);
+
+   if (!IS_ERR_OR_NULL(ar_ahb->radio_cold_rst))
+   reset_control_put(ar_ahb->radio_cold_rst);
+
+   if (!IS_ERR_OR_NULL(ar_ahb->radio_warm_rst))
+   reset_control_put(ar_ahb->radio_warm_rst);
+
+   if (!IS_ERR_OR_NULL(ar_ahb->radio_srif_rst))
+   reset_control_put(ar_ahb->radio_srif_rst);
+
+   if (!IS_ERR_OR_NULL(ar_ahb->cpu_init_rst))
+   reset_control_put(ar_ahb->cpu_init_rst);
+
+   ar_ahb->core_cold_rst = NULL;
+   ar_ahb->radio_cold_rst = NULL;
+   ar_ahb->radio_warm_rst = NULL;
+   ar_ahb->radio_srif_rst = NULL;
+   ar_ahb->cpu_init_rst = NULL;

[PATCH 10/12] ath10k: include irq related functions in ahb

2016-01-27 Thread Raja Mani
Add irq related functions to register,handle,release,disable interrupt.

qca4019 supports msi interrupt, but it has the problem. Until the issue
gets sorted out, only legacy interrupt model is enabled and used.

Signed-off-by: Raja Mani 
---
 drivers/net/wireless/ath/ath10k/ahb.c | 44 +++
 drivers/net/wireless/ath/ath10k/ahb.h |  2 ++
 2 files changed, 46 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/ahb.c 
b/drivers/net/wireless/ath/ath10k/ahb.c
index 2305078..29d0b6c 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.c
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -458,6 +458,50 @@ static void ath10k_ahb_halt_chip(struct ath10k *ar)
ath10k_dbg(ar, ATH10K_DBG_AHB, "core %d reset done\n", core_id);
 }
 
+static irqreturn_t ath10k_ahb_interrupt_handler(int irq, void *arg)
+{
+   struct ath10k *ar = arg;
+   struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+
+   if (!ath10k_pci_irq_pending(ar))
+   return IRQ_NONE;
+
+   ath10k_pci_disable_and_clear_legacy_irq(ar);
+   tasklet_schedule(&ar_pci->intr_tq);
+
+   return IRQ_HANDLED;
+}
+
+static int ath10k_ahb_request_irq_legacy(struct ath10k *ar)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+   int ret;
+
+   ret = request_irq(ar_ahb->irq,
+ ath10k_ahb_interrupt_handler,
+ IRQF_SHARED, "ath10k_ahb", ar);
+   if (ret) {
+   ath10k_warn(ar, "failed to request legacy irq %d: %d\n",
+   ar_ahb->irq, ret);
+   return ret;
+   }
+
+   return 0;
+}
+
+static void ath10k_ahb_release_irq_legacy(struct ath10k *ar)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+
+   free_irq(ar_ahb->irq, ar);
+}
+
+static void ath10k_ahb_irq_disable(struct ath10k *ar)
+{
+   ath10k_ce_disable_interrupts(ar);
+   ath10k_pci_disable_and_clear_legacy_irq(ar);
+}
+
 static int ath10k_ahb_probe(struct platform_device *pdev)
 {
return 0;
diff --git a/drivers/net/wireless/ath/ath10k/ahb.h 
b/drivers/net/wireless/ath/ath10k/ahb.h
index 4761eeb..97c40e4 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.h
+++ b/drivers/net/wireless/ath/ath10k/ahb.h
@@ -26,6 +26,8 @@ struct ath10k_ahb {
void __iomem *gcc_mem;
void __iomem *tcsr_mem;
 
+   int irq;
+
struct clk *cmd_clk;
struct clk *ref_clk;
struct clk *rtc_clk;
-- 
1.8.1.2

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


[PATCH 09/12] ath10k: add chip and bus halt logic in ahb

2016-01-27 Thread Raja Mani
Add function to perform chip halt sequence and function to halt axi
bus in ahb module. Mainly used in the scenario like driver unload.

Signed-off-by: Raja Mani 
---
 drivers/net/wireless/ath/ath10k/ahb.c | 113 ++
 drivers/net/wireless/ath/ath10k/ahb.h |  15 +
 2 files changed, 128 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/ahb.c 
b/drivers/net/wireless/ath/ath10k/ahb.c
index d1f1972..2305078 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.c
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -345,6 +345,119 @@ static int ath10k_ahb_release_reset(struct ath10k *ar)
return 0;
 }
 
+static void ath10k_ahb_halt_axi_bus(struct ath10k *ar, u32 haltreq_reg,
+   u32 haltack_reg)
+{
+   unsigned long timeout;
+   u32 val;
+
+   /* Issue halt axi bus request */
+   val = ath10k_ahb_tcsr_read32(ar, haltreq_reg);
+   val |= AHB_AXI_BUS_HALT_REQ;
+   ath10k_ahb_tcsr_write32(ar, haltreq_reg, val);
+
+   /* Wait for axi bus halted ack */
+   timeout = jiffies + msecs_to_jiffies(ATH10K_AHB_AXI_BUS_HALT_TIMEOUT);
+   do {
+   val = ath10k_ahb_tcsr_read32(ar, haltack_reg);
+   if (val & AHB_AXI_BUS_HALT_ACK)
+   break;
+
+   mdelay(1);
+   } while (time_before(jiffies, timeout));
+
+   if (!(val & AHB_AXI_BUS_HALT_ACK)) {
+   ath10k_err(ar, "failed to halt axi bus: %d\n", val);
+   return;
+   }
+
+   ath10k_dbg(ar, ATH10K_DBG_AHB, "axi bus halted\n");
+}
+
+static void ath10k_ahb_halt_chip(struct ath10k *ar)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+   u32 core_id, glb_cfg_reg, haltreq_reg, haltack_reg;
+   u32 val;
+   int ret;
+
+   if (IS_ERR_OR_NULL(ar_ahb->core_cold_rst) ||
+   IS_ERR_OR_NULL(ar_ahb->radio_cold_rst) ||
+   IS_ERR_OR_NULL(ar_ahb->radio_warm_rst) ||
+   IS_ERR_OR_NULL(ar_ahb->radio_srif_rst) ||
+   IS_ERR_OR_NULL(ar_ahb->cpu_init_rst)) {
+   ath10k_err(ar, "rst ctrl(s) is/are not initialized\n");
+   return;
+   }
+
+   core_id = ath10k_ahb_read32(ar, ATH10K_AHB_WLAN_CORE_ID_REG);
+
+   switch (core_id) {
+   case 0:
+   glb_cfg_reg = ATH10K_AHB_TCSR_WIFI0_GLB_CFG;
+   haltreq_reg = ATH10K_AHB_TCSR_WCSS0_HALTREQ;
+   haltack_reg = ATH10K_AHB_TCSR_WCSS0_HALTACK;
+   break;
+   case 1:
+   glb_cfg_reg = ATH10K_AHB_TCSR_WIFI1_GLB_CFG;
+   haltreq_reg = ATH10K_AHB_TCSR_WCSS1_HALTREQ;
+   haltack_reg = ATH10K_AHB_TCSR_WCSS1_HALTACK;
+   break;
+   default:
+   ath10k_err(ar, "invalid core id %d found, skipping reset 
sequence\n",
+  core_id);
+   return;
+   }
+
+   ath10k_ahb_halt_axi_bus(ar, haltreq_reg, haltack_reg);
+
+   val = ath10k_ahb_tcsr_read32(ar, glb_cfg_reg);
+   val |= TCSR_WIFIX_GLB_CFG_DISABLE_CORE_CLK;
+   ath10k_ahb_tcsr_write32(ar, glb_cfg_reg, val);
+
+   ret = reset_control_assert(ar_ahb->core_cold_rst);
+   if (ret)
+   ath10k_err(ar, "failed to assert core cold rst: %d\n", ret);
+   msleep(1);
+
+   ret = reset_control_assert(ar_ahb->radio_cold_rst);
+   if (ret)
+   ath10k_err(ar, "failed to assert radio cold rst: %d\n", ret);
+   msleep(1);
+
+   ret = reset_control_assert(ar_ahb->radio_warm_rst);
+   if (ret)
+   ath10k_err(ar, "failed to assert radio warm rst: %d\n", ret);
+   msleep(1);
+
+   ret = reset_control_assert(ar_ahb->radio_srif_rst);
+   if (ret)
+   ath10k_err(ar, "failed to assert radio srif rst: %d\n", ret);
+   msleep(1);
+
+   ret = reset_control_assert(ar_ahb->cpu_init_rst);
+   if (ret)
+   ath10k_err(ar, "failed to assert cpu init rst: %d\n", ret);
+   msleep(10);
+
+   /* Clear halt req and core clock disable req before
+* deasserting wifi core reset.
+*/
+   val = ath10k_ahb_tcsr_read32(ar, haltreq_reg);
+   val &= ~AHB_AXI_BUS_HALT_REQ;
+   ath10k_ahb_tcsr_write32(ar, haltreq_reg, val);
+
+   val = ath10k_ahb_tcsr_read32(ar, glb_cfg_reg);
+   val &= ~TCSR_WIFIX_GLB_CFG_DISABLE_CORE_CLK;
+   ath10k_ahb_tcsr_write32(ar, glb_cfg_reg, val);
+
+   ret = reset_control_deassert(ar_ahb->core_cold_rst);
+   if (ret)
+   ath10k_err(ar, "failed to deassert core cold rst: %d\n", ret);
+
+   ath10k_dbg(ar, ATH10K_DBG_AHB, "core %d reset done\n", core_id);
+}
+
 static int ath10k_ahb_probe(struct platform_device *pdev)
 {
return 0;
diff --git a/drivers/net/wireless/ath/ath10k/ahb.h 
b/drivers/net/wireless/ath/ath10k/ahb.h
index 2904b7b..4761eeb 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.h
+++ b/drivers/net/wireless/ath/ath10k/ahb.h
@@ -39,6 +39,21 @@ struct ath10k_ahb {
 
 #ifdef CONF

[PATCH 12/12] ath10k: expose hif ops for ahb

2016-01-27 Thread Raja Mani
Like how pci.c exposes hif ops for the bus specific operation,
expose similar hif ops table for ahb with all required functions
linked to it. Many ath10k_pci_* functions are reused here in hif ops
table. If something is not sharable, new functions are added for ahb
and linked to hif ops table.

Finally, make ath10k_ahb_probe/remove() to perform what is expected
out of it.

Signed-off-by: Raja Mani 
---
 drivers/net/wireless/ath/ath10k/ahb.c | 271 ++
 drivers/net/wireless/ath/ath10k/ahb.h |   5 +
 drivers/net/wireless/ath/ath10k/hw.h  |   1 +
 3 files changed, 277 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/ahb.c 
b/drivers/net/wireless/ath/ath10k/ahb.c
index d83a864..bd62bc1 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.c
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -624,13 +624,284 @@ static void ath10k_ahb_resource_deinit(struct ath10k *ar)
ath10k_ahb_rst_ctrl_deinit(ar);
 }
 
+static int ath10k_ahb_prepare_device(struct ath10k *ar)
+{
+   u32 val;
+   int ret;
+
+   ret = ath10k_ahb_clock_enable(ar);
+   if (ret) {
+   ath10k_err(ar, "failed to enable clocks\n");
+   return ret;
+   }
+
+   /* Clock for the target is supplied from outside of target (ie,
+* external clock module controlled by the host). Target needs
+* to know what frequency target cpu is configured which is needed
+* for target internal use. Read target cpu frequency info from
+* gcc register and write into target's scratch register where
+* target expects this information.
+*/
+   val = ath10k_ahb_gcc_read32(ar, ATH10K_AHB_GCC_FEPLL_PLL_DIV);
+   ath10k_ahb_write32(ar, ATH10K_AHB_WIFI_SCRATCH_5_REG, val);
+
+   ret = ath10k_ahb_release_reset(ar);
+   if (ret)
+   goto err_clk_disable;
+
+   ath10k_ahb_irq_disable(ar);
+
+   ath10k_ahb_write32(ar, FW_INDICATOR_ADDRESS, FW_IND_HOST_READY);
+
+   ret = ath10k_pci_wait_for_target_init(ar);
+   if (ret)
+   goto err_halt_chip;
+
+   return 0;
+
+err_halt_chip:
+   ath10k_ahb_halt_chip(ar);
+
+err_clk_disable:
+   ath10k_ahb_clock_disable(ar);
+
+   return ret;
+}
+
+static int ath10k_ahb_chip_reset(struct ath10k *ar)
+{
+   int ret;
+
+   ath10k_ahb_halt_chip(ar);
+   ath10k_ahb_clock_disable(ar);
+
+   ret = ath10k_ahb_prepare_device(ar);
+   if (ret)
+   return ret;
+
+   return 0;
+}
+
+static int ath10k_ahb_wake_target_cpu(struct ath10k *ar)
+{
+   u32 addr, val;
+
+   addr = SOC_CORE_BASE_ADDRESS | CORE_CTRL_ADDRESS;
+   val = ath10k_ahb_read32(ar, addr);
+   val |= ATH10K_AHB_CORE_CTRL_CPU_INTR_MASK;
+   ath10k_ahb_write32(ar, addr, val);
+
+   return 0;
+}
+
+static int ath10k_ahb_hif_start(struct ath10k *ar)
+{
+   ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot ahb hif start\n");
+
+   ath10k_ce_enable_interrupts(ar);
+   ath10k_pci_enable_legacy_irq(ar);
+
+   ath10k_pci_rx_post(ar);
+
+   return 0;
+}
+
+static void ath10k_ahb_hif_stop(struct ath10k *ar)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+
+   ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot ahb hif stop\n");
+
+   ath10k_ahb_irq_disable(ar);
+   synchronize_irq(ar_ahb->irq);
+
+   ath10k_pci_flush(ar);
+}
+
+static int ath10k_ahb_hif_power_up(struct ath10k *ar)
+{
+   int ret;
+
+   ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot ahb hif power up\n");
+
+   ret = ath10k_ahb_chip_reset(ar);
+   if (ret) {
+   ath10k_err(ar, "failed to reset chip: %d\n", ret);
+   goto out;
+   }
+
+   ret = ath10k_pci_init_pipes(ar);
+   if (ret) {
+   ath10k_err(ar, "failed to initialize CE: %d\n", ret);
+   goto out;
+   }
+
+   ret = ath10k_pci_init_config(ar);
+   if (ret) {
+   ath10k_err(ar, "failed to setup init config: %d\n", ret);
+   goto err_ce_deinit;
+   }
+
+   ret = ath10k_ahb_wake_target_cpu(ar);
+   if (ret) {
+   ath10k_err(ar, "could not wake up target CPU: %d\n", ret);
+   goto err_ce_deinit;
+   }
+
+   return 0;
+
+err_ce_deinit:
+   ath10k_pci_ce_deinit(ar);
+out:
+   return ret;
+}
+
+static const struct ath10k_hif_ops ath10k_ahb_hif_ops = {
+   .tx_sg  = ath10k_pci_hif_tx_sg,
+   .diag_read  = ath10k_pci_hif_diag_read,
+   .diag_write = ath10k_pci_diag_write_mem,
+   .exchange_bmi_msg   = ath10k_pci_hif_exchange_bmi_msg,
+   .start  = ath10k_ahb_hif_start,
+   .stop   = ath10k_ahb_hif_stop,
+   .map_service_to_pipe= ath10k_pci_hif_map_service_to_pipe,
+   .get_default_pipe   = ath10k_pci_hif_get_default_pipe,
+   .send_complete_check= ath10k_pci_hif_send_complete_check,
+   .get_free_queue_number  = ath10k_pci_hif_get_fre

[PATCH 11/12] ath10k: add resource init and deinit in ahb

2016-01-27 Thread Raja Mani
Add function to gather resources required for qca4019 to operate
(memory, irq, dma setting, clock init , rest control init) and
function release those resources when it's not needed.

Signed-off-by: Raja Mani 
---
 drivers/net/wireless/ath/ath10k/ahb.c | 122 ++
 drivers/net/wireless/ath/ath10k/ahb.h |   7 ++
 2 files changed, 129 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/ahb.c 
b/drivers/net/wireless/ath/ath10k/ahb.c
index 29d0b6c..d83a864 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.c
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -15,6 +15,8 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include 
+#include 
+#include 
 #include 
 #include 
 #include "core.h"
@@ -502,6 +504,126 @@ static void ath10k_ahb_irq_disable(struct ath10k *ar)
ath10k_pci_disable_and_clear_legacy_irq(ar);
 }
 
+static int ath10k_ahb_resource_init(struct ath10k *ar)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+   struct platform_device *pdev;
+   struct device *dev;
+   struct resource *res;
+   int ret;
+
+   pdev = ar_ahb->pdev;
+   dev = &pdev->dev;
+
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   if (!res) {
+   ath10k_err(ar, "failed to get memory resource\n");
+   ret = -ENXIO;
+   goto out;
+   }
+
+   ar_ahb->mem = devm_ioremap_resource(&pdev->dev, res);
+   if (IS_ERR(ar_ahb->mem)) {
+   ath10k_err(ar, "mem ioremap error\n");
+   ret = PTR_ERR(ar_ahb->mem);
+   goto out;
+   }
+
+   ar_ahb->mem_len = resource_size(res);
+
+   ar_ahb->gcc_mem = ioremap_nocache(ATH10K_GCC_REG_BASE,
+ ATH10K_GCC_REG_SIZE);
+   if (!ar_ahb->gcc_mem) {
+   ath10k_err(ar, "gcc mem ioremap error\n");
+   ret = -ENOMEM;
+   goto err_mem_unmap;
+   }
+
+   ar_ahb->tcsr_mem = ioremap_nocache(ATH10K_TCSR_REG_BASE,
+  ATH10K_TCSR_REG_SIZE);
+   if (!ar_ahb->tcsr_mem) {
+   ath10k_err(ar, "tcsr mem ioremap error\n");
+   ret = -ENOMEM;
+   goto err_gcc_mem_unmap;
+   }
+
+   ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
+   if (ret) {
+   ath10k_err(ar, "failed to set 32-bit dma mask: %d\n", ret);
+   goto err_tcsr_mem_unmap;
+   }
+
+   ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
+   if (ret) {
+   ath10k_err(ar, "failed to set 32-bit consistent dma: %d\n",
+  ret);
+   goto err_tcsr_mem_unmap;
+   }
+
+   ret = ath10k_ahb_clock_init(ar);
+   if (ret)
+   goto err_tcsr_mem_unmap;
+
+   ret = ath10k_ahb_rst_ctrl_init(ar);
+   if (ret)
+   goto err_clock_deinit;
+
+   ar_ahb->irq = platform_get_irq_byname(pdev, "legacy");
+   if (ar_ahb->irq < 0) {
+   ath10k_err(ar, "failed to get irq number: %d\n", ar_ahb->irq);
+   goto err_clock_deinit;
+   }
+
+   ath10k_dbg(ar, ATH10K_DBG_BOOT, "irq: %d\n", ar_ahb->irq);
+
+   ath10k_dbg(ar, ATH10K_DBG_BOOT, "mem: 0x%p mem_len: %lu gcc mem: 0x%p 
tcsr_mem: 0x%p\n",
+  ar_ahb->mem, ar_ahb->mem_len,
+  ar_ahb->gcc_mem, ar_ahb->tcsr_mem);
+   return 0;
+
+err_clock_deinit:
+   ath10k_ahb_clock_deinit(ar);
+
+err_tcsr_mem_unmap:
+   iounmap(ar_ahb->tcsr_mem);
+
+err_gcc_mem_unmap:
+   ar_ahb->tcsr_mem = NULL;
+   iounmap(ar_ahb->gcc_mem);
+
+err_mem_unmap:
+   ar_ahb->gcc_mem = NULL;
+   devm_iounmap(&pdev->dev, ar_ahb->mem);
+
+out:
+   ar_ahb->mem = NULL;
+   return ret;
+}
+
+static void ath10k_ahb_resource_deinit(struct ath10k *ar)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+   struct device *dev;
+
+   dev = &ar_ahb->pdev->dev;
+
+   if (ar_ahb->mem)
+   devm_iounmap(dev, ar_ahb->mem);
+
+   if (ar_ahb->gcc_mem)
+   iounmap(ar_ahb->gcc_mem);
+
+   if (ar_ahb->tcsr_mem)
+   iounmap(ar_ahb->tcsr_mem);
+
+   ar_ahb->mem = NULL;
+   ar_ahb->gcc_mem = NULL;
+   ar_ahb->tcsr_mem = NULL;
+
+   ath10k_ahb_clock_deinit(ar);
+   ath10k_ahb_rst_ctrl_deinit(ar);
+}
+
 static int ath10k_ahb_probe(struct platform_device *pdev)
 {
return 0;
diff --git a/drivers/net/wireless/ath/ath10k/ahb.h 
b/drivers/net/wireless/ath/ath10k/ahb.h
index 97c40e4..5bd01b4 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.h
+++ b/drivers/net/wireless/ath/ath10k/ahb.h
@@ -23,6 +23,7 @@
 struct ath10k_ahb {
struct platform_device *pdev;
void __iomem *mem;
+   unsigned long mem_len;
void __iomem *gcc_mem;
void __iomem *tcsr_mem;
 
@@ -41,6 +42,12 @@ struct ath10k_ahb {
 
 #ifdef CONFIG_ATH10K_AHB
 
+#define ATH10K_GCC_REG_BASE

[PATCH] wext: fix message delay/ordering

2016-01-27 Thread Johannes Berg
From: Johannes Berg 

Beniamino reported that he was getting an RTM_NEWLINK message for a
given interface, after the RTM_DELLINK for it. It turns out that the
message is a wireless extensions message, which was sent because the
interface had been connected and disconnection while it was deleted
caused a wext message.

It's strange that wext uses RTM_NEWLINK, and the message is somewhat
malformed without any proper attributes, causing "ip monitor link"
to print just rudimentary information:

5: wlan1:  mtu 1500 qdisc mq state DOWN group default
link/ether 02:00:00:00:01:00 brd ff:ff:ff:ff:ff:ff
Deleted 5: wlan1:  mtu 1500 qdisc noop state DOWN group 
default
link/ether 02:00:00:00:01:00 brd ff:ff:ff:ff:ff:ff
5: wlan1: 
link/ether
(from my hwsim reproduction)

The reason for this is that wext schedules a worker to send out the
messages, and the scheduling delay can cause the messages to get out
to userspace after the RTM_DELLINK.

To fix this, have wext register a netdevice notifier and flush out
any pending messages when a netdevice is unregistered.

Cc: sta...@vger.kernel.org
Reported-by: Beniamino Galvani 
Signed-off-by: Johannes Berg 
---
 net/wireless/wext-core.c | 48 ++--
 1 file changed, 38 insertions(+), 10 deletions(-)

diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c
index c8717c1d082e..4e4e1c5236cc 100644
--- a/net/wireless/wext-core.c
+++ b/net/wireless/wext-core.c
@@ -342,6 +342,38 @@ static const int compat_event_type_size[] = {
 
 /* IW event code */
 
+static void wireless_nlevent_flush(void)
+{
+   struct sk_buff *skb;
+   struct net *net;
+
+   ASSERT_RTNL();
+
+   for_each_net(net) {
+   while ((skb = skb_dequeue(&net->wext_nlevents)))
+   rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL,
+   GFP_KERNEL);
+   }
+}
+
+static int wext_netdev_notifier_call(struct notifier_block *nb,
+unsigned long state, void *ptr)
+{
+   /*
+* When a netdev is unregistered, flush all pending messages
+* to avoid them going out after the RTM_DELLINK, which can
+* happen due to the schedule_work().
+*/
+   if (state == NETDEV_UNREGISTER)
+   wireless_nlevent_flush();
+
+   return NOTIFY_OK;
+}
+
+static struct notifier_block wext_netdev_notifier = {
+   .notifier_call = wext_netdev_notifier_call,
+};
+
 static int __net_init wext_pernet_init(struct net *net)
 {
skb_queue_head_init(&net->wext_nlevents);
@@ -360,6 +392,11 @@ static struct pernet_operations wext_pernet_ops = {
 
 static int __init wireless_nlevent_init(void)
 {
+   int err = register_netdevice_notifier(&wext_netdev_notifier);
+
+   if (err)
+   return err;
+
return register_pernet_subsys(&wext_pernet_ops);
 }
 
@@ -368,17 +405,8 @@ subsys_initcall(wireless_nlevent_init);
 /* Process events generated by the wireless layer or the driver. */
 static void wireless_nlevent_process(struct work_struct *work)
 {
-   struct sk_buff *skb;
-   struct net *net;
-
rtnl_lock();
-
-   for_each_net(net) {
-   while ((skb = skb_dequeue(&net->wext_nlevents)))
-   rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL,
-   GFP_KERNEL);
-   }
-
+   wireless_nlevent_flush();
rtnl_unlock();
 }
 
-- 
2.6.2

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


Re: [PATCH] wext: fix message delay/ordering

2016-01-27 Thread Johannes Berg
On Wed, 2016-01-27 at 13:14 +0100, Johannes Berg wrote:
> 
> +static int wext_netdev_notifier_call(struct notifier_block *nb,
> +  unsigned long state, void *ptr)
> +{
> + /*
> +  * When a netdev is unregistered, flush all pending messages
> +  * to avoid them going out after the RTM_DELLINK, which can
> +  * happen due to the schedule_work().
> +  */
> + if (state == NETDEV_UNREGISTER)
> + wireless_nlevent_flush();
> 
It could be argued that the state check isn't really necessary and
should be removed to avoid ordering issues with up/down vs. wext, but
this fixes the really strange issue where you get an RTM_NEWLINK after
RTM_DELLINK (with the same ifidx), and I don't see how any software
would care much about the ordering otherwise.

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] wext: fix message delay/ordering

2016-01-27 Thread Johannes Berg

> > +   if (state == NETDEV_UNREGISTER)
> > +   wireless_nlevent_flush();
> > 
> It could be argued that the state check isn't really necessary and
> should be removed to avoid ordering issues with up/down vs. wext, but
> this fixes the really strange issue where you get an RTM_NEWLINK
> after
> RTM_DELLINK (with the same ifidx), and I don't see how any software
> would care much about the ordering otherwise.
> 

Actually though, with the fix I still get:

5: wlan1:  mtu 1500 qdisc mq state DOWN group default 
link/ether 02:00:00:00:01:00 brd ff:ff:ff:ff:ff:ff
5: wlan1:  
link/ether 
Deleted 5: wlan1:  mtu 1500 qdisc noop state DOWN group 
default 
link/ether 02:00:00:00:01:00 brd ff:ff:ff:ff:ff:ff

which is clearly odd (see the UP flag), so I'll change 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


Re: pull request: iwlwifi 2016-01-26

2016-01-27 Thread Kalle Valo
"Grumbach, Emmanuel"  writes:

> On 01/26/2016 04:01 PM, Johannes Berg wrote:
 There's a conflict due to 8f57e4d930d, how should I fix it?
>> I think we can thus drop my patch - that commit fixes the issue that
>> Andrew had reported as well, and that I worked around by casting the
>> result... now that abs() has a consistent result, using s32 in both
>> sides of the min() is perfectly fine.
>>
>> johannes
>>
>>
>
> I did just that in my new tag: iwlwifi-for-kalle-2016-01-26_2

Pulled, thanks.

-- 
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 4/5] brcmfmac: access PMU registers using standalone PMU core if available

2016-01-27 Thread Kalle Valo
kbuild test robot  writes:

> Hi Rafał,
>
> [auto build test ERROR on wireless-drivers/master]
> [also build test ERROR on v4.5-rc1 next-20160125]
> [if your patch is applied to the wrong git tree, please drop us a note to 
> help improving the system]
>
> url:
> https://github.com/0day-ci/linux/commits/Rafa-Mi-ecki/brcmfmac-support-for-new-14e43-4365-card-with-BCM4366/20160127-010149
> base:   
> https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git 
> master
> config: x86_64-allmodconfig (attached as .config)
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=x86_64 
>
> All errors (new ones prefixed by >>):
>
>drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c: In function 
> 'brcmf_chip_get_pmu':
>>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c:1143:25: error: 
>>> 'BCMA_CC_CAP_EXT_AOB_PRESENT' undeclared (first use in this function)
>  pub->cc_caps_ext & BCMA_CC_CAP_EXT_AOB_PRESENT) {
> ^
>drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c:1143:25: note: 
> each undeclared identifier is reported only once for each function it appears 
> in

I think this error was as expected because this set depends on "bcma:
support PMU present as separated bus core" which is not yet applied.

-- 
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] wext: fix message delay/ordering

2016-01-27 Thread Johannes Berg
On Wed, 2016-01-27 at 13:18 +0100, Johannes Berg wrote:
> > > + if (state == NETDEV_UNREGISTER)
> > > + wireless_nlevent_flush();
> > > 
> > It could be argued that the state check isn't really necessary and
> > should be removed to avoid ordering issues with up/down vs. wext,
> > but
> > this fixes the really strange issue where you get an RTM_NEWLINK
> > after
> > RTM_DELLINK (with the same ifidx), and I don't see how any software
> > would care much about the ordering otherwise.
> > 
> 
> Actually though, with the fix I still get:
> 
> 5: wlan1:  mtu 1500 qdisc mq state DOWN group
> default 
> link/ether 02:00:00:00:01:00 brd ff:ff:ff:ff:ff:ff
> 5: wlan1:  
> link/ether 
> Deleted 5: wlan1:  mtu 1500 qdisc noop state
> DOWN group default 
> link/ether 02:00:00:00:01:00 brd ff:ff:ff:ff:ff:ff
> 
> which is clearly odd (see the UP flag), so I'll change it.
> 

Doesn't help, since the wext netdev notifier is registered earlier and
thus runs earlier than the cfg80211 one that triggers the action ...

I'll fix that differently then.

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/2] cfg80211/wext: fix message ordering

2016-01-27 Thread Johannes Berg
From: Johannes Berg 

Since cfg80211 frequently takes actions from its netdev notifier
call, wireless extensions messages could still be ordered badly
since the wext netdev notifier, since wext is built into the
kernel, runs before the cfg80211 netdev notifier. For example,
the following can happen:

5: wlan1:  mtu 1500 qdisc mq state DOWN group default
link/ether 02:00:00:00:01:00 brd ff:ff:ff:ff:ff:ff
5: wlan1: 
link/ether

when setting the interface down causes the wext message.

To also fix this, export the wireless_nlevent_flush() function
and also call it from the cfg80211 notifier.

Cc: sta...@vger.kernel.org
Signed-off-by: Johannes Berg 
---
 include/net/iw_handler.h | 6 ++
 net/wireless/core.c  | 2 ++
 net/wireless/wext-core.c | 3 ++-
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h
index 8f81bbbc38fc..8a3ec3955f20 100644
--- a/include/net/iw_handler.h
+++ b/include/net/iw_handler.h
@@ -439,6 +439,12 @@ int dev_get_wireless_info(char *buffer, char **start, 
off_t offset, int length);
 /* Send a single event to user space */
 void wireless_send_event(struct net_device *dev, unsigned int cmd,
 union iwreq_data *wrqu, const char *extra);
+#ifdef CONFIG_WEXT_CORE
+/* flush all previous wext events - if work is done from netdev notifiers */
+void wireless_nlevent_flush(void);
+#else
+static void wireless_nlevent_flush(void) {}
+#endif
 
 /* We may need a function to send a stream of events to user space.
  * More on that later... */
diff --git a/net/wireless/core.c b/net/wireless/core.c
index b0915515640e..8f0bac7e03c4 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -1147,6 +1147,8 @@ static int cfg80211_netdev_notifier_call(struct 
notifier_block *nb,
return NOTIFY_DONE;
}
 
+   wireless_nlevent_flush();
+
return NOTIFY_OK;
 }
 
diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c
index 5f429637efff..abdfcb5f3e48 100644
--- a/net/wireless/wext-core.c
+++ b/net/wireless/wext-core.c
@@ -342,7 +342,7 @@ static const int compat_event_type_size[] = {
 
 /* IW event code */
 
-static void wireless_nlevent_flush(void)
+void wireless_nlevent_flush(void)
 {
struct sk_buff *skb;
struct net *net;
@@ -355,6 +355,7 @@ static void wireless_nlevent_flush(void)
GFP_KERNEL);
}
 }
+EXPORT_SYMBOL_GPL(wireless_nlevent_flush);
 
 static int wext_netdev_notifier_call(struct notifier_block *nb,
 unsigned long state, void *ptr)
-- 
2.6.2

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


[PATCH 1/2] wext: fix message delay/ordering

2016-01-27 Thread Johannes Berg
From: Johannes Berg 

Beniamino reported that he was getting an RTM_NEWLINK message for a
given interface, after the RTM_DELLINK for it. It turns out that the
message is a wireless extensions message, which was sent because the
interface had been connected and disconnection while it was deleted
caused a wext message.

For its netlink messages, wext uses RTM_NEWLINK, but the message is
without all the regular rtnetlink attributes, so "ip monitor link"
prints just rudimentary information:

5: wlan1:  mtu 1500 qdisc mq state DOWN group default
link/ether 02:00:00:00:01:00 brd ff:ff:ff:ff:ff:ff
Deleted 5: wlan1:  mtu 1500 qdisc noop state DOWN group 
default
link/ether 02:00:00:00:01:00 brd ff:ff:ff:ff:ff:ff
5: wlan1: 
link/ether
(from my hwsim reproduction)

This can cause userspace to get confused since it doesn't expect an
RTM_NEWLINK message after RTM_DELLINK.

The reason for this is that wext schedules a worker to send out the
messages, and the scheduling delay can cause the messages to get out
to userspace in different order.

To fix this, have wext register a netdevice notifier and flush out
any pending messages when netdevice state changes. This fixes any
ordering whenever the original message wasn't sent by a notifier
itself.

Cc: sta...@vger.kernel.org
Reported-by: Beniamino Galvani 
Signed-off-by: Johannes Berg 
---
 net/wireless/wext-core.c | 49 ++--
 1 file changed, 39 insertions(+), 10 deletions(-)

diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c
index c8717c1d082e..5f429637efff 100644
--- a/net/wireless/wext-core.c
+++ b/net/wireless/wext-core.c
@@ -342,6 +342,39 @@ static const int compat_event_type_size[] = {
 
 /* IW event code */
 
+static void wireless_nlevent_flush(void)
+{
+   struct sk_buff *skb;
+   struct net *net;
+
+   ASSERT_RTNL();
+
+   for_each_net(net) {
+   while ((skb = skb_dequeue(&net->wext_nlevents)))
+   rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL,
+   GFP_KERNEL);
+   }
+}
+
+static int wext_netdev_notifier_call(struct notifier_block *nb,
+unsigned long state, void *ptr)
+{
+   /*
+* When a netdev changes state in any way, flush all pending messages
+* to avoid them going out in a strange order, e.g. RTM_NEWLINK after
+* RTM_DELLINK, or with IFF_UP after without IFF_UP during dev_close()
+* or similar - all of which could otherwise happen due to delays from
+* schedule_work().
+*/
+   wireless_nlevent_flush();
+
+   return NOTIFY_OK;
+}
+
+static struct notifier_block wext_netdev_notifier = {
+   .notifier_call = wext_netdev_notifier_call,
+};
+
 static int __net_init wext_pernet_init(struct net *net)
 {
skb_queue_head_init(&net->wext_nlevents);
@@ -360,6 +393,11 @@ static struct pernet_operations wext_pernet_ops = {
 
 static int __init wireless_nlevent_init(void)
 {
+   int err = register_netdevice_notifier(&wext_netdev_notifier);
+
+   if (err)
+   return err;
+
return register_pernet_subsys(&wext_pernet_ops);
 }
 
@@ -368,17 +406,8 @@ subsys_initcall(wireless_nlevent_init);
 /* Process events generated by the wireless layer or the driver. */
 static void wireless_nlevent_process(struct work_struct *work)
 {
-   struct sk_buff *skb;
-   struct net *net;
-
rtnl_lock();
-
-   for_each_net(net) {
-   while ((skb = skb_dequeue(&net->wext_nlevents)))
-   rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL,
-   GFP_KERNEL);
-   }
-
+   wireless_nlevent_flush();
rtnl_unlock();
 }
 
-- 
2.6.2

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


Re: [PATCH 4/5] brcmfmac: access PMU registers using standalone PMU core if available

2016-01-27 Thread Rafał Miłecki
On 27 January 2016 at 13:27, Kalle Valo  wrote:
> kbuild test robot  writes:
>
>> Hi Rafał,
>>
>> [auto build test ERROR on wireless-drivers/master]
>> [also build test ERROR on v4.5-rc1 next-20160125]
>> [if your patch is applied to the wrong git tree, please drop us a note to 
>> help improving the system]
>>
>> url:
>> https://github.com/0day-ci/linux/commits/Rafa-Mi-ecki/brcmfmac-support-for-new-14e43-4365-card-with-BCM4366/20160127-010149
>> base:   
>> https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git 
>> master
>> config: x86_64-allmodconfig (attached as .config)
>> reproduce:
>> # save the attached .config to linux build tree
>> make ARCH=x86_64
>>
>> All errors (new ones prefixed by >>):
>>
>>drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c: In function 
>> 'brcmf_chip_get_pmu':
>>>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c:1143:25: error: 
>>>> 'BCMA_CC_CAP_EXT_AOB_PRESENT' undeclared (first use in this function)
>>  pub->cc_caps_ext & BCMA_CC_CAP_EXT_AOB_PRESENT) {
>> ^
>>drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c:1143:25: note: 
>> each undeclared identifier is reported only once for each function it 
>> appears in
>
> I think this error was as expected because this set depends on "bcma:
> support PMU present as separated bus core" which is not yet applied.

Yes, builbot simply couldn't know about this, but I should have reply
to make it clear I guess.

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


[PATCH] hostap: avoid uninitialized variable use in hfa384x_get_rid

2016-01-27 Thread Arnd Bergmann
The driver reads a value from hfa384x_from_bap(), which may fail,
and then assigns the value to a local variable. gcc detects that
in in the failure case, the 'rlen' variable now contains
uninitialized data:

In file included from 
../drivers/net/wireless/intersil/hostap/hostap_pci.c:220:0:
drivers/net/wireless/intersil/hostap/hostap_hw.c: In function 'hfa384x_get_rid':
drivers/net/wireless/intersil/hostap/hostap_hw.c:842:5: warning: 'rec' may be 
used uninitialized in this function [-Wmaybe-uninitialized]
  if (le16_to_cpu(rec.len) == 0) {

To ensure we get consistent error handling here, this changes the code
to only set rlen if we actually read data correctly, which also takes
care of the warning.

Signed-off-by: Arnd Bergmann 
---
 drivers/net/wireless/intersil/hostap/hostap_hw.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/intersil/hostap/hostap_hw.c 
b/drivers/net/wireless/intersil/hostap/hostap_hw.c
index 6df3ee561d52..6dbf8ee9490a 100644
--- a/drivers/net/wireless/intersil/hostap/hostap_hw.c
+++ b/drivers/net/wireless/intersil/hostap/hostap_hw.c
@@ -839,12 +839,15 @@ static int hfa384x_get_rid(struct net_device *dev, u16 
rid, void *buf, int len,
if (!res)
res = hfa384x_from_bap(dev, BAP0, &rec, sizeof(rec));
 
-   if (le16_to_cpu(rec.len) == 0) {
-   /* RID not available */
-   res = -ENODATA;
+   if (!res) {
+   if (le16_to_cpu(rec.len) == 0) {
+   /* RID not available */
+   res = -ENODATA;
+   }
+
+   rlen = (le16_to_cpu(rec.len) - 1) * 2;
}
 
-   rlen = (le16_to_cpu(rec.len) - 1) * 2;
if (!res && exact_len && rlen != len) {
printk(KERN_DEBUG "%s: hfa384x_get_rid - RID len mismatch: "
   "rid=0x%04x, len=%d (expected %d)\n",
-- 
2.7.0

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


[PATCH v2] mac80211: expose txq queue depth and size to drivers

2016-01-27 Thread Michal Kazior
This will allow drivers to make more educated
decisions whether to defer transmission or not.

Relying on wake_tx_queue() call count implicitly
was not possible because it could be called
without queued frame count actually changing on
software tx aggregation start/stop code paths.

It was also not possible to know how long
byte-wise queue was without dequeueing.

Signed-off-by: Michal Kazior 
---

Notes:
v2:
 * export a dedicated API call to get both
   frame/byte counts to reduce redundancy and
   offer possible synchronized reads in the future [Felix]

 include/net/mac80211.h | 15 +++
 net/mac80211/ieee80211_i.h |  1 +
 net/mac80211/iface.c   |  1 +
 net/mac80211/sta_info.c|  1 +
 net/mac80211/tx.c  |  8 +++-
 net/mac80211/util.c| 14 ++
 6 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 31337f81ec03..6617516a276f 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -5594,4 +5594,19 @@ void ieee80211_unreserve_tid(struct ieee80211_sta *sta, 
u8 tid);
  */
 struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
 struct ieee80211_txq *txq);
+
+/**
+ * ieee80211_txq_get_depth - get pending frame/byte count of given txq
+ *
+ * The values are not guaranteed to be coherent with regard to each other, i.e.
+ * txq state can change half-way of this function and the caller may end up
+ * with "new" frame_cnt and "old" byte_cnt or vice-versa.
+ *
+ * @txq: pointer obtained from station or virtual interface
+ * @frame_cnt: pointer to store frame count
+ * @byte_cnt: pointer to store byte count
+ */
+void ieee80211_txq_get_depth(struct ieee80211_txq *txq,
+unsigned long *frame_cnt,
+unsigned long *byte_cnt);
 #endif /* MAC80211_H */
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index a29f61dc9c06..a96f8c0461f6 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -804,6 +804,7 @@ enum txq_info_flags {
 struct txq_info {
struct sk_buff_head queue;
unsigned long flags;
+   unsigned long byte_cnt;
 
/* keep last! */
struct ieee80211_txq txq;
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 0451f120746e..453b4e741780 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -979,6 +979,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data 
*sdata,
 
spin_lock_bh(&txqi->queue.lock);
ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
+   txqi->byte_cnt = 0;
spin_unlock_bh(&txqi->queue.lock);
 
atomic_set(&sdata->txqs_len[txqi->txq.ac], 0);
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 7e007cf12cb2..e1d9ccc5d197 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -116,6 +116,7 @@ static void __cleanup_single_sta(struct sta_info *sta)
 
ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
atomic_sub(n, &sdata->txqs_len[txqi->txq.ac]);
+   txqi->byte_cnt = 0;
}
}
 
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 3311ce0f3d6c..af584f7cdd63 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1266,7 +1266,11 @@ static void ieee80211_drv_tx(struct ieee80211_local 
*local,
if (atomic_read(&sdata->txqs_len[ac]) >= local->hw.txq_ac_max_pending)
netif_stop_subqueue(sdata->dev, ac);
 
-   skb_queue_tail(&txqi->queue, skb);
+   spin_lock_bh(&txqi->queue.lock);
+   txqi->byte_cnt += skb->len;
+   __skb_queue_tail(&txqi->queue, skb);
+   spin_unlock_bh(&txqi->queue.lock);
+
drv_wake_tx_queue(local, txqi);
 
return;
@@ -1294,6 +1298,8 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw 
*hw,
if (!skb)
goto out;
 
+   txqi->byte_cnt -= skb->len;
+
atomic_dec(&sdata->txqs_len[ac]);
if (__netif_subqueue_stopped(sdata->dev, ac))
ieee80211_propagate_queue_wake(local, sdata->vif.hw_queue[ac]);
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index fb90d9c5df59..091f3dd62ad1 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -3368,3 +3368,17 @@ void ieee80211_init_tx_queue(struct 
ieee80211_sub_if_data *sdata,
txqi->txq.ac = IEEE80211_AC_BE;
}
 }
+
+void ieee80211_txq_get_depth(struct ieee80211_txq *txq,
+unsigned long *frame_cnt,
+unsigned long *byte_cnt)
+{
+   struct txq_info *txqi = to_txq_info(txq);
+
+   if (frame_cnt)
+   *frame_cnt = txqi->queue.qlen;
+
+   if (byte_cnt)
+   *byte_cnt = txqi->byte_cnt;
+}
+EXPORT_SYMBOL(ieee80211_txq_get_depth);
-- 
2.1.4

--
To unsubscribe from this list: send the line

Re: [PATCH v2] mac80211: expose txq queue depth and size to drivers

2016-01-27 Thread Johannes Berg
On Wed, 2016-01-27 at 15:26 +0100, Michal Kazior wrote:
> 
> @@ -1294,6 +1298,8 @@ struct sk_buff *ieee80211_tx_dequeue(struct
> ieee80211_hw *hw,
>   if (!skb)
>   goto out;
>  
> + txqi->byte_cnt -= skb->len;
> +
>   atomic_dec(&sdata->txqs_len[ac]);
> 
This *looks* a bit worrying - you have an atomic dec for the # of
packets and a non-atomic one for the bytes.

You probably thought about it and I guess it's fine, but can you
explain 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


[RFC] mac80211: introduce netdev queue control for txqs

2016-01-27 Thread Michal Kazior
Until now all stations (notably in AP mode) would
share 4 AC queues exposed via netdev. This meant
that whenever a single station's AC became full
all other stations' AC were considered full and
stopped as well.

This was suboptimal and could lead to per station
traffic starvation and/or suboptimal Tx
aggregation performance.

The introduced queue control is performed by
mac80211 alone. Additional netdev queues are
created only if driver supports wake_tx_queue()
op.

First 4 netdev queues are used for unclassified
traffic (e.g. when there's no sta_info for given
RA) which is mostly multicast.

All other netdev queues (>=4) are used per
station. Each station gets 4 queues for each AC.
Whenever station's AC-related ieee80211_txqs get
full only that single station's netdev queue is
stopped allowing all other stations (either using
identical AC number or not) to continue submitting
traffic without interruption.

Current implementation supports up to 63
non-overlapping stations. Overlapping stations
will share their per AC netdev queues so whenever
any of overlapping stations' AC queue is stopped
others are stopped as well.

This was designed with MU-MIMO in mind but should
benefit regular Tx aggregation as well because
drivers will now have the ability to avoid
clogging up their internal (be it firmware or
hardware) queues with traffic to slow or
unresponsive stations needlessly.

Note: This can significantly increase memory usage
with, e.g. fq_codel qdisc even up to 20MB per
virtual interface.

Signed-off-by: Michal Kazior 
---
Note: It is recommended to have the following
patch applied in order to avoid conflicts:

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


 net/mac80211/cfg.c |  5 +++
 net/mac80211/ieee80211_i.h | 16 +
 net/mac80211/iface.c   | 21 ++-
 net/mac80211/sta_info.c| 86 --
 net/mac80211/sta_info.h| 11 ++
 net/mac80211/tx.c  | 74 ++-
 net/mac80211/util.c| 35 ---
 net/mac80211/wme.c |  5 +++
 8 files changed, 238 insertions(+), 15 deletions(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 66d22de93c8d..0428c5f68e8c 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1370,6 +1370,11 @@ static int ieee80211_change_station(struct wiphy *wiphy,
prev_4addr = true;
}
 
+   if (local->ops->wake_tx_queue) {
+   sta_info_ndev_free(sta->sdata, sta);
+   sta_info_ndev_init(vlansdata, sta);
+   }
+
sta->sdata = vlansdata;
ieee80211_check_fast_xmit(sta);
 
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index a96f8c0461f6..416bd12f14d2 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -47,6 +47,17 @@ struct ieee80211_local;
  * frame can be up to about 2 kB long. */
 #define TOTAL_MAX_TX_BUFFER 512
 
+/* The number of stations exposed via netdev queues. First 4 netdev queues are
+ * mapped to vif's ACs. Subsequent ones, in groups of 4, are ACs for stations.
+ * NUM_NDEV_STA + 1 station is wrapped around to 1st station. f.e. netdev queue
+ * 5 corresponds to AC1 of STA0, STA63, STA126, ... and queue 8 corresponds
+ * to AC0 of STA1, STA64, STA127, ...
+ *
+ * This is used only when driver implements wake_tx_queues() op.
+ */
+#define IEEE80211_NUM_NDEV_STA 63
+#define IEEE80211_NUM_NDEV_STA_Q (IEEE80211_NUM_NDEV_STA * IEEE80211_NUM_ACS)
+
 /* Required encryption head and tailroom */
 #define IEEE80211_ENCRYPT_HEADROOM 8
 #define IEEE80211_ENCRYPT_TAILROOM 18
@@ -852,7 +863,12 @@ struct ieee80211_sub_if_data {
bool control_port_no_encrypt;
int encrypt_headroom;
 
+   spinlock_t ndev_lock; /* protects access to ndev_sta_idr */
+   DECLARE_BITMAP(ndev_sta_q_stopped, IEEE80211_NUM_NDEV_STA_Q);
+   atomic_t ndev_sta_q_refs[IEEE80211_NUM_NDEV_STA_Q];
+   struct idr ndev_sta_idr;
atomic_t txqs_len[IEEE80211_NUM_ACS];
+
struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS];
struct mac80211_qos_map __rcu *qos_map;
 
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 453b4e741780..d3dae1ae5652 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1094,6 +1094,8 @@ static void ieee80211_teardown_sdata(struct 
ieee80211_sub_if_data *sdata)
 
if (ieee80211_vif_is_mesh(&sdata->vif))
mesh_rmc_free(sdata);
+
+   idr_destroy(&sdata->ndev_sta_idr);
 }
 
 static void ieee80211_uninit(struct net_device *dev)
@@ -1373,6 +1375,7 @@ static void ieee80211_setup_sdata(struct 
ieee80211_sub_if_data *sdata,
 {
static const u8 bssid_wildcard[ETH_ALEN] = {0xff, 0xff, 0xff,
0xff, 0xff, 0xff};
+   int i;
 
/* clear type-dependent union */
memset(&sdata->u, 0, sizeof(sdata->u));
@@ -1401,6 +

Re: [RFC] mac80211: introduce netdev queue control for txqs

2016-01-27 Thread Johannes Berg
On Wed, 2016-01-27 at 15:28 +0100, Michal Kazior wrote:
> Until now all stations (notably in AP mode) would
> share 4 AC queues exposed via netdev. This meant
> that whenever a single station's AC became full
> all other stations' AC were considered full and
> stopped as well.
> 
> This was suboptimal and could lead to per station
> traffic starvation and/or suboptimal Tx
> aggregation performance.

I really think you need to Cc netdev on this :)

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] mac80211: expose txq queue depth and size to drivers

2016-01-27 Thread Michal Kazior
On 27 January 2016 at 15:26, Johannes Berg  wrote:
> On Wed, 2016-01-27 at 15:26 +0100, Michal Kazior wrote:
>>
>> @@ -1294,6 +1298,8 @@ struct sk_buff *ieee80211_tx_dequeue(struct
>> ieee80211_hw *hw,
>>   if (!skb)
>>   goto out;
>>
>> + txqi->byte_cnt -= skb->len;
>> +
>>   atomic_dec(&sdata->txqs_len[ac]);
>>
> This *looks* a bit worrying - you have an atomic dec for the # of
> packets and a non-atomic one for the bytes.
>
> You probably thought about it and I guess it's fine, but can you
> explain it?

The atomic was used because it accesses per-vif counters. You can't
use txqi->queue.lock for that.

On the other hand byte_cnt is per txqi and it was very easy to make
use of the txqi->queue.lock (which was already acquired in both drv_tx
and tx_dequeue functions). Using atomic* for byte_cnt would be
wasteful a bit.


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] mac80211: expose txq queue depth and size to drivers

2016-01-27 Thread Johannes Berg
On Wed, 2016-01-27 at 15:33 +0100, Michal Kazior wrote:
> On 27 January 2016 at 15:26, Johannes Berg  > wrote:
> > On Wed, 2016-01-27 at 15:26 +0100, Michal Kazior wrote:
> > > 
> > > @@ -1294,6 +1298,8 @@ struct sk_buff *ieee80211_tx_dequeue(struct
> > > ieee80211_hw *hw,
> > >   if (!skb)
> > >   goto out;
> > > 
> > > + txqi->byte_cnt -= skb->len;
> > > +
> > >   atomic_dec(&sdata->txqs_len[ac]);
> > > 
> > This *looks* a bit worrying - you have an atomic dec for the # of
> > packets and a non-atomic one for the bytes.
> > 
> > You probably thought about it and I guess it's fine, but can you
> > explain it?
> 
> The atomic was used because it accesses per-vif counters. You can't
> use txqi->queue.lock for that.
> 

Ah. I completely missed that distinction, thanks.

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


[RFC] mac80211: introduce netdev queue control for txqs

2016-01-27 Thread Michal Kazior
Until now all stations (notably in AP mode) would
share 4 AC queues exposed via netdev. This meant
that whenever a single station's AC became full
all other stations' AC were considered full and
stopped as well.

This was suboptimal and could lead to per station
traffic starvation and/or suboptimal Tx
aggregation performance.

The introduced queue control is performed by
mac80211 alone. Additional netdev queues are
created only if driver supports wake_tx_queue()
op.

First 4 netdev queues are used for unclassified
traffic (e.g. when there's no sta_info for given
RA) which is mostly multicast.

All other netdev queues (>=4) are used per
station. Each station gets 4 queues for each AC.
Whenever station's AC-related ieee80211_txqs get
full only that single station's netdev queue is
stopped allowing all other stations (either using
identical AC number or not) to continue submitting
traffic without interruption.

Current implementation supports up to 63
non-overlapping stations. Overlapping stations
will share their per AC netdev queues so whenever
any of overlapping stations' AC queue is stopped
others are stopped as well.

This was designed with MU-MIMO in mind but should
benefit regular Tx aggregation as well because
drivers will now have the ability to avoid
clogging up their internal (be it firmware or
hardware) queues with traffic to slow or
unresponsive stations needlessly.

Note: This can significantly increase memory usage
with, e.g. fq_codel qdisc even up to 20MB per
virtual interface.

Signed-off-by: Michal Kazior 
---
Note: It is recommended to have the following
patch applied in order to avoid conflicts:

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

I'm re-sending this with netdev in Cc as per
Johannes' suggestion.


 net/mac80211/cfg.c |  5 +++
 net/mac80211/ieee80211_i.h | 16 +
 net/mac80211/iface.c   | 21 ++-
 net/mac80211/sta_info.c| 86 --
 net/mac80211/sta_info.h| 11 ++
 net/mac80211/tx.c  | 74 ++-
 net/mac80211/util.c| 35 ---
 net/mac80211/wme.c |  5 +++
 8 files changed, 238 insertions(+), 15 deletions(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 66d22de93c8d..0428c5f68e8c 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1370,6 +1370,11 @@ static int ieee80211_change_station(struct wiphy *wiphy,
prev_4addr = true;
}
 
+   if (local->ops->wake_tx_queue) {
+   sta_info_ndev_free(sta->sdata, sta);
+   sta_info_ndev_init(vlansdata, sta);
+   }
+
sta->sdata = vlansdata;
ieee80211_check_fast_xmit(sta);
 
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index a96f8c0461f6..416bd12f14d2 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -47,6 +47,17 @@ struct ieee80211_local;
  * frame can be up to about 2 kB long. */
 #define TOTAL_MAX_TX_BUFFER 512
 
+/* The number of stations exposed via netdev queues. First 4 netdev queues are
+ * mapped to vif's ACs. Subsequent ones, in groups of 4, are ACs for stations.
+ * NUM_NDEV_STA + 1 station is wrapped around to 1st station. f.e. netdev queue
+ * 5 corresponds to AC1 of STA0, STA63, STA126, ... and queue 8 corresponds
+ * to AC0 of STA1, STA64, STA127, ...
+ *
+ * This is used only when driver implements wake_tx_queues() op.
+ */
+#define IEEE80211_NUM_NDEV_STA 63
+#define IEEE80211_NUM_NDEV_STA_Q (IEEE80211_NUM_NDEV_STA * IEEE80211_NUM_ACS)
+
 /* Required encryption head and tailroom */
 #define IEEE80211_ENCRYPT_HEADROOM 8
 #define IEEE80211_ENCRYPT_TAILROOM 18
@@ -852,7 +863,12 @@ struct ieee80211_sub_if_data {
bool control_port_no_encrypt;
int encrypt_headroom;
 
+   spinlock_t ndev_lock; /* protects access to ndev_sta_idr */
+   DECLARE_BITMAP(ndev_sta_q_stopped, IEEE80211_NUM_NDEV_STA_Q);
+   atomic_t ndev_sta_q_refs[IEEE80211_NUM_NDEV_STA_Q];
+   struct idr ndev_sta_idr;
atomic_t txqs_len[IEEE80211_NUM_ACS];
+
struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS];
struct mac80211_qos_map __rcu *qos_map;
 
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 453b4e741780..d3dae1ae5652 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1094,6 +1094,8 @@ static void ieee80211_teardown_sdata(struct 
ieee80211_sub_if_data *sdata)
 
if (ieee80211_vif_is_mesh(&sdata->vif))
mesh_rmc_free(sdata);
+
+   idr_destroy(&sdata->ndev_sta_idr);
 }
 
 static void ieee80211_uninit(struct net_device *dev)
@@ -1373,6 +1375,7 @@ static void ieee80211_setup_sdata(struct 
ieee80211_sub_if_data *sdata,
 {
static const u8 bssid_wildcard[ETH_ALEN] = {0xff, 0xff, 0xff,
0xff, 0xff, 0xff};
+   int i;
 
/* clear type-dependent u

rtl8xxxu (mac80211) not working with alfa AWUS036NHR v2

2016-01-27 Thread Drunk Cat
problem: it does not connect to any wifi network you can see the time out on 
dmesg

>uname -a
Linux DrunkCatPC 4.4.0-4-MANJARO #1 SMP PREEMPT Wed Jan 20 20:22:31 UTC 2016 
x86_64 GNU/Linux

>lsusb

Bus 002 Device 007: ID 0bda:817f Realtek Semiconductor Corp. RTL8188RU 
802.11n WLAN Adapter

>iwconfig
wlp0s20u1  IEEE 802.11bgn  ESSID:off/any  
  Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm   
  Retry short limit:7   RTS thr=2347 B   Fragment thr:off
  Power Management:off
>dmesg

[16421.696441] usb 2-1: new high-speed USB device number 6 using xhci_hcd
[16423.550427] usb 2-1: Vendor: 11n U
[16423.550433] usb 2-1: Product: US036NHR
[16423.550437] usb 2-1: RTL8188RU rev A (TSMC) 1T1R, TX queues 2, WiFi=1, 
BT=0, GPS=0, HI PA=1
[16423.550439] usb 2-1: RTL8188RU MAC: 00:c0:ca:7e:c7:d3
[16423.550441] usb 2-1: rtl8xxxu: Loading firmware 
rtlwifi/rtl8192cufw_TMSC.bin
[16423.566357] usb 2-1: Firmware revision 80.0 (signature 0x88c1)
[16423.851643] usb 2-1: rtl8xxxu_iqk_path_a: Path A RX IQK failed!
[16423.958287] usbcore: registered new interface driver rtl8xxxu
[16424.016545] rtl8xxxu 2-1:1.0 wlp0s20u1: renamed from wlan0
[16424.032244] IPv6: ADDRCONF(NETDEV_UP): wlp0s20u1: link is not ready
[16424.038160] IPv6: ADDRCONF(NETDEV_UP): wlp0s20u1: link is not ready
[16424.080456] IPv6: ADDRCONF(NETDEV_UP): wlp0s20u1: link is not ready
[16673.335433] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type 
mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[16673.343329] [drm] Module unloaded
[16673.358464] bbswitch: disabling discrete graphics
[16673.358476] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type 
mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[16673.370088] pci :04:00.0: Refused to change power state, currently in 
D0
[16693.345669] bbswitch: enabling discrete graphics
[16693.851919] [drm] Initialized nvidia-drm 0.0.0 20150116 for :04:00.0 
on minor 1
[16693.851926] NVRM: loading NVIDIA UNIX x86_64 Kernel Module  352.63  Sat 
Nov  7 21:25:42 PST 2015
[16693.874719] vgaarb: this pci device is not a vga device
[16693.877519] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type 
mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[16693.877610] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type 
mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[16693.877645] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type 
mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[16693.877680] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type 
mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[16693.877711] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type 
mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[16693.877741] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type 
mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[16693.877796] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type 
mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[16693.877823] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type 
mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[16693.896287] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type 
mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[16694.332278] vgaarb: this pci device is not a vga device
[16754.752107] wlp3s0: deauthenticating from 9c:97:26:0f:0e:8e by local 
choice (Reason: 3=DEAUTH_LEAVING)
[16754.773908] cfg80211: World regulatory domain updated:
[16754.773911] cfg80211:  DFS Master region: unset
[16754.773912] cfg80211:   (start_freq - end_freq @ bandwidth), 
(max_antenna_gain, max_eirp), (dfs_cac_time)
[16754.773913] cfg80211:   (2402000 KHz - 2472000 KHz @ 4 KHz), (N/A, 
2000 mBm), (N/A)
[16754.773915] cfg80211:   (2457000 KHz - 2482000 KHz @ 4 KHz), (N/A, 
2000 mBm), (N/A)
[16754.773916] cfg80211:   (2474000 KHz - 2494000 KHz @ 2 KHz), (N/A, 
2000 mBm), (N/A)
[16754.773917] cfg80211:   (517 KHz - 525 KHz @ 8 KHz, 16 
KHz AUTO), (N/A, 2000 mBm), (N/A)
[16754.773919] cfg80211:   (525 KHz - 533 KHz @ 8 KHz, 16 
KHz AUTO), (N/A, 2000 mBm), (0 s)
[16754.773920] cfg80211:   (549 KHz - 573 KHz @ 16 KHz), (N/A, 
2000 mBm), (0 s)
[16754.773921] cfg80211:   (5735000 KHz - 5835000 KHz @ 8 KHz), (N/A, 
2000 mBm), (N/A)
[16754.773922] cfg80211:   (5724 KHz - 6372 KHz @ 216 KHz), 
(N/A, 0 mBm), (N/A)
[16763.402727] IPv6: ADDRCONF(NETDEV_UP): wlp3s0: link is not ready
[16763.417485] IPv6: ADDRCONF(NETDEV_UP): wlp3s0: link is not ready
[16855.122476] IPv6: ADDRCONF(NETDEV_UP): wlp3s0: link is not ready
[16886.169494] wlp0s20u1: authenticate with 9c:97:26:0f:0e:8e
[16886.178492] wlp0s20u1: send auth to 9c:97:26:0f

Re: [PATCH v2] iwldvm: fix chain gain calibration when firmware return zero values

2016-01-27 Thread Nikolay Martynov
2016-01-27 2:46 GMT-05:00 Grumbach, Emmanuel :
>> Hi
>>
>> 2016-01-26 3:28 GMT-05:00 Grumbach, Emmanuel
>> :
>> >
>> >
>> > On 01/26/2016 12:20 AM, Nikolay Martynov wrote:
>> >> It looks like sometimes firmware returns zero for chain noise and
>> >> signal during calibration period. This seems to be a known problem
>> >> and current implementation accounts for this by ignoring invalid data
>> >> when all chains return zero signal and noise.
>> >>
>> >> The problem is that sometimes firmware returns zero for only one
>> >> chain for some (not all) beacons used for calibration. This leads to
>> >> perfectly valid chains be disabled and may cause invalid gain settings.
>> >> For example this is calibration data taken on laptop with Intel 6300
>> >> card with all three antennas attached:
>> >>
>> >> active_chains: 3
>> >> chain_noise_a: 312
>> >> chain_noise_b: 297
>> >> chain_noise_c: 0
>> >> chain_signal_a:549
>> >> chain_signal_b:513
>> >> chain_signal_c:0
>> >> beacon_count:  16
>> >> disconn_array: 0 0 1
>> >> delta_gain_code:   4 0 0
>> >> radio_write:   1
>> >> state: 3
>> >>
>> >> This patch changes statistics gathering to make sure that zero noise
>> >> results are ignored for valid rx chains. The rationale being that
>> >> even if anntenna is not connected we should be able to see non zero
>> >> noise if rx chain is present.
>> >
>> > But then the firmware will continue to send zero for signal and this
>> > will impact lots of flows like roaming. If the driver allows the
>> > firmware to use that antenna, the firmware may use this antenna for
>> > scanning and roaming will be broken.
>> > This seems to be a bug in the firmware, but there isn't much I can do
>> > about it.
>> > Sorry, I have to NACK this patch.
>>
>>   Could you please elaborate on how this patch would affect roaming or other
>> things. As far as I can see this patch doesn't change much behavior apart
>> from ignoring invalid values from firmware.
>> Disconnected antennas still get disabled (as before) connected antennas still
>> work (more often than before). So I'm not sure I can see how this patch
>> would change what firmware does at all. I really hope you could find a
>> moment and explain this.
>>
>
> What you are saying here is that there is a bug in the firmware which makes 
> it report wrong
> values for one of the antennas. But when you will have this antenna enabled 
> (with your patch),
> the firmware will keep sending bad signal / noise values for it. If the 
> driver allows the firmware
> to use this antenna (after your patch), the firmware will choose this antenna 
> to receive beacons
> or to scan. Then, the driver will look at the beacons' rssi (which will be 
> wrong) and it will think that
> an AP which is very close is in fact far away.
>
No. That is not correct, I think. What I'm saying is that sometimes
(not always) firmware is sending 0 (exactly 0) for signal and noise
for some (or all) chains.
The case when all chains get 0 seem to be a known problem: it is
worked around in iwl_find_disconn_antenna. The case when only one
chain gets zero is not currently handled.
And just to clarify - all chains are affected by this problem, it's
not like one specific chain is broken in some way and gets zero. So
both of the cards I have may be running with 3 chains or with 2 chains
depending on how lucky I'm during initial scan.

It's just firmware that has a bug that sometimes returns zero for
chain 1, sometimes for chain 2, and sometimes for all of them.
So currently driver is already enabling chains for which we may get
zero later for rssi (presumably this is true) if it gets non zero
during scan for first 16 beacons.
Moreover, if it gets non-zero for 15 out of 16 beacons the chain is
not disabled but gain values are wrong because of this - and one chain
would be amplifying things more than it should - this is currently
happening to the best of my understanding.

So my patch filters out results that we know are bad to account for
this firmware bug.
With this patch all chains with antenna attached get signal and noise
reading - suggesting that firmware actually returns zero only some
times and after several retries we get reasonable statistics. It looks
like there are some 'transitioning' processes in firmware and if we
out-wait them we get good statistics.

I'm not sure I see how this patch makes anything more worse than they
currently already are.
Currently it is already (presumably) possible to get wrong rssi
reading because chain that may have been enabled during first scan may
get zeros later. All my patch does is to enable all equivalently good
(or bad) antennas, instead of two equivalently good (or bad) as
current code does.

Does this explanation make an

[PATCH] net/mac80211/agg-rx.c: fix use of uninitialised values

2016-01-27 Thread Chris Bainbridge
Use kzalloc instead of kmalloc for struct tid_ampdu_rx. Fixes:

[7.976605] UBSAN: Undefined behaviour in net/mac80211/rx.c:932:29
[7.976608] load of value 2 is not a valid value for type '_Bool'
[7.976611] CPU: 3 PID: 1134 Comm: kworker/u16:7 Not tainted 4.5.0-rc1+ #265
[7.976613] Hardware name: Apple Inc. MacBookPro10,2/Mac-AFD8A9D944EA4843, 
BIOS MBP102.88Z.0106.B0A.1509130955 09/13/2015
[7.976616] Workqueue: phy0 rt2x00usb_work_rxdone
[7.976619]  0004 880254a7ba50 8181d866 
0007
[7.976622]  880254a7ba78 880254a7ba68 8188422d 
8379b500
[7.976626]  880254a7bab8 81884747 0202 
000348620032
[7.976629] Call Trace:
[7.976633]  [] dump_stack+0x45/0x5f
[7.976637]  [] ubsan_epilogue+0xd/0x40
[7.976642]  [] __ubsan_handle_load_invalid_value+0x67/0x70
[7.976646]  [] 
ieee80211_sta_reorder_release.isra.16+0x5ed/0x730
[7.976650]  [] 
ieee80211_prepare_and_rx_handle+0xd04/0x1c00
[7.976654]  [] ? usb_hcd_map_urb_for_dma+0x65e/0x960
[7.976659]  [] __ieee80211_rx_handle_packet+0x1f3/0x750
[7.976663]  [] ieee80211_rx_napi+0x447/0x990
[7.976667]  [] rt2x00lib_rxdone+0x305/0xbd0
[7.976670]  [] ? dequeue_task_fair+0x64f/0x1de0
[7.976674]  [] ? sched_clock_cpu+0xe6/0x150
[7.976678]  [] rt2x00usb_work_rxdone+0x7c/0x140
[7.976682]  [] process_one_work+0x226/0x860
[7.976686]  [] worker_thread+0x5c/0x680
[7.976690]  [] ? process_one_work+0x860/0x860
[7.976693]  [] kthread+0xf6/0x150
[7.976697]  [] ? kthread_worker_fn+0x310/0x310
[7.976700]  [] ret_from_fork+0x3f/0x70
[7.976703]  [] ? kthread_worker_fn+0x310/0x310

Link: https://lkml.org/lkml/2016/1/26/230
Signed-off-by: Chris Bainbridge 
---
 net/mac80211/agg-rx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c
index 10ad4ac1fa0b..bde3344cbdd0 100644
--- a/net/mac80211/agg-rx.c
+++ b/net/mac80211/agg-rx.c
@@ -291,7 +291,7 @@ void __ieee80211_start_rx_ba_session(struct sta_info *sta,
}
 
/* prepare A-MPDU MLME for Rx aggregation */
-   tid_agg_rx = kmalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL);
+   tid_agg_rx = kzalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL);
if (!tid_agg_rx)
goto end;
 
-- 
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: Move wlan-ng out of staging?

2016-01-27 Thread Kalle Valo
Dan Carpenter  writes:

> On Mon, Jan 25, 2016 at 01:16:56PM +0100, Ksenija Stanojević wrote:
>> Hi All,
>> 
>> I'm helping Greg do a bit of cleanup in the staging tree, I noticed that
>> wlan-ng driver is maybe ready to be moved out of staging. Are there
>> any TODO tasks left to do beside checkpatch.pl clean-up?

For questions like this you should CC linux-wireless.

> I happened to look through this code recently.  It's terrible.

And uses wireless extensions, yuck. There's a lot of work to get it into
reasonable shape, fixing checkpatch warnings will not be enough.

-- 
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 v4 3/3] wlcore/wl12xx: spi: add wifi support to cm-t335

2016-01-27 Thread Tony Lindgren
* Tony Lindgren  [160113 09:28]:
> * Igor Grinberg  [160112 22:01]:
> > Hi Kalle Valo,
> > 
> > On 01/07/16 11:02, Kalle Valo wrote:
> > > Uri Mashiach  writes:
> > > 
> > >> Device tree modifications:
> > >> - Pinmux for SPI0 and WiFi GPIOs.
> > >> - SPI0 node with wlcore as a child node.
> > >>
> > >> Cc: Tony Lindgren 
> > >> Signed-off-by: Uri Mashiach 
> > >> ---
> > 
> > Uri, please document the dependencies next time. Thanks!
> > 
> > >> v1 -> v2: Replace interrupts and interrupt-parent with 
> > >> interrupts-extended.
> > >> v2 -> v3: Move the pinctrl-0 = <&wifi_pins> to the wlcore node.
> > >> v3 -> v4: replace interrupts-extended with interrupts and 
> > >> interrupt-parent. (revert v2 modification).
> > >>   According to Rob Herring and 
> > >> Documentation/devicetree/bindings/interrupt-controller/interrupts.txt,
> > >>interrupts-extended should only be used when a device has multiple 
> > >> interrupt parents.
> > >>
> > >>  arch/arm/boot/dts/am335x-cm-t335.dts | 55 
> > >> 
> > >>  1 file changed, 55 insertions(+)
> > > 
> > > To what tree should this patch go? My wireless-drivers-next tree doesn't
> > > even have this file.
> > 
> > Right. It will hit the mainline during this merge window through Tony's and
> > arm-soc trees.
> > 
> > Do you think it will be sensible if you take 1/3 and 2/3 patches and Tony
> > will take the 3/3 (there is no code dependency between first two and the 
> > last one),
> > or we can just wait till arm-soc hits the mainline, so you will have the
> > needed code?
> 
> Yeah I'll pick the dts changes separately after the merge window as
> there is no dependency to the driver changes.

Applying patch 3/3 into omap-for-v4.6/dt thanks.

Tony
--
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 v4 3/3] wlcore/wl12xx: spi: add wifi support to cm-t335

2016-01-27 Thread Tony Lindgren
* Igor Grinberg  [160112 22:09]:
> 
> 
> On 12/30/15 15:35, Uri Mashiach wrote:
> > Device tree modifications:
> > - Pinmux for SPI0 and WiFi GPIOs.
> > - SPI0 node with wlcore as a child node.
> > 
> > Cc: Tony Lindgren 
> > Signed-off-by: Uri Mashiach 
> 
> Acked-by: Igor Grinberg 

Applying into omap-for-v4.6/dt thanks.

Tony
--
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] ath10k: update 10.4 WMI service map

2016-01-27 Thread Peter Oh
Update 10.4 WMI service map to sync to the latest 10.4 firmware
as of 1/20/2016.

Signed-off-by: Peter Oh 
---
 drivers/net/wireless/ath/ath10k/wmi.h | 13 +
 1 file changed, 13 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index 26a1bb9..90b6581 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -178,6 +178,8 @@ enum wmi_service {
WMI_SERVICE_EXT_RES_CFG_SUPPORT,
WMI_SERVICE_MESH_11S,
WMI_SERVICE_MESH_NON_11S,
+   WMI_SERVICE_RESTRT_CHNL_SUPPORT,
+   WMI_SERVICE_PEER_STATS,
 
/* keep last */
WMI_SERVICE_MAX,
@@ -296,6 +298,9 @@ enum wmi_10_4_service {
WMI_10_4_SERVICE_BSS_CHANNEL_INFO_64,
WMI_10_4_SERVICE_EXT_RES_CFG_SUPPORT,
WMI_10_4_SERVICE_MESH_NON_11S,
+   WMI_10_4_SERVICE_RESTRT_CHNL_SUPPORT,
+   WMI_10_4_SERVICE_PEER_STATS,
+   WMI_10_4_SERVICE_MESH_11S,
 };
 
 static inline char *wmi_service_name(int service_id)
@@ -388,6 +393,8 @@ static inline char *wmi_service_name(int service_id)
SVCSTR(WMI_SERVICE_EXT_RES_CFG_SUPPORT);
SVCSTR(WMI_SERVICE_MESH_11S);
SVCSTR(WMI_SERVICE_MESH_NON_11S);
+   SVCSTR(WMI_SERVICE_RESTRT_CHNL_SUPPORT);
+   SVCSTR(WMI_SERVICE_PEER_STATS);
default:
return NULL;
}
@@ -627,6 +634,12 @@ static inline void wmi_10_4_svc_map(const __le32 *in, 
unsigned long *out,
   WMI_SERVICE_EXT_RES_CFG_SUPPORT, len);
SVCMAP(WMI_10_4_SERVICE_MESH_NON_11S,
   WMI_SERVICE_MESH_NON_11S, len);
+   SVCMAP(WMI_10_4_SERVICE_RESTRT_CHNL_SUPPORT,
+  WMI_SERVICE_RESTRT_CHNL_SUPPORT, len);
+   SVCMAP(WMI_10_4_SERVICE_PEER_STATS,
+  WMI_SERVICE_PEER_STATS, len);
+   SVCMAP(WMI_10_4_SERVICE_MESH_11S,
+  WMI_SERVICE_MESH_11S, len);
 }
 
 #undef SVCMAP
-- 
1.9.1

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


[PATCH 4/4] ath10k: add abstraction layer for vdev subtype

2016-01-27 Thread Peter Oh
Abstraction layer for vdev subtype is added to solve
subtype mismatch and to give flexible compatibility
among different firmware revisions.

For instance, 10.2 and 10.4 firmware has different
definition of their vdev subtypes for Mesh.
10.4 defined subtype 6 for 802.11s Mesh while 10.2 uses 5.
Hence use the abstraction API to get right subtype to use.

Signed-off-by: Peter Oh 
---
 drivers/net/wireless/ath/ath10k/mac.c | 15 ---
 drivers/net/wireless/ath/ath10k/wmi-ops.h | 11 +
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |  1 +
 drivers/net/wireless/ath/ath10k/wmi.c | 70 +++
 drivers/net/wireless/ath/ath10k/wmi.h | 42 ---
 5 files changed, 128 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 2940b00..c9a39ab 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -4345,25 +4345,29 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
   bit, ar->free_vdev_map);
 
arvif->vdev_id = bit;
-   arvif->vdev_subtype = WMI_VDEV_SUBTYPE_NONE;
+   arvif->vdev_subtype =
+   ath10k_wmi_get_vdev_subtype(ar, WMI_VDEV_SUBTYPE_NONE);
 
switch (vif->type) {
case NL80211_IFTYPE_P2P_DEVICE:
arvif->vdev_type = WMI_VDEV_TYPE_STA;
-   arvif->vdev_subtype = WMI_VDEV_SUBTYPE_P2P_DEVICE;
+   arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype
+   (ar, WMI_VDEV_SUBTYPE_P2P_DEVICE);
break;
case NL80211_IFTYPE_UNSPECIFIED:
case NL80211_IFTYPE_STATION:
arvif->vdev_type = WMI_VDEV_TYPE_STA;
if (vif->p2p)
-   arvif->vdev_subtype = WMI_VDEV_SUBTYPE_P2P_CLIENT;
+   arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype
+   (ar, WMI_VDEV_SUBTYPE_P2P_CLIENT);
break;
case NL80211_IFTYPE_ADHOC:
arvif->vdev_type = WMI_VDEV_TYPE_IBSS;
break;
case NL80211_IFTYPE_MESH_POINT:
if (test_bit(WMI_SERVICE_MESH_11S, ar->wmi.svc_map)) {
-   arvif->vdev_subtype = WMI_VDEV_SUBTYPE_MESH_11S;
+   arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype
+   (ar, WMI_VDEV_SUBTYPE_MESH_11S);
} else if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) {
ret = -EINVAL;
ath10k_warn(ar, "must load driver with rawmode=1 to add 
mesh interfaces\n");
@@ -4375,7 +4379,8 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
arvif->vdev_type = WMI_VDEV_TYPE_AP;
 
if (vif->p2p)
-   arvif->vdev_subtype = WMI_VDEV_SUBTYPE_P2P_GO;
+   arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype
+   (ar, WMI_VDEV_SUBTYPE_P2P_GO);
break;
case NL80211_IFTYPE_MONITOR:
arvif->vdev_type = WMI_VDEV_TYPE_MONITOR;
diff --git a/drivers/net/wireless/ath/ath10k/wmi-ops.h 
b/drivers/net/wireless/ath/ath10k/wmi-ops.h
index 8f4f6a8..32ab34e 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-ops.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h
@@ -186,6 +186,8 @@ struct wmi_ops {
u8 enable,
u32 detect_level,
u32 detect_margin);
+   int (*get_vdev_subtype)(struct ath10k *ar,
+   enum wmi_vdev_subtype subtype);
 };
 
 int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id);
@@ -1327,4 +1329,13 @@ ath10k_wmi_pdev_enable_adaptive_cca(struct ath10k *ar, 
u8 enable,
   ar->wmi.cmd->pdev_enable_adaptive_cca_cmdid);
 }
 
+static inline int
+ath10k_wmi_get_vdev_subtype(struct ath10k *ar, enum wmi_vdev_subtype subtype)
+{
+   if (!ar->wmi.ops->get_vdev_subtype)
+   return -EOPNOTSUPP;
+
+   return ar->wmi.ops->get_vdev_subtype(ar, subtype);
+}
+
 #endif
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index 3b3a27b..1085932 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -3483,6 +3483,7 @@ static const struct wmi_ops wmi_tlv_ops = {
.gen_tdls_peer_update = ath10k_wmi_tlv_op_gen_tdls_peer_update,
.gen_adaptive_qcs = ath10k_wmi_tlv_op_gen_adaptive_qcs,
.fw_stats_fill = ath10k_wmi_main_op_fw_stats_fill,
+   .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
 };
 
 static const struct wmi_peer_flags_map wmi_tlv_peer_flags_map = {
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/driv

[PATCH 3/4] ath10k: use vif->type and vif->p2p for P2P_GO check

2016-01-27 Thread Peter Oh
Interface type P2P_GO can be checked by either arvif->vdev_type
and arvif->vdev_subtype or vif->type and vif->p2p.
Use later one to avoid more cpu consumption that could happen
when subtype abstraction layer change is introduced.

Signed-off-by: Peter Oh 
---
 drivers/net/wireless/ath/ath10k/mac.c | 8 ++--
 drivers/net/wireless/ath/ath10k/wmi.c | 2 +-
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 6bf5c91..2940b00 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1358,10 +1358,7 @@ static int ath10k_mac_setup_bcn_p2p_ie(struct ath10k_vif 
*arvif,
const u8 *p2p_ie;
int ret;
 
-   if (arvif->vdev_type != WMI_VDEV_TYPE_AP)
-   return 0;
-
-   if (arvif->vdev_subtype != WMI_VDEV_SUBTYPE_P2P_GO)
+   if (arvif->vif->type != NL80211_IFTYPE_AP || !arvif->vif->p2p)
return 0;
 
mgmt = (void *)bcn->data;
@@ -3259,8 +3256,7 @@ static void ath10k_tx_h_add_p2p_noa_ie(struct ath10k *ar,
struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
 
/* This is case only for P2P_GO */
-   if (arvif->vdev_type != WMI_VDEV_TYPE_AP ||
-   arvif->vdev_subtype != WMI_VDEV_SUBTYPE_P2P_GO)
+   if (vif->type != NL80211_IFTYPE_AP || !vif->p2p)
return;
 
if (unlikely(ieee80211_is_probe_resp(hdr->frame_control))) {
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index a7c3d29..723fb9bc 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -3184,7 +3184,7 @@ static void ath10k_wmi_update_noa(struct ath10k *ar, 
struct ath10k_vif *arvif,
  struct sk_buff *bcn,
  const struct wmi_p2p_noa_info *noa)
 {
-   if (arvif->vdev_subtype != WMI_VDEV_SUBTYPE_P2P_GO)
+   if (!arvif->vif->p2p)
return;
 
ath10k_dbg(ar, ATH10K_DBG_MGMT, "noa changed: %d\n", noa->changed);
-- 
1.9.1

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


[PATCH 1/4] ath10k: rename Mesh related service names

2016-01-27 Thread Peter Oh
WMI_10_4_SERVICE_MESH bit is for non IEEE802.11s Mesh.
Hence rename it to WMI_10_4_SERVICE_MESH_NON_11S.
Also add _11S as post-fix to each of WMI_SERVICE_MESH and
WMI_VDEV_SUBTYPE_MESH specifying the service is for 11s Mesh.
This will help users to distinguish 11s Mesh from non 11s Mesh.

Signed-off-by: Peter Oh 
---
 drivers/net/wireless/ath/ath10k/mac.c |  4 ++--
 drivers/net/wireless/ath/ath10k/wmi.h | 16 +---
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 6146a29..6bf5c91 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -4366,8 +4366,8 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
arvif->vdev_type = WMI_VDEV_TYPE_IBSS;
break;
case NL80211_IFTYPE_MESH_POINT:
-   if (test_bit(WMI_SERVICE_MESH, ar->wmi.svc_map)) {
-   arvif->vdev_subtype = WMI_VDEV_SUBTYPE_MESH;
+   if (test_bit(WMI_SERVICE_MESH_11S, ar->wmi.svc_map)) {
+   arvif->vdev_subtype = WMI_VDEV_SUBTYPE_MESH_11S;
} else if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) {
ret = -EINVAL;
ath10k_warn(ar, "must load driver with rawmode=1 to add 
mesh interfaces\n");
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index d85ad78..26a1bb9 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -176,7 +176,8 @@ enum wmi_service {
WMI_SERVICE_AUX_CHAN_LOAD_INTF,
WMI_SERVICE_BSS_CHANNEL_INFO_64,
WMI_SERVICE_EXT_RES_CFG_SUPPORT,
-   WMI_SERVICE_MESH,
+   WMI_SERVICE_MESH_11S,
+   WMI_SERVICE_MESH_NON_11S,
 
/* keep last */
WMI_SERVICE_MAX,
@@ -294,7 +295,7 @@ enum wmi_10_4_service {
WMI_10_4_SERVICE_AUX_CHAN_LOAD_INTF,
WMI_10_4_SERVICE_BSS_CHANNEL_INFO_64,
WMI_10_4_SERVICE_EXT_RES_CFG_SUPPORT,
-   WMI_10_4_SERVICE_MESH,
+   WMI_10_4_SERVICE_MESH_NON_11S,
 };
 
 static inline char *wmi_service_name(int service_id)
@@ -385,7 +386,8 @@ static inline char *wmi_service_name(int service_id)
SVCSTR(WMI_SERVICE_AUX_CHAN_LOAD_INTF);
SVCSTR(WMI_SERVICE_BSS_CHANNEL_INFO_64);
SVCSTR(WMI_SERVICE_EXT_RES_CFG_SUPPORT);
-   SVCSTR(WMI_SERVICE_MESH);
+   SVCSTR(WMI_SERVICE_MESH_11S);
+   SVCSTR(WMI_SERVICE_MESH_NON_11S);
default:
return NULL;
}
@@ -460,7 +462,7 @@ static inline void wmi_10x_svc_map(const __le32 *in, 
unsigned long *out,
SVCMAP(WMI_10X_SERVICE_BSS_CHANNEL_INFO_64,
   WMI_SERVICE_BSS_CHANNEL_INFO_64, len);
SVCMAP(WMI_10X_SERVICE_MESH,
-  WMI_SERVICE_MESH, len);
+  WMI_SERVICE_MESH_11S, len);
SVCMAP(WMI_10X_SERVICE_EXT_RES_CFG_SUPPORT,
   WMI_SERVICE_EXT_RES_CFG_SUPPORT, len);
 }
@@ -623,8 +625,8 @@ static inline void wmi_10_4_svc_map(const __le32 *in, 
unsigned long *out,
   WMI_SERVICE_BSS_CHANNEL_INFO_64, len);
SVCMAP(WMI_10_4_SERVICE_EXT_RES_CFG_SUPPORT,
   WMI_SERVICE_EXT_RES_CFG_SUPPORT, len);
-   SVCMAP(WMI_10_4_SERVICE_MESH,
-  WMI_SERVICE_MESH, len);
+   SVCMAP(WMI_10_4_SERVICE_MESH_NON_11S,
+  WMI_SERVICE_MESH_NON_11S, len);
 }
 
 #undef SVCMAP
@@ -4275,7 +4277,7 @@ enum wmi_vdev_subtype {
WMI_VDEV_SUBTYPE_P2P_CLIENT = 2,
WMI_VDEV_SUBTYPE_P2P_GO = 3,
WMI_VDEV_SUBTYPE_PROXY_STA  = 4,
-   WMI_VDEV_SUBTYPE_MESH   = 5,
+   WMI_VDEV_SUBTYPE_MESH_11S   = 5,
 };
 
 /* values for vdev_subtype */
-- 
1.9.1

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


[PATCH 0/4] ath10k: rename mesh and add abstraction layer

2016-01-27 Thread Peter Oh
Split Mesh service to 11s Mesh and non-11s Mesh according to
firmware service bit to help users distinguish 11s Mesh from
non 11s Mesh.
And add abstraction layer for vdev subtype to solve subtype mismatch
and to give flexible compatibility among different firmware revisions.

Peter Oh (4):
  ath10k: rename Mesh related service names
  ath10k: update 10.4 WMI service map
  ath10k: use vif->type and vif->p2p for P2P_GO check
  ath10k: add abstraction layer for vdev subtype

 drivers/net/wireless/ath/ath10k/mac.c | 25 +--
 drivers/net/wireless/ath/ath10k/wmi-ops.h | 11 +
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |  1 +
 drivers/net/wireless/ath/ath10k/wmi.c | 72 ++-
 drivers/net/wireless/ath/ath10k/wmi.h | 69 +++--
 5 files changed, 153 insertions(+), 25 deletions(-)

-- 
1.9.1

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


Re: [PATCH 4/4] ath10k: add abstraction layer for vdev subtype

2016-01-27 Thread Ben Greear

On 01/27/2016 10:55 AM, Peter Oh wrote:

Abstraction layer for vdev subtype is added to solve
subtype mismatch and to give flexible compatibility
among different firmware revisions.

For instance, 10.2 and 10.4 firmware has different
definition of their vdev subtypes for Mesh.
10.4 defined subtype 6 for 802.11s Mesh while 10.2 uses 5.
Hence use the abstraction API to get right subtype to use.

Signed-off-by: Peter Oh 
---
  drivers/net/wireless/ath/ath10k/mac.c | 15 ---
  drivers/net/wireless/ath/ath10k/wmi-ops.h | 11 +
  drivers/net/wireless/ath/ath10k/wmi-tlv.c |  1 +
  drivers/net/wireless/ath/ath10k/wmi.c | 70 +++
  drivers/net/wireless/ath/ath10k/wmi.h | 42 ---
  5 files changed, 128 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 2940b00..c9a39ab 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -4345,25 +4345,29 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
   bit, ar->free_vdev_map);

arvif->vdev_id = bit;
-   arvif->vdev_subtype = WMI_VDEV_SUBTYPE_NONE;
+   arvif->vdev_subtype =
+   ath10k_wmi_get_vdev_subtype(ar, WMI_VDEV_SUBTYPE_NONE);

switch (vif->type) {
case NL80211_IFTYPE_P2P_DEVICE:
arvif->vdev_type = WMI_VDEV_TYPE_STA;
-   arvif->vdev_subtype = WMI_VDEV_SUBTYPE_P2P_DEVICE;
+   arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype
+   (ar, WMI_VDEV_SUBTYPE_P2P_DEVICE);


Would it maybe be simpler code to just assign these types to the ar struct at
firmware init time.  And then do something like:

arvif->vdev_subtype = ar->p2p_subtype;

Or even maybe:

arvif->vdev_subtype = ar->subtype_for_viftype[vif->type];

I'm not sure how much it matters, but in general I find the abstraction in
ath10k makes it hard to read through the code.

Thanks,
Ben

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

--
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] hostap: avoid uninitialized variable use in hfa384x_get_rid

2016-01-27 Thread Russell King - ARM Linux
On Wed, Jan 27, 2016 at 02:45:26PM +0100, Arnd Bergmann wrote:
> To ensure we get consistent error handling here, this changes the code
> to only set rlen if we actually read data correctly, which also takes
> care of the warning.

It may be a good idea to do the job better.  Looking at the code:

struct hfa384x_rid_hdr rec;

spin_lock_bh(&local->baplock);

res = hfa384x_setup_bap(dev, BAP0, rid, 0);
if (!res)
res = hfa384x_from_bap(dev, BAP0, &rec, sizeof(rec));

The only thing which initialises any of "rec" is that function call.
The following lines are:

if (le16_to_cpu(rec.len) == 0) {
/* RID not available */
res = -ENODATA;
}

rlen = (le16_to_cpu(rec.len) - 1) * 2;

So, why give the compiler a hard time as you're doing, why make the code
harder to read.  What's wrong with:

spin_lock_bh(&local->baplock);

res = hfa384x_setup_bap(dev, BAP0, rid, 0);
if (res)
goto unlock;

res = hfa384x_from_bap(dev, BAP0, &rec, sizeof(rec));
if (res)
goto unlock;

if (le16_to_cpu(rec.len) == 0) {
/* RID not available */
res = -ENODATA;
goto unlock;
}

rlen = (le16_to_cpu(rec.len) - 1) * 2;
if (exact_len && rlen != len) {
printk(KERN_DEBUG "%s: hfa384x_get_rid - RID len mismatch: 
rid=0x%04x, len=%d (expected %d)\n",
   dev->name, rid, rlen, len);
res = -ENODATA;
goto unlock;
}

res = hfa384x_from_bap(dev, BAP0, buf, len);
unlock:
spin_unlock_bh(&local->baplock);

?

-- 
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/4] ath10k: rename mesh and add abstraction layer

2016-01-27 Thread Bob Copeland
On Wed, Jan 27, 2016 at 10:55:53AM -0800, Peter Oh wrote:
> Split Mesh service to 11s Mesh and non-11s Mesh according to
> firmware service bit to help users distinguish 11s Mesh from
> non 11s Mesh.
> And add abstraction layer for vdev subtype to solve subtype mismatch
> and to give flexible compatibility among different firmware revisions.

Out of curiosity, which non-11s mesh, if you can share?

-- 
Bob Copeland %% http://bobcopeland.com/
--
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 RESEND net] nfc: use GFP_USER for user-controlled kmalloc

2016-01-27 Thread Cong Wang
On Tue, Jan 26, 2016 at 6:23 PM, Eric Dumazet  wrote:
> On Tue, 2016-01-26 at 15:12 -0800, Cong Wang wrote:
>> On Tue, Jan 26, 2016 at 2:55 PM, Julian Calaby  
>> wrote:
>> > Hi Cong,
>> >
>> > On Wed, Jan 27, 2016 at 4:53 AM, Cong Wang  
>> > wrote:
>> >
>> > A commit message would be nice. A brief rundown of how this is called
>> > from userspace would be nice (I'm talking a single sentence here, e.g.
>> > "this is allocated when submitting a nfc packet") and what issue
>> > __GFP_NOWARN is fixing. (I'm guessing log spam due to allocation
>> > failures.)
>> >
>>
>> I thought it is obvious. ;) Keep in mind that $subject is one part of commit
>> message too, so there is a commit message although very short.
>>
>> I will add it.
>
>
> BTW, kzalloc() is useless here, since it is followed by
>
> if (memcpy_from_msg(msg_data, msg, len)) {

Hmm? I think nfc_llcp_send_ui_frame() needs to do some fragmention
with this temporary memory, or you are saying msg_iter has some
API available to seek the pointer? Even if so, it doesn't look like
suitable for -stable.

>
> Also, this file seems to have two spots with the same problem,
> in nfc_llcp_send_ui_frame() & nfc_llcp_send_i_frame()
>

Ah, yes, I missed nfc_llcp_send_i_frame().
--
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 RESEND net] nfc: use GFP_USER for user-controlled kmalloc

2016-01-27 Thread Eric Dumazet
On Wed, 2016-01-27 at 11:50 -0800, Cong Wang wrote:

> Hmm? I think nfc_llcp_send_ui_frame() needs to do some fragmention
> with this temporary memory, or you are saying msg_iter has some
> API available to seek the pointer? Even if so, it doesn't look like
> suitable for -stable.
> 

memcpy_from_msg(msg_data, msg, len) will overwrite the msg_data with len
bytes, or return an error.

So prior msg_data content does not matter.

kzalloc() before a memset() or memcpy() sounds defensive programming,
kmalloc() is a bit faster.



--
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/4] ath10k: add abstraction layer for vdev subtype

2016-01-27 Thread Peter Oh


On 01/27/2016 11:11 AM, Ben Greear wrote:

On 01/27/2016 10:55 AM, Peter Oh wrote:

Abstraction layer for vdev subtype is added to solve
subtype mismatch and to give flexible compatibility
among different firmware revisions.

For instance, 10.2 and 10.4 firmware has different
definition of their vdev subtypes for Mesh.
10.4 defined subtype 6 for 802.11s Mesh while 10.2 uses 5.
Hence use the abstraction API to get right subtype to use.

Signed-off-by: Peter Oh 
---
  drivers/net/wireless/ath/ath10k/mac.c | 15 ---
  drivers/net/wireless/ath/ath10k/wmi-ops.h | 11 +
  drivers/net/wireless/ath/ath10k/wmi-tlv.c |  1 +
  drivers/net/wireless/ath/ath10k/wmi.c | 70

+++

drivers/net/wireless/ath/ath10k/wmi.h | 42 ---
  5 files changed, 128 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c

b/drivers/net/wireless/ath/ath10k/mac.c

index 2940b00..c9a39ab 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -4345,25 +4345,29 @@ static int ath10k_add_interface(struct

ieee80211_hw *hw,

 bit, ar->free_vdev_map);

  arvif->vdev_id = bit;
-arvif->vdev_subtype = WMI_VDEV_SUBTYPE_NONE;
+arvif->vdev_subtype =
+ath10k_wmi_get_vdev_subtype(ar, WMI_VDEV_SUBTYPE_NONE);

  switch (vif->type) {
  case NL80211_IFTYPE_P2P_DEVICE:
  arvif->vdev_type = WMI_VDEV_TYPE_STA;
-arvif->vdev_subtype = WMI_VDEV_SUBTYPE_P2P_DEVICE;
+arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype
+(ar, WMI_VDEV_SUBTYPE_P2P_DEVICE);


Would it maybe be simpler code to just assign these types to the ar 
struct

at
firmware init time.  And then do something like:

arvif->vdev_subtype = ar->p2p_subtype;
Maintaining a variable per subtype doesn't look good since a variable 
can cover subtypes.


Or even maybe:

arvif->vdev_subtype = ar->subtype_for_viftype[vif->type];
if you take a look the abstraction layer, there is different index 
indicating the same subtype.
In that case, your suggestion also needs to maintaining different array 
per FW version which is the same amount of work as this patch.


I'm not sure how much it matters, but in general I find the 
abstraction in

ath10k makes it hard to read through the code.
It cannot help avoiding use it since ath10k supports different chipsets 
and firmware IMO.


Thanks,
Ben



--
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: [RFC V4 1/2] nl80211: add feature for BSS selection support

2016-01-27 Thread Arend van Spriel


On 26-1-2016 14:56, Johannes Berg wrote:
> On Tue, 2016-01-26 at 14:06 +0100, Arend van Spriel wrote:
>>  
>> + * @behaviour: requested BSS selection behaviour.
>> + * @param: parameters for requestion behaviour.
>> + * @band_pref: preferred band for
>> %NL80211_BSS_SELECT_ATTR_BAND_PREF.
>> + * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.
> 
> Sadly, I don't think this works with kernel-doc. You'd have to split it
> out into a named union to get this working properly.

Yeah. I did not run kernel-doc. Will look into it.

>> +/**
>> + * enum nl80211_bss_select_attr - attributes for bss selection.
>> + *
>> + * @__NL80211_BSS_SELECT_ATTR_INVALID: reserved.
>> + * @NL80211_BSS_SELECT_ATTR_RSSI: Flag indicating only RSSI-based BSS 
>> selection
>> + * is requested.
>> + * @NL80211_BSS_SELECT_ATTR_BAND_PREF: attribute indicating BSS
>> + *> > selection should be done such that the specified band is 
>> preferred.
>> + *> > When there are multiple BSS-es in the preferred band, the 
>> driver
>> + *> > shall use RSSI-based BSS selection as a second step. The 
>> value of
>> + *> > this attribute is according to &enum nl80211_band (u32).
>> + * @NL80211_BSS_SELECT_ATTR_RSSI_ADJUST: When present the RSSI level for
>> + *> > BSS-es in the specified band is to be adjusted before doing
>> + *> > RSSI-based BSS selection. The attribute value is a packed 
>> two-byte
>> + *> > value. The lower byte contains the adjustment value (s8) and 
>> the
>> + *  high byte contains the band according &enum nl80211_band.
> 
> I think it might be nicer to define an explicit struct for this, then
> you don't have to use u8 for the band in one attribute and u32 for the
> band in the other attribute either.
> 
> As long as there's no u64 in the struct that's pretty much safe - if
> u64 is needed use compat_u64 :)

So you mean mapping the explicit structure over the nla_data()?

>> + * @NL80211_BSS_SELECT_ATTR_MAX: highest bss select attribute number.
>> + *@__NL80211_BSS_SELECT_ATTR_AFTER_LAST: internal use.
>> + *
>> + * These attributes are found within %NL80211_ATTR_BSS_SELECT and
>> + * indicate the required BSS selection behaviour which the driver
>> + * should use.
> 
> You should probably indicate that only a single one can ever be
> specified?

Realized that was missing indeed. Will add it.

>> +static const struct nla_policy
>> +nl80211_bss_select_policy[NL80211_BSS_SELECT_ATTR_MAX + 1] = {
>> +[NL80211_BSS_SELECT_ATTR_RSSI] = { .type = NLA_FLAG },
>> +[NL80211_BSS_SELECT_ATTR_BAND_PREF] = { .type = NLA_U32 },
>> +[NL80211_BSS_SELECT_ATTR_RSSI_ADJUST] = { .type = NLA_U8 },
> 
> The RSSI_ADJUST here seems wrong in any case? Should've been NLA_U16
> now?

It should have, yes.

>> @@ -5753,6 +5778,42 @@ static int validate_scan_freqs(struct nlattr
>> *freqs)
>>  return n_channels;
>>  }
>>  
>> +static int parse_bss_select(struct nlattr *nla,
>> +struct cfg80211_bss_selection
>> *bss_select)
>> +{
>> +struct nlattr *attr[NL80211_BSS_SELECT_ATTR_MAX + 1];
>> +u16 band_delta;
>> +int err;
> 
> This should perhaps reject specification of multiple attributes, since
> otherwise the order of the code here dictates which one "wins".

I was waiting for your opinion on this as it did not feel right to me
either.

> But these are small things - looks good!

Thanks. Will work on final patch (famous last words).

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: [PATCH 0/4] ath10k: rename mesh and add abstraction layer

2016-01-27 Thread Peter Oh


On 01/27/2016 11:39 AM, Bob Copeland wrote:

On Wed, Jan 27, 2016 at 10:55:53AM -0800, Peter Oh wrote:

Split Mesh service to 11s Mesh and non-11s Mesh according to
firmware service bit to help users distinguish 11s Mesh from
non 11s Mesh.
And add abstraction layer for vdev subtype to solve subtype mismatch
and to give flexible compatibility among different firmware revisions.

Out of curiosity, which non-11s mesh, if you can share?

non-11s Mesh can be anything, but 11s Mesh such as meraki mesh.




--
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: Delivery Status Notification (Failure)

2016-01-27 Thread André Vitor
Hi all,

I'm having trouble with driver r8xxxu. My device has a realtek usb
wifi+bt combo (0bda:0724) built-in.
I can connect to a wifi network but if I open something that uses
connections the driver stops working with a mac80211 crash message.

OS used is Android-x86 with kernel 4.4.0.

I'm also CC'ing the driver's author as I contacted him earlier.

dmesg >
[   34.641610] [ cut here ]
[   34.641701] WARNING: CPU: 0 PID: 0 at
/home/andre64/m-x86/kernel/net/mac80211/rx.c:3619
ieee80211_rx_napi+0x63/0x60f [mac80211]()
[   34.641709] Modules linked in: hid_sensor_accel_3d hid_sensor_als
hid_sensor_magn_3d hid_sensor_incl_3d hid_sensor_rotation
hid_sensor_gyro_3d hid_sensor_trigger industrialio_triggered_buffer
kfifo_buf industrialio hid_sensor_iio_common hid_sensor_custom mac_hid
rtl8xxxu mac80211 cfg80211 atkbd pcspkr efivars snd_hda_codec_hdmi
snd_hda_codec_realtek snd_hda_codec_generic i2c_i801 lpc_ich
snd_hda_intel snd_hda_codec snd_hda_core snd_hwdep i915 drm_kms_helper
drm fb_sys_fops sysfillrect syscopyarea sysimgblt i2c_algo_bit
hid_sensor_hub hid_multitouch dw_dmac dw_dmac_core i2c_hid
i2c_designware_platform i2c_designware_core snd_soc_sst_acpi 8250_dw
pwm_lpss_platform pwm_lpss snd_soc_rt5640 snd_soc_rl6231 snd_soc_core
snd_compress snd_pcm_dmaengine snd_pcm snd_timer snd soundcore
ac97_bus
[   34.641852] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.0-android-x86+ #2
[   34.641859] Hardware name: Zmax B10T/B10T, BIOS 5.6.5 11/22/2013
[   34.641867]   c14e8b20  c103bae0 f91a9291 0e23
da4467c0 f637c7f8
[   34.641887]  f637c7e8 f637c420 c103bb58 0009  f91a9291
f553b501 
[   34.641906]  dee010b4  f82f815c f3f1e800 dee010b8 d48231d8
f637c420 
[   34.641925] Call Trace:
[   34.641944]  [] ? dump_stack+0x45/0x65
[   34.641958]  [] ? warn_slowpath_common+0x8a/0x9f
[   34.642030]  [] ? ieee80211_rx_napi+0x63/0x60f [mac80211]
[   34.642042]  [] ? warn_slowpath_null+0xd/0x10
[   34.642114]  [] ? ieee80211_rx_napi+0x63/0x60f [mac80211]
[   34.642178]  [] ? ieee80211_tasklet_handler+0x4f/0x8e [mac80211]
[   34.642190]  [] ? tasklet_action+0x78/0x81
[   34.642201]  [] ? __do_softirq+0xb9/0x21c
[   34.642213]  [] ? __tasklet_hrtimer_trampoline+0x27/0x27
[   34.642225]  [] ? do_softirq_own_stack+0x1a/0x1f
[   34.642231][] ? irq_exit+0x31/0x70
[   34.642278]  [] ? do_IRQ+0x88/0x99
[   34.642292]  [] ? common_interrupt+0x29/0x30
[   34.642306]  [] ? cpuidle_enter_state+0x16a/0x2a7
[   34.642319]  [] ? cpu_startup_entry+0x197/0x280
[   34.642332]  [] ? start_kernel+0x35b/0x35e
[   34.642340] ---[ end trace 2226f818bc03f025 ]---
[   34.844354] [ cut here ]
[   34.844407] WARNING: CPU: 0 PID: 7 at
/home/andre64/m-x86/kernel/net/mac80211/rx.c:3619
ieee80211_rx_napi+0x63/0x60f [mac80211]()
[   34.844412] Modules linked in: hid_sensor_accel_3d hid_sensor_als
hid_sensor_magn_3d hid_sensor_incl_3d hid_sensor_rotation
hid_sensor_gyro_3d hid_sensor_trigger industrialio_triggered_buffer
kfifo_buf industrialio hid_sensor_iio_common hid_sensor_custom mac_hid
rtl8xxxu mac80211 cfg80211 atkbd pcspkr efivars snd_hda_codec_hdmi
snd_hda_codec_realtek snd_hda_codec_generic i2c_i801 lpc_ich
snd_hda_intel snd_hda_codec snd_hda_core snd_hwdep i915 drm_kms_helper
drm fb_sys_fops sysfillrect syscopyarea sysimgblt i2c_algo_bit
hid_sensor_hub hid_multitouch dw_dmac dw_dmac_core i2c_hid
i2c_designware_platform i2c_designware_core snd_soc_sst_acpi 8250_dw
pwm_lpss_platform pwm_lpss snd_soc_rt5640 snd_soc_rl6231 snd_soc_core
snd_compress snd_pcm_dmaengine snd_pcm snd_timer snd soundcore
ac97_bus
[   34.844494] CPU: 0 PID: 7 Comm: rcu_preempt Tainted: GW
  4.4.0-android-x86+ #2
[   34.844498] Hardware name: Zmax B10T/B10T, BIOS 5.6.5 11/22/2013
[   34.844502]   c14e8b20  c103bae0 f91a9291 0e23
d4ae3880 f637c7f8
[   34.844514]  f637c7e8 f637c420 c103bb58 0009  f91a9291
f553b501 
[   34.844524]  da4bdeb4  f82f815c f3f1e800 da4bdeb8 d4ae54d8
f3f45340 00200282
[   34.844535] Call Trace:
[   34.844548]  [] ? dump_stack+0x45/0x65
[   34.844556]  [] ? warn_slowpath_common+0x8a/0x9f
[   34.844595]  [] ? ieee80211_rx_napi+0x63/0x60f [mac80211]
[   34.844602]  [] ? warn_slowpath_null+0xd/0x10
[   34.844641]  [] ? ieee80211_rx_napi+0x63/0x60f [mac80211]
[   34.844676]  [] ? ieee80211_tasklet_handler+0x4f/0x8e [mac80211]
[   34.844682]  [] ? tasklet_action+0x78/0x81
[   34.844688]  [] ? __do_softirq+0xb9/0x21c
[   34.844695]  [] ? __tasklet_hrtimer_trampoline+0x27/0x27
[   34.844702]  [] ? do_softirq_own_stack+0x1a/0x1f
[   34.844705][] ? irq_exit+0x31/0x70
[   34.844714]  [] ? do_IRQ+0x88/0x99
[   34.844722]  [] ? common_interrupt+0x29/0x30
[   34.844730]  [] ? run_timer_softirq+0x1ec/0x1ec
[   34.844737]  [] ? schedule_timeout+0x58/0x192
[   34.844742]  [] ? detach_if_pending+0xad/0xad
[   34.844750]  [] ? prepare_to_wait_event+0x9d/0xa5
[   34.844757]  [] ? rcu_gp_kthread+0x415/0x6d6
[ 

Re: Move wlan-ng out of staging?

2016-01-27 Thread Julian Calaby
Hi Glen,

On Thu, Jan 28, 2016 at 5:27 AM, Kalle Valo  wrote:
> Dan Carpenter  writes:
>
>> On Mon, Jan 25, 2016 at 01:16:56PM +0100, Ksenija Stanojević wrote:
>>> Hi All,
>>>
>>> I'm helping Greg do a bit of cleanup in the staging tree, I noticed that
>>> wlan-ng driver is maybe ready to be moved out of staging. Are there
>>> any TODO tasks left to do beside checkpatch.pl clean-up?
>
> For questions like this you should CC linux-wireless.
>
>> I happened to look through this code recently.  It's terrible.
>
> And uses wireless extensions, yuck. There's a lot of work to get it into
> reasonable shape, fixing checkpatch warnings will not be enough.

On the same subject, the wilc1000 driver has taken some pretty big
steps in the past few days, how far away do you think it is from
graduating from staging?

Thanks,

-- 
Julian Calaby

Email: julian.cal...@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
--
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/5] brcmfmac: access PMU registers using standalone PMU core if available

2016-01-27 Thread Julian Calaby
Hi Kbuild Test Robot Guys,

On Thu, Jan 28, 2016 at 12:08 AM, Rafał Miłecki  wrote:
> On 27 January 2016 at 13:27, Kalle Valo  wrote:
>> kbuild test robot  writes:
>>
>>> Hi Rafał,
>>>
>>> [auto build test ERROR on wireless-drivers/master]
>>> [also build test ERROR on v4.5-rc1 next-20160125]
>>> [if your patch is applied to the wrong git tree, please drop us a note to 
>>> help improving the system]
>>>
>>> url:
>>> https://github.com/0day-ci/linux/commits/Rafa-Mi-ecki/brcmfmac-support-for-new-14e43-4365-card-with-BCM4366/20160127-010149
>>> base:   
>>> https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git 
>>> master
>>> config: x86_64-allmodconfig (attached as .config)
>>> reproduce:
>>> # save the attached .config to linux build tree
>>> make ARCH=x86_64
>>>
>>> All errors (new ones prefixed by >>):
>>>
>>>drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c: In function 
>>> 'brcmf_chip_get_pmu':
>>>>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c:1143:25: error: 
>>>>> 'BCMA_CC_CAP_EXT_AOB_PRESENT' undeclared (first use in this function)
>>>  pub->cc_caps_ext & BCMA_CC_CAP_EXT_AOB_PRESENT) {
>>> ^
>>>drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c:1143:25: note: 
>>> each undeclared identifier is reported only once for each function it 
>>> appears in
>>
>> I think this error was as expected because this set depends on "bcma:
>> support PMU present as separated bus core" which is not yet applied.
>
> Yes, builbot simply couldn't know about this, but I should have reply
> to make it clear I guess.

Is there any way to communicate to the test robot that this series
depends on some other series or patch?

Thanks,

-- 
Julian Calaby

Email: julian.cal...@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
--
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: Move wlan-ng out of staging?

2016-01-27 Thread Greg KH
On Thu, Jan 28, 2016 at 09:48:16AM +1100, Julian Calaby wrote:
> Hi Glen,
> 
> On Thu, Jan 28, 2016 at 5:27 AM, Kalle Valo  wrote:
> > Dan Carpenter  writes:
> >
> >> On Mon, Jan 25, 2016 at 01:16:56PM +0100, Ksenija Stanojević wrote:
> >>> Hi All,
> >>>
> >>> I'm helping Greg do a bit of cleanup in the staging tree, I noticed that
> >>> wlan-ng driver is maybe ready to be moved out of staging. Are there
> >>> any TODO tasks left to do beside checkpatch.pl clean-up?
> >
> > For questions like this you should CC linux-wireless.
> >
> >> I happened to look through this code recently.  It's terrible.
> >
> > And uses wireless extensions, yuck. There's a lot of work to get it into
> > reasonable shape, fixing checkpatch warnings will not be enough.
> 
> On the same subject, the wilc1000 driver has taken some pretty big
> steps in the past few days, how far away do you think it is from
> graduating from staging?

I have 221 patches in my to-apply queue to be merged for this driver, at
the very least, those need to be merged before anyone should review it
for graduation.  That number also implies that there is still quite a
lot to be done, but I would not know for sure until that happens.

thanks,

greg k-h
--
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] net/mac80211/agg-rx.c: fix use of uninitialised values

2016-01-27 Thread Julian Calaby
Hi Chris,

On Thu, Jan 28, 2016 at 2:46 AM, Chris Bainbridge
 wrote:
> Use kzalloc instead of kmalloc for struct tid_ampdu_rx. Fixes:
>
> [7.976605] UBSAN: Undefined behaviour in net/mac80211/rx.c:932:29
> [7.976608] load of value 2 is not a valid value for type '_Bool'
> [7.976611] CPU: 3 PID: 1134 Comm: kworker/u16:7 Not tainted 4.5.0-rc1+ 
> #265
> [7.976613] Hardware name: Apple Inc. MacBookPro10,2/Mac-AFD8A9D944EA4843, 
> BIOS MBP102.88Z.0106.B0A.1509130955 09/13/2015
> [7.976616] Workqueue: phy0 rt2x00usb_work_rxdone
> [7.976619]  0004 880254a7ba50 8181d866 
> 0007
> [7.976622]  880254a7ba78 880254a7ba68 8188422d 
> 8379b500
> [7.976626]  880254a7bab8 81884747 0202 
> 000348620032
> [7.976629] Call Trace:
> [7.976633]  [] dump_stack+0x45/0x5f
> [7.976637]  [] ubsan_epilogue+0xd/0x40
> [7.976642]  [] 
> __ubsan_handle_load_invalid_value+0x67/0x70
> [7.976646]  [] 
> ieee80211_sta_reorder_release.isra.16+0x5ed/0x730
> [7.976650]  [] 
> ieee80211_prepare_and_rx_handle+0xd04/0x1c00
> [7.976654]  [] ? usb_hcd_map_urb_for_dma+0x65e/0x960
> [7.976659]  [] __ieee80211_rx_handle_packet+0x1f3/0x750
> [7.976663]  [] ieee80211_rx_napi+0x447/0x990
> [7.976667]  [] rt2x00lib_rxdone+0x305/0xbd0
> [7.976670]  [] ? dequeue_task_fair+0x64f/0x1de0
> [7.976674]  [] ? sched_clock_cpu+0xe6/0x150
> [7.976678]  [] rt2x00usb_work_rxdone+0x7c/0x140
> [7.976682]  [] process_one_work+0x226/0x860
> [7.976686]  [] worker_thread+0x5c/0x680
> [7.976690]  [] ? process_one_work+0x860/0x860
> [7.976693]  [] kthread+0xf6/0x150
> [7.976697]  [] ? kthread_worker_fn+0x310/0x310
> [7.976700]  [] ret_from_fork+0x3f/0x70
> [7.976703]  [] ? kthread_worker_fn+0x310/0x310
>
> Link: https://lkml.org/lkml/2016/1/26/230
> Signed-off-by: Chris Bainbridge 
> ---
>  net/mac80211/agg-rx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c
> index 10ad4ac1fa0b..bde3344cbdd0 100644
> --- a/net/mac80211/agg-rx.c
> +++ b/net/mac80211/agg-rx.c
> @@ -291,7 +291,7 @@ void __ieee80211_start_rx_ba_session(struct sta_info *sta,
> }
>
> /* prepare A-MPDU MLME for Rx aggregation */
> -   tid_agg_rx = kmalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL);
> +   tid_agg_rx = kzalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL);

This looks like a "big hammer" solution to this problem.

My reading of this is that the events leading up to UBSAN's warning are:

1. In __ieee80211_start_rx_ba_session() tid_agg_rx is kmalloc'd and
has "random" data
2. All of tid_ampdu_rx's fields except the boolean "removed" are initialised
3. Stuff happens
4. We get to "set_release_timer" in ieee80211_sta_reorder_release
5. the random data means that "removed" has an incorrect value for a boolean
6. UBSAN barfs as above

I believe that false is stored as 0 internally (and true as 1) so
kzalloc is a correct solution, but it's the heavy weight solution as
all but one of the fields in the struct are initialised immediately
after, so we're essentially zeroing the entire struct to ensure that
one field is set to zero.

I'd prefer to just set ->removed to false right after we set
->auto_seq as that should be faster, however I don't know if
__ieee80211_start_rx_ba_session() is a fast path so I don't know if
this is saving anything.

Either way, this looks sane to me.

Reviewed-by: Julian Calaby 

On another note, this is an error that should be pretty easy to spot.
Could any of the automated tools find cases where a struct containing
a bool variable is kmalloc'd and returned without assigning all the
bools?

Thanks,

-- 
Julian Calaby

Email: julian.cal...@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
--
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: Move wlan-ng out of staging?

2016-01-27 Thread Julian Calaby
Hi Greg,

On Thu, Jan 28, 2016 at 10:07 AM, Greg KH  wrote:
> On Thu, Jan 28, 2016 at 09:48:16AM +1100, Julian Calaby wrote:
>> Hi Glen,
>>
>> On Thu, Jan 28, 2016 at 5:27 AM, Kalle Valo  wrote:
>> > Dan Carpenter  writes:
>> >
>> >> On Mon, Jan 25, 2016 at 01:16:56PM +0100, Ksenija Stanojević wrote:
>> >>> Hi All,
>> >>>
>> >>> I'm helping Greg do a bit of cleanup in the staging tree, I noticed that
>> >>> wlan-ng driver is maybe ready to be moved out of staging. Are there
>> >>> any TODO tasks left to do beside checkpatch.pl clean-up?
>> >
>> > For questions like this you should CC linux-wireless.
>> >
>> >> I happened to look through this code recently.  It's terrible.
>> >
>> > And uses wireless extensions, yuck. There's a lot of work to get it into
>> > reasonable shape, fixing checkpatch warnings will not be enough.
>>
>> On the same subject, the wilc1000 driver has taken some pretty big
>> steps in the past few days, how far away do you think it is from
>> graduating from staging?
>
> I have 221 patches in my to-apply queue to be merged for this driver, at
> the very least, those need to be merged before anyone should review it
> for graduation.  That number also implies that there is still quite a
> lot to be done, but I would not know for sure until that happens.

I figured that was the case (there's a _lot_ of churn on that driver)
however I've noticed the patches recently have swung away from being
straight checkpatch / coding style cleanups towards feature additions
and bug fixes, hence my question.

Thanks,

-- 
Julian Calaby

Email: julian.cal...@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
--
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: Move wlan-ng out of staging?

2016-01-27 Thread Greg KH
On Thu, Jan 28, 2016 at 10:28:38AM +1100, Julian Calaby wrote:
> Hi Greg,
> 
> On Thu, Jan 28, 2016 at 10:07 AM, Greg KH  wrote:
> > On Thu, Jan 28, 2016 at 09:48:16AM +1100, Julian Calaby wrote:
> >> Hi Glen,
> >>
> >> On Thu, Jan 28, 2016 at 5:27 AM, Kalle Valo  wrote:
> >> > Dan Carpenter  writes:
> >> >
> >> >> On Mon, Jan 25, 2016 at 01:16:56PM +0100, Ksenija Stanojević wrote:
> >> >>> Hi All,
> >> >>>
> >> >>> I'm helping Greg do a bit of cleanup in the staging tree, I noticed 
> >> >>> that
> >> >>> wlan-ng driver is maybe ready to be moved out of staging. Are there
> >> >>> any TODO tasks left to do beside checkpatch.pl clean-up?
> >> >
> >> > For questions like this you should CC linux-wireless.
> >> >
> >> >> I happened to look through this code recently.  It's terrible.
> >> >
> >> > And uses wireless extensions, yuck. There's a lot of work to get it into
> >> > reasonable shape, fixing checkpatch warnings will not be enough.
> >>
> >> On the same subject, the wilc1000 driver has taken some pretty big
> >> steps in the past few days, how far away do you think it is from
> >> graduating from staging?
> >
> > I have 221 patches in my to-apply queue to be merged for this driver, at
> > the very least, those need to be merged before anyone should review it
> > for graduation.  That number also implies that there is still quite a
> > lot to be done, but I would not know for sure until that happens.
> 
> I figured that was the case (there's a _lot_ of churn on that driver)
> however I've noticed the patches recently have swung away from being
> straight checkpatch / coding style cleanups towards feature additions
> and bug fixes, hence my question.

Please feel free to audit it and let us know the details :)
--
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


alfa awus036nhr v2 and module rtl8xxxu

2016-01-27 Thread Drunk Cat
problem: it does not connect to any wifi network you can see the time out on 
dmesg


>lsusb

Bus 002 Device 007: ID 0bda:817f Realtek Semiconductor Corp. RTL8188RU 
802.11n WLAN Adapter

>iwconfig
wlp0s20u1  IEEE 802.11bgn  ESSID:off/any  
  Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm   
  Retry short limit:7   RTS thr=2347 B   Fragment thr:off
  Power Management:off
>dmesg

[16421.696441] usb 2-1: new high-speed USB device number 6 using xhci_hcd
[16423.550427] usb 2-1: Vendor: 11n U
[16423.550433] usb 2-1: Product: US036NHR
[16423.550437] usb 2-1: RTL8188RU rev A (TSMC) 1T1R, TX queues 2, WiFi=1, 
BT=0, GPS=0, HI PA=1
[16423.550439] usb 2-1: RTL8188RU MAC: 00:c0:ca:7e:c7:d3
[16423.550441] usb 2-1: rtl8xxxu: Loading firmware 
rtlwifi/rtl8192cufw_TMSC.bin
[16423.566357] usb 2-1: Firmware revision 80.0 (signature 0x88c1)
[16423.851643] usb 2-1: rtl8xxxu_iqk_path_a: Path A RX IQK failed!
[16423.958287] usbcore: registered new interface driver rtl8xxxu
[16424.016545] rtl8xxxu 2-1:1.0 wlp0s20u1: renamed from wlan0
[16424.032244] IPv6: ADDRCONF(NETDEV_UP): wlp0s20u1: link is not ready
[16424.038160] IPv6: ADDRCONF(NETDEV_UP): wlp0s20u1: link is not ready
[16424.080456] IPv6: ADDRCONF(NETDEV_UP): wlp0s20u1: link is not ready
[16673.335433] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type 
mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[16673.343329] [drm] Module unloaded
[16673.358464] bbswitch: disabling discrete graphics
[16673.358476] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type 
mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[16673.370088] pci :04:00.0: Refused to change power state, currently in 
D0
[16693.345669] bbswitch: enabling discrete graphics
[16693.851919] [drm] Initialized nvidia-drm 0.0.0 20150116 for :04:00.0 
on minor 1
[16693.851926] NVRM: loading NVIDIA UNIX x86_64 Kernel Module  352.63  Sat 
Nov  7 21:25:42 PST 2015
[16693.874719] vgaarb: this pci device is not a vga device
[16693.877519] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type 
mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[16693.877610] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type 
mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[16693.877645] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type 
mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[16693.877680] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type 
mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[16693.877711] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type 
mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[16693.877741] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type 
mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[16693.877796] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type 
mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[16693.877823] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type 
mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[16693.896287] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type 
mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[16694.332278] vgaarb: this pci device is not a vga device
[16754.752107] wlp3s0: deauthenticating from 9c:97:26:0f:0e:8e by local 
choice (Reason: 3=DEAUTH_LEAVING)
[16754.773908] cfg80211: World regulatory domain updated:
[16754.773911] cfg80211:  DFS Master region: unset
[16754.773912] cfg80211:   (start_freq - end_freq @ bandwidth), 
(max_antenna_gain, max_eirp), (dfs_cac_time)
[16754.773913] cfg80211:   (2402000 KHz - 2472000 KHz @ 4 KHz), (N/A, 
2000 mBm), (N/A)
[16754.773915] cfg80211:   (2457000 KHz - 2482000 KHz @ 4 KHz), (N/A, 
2000 mBm), (N/A)
[16754.773916] cfg80211:   (2474000 KHz - 2494000 KHz @ 2 KHz), (N/A, 
2000 mBm), (N/A)
[16754.773917] cfg80211:   (517 KHz - 525 KHz @ 8 KHz, 16 
KHz AUTO), (N/A, 2000 mBm), (N/A)
[16754.773919] cfg80211:   (525 KHz - 533 KHz @ 8 KHz, 16 
KHz AUTO), (N/A, 2000 mBm), (0 s)
[16754.773920] cfg80211:   (549 KHz - 573 KHz @ 16 KHz), (N/A, 
2000 mBm), (0 s)
[16754.773921] cfg80211:   (5735000 KHz - 5835000 KHz @ 8 KHz), (N/A, 
2000 mBm), (N/A)
[16754.773922] cfg80211:   (5724 KHz - 6372 KHz @ 216 KHz), 
(N/A, 0 mBm), (N/A)
[16763.402727] IPv6: ADDRCONF(NETDEV_UP): wlp3s0: link is not ready
[16763.417485] IPv6: ADDRCONF(NETDEV_UP): wlp3s0: link is not ready
[16855.122476] IPv6: ADDRCONF(NETDEV_UP): wlp3s0: link is not ready
[16886.169494] wlp0s20u1: authenticate with 9c:97:26:0f:0e:8e
[16886.178492] wlp0s20u1: send auth to 9c:97:26:0f:0e:8e (try 1/3)
[16886.378815] wlp0s20u1: send auth to 9c:97:26:0f:0e:8e (try 2/3)
[16886.582153] wlp0s2

[PATCH] lib: fix callers of strtobool to use char array

2016-01-27 Thread Kees Cook
Some callers of strtobool were passing a pointer to unterminated strings.
This fixes the issue and consolidates some logic in cifs.

Signed-off-by: Kees Cook 
Cc: Amitkumar Karwar 
Cc: Nishant Sarmukadam 
Cc: Kalle Valo 
Cc: Steve French 
Cc: linux-c...@vger.kernel.org
---
This is preparation for adding "on"/"off" support to strtobool(), and I
want to make sure the solution isn't upsetting to the two callers. :)
---
 drivers/net/wireless/marvell/mwifiex/debugfs.c |  6 +-
 fs/cifs/cifs_debug.c   | 78 --
 fs/cifs/cifs_debug.h   |  2 +-
 fs/cifs/cifsfs.c   |  6 +-
 fs/cifs/cifsglob.h |  4 +-
 5 files changed, 44 insertions(+), 52 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/debugfs.c 
b/drivers/net/wireless/marvell/mwifiex/debugfs.c
index 0b9c580af988..76af60899c69 100644
--- a/drivers/net/wireless/marvell/mwifiex/debugfs.c
+++ b/drivers/net/wireless/marvell/mwifiex/debugfs.c
@@ -880,13 +880,13 @@ mwifiex_reset_write(struct file *file,
 {
struct mwifiex_private *priv = file->private_data;
struct mwifiex_adapter *adapter = priv->adapter;
-   char cmd;
+   char cmd[2] = { '\0' };
bool result;
 
-   if (copy_from_user(&cmd, ubuf, sizeof(cmd)))
+   if (copy_from_user(cmd, ubuf, sizeof(char)))
return -EFAULT;
 
-   if (strtobool(&cmd, &result))
+   if (strtobool(cmd, &result))
return -EINVAL;
 
if (!result)
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index 50b268483302..cafe464fa1b7 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -251,11 +251,29 @@ static const struct file_operations 
cifs_debug_data_proc_fops = {
.release= single_release,
 };
 
+static int get_user_bool(const char __user *buffer, bool *store)
+{
+   char c[2] = { '\0' };
+   bool bv;
+   int rc;
+
+   rc = get_user(c[0], buffer);
+   if (rc)
+   return rc;
+
+   rc = strtobool(c, &bv);
+   if (rc)
+   return rc;
+
+   *store = bv;
+
+   return 0;
+}
+
 #ifdef CONFIG_CIFS_STATS
 static ssize_t cifs_stats_proc_write(struct file *file,
const char __user *buffer, size_t count, loff_t *ppos)
 {
-   char c;
bool bv;
int rc;
struct list_head *tmp1, *tmp2, *tmp3;
@@ -263,11 +281,8 @@ static ssize_t cifs_stats_proc_write(struct file *file,
struct cifs_ses *ses;
struct cifs_tcon *tcon;
 
-   rc = get_user(c, buffer);
-   if (rc)
-   return rc;
-
-   if (strtobool(&c, &bv) == 0) {
+   rc = get_user_bool(buffer, &bv);
+   if (rc == 0) {
 #ifdef CONFIG_CIFS_STATS2
atomic_set(&totBufAllocCount, 0);
atomic_set(&totSmBufAllocCount, 0);
@@ -290,7 +305,8 @@ static ssize_t cifs_stats_proc_write(struct file *file,
}
}
spin_unlock(&cifs_tcp_ses_lock);
-   }
+   } else
+   return rc;
 
return count;
 }
@@ -433,17 +449,17 @@ static int cifsFYI_proc_open(struct inode *inode, struct 
file *file)
 static ssize_t cifsFYI_proc_write(struct file *file, const char __user *buffer,
size_t count, loff_t *ppos)
 {
-   char c;
+   char c[2] = { '\0' };
bool bv;
int rc;
 
-   rc = get_user(c, buffer);
+   rc = get_user(c[0], buffer);
if (rc)
return rc;
-   if (strtobool(&c, &bv) == 0)
+   if (strtobool(c, &bv) == 0)
cifsFYI = bv;
-   else if ((c > '1') && (c <= '9'))
-   cifsFYI = (int) (c - '0'); /* see cifs_debug.h for meanings */
+   else if ((c[0] > '1') && (c[0] <= '9'))
+   cifsFYI = (int) (c[0] - '0'); /* see cifs_debug.h for meanings 
*/
 
return count;
 }
@@ -471,20 +487,12 @@ static int cifs_linux_ext_proc_open(struct inode *inode, 
struct file *file)
 static ssize_t cifs_linux_ext_proc_write(struct file *file,
const char __user *buffer, size_t count, loff_t *ppos)
 {
-   char c;
-   bool bv;
int rc;
 
-   rc = get_user(c, buffer);
+   rc = get_user_bool(buffer, &linuxExtEnabled);
if (rc)
return rc;
 
-   rc = strtobool(&c, &bv);
-   if (rc)
-   return rc;
-
-   linuxExtEnabled = bv;
-
return count;
 }
 
@@ -511,20 +519,12 @@ static int cifs_lookup_cache_proc_open(struct inode 
*inode, struct file *file)
 static ssize_t cifs_lookup_cache_proc_write(struct file *file,
const char __user *buffer, size_t count, loff_t *ppos)
 {
-   char c;
-   bool bv;
int rc;
 
-   rc = get_user(c, buffer);
+   rc = get_user_bool(buffer, &lookupCacheEnabled);
if (rc)
return rc;
 
-   rc = strtobool(&c, &bv);
-   if (rc)
-   return rc;
-
-  

Re: [PATCH] lib: fix callers of strtobool to use char array

2016-01-27 Thread Joe Perches
On Wed, 2016-01-27 at 16:45 -0800, Kees Cook wrote:
> Some callers of strtobool were passing a pointer to unterminated strings.
> This fixes the issue and consolidates some logic in cifs.

This may be incomplete as it duplicates the behavior for
the old number of characters, but this is not a solution
for the entry of a bool that is "on" or "off".

> diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
[]
> @@ -290,7 +305,8 @@ static ssize_t cifs_stats_proc_write(struct file *file,
>   }
>   }
>   spin_unlock(&cifs_tcp_ses_lock);
> - }
> + } else
> + return rc;

Likely better to reverse the test and unindent the
preceding block.

Otherwise, please make sure to use the general brace
form of when one branch needs braces, the other branch
should have them too.

--
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] lib: fix callers of strtobool to use char array

2016-01-27 Thread Kees Cook
On Wed, Jan 27, 2016 at 4:58 PM, Joe Perches  wrote:
> On Wed, 2016-01-27 at 16:45 -0800, Kees Cook wrote:
>> Some callers of strtobool were passing a pointer to unterminated strings.
>> This fixes the issue and consolidates some logic in cifs.
>
> This may be incomplete as it duplicates the behavior for
> the old number of characters, but this is not a solution
> for the entry of a bool that is "on" or "off".

As in, the on/off patch is missing? Yes, that's been sent separately,
but I wanted to make sure these changes weren't upsetting to the two
users.

>> diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
> []
>> @@ -290,7 +305,8 @@ static ssize_t cifs_stats_proc_write(struct file *file,
>>   }
>>   }
>>   spin_unlock(&cifs_tcp_ses_lock);
>> - }
>> + } else
>> + return rc;
>
> Likely better to reverse the test and unindent the
> preceding block.
>
> Otherwise, please make sure to use the general brace
> form of when one branch needs braces, the other branch
> should have them too.

Okay, sure, I'll rework this and send it together with the on/off patch.

-Kees

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


Re: [PATCH 0/4] ath10k: rename mesh and add abstraction layer

2016-01-27 Thread Yeoh Chun-Yeow
On Thu, Jan 28, 2016 at 5:53 AM, Peter Oh  wrote:
>
> On 01/27/2016 11:39 AM, Bob Copeland wrote:
>>
>> On Wed, Jan 27, 2016 at 10:55:53AM -0800, Peter Oh wrote:
>>>
>>> Split Mesh service to 11s Mesh and non-11s Mesh according to
>>> firmware service bit to help users distinguish 11s Mesh from
>>> non 11s Mesh.
>>> And add abstraction layer for vdev subtype to solve subtype mismatch
>>> and to give flexible compatibility among different firmware revisions.
>>
>> Out of curiosity, which non-11s mesh, if you can share?
>
> non-11s Mesh can be anything, but 11s Mesh such as meraki mesh.
>

I thought that non-11s mesh is for meraki mesh since it is not 802.11s
implementation.

WMI_10_4_SERVICE_MESH_NON_11S for non IEEE802.11s Mesh
WMI_SERVICE_MESH_11S and WMI_VDEV_SUBTYPE_MESH for IEEE 802.11s Mesh

Correct me if I am wrong.

Thanks


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


NEW ARRIVALS, CISCO,CPU's,Memory, LAPTOP AND AVAYA

2016-01-27 Thread Laison Computech Inc
Dear Sir/Madam,

Clean tested working pulls CPUs and QTYs in stock.

115  X   X5650
65  X   E5410
75  X   X5660
145  X   E5530
100  X   E5645
40  X   X5680
75  X   X5690

Brand new sealed  IP phones and QTYs in stock.

55 x CP-7937G
77 x CP-7942G
54 x CP-7945G
75 x CP-7962G
..
45 x Avaya 9630
65 x Avaya 9641
55 x Avaya 9640

All NIB.

Here is our current stock list.

 SSD drives and 750 gig 2.5" sata drives

We also have
250 x i5 dell
133 x HP
360 x Lenevo
all grade A

Here is the qty in stock for laptops
 
150 x E6500 Dell Latitude E6500 Core 2 Duo 2.80GHz T9600 4GB 160GB DVD+/-RW Win 
7
 60 x E6510 Dell Ltitude E6510. 15.6" Intel Core i5- M520 @ 2.40GHz. 4GB. 320GB 
DVD+/-RW Win 7
30 X 8530P HP EliteBook 8530p 15.4" Laptop 2.53GHz Core 2 Duo T9400, 4GB RAM, 
160GB HDD, Win
100 x  8740W  HP EliteBook 8740w 17" 2.4Ghz Core i5 6GB 250GB Win 7 Pr
45 x 8760W HP EliteBook 8760W 17.3" 2nd Gen Intel Core i7 2.70GHz 8GB 320GB 
Windows 7 Pro
50 x DELL 6520Dell latitude e6520 15.6" i5-2520M 2.5Ghz, 8GB Ram, 500GB HD Win 
7 @ $115
120 x DELL 6420 Laptop Dell Latitude E6420 14" Intel Core i5 2.4Ghz 4GB RAM 
250GB HDD DVD Win 7
150 x T410 Lenovo ThinkPad Laptop T410s 14.1" 2.40GHz Core i5 4GB RAM 160GB Win 
7
180 x 8440P HP EliteBook 8440p 14" M520 Core i5 2.4GHz 4GB 250GB Win 7


Let me know if you're interested. We are very open to offers and willing to 
work with you to make sure that we have a deal.

Thank You
Barbara Johnson
Laison Computech Inc
210 N Scoring Ave,
Rialto California, 92376
Tel: +1-657-232-7047
Fax: +1-347-214-047
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/4] ath10k: rename mesh and add abstraction layer

2016-01-27 Thread Peter Oh


On 01/27/2016 06:04 PM, Yeoh Chun-Yeow wrote:

On Thu, Jan 28, 2016 at 5:53 AM, Peter Oh  wrote:

On 01/27/2016 11:39 AM, Bob Copeland wrote:

On Wed, Jan 27, 2016 at 10:55:53AM -0800, Peter Oh wrote:

Split Mesh service to 11s Mesh and non-11s Mesh according to
firmware service bit to help users distinguish 11s Mesh from
non 11s Mesh.
And add abstraction layer for vdev subtype to solve subtype mismatch
and to give flexible compatibility among different firmware revisions.

Out of curiosity, which non-11s mesh, if you can share?

non-11s Mesh can be anything, but 11s Mesh such as meraki mesh.


I thought that non-11s mesh is for meraki mesh since it is not 802.11s
implementation.

WMI_10_4_SERVICE_MESH_NON_11S for non IEEE802.11s Mesh
WMI_SERVICE_MESH_11S and WMI_VDEV_SUBTYPE_MESH for IEEE 802.11s Mesh

Correct me if I am wrong.

You're correct.  WMI_VDEV_SUBTYPE_MESH -> WMI_VDEV_SUBTYPE_MESH_11S


Thanks


Chun-Yeow

___
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


WARNING at net/mac80211/rate.c:513 ieee80211_get_tx_rates [mac80211]

2016-01-27 Thread Linus Torvalds
Hmm. So my daughter has a little Gigabyte Brix that has rtl8821ae
wireless in it. Yeah, nasty, I know, but it has actually worked
reasonably well.

.. except now I upgraded the nearest access point, and now wireless on
that machine no longer works.

Or rather, it actually *does* work in the sense that it authenticates,
it associates, and it actually gets a DHCP lease etc. So the darn
thing has an IP address and everything, but then nothing else seems to
go through after that. Very odd. My guess is that the auth/assoc/dhcp
thign happens at low rates, then it starts trying to up the rates, and
things go to hell.

But clearly several packets have gotten through.  And then absolutely
nothing. Everything else is happy with the new AP, so this is not a
problem with the wireless network itself.

I'm appending the warning that gets printed, which may or may not be relevant.

This is with a clean and up-to-date Fedora 23 install, so that line 513 is the

   512  /* RC is busted */
   513  if (WARN_ON_ONCE(rates[i].idx >= sband->n_bitrates)) {
   514  rates[i].idx = -1;
   515  continue;
   516  }

thing, which still exists in the same form in current kernels (except
in current -git it's line 625).

I do note that that rate_fixup_ratelist() function is a bit odd wrt
those rate indexes: it has code to make sure that there are no valid
rates following an invalid one:

/*
 * make sure there's no valid rate following
 * an invalid one, just in case drivers don't
 * take the API seriously to stop at -1.
 */
if (inval) {
rates[i].idx = -1;
continue;
}
if (rates[i].idx < 0) {
inval = true;
continue;
}

but then that "RC is busted" case that generates a warning will add
one of those invalid rates in the middle anyway. So I get the feeling
that if that warning ever triggers, it will basically be screwing up
that whole rate table. I dunno.

Is there anything sane I can do to help debug this case?

 Linus

--- snip snip, relevant (?) wireless warning ---

IPv6: ADDRCONF(NETDEV_UP): enp3s0: link is not ready
  r8169 :03:00.0 enp3s0: link down
  IPv6: ADDRCONF(NETDEV_UP): enp3s0: link is not ready
  IPv6: ADDRCONF(NETDEV_UP): wlp2s0: link is not ready
  IPv6: ADDRCONF(NETDEV_UP): wlp2s0: link is not ready
  IPv6: ADDRCONF(NETDEV_UP): wlp2s0: link is not ready
  tun: Universal TUN/TAP device driver, 1.6
  tun: (C) 1999-2004 Max Krasnyansky 
  device virbr0-nic entered promiscuous mode
  virbr0: port 1(virbr0-nic) entered listening state
  virbr0: port 1(virbr0-nic) entered listening state
  virbr0: port 1(virbr0-nic) entered disabled state
  wlp2s0: authenticate with 46:d9:e7:92:bf:29
  wlp2s0: send auth to 46:d9:e7:92:bf:29 (try 1/3)
  wlp2s0: authenticated
  wlp2s0: associate with 46:d9:e7:92:bf:29 (try 1/3)
  wlp2s0: associate with 46:d9:e7:92:bf:29 (try 2/3)
  wlp2s0: RX AssocResp from 46:d9:e7:92:bf:29 (capab=0x411 status=0 aid=1)
  wlp2s0: associated
  IPv6: ADDRCONF(NETDEV_CHANGE): wlp2s0: link becomes ready
  [ cut here ]
  WARNING: CPU: 2 PID: 0 at net/mac80211/rate.c:513
ieee80211_get_tx_rates+0x243/0x7d0 [mac80211]()
  Modules linked in: ccm cmac xt_CHECKSUM ipt_MASQUERADE
nf_nat_masquerade_ipv4 tun nf_conntrack_netbios_ns
nf_conntrack_broadcast ip6t_rpfilter ip6t_REJECT nf_reject_ipv6
xt_conntrack ebtable_filter ebtable_nat ebtable_broute bridge ebtables
ip6table_raw ip6table_security ip6table_nat nf_conntrack_ipv6
nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_filter ip6_tables
iptable_raw iptable_security iptable_nat nf_conntrack_ipv4
nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle bnep
arc4 rtl8821ae vfat fat btcoexist rtl_pci rtlwifi mac80211
x86_pkg_temp_thermal coretemp snd_hda_codec_realtek snd_hda_codec_hdmi
snd_hda_codec_generic kvm_intel snd_soc_rt5640 kvm snd_soc_rl6231
snd_hda_intel snd_soc_core iTCO_wdt snd_hda_codec snd_compress btusb
snd_pcm_dmaengine snd_hda_core
   iTCO_vendor_support cfg80211 ac97_bus btrtl snd_hwdep
crct10dif_pclmul btbcm snd_seq crc32_pclmul btintel crc32c_intel
bluetooth snd_seq_device joydev snd_pcm mei_me mei shpchp dw_dmac
tpm_tis lpc_ich i2c_i801 snd_timer rfkill snd tpm soundcore
snd_soc_sst_acpi dw_dmac_core i2c_designware_platform
i2c_designware_core nfsd auth_rpcgss nfs_acl lockd grace sunrpc
hid_logitech_hidpp hid_logitech_dj i915 i2c_algo_bit drm_kms_helper
8021q garp drm stp llc mrp r8169 sdhci_acpi mii sdhci mmc_core video
i2c_hid
  CPU: 2 PID: 0 Comm: swapper/2 Not tainted 4.2.8-300.fc23.x86_64 #1
  Hardware name: GIGABYTE M4HM87P-00/M4HM87P-00, BIOS F2 12/11/2013
    aad0aff724c0ea01 88021ea83648 817738ca
    000

[PATCH 01/12] staging: wilc1000: coreconfigurator.c : remove over-commenting

2016-01-27 Thread Leo Kim
There are over-commenting in the coreconfigurator.c file and most of them
are not helpful to explain what the code does and generate 80 ending
line over warnings. So, all of comments are removed in this patch and the
comments will later be added if necessary with the preferred Linux style.

Signed-off-by: Leo Kim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 141 +---
 1 file changed, 1 insertion(+), 140 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index d101393..37d40bb 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -1,13 +1,3 @@
-
-/*!
- *  @file  coreconfigurator.c
- *  @brief
- *  @author
- *  @sacoreconfigurator.h
- *  @date  1 Mar 2012
- *  @version   1.0
- */
-
 #include "coreconfigurator.h"
 #include "wilc_wlan_if.h"
 #include "wilc_wlan.h"
@@ -16,7 +6,6 @@
 #define TAG_PARAM_OFFSET   (MAC_HDR_LEN + TIME_STAMP_LEN + \
BEACON_INTERVAL_LEN + 
CAP_INFO_LEN)
 
-/* Basic Frame Type Codes (2-bit) */
 enum basic_frame_type {
FRAME_TYPE_CONTROL = 0x04,
FRAME_TYPE_DATA= 0x08,
@@ -25,7 +14,6 @@ enum basic_frame_type {
FRAME_TYPE_FORCE_32BIT = 0x
 };
 
-/* Frame Type and Subtype Codes (6-bit) */
 enum sub_frame_type {
ASSOC_REQ = 0x00,
ASSOC_RSP = 0x10,
@@ -65,7 +53,6 @@ enum sub_frame_type {
FRAME_SUBTYPE_FORCE_32BIT  = 0x
 };
 
-/* Element ID  of various Information Elements */
 enum info_element_id {
ISSID   = 0,   /* Service Set Identifier */
ISUPRATES   = 1,   /* Supported Rates*/
@@ -109,8 +96,6 @@ enum info_element_id {
INFOELEM_ID_FORCE_32BIT  = 0x
 };
 
-/* This function extracts the beacon period field from the beacon or probe   */
-/* response frame.   */
 static inline u16 get_beacon_period(u8 *data)
 {
u16 bcn_per;
@@ -147,54 +132,36 @@ static inline u32 get_beacon_timestamp_hi(u8 *data)
return time_stamp;
 }
 
-/* This function extracts the 'frame type and sub type' bits from the MAC*/
-/* header of the input frame.*/
-/* Returns the value in the LSB of the returned value.   */
 static inline enum sub_frame_type get_sub_type(u8 *header)
 {
return ((enum sub_frame_type)(header[0] & 0xFC));
 }
 
-/* This function extracts the 'to ds' bit from the MAC header of the input   */
-/* frame.*/
-/* Returns the value in the LSB of the returned value.   */
 static inline u8 get_to_ds(u8 *header)
 {
return (header[1] & 0x01);
 }
 
-/* This function extracts the 'from ds' bit from the MAC header of the input */
-/* frame.*/
-/* Returns the value in the LSB of the returned value.   */
 static inline u8 get_from_ds(u8 *header)
 {
return ((header[1] & 0x02) >> 1);
 }
 
-/* This function extracts the MAC Address in 'address1' field of the MAC */
-/* header and updates the MAC Address in the allocated 'addr' variable.  */
 static inline void get_address1(u8 *pu8msa, u8 *addr)
 {
memcpy(addr, pu8msa + 4, 6);
 }
 
-/* This function extracts the MAC Address in 'address2' field of the MAC */
-/* header and updates the MAC Address in the allocated 'addr' variable.  */
 static inline void get_address2(u8 *pu8msa, u8 *addr)
 {
memcpy(addr, pu8msa + 10, 6);
 }
 
-/* This function extracts the MAC Address in 'address3' field of the MAC */
-/* header and updates the MAC Address in the allocated 'addr' variable.  */
 static inline void get_address3(u8 *pu8msa, u8 *addr)
 {
memcpy(addr, pu8msa + 16, 6);
 }
 
-/* This function extracts the BSSID from the incoming WLAN packet based on   */
-/* the 'from ds' bit, and updates the MAC Address in the allocated 'addr'*/
-/* variable. */
 static inline void get_BSSID(u8 *data, u8 *bssid)
 {
if (get_from_ds(data) == 1)
@@ -205,7 +172,6 @@ static inline void get_BSSID(u8 *data, u8 *bssid)
get_address3(data, bssid);
 }
 
-/* This function extracts the SSID from a beacon/probe response frame*/
 static inline void get_ssid(u8 *data, u8 *ssid, u8 *p_ssid_len)
 {
u8 len = 0;
@@ -217,8 +183,6 @@ static inline void get_ssid(u8 *data, u8 *ssid, u8 
*p_ssid_len)
j   = MAC_HDR_LEN + TIME_STAMP_LEN + BEACON_INTERVAL_LEN +
CAP_INFO_LEN + 2;
 
-   /* If the SSID length field is set wrongly to a value greater than the  
 */
-   /* allowed maximum SSID length l

[PATCH 02/12] staging: wilc1000: renames u16RxLen variable

2016-01-27 Thread Leo Kim
This patch renames u16RxLen variable to rx_len to avoid camelcase.

Signed-off-by: Leo Kim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 37d40bb..9f85fff 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -241,13 +241,13 @@ static inline u16 get_asoc_id(u8 *data)
return asoc_id;
 }
 
-static u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 u16TagParamOffset)
+static u8 *get_tim_elm(u8 *pu8msa, u16 rx_len, u16 u16TagParamOffset)
 {
u16 u16index;
 
u16index = u16TagParamOffset;
 
-   while (u16index < (u16RxLen - FCS_LEN)) {
+   while (u16index < (rx_len - FCS_LEN)) {
if (pu8msa[u16index] == ITIM)
return &pu8msa[u16index];
u16index += (IE_HDR_LEN + pu8msa[u16index + 1]);
@@ -256,12 +256,12 @@ static u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 
u16TagParamOffset)
return NULL;
 }
 
-static u8 get_current_channel_802_11n(u8 *pu8msa, u16 u16RxLen)
+static u8 get_current_channel_802_11n(u8 *pu8msa, u16 rx_len)
 {
u16 index;
 
index = TAG_PARAM_OFFSET;
-   while (index < (u16RxLen - FCS_LEN)) {
+   while (index < (rx_len - FCS_LEN)) {
if (pu8msa[index] == IDSPARMS)
return pu8msa[index + 2];
index += pu8msa[index + 1] + IE_HDR_LEN;
@@ -296,7 +296,7 @@ s32 wilc_parse_network_info(u8 *pu8MsgBuffer, 
tstrNetworkInfo **ppstrNetworkInfo
 
{
u8  *pu8msa = NULL;
-   u16 u16RxLen = 0;
+   u16 rx_len = 0;
u8 *pu8TimElm = NULL;
u8 *pu8IEs = NULL;
u16 u16IEsLen = 0;
@@ -312,7 +312,7 @@ s32 wilc_parse_network_info(u8 *pu8MsgBuffer, 
tstrNetworkInfo **ppstrNetworkInfo
 
pu8msa = &pu8WidVal[1];
 
-   u16RxLen = u16WidLen - 1;
+   rx_len = u16WidLen - 1;
pstrNetworkInfo->u16CapInfo = get_cap_info(pu8msa);
pstrNetworkInfo->u32Tsf = get_beacon_timestamp_lo(pu8msa);
PRINT_D(CORECONFIG_DBG, "TSF :%x\n", pstrNetworkInfo->u32Tsf);
@@ -326,7 +326,7 @@ s32 wilc_parse_network_info(u8 *pu8MsgBuffer, 
tstrNetworkInfo **ppstrNetworkInfo
get_BSSID(pu8msa, pstrNetworkInfo->au8bssid);
 
pstrNetworkInfo->u8channel = get_current_channel_802_11n(pu8msa,
-   u16RxLen + FCS_LEN);
+   rx_len + FCS_LEN);
 
u8index = MAC_HDR_LEN + TIME_STAMP_LEN;
 
@@ -334,11 +334,11 @@ s32 wilc_parse_network_info(u8 *pu8MsgBuffer, 
tstrNetworkInfo **ppstrNetworkInfo
 
u8index += BEACON_INTERVAL_LEN + CAP_INFO_LEN;
 
-   pu8TimElm = get_tim_elm(pu8msa, u16RxLen + FCS_LEN, u8index);
+   pu8TimElm = get_tim_elm(pu8msa, rx_len + FCS_LEN, u8index);
if (pu8TimElm)
pstrNetworkInfo->u8DtimPeriod = pu8TimElm[3];
pu8IEs = &pu8msa[MAC_HDR_LEN + TIME_STAMP_LEN + 
BEACON_INTERVAL_LEN + CAP_INFO_LEN];
-   u16IEsLen = u16RxLen - (MAC_HDR_LEN + TIME_STAMP_LEN + 
BEACON_INTERVAL_LEN + CAP_INFO_LEN);
+   u16IEsLen = rx_len - (MAC_HDR_LEN + TIME_STAMP_LEN + 
BEACON_INTERVAL_LEN + CAP_INFO_LEN);
 
if (u16IEsLen > 0) {
pstrNetworkInfo->pu8IEs = kmemdup(pu8IEs, u16IEsLen,
-- 
1.9.1

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


[PATCH 03/12] staging: wilc1000: renames u16TagParamOffset variable

2016-01-27 Thread Leo Kim
This patch renames u16TagParamOffset variable to tag_param_offset
to avoid camelcase.

Signed-off-by: Leo Kim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 9f85fff..b769d3c 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -241,11 +241,11 @@ static inline u16 get_asoc_id(u8 *data)
return asoc_id;
 }
 
-static u8 *get_tim_elm(u8 *pu8msa, u16 rx_len, u16 u16TagParamOffset)
+static u8 *get_tim_elm(u8 *pu8msa, u16 rx_len, u16 tag_param_offset)
 {
u16 u16index;
 
-   u16index = u16TagParamOffset;
+   u16index = tag_param_offset;
 
while (u16index < (rx_len - FCS_LEN)) {
if (pu8msa[u16index] == ITIM)
-- 
1.9.1

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


[PATCH 04/12] staging: wilc1000: renames u16index variable

2016-01-27 Thread Leo Kim
This patch renames u16index variable to index
to remove the prefix variable defined name.

Signed-off-by: Leo Kim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index b769d3c..6f17e2b 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -243,14 +243,14 @@ static inline u16 get_asoc_id(u8 *data)
 
 static u8 *get_tim_elm(u8 *pu8msa, u16 rx_len, u16 tag_param_offset)
 {
-   u16 u16index;
+   u16 index;
 
-   u16index = tag_param_offset;
+   index = tag_param_offset;
 
-   while (u16index < (rx_len - FCS_LEN)) {
-   if (pu8msa[u16index] == ITIM)
-   return &pu8msa[u16index];
-   u16index += (IE_HDR_LEN + pu8msa[u16index + 1]);
+   while (index < (rx_len - FCS_LEN)) {
+   if (pu8msa[index] == ITIM)
+   return &pu8msa[index];
+   index += (IE_HDR_LEN + pu8msa[index + 1]);
}
 
return NULL;
-- 
1.9.1

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


[PATCH 09/12] staging: wilc1000: wilc_parse_assoc_resp_info(): renames function variables

2016-01-27 Thread Leo Kim
This patch renames to avoid camelcase, changes follow are:
 - pu8Buffer to buffer
 - u32BufferLen to buffer_len
 - ppstrConnectRespInfo to ret_connect_resp_info

Signed-off-by: Leo Kim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 16 
 drivers/staging/wilc1000/coreconfigurator.h |  5 ++---
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 88e5661..48c8573 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -376,8 +376,8 @@ s32 wilc_dealloc_network_info(tstrNetworkInfo 
*pstrNetworkInfo)
return result;
 }
 
-s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
-  tstrConnectRespInfo **ppstrConnectRespInfo)
+s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
+  tstrConnectRespInfo **ret_connect_resp_info)
 {
tstrConnectRespInfo *pstrConnectRespInfo = NULL;
u16 u16AssocRespLen = 0;
@@ -388,14 +388,14 @@ s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 
u32BufferLen,
if (!pstrConnectRespInfo)
return -ENOMEM;
 
-   u16AssocRespLen = (u16)u32BufferLen;
+   u16AssocRespLen = (u16)buffer_len;
 
-   pstrConnectRespInfo->u16ConnectStatus = get_asoc_status(pu8Buffer);
+   pstrConnectRespInfo->u16ConnectStatus = get_asoc_status(buffer);
if (pstrConnectRespInfo->u16ConnectStatus == SUCCESSFUL_STATUSCODE) {
-   pstrConnectRespInfo->u16capability = 
get_assoc_resp_cap_info(pu8Buffer);
-   pstrConnectRespInfo->u16AssocID = get_asoc_id(pu8Buffer);
+   pstrConnectRespInfo->u16capability = 
get_assoc_resp_cap_info(buffer);
+   pstrConnectRespInfo->u16AssocID = get_asoc_id(buffer);
 
-   pu8IEs = &pu8Buffer[CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN];
+   pu8IEs = &buffer[CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN];
u16IEsLen = u16AssocRespLen - (CAP_INFO_LEN + STATUS_CODE_LEN + 
AID_LEN);
 
pstrConnectRespInfo->pu8RespIEs = kmemdup(pu8IEs, u16IEsLen, 
GFP_KERNEL);
@@ -405,7 +405,7 @@ s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 
u32BufferLen,
pstrConnectRespInfo->u16RespIEsLen = u16IEsLen;
}
 
-   *ppstrConnectRespInfo = pstrConnectRespInfo;
+   *ret_connect_resp_info = pstrConnectRespInfo;
 
return 0;
 }
diff --git a/drivers/staging/wilc1000/coreconfigurator.h 
b/drivers/staging/wilc1000/coreconfigurator.h
index aec0779..6a2c323 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -122,9 +122,8 @@ typedef struct {
 
 s32 wilc_parse_network_info(u8 *msg_buffer, tstrNetworkInfo 
**ret_network_info);
 s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo);
-
-s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
-  tstrConnectRespInfo **ppstrConnectRespInfo);
+s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
+  tstrConnectRespInfo **ret_connect_resp_info);
 s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo);
 void wilc_scan_complete_received(struct wilc *wilc, u8 *pu8Buffer,
 u32 u32Length);
-- 
1.9.1

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


[PATCH 10/12] staging: wilc1000: wilc_parse_assoc_resp_info(): renames local variables

2016-01-27 Thread Leo Kim
This patch renames to avoid camelcase, changes follow are:
 - pstrConnectRespInfo to connect_resp_info
 - u16AssocRespLen to assoc_resp_len
 - pu8IEs to ies
 - u16IEsLen to ies_len

Signed-off-by: Leo Kim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 34 ++---
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 48c8573..c0be33d 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -379,33 +379,33 @@ s32 wilc_dealloc_network_info(tstrNetworkInfo 
*pstrNetworkInfo)
 s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
   tstrConnectRespInfo **ret_connect_resp_info)
 {
-   tstrConnectRespInfo *pstrConnectRespInfo = NULL;
-   u16 u16AssocRespLen = 0;
-   u8 *pu8IEs = NULL;
-   u16 u16IEsLen = 0;
+   tstrConnectRespInfo *connect_resp_info = NULL;
+   u16 assoc_resp_len = 0;
+   u8 *ies = NULL;
+   u16 ies_len = 0;
 
-   pstrConnectRespInfo = kzalloc(sizeof(tstrConnectRespInfo), GFP_KERNEL);
-   if (!pstrConnectRespInfo)
+   connect_resp_info = kzalloc(sizeof(tstrConnectRespInfo), GFP_KERNEL);
+   if (!connect_resp_info)
return -ENOMEM;
 
-   u16AssocRespLen = (u16)buffer_len;
+   assoc_resp_len = (u16)buffer_len;
 
-   pstrConnectRespInfo->u16ConnectStatus = get_asoc_status(buffer);
-   if (pstrConnectRespInfo->u16ConnectStatus == SUCCESSFUL_STATUSCODE) {
-   pstrConnectRespInfo->u16capability = 
get_assoc_resp_cap_info(buffer);
-   pstrConnectRespInfo->u16AssocID = get_asoc_id(buffer);
+   connect_resp_info->u16ConnectStatus = get_asoc_status(buffer);
+   if (connect_resp_info->u16ConnectStatus == SUCCESSFUL_STATUSCODE) {
+   connect_resp_info->u16capability = 
get_assoc_resp_cap_info(buffer);
+   connect_resp_info->u16AssocID = get_asoc_id(buffer);
 
-   pu8IEs = &buffer[CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN];
-   u16IEsLen = u16AssocRespLen - (CAP_INFO_LEN + STATUS_CODE_LEN + 
AID_LEN);
+   ies = &buffer[CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN];
+   ies_len = assoc_resp_len - (CAP_INFO_LEN + STATUS_CODE_LEN + 
AID_LEN);
 
-   pstrConnectRespInfo->pu8RespIEs = kmemdup(pu8IEs, u16IEsLen, 
GFP_KERNEL);
-   if (!pstrConnectRespInfo->pu8RespIEs)
+   connect_resp_info->pu8RespIEs = kmemdup(ies, ies_len, 
GFP_KERNEL);
+   if (!connect_resp_info->pu8RespIEs)
return -ENOMEM;
 
-   pstrConnectRespInfo->u16RespIEsLen = u16IEsLen;
+   connect_resp_info->u16RespIEsLen = ies_len;
}
 
-   *ret_connect_resp_info = pstrConnectRespInfo;
+   *ret_connect_resp_info = connect_resp_info;
 
return 0;
 }
-- 
1.9.1

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


[PATCH 06/12] staging: wilc1000: wilc_parse_network_info(): renames local variables

2016-01-27 Thread Leo Kim
This patch renames to avoid camelcase, changes follow are:
 - pstrNetworkInfo to network_info
 - u8MsgType to msg_type
 - u8MsgID to msg_id
 - u16MsgLen to msg_len
 - u16WidID to wid_id
 - u16WidLen to wid_len
 - pu8WidVal to wid_val

Signed-off-by: Leo Kim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 67 ++---
 1 file changed, 33 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 43f0a29..24afeb8 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -272,27 +272,27 @@ static u8 get_current_channel_802_11n(u8 *pu8msa, u16 
rx_len)
 
 s32 wilc_parse_network_info(u8 *msg_buffer, tstrNetworkInfo **ret_network_info)
 {
-   tstrNetworkInfo *pstrNetworkInfo = NULL;
-   u8 u8MsgType = 0;
-   u8 u8MsgID = 0;
-   u16 u16MsgLen = 0;
+   tstrNetworkInfo *network_info = NULL;
+   u8 msg_type = 0;
+   u8 msg_id = 0;
+   u16 msg_len = 0;
 
-   u16 u16WidID = (u16)WID_NIL;
-   u16 u16WidLen  = 0;
-   u8  *pu8WidVal = NULL;
+   u16 wid_id = (u16)WID_NIL;
+   u16 wid_len  = 0;
+   u8 *wid_val = NULL;
 
-   u8MsgType = msg_buffer[0];
+   msg_type = msg_buffer[0];
 
-   if ('N' != u8MsgType) {
+   if ('N' != msg_type) {
PRINT_ER("Received Message format incorrect.\n");
return -EFAULT;
}
 
-   u8MsgID = msg_buffer[1];
-   u16MsgLen = MAKE_WORD16(msg_buffer[2], msg_buffer[3]);
-   u16WidID = MAKE_WORD16(msg_buffer[4], msg_buffer[5]);
-   u16WidLen = MAKE_WORD16(msg_buffer[6], msg_buffer[7]);
-   pu8WidVal = &msg_buffer[8];
+   msg_id = msg_buffer[1];
+   msg_len = MAKE_WORD16(msg_buffer[2], msg_buffer[3]);
+   wid_id = MAKE_WORD16(msg_buffer[4], msg_buffer[5]);
+   wid_len = MAKE_WORD16(msg_buffer[6], msg_buffer[7]);
+   wid_val = &msg_buffer[8];
 
{
u8  *pu8msa = NULL;
@@ -304,53 +304,52 @@ s32 wilc_parse_network_info(u8 *msg_buffer, 
tstrNetworkInfo **ret_network_info)
u32 u32Tsf_Lo;
u32 u32Tsf_Hi;
 
-   pstrNetworkInfo = kzalloc(sizeof(tstrNetworkInfo), GFP_KERNEL);
-   if (!pstrNetworkInfo)
+   network_info = kzalloc(sizeof(tstrNetworkInfo), GFP_KERNEL);
+   if (!network_info)
return -ENOMEM;
 
-   pstrNetworkInfo->s8rssi = pu8WidVal[0];
+   network_info->s8rssi = wid_val[0];
 
-   pu8msa = &pu8WidVal[1];
+   pu8msa = &wid_val[1];
 
-   rx_len = u16WidLen - 1;
-   pstrNetworkInfo->u16CapInfo = get_cap_info(pu8msa);
-   pstrNetworkInfo->u32Tsf = get_beacon_timestamp_lo(pu8msa);
-   PRINT_D(CORECONFIG_DBG, "TSF :%x\n", pstrNetworkInfo->u32Tsf);
+   rx_len = wid_len - 1;
+   network_info->u16CapInfo = get_cap_info(pu8msa);
+   network_info->u32Tsf = get_beacon_timestamp_lo(pu8msa);
+   PRINT_D(CORECONFIG_DBG, "TSF :%x\n", network_info->u32Tsf);
 
u32Tsf_Lo = get_beacon_timestamp_lo(pu8msa);
u32Tsf_Hi = get_beacon_timestamp_hi(pu8msa);
 
-   pstrNetworkInfo->u64Tsf = u32Tsf_Lo | ((u64)u32Tsf_Hi << 32);
+   network_info->u64Tsf = u32Tsf_Lo | ((u64)u32Tsf_Hi << 32);
 
-   get_ssid(pu8msa, pstrNetworkInfo->au8ssid, 
&pstrNetworkInfo->u8SsidLen);
-   get_BSSID(pu8msa, pstrNetworkInfo->au8bssid);
+   get_ssid(pu8msa, network_info->au8ssid, 
&network_info->u8SsidLen);
+   get_BSSID(pu8msa, network_info->au8bssid);
 
-   pstrNetworkInfo->u8channel = get_current_channel_802_11n(pu8msa,
+   network_info->u8channel = get_current_channel_802_11n(pu8msa,
rx_len + FCS_LEN);
 
u8index = MAC_HDR_LEN + TIME_STAMP_LEN;
 
-   pstrNetworkInfo->u16BeaconPeriod = get_beacon_period(pu8msa + 
u8index);
+   network_info->u16BeaconPeriod = get_beacon_period(pu8msa + 
u8index);
 
u8index += BEACON_INTERVAL_LEN + CAP_INFO_LEN;
 
pu8TimElm = get_tim_elm(pu8msa, rx_len + FCS_LEN, u8index);
if (pu8TimElm)
-   pstrNetworkInfo->u8DtimPeriod = pu8TimElm[3];
+   network_info->u8DtimPeriod = pu8TimElm[3];
pu8IEs = &pu8msa[MAC_HDR_LEN + TIME_STAMP_LEN + 
BEACON_INTERVAL_LEN + CAP_INFO_LEN];
u16IEsLen = rx_len - (MAC_HDR_LEN + TIME_STAMP_LEN + 
BEACON_INTERVAL_LEN + CAP_INFO_LEN);
 
if (u16IEsLen > 0) {
-   pstrNetworkInfo->pu8IEs = kmemdup(pu8IEs, u16IEsLen,
- GFP_KERNEL);
-   if (!pstrNetworkInfo->pu8IEs)
+  

[PATCH 11/12] staging: wilc1000: wilc_dealloc_assoc_resp_info(): renames function variables

2016-01-27 Thread Leo Kim
This patch renames to avoid camelcase, changes follow are:
 - pstrConnectRespInfo to connect_resp_info

Signed-off-by: Leo Kim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 14 +++---
 drivers/staging/wilc1000/coreconfigurator.h |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index c0be33d..c78da2c 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -410,20 +410,20 @@ s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
return 0;
 }
 
-s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo)
+s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *connect_resp_info)
 {
s32 result = 0;
 
-   if (pstrConnectRespInfo) {
-   if (pstrConnectRespInfo->pu8RespIEs) {
-   kfree(pstrConnectRespInfo->pu8RespIEs);
-   pstrConnectRespInfo->pu8RespIEs = NULL;
+   if (connect_resp_info) {
+   if (connect_resp_info->pu8RespIEs) {
+   kfree(connect_resp_info->pu8RespIEs);
+   connect_resp_info->pu8RespIEs = NULL;
} else {
result = -EFAULT;
}
 
-   kfree(pstrConnectRespInfo);
-   pstrConnectRespInfo = NULL;
+   kfree(connect_resp_info);
+   connect_resp_info = NULL;
 
} else {
result = -EFAULT;
diff --git a/drivers/staging/wilc1000/coreconfigurator.h 
b/drivers/staging/wilc1000/coreconfigurator.h
index 6a2c323..ec810b5 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -124,7 +124,7 @@ s32 wilc_parse_network_info(u8 *msg_buffer, tstrNetworkInfo 
**ret_network_info);
 s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo);
 s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
   tstrConnectRespInfo **ret_connect_resp_info);
-s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo);
+s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *connect_resp_info);
 void wilc_scan_complete_received(struct wilc *wilc, u8 *pu8Buffer,
 u32 u32Length);
 void wilc_network_info_received(struct wilc *wilc, u8 *pu8Buffer,
-- 
1.9.1

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


[PATCH 08/12] staging: wilc1000: rename variable s32Error

2016-01-27 Thread Leo Kim
This patch renames variable s32Error to result
to avoid CamelCase naming convention.
Also, remove the unused variable s32Error and replace with direct return.

Signed-off-by: Leo Kim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 2a4e324..88e5661 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -356,30 +356,29 @@ s32 wilc_parse_network_info(u8 *msg_buffer, 
tstrNetworkInfo **ret_network_info)
 
 s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo)
 {
-   s32 s32Error = 0;
+   s32 result = 0;
 
if (pstrNetworkInfo) {
if (pstrNetworkInfo->pu8IEs) {
kfree(pstrNetworkInfo->pu8IEs);
pstrNetworkInfo->pu8IEs = NULL;
} else {
-   s32Error = -EFAULT;
+   result = -EFAULT;
}
 
kfree(pstrNetworkInfo);
pstrNetworkInfo = NULL;
 
} else {
-   s32Error = -EFAULT;
+   result = -EFAULT;
}
 
-   return s32Error;
+   return result;
 }
 
 s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
   tstrConnectRespInfo **ppstrConnectRespInfo)
 {
-   s32 s32Error = 0;
tstrConnectRespInfo *pstrConnectRespInfo = NULL;
u16 u16AssocRespLen = 0;
u8 *pu8IEs = NULL;
@@ -408,27 +407,27 @@ s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 
u32BufferLen,
 
*ppstrConnectRespInfo = pstrConnectRespInfo;
 
-   return s32Error;
+   return 0;
 }
 
 s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo)
 {
-   s32 s32Error = 0;
+   s32 result = 0;
 
if (pstrConnectRespInfo) {
if (pstrConnectRespInfo->pu8RespIEs) {
kfree(pstrConnectRespInfo->pu8RespIEs);
pstrConnectRespInfo->pu8RespIEs = NULL;
} else {
-   s32Error = -EFAULT;
+   result = -EFAULT;
}
 
kfree(pstrConnectRespInfo);
pstrConnectRespInfo = NULL;
 
} else {
-   s32Error = -EFAULT;
+   result = -EFAULT;
}
 
-   return s32Error;
+   return result;
 }
-- 
1.9.1

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


[PATCH 05/12] staging: wilc1000: wilc_parse_network_info(): renames function variables

2016-01-27 Thread Leo Kim
This patch renames to avoid camelcase, changes follow are:
 - pu8MsgBuffer to msg_buffer
 - ppstrNetworkInfo to ret_network_info

Signed-off-by: Leo Kim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 16 
 drivers/staging/wilc1000/coreconfigurator.h |  2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 6f17e2b..43f0a29 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -270,7 +270,7 @@ static u8 get_current_channel_802_11n(u8 *pu8msa, u16 
rx_len)
return 0;
 }
 
-s32 wilc_parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo)
+s32 wilc_parse_network_info(u8 *msg_buffer, tstrNetworkInfo **ret_network_info)
 {
tstrNetworkInfo *pstrNetworkInfo = NULL;
u8 u8MsgType = 0;
@@ -281,18 +281,18 @@ s32 wilc_parse_network_info(u8 *pu8MsgBuffer, 
tstrNetworkInfo **ppstrNetworkInfo
u16 u16WidLen  = 0;
u8  *pu8WidVal = NULL;
 
-   u8MsgType = pu8MsgBuffer[0];
+   u8MsgType = msg_buffer[0];
 
if ('N' != u8MsgType) {
PRINT_ER("Received Message format incorrect.\n");
return -EFAULT;
}
 
-   u8MsgID = pu8MsgBuffer[1];
-   u16MsgLen = MAKE_WORD16(pu8MsgBuffer[2], pu8MsgBuffer[3]);
-   u16WidID = MAKE_WORD16(pu8MsgBuffer[4], pu8MsgBuffer[5]);
-   u16WidLen = MAKE_WORD16(pu8MsgBuffer[6], pu8MsgBuffer[7]);
-   pu8WidVal  = &pu8MsgBuffer[8];
+   u8MsgID = msg_buffer[1];
+   u16MsgLen = MAKE_WORD16(msg_buffer[2], msg_buffer[3]);
+   u16WidID = MAKE_WORD16(msg_buffer[4], msg_buffer[5]);
+   u16WidLen = MAKE_WORD16(msg_buffer[6], msg_buffer[7]);
+   pu8WidVal = &msg_buffer[8];
 
{
u8  *pu8msa = NULL;
@@ -350,7 +350,7 @@ s32 wilc_parse_network_info(u8 *pu8MsgBuffer, 
tstrNetworkInfo **ppstrNetworkInfo
 
}
 
-   *ppstrNetworkInfo = pstrNetworkInfo;
+   *ret_network_info = pstrNetworkInfo;
 
return 0;
 }
diff --git a/drivers/staging/wilc1000/coreconfigurator.h 
b/drivers/staging/wilc1000/coreconfigurator.h
index ee107ac..aec0779 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -120,7 +120,7 @@ typedef struct {
size_t ie_len;
 } tstrDisconnectNotifInfo;
 
-s32 wilc_parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo);
+s32 wilc_parse_network_info(u8 *msg_buffer, tstrNetworkInfo 
**ret_network_info);
 s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo);
 
 s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
-- 
1.9.1

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


[PATCH 12/12] staging: wilc1000: wilc_dealloc_network_info(): renames function variables

2016-01-27 Thread Leo Kim
This patch renames to avoid camelcase, changes follow are:
 - pstrNetworkInfo to network_info

Signed-off-by: Leo Kim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 14 +++---
 drivers/staging/wilc1000/coreconfigurator.h |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index c78da2c..a0b80bf 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -354,20 +354,20 @@ s32 wilc_parse_network_info(u8 *msg_buffer, 
tstrNetworkInfo **ret_network_info)
return 0;
 }
 
-s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo)
+s32 wilc_dealloc_network_info(tstrNetworkInfo *network_info)
 {
s32 result = 0;
 
-   if (pstrNetworkInfo) {
-   if (pstrNetworkInfo->pu8IEs) {
-   kfree(pstrNetworkInfo->pu8IEs);
-   pstrNetworkInfo->pu8IEs = NULL;
+   if (network_info) {
+   if (network_info->pu8IEs) {
+   kfree(network_info->pu8IEs);
+   network_info->pu8IEs = NULL;
} else {
result = -EFAULT;
}
 
-   kfree(pstrNetworkInfo);
-   pstrNetworkInfo = NULL;
+   kfree(network_info);
+   network_info = NULL;
 
} else {
result = -EFAULT;
diff --git a/drivers/staging/wilc1000/coreconfigurator.h 
b/drivers/staging/wilc1000/coreconfigurator.h
index ec810b5..d801e58 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -121,7 +121,7 @@ typedef struct {
 } tstrDisconnectNotifInfo;
 
 s32 wilc_parse_network_info(u8 *msg_buffer, tstrNetworkInfo 
**ret_network_info);
-s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo);
+s32 wilc_dealloc_network_info(tstrNetworkInfo *network_info);
 s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
   tstrConnectRespInfo **ret_connect_resp_info);
 s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *connect_resp_info);
-- 
1.9.1

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


[PATCH 07/12] staging: wilc1000: wilc_parse_network_info(): renames local inner variables

2016-01-27 Thread Leo Kim
This patch renames to avoid camelcase, changes follow are:
 - pu8TimElm to tim_elm
 - pu8IEs to ies
 - u16IEsLen to ies_len
 - u32Tsf_Lo to tsf_lo
 - u32Tsf_Hi to tsf_hi

And, remove the prefix variable defined name, below are:
 - u8index to index
 - pu8msa to msa

Signed-off-by: Leo Kim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 54 ++---
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 24afeb8..2a4e324 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -295,14 +295,14 @@ s32 wilc_parse_network_info(u8 *msg_buffer, 
tstrNetworkInfo **ret_network_info)
wid_val = &msg_buffer[8];
 
{
-   u8  *pu8msa = NULL;
+   u8 *msa = NULL;
u16 rx_len = 0;
-   u8 *pu8TimElm = NULL;
-   u8 *pu8IEs = NULL;
-   u16 u16IEsLen = 0;
-   u8 u8index = 0;
-   u32 u32Tsf_Lo;
-   u32 u32Tsf_Hi;
+   u8 *tim_elm = NULL;
+   u8 *ies = NULL;
+   u16 ies_len = 0;
+   u8 index = 0;
+   u32 tsf_lo;
+   u32 tsf_hi;
 
network_info = kzalloc(sizeof(tstrNetworkInfo), GFP_KERNEL);
if (!network_info)
@@ -310,43 +310,43 @@ s32 wilc_parse_network_info(u8 *msg_buffer, 
tstrNetworkInfo **ret_network_info)
 
network_info->s8rssi = wid_val[0];
 
-   pu8msa = &wid_val[1];
+   msa = &wid_val[1];
 
rx_len = wid_len - 1;
-   network_info->u16CapInfo = get_cap_info(pu8msa);
-   network_info->u32Tsf = get_beacon_timestamp_lo(pu8msa);
+   network_info->u16CapInfo = get_cap_info(msa);
+   network_info->u32Tsf = get_beacon_timestamp_lo(msa);
PRINT_D(CORECONFIG_DBG, "TSF :%x\n", network_info->u32Tsf);
 
-   u32Tsf_Lo = get_beacon_timestamp_lo(pu8msa);
-   u32Tsf_Hi = get_beacon_timestamp_hi(pu8msa);
+   tsf_lo = get_beacon_timestamp_lo(msa);
+   tsf_hi = get_beacon_timestamp_hi(msa);
 
-   network_info->u64Tsf = u32Tsf_Lo | ((u64)u32Tsf_Hi << 32);
+   network_info->u64Tsf = tsf_lo | ((u64)tsf_hi << 32);
 
-   get_ssid(pu8msa, network_info->au8ssid, 
&network_info->u8SsidLen);
-   get_BSSID(pu8msa, network_info->au8bssid);
+   get_ssid(msa, network_info->au8ssid, &network_info->u8SsidLen);
+   get_BSSID(msa, network_info->au8bssid);
 
-   network_info->u8channel = get_current_channel_802_11n(pu8msa,
+   network_info->u8channel = get_current_channel_802_11n(msa,
rx_len + FCS_LEN);
 
-   u8index = MAC_HDR_LEN + TIME_STAMP_LEN;
+   index = MAC_HDR_LEN + TIME_STAMP_LEN;
 
-   network_info->u16BeaconPeriod = get_beacon_period(pu8msa + 
u8index);
+   network_info->u16BeaconPeriod = get_beacon_period(msa + index);
 
-   u8index += BEACON_INTERVAL_LEN + CAP_INFO_LEN;
+   index += BEACON_INTERVAL_LEN + CAP_INFO_LEN;
 
-   pu8TimElm = get_tim_elm(pu8msa, rx_len + FCS_LEN, u8index);
-   if (pu8TimElm)
-   network_info->u8DtimPeriod = pu8TimElm[3];
-   pu8IEs = &pu8msa[MAC_HDR_LEN + TIME_STAMP_LEN + 
BEACON_INTERVAL_LEN + CAP_INFO_LEN];
-   u16IEsLen = rx_len - (MAC_HDR_LEN + TIME_STAMP_LEN + 
BEACON_INTERVAL_LEN + CAP_INFO_LEN);
+   tim_elm = get_tim_elm(msa, rx_len + FCS_LEN, index);
+   if (tim_elm)
+   network_info->u8DtimPeriod = tim_elm[3];
+   ies = &msa[MAC_HDR_LEN + TIME_STAMP_LEN + BEACON_INTERVAL_LEN + 
CAP_INFO_LEN];
+   ies_len = rx_len - (MAC_HDR_LEN + TIME_STAMP_LEN + 
BEACON_INTERVAL_LEN + CAP_INFO_LEN);
 
-   if (u16IEsLen > 0) {
-   network_info->pu8IEs = kmemdup(pu8IEs, u16IEsLen,
+   if (ies_len > 0) {
+   network_info->pu8IEs = kmemdup(ies, ies_len,
   GFP_KERNEL);
if (!network_info->pu8IEs)
return -ENOMEM;
}
-   network_info->u16IEsLen = u16IEsLen;
+   network_info->u16IEsLen = ies_len;
}
 
*ret_network_info = network_info;
-- 
1.9.1

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


RE: [PATCH v2] iwldvm: fix chain gain calibration when firmware return zero values

2016-01-27 Thread Grumbach, Emmanuel
> 
> 2016-01-27 2:46 GMT-05:00 Grumbach, Emmanuel
> :
> >> Hi
> >>
> >> 2016-01-26 3:28 GMT-05:00 Grumbach, Emmanuel
> >> :
> >> >
> >> >
> >> > On 01/26/2016 12:20 AM, Nikolay Martynov wrote:
> >> >> It looks like sometimes firmware returns zero for chain noise and
> >> >> signal during calibration period. This seems to be a known problem
> >> >> and current implementation accounts for this by ignoring invalid
> >> >> data when all chains return zero signal and noise.
> >> >>
> >> >> The problem is that sometimes firmware returns zero for only one
> >> >> chain for some (not all) beacons used for calibration. This leads
> >> >> to perfectly valid chains be disabled and may cause invalid gain
> settings.
> >> >> For example this is calibration data taken on laptop with Intel
> >> >> 6300 card with all three antennas attached:
> >> >>
> >> >> active_chains: 3
> >> >> chain_noise_a: 312
> >> >> chain_noise_b: 297
> >> >> chain_noise_c: 0
> >> >> chain_signal_a:549
> >> >> chain_signal_b:513
> >> >> chain_signal_c:0
> >> >> beacon_count:  16
> >> >> disconn_array: 0 0 1
> >> >> delta_gain_code:   4 0 0
> >> >> radio_write:   1
> >> >> state: 3
> >> >>
> >> >> This patch changes statistics gathering to make sure that zero
> >> >> noise results are ignored for valid rx chains. The rationale being
> >> >> that even if anntenna is not connected we should be able to see
> >> >> non zero noise if rx chain is present.
> >> >
> >> > But then the firmware will continue to send zero for signal and
> >> > this will impact lots of flows like roaming. If the driver allows
> >> > the firmware to use that antenna, the firmware may use this antenna
> >> > for scanning and roaming will be broken.
> >> > This seems to be a bug in the firmware, but there isn't much I can
> >> > do about it.
> >> > Sorry, I have to NACK this patch.
> >>
> >>   Could you please elaborate on how this patch would affect roaming
> >> or other things. As far as I can see this patch doesn't change much
> >> behavior apart from ignoring invalid values from firmware.
> >> Disconnected antennas still get disabled (as before) connected
> >> antennas still work (more often than before). So I'm not sure I can
> >> see how this patch would change what firmware does at all. I really
> >> hope you could find a moment and explain this.
> >>
> >
> > What you are saying here is that there is a bug in the firmware which
> > makes it report wrong values for one of the antennas. But when you
> > will have this antenna enabled (with your patch), the firmware will
> > keep sending bad signal / noise values for it. If the driver allows
> > the firmware to use this antenna (after your patch), the firmware will
> > choose this antenna to receive beacons or to scan. Then, the driver will
> look at the beacons' rssi (which will be wrong) and it will think that an AP
> which is very close is in fact far away.
> >
> No. That is not correct, I think. What I'm saying is that sometimes (not
> always) firmware is sending 0 (exactly 0) for signal and noise for some (or 
> all)
> chains.
> The case when all chains get 0 seem to be a known problem: it is worked
> around in iwl_find_disconn_antenna. The case when only one chain gets
> zero is not currently handled.
> And just to clarify - all chains are affected by this problem, it's not like 
> one
> specific chain is broken in some way and gets zero. So both of the cards I
> have may be running with 3 chains or with 2 chains depending on how lucky
> I'm during initial scan.
> 
> It's just firmware that has a bug that sometimes returns zero for chain 1,
> sometimes for chain 2, and sometimes for all of them.
> So currently driver is already enabling chains for which we may get zero later
> for rssi (presumably this is true) if it gets non zero during scan for first 
> 16
> beacons.
> Moreover, if it gets non-zero for 15 out of 16 beacons the chain is not
> disabled but gain values are wrong because of this - and one chain would be
> amplifying things more than it should - this is currently happening to the 
> best
> of my understanding.
> 
> So my patch filters out results that we know are bad to account for this
> firmware bug.
> With this patch all chains with antenna attached get signal and noise reading 
> -
> suggesting that firmware actually returns zero only some times and after
> several retries we get reasonable statistics. It looks like there are some
> 'transitioning' processes in firmware and if we out-wait them we get good
> statistics.
> 
> I'm not sure I see how this patch makes anything more worse than they
> currently already are.
> Currently it is already (presumably) possible to get wrong rssi reading
> because chain that may have been enabled during