[PATCH v2 2/7] ath10k: add sanity checks for service bmap parsing

2014-11-27 Thread Michal Kazior
This shouldn't really happen but take into account
the original service bitmap length when mapping
service ids.

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

Notes:
v2:
 * remove space between brackets as per checkpatch warning

 drivers/net/wireless/ath/ath10k/wmi.c |   6 +-
 drivers/net/wireless/ath/ath10k/wmi.h | 121 +-
 2 files changed, 66 insertions(+), 61 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index c6c03e5..81ccc2e 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2516,10 +2516,12 @@ static void ath10k_wmi_event_service_ready(struct 
ath10k *ar,
 
if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar-fw_features)) {
ret = ath10k_wmi_10x_pull_svc_rdy_ev(skb, arg);
-   wmi_10x_svc_map(arg.service_map, svc_bmap);
+   wmi_10x_svc_map(arg.service_map, svc_bmap,
+   arg.service_map_len);
} else {
ret = ath10k_wmi_main_pull_svc_rdy_ev(skb, arg);
-   wmi_main_svc_map(arg.service_map, svc_bmap);
+   wmi_main_svc_map(arg.service_map, svc_bmap,
+arg.service_map_len);
}
 
if (ret) {
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index fc6b844..724929d 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -222,128 +222,131 @@ static inline char *wmi_service_name(int service_id)
 #undef SVCSTR
 }
 
-#define WMI_SERVICE_IS_ENABLED(wmi_svc_bmap, svc_id) \
-   (__le32_to_cpu((wmi_svc_bmap)[(svc_id)/(sizeof(u32))])  \
+#define WMI_SERVICE_IS_ENABLED(wmi_svc_bmap, svc_id, len) \
+   ((svc_id)  (len)  \
+__le32_to_cpu((wmi_svc_bmap)[(svc_id)/(sizeof(u32))])  \
 BIT((svc_id)%(sizeof(u32
 
-#define SVCMAP(x, y) \
+#define SVCMAP(x, y, len) \
do { \
-   if (WMI_SERVICE_IS_ENABLED((in), (x))) \
+   if (WMI_SERVICE_IS_ENABLED((in), (x), (len))) \
__set_bit(y, out); \
} while (0)
 
-static inline void wmi_10x_svc_map(const __le32 *in, unsigned long *out)
+static inline void wmi_10x_svc_map(const __le32 *in, unsigned long *out,
+  size_t len)
 {
SVCMAP(WMI_10X_SERVICE_BEACON_OFFLOAD,
-  WMI_SERVICE_BEACON_OFFLOAD);
+  WMI_SERVICE_BEACON_OFFLOAD, len);
SVCMAP(WMI_10X_SERVICE_SCAN_OFFLOAD,
-  WMI_SERVICE_SCAN_OFFLOAD);
+  WMI_SERVICE_SCAN_OFFLOAD, len);
SVCMAP(WMI_10X_SERVICE_ROAM_OFFLOAD,
-  WMI_SERVICE_ROAM_OFFLOAD);
+  WMI_SERVICE_ROAM_OFFLOAD, len);
SVCMAP(WMI_10X_SERVICE_BCN_MISS_OFFLOAD,
-  WMI_SERVICE_BCN_MISS_OFFLOAD);
+  WMI_SERVICE_BCN_MISS_OFFLOAD, len);
SVCMAP(WMI_10X_SERVICE_STA_PWRSAVE,
-  WMI_SERVICE_STA_PWRSAVE);
+  WMI_SERVICE_STA_PWRSAVE, len);
SVCMAP(WMI_10X_SERVICE_STA_ADVANCED_PWRSAVE,
-  WMI_SERVICE_STA_ADVANCED_PWRSAVE);
+  WMI_SERVICE_STA_ADVANCED_PWRSAVE, len);
SVCMAP(WMI_10X_SERVICE_AP_UAPSD,
-  WMI_SERVICE_AP_UAPSD);
+  WMI_SERVICE_AP_UAPSD, len);
SVCMAP(WMI_10X_SERVICE_AP_DFS,
-  WMI_SERVICE_AP_DFS);
+  WMI_SERVICE_AP_DFS, len);
SVCMAP(WMI_10X_SERVICE_11AC,
-  WMI_SERVICE_11AC);
+  WMI_SERVICE_11AC, len);
SVCMAP(WMI_10X_SERVICE_BLOCKACK,
-  WMI_SERVICE_BLOCKACK);
+  WMI_SERVICE_BLOCKACK, len);
SVCMAP(WMI_10X_SERVICE_PHYERR,
-  WMI_SERVICE_PHYERR);
+  WMI_SERVICE_PHYERR, len);
SVCMAP(WMI_10X_SERVICE_BCN_FILTER,
-  WMI_SERVICE_BCN_FILTER);
+  WMI_SERVICE_BCN_FILTER, len);
SVCMAP(WMI_10X_SERVICE_RTT,
-  WMI_SERVICE_RTT);
+  WMI_SERVICE_RTT, len);
SVCMAP(WMI_10X_SERVICE_RATECTRL,
-  WMI_SERVICE_RATECTRL);
+  WMI_SERVICE_RATECTRL, len);
SVCMAP(WMI_10X_SERVICE_WOW,
-  WMI_SERVICE_WOW);
+  WMI_SERVICE_WOW, len);
SVCMAP(WMI_10X_SERVICE_RATECTRL_CACHE,
-  WMI_SERVICE_RATECTRL_CACHE);
+  WMI_SERVICE_RATECTRL_CACHE, len);
SVCMAP(WMI_10X_SERVICE_IRAM_TIDS,
-  WMI_SERVICE_IRAM_TIDS);
+  WMI_SERVICE_IRAM_TIDS, len);
SVCMAP(WMI_10X_SERVICE_BURST,
-  WMI_SERVICE_BURST);
+  WMI_SERVICE_BURST, len);
SVCMAP(WMI_10X_SERVICE_SMART_ANTENNA_SW_SUPPORT,
-  WMI_SERVICE_SMART_ANTENNA_SW_SUPPORT);
+  WMI_SERVICE_SMART_ANTENNA_SW_SUPPORT, len);
SVCMAP(WMI_10X_SERVICE_FORCE_FW_HANG,
-  WMI_SERVICE_FORCE_FW_HANG);
+  WMI_SERVICE_FORCE_FW_HANG, len);

[PATCH v2 5/7] ath10k: introduce wmi ops

2014-11-27 Thread Michal Kazior
Since the 10.x fw branch support was introduced it
became apparent ath10k will need to be able to
deal with different fw ABIs eventually.

The patch creates an abstraction for dealing with
command and event structures across different ABIs
and mostly gets rid of the
ATH10K_FW_FEATURE_WMI_10X flag usage.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/core.c |   1 +
 drivers/net/wireless/ath/ath10k/core.h |   1 +
 drivers/net/wireless/ath/ath10k/debug.c|   1 +
 drivers/net/wireless/ath/ath10k/mac.c  |   2 +
 drivers/net/wireless/ath/ath10k/spectral.c |   1 +
 drivers/net/wireless/ath/ath10k/wmi-ops.h  | 820 ++
 drivers/net/wireless/ath/ath10k/wmi.c  | 888 +
 drivers/net/wireless/ath/ath10k/wmi.h  |  67 +--
 8 files changed, 1345 insertions(+), 436 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath10k/wmi-ops.h

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 7762061..e8384e1 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -27,6 +27,7 @@
 #include debug.h
 #include htt.h
 #include testmode.h
+#include wmi-ops.h
 
 unsigned int ath10k_debug_mask;
 static bool uart_print;
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 5af9a24..837972c 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -127,6 +127,7 @@ struct ath10k_wmi {
struct wmi_cmd_map *cmd;
struct wmi_vdev_param_map *vdev_param;
struct wmi_pdev_param_map *pdev_param;
+   const struct wmi_ops *ops;
 
u32 num_mem_chunks;
struct ath10k_mem_chunk mem_chunks[WMI_MAX_MEM_REQS];
diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index a716758..c15b5774 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -23,6 +23,7 @@
 #include core.h
 #include debug.h
 #include hif.h
+#include wmi-ops.h
 
 /* ms */
 #define ATH10K_DEBUG_HTT_STATS_INTERVAL 1000
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index e475cc4..2bc97f3 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -27,6 +27,8 @@
 #include htt.h
 #include txrx.h
 #include testmode.h
+#include wmi.h
+#include wmi-ops.h
 
 /**/
 /* Crypto */
diff --git a/drivers/net/wireless/ath/ath10k/spectral.c 
b/drivers/net/wireless/ath/ath10k/spectral.c
index 63ce61f..d22addf 100644
--- a/drivers/net/wireless/ath/ath10k/spectral.c
+++ b/drivers/net/wireless/ath/ath10k/spectral.c
@@ -17,6 +17,7 @@
 #include linux/relay.h
 #include core.h
 #include debug.h
+#include wmi-ops.h
 
 static void send_fft_sample(struct ath10k *ar,
const struct fft_sample_tlv *fft_sample_tlv)
diff --git a/drivers/net/wireless/ath/ath10k/wmi-ops.h 
b/drivers/net/wireless/ath/ath10k/wmi-ops.h
new file mode 100644
index 000..f3b87a8
--- /dev/null
+++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h
@@ -0,0 +1,820 @@
+/*
+ * Copyright (c) 2005-2011 Atheros Communications Inc.
+ * Copyright (c) 2011-2014 Qualcomm Atheros, Inc.
+ *
+ * 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.
+ */
+
+#ifndef _WMI_OPS_H_
+#define _WMI_OPS_H_
+
+struct ath10k;
+struct sk_buff;
+
+struct wmi_ops {
+   void (*rx)(struct ath10k *ar, struct sk_buff *skb);
+   void (*map_svc)(const __le32 *in, unsigned long *out, size_t len);
+
+   int (*pull_scan)(struct ath10k *ar, struct sk_buff *skb,
+struct wmi_scan_ev_arg *arg);
+   int (*pull_mgmt_rx)(struct ath10k *ar, struct sk_buff *skb,
+   struct wmi_mgmt_rx_ev_arg *arg);
+   int (*pull_ch_info)(struct ath10k *ar, struct sk_buff *skb,
+   struct wmi_ch_info_ev_arg *arg);
+   int (*pull_vdev_start)(struct ath10k *ar, struct sk_buff *skb,
+  struct wmi_vdev_start_ev_arg *arg);
+   int (*pull_peer_kick)(struct ath10k *ar, struct sk_buff *skb,
+ struct wmi_peer_kick_ev_arg *arg);
+   int (*pull_swba)(struct ath10k 

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

2014-11-27 Thread Michal Kazior
Latest main firmware branch introduced a new WMI
ABI called wmi-tlv. It is not a tlv strictly
speaking but something that resembles it because
it is ordered and may have duplicate id entries.

This prepares ath10k to support new hw.

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

Notes:
v2:
 * fix kbuildbot warning regarding %ld
 * add missing __packed to wmi_tlv_peer_create_cmd
 * fix pdev set wmm param command generation
 * tune wmi init setup to avoid some multi-vif related fw crashes
 * add missing pktlog enable/disable impl.
 * remove space between brackets as per checkpatch error
 * rename vdev stat var (shorter)
 * add more enum entries (pdev, vdev, cmd, event, tags, services)
 * s/STRUC/STRUCT/ to satisfy checkpatch
 * fix some other checkpatch warnings
 * changed some enum names to be shorter
   (s/_FIXED_PARAM// and s/STRUCT_WMI_/STRUCT_/)

 drivers/net/wireless/ath/ath10k/Makefile  |1 +
 drivers/net/wireless/ath/ath10k/ce.c  |2 +
 drivers/net/wireless/ath/ath10k/core.c|3 +
 drivers/net/wireless/ath/ath10k/core.h|3 +
 drivers/net/wireless/ath/ath10k/hw.h  |9 +
 drivers/net/wireless/ath/ath10k/mac.c |   45 +
 drivers/net/wireless/ath/ath10k/wmi-tlv.c | 2218 +
 drivers/net/wireless/ath/ath10k/wmi-tlv.h | 1380 ++
 drivers/net/wireless/ath/ath10k/wmi.c |6 +-
 drivers/net/wireless/ath/ath10k/wmi.h |   76 +
 10 files changed, 3742 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/wireless/ath/ath10k/wmi-tlv.c
 create mode 100644 drivers/net/wireless/ath/ath10k/wmi-tlv.h

diff --git a/drivers/net/wireless/ath/ath10k/Makefile 
b/drivers/net/wireless/ath/ath10k/Makefile
index 8b1b1ad..8abb66c 100644
--- a/drivers/net/wireless/ath/ath10k/Makefile
+++ b/drivers/net/wireless/ath/ath10k/Makefile
@@ -8,6 +8,7 @@ ath10k_core-y += mac.o \
 htt_tx.o \
 txrx.o \
 wmi.o \
+wmi-tlv.o \
 bmi.o
 
 ath10k_core-$(CONFIG_ATH10K_DEBUGFS) += spectral.o
diff --git a/drivers/net/wireless/ath/ath10k/ce.c 
b/drivers/net/wireless/ath/ath10k/ce.c
index a156e6e..42ec793 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -1093,6 +1093,8 @@ int ath10k_ce_alloc_pipe(struct ath10k *ar, int ce_id,
 (CE_HTT_H2T_MSG_SRC_NENTRIES - 1));
BUILD_BUG_ON(2*TARGET_10X_NUM_MSDU_DESC 
 (CE_HTT_H2T_MSG_SRC_NENTRIES - 1));
+   BUILD_BUG_ON(2*TARGET_TLV_NUM_MSDU_DESC 
+(CE_HTT_H2T_MSG_SRC_NENTRIES - 1));
 
ce_state-ar = ar;
ce_state-id = ce_id;
diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index e8384e1..6e820a6 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -805,6 +805,9 @@ static void ath10k_core_init_max_sta_count(struct ath10k 
*ar)
if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar-fw_features)) {
ar-max_num_peers = TARGET_10X_NUM_PEERS;
ar-max_num_stations = TARGET_10X_NUM_STATIONS;
+   } else if (test_bit(ATH10K_FW_FEATURE_WMI_TLV, ar-fw_features)) {
+   ar-max_num_peers = TARGET_TLV_NUM_PEERS;
+   ar-max_num_stations = TARGET_TLV_NUM_STATIONS;
} else {
ar-max_num_peers = TARGET_NUM_PEERS;
ar-max_num_stations = TARGET_NUM_STATIONS;
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 837972c..88bedaf 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -383,6 +383,9 @@ enum ath10k_fw_features {
 */
ATH10K_FW_FEATURE_WMI_10_2 = 4,
 
+   /* Firmware uses WMI TLV */
+   ATH10K_FW_FEATURE_WMI_TLV = 5,
+
/* keep last */
ATH10K_FW_FEATURE_COUNT,
 };
diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
b/drivers/net/wireless/ath/ath10k/hw.h
index dfedfd0..479dc4d 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -162,6 +162,15 @@ struct ath10k_pktlog_hdr {
 #define TARGET_10X_NUM_MSDU_DESC   (1024 + 400)
 #define TARGET_10X_MAX_FRAG_ENTRIES0
 
+/* Target specific defines for WMI-TLV firmware */
+#define TARGET_TLV_NUM_VDEVS   3
+#define TARGET_TLV_NUM_STATIONS32
+#define TARGET_TLV_NUM_PEERS   ((TARGET_TLV_NUM_STATIONS) + \
+(TARGET_TLV_NUM_VDEVS) + \
+2)
+#define TARGET_TLV_NUM_TIDS((TARGET_TLV_NUM_PEERS) * 2)
+#define TARGET_TLV_NUM_MSDU_DESC   (1024 + 32)
+
 /* Number of Copy Engines supported */
 #define CE_COUNT 8
 
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 

[PATCH v2 3/7] ath10k: make wmi service bitmap non-debug

2014-11-27 Thread Michal Kazior
The service bitmap can be used to determine
firmware capabilities.

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

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 4a29498..5af9a24 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -123,6 +123,7 @@ struct ath10k_wmi {
struct completion service_ready;
struct completion unified_ready;
wait_queue_head_t tx_credits_wq;
+   DECLARE_BITMAP(svc_map, WMI_SERVICE_MAX);
struct wmi_cmd_map *cmd;
struct wmi_vdev_param_map *vdev_param;
struct wmi_pdev_param_map *pdev_param;
@@ -313,7 +314,6 @@ struct ath10k_debug {
struct ath10k_fw_stats fw_stats;
struct completion fw_stats_complete;
bool fw_stats_done;
-   DECLARE_BITMAP(wmi_service_bitmap, WMI_SERVICE_MAX);
 
unsigned long htt_stats_mask;
struct delayed_work htt_stats_dwork;
diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index c096d00a..a716758 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -179,13 +179,6 @@ EXPORT_SYMBOL(ath10k_warn);
 
 #ifdef CONFIG_ATH10K_DEBUGFS
 
-void ath10k_debug_read_service_map(struct ath10k *ar,
-  const void *service_map,
-  size_t map_size)
-{
-   memcpy(ar-debug.wmi_service_bitmap, service_map, map_size);
-}
-
 static ssize_t ath10k_read_wmi_services(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
@@ -207,8 +200,9 @@ static ssize_t ath10k_read_wmi_services(struct file *file,
if (len  buf_len)
len = buf_len;
 
+   spin_lock_bh(ar-data_lock);
for (i = 0; i  WMI_SERVICE_MAX; i++) {
-   enabled = test_bit(i, ar-debug.wmi_service_bitmap);
+   enabled = test_bit(i, ar-wmi.svc_map);
name = wmi_service_name(i);
 
if (!name) {
@@ -224,6 +218,7 @@ static ssize_t ath10k_read_wmi_services(struct file *file,
 %-40s %s\n,
 name, enabled ? enabled : -);
}
+   spin_unlock_bh(ar-data_lock);
 
ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
 
diff --git a/drivers/net/wireless/ath/ath10k/debug.h 
b/drivers/net/wireless/ath/ath10k/debug.h
index 815d325..1b87a5d 100644
--- a/drivers/net/wireless/ath/ath10k/debug.h
+++ b/drivers/net/wireless/ath/ath10k/debug.h
@@ -62,9 +62,6 @@ int ath10k_debug_create(struct ath10k *ar);
 void ath10k_debug_destroy(struct ath10k *ar);
 int ath10k_debug_register(struct ath10k *ar);
 void ath10k_debug_unregister(struct ath10k *ar);
-void ath10k_debug_read_service_map(struct ath10k *ar,
-  const void *service_map,
-  size_t map_size);
 void ath10k_debug_fw_stats_process(struct ath10k *ar, struct sk_buff *skb);
 struct ath10k_fw_crash_data *
 ath10k_debug_get_new_fw_crash_data(struct ath10k *ar);
@@ -109,12 +106,6 @@ static inline void ath10k_debug_unregister(struct ath10k 
*ar)
 {
 }
 
-static inline void ath10k_debug_read_service_map(struct ath10k *ar,
-const void *service_map,
-size_t map_size)
-{
-}
-
 static inline void ath10k_debug_fw_stats_process(struct ath10k *ar,
 struct sk_buff *skb)
 {
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 81ccc2e..c0f3e4d 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2511,16 +2511,17 @@ static void ath10k_wmi_event_service_ready(struct 
ath10k *ar,
 {
struct wmi_svc_rdy_ev_arg arg = {};
u32 num_units, req_id, unit_size, num_mem_reqs, num_unit_info, i;
-   DECLARE_BITMAP(svc_bmap, WMI_SERVICE_MAX) = {};
int ret;
 
+   memset(ar-wmi.svc_map, 0, sizeof(ar-wmi.svc_map));
+
if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar-fw_features)) {
ret = ath10k_wmi_10x_pull_svc_rdy_ev(skb, arg);
-   wmi_10x_svc_map(arg.service_map, svc_bmap,
+   wmi_10x_svc_map(arg.service_map, ar-wmi.svc_map,
arg.service_map_len);
} else {
ret = ath10k_wmi_main_pull_svc_rdy_ev(skb, arg);
-   wmi_main_svc_map(arg.service_map, svc_bmap,
+   wmi_main_svc_map(arg.service_map, ar-wmi.svc_map,

[PATCH v2 6/7] ath10k: make some wmi functions public

2014-11-27 Thread Michal Kazior
Some functions can be shared across different WMI
ABIs. Make them public so different WMI backends
can use them from different source files in the
future.

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

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 0f3c410..e2dbe39 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -610,9 +610,8 @@ static struct wmi_cmd_map wmi_10_2_cmd_map = {
.gpio_output_cmdid = WMI_10_2_GPIO_OUTPUT_CMDID,
 };
 
-static void
-ath10k_wmi_put_wmi_channel(struct wmi_channel *ch,
-  const struct wmi_channel_arg *arg)
+void ath10k_wmi_put_wmi_channel(struct wmi_channel *ch,
+   const struct wmi_channel_arg *arg)
 {
u32 flags = 0;
 
@@ -987,7 +986,7 @@ static int ath10k_wmi_op_pull_scan_ev(struct ath10k *ar, 
struct sk_buff *skb,
return 0;
 }
 
-static int ath10k_wmi_event_scan(struct ath10k *ar, struct sk_buff *skb)
+int ath10k_wmi_event_scan(struct ath10k *ar, struct sk_buff *skb)
 {
struct wmi_scan_ev_arg arg = {};
enum wmi_scan_event_type event_type;
@@ -1206,7 +1205,7 @@ static int ath10k_wmi_op_pull_mgmt_rx_ev(struct ath10k 
*ar, struct sk_buff *skb,
return 0;
 }
 
-static int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)
+int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)
 {
struct wmi_mgmt_rx_ev_arg arg = {};
struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
@@ -1359,7 +1358,7 @@ static int ath10k_wmi_op_pull_ch_info_ev(struct ath10k 
*ar, struct sk_buff *skb,
return 0;
 }
 
-static void ath10k_wmi_event_chan_info(struct ath10k *ar, struct sk_buff *skb)
+void ath10k_wmi_event_chan_info(struct ath10k *ar, struct sk_buff *skb)
 {
struct wmi_ch_info_ev_arg arg = {};
struct survey_info *survey;
@@ -1427,12 +1426,12 @@ exit:
spin_unlock_bh(ar-data_lock);
 }
 
-static void ath10k_wmi_event_echo(struct ath10k *ar, struct sk_buff *skb)
+void ath10k_wmi_event_echo(struct ath10k *ar, struct sk_buff *skb)
 {
ath10k_dbg(ar, ATH10K_DBG_WMI, WMI_ECHO_EVENTID\n);
 }
 
-static int ath10k_wmi_event_debug_mesg(struct ath10k *ar, struct sk_buff *skb)
+int ath10k_wmi_event_debug_mesg(struct ath10k *ar, struct sk_buff *skb)
 {
ath10k_dbg(ar, ATH10K_DBG_WMI, wmi event debug mesg len %d\n,
   skb-len);
@@ -1442,8 +1441,8 @@ static int ath10k_wmi_event_debug_mesg(struct ath10k *ar, 
struct sk_buff *skb)
return 0;
 }
 
-static void ath10k_wmi_pull_pdev_stats(const struct wmi_pdev_stats *src,
-  struct ath10k_fw_stats_pdev *dst)
+void ath10k_wmi_pull_pdev_stats(const struct wmi_pdev_stats *src,
+   struct ath10k_fw_stats_pdev *dst)
 {
const struct wal_dbg_tx_stats *tx = src-wal.tx;
const struct wal_dbg_rx_stats *rx = src-wal.rx;
@@ -1495,8 +1494,8 @@ static void ath10k_wmi_pull_pdev_stats(const struct 
wmi_pdev_stats *src,
dst-mpdu_errs = __le32_to_cpu(rx-mpdu_errs);
 }
 
-static void ath10k_wmi_pull_peer_stats(const struct wmi_peer_stats *src,
-  struct ath10k_fw_stats_peer *dst)
+void ath10k_wmi_pull_peer_stats(const struct wmi_peer_stats *src,
+   struct ath10k_fw_stats_peer *dst)
 {
ether_addr_copy(dst-peer_macaddr, src-peer_macaddr.addr);
dst-peer_rssi = __le32_to_cpu(src-peer_rssi);
@@ -1618,8 +1617,7 @@ static int ath10k_wmi_10x_op_pull_fw_stats(struct ath10k 
*ar,
return 0;
 }
 
-static void ath10k_wmi_event_update_stats(struct ath10k *ar,
- struct sk_buff *skb)
+void ath10k_wmi_event_update_stats(struct ath10k *ar, struct sk_buff *skb)
 {
ath10k_dbg(ar, ATH10K_DBG_WMI, WMI_UPDATE_STATS_EVENTID\n);
ath10k_debug_fw_stats_process(ar, skb);
@@ -1643,8 +1641,7 @@ ath10k_wmi_op_pull_vdev_start_ev(struct ath10k *ar, 
struct sk_buff *skb,
return 0;
 }
 
-static void ath10k_wmi_event_vdev_start_resp(struct ath10k *ar,
-struct sk_buff *skb)
+void ath10k_wmi_event_vdev_start_resp(struct ath10k *ar, struct sk_buff *skb)
 {
struct wmi_vdev_start_ev_arg arg = {};
int ret;
@@ -1663,8 +1660,7 @@ static void ath10k_wmi_event_vdev_start_resp(struct 
ath10k *ar,
complete(ar-vdev_setup_done);
 }
 
-static void ath10k_wmi_event_vdev_stopped(struct ath10k *ar,
- struct sk_buff *skb)
+void ath10k_wmi_event_vdev_stopped(struct ath10k *ar, struct sk_buff *skb)
 {
ath10k_dbg(ar, ATH10K_DBG_WMI, WMI_VDEV_STOPPED_EVENTID\n);

[PATCH v8 1/2] nl80211: Stop scheduled scan if netlink client disappears

2014-11-27 Thread Jukka Rissanen
An attribute NL80211_ATTR_SOCKET_OWNER can be set by the scan initiator.
If present, the attribute will cause the scan to be stopped if the client
dies.

Signed-off-by: Jukka Rissanen jukka.rissa...@linux.intel.com
---
 include/net/cfg80211.h   |  1 +
 include/uapi/linux/nl80211.h |  3 +++
 net/wireless/core.c  | 16 
 net/wireless/core.h  |  2 ++
 net/wireless/nl80211.c   | 16 
 5 files changed, 38 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index bb748c4..5806c75 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1537,6 +1537,7 @@ struct cfg80211_sched_scan_request {
struct wiphy *wiphy;
struct net_device *dev;
unsigned long scan_start;
+   u32 owner_nlportid;
 
/* keep last */
struct ieee80211_channel *channels[0];
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index d775245..a0e3b32 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -1655,6 +1655,9 @@ enum nl80211_commands {
  * @NL80211_ATTR_SOCKET_OWNER: Flag attribute, if set during interface
  * creation then the new interface will be owned by the netlink socket
  * that created it and will be destroyed when the socket is closed.
+ * If set during scheduled scan start then the new scan req will be
+ * owned by the netlink socket that created it and the scheduled scan will
+ * be stopped when the socket is closed.
  *
  * @NL80211_ATTR_TDLS_INITIATOR: flag attribute indicating the current end is
  * the TDLS link initiator.
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 4c2e501..8236e2d 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -320,6 +320,20 @@ static void cfg80211_destroy_iface_wk(struct work_struct 
*work)
rtnl_unlock();
 }
 
+static void cfg80211_sched_scan_stop_wk(struct work_struct *work)
+{
+   struct cfg80211_registered_device *rdev;
+
+   rdev = container_of(work, struct cfg80211_registered_device,
+  sched_scan_stop_wk);
+
+   rtnl_lock();
+
+   __cfg80211_stop_sched_scan(rdev, false);
+
+   rtnl_unlock();
+}
+
 /* exported functions */
 
 struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
@@ -406,6 +420,7 @@ use_default_name:
INIT_LIST_HEAD(rdev-destroy_list);
spin_lock_init(rdev-destroy_list_lock);
INIT_WORK(rdev-destroy_work, cfg80211_destroy_iface_wk);
+   INIT_WORK(rdev-sched_scan_stop_wk, cfg80211_sched_scan_stop_wk);
 
 #ifdef CONFIG_CFG80211_DEFAULT_PS
rdev-wiphy.flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT;
@@ -764,6 +779,7 @@ void wiphy_unregister(struct wiphy *wiphy)
flush_work(rdev-event_work);
cancel_delayed_work_sync(rdev-dfs_update_channels_wk);
flush_work(rdev-destroy_work);
+   flush_work(rdev-sched_scan_stop_wk);
 
 #ifdef CONFIG_PM
if (rdev-wiphy.wowlan_config  rdev-ops-set_wakeup)
diff --git a/net/wireless/core.h b/net/wireless/core.h
index faa5b16..5327375 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -84,6 +84,8 @@ struct cfg80211_registered_device {
struct list_head destroy_list;
struct work_struct destroy_work;
 
+   struct work_struct sched_scan_stop_wk;
+
/* must be last because of the way we do wiphy_priv(),
 * and it should at least be aligned to NETDEV_ALIGN */
struct wiphy wiphy __aligned(NETDEV_ALIGN);
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index b5e3c48..a5cc4d6 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6090,6 +6090,9 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,
rdev-sched_scan_req-dev = dev;
rdev-sched_scan_req-wiphy = rdev-wiphy;
 
+   if (info-attrs[NL80211_ATTR_SOCKET_OWNER])
+   rdev-sched_scan_req-owner_nlportid = info-snd_portid;
+
nl80211_send_sched_scan(rdev, dev,
NL80211_CMD_START_SCHED_SCAN);
return 0;
@@ -12471,6 +12474,13 @@ static int nl80211_netlink_notify(struct 
notifier_block * nb,
 
list_for_each_entry_rcu(rdev, cfg80211_rdev_list, list) {
bool schedule_destroy_work = false;
+   bool schedule_scan_stop = false;
+   struct cfg80211_sched_scan_request *sched_scan_req =
+   rdev-sched_scan_req;
+
+   if (sched_scan_req  notify-portid 
+   sched_scan_req-owner_nlportid == notify-portid)
+   schedule_scan_stop = true;
 
list_for_each_entry_rcu(wdev, rdev-wdev_list, list) {
cfg80211_mlme_unregister_socket(wdev, notify-portid);
@@ -12501,6 +12511,12 @@ static int nl80211_netlink_notify(struct 
notifier_block * nb,
spin_unlock(rdev-destroy_list_lock);
schedule_work(rdev-destroy_work);
 

[PATCH v8 0/2] Stop scheduled scan if netlink client disappears

2014-11-27 Thread Jukka Rissanen
Hi,

v8:
- reworked the RCU code and placed it in patch 2

v7:
- convert the cfg80211_sched_scan_request to __rcu pointer in order
  to avoid races when accessing it
- reverting the patch v6, the port id is back in request struct

v6:
- moved owner netlink port id from cfg80211_sched_scan_request to
  rdev in order to avoid possible races

v5:
- discarded the locking changes in v4
- instead of trying to schedule sched_scan_stop worker from
  struct cfg80211_sched_scan_request, move the worker to wiphy
  as that makes it easier to manage the sched_scan_stop worker.
  There are also one scheduled scan / wiphy so it is also logical
  to do it like this.

v4:
- rtnl locking issues fixed in patch 2

v3:
- backward compatibility define tweaked in patch 1
- added missing signed-off-by:

v2:
- split the patch
- In patch 1, use a generic NL80211_ATTR_SOCKET_OWNER attribute and
  convert the old code that uses NL80211_ATTR_IFACE_SOCKET_OWNER to
  use the new value. A define is provided for backward compatibility.
- Any pending schedule scan stop worker is cancelled when interface is
  taken down in patch 2



Jukka Rissanen (2):
  nl80211: Stop scheduled scan if netlink client disappears
  nl80211: Convert sched_scan_req pointer to RCU pointer

 include/net/cfg80211.h   |  2 ++
 include/uapi/linux/nl80211.h |  3 +++
 net/wireless/core.c  | 26 +++---
 net/wireless/core.h  |  4 +++-
 net/wireless/nl80211.c   | 37 +
 net/wireless/scan.c  | 20 +++-
 6 files changed, 75 insertions(+), 17 deletions(-)

-- 
1.8.3.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/3] ath10k: remove unused callback argument

2014-11-27 Thread Michal Kazior
This wasn't used since forever and there are no
plans on using it.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/hif.h | 3 +--
 drivers/net/wireless/ath/ath10k/htc.c | 3 +--
 drivers/net/wireless/ath/ath10k/pci.c | 2 +-
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/hif.h 
b/drivers/net/wireless/ath/ath10k/hif.h
index 6ac5523..91d24a5 100644
--- a/drivers/net/wireless/ath/ath10k/hif.h
+++ b/drivers/net/wireless/ath/ath10k/hif.h
@@ -35,8 +35,7 @@ struct ath10k_hif_cb {
 struct sk_buff *wbuf,
 unsigned transfer_id);
int (*rx_completion)(struct ath10k *ar,
-struct sk_buff *wbuf,
-u8 pipe_id);
+struct sk_buff *wbuf);
 };
 
 struct ath10k_hif_ops {
diff --git a/drivers/net/wireless/ath/ath10k/htc.c 
b/drivers/net/wireless/ath/ath10k/htc.c
index 676bd4e..e245e34 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -317,8 +317,7 @@ static int ath10k_htc_process_trailer(struct ath10k_htc 
*htc,
 }
 
 static int ath10k_htc_rx_completion_handler(struct ath10k *ar,
-   struct sk_buff *skb,
-   u8 pipe_id)
+   struct sk_buff *skb)
 {
int status = 0;
struct ath10k_htc *htc = ar-htc;
diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 0816098..541f3bc 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -875,7 +875,7 @@ static void ath10k_pci_ce_recv_data(struct ath10k_ce_pipe 
*ce_state)
ath10k_dbg_dump(ar, ATH10K_DBG_PCI_DUMP, NULL, pci rx: ,
skb-data, skb-len);
 
-   cb-rx_completion(ar, skb, pipe_info-pipe_num);
+   cb-rx_completion(ar, skb);
}
 
ath10k_pci_rx_post_pipe(pipe_info);
-- 
1.8.5.3

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


[PATCH v8 2/2] nl80211: Convert sched_scan_req pointer to RCU pointer

2014-11-27 Thread Jukka Rissanen
Because of possible races when accessing sched_scan_req pointer in
rdev, the sched_scan_req is converted to RCU pointer.

Signed-off-by: Jukka Rissanen jukka.rissa...@linux.intel.com
---
 include/net/cfg80211.h |  1 +
 net/wireless/core.c| 10 +++---
 net/wireless/core.h|  2 +-
 net/wireless/nl80211.c | 27 ---
 net/wireless/scan.c| 20 +++-
 5 files changed, 40 insertions(+), 20 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 5806c75..0e540fc 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1538,6 +1538,7 @@ struct cfg80211_sched_scan_request {
struct net_device *dev;
unsigned long scan_start;
u32 owner_nlportid;
+   struct rcu_head rcu_head;
 
/* keep last */
struct ieee80211_channel *channels[0];
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 8236e2d..b612b71 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -860,6 +860,7 @@ void __cfg80211_leave(struct cfg80211_registered_device 
*rdev,
  struct wireless_dev *wdev)
 {
struct net_device *dev = wdev-netdev;
+   struct cfg80211_sched_scan_request *sched_scan_req;
 
ASSERT_RTNL();
ASSERT_WDEV_LOCK(wdev);
@@ -870,7 +871,8 @@ void __cfg80211_leave(struct cfg80211_registered_device 
*rdev,
break;
case NL80211_IFTYPE_P2P_CLIENT:
case NL80211_IFTYPE_STATION:
-   if (rdev-sched_scan_req  dev == rdev-sched_scan_req-dev)
+   sched_scan_req = rtnl_dereference(rdev-sched_scan_req);
+   if (sched_scan_req  dev == sched_scan_req-dev)
__cfg80211_stop_sched_scan(rdev, false);
 
 #ifdef CONFIG_CFG80211_WEXT
@@ -945,6 +947,7 @@ static int cfg80211_netdev_notifier_call(struct 
notifier_block *nb,
struct net_device *dev = netdev_notifier_info_to_dev(ptr);
struct wireless_dev *wdev = dev-ieee80211_ptr;
struct cfg80211_registered_device *rdev;
+   struct cfg80211_sched_scan_request *sched_scan_req;
 
if (!wdev)
return NOTIFY_DONE;
@@ -1009,8 +1012,9 @@ static int cfg80211_netdev_notifier_call(struct 
notifier_block *nb,
___cfg80211_scan_done(rdev, false);
}
 
-   if (WARN_ON(rdev-sched_scan_req 
-   rdev-sched_scan_req-dev == wdev-netdev)) {
+   sched_scan_req = rtnl_dereference(rdev-sched_scan_req);
+   if (WARN_ON(sched_scan_req 
+   sched_scan_req-dev == wdev-netdev)) {
__cfg80211_stop_sched_scan(rdev, false);
}
 
diff --git a/net/wireless/core.h b/net/wireless/core.h
index 5327375..4e3630b 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -63,7 +63,7 @@ struct cfg80211_registered_device {
u32 bss_generation;
struct cfg80211_scan_request *scan_req; /* protected by RTNL */
struct sk_buff *scan_msg;
-   struct cfg80211_sched_scan_request *sched_scan_req;
+   struct cfg80211_sched_scan_request __rcu *sched_scan_req;
unsigned long suspend_at;
struct work_struct scan_done_wk;
struct work_struct sched_scan_results_wk;
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index a5cc4d6..6cdb2ff 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6068,6 +6068,7 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,
struct cfg80211_registered_device *rdev = info-user_ptr[0];
struct net_device *dev = info-user_ptr[1];
struct wireless_dev *wdev = dev-ieee80211_ptr;
+   struct cfg80211_sched_scan_request *sched_scan_req;
int err;
 
if (!(rdev-wiphy.flags  WIPHY_FLAG_SUPPORTS_SCHED_SCAN) ||
@@ -6077,30 +6078,34 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,
if (rdev-sched_scan_req)
return -EINPROGRESS;
 
-   rdev-sched_scan_req = nl80211_parse_sched_scan(rdev-wiphy, wdev,
-   info-attrs);
-   err = PTR_ERR_OR_ZERO(rdev-sched_scan_req);
+   sched_scan_req = nl80211_parse_sched_scan(rdev-wiphy, wdev,
+ info-attrs);
+
+   err = PTR_ERR_OR_ZERO(sched_scan_req);
if (err)
goto out_err;
 
-   err = rdev_sched_scan_start(rdev, dev, rdev-sched_scan_req);
+   rcu_assign_pointer(rdev-sched_scan_req, sched_scan_req);
+
+   err = rdev_sched_scan_start(rdev, dev, sched_scan_req);
if (err)
goto out_free;
 
-   rdev-sched_scan_req-dev = dev;
-   rdev-sched_scan_req-wiphy = rdev-wiphy;
-
if (info-attrs[NL80211_ATTR_SOCKET_OWNER])
-   rdev-sched_scan_req-owner_nlportid = info-snd_portid;
+   rtnl_dereference(rdev-sched_scan_req)-owner_nlportid =
+   info-snd_portid;
+
+  

[PATCH 3/3] ath10k: prevent pci tx/rx starvation

2014-11-27 Thread Michal Kazior
In theory it was possible to starve the system if
a tx/rx handler could implicitly trigger more
tx/rx pci events.

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

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 95e9066..7abb836 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -823,20 +823,24 @@ static void ath10k_pci_ce_send_done(struct ath10k_ce_pipe 
*ce_state)
struct ath10k *ar = ce_state-ar;
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
struct ath10k_hif_cb *cb = ar_pci-msg_callbacks_current;
-   void *transfer_context;
+   struct sk_buff_head list;
+   struct sk_buff *skb;
u32 ce_data;
unsigned int nbytes;
unsigned int transfer_id;
 
-   while (ath10k_ce_completed_send_next(ce_state, transfer_context,
-ce_data, nbytes,
-transfer_id) == 0) {
+   __skb_queue_head_init(list);
+   while (ath10k_ce_completed_send_next(ce_state, (void **)skb, ce_data,
+nbytes, transfer_id) == 0) {
/* no need to call tx completion for NULL pointers */
-   if (transfer_context == NULL)
+   if (skb == NULL)
continue;
 
-   cb-tx_completion(ar, transfer_context);
+   __skb_queue_tail(list, skb);
}
+
+   while ((skb = __skb_dequeue(list)))
+   cb-tx_completion(ar, skb);
 }
 
 /* Called by lower (CE) layer when data is received from the Target. */
@@ -847,12 +851,14 @@ static void ath10k_pci_ce_recv_data(struct ath10k_ce_pipe 
*ce_state)
struct ath10k_pci_pipe *pipe_info =  ar_pci-pipe_info[ce_state-id];
struct ath10k_hif_cb *cb = ar_pci-msg_callbacks_current;
struct sk_buff *skb;
+   struct sk_buff_head list;
void *transfer_context;
u32 ce_data;
unsigned int nbytes, max_nbytes;
unsigned int transfer_id;
unsigned int flags;
 
+   __skb_queue_head_init(list);
while (ath10k_ce_completed_recv_next(ce_state, transfer_context,
 ce_data, nbytes, transfer_id,
 flags) == 0) {
@@ -869,7 +875,10 @@ static void ath10k_pci_ce_recv_data(struct ath10k_ce_pipe 
*ce_state)
}
 
skb_put(skb, nbytes);
+   __skb_queue_tail(list, skb);
+   }
 
+   while ((skb = __skb_dequeue(list))) {
ath10k_dbg(ar, ATH10K_DBG_PCI, pci rx ce pipe %d len %d\n,
   ce_state-id, skb-len);
ath10k_dbg_dump(ar, ATH10K_DBG_PCI_DUMP, NULL, pci rx: ,
-- 
1.8.5.3

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


[PATCH 2/3] ath10k: remove callback argument

2014-11-27 Thread Michal Kazior
Pass the eid argument via skbuff control buffer.
This will make it possible to work with queues of
HTC event buffers.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/core.h |  1 +
 drivers/net/wireless/ath/ath10k/hif.h  |  3 +--
 drivers/net/wireless/ath/ath10k/htc.c  | 10 +++---
 drivers/net/wireless/ath/ath10k/pci.c  |  4 ++--
 4 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 4a29498..226b2d2 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -79,6 +79,7 @@ static inline const char *ath10k_bus_str(enum ath10k_bus bus)
 
 struct ath10k_skb_cb {
dma_addr_t paddr;
+   u8 eid;
u8 vdev_id;
 
struct {
diff --git a/drivers/net/wireless/ath/ath10k/hif.h 
b/drivers/net/wireless/ath/ath10k/hif.h
index 91d24a5..0c92e02 100644
--- a/drivers/net/wireless/ath/ath10k/hif.h
+++ b/drivers/net/wireless/ath/ath10k/hif.h
@@ -32,8 +32,7 @@ struct ath10k_hif_sg_item {
 
 struct ath10k_hif_cb {
int (*tx_completion)(struct ath10k *ar,
-struct sk_buff *wbuf,
-unsigned transfer_id);
+struct sk_buff *wbuf);
int (*rx_completion)(struct ath10k *ar,
 struct sk_buff *wbuf);
 };
diff --git a/drivers/net/wireless/ath/ath10k/htc.c 
b/drivers/net/wireless/ath/ath10k/htc.c
index e245e34..f1946a6 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -160,6 +160,7 @@ int ath10k_htc_send(struct ath10k_htc *htc,
 
ath10k_htc_prepare_tx_skb(ep, skb);
 
+   skb_cb-eid = eid;
skb_cb-paddr = dma_map_single(dev, skb-data, skb-len, DMA_TO_DEVICE);
ret = dma_mapping_error(dev, skb_cb-paddr);
if (ret)
@@ -197,15 +198,18 @@ err_pull:
 }
 
 static int ath10k_htc_tx_completion_handler(struct ath10k *ar,
-   struct sk_buff *skb,
-   unsigned int eid)
+   struct sk_buff *skb)
 {
struct ath10k_htc *htc = ar-htc;
-   struct ath10k_htc_ep *ep = htc-endpoint[eid];
+   struct ath10k_skb_cb *skb_cb;
+   struct ath10k_htc_ep *ep;
 
if (WARN_ON_ONCE(!skb))
return 0;
 
+   skb_cb = ATH10K_SKB_CB(skb);
+   ep = htc-endpoint[skb_cb-eid];
+
ath10k_htc_notify_tx_completion(ep, skb);
/* the skb now belongs to the completion handler */
 
diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 541f3bc..95e9066 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -835,7 +835,7 @@ static void ath10k_pci_ce_send_done(struct ath10k_ce_pipe 
*ce_state)
if (transfer_context == NULL)
continue;
 
-   cb-tx_completion(ar, transfer_context, transfer_id);
+   cb-tx_completion(ar, transfer_context);
}
 }
 
@@ -1263,7 +1263,7 @@ static void ath10k_pci_tx_pipe_cleanup(struct 
ath10k_pci_pipe *pci_pipe)
id = MS(__le16_to_cpu(ce_desc[i].flags),
CE_DESC_FLAGS_META_DATA);
 
-   ar_pci-msg_callbacks_current.tx_completion(ar, skb, id);
+   ar_pci-msg_callbacks_current.tx_completion(ar, skb);
}
 }
 
-- 
1.8.5.3

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


pull request: bluetooth-next 2014-11-27

2014-11-27 Thread Johan Hedberg
Hi John,

Here's one more bluetooth-next pull request for 3.19:

 - Minor cleanups for ieee802154  mac802154
 - Fix for the kernel warning with !TASK_RUNNING reported by Kirill A.
   Shutemov
 - Support for another ath3k device
 - Fix for tracking link key based security level
 - Device tree bindings for btmrvl + a state update fix
 - Fix for wrong ACL flags on LE links

Please let me know if there are any issues pulling. Thanks.

Johan

---
The following changes since commit a86c02ea38c53b695209b1181f9e2e18d73eb4e8:

  Bluetooth: Add support for Broadcom BCM20702A1 variant (2014-11-18 08:32:14 
+0100)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git 
for-upstream

for you to fetch changes up to f6af675ef5489c69fc3d4faf8c6f477df3cbf8b9:

  Bluetooth: Automatically flushable packets aren't allowed on LE links 
(2014-11-27 12:12:27 +0200)


Amitkumar Karwar (3):
  Bluetooth: btmrvl: add DT bindings documentation
  Bluetooth: btmrvl: add DT-bindings for gpio-gap
  Bluetooth: btmrvl: update hs_state in interrupt handler

Dmitry Tunin (1):
  Bluetooth: ath3k: Add support of MCI 13d3:3408 bt device

Johan Hedberg (3):
  Bluetooth: Fix setting state back to TASK_RUNNING
  Bluetooth: Fix setting conn-pending_sec_level value from link key
  Bluetooth: Convert link keys list to use RCU

Steven Walter (1):
  Bluetooth: Automatically flushable packets aren't allowed on LE links

Varka Bhadram (2):
  ieee802154: fix spelling mistakes
  mac802154: remove unnecessary if statement

 Documentation/devicetree/bindings/btmrvl.txt | 29 +++
 drivers/bluetooth/ath3k.c|  2 +
 drivers/bluetooth/btmrvl_main.c  | 51 +++---
 drivers/bluetooth/btusb.c|  1 +
 include/net/bluetooth/hci_core.h |  1 +
 net/bluetooth/hci_core.c | 39 ++--
 net/bluetooth/hci_event.c| 51 +-
 net/bluetooth/l2cap_core.c   | 14 +--
 net/ieee802154/6lowpan_rtnl.c|  2 +-
 net/ieee802154/netlink.c |  2 +-
 net/ieee802154/nl-mac.c  |  2 +-
 net/ieee802154/nl-phy.c  |  2 +-
 net/mac802154/iface.c|  8 ++--
 13 files changed, 143 insertions(+), 61 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/btmrvl.txt



pgp3d1mnrYhoU.pgp
Description: PGP signature


Re: [PATCH v3] nl80211: Broadcast CMD_NEW_INTERFACE and CMD_DEL_INTERFACE

2014-11-27 Thread Jouni Malinen
On Wed, Nov 12, 2014 at 04:26:45PM +0200, Tomasz Bursztyka wrote:
 Let the other listeners being notified when a new or del interface
 command has been issued, thus reducing later necessary request to be in
 sync with current context.

This seems to trigger a NULL pointer dereference in
nl80211_send_chandef(). See below for logs. Please also note that it
would have been trivial to find this with automated mac80211_hwsim test
setup described here http://buildbot.w1.fi/hwsim/ before this commit was
applied.. This happens every time, e.g., with ap_vlan_open test case.

 
[6.271676] [ cut here ]
[6.272032] WARNING: CPU: 1 PID: 590 at net/wireless/nl80211.c:2320 
nl80211_send_chandef+0x127/0x130()
[6.272710] CPU: 1 PID: 590 Comm: hostapd Not tainted 3.17.0+ #380
[6.273162] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 
Bochs 01/01/2011
[6.273752]  0009 88001e083918 814e6044 
8108fbe1
[6.274346]   88001e083958 81040bbc 
88001e083968
[6.274924]  88001e0839e0 88001eb20d00  
88001e2088d0
[6.275502] Call Trace:
[6.275690]  [814e6044] dump_stack+0x4e/0x71
[6.276069]  [8108fbe1] ? console_unlock+0x1f1/0x4d0
[6.276498]  [81040bbc] warn_slowpath_common+0x7c/0xa0
[6.276939]  [81040cca] warn_slowpath_null+0x1a/0x20
[6.277368]  [813f9677] nl80211_send_chandef+0x127/0x130
[6.277821]  [813f9a35] nl80211_send_iface+0x3b5/0x5e0
[6.278281]  [813f9ccc] nl80211_del_interface+0x6c/0x520
[6.278736]  [8131b9a4] genl_family_rcv_msg+0x194/0x330
[6.279183]  [8131bb40] ? genl_family_rcv_msg+0x330/0x330
[6.279644]  [8131bbce] genl_rcv_msg+0x8e/0xd0
[6.280047]  [8131b081] netlink_rcv_skb+0xb1/0xc0
[6.280679]  [8131b7ed] ? genl_rcv+0x1d/0x40
[6.281251]  [8131b7fc] genl_rcv+0x2c/0x40
[6.281797]  [81319786] netlink_unicast+0x156/0x230
[6.282355]  [8131a0e0] netlink_sendmsg+0x320/0x410
[6.282870]  [812d6eb9] sock_sendmsg+0x69/0x90
[6.283343]  [812e5b66] ? verify_iovec+0x56/0xe0
[6.283830]  [812d71a8] ___sys_sendmsg.part.38+0x2c8/0x2e0
[6.284373]  [810889e0] ? __lock_acquire+0x430/0xbd0
[6.284882]  [81089aa0] ? lock_release_non_nested+0xa0/0x300
[6.285425]  [8111b18c] ? might_fault+0x8c/0xa0
[6.285898]  [8111b143] ? might_fault+0x43/0xa0
[6.286384]  [812d892e] __sys_sendmsg+0x4e/0x90
[6.286849]  [812d897e] SyS_sendmsg+0xe/0x10
[6.287312]  [814f0be9] system_call_fastpath+0x12/0x17
[6.287816] ---[ end trace 144e876be0145ff5 ]---
[6.288265] BUG: unable to handle kernel NULL pointer dereference at 
0004
[6.288937] IP: [813f958a] nl80211_send_chandef+0x3a/0x130
[6.289356] PGD 1df2b067 PUD 1df2e067 PMD 0 
[6.289661] Oops:  [#1] PREEMPT SMP 
[6.289944] CPU: 1 PID: 590 Comm: hostapd Tainted: GW  3.17.0+ 
#380
[6.290038] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 
Bochs 01/01/2011
[6.290038] task: 88001e1a2040 ti: 88001e08 task.ti: 
88001e08
[6.290038] RIP: 0010:[813f958a]  [813f958a] 
nl80211_send_chandef+0x3a/0x130
[6.290038] RSP: 0018:88001e083978  EFLAGS: 00010296
[6.290038] RAX:  RBX: 88001e0839e0 RCX: 88001e083984
[6.290038] RDX: 0004 RSI: 0026 RDI: 88001eb20d00
[6.290038] RBP: 88001e0839a8 R08: 0001 R09: 0001
[6.290038] R10: 0001 R11: 0001 R12: 88001eb20d00
[6.290038] R13:  R14: 88001e2088d0 R15: 88001deb
[6.290038] FS:  7fc7f9aac740() GS:88001fc8() 
knlGS:
[6.290038] CS:  0010 DS:  ES:  CR0: 80050033
[6.290038] CR2: 0004 CR3: 1df28000 CR4: 06a0
[6.290038] Stack:
[6.290038]  0246  88001e0839a8 
0246
[6.290038]  88001eb20d00 88001de50014 88001e083a28 
813f9a35
[6.290038]  00d0 88001deb0420 0003000c 
001b0004
[6.290038] Call Trace:
[6.290038]  [813f9a35] nl80211_send_iface+0x3b5/0x5e0
[6.290038]  [813f9ccc] nl80211_del_interface+0x6c/0x520
[6.290038]  [8131b9a4] genl_family_rcv_msg+0x194/0x330
[6.290038]  [8131bb40] ? genl_family_rcv_msg+0x330/0x330
[6.290038]  [8131bbce] genl_rcv_msg+0x8e/0xd0
[6.290038]  [8131b081] netlink_rcv_skb+0xb1/0xc0
[6.290038]  [8131b7ed] ? genl_rcv+0x1d/0x40
[6.290038]  [8131b7fc] genl_rcv+0x2c/0x40
[6.290038]  [81319786] netlink_unicast+0x156/0x230
[6.290038]  

[PATCH v3 0/2] ath10k: device tree support

2014-11-27 Thread Kalle Valo
Hi,

here's ath10k device tree support which Toshi and me have been working
on. Please review.

Device tree maintainers: please review the bindings document
carefully, this is the first time I have written one.

v3:

* add a debug message to ath10k

* write bindings file

* use ar-dev.of_node instead of pci_device_to_OF_node()

v2:

* fixed a bug that returns an uninitialized value if the node is not
  found

---

Kalle Valo (1):
  dt: bindings: add ath10k wireless device

Toshi Kikuchi (1):
  ath10k: read calibration data from Device Tree


 .../bindings/net/wireless/qcom,ath10k.txt  |   30 +
 drivers/net/wireless/ath/ath10k/core.c |   70 
 drivers/net/wireless/ath/ath10k/core.h |3 +
 3 files changed, 102 insertions(+), 1 deletion(-)
 create mode 100644 
Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt

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


[PATCH v3 1/2] dt: bindings: add ath10k wireless device

2014-11-27 Thread Kalle Valo
Document how calibration data can be provided to ath10k via Device Tree.

Signed-off-by: Kalle Valo kv...@qca.qualcomm.com
---
 .../bindings/net/wireless/qcom,ath10k.txt  |   30 
 1 file changed, 30 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt

diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
new file mode 100644
index ..edefc26c6204
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -0,0 +1,30 @@
+* Qualcomm Atheros ath10k wireless devices
+
+For ath10k devices the calibration data can be provided through Device
+Tree. The node is a child node of the PCI controller.
+
+Required properties:
+-compatible : Should be qcom,ath10k
+
+Optional properties:
+- qcom,ath10k-calibration-data : calibration data as an array, the
+length can vary between hw versions
+
+
+Example:
+
+pci {
+   pcie@0 {
+   reg = 0 0 0 0 0;
+   #interrupt-cells = 1;
+   #size-cells = 2;
+   #address-cells = 3;
+   device_type = pci;
+
+   ath10k@0,0 {
+   reg = 0 0 0 0 0;
+   device_type = pci;
+   qcom,ath10k-calibration-data = [ 01 02 03 ... ];
+   };
+   };
+};

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


[PATCH v3 2/2] ath10k: read calibration data from Device Tree

2014-11-27 Thread Kalle Valo
From: Toshi Kikuchi tos...@chromium.org

This patch adds support for reading calibration data from Device Tree.
It looks for the calibration data in Device Tree if it can't find it
in a file. If there's no node in Device Tree, ath10k will try to find the
calibration data from OTP.

The node for the calibration data should be defined like this:

pci {
pcie@0 {
reg = 0 0 0 0 0;
#interrupt-cells = 1;
#size-cells = 2;
#address-cells = 3;
device_type = pci;

ath10k@0,0 {
reg = 0 0 0 0 0;
device_type = pci;
qcom,ath10k-calibration-data = [ 01 02 03 ... ];
};
};
};

Signed-off-by: Toshi Kikuchi tos...@chromium.org
Signed-off-by: Kalle Valo kv...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/core.c |   70 
 drivers/net/wireless/ath/ath10k/core.h |3 +
 2 files changed, 72 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 7762061a1944..6165f2735b35 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -17,6 +17,7 @@
 
 #include linux/module.h
 #include linux/firmware.h
+#include linux/of.h
 
 #include core.h
 #include mac.h
@@ -249,6 +250,63 @@ static int ath10k_download_cal_file(struct ath10k *ar)
return 0;
 }
 
+static int ath10k_download_cal_dt(struct ath10k *ar)
+{
+   struct device_node *node;
+   int data_len;
+   void *data;
+   int ret;
+
+   node = ar-dev-of_node;
+   if (!node)
+   /* Device Tree is optional, don't print any warnings if
+* there's no node for ath10k.
+*/
+   return -ENOENT;
+
+   if (!of_get_property(node, qcom,ath10k-calibration-data,
+data_len)) {
+   /* The calibration data node is optional */
+   return -ENOENT;
+   }
+
+   if (data_len != QCA988X_CAL_DATA_LEN) {
+   ath10k_warn(ar, invalid calibration data length in DT: %d\n,
+   data_len);
+   ret = -EMSGSIZE;
+   goto out;
+   }
+
+   data = kmalloc(data_len, GFP_KERNEL);
+   if (!data) {
+   ret = -ENOMEM;
+   goto out;
+   }
+
+   ret = of_property_read_u8_array(node, qcom,ath10k-calibration-data,
+   data, data_len);
+   if (ret) {
+   ath10k_warn(ar, failed to read calibration data from DT: %d\n,
+   ret);
+   goto out_free;
+   }
+
+   ret = ath10k_download_board_data(ar, data, data_len);
+   if (ret) {
+   ath10k_warn(ar, failed to download calibration data from 
Device Tree: %d\n,
+   ret);
+   goto out_free;
+   }
+
+   ret = 0;
+
+out_free:
+   kfree(data);
+
+out:
+   return ret;
+}
+
 static int ath10k_download_and_run_otp(struct ath10k *ar)
 {
u32 result, address = ar-hw_params.patch_load_addr;
@@ -662,7 +720,17 @@ static int ath10k_download_cal_data(struct ath10k *ar)
}
 
ath10k_dbg(ar, ATH10K_DBG_BOOT,
-  boot did not find a calibration file, try OTP next: %d\n,
+  boot did not find a calibration file, try DT next: %d\n,
+  ret);
+
+   ret = ath10k_download_cal_dt(ar);
+   if (ret == 0) {
+   ar-cal_mode = ATH10K_CAL_MODE_DT;
+   goto done;
+   }
+
+   ath10k_dbg(ar, ATH10K_DBG_BOOT,
+  boot did not find DT entry, try OTP next: %d\n,
   ret);
 
ret = ath10k_download_and_run_otp(ar);
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 4a294987736c..2dd1bb05a3fc 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -400,6 +400,7 @@ enum ath10k_dev_flags {
 enum ath10k_cal_mode {
ATH10K_CAL_MODE_FILE,
ATH10K_CAL_MODE_OTP,
+   ATH10K_CAL_MODE_DT,
 };
 
 static inline const char *ath10k_cal_mode_str(enum ath10k_cal_mode mode)
@@ -409,6 +410,8 @@ static inline const char *ath10k_cal_mode_str(enum 
ath10k_cal_mode mode)
return file;
case ATH10K_CAL_MODE_OTP:
return otp;
+   case ATH10K_CAL_MODE_DT:
+   return dt;
}
 
return unknown;

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


Re: [PATCH v3 0/2] ath10k: device tree support

2014-11-27 Thread Kalle Valo
Kalle Valo kv...@qca.qualcomm.com writes:

 here's ath10k device tree support which Toshi and me have been working
 on. Please review.

 Device tree maintainers: please review the bindings document
 carefully, this is the first time I have written one.

Argh, I again used the old devicetree mailing list address. Please
ignore this one, I'll resend using the correct address.

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


[PATCH v4 1/2] dt: bindings: add ath10k wireless device

2014-11-27 Thread Kalle Valo
Document how calibration data can be provided to ath10k via Device Tree.

Signed-off-by: Kalle Valo kv...@qca.qualcomm.com
---
 .../bindings/net/wireless/qcom,ath10k.txt  |   30 
 1 file changed, 30 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt

diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
new file mode 100644
index ..edefc26c6204
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -0,0 +1,30 @@
+* Qualcomm Atheros ath10k wireless devices
+
+For ath10k devices the calibration data can be provided through Device
+Tree. The node is a child node of the PCI controller.
+
+Required properties:
+-compatible : Should be qcom,ath10k
+
+Optional properties:
+- qcom,ath10k-calibration-data : calibration data as an array, the
+length can vary between hw versions
+
+
+Example:
+
+pci {
+   pcie@0 {
+   reg = 0 0 0 0 0;
+   #interrupt-cells = 1;
+   #size-cells = 2;
+   #address-cells = 3;
+   device_type = pci;
+
+   ath10k@0,0 {
+   reg = 0 0 0 0 0;
+   device_type = pci;
+   qcom,ath10k-calibration-data = [ 01 02 03 ... ];
+   };
+   };
+};

--
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 v4 0/2] ath10k: device tree support

2014-11-27 Thread Kalle Valo
Hi,

here's providing ath10k calibration data via device tree support which
Toshi and me have been working on. Please review.

Device tree maintainers: please review the bindings document
carefully, this is the first time I have written one.

v4:

* use correct devicetree mailing list address

v3:

* add a debug message to ath10k

* write bindings file

* use ar-dev.of_node instead of pci_device_to_OF_node()

v2:

* fixed a bug that returns an uninitialized value if the node is not
  found

---

Kalle Valo (1):
  dt: bindings: add ath10k wireless device

Toshi Kikuchi (1):
  ath10k: read calibration data from Device Tree


 .../bindings/net/wireless/qcom,ath10k.txt  |   30 +
 drivers/net/wireless/ath/ath10k/core.c |   70 
 drivers/net/wireless/ath/ath10k/core.h |3 +
 3 files changed, 102 insertions(+), 1 deletion(-)
 create mode 100644 
Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt

--
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 1/2] dt: bindings: add ath10k wireless device

2014-11-27 Thread Arnd Bergmann
On Thursday 27 November 2014 14:08:56 Kalle Valo wrote:
 diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
 b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
 new file mode 100644
 index ..edefc26c6204
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
 @@ -0,0 +1,30 @@
 +* Qualcomm Atheros ath10k wireless devices
 +
 +For ath10k devices the calibration data can be provided through Device
 +Tree. The node is a child node of the PCI controller.
 +
 +Required properties:
 +-compatible : Should be qcom,ath10k
 +
 +Optional properties:
 +- qcom,ath10k-calibration-data : calibration data as an array, the
 +length can vary between hw versions
 +

Does the device always have a valid mac address in hardware? If not,
how about listing that as well using the mac-address property?

Arnd
--
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: take reserved vif into account when calculating the min_def

2014-11-27 Thread Emmanuel Grumbach
When we want to calculate the minimal bandwidth needed for
a channel context, we need to take into account vifs that
have reserved the channel context.
I hit an issue with iwlwifi and channel switch as a client.

We would allocate a virgin channel context and reserve it.
At that stage, the min_def was 20MHz.
Then we would use it after CSA, and start transmitting, but
the channel context was still 20MHz even if the GO was in
40MHz. This made the firmware unhappy.

Signed-off-by: Emmanuel Grumbach emmanuel.grumb...@intel.com
---
 net/mac80211/chan.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index 4c74e8d..769e0c5 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -256,7 +256,8 @@ ieee80211_get_chanctx_max_required_bw(struct 
ieee80211_local *local,
if (!ieee80211_sdata_running(sdata))
continue;
 
-   if (rcu_access_pointer(sdata-vif.chanctx_conf) != conf)
+   if (rcu_access_pointer(sdata-vif.chanctx_conf) != conf 
+   sdata-reserved_chanctx-conf != conf)
continue;
 
switch (vif-type) {
@@ -271,6 +272,7 @@ ieee80211_get_chanctx_max_required_bw(struct 
ieee80211_local *local,
case NL80211_IFTYPE_WDS:
case NL80211_IFTYPE_MESH_POINT:
width = vif-bss_conf.chandef.width;
+   width = max(width, sdata-reserved_chandef.width);
break;
case NL80211_IFTYPE_UNSPECIFIED:
case NUM_NL80211_IFTYPES:
@@ -899,6 +901,8 @@ int ieee80211_vif_reserve_chanctx(struct 
ieee80211_sub_if_data *sdata,
sdata-reserved_radar_required = radar_required;
sdata-reserved_ready = false;
 
+   ieee80211_recalc_chanctx_min_def(local, new_ctx);
+
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


Re: [PATCH 1/3] ath10k: remove unused callback argument

2014-11-27 Thread Kalle Valo
Michal Kazior michal.kaz...@tieto.com writes:

 This wasn't used since forever and there are no
 plans on using it.

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

I modified the title to get it more unique:

ath10k: remove unused callback argument from struct ath10k_hif_cb::rx_completion

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


Re: [PATCH v2 0/7] ath10k: add support for new wmi-tlv backend

2014-11-27 Thread Kalle Valo
Michal Kazior michal.kaz...@tieto.com writes:

 First 2 patches are simple fixes. Patch 3 isn't
 strictly related to wmi-tlv but I decided to
 include it anyway. Other patches gradually
 implement wmi-tlv.

 There's a bunch of false-positive checkpatch
 warnings regarding `CHECK: No space is necessary
 after a cast`.

 v2:
  * a lot of fixes (see notes on patch #7)

 Michal Kazior (7):
   ath10k: fix wmi svc bitmap dbg print
   ath10k: add sanity checks for service bmap parsing
   ath10k: make wmi service bitmap non-debug

These look ok and are now in ath-next-text.

   ath10k: implement intermediate event args
   ath10k: introduce wmi ops
   ath10k: make some wmi functions public
   ath10k: implement wmi-tlv backend

I still need to look at these more carefully.

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


[RFC] mac80211: update the channel context after channel switch

2014-11-27 Thread Emmanuel Grumbach
When the channel switch has been made, a vif is now using
the channel context which was reserved. When that happens,
we need to update the channel context since its parameters
may change.

I hit a case in which I switched to a 40Mhz channel but the
reserved channel context was still on 20Mhz. The rate control
would try to send 40Mhz packets on a 20Mhz channel context and
that made iwlwifi's firmware unhappy.

Signed-off-by: Emmanuel Grumbach emmanuel.grumb...@intel.com
---
This is a second version of the patch I sent earlier.
I think the first version is more generic.

Luca / Michal / Whoever, please share your thoughts on which version
should be merged.
---
 net/mac80211/chan.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index 4c74e8d..eadc1a0 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -993,6 +993,10 @@ ieee80211_vif_use_reserved_reassign(struct 
ieee80211_sub_if_data *sdata)
 
sdata-vif.bss_conf.chandef = sdata-reserved_chandef;
 
+   ieee80211_recalc_smps_chanctx(local, new_ctx);
+   ieee80211_recalc_radar_chanctx(local, new_ctx);
+   ieee80211_recalc_chanctx_min_def(local, new_ctx);
+
if (changed)
ieee80211_bss_info_change_notify(sdata, 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


wl1251: NVS firmware data

2014-11-27 Thread Pali Rohár
Hello,

wifi driver wl1251 needs NVS calibration data for working. These 
data are loaded by driver via request_firmware from userspace 
file: ti-connectivity/wl1251-nvs.bin. In linux-fimrware git tree 
there is generic wl1251-nvs.bin file which is used by default.

Driver wl1251 is used on Nokia N900 cellphone for its wifi chip. 
This cellphone has one special MTD partition (called CAL) where 
are stored some configuration data in special binary (key-value) 
format. And there is also stored correct calibration data for 
specific device (each device has different data). It is preferred 
to use those data instead generic one (provided by linux-firmware 
git tree).

Now my question is: How to correctly load calibration data from 
special Nokia N900 CAL partition into wl1251 kernel driver?

By default kernel reads ti-connectivity/wl1251-nvs.bin file from 
VFS if exists without any userspace support. If it fails then it 
fallback to loading via udev.

Reading correct data from CAL partition is not easy (structure is 
difficult), but there is open source program which can parse CAL 
partition and write NVS data to stdout. So adding this CAL parser 
into kernel is not good idea (program is GPLv3+ code -- 
incompatible with kernel).

So how to solve this problem? How to load correct NVS data from 
CAL partition into wl1251 driver?

It is possible to tell kernel to use some helper userspace 
program for loading data and if it fails then fallback to direct 
loading? E.g first try to use model specific data and if it fails 
for some reasons then fallback to reading genetic data.

-- 
Pali Rohár
pali.ro...@gmail.com


signature.asc
Description: This is a digitally signed message part.


Re: wl1251: NVS firmware data

2014-11-27 Thread Pali Rohár
On Thursday 27 November 2014 15:21:44 Ming Lei wrote:
 On Thu, Nov 27, 2014 at 10:06 PM, Pali Rohár 
pali.ro...@gmail.com wrote:
  Hello,
  
  wifi driver wl1251 needs NVS calibration data for working.
  These data are loaded by driver via request_firmware from
  userspace file: ti-connectivity/wl1251-nvs.bin. In
  linux-fimrware git tree there is generic wl1251-nvs.bin
  file which is used by default.
  
  Driver wl1251 is used on Nokia N900 cellphone for its wifi
  chip. This cellphone has one special MTD partition (called
  CAL) where are stored some configuration data in special
  binary (key-value) format. And there is also stored correct
  calibration data for specific device (each device has
  different data). It is preferred to use those data instead
  generic one (provided by linux-firmware git tree).
  
  Now my question is: How to correctly load calibration data
  from special Nokia N900 CAL partition into wl1251 kernel
  driver?
 
 It is better to let user space script handle the request.
 

Yes, this makes sense. Implementing CAL parser in kernel wl1251 
driver would be hard...

  By default kernel reads ti-connectivity/wl1251-nvs.bin file
  from VFS if exists without any userspace support. If it
  fails then it fallback to loading via udev.
 
 You can remove or rename this file so that loading from user
 space can be triggered.
 

It is no so easy... In case when CAL does not contains NVS data 
then we want to use this generic NVS file. And telling everybody 
to rename this is file is not good solution...

  Reading correct data from CAL partition is not easy
  (structure is difficult), but there is open source program
  which can parse CAL partition and write NVS data to stdout.
  So adding this CAL parser into kernel is not good idea
  (program is GPLv3+ code -- incompatible with kernel).
  
  So how to solve this problem? How to load correct NVS data
  from CAL partition into wl1251 driver?
  
  It is possible to tell kernel to use some helper userspace
  program for loading data and if it fails then fallback to
  direct loading? E.g first try to use model specific data
  and if it fails for some reasons then fallback to reading
  genetic data.
 
 One solution is to introduce request_firmware_user() and let
 this API handle your case, but CONFIG_FW_LOADER_USER_HELPER
 has to be enabled.
 
 If request_firmware_user() fails, request_firmware_direct()
 can be tried further.
 
 Thanks,
 Ming Lei

Ok, new kernel function which will change order of loading 
firmware should work.

Which userspace helper programs for (automatic) firmware loading 
are used? Can be udev configured to use own program for loading 
firmware instead that udev integrated which looking for firmware 
only in /lib/firmware files?

-- 
Pali Rohár
pali.ro...@gmail.com


signature.asc
Description: This is a digitally signed message part.


Re: [PATCH] mac80211: enable TPC through mac80211 stack

2014-11-27 Thread Johannes Berg
On Thu, 2014-11-27 at 14:39 +0100, Lorenzo Bianconi wrote:
 Configure per packet Transmit Power Control (TPC) in lower drivers checking
 if user_power_level has been set to IEEE80211_UNSET_POWER_LEVEL

Err, what? Why? how? what does this do?

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] mac80211: enable TPC through mac80211 stack

2014-11-27 Thread Lorenzo Bianconi
 On Thu, 2014-11-27 at 14:39 +0100, Lorenzo Bianconi wrote:
 Configure per packet Transmit Power Control (TPC) in lower drivers checking
 if user_power_level has been set to IEEE80211_UNSET_POWER_LEVEL

 Err, what? Why? how? what does this do?

 johannes


I would like to enable TPC in ath9k using iw command:

iw dev wlan0 set txpower auto

I knew user_power_level is set to IEEE80211_UNSET_POWER_LEVEL in that
case. Is there a better way than to check user_power_level?

Regards,
Lorenzo

-- 
UNIX is Sexy: who | grep -i blonde | talk; cd ~; wine; talk; touch;
unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp;
umount; make clean; sleep
--
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: wl1251: NVS firmware data

2014-11-27 Thread Ming Lei
On Thu, Nov 27, 2014 at 10:43 PM, Pali Rohár pali.ro...@gmail.com wrote:
 On Thursday 27 November 2014 15:21:44 Ming Lei wrote:
 On Thu, Nov 27, 2014 at 10:06 PM, Pali Rohár
 pali.ro...@gmail.com wrote:
  Hello,
 
  wifi driver wl1251 needs NVS calibration data for working.
  These data are loaded by driver via request_firmware from
  userspace file: ti-connectivity/wl1251-nvs.bin. In
  linux-fimrware git tree there is generic wl1251-nvs.bin
  file which is used by default.
 
  Driver wl1251 is used on Nokia N900 cellphone for its wifi
  chip. This cellphone has one special MTD partition (called
  CAL) where are stored some configuration data in special
  binary (key-value) format. And there is also stored correct
  calibration data for specific device (each device has
  different data). It is preferred to use those data instead
  generic one (provided by linux-firmware git tree).
 
  Now my question is: How to correctly load calibration data
  from special Nokia N900 CAL partition into wl1251 kernel
  driver?

 It is better to let user space script handle the request.


 Yes, this makes sense. Implementing CAL parser in kernel wl1251
 driver would be hard...

  By default kernel reads ti-connectivity/wl1251-nvs.bin file
  from VFS if exists without any userspace support. If it
  fails then it fallback to loading via udev.

 You can remove or rename this file so that loading from user
 space can be triggered.


 It is no so easy... In case when CAL does not contains NVS data
 then we want to use this generic NVS file. And telling everybody
 to rename this is file is not good solution...

  Reading correct data from CAL partition is not easy
  (structure is difficult), but there is open source program
  which can parse CAL partition and write NVS data to stdout.
  So adding this CAL parser into kernel is not good idea
  (program is GPLv3+ code -- incompatible with kernel).
 
  So how to solve this problem? How to load correct NVS data
  from CAL partition into wl1251 driver?
 
  It is possible to tell kernel to use some helper userspace
  program for loading data and if it fails then fallback to
  direct loading? E.g first try to use model specific data
  and if it fails for some reasons then fallback to reading
  genetic data.

 One solution is to introduce request_firmware_user() and let
 this API handle your case, but CONFIG_FW_LOADER_USER_HELPER
 has to be enabled.

 If request_firmware_user() fails, request_firmware_direct()
 can be tried further.

 Thanks,
 Ming Lei

 Ok, new kernel function which will change order of loading
 firmware should work.

I mean you can do that in your driver.


 Which userspace helper programs for (automatic) firmware loading
 are used? Can be udev configured to use own program for loading

At default, udev had its builtin firmware helper, but some new
udev stops to handle firmware request.

If the udev you are using still supports to handle firmware request,
you can write your load helper and add your rule for handling
the special case. Otherwise, you need to write code to monitor
the netlink uevents from the kernel and handle your firmware
loading request.

Thanks,
Ming Lei
--
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: wl1251: NVS firmware data

2014-11-27 Thread Greg Kroah-Hartman
On Thu, Nov 27, 2014 at 03:43:23PM +0100, Pali Rohár wrote:
 Which userspace helper programs for (automatic) firmware loading 
 are used? Can be udev configured to use own program for loading 
 firmware instead that udev integrated which looking for firmware 
 only in /lib/firmware files?

The code to load firmware from userspace has been removed from udev, so
that's not going to work at all, sorry.

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: wl1251: NVS firmware data

2014-11-27 Thread Greg Kroah-Hartman
On Thu, Nov 27, 2014 at 03:43:23PM +0100, Pali Rohár wrote:
 On Thursday 27 November 2014 15:21:44 Ming Lei wrote:
  On Thu, Nov 27, 2014 at 10:06 PM, Pali Rohár 
 pali.ro...@gmail.com wrote:
   Hello,
   
   wifi driver wl1251 needs NVS calibration data for working.
   These data are loaded by driver via request_firmware from
   userspace file: ti-connectivity/wl1251-nvs.bin. In
   linux-fimrware git tree there is generic wl1251-nvs.bin
   file which is used by default.
   
   Driver wl1251 is used on Nokia N900 cellphone for its wifi
   chip. This cellphone has one special MTD partition (called
   CAL) where are stored some configuration data in special
   binary (key-value) format. And there is also stored correct
   calibration data for specific device (each device has
   different data). It is preferred to use those data instead
   generic one (provided by linux-firmware git tree).
   
   Now my question is: How to correctly load calibration data
   from special Nokia N900 CAL partition into wl1251 kernel
   driver?
  
  It is better to let user space script handle the request.
  
 
 Yes, this makes sense. Implementing CAL parser in kernel wl1251 
 driver would be hard...
 
   By default kernel reads ti-connectivity/wl1251-nvs.bin file
   from VFS if exists without any userspace support. If it
   fails then it fallback to loading via udev.
  
  You can remove or rename this file so that loading from user
  space can be triggered.
  
 
 It is no so easy... In case when CAL does not contains NVS data 
 then we want to use this generic NVS file. And telling everybody 
 to rename this is file is not good solution...

But that's up to your system configuration, not the kernel.  Make a
userspace package for the firmware that creates it in the format you
need it to be in, for the hardware you have, and then there would not be
any need for a kernel change, right?

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: wl1251: NVS firmware data

2014-11-27 Thread Pali Rohár
On Thursday 27 November 2014 16:16:55 Greg Kroah-Hartman wrote:
 On Thu, Nov 27, 2014 at 03:43:23PM +0100, Pali Rohár wrote:
  On Thursday 27 November 2014 15:21:44 Ming Lei wrote:
   On Thu, Nov 27, 2014 at 10:06 PM, Pali Rohár
  
  pali.ro...@gmail.com wrote:
Hello,

wifi driver wl1251 needs NVS calibration data for
working. These data are loaded by driver via
request_firmware from userspace file:
ti-connectivity/wl1251-nvs.bin. In linux-fimrware git
tree there is generic wl1251-nvs.bin file which is used
by default.

Driver wl1251 is used on Nokia N900 cellphone for its
wifi chip. This cellphone has one special MTD partition
(called CAL) where are stored some configuration data
in special binary (key-value) format. And there is also
stored correct calibration data for specific device
(each device has different data). It is preferred to
use those data instead generic one (provided by
linux-firmware git tree).

Now my question is: How to correctly load calibration
data from special Nokia N900 CAL partition into wl1251
kernel driver?
   
   It is better to let user space script handle the request.
  
  Yes, this makes sense. Implementing CAL parser in kernel
  wl1251 driver would be hard...
  
By default kernel reads ti-connectivity/wl1251-nvs.bin
file from VFS if exists without any userspace support.
If it fails then it fallback to loading via udev.
   
   You can remove or rename this file so that loading from
   user space can be triggered.
  
  It is no so easy... In case when CAL does not contains NVS
  data then we want to use this generic NVS file. And telling
  everybody to rename this is file is not good solution...
 
 But that's up to your system configuration, not the kernel. 
 Make a userspace package for the firmware that creates it in
 the format you need it to be in, for the hardware you have,
 and then there would not be any need for a kernel change,
 right?
 
 greg k-h

Not so simple as you think. Some parts of NVS data are configured 
based on location and cellular station. Data are not static.

-- 
Pali Rohár
pali.ro...@gmail.com


signature.asc
Description: This is a digitally signed message part.


Re: wl1251: NVS firmware data

2014-11-27 Thread Pali Rohár
On Thursday 27 November 2014 16:14:48 Greg Kroah-Hartman wrote:
 On Thu, Nov 27, 2014 at 03:43:23PM +0100, Pali Rohár wrote:
  Which userspace helper programs for (automatic) firmware
  loading are used? Can be udev configured to use own program
  for loading firmware instead that udev integrated which
  looking for firmware only in /lib/firmware files?
 
 The code to load firmware from userspace has been removed from
 udev, so that's not going to work at all, sorry.
 
 greg k-h

Ok and how to load (dynamic) firmware files into kernel? What is 
preferred way if not udev (because it removed that support)?

-- 
Pali Rohár
pali.ro...@gmail.com


signature.asc
Description: This is a digitally signed message part.


Re: wl1251: NVS firmware data

2014-11-27 Thread Greg Kroah-Hartman
On Thu, Nov 27, 2014 at 04:22:58PM +0100, Pali Rohár wrote:
 On Thursday 27 November 2014 16:16:55 Greg Kroah-Hartman wrote:
  On Thu, Nov 27, 2014 at 03:43:23PM +0100, Pali Rohár wrote:
   On Thursday 27 November 2014 15:21:44 Ming Lei wrote:
On Thu, Nov 27, 2014 at 10:06 PM, Pali Rohár
   
   pali.ro...@gmail.com wrote:
 Hello,
 
 wifi driver wl1251 needs NVS calibration data for
 working. These data are loaded by driver via
 request_firmware from userspace file:
 ti-connectivity/wl1251-nvs.bin. In linux-fimrware git
 tree there is generic wl1251-nvs.bin file which is used
 by default.
 
 Driver wl1251 is used on Nokia N900 cellphone for its
 wifi chip. This cellphone has one special MTD partition
 (called CAL) where are stored some configuration data
 in special binary (key-value) format. And there is also
 stored correct calibration data for specific device
 (each device has different data). It is preferred to
 use those data instead generic one (provided by
 linux-firmware git tree).
 
 Now my question is: How to correctly load calibration
 data from special Nokia N900 CAL partition into wl1251
 kernel driver?

It is better to let user space script handle the request.
   
   Yes, this makes sense. Implementing CAL parser in kernel
   wl1251 driver would be hard...
   
 By default kernel reads ti-connectivity/wl1251-nvs.bin
 file from VFS if exists without any userspace support.
 If it fails then it fallback to loading via udev.

You can remove or rename this file so that loading from
user space can be triggered.
   
   It is no so easy... In case when CAL does not contains NVS
   data then we want to use this generic NVS file. And telling
   everybody to rename this is file is not good solution...
  
  But that's up to your system configuration, not the kernel. 
  Make a userspace package for the firmware that creates it in
  the format you need it to be in, for the hardware you have,
  and then there would not be any need for a kernel change,
  right?
  
  greg k-h
 
 Not so simple as you think. Some parts of NVS data are configured 
 based on location and cellular station. Data are not static.

Then you need a dynamic program that you control, in userspace, to dump
the needed data into the kernel.  Don't try to do it with static
firmware files.  Use the binary sysfs file interface for this if you
want.

good luck,

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


[PATCH] nl80211: don't crash sending invalid chandef

2014-11-27 Thread Johannes Berg
From: Johannes Berg johannes.b...@intel.com

One of the cases for an invalid channel definition is that
the channel pointer is NULL, in which case the warning is
a bit late since we'll dereference the pointer. Bail out
of the function upon warning about this.

Signed-off-by: Johannes Berg johannes.b...@intel.com
---
 net/wireless/nl80211.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index e11980e74a04..4fae26d722f8 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2317,7 +2317,8 @@ static inline u64 wdev_id(struct wireless_dev *wdev)
 static int nl80211_send_chandef(struct sk_buff *msg,
const struct cfg80211_chan_def *chandef)
 {
-   WARN_ON(!cfg80211_chandef_valid(chandef));
+   if (WARN_ON(!cfg80211_chandef_valid(chandef)))
+   return -EINVAL;
 
if (nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ,
chandef-chan-center_freq))
-- 
2.1.1

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


Re: [PATCH 3.18] mac80211: copy chandef from AP vif to VLANs

2014-11-27 Thread Johannes Berg
On Mon, 2014-11-24 at 18:12 +0100, Felix Fietkau wrote:
 Fixes a crash in nl80211_send_chandef, introduced in
 
 commit c12bc4885f4b3bab0ed779c69d5d7e3223fa5003
 mac80211: return the vif's chandef in ieee80211_cfg_get_channel()

I've fixed up the commit log myself and applied it, but I doubt we'll
get it into 3.18 at this point, so I've applied it to mac80211-next with
the stable tag.

johannes

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


[PATCH iw 1/2] update nl80211.h

2014-11-27 Thread Luca Coelho
From: Luciano Coelho luciano.coe...@intel.com

Signed-off-by: Luciano Coelho luciano.coe...@intel.com
---
 nl80211.h | 119 +++---
 1 file changed, 115 insertions(+), 4 deletions(-)

diff --git a/nl80211.h b/nl80211.h
index f7daae5..d775245 100644
--- a/nl80211.h
+++ b/nl80211.h
@@ -643,7 +643,18 @@
  * @NL80211_CMD_CH_SWITCH_NOTIFY: An AP or GO may decide to switch channels
  * independently of the userspace SME, send this event indicating
  * %NL80211_ATTR_IFINDEX is now on %NL80211_ATTR_WIPHY_FREQ and the
- * attributes determining channel width.
+ * attributes determining channel width.  This indication may also be
+ * sent when a remotely-initiated switch (e.g., when a STA receives a CSA
+ * from the remote AP) is completed;
+ *
+ * @NL80211_CMD_CH_SWITCH_STARTED_NOTIFY: Notify that a channel switch
+ * has been started on an interface, regardless of the initiator
+ * (ie. whether it was requested from a remote device or
+ * initiated on our own).  It indicates that
+ * %NL80211_ATTR_IFINDEX will be on %NL80211_ATTR_WIPHY_FREQ
+ * after %NL80211_ATTR_CH_SWITCH_COUNT TBTT's.  The userspace may
+ * decide to react to this indication by requesting other
+ * interfaces to change channel as well.
  *
  * @NL80211_CMD_START_P2P_DEVICE: Start the given P2P Device, identified by
  * its %NL80211_ATTR_WDEV identifier. It must have been created with
@@ -746,6 +757,23 @@
  * destination %NL80211_ATTR_MAC on the interface identified by
  * %NL80211_ATTR_IFINDEX.
  *
+ * @NL80211_CMD_JOIN_OCB: Join the OCB network. The center frequency and
+ * bandwidth of a channel must be given.
+ * @NL80211_CMD_LEAVE_OCB: Leave the OCB network -- no special arguments, the
+ * network is determined by the network interface.
+ *
+ * @NL80211_CMD_TDLS_CHANNEL_SWITCH: Start channel-switching with a TDLS peer,
+ * identified by the %NL80211_ATTR_MAC parameter. A target channel is
+ * provided via %NL80211_ATTR_WIPHY_FREQ and other attributes determining
+ * channel width/type. The target operating class is given via
+ * %NL80211_ATTR_OPER_CLASS.
+ * The driver is responsible for continually initiating channel-switching
+ * operations and returning to the base channel for communication with the
+ * AP.
+ * @NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH: Stop channel-switching with a TDLS
+ * peer given by %NL80211_ATTR_MAC. Both peers must be on the base channel
+ * when this command completes.
+ *
  * @NL80211_CMD_MAX: highest used command number
  * @__NL80211_CMD_AFTER_LAST: internal use
  */
@@ -922,6 +950,14 @@ enum nl80211_commands {
 
NL80211_CMD_GET_MPP,
 
+   NL80211_CMD_JOIN_OCB,
+   NL80211_CMD_LEAVE_OCB,
+
+   NL80211_CMD_CH_SWITCH_STARTED_NOTIFY,
+
+   NL80211_CMD_TDLS_CHANNEL_SWITCH,
+   NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH,
+
/* add new commands above here */
 
/* used to define NL80211_CMD_MAX below */
@@ -1616,9 +1652,9 @@ enum nl80211_commands {
  * @NL80211_ATTR_TDLS_PEER_CAPABILITY: flags for TDLS peer capabilities, u32.
  * As specified in the enum nl80211_tdls_peer_capability.
  *
- * @NL80211_ATTR_IFACE_SOCKET_OWNER: flag attribute, if set during interface
+ * @NL80211_ATTR_SOCKET_OWNER: Flag attribute, if set during interface
  * creation then the new interface will be owned by the netlink socket
- * that created it and will be destroyed when the socket is closed
+ * that created it and will be destroyed when the socket is closed.
  *
  * @NL80211_ATTR_TDLS_INITIATOR: flag attribute indicating the current end is
  * the TDLS link initiator.
@@ -1648,6 +1684,11 @@ enum nl80211_commands {
  * @NL80211_ATTR_SMPS_MODE: SMPS mode to use (ap mode). see
  * enum nl80211_smps_mode.
  *
+ * @NL80211_ATTR_OPER_CLASS: operating class
+ *
+ * @NL80211_ATTR_MAC_MASK: MAC address mask
+ *
+ * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
  */
@@ -1983,7 +2024,7 @@ enum nl80211_attrs {
 
NL80211_ATTR_TDLS_PEER_CAPABILITY,
 
-   NL80211_ATTR_IFACE_SOCKET_OWNER,
+   NL80211_ATTR_SOCKET_OWNER,
 
NL80211_ATTR_CSA_C_OFFSETS_TX,
NL80211_ATTR_MAX_CSA_COUNTERS,
@@ -2000,15 +2041,21 @@ enum nl80211_attrs {
 
NL80211_ATTR_SMPS_MODE,
 
+   NL80211_ATTR_OPER_CLASS,
+
+   NL80211_ATTR_MAC_MASK,
+
/* add attributes here, update the policy in nl80211.c */
 
__NL80211_ATTR_AFTER_LAST,
+   NUM_NL80211_ATTR = __NL80211_ATTR_AFTER_LAST,
NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1
 };
 
 /* source-level API compatibility */
 #define NL80211_ATTR_SCAN_GENERATION NL80211_ATTR_GENERATION
 #defineNL80211_ATTR_MESH_PARAMS NL80211_ATTR_MESH_CONFIG
+#define NL80211_ATTR_IFACE_SOCKET_OWNER NL80211_ATTR_SOCKET_OWNER
 
 /*

[PATCH iw 2/2] add WoWLAN net-detect trigger

2014-11-27 Thread Luca Coelho
From: Luciano Coelho luciano.coe...@intel.com

Adds a netdetect option to the wowlan triggers that allows the user to
request network detection to be started when the device goes to
suspend mode.

Signed-off-by: Luciano Coelho luciano.coe...@intel.com
---
 event.c  |  30 ++-
 info.c   |   3 ++
 wowlan.c | 177 ++-
 3 files changed, 207 insertions(+), 3 deletions(-)

diff --git a/event.c b/event.c
index 25f8099..99f9f15 100644
--- a/event.c
+++ b/event.c
@@ -200,7 +200,8 @@ static void parse_mic_failure(struct nlattr **attrs)
 
 static void parse_wowlan_wake_event(struct nlattr **attrs)
 {
-   struct nlattr *tb[NUM_NL80211_WOWLAN_TRIG];
+   struct nlattr *tb[NUM_NL80211_WOWLAN_TRIG],
+   *tb_match[NUM_NL80211_ATTR];
 
printf(WoWLAN wakeup\n);
if (!attrs[NL80211_ATTR_WOWLAN_TRIGGERS]) {
@@ -227,6 +228,33 @@ static void parse_wowlan_wake_event(struct nlattr **attrs)
printf(\t* 4-way handshake\n);
if (tb[NL80211_WOWLAN_TRIG_RFKILL_RELEASE])
printf(\t* RF-kill released\n);
+   if (tb[NL80211_WOWLAN_TRIG_NET_DETECT_RESULTS]) {
+   struct nlattr *match, *freq;
+   int rem_nst, rem_nst2;
+
+   printf(\t* network detected\n);
+   nla_for_each_nested(match,
+   tb[NL80211_WOWLAN_TRIG_NET_DETECT_RESULTS],
+   rem_nst) {
+   nla_parse(tb_match, NUM_NL80211_ATTR, nla_data(match),
+ nla_len(match),
+ NULL);
+   printf(\t\tSSID: \);
+   /* printf(len %d %p\n, 
nla_len(tb_match[NL80211_ATTR_SSID]), */
+   /*nla_data(tb_match[NL80211_ATTR_SSID])); */
+   print_ssid_escaped(nla_len(tb_match[NL80211_ATTR_SSID]),
+  
nla_data(tb_match[NL80211_ATTR_SSID]));
+   printf(\);
+   if (tb_match[NL80211_ATTR_SCAN_FREQUENCIES]) {
+   printf( freq(s):);
+   nla_for_each_nested(freq,
+   
tb_match[NL80211_ATTR_SCAN_FREQUENCIES],
+   rem_nst2)
+   printf( %d, nla_get_u32(freq));
+   }
+   printf(\n);
+   }
+   }
if (tb[NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211]) {
uint8_t *d = nla_data(tb[NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211]);
int l = nla_len(tb[NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211]);
diff --git a/info.c b/info.c
index 7499290..d934c58 100644
--- a/info.c
+++ b/info.c
@@ -455,6 +455,7 @@ broken_combination:
[NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST] = { .type = 
NLA_FLAG },
[NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE] = { .type = 
NLA_FLAG },
[NL80211_WOWLAN_TRIG_RFKILL_RELEASE] = { .type = 
NLA_FLAG },
+   [NL80211_WOWLAN_TRIG_NET_DETECT] = { .type = NLA_FLAG },
[NL80211_WOWLAN_TRIG_TCP_CONNECTION] = { .type = 
NLA_NESTED },
};
struct nl80211_pattern_support *pat;
@@ -492,6 +493,8 @@ broken_combination:
printf(\t\t * wake up on 4-way handshake\n);
if (tb_wowlan[NL80211_WOWLAN_TRIG_RFKILL_RELEASE])
printf(\t\t * wake up on rfkill release\n);
+   if (tb_wowlan[NL80211_WOWLAN_TRIG_NET_DETECT])
+   printf(\t\t * wake up on network detection\n);
if (tb_wowlan[NL80211_WOWLAN_TRIG_TCP_CONNECTION])
printf(\t\t * wake up on TCP connection\n);
}
diff --git a/wowlan.c b/wowlan.c
index fc8e2c3..b52a4f9 100644
--- a/wowlan.c
+++ b/wowlan.c
@@ -181,6 +181,163 @@ static int wowlan_parse_tcp_file(struct nl_msg *msg, 
const char *fn)
return err;
 }
 
+static int wowlan_parse_net_detect(struct nl_msg *msg, int *argc, char ***argv)
+{
+   struct nl_msg *matchset = NULL, *freqs = NULL;
+   struct nlattr *nd, *match = NULL;
+   enum {
+   ND_TOPLEVEL,
+   ND_MATCH,
+   ND_FREQS,
+   } parse_state = ND_TOPLEVEL;
+   int c  = *argc;
+   char *end, **v = *argv;
+   int err = 0, i = 0;
+   unsigned int freq, interval = 0;
+   bool have_matchset = false, have_freqs = false;
+
+   nd = nla_nest_start(msg, NL80211_WOWLAN_TRIG_NET_DETECT);
+   if (!nd) {
+   err = -ENOBUFS;
+   goto out;
+   }
+
+   matchset = nlmsg_alloc();
+   if (!matchset) {
+   err = -ENOBUFS;
+   goto out;
+   }
+
+   freqs 

Re: [PATCH iw 2/2] add WoWLAN net-detect trigger

2014-11-27 Thread Arend van Spriel

On 11/27/14 22:06, Luca Coelho wrote:

From: Luciano Coelholuciano.coe...@intel.com

Adds a netdetect option to the wowlan triggers that allows the user to
request network detection to be started when the device goes to
suspend mode.


So it can start heating up my backpack when I get home. Nice ;-)

Arend


Signed-off-by: Luciano Coelholuciano.coe...@intel.com
---
  event.c  |  30 ++-
  info.c   |   3 ++
  wowlan.c | 177 ++-
  3 files changed, 207 insertions(+), 3 deletions(-)

diff --git a/event.c b/event.c
index 25f8099..99f9f15 100644
--- a/event.c
+++ b/event.c
@@ -200,7 +200,8 @@ static void parse_mic_failure(struct nlattr **attrs)

  static void parse_wowlan_wake_event(struct nlattr **attrs)
  {
-   struct nlattr *tb[NUM_NL80211_WOWLAN_TRIG];
+   struct nlattr *tb[NUM_NL80211_WOWLAN_TRIG],
+   *tb_match[NUM_NL80211_ATTR];

printf(WoWLAN wakeup\n);
if (!attrs[NL80211_ATTR_WOWLAN_TRIGGERS]) {
@@ -227,6 +228,33 @@ static void parse_wowlan_wake_event(struct nlattr **attrs)
printf(\t* 4-way handshake\n);
if (tb[NL80211_WOWLAN_TRIG_RFKILL_RELEASE])
printf(\t* RF-kill released\n);
+   if (tb[NL80211_WOWLAN_TRIG_NET_DETECT_RESULTS]) {
+   struct nlattr *match, *freq;
+   int rem_nst, rem_nst2;
+
+   printf(\t* network detected\n);
+   nla_for_each_nested(match,
+   tb[NL80211_WOWLAN_TRIG_NET_DETECT_RESULTS],
+   rem_nst) {
+   nla_parse(tb_match, NUM_NL80211_ATTR, nla_data(match),
+ nla_len(match),
+ NULL);
+   printf(\t\tSSID: \);
+   /* printf(len %d %p\n, 
nla_len(tb_match[NL80211_ATTR_SSID]), */
+   /*nla_data(tb_match[NL80211_ATTR_SSID])); */
+   print_ssid_escaped(nla_len(tb_match[NL80211_ATTR_SSID]),
+  
nla_data(tb_match[NL80211_ATTR_SSID]));
+   printf(\);
+   if (tb_match[NL80211_ATTR_SCAN_FREQUENCIES]) {
+   printf( freq(s):);
+   nla_for_each_nested(freq,
+   
tb_match[NL80211_ATTR_SCAN_FREQUENCIES],
+   rem_nst2)
+   printf( %d, nla_get_u32(freq));
+   }
+   printf(\n);
+   }
+   }
if (tb[NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211]) {
uint8_t *d = nla_data(tb[NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211]);
int l = nla_len(tb[NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211]);
diff --git a/info.c b/info.c
index 7499290..d934c58 100644
--- a/info.c
+++ b/info.c
@@ -455,6 +455,7 @@ broken_combination:
[NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST] = { .type = 
NLA_FLAG },
[NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE] = { .type = 
NLA_FLAG },
[NL80211_WOWLAN_TRIG_RFKILL_RELEASE] = { .type = 
NLA_FLAG },
+   [NL80211_WOWLAN_TRIG_NET_DETECT] = { .type = NLA_FLAG },
[NL80211_WOWLAN_TRIG_TCP_CONNECTION] = { .type = 
NLA_NESTED },
};
struct nl80211_pattern_support *pat;
@@ -492,6 +493,8 @@ broken_combination:
printf(\t\t * wake up on 4-way handshake\n);
if (tb_wowlan[NL80211_WOWLAN_TRIG_RFKILL_RELEASE])
printf(\t\t * wake up on rfkill release\n);
+   if (tb_wowlan[NL80211_WOWLAN_TRIG_NET_DETECT])
+   printf(\t\t * wake up on network detection\n);
if (tb_wowlan[NL80211_WOWLAN_TRIG_TCP_CONNECTION])
printf(\t\t * wake up on TCP connection\n);
}
diff --git a/wowlan.c b/wowlan.c
index fc8e2c3..b52a4f9 100644
--- a/wowlan.c
+++ b/wowlan.c
@@ -181,6 +181,163 @@ static int wowlan_parse_tcp_file(struct nl_msg *msg, 
const char *fn)
return err;
  }

+static int wowlan_parse_net_detect(struct nl_msg *msg, int *argc, char ***argv)
+{
+   struct nl_msg *matchset = NULL, *freqs = NULL;
+   struct nlattr *nd, *match = NULL;
+   enum {
+   ND_TOPLEVEL,
+   ND_MATCH,
+   ND_FREQS,
+   } parse_state = ND_TOPLEVEL;
+   int c  = *argc;
+   char *end, **v = *argv;
+   int err = 0, i = 0;
+   unsigned int freq, interval = 0;
+   bool have_matchset = false, have_freqs = false;
+
+   nd = nla_nest_start(msg, NL80211_WOWLAN_TRIG_NET_DETECT);
+   if (!nd) {
+   err = -ENOBUFS;
+   goto out;
+   }
+
+   matchset = 

firmware loading fails (iwl 7260)

2014-11-27 Thread Hanno Böck
Hi,

I have an X1 Carbon laptop with an intel 7260 chip.

The automatic firmware loading doesn't work (kernel 3.17.2). I get this
in dmesg:
[1.615155] iwlwifi :03:00.0: Direct firmware load for
iwlwifi-7260-10.ucode failed with error -2

The firmware then gets loaded by the userspace helper, however as far
as I understand it (and the description of the kernel option) this is
deprecated and shouldn't be used. Also, it takes quite a while
(minutes) till the wifi is available after boot which is quite annoying.

Any idea what I should do to debug/fix this? Is this a bug? (firmware
is the latest from intel's page, 23.10.10.0)

cu,
-- 
Hanno Böck
http://hboeck.de/

mail/jabber: ha...@hboeck.de
GPG: BBB51E42


pgpzqiBXLkYqb.pgp
Description: OpenPGP digital signature


Re: firmware loading fails (iwl 7260)

2014-11-27 Thread Vladimir Zapolskiy
On 28.11.2014 01:40, Hanno Böck wrote:
 Hi,
 
 I have an X1 Carbon laptop with an intel 7260 chip.
 
 The automatic firmware loading doesn't work (kernel 3.17.2). I get this
 in dmesg:
 [1.615155] iwlwifi :03:00.0: Direct firmware load for
 iwlwifi-7260-10.ucode failed with error -2
 
 The firmware then gets loaded by the userspace helper, however as far
 as I understand it (and the description of the kernel option) this is
 deprecated and shouldn't be used. Also, it takes quite a while
 (minutes) till the wifi is available after boot which is quite annoying.
 
 Any idea what I should do to debug/fix this? Is this a bug? (firmware
 is the latest from intel's page, 23.10.10.0)
 

Most probably your rootfs is not yet mounted, when the driver attempts
to load the firmware file.

As a workaround try to compile iwlwifi as a module. When rootfs is
mounted, the module is loaded and the driver should pick up firmware.

--
With best wishes,
Vladimir
--
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] cfg80211: do not check for carrier during start_radar_detect

2014-11-27 Thread Avinash Patil
Radar detection happens before starting AP; so netdev carrier may be dormant
at this time. Remove this check from cfg80211_start_radar_detection.

Signed-off-by: Avinash Patil pat...@marvell.com
---
 net/wireless/nl80211.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 6e41777..25f68d6 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6132,9 +6132,6 @@ static int nl80211_start_radar_detection(struct sk_buff 
*skb,
if (err)
return err;
 
-   if (netif_carrier_ok(dev))
-   return -EBUSY;
-
if (wdev-cac_started)
return -EBUSY;
 
-- 
1.8.1.4

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


Re: [PATCH iw 2/2] add WoWLAN net-detect trigger

2014-11-27 Thread Luca Coelho
On Thu, 2014-11-27 at 22:29 +0100, Arend van Spriel wrote:
 On 11/27/14 22:06, Luca Coelho wrote:
  From: Luciano Coelholuciano.coe...@intel.com
 
  Adds a netdetect option to the wowlan triggers that allows the user to
  request network detection to be started when the device goes to
  suspend mode.
 
 So it can start heating up my backpack when I get home. Nice ;-)

Yeah, that's the main benefit of this feature, especially if you
configure the scan interval properly. :D

--
Luca.

--
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] mac80211: take reserved vif into account when calculating the min_def

2014-11-27 Thread Michal Kazior
On 27 November 2014 at 13:30, Emmanuel Grumbach
emmanuel.grumb...@intel.com wrote:
 When we want to calculate the minimal bandwidth needed for
 a channel context, we need to take into account vifs that
 have reserved the channel context.
 I hit an issue with iwlwifi and channel switch as a client.

 We would allocate a virgin channel context and reserve it.
 At that stage, the min_def was 20MHz.
 Then we would use it after CSA, and start transmitting, but
 the channel context was still 20MHz even if the GO was in
 40MHz. This made the firmware unhappy.

 Signed-off-by: Emmanuel Grumbach emmanuel.grumb...@intel.com
 ---
  net/mac80211/chan.c | 6 +-
  1 file changed, 5 insertions(+), 1 deletion(-)

 diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
 index 4c74e8d..769e0c5 100644
 --- a/net/mac80211/chan.c
 +++ b/net/mac80211/chan.c
 @@ -256,7 +256,8 @@ ieee80211_get_chanctx_max_required_bw(struct 
 ieee80211_local *local,
 if (!ieee80211_sdata_running(sdata))
 continue;

 -   if (rcu_access_pointer(sdata-vif.chanctx_conf) != conf)
 +   if (rcu_access_pointer(sdata-vif.chanctx_conf) != conf 
 +   sdata-reserved_chanctx-conf != conf)
 continue;

 switch (vif-type) {
 @@ -271,6 +272,7 @@ ieee80211_get_chanctx_max_required_bw(struct 
 ieee80211_local *local,
 case NL80211_IFTYPE_WDS:
 case NL80211_IFTYPE_MESH_POINT:
 width = vif-bss_conf.chandef.width;
 +   width = max(width, sdata-reserved_chandef.width);

Not really sure why this is needed in this patch?


 break;
 case NL80211_IFTYPE_UNSPECIFIED:
 case NUM_NL80211_IFTYPES:
 @@ -899,6 +901,8 @@ int ieee80211_vif_reserve_chanctx(struct 
 ieee80211_sub_if_data *sdata,
 sdata-reserved_radar_required = radar_required;
 sdata-reserved_ready = false;

 +   ieee80211_recalc_chanctx_min_def(local, new_ctx);
 +

Hmm.. Wouldn't it make sense to recalc this in
ieee80211_vif_unreserve_ chanctx() as well?


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 1/3] ath10k: embed supported chip ids in hw_params

2014-11-27 Thread Kalle Valo
Michal Kazior michal.kaz...@tieto.com writes:

 Hmm.. I have a couple of ideas:

[...]

 2. Have a dedicatd pci-specific structure:

  struct ath10k_pci_supported_chip {
u16 dev_id;
u32 chip_id;
  };

  struct ath10k_pci_supported_chip ath10k_pci_supported_chips[] = {
{ QCA988X_2_0_DEVICE_ID, QCA988X_HW_2_0_CHIP_ID_REV },
// ...
  };

 Probably the simplest and has least impact.

Yeah, this seems to be the best. Can you send v2?

-- 
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/4] cfg80211: allow usermode to query wiphy specific regdom

2014-11-27 Thread Arik Nemtsov
On Thu, Nov 27, 2014 at 5:35 PM, Luis R. Rodriguez mcg...@suse.com wrote:
 On Thu, Nov 27, 2014 at 09:12:11AM +0200, Arik Nemtsov wrote:
 On Wed, Nov 26, 2014 at 11:43 PM, Luis R. Rodriguez mcg...@suse.com wrote:
  On Wed, Nov 26, 2014 at 4:35 PM, Luis R. Rodriguez mcg...@suse.com wrote:
  We're not checking here if this was a managed wiphy or not, we
  want userspace to be able to tell if a wiphy was managed or not.
 
  Ah I see what you did, yes that is what I wanted but since you allowed
  for self managed regdomains *first* the placement of this patch in
  terms of order would mean we are not giving userspace information it
  should have needed right after this commit. After your 4th patch we do
  though. We want commits to work well linearly in history so can you
  move this patch to number 2 in the series and bump number 2 to be
  patch number 3? That way right after commit 2 we are not lying to
  userspace.
 
  The question about having userspace specify the wiphy still stands as
  I'd expect userspace asking only for a regd for a wiphy would want
  only that one, not all, or the central one.

 In general, we want to return only the regdom of the wiphy the user
 asked for. And yea, I'll fix it.

 But there's a tricky part here. In the not-self-managed case, if a
 user specifies a wiphy-idx, and there's no wiphy-regd, we'll return
 the global one.

 Hm, that's fine if its well understood by userspace that even if
 a wiphy has a specific regd (priv one) that the central one is the one that is
 used for it anyway, the wiphy regd would just be informational. It may be
 a bit odd to give the central one if the wiphy-idx has no regd in this
 case then, so just think about this a bit, wihch is why I am a bit
 inclined to just have cfg80211 not return any regd if the wiphy has
 no priv or self-manged regd.

 This is fine, since in effect, the global regd is the one used by this
 wiphy anyway.
 Essentially we want this part to just be able to add the wiphy-idx to
 wpa_s code for GET_REG, and remain backward compatible. But like I
 said above, it's the right thing to do

 Sure, you have a handle of what is needed, so just make the API very
 clear to users so they don't think that if cfg80211 returns a regd
 for a wiphy if its a priv regd that its not the one that applies
 but rather informational for what it started with.

Do you see a problem with v5 of the patches?

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